instruction_seed
stringlengths
1
35.8k
_source
stringclasses
1 value
I've been reading a lot lately about the next release of Java possibly supporting closures. I feel like I have a pretty firm grasp on what closures are, but I can't think of a solid example of how they would make an Object-Oriented language "better". Can anyone give me a specific use-case where a closure would be nee...
stackexchange/codereview
I am playing with a CAD application using MFC. I was thinking it would be nice to save the document (model) as an SQLite database. Advantages: I avoid file format changes (SQLite takes care of that) Free query engine Undo stack is simplified (table name, column name, new value and so on...) Opinions?
stackexchange/codereview
I'm a newbie when it comes to SQL. When creating a stored procedure with parameters as such: @executed bit, @failure bit, @success bit, @testID int, @time float = 0, @name varchar(200) = '', @description varchar(200) = '', @executionDate...
stackexchange/codereview
I can get rootmenuitemlefthtml and rootmenuitemrighthtml to emit but not separator. Tried CDATA wrapping and setting SeparatorCssClass. I just want pipes between root menu items. <dnn:SOLPARTMENU runat="server" id="dnnSOLPARTMENU" Separator="<![CDATA[|]]>" SeparatorCssClass="MainMenu_SeparatorCSS" usearrows="fa...
stackexchange/codereview
Some of the requirements (restrictions) for such a ui framework/toolkit are: No single vendor lock down Ability for real time data visualization Good initial widgets Good dash boarding capabilities cross platform Good development/debug environment No flash
stackexchange/codereview
I'm looking for a subversion web client ala SVN::Web but with a very specific feature I've always thought would be quite useful. What I want is the ability to find which revision was responsible for a certain line (or lines) in a text file. A way to do this via the web would be fantastic. Anybody know of such a tool?
stackexchange/codereview
I need to change color of TextBox whenever its required field validator is fired on Clicking the Submit button
stackexchange/codereview
I have an asp.net text form that contains numerous decimal fields that are optional. I want to selectively update the database but not inserting a "0" for fields that do not have data (maintaining the null status). Typically, I would create multiple functions, each with a different signature to handle this. However, I...
stackexchange/codereview
Ok, this is a weird one. The junk data isn't random either, it appears to be substrings of the executable itself. private void Form1_Load(object sender, EventArgs e) { string s = GetValue(); // at this point, s == "400". Why isn't really relevant (dumbed down a test) if (s != "18446744073709551615") ...
stackexchange/codereview
Is there anyway to build a solution to target 64 bit environment in vs2003? My solution is native c++ not visual c++. Any help would be greatly appreciated. cheers, RWendi
stackexchange/codereview
Implementing a file upload under html is fairly simple, but I just noticed that there is an 'accept' attribute that can be added to the <input type="file" ...> tag. Is this attribute useful as a way of limiting file uploads to images, etc? What is the best way to use it? Alternatively, is there a way to limit file type...
stackexchange/codereview
I am testing a Ruby Rails website and wanted to get started with Unit and Functional testing.
stackexchange/codereview
When you use Apache proxying (using either ProxyPass or RewriteRule), if the destination returns an error (500 series status) then Apache won't proxy any more requests for 30 seconds. I know there's a way to disable this by setting that value to 0 second, but I can't remember how. I think it involves a semicolon and s...
stackexchange/codereview
I recently came across a ASP 1.1 web application that put a whole heap of stuff in the session variable - including all the DB data objects and even the DB connection object. It ends up being huge. When the web session times out (four hours after the user has finished using the application) sometimes their database tra...
stackexchange/codereview
We have been using GenuineChannels in our product for the last 4 years. GenuineChannels now appears to have become unsupported and the main developer guy Dmitri has I think joined Microsoft. I have the source as part of the product but not the networking / .net knowledge to support it. Has anyone found a good alternati...
stackexchange/codereview
Like the title says, how do you create custom code snippets in Visual Studio 2008?
stackexchange/codereview
I want to automate a Windows 2000+ server reboot process using Task Scheduler or similar tool to remotely reboot a server and wait for it to come back up. I can issue shutdown or psshutdown to remotely reboot, but I want something better than sleep to wait for it to come back. I need to verify it is back online withi...
stackexchange/codereview
If you have an NSMutableArray, how do you shuffle the elements randomly? (I have my own answer for this, which is posted below, but I'm new to Cocoa and I'm interested to know if there is a better way.) Update: As noted by @Mukesh, as of iOS 10+ and macOS 10.12+, there is an -[NSMutableArray shuffledArray] method that...
stackexchange/codereview
Just looking at ways of getting named constants in python. class constant_list: (A_CONSTANT, B_CONSTANT, C_CONSTANT) = range(3) Then of course you can refer to it like so: constant_list.A_CONSTANT I suppose you could use a dictionary, using strings: constant_dic = { "A_CONSTANT" : 1, "B_CONSTANT" : 2,...
stackexchange/codereview
I'm wondering if it's possible to sandbox JavaScript running in the browser to prevent access to features that are normally available to JavaScript code running in an HTML page. For example, let's say I want to provide a JavaScript API for end users to let them define event handlers to be run when "interesting events" ...
stackexchange/codereview
How can I raise an event from a SWF file loaded into a Flex application (using SWFLoader)? I want to be able to detect a) when a button is pressed b) when the animation ends
stackexchange/codereview
I have a ListView in WPF that is databound to a basic table that I pull from the database. The code for the ListView is as follows: <ListView Canvas.Left="402" Canvas.Top="480" Height="78" ItemsSource="{Binding}" Name="lsvViewEditCardPrint" Width="419"> <ListView.View> <GridView> <GridViewColumn Displ...
stackexchange/codereview
We have a WCF service deployed on a Windows 2003 server that is exhibiting some problems. The configuration is using wsHttpBinding and we are specifying the IP address. The services is being hosted by a Windows Service. When we start the service up, most of the time it grabs the wrong IP address. A few times it boun...
stackexchange/codereview
How do I read a time value and then insert it into a TimeSpan variables?
stackexchange/codereview
In a number of applications we create an MSI Installer with the Visual Studio Setup Project. In most cases, the install works fine, but every now and then the previous version was not uninstalled correctly. The user ends up with two icons on the desktop, and in the Add/Remove program list, the application appears twice...
stackexchange/codereview
I have a web page in which people go to register for my site. I use server side validation to authenticate them. I need to call some Javascript to tell GA that user was or was not registered. Later I need stats on success in registration. How can I call the GA function on my server side C# code?
stackexchange/codereview
Are there are good uses of Partial Classes outside the webforms/winforms generated code scenarios? Or is this feature basically to support that?
stackexchange/codereview
It finally started to annoy me enough to ask this question: how do I do a basic diff between two revisions of a file in CVS? Usually I want to compare the latest revision and some random old one. I'm using the Eclipse CVS plugin. When I use "compare with->Another branch or version..." from the selected file's (latest r...
stackexchange/codereview
I know this is a subjective question, but why does Hibernate seem to be designed for short lived sessions? Generally in my apps I create DAOs to abstract my data layer, but since I can't predict how the entity objects are going to be used some of its collections are lazy loaded, or I should say fail to load once the s...
stackexchange/codereview
I've got a Lua program that seems to be slower than it ought to be. I suspect the issue is that I'm adding values to an associative array one at a time and the table has to allocate new memory each time. There did seem to be a table.setn function, but it fails under Lua 5.1.3: stdin:1: 'setn' is obsolete stack trace...
stackexchange/codereview
I have limited experience with .net. My app throws an error this.dateTimeFormat is undefined which I tracked down to a known ajax bug. The workaround posted said to: "Register the following as a startup script:" Sys.CultureInfo.prototype._getAbbrMonthIndex = function(value) { if (!this._upperAbbrMonths) { this._upper...
stackexchange/codereview
About a year ago, I picked up Scott Ambler's Refactoring Databases: Evolutionary Database Design. I was won over to the idea that just as you can develop your code with TDD, you probably should be covering your databases with unit tests (at least) or even writing database tests before you make a change to the schema so...
stackexchange/codereview
Given a simple (id, description) table t1, such as id description -- ----------- 1 Alice 2 Bob 3 Carol 4 David 5 Erica 6 Fred And a parent-child relationship table t2, such as parent child ------ ----- 1 2 1 3 4 5 5 6 Oracle offers a way of traversing this as a tree with some c...
stackexchange/codereview
How do I properly represent a different timezone using the datetime module? The following example using myTimeZone() only works because I know that EDT is one hour ahead of me. What is the replacement for that commented part of the code? import datetime, re from datetime import tzinfo class myTimeZone(tzinfo): """...
stackexchange/codereview
I have a menu control inside of an updatepanel. When I hover over a selected item, and then move back off of it, the css class gets set to staticSubMenuItem instead of staticSubMenuItemSelected. Is there a fix for this? <asp:UpdatePanel runat="server"> <ContentTemplate> ...
stackexchange/codereview
I keep getting this error when trying to re-order items in my ReorderList control. "Reorder failed, see details below. Can't access data source. It does not a DataSource and does not implement IList." I'm setting the datasource to a DataTable right now, and am currently trying to use an ArrayList datasource instead, b...
stackexchange/codereview
Can this be done w/ linqtosql? SELECT City, SUM(DATEDIFF(minute,StartDate,Completed)) AS Downtime FROM Incidents GROUP BY City
stackexchange/codereview
I want to export the contents of several tables from MSAccess2003. The tables contain unicode Japanese characters. I want to store them as tilde delimited text files. I can do this manually using File/Export and, in the 'Advanced' dialog selecting tilde as Field Delimiter and the Unicode as the Code Page. I can store ...
stackexchange/codereview
How do I create a file-like object (same duck type as File) with the contents of a string?
stackexchange/codereview
I have a select element in a form, and I want to display something only if the dropdown is not visible. Things I have tried: Watching for click events, where odd clicks mean the dropdown is visible and even clicks mean the dropdown isn't. Misses other ways the dropdown could disappear (pressing escape, tabbing to an...
stackexchange/codereview
As above, anyone tried that before on Windows 2008 server? If yes, how is everything go? Stable enough for production use?
stackexchange/codereview
Is there a keyboard shortcut for pasting the content of the clipboard into a command prompt window on Windows XP (instead of using the right mouse button)? The typical Shift+Insert does not seem to work here.
stackexchange/codereview
In my Silverlight project I have a thread that fires every x milliseconds. In this thread I was attempting to change the state of the application. This wasn't working and I didn't know why, so put a breakpoint in to the Timer callback. The breakpoint was hit, but the minute I attempted to change the state it just baile...
stackexchange/codereview
Can i override fetchall method in a model? I need to check sth everytime fetchAll is called. The model extends Zend_db_table_abstract
stackexchange/codereview
I want to use shoes to be able to download the body of a website that a user enters in an edit_line. How can I make this work? Can anyone help explain why the below code does not work? It just pops up a new window, and does not download the site from the text entered.... Here's my code thus far: Shoes.app do stack...
stackexchange/codereview
I need to profile a java application for a customer. It's an eclipse/maven project, so I decided on using eclipse TPTP ( http://www.eclipse.org/tptp ). I tried to install eclipse TPTP through the update manager from a standard eclipse installation, but I gave up because of the unbelievable complex setup and downloading...
stackexchange/codereview
I have a pseudo random number generator (PRNG) class that I want to unit test. There are two approaches: write a test case that takes a large amount of samples and test whether they are properly distributed. This approach may lead to a fairly long execution time for the test case; calculate a small series of samples '...
stackexchange/codereview
I want to let the users of my app, which is in turn an app container (app contains subapps), add java jars to their jython path. I let the subapp managers write thir own extensions in jython, but some of the functionality they want to add needs additional jars. For example, if they want to check a svn repo, they need t...
stackexchange/codereview
How precise is the VB6 Date data type (by way of fractions of a second)? How to format it to show fractions of a second? I'm revisiting VB6 after many years absence, and for the life of me can't remember the things I used to know. I considered putting a memory-leak tag on this, because my memory leaked (hur hur hur)....
stackexchange/codereview
I have a script which calls mysql_connect() to connect to a MySQL DB. When I run the script in a browser, it works. However, when I run it from a command line I receive the following error: Call to undefined function mysql_connect() This seems completely paradoxical. Anyone have any ideas as how I can run it from the...
stackexchange/codereview
I'm looking for a reasonably fast event handling mechanism in Java to generate and handle events across different JVMs running on different hosts. For event handling across multiple threads in a single JVM, I found some good candidates like Jetlang. But in my search for a distributed equivalent , I couldn't find anythi...
stackexchange/codereview
In C++/CLI , you can use native types in a managed class by it is not allowed to hold a member of a native class in a managed class : you need to use pointers in that case. Here is an example : class NativeClass { .... }; public ref class ManagedClass { private: NativeClass mNativeClass; // Not allowed ! NativeC...
stackexchange/codereview
I have just found a static nested interface in our code-base. class Foo { public static interface Bar { /* snip */ } /* snip */ } I have never seen this before. The original developer is out of reach. Therefore I have to ask SO: What are the semantics behind a static interface? What would change, i...
stackexchange/codereview
Using the Qt Visual studio integration, adding a new Qt class adds two separate moc.exe generated files - one for debug and one for release (and one for any other configuration currently existing). Yet the two eventual generated files seem to be identical. On the other hand when adding a UI class, the uic.exe generated...
stackexchange/codereview
I am having an ASP.net page in my page i am having this as my code behind files. on first access the page the page preinit, init, load methods are called. on postbacks the preinit, init, load methods are called. My question is LoadViewstate and control state events (Overridden methods) are not firing after postbacks al...
stackexchange/codereview
I want to create a VB.NET generic factory method that creates instances of classes (as a home-grown inversion of control container). If I pass the interface IDoSomething as the generic parameter, I want to return an instance of DoSomething (that implements IDoSomething). I cannot figure out the syntax of the if state...
stackexchange/codereview
Like many projects, we deploy to many environments, QA, UA, Developer trunks, etc.. What is the best way to store sensitive configuration parameters in SVN? Or, should you not and just maintain a smaller unversioned file with credentials in it on the server? Mainly, we do not want to expose production credentials to ev...
stackexchange/codereview
I enjoy developing algorithms using the STL, however, I have this recurring problem where my data sets are too large for the heap. I have been searching for drop-in replacements for STL containers and algorithms which are disk-backed, i.e. the data structures on stored on disk rather than the heap. A friend recently ...
stackexchange/codereview
I've been arguing with my coworkers about Pascal casing (upper camel case) vs. lower CamelCasing. They are used to lower camel casing for everything from table names in SQL databases to property naming in C# code but I like Pascal casing better, lower camel casing for variables and Pascal casing for properties: string ...
stackexchange/codereview
I have an API that is dependent on certain state information between requests. As an easy first version of the code, I am simply using PHP session's to store the state information instead of something more advanced (APC, memcache, DB). Throughout my initial testing in a web browser, everything worked perfectly. However...
stackexchange/codereview
We are currently running a SQL Job that archives data daily at every 10PM. However, the end users complains that from 10PM to 12, the page shows a time out error. Here's the pseudocode of the job while @jobArchive = 1 and @countProcecessedItem < @maxItem exec ArchiveItems @countProcecessedItem out if error oc...
stackexchange/codereview
I'm looking for an add-in to VS2008 that can enable structural highlighting (vertical lines in blocks of code) in the C# code editor. I tried out CodeRush, but while the structural highlighting was great, I was annoyed with all the other stuff in CodeRush. No matter how much I disabled in the options, I couldn't quite...
stackexchange/codereview
I am using an authentication attribute on some of my actions in an asp.net mvc page to refer people to a login screen if they have not authenticated. My problem is returning them to the referring page after they have logged in. I was just keeping track of the referring action and referring controller but that becomes...
stackexchange/codereview
I haven't installed Visual Studio before on my computer. However when I try to install Visual Studio 2008 Express SP1 I get an error message "Setup has detected that this computer does not meet the requirements to install this software. These requirements must be met before you can install Microsoft Visual C++ 2008 Exp...
stackexchange/codereview
Ryan Delucchi asked here in comment #3 to Tom Hawtin's answer: why is Class.newInstance() "evil"? this in response to the code sample: // Avoid Class.newInstance, for it is evil. Constructor<? extends Runnable> ctor = runClass.getConstructor(); Runnable doRun = ctor.newInstance(); so, why is it Evil?
stackexchange/codereview
I'd like to read whole content of a text file to a std::string object with c++. With Python, I can write: text = open("text.txt", "rt").read() It is very simple and elegant. I hate ugly stuff, so I'd like to know - what is the most elegant way to read a text file with C++? Thanks.
stackexchange/codereview
I have a site I made really fast that uses floats to display different sections of content. The floated content and the content that has an additional margin both appear fine in FF/IE, but on safari one of the divs is completely hidden. I've tried switching to padding and position:relative, but nothing has worked for m...
stackexchange/codereview
When you run something similar to: UPDATE table SET datetime = NOW(); on a table with 1 000 000 000 records and the query takes 10 seconds to run, will all the rows have the exact same time (minutes and seconds) or will they have different times? In other words, will the time be when the query started or when each row...
stackexchange/codereview
I am new to this community, but I am working on a site that requires implementation of a user/password/register check upon entry, which would check against a database, or write to the database, in the case of registration. I have experience with XHTML and CSS, and just discovered RoR. I honestly have very little insigh...
stackexchange/codereview
I have a Zimbra installation and I need to programmaticaly update contacts in it. It seems that its REST interface is only working to add new contacts, but I need to update existing ones. Is there a way, tool or something, open-source, to do that ?
stackexchange/codereview
How can I determine if I'm running on a 32bit or a 64bit version of matlab? I have some pre-compiled mex-files which need different path's depending on 32/64bit matlab.
stackexchange/codereview
I'm having performance oddities with Java2D. I know of the sun.java2d.opengl VM parameter to enable 3D acceleration for 2D, but even using that has some weird issues. Here are results of tests I ran: Drawing a 25x18 map with 32x32 pixel tiles on a JComponent Image 1 = .bmp format, Image 2 = A .png format Without -Dsun...
stackexchange/codereview
Can someone take a look at this code and tell me if there's any obvious reason it shouldn't be working? When service.getResponse is called within my code the mocking framework only returns null, not the object I specified. [Test] public void Get_All_Milestones() { var mockRepo = new MockRepository()...
stackexchange/codereview
Very simply put: I have a class that consists mostly of static public members, so I can group similar functions together that still have to be called from other classes/functions. Anyway, I have defined two static unsigned char variables in my class public scope, when I try to modify these values in the same class' con...
stackexchange/codereview
I'm attempting to use File.Move to move a file from one UNC location to another. This blows up if the UNC path for the destination happens to be the local machine (error: Access to the path is denied). Example File.Move(@"\\someServer\path\file.txt", @"\\blah2\somewhere\file.txt"). This assumes there's a network sha...
stackexchange/codereview
I have a production server running with the following flag: -XX:+HeapDumpOnOutOfMemoryError Last night it generated a java-38942.hprof file when our server encountered a heap error. It turns out that the developers of the system knew of the flag but no way to get any useful information from it. Any ideas?
stackexchange/codereview
I just got through manually removing the bin\ and obj\ folders from around 30 VS projects getting them ready for an initial SVN commit. Yeah, I know, I should have done it alot sooner, but these are personal project on my home PC, and I only installed a SVN server locally today. Anyway, it occurs to me that there must ...
stackexchange/codereview
I'm looking to add localization to a web site (asp.net /c# if that makes a difference) with a minimum of effort. I've looked at tools like wiztom multilizer and I am curious as to others experience with them. Have you used tools like these successfully and if so, what would you do differently?
stackexchange/codereview
Recently I was asked this during a job interview. I was honest and said I knew how a symbolic link behaves and how to create one, but do not understand the use of a hard link and how it differs from a symbolic one.
stackexchange/codereview
I noticed when a file is executed on Windows (.exe or .dll), it is locked and cannot be deleted, moved or modified. Linux, on the other hand, does not lock executing files and you can delete, move, or modify them. Why does Windows lock when Linux does not? Is there an advantage to locking?
stackexchange/codereview
Every time I use the "at" command, I get this message: warning: commands will be executed using /bin/sh What is it trying to warn me about? More importantly, how do I turn the warning off?
stackexchange/codereview
I am trying to make this feature available, maybe in an apache .htaccess file.
stackexchange/codereview
I have a source base that, depending on defined flags at build time, creates two different apps. I can build both of these apps using a Makefile by specifying two different targets, one that compiles with a flag and one that compiles without, and having an aggregate target that builds both. How do I do the equivalent t...
stackexchange/codereview
I have trouble. One of the users of an application I'm developing is occasionally, but regularly, experiencing an application hang. When this happens, we find an entry with a source of "Application Hang" in the machine's Event Log, with the informative message "Hanging application [my app], version [the right version]...
stackexchange/codereview
I have an application running under Windows XP, and I'm accessing the Processor and Memory performance counters. When I try to run the same code and access them on XP Embedded, the counters don't seem to be present. They are present in the image - I can see them all in perfmon. What's the missing piece here?
stackexchange/codereview
This is the day of weird behavior. We have a Win32 project made with Delphi 2007, which hosts the .NET runtime and calls into .NET to show new forms, as part of a transition period. Recently we've begun experiencing exceptions at seemingly random locations and points of our code: Arithmetic overflow or underflow. The s...
stackexchange/codereview
I have a WCF service and I want to expose it as both a RESTfull service and as a SOAP service. Anyone has done something like this before?
stackexchange/codereview
I am actually loading a page as a modal dialog box as window.showModalDialog("url.aspx"). The first time the modal dialog is poped up the page load event gets called. When i close it and call the same again, the Control does not come to the PageLoad. Instead the page pops up with the previous values in all its controls...
stackexchange/codereview
I've got the following example running in a simple Silverlight page: public Page() { InitializeComponent(); InitializeOther(); } private DoubleCollection dashes; public DoubleCollection Dashes { get { //dashes = new DoubleCollection(); //works ok //dashes.Add(2.0); //dashes.Add(2.0); if (dash...
stackexchange/codereview
Would you recommend me the best approach to edit SQL query with Visual Studio 2008 Professional, please? I know I can open Query window from context menu in Server Explorer and edit text in SQL Pane. But unfortunately I am not allowed to save query to a file and Find and Replace commands are not working there. Alterna...
stackexchange/codereview
For an application (*) I'm developing I need a mixture of dynamically generated and static pages. It would be cool to use a wiki such that once a dynamic page has been accessed for the first time it becomes a static page that can be annotated by a user just like any other static wiki page. In other words, I want to ove...
stackexchange/codereview
At work, I use Cygwin a lot because it offers me a small oasis in the vast desert of Windows. I inevitably end up running some non-Cygwin programs through the bash shell, such as build scripts (batch files created in-house) and the Subversion CLI binaries (I have the Windows ones installed). 99% of the time, I don't ...
stackexchange/codereview
If I have a style defined .style1 { width: 140px; } can I reference it from a second style? .style2 { ref: .style1; } Or is there a way via javascript/jQuery? --- Edit To clarify the problem, I am trying to apply whatever style is defined for a #x and #c to .x and .c without altering the CSS as the CSS is going...
stackexchange/codereview
I've been using this nifty LINQ to SQL tool for a data access layer in an asp.net project. I keep making changes to the underlying tables and in order for the data classes to recognize the change I have to delete and readd the table which has changed. Is there some shortcut to regenerating the data layer?
stackexchange/codereview
Do any apps/packages exist that will support writing to OS X's log database from external sources. I'm not too familiar with the specifics of the database, beyond the fact that you can view its contents from the Console app. I'm not even sure if it's just a version of some simple DB like SQLite or if it is some sort of...
stackexchange/codereview
After Visual Studio 2005 displays the splash screen it locks up on me. No error, no cpu utilization, just a frozen splash screen. I've tried it in both /safemode and /resetsettings I'm sure it's one of the services on my machine, just wonder if anyone else has had the problem and can help me with the hunt? BTW, it's ...
stackexchange/codereview
We have TFS 2008 our build set up to checkout all AssemblyInfo.cs files in the project, update them with AssemblyInfoTask, and then either undo the checkout or checkin depending on whether the build passed or not. Unfortunately, when two builds are queued close together this results in a Partially completed build as t...
stackexchange/codereview
Is there any open source OCR library written in .NET, or written in any language but can be used in an ASP.NET application? Or is there any open source OCR API available in the market for image to tabular formats ?
stackexchange/codereview
Is is possible to create COM component and ActiveX controls in .Net (using c# language). I searched internet but i could`t get anything. Thanks, santhosh
stackexchange/codereview
I have two queries saved on my SQL Server 2005 and I would like to have them running at certain intervals, e.g. every 24 hours. Is there a way to automate these queries and schedule them via SQL Server Management Studio?
stackexchange/codereview