instruction_seed
stringlengths
1
35.8k
_source
stringclasses
1 value
I've got a class named BackgroundWorker that has a thread constantly running. To turn this thread off, an instance variable named stop to needs to be true. To make sure the thread is freed when the class is done being used, I've added IDisposable and a finalizer that invokes Dispose(). Assuming that stop = true does i...
stackexchange/codereview
I have the source of a program (taken from cvs/svn/git/...) and I'd like to build a Debian/Ubuntu package for it. The package is present in the repositories, but: It is an older version (lacking features I need) I need slightly different compile options than the default. What is the easiest way of doing it? I am conc...
stackexchange/codereview
How can I perform list comprehensions in C#?
stackexchange/codereview
I've managed to mostly ignore all this multi-byte character stuff, but now I need to do some UI work and I know my ignorance in this area is going to catch up with me! Can anyone explain in a few paragraphs or less just what I need to know so that I can localize my applications? What types should I be using (I use both...
stackexchange/codereview
How can I create an Excel spreadsheet with C# without requiring Excel to be installed on the machine that's running the code?
stackexchange/codereview
From what I've seen the tag is ignored when hosting a WCF service in IIS. I understand that when self-hosting this is required but is this harmful or even used when operating under IIS? ex. <system.serviceModel> <service blah blah blah> <host> <baseAddresses> <add baseAddress="http://localhost/bla...
stackexchange/codereview
I need to setup a blog using wordpress engine but i need it support multi languages (3 languages), currently i am thinking of using custom field to identify the language of current post though i knew thats not a best practices, does anyone has better suggestions?
stackexchange/codereview
Is it at the state where it is actually useful and can do more than rename classes?
stackexchange/codereview
At the moment I am working on a project admin application in C# 3.5 on ASP.net. In order to reduce hits to the database, I'm caching a lot of information using static variables. For example, a list of users is kept in memory in a static class. The class reads in all the information from the database on startup, and wil...
stackexchange/codereview
I'm sure this is a newbie question, but every time I've compiled/dl'ed a new version of vim for os x, running vim on the command-line opens up the gvim app. I just want to upgrade the console version (so I can, for example, have python compiled in to use omnicomplete).
stackexchange/codereview
When I enter this query: sqlite> DELETE FROM mails WHERE (id = 71); SQLite returns this error: SQL error: database is locked How do I unlock the database so this query will work?
stackexchange/codereview
I want to write a program in which plays an audio file that reads a text. I want to highlite the current syllable that the audiofile plays in green and the rest of the current word in red. What kind of datastructure should I use to store the audio file and the information that tells the program when to switch to the n...
stackexchange/codereview
When I load script/console, sometimes I want to play with the output of a controller or a view helper method. Are there ways to: simulate a request? call methods from a controller instance on said request? test helper methods, either via said controller instance or another way?
stackexchange/codereview
In order to improve my open source project, I need testers. I have created my project independently, so up to now I have been the sole coder and tester. I have tested the thing to death, but as we all know it is dangerous as a developer to test your own code. I'm looking for ideas on how I can get some other eyes to e...
stackexchange/codereview
I've been using Eclipse pretty regularly for several years now, but I admit to not having explored all the esoterica it has to offer, particularly in the areas of what formatting features the editors offer. The main thing I miss from (X)emacs is the "align-regex" command, which let me take several lines into a region a...
stackexchange/codereview
Can you package up the .Net framework in an installer created in Visual Studio? If so how? I've seen this done with Install4J packaging a JVM but I think that was the JVM to run Install4J.
stackexchange/codereview
I know very little (arguably nothing) about Sybase setup, but I do know SSIS is having trouble enlisting Sybase in a distributed transaction. Has anyone been able to make this work? The SSIS Runtime has failed to enlist the OLE DB connection in a distributed transaction with error 0x80004005 "Unspecified error". Thi...
stackexchange/codereview
I'm trying to figure out the best way to determine whether I'm in the last iteration of a loop over a map in order to do something like the following: for (iter = someMap.begin(); iter != someMap.end(); ++iter) { bool last_iteration; // do something for all iterations if (!last_iteration) { // do so...
stackexchange/codereview
I'm trying to write a regex that will parse out the directory and filename of a fully qualified path using matching groups. so... /var/log/xyz/10032008.log would recognize group 1 to be "/var/log/xyz" and group 2 to be "10032008.log" Seems simple but I can't get the matching groups to work for the life of me. NOTE: A...
stackexchange/codereview
is there a tomahawk component, that enables "scrollable tabs"? What I mean is something for the following situation: If I have very many tabs, the tab-bar gets a little arrow on the side to scroll through all the open tabs (like in firefox). Is there a tomahawk component for creating something similar?
stackexchange/codereview
I want to split an arithmetic expression into tokens, to convert it into RPN. Java has the StringTokenizer, which can optionally keep the delimiters. That way, I could use the operators as delimiters. Unfortunately, I need to do this in PHP, which has strtok, but that throws away the delimiters, so I need to brew somet...
stackexchange/codereview
Is it possible to gather performance statistics programmatically from inside a WCF application? For example, the number of connections open or requests received.
stackexchange/codereview
What is the highest port number one can use?
stackexchange/codereview
How do I load the edited .emacs file without restarting Emacs?
stackexchange/codereview
What characters are valid in a Java class name? What other rules govern Java class names (for instance, Java class names cannot begin with a number)?
stackexchange/codereview
The backup and restore process of a large database or collection of databases on sql server is very important for disaster & recovery purposes. However, I have not found a robust solution that will guarantee the whole process is as efficient as possible, 100% reliable and easily maintainable and configurable accross m...
stackexchange/codereview
For those who haven't read Code Complete 2, the Pseudocode Programming Process is basically a way to design a routine by describing it in plain English first, then gradually revise it to more detailed pseudocode, and finally to code. The main benefit of this is to help you stay at the right level of abstraction by buil...
stackexchange/codereview
Is entity framework just a fancy name for another CRUD code generator? Or is there more to it?
stackexchange/codereview
py2exe does not work with the standard email module Hello. I am trying to use py2exe for converting a script into an exe. The build process shows this: The following modules appear to be missing ['email.Encoders', 'email.Generator', 'email.Iterators', 'email.MIMEBase', 'email.MIMEMultipart', 'email.MIMEText', 'email.U...
stackexchange/codereview
I have built an application in C# that I would like to be optimized for multiple cores. I have some threads, should I do more? Updated for more detail C# 2.0 Run on Windows Vista and Windows Server 2003 Updated again This code is running as a service I do not want to have the complete code... my goal here is to get ...
stackexchange/codereview
In .NET, under which circumstances should I use GC.SuppressFinalize()? What advantage(s) does using this method give me?
stackexchange/codereview
I'm starting on a project that I expect will include a substantial amount of non-Java code (mostly shell and SQL scripts). I would still like to manage this project with Maven. What are the best practices wrt non-Java source code and Maven? Where should the source go? What happens to them during the different lifecycle...
stackexchange/codereview
Is Oracle Application Express suitable for Intranet client/server application? If so, what should I do to enable client access to application? Well, I am working as a PowerBuilder/Oracle developer, so I am familiar with client/server architecture. I have recently read an article about APEX so I would like to develop A...
stackexchange/codereview
Our application is structured something like: UI <--> REST API <--> Workflow <--> Business Logic <--> DAL <--> DB However, I am seeing a few examples where it looks like people are doing UI <--> Workflow <--> REST API <--> Business Logic <--> DAL <--> DB Is this my imagination? Or is the second option considered a vi...
stackexchange/codereview
I have a Rails application for project management where there are Project and Task models. A project can have many tasks, but a task can also have many tasks, ad infinitum. Using nested resources, we can have /projects/1/tasks, /projects/1/tasks/new, /projects/1/tasks/3/edit etc. However, how do you represent the recur...
stackexchange/codereview
I'm doing some architectural cleanup that involves moving a bunch of classes into different projects and/or namespaces. Currently I'm moving the files by hand, building, and then manually adding using Foo statements as needed to resolve compilation errors. Anyone know of a smarter way of doing this? (We're a CodeRush a...
stackexchange/codereview
With the new approach of having the get/set within the attribut of the class like that : public string FirstName { get; set; } Why simply not simply put the attribute FirstName public without accessor?
stackexchange/codereview
I know what Hungarian refers to - giving information about a variable, parameter, or type as a prefix to its name. Everyone seems to be rabidly against it, even though in some cases it seems to be a good idea. If I feel that useful information is being imparted, why shouldn't I put it right there where it's available? ...
stackexchange/codereview
I want to create some text in a canvas: myText = self.canvas.create_text(5, 5, anchor=NW, text="TEST") Now how do I find the width and height of myText?
stackexchange/codereview
I need to upload some data to a server using HTTP PUT method in Python. From my brief reading of the urllib2 docs, it only does HTTP POST. Is there any way to do an HTTP PUT in Python?
stackexchange/codereview
If you were tasked to build an event scheduling system that supported recurring events, how would you do it? How do you handle when an recurring event is removed? How could you see when the future events will happen? i.e. When creating an event, you could pick "repeating daily" (or weekly, yearly, etc). One design pe...
stackexchange/codereview
I have an if/else statement in the controller and 2 different types of views to display depending on the outcome. So I have my 2 views in a .aspx page with a placeholder around each. How do I set the property placeholder.Visible from the controller? Or by the theory of MVC should I even be doing that sort of presentati...
stackexchange/codereview
I have a Ruby/Rails app that has two or three main "sections". When a user visits that section, I wish to display some sub-navigation. All three sections use the same layout, so I can't "hard code" the navigation into the layout. I can think of a few different methods to do this. I guess in order to help people vote I'...
stackexchange/codereview
What do folks here see as the relative strengths and weaknesses of Git, Mercurial, and Bazaar? In considering each of them with one another and against version control systems like SVN and Perforce, what issues should be considered? In planning a migration from SVN to one of these distributed version control systems, w...
stackexchange/codereview
I was thinking about obfuscating a commercial .Net application. But is it really worth the effort to select, buy and use such a tool? Are the obfuscated binaries really safe from reverse engineering?
stackexchange/codereview
I have a problem (and have been having it for some time now) -- the new sound mixer stack in Vista features new cool things, but also re-invents the wheel. Many applications that used to use Volume Mixer on a Windows system to mix different voiced outputs into one input (for example Wave-out + Line-in --> Stereo Mix) h...
stackexchange/codereview
My app generates PDFs for user consumption. The "Content-Disposition" http header is set as mentioned here. This is set to "inline; filename=foo.pdf", which should be enough for Acrobat to give "foo.pdf" as the filename when saving the pdf. However, upon clicking the "Save" button in the browser-embedded Acrobat, the...
stackexchange/codereview
I am using MySQL and PHP for a project I am working. I have created separate users for carrying out different functions (one for running select queries, one for running update queries, etc.) to provide an extra layer of security. This way, I figure if someone does manage to carry out an injection attack (which is unl...
stackexchange/codereview
When using the paginator helper in cakephp views, it doesnt remember parts of the url that are custom for my useage. For example: http://example.org/users/index/moderators/page:2/sort:name/dir:asc here moderators is a parameter that helps me filter by that type. But pressing a paginator link will not include this lin...
stackexchange/codereview
I am using VB6 and the Win32 API to write data to a file, this functionality is for the export of data, therefore write performance to the disk is the key factor in my considerations. As such I am using the FILE_FLAG_NO_BUFFERING and FILE_FLAG_WRITE_THROUGH options when opening the file with a call to CreateFile. FILE_...
stackexchange/codereview
I have a Console application hosting a WCF service. I would like to be able to fire an event from a method in the WCF service and handle the event in the hosting process of the WCF service. Is this possible? How would I do this? Could I derive a custom class from ServiceHost?
stackexchange/codereview
Having this route: map.foo 'foo/*path', :controller => 'foo', :action => 'index' I have the following results for the link_to call link_to "Foo", :controller => 'foo', :path => 'bar/baz' # <a href="/foo/bar%2Fbaz">Foo</a> Calling url_for or foo_url directly, even with :escape => false, give me the same url: foo_url(:...
stackexchange/codereview
What is an algorithm to compare multiple sets of numbers against a target set to determine which ones are the most "similar"? One use of this algorithm would be to compare today's hourly weather forecast against historical weather recordings to find a day that had similar weather. The similarity of two sets is a bit su...
stackexchange/codereview
I would like to write a small application that unlocks the workstation. To put the specs of what I need very simple: Have an exe that runs and at a defined time (let's say midnight) unlocks the workstation. Of course the application knows the user and password of the logged on account. I know of the LogonUser API and h...
stackexchange/codereview
I'm stuck on a PHP 4 server, and I would like to start moving an old legacy project to modern Design Patterns, including Dependency Injection. Are there any dependency injection frameworks that will work with PHP 4?
stackexchange/codereview
Basically I'm trying to accomplish the same thing that "mailto:bgates@microsoft.com" does in Internet Explorer Mobile. But I want to be able to do it from a managed Windows Mobile application. I don't want to send an email pro grammatically in the background. I want to be able to create the email in Pocket Outlook and ...
stackexchange/codereview
Which is Best way to send data to aspx page, and why? using query string using session using cross page postback Something else Thanks. What are you trying to achieve? More info. please For example search form and advanced search form or multi step user registration.
stackexchange/codereview
I have inherited a c# class 'Button' (which I can't change) which clashes with the BCL class 'Windows.Forms.Button'. Normally, Id be very happy to go: MyPackage.MyClass.Button; But there are a large number or references to this class which is a pain to have to re-type. Is there any way to get the compiler (linker?) to...
stackexchange/codereview
Has anyone had any experience targetting WSH in the way that VBScript, JScript, PerlScript, xbScript and ForthScript (among other) do, such that the language can be used from the command line and embedded in server-side web pages? Where do I go to get that kind of information?
stackexchange/codereview
I have two tables that are joined together. A has many B Normally you would do: select * from a,b where b.a_id = a.id To get all of the records from a that has a record in b. How do I get just the records in a that does not have anything in b?
stackexchange/codereview
I am developing a web application using Struts 2.1.2 and Hibernate 3.2.6.GA. I have an entity, User, which I have mapped to a table USERS in the DB using Hibernate. I want to have an image associated with this entity, which I plan to store as a BLOB in the DB. I also want to display the image on a webpage along with ot...
stackexchange/codereview
Several extensions offer a "bottom window" for viewing their content. Firebug and ScribeFire are good examples where the main content appears at the bottom of the browser. This appears to be very similar to the sidebar functionality in the browser. Is there a best practice/method to create a bottom window in an exten...
stackexchange/codereview
Our customer would like to know who is online and currently using the custom application we wrote for them. I discussed it with them and this does not need to be exact, more of a guestimate will work. So my thought is a 15 minute time interval to determine user activity. Some ideas I have for doing this are as foll...
stackexchange/codereview
This may be simple one, but 5 mins of Googling didn't give me the answer. How do you save and load bitmaps using .Net librabries? I have an Image object and I need to save it to disk in some format (preferably png) and load back in later. A C# example would be great.
stackexchange/codereview
I get the Total length of columns in constraint is too long. erro from the following sql] Failed to execute: CREATE TABLE GTW_WORKFLOW_MON ( WORKFLOW_NAME VARCHAR(255) NOT NULL, WORKFLOW_LOADED NUMERIC(20) NOT NULL, ACTIVITY_NAME VARCHAR(255) NOT NULL, FLAGS INTEGER NOT NULL, MONITOR_NAME VARCHAR(255) NOT NULL, C...
stackexchange/codereview
In the past I've worked with a number of programmers who have worked exclusively writing GUI applications. And I've been given the impression that they have almost universally minimised the use of multiple threads in their applications. In some cases they seem to have gone to extreme lengths to ensure that they use a s...
stackexchange/codereview
When I open a solution in VS 2008, I don't want it to open all the files that I had open last time. I just want it to open the solution. Can't see a config option for this, is it possible?
stackexchange/codereview
I'm programming an application for a 32 bit processor with limited memory (512k flash, 32k RAM). The display on this device is 128x160 with 16 bit color, which would normally consume 40k ram if I were to buffer it on my processor. I don't have that much RAM, so I'm looking for techniques, tips, tricks, ideas for gener...
stackexchange/codereview
For development, I use a local LAMP stack, for production I'm using MediaTemple's Django Container (which I'm loving BTW). MT's container uses lighthttpd. Honestly I've never had any other experience with it. I've always used Apache. I've been doing some reading: Onlamp TextDrive Linux.com Here's are questions: Wh...
stackexchange/codereview
The array has lots of data and I need to delete two elements. Below is the code snippet I am using, my @array = (1,2,3,4,5,5,6,5,4,9); my $element_omitted = 5; @array = grep { $_ != $element_omitted } @array;
stackexchange/codereview
Try running these two simple statements on Oracle 10.2: CREATE TABLE mytest (table_name varchar2(30), index_name varchar2(30), column_expression clob, column_position number); INSERT INTO mytest (table_name, index_name, column_expression, column_position) SELECT table_name, index_name, ...
stackexchange/codereview
The following test fails: #!/usr/bin/env python def f(*args): """ >>> t = 1, -1 >>> f(*map(lambda i: lambda: i, t)) [1, -1] >>> f(*(lambda: i for i in t)) # -> [-1, -1] [1, -1] >>> f(*[lambda: i for i in t]) # -> [-1, -1] [1, -1] """ alist = [a() for a in args] print(alist) ...
stackexchange/codereview
What is the bare minimum I need to put in web.config to get WCF working with REST? I have annotated my methods with [WebGet], but they are not getting the message.
stackexchange/codereview
When running one of our software, a tester was faced with the data execution prevention dialog of Windows. We try to reproduce this situation on a developer computer for debugging purposes : with no success. Does anyone know how to find what may cause the DEP protection to kill the application? Is there any existing to...
stackexchange/codereview
Eclipse is a really great editor, which I prefer to use, but the GUI design tools for Eclipse are lacking. On the other hand, NetBeans works really well for GUI design. Are there any tips, tricks or pitfalls for using NetBeans for GUI design and Eclipse for everything else on the same project? EDIT: I tried Maven, a...
stackexchange/codereview
I'm building an interface much like the built-in Weather application's flipside view, or the Alarms view of the Clock application in editing mode. The table view is always in editing mode, so the delete icon appears on the left side of each cell. When the table view is in editing mode, my delegate doesn't receive didSe...
stackexchange/codereview
I've got my brand new VS2008 and decided to convert my main solution from VS2005. One of the projects is a SQL2005 reporting services project. Now that I've converted I cannot load it in VS2008. Is there anyway around this? My problem is that my solution is a hybrid and has websites libraries and reports in there. Sep...
stackexchange/codereview
Here's my code in a gridview that is bound at runtime: ... <asp:templatefield> <edititemtemplate> <asp:dropdownlist runat="server" id="ddgvOpp" /> </edititemtemplate> <itemtemplate> <%# Eval("opponent.name") %> </itemtemplate> </asp:templatefield> ... I want to bind the dropdownlist "dd...
stackexchange/codereview
What is the best way to deal with storing and indexing URL's in SQL Server 2005? I have a WebPage table that stores metadata and content about Web Pages. I also have many other tables related to the WebPage table. They all use URL as a key. The problem is URL's can be very large, and using them as a key makes the ind...
stackexchange/codereview
I'm looking for a decent lexical scanner generator for C#/.NET -- something that supports Unicode character categories, and generates somewhat readable & efficient code. Anyone know of one? EDIT: I need support for Unicode categories, not just Unicode characters. There are currently 1421 characters in just the Lu (L...
stackexchange/codereview
I am working on a web-application in which dynamically-created images are used to display information. This data is currently sent to the images using a GET query-string but with more complex images and data I am worried about running into problems with the url character limit. I could simply pass the record ID to the ...
stackexchange/codereview
What's the difference between the Enabled and the ReadOnly-properties of an asp:TextBox control?
stackexchange/codereview
I would like to know how much disk space a directory is going to consume before I bring it over from the Perforce server. I don't see any way to do this other than getting the files and looking at the size of the directory in a file manager. This, of course, defeats the purpose. Is there a way to get file size info...
stackexchange/codereview
I am using StringReplace to replace &gt and &lt by the char itself in a generated XML like this: StringReplace(xml.Text,'&gt;','>',[rfReplaceAll]) ; StringReplace(xml.Text,'&lt;','<',[rfReplaceAll]) ; The thing is it takes way tooo long to replace every occurence of &gt. Do you purpose any better idea to make it faste...
stackexchange/codereview
I have a C# WinForms borderless window, for which I override WndProc and handle the WM_NCHITTEST message. For an area of that form, my hit test function returns HTSYSMENU. Double-clicking that area successfully closes the form, but right-clicking it does not show the window's system menu, nor does it show up when right...
stackexchange/codereview
I know it's possible, and I've seen simple examples in the documentation, but are they being used in the wild? I use attributes at the class and method level all the time, but have never used them on method parameters. What are some real-world examples, and the reasons for the usage? I'm not interested in seeing a tex...
stackexchange/codereview
Where can I find a list of all types of bsd style socket errors?
stackexchange/codereview
I can get both System.Net.Mail and System.Web.Mail to work with GMail, but I can't get them both to work with smtp.att.yahoo.com. I get the SMTP settings from my own Web.config keys. These settings work when I send using System.Web.Mail, but fail with System.Net.Mail. <add key="SmtpServer" value="smtp.att.yahoo.c...
stackexchange/codereview
What are the relative merits of the xdoc and apt formats for writing websites of Maven projects? Is one more expressive than the other? Has one got better tool support than the other?
stackexchange/codereview
We're starting a large web project, mostly green field. I like the Tapestry framework for java/web solutions. I have concerns about starting a Tapestry 5 project since T5 is still in beta. However, if I understand the documentation correctly, T4 development will not be supported by T5 and up. My question: Should I begi...
stackexchange/codereview
Can perforce be adjusted so I don't need to "open files for edit"? Someone told me that this was a "feature", and that s/he guessed it could be turned off.
stackexchange/codereview
I've got a few hundred computers running an app. On one computer, I've seen two instances of a single bit being incorrectly set on some strings that I pull out of SQLite. If this was my dev computer I would assume I have a bug somewhere, but there is certainly some number of installations at which point I'll start se...
stackexchange/codereview
I have a strange requirement to ship an application without bundling .Net framework (to save memory footprint and bandwidth). Is this possible? Customers may or may not have .Net runtime installed on their systems. Will doing Ngen take care of this problem? I was looking for something like the good old ways of releasi...
stackexchange/codereview
I deleted millions of rows of old data from a production SQL database recently, and it didn't seem to shrink the size of the .MDF file much. We have a finite amount of disk space. I am wondering if there is anything else I can do to "tighten" the file (like something analogous to Access' Compact and Repair function)?
stackexchange/codereview
From the Apple developer faq Safari ships with a conservative cookie policy which limits cookie writes to only the pages chosen ("navigated to") by the user. By default Safari only allows cookies from sites you navigate to directly. (i.e. if you click on links with the url of that domainname). This means that i...
stackexchange/codereview
I am trying to create a table with the following: CREATE TABLE GTW_WORKFLOW_MON ( WORKFLOW_NAME VARCHAR(255) NOT NULL, WORKFLOW_LOADED NUMERIC(20) NOT NULL, ACTIVITY_NAME VARCHAR(255) NOT NULL, FLAGS INTEGER NOT NULL, MONITOR_NAME VARCHAR(255) NOT NULL, CLASSNAME VARCHAR(255) NOT NULL, ST...
stackexchange/codereview
Will content requested over https still be cached by web browsers or do they consider this insecure behaviour? If this is the case is there anyway to tell them it's ok to cache?
stackexchange/codereview
By default, in C++, a single-argument constructor can be used as an implicit conversion operator. This can be suppressed by marking the constructor as explicit. I'd prefer to make "explicit" be the default, so that the compiler cannot silently use these constructors for conversion. Is there a way to do this in standard...
stackexchange/codereview
I'm quite new to NHibernate and starting to find my way around. I have a domain model that is somewhat like a tree. Funds have Periods have Selections have Audits Now I would like to get all Audits for a specific Fund Would look like this if I made it in SQL SELECT A.* FROM Audit A JOIN Selection S ON A.fkSelectionID =...
stackexchange/codereview
How do you include a file that is more than 2 directories back. I know you can use ../index.php to include a file that is 2 directories back, but how do you do it for 3 directories back? Does this make sense? I tried .../index.php but it isn't working. I have a file in /game/forum/files/index.php and it uses PHP includ...
stackexchange/codereview