instruction
stringlengths
0
30k
Given the URL (single line): http://test.example.com/dir/subdir/file.html How can I extract the following parts using regular expressions: 1. The Subdomain (test) 2. The Domain (example.com) 3. The path without the file (/dir/subdir/) 4. The file (file.html) 5. The path with the file (/dir/subdir/file...
The best I could come up with is to produce a matrix of sums of each pair, and then merge the rows together, a-la merge sort. I feel like I'm missing some simple insight that will reveal a much more efficient solution. My algorithm, in Haskell: matrixOfSums list = [[a+b | b <- list, b >= a] | a <- list] ...
Adobe Flex component events
|apache-flex|actionscript-3|
I have a component I wrote that display a filename, a thumbnail, and has a button to click on to load/play the file. The component is databound to a repeater. How can I make it so the button event fires to the main application and tells it which file to play?
Maybe you should try including a fourth column, stating the table it came from, and then order and group by it: SELECT A,B,C, "query 1" as origin FROM table WHERE field LIKE 'query%' UNION SELECT A,B,C, "query 2" as origin FROM table WHERE field LIKE '%query' UNION SELECT A,B,C, "query 3" as ...
Also try out [visual svn][1] for your server if you want to avoid any command line work. [1]: http://www.visualsvn.com/
Is there a WMI Redistributable Package?
|wmi|windows|64-bit|
I've been working on a project that accesses the WMI to get information about the software installed on a user's machine. We've been querying Win32_Product only to find that it doesn't exist in 64-bit versions of Windows because it's an ["optional component"][1].<br /> <br /> I know there are a lot of really good alt...
If it is just simple data contained in the Excel file you can read the data via ADO.NET. See the connection strings listed here: [http://www.connectionstrings.com/?carrier=excel2007][1] or [http://www.connectionstrings.com/?carrier=excel][2] -Ryan [1]: http://www.connectionstrings.com/?carrier=excel2007...
If it is just simple data contained in the Excel file you can read the data via ADO.NET. See the connection strings listed here: [http://www.connectionstrings.com/?carrier=excel2007][1] or [http://www.connectionstrings.com/?carrier=excel][2] -Ryan Update: then you can just read the worksheet via something l...
Just did a quick demo project that required managing some excel files. The .NET component from GemBox software was adequate for my needs. It has a free version with a few limitations. [http://www.gemboxsoftware.com/GBSpreadsheet.htm][1] [1]: http://www.gemboxsoftware.com/GBSpreadsheet.htm
You could use jQuery. Here is an example: [http://www.jqueryplugins.com/plugins/view/61/][1] [1]: http://www.jqueryplugins.com/plugins/view/61/
I think that depends on your window manager. I'm a windows user, so this might be a wrong guess, but: Isn't there something called [X-Server][1] running on linux machines - at least on ones that might be interesting targets for VNC - that you can connect to with "X-Clients"? VNC just takes everything that's on th...
WF is available already in .net 3.0. It is a bit buggy though on the Designer-side in Visual Studio and can get quite messy. I use it on Sharepoint (where WF is pretty much your only option anyway) and overall I am quite satisfied with it, even though the learning curve is rather steep. [Foundations of WF][1] is a g...
@Patrick you are assuming calling setValueInVector( v, idx ); at the end of the second loop is OK. If the code is to be identical, logically, it must be rewritten to somethng like this: <pre><code>for( int idx = 0; idx < vectorLength; idx++) { if( conditionAtVectorPosition( v, idx ) ) continue; for( rowI...
Does this work for you? I extracted the inner loop into a method CheckedEntireMatrix (you can name it better than me) - Also my java is a bit rusty.. but I think it gets the message across for( int idx = 0; idx < vectorLength; idx++) { if( conditionAtVectorPosition( v, idx ) || !CheckedEntireMatr...
You can set up VS.Net to break as soon as any exception occurs. Just run your project in debug mode, and it will stop as soon as the exception is thrown. Then you should have a better idea of why it isn't being caught. Also, you can put some code in to [catch all unhandled exceptions][1]. Read the link for more in...
How can I play compressed sound files in C# in a portable way?
|c#|.net|mono|oggvorbis|audio|
Is there a portable, not patent-restricted way to play compressed sound files in C# / .Net? <a href="http://msdn.microsoft.com/en-us/library/system.media.soundplayer.aspx">System.Media.SoundPlayer</a> can handle only WAV, but those are typically to big to embed in a downloadable apllication. MP3 is protected with paten...
|c#|.net|mono|audio|oggvorbis|
Is there a portable, not patent-restricted way to play compressed sound files in C# / .Net? I want to play short "jingle" sounds on various events occuring in the program. <a href="http://msdn.microsoft.com/en-us/library/system.media.soundplayer.aspx">System.Media.SoundPlayer</a> can handle only WAV, but those are t...
Oh and in reference to what Kibbee said; if you select Debug|Exceptions in VS and just click all the boxes in the 'thrown' column it should pick *everything* up AFAIK as a 'first chance exception', i.e. VS will indicate when the exception is *about* to be processed by everything else and break on the relevant code. Thi...
Floating Point Number parsing: Is there a Catch All algorithm?
|.net|c#|vb.net|asp.net|
One of the fun parts of multi-cultural programming are numbers formats. Americans use 10,000.50, Germans use 10.000,50, French use 10 000,50 etc. My first approach would be: Take the string, parse it backwards, until I encounter a separator and use this as my decimal separator. The obvious flaw with that: 10.000 wo...
|.net|c#|vb.net|asp.net|globalization|
|c#|.net|asp.net|vb.net|internationalization|globalization|
I'm not sure why you would want to do this in the first place. The resulting set for any moderately large values of x and y will be huge, and will grow exponentially as x and/or y get bigger. Lets say your set of possible characters is the 26 lowercase letters of the alphabet, and you ask your application to genera...
The [scoring][1] contains the Inverse Document Frequency(IDF). If the term "John Smith" is in one partition, 0, 100 times and in partition 1, once. The score for searching for John Smith would be higher search in partition 1 as the term is more scarce. To get round this you would wither have to have your index being...
Because the score is determined on the Index if I am not completely mistaken. If you have different indexes (more/less or different data that was indexed), the score will differ: [http://lucene.apache.org/java/docs/scoring.html][1] (Warning: Contains Math :-)) [1]: http://lucene.apache.org/java/docs/scor...
Longhorn213 almost has the right answer, but as as Sean Chambers and bdukes say, you should use ctrl is IInterfaceToFind instead of ctrl.GetType() == aTypeVariable The reason why is that if you use .GetType(), you will get the true type of an object, not necessarily what it can also be cast to i...
Longhorn213 almost has the right answer, but as as Sean Chambers and bdukes say, you should use ctrl is IInterfaceToFind instead of ctrl.GetType() == aTypeVariable The reason why is that if you use .GetType(), you will get the true type of an object, not necessarily what it can also be cast to i...
Longhorn213 almost has the right answer, but as as Sean Chambers and bdukes say, you should use ctrl is IInterfaceToFind instead of ctrl.GetType() == aTypeVariable The reason why is that if you use .GetType(), you will get the true type of an object, not necessarily what it can also be cast to i...
Longhorn213 almost has the right answer, but as as Sean Chambers and bdukes say, you should use ctrl is IInterfaceToFind instead of ctrl.GetType() == aTypeVariable The reason why is that if you use .GetType(), you will get the true type of an object, not necessarily what it can also be cast to i...
|language-agnostic|regex|url|
Easy-to-Use Regular Expression Support in C++?
|windows|c++|regex|regularexpression|
I'm looking for a robust, easy-to-use, regular expression evaluator for native C++, either platform-independent or Windows-specific. Requirements: - Can't use Boost or ACE regex libraries (unfortunately) - Can't use .NET Regex (or any managed code) The main requirement is that it should be standalone and ...
|c++|regex|
|c++|regex|regular-expression|
|c++|regex|
If you need to you can create and drop temporary tables in procedures using the [Execute Immediate][1] command. [1]: http://www.dbasupport.com/oracle/ora9i/execute_immediate.shtml
Personally, developing a website that is high traffic perfomance based, I stay away from database transactions whenever possible. Obviously they are neccessary, so I use an ORM, and page level object variables to minimize the number of server side calls I have to make. Nested transactions are an awesome way to mini...
How do I bind a regular expression to a key combination in emacs?
|emacs|lisp|regex|regular-expression|
For context, I am something of an emacs newbie. I haven't used it for very long, but have been using it more and more (I like it a lot). Also I'm comfortable with lisp, but not super familiar with elisp. What I need to do is bind a regular expression to a keyboard combination because I use this particular regex so...
For context, I am something of an emacs newbie. I haven't used it for very long, but have been using it more and more (I like it a lot). Also I'm comfortable with lisp, but not super familiar with elisp. What I need to do is bind a regular expression to a keyboard combination because I use this particular regex so...
Getting developers to use a wiki
|documentation|wiki|mediawiki|
I work on a complex application where different teams work on their own modules with a degree of overlap. A while back we got a Mediawiki instance set up, partly at my prompting. I have a hard job getting people to actually use it, let alone contribute. I can see a lot of benefit in sharing information. It may at le...
Easily, my good man. for( int idx = 0; idx < vectorLength; idx++) { if( conditionAtVectorPosition( v, idx ) ) continue; for( rowIdx = 0; rowIdx < n; rowIdx++ ) { if( anotherConditionAtVector( v, rowIdx ) ) continue; if( conditionAtMatrixRowCol( m, rowIdx, idx ) ) break; ...
Easily, my good man. for( int idx = 0; idx < vectorLength; idx++) { if( conditionAtVectorPosition( v, idx ) ) continue; for( rowIdx = 0; rowIdx < n; rowIdx++ ) { if( anotherConditionAtVector( v, rowIdx ) ) continue; if( conditionAtMatrixRowCol( m, rowIdx, idx ) ) break; ...
Using ints is generally better than using shorts because java uses 32-bit values internally anyway (Even for bytes, unless in an array) so using ints will avoid unnecessary conversion to/from short values in the bytecode.
If you're reading TPOP, you will next see how they make this search many times faster with different data structures and algorithms. But you can make things a bit faster by replacing things like for (i = 0; i < n; ++i) foo(a[i]); with char **p = a; for (i = 0; i < n; ++i) foo(...
Sell the idea of using the wiki to the developers. You've identified some benefits, share those with the developers. If they can see that they'll get something of value out of it they'll start using it.
Sell the idea of using the wiki to the developers. You've identified some benefits, share those with the developers. If they can see that they'll get something of value out of it they'll start using it. Example advantages from [What Is a Wiki](http://www.oreillynet.com/pub/a/network/2006/07/07/what-is-a-wiki.html?pa...
Run it through the query analyzer and see what the query plan is. My guess would be that the double root (ie. %ae%) searches are causing it do do a table scan when looking for the matching rows. Double root searches are inherently slow, as you can't use any kind of index to match them usually.
What's your top feature request for Silverlight?
|silverlight|
I'll take away the obvious one here: mic and webcam support. Other than that, if you ran the Silverlight team, what would your highest priority be for Silverlight 3? Disclaimer: If we get some good responses, I'll pass them along to folks I know on the Silverlight team. Is that cool? I mean, this site will be public...
|.net|silverlight|
What's a good open source VoiceXML implementation?
|speech-recognition|ivr|voip|
I am trying to find out if it's possible to build a complete IVR application by cobbling together parts from open source projects. Is anyone using a non-commercial VoiceXML implementation to build speech-enabled systems?
I'm completely inexperienced with yaws, but I have a troubleshooting suggestion: What happens if you remove the config file completely? If it still starts yaws without a config file, that could be a clear sign that something is being cached. For what it's worth, with a quick 5 minutes of googling, I found no mention...
You can also pass the init parameters to the instance variables by position # Abstract struct class class Struct: def __init__ (self, *argv, **argd): if len(argd): # Update by dictionary self.__dict__.update (argd) else: # Update by positi...
After adding `;.LNK` to the end of my `PATHEXT` environment variable, I can now execute shortcuts even without the preceding `./` notation. (Thanks bruceatk!) I was also inspired by Steven's suggestion to create a little script that automatically aliases all the shortcuts in my `PATH` (even though I plan to stick wi...
After adding `;.LNK` to the end of my `PATHEXT` environment variable, I can now execute shortcuts even without the preceding `./` notation. (Thanks bruceatk!) I was also inspired by Steven's suggestion to create a little script that automatically aliases all the shortcuts in my `PATH` (even though I plan to stick wi...
Longhorn213 almost has the right answer, but as as Sean Chambers and bdukes say, you should use ctrl is IInterfaceToFind instead of ctrl.GetType() == aTypeVariable The reason why is that if you use .GetType(), you will get the true type of an object, not necessarily what it can also be cast to i...
Given that the exception is a DllNotFoundException, you might want to try checking the HardwareID.dll with [Dependency Walker][1] BEFORE installing any dev tools on the Vista install to see if there is in fact a dependency missing. [1]: http://www.dependencywalker.com/
It's not really the languages that are OO, it's the code. It is possible to write object-oriented C code (with structs and even function pointer members, if you wish) and I have seen some pretty good examples of it. (Quake 2/3 SDK comes to mind.) It is also definitely possible to write procedural (i.e. non-OO) code ...
We ended up using Oracle XE. Install client, install express, reboot, it just works.
From Linq in Action > Microsoft has a Query Visualizer tool that can be downloaded separetly from VS 2008. it is at [http://weblogs.asp.net/scottgu/archive/2007/07/31/linq-to-sql-debug-visualizer.aspx][1] [1]: http://weblogs.asp.net/scottgu/archive/2007/07/31/linq-to-sql-debug-visualizer.aspx
Rails requires RubyGems >= 0.9.4. Please install RubyGems
|ruby-on-rails|deployment|rubygems|
I'm deploying to Ubuntu slice on slicehost, using Rails 2.1.0 (from gem) If I try mongrel_rails start or script/server I get error: > Rails requires RubyGems >= 0.9.4. Please install RubyGems When I type `gem-v` i have 1.2.0. Any quick tips on what to look at to fix?
Converting bool to text in C++
RDoc uses SimpleMarkup so it's fairly simple to create lists, etc. using *, - or a number. It also treats lines that are indented at the same column number as part of the same paragraph until there is an empty line which signifies a new paragraph. Do you have a few examples of comments you want RDoc'ed so we could show...
iPhone app in landscape mode
|iphone|
What's the best way to create an iPhone application that runs in landscape mode from the start, regardless of the position of the device? Both programmatically and using the Interface Builder.
The best way to deploy video on the web is using Flash - it's much easier to embed cleanly into a web page and will play on more or less any browser and platform combination. The only reason to use Windows Media Player is if you're streaming content and you need extraordinarily strong digital rights management, and eve...
If the fact that the first button is used by default is consistent across browsers, why not put them the right way round in the source code, then use CSS to switch their apparent positions? float them left and right to switch them around visually, for example.
The difference between 12.345 in French and English is a factor of 1000. If you supply an expected range where max < 1000*min, you can easily guess. Take for example the height of a person (including babies and children) in mm. By using a range of 200-3000, an input of 1.800 or 1,800 can unambiguously be interpr...
Yahoo uses a method called Sender ID, which can be configured at [The SPF Setup Wizard][1] and entered in to your DNS. Also one of the important ones for Exchange, Hotmail, AOL, Yahoo, and others is to have a Reverse DNS for your domain. Those will knock out most of the issues. However you can never prevent a person...
While you haven't said what you're storing, and you may have a great reason for doing so, often the answer is 'as a filesystem reference' and the actual data is on the filesystem somewhere. <http://www.onlamp.com/pub/a/onlamp/2002/07/11/MySQLtips.html>
[ElementTree][1] has a nice pythony API. I think it's even shipped as part of python 2.5 It's in pure python and as I say, pretty nice, but if you wind up needing more performance, then [lxml][2] exposes the same API and uses libxml2 under the hood. You can theoretically just swap it in when you discover you need ...
I've been working on a project that accesses the WMI to get information about the software installed on a user's machine. We've been querying Win32_Product only to find that it doesn't exist in 64-bit versions of Windows because it's an ["optional component"][1]. I know there are a lot of really good alternatives to...
|windows|64-bit|wmi|
I've been working on a project that accesses the WMI to get information about the software installed on a user's machine. We've been querying Win32_Product only to find that it doesn't exist in 64-bit versions of Windows because it's an ["optional component"][1]. I know there are a lot of really good alternatives to...
I would start with: - [A Visual Guide to Version Control][1] - [Wikipedia][2] Then once you have read up on it, download and install [SVN][3], [TortoiseSVN][4] and skim the first few chapters of the [book][5] and get started. [1]: http://betterexplained.com/articles/a-visual-guide-to-version-control/ ...
Eric Sink has a [good overview of source control][1]. There are also some [existing][2] [questions][3] here on SO. [1]: http://www.ericsink.com/scm/source_control.html [2]: http://stackoverflow.com/questions/871/why-is-git-better-than-subversion [3]: http://stackoverflow.com/questions/2658/version-control-...
The ["Napkin Look & Feel"][1] for Java is really cool for prototyping. An actual, functioning, clickable app that looks like it was drawn on a napkin. Check out this screenshot: ![Napkin Look and Feel][2] Seriously, how cool is that? [1]: http://napkinlaf.sourceforge.net/ [2]: http://napkinlaf.sourceforge.n...
If you are working by yourself in a Windows environment, then the [single user license][1] for SourceGear's Vault is free. [1]: http://www.sourcegear.com/faq.html
Partial methods have been introduced for similar reasons to why partial classes were in .Net 2. A partial class is one that can be split across multiple files - the compiler builds them all into one file as it runs. The advantage for this is that Visual Studio can provide a graphical designer for part of the clas...
Max length for html text areas
|javascript|html|