instruction_seed
stringlengths
1
35.8k
_source
stringclasses
1 value
In this asp.net I'm cleaning up it's possible for deadlocks to occur. I want to make sure that the code deals with them properly, so I'm trying to write NUnit tests which trigger a deadlock..... The DAO is split by entity. Each entity has a set of tests which are surrounded by Startup() and Teardown() methods which c...
stackexchange/codereview
How can i release the memory that I used for a variable (e.g. a long string) in C?
stackexchange/codereview
I'm experimenting with internationalization by making a Hello World program that uses properties files + ResourceBundle to get different strings. Specifically, I have a file "messages_en_US.properties" that stores "hello.world=Hello World!", which works fine of course. I then have a file "messages_ja_JP.properties" whi...
stackexchange/codereview
Are there PHP libraries which can be used to fill PDF forms and then save (flatten) them to PDF files?
stackexchange/codereview
I have several wpf pages with update/delete/add buttons. I want to display to the user messages like "successful delete", etc. How can I best implement this so the message is defined in a single place (similar to an asp.net master page) and I can update this message from anywhere?
stackexchange/codereview
I've never had to do IPC on Windows before. I'm developing a pair of programs, a standard GUI/CLI app, and a windows service. The app has to tell the service what to do. So, assuming the communication is local only, what would be the best communication method for these two processes? By best I mean more robust and less...
stackexchange/codereview
What I would like is a method to convert a double to a string which rounds using the half-up method - i.e. if the decimal to be rounded is 5, it always rounds up to the next number. This is the standard method of rounding most people expect in most situations. I also would like only significant digits to be displayed -...
stackexchange/codereview
I'm developing a simple console application in Visual Studio 2008 and want to run it in the output window inside Visual Studio 2008, instead of having a separate command prompt window come up. Is there a way to do this?
stackexchange/codereview
I want to post an xml document to an asp page from an asp.net page. If I use WebRequest with content/type text/xml the document never gets to the asp page. How can I do this ?
stackexchange/codereview
In terms of Webserver and low package size installation.
stackexchange/codereview
the question I am having is: when running my app with a launch code other than sysAppLaunchCmdNormalLaunch, I can not use code outside the default code segment - but could I use a shared library that is multi-segmented, thus circumventing this problem? A bit of background information: I am evaluating the possibility of...
stackexchange/codereview
I'm looking for an easiest way how to implement the "suggest" feature for a text entry field in a Rails application. The idea is to complete names stored in a database column, giving the user a drop-down menu of possible matches as he types. Thanks for any suggestions!
stackexchange/codereview
I want to keep multiple web site projects in one solution and I want to publish them all together in one folder. What are the steps to do that? Can I publish the whole solution? I am guessing the solution is only a container that is holding different web site projects. I want to publish all these small web site project...
stackexchange/codereview
Although my question might seem abstract I hope it's not. Suppose I develop an application, an ASP.NET MVC site and later I am tasked to build an Winforms client for this application how much and how can I reuse from the existing application? I defined the models, I defined controllers and views. They all work well. No...
stackexchange/codereview
I know there are several plugins that do asynchronous processing. Which one is the best one and why? The ones I know about are: BackgrounDRb
stackexchange/codereview
I want to programmatically create a new column in an MS Access table. I've tried many permutations of ALTER TABLE MyTable Add MyField DECIMAL (9,4) NULL; and got: Syntax Error in Field Definition I can easily create a number field that goes to a Double type, but I want decimal. I would very strongly prefer to do ...
stackexchange/codereview
I am attempting to use linq to shape list of data into a particular shape to be returned as Json from an ajax call. Given this data: var data = new List<string>(); data.Add("One"); data.Add("Two"); data.Add("Three"); And this code: ** Which is not correct and is what needs to be fixed!! ** var shaped = data.Select(c =...
stackexchange/codereview
I've got a LOT of tests written for a piece of software (which is a GREAT thing) but it was built essentially as a standalone test in C#. While this works well enough, it suffers from a few shortcomings, not the least of which is that it isn't using a standard testing framework and ends up requiring the person running...
stackexchange/codereview
It's my understanding that common wisdom says to only use exceptions for truly exceptional conditions (In fact, I've seen that statement here at SO several times). However, Krzysztof Cwalina says: One of the biggest misconceptions about exceptions is that they are for “exceptional conditions.” The reality is that th...
stackexchange/codereview
Is it is possible, with Windows Forms in .NET, to change the opacity of a form without it automatically changing the opacity of the controls within the form? I have a form that is running maximized, that contains a flowlayoutpanel in the centre of the form with controls inside it. I would like to lower the opacity of t...
stackexchange/codereview
This is a minor bug (one I'm willing to live with in the interest of go-live, frankly), but I'm wondering if anyone else has ideas to fix it. I have a C# WinForms application. When the app is launched via the executable (not via the debugger), the first thing the user sees is a console window, followed by the main wind...
stackexchange/codereview
I am looking for validation framework and while I am already using NHibernate I am thinking of using NHibernate.validator from contrib project however I also look at MS Validation Block which seem to be robust but i am not yet get into detail of each one yet so I wonder has anyone had step into these two frameworks and...
stackexchange/codereview
To give an example of the kind of request that I can't figure out what else to do for: The application is a bowling score/stat tracker. When someone enters their scores in advanced mode, a number of stats are calculated, as well as their score. The data is modeled as: Game - members like name, user, reference to the ...
stackexchange/codereview
I think there are a lot of people out there unaware of RFC's (Request for Comments). I know what they are at a logical level, but can anybody give a good description for a new developer? Also, sharing some resources on how to use and read them would be nice.
stackexchange/codereview
I've seen the following code many times: try { ... // some code } catch (Exception ex) { ... // Do something throw new CustomException(ex); // or // throw; // or // throw ex; } Can you please explain the purpose of re-throwing an exception? Is it following a pattern/best practice in excep...
stackexchange/codereview
I'm seeking a library, technique or advice on how to read an EAN-13 barcode from an image (including ISBN,and ISSN encodings). The image would come from a mobile phone or webcam, so resolution may be quite poor and not well aligned. I'm specifically interested in something that could be used from ruby on rails, but ans...
stackexchange/codereview
What are the steps needed to successfully be able to remotely debug a stored procedure (SQL Server 2005) from within VS 2005? Both client and server machines are on the same domain. I have never done this so step by step instructions would greatly be appreciated.
stackexchange/codereview
I understand that Microsoft uses this template when versioning their products: Major.Minor.Build.Revision. Major is changed when the "developers" want to show that there is a big change in the software and backward compatibility cannot be assumed. Maybe a major rewrite of the code is done. Minor number represents a s...
stackexchange/codereview
If I have a subclass that has yet to implement a function provided by the base class, I can override that function and have it throw a NotSupportedException. Is there a way to generate a compile-time error for this to avoid only hitting this at runtime? Update: I can't make the base class abstract.
stackexchange/codereview
I have an application dependent on some internal web services, and so we want our development and staging configurations to point to the development and staging servers for the web services. Right now, this means manually editing my app.config file to point to the appropriate URLs. This is not only a hassle, but prone...
stackexchange/codereview
What business cases are there for using Markov chains? I've seen the sort of play area of a markov chain applied to someone's blog to write a fake post. I'd like some practical examples though? E.g. useful in business or prediction of stock market, or the like... Edit: Thanks to all who gave examples, I upvoted each ...
stackexchange/codereview
When dropping the use of rspec and rspec-rails plugins and switching to the gem versions instead, is there anything extra I have to change in spec_helper.rb or something to make the specs in my app see the change? I can no longer get my specs to run successfully anymore after deleting the plugins and installing the ge...
stackexchange/codereview
I had developed an application in visual Studio 2005. whenever i run that application active directory locks domain my account. I really cant understand what am i doing wrong.
stackexchange/codereview
There's another post on SO relating to .NET -- not us. Pure PHP. Trying to find the best way/process to deploy stable version of our PHP app. I've seen an article on Capistrano, but am curious what else is out there. Aside from the obvious reasons, I'm also looking to add some scripting so that the SVN rev number g...
stackexchange/codereview
The Flot API documentation describes the library's extensive hooks for customizing the axes of a graph. You can set the number of ticks, their color, etc. separately for each axis. However, I can not figure out how to prevent Flot from drawing the vertical grid lines without also removing the x-axis labels. I've tried ...
stackexchange/codereview
I am trying to use the new DATETIMEOFFSET data type in SQL 2008 but I can't figure out how to get the DATETIMEOFFSET '2008-09-27 21:28:17.2930000 -07:00' to show as '2008-09-27 14:28:17.2930000' (basically applying the offset to show the local time). Does anyone know how to do this?
stackexchange/codereview
I've recently acquired a second monitor and now run VS2008 SP1 maximized on my secondary (and bigger) monitor. This theoretically has the benefit of opening the application under development on the primary monitor, where -- as it seems to me -- all newly started applications go. So far, so good. The problem though is n...
stackexchange/codereview
I want to attach a click event to a button element and then later remove it, but I can't get unclick() or unbind() event(s) to work as expected. In the code below, the button is tan colour and the click event works. window.onload = init; function init() { $("#startButton").css('background-color', 'beige').click(p...
stackexchange/codereview
My application draws all its own window borders and decorations. It works fine with Windows taskbars that are set to auto-hide, except when my application window is maximized. The taskbar won't "roll up". It will behave normally if I have the application not maximized, even when sized all the way to the bottom of the...
stackexchange/codereview
Is there any way to redefine a class or some of its methods without using typical inheritance? For example: class third_party_library { function buggy_function() { return 'bad result'; } function other_functions(){ return 'blah'; } } What can I do to replace buggy_function()? Obviously ...
stackexchange/codereview
I have a lot of nice MATLAB code that runs too slowly and would be a pain to write over in C. The MATLAB compiler for C does not seem to help much, if at all. Should it be speeding execution up more? Am I screwed?
stackexchange/codereview
I have an application where the contents of e-mails that get sent are stored in a .resx file. This is an ASP.Net application, the .resx file lives in /App_GlobalResources When I need to send an e-mail, i'm reading this using: HttpContext.GetGlobalResourceObject("MailContents", "EmailID").ToString Now, I need to us...
stackexchange/codereview
I've an example (wimobot.org) of a working directshow camera (not based on CameraDialog), but this example doesn't includes preview. I don't know how to implement the direct show filter for the preview, any sample code in C# or Visual Basic .Net? Thanks in advance
stackexchange/codereview
I'm using an expander inside a Resizer (a ContentControl with a resize gripper), and it expands/collapses properly when the control initially comes up. Once I resize it, the Expander won't properly collapse, as documented below. I ran Snoop on my application, and I don't see any heights set on Expander or its constit...
stackexchange/codereview
Let's say I've got a website that works better if a client has installed and logged into a desktop application. I'd like to be able to do 2 things: Alter the website if they haven't installed the app (to make it easy for them to find a link to the installer) If they've installed the app on a couple of machines, deter...
stackexchange/codereview
I have a program that uses the built in webbrowser control. At some point during the usage of this, I'm not sure at what point, but it appears to be random, I get the following error: System.AccessViolationException FullText = System.AccessViolationException: Attempted to read or write protected memory. This is often...
stackexchange/codereview
I have just started authoring web pages for use on "smart phones". I need to target Blackberry, WinCE, iPhone, etc. What resources or books would you recommend for someone with ample web and software development experience but no experience developing UI for these devices? What emulation kits would you recommend, an...
stackexchange/codereview
Is there any way to do this in the Powerbuilder properties window for a datawindow's textbox?
stackexchange/codereview
I want to create Code39 encoded barcodes from my application. I know I can use a font for this, but I'd prefer not to as I'd have to register the font on the server and I've had some pretty bad experiences with that. An example of what I've produced after asking this question is in the answers
stackexchange/codereview
This is an issue that I've spent hours researching in the past. It seems to me to be something that should have been addressed by modern RDBMS solutions but as yet I have not found anything that really addresses what I see to be an incredibly common need in any Web or Windows application with a database back-end. I sp...
stackexchange/codereview
Was wondering if anyone knows, or has pointers to good documentation that discusses, the low-level implementation details of Cocoa's 'performSelectorOnMainThread:' method. My best guess, and one I think is probably pretty close, is that it uses mach ports or an abstraction on top of them to provide intra-thread communi...
stackexchange/codereview
There's a feature that I'd like to see in issue tracking software that just doesn't seem to be all that common, and that is the ability to divide a ticket (bug, feature request, etc) into sub-tasks and view them in a hierarchical fashion, perhaps with some kind of progress bar style report of progress on a particular t...
stackexchange/codereview
I'm developing an application that is targeting the .NET 3.5 Framework. The application's setup installs the .NET 2.0 runtime on the target machine. So far I haven't had any issues with doing this, but I'm wondering what problems I'm going to have down the line. Do I need to be installing the 3.5 runtime? I must packag...
stackexchange/codereview
I have a collection of classes that I want to serialize out to an XML file. It looks something like this: public class Foo { public List<Bar> BarList { get; set; } } Where a bar is just a wrapper for a collection of properties, like this: public class Bar { public string Property1 { get; set; } public string Pro...
stackexchange/codereview
Consider: var something = { wtf: null, omg: null }; My JavaScript knowledge is still horribly patchy since I last programmed with it, but I think I've relearned most of it now. Except for this. I don't recall ever seeing this before. What is it? And where can I learn more about it?
stackexchange/codereview
If i have a complex XML file, is there a cheap or free way to get a rough approximation of an XSD from it?
stackexchange/codereview
I have a C# form into which I've placed a left-docked MenuStrip. This MenuStrip contains some menu items which contain submenus, and some menu items which are effectively buttons (clicking on them results in an action taking place; n.b., I realize this is not a good design). I would like to have the menu items which h...
stackexchange/codereview
I have a winforms application, the issue has to do with threading. Since I am calling 'MyCustomCode() which creates a new thread, and calls the method 'SomeMethod()' which then accesses MessageBox.Show(...). The problem has to do with threading, since the newly created thread is trying to access a control that was cre...
stackexchange/codereview
Here's the jist of the problem: Given a list of sets, such as: [ (1,2,3), (5,2,6), (7,8,9), (6,12,13), (21,8,34), (19,20) ] Return a list of groups of the sets, such that sets that have a shared element are in the same group. [ [ (1,2,3), (5,2,6), (6,12,13) ], [ (7,8,9), (21,8,34) ], [ (19,20) ] ] Note the stickeynes...
stackexchange/codereview
What do I need to do to save an image my program has generated (possibly from the camera, possibly not) to the system photo library on the iPhone?
stackexchange/codereview
I need to recursively search directories and replace a string (say http://development:port/URI) with another (say http://production:port/URI) in all the files where ever it's found. Can anyone help? It would be much better if that script can print out the files that it modified and takes the search/replace patterns as ...
stackexchange/codereview
I have an embedded PowerPoint presentation in an Excel workbook. How can I edit this (open, copy slides, add data to slides, close) using VBA?
stackexchange/codereview
I've been admiring StackOverflow's default quilt-like profile pictures (which I notice are also on the Fail Blog) and am curious what program both are using to generate them. But what I really want to know is: If you were to design the system to create default profile pictures, how would you do it? I'm looking for idea...
stackexchange/codereview
I've been searching on SO on how to do i18n support on my little application... I know that Microsoft offers 'culture' classes, but you have to re-compile your application to include any new string you add. So, all I'm trying to do is to put all my strings in a external file and offers users the choice to translate the...
stackexchange/codereview
I have an application that takes the quality results for a manufacturing process and creates graphs both to show Pareto charts of the bad, and also to show production throughput. To automate the task of testing these statistical procedures I would like to deterministically be able to add records into the database and ...
stackexchange/codereview
I'm maintaining a library that contains compiled objects that need to be linked into a 3rd party executable. sometimes the executable has been compiled for Solaris, sometimes as a 32bit Linux Application, sometimes its a 64bit linux application. What I'd love to do is pass one "path" to the library, and have the appl...
stackexchange/codereview
Application has an auxiliary thread. This thread is not meant to run all the time, but main process can call it very often. So, my question is, what is more optimal in terms of CPU performance: suspend thread when it is not being used or keep it alive and use WaitForSingleObject function in order to wait for a signal f...
stackexchange/codereview
We have a Windows machine running SQL Server 2005, and we need to be able to run some database queries on it from a Linux box. What are some of the recommended ways of doing this? Ideally, we would want a command-line utility similar to sqlcmd on Windows.
stackexchange/codereview
Hoping that someone has some info on how to parse a xfa file. I can parse csv or xml files just fine, but an xfa one has come along and I'm not familar with the format. Looks like tab delimited body with column metadata at the top. Anyone dealt with these before or can give me a steer on how to parse them? I use vb.net...
stackexchange/codereview
I don't develop too many desktop / Windows Forms applications, but it had occurred to me that there may be some benefit to using the MVC (Model View Controller) pattern for Windows Forms .NET development. Has anyone implemented MVC in Windows Forms? If so, do you have any tips on the design?
stackexchange/codereview
I am presently running several websites and a mail server from my home network. I have a business DSL account with 8 public IP addresses (1 by itself, and 7 in a block). To handle routing/firewall/gateway, I am presently using RRAS, DNS, & DHCP from Windows 2003 running on a ancient (circa 2001) PC -- which I suspect...
stackexchange/codereview
Everyone (at least everyone who uses a compiled language) has faced compilation errors but how many times do you get to actually crash the compiler? I've had my fair share of "internal compiler errors" but most went away just by re-compiling. Do you have a (minimal) piece of code that crashes the compiler?
stackexchange/codereview
What's the C++ way of parsing a string (given as char *) into an int? Robust and clear error handling is a plus (instead of returning zero).
stackexchange/codereview
I'm trying to write a faster user switching app for Windows. Win+L and selecting users is very cumbersome. If I start Task Manager as administrator, it shows active users and I can select one and "Connect" (if I enter their password). How do I get the list of all users (or all active users)? I'm using C# (Visual Studi...
stackexchange/codereview
Well, this is my first post here and really enjoying the site. I have a very basic (ugly as sin) site I have started and for some reason, I can not get the CSS Sticky footer to work for FireFox. IE works but FF shows it halfway up the page. The URL is http://dev.aipoker.co.uk I know I should be developing in FF and bu...
stackexchange/codereview
In .NET, what is the difference between String.Empty and "", and are they interchangeable, or is there some underlying reference or Localization issues around equality that String.Empty will ensure are not a problem?
stackexchange/codereview
Is there a freely available Base64 decoding code snippet in C++?
stackexchange/codereview
I am working on a project that has grown to a decent size, and I am the only developer. We currently don't use any version control, but I definitely need to start. I want to use Subversion. What would be the best way to transfer an existing project to it? I have a test server that I use for developing new features, th...
stackexchange/codereview
What is the best way to handle large numeric inputs in C++ (for example 10^100)? For algorithms I usually switch over to ruby and I sometimes use strings. Any other good methods?
stackexchange/codereview
Our resident Flex expert is out for the day and I thought this would be a good chance to test this site out. I have a dropdown with a dataProvider that is working fine: <ep:ComboBox id="dead_reason" selectedValue="{_data.dead_reason}" dataProvider="{_data.staticData.dead_reason}" labelField="@label" width="300"...
stackexchange/codereview
I mostly use lambda functions but sometimes use nested functions that seem to provide the same behavior. Here are some trivial examples where they functionally do the same thing if either were found within another function: Lambda function >>> a = lambda x : 1 + x >>> a(5) 6 Nested function >>> def b(x): return 1 + x ...
stackexchange/codereview
In my urls.py file, I have: from myapp import views ... (r'^categories/$', views.categories) Where categories is a view function inside myapp/views.py. No other URLconf lines reference views.categories. In a unit test file, I’m trying to grab this URL using django.core.urlresolvers.reverse(), instead of just copying '...
stackexchange/codereview
I'd like to know which libraries are used by executables on my system. More specifically, I'd like to rank which libraries are used the most, along with the binaries that use them. How can I do this?
stackexchange/codereview
I've got an ms-access application that's accessing and ms-sql db through an ODBC connection. I'm trying to force my users to update the data only through the application portion, but I don't care if they read the data directly or through their own custom ms-access db (they use it for creating ad hoc reports). What I'm ...
stackexchange/codereview
I'd like to have a context menu for my tab headers in a Syncfusion TabControlAdv control, and have a separate menu for the controls inside each tab. The likely menu entries will be "Add Tab", "Delete Tab" and "Clone Tab", and neither of them makes much sense to show when the user rightclicks in the middle of my control...
stackexchange/codereview
I have the following code in my file to load a div with HTML from an AJAX call: $('#searchButton').click( function() { $('#inquiry').load('/search.php?pid=' + $('#searchValue').val()); }); This works fine in Firefox and Google Chrome, but whenever I do the search in IE I get redirected back to index.php. I grabbed...
stackexchange/codereview
Is there a Winform caching library out there? I need to pass a few datasets aroung in a Winform Application, and probably persist to storage upon close. I've seen some samples around via Google, using System.Web. What's the recommendation and where can I get some details. I am using VS 2008 for 2.0. 3.0 Framework. Than...
stackexchange/codereview
In IE6 the left of the #right-content DIV is cut off. I've been playing with it and can't get it to display properly. http://philzit.com/services
stackexchange/codereview
I collect a few corner cases and brain teasers and would always like to hear more. The page only really covers C# language bits and bobs, but I also find core .NET things interesting too. For example, here's one which isn't on the page, but which I find incredible: string x = new string(new char[0]); string y = new str...
stackexchange/codereview
I'm building few command-line utilities in Xcode (plain C, no Cocoa). I want all of them to use my customized version of libpng, and I want to save space by sharing one copy of the library among all executables (I don't mind re-distributing .dylib with them). Do I need to do some magic to get libpng export symbols? Doe...
stackexchange/codereview
In visual C++, I can do things like this: template <class T> class A{ protected: T i; }; template <class T> class B : public A<T>{ T geti() {return i;} }; If I try to compile this in g++, I get an error. I have to do this: template <class T> class B : public A<T>{ T geti() {return A<T>::i;} }; Am I not ...
stackexchange/codereview
In a language where both are available, would you prefer to see an instance constructor or a static method that returns an instance? For example, if you're creating a String from a char[]: String.FromCharacters(chars); new String(chars);
stackexchange/codereview
I got a text file with a couple of lines and I am looking for a string in this file. I need to pass following command line parameters to the program: - file path - the string I am looking for - maximum number of processes the program is allowed to "fork" in order to complete this task. How to such a program should b...
stackexchange/codereview
In the STL library some containers have iterators and it is commonly held that they are a superior way of iterating through these containers rather than simple for loops e.g. for ( int i=0; i < vecVector.size(); i++ ) { .. } Can anyone tell me why and in what cases I should use iterators and in what cases the code s...
stackexchange/codereview
I am working on a build system. The build system posts the results as a zip file in a directory. Unfortunately I have no easy way to know the name of the zip file, because it is timestamped. For the next operation, I must decompress this zip file to some specific location and then do some more file operations. I gue...
stackexchange/codereview
Just updated build server with rc0 and surprise no chiron. Wondering how you package up a xap file without chiron.
stackexchange/codereview
I want to add same field to multiple tables. Can I do this with single query in MySql?
stackexchange/codereview
I am trying to create a sortable image matrix, 5x5 using scriptaculous javascript library by I can't make it work. I am trying using a table but I am having trouble linking the <td> into the Sortable object. Do you guys have any hint or documentation I can go through to create this ? Thanks
stackexchange/codereview
I need to display the log entries from a database. Of course the log data is huge, so I have to show the results on several pages, and that **without** getting **all** the log data at once, but as the user navigates through the pages. I know about DisplayTag and TableTags, but it seems to me that they both fetch all th...
stackexchange/codereview
I'm running my workstation on Server 2008 and a few servers in Hyper-V VM's on that server. I connect to my corporate LAN using VPN from the main OS (the host) but my VM's aren't seeing the servers in the corporate LAN. Internet and local access to my home network work fine. Each of the VMs has one virtual network adap...
stackexchange/codereview