instruction
stringlengths
0
30k
You don't need jQuery. var s = 'john smith~123 Street~Apt 4~New York~NY~12345'; var fields = s.split(/~/); var name = fields[0]; var street = fields[1];
It is definitely useful. There could be a number of cases. For example, user deleted the original email accidentally.
[Sphinx][1] is probably the most efficient and scalable option while [SQLite - FTS3][2] is the most straightforward option. [1]: http://www.sphinxsearch.com/ [2]: http://dotnetperls.com/Content/SQLite-FTS3.aspx
The concept of sharing a data schema across multiple applications is a tough one. Invariably, your schema gets compromised for performance reasons: denormalization, which indexes to create. If you can cut the size of a row in half, you can double the number of rows per page and, likely, halve the time it takes to scan ...
Your objection is assuming that the issue was the invitation was going to the spam folder. You don't know that for sure (or, at least, you hint at such). They could want a Resend button because they want to remind the customer for payment or notify them of something again or whatever. It doesn't matter the reason becau...
I recently was annoyed by the appearance of my progress bars on XP after developing on Vista. I didn't want to try suggestions I'd seen for loading the Vista styles out of dll's, but [this article][1] gave me just what I was looking for. vista appearance - no new classes. Plus it has the glassy highlight on a timer....
Here you go: [How To Write Binary Files to the Browser Using ASP.NET and Visual C# .NET][1] [1]: http://support.microsoft.com/kb/306654
I have used "Ternary Search Tree Dictionary in C#" (http://www.codeproject.com/KB/recipes/tst.aspx) to search for similar strings. Regards, Patricio
Using Visual Studio's 'cl' from a normal command line
You need two statements. First create the column with not null. Then change the not null constraint to nullable alter table mytable add mycolumn varchar(10) not null default ('a value') alter table mytable alter column mycolumn varchar(10) null
Virtual calls themselves are more time consuming than normal calls because it has to lookup the address of the actual function to call from the vtable Additionally compiler optimizations like inlining might be hard to perform due to the lookup requirement. Situations where inlining is not possible itself can lead...
I use [Mole][1]. > Mole was designed to not only allow > the developer to view objects or data, > but to also allow the developer to > drill into properties of those objects > and then edit them. Mole allows > unlimited drilling into objects and > sub-objects. [1]: http://karlshifflett.wordpress.com/mol...
So, now with registered account :) The problem with these steps in the mentioned link is, that the look and feel and therefor the UI is set globaly in our software. So the UI is set before I'm able to manipulate the file filters.
So, now with registered account :) The problem with these steps in the mentioned link is, that the look and feel and therefor the UI is set globaly in our software. So the UI is set before I'm able to manipulate the file filters. Edit: Missunderstood the code for reproduction. The exampled works as mentioned. Tha...
Try compiling it. The compiler will report an error if ``DBBase`` doesn't implement ``IDBBase``.
I've always tried to stick to the following set of sizes to get a reasonable icon on most systems. - 16 x 16 in 16 colours - 16 x 16 in XP Style (true colour with alpha channel info) - 32 x 32 in 256 colours - 32 x 32 in XP style - 48 x 48 in XP style - 64 x 64 in XP style This produces an icon of abou...
*Path.Combine* is the way to go.
Is "Partial Function Application" a misnomer in the context of Javascript?
|javascript|language-agnostic|programming-languages|functional-programming|
A friend of mine and I were having a discussion regarding currying and partial function application in Javascript, and we came to very different conclusions as to whether either were achievable. I came up with this implementation of `Function.prototype.curry`, which was the basis of our discussion: Function.prot...
|javascript|functional-programming|
When I need to collaborate with someone in another office, it's great ... when I'm deep in thought, I have to turn it off (just like e-mail).
I think what you're looking for is/was called ObjectDumper. It uses reflection to iterate through and output all of the different properties for an object. I first heard about it while learning LINQ, and most of the examples in the Linq in Action book use it. It appears that Microsoft didn't include it in the final...
This is your friend: http://msdn.microsoft.com/en-us/library/system.io.path.combine.aspx
How do you detect dialup, broadband or wireless Internet connections in C++ for Windows?
|c++|windows-xp|mfc|internet|broadband|
I have an installation program (just a regular C++ MFC program, not Windows Installer based) that needs to set some registry values based on the type of Internet connection: broadband, dialup, and/or wireless. Right now this information is being determined by asking a series of yes or no questions. The problem is tha...
For a generic solution to your example, you can do this: public static T RetrieveByID<T>(string ID) { var fieldNames = getFieldNamesBasedOnType(typeof(T)); QueryResult qr = webservice.query( "SELECT "+fieldNames+" FROM " +tyepof(T).Name ...
If I were you I would try to avoid any statics. IMHO I always ended up with some sort of synchronization issues down the road with statics. That being said you are presenting a classic example of generic programming using templates. I will adopt the template based solution of Rob Copper presented in one of the posts ab...
How to make Pro*C cope with #warning directives?
|c|oracle-database|proc|
When I try to precompile a *.pc file that contains a #warning directive I recieve the following error: PCC-S-02014, Encountered the symbol "warning" when expecting one of the followin g: (bla bla bla). Can I somehow convince Pro*C to ignore the thing if it doesn't know what to do with it? I can't remove the #war...
You have to have a XRef table if you want to take out the cursor. Assuming you know the 100 distinct lookup values (and that they're static) it's simple to generate one by calling proc_code_xref 100 times and inserting the results into a table
If I were starting a new web project now I'd be looking at using MVC from scratch. That uses re-written URLs as standard.
I found the answer here: [http://www.themssforum.com/SVCS/Unable-execute/][1] Apperently there was something wrong with the login for 'NT AUTHORITY\NETWORK SERVICE' and it wouldn't run the jobs it owned properly. Anyone understand why this might have happened? [1]: http://www.themssforum.com/SVCS/Unable-exec...
If you are giving the user a small list of choices then stick with the radio buttons. However, if you will want want to use the combo box for dynamic or long lists. Set the style to DropDownList. private sub populateList( items as List(of UserChoices)) dim choices as UserChoices dim defaultChoice...
You can also use Fetch as an SFTP client, and then edit files directly on the server from within that. There are also SSHFS (mount an ssh folder as a Volume) options. This is in line with what stimms said - are you sure you want stuff kept in sync, or just want to edit files on the server? OS X has it's own file n...
|visual-studio|command-line|
Visual Studio 2003 and 2005 (and perhaps 2008 for all I know) require the command line user to run in the 'Visual Studio Command Prompt'. When starting this command prompt it sets various environment variables that the C++ compiler, cl, uses when compiling. Is there an easy way to run cl without having to run from ...
Visual Studio 2003 and 2005 (and perhaps 2008 for all I know) require the command line user to run in the 'Visual Studio Command Prompt'. When starting this command prompt it sets various environment variables that the C++ compiler, cl, uses when compiling. This is not always desirable. If, for example, I want to ...
@eric - Thanks for the comments. You keep saying something though, that drives me nuts: > Those run-time libraries handle the > memory management calls to the OS in a > OS independent consistent syntax and > those run-time libraries are > responsible for making malloc and new > work consistently between OSes s...
This is absolutely required. Just because your application didn't get a bounce doesn't mean that the mail actually went through. Many sites drop e-mails that trigger a spam filter rather than deliver them to a spam folder. In such a circumstance, it's conceivable that a user might in the meantime opt-out of his sites s...
You can do this with the css when you specify media as print.
You could look at some of the work being done with Self-Organizing maps (Kohonen's neural network method)... the guys at [Vienna University of Technology](http://www.ifs.tuwien.ac.at/~andi/somlib/experiments_wfb90.html#integration) have done some work on distributed calculation of their growing hierarchical map algorit...
I use the jquery [extend][1] function to extend a class prototype. For example: MyWidget = function(name_var) { this.init(name_var); } $.extend(MyWidget.prototype, { // object variables widget_name: '', init: function(widget_name) { // do initializati...
No, it's not possible. I tried compiling this: interface Interface1 { } class Class1 : Interface1 {} interface Interface2 { void Foo(Interface1 i1);} class Class2 : Interface2 {void Foo(Class1 c1) {}} And I got this error: >_'Class2' does not implement interface member 'Interface2.Foo(Inte...
[Covariance and contravariance][1] are not widely supported as of C# 3.0, except for assigning method groups to delegates. You can emulate it a bit by using private interface implementation and call public method with more specific parameters: class DBBase : IDBBase { DataTable IDBBase.getDataTabl...
Why not set up a batch file which you can invoke? Pass the path the batch file, have the batch file set the environment variable and then invoke NUnit?
Algorithm for hit test in non-overlapping rectangles
|.net|
<p>I have a collection of non-overlapping rectangles that cover an enclosing rectangle. What is the best way to find the containing rectangle for a mouse click?</p> <p>The obvious answer is to have an array of rectangles and to search them in sequence, making the search O(n). Is there some way to order them by posit...
|.net|geometry|
Using openssl encryption with Java
|openssl|java|encryption|
I have a legacy C++ module that offers encryption/decryption using the openssl library (DES encryption). I'm trying to translate that code into java, and I don't want to rely on a DLL, JNI, etc... C++ code looks like: ... des_string_to_key(reinterpret_cast<const char *>(key1), &initkey); des_string_to_key(reinterpr...
I have a legacy C++ module that offers encryption/decryption using the openssl library (DES encryption). I'm trying to translate that code into java, and I don't want to rely on a DLL, JNI, etc... C++ code looks like: des_string_to_key(reinterpret_cast<const char *>(key1), &initkey); des_string_to_key(rein...
As you mentioned, many IDEs have this functionality already, and one such IDE is Eclipse. However, unlike many other IDEs Eclipse is: A) open source B) designed to be programmable For instance, here's an article on using Eclipse's code formatting functionality from the command line: http://www.peterfriese.de...
WEB-INF is a good place to put your config file. Here's some code to get the absolute path of the directory from a servlet. public void init(ServletConfig servletConfig) throws ServletException{ super.init(servletConfig); String path = servletConfig.getServletContext().getRealPath("/WEB-INF") ...
Thanks to Hallgrim, here is the code I ended up with: ScreenCapture = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(bmp.GetHbitmap(), IntPtr.Zero, System.Windows.Int32Rect.Empty, BitmapSizeOptions.FromWidthAndHeight(width, height)); I also ended up binding to a BitmapSource instead of a BitmapI...
How can I retore svn control if the .svn folder has been damaged
|svn|
I've got a couple large checkouts where the .svn folder has become damaged so I'm getting and error, "Cleanup failed to process the following path.." And I can no longer commit or update files in that directory. I'd just delete and do the checkout again but the whole directory is over a gig. Is there a tool that ...
How can I restore svn control if the .svn folder has been damaged?
|svn|
well, easiest way would be something like: var address = theEncodedString.split(/~/) var name = address[0], street = address[1]
you can use the profiler tool to trace all existing and opening and closing connections You can open profiler from enterprise manager
there is also ClassLoader.loadClass(string) but this is not often used. and if you want to be a total lawyer about it, arrays are *technically* objects because of an array's .length property. so initializing an array creates an object.
You don't append to an a-list. You cons onto an a-list. An a-list is logically a set of associations. You don't care about the order of elements in a set. All you care about is presence or absence of a particular element. In the case of an a-list, all you care about is whether there exists an association for a g...
|c++|mfc|windows-xp|internet|broadband|
I have an installation program (just a regular C++ MFC program, not Windows Installer based) that needs to set some registry values based on the type of Internet connection: broadband, dialup, and/or wireless. Right now this information is being determined by asking a series of yes or no questions. The problem is tha...
There's a [great post here][1] about the differences between the two from a member of the IIS team. One caveat I would advise is that for WebForms, you need to be careful when using Routing. I've written a sample implementation of how you'd use [routing with WebForms][2] that addresses these concerns and hopefully h...
If you have telecommuters, not chatting online will be the death of you. Without chat, there is no interaction. Without interaction, there is no problem solving. Without problem solving, the code will suck. The chatting part does waste a lot of time and I often wish I could just pull them out and just W...
I used to. I found it a great resource to chat with people I used to work with. In our business I find that we tend to network alot and using that collective knowledge is awesome. Of course my company turned that off so they lose. I know that a certain large Bank hasd an internal AIM setup so that they can IM eac...
I've been having success with jmockit (http://jmockit.dev.java.net) It's pretty new, and so it's a bit raw and underdocumented. It uses asm (http://asm.objectweb.org/index.html) to dynamically redefine the class bytecode, so it can mock out all methods including static, private, constructors, and static initializer...
Well, after searching around and cobbling together various points from around StackOverflow (gee, I love this place already), most of the problems where already past this stage. I did manage to work out an answer to my problem though. <strong>How to create a resource.</strong> In my case, I want to create an icon...
Well, after searching around and cobbling together various points from around StackOverflow (gee, I love this place already), most of the problems were already past this stage. I did manage to work out an answer to my problem though. <strong>How to create a resource.</strong> In my case, I want to create an icon....
I use the jquery [extend][1] function to extend a class prototype. For example: MyWidget = function(name_var) { this.init(name_var); } $.extend(MyWidget.prototype, { // object variables widget_name: '', init: function(widget_name) { // do initializati...
**Yes.** It is done with a filter on the appender. Here is the appender configuration I normally use, limited to only INFO level. <appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender"> <file value="${HOMEDRIVE}\\PI.Logging\\PI.ECSignage.${COMPUTERNAME}.log" /> <appen...
I found this via [Google][1]: >You add a comma and the port number to the end of the server name. > So if you want to connect to MySqlServer.MyDomain.com on port 3821, you type... > MySqlServer.MyDomain.com,3821 [1]: http://www.avianwaves.com/Blog/Default.aspx?id=25&t=Connecting-SQL-Server-Management-S...
If you implement it I would get the user to re-enter and re-confirm the email address they entered and I would not allow it to be used more than a few times, otherwise it would be very easy to script an abuse script to bomb someones mailbox.
SqlServer create table with MySql like auto_increment primary key
|sql-server|mysql|table|auto-increment|
I want to make a table in SqlServer that will add, on insert, a auto incremented primary key. This should be an autoincremented id similar to MySql auto_increment functionality. (Below) create table foo ( user_id int not null auto_increment, name varchar(50) ) Is there a way of ...
How can I quickly identify most recently modified stored procedures in SQL Server
|sql-server|stored-procedures|migration|
|java|encryption|openssl|
I have a legacy C++ module that offers encryption/decryption using the openssl library (DES encryption). I'm trying to translate that code into java, and I don't want to rely on a DLL, JNI, etc... C++ code looks like: des_string_to_key(reinterpret_cast<const char *>(key1), &initkey); des_string_to_key(rein...
I have a legacy C++ module that offers encryption/decryption using the openssl library (DES encryption). I'm trying to translate that code into java, and I don't want to rely on a DLL, JNI, etc... C++ code looks like: des_string_to_key(reinterpret_cast<const char *>(key1), &initkey); des_string_to_key(reinterpret_...
I've been having success with jmockit (http://jmockit.dev.java.net) It's pretty new, and so it's a bit raw and underdocumented. It uses asm (http://asm.objectweb.org/index.html) to dynamically redefine the class bytecode, so it can mock out all methods including static, private, constructors, and static initializer...
**xml.etree.cElementTree**, included in the default distribution of CPython since 2.5. Lightning fast for both reading and writing XML.
Yes, absolutly, I work with most of my employees, and employers via MSN/Yahoo/Skype/.../ it makes the work easier, because I can hire the better people without having to pay them to move to me.
I see code generation harmfull as well, but only if you use 3rd party tools like codesmith and mygeneration. I have 2 stored procedures that generate my domain objects and domain interfaces Example GenerateDomainInterface 'TableName' Then I just copy and paste it into visual studio. Works pretty awesome for ...
This is a known bug with some Oracle versions when using ANSI-style joins. The correct behavior would be to get an ORA-00918 error. It's always best to specify your table names anyway; that way your queries don't break when you happen to add a new column with a name that is also used in another table.
I haven't got enough reputation to comment on the above answer but the pro version of SQL Compare has a scriptable API. Given that you have to replicate stuff to all of these databases you could use this to make an automated job to either generate the change scripts or to validate that the databases are all in sync. ...
As others have mentioned, this isn't part of the standard and is left up to the compiler to implement as it sees fit for the processor in question. For example, VC could easily implement different alignment requirements for an ARM processor than it does for x86 processors. Microsoft VC implements what is basically ...
Best practice for storing large amounts of data with J2ME
|java|java-me|rms|
I am developing a J2ME application that has a large amount of data to store on the device (in the region of 1MB but variable). I can't rely on the file system so I'm stuck the Record Management System (RMS), which allows multiple record stores but each have a limited size. My initial target platform, Blackberry, limits...
|java|java-me|rms|
|java|java-me|rms|