instruction_seed
stringlengths
1
35.8k
_source
stringclasses
1 value
According to this post on how to do query auto-completionsuggestions in lucene getting "Did You Mean" functionality best involves using a LuceneDictionary. But I probably would have used a fuzzy query for this before reading this post. Now I'm wondering which is faster, which is easier to implement?
stackexchange/codereview
If I create an event using CreateEvent in Windows, how can I check if that event is signaled or not using the debugger in Visual Studio? CreateEvent returns back a handle, which doesn't give me access to much information. Before I call WaitForSingleObject(), I want to check to see if the event is signaled before I st...
stackexchange/codereview
How can I get a UIElement to ignore mouse clicks on it and pass it through to the control behind it? I have a 50% transparent UIElement which covers another element. When I attempt to click on the background element, the mouse click is captured by the foreground semi-transparent UIElement.
stackexchange/codereview
In almost all projects, the choice of the database system is 'almost' automatic .. if you're coding "in the Microsoft stack" you'll go with SQLServer, in the Linux world the default is MySQL, and for corporate in-house project most shops have decided on some default like Oracle or IBM DB2. What are your thoughts?
stackexchange/codereview
This is the one thing I could never get to work. My problem is to detect the end of one day and the start of the next and then splitting the diff into each day. Imagine you want to calculate a pay rate but it has to span across midnight. It also applies to calculating time to run on timed system, or time diff it should...
stackexchange/codereview
I want to import data from MS SQL Server, run it through some sort of regexp to filter out stuff, and import it into MySQL. I then, for each query, wish to display a relevant image from a third database. What would be the easiest way to do this, importing and linking wise? Thank you. Clarification: It is a php applicat...
stackexchange/codereview
I'm getting an unexpected T_CONCAT_EQUAL error on a line of the following form: $arg1 .= "arg2".$arg3."arg4"; I'm using PHP5. I could simply go an do the following: $arg1 = $arg1."arg2".$arg3."arg4"; but I'd like to know whats going wrong in the first place. Any ideas? Thanks, sweeney
stackexchange/codereview
I need to create a windows service that will monitor a directory for newly uploaded files. The files will be around 100K to 400K in size. Is there a chance that my monitoring system will notice a new file, but the file hasn't completetly finished copying over? i.e. it is still streaming in and the EOF hasn't been writt...
stackexchange/codereview
I have a self-signed root certificate with just the code signing extension (no other extensions) in my Mac keychain; I use it to sign all code coming out of ∞labs using Apple's codesign tool and it works great. I was looking to expand myself a little and doing some Java development. I know Apple provides a KeyStore imp...
stackexchange/codereview
I am trying to do the following in SQL*PLUS in ORACLE. Create a variable Pass it as output variable to my method invocation Print the value from output variable I get undeclared variable error. I am trying to create a variable that persists in the session till i close the SQL*PLUS window. variable subhandle number;...
stackexchange/codereview
I have a Ruby on Rails application that I'm writing where a user has the option to edit an invoice. They need to be able to reassign the order of the rows. Right now I have an index column in the db which is used as the default sort mechanism. I just exposed that and allowed the user to edit it. This is not very...
stackexchange/codereview
I have a an HTML form which contains the YAHOO rich text editor on it. When I display the form I want the YAHOO editor to have focus so that the cursor is ready to accept input without the user having to click on it or tab into it
stackexchange/codereview
In the vxWorks memory map, there is an area (bellow the load address of vxWorks) which is described as the "shared memory anchor". What is it used for?
stackexchange/codereview
The following snippet of C# code: int i = 1; string result = String.Format("{0},{1},{2}", i++, i++, i++); Console.WriteLine(result); writes out: 1,2,3 Before I tried this in the compiler I was expecting the assignments to take place and then the evaluations, so my expected output was: 1,1,1 So my question is: Do...
stackexchange/codereview
In PHP I simply write: $bob = $_POST['bob']; How do I do the same in Python? And yes, I do normally check that it exists etc, I'm just stripping it down specifically to the functionality I am after. Edit: I am not using a framework
stackexchange/codereview
When programming by contract a function or method first checks whether its preconditions are fulfilled, before starting to work on its responsibilities, right? The two most prominent ways to do these checks are by assert and by exception. assert fails only in debug mode. To make sure it is crucial to (unit) test all ...
stackexchange/codereview
This is really two questions, but they are so similar, and to keep it simple, I figured I'd just roll them together: Firstly: Given an established python project, what are some decent ways to speed it up beyond just plain in-code optimization? Secondly: When writing a program from scratch in python, what are some goo...
stackexchange/codereview
How can I configure an application, or even an entire machine, to use either the server or workstation flavor of the CLR's garbage collection?
stackexchange/codereview
I am using SetCursor to set the system cursor to my own image. The code looks something like this: // member on some class HCURSOR _cursor; // at init time _cursor = LoadCursorFromFile("somefilename.cur"); // in some function SetCursor(_cursor); When I do this the cursor does change, but on the first mouse move mess...
stackexchange/codereview
In both the Visual Studio emacs mode and the default mode the tab key is bound to Edit.InsertTab. However, in the emacs mode the tab button jumps to where it expects the next line to start instead of inserting a tab. Is there a way to disable this "smart insert" while keeping the emacs key bindings?
stackexchange/codereview
When you are working on a new website, what combinations of browsers and operating systems do you target, and at what priorities? Do you find targeting a few specific combinations (and ignoring the rest) better than trying to strive to make them all work as intended? Common browsers: Firefox (1.5, 2, 3) Internet Expl...
stackexchange/codereview
I've got a BPG file that I've modified to use as a make file for our company's automated build server. In order to get it to work I had to change Uses * Uses unit1 in 'unit1.pas' * unit1 unit2 in 'unit2.pas' * unit2 ... * ... in the DPR file to get it ...
stackexchange/codereview
Here at work, we are working on a newsletter system that our clients can use. As an intern one of my jobs is to help with the smaller pieces of the puzzle. In this case what I need to do is scan the logs of the email server for bounced messages and add the emails and the reason the email bounced to a "bad email databas...
stackexchange/codereview
My everyday IDE is Eclipse which has a wonderful Open Resource feature (CTRL+SHIFT+R or Navigate > Open Resource) which allows the user to search for files/resources across multiple projects. I can't find a similar feature in SQL Server Management Studio, is there one?
stackexchange/codereview
I would like to format a price in JavaScript. I'd like a function which takes a float as an argument and returns a string formatted like this: "$ 2,500.00" How can I do this?
stackexchange/codereview
How can you remove all of the trailing whitespace of an entire project? Starting at a root directory, and removing the trailing whitespace from all files in all folders. Also, I want to to be able to modify the file directly, and not just print everything to stdout.
stackexchange/codereview
I'm seeing this error several times an hour on my production site and am not quite sure how to fix it. I've grepped the source code and I am not using "../" anywhere in my code to generate a path. My application is running on IIS6 on Win2003 Server. It's using URLRewriter.Net to allow the site to have friendly URLs, an...
stackexchange/codereview
Is there any way to download attachment from a web service without using WSE in C#?
stackexchange/codereview
Is it possible to run a macro in Visual Studio 2008 the moment a solution is closed? I would like to delete the .suo-files of that solution, so that the current user settings are not presented to me the next time I open the solution.
stackexchange/codereview
Suppose I have one long long int and want to take its bits and construct four unsigned short ints out of it. Particular order doesn't matter much here. I generally know that I need to shift bits and truncate to the size of unsigned short int. But I think I may make some weird mistake somewhere, so I ask.
stackexchange/codereview
So my build machine spits out a new executable and I would like to update my test machine with the new build. In order to do this I would need to somehow kill the process on the remote machine, copy over the new binary and start it running. And for some reason pskill and psexec don't work due to some weird IT setup. Wh...
stackexchange/codereview
User-Defined Functions & Collating Sequences Full support for user-defined functions and collating sequences means that in many cases if SQLite doesn't have a feature, you can write it yourself in your favorite .NET language. Writing UDF's and collating sequences has never been easier I spotted this bit on the C# ...
stackexchange/codereview
I am studying for cryptography and I somehow stuck on understanding how DES works. Because it is around for a long time there should be nice tutorials like fancy diagrams, videos etc around the net. I searched but with no luck. Has anyone spotted anything "easy-to-digest" for the brain?
stackexchange/codereview
I'm using DirectMusic for MIDI playback in an application I'm developing. Does anyone know if it's possible to use DirectMusic to play individual notes? Currently, I'm converting an in-memory data structure that represents entire 'songs' into a MIDI buffer and playing it back through DirectMusic. I'd like to be able to...
stackexchange/codereview
Is there a way to make a popup window maximised as soon as it is opened? If not that, at least make it screen-sized? This: window.open(src, 'newWin', 'fullscreen="yes"') apparently only worked for old version of IE.
stackexchange/codereview
I can't seem to figure out how to set the default database in Sql Server from code. This can be either .Net code or T-Sql (T-Sql would be nice since it would be easy to use in any language). I searched Google and could only find how to do it in Sql Server Management Studio.
stackexchange/codereview
I've been considering experimenting with game development and XNA. I'm already an expert C/C++ programmer. I read through some C# books, but haven't done any development in C# yet. What's a good resource for learning XNA, from the point of view of someone who's already an expert programmer?
stackexchange/codereview
I have the option of storing data in memory either as an XML document or multi-table ADO dataset. The web page utilizing this object will be selectively retrieving data items based on keys. Does either of these objects have a clear performance advantage over the other?
stackexchange/codereview
just wondering if anyone has ever tried embedding and actually integrating any js engine into the .net environment. I could find and actually use (after a LOT of pain and effort, since it's pretty outdated and not quite finished) spidermonkey-dotnet project. Anyone with experience in this area? Engines like SquirrelFis...
stackexchange/codereview
Short version: I'm wondering if it's possible, and how best, to utilise CPU specific instructions within a DLL? Slightly longer version: When downloading (32bit) DLLs from, say, Microsoft it seems that one size fits all processors. Does this mean that they are strictly built for the lowest common denominator (ie. the m...
stackexchange/codereview
In Subversion you can specify a range of versions to get an aggregate view of a series of commits. Is this possible in git? If so, how?
stackexchange/codereview
I need to specify a date value in a sybase where clause. For example: select * from data where dateVal < [THE DATE]
stackexchange/codereview
There doesn't seem to be an accepted way of sending down a header parameter in non ascii format. The header for file download usually looks like Content-disposition: attachment; filename="theasciifilename.doc" Except if you smash a utf8 encoded string in the filename parameter, Firefox will handle it fine, whereas IE w...
stackexchange/codereview
I am am trying to load a SQL table from a flat file. The flat i am talking about is a comma separated file. This has all the data required to populate a table will each column separated by a comma ",". I need some way by which i can load this content into the table faster.
stackexchange/codereview
In a C++ function I need the compiler to choose a different block if it is compiling for a 64 bit architecture. I know a way to do it for MSVC++ and g++, so I'll post it as an answer. However I would like to know if there is a better way (more elegant that would work for all compilers/all 64 bits architectures). If the...
stackexchange/codereview
I would find out the floppy inserted state: no floppy inserted unformatted floppy inserted formatted floppy inserted Can this determined using "WMI" in the System.Management namespace? If so, can I generate events when the floppy inserted state changes?
stackexchange/codereview
I'm using the GL class from JOGL, which basically contains all OpenGL functions. Now I just installed the Javadoc for JOGL, because it's nice to have the parameter names if you can't remember the order. However, with this Javadoc installed, it takes about half a minute to show the autocompletion list whenever I type GL...
stackexchange/codereview
I would like to check which type of RAM my computer uses before I order an upgrade. I'm fairly sure its DDR2 but I would like to double check this. Is there any way to check this in Windows XP without opening the case up and looking? EDIT The content police seem to have gotten the wrong end of the stick, I was lookin...
stackexchange/codereview
My favorite equation for centering an xhtml element using only CSS is as follows: display: block; position: absolute; width: _insert width here_; left: 50%; margin-left: _insert width divided by two & multiplied by negative one here_ There's also the simpler margin:auto method in browsers that support it. Does anyone ...
stackexchange/codereview
Are there any good MVC frameworks for native Windows Mobile code? Barring that could someone link to an open source Windows Mobile or CE project that uses the MVC pattern?
stackexchange/codereview
The Law of Demeter indicates that you should only speak to objects that you know about directly. That is, do not perform method chaining to talk to other objects. When you do so, you are establishing improper linkages with the intermediary objects, inappropriately coupling your code to other code. That's bad. The sol...
stackexchange/codereview
We're all familiar with the pre- and post-increment operators, e.g. c++; // c = c + 1 ++c; // ditto and the "combined operators" which extend this principle: c += 5; // c = c + 5 s .= ", world"; // s = s . ", world"; e.g. PHP I've often had a need for a 'post-combined operator', which would allow: s =. "H...
stackexchange/codereview
My normal work flow to create a new repository with subversion is to create a new repos, do a checkout of the repos root, create my branches tags and trunk folders and place in the trunk my initial files. Then I do a commit of this "initial import", delete the checked out repos from my hard drive and do a checkout of t...
stackexchange/codereview
I'm using Test/Unit with a standard rails 2.1 project. I would like to be able to test Partial Views in isolation from any particular controller / action. It seemed as though ZenTest's Test::Rails::ViewTestCase would help, but I couldn't get it working, similarly with view_test http://www.continuousthinking.com/tags/vi...
stackexchange/codereview
What is the easiest way to test (using reflection), whether given method (i.e. java.lang.Method instance) has a return type, which can be safely casted to List<String>? Consider this snippet: public static class StringList extends ArrayList<String> {} public List<String> method1(); public ArrayList<String> method2(); ...
stackexchange/codereview
If something inherits from a Serializable class, is the child class still Serializable?
stackexchange/codereview
Is there a query in SQL Server 2005 I can use to get the server's IP or name?
stackexchange/codereview
I'm an experienced programmer but just starting out with Flash/Actionscript. I'm working on a project that for certain reasons requires me to use Actionscript 2 rather than 3. When I run the following (I just put it in frame one of a new flash project), the output is a 3 rather than a 1 ? I need it to be a 1. Why does ...
stackexchange/codereview
What are your disaster recovery plans for Windows Sharepoint Services 3.0 ? Currently we are backuping all databases (1 content, admin, search and config) using sql backup tools, and backuping the front end server via dataprotector. To test our backups, we use another server farm, restore the content database (followin...
stackexchange/codereview
Is there any free tool available for creating and editing PNG Images?
stackexchange/codereview
Often, I found OutOfMemoryException on IBM Websphere Application Server. I think this exception occur because my application retrieve Huge data from database. So, I limit all query don't retreive data more than 1000 records and set JVM of WAS follow + Verbose garbage collection + Maximum Heap size = 1024 (RAM on my ser...
stackexchange/codereview
In Oracle, I have set the log_archive_dest1='D:\app\administrator\orcl\archive' parameter and shutdown the database. When I tried to start up the db, I got the following error: SQL> startup mount; ORA-16032: parameter LOG_ARCHIVE_DEST_1 destination string cannot be translated ORA-09291: sksachk: invalid device specif...
stackexchange/codereview
Does anyone have an XSLT that will take the app.config and render it into a non-techie palatable format? The purpose being mainly informational, but with the nice side-effect of validating the XML (if it's been made invalid, it won't render)
stackexchange/codereview
Is there a way to find the maximum and minimum defined values of an enum in c++?
stackexchange/codereview
Here is my question, Would it be possible, knowing that classic asp support server-side javascript, to be able to generate "server side HTML" to send to the client like Response.write $(page).html() Of course it would be great to use jQuery to do it because it's easy to parse complicated structure and manipulate the...
stackexchange/codereview
I have a friend who is need of a web page. He does interior construction, and would like to have a gallery of his work. I'll probably go for a php host, and was thinking about the best way to implement the image gallery for him. I came up with: Use flickr to host the images. They can be tagged, added to sets, and ...
stackexchange/codereview
I need to determine the highest .NET framework version installed on a desktop machine from C\C++ code. Looks like I can iterate the folders under %systemroot%\Microsoft.NET\Framework, but that seems kind of error prone. Is there a better way? Perhaps a registry key I can inspect? Thanks.
stackexchange/codereview
Please note that the problem described below is almost the exact opposite to the common problem of "my control shows the same value every time the page loads. I understand the behavior expressed is generally not desirable. I have a listbox which is being databound in the page load event even on postback. When the even...
stackexchange/codereview
Is there a tool to migrate an SQLite database to SQL Server (both the structure and data)?
stackexchange/codereview
In Ruby you can easily set a default value for a variable x ||= "default" The above statement will set the value of x to "default" if x is nil or false Is there a similar shortcut in PHP or do I have to use the longer form: $x = (isset($x))? $x : "default"; Are there any easier ways to handle this in PHP?
stackexchange/codereview
I want to draw DirectX content so that it appears to be floating over top of the desktop and any other applications that are running. I also need to be able to make the directx content semi-transparent, so other things show through. Is there a way of doing this? I am using Managed DX with C#.
stackexchange/codereview
Now this is .NET but I am sure the principal should apply to all OOP language, to simplify I take .NET as an example: R# usually creator constructor and passing incoming variable to private field, which for me mi tend to pass it to Property. Any opinion on how the different and what is the best practice for that?
stackexchange/codereview
In my ASP.Net 1.1 application, i've added the following to my Web.Config (within the System.Web tag section): <httpHandlers> <add verb="*" path="*.bcn" type="Internet2008.Beacon.BeaconHandler, Internet2008" /> </httpHandlers> This works fine, and the HTTPHandler kicks in for files of type .bcn, and does its thing.. ...
stackexchange/codereview
I want a recommendation on an ISP which has Subversion installed so I can get a repository started. So far I found out discount.asp doesn't have that on their servers and will not support it. So I'm looking for a recommendation
stackexchange/codereview
How do I download all files in a directory and all subdirectories on an HTTP server?
stackexchange/codereview
System.IO.BinaryReader reads values in a little-endian format. I have a C# application connecting to a proprietary networking library on the server side. The server-side sends everything down in network byte order, as one would expect, but I find that dealing with this on the client side is awkward, particularly for u...
stackexchange/codereview
I'm writing by own blogging engine in PHP with a MYSQL backend database. MY question is: How would you go about making user comments and blog posts include newlines wherever they are appropriate? For example, if a user hits the return key in the message/comments box how would this translate into a new line that would s...
stackexchange/codereview
Will Subclipse 1.4.4 work safely with Subversion 1.3.2? I am confused because its changelog says NOTE: As of Subclipse 1.3.0, the minimum Subversion JavaHL requirement is 1.5.0.
stackexchange/codereview
How can I write from Java to the Windows Event Log?
stackexchange/codereview
I have a fairly large codebase that depends on MooTools v1.11 and am about to convert to version 1.2. Since this is a pretty major overhaul, I've toyed with the idea of converting to jQuery. Anyone have advice on whether to update to jQuery or just stick with MooTools? I mostly use MooTools for Ajax, drag and drop, ...
stackexchange/codereview
I am looking for a way to do a keep alive check in .NET. The scenario is for both UDP and TCP. Currently in TCP what I do is that one side connects and when there is no data to send it sends a keep alive every X seconds. I want the other side to check for data, and if non was received in X seconds, to raise an event or...
stackexchange/codereview
Progressive Enhancement is a web development methodology that not only allows greater portability and accessibility but in my opinion, makes the development process easier. What I want is to know what the rest of the community think of this approach. In particular: What do you believe is the minimum set of technologies...
stackexchange/codereview
What is the use of a Dispatcher Object in WPF?
stackexchange/codereview
Is there any way to format a string by name rather than position in C#? In python, I can do something like this example (shamelessly stolen from here): >>> print '%(language)s has %(#)03d quote types.' % \ {'language': "Python", "#": 2} Python has 002 quote types. Is there any way to do this in C#? Say for inst...
stackexchange/codereview
Is there a way to separate a C# class into a header that contains the class definition and then an actual .cs file that contains the implementation? I suppose one can do this by creating an interface, but that doesn't seem right. I just want a file where I can just see the class design, and not all the detail. It's ...
stackexchange/codereview
Is there a mod_rewrite equivalent for IIS 7.0 that's a) more or less complete b) suitable for a production environment, i.e. battle-tested/dependable/secure Do you have an experience-based recommendation?
stackexchange/codereview
I have written a DLL that uses MS Word to spell check the content of a RichtextBox. The project uses Microsoft Word 11.0 Object Library. I have read that you can use that reference on machines using that version of Word or later, and that seem to be true. However ... When I run the dll in a test app on a machine with ...
stackexchange/codereview
The output we get when printing C++ sources from Eclipse is rather ugly. Is there are way/a plugin to pretty print C++ source code like e.g. with a2ps (which is probably using yet another filter for C source code)?
stackexchange/codereview
Does anyone know of a freely available java 1.5 package that provides a list of ISO 3166-1 country codes as a enum or EnumMap? Specifically I need the "ISO 3166-1-alpha-2 code elements", i.e. the 2 character country code like "us", "uk", "de", etc. Creating one is simple enough (although tedious), but if there's a st...
stackexchange/codereview
When working on a linx CShell u get the option to press the up / down arrows to select the last command/s typed or the Command Buffer. This even works on Windows. However this is not functional when working on Solaris, to which i recently switched. I am guessing that the shell is also a CShell. Please tell me what key...
stackexchange/codereview
I'm writing a setup program to install an application to a USB drive. The application is meant to be used only from USB drives, so it would save an extra step for the user by automatically selecting USB drive to install to. I might explore using Nullsoft or MSI for install, but since I'm mostly familiar with .NET I ini...
stackexchange/codereview
I need to implement an audit trail for Add/Edit/Delete on my objects,I'm using an ORM (XPO) for defining my objects etc. I implemented an audit trail object that is triggered on OnSaving OnDeleting Of the base object, and I store the changes in Audit-AuditTrail (Mast-Det) table, for field changes. etc. using some m...
stackexchange/codereview
Some of my colleagues use special comments on their bug fixes, for example: // 2008-09-23 John Doe - bug 12345 // <short description> Does this make sense? Do you comment bug fixes in a special way? Please let me know.
stackexchange/codereview
I have a Excel macro that generates a this error whenever it gets input of a specific format. Does anyone knows in general what an advise flag is OR where can I find information on this type of error? Thanks Runtime error -2147221503 (80040001): Automation error, Invalid advise flags
stackexchange/codereview
I have gone through their developer guide but haven't been able to find a way to print the value at points (in case of line charts) or after bars (bar charts).Is there a way to do it?
stackexchange/codereview
Okay, we know that the following two lines are equivalent - (0 == i) (i == 0) Also, the first method was encouraged in the past because that would have allowed the compiler to give an error message if you accidentally used '=' instead of '=='. My question is - in today's generation of pretty slick IDE's and intellig...
stackexchange/codereview
I'm working on a SaaS application where each customer will have different configurations depending on the edition they have purchased, additional features they have purchased, etc. For example, a customer might have a limit of 3 custom reports. Obviously I want to store this configuration in the database, but I am unsu...
stackexchange/codereview
I have a list control in GTK+ (a gtk.TreeView with one column), with "find-as-you type" enabled (so typing any text will open a small search field for searching through the list entries). Now, if the user enters some search text like "abc", should I search only for entries starting with "abc", or should I search for en...
stackexchange/codereview
I have integrated SRM 5.0 into Portal. Most of the iviews are IAC i.e., all are ITS based services. The issue is that the Portal Theme does not get reflected on these services after integration. When a BSP or Webdynpro is integrated then the application reflects the Portal Theme when executed from Portal but the ITS se...
stackexchange/codereview
I am working on a bash script where I need to conditionally execute some things if a particular file exists. This is happening multiple times, so I abstracted the following function: function conditional-do { if [ -f $1 ] then echo "Doing stuff" $2 else echo "File doesn't exist!" ...
stackexchange/codereview