instruction
stringlengths
0
30k
Attempting to parse HTML with regular expressions is generally an *extremely* bad idea. Use a parser instead, there should be one available for your chosen language.
Attempting to parse HTML with regular expressions is generally an *extremely* bad idea. Use a parser instead, there should be one available for your chosen language. You **might** be able to get away with something like this: </?tag[^>]*> But it depends on exactly what you're doing. For example, that won't...
Attempting to parse HTML with regular expressions is generally an *extremely* bad idea. Use a parser instead, there should be one available for your chosen language. You **might** be able to get away with something like this: </?tag[^>]*?> But it depends on exactly what you're doing. For example, that won'...
I agree for applications. Most people that use multiple levels of namespaces (in my experience) come from a Java or .NET background where the noise is significantly less. I find that good class prefixes can take the place of multiple levels of namespaces. But I have seen good use of multiple namespace levels in bo...
Apple Cover-flow effect using jQuery or other library?
|jquery|js|
Does anyone know how to achieve the cover-flow effect using JS to scroll through a bunch of images. I'm not talking about the 3d rotating itunes cover-art, but the effect that happens when you hit the space bar in a folder of documents, allowing you to preview them in a lightbox fashion.
|javascript|jquery|client-side-scripting|
It's the same unless you need to refer to the returned objects by taLookupCode.GetDataByCodeAndValue("EmpStatus", "FULL") or Item(0) multiple times. Otherwise, you don't know if the runtime for this function is log(n) or n, so for the best bet, I would assign a reference to it.
I don't know if it's the "ultimate" program for drawing database models, but I use [Visio][1]. Unfortunately, it only runs in Windows. On the upside, I can create my own shapes, or modify existing ones, and save them in collections called stencils. I can also make my shapes "smart" by programming them to do various ...
Does the JVM prevent tail call optimizations?
|java|jvm|scala|tail-recursion|
I saw this on a [question][1]: > Scala in particular doesn't support tail-call elimination except in self-recursive functions, which limits the kinds of composition you can do (this is a fundamental limitation of the JVM). Is this true? If so, what is it about the JVM that creates this fundamental limitation? ...
A whiteboard (and camera to take a picture afterwards)
Real-world examples of recursion
|education|recursion|
Can anyone suggest **real-world** problems where a recursive approach is the natural solution besides DFS? (I don't consider towers-of-Hanoi, fibonacci sequence, or factorial real-world problems. They are a bit contrived in my mind.)
If you want to determine wheter to add data or not: don't worry, send will block until the data is in the queue. If you don't want it to block, you can tell it to send(2): send(socket, buf, buflen, MSG_DONTWAIT); But this only works on Linux. You can also set the socket to non-blocking: fcntl(socket...
Sometimes I combine the state pattern with a stack. It works well for hierarchical structures; a parent element knows what state to push onto the stack to handle a child element, but a child doesn't have to know anything about its parent. In other words, the child doesn't know what the next state is, it simply sign...
How about anything involving a directory structure in the file system. Recursively finding files, deleting files, creating directories, etc.
DIA is not bad, and there are tools to actually generate some code from some types of models. If you are using PostgreSQL, there is even a tool for going the other way, pg-autodoc. DIA is available for Unix, and I believe Windows as well.
I don't think using **like** statement abusively is a good idea. And I believe the performance of lucene will be better than database.
Probably you should use lucene, unless the SQL search is very performant. We are right now moving to Solr (based on Lucene) because our search queries are inherently slow, and cannot be sped up with our database.... If you have reasonably large tables, your search queries will start to get really slow unless the DB ...
Any one using lucene?
|lucene|
I'm using lucene in my project. Here is my questoin: should I use lucene to replace the whole search module which has been implemented with sql using a large number of `like` statement and accurate search by id or sth, or should I just use lucene in fuzzy search(i mean full text search)?
What is the best search approach using Lucene?
|search|lucene|
I'm using lucene in my project. Here is my question: should I use lucene to replace the whole search module which has been implemented with sql using a large number of `like` statement and accurate search by id or sth, or should I just use lucene in fuzzy search(i mean full text search)?
This would be your SQL Server query: SELECT [NAME] FROM sysobjects WHERE xType = 'U' AND --specifies a user table object id in ( SELECT sd.depid FROM sysobjects so, sysdepends sd...
I quite liked using the Apache POI Project HSSF library ([http://poi.apache.org/][1]) - it was fairly easy to use. I didn't use it in that much depth, but it seemed fairly powerful. Also, there's JExcelAPI ([http://sourceforge.net/projects/jexcelapi/][2]) which I've not used. [1]: http://poi.apache.org/ [2]: ...
Here's a [solution][1]. The second easiest solution after -r (which is to specify a From: header and separate it from the body by a newline like this $mail -s "Subject" destination@example.com From: Joel <joel@example.com> Hi! . works in only a few mail versions, don't know what vers...
I've used python with SVN and Mercurial, and have no hassles merging. It all depends on how the diffing is done - and I suspect that it is character-by-character, which would notice the difference between one level of indent and another.
I personally would avoid all dashes and underscores and opt for [camelCase][1] or [PascalCase][2] if its in code. The Wikipedia article on camelCase explains a bit of the reasoning behind it's origins. They amount to 1. Lazy programmers who didn't like reaching for the _ key 2. Potential confusion abou...
I'm having an odd problem with my vs debugger. When running my program under the vs debugger, the debugger does not break on an unhandled exception. Instead control is returned to VS as if the program exited normally. If I look in the output tab, There is a first-chance exeption listed just before the thread termina...
I'm having an odd problem with my vs debugger. When running my program under the vs debugger, the debugger does not break on an unhandled exception. Instead control is returned to VS as if the program exited normally. If I look in the output tab, There is a first-chance exeption listed just before the thread termina...
I'm having an odd problem with my vs debugger. When running my program under the vs debugger, the debugger does not break on an unhandled exception. Instead control is returned to VS as if the program exited normally. If I look in the output tab, There is a first-chance exeption listed just before the thread termina...
I would recommend using Tortoise and do version control through Windows Explorer. I actually prefer that to Ankh in VS2008.
Please see my slides for ["A Field Guide To The Perl Command Line Options."][1] [1]: http://petdance.com/perl/command-line-options.pdf
Why can't I check out from my Subversion repository?
|version-control|tortoisesvn|svn|
I'm trying to setup a new computer to synchronize with my SVN repository that's hosted with cvsdude.com. I get this error: ![SVN Error][1] Here's what I did (these have worked in the past): 0. Downloaded and installed TortoiseSVN 0. Created a new folder C:\aspwebsite 0. Right-clicked, chose SVN ...
There's a very straight forward web based solution over at ISBNDB.com that you may want to look at. [http://isbndb.com/docs/api/][1] [1]: http://isbndb.com/docs/api/ You can be up and running in just a few minutes, simple pass URL and query string and receive XML response with book data, just make sure you...
There's a very straight forward web based solution over at ISBNDB.com that you may want to look at. [http://isbndb.com/docs/api/][1] [1]: http://isbndb.com/docs/api/ You can be up and running in just a few minutes, simple pass URL and query string and receive XML response with book data, just make sure you...
There's a very straightforward web based solution over at ISBNDB.com that you may want to look at. [http://isbndb.com/docs/api/][1] [1]: http://isbndb.com/docs/api/ You can be up and running in just a few minutes: * register on the site and get a key to use the API * try a URL like: `http://isbndb.co...
A **?** as a suffix for a value type allows for null assignments that would be othwerwise impossible. http://msdn.microsoft.com/en-us/library/b3h38hb0.aspx > Represents an object whose underlying > type is a value type that can also be > assigned a null reference. This means that you can write something like...
it basically gives you an extra state for primitives. It can be a value, or it can be null. It can be usefull in situations where a value does not need to be assigned. So rather than using for example, datetime.min or max, you can assign it null to represent no value.
It's a nullable datetime. ? after a primitive type indicates that it is the nullable version. Example: int can never be null. Its value must always be between -2,147,483,648 and 2,147,483,647. int? can be null.
Are your settings and ruby installation ok? I created those 3 files and wrote what follows in "test.rb" require 'yaml' require "some_module" SomeModule.sizes.first.fits? Then I ran it. $ ruby --version ruby 1.8.6 (2008-06-20 patchlevel 230) [i486-linux] $ ruby -w test.rb ...
Microsoft's [ReportViewer][1] client can generate pdfs natively. [1]: http://msdn.microsoft.com/en-us/library/ms251771(VS.80).aspx It works inside of web pages and windows forms/wpf apps. You can programmatically trigger the export as well. The only downside is that you'll need to basically redo your form as ...
By ASP I assume you mean Classic ASP? Try: Dim oXML, oNode, sKey, sValue Set oXML = Server.CreateObject("MSXML2.DomDocument.4.0") oXML.LoadXML(sXML) For Each oNode In oXML.SelectNodes("/user_data/person_info/attribute") sKey = oNode.GetAttribute("name") sValue = oNode.Tex...
Slides 25/26 of [this presentation][1] talk about the characteristics of different methods for inserting scripts. It suggests that IE is the only browser that will execute those scripts in order. All others will execute them in the order that they finish loading. One of the methods suggested is to insert a DOM ele...
Slides 25/26 of [this presentation][1] talk about the characteristics of different methods for inserting scripts. It suggests that IE is the only browser that will execute those scripts in order. All others will execute them in the order that they finish loading. One of the methods suggested is to insert a new DOM...
Slides 25/26 of [this presentation][1] talk about the characteristics of different methods for inserting scripts. It suggests that IE is the only browser that will execute those scripts in order. All other browsers will execute them in the order that they finish loading. Even IE won't execute them in order if one or...
Well, it might not be fitting in with the "official" definition, but I always try and explain it to people as "It's like syndicating knowledge instead of content." Why would you want to use it? Well... if you are making applications that could benefit from machine parseable and queryable "knowledge," then... you mi...
How to update a Tix.ComboBox's text?
|python|combobox|tkinter|tix|
I have a Tix.ComboBox with an editable text field. How do I force the variable holding the value for the text to update? Let me give a more concrete explanation. I have a combo box and a button. When I click the button, it pops up a message box with the value of the combo box. Let's say the combo box text field curr...
Just look at the .Net base class library to see a namespace hierarchy put to good use. It goes four or five levels deep in a few places, but mostly it's just two or three, and the organization is very nice for finding things.
3 others [NatTable][1] [Agile Grid][2] [Jaret Table][3] [1]: http://sourceforge.net/projects/nattable/ [2]: http://sourceforge.net/projects/agilegrid [3]: http://jaret.de/jarettable/index.html
That's true. As you might guess, the Natural procedures we want to call do lookups and calculations that we'd like to keep at that level if possible.
User controls are compiled with the project and it must be written in the same language as the project. Custom controls can be dropped on the canvas and configured by setting properties without the programmer knowing all the internals (can be good or bad). Also since the custom control is precompiled in the dll, it ...
I'm trying to setup a new computer to synchronize with my SVN repository that's hosted with cvsdude.com. I get this error: ![SVN Error][1] Here's what I did (these have worked in the past): 0. Downloaded and installed TortoiseSVN 0. Created a new folder C:\aspwebsite 0. Right-clicked, chose SVN ...
TortoiseSVN Error: "OPTIONS of 'https://...' could not connect to server (...)
TortoiseSVN Error: "OPTIONS of 'https://...' could not connect to server (...)"
I'm trying to setup a new computer to synchronize with my SVN repository that's hosted with cvsdude.com. I get this error: ![SVN Error][1] Here's what I did (these have worked in the past): 0. Downloaded and installed TortoiseSVN 0. Created a new folder C:\aspwebsite 0. Right-clicked, chose SVN ...
I'm trying to setup a new computer to synchronize with my SVN repository that's hosted with cvsdude.com. I get this error: ![SVN Error][1] Here's what I did (these have worked in the past): 0. Downloaded and installed TortoiseSVN 0. Created a new folder C:\aspwebsite 0. Right-clicked, chose SVN ...
good postgresql client for windows?
|postgresql|windows|postgis|frontend|
coming back to postgresql after several years of oracle ... what are the state-of-the art postgresql frontends on windows? it would be nice if it had integration for postgis as well. thinking back, all the windows programs specific for postgresql i have used were crap.
|windows|postgresql|frontend|postgis|
coming back to postgresql after several years of oracle ... what are the state-of-the art postgresql administrative/ddl generating/data inserting frontends on windows? it would be nice if it had integration for postgis as well. it should be standalone or alternatively a plugin for intellij idea thinking back, al...
I think that [Reddit's registration](http://www.reddit.com/login) is pretty good. If you attempt to use an action that requires you to be logged in it will pop up in front all Javascripty. It just requires your username and password, and just takes a few second.
Quick sort, merge sort, and most other N-logN sorts
The PadLeft only does something if the user enters a year that is either 2 or 3 digits long. With a 1-digit year, you get an exception (Subsring errs). With a 2-digit year (07, 08, etc), it will return 00. I would say this is an error. With a 3-digit year (207, 208), which the author may have assumed to be ty...
I used to use Viso but now, as I'm more Mac based I use Omnigraffle. I do have to admit though, as andyUK does, I do a rough sketch on paper. It also depends on what Database you're using. If it's MySQL then there are quite a few visual development tools available, just <a href="http://www.google.co.uk/search?q=m...
It *is* legal, but I think the most important issue is this: A class should do one thing and do it well. If your class uses a thread internally, then the existence of that thread should not be visible in the public API. This allows improvement without affecting the public API. Solution: extend Runnable, not Thread....
It *is* "legal", but I think the most important issue is this: A class should do one thing and do it well. If your class uses a thread internally, then the existence of that thread should not be visible in the public API. This allows improvement without affecting the public API. Solution: extend Runnable, not Threa...
Things will probably compile OK, but we had a few nasty runtime issues with an application we upgraded at the start of the year. First, we had a number of problems with timezone handling in DateTime objects when calling 1.1 webservices from a 2.0 application, as the conversions to and from UTC when serializing to t...
Should I use a dedicated network chanel between the database and the application server?
|networking|latency|database|
Should I use a dedicated network chanel between the database and the application server? ...or... Connecting both in the switch along with all other computer nodes makes no diference at all?
|database|performance|networking|latency|
Should I use a dedicated network chanel between the database and the application server? ...or... Connecting both in the switch along with all other computer nodes makes no diference at all? The matter is **performance!**
|database|performance|networking|latency|
Should I use a dedicated network channel between the database and the application server?
|database|performance|networking|latency|
Should I use a dedicated network channel between the database and the application server? ...or... Connecting both in the switch along with all other computer nodes makes no diference at all? The matter is **performance!**
Being a programmer working on an already critical (or least, important) task, should not let yourself deviate by trying to develop something that is already available in the market (OpenSource or Commercial). You will now try to create a bug tracking system to keep track of the bug tracking system that you use to tr...
Slides 25/26 of [this presentation][1] talk about the characteristics of different methods for inserting scripts. It suggests that IE is the only browser that will execute those scripts in order. All other browsers will execute them in the order that they finish loading. Even IE won't execute them in order if one or...
Slides 25/26 of [this presentation][1] talk about the characteristics of different methods for inserting scripts. It suggests that IE is the only browser that will execute those scripts in order. All other browsers will execute them in the order that they finish loading. Even IE won't execute them in order if one or...
I use TortoiseSVN and windows explorer for all my development projects and believe it works great. I started with SourceSafe, but when I changed jobs I went to an SVN shop and have now incorporated it into my own development projects. You can also use Source Safe without integration. You use Source Safe to check in/...
SQL server 2000 Like Statement Usage
|sqlsever|sql|like|where|
I have a SQL statement that looks like: SELECT [Phone] FROM [Table] WHERE ( [Phone] LIKE '[A-Z][a-z]' OR [Phone] = 'N/A' OR [Phone] LIKE '[0]' ) The part I'm having trouble with is the where statement with the "LIKEs". I've seen SQL statements where authors used ...
|sql|sql-server|
The main product I work on at work uses the txt_ pnl_ etc prefixes. This does work, though it is a bit of a pain at times when switching something that just hides/shows controls from say, a tr to a panel because you have to rename it. What I've started doing in new projects, is naming my UI controls with a ui prefi...
Is there a printf converter to print in binary format?
|c|printf|
I can print with printf as a hex or octal number. Is there a format tag to print as binary, or arbitrary base? I am running gcc. printf("%d %x %o\n", 10, 10, 10); //prints "10 A 12\n" print("%b\n", 10); // prints "%b\n"