instruction_seed
stringlengths
1
35.8k
_source
stringclasses
1 value
We use ASP.NET / C#. We work locally, test locally, check in our code and binaries through SVN. On our server, we checkout the latest 'build' from SVN directly into our IIS web directory. Is this a good practice, or is there something else we should be doing for rollouts?
stackexchange/codereview
I'm using a third-party library that returns "XML" that is not valid, because it contains invalid characters, as well as non-declared entities. I need to use a Java XML parser to parse this XML, but it's choking. Is there a generic way to sanitize this XML so that it becomes valid?
stackexchange/codereview
I have several arrays of arrays or arrays of dicts that I would like to store in my iPhone app. This lists are static and won't be modified by the app or users. Occasionally they may be displayed but more likely they'll be iterated over and compared to some input value. Would the best way to store these arrays be a ...
stackexchange/codereview
I have a lot of Java source code that requires custom pre-processing. I'd like rid of it but that's not feasible right now so I'm stuck with it. Given that I have an unfortunate problem that shouldn't have existed in the first place, how do I solve it using maven? (For the full story, I'm replacing a python-based buil...
stackexchange/codereview
I'm trying to use ASP.net health monitoring to log unhandled exceptions from an asmx web service. I've enabled health monitoring in the web.config but it's not logging anything. Does health monitoring work with asmx web services? I've googled around and seems other people have asked the same question but never got a de...
stackexchange/codereview
What's the best way of capturing an mp3 stream coming off of http and saving it to disk with python? Thus far I've tried target = open(target_path, "w") conn = urllib.urlopen(stream_url) while True: target.write(conn.read(buf_size)) This gives me data but its garbled or wont play in mp3 players.
stackexchange/codereview
From wikipedia: the cross product is a binary operation on two vectors in a three-dimensional Euclidean space that results in another vector which is perpendicular to the plane containing the two input vectors. Given that the definition is only defined in three (or seven, one and zero) dimensions, how does one calcu...
stackexchange/codereview
Given any arbitrary, one-line string, my goal is to render it into a bitmap representation. However, I have no means of finding out its dimensions beforehand, so I am reduced to getting the glyph range's bounding rect and resizing my canvas if it's not large enough. Unfortunately, if the canvas is not wide enough for...
stackexchange/codereview
I have a problem perplexing me to no end. When I run the following query against an access database: SELECT * FROM PreferredSpacer INNER JOIN SpacerThickness ON PreferredSpacer.SpacerTypeID = SpacerThickness.SpacerTypeID ORDER BY PreferredSpacer.UnitTypeID DESC (UnitTypeID field is a text type) The results do not co...
stackexchange/codereview
Something that would really reload the page or resource, ignoring whatever might be in cache.
stackexchange/codereview
Replaces Question: Update multiple rows into SQL table Here's a Code Snippet to update an exam results set. DB structure is as given, but I can submit Stored Procedures for inclusion (Which are a pain to modify, so I save that until the end.) The question: Is there a better way using SQL server v 2005.,net 2.0 ? string...
stackexchange/codereview
I have been pushing into the .NET framework in PowerShell, and I have hit something that I don't understand. This works fine: $foo = New-Object "System.Collections.Generic.Dictionary``2[System.String,System.String]" $foo.Add("FOO", "BAR") $foo Key Value --- ...
stackexchange/codereview
I currently have a silverlight application which rotates through several graphs of live data. Each page has two user controls though: one for an info box at the top and another for the graph to display. I have tried to add a background image to the master page that they are displayed on so that the image is behind ever...
stackexchange/codereview
I am working on a single sign-on login page using Shibboleth that will be used for a variety of web applications. Obviously we would like to make this page as secure and usable as possible while limiting the effects of phishing scams. What are the best practices to keep in mind when designing a login page? Some questio...
stackexchange/codereview
I have compression enabled within IIS7 and it works as expected on all responses except for those constructed by ASP.NET AJAX. I have a web service that provides data to the client. When the web service is called directly, it is properly compressed. However, when it is called via ASP.NET AJAX, the JSON response is n...
stackexchange/codereview
Which Eclipse package should I choose for Python development with PyDev? Nothing on the Eclipse homepage tells me what to choose, and the PyDev documentation assumes I already have Eclipse installed. Does it matter which Eclipse package I choose?
stackexchange/codereview
I need to send an email to someone and want them to be able to simply reply to the email without having to specify the email address. Using sp_send_dbmail sets the reply-to address as the name of the profile that it was sent from. Can this be changed to specify the reply-to so it looks like it came from me. Thanks.
stackexchange/codereview
Sometimes you need to skip execution of part of a method under certain non-critical error conditions. You can use exceptions for that, but exceptions generally are not recommended in normal application logic, only for abnormal situations. So I do a trick like this: do { bool isGood = true; .... some code if(...
stackexchange/codereview
What do you think of using a metric of function point to lines of code as a metric? It makes me think of the old game show "Name That Tune". "I can name that tune in three notes!" I can write that functionality in 0.1 klocs! Is this useful? It would certainly seem to promote library usage, but is that what you want?...
stackexchange/codereview
I'm about to enter the 1st phases of designing a commodities trading application. A major function of this application is the capture and evaluation of pricing information. Pricing in this market is not fixed. It is usually a market benchmark +/- a premium. For example: (A and B are market benchmarks) Price = A + $1 P...
stackexchange/codereview
I have currently 200+ GB database that is using the DB2 built in backup to do a daily backup (and hopefully not restore - lol) But since that backup now takes more than 2.5 hours to complete I am looking into a Third party Backup and Restore utility. The version is 8.2 FP 14 But I will be moving soon to 9.1 and I also...
stackexchange/codereview
I know you can use C++ keyword 'explicit' for constructors of classes to prevent an automatic conversion of type. Can you use this same command to prevent the conversion of parameters for a class method? I have two class members, one which takes a bool as a param, the other an unsigned int. When I called the function...
stackexchange/codereview
I know I could just ask, but that would involve bureaucratic entanglements.
stackexchange/codereview
How can I represent the following in XSD. <price-update> <![CDATA[ arbitrary data goes here ]]> </price-update>
stackexchange/codereview
My fact table looks like this yesterday a yesterday a yesterday a yesterday b yesterday b yesterday c today a today a today b today b tommorow a tommorow a tommorow c tommorow d In the end I need an Excel report like this repetition count 1 2 3 yesterday 1...
stackexchange/codereview
A website of mine will host the usual images, javascript and CSS stylesheets in the database. Since these are unlikely to change each day, I am going to use some client caching on these to reduce the server load. How long do you cache these? A few days? More? I'm probably not going to reuse the same name twice if I upd...
stackexchange/codereview
When I create a zip Archive via java.util.zip.*, is there a way to split the resulting archive in multiple volumes? Let's say my overall archive has a filesize of 24 MB and I want to split it into 3 files on a limit of 10 MB per file. Is there a zip API which has this feature? Or any other nice ways to achieve this? ...
stackexchange/codereview
I am trying to set the permissions of a folder and all of it's children on a vista computer. The code I have so far is this. public static void SetPermissions(string dir) { DirectoryInfo info = new DirectoryInfo(dir); DirectorySecurity ds = info.GetAccessControl(); ...
stackexchange/codereview
What is the best way to actively monitor if a .NET Windows service is still running (e.g not hung)? The service needs to periodically respond to events raised by a timer. Thanks Jon
stackexchange/codereview
I'm trying to use an external framework for UPnP browsing on the iPhone. The framework works perfectly on the Mac, But when I copy it to the iPhone app, it wouldn't run even if there's no code using the framework yet. It gives weird error that I can't understand. [Session started at 2008-10-20 15:32:34 +0200.] objc[27...
stackexchange/codereview
Part of my latest webapp needs to write to file a fair amount as part of its logging. One problem I've noticed is that if there are a few concurrent users, the writes can overwrite each other (instead of appending to file). I assume this is because of the destination file can be open in a number of places at the same t...
stackexchange/codereview
I display data into an html table, w/ a drop down box with a list of venues. Each volunteer will be assigned a venue. I envision being able to go down thru the html table and assigning each volunteer a venue. The drop down box contains all the possible venues that they can be assigned to. <select> <option value="1">Set...
stackexchange/codereview
I have two XmlDocuments and I would like to move an XmlNode selected from one of the documents and append it at a particular location in the other document. The naively intuitive approach of simply calling AppendNode(xmlNodeFromDocument1) at the appropriate place of document 2, of course doesn't work because the method...
stackexchange/codereview
I am trying to retrieve an image stored in an oracle blob and place it in a new System.Drawing.Image instance. I know I can write the stream to a temp.bmp file on the disk and read it from there but thats just not l33t enough for me. How do I convert the blob object directly to an image?
stackexchange/codereview
Looking for help using the Apache Abdera Atom Client. I am trying to post and put files to a feed but I am getting a 400 error saying that the content type must be application/x-www-form-urlencoded or multipart/form-data
stackexchange/codereview
I know that cursors are frowned upon and I try to avoid their use as much as possible, but there may be some legitimate reasons to use them. I have one and I am trying to use a pair of cursors: one for the primary table and one for the secondary table. The primary table cursor iterates through the primary table in an o...
stackexchange/codereview
I would like to know what is the difference between initializing a static member inline as in: class Foo { private static Bar bar_ = new Bar(); } or initializing it inside the static constructor as in: class Foo { static Foo() { bar_ = new Bar(); } private static Bar bar_; }
stackexchange/codereview
I have two different grid controls on the same form. They share the same context menu. I am having trouble determining which control is the owner when I select the context menu item.
stackexchange/codereview
I am looking for a way to maintain PHP sessions across multiple domains on the same server. I am going to be integrating my sites with a Simple Machines Forum so I will need to use MySQL based sessions. Thanks!
stackexchange/codereview
In my Rails controller, I'm creating multiple instances of the same model class. I want to add some RSpec expectations so I can test that it is creating the correct number with the correct parameters. So, here's what I have in my spec: Bandmate.should_receive(:create).with(:band_id => @band.id, :user_id => @user.id,...
stackexchange/codereview
I'm using Flex 3 in the UI of a Windows app (Flash player as an embedded ActiveX control), and passing data between them with ExternalInterface (primarily into the Flex app, as opposed to out). I'm finding, though, that the performance is pretty awful, particularly with larger (i.e., custom) objects; the more EI calls ...
stackexchange/codereview
I currently capture MiniDumps of unhandled exceptions using SetUnhandledExceptionFilter however at times I am getting "R6025: pure virtual function". I understand how a pure virtual function call happens I am just wondering if it is possible to capture them so I can create a MiniDump at that point.
stackexchange/codereview
Is it possible to use a variable from one page in a piece of code on another? e.g. submit a form on one page and on the second page use a PHP script to add the data from the form to a MySQL table Thanks for all the help
stackexchange/codereview
Specifically, I want to copy a link (with text and location) and then to be able to paste it, e.g., into Word as a link.
stackexchange/codereview
Does anyone know how to set the code text editor font style to italics in Visual Studio 2005 or 2008? Note, I'm talking about the code editor not in code itself.
stackexchange/codereview
I'm having a hard time coding understanding the format of the specifier and string functions. My aim is to use %[] to readin all characters and spaces and then use the strcpy function followed by the strcat function. So far i've managed to enter individual characters and print them out, excluding spaces. here's the cod...
stackexchange/codereview
I'm looking for the class name of the popup/message windows on the iPhone (it's a blueish window that comes up when you have a missed call, or a message comes in for example.)
stackexchange/codereview
In Enterprise Manager you could script all SPs in a database through the right click menu, is there a way to do it in Management Studio?
stackexchange/codereview
Or are they two distinct applications that are not related?
stackexchange/codereview
So what's the best way to create new tables in a Sqlite database in Rails 2. I have created the database using rake db:migrate command. So should I write individual sql scripts to create a database or use rake somehow. I don't need scaffolding.
stackexchange/codereview
At a new job I started, we have both a Java application that handles most of the heavy lifting in the core business logic, and we also have a Rails application that of course handles the web interface to this server. Both of these access the same database. Up until now, most of the focus has been on the Java applicati...
stackexchange/codereview
Problem I have timestamped data, which I need to search based on the timestamp in order to get the one existing timestamp which matches my input timestamp the closest. Preferably this should be solved with the STL. boost::* or stl::tr1::* (from VS9 with Featurepack) are also possible. Example of timestamped data: struc...
stackexchange/codereview
For example, launch Paint.NET. Then have a look on its memory usage with Task Manager: on my computer, it uses 36Mb. Then minimize Paint.NET: now it takes only a few more than 1Mb. This happens with every .NET Application. What happens when a .NET Application is minimized? Is a GC occurring?
stackexchange/codereview
This is something that I have never fully grasped in .NET as to the correct application of the .dispose() method. Say I have something like Public Class someClass() sub someMethod ' do some stuff tying up resources end sub End Class public class mainApp dim _class as new SomeClass _class.someMethod() End ...
stackexchange/codereview
I wrote a small web app using ruby on rails, its main purpose is to upload, store, and display results from xml(files can be up to several MB) files. After running for about 2 months I noticed that the mongrel process was using about 4GB of memory. I did some research on debugging ruby memory leaks and could not find...
stackexchange/codereview
I have a form where controls are dynamically added to a Panel. However, when they do so, they are many times added below the fold (bottom of the container). It's nice that the .NET Framework provides this ScrollControlIntoView method, however, for added usability, it would also be nice if there was an easy way to ani...
stackexchange/codereview
c# windows forms: How do you create new settings at run time so that they are permanently saved as Settings.Default.-- values?
stackexchange/codereview
I want to trigger an event that causes the ScrollPane to start scrolling up or down. Ideally the ScrollPane would scroll continue to scroll all the way up or down unless canceled by another event.
stackexchange/codereview
I've seen this format used for comma-delimited lists in some C++ code (although this could apply to any language): void function( int a , int b , int c ) I was wondering why would someone use that over a more common format such as: void function (int a, int b, ...
stackexchange/codereview
I have quickly read (and will read with more care soon) the article of Scott Allen concerning the possibility to use an other provider of the default SQL Express or SQL Server database to use the "Membership and Role Providers" for ASP.NET. We will soon need to open a part of our project to some client via the web and ...
stackexchange/codereview
I've used HttpWebRequests to post data to HTTPS websites before, and I've never had todo anything different than a regular HTTP Post. Does anyone know if there are any tricks involved that I missed to ensure that this is done properly?
stackexchange/codereview
What is the fastest way to load data from flatfiles into a MySQL database, and then create the relations between the tables via foreign keys? For example... I have a flat file in the format: [INDIVIDUAL] [POP] [MARKER] [GENOTYPE] "INDIVIDUAL1", "CEU", "rs55555","AA" "INDIVIDUAL1", "CEU", "rs535454","GA" "IND...
stackexchange/codereview
I have a list of variable names, like this: ['foo', 'bar', 'baz'] (I originally asked how I convert a list of variables. See Greg Hewgill's answer below.) How do I convert this to a dictionary where the keys are the variable names (as strings) and the values are the values of the variables? {'foo': foo, 'bar': bar, '...
stackexchange/codereview
We have a Java Applet built using AWT. This applet lets you select pictures from your hard drive and upload them to a server. The applet includes a scrollable list of pictures, which works fine in Windows, Linux and Mac OS X 10.5. We launch this applet via Java Web Start or within a web page. Our applet does not behav...
stackexchange/codereview
My client wants me to enable a "Remember Me" checkbox when the user logs in. I am encrypting and storing both the username and password in a cookie. However, you cannot write to a textbox when it's in password mode. I've seen this done numerous times, so how are they doing it? thanks in advance!
stackexchange/codereview
I get errors when viewing forms and there are not any. I can close VS and reopen and it is fine. What cases this? Can it be fixed without closing?
stackexchange/codereview
Is it even possible? Basically, there's a remote repository from which I pull using just: git pull Now, I'd like to preview what this pull would change (a diff) without touching anything on my side. The reason is that thing I'm pulling might not be "good" and I want someone else to fix it before making my repository "...
stackexchange/codereview
I am trying to figure out the proper procedure for applying a new tsk based theme file in windows mobile 6.1. I have tried working off of the page http://www.pocketpcdn.com/articles/changetodaytheme.html But this only changes the background, not the system colors for things such as the top and bottom bars on the screen...
stackexchange/codereview
I am trying to insert a time only value, but get the following error ex {"SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM."} System.Exception From the front end, the time is selected using the "TimeEdit" control, with the up and down arrows. The table in SQL Server has the fi...
stackexchange/codereview
Wanna write a RegEx to validate a driving license. if it doesn't start with (US, CA, CN) then it has to be followed with XX and after that with any number of Alpha numeric letters. So for example if the driving license starts with GB then it has to be followed with XX GBXX12345363 However if it starts with US then we...
stackexchange/codereview
Is it possible to configure Windows Servers that reside on the same domain such that when a web service call is made from a web app using an IP address, the request does not go via a proxy server? The web service is running on one of the servers on the domain. I want to configure IP based security on the server that h...
stackexchange/codereview
I am developing a TCP/IP client that has to deal with a proprietary binary protocol. I was considering using user-defined types to represent the protocol headers, and using CopyMemory to shuffle data to and from the UDT and a byte array. However, it appears that VB6 adds padding bytes to align user-defined types. Is th...
stackexchange/codereview
When you open a page in the browser, an instance of the page is created on the server. But, when you use AJAX, does anyone know if the entire page object is created at the server on postbacks?
stackexchange/codereview
When I make relationsships with JPA using hibernate, some terrible long and ackward column names are generated. Eg. I have the following actionPlan_actionPlanPK, which means that the column actionPlan is a FK that points to actionPlanPK. To make it look just a little bit more neat in the DB I would like if I could give...
stackexchange/codereview
I'm creating a few web forms that have areas to them. Are fieldsets viable options for sectioning forms anymore? Should I just use a div with styles to be similar?
stackexchange/codereview
I have a home project that really needs to be in Source Control. I tried installing Subversion, which I have some experience with, but couldn't get it working. I don't particularly want to use SourceSafe. I'm a bit nervous about Git/Mercury as being somewhat cryptic, although this is only based on opinion rather tha...
stackexchange/codereview
I have created a website project in VS2008 and in the appcode folder I have created a class deriving from System.Web.UI.WebControls.WebControl. I need to use this control in one of my webforms. I can't figure out how to.
stackexchange/codereview
I wrote a small WPF app where I like to prepend text into a RichTextBox, so that the newest stuff is on top. I wrote this, and it works: /// <summary> /// Prepends the text to the rich textbox /// </summary> /// <param name="textoutput">The text representing the character information.</param> priva...
stackexchange/codereview
I need to validate the email address of my users. Unfortunately, making a validator that conforms to standards is hard. Here is an example of a regex expression that tries to conform to the standard. Is there a PHP library (preferably, open-source) that validates an email address?
stackexchange/codereview
I am using ServerXMLHTTP to perform an HTTP POST. The response returned is a redirect (specifically 303 See Other). ServerXMLHTTP is automatically following this redirect but this is causing an authentication failure as is not propagating the Authorization header of the original request. Is there a way I can prevent th...
stackexchange/codereview
Creating a CSV file in a winforms application, it is to be improted into Excel. The file output looks like: "header1", "header2", "header3", 1,2,3, 4,5,6 What should I use to signify a newline character when generating the CSV file?
stackexchange/codereview
Visual Studio does it; Reflector does it; and now I want to as well :) I want to retrieve the XML documentation for some members in some framework assemblies (i.e. mscorlib.dll, System.dll, etc). I assume this would involve: finding the XML file for the assembly, navigating to the appropriately named child element, a...
stackexchange/codereview
What is a Turing machine and why do people keep mentioning it? My IBM PC is all I need to do my computation! Why does anyone care about these machines?
stackexchange/codereview
My understanding is that in unix, when memory is freed, the memory doesn't get returned back to the operating system, it stays in the process to be used again for the next call to malloc. On windows, I understand that the memory actually gets returned to the operating system. Is there any big difference between these t...
stackexchange/codereview
I've used both and I've found MySql to have several frustrating bugs, limited support for: IDE integration, profiling, integration services, reporting, and even lack of a decent manager. Total cost of ownership of MSSQL Server is touted to be less than MySQL too (.net environment), but maintaining an open mind could so...
stackexchange/codereview
I found this page describing the Muenchian method, but I think I'm applying it wrong. Consider that this would return a set of ages: /doc/class/person/descriptive[(@name='age')]/value 1..2..2..2..3..3..4..7 But I would like a nodeset only one node for each age. 1..2..3..4..7 Each of these seem to return all of the...
stackexchange/codereview
I need to be able to launch a process and read the output into a variable. Then based on the return of the command I can choose to show the full output or just a selected subset. So to be clear, I want to launch a text based process (psexec actually) and read the output from that command (stdout, stderr, etc) into a v...
stackexchange/codereview
I have looked at some resources already and just want to clarify and get an opinion. First of all to totally avoid any problems we could just not bother using identity columns as primary keys instead have them generated ourselves and just have those values replicated both ways presuming they are always unique at any ti...
stackexchange/codereview
I want to use Sharepoint with python (C-Python) Has anyone tried this before ?
stackexchange/codereview
I am attempting to pass information from a task created within a workflow to its corresponding task form. Prior to the CreateTask activity, I create an SPWorkflowTaskProperties and fill it with the usual info (title, assigned-to, etc). I also add some elements to the ExtendedProperties property. However, those custo...
stackexchange/codereview
I have a <button> with an accesskey assgined to it. The accesskey works fine as long as the button is visible, but when I set display: none or visibility: hidden, the accesskey no longer works. Also tried without success: Use a different element type: a, input (various types, even typeless). Assign the accesskey to a ...
stackexchange/codereview
This seems trivial, but I've never had to worry about it before and my Google skills are failing me. How far-reaching is the in-process session bucket for ASP.NET/IIS6, in the sense that you can call Session["whatever"] and get the same value back? Obviously it can't stretch across different servers or application pool...
stackexchange/codereview
Delphi 2009 complains with an E2283 error: [DCC Error] outputcode.pas(466): E2283 Too many local constants. Use shorter procedures Delphi 2007 compiles just fine. I can't find an abundance of local constants, it's a short (500 line) unit. Do you see any abundance of constants or literals I can address? procedure TOutpu...
stackexchange/codereview
What are some things I can do to improve query performance of an oracle query without creating indexes? Here is the query I'm trying to run faster: SELECT c.ClaimNumber, a.ItemDate, c.DTN, b.FilePath FROM items a, itempages b, keygroupdata c WHERE a.ItemType IN (112,115,189,241) AND a.ItemNum = b.ItemNum AND b.ItemNum ...
stackexchange/codereview
I have been trying to learn multi-threaded programming in C# and I am confused about when it is best to use a thread pool vs. create my own threads. One book recommends using a thread pool for small tasks only (whatever that means), but I can't seem to find any real guidelines. What are some pros and cons of thread poo...
stackexchange/codereview
When I add a reference to Microsoft.Office.Interop.Excel on my computer, Visual Studio adds this to the project file: <COMReference Include="Excel"> <Guid>{00020813-0000-0000-C000-000000000046}</Guid> <VersionMajor>1</VersionMajor> <VersionMinor>5</VersionMinor> <Lcid>0</Lcid> <WrapperTool>primary</WrapperToo...
stackexchange/codereview
Is there a free third-party or .NET class that will convert HTML to RTF (for use in a rich-text enabled Windows Forms control)? The "free" requirement comes from the fact that I'm only working on a prototype and can just load the BrowserControl and just render HTML if need be (even if it is slow) and that Developer Exp...
stackexchange/codereview
I'm trying to chart the number of registrations per day in our registration system. I have an Attendee table in sql server that has a smalldatetime field A_DT, which is the date and time the person registered. I started with this: var dailyCountList = (from a in showDC.Attendee let justDate = new DateTime(a.A_D...
stackexchange/codereview
I have an Electronic Workforce (EWF) application that records the caller speaking. The system needs to record for 120 seconds then play a message and hangup. I set a maximum length of 120 seconds and a minimum length of 1 second. I didn't want any input to disrupt the recording, so I checked "Discard Earlier User In...
stackexchange/codereview
I'm experimenting with a personal finance application, and I'm thinking about what approach to take to update running balances when entering a transaction in an account. Currently the way I'm using involves retrieving all records more recent than the inserted/modified one, and go one by one incrementing their running b...
stackexchange/codereview