instruction
stringlengths
0
30k
You could maybe combine them into a `Locale` class, which stores both Language code and Region code, has accessors for Region and Language plus one parse function which also allows for strings like "en_gb"... That's how I've seen locales be handled in various frameworks.
VMWare Server: Best way to backup images
|vmware|backup|virtualization|
What is the best way to backup VMWare Servers (1.0.x)? The virtual machines in question are our development environment, and run isololated from the main network (so you can't just copy data from virtual to real servers). The image files are normally in use and locked when the server is running, so it is difficult...
Your server access logs should already have the request for the non-thumbnailed version of the file, so you just need to modify the log format to include the sessionid, which I presume you can map back to a user.
These two, as they stand, aren't going to refactor well because of the static methods. You'd either end up with some kind of factory method on a base class that returns an a type of that base class (which would subsequently need casting) or you'd need some kind of additional helper class. Given the amount of extr...
I am a big fan of [Google's Heapchecker][1] -- it will not catch all leaks, but it gets most of them. (**Tip**: Link it into all your unittests.) [1]: http://goog-perftools.sourceforge.net/doc/heap_checker.html
These are unvaluable online reference tools: - [Python 2.5 Quick Reference][1] - [Python Side bar][2] Other online resources for beginners: - A good python blog for beginners: [http://www.learningpython.com/][3] - [Python Video at Google Code][4] [1]: http://rgruet.free.fr/PQR25/PQR2.5.ht...
Also note a good perl idiom to use is <pre>for my $rowHR ( @records ) { my %row = %$rowHR; #or whatever... }</pre> to iterate through the list.
Java makes it possible to write database-neutral code. It allows you to reuse existing code and dramatically increase productivity. One thing I find Java Stored Procedures useful for is File IO. Java has a far richer set of File IO capabilities, allowing developers to remove files, add directories, and so on, as com...
If your friend is in the habit of pressing `^A` to get to the beginning of the line in bash, he/she is in for some surprises, since `^A` is the screen command key binding. Usually I end up with a frozen screen, possibly because of some random key I pressed after `^A` :-) In those cases I try `^A s` and `^A q` ...
|c#|xml|wcf|rss|import|
Before SCVMM, Microsoft's solution was the [Virtual Server Migration Toolkit][1]. This requires Windows Server 2003 Automated Deployment Services, which in turn can only be installed on Windows Server 2003 Enterprise Edition. It's about as far from a free tool as you can get. It only works on SP1, not SP2 (unless ADS h...
I'll probably get flamed for this, but what is the point of testing for existence if you are just going to delete it? One of my major pet peeves is an app throwing an error dialog with something like "Could not delete file, it does not exist!" <blockquote> On Error Resume Next <br /> Kill "c:\file_to_delete.txt"<...
First of all, I agree 100% with the earlier folks that said turn OFF "Load Symbols Lazily." I have two more things to add. My first suggestion sounds obvious, but the first time someone told me this I was on the verge of responding with "oh, come on, you really think I wouldn't know better...... oh." 1. Make ...
C# XML serialization gotchas
|c#|xml|serialization|
I've run into a few gotchas when doing C# XML serialization that I thought I'd share: * You can't serialize items that are read-only (like KeyValuePairs) * You can't serialize a generic dictionary. Instead, try this wrapper class (from http://weblogs.asp.net/pwelter34/archive/2006/05/03/444961.aspx): <hr/> ...
Algorithmically talking , you don't really need a temporary file : 1)read the content of the file you need to modify 2)modify the content ( as a string , assuming you have the content in a variable named content ) , like this : content = header + content 3)seek to the beginning of the file , each language has ...
From http://docs.python.org/lib/minimal-example.html : > When a setUp() method is defined, the > test runner will run that method prior > to each test. So setUp() gets run before both testA and testB, resetting i to 1 each time.
From http://docs.python.org/lib/minimal-example.html : > When a setUp() method is defined, the > test runner will run that method prior > to each test. So setUp() gets run before both testA and testB, setting i to 1 each time. Behind the scenes, the entire test object is actually being re-instantiated for each...
You probably don't want to strip the debug symbols from the shared libraries, as you may need that at some point. If you are using GDB or DDD to debug, you may be able to get away with removing the Boost source files from the Source Path so it can't trace into the functions. (Or just don't trace into them, trace ove...
What is the difference between Explicit and inplicit cursors in Oracle?
|oracle-database|plsql|
I am a bit rusty on my cursor lingo in PL/SQL. Anyone know this?
What is the difference between explicit and implicit cursors in Oracle?
Back ~2004 Microsoft did have a tool that would convert managed C++ to C++/CLI ... sort of. We ran it on a couple of projects, but to be honest the amount of work left cleaning up the project was no less than the amount of work it would have been to do the conversion by hand in the first place. I don't think the tool...
Using Javascript, how do I make sure a date range is valid?
|validation|date|javascript|
As the title states, using Javascript, how can I valid two given dates to ensure that they are a valid range?
|validation|date|javascript|
XHTML 1 specification says: [С.3. Element Minimization and Empty Element Content](http://www.w3.org/TR/xhtml1/#C_3) >> Given an empty instance of an element whose content model is not `EMPTY` (for example, an empty title or paragraph) do not use the minimized form (e.g. use `<p> </p>` and not `<p />`). [XHTML ...
If you just want to test your scheme code, I would recommend [PLT Scheme][1]. It offers a very complete environment, with debugger, help, etc., and works on most platforms. But if you also want to get an idea of how the interpreter behind the scenes works, and have Visual Studio, I would recommend [Tachy][2]. It is ...
The other answers are incorrect when they say you cannot assign to 'this'. True, you can't for a class type, but you *can* for a struct type: public struct MyValueType { public int Id; public void Swap(ref MyValueType other) { MyValueType temp = this; ...
Definitely MVC - something like this [example][1] which clearly splits things out. The problem with the Swing examples is that they seem to show the MVC all working within the swing stuff, which does not seem right to me [1]: http://www.leepoint.net/notes-java/GUI/structure/40mvc.html
Have you tried (setq tab-width 4)
You can actually do it all with GET methods. However, you'll want to use a full challenge response protocol for the logins. (You can hash on the client side using javascript. You just need to send out a unique challenge each time.) You'll also want to use SSL to ensure that no one can see the strings as they go acr...
Unlike XML and XHTML, HTML has no knowledge of the self-closing syntax. Browsers that interpret XHTML as HTML don't know that the `/` character indicates that the tag should be self-closing; instead they is interpret it like an empty attribute and the parser still thinks the tag is 'open' Just as `<script defer>` i...
Typically this behaviour is caused by the browser cache set by the site having a small or no time before expiry. On many sites, when you hit "back" you get brought back to the link you hit, as your browser is pulling the page from your cache. If this cache has not been set, a new page request is made, and the browse...
|asp.net|file|download|
|asp.net|file|download|
How to Automatically Start a Download in PHP?
|php|automation|download|
What code do you need to add in PHP to automatically have the browser download a file to the local machine when a link is visited? I am specifically thinking of functionality similar to that of download sites that prompt the user to save a file to disk once you click on the name of the software?
|php|automation|download|
How do I avoid using cursors in Sybase (T-SQL)?
|t-sql|sybase|cursor|
Imagine the scene, you're updating some legacy Sybase code and come across a cursor. The stored procedure builds up a result set in a #temporary table which is all ready to be returned except that one of columns isn't terribly human readable, it's an alphanumeric code. What we need to do, is figure out the possible ...
|t-sql|sybase|cursors|
HTML comments break down
|html|sgml|comment|
I have a page that is generated which inserts an HTML comment near the top of the page. Inside the comment is a *nix-style command. <!-- command --option value --option2 value2 --option3 --> This comment breaks the page completely. What is wrong with the comment to cause this to happen, and why is this the ...
|html|xml|comment|sgml|
|html|xml|comments|sgml|
Adapt Replace all strings in all tables to work with text
|sql-server|cursor|text|t-sql|
|sql-server|t-sql|cursor|text|
|sql-server|t-sql|text|cursors|
1. Create a generic base class (eg `AbstractCode<T>`) 1. add abstract methods like protected T GetConstructor(string code); 1. override in base classes like protected override RegionCode GetConstructor(string code) { return new RegionCode(code); } 1. Finally, ...
Getting Generated HTML in a WCF service.
|c#|wcf|
In the WCF application that I am working on, I need to access the generated source of a particular webpage (after all the AJAX calls on the page are made). I have tried using `System.Net.WebRequest` but it just brings me back the original source of the page. Is there a way to execute a page and then get the source...
> *Your links takes me to a site in* > *Russian that seems to want a userid* > *and password. Legitimate mistake, or* > *troll? Paul Tomblin* The site is in Bulgarian and you shouldn't need a password to access the list of files I linked to and download some of them. Unless of course there is an access restiction...
In addition to the cosmetic best practices, I always find it useful to run Devel::Prof on my unit test suite to check test coverage.
:!cat %| grep -c "pattern" It's not exactly vim command, but it will give you what you need from vim. You can map it to the command if you need to use it frequently.
If I recall correctly, VMWare Server has a scripting interface, available via Perl or COM. You might be able to use that to automatically pause the VMs before running the backup. If your backup software was shadow-copy aware, that might work, too.
Delphi is one language that supports virtual constructors. Typically they would be used in a class factory type scenario where you create a meta type i.e. that is a type that describes a type. You would then use that meta type to construct a concrete example of your descendant class Code would be something like.....
I've had some luck with this. I've managed to compile [this simple Direct3D example](http://www.directxtutorial.com/Tutorial9/B-Direct3DBasics/dx9B5.aspx). I used winelib for this (wine-dev package on Ubuntu). Thanks to [alastair](http://stackoverflow.com/users/9554/alastair) for pointing me to winelib. I modifie...
Copying data from one DataTable to another
|ado.net|c#|
What is the fastest way of transferring few thousand rows of data from one DataTable to another? Would be great to see some sample code snippets.
|c#|ado.net|
What is the fastest way of transferring few thousand rows of data from one DataTable to another? Would be great to see some sample code snippets. Edit: I need to explain a bit more. There is a filtering condition for copying the rows. So, a plain Copy() will not work.
I would strongly suggest you weigh up migrating from the legacy database. You'll probably find yourself in a world of pain pretty quickly. From experience, Rails and legacy schemas don't go too well together either. I don't think there's a "nice solution" to this one, I'm afraid.
XmlDocument (located in System.Xml, you will need to add a reference to the dll if it isn't added for you) is what you would use for getting the xml into C#. At that point, just .ToString(), which should give you the xml as string, then parse with the Regex.
XmlDocument (located in System.Xml, you will need to add a reference to the dll if it isn't added for you) is what you would use for getting the xml into C#. At that point, just call the InnerXml property which gives the inner Xml in string format then parse with the Regex.
lambada expressions in vb.net
|vb.net|linq|
lambda expressions in vb.net
I have something that is driving me absolutely crazy... Public Function GetAccountGroups() As IList(Of AccountGroup) Dim raw_account_groups As IList(Of AccountGroup) raw_account_groups = _repository.GetAccountGroups().ToList() Dim parents = (From ag In raw_account_group...
The original version of "Tricks of the Game Programming Gurus" has an entire chapter on implementing fixed-point math
IPC::Open2/3 are fine, but I've found that usually all I really need is [IPC::Run3](http://search.cpan.org/perldoc?IPC::Run3), which handles the simple cases really well with minimal complexity: use IPC::Run3; # Exports run3() by default run3( \@cmd, \$in, \$out, \$err ); The documentation compares ...
How are the vxWorks "kernel shell" and "host shell" different?
|embedded|vxworks|rtos|
In the vxWorks RTOS, there is a shell that allows you to issue command to your embedded system. The documentation refers to kernel shell, host shell and target shell. What is the difference between the three?
If you "already have a C# dll" you're intending to use then there must be .net already installed on the target machine. In that case, a C# win forms app need not be anywhere near 20 meg. The smallest hello world type win form would be 7 kilobytes.
I've run into this issue as well. It <a href="http://groups.google.com/group/phusion-passenger/browse_thread/thread/79474d37028f2a03">appears</a> that Passenger <a href="http://groups.google.co.uk/group/phusion-passenger/browse_thread/thread/497d605834ff2e54/d6cd1e284352018b?hl=en&lnk=st&q=passenger+apache+environment...
I've run into this issue as well. It <a href="http://groups.google.com/group/phusion-passenger/browse_thread/thread/79474d37028f2a03">appears</a> that Passenger <a href="http://groups.google.co.uk/group/phusion-passenger/browse_thread/thread/497d605834ff2e54/d6cd1e284352018b?hl=en&lnk=st&q=passenger+apache+environment...
Yes ahockley's call sets the application's printer orientation to landscape. I tried an experiment and it worked well. I know this doesn't produce a pivot table, but I didn't setup one to use, so it opens and prints a regular query. Private sub Application.Printer.Orientation = acPRORLandscape ...
It's tough to say definitively without knowing the language/compiler used. However, if you can simply pass a pointer/reference to the object that you're creating, then the size of the object itself has nothing to do with the speed of the function calls. Manipulating this data down the road could be a different story.
Some general information with regards to automated mail processing... First, the mail server "brand" itself isn't that important for broadcasting or receiving emails. All of them support the standard smtp / pop3 communications protocol. Most even have IMAP support and have some level of spam filtering. That said, ...
For Linux/BSD/Solaris: http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
I don't love the wordlist approach. For example, in /usr/share/dict/words on OSX, there are 5110 4-character words. Using two of them with a seperator character produces ~600M combinations. But if you used the character set directly with a strong random number generator, you'd have 88^9 possible passwords, 3.16e+17 com...
A VS project is it's own entity. It will build and compile by itself. A Solution is just a way to contain multiple projects. The projects don't necessarily need the other projects to compile (though, they can depend on the other projects). This just lets you conceptually group projects together into one Big Project...
Ajax and a restricted uri
|ajax|xmlhttprequest|
I would like to make an ajax call to a different server (same domain and box, just a different port.) e.g. My page is <pre> http://localhost/index.html </pre> I would like to make a ajax get request to: <pre> http://localhost:7076/?word=foo </pre> I am getting this error: <pre> Access to restricted UR...
The Spring Validation framework can be used outside of Spring MVC. What WebServices Stack are you using? If you are using Spring-WS (Spring's Web Services stack) they have special instructions on how to set up the validator here: [http://static.springframework.org/spring-ws/sites/1.5/reference/html/server.html#d0e23...
HttpOnly does very little to improve the security of web applications. For one thing, it only works in IE (Firefox "supports" it, but still discloses cookies to Javascript in some situations). For another thing, it only prevents a "drive-by" attack against your application; it does nothing to keep a cross-site scriptin...
Watch this presentation by Rasmus Lerdorf (creator of PHP). He goes into some good examples of testing PHP speed and what to look for as well as some internals that can slow things down. XDebug is one tool he uses. He also makes a very solid point about knowing what performance cost you're getting into with frameworks....