instruction
stringlengths
0
30k
|asp.net|viewstate|postback|custom-server-controls|
On my journey into the depths of custom ASP.NET control development I am obviously getting my head around the ASP.NET PostBack model and how it affects control development. I understand that controls have no "lifetime" in ASP.NET, and therefore must be re-initialized on each and every page load. We overcome this by ...
If you still want to give MooTools a second chance, I'd recommend taking a look at [Mocha UI][1]. [1]: http://mochaui.com/demo/
The reason may be the famous [box model problem](http://en.wikipedia.org/wiki/Internet_Explorer_box_model_bug). Summary: IE renders _width_ different then the standard rendering if padding and margin used with width or height.
What attributes help runtime .Net performance?
|.net|performance|runtime|
I am looking for attributes I can use to ensure the best runtime performance for my .Net application by giving hints to the loader, JIT compiler or ngen. For example we have [DebuggableAttribute][1] which should be set to not debug and not disable optimization for optimal performance. [Debuggable(false, false...
> Or should I be using a completely > hidden primary key and then the 'code' > field can be re-used? I think you have answered this pretty well yourself. If you want the user to be able to re-use the deleted codes, then you should have a separate primary key not visisble to the user. If it is important that the ...
You can try out [DebugDiag 1.1][1] [1]: http://blogs.msdn.com/tess/archive/2008/05/21/debugdiag-1-1-or-windbg-which-one-should-i-use-and-how-do-i-gather-memory-dumps.aspx
Another fun addition in 1.9 Proc functionality is Proc#curry which allows you to turn a Proc accepting n arguments into one accepting n-1. Here it is combined with the Proc#=== tip I mentioned above: it_is_day_of_week = lambda{ |day_of_week, date| date.wday == day_of_week } it_is_saturday = it_is_day_of_wee...
Another fun addition in 1.9 Proc functionality is Proc#curry which allows you to turn a Proc accepting n arguments into one accepting n-1. Here it is combined with the Proc#=== tip I mentioned above: it_is_day_of_week = lambda{ |day_of_week, date| date.wday == day_of_week } it_is_saturday = it_is_day_of_wee...
You need to set the <code>AutoPostBack</code> property of the list to true. Also, if you're populating the contents of the drop down list from the code behind (getting the contents of the list from a database, for example) - make sure you're not re-binding the data in every postback. Sometimes people are caught o...
Would FIT/ [Fitnesse][1] be suitable for what you want? FIT is an acceptance test framework rather than unit test framework, but from what you describe you would want to ensure that the three implementations have the same behavior rather than identical designs. FIT has links to [several languages][2] [1]...
perhaps the [prefuse][1] visualization toolkit might help you. It's based on Java and has many sample apps including a [graph viewer][2]. [1]: http://prefuse.org/ [2]: http://prefuse.org/gallery/graphview/
if hasattr(obj, '__call__'): pass This also fits in better with Python's "duck typing" philosophy, because you don't really care *what* it is, so long as you can call it. It's worth noting that `callable()` is being removed from Python and is not present in 3.0.
From [MSDN][1]: >This interface allows the implementation of customized equality comparison for collections. That is, you can create your own definition of equality, and specify that this definition be used with a collection type that accepts the `IEqualityComparer` interface. In the .NET Framework, constructors of ...
This is what [MSDN][1] has to say about IEqualityComparer (non-generic): >This interface allows the implementation of customized equality comparison for collections. That is, you can create your own definition of equality, and specify that this definition be used with a collection type that accepts the `IEqualityCom...
Well you could store the data in a format you could read, but which maintained the integrity of your data (XML or JSON for instance). Or (*shudder*) you could come up with your own propriatory binary format, and use that.
Is it possible to use analyic functions in Hibernate?
|hibernate|sql|
Is there a way to use sql-server like analytic functions in Hibernate? Something like select foo from Foo foo where f.x = max(f.x) over (partition by f.y)
I've had some luck with [the Java Service Wrapper][1] [1]: http://wrapper.tanukisoftware.org/doc/english/introduction.html
You can't add a sheet to a window in another process, because you have at most only the most restricted access to the windows in the other process.
How Long Do You Keep Your Code?
|code-reuse|
I took a data structures class in C++ last year, and consequently implemented all the major data structures in templated code. I saved it all on a flash drive because I have a feeling that at some point in my life, I'll use it again. I imagine *something* I end up programming will need a B-Tree, or is that just delus...
Reintroduce tells the compiler you want to call the code defined in this method as an entry point for this class and its descendants, regardless of other methods with the same name in the ancestors’ chain. Creating a `TDescendant.MyMethod` would create a potential confusion for the TDescendants in adding another m...
MySQL replication would work perfectly for this. Master -> the live server. Slave -> a different server on the same network.
Forever (or as close as I can get). That's the whole point of a source control system.
NetworkStream.Write returns immediately - how can I tell when it has finished sending data?
|c#|network-programming|
Despite the documentation, NetworkStream.Write does not appear to wait until the data has been sent. Instead, it waits until the data has been copied to a buffer and then returns. That buffer is transmitted in the background. This is the code I have at the moment. Whether I use ns.Write or ns.BeginWrite doesn't matt...
It is possible that recursion will be more expensive, depending on if the recursive function is [tail recursive][1] (last line is recursive call). Tail recursion *should* be recognized by the compiler and optimized to its iterative counterpart (while maintaining the concise, clear implementation you have in your code)...
In Python, there's a distinction between "match" and "search"; match only looks for the pattern at the start of the string, and search looks for the pattern starting at any location within the string. [Python regex docs][1] [Matching vs searching][2] [1]: http://docs.python.org/lib/module-re.html [2]: h...
If you chose to use plain `DBI` for a task that doesn't need an ORM, I strongly suggest you take a look at [DBIx::Simple][1]. It's not a replacement, but a very well designed API on top of `DBI` that makes simple things simple and complex things possible, without losing any of the flexibilty of `DBI`. Did you ...
gwt lazy loading
|gwt|lazy|
Is it possible in large GWT project, load some potion of JavaScript lazy, on the fly? Like overlays. PS: Iframes is not a solution.
are you using innodb tables? if so, you might not have auto-grow turned on and inno can't expand the table space any more. if these are myisam tables and it only happens on specific tables, i would suspect corruption. do a REPAIR on the tables in question.
Not Win32, but for .net anyway, you can do this using the following in C#: System.Media.SystemSounds.Asterisk.Play(); // Plays the Asterisk sound (used for Information (i)) // Also available: // Exclamation (Warning /!\) // Hand (aka Critical Stop - Error (X)) // Question (?) // Bee...
In your second snippet, you're getting the lock multitude of times, never releasing it. In general, the state you're waintin on can be completely expressed by a semaphore, then you can use just that. A lock structure is smaller in size, and it requires less atomic operations to check/set/release. Otherwise, if t...
Make sure that your reference is to the VB *project* and not just a DLL file.
@Hanno you should try the Levenshtein distance algorithm. Given an input string **s** and a list of of strings **t** iterate for each string **u** in **t** and return the one with the minimum Levenshtein distance. http://en.wikipedia.org/wiki/Levenshtein_distance See a Java implementation example in http://www.ja...
One option would be to use embedded Winstone servlet container instead of Tomcat as described here: http://winstone.sourceforge.net/#embedding Then you would have executable jar file running your application.
Any tool similar to Hyperterminal application?
|windows-vista|communication|virtual-com-port|hyperterminal|
> HyperTerminal is a program that you can use to connect to other > computers, Telnet sites, bulletin > board systems (BBSs), online services, > and host computers, using either your > modem, a null modem cable or Ethernet > connection. But My main usage of Hyperterminal is to communicate with hardware through ...
|windows|windows-vista|virtual-com-port|hyperterminal|
I'd log on to the server and try out your code in script/console. This will still go through the rails stack, but will allow you to quickly check that your code works the way you expect and that RMagick and ImageMagick are correctly installed without having to deploy anything. When the time comes to write your actu...
No. Primary keys can not be null.
This is not advisable. Could you use a view and map that instead? You could use COALESCE to supply a default if you are stuck with legacy data. We had lots of trouble with composite keys and I imagine null values will cause even more issues.
Here is a page that explained the solution for my use. [Silverlight 2 Drag, Drop, and Import Content Example][1] [1]: http://www.adefwebserver.com/DotNetNukeHELP/Misc/Silverlight/DragAndDropTest/
C++ Standard [5.3.5.2] declares: > If the operand has a class type, the operand is converted to a pointer type by calling the above-mentioned conversion function, and the converted operand is used in place of the original operand for the remainder of this section. In either alternative, the value of the operand of...
Try use data contract Surrogates to map unsupported object that is dot net specific or not interoperable types. See [MSDN][1] [1]: http://msdn.microsoft.com/en-us/library/ms733064.aspx
Well, from what I can tell: Class.new( StandardError ) Is creating a new class with StandardError as the base class, so it is not going to be a Amazon::AWS::Error at all. It is just defined in that module, which is probably why it is a kind_of? Amazon::AWS::Error. It probably isn't a kind_of? Amazon::AWS be...
Well, from what I can tell: Class.new( StandardError ) Is creating a new class with StandardError as the base class, so it is not going to be a Amazon::AWS::Error at all. It is just defined in that module, which is probably why it is a kind_of? Amazon::AWS::Error. It probably isn't a kind_of? Amazon::AWS be...
I use the [Understand for C++][1]. It's very handy tool to deal with large amounts of code. It also can calculate code statistics and draw call graph. Must have! [1]: http://www.scitools.com/products/understand/
I'm assuming this file is from a Maildir folder? The 'M' is just part of the unique filename and has nothing to do with the fact that the mail doesn't show up in mail clients. The 'T' at the end of the filename, after the ':' sign, however tells the IMAP server that this message is Trashed. See http://cr.yp.t...
IMAP, is a protocol for communicating to a message storage, the actual storage is standardised in other ways. The filename looks like a [Maildir][1] filename where I think does not put any meaning into the first part of the filename, but you have to check with your software manual. [1]: http://en.wikipedia.org/w...
In Irssi (terminal based IRC client, not "really" a programming language), $L means the current command line. So you can cause a stack overflow ("hit maximum recursion limit") with: /eval $L
Why would you want to? They're usually seperated for a reason afterall (often maintainability) You could always write the merge yourself - read the XSL files in, select the template items you're interested in and write to a new master XSL file...
SQL Server: Column nullability inconsistency
Is it possible to use analytic functions in Hibernate?
|sql|hibernate|
I don't know of any program that auto-generates graph visualizations *and* allows you to interactively adjust nodes, but [Graphviz][1] is a really popular tool for graph visualization. It can export to SVG so you can edit the result in your favorite vector graphics editor. [1]: http://www.graphviz.org/
Try this: `shutdown -r -t 1 -f` Alex
Assuming that info is a pointer type and that info is pointing to a valid location it is still possible that info is pointing to an address that is not in user space which is required by the function.
I would say "no". I don't think you can really get the "something you have" part of multi-factor authentication without issuing something the end user can carry with them. If you "have" something, it implies it can be lost - not many users lose their entire desktop machines. The security of "something you have", after ...
The <a href="http://tldp.org/HOWTO/Serial-HOWTO.html">Linux Serial HOWTO</a> has a lot of detailed information about serial communication in general. The more-specific <a href="http://tldp.org/HOWTO/Remote-Serial-Console-HOWTO/index.html">Linux Remote Serial Console HOWTO</a> is what you're really looking for if you wa...
How to convert numbers between Hex and Decimal in C#
|c#|
How do you convert between Hex numbers and decimal numbers in C#?
There is no way to do it in IE6/IE7/IE8. The control is drawn by the app and IE simply doesn't draw it that way. Your best bet is to implement your own drop-down via simple HTML/CSS/JavaScript if it's that important to have the the drop-down one width and the list another width.
It depends on your Database Management System. Most of them have powerfull shell tools for importing data, doing even some ETL functions. Those tools could be even very performant if they support bulk loading - usually Java JDBC can't do that so easily.
I would suggest taking the same approach as with NT services in this case. They will also start and usually not give you enough time to attach the debugger for the start-up routines. Details are described here: <http://www.debuginfo.com/articles/debugstartup.html> In short you add a registry entry for the second ...
There is no hidden features, but the language C++ is very powerful and frequently even developers of standard couldn't imagine what C++ can be used for. Actually from simple enough language construction you can write something very powerful. A lot of such things are available at www.boost.org as an examples (and h...
The problem occurs because the conditional operator doesn't look at how the value is used (assigned in this case) to determine the type of the expression -- just the true/false values. In this case, you have a *null* and an **Int32**, and the type can not be determined (there are real reasons it can't just assume **Nu...
I had the same problem with unreliability... I ended up using XMLHTTPRequest, which when used from the XPCOM component can do cross site requests. The second part of the [docs][1] detail how to instantiate the XPCOM version. If you're looking to serve HTTP request I'd take a look at the [POW][3] source code and the ...
If you are using AJAX you may also be doing a callback, not a full postback. In that case you may want to use this in your page load method: if (!IsCallback && !IsPostBack) { // Do your page setup here }
I've started reading [Silverlight 2 in Action][1] which seems pretty ok. One good thing is that because they have an early access program, you can get most of the book as an electronic copy already now. Even though the full book is not due to be released until sometime in October. [1]: http://www.manning.com/cam...
Modern C++ Design by Andrei Alexandrescu
The ADO.NET OLE DB provider is for generic data access where you don't have a specific provider for your database. Use OracleConnection et al in preference to OleDbConnection for an Oracle database connection.
I don't use a framework, I just use autotools "check" target support. Implement a "main" and use assert(s). My test dir Makefile.am(s) look like: check_PROGRAMS = test_oe_amqp test_oe_amqp_SOURCES = test_oe_amqp.c test_oe_amqp_LDADD = -L$(top_builddir)/components/common -loecommon test_oe_a...
Last year, Hallvard Vassbotn blogged about a Delphi-hack I had made for this, it became a two-part article: 1. [Hack#17: Virtual class variables, Part I][1] 2. [Hack#17: Virtual class variables, Part II][2] Yeah, it's a long read, but very rewarding. In summary, I've reused the (deprecated) VMT entry call...
Check out Oracle/Empirix e-Test.
If I recall correctly in that test framework the setUp method is run before each test
I close email and listen to soothing music. Of course, this tactic really is all about minimizing distractions.
>>> import re >>> pattern = re.compile("url") >>> string = " url" >>> pattern.match(string) >>> pattern.search(string) <_sre.SRE_Match object at 0xb7f7a6e8>
you cannot source-control the .user files because that's user specific. it contains the name of remote machine and other user dependent things. it's a vcproj related file the .suo is a sln related file and it contains the "solution user options" (startup project(s), windows position (what's docked and where, what's ...
I think code complete is going to be a hugely popular one for this question, for me it corrected many of my bad habits and re-affirmed my good practices. Also for my Perl background I really like Perl Best Practices from Damian Conway. Perl can be a nasty language if you don't use style and best practices, which is ...
I'll add that not only can you can tack on your own class **partial classes** to those emitted by the Entity Framework, but you can also write out all the **partial methods** created by the generated code. IE. There'll be a lot of partial method code which get called but the method itself in the generated code isn't...
You could use the $.ajaxComplete() and/or $.ajaxError() methods to attach function to those events. I would also recommend using the Firefox browser with the Firebug pluging, you can get a lot of information about the requests and responses.
C# Corrupt Memory Error
|c#|voip|
I cant post the code (proprietary issues) but does anyone know what types of things would cause the following error in C#. It is being thrown by a VOIP client that I wrote (using counterpath api) when the call is ended by the other client. The error is: <pre><code>System.AccessViolationException was unhandled M...
I cant post the code (proprietary issues) but does anyone know what types of things would cause the following error in C#. It is being thrown by a VOIP client that I wrote (using counterpath api) when the call is ended by the other client. The error is: <pre><code>System.AccessViolationException was unhandled M...
Despite the documentation, NetworkStream.Write does not appear to wait until the data has been sent. Instead, it waits until the data has been copied to a buffer and then returns. That buffer is transmitted in the background. This is the code I have at the moment. Whether I use ns.Write or ns.BeginWrite doesn't matt...
Well, it depends on your userbase. If you know that people will be using your site from mobile devices, it's good to have unobtrusive javascript. However, if you're trying to appeal to a tech-savvy crowd, don't bother with it. However, if you're appealing to a crowd that may be using screen readers (blind people), I...
I'd consider [K&R](http://en.wikipedia.org/wiki/The_C_Programming_Language_(book\)) a prerequisite for C++. Perhaps the best thing about C++ is that it's a better C. And of course, Stroustrup (as suggested by Mladen Jankovic) is a must read.
Is it possible to get a core dump of a running process and it's symbol table?