instruction_seed
stringlengths
1
35.8k
_source
stringclasses
1 value
I have a sequence of migrations in a rails app which includes the following steps: Create basic version of the 'user' model Create an instance of this model - there needs to be at least one initial user in my system so that you can log in and start using it Update the 'user' model to add a new field / column. Now I'm...
stackexchange/codereview
I'm trying to construct a find command to process a bunch of files in a directory using two different executables. Unfortunately, -exec on find doesn't allow to use pipe or even \| because the shell interprets that character first. Here is specifically what I'm trying to do (which doesn't work because pipe ends the ...
stackexchange/codereview
Two RAID volumes, VMware kernel/console running on a RAID1, vmdks live on a RAID5. Entering a login at the console just results in SCSI errors, no password prompt. Praise be, the VMs are actually still running. We're thinking, though, that upon reboot the kernel may not start again and the VMs will be down. We have da...
stackexchange/codereview
My company develops several types of applications. A lot of our business comes from doing multimedia-type apps, typically done in Flash. However, now that side of the house is starting to migrate towards doing Flex development. Most of our other development is done using .NET. I'm trying to make a push towards doing...
stackexchange/codereview
I'm trying to do a file system backup of a RedHat Enterprise Linux v4 server using Symantec Backup Exec 11d (Rev 7170). The backup server is Windows Server 2003. I can browse the target server to create a selection list, and when I do a test run it completes successfully. However, when I run a real backup, the job fai...
stackexchange/codereview
I need to build something that starts serving a H.264 encoded video to a flash player halfway through the file (to support skipping to a point in the video that has not been buffered yet). Currently, the videos are in the FLV container format, but transcoding is an option. I managed to re-write the file header and met...
stackexchange/codereview
Most mathematicians agree that: eπi + 1 = 0 However, most floating point implementations disagree. How well can we settle this dispute? I'm keen to hear about different languages and implementations, and various methods to make the result as close to zero as possible. Be creative!
stackexchange/codereview
I've been asked to screen some candidates for a MySQL DBA / Developer position for a role that requires an enterprise level skill set. I myself am a SQL Server person so I know what I would be looking for from that point of view with regards to scalability / design etc but is there anything specific I should be asking ...
stackexchange/codereview
We're looking for a Transformation library or engine which can read any input (EDIfact files, CSV, XML, stuff like that. So files (or webservices results) that contain data which must be transformed to a known business object structure.) This data should be transformed this to a existing business object using custom ...
stackexchange/codereview
Is there a limit with the number of SSL connections? We are trying to connect through SSL with 2000 sessions. We have tried it a couple of times but it always dies at 1062nd. Is there a limit?
stackexchange/codereview
Ok, so I demo'd Refactor Pro and Resharper, I'm more comfortable with Resharper so that's what I bought. When I uninstalled Refactor Pro I thought everything was breezy. However, now when I open Visual Studio I get The Add-in 'DevExpress Tools' failed to load or caused and exception, woudl you like to remove this Add ...
stackexchange/codereview
I am trying to get some accurate runtime comparisons of PHP vs Python (and potentially any other language that I have to include). Timing within a script is not my problem but timing within a script does not account for everything from the moment the request is made to run the script to output. 1) Is it actually worth...
stackexchange/codereview
I am using Adobe Flex/Air here, but as far as I know this applies to all of JavaScript. I have come across this problem a few times, and there must be an easy solution out there! Suppose I have the following XML (using e4x): var xml:XML = <root><example>foo</example></root> I can change the contents of the example nod...
stackexchange/codereview
As a consultant I get to toy around with many different products and APIs as the customer demands we use X and Y. I think it is great fun and I learn a lot from it. What will make a great developer over time is, in my opinion, the will to understand and learn new things. Therefore, I will always try to understand what ...
stackexchange/codereview
I'm trying to figure out why the control does not honor ZIndex. Example 1 - which works fine <Canvas> <Rectangle Canvas.ZIndex="1" Height="400" Width="600" Fill="Yellow"/> <Rectangle Canvas.ZIndex="2" Height="100" Width="100" Fill="Red"/> </Canvas> Example 2 - which does not work <Canvas> ...
stackexchange/codereview
What is the difference between TrueType fonts and Type-1 fonts?
stackexchange/codereview
I'd like to know what's the way to actually set the icon of a .bat file to an arbitrary icon. How would I go about doing that programmatically, independently of the language I may be using.
stackexchange/codereview
My gut feel is that document based web services are preferred in practice - is this other peoples experience? Are they easier to support? (I noted that SharePoint uses Any for the "document type" in its WSDL interface, I guess that makes it Document based). Also - are people offering both WSDL and Rest type services n...
stackexchange/codereview
I have several tables whose only unique data is a uniqueidentifier (a Guid) column. Because guids are non-sequential (and they're client-side generated so I can't use newsequentialid()), I have made a non-primary, non-clustered index on this ID field rather than giving the tables a clustered primary key. I'm wondering ...
stackexchange/codereview
I recently discovered the org-mode in emacs and it works very well for me. I also like www.RememberTheMilk.com. I would like to be able to sync my org-mode file and RTM list. I know that RTM has its API exposed as web services. I am currently looking for a HTTP library that I could use to write my script. I found a cou...
stackexchange/codereview
I have a ~23000 line SQL dump containing several databases worth of data. I need to extract a certain section of this file (i.e. the data for a single database) and place it in a new file. I know both the start and end line numbers of the data that I want. Does anyone know a Unix command (or series of commands) to extr...
stackexchange/codereview
I want to know what exactly is the sequence of calls that occurs when a getter/setter created through Class::MethodMaker is called? How much costlier are getter/setters defined by MethodMaker than the native ones (overwritten in the module)?
stackexchange/codereview
I'm developing a compiler framework for .NET and want a flexible way of defining pipelines. I've considered the following options: WWF Custom XML pipeline description Custom pipeline description in code (using Nemerle's macros to define syntax for it) Other code-based description Requirements: Must not depend on fu...
stackexchange/codereview
Does anyone know of any good tutorials on ADO.NET Entity Framework? There are a few useful links here at Stack OverFlow, and I've found one tutorial at Jason's DotNet Architecture Blog, but can anyone recommend any other good tutorials? Any tutorials available from Microsoft, either online or as part of any conference...
stackexchange/codereview
If I inherit from a base class and want to pass something from the constructor of the inherited class to the constructor of the base class, how do I do that? For example, if I inherit from the Exception class I want to do something like this: class MyExceptionClass : Exception { public MyExceptionClass(string mess...
stackexchange/codereview
I'm using Delphi and need to get the current Windows DNS server IP address so I can do a lookup. What function should I call to find it? The only solution I have right now does an ipconfig/all to get it, which is horrible.
stackexchange/codereview
I know that just using rand() is predictable, if you know what you're doing, and have access to the server. I have a project that is highly dependent upon choosing a random number that is as unpredictable as possible. So I'm looking for suggestions, either other built-in functions or user functions, that can generate a...
stackexchange/codereview
The Setting: The program in question tries to post form data via an AJAX call to a target procedure contained in the same package as the caller. This is done for a site that uses a secure connection (HTTPS). The technology used here is PLSQL and the DOJO JavaScript library. The development tool is basically a text edit...
stackexchange/codereview
Let's say I want to run a .NET application on a machine where the .NET framework is not available; Is there any way to compile the application to native code?
stackexchange/codereview
I've created a simple desktop application in C# 3.0 to learn some C#, wpf and .Net 3.5. My application essentially reads data from a csv file and stores it in a SQL server CE database. I use sqlmetal to generate the ORM code for the database. My first iteration of this app is ugly as hell and I'm in the process of refa...
stackexchange/codereview
I've just heard the term covered index in some database discussion - what does it mean?
stackexchange/codereview
I'd like to display 100 floating cubes using DirectX or OpenGL. I'm looking for either some sample source code, or a description of the technique. I have trouble getting more one cube to display correctly. I've combed the net for a good series of tutorials and although they talk about how to do 3D primitives, what I c...
stackexchange/codereview
I'm working on a multithreaded C++ application that is corrupting the heap. The usual tools to locate this corruption seem to be inapplicable. Old builds (18 months old) of the source code exhibit the same behavior as the most recent release, so this has been around for a long time and just wasn't noticed; on the dow...
stackexchange/codereview
What is the correct way to get the process size on Solaris, HP-UX and AIX? Should we use top or ps -o vsz or something else?
stackexchange/codereview
I've been using WWF for a while as part of an internal call center application (ASP.NET), and while learning it was a good practice in understanding how a state machine based workflow system should work, I am definitely not in love with WWF itself. In my opinion it is: Overly complex, especially for use within web app...
stackexchange/codereview
What I want is lots of nodes which can expand making a mind map. I'd ideally like to expand and collapse nodes. I would like to be able to navigate by either dragging around the page, or by following expanded nodes.
stackexchange/codereview
I'm sure many readers on SO have used Lutz Roeder's .NET reflector to decompile their .NET code. I was amazed just how accurately our source code could be recontructed from our compiled assemblies. I'd be interested in hearing how many of you use obfuscation, and for what sort of products? I'm sure that this is a muc...
stackexchange/codereview
I was wondering if there is any good and clean object-oriented programming (OOP) implementation of Bayesian filtering for spam and text classification? This is just for learning purposes.
stackexchange/codereview
I've been wondering what exactly are the principles of how the two properties work. I know the second one is universal and basically doesn't deal with time zones, but can someone explain in detail how they work and which one should be used in what scenario?
stackexchange/codereview
Several times now I've been faced with plans from a team that wants to build their own bug tracking system - Not as a product, but as an internal tool. The arguments I've heard in favous are usually along the lines of : Wanting to 'eat our own dog food' in terms of some internally built web framework Needing some high...
stackexchange/codereview
I have recently upgraded some of my web applications to ASP.NET 3.5 by installing the framework on the server and setting up my web applications acrodingly and all is well, however. On some pages, I want to clear the current contents of the response buffer with code like this: Response.Clear(); // Output some stuff Res...
stackexchange/codereview
I use a stream reader to import some data and at the moment I hardcode a small sample file in the test to do the job. Is it sensible to use Mock Objects with this and how ?
stackexchange/codereview
I need to script the creation of app pools and websites on IIS 6.0. I have been able to create these using adsutil.vbs and iisweb.vbs, but don't know how to set the version of ASP.NET for the sites I have just created to 2.0.50727.0. Ideally I would like to adsutil.vbs to update the metabase. How do I do this?
stackexchange/codereview
Today I was working on a tab navigation for a webpage. I tried the Sliding Doors approach which worked fine. Then I realized that I must include an option to delete a tab (usually a small X in the right corner of each tab). I wanted to use a nested anchor, which didn't work because it is not allowed. Then I saw the ta...
stackexchange/codereview
I've got two models: Message and Attachment. Each attachment is attached to a specific message, using a ForeignKey on the Attachment model. Both models have an auto_now DateTimeField called updated. I'm trying to make it so that when any attachment is saved, it also sets the updated field on the associated message to n...
stackexchange/codereview
I am looking for a 3rd party solution to integrate a QR code reader in Windows Mobile Applications (.NET Compact Framework). The component should integrate Reader (camera) and Decoder (algorithm). I tried out the QuickMark reader, which can be called outside the application and communicates using Windows Messages. It w...
stackexchange/codereview
Alright. So I figure it's about time I get into unit testing, since everyone's been banging on about it for long enough. I've installed NUnit and gone through a few "intro to unit testing" type tutorials. I'm currently putting together a small framework to help with the rebuild of one of our web apps, so I've created ...
stackexchange/codereview
What are in your opinion the best resources (books or web pages) describing algorithms or techniques to use for collision detection in a 2D environment? I'm just eager to learn different techniques to make more sophisticated and efficient games. ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
stackexchange/codereview
I want some links to include a fragment identifier. Like some of the URLs on this site: Debugging: IE6 + SSL + AJAX + post form = 404 error#5626 Is there a way to do this with any of the built-in methods in MVC? Or would I have to roll my own HTML helpers?
stackexchange/codereview
It is supposed to be backwards compatible with HTML4 and XHTML. John Resig posted about some of the benefits. As long as we don't use any of the new and not supported yet features, would there be any downside to start building sites with this doctype?
stackexchange/codereview
Does anyone know of any good tools (I'm looking for IDEs) to write assembly on the Mac. Xcode is a little cumbersome to me. Also, on the Intel Macs, can I use generic x86 asm? Or is there a modified instruction set? Any information about post Intel. Also: I know that on windows, asm can run in an emulated environment ...
stackexchange/codereview
To commemorate the public launch of Stack Overflow, what's the shortest code to cause a stack overflow? Any language welcome. ETA: Just to be clear on this question, seeing as I'm an occasional Scheme user: tail-call "recursion" is really iteration, and any solution which can be converted to an iterative solution relat...
stackexchange/codereview
I'm trying to unit test a custom ConfigurationSection I've written, and I'd like to load some arbitrary configuration XML into a System.Configuration.Configuration for each test (rather than put the test configuration xml in the Tests.dll.config file. That is, I'd like to do something like this: Configuration testConf...
stackexchange/codereview
I'm designing a database table and asking myself this question: How long should the firstname field be? Does anyone have a list of reasonable lengths for the most common fields, such as first name, last name, and email address?
stackexchange/codereview
I've got a rails application where users have to log in. Therefore in order for the application to be usable, there must be one initial user in the system for the first person to log in with (they can then create subsequent users). Up to now I've used a migration to add a special user to the database. After asking th...
stackexchange/codereview
In php I have open a .php file and want to evaluate certain lines. Specifically when the $table_id and $line variables are assigned a value. Within the text file I have: ... $table_id = 'crs_class'; // table name $screen = 'crs_class.detail.screen.inc'; // file identifying screen structure ....
stackexchange/codereview
I have a rails application running on a Linux server. I would like to interact with Outlook/Exchange 2003 appointments from the rails application. For example, certain actions should trigger sending an appointment, and then preferably accepting/canceling the appointment in Outlook should trigger events in the applicati...
stackexchange/codereview
I am looking for a good JavaScript library for parsing XML data. It should be much easier to use than the built-in XML DOM parsers bundled with the browsers. I got spoiled a bit working with JSON and am looking forward to something on similar lines for XML.
stackexchange/codereview
As I get more and more namespaces in my solution, the list of using statements at the top of my files grows longer and longer. This is especially the case in my unit tests where for each component that might be called I need to include the using for the interface, the IoC container, and the concrete type. With upwar...
stackexchange/codereview
I have a large CSV file and I want to execute a stored procedure for each line. What is the best way to execute a stored procedure from PowerShell?
stackexchange/codereview
I have an ASP.NET webservice with along the lines of: [WebService(Namespace = "http://internalservice.net/messageprocessing")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [ToolboxItem(false)] public class ProvisioningService : WebService { [WebMethod] public XmlDocument ProcessMessage(XmlDocum...
stackexchange/codereview
I was trying to set a breakpoint in global.asa in an old classic ASP project with IIS 6 in Visual Studio 2005. Somehow the context menu for actually setting the breakpoint somewhere in global.asa is disabled (greyed). How can I set a breakpoint then? Breakpoints in .asp pages are no problem though and do work fine.
stackexchange/codereview
An instance of class A instantiates a couple of other objects, say for example from class B: $foo = new B(); I would like to access A's public class variables from methods within B. Unless I'm missing something, the only way to do this is to pass the current object to the instances of B: $foo = new B($this); Is this...
stackexchange/codereview
How do I save a jpg image to database and then load it in Delphi using FIBplus and TImage?
stackexchange/codereview
I am developing a web site and need to see how it will look at different resolutions. The catch is that it must work on our Intranet. Is there a free solution?
stackexchange/codereview
I'm quoting part of an answer which I received for another question of mine: In the PHP/MySQL world I would say stored procedures are no-go I would like to know: Is that so? Why? Why not? [edit]I mean this as a general question without a specific need in mind[/edit]
stackexchange/codereview
Is there an easy way to avoid dealing with text encoding problems?
stackexchange/codereview
I am trying to refactor some code I have for software that collects current status of agents in a call queue. Currently, for each of the 6 or so events that I listen to, I check in a Mnesia table if an agent exists and change some values in the row depending on the event or add it as new if the agent doesn't exist. Cur...
stackexchange/codereview
What's the best way to do the semantic equivalent of the traditional sleep() system call from within an Informix SPL routine? In other words, simply "pause" for N seconds (or milliseconds or whatever, but seconds are fine). I'm looking for a solution that does not involve linking some new (perhaps written by me) C co...
stackexchange/codereview
The StackOverflow transcripts are enormous, and sometimes I want to link to a little bit within it. How do I create an HTML anchor in a FogBugz wiki page?
stackexchange/codereview
I'm not sure if it's my system, although I haven't done anything unusual with it, but I've started noticing incorrectly rendered characters popping up in web pages, text-files, like this: http://www.kbssource.com/strange-characters.gif I have a hunch it's a related to the fairly recent trend to use unicode for everythi...
stackexchange/codereview
My GPS logger occassionally leaves "unfinished" lines at the end of the log files. I think they're only at the end, but I want to check all lines just in case. A sample complete sentence looks like: $GPRMC,005727.000,A,3751.9418,S,14502.2569,E,0.00,339.17,210808,,,A*76 The line should start with a $ sign, and end wi...
stackexchange/codereview
Is there is any way to change the datasource location for a report and all of it's subreports without having to open each of them manually?
stackexchange/codereview
Are square brackets in URLs allowed? I noticed that Apache commons HttpClient (3.0.1) throws an IOException, wget and Firefox however accept square brackets. URL example: http://example.com/path/to/file[3].html My HTTP client encounters such URLs but I'm not sure whether to patch the code or to throw an exception (as ...
stackexchange/codereview
How can I determine all of the assemblies that my .NET desktop application has loaded? I'd like to put them in the about box so I can query customers over the phone to determine what version of XYZ they have on their PC. It would be nice to see both managed and unmanaged assemblies. I realize the list will get long b...
stackexchange/codereview
I recently asked about keyword expansion in Git and I'm willing to accept the design not to really support this idea in Git. For better or worse, the project I'm working on at the moment requires SVN keyword expansion like this: svn propset svn:keywords "Id" expl3.dtx to keep this string up-to-date: $Id: expl3.dtx 80...
stackexchange/codereview
I know this site is written using ASP.Net MVC and I do not see "/Home" in the url. This proves to me that it can be done. What special route and do I need?
stackexchange/codereview
GDI+ DrawLines function has a clipping bug that can be reproduced by running the following c# code. When running the code, two line paths appear, that should be identical, because both of them are inside the clipping region. But when the clipping region is set, one of the line segment is not drawn. protected override...
stackexchange/codereview
Sometimes a labeled break or continue can make code a lot more readable. OUTERLOOP: for ( ;/*stuff*/; ) { //...lots of code if ( isEnough() ) break OUTERLOOP; //...more code } I was wondering what the common convention for the labels was. All caps? first cap?
stackexchange/codereview
So I came across an interesting problem today. We have a WCF web service that returns an IList. Not really a big deal until I wanted to sort it. Turns out the IList interface doesn't have a sort method built in. I ended up using the ArrayList.Adapter(list).Sort(new MyComparer()) method to solve the problem but it just...
stackexchange/codereview
I have a winform app that calls a web service to check for updates. This works in dev and it also works everywhere else I've tried it, just not on the installed copy on my machine (which happens to be the same in dev). The error is: Cannot execute a program. The command being executed was "C:\WINDOWS\Microsoft.NET\Fra...
stackexchange/codereview
What tool would you recommend to detect Java package cyclic dependencies, knowing that the goal is to list explicitly the specific classes involved in the detected 'across-packages cycle'? I know about classycle and JDepend, but they both fail to list the classes involved in a cyclic package dependency. Metrics has an ...
stackexchange/codereview
How is it possible to read/write to the Windows registry using Java?
stackexchange/codereview
Now that most of the major browsers support full page zoom (at present, the only notable exception being Google Chrome), are liquid or elastic layouts no longer needed? Is the relative pain of building liquid/elastic layouts worth the effort? Are there any situations where a liquid layout would still be of benefit? Is ...
stackexchange/codereview
The default check-in action for a work-item is "resolve". I'd like to set it to "associate" so that this work item isn't automaticaly closed if I check-in stuff too fast. How can I do that?
stackexchange/codereview
When creating a web application, and lets say you have a User object denoting a single user, what do you think is the best way to store that the user has logged in? Two ways I've thought about have been: Stored the user database id in a session variable Stored the entire user object in a session variable Any better s...
stackexchange/codereview
I have a route that I am calling through a RedirectToRoute like this: return this.RedirectToRoute("Super-SuperRoute", new { year = selectedYear }); I have also tried: return this.RedirectToRoute("Super-SuperRoute", new { controller = "Super", action = "SuperRoute", id = "RouteTopic", year = selectedYear }); The rout...
stackexchange/codereview
I got this error today when trying to open a Visual Studio 2008 project in Visual Studio 2005: The imported project "C:\Microsoft.CSharp.targets" was not found.
stackexchange/codereview
I wonder if anyone uses commercial/free java obfuscators on his own commercial product. I know only about one project that actually had an obfuscating step in the ant build step for releases. Do you obfuscate? And if so, why do you obfuscate? Is it really a way to protect the code or is it just a better feeling for the...
stackexchange/codereview
Our team is creating a new recruitment workflow system to replace an old one. I have been tasked with migrating the old data into the new schema. I have decided to do this by creating a small Windows Forms project as the schema are radically different and straight TSQL scripts are not an adequate solution. The main sea...
stackexchange/codereview
When I try to create a SQL Server Login by saying CREATE LOGIN [ourdomain\SQLAccessGroup] FROM WINDOWS; I get this error The server principal 'ourdomain\SQLAccessGroup' already exists. However, when I try this code DROP LOGIN [ourdomain\SQLAccessGroup] I get this error Cannot drop the login 'ourdomain\SQLAccessGro...
stackexchange/codereview
In PHP, how can I replicate the expand/contract feature for Tinyurls as on search.twitter.com?
stackexchange/codereview
When trying to implement an asynchronous API calls / Non-blocking calls, I know a little in a All Plain-C application I have, I read a about APM (Asynchronous Programming Model) by 'Delegates'. Basically what I want to do is call one API f1() to do a functionality(which takes long time 8-10 seconds), So I call that API...
stackexchange/codereview
What is the preferred way to remove spaces from a string in C++? I could loop through all the characters and build a new string, but is there a better way?
stackexchange/codereview
In subclipse, the Team > Update menu option performs an "svn update -r HEAD". I want to run "svn update -r [revision number]" but can't find a menu option which will let me update to anything besides the HEAD revision.
stackexchange/codereview
input: phrase 1, phrase 2 output: semantic similarity value (between 0 and 1), or the probability these two phrases are talking about the same thing
stackexchange/codereview
My designer keeps throwing out the term "liquid" layout. What does this mean? Thanks for the clarification, I have always just called this a percentage layout, and thought he was saying that the pieces could be moved around, and that was liquid
stackexchange/codereview
std::vector<int> ints; // ... fill ints with random values for(std::vector<int>::iterator it = ints.begin(); it != ints.end(); ) { if(*it < 10) { *it = ints.back(); ints.pop_back(); continue; } it++; } This code is not working because when pop_back() is called, it is invalidat...
stackexchange/codereview
After reading Hidden Features of C# I wondered, What are some of the hidden features of Java?
stackexchange/codereview
I have a solution with multiple project. I am trying to optimize AssemblyInfo.cs files by linking one solution wide assembly info file. What are the best practices for doing this? Which attributes should be in solution wide file and which are project/assembly specific? Edit: If you are interested there is a follow up ...
stackexchange/codereview