instruction_seed
stringlengths
1
35.8k
_source
stringclasses
1 value
Scenario: A stored procedure receives from code a DateTime with, let's say DateTime.Now value, as a datetime parameter. The stored procedure needs to store only the date part of the datetime on the row, but preserving all date related arithmetics for, to say, do searches over time intervals and doing reports based on...
stackexchange/codereview
I've used db4o with much success on many projects in the past. Over time it seems to have evolved greatly, and with modern trends like LINQ on everyone's tongue it has peaked my interest again, especially now that I know that it is starting to support transparent activation and persistence which intrigue me quite a bit...
stackexchange/codereview
First off, I'm working on an app that's written such that some of your typical debugging tools can't be used (or at least I can't figure out how :). JavaScript, html, etc are all "cooked" and encoded (I think; I'm a little fuzzy on how the process works) before being deployed, so I can't attach VS 2005 to ie, and fire...
stackexchange/codereview
I have a strange problem on a PeopleSoft application. It appears that integration broker messages are being processed out of order. There is another possibility, and that is that the commit is being fired asynchronously, allowing the transactions to complete out of order. There are many inserts of detail records, f...
stackexchange/codereview
How to make database connection pool in PowerBuilder (v9+) with... ...ODBC? ...SQL Server? ...Oracle?
stackexchange/codereview
I'd like to automatically generate database scripts on a regular basis. Is this possible.
stackexchange/codereview
OK, so practically every database based application has to deal with "non-active" records. Either, soft-deletions or marking something as "to be ignored". I'm curious as to whether there are any radical alternatives thoughts on an `active' column (or a status column). For example, if I had a list of people CREATE TABLE...
stackexchange/codereview
Does full trust mean the same as Run As Administrator? I have read things stating that "for this to work, the application must be a full-trust application." Is that the same as you must have administrator privileges to run the application? If not, what's the difference? How can you tell if an app is "full-trust"? I...
stackexchange/codereview
What would be the best WPF control in C# (VS 2008) that you can place on a form that would allow you to do drawing similar to the "Paint" function for the CWnd class in C++? Also, that could display bitmaps, have a scroll bar, and the ability to accept user inputs (ie. MouseMove, Button Clicks, etc...). Basically all...
stackexchange/codereview
Is there a way to determine how many capture groups there are in a given regular expression? I would like to be able to do the follwing: def groups(regexp, s): """ Returns the first result of re.findall, or an empty default >>> groups(r'(\d)(\d)(\d)', '123') ('1', '2', '3') >>> groups(r'(\d)(\d)(\d)', ...
stackexchange/codereview
Given the code from the Complex Form part III how would you go about testing the virtual attribute? def new_task_attributes=(task_attributes) task_attributes.each do |attributes| tasks.build(attributes) end end I am currently trying to test it like this: def test_adding_task_to_project p = Proj...
stackexchange/codereview
is it possible to have different items in different rows within a comboboxcolumn in a datagridview. This would be using virtual mode. Code samples would be great.
stackexchange/codereview
I have two tables Organisation and Employee having one to many relation i.e one organisation can have multiple employees. Now I want to select all information of a particular organisation plus first name of all employees for this organisation. What’s the best way to do it? Can I get all of this in single record set or ...
stackexchange/codereview
I'm looking to add a numeric up / down control to a .Net StatusStrip. Unfortunately, it isn't listed as an option in the UI designer. Is there a way to do this?
stackexchange/codereview
Since Java 6 there is a class java.awt.Desktop. There are some nice methods but the class is not supported on all platforms. The methods java.awt.Desktop.getDesktop() throws an java.lang.UnsupportedOperationException: Desktop API is not supported on the current platform on some platforms. Or the method java.awt.De...
stackexchange/codereview
When I debug in Visual Studio, Firefox opens and that is annoying because of the hookups that Internet Explorer and Visual Studio have, such as when you close the Internet Explorer browser that starting debug opened, Visual Studio stops debugging. How can I get Visual Studio to open Internet Explorer instead without h...
stackexchange/codereview
I have a code snippet written in PHP that pulls a block of text from a database and sends it out to a widget on a webpage. The original block of text can be a lengthy article or a short sentence or two; but for this widget I can't display more than, say, 200 characters. I could use substr() to chop off the text at 20...
stackexchange/codereview
I have a string which is like this: this is "a test" I'm trying to write something in Python to split it up by space while ignoring spaces within quotes. The result I'm looking for is: ['this', 'is', 'a test'] PS. I know you are going to ask "what happens if there are quotes within the quotes, well, in my application...
stackexchange/codereview
I am about to start a new project and would like to document its development in a very simple blog. My requirements are: self-hosted on my Gentoo-based LAMP stack (that seems to rule out blogger) Integration in a django based website (as in www.myproject.com/about, www.myproject.com/blog etc rather than www.myproject....
stackexchange/codereview
I have a need to open a popup detail window from a gridview (VS 2005 / 2008). What I am trying to do is in the markup for my TemplateColumn have an asp:Button control, sort of like this: <asp:Button ID="btnShowDetails" runat="server" CausesValidation="false" CommandName="Details" Text="Order Details" onClientCl...
stackexchange/codereview
I am trying to build an Eclipse application that would work with a linux/motif installation target. However, this seems not to be possible even though the export option is available in the product export wizard. I've checked the content of the delta pack and indeed, the packages for linux/motif are missing. After che...
stackexchange/codereview
Given an array of n Objects, let's say it is an array of strings, and it has the following values: foo[0] = "a"; foo[1] = "cc"; foo[2] = "a"; foo[3] = "dd"; What do I have to do to delete/remove all the strings/objects equal to "a" in the array?
stackexchange/codereview
I run Vista (business x32) on my work machine, in which I do ASP.NET development. Because I use IIS to server the sites I build (I do a lot of CMS integrations so I need to use IIS not the inbuilt web development server) I always need to attach to w3wp for debugging. The problem is that w3wp requires elevated permissio...
stackexchange/codereview
Do you still use session or entity EJBs in your project? Why?
stackexchange/codereview
I have successfully connected to an Oracle database (10g) from C# (Visual Studio 2008) by downloading and installing the client administration tools and Visual Studio 2008 on my laptop. The installation footprint for Oracle Client tools was over 200Mb, and quite long winded. Does anyone know what the minimum workable f...
stackexchange/codereview
I've just introduced a friend to GNU Screen and they're having a hard time getting used to it. That makes me think about the essential things he needs to know about the excellent Screen utility, the same things that you'd think worthwhile to teach someone, a beginner, from the ground up. What are some analogies and han...
stackexchange/codereview
I want to merge multiple rss feeds into a single feed, removing any duplicates. Specifically, I'm interested in merging the feeds for the tags I'm interested in. [A quick search turned up some promising links, which I don't have time to visit at the moment] Broadly speaking, the ideal would be a reader that would lis...
stackexchange/codereview
I have been considering taking the plunge and installing Linux on my Playstation 3. As C# is my current language of choice, the next logical step would be to install Mono. I have done a little research and found that http://psubuntu.com/wiki/InstallationInstructions has instruction on installing Ubuntu and links to do...
stackexchange/codereview
So, at my current job we're usually 1-3 developers, 1-2 art directors and 1 project manager on each project, with the smallest ones just being one of each and the larger ones being three developers and two art directors. I'm looking for a software, combination of softwares or some type of service that will allow us to ...
stackexchange/codereview
I want to emulate the delete confirmation page behavior before saving certain models in the admin. In my case if I change one object, certain others should be deleted as they depend upon the object's now out-of-date state. I understand where to implement the actual cascaded updates (inside the parent model's save...
stackexchange/codereview
First of all, this question regards MySQL 3.23.58, so be advised. I have 2 tables with the following definition: Table A: id INT (primary), customer_id INT, offlineid INT Table B: id INT (primary), name VARCHAR(255) Now, table A contains in the range of 65k+ records, while table B contains ~40 records. In addition to...
stackexchange/codereview
I'm building an install using VS 2003. The install has an Excel workbook and two Access databases. I need to force the Access files to load regardless of the create/mod date of the existing databases on the user's computer. I currently use ORCA to force in a Version number on the two files, but would like to find a sim...
stackexchange/codereview
I have just installed a build server with a 64 bit windows server 2008 for continuous integration. The reason I choose a 64 bit server was to have more than ~3Gb of RAM. I had hopes that this machine would provide blazing fast builds. Unfortunately, the result are lacking greatly to say the least. My desktop provides ...
stackexchange/codereview
C++ seems to be rather grouchy when declaring templates across multiple files. More specifically, when working with templated classes, the linker expect all method definitions for the class in a single compiler object file. When you take into account headers, other declarations, inheritance, etc., things get really mes...
stackexchange/codereview
I am working on a winforms application using LINQ to SQL - and am building the app using a SQL Express instance on my workstation. The final installation of the project will be on a proper SQL Server 2005. The database has the same name, and all tables are identical but the hostname is different. The only way I have...
stackexchange/codereview
Here at work, we often need to find a string from the list of strings that is the closest match to some other input string. Currently, we are using Needleman-Wunsch algorithm. The algorithm often returns a lot of false-positives (if we set the minimum-score too low), sometimes it doesn't find a match when it should (wh...
stackexchange/codereview
For a project I'm working on. I need to look for an executable on the filesystem. For UNIX derivatives, I assume the user has the file in the mighty $PATH variable, but there is no such thing on Windows. I can safely assume the file is at most 2 levels deep into the filesystem, but I don't know on what drive it will be...
stackexchange/codereview
I'm used to python, so this is a bit confusing to me. I'm trying to take in input, line-by-line, until a user inputs a certain number. The numbers will be stored in an array to apply some statistical maths to them. Currently, I have a main class, the stats classes, and an "reading" class. Two Questions: I can't seem t...
stackexchange/codereview
I use ssh-agent with password-protected keys on Linux. Every time I log into a certain machine, I do this: eval `ssh-agent` && ssh-add This works well enough, but every time I log in and do this, I create another ssh-agent. Once in a while, I will do a killall ssh-agent to reap them. Is there a simple way to reuse the...
stackexchange/codereview
I have looked at the ability to use tabs in Vim (with :tabe, :tabnew, etc.) as a replacement for my current practice of having many files open in the same window in hidden buffers. I would like every distinct file that I have open to always be in its own tab. However, there are some things that get in the way of this. ...
stackexchange/codereview
I am trying to sort a dict based on its key and return an iterator to the values from within an overridden iter method in a class. Is there a nicer and more efficient way of doing this than creating a new list, inserting into the list as I sort through the keys?
stackexchange/codereview
I'm working on a webapp, and every so often we run into situations where pages will load without applying CSS. This problem has shown up in IE6, IE7, Safari 3, and FF3. A page refresh will always fix the problem. There are 3 CSS files loaded, all within the same style block using @import: <STYLE type="text/css"> @imp...
stackexchange/codereview
I recently received an email from my girlfriend that spamassassin marked as spam, mostly because spamassassin detected a tracker ID... except there wasn't one. I'd like to know what triggered it, so that I can report a sensible bug.
stackexchange/codereview
I'm having a problem debugging an Eclipse Application from Eclipse. When I launch the Debug Configuration, the Eclipse Application starts up and then stops repeatedly. It shows the splash screen and then disappears. This is the farthest it gets before restarting: MyDebugConfiguration [Eclipse Application] org....
stackexchange/codereview
The background should be transparent, but the text should not.
stackexchange/codereview
How would you define testing? In the interest of full disclosure, I'm posting this because I already have some answers I like.
stackexchange/codereview
I installed MySQL via MacPorts. What is the command I need to stop the server (I need to test how my application behave when MySQL is dead)?
stackexchange/codereview
Embedded custom-tag in dynamic content (nested tag) not rendering. I have a page that pulls dynamic content from a javabean and passes the list of objects to a custom tag for processing into html. Within each object is a bunch of html to be output that contains a second custom tag that I would like to also be rendered....
stackexchange/codereview
We have an ASP.NET application running at a customer site that uses ActiveDirectory for user login via the ActiveDirectoryMembershipProvider. Their primary domain controller that we were pointing to went down this morning, and in getting everything set back up the client was wondering if we could have a redundant conne...
stackexchange/codereview
This is probably a complex solution. I am looking for a simple operator like ">>", but for prepending. I am afraid it does not exist. I'll have to do something like mv myfile tmp cat myheader tmp > myfile Anything smarter?
stackexchange/codereview
I have a web application running on a Gentoo-based LAMP stack. My customers buy the software as a service and I host everything. However, there is some demand for on-site deployment inside the clients' own networks. Currently, because I host the system, there is no built-in license management in the app. I bill based o...
stackexchange/codereview
I'm a bit stuck on this. Basically I want to do something like the following SQL query in LINQ to SQL: SELECT f.* FROM Foo f WHERE f.FooId IN ( SELECT fb.FooId FROM FooBar fb WHERE fb.BarId = 1000 ) Any help would be gratefully received.
stackexchange/codereview
i have a list of products that are being displayed in particular order. store admin can reassign the display order, by moving the "hot" items to the top of the list. what's the best way of implementing the admin functionality UI [asp.net C#]? Products table has a [displayOrder(int)] filed which determines the display o...
stackexchange/codereview
I have always wondered how people update a previous line in a command line. a great example of this is when using the wget command in linux. It creates an ASCII loading bar of sorts that looks like this: [======>                    ] 37% and of course the loading bar moves and the percent changes, But it doesn't make...
stackexchange/codereview
I've been using Visual Studio for a long time and the constant shuffling of the code tabs at the top drives me bonkers. I was wondering if there were any add-ins that might change this or other UI behavior. Things that might be cool: Sticky Tabs that won't go away. Multi-code file collapsible tabs (maybe each tab bein...
stackexchange/codereview
I am looking for a .NET implementation of a priority queue or heap data structure Priority queues are data structures that provide more flexibility than simple sorting, because they allow new elements to enter a system at arbitrary intervals. It is much more cost-effective to insert a new job into a priority queue tha...
stackexchange/codereview
I have VB6 application , I want to put some good error handling finction in it which can tell me what was the error and exact place when it happened , can anyone suggest the good way to do this
stackexchange/codereview
I have a number of application settings (in user scope) for my custom grid control. Most of them are color settings. I have a form where the user can customize these colors and I want to add a button for reverting to default color settings. How can I read the default settings? For example: I have a user setting named ...
stackexchange/codereview
I have a string, say '123', and I want to convert it to the integer 123. I know you can simply do some_string.to_i, but that converts 'lolipops' to 0, which is not the effect I have in mind. I want it to blow up in my face when I try to convert something invalid, with a nice and painful Exception. Otherwise, I can't di...
stackexchange/codereview
We have a production machine and are trying to slowly introduce some 3.0 and up features on our web application. 3.5 is installed but I would like to upgrade to SP1, I would just like to know if it requires a restart of the machine in the end so I can schedule some down time. Thanks! EDIT: so it did require the restart...
stackexchange/codereview
In ASP.NET, if I databind a gridview with a array of objects lets say , how can I retrieve and use foo(index) when the user selects the row? i.e. dim fooArr() as foo; gv1.datasource = fooArr; gv1.databind(); On Row Select Private Sub gv1_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridView...
stackexchange/codereview
I am aware of CocoaMySQL but I have not seen a Mac GUI for SQLite, is there one? My Google search didn't turn up any Mac related GUI's which is why I'm asking here rather than Google.
stackexchange/codereview
We have a graphics intensive application that seems to be experiencing problems on AMD 64 bit Dual Core platforms that are not apparent on Intel platforms. Running the application causes the CPU to run at 100%, in particular when using code for shadows and lighting (Open GL). Does anyone know of specific issues with AM...
stackexchange/codereview
I'm a PHP developer and now I use Notepad++ for code editing, but lately I've been searching for an IDE to ease my work. I've looked into Eclipse, Aptana Studio and several others, but I'm not really decided, they all look nice enough but a bit complicated. I'm sure it'll all get easy once I get used to it, but I don't...
stackexchange/codereview
In a typical enterprise scenario with in-house development, you might have dev, staging, and production environments. You might use SVN to contain ongoing development work in a trunk, with patches being stored in branches, and your released code going into appropriately named tags. Migrating binaries from one environ...
stackexchange/codereview
Is there a TortoiseSVN equivalent for OS X? I'm looking for an SVN client that will integrate with OS X's Finder and be added as Context menu items. Update: Just found SmartSVN. Anyone with feedback on it?
stackexchange/codereview
How compatible is code written under Solaris with Open Solaris ? I would be interested specifically in some kernel modules .
stackexchange/codereview
I have an application where a user has to remember and insert an unix timestamp like 1221931027. In order to make it easier to remember the key I like to reduce the number of characters to insert through allowing the characters [a-z]. So I'm searching for an algorithm to convert the timestamp to a shorter alphanum vers...
stackexchange/codereview
How can I Handler 404 errors without the framework throwing an Exception 500 error code?
stackexchange/codereview
I have quite a big solution here with a lot of different web applications and sites, around 10-15 of them. When I attach VS2008 to any process (most likely Nunit.exe or something similar) I get one Cassini process per website/application in the solution. Is there a quick way to get rid of this behaviour in VS or do I ...
stackexchange/codereview
I'm used to Atlas where the preferred (from what I know) method is to use XML comments such as: /// <summary> /// Method to calculate distance between two points /// </summary> /// /// <param name="pointA">First point</param> /// <param name="pointB">Second point</param> /// function calculatePointDistance(pointA, po...
stackexchange/codereview
Anyone got a good explanation of "combinators" (Y-combinators etc. and NOT the company)? I'm looking for one for the practical programmer who understands recursion and higher-order functions, but doesn't have a strong theory or math background. (Note: that I'm talking about these things)
stackexchange/codereview
I'm relatively new to J2ME and about to begin my first serious project. My experience in testing isn't too deep either. I'm looking for a unit test framework for J2ME. So far I've seen J2MEUnit, but I don't now how well supported it is. I've seen JavaTest Harness but I don't know if it's not an overkill. Please tell m...
stackexchange/codereview
What mysql functions are there (if any) to trim leading zeros from an alphanumeric text field? Field with value "00345ABC" would need to return "345ABC".
stackexchange/codereview
What is the best way to randomize an array of strings with .NET? My array contains about 500 strings and I'd like to create a new Array with the same strings but in a random order. Please include a C# example in your answer.
stackexchange/codereview
I would like to wipe out all data for a specific kind in Google App Engine. What is the best way to do this? I wrote a delete script (hack), but since there is so much data is timeout's out after a few hundred records.
stackexchange/codereview
I'm always wondering who should do it. In Ruby, we have the Daemons library which allows Ruby scripts to daemonize themselves. And then, looking at God (a process monitoring tool, similar to monit) page, I see that God can daemonize processes. Any definitive answer out there?
stackexchange/codereview
Is it possible to clone a virtual machine using VMware Fusion on Mac OS X? I'm trying the 30 day evaluation version but there doesn't appear to be a clone feature. I tried using the Finder to copy a VM's package structure but the copy didn't appear in the Virtual Machine Library.
stackexchange/codereview
This question is related to this one, though I think I was a little too long-winded there to really get a good answer. I'll keep this brief. I'm working on a web handler (ashx) that accepts a form post from an aspx page. When the handler receives this form post, in order to do what it needs to do, it needs to know the ...
stackexchange/codereview
I want to test the web pages I create in all the modern versions of Internet Explorer (6, 7 and 8 beta) but I work mainly on a Mac and often don't have direct access to a PC.
stackexchange/codereview
just wondering if anyone knows of a truly restful Put/delete implementation asp.net mvc preview 5 preferably.
stackexchange/codereview
Is it possible to send an email from my Java application using a GMail account? I have configured my company mail server with Java app to send email, but that's not going to cut it when I distribute the application. Answers with any of using Hotmail, Yahoo or GMail are acceptable.
stackexchange/codereview
How would you refactor these two classes to abstract out the similarities? An abstract class? Simple inheritance? What would the refactored class(es) look like? public class LanguageCode { /// <summary> /// Get the lowercase two-character ISO 639-1 language code. /// </summary> public readonly string Va...
stackexchange/codereview
How would I go about writing some code to allow access to a Java class in my webapp from the command line. E.g. I have a java class with command line interface, that can runs code in the context of the webapp, with access to the DB etc. I want to log on the machine hosting my WARred app in tomcat and be able to interac...
stackexchange/codereview
I'm looking at writing a little drum machine in Python for fun. I've googled some and found the python pages on music and basic audio as well as a StackOverflow question on generating audio files, but what I'm looking for is a decent library for music creation. Has anyone on here tried to do something like this befor...
stackexchange/codereview
Has anyone used the Sphinx speech recognition stack to build IVR applications? I am looking for open source alternatives to the expensive and somewhat limiting choices from MSFT and others. I have not been able to find a comprehensive package that ties open source speech/voip applications together.
stackexchange/codereview
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?
stackexchange/codereview
I've come across a rather interesing (and frustrating) problem with IE6. We are serving up some server generated pdfs and then simply setting headers in PHP to force a browser download of the file. Works fine and all, except in IE6 but only if the windows user account is set to standard user (ie. not administrator). Si...
stackexchange/codereview
I was wondering if there was an easy way in SQL to convert an integer to its binary representation and then store it as a varchar. For example 5 would be converted to "101" and stored as a varchar.
stackexchange/codereview
I need to test whether various types of database objects exist in a given database, and I don't know how to formulate these tests in Firebird SQL. Each test has the form "Does object of type X with name Y exist?". For example, I need to test whether a table with a given name exists. The object types I need to test are...
stackexchange/codereview
How do you resolve an NT style device path, e.g. \Device\CdRom0, to its logical drive letter, e.g. G:\ ? Edit: A Volume Name isn't the same as a Device Path so unfortunately GetVolumePathNamesForVolumeName() won't work.
stackexchange/codereview
We have been using .Net and Visual Studio for the last six years, and early on developed a number of web based reporting applications using the .Net version of Crystal Reports that was bundled with Visual Studio. I'm unimpressed with that product: It seems incredibly difficult and convoluted to use. We had to make secu...
stackexchange/codereview
I have some code in a javascript file that needs to send queries back to the server. The question is, how do I find the url for the script that I am in, so I can build a proper request url for ajax. I.e., the same script is included on /, /help, /whatever, and so on, while it will always need to request from /data.json...
stackexchange/codereview
Setting up an integration server, I’m in doubt about the best approach regarding using multiple tasks to complete the build. Is the best way to set all in just one big-job or make small dependent ones?
stackexchange/codereview
When developing (works fine live) the pages for our website don't pick up the correct CSS until the user has authenticated (logged on). So the Logon and Logoff forms look bad, but once inside the site, the CSS works again. I'm guessing it's some kind of authentication issue? Haven't really looked into it too much becau...
stackexchange/codereview
Does anyone know a good online resource for example of R code? The programs do not have to be written for illustrative purposes, I am really just looking for some places where a bunch of R code has been written to give me a sense of the syntax and capabilities of the language? Edit: I have read the basic documentation ...
stackexchange/codereview
Is there a version of memset() which sets a value that is larger than 1 byte (char)? For example, let's say we have a memset32() function, so using it we can do the following: int32_t array[10]; memset32(array, 0xDEADBEEF, sizeof(array)); This will set the value 0xDEADBEEF in all the elements of array. Currently it se...
stackexchange/codereview
What is a non recursive algorithm for deciding whether a passed in amount can be built additively from a set of numbers. In my case I'm determining whether a certain currency amount (such as $40) can be met by adding up some combination of a set of bills (such as $5, $10 and $20 bills). That is a simple example, but t...
stackexchange/codereview
There are so many reasons why using an MVC framework in Flex rocks, but picking the right one seems tricky. I am interested in what you all think from your experiences of implementing either of these (or another). Sam
stackexchange/codereview
Folks, I need a solution that allows drag-and-drop cell over the table. The cells can be of different colspans, so when the cell is dropped into the middle of another cell, which is bigger, the following steps should be performed: Another td element is created, which is equal in width to the draggable element. Cells ...
stackexchange/codereview