instruction_seed
stringlengths
1
35.8k
_source
stringclasses
1 value
I've been working on a project where I need to iterate through a collection of data and remove entries where the "primary key" is duplicated. I have tried using a List<int> and Dictionary<int, bool> With the dictionary I found slightly better performance, even though I never need the Boolean tagged with each entry. ...
stackexchange/codereview
I'm interested in using API spying/hijacking to implement some core features of a project I'm working on. It's been mentioned in this question as well, but that wasn't really on topic so I figured it'd be better with a question of its own for this., I'd like to gather as much information as possible on this, different ...
stackexchange/codereview
How do you generate passwords? Random Characters? Passphrases? High Ascii? Something like this? cat /dev/urandom | strings
stackexchange/codereview
I'm using Castle Windsor for dependency injection in my test project. I'm trying to create an instance one of my 'Repository' classes. "It works fine on my machine", but when I run a nightly build in TFS, my tests are not able to load said classes. private static readonly WindsorContainer _container = new WindsorContai...
stackexchange/codereview
I am looking for a way in LINQ to match the follow SQL Query. Select max(uid) as uid, Serial_Number from Table Group BY Serial_Number Really looking for some help on this one. The above query gets the max uid of each Serial Number because of the Group By Syntax.
stackexchange/codereview
Windows Forms allows you to develop Components, non-visual elements that can have a designer. Built-in components include the BackgroundWorker, Timer, and a lot of ADO .NET objects. It's a nice way to provide easy configuration of a complicated object, and it it enables designer-assisted data binding. I've been looki...
stackexchange/codereview
What's the difference between "Layers" and "Tiers"?
stackexchange/codereview
I am adding a webpart to the webpart gallery as part of a feature within a solution. When the webpart is added to the gallery, the webparts Description field is being overwritten by an empty string. I have added a description to everywhere I can think of, including: The webpart itself. myWebpart.webpart <property nam...
stackexchange/codereview
I need to simulate a low bandwidth, high latency connection to a server in order to emulate the conditions of a VPN at a remote site. The bandwidth and latency should be tweakable so I can discover the best combination in order to run our software package.
stackexchange/codereview
My Visual Studio 2005 is storing the info about which projects and solutions go with which source control repositories in the .sln and .csproj files. Is it possible to make it store that binding information in some external file instead? The reason I wish the info were stored outside the solution/project files is to fa...
stackexchange/codereview
What are some suggestions for easy to use C++ compilers for a beginner? Free or open-source ones would be preferred.
stackexchange/codereview
I have exceptions created for every condition that my application does not expect. UserNameNotValidException, PasswordNotCorrectException etc. However I was told I should not create exceptions for those conditions. In my UML those ARE exceptions to the main flow, so why should it not be an exception? Any guidance or b...
stackexchange/codereview
We have various php projects developed on windows (xampp) that need to be deployed to a mix of linux/windows servers. We've used capistrano in the past to deploy from windows to the linux servers, but recent changes in architecture and windows servers left the old config not working. The recipe works fine for the linu...
stackexchange/codereview
Does anyone have a good complex object marshalling example using the kSOAP package?
stackexchange/codereview
What are some really useful but esoteric language features in Perl that you've actually been able to employ to do useful work? Guidelines: Try to limit answers to the Perl core and not CPAN Please give an example and a short description Hidden Features also found in other languages' Hidden Features: (These are all f...
stackexchange/codereview
I'm working on the K&R book. I've read farther ahead than I've done exercises, mostly for lack of time. I'm catching up, and have done almost all the exercises from chapter 1, which is the tutorial. My issue was exercise 1-18. The exercise is to: Write a program to remove trailing blanks and tabs from line of input...
stackexchange/codereview
I would like to subscribe to the ItemCommand event of a Reorderlist I have on my page. The front end looks like this... <cc1:ReorderList id="ReorderList1" runat="server" CssClass="Sortables" Width="400" OnItemReorder="ReorderList1_ItemReorder" OnItemCommand="ReorderList1_ItemCommand"> ... <asp:ImageButton ID="btnDele...
stackexchange/codereview
Does Server Core 2008 support asp.net? I see references online saying that it isn't supported, but they are all old references from CTPs.
stackexchange/codereview
Each time a python file is imported that contains a large quantity of static regular expressions, cpu cycles are spent compiling the strings into their representative state machines in memory. a = re.compile("a.*b") b = re.compile("c.*d") ... Question: Is it possible to store these regular expressions in a cache on di...
stackexchange/codereview
I have a sample held in a buffer from DirectX. It's a sample of a note played and captured from an instrument. How do I analyse the frequency of the sample (like a guitar tuner does)? I believe FFTs are involved, but I have no pointers to HOWTOs.
stackexchange/codereview
If you have an API, and you are a UK-based developer with a highly international audience, should your API be setColour() or setColor() (To take one word as a simple example.) UK-based engineers are often quite defensive about their 'correct' spellings but it could be argued that US spelling is more 'standard' in th...
stackexchange/codereview
I have a field on a table in MS Access, tblMyTable.SomeID, and I want to set the default value as a user preference in tblUserPref.DefaultSomeID. It doesn't appear that I can set the default value to use a query in the table definition of tblMyTable. I have a form where records are entered into tblMyTable. I've trie...
stackexchange/codereview
I need some software to explore and modify some SQLite databases. Does anything similar to SQL Server Management Studio or MySQLAdmin exist for it?
stackexchange/codereview
My code needs to run all networking routines in a separate NSThread. I have got a library, which I pass a callback routine for communication: my thread code library my callback (networking) library my thread code My callback routine must POST some data to an HTTP server (NSURLConnection), wait for the ...
stackexchange/codereview
The question should be interpreted from a general point of view and not targeted solely at web apps or desktop apps. I have been looking around to find a simple and easy way of creating interactive prototypes for web applications. I'd like to use a technique that allows simple UI creation and especially UI recreation a...
stackexchange/codereview
This is sort of SQL newbie question, I think, but here goes. I have a SQL Query (SQL Server 2005) that I've put together based on an example user-defined function: SELECT CASEID, GetNoteText(CASEID) FROM ( SELECT CASEID FROM ATTACHMENTS GROUP BY CASEID ) i GO the U...
stackexchange/codereview
Problem: Given a list of strings, find the substring which, if subtracted from the beginning of all strings where it matches and replaced by an escape byte, gives the shortest total length. Example: "foo", "fool", "bar" The result is: "foo" as the base string with the strings "\0", "\0l", "bar" and a total length of 9 ...
stackexchange/codereview
I'm using a medical records system built on an Oracle database. Our vendor just told us that we need to shut down Oracle's Enterprise Manager service when we're not using it, because it uses too much of the system's resources. I know I can get actual numbers by checking Sysinternals Process Explorer, but I was hoping t...
stackexchange/codereview
What is the benefit of using the servletContext as opposed the request in order to obtain a requestDispatcher? servletContext.getRequestDispatcher(dispatchPath) and using argRequest.getRequestDispatcher(dispatchPath)
stackexchange/codereview
In a C# Web app, VS 2005 (I am avoiding 2008 because I find the IDE to be hard to deal with), I am getting into a layout stew. I am moving from absolute positioning toward CSS relative positioning. I'd like to divide the screen into four blocks: top (header band), middle left (a stacked menu), middle right (content - h...
stackexchange/codereview
Imagine this sample java class: class A { void addListener(Listener obj); void removeListener(Listener obj); } class B { private A a; B() { a = new A(); a.addListener(new Listener() { void listen() {} } } Do I need to add a finalize method to B to call a.removeList...
stackexchange/codereview
We are trying to integrate tests in our daily builds using TestComplete, so far we have a machine dedicated for testing and our build script copies to this machine everything TestComplete needs for its tests (Application, Database, Test script project and source files, etc). Basically we can open the TestComplete proje...
stackexchange/codereview
This question is a follow up on one of my other questions, Can I legally Incorporating GPL & LGPL, open-sourced software in a proprietary, closed-source project? Many of the conditions of the LGPL license are based on the notion of distribution. My company does business as a consultant. We are contracted to create soft...
stackexchange/codereview
I am new to asp and have a deadline in the next few days. i receive the following xml from within a webservice response. print("<?xml version="1.0" encoding="UTF-8"?> <user_data> <execution_status>0</execution_status> <row_count>1</row_count> <txn_id>stuetd678</txn_id> <person_info> <attribute name="firstname">john...
stackexchange/codereview
Do you guys have any resources on creating a Sharepoint webpart that uses the AjaxToolkit controls? I need to create a webpart that uses the Accordion control and I can't find any complete tutorial or walkthrough. I prefer a tutorial/article that doesn't use SmartPart. TIA!
stackexchange/codereview
Looking for a good rss/feed reader for windows or if there are any good cross platforms one i would be really amazed, or good web services (dont like the google one). I want something simplistic and minimalistic.
stackexchange/codereview
I'm doing a website for a family member's wedding. A feature they requested was a photo section where all the guests could go after the wedding and upload their snaps. I said this was a stellar idea and I went off to build it. Well there's just the one problem: logistics. Upload speeds are slow and photos from modern c...
stackexchange/codereview
I am looking to replace the life cycle tools currently used by my development teams. Tools that I'm looking for: Version Control Defect/Issue Tracking Requirements Tracking Test Case Management (potentially) Project Management: Project Status, hours entry I have a new beefy server (Windows 2008 Server) to run all too...
stackexchange/codereview
Does anyone have a decent algorithm for calculating axis minima and maxima? When creating a chart for a given set of data items, I'd like to be able to give the algorithm: the maximum (y) value in the set the minimum (y) value in the set the number of tick marks to appear on the axis an optional value that must a...
stackexchange/codereview
I have a Samurize config that shows a CPU usage graph similar to Task manager. How do I also display the name of the process with the current highest CPU usage percentage? I would like this to be updated, at most, once per second. Samurize can call a command line tool and display it's output on screen, so this cou...
stackexchange/codereview
Is it possible to deploy a native Delphi application with ClickOnce without a stub C# exe that would be used to launch the Delphi application? The same question applies to VB6, C++ and other native Windows applications.
stackexchange/codereview
Has anyone implemented Lightbox style background dimming on a modal dialog box in a MFC/non .net app. I think the procedure would have to be something like: steps: Get dialog parent HWND or CWnd* Get the rect of the parent window and draw an overlay with a translucency over that window allow the dialog to do it...
stackexchange/codereview
I know it happens sometime before Load, but during what event exactly?
stackexchange/codereview
What are the pros/cons of using black-box reuse over white-box reuse?
stackexchange/codereview
Is there a way to Minimize an external application that I don't have control over from with-in my Delphi application? for example notepad.exe, except the application I want to minimize will only ever have one instance.
stackexchange/codereview
I have been asked to develop some usercontrols in ASP.NET that will at a later point be pulled into a SharePoint site as web parts. I am new to SharePoint and will not have access to a SharePoint server during the time I need to prototype these parts. Does anyone know of any reasons that this approach will not work? I...
stackexchange/codereview
I'm looking for a code snippet that can delete all emails and text messages on a Windows Mobile device. Preferably the code would delete items in the Sent and Draft folders as well as the Inbox. My platform is Windows Mobile (5.0 SDK) and .net 2.0 compact framework (C# / VB.NET)
stackexchange/codereview
I'm having a test hang in our rails app can't figure out which one (since it hangs and doesn't get to the failure report). I found this blog post http://bmorearty.wordpress.com/2008/06/18/find-tests-more-easily-in-your-testlog/ which adds a setup hook to print the test name but when I try to do the same thing it gives...
stackexchange/codereview
This question exists because it has historical significance, but it is not considered a good, on-topic question for this site, so please do not use it as evidence that you can ask similar questions here. More info: https://stackoverflow.com/faq There are always features that would be useful in fringe scen...
stackexchange/codereview
I am working on a large C++ project in Visual Studio 2008, and there are a lot of files with unnecessary #include directives. Sometimes the #includes are just artifacts and everything will compile fine with them removed, and in other cases classes could be forward declared and the #include could be moved to the .cpp fi...
stackexchange/codereview
I know how to test an object to see if it is of a type, using the IS keyword e.g. if (foo is bar) { //do something here } but how do you test for it not being "bar"?, I can't seem to find a keyword that works with IS to test for a negative result. BTW - I have a horrible feeling this is soooo obvious, so apologies...
stackexchange/codereview
I am writing a simple Python web application that consists of several pages of business data formatted for the iPhone. I'm comfortable programming Python, but I'm not very familiar with Python "idiom," especially regarding classes and objects. Python's object oriented design differs somewhat from other languages I've w...
stackexchange/codereview
I would like Visual Studio to break when a handled exception happens (i.e. I don't just want to see a "First chance" message, I want to debug the actual exception). e.g. I want the debugger to break at the exception: try { System.IO.File.Delete(someFilename); } catch (Exception) { //we really don't care at runtim...
stackexchange/codereview
Quite often in ANSI C code I can see parenthesis sorrounding a single return value. Like this:- int foo(int x) { if (x) return (-1); else return (0); } Why use () around the return value in those cases? Any ideas? I can see no reason for that.
stackexchange/codereview
For those of you that like puzzles: I had this problem recently and am sure there must be a nicer solution. Consider : an ObservableCollection of Foo objects called foos. Foo contains a string ID field I have no control over foos foos will be changing Then: I have another collection called sortLikeThis sortListThis ...
stackexchange/codereview
When running performance tests file system cache hit or miss can significantly influence test results. Therefore generally before running such tests used files are evicted from system cache. How to do that on Linux? Clarification: If possible, the solution should not require root privileges.
stackexchange/codereview
I'm trying to implement some drag and drop functionality for a material system being developed at my work. Part of this system includes a 'Material Library' which acts as a repository, divided into groups, of saved materials on the user's hard drive. As part of some UI polish, I was hoping to implement a 'highlight' ty...
stackexchange/codereview
Can ZK easily be integrated in a struts web application?
stackexchange/codereview
I am looking for a well tested class for manipulating URLs in .NET. Specifically I want to be able to add/update querystring values given a url. I have found various classes on the web that do this but none seem really robust and well tested. I also cannot find anything in the .NET framework; the Uri class doesn't le...
stackexchange/codereview
How can I get LWP to verify that the certificate of the server I'm connecting to is signed by a trusted authority and issued to the correct host? As far as I can tell, it doesn't even check that the certificate claims to be for the hostname I'm connecting to. That seems like a major security hole (especially with the...
stackexchange/codereview
The basic problem is like this: A subscriber has successfully replicated a row from the publisher, using transactional replication. Now, how do we keep track the time of this row being last successfully replicated? A friend has suggested the following solution, which he used for his SQL Server 2000: 1) Add a datetime...
stackexchange/codereview
I am trying to create an email two column flexible layout, which works in outlook 07, i have created a successful version in outlook 03, hotmail, gmail, yahoo and aol, in both IE and Mozilla Firefox, however when testing in outlook 07 it strips out my float left css. What I would like is a layout that has a photo on t...
stackexchange/codereview
The subject says it all, almost. How do I automatically fix jsp pages so that relative URLs are mapped to the context path instead of the server root? That is, given for example <link rel="stylesheet" type="text/css" href="/css/style.css" /> how do I set-up things in a way that maps the css to my-server/my-context/css...
stackexchange/codereview
I am trying to add an unhandled exception handler in .net (c#) that should be as helpfull for the 'user' as possible. The end users are mostly programers so they just need a hint of what object are they manipulating wrong. I'm developing a windows similar to the windows XP error report when an application crashes but t...
stackexchange/codereview
This might be an interesting question. I need to test that if I can successfully upload and fetch the PDF file. This works for the text based files but I just wanted to check for PDF. For this unit test to run I need a PDF file. There are couple of options. I can create a dummy PDF file and store it some folder and rea...
stackexchange/codereview
I have a large collection of retro games consoles and computers, I want to create some sort of catalogue to keep track of them using Drupal. I could do it as a series of pages in Drupal, but would rather have some sort of more structured method. It'd be great if I could somehow define a record consisting of certain fie...
stackexchange/codereview
What is the difference between const and readonly in C#? When would you use one over the other?
stackexchange/codereview
I would like to use my laptop as a web development (PHP, Python, etc.) machine, but I'm hesitant to do this unless I can ensure that it can not be accessed by the outside world. I'm guessing that something more than a firewall is necessary, such as configurations to the Apache configuration files, but I'm not sure what...
stackexchange/codereview
I learned some time ago about Decision Trees and Decision tables. I feel that Decision Tables can help with conditional If-Then-Else statements. In particular, I feel that Decision Tables have no side-effects, for example, if you didn't notice that you need one more "else if" statement. But I am not sure how I can impl...
stackexchange/codereview
This certainly presupposes that unit testing is a good thing. Our projects have some level of unit testing, but it's inconsistent at best. What are the most convincing ways that you have used or have had used with you to convince everyone that formalized unit testing is a good thing and that making it required is reall...
stackexchange/codereview
I would like to confirm that the following analysis is correct: I am building a web app in RoR. I have a data structure for my postgres db designed (around 70 tables; this design may need changes and additions during development to reflect Rails ways of doing things. EG, I designed some user and role tables - but if it...
stackexchange/codereview
How do you return 1 value per row of the max of several columns: TableName [Number, Date1, Date2, Date3, Cost] I need to return something like this: [Number, Most_Recent_Date, Cost] Query?
stackexchange/codereview
Recently I got IE7 crashed on Vista on jar loading (presumably) with the following error: Problem signature: Problem Event Name: BEX Application Name: iexplore.exe Application Version: 7.0.6001.18000 Application Timestamp: 47918f11 Fault Module Name: ntdll.dll Fault Module ...
stackexchange/codereview
In the process of updating a web app from ASP to ASP.NET, I want to insert one of the new files into the old app to test something - is this an offence against reason?
stackexchange/codereview
I created a couple of tables procedurally via C# named something like [MyTableOneCustom0] and [MyTableTwoCustom0]. When I try to return all of the values from these tables via "Open Table" in MSSQL Server Management Studio, I receive the following error: Error Source: Microsoft.VisualStudio.DataTools Error Message: Ex...
stackexchange/codereview
Which scenarios, areas of an application/system, etc. are best suited for 'classic' state based testing versus using mock objects?
stackexchange/codereview
We try to use Java and UTF-8 on Windows. The application writes logs on the console, and we would like to use UTF-8 for the logs as our application has internationalized logs. It is possible to configure the JVM so it generates UTF-8, using -Dfile.encoding=UTF-8 as arguments to the JVM. It works fine, but the output on...
stackexchange/codereview
I am using XmlSpy to analyze an xml file, and I want to get a quick count of the number of nodes that match a given xpath. I know how to enter the XPathand get the list of nodes, but I am really just interested in the count. Is it possible to get this? I'm using XmlSpy Professional Edition version 2007 sp2, if it mat...
stackexchange/codereview
I see a bunch of lines in the .log files in the postgres pg_log directory that say something like: ERROR: prepared statement "pdo_pgsql_stmt_09e097f4" does not exist What are prepared statements, and what kinds of things can cause these error messages to be displayed?
stackexchange/codereview
I've started to "play around" with PowerShell and am trying to get it to "behave". One of the things I'd like to do is to customize the PROMPT to be "similar" to what "$M$P$_$+$G" do on MS-Dos: A quick rundown of what these do: Character| Description $m The remote name associated with the current drive letter or the ...
stackexchange/codereview
How do I use groovy to search+replace in XML? I need something as short/easy as possible, since I'll be giving this code to the testers for their SoapUI scripting. More specifically, how do I turn: <root><data></data></root> into: <root><data>value</data></root>
stackexchange/codereview
I am involved in the process of porting a system containing several hundreds of ksh scripts from AIX, Solaris and HPUX to Linux. I have come across the following difference in the way ksh behaves on the two systems: #!/bin/ksh flag=false echo "a\nb" | while read x do flag=true done echo "flag = ${flag}" exit 0 On ...
stackexchange/codereview
I've got a situation where I need to use LINQ's ExecuteCommand method to run an insert. Something like (simplified for purposes of this question): object[] oParams = { Guid.NewGuid(), rec.WebMethodID }; TransLogDataContext.ExecuteCommand ( "INSERT INTO dbo.Transaction_Log (ID, WebMethodID) VALUES ({0}, {1})", oParams)...
stackexchange/codereview
I need to convert a value which is in a DateTime variable into a varchar variable formatted as yyyy-mm-dd format (without time part). How do I do that?
stackexchange/codereview
Is it possible to call managed code, specifically IronRuby or IronPython from unamanaged code such as C++ or Delphi? For example, we have an application written in Delphi that is being moved to C#.NET We'd like to provide Ruby or Python scripting in our new application to replace VBSCRIPT. However, we would need to p...
stackexchange/codereview
Multithread algorithms are notably hard to design/debug/prove. Dekker's algorithm is a prime example of how hard it can be to design a correct synchronized algorithm. Tanenbaum's Modern operating systems is filled with examples in its IPC section. Does anyone have a good reference (books, articles) for this? Thanks!
stackexchange/codereview
I know there is a Jackpot API http://jackpot.netbeans.org/docs/org-netbeans-modules-jackpot/overview-summary.html for programmatic access the the rules engine, has anyone had success seperating this from NetBeans itself? So it can operate on any Java source files?
stackexchange/codereview
I was able to implement a thread-safe Dictionary in C# by deriving from IDictionary and defining a private SyncRoot object: public class SafeDictionary<TKey, TValue>: IDictionary<TKey, TValue> { private readonly object syncRoot = new object(); private Dictionary<TKey, TValue> d = new Dictionary<TKey, TValue>();...
stackexchange/codereview
I have got a python script which is creating an ODBC connection. The ODBC connection is generated with a connection string. In this connection string I have to include the username and password for this connection. Is there an easy way to obscure this password in the file (just that nobody can read the password when ...
stackexchange/codereview
Element[] array = {new Element(1), new Element(2), new Element(3)}; How do I convert the above variable of type Element[] into a variable of type ArrayList<Element>? ArrayList<Element> arrayList = ...;
stackexchange/codereview
I'm looking to create a "Countries You've Visited" map - just like the ones you've probably seen on Facebook, TravelAdvisor and whatnot. I've tried different flash kits, but they're not quite as advanced as I'd like them to be. The main problem I've encountered with all the different kits is changing the background col...
stackexchange/codereview
I would like to draw a diagram in HTML. The positioning structure looks like this: <div id='hostDiv'> <div id='backgroundDiv'> ... drawing the background ... </div> <div id='foregroundDiv' style='position: absolute;'> ... drawing the foreground ... </div> </div> The foreground contains a Table element ...
stackexchange/codereview
I'm trying to have two inputs (one textbox, one drop down) to have the same width. You can set the width through css, but for some reason, the select box is always a few pixels smaller. It seems this only happens with the xhtml 1.0 strict doctype Any suggestions/ideas about the reason/work around? Having the following ...
stackexchange/codereview
In low latency trading applications we are very conscious of latency issues. There is some concern that our application may experience increased latency if the server on which it is running changes PowerNow state. Any kernel developers familiar with calling PowerNow changes and how much processor time is used for the ...
stackexchange/codereview
I'm currently convering my ASP.NET v2 application to serialize/deserialize it's objects because I want to shift from inproc session state to stateserver. This is because my host, webhost4life, has a nasty tendency to recycle the worker process frequently thus causing session timeouts. Anyway... the question... I'm tryi...
stackexchange/codereview
Hi i want to write a game with a main game form and lot of other normal forms. What is the best way to manage update-paint cycle in that case? Should the game form paint loop only should be overriden? or should i do an application.do events() in the main method? Please guide me regarding this. i am new to windows forms...
stackexchange/codereview
I am trying to use the import random statement in python, but it doesn't appear to have any methods in it to use. Am I missing something?
stackexchange/codereview
When I ssh into a remote production server I would like the colour scheme of my terminal window to change to something brigh and scary, preferably red, to warn me that I am touching a live scary server. How can I make it automatically detect that I have ssh'ed somewhere, and if that somewhere is on a specific list, ch...
stackexchange/codereview
The company I work for are currently undergoing a site wide renovation and I'm involved in the 'consultation' on what the R&D work spaces are going to be like. There is no scope for individual private offices - so lets not start on that topic. One big requirement is that the office layout can be flexible (i.e. team ar...
stackexchange/codereview
We have a rather large object graph that needs to be serialized and deserialized in a lot of different ways (modes). In some modes we want certain properties to be deserialized and in some we don't. In future modes it might also be possible that there are more options for properties than yes or no. The problem is now h...
stackexchange/codereview