instruction
stringlengths
0
30k
Either: Text="<%= MyProperty %>" Or call lID.Databind() from code-behind
Call lID.Databind() from code-behind
What the EntLib calls Policy Injection, is really Aspect Oriented Programming. I wrote a post [introducing the concepts of AOP on my blog][1] a while back, maybe it'll be helpful. [1]: http://iridescence.no/post/Aspect-Oriented-Programming-A-Primer.aspx
if (s.StartsWith(",")) { s = s.Substring(1, s.Length - 1); }
SMTP commands for "AUTH NTLM"
|smtp|ntlm|
I'm failing at finding the commands I need to send to authenticate to a SMTP server using NTLM. I think it goes something like: AUTH NTLM <bae64encode something> 334 <bae64encode something> 235
Here's a sample that we used for cross-platform embeddeding of files. It's pretty simplistic, but will probably work for you. You may also need to change how it's handling linefeeds in the escapeLine function. #include <string> #include <iostream> #include <fstream> #include <cstdio> ...
[Gomoku][1] is a nice, simple game, and fun one to write AI for. [1]: http://en.wikipedia.org/wiki/Gomoku
Checkers will let you teach several methods. Simple lookahead, depth search of best-case-worst-case decisions, differences between short-term and long-term gains, and something they could continue to work on after learning what you want to teach them. Personally I think that last bit is the most critical -- there a...
You can use one of the popular Ajax libraries that do this for you natively. I like [Prototype][1]. You can just add evalScripts:true as part of your Ajax call and it happens automagically. [1]: http://www.prototypejs.org/
For checking the cross browser and cross platform look of your site, [browershots.org][1] is maybe the best free tool that can safe a lot of time and costs. [1]: http://browsershots.org
JAD is an excellent option if you want readable Java code as a result. If you really want to dig into the internals of the `.class` file format though, you're going to want `javap`. It's bundled with the JDK and allows you to "decompile" the hexadecimal bytecode into readable ASCII. The language it produces is still...
ArrayList is *not* thread-safe. From the relevant [Javadoc][1]: > Note that this implementation is not > synchronized. If multiple threads > access an ArrayList instance > concurrently, and at least one of the > threads modifies the list > structurally, it must be synchronized > externally. If you need a th...
How do you start running the program over again in gdb with 'target remote'?
|gdb|debugging|
When you're doing a usual <tt>gdb</tt> session on an executable file on the same computer, you can give the <tt>run</tt> command and it will start the program over again. When you're running <tt>gdb</tt> on an embedded system, as with the command <tt>target localhost:3210'</tt>, how do you start the program over aga...
|embedded|debugging|gdb|
You can look at [Building Skills in Python][1], also. It presumes some level of experience in programming. If you're really new, try [Building Skills in Programming][2]. It includes a lot of background and fundamentals. [1]: http://homepage.mac.com/s_lott/books/python.html [2]: http://homepage.mac.com/s_...
Stored procedures are better, in my view, because they can have an independent security configuration from the underlying tables. This means you can allow specific operations without out allowing writes/reads to specific tables. It also limits the damage that people can do if they discover a SQL injection exploit.
you'd better read this: http://msdn.microsoft.com/en-us/library/aa730880(VS.80).aspx in my opinion it depends on what you are developing
you'd better read this: <http://msdn.microsoft.com/en-us/library/aa730880(VS.80).aspx> in my opinion it depends on what you are developing
The customization of the error page is not very easy (or flexible). You can see an example here: [http://blogs.msdn.com/jingmeili/archive/2007/04/08/how-to-create-your-own-custom-404-error-page-and-handle-redirect-in-sharepoint-2007-moss.aspx][1] The web.config can be changed. I used my own HttpModules in additio...
Compression and minify-ing (removing whitespace) are a start. Additionally: 1. Combine all of your JavaScript includes into a single file. That way the browser can download the source in a single request to server. Make this part of your build process. 2. Turn caching on at the web-server level using the [cach...
Compression and minify-ing (removing whitespace) are a start. Additionally: 1. Combine all of your JavaScript and CSS includes into a single file. That way the browser can download the source in a single request to server. Make this part of your build process. 2. Turn caching on at the web-server level using t...
There is a command available for this on the sqlite command line. .tables ?PATTERN? List names of tables matching a LIKE pattern Which converts to the following SQL SELECT name FROM sqlite_master WHERE type IN ('table','view') AND name NOT LIKE 'sqlite_%' UNION ALL SELECT na...
Not a full answer, but you **don't have to parse** your own XML. It will hurt performance and reliability. But definitely make sure it is **well-formed**. It shouldn't be very hard if you generate it by hand or using general-purpose tools. Or maybe your included HTML ruins it?
To obtain data for given ISBN number you need to interact with some online service like [isbndb][1]. One of the best sources for bibliographic information is Amazon web service. It provides you with all bibliographic info + book cover. [1]: http://isbndb.com
Check out [ISBN DB API][1]. It's a simple REST-based web service. Haven't tried it myself, but a friend has had successful experiences with it. It'll give you book title, author information, and depending on the book, number of other details you can use. [1]: http://isbndb.com/docs/api/index.html
You might want to look into [LibraryThing][1], it has an [API][2] that would [do what you want][3] and they handle things like mapping multiple ISBNs for different editions of a single "work". [1]: http://www.librarything.com/ [2]: http://www.librarything.com/services/ [3]: http://www.librarything.com/serv...
What are you trying to do with reflection? <br> You can use the Boost [type traits][1] and [typeof][2] libraries as a limited form of compile-time reflection. That is, you can inspect and modify the basic properties of a type passed to a template. [1]: http://www.boost.org/doc/libs/1_36_0/libs/type_traits/doc/...
In our office, our CTO has categorically banned the use of the var keyword, for the same reasons that you have stated. Personally I find the use of var only valid in new object declarations, since the type of the object is obvious in the statement itself. For LINQ queries, you can resolve results to: IEnum...
Is this as simple as spelling? or is there just typos in the question? Sometimes you write `rebuildThumbnail` and sometimes you write `rebildThumbnail` The methods you are trying to override with advice are not final methods in the MVC framework, so whilst bpapas answer is useful, it is not the problem in this case...
Is this as simple as spelling? or are there just typos in the question? Sometimes you write `rebuildThumbnail` and sometimes you write `rebildThumbnail` The methods you are trying to override with advice are not final methods in the MVC framework, so whilst bpapas answer is useful, it is not the problem in this cas...
Is this as simple as spelling? or are there just typos in the question? Sometimes you write `rebuildThumbnail` and sometimes you write `rebildThumbnail` The methods you are trying to override with advice are not final methods in the MVC framework, so whilst bpapas answer is useful, my understanding is that this is ...
We did actually use *sasb*'s idea for one site. It was a medical software web app to run a doctor's office. However, many of our clients were surgeons who used lots of different workstations, including semi-public terminals. So, they wanted to make sure that a doctor who doesn't understand the implication of auto-saved...
string t = ",liger, unicorn, snipe".TrimStart(new char[] {','});
The same way as everywhere else: [string.trim][1] [1]: http://msdn.microsoft.com/en-us/library/d4tt83f9.aspx
The Control.DesignMode property is probably what you're looking for. It tells you if the control's parent is open in the designer. In most cases it works great, but there are instances where it doesn't work as expected. First, it doesn't work in the controls constructor. Second, DesignMode is false for "grandchild"...
string s = ",liger, tiger"; if (s.Substring(0, 1) == ",") s = s.Substring(1);
For a question that vague, I can answer is open MS Access, and click the mouse a few times.
For a question that vague, all that I can answer is open MS Access, and click the mouse a few times.
For a question that vague, all that I can answer is open MS Access, and click the mouse a few times. On second thought: Use the "WhereCondition" argument of the "OpenForm" method
If the language is dead simple like just VERB NOUN then splitting by hand works well. If it's more complex, you should really look into a tool like ANTLR or JavaCC. I've got a tutorial on ANTLR (v2) at http://javadude.com/articles/antlrtut which will give you an idea of how it works.
Terminating a Python script
|python|termination|
I am aware of the die() command in PHP which stops a script early, how can I do this in Python?
Did you mean trim all instances of "," in that string? In which case, you can do: s = s.Replace(",", "");
[Dreaming in Code][1] Has probably had the most profound impact in the last 6 months. [1]: http://www.amazon.ca/Dreaming-Code-Programmers-Transcendent-Software/dp/1400082471/ref=pd_bbs_3?ie=UTF8&s=books&qid=1221595779&sr=8-3
I recall using it, and a little bit of googling suggests that function __call($method_name, $parameters, &$return) { $return_value = "You called ${method_name}!"; } as a member function will do the job.
If you use Eclipse, it offers support for Javadocs. For example, hovering your mouse over a method call will display a tooltip showing you the Javadoc for that method. Documentation for the core Java classes are supported out of the box. However, if your project uses any additional libraries (JAR files), some config...
I was able to get the solution from somewhere else and here it is: regsvr32 %windir%\system32\inetsrv\inetmgr.dll
Which type of external drives are good for SQL backup files?
|sql-server|
As a part of database maintenance we are thinking of taking daily backups onto an external/firewall drives. Are there any specific recommended drives for the frequent read/write operations from sql server 2000 to take backups?
As a part of database maintenance we are thinking of taking daily backups onto an external/firewire drives. Are there any specific recommended drives for the frequent read/write operations from sql server 2000 to take backups?
Is it possible that the script you run is called random.py itself?
jd-gui is the best decompiler at the moment. it can handle newer features in Java, as compared to the getting-dusty JAD. http://java.decompiler.free.fr/
In addition to what was said, a lot of LISP goodness is based on guaranteed lack of side-effects and using built-in data structures. Both rarely hold in real world. ML is probably better functional base.
You are allowed to make changes to the `*.aspx` file while it runs, and you can hit refresh on your web instance to see those changes immediately. However, you cannot make changes to the `*.cs/*.vb` or `*.designer.cs/*.designer.vb` files while the program runs.
This is By Design(tm), as you can see on [Connect][1] by the SQL Server team's response to a similar question. Yes, this is a bit of an issue for some who hoped raiseerror with a high severity (like 16) would be the same as a sql execution error - it's not. Your workaround is just about what you need to do, and u...
To my knowledge, there isn't a command that will give you exactly what you want. In looking what the update command does, there is no single alternative in Perforce. I think that the closest that you will come will be to use the 'p4 fstat' command and parse the output from there to get the information that you need. ...
The conventions for Class and Package naming as far as I've heard: The package structure should use the "flipped domain" naming, with lowercase folders and CamelCAsed class names. IE: import com.yourdomain.nameofsubfolder.YourSpecialClass; This is reflected in all of the packages shipped with Flash and Flex...
How do I convert dos files to linux files in vim?
|vim|editor|linux|
If I open files I created in windows, the lines all end with ^M. How do I delete them all in once?
|linux|vim|editor|file|
If I open files I created in windows, the lines all end with ^M. How do I delete them all in once?
Mocking can be useful in some kind of project. But, sometimes mocking is very time consuming and the ROI of it is low.
I would argue that using an OR mapper will increase readability and maintainability of your applications source code, while using SP will increase the performance of the application.
Stored procedures hands down. OR Mappers are language specific, and often add graphic slowdowns. Stored procedures means you're not limited by the language interface, and you can merely tack on new interfaces to the database in forwards compatible ways. My personal opinion of OR Mappers is their existence highl...
Speaking as a CEH, learn the CEH material first. This will expose you to a variety of tools and platforms used to mount various kinds of attacks. Once you understand your target well, look into the capabilities of the tools and platforms already available (the previously mentioned metasploit framework is very thorough ...
Troubleshooting Timeout SqlExceptions
|sql-server|ado.net|sqlexception|
I have some curious behavior that I'm having trouble figuring out why is occurring. I'm seeing intermittent timeout exceptions. I'm pretty sure it's related to volume because it's not reproducible in our development environment. As a bandaid solution, I tried upping the sql command timeout to sixty seconds, but as I...
You can try using ieHTTPHeaders to see what is going on behind the scenes. Do you have any events applied to your submit button? Are you doing a custom submit button that is a hyperlink with an href like "javascript:void(0)" and an event attached that submits the form?
I know this isn't a direct answer to what you're looking for but if you haven't looked at it yet I'd recommend checking out [CMS made simple][1]. It has much less bloat than other CMS's and is fast and efficient. It's open source so it may be a good reference point for any questions you will run into. [1]: http:...
",liger, unicorn, snipe".Trim(',') -> "liger, unicor, snipe"
Within XP, I have often found that by adding/modifying static routes, I can typically accomplish what I need in such cases. Of course, there are other 'high level' COTS tools/firewalls that might provide you a better interface. One caveat with modifying routes - VPN tunnels are not too happy about chnages ...
Try string.Trim(',') and see if that does what you want.
Is GCJ (GNU Compiler for Java) a viable tool for publishing a webapp?
|java|gcj|
Is it really viable to use GCJ to publish server-side applications? Webapps? My boss is convinced that compiling our (***my***) webapp into a binary executable is a brilliant idea. (Then again, he likes nice, small simple things with blinky lights that he can understand.) He instinctively sees no issues with th...
I had the same concern when I started to use *var* keyword. However I got used to it over time and not going to go back to explicit variable types. Visual Studio's compiler\intellisense are doing a very good job to make work with implicitly typed variables much easier. I think that following proper naming conv...
I had the same concern when I started to use *var* keyword. However I got used to it over time and not going to go back to explicit variable types. Visual Studio's compiler\intellisense are doing a very good job on making work with implicitly typed variables much easier. I think that following proper naming co...
I think the use of var should be coupled with wisely-chosen variable names. I have no problem using var in a foreach statement, provided it's not like this: foreach (var c in list) { ... } If it were more like this: foreach (var customer in list) { ... } ... then someone reading the code would be ...
I think the use of var should be coupled with wisely-chosen variable names. I have no problem using var in a foreach statement, provided it's not like this: foreach (var c in list) { ... } If it were more like this: foreach (var customer in list) { ... } ... then someone reading the code would be...
Someone doesn't like criticism of var.. All answers downmodded.. oh well.. @Jon Limjap: I know. :) What I meant was that the readability is degraded like it is in VB6. I don't like to rely on Intellisense to figure out what type a given variable is. I want to be able to figure it out using the source alone. Nami...
Bit shifts are usually very fast: y = 0xFF3B * (int32_t) x >> 16; This is probably better written as: y = (0.997 * 0x10000) * (int32_t)x >> 16; A good compiler will generate equivalent output. If your integers are signed, the constants should be changed to 0x8000 and 15.
Have a look at Assembly.GetTypes() method. It returns all the types that can be found in an assembly. All you have to do is to iterate through every returned type and check if it implements neccesary interface. On of the way to do so is using Type.IsAssignableFrom method. Here is the example. myInterface is the i...
try using split list($hh,$mm,$ss)= split(':',$duration);
It doesn't look like you've declared $name. Also, try removing bind_result() and fetch() so it reads something like this: $statement->execute(); $statement->store_result(); printf("Number of rows: %d.\n", $statement->num_rows);
this should do the trick string.scan(/regex/) http://www.ruby-doc.org/core/classes/String.html#M000827
WPF Data Triggers and Story Boards
|wpf|animation|expression-blend|
I'm trying to trigger a progress animation when ever the ViewModel/Presentation Model is Bussy. I have a IsBussy Property, and the ViewModel is set as the DataContext of the UserControl. What is the best way to trigger a "progressAnimation" story board when the IsBussy property is true? Blend only let med add Event-Tri...
One little change could be: $vals = explode(':', $duration); if ( $vals[0] == 0 ) $result = "{$vals[1]} minutes, {$vals[2]} seconds"; else $result = "{$vals[0]} hours, {$vals[1]} minutes, {$vals[2]} seconds";
There are three steps to complete software: 1. Make it work 2. Make it right 3. Make it fast Tests get you #1. Your code is not done just because the tests have passed. Preferably you have some concept of project structure (Utilities, commonly accessed objects, layers, framework) before you start writing y...
I used to type in hex-tables from a magazine and then a a short basic application to unpack the data into assembly code -- couldn't make head nor tale of it for ages until I discovered I wasn't actually coding at all! I then moved onto Z80 assembly on a College owned CPM mini system. Programming the Speccy was neve...
Answering just your second question: The JVM is just an abstract machine and execution model. So targetting it with a compiler is just the same as any other machine and execution model that a compiler might target, be it implemented in hardware (x86, CELL, etc) or software (parrot, .NET). The JVM is fairly simple,...