instruction_seed
stringlengths
1
35.8k
_source
stringclasses
1 value
I have a console app in which I want to give the user x seconds to respond to the prompt. If no input is made after a certain period of time, program logic should continue. We assume a timeout means empty response. What is the most straightforward way of approaching this?
stackexchange/codereview
Has anybody found a good solution for lazily-evaluated lists in Perl? I've tried a number of ways to turn something like for my $item ( map { ... } @list ) { } into a lazy evaluation--by tie-ing @list, for example. I'm trying to avoid breaking down and writing a source filter to do it, because they mess with your a...
stackexchange/codereview
aspnet mvc has the HandleError filter that will return a view if an error occurs, but if an error occurs when calling a JsonResult Action how can I return a JSON object that represents an error? I don't want to wrap the code in each action method that returns a JsonResult in a try/catch to accomplish it, I'd rather do ...
stackexchange/codereview
I can use DCOMCNFG to disable remote launch on my DCOM application, but I would like to do this programatically. I looked at CoInitializeSecurity, but that does not seem to do it. Anyone done this? I am using Delphi BTW.
stackexchange/codereview
In Firefox you can enter the following into the awesome bar and hit enter: javascript:self.resizeTo(1024,768); How do you do the same thing in IE?
stackexchange/codereview
How do I get the key of the current element in a foreach loop in C#? For example: PHP foreach ($array as $key => $value) { echo("$value is assigned to key: $key"); } What I'm trying to do in C#: int[] values = { 5, 14, 29, 49, 99, 150, 999 }; foreach (int val in values) { if(search <= val && !stop) { ...
stackexchange/codereview
What libraries are there to write C# internationalized applications? Typical functionalities that should be contained in the library: Validation of country specific data (e.g. VAT numbers, phone numbers, addresses,...) Validation of bank and financial coordinates (e.g. Credit Card numbers, IBAN,...) Language-specific ...
stackexchange/codereview
From my understanding the XMPP protocol is based on an always-on connection where you have no, immediate, indication of when an XML message ends. This means you have to evaluate the stream as it comes. This also means that, probably, you have to deal with asynchronous connections since the socket can block in the midd...
stackexchange/codereview
To see what file to invoke the unrar command on, one needs to determine which file is the first in the file set. Here are some sample file names, of which - naturally - only the first group should be matched: yes.rar yes.part1.rar yes.part01.rar yes.part001.rar no.part2.rar no.part02.rar no.part002.rar no.part011.rar ...
stackexchange/codereview
I am trying to program a small server+client in Javascript on Firefox, using XPCOM. To get the HTTP message in Javascript, I am using the nsIScriptableInputStream interface. This f**ing component through the read() method randomly cut the message and I cannot make it reliable. Is anybody know a solution to get reliably...
stackexchange/codereview
So our SQL Server 2000 is giving me the error, "The log file for database is full. Back up the transaction log for the database to free up some log space." How do I go about fixing this without deleting the log like some other sites have mentioned? Additional Info: Enable AutoGrowth is enabled growing by 10% and is re...
stackexchange/codereview
What should I do if I want to release a .net assembly but wish to keep its internals detailed in the manifest private (from a utility such as ildasm.exe) ?
stackexchange/codereview
I have about 150 000 rows of data written to a database everyday. These row represent outgoing articles for example. Now I need to show a graph using SSRS that show the average number of articles per day over time. I also need to have a information about the actual number of articles from yesterday. The idea is to have...
stackexchange/codereview
In a recent sharepoint project, I implemented an authentication webpart which should replace the NTLM authentication dialog box. It works fine as long as the user provides valid credentials. Whenever the user provides invalid credentials, the NTLM dialog box pops up in Internet Explorer. My Javascript code which does t...
stackexchange/codereview
People, We have 4 or 5 utilities that work in conjunction with our application. These utilities are either .bat files, or VB apps, PowerBuilder, etc. I am trying to manage these utils in source control, and am trying to figure out a better way to assign versions to them. Right now, the developers use the version contro...
stackexchange/codereview
Has anyone worked out how to get PowerShell to use app.config files? I have a couple of .NET DLL's I'd like to use in one of my scripts but they expect their own config sections to be present in app.config/web.config.
stackexchange/codereview
This has been a fun week (if you look back at my questions you'll see a common theme). I have a repeater that is bound to a collection. Each repeater item dynamic control that corresponds to the collection item, it also renders out a header over each control that contains a Delete link. When the delete link is clicked,...
stackexchange/codereview
I was wondering; which logging libraries for Delphi do you prefer? CodeSite SmartInspect Log4Delphi TraceFormat Please try to add a reasoning why you prefer one over the other if you've used more than one. I'll add suggestions to this question to keep things readable.
stackexchange/codereview
I'd like to write a simple C# application to monitor the line-in audio and give me the current (well, the rolling average) beats per minute. I've seen this gamedev article, and that was absolutely no help. I went through and tried to implement what he was doing but it just wasn't working. I know there have to be tons o...
stackexchange/codereview
I would like to test out the new SP1 in my development server and then install it for my production server. But I wonder what it had enhance to the ASP.NET portion specifically as that is where my concerns are. I read the docs found in the SP1 Download page but it seens a bit too general to me, not much on the ASP.NE ...
stackexchange/codereview
As I put together each asp.net page It's clear that most of the time I could use the standard HTML tags just as easily as the web forms controls. When this is the case what is the lure of the webforms controls?
stackexchange/codereview
I noticed that my Designer.vb file of one of my forms has a lot of controls that aren't even used or visible on my form. This is probably from copying controls from my other forms. Is there a way to clean up the Designer.vb file and get rid of all the unused controls? **UPDATE: This is for a Windows Form project.
stackexchange/codereview
Is accessing a bool field atomic in C#? In particular, do I need to put a lock around: class Foo { private bool _bar; //... in some function on any thread (or many threads) _bar = true; //... same for a read if (_bar) { ... } }
stackexchange/codereview
I've got the following in my .css file creating a little image next to each link on my site: div.post .text a[href^="http:"] { background: url(../../pics/remote.gif) right top no-repeat; padding-right: 10px; white-space: nowrap; } How do I modify this snippet (or add something new) to exclude the link icon...
stackexchange/codereview
I'm working on an ASP.NET website which targets desktop browsers. We want to enable an optional mobile view (e.g. http://m.sample.com) which will offer a few simple pages which will be mostly text. There will be not need for AJAX or even Javascript, and there's no user input - it's really just tables of text with a few...
stackexchange/codereview
Are there any import and export tools that would let us move projects into and out of team system with full history and log? Our current SCM is SVN. PS - Sorry, I know it's a repost, but I didn't get an answer before... :)
stackexchange/codereview
As far as I know, Flash has to pass info off to another external process in order to save files - POSTing to PHP or talking to an executable, right? But every once in a while I hear rumors that Flash is able to open a file, make changes, then save/write those changes, all on its own - is it possible?
stackexchange/codereview
now i need to insert some data from the sqlserver into a word,i know how to use bookmark and the office interop api do that but it's slow to call the word process do that and it's coupling between the bookmark define and the code , is it possible to do this without word process start?if not are there any template e...
stackexchange/codereview
I've tried cpan and cpanp shell and I keep getting: ExtUtils::PkgConfig requires the pkg-config utility, but it doesn't seem to be in your PATH. Is it correctly installed? What is the pkg-config utility and how do I install it? Updates: OS: Windows This module is a prerequisite for the File::Extractor module
stackexchange/codereview
How to implement multi-threading in visual basic 6.0. It would be great if someone can give an example.
stackexchange/codereview
I've got a generic<> function that takes a linq query ('items') and enumerates through it adding additional properties. How can I select all the properties of the original 'item' rather than the item itself (as the code below does)? So equivalent to the sql: select *, 'bar' as Foo from items foreach (var item in items)...
stackexchange/codereview
just a quick question: I am a CS undergrad and have only had experience with the Eclipse, and Net Beans IDEs. I have recently acquired a Macbook and was wanting to recompile a recent school project in Xcode just to test it out. Right after the line where I declare a new instance of an ArrayList: dictionary = new Arr...
stackexchange/codereview
I want to make a copy of an ActiveRecord object, changing a single field in the process (in addition to the id). What is the simplest way to accomplish this? I realize I could create a new record, and then iterate over each of the fields copying the data field-by-field - but I figured there must be an easier way to do...
stackexchange/codereview
I am writing a batch file script using Windows command-line environment and want to change each occurrence of some text in a file (ex. "FOO") with another (ex. "BAR"). What is the simplest way to do that? Any built in functions?
stackexchange/codereview
I am currently working on (or at least planning) a couple of projects that work with large amounts of repetitive data. The kind of data that works well in a spreadsheet or database, but is nasty in XML. :) NetCDF seems like a great option for a file format. However, my work is in C# and there is no "official" NetCDF im...
stackexchange/codereview
I'm embedding the Google Maps Flash API in Flex and it runs fine locally with the watermark on it, etc. When I upload it to the server (flex.mydomain.com) I get a sandbox security error listed below: SecurityError: Error #2121: Security sandbox violation: Loader.content: http://mydomain.com/main.swf?Fri, 12 Sep 200...
stackexchange/codereview
Without resorting to PInvoke, is there a way in .net to find out what windows are open? This is slightly different than asking what applications are running in memory. For example, Firefox could be running, but could be more than one window. Basically, I just want to be privy to the same information that the taskbar...
stackexchange/codereview
I've been using git for some time now on Windows (with msysGit) and I like the idea of distributed source control. Just recently I've been looking at Mercurial (hg) and it looks interesting. However, I can't wrap my head around the differences between hg and git. Has anyone made a side-by-side comparison between git an...
stackexchange/codereview
I'm using MySQL in particular, but I'm hoping for a cross-vendor solution. I'm using the NOW() function to add a timestamp as a column for each record. INSERT INTO messages (typeId, messageTime, stationId, message) VALUES (?, NOW(), ?, ?)
stackexchange/codereview
I've been making my way through The Little Schemer and I was wondering what environment, IDE or interpreter would be best to use in order to test any of the Scheme code I jot down for myself.
stackexchange/codereview
As much as we would all like to say it is a benefit to programmers to be language agnostic, is it really feasible to support multiple enterprise Web applications of the same type all written in different languages? Think about how complicated a CMS or e-commerce system can be -- now imagine supporting three different C...
stackexchange/codereview
Does anyone know if it is possible to restart a J2EE application (from the application)? If so, how? I would like to be able to do it in an app-server-agnostic way, if it is possible. The application will be run on many different app servers-- basically whatever the client prefers. If it isn't possible to do this in a...
stackexchange/codereview
I have been tasked with going through a number of ColdFusion sites that have recently been the subject of a rather nasty SQL Injection attack. Basically my work involves adding <cfqueryparam> tags to all of the inline sql. For the most part I've got it down, but can anybody tell me how to use cfqueryparam with the LI...
stackexchange/codereview
Looking at what's running and nothing jumps out. Thanks!
stackexchange/codereview
Has anyone used the new Java 1.6 JDK tool, VisualVM, to profile a production application and how does the application perform while being profiled? The documentation say that it is designed for both Production and Development use, but based on previous profiling experience, with other profiling tools, I am hesitant.
stackexchange/codereview
It seems that Microsoft wants Silverlight to take off, yet I cannot find an easy way to develop in it without buying Visual Studio 2008. Has anyone out there found a way to get the silverlight development environment in the express editions of Visual Studio? Any other tools?
stackexchange/codereview
I recently installed Windows 2008 Server to replace a crashed hard drive on a web server with a variety of web pages including several classic ASP applications. One of these makes extensive use of file uploads using a com tool that has worked for several years. More information: My users did not provide good informati...
stackexchange/codereview
I am currently working on a project where a programmer who fancied themselves a graphic designer attempted their hand at ASP.Net themes. The CSS is pretty bad, but that is another question altogether. What I really need help with is the best way to organize ASP.Net Themes and the CSS that lies within them. Imagine that...
stackexchange/codereview
I am setting up a rails app and I just finished making some unit tests and my friend said that apparently fixtures are no longer cool and people are now using RSpec or shoulda. I was wondering what the actual benefits are to use these other toolkits. Any information at all is appreciated. -fREW
stackexchange/codereview
I want to simulate a 'Web 2.0' Lightbox style UI technique in a Windows Forms application. That is, to draw attention to some foreground control by 'dimming' all other content in the client area of a window. The obvious solution is to create a control that is simply a partially transparent rectangle that can be docked...
stackexchange/codereview
I have a structure in C#: public struct UserInfo { public string str1 { get; set; } public string str2 { get; set; } } The only rule is that UserInfo(str1="AA", str2="BB").Equals(UserInfo(str1="BB", str2="AA")) How to override the GetHashCode function for this structure?
stackexchange/codereview
Working on implementing TFS throughout our organization. It is easy to integrate with .NET projects and any platform that uses Eclipse or a derivative of Eclipse for editing. What's the best way to use TFS version control with Xcode (now that I find out we need to write some iPhone apps)?
stackexchange/codereview
I am creating an installer in IzPack. It is quite large, and I have broken up my XML files appropriately using <xinclude> and <xfragment> tags. Unfortunately, IzPack does not combine them together when you build your installer. This requires you to package the files with the installer, which just won't work. I was abo...
stackexchange/codereview
I have to write an applet that brings up a password dialog. The problem is that dialog is set to be always on top but when user clicks on IE window dialog gets hidden behind IE window nevertheless. And since dialog is modal and holds all IE threads IE pane does not refresh and dialog window is still painted on top of I...
stackexchange/codereview
In the past, some of my projects have required me to create a movie version of a fullscreen Flash application. The easiest way to do this has been to get a screen capture. However, capturing anything over 1024x768 has resulted in choppy video, which is unacceptable. I understand that there are hardware based solutions ...
stackexchange/codereview
I am curious about how do you protect your software against cracking, hacking etc. Do you employ some kind of serial number check? Hardware keys? Do you use any third-party solutions? How do you go about solving licensing issues? (e.g. managing floating licenses) EDIT: I'm not talking any open source, but strictly com...
stackexchange/codereview
Why do I need two of them? When I have to use one or another?
stackexchange/codereview
I am looking for a way to concatenate the strings of a field within a group by query. So for example, I have a table: ID COMPANY_ID EMPLOYEE 1 1 Anna 2 1 Bill 3 2 Carol 4 2 Dave and I wanted to group by company_id to get something like: COMPANY_ID EMPLOYEE 1 Anna, Bill 2 Carol, Dave Ther...
stackexchange/codereview
This is slightly off topic of programming but still has to do with my programming project. I'm writing an app that uses a custom proxy server. I would like to write the server in C# since it would be easier to write and maintain, but I am concerned about the licensing cost of Windows Server + CALS vs a Linux server (...
stackexchange/codereview
I'm getting near completely different objects from the same WSDL file when I try to Add a Web Reference depending if I am using Express or Pro version of the vs2008 .NET IDE. 1) Why is this happening? I'd expect the WSDL's to act the same across platforms--clearly they are not! 2) How do I determine what tool/wizard th...
stackexchange/codereview
I've been programming in C,C++,C# and a few other languages for many years, mainly for Windows and Linux but also embedded platforms. Recently started to do some iPhone programming as a side project so I'm using Apple platforms for the first time since my Apple II days. I'm wondering what other developers that are comi...
stackexchange/codereview
I've added a callback to an IHTMLElement instance but when the IDispatch::Invoke is called for the event, there are never any arguments (i.e. the pDispParams->cArgs and pDispParams->cNamedArgs are always 0). For example, I add a callback for an onmouseup event. From what I can tell, a callback for this event is suppose...
stackexchange/codereview
I know that JTable can sort by a single column. But is it possible to allow for multiple column sort or do I need to write the code myself?
stackexchange/codereview
Anyone know? Want to be able to on the fly stamp an image with another image as a watermark, also to do large batches. Any type of existing library or a technique you know of would be great.
stackexchange/codereview
In my app i need to save changed values (old and new) when model gets saved. Any examples or working code? I need this for premoderation of content. For example, if user changes something in model, then administrator can see all changes in separate table and then decide to apply them or not.
stackexchange/codereview
Possible Duplicate: Combine Gyroscope and Accelerometer Data I have read a number of papers on Kalman filters, but there seem to be few good publically accessible worked examples of getting from mathematical paper to actual working code. I have a system containing a three-axis accelerometer and a single gyro measuri...
stackexchange/codereview
Below is the code I use to build an HTML table on the fly (using JSON data received from the server). I display an animated pleasewait (.gif) graphic while the data is loading. However, the graphic freezes while the JavaScript function is building the table. At first, I was just happy to make this happen (display the t...
stackexchange/codereview
(Jeopardy-style question, I wish the answer had been online when I had this issue) Using Java 1.4, I have a method that I want to run as a thread some of the time, but not at others. So I declared it as a subclass of Thread, then either called start() or run() depending on what I needed. But I found that my program wou...
stackexchange/codereview
I don't want PHP errors to display /html, but I want them to display in /html/beta/usercomponent. Everything is set up so that errors do not display at all. How can I get errors to just show up in that one folder (and its subfolders)?
stackexchange/codereview
We have several wizard style form applications on our website where we capture information from the user on each page and then submit to a backend process using a web service. Unfortunately we can't submit the information in chunks during each form submission so we have to store it the users session until the end of th...
stackexchange/codereview
I'm using start.jar and stop.jar to stop and start my jetty instance. I restart by calling stop.jar, then start.jar. The problem is, if I don't sleep long enough between stop.jar and start.jar I start getting these random ClassNotFoundExceptions and the application doesn't work correctly. Sleeping for a longer period o...
stackexchange/codereview
I've heard that the static_cast function should be preferred to C-style or simple function-style casting. Is this true? Why?
stackexchange/codereview
I'm wondering how do you deal with displaying release revision number when pushing live new versions of your app? You can use $Rev$ in a file to get latest revision, but only after you update the file. What if I want to update a string in one file every time I change any file in the repository/directory? Is there a way...
stackexchange/codereview
I'm trying to make a context menu for a control that is "linked" to a main menu item. There are two fixed menu items that are always there and an arbitrary number of additional menu items that might need to be on the menu. I've tried solving the problem by keeping a class-level reference to the fixed menu items and a ...
stackexchange/codereview
Using c#, VS2005, and .NET 2.0. (XP 32 bit) This is a Winforms app that gets called by a VBA addin (.xla) via Interop libraries. This app has been around for a while and works fine when the assembly is compiled and executed anywhere other than my dev machine. On dev it crashes hard (in debugger and just running the ob...
stackexchange/codereview
I've encrypted the connectionstring in my web.config file using the steps in the link below: http://www.codeproject.com/KB/database/WebFarmConnStringsNet20.aspx However, whenever I call my application, it will give the following error: Failed to decrypt using provider 'CustomProvider'. Error message from the pro...
stackexchange/codereview
How many lines of code can a .java file contain? Does it depend on the JVM being used?
stackexchange/codereview
I'm running some JUnit tests on my applications. Every test has a for loop calling respective method 10000 times. The tested methods produce a lot of log. These logs are also automatically collected by JUnit as test output. This situation takes to OutOfMemoryError because the string buffer where JUnit keeps the output...
stackexchange/codereview
What would you say are the essential steps in verifying a file upload? I'd tend to check the MIME type, give it a new (random) name, make sure its got an allowed file extension, and then I'd check the contents of the file. How do you go about it?
stackexchange/codereview
I'm looking for an alternative to www.jsfmatrix.net to get a better idea of what JSF libraries are out there and to avoid having to write my own grid/table components. Or are these 27 the best the world has to offer (really only 3 are worth their salt.)
stackexchange/codereview
Just bought a 2.4GHz Intel Core 2 Duo iMac with 2GB of memory and a 320GB hard drive. I plan on doing some .net development on it using a BootCamp/VMWare combo since VMWare grants access to the bootcamp partition. What is a recommended size for a BootCamp partition and how much memory should I give VMWare? Any pitfalls...
stackexchange/codereview
Several questions about functional programming languages have got me thinking about whether XSLT is a functional programming language. If not, what features are missing? Has XSLT 2.0 shortened or closed the gap?
stackexchange/codereview
Is a Star-Schema design essential to a data warehouse? Or can you do data warehousing with another design pattern?
stackexchange/codereview
I'll have an ASP.net page that creates some Excel Sheets and sends them to the user. The problem is, sometimes I get Http timeouts, presumably because the Request runs longer than executionTimeout (110 seconds per default). I just wonder what my options are to prevent this, without wanting to generally increase the exe...
stackexchange/codereview
I have a large codebase without Javadoc, and I want to run a program to write a skeleton with the basic Javadoc information (e.g., for each method's parameter write @param...), so I just have to fill the gaps left. Anyone know a good solution for this? Edit: JAutodoc is what I was looking for. It has Ant tasks, an Ecl...
stackexchange/codereview
There are lots of widgets provided by sites that are effectively bits of JavaScript that generate HTML through DOM manipulation or document.write(). Rather than slow the browser down even more with additional requests and trust yet another provider to be fast, reliable and not change the widget output, I want to execut...
stackexchange/codereview
I have Laconica (self hosted twitter) configured on my local intranet and would like to integrate the public stream into SharePoint site with a web part. How can I do this?
stackexchange/codereview
I have a legacy web site in ColdFusion MX 2004. I'm re-writing it in .Net, so I don't want to pay $600+ for an upgrade to the latest version of ColdFusion, nor do I want to go through the (very large) site fixing version incompatibilities. I often have to track down and fix bugs in the site. A source-level debugger th...
stackexchange/codereview
If you need to open a SqlConnection before issuing queries, can you simply handle all non-Open ConnectionStates in the same way? For example: if (connection.State != ConnectionState.Open) { connection.Open(); } I read somewhere that for ConnectionState.Broken the connection needs to be closed befo...
stackexchange/codereview
I'm planning to install Drupal. Is there any reason not to install the latest 6.x version as opposed to the 5.x branch? Are there any really good modules that are 5.x only?
stackexchange/codereview
Is there a system stored procedure to get the version #?
stackexchange/codereview
How do I create a silverlight data template in code? I've seen plenty of examples for WPF, but nothing for Silverlight. Edit: Here's the code I'm now using this for, based on the answer from Santiago below. public DataTemplate Create(Type type) { return (DataTemplate)XamlReader.Load( @"<DataTemplate ...
stackexchange/codereview
I'm facing a problem on the Win32 API. I have a program that, when it handles WM_PAINT messages, it calls BeginPaint to clip the region and validate the update region, but the BeginPaint function is always generating a WM_NCPAINT message with the same update region, even if the touched part that needs repainting is onl...
stackexchange/codereview
I'm trying to identify differences between a base case and supplied case. Looking for a library to tell me similarity in percentage or something like that. For Example: I've 10 different HTML pages. * All of them are 404 responses with only one 2 lines of random code (such as time or quote of the day). Now when I supp...
stackexchange/codereview
On Linux/GCC I can use the -rpath flag to change an executables search path for shared libraries without tempering with environment variables. Can this also be accomplished on Windows? As far as I know, dlls are always searched in the executable's directory and in PATH. My scenario: I would like to put shared librar...
stackexchange/codereview
I have been working on some legacy C++ code that uses variable length structures (TAPI), where the structure size will depend on variable length strings. The structures are allocated by casting array new thus: STRUCT* pStruct = (STRUCT*)new BYTE[sizeof(STRUCT) + nPaddingSize]; Later on however the memory is freed usin...
stackexchange/codereview
Experienced with Rails / ActiveRecord 2.1.1 You create a first version with (for example) ruby script\generate scaffold product title:string description:text image_url:string This create (for example) a migration file called 20080910122415_create_products.rb You apply the migration with rake db:migrate Now, you add a ...
stackexchange/codereview
What is the main difference between an inner class and a static nested class in Java? Does design / implementation play a role in choosing one of these?
stackexchange/codereview
I have a start of a webapp that I wrote without using the Object Oriented features of PHP. I don't really know if it is worth it to go back and rewrite the parts I have finished. Is object oriented PHP worth rewriting all or part of a decent working app?
stackexchange/codereview
This one will take some explaining. What I've done is create a specific custom message queue in SQL Server 2005. I have a table with messages that contain timestamps for both acknowledgment and completion. The stored procedure that callers execute to obtain the next message in their queue also acknowledges the message....
stackexchange/codereview