instruction_seed
stringlengths
1
35.8k
_source
stringclasses
1 value
We are in the early design stages of a major rewrite of our product. Right now our customers are mostly businesses. We manage accounts. User names for an account are each on their own namespace but it means that we can't move assets between servers. We want to move to a single namespace. But that brings the problem of ...
stackexchange/codereview
I have windows 2003 terminal servers, multi-core. I'm looking for a way to monitor individual CPU core usage on these servers. It is possible for an end-user to have a run-away process (e.g. Internet Explorer or Outlook). The core for that process may spike to near 100% leaving the other cores 'normal'. Thus, the ...
stackexchange/codereview
I have a NAT configured to run when loading up my favorite Linux distribution in VitualBox. This allows outgoing connections to work successfully. How do I allow incoming connections to this box, like, say, Web traffic? The IP address is 10.0.2.15. A ping request from my main box results in a Timeout.
stackexchange/codereview
Often, I find myself wanting to write a unit test for a portion of code that accesses HTTP resources as part of its normal function. Have you found any good ways to write these kinds of tests?
stackexchange/codereview
I've seen this done in Borland's Turbo C++ environment, but I'm not sure how to go about it for a C# application I'm working on. Are there best practices or gotchas to look out for?
stackexchange/codereview
Our automated build machine needs to archive the version numbers of the OS plus various tools used during each build. (In case we ever need to replicate exactly the same build later on, perhaps when the machine is long dead.) I see the command "msinfo32.exe" can be used to dump a whole load of system version informati...
stackexchange/codereview
I have some code like this in a winforms app I was writing to query a user's mail box Storage Quota. DirectoryEntry mbstore = new DirectoryEntry( @"LDAP://" + strhome, m_serviceaccount, [m_pwd], AuthenticationTypes.Secure); No matter what approach I tried (like SecureString), I am easily abl...
stackexchange/codereview
I'm currently using and enjoying using the Flex MVC framework PureMVC. I have heard some good things about Cairngorm, which is supported by Adobe and has first-to-market momentum. And there is a new player called Mate, which has a good deal of buzz. Has anyone tried two or three of these frameworks and formed an opin...
stackexchange/codereview
I've been handed a table with about 18000 rows. Each record describes the location of one customer. The issue is, that when the person created the table, they did not add a field for "Company Name", only "Location Name," and one company can have many locations. For example, here are some records that describe the same ...
stackexchange/codereview
It seems like anything you can do with bytecode you can do just as easily and much faster in native code. In theory, you could even retain platform and language independence by distributing programs and libraries in bytecode then compiling to native code at installation, rather than JITing it. So in general, when would...
stackexchange/codereview
My strongest lead is that the code who deals with the incoming XMLs is actually receiving an invalid/incomplete file hence failing the DOM parsing. Any suggestions?
stackexchange/codereview
In SQL Server, how do I "floor" a DATETIME to the second/minute/hour/day/year? Let's say that I have a date of 2008-09-17 12:56:53.430, then the output of flooring should be: Year: 2008-01-01 00:00:00.000 Month: 2008-09-01 00:00:00.000 Day: 2008-09-17 00:00:00.000 Hour: 2008-09-17 12:00:00.000 Minute: 2008-09-17 12:5...
stackexchange/codereview
OK -- a bit of an undefined question (is the pattern of plugs in an Eniac plugboard a language ??) but contenders include: Konrad Zuse's PlanKalkül (1940s) - never implemented (generally accepted as the first). Whatever Ada Lovelace (1840s) programmed in (not Ada) -- if she is the first programmer, as everyone says, ...
stackexchange/codereview
The application my team is currently developing has a DLL that is used to perform all database access. The application can not use a trusted connection because the database is behind a firewall and the domain server is not. So it appears that the connection string needs to have a DB username and password. The DLL cu...
stackexchange/codereview
I'm wondering about instances when it makes sent to use #define and #if statements. I've known about it for a while, but never incorporated it into my way of coding. How exactly does this affect the compilation? Is #define the only thing that determines if the code is included when compiled? If I have #define DEBUGme ...
stackexchange/codereview
Is it possible to use an UnhandledException Handler in a Windows Service? Normally I would use a custom built Exception Handling Component that does logging, phone home, etc. This component adds a handler to System.AppDomain.CurrentDomain.UnhandledException but as far as I can tell this doesn’t achieve anything win a W...
stackexchange/codereview
Can somebody suggest a good free tool for analyzing .Net memory dumps other than Adplus/windbg/sos ?
stackexchange/codereview
It's something that's bugged me in every language I've used, I have an if statement but the conditional part has so many checks that I have to split it over multiple lines, use a nested if statement or just accept that it's ugly and move on with my life. Are there any other methods that you've found that might be of us...
stackexchange/codereview
I'm using subclipse in Flex Builder 3, and recently received this error when trying to commit: svn: Checksum mismatch for '/Users/redacted/Documents/Flex Builder 3/path/to/my/file.mxml'; expected: 'f8cb275de72776657406154dd3c10348', actual: 'null' I worked around it by: Committing all the other changed files, omitting...
stackexchange/codereview
Is there an IDE that I can load on a Blackberry, E71, or an iPhone?
stackexchange/codereview
Basically I'm going to go a bit broad here and ask a few questions to get a bit of a picture of how people are handling UI these days. Lately I've found it pretty easy to do some fancy things with UI design and with WPF specifically we're finding new ways to do layouts that are better looking and more functional for th...
stackexchange/codereview
Can anyone advise on how to crop an image, let's say jpeg, without using any .NET framework constructs, just raw bytes? Since this is the only* way in Silverlight... Or point to a library? I'm not concerned with rendering i'm wanting to manipulate a jpg before uploading. *There are no GDI+(System.Drawing) or WPF(Syste...
stackexchange/codereview
I'm trying to find out the 'correct' windows API for finding out the localized name of 'special' folders, specifically the Recycle Bin. I want to be able to prompt the user with a suitably localized dialog box asking them if they want to send files to the recycle bin or delete them directly. I've found lots on the inte...
stackexchange/codereview
I'm setting up a web application with a FreeBSD PostgreSQL back-end. I'm looking for some database performance optimization tool/technique.
stackexchange/codereview
What I'm talking about here are nested classes. Essentially, I have two classes that I'm modeling. A DownloadManager class and a DownloadThread class. The obvious OOP concept here is composition. However, composition doesn't necessarily mean nesting, right? I have code that looks something like this: class DownloadThre...
stackexchange/codereview
Running a rails site right now using SQLite3. About once every 500 requests or so, I get a ActiveRecord::StatementInvalid (SQLite3::BusyException: database is locked:... What's the way to fix this that would be minimally invasive to my code? I'm using SQLLite at the moment because you can store the DB in source control...
stackexchange/codereview
Where a new system concept or new technology is used, one has to build a system to throw away, for even the best planning is not so omniscient as to get it right the first time. Hence plan to throw one away; you will, anyhow. -- Fred Brooks, The Mythical Man-Month [Emphasis mine] Build one to throw away. That's ...
stackexchange/codereview
I have a list with 2 text fields, and a choice field. How do I use the Lists.asmx web service to insert a new item? I can make a web reference to the lists.asmx service, so you can assume that this is known. I would like a complete example including code and the XML for the CAML query. Ideally the sample would use C#.
stackexchange/codereview
I am a student studying software development, and I feel programming, in general, is too broad of a subject to try to know everything. To be proficient, you have to decide which areas to focus your learning and understanding. Certain skill sets synergize with each other, like data-driven web development and SQL experie...
stackexchange/codereview
What's the easiest way to do an "instring" type function with a regex? For example, how could I reject a whole string because of the presence of a single character such as :? For example: this - okay there:is - not okay because of : More practically, how can I match the following string: //foo/bar/baz[1]/ns:foo2/@a...
stackexchange/codereview
I have a very simple mapping function called "BuildEntity" that does the usual boring "left/right" coding required to dump my reader data into my domain object. (shown below) My question is this - If I don't bring back every column in this mapping as is, I get the "System.IndexOutOfRangeException" exception and wanted ...
stackexchange/codereview
What libraries exist for other programming languages to provide an Erlang-style concurrency model (processes, mailboxes, pattern-matching receive, etc.)? Note: I am specifically interested in things that are intended to be similar to Erlang, not just any threading or queueing library.
stackexchange/codereview
I am having problems getting text within a table to appear centered in IE. In Firefox 2, 3 and Safari everything work fine, but for some reason, the text doesn't appear centered in IE 6 or 7. I'm using: h2 { font: 300 12px "Helvetica", serif; text-align: center; text-transform: uppercase; } I've also tried a...
stackexchange/codereview
I have a large application that uses EJB 2.x entity beans (BMP). This is well-known to be a horrible persistence strategy (I can elaborate if necessary). I'd like to start migrating this application to use a much more expressive, transparent, and non-invasive persistence strategy, and given my company's previous experi...
stackexchange/codereview
This is re-posted from something I posted on the DDD Yahoo! group. All things being equal, do you write phone.dial(phoneNumber) or phoneNumber.dialOn(phone)? Keep in mind possible future requirements (account numbers in addition to phone numbers, calculators in addition to phones). The choice tends to illustrate how th...
stackexchange/codereview
I have a problem with some zombie-like processes on a certain server that need to be killed every now and then. How can I best identify the ones that have run for longer than an hour or so?
stackexchange/codereview
There is a netsh and a route command on Windows. From their help text it looks like both can be used to configure static routes. When should you use one and not the other? Is IPv6 a distinguishing factor here?
stackexchange/codereview
What would be the most efficient way to compare two double or two float values? Simply doing this is not correct: bool CompareDoubles1 (double A, double B) { return A == B; } But something like: bool CompareDoubles2 (double A, double B) { diff = A - B; return (diff < EPSILON) && (-diff < EPSILON); } Seems ...
stackexchange/codereview
Many applications have grids that display data from a database table one page at a time. Many of them also let the user pick the number of records per page, sort by any column, and navigate back and forth through the results. What's a good algorithm to implement this pattern without bringing the entire table to the cli...
stackexchange/codereview
I'm trying to customize some TFS work items via the VS2008 xml editor, but every time I open a work item xml file it jumps to the graphical designer. All that gives me is a "View XML" button that doesn't let you edit the xml directly.
stackexchange/codereview
What kinds of hook scripts are people using for Subversion? Just general ideas but code would be great too!
stackexchange/codereview
I am wondering what experiences people are having using the ASP.NET MVC Framework? In particular I am looking for feedback on the type of experience folks are having using the framework. What are people using for their view engine? What about the db layer, NHibernate, LINQ to SQL or something else? I know stackoverfl...
stackexchange/codereview
I'm working with Webby and am looking for some clarification. Can I define attributes like title or author in my layout?
stackexchange/codereview
Has anyone used Lucene.NET rather than using the full text search that comes with sql server? If so I would be interested on how you implemented it. Did you for example write a windows service that queried the database every hour then saved the results to the lucene.net index?
stackexchange/codereview
I've created a model for executing worker tasks in a server application using a thread pool associated with an IO completion port such as shown in the posts below: http://weblogs.asp.net/kennykerr/archive/2008/01/03/parallel-programming-with-c-part-4-i-o-completion-ports.aspx http://blogs.msdn.com/larryosterman/archive...
stackexchange/codereview
On Mac OS X 10.5 I downloaded the latest version of Apache 2.2.9. After the usual configure, make, make install dance I had a build of apache without mod_rewrite. This wasn't statically linked and the module was not built in the /modules folder either. I had to do the following to build Apache and mod_rewrite: ./config...
stackexchange/codereview
This is a somewhat low-level question. In x86 assembly there are two SSE instructions: MOVDQA xmmi, m128 and MOVNTDQA xmmi, m128 The IA-32 Software Developer's Manual says that the NT in MOVNTDQA stands for Non-Temporal, and that otherwise it's the same as MOVDQA. My question is, what does Non-Temporal mean?
stackexchange/codereview
I'm looking for a .NET regular expression extract all the URLs from a webpage but haven't found one to be comprehensive enough to cover all the different ways you can specify a link. And a side question: Is there one regex to rule them all? Or am I better off using a series of less complicated regular expressions and ...
stackexchange/codereview
I have a table which is full of arbitrarily formatted phone numbers, like this 027 123 5644 021 393-5593 (07) 123 456 042123456 I need to search for a phone number in a similarly arbitrary format ( e.g. 07123456 should find the entry (07) 123 456 The way I'd do this in a normal programming language is to strip all the...
stackexchange/codereview
When you subscribe to an event on an object from within a form, you are essentially handing over control of your callback method to the event source. You have no idea whether that event source will choose to trigger the event on a different thread. The problem is that when the callback is invoked, you cannot assume tha...
stackexchange/codereview
I am using Lotus Notes as my email client, and how to change the defailt email delete date to something new so my older emails don't get deleted after pre-defined date?
stackexchange/codereview
I need to take a Word document that is a template of sorts...collect user input to populate specific fields in that template..then generate a PDF file that includes the completed template as well as a few other document types. Does anyone have a good suggestion on a component to achieve this? Preferably one that does n...
stackexchange/codereview
I've been using VMWare for a while and am very happy with it, but I would like to compare it with VirtualBox. Apparently the disk images are compatible, and I have successfully booted my Fedora based VM created by VMWare in VirtualBox... but the network is completely unavailable. How do you port a virtual machine fro...
stackexchange/codereview
I would like to parse a string such as p1=6&p2=7&p3=8 into a NameValueCollection. What is the most elegant way of doing this when you don't have access to the Page.Request object?
stackexchange/codereview
Has anyone had any experience in building a 'real world' application with the Smart Client Software Factory, from Microsofts Patterns and Practices group? I'm looking for advice on how difficult it was to master, whether it decreased your time to market and any other general pitfalls.
stackexchange/codereview
I've got a website that I've just uploaded onto the interwebs, and it's displaying differently using Firefox 3.0.1 on Ubuntu and WinXP. Two things I've noticed on Ubuntu: The favicon is missing The background color isn't displaying (it's set in the stylesheet) What have I done wrong? The CSS file is being fetched u...
stackexchange/codereview
Given a string like this: a,"string, with",various,"values, and some",quoted What is a good algorithm to split this based on commas while ignoring the commas inside the quoted sections? The output should be an array: [ "a", "string, with", "various", "values, and some", "quoted" ]
stackexchange/codereview
In a .net system I'm building, there is a need for automated e-mail notifications. These should be editable by an admin. What's the easiest way to do this? SQL table and WYSIWIG for editing? The queue is a great idea. I've been throwing around that type of process for awhile with my old company.
stackexchange/codereview
Is anyone successfully using the latest 64-bit Ganymede release of Eclipse on Windows XP or Vista 64-bit? Currently I run the normal Eclipse 3.4 distribution on a 32bit JDK and launch & compile my apps with a 64bit JDK. Our previous experience has been that the 64bit Eclipse distro is unstable for us, so I'm curious if...
stackexchange/codereview
Is the documentation for Rich Edit Controls really as bad (wrong?) as it seems to be? Right now I'm manually calling LoadLibrary("riched20.dll") in order to get a Rich Edit Control to show up. The documentation for Rich Edit poorly demonstrates this in the first code sample for using Rich Edit controls. It talks abou...
stackexchange/codereview
We have a requirement to increase the functionality of a grid we are using to edit on our webapp, and our manager keeps citing Excel as the perfect example for a data grid :/ He still doesn't really get that a Spreadsheet like control doesn't exist out of the box, but I thought I'd do a bit of searching nonetheless. I'...
stackexchange/codereview
When I call socket.getsockname() on a socket object, it returns a tuple of my machine's internal IP and the port. However, I would like to retrieve my external IP. What's the cheapest, most efficient manner of doing this?
stackexchange/codereview
Do you know managed tools for manipulating PowerPoint files? The tool should be 100% managed code and offer the option to handle .ppt and .pptx files.
stackexchange/codereview
How can I go about storing a vb.net user defined object in a sql database. I am not trying to replicate the properties with columns. I mean something along the lines of converting or encoding my object to a byte array and then storing that in a field in the db. Like when you store an instance of an object in session, b...
stackexchange/codereview
What is currently the best way to get a favicon to display in all browsers that currently support it? Please include: Which image formats are supported by which browsers. Which lines are needed in what places for the various browsers.
stackexchange/codereview
Modern database systems today come with loads of features. And you would agree with me that to learn one database you must unlearn the concepts you learned in another database. For example, each database would implement locking differently than others. So to carry the concepts of one database to another would be a reci...
stackexchange/codereview
Is there a way to enable code outlining for Classic ASP in Visual Studio 2005? It outlines the HTML code pretty well and I get a big outline between <% and %>, but nothing for the code itself.
stackexchange/codereview
I've only been using VS 2008 Team Foundation for a few weeks. Over the last few days, I've noticed that sometimes one of my objects/controls on my page just disappears from intellisense. The project builds perfectly and the objects are still in the HTML, but I still can't find the object. Any one else notice this? Edi...
stackexchange/codereview
I was wondering if anyone tried migrating between TS and SVN/CC. What I mean by migrating is importing and exporting the repository between source control systems without losing the history. How good are the tools to migrate to and from VSTS? I am also interested in knowing any opinion regarding using Team System fro...
stackexchange/codereview
Can anybody give an example of exporting a ChartFX7 chart to SVG? I've tried: ByteArrayOutputStream baos = new ByteArrayOutputStream(); m_chart.setOutputWriter(new SvgWriter()); m_chart.exportChart(FileFormat.EXTERNAL, baos); and : ByteArrayOutputStream baos = new ByteArrayOutputStream(); ...
stackexchange/codereview
If I remove all the ' characters from a SQL query, is there some other way to do a SQL injection attack on the database? How can it be done? Can anyone give me examples?
stackexchange/codereview
Is there any performance difference between tuples and lists when it comes to instantiation and retrieval of elements?
stackexchange/codereview
I need a Regex that will match a java method declaration. I have come up with one that will match a method declaration, but it requires the opening bracket of the method to be on the same line as the declaration. If you have any suggestions to improve my regex or simply have a better one then please submit an answer. H...
stackexchange/codereview
Why is Array.Length an int, and not a uint. This bothers me (just a bit) because a length value can never be negative. This also forced me to use an int for a length-property on my own class, because when you specify an int-value, this needs to be cast explicitly... So the ultimate question is: is there any use for a...
stackexchange/codereview
i have created a workflow activity that do give the item creater of a specific list full control on the item and set everyone else to read only access (permission) someone told me that doing it this way (if i have a lot of users) the performance will go down dramatically is that correct ?!! if yes what is the best so...
stackexchange/codereview
Why are unsigned integers not CLS compliant? I am starting to think the type specification is just for performance and not for correctness.
stackexchange/codereview
I have the following html.erb code that I'm looking to move to Haml: <span class="<%= item.dashboardstatus.cssclass %>" ><%= item.dashboardstatus.status %></span> What it does is associate the CSS class of the currently assigned status to the span. How is this done in Haml? I'm sure I'm missing something really simple...
stackexchange/codereview
I've got a table that is supposed to track days and costs for shipping product from one vendor to another. We (brilliantly :p) stored both the shipping vendors (FedEx, UPS) with the product handling vendors (Think... Dunder Mifflin) in a "VENDOR" table. So, I have three columns in my SHIPPING_DETAILS table that all ref...
stackexchange/codereview
As everyone knows, the Visual C++ runtime marks uninitialized or just freed memory blocks with special non-zero markers. Is there any way to disable this behavior entirely without manually setting all uninitialized memory to zeros? It's causing havoc with my valid not null checks, since 0xFEEEFEEE != 0. Hrm, perhaps I ...
stackexchange/codereview
I have a SQL Server 2005 machine with a JDE DB2 set up as a linked server. For some reason the performance of any queries from this box to the db2 box are horrible. For example. The following takes 7 mins to run from Management Studio SELECT * FROM F42119 WHERE SDUPMJ >= 107256 Whereas it takes seconds ...
stackexchange/codereview
Which is better to use for timing in Python? time.clock() or time.time()? Which one provides more accuracy? for example: start = time.clock() ... do something elapsed = (time.clock() - start) vs. start = time.time() ... do something elapsed = (time.time() - start)
stackexchange/codereview
This link describes an exploit into my app using fckEditor: http://knitinr.blogspot.com/2008/07/script-exploit-via-fckeditor.html How do I make my app secure while still using fckEditor? Is it an fckEditor configuration? Is it some processing I'm supposed to do server-side after I grab the text from fckEditor? It's...
stackexchange/codereview
I talked to a few friends who say that Drupal is amazing, and it is a way better than Joomla. What are the major differences/advantages?
stackexchange/codereview
When attempting to open a project from source control on a newly formatted pc, I receive an "unable to get the project file from the web server" after getting the sln file from VSS. If I attempt to open the sln file from explorer, I also receive the same error. Any pointers or ideas? Thanks!
stackexchange/codereview
I am trying to inherit from my generated datacontext in LinqToSQL - something like this public class myContext : dbDataContext { public System.Data.Linq.Table<User>() Users { return (from x in base.Users() where x.DeletedOn.HasValue == false select x); } } But my Linq statement returns IQueryable which cannot cas...
stackexchange/codereview
I have a series of PDFs named sequentially like so: 01_foo.pdf 02_bar.pdf 03_baz.pdf etc. Using Ruby, is it possible to combine these into one big PDF while keeping them in sequence? I don't mind installing any necessary gems to do the job. If this isn't possible in Ruby, how about another language? No commercial com...
stackexchange/codereview
Does Java impose any extra restrictions of its own. Windows (upto Vista) does not allow names to include \ / < > ? * : I know HOW to validate names (a regular expression). I need to validate filenames entered by users. My application does not need to run on any other platform, though, of course, I would prefer to be...
stackexchange/codereview
How do I ask PowerShell where something is? For instance, "which notepad" and it returns the directory where the notepad.exe is run from according to the current paths.
stackexchange/codereview
When launching a thread or a process in .NET or Java, is there a way to choose which processor or core it is launched on? How does the shared memory model work in such cases?
stackexchange/codereview
You can embed the IPython shell inside of your application so that it launches the shell in the foreground. Is there a way to embed a telnet server in a python app so that you can telnet to a certain port and launch a remote IPython shell? Any tips for redirecting the input/output streams for IPython or how to hook ...
stackexchange/codereview
I want to generate a thumbnail preview of videos in Java. I'm mostly JMF and video manipulation alienated. Is there an easy way to do it? What about codecs? Will I have to deal with it? Any video type is suported? (including Quicktime)
stackexchange/codereview
I'm looking at parsing a delimited string, something on the order of a,b,c But this is a very simple example, and parsing delimited data can get complex; for instance 1,"Your simple algorithm, it fails",True would blow your naiive string.Split implementation to bits. Is there anything I can freely use/steal/copy and p...
stackexchange/codereview
I installed ActiveReports from their site. The version was labeled as .NET 2.0 build 5.2.1013.2 (for Visual Studio 2005 and 2008). I have an ASP.NET project in VS 2008 which has 2.0 as target framework. I added all the tools in the DataDynamics namespace to the toolbox, created a new project, added a new report. When ...
stackexchange/codereview
Does anyone have experiences in providing a custom MvcRouteHandler? In my application I'd like to implement a globalization-pattern like http://mydomain/en/about or http://mydomain/de/about. As for persistance, I'd like to have a cookie read as soon as a request arrives and if there is a language setting in this cooki...
stackexchange/codereview
I've been looking for this information for my commercial desktop product, with no avail. Specifically, what I'm look for, is deployment statistics of the .NET framework for end-users (both granny "I'm just browsing the internet" XP, and high-end users, if possible), and in the commercial/business sector. Edit: Other th...
stackexchange/codereview
Is it possible in C# to have a Struct with a member variable which is a Class type? If so, where does the information get stored, on the Stack, the Heap, or both?
stackexchange/codereview
How do I create class (i.e. static) variables or methods in Python?
stackexchange/codereview
If I pass request fields or cookies with a period/dot in their names, PHP auto-replaces them with underscores. For example, if I put this code at https://example.com/test.php?x.y=a.b: <?php echo $_SERVER['REQUEST_URI']; echo $_GET['x.y']; echo $_GET['x_y']; the output is: /test.php?x.y=a.b a.b Is there any way I can...
stackexchange/codereview
Can someone give an example of a good time to actually use "unsafe" and "fixed" in C# code? I've played with it before, but never actually found a good use for it. Consider this code... fixed (byte* pSrc = src, pDst = dst) { //Code that copies the bytes in a loop } compared to simply using... Array.Copy(source, t...
stackexchange/codereview
Say I've got this table (SQL Server 2005): Id => integer MyField => XML Id MyField 1 < Object>< Type>AAA< /Type>< Value>10< /Value>< /Object>< Object>< Type>BBB< /Type><Value>20< /Value>< /Object> 2 < Object>< Type>AAA< /Type>< Value>15< /Value>< /Object> 3 < Object>< Type>AAA< /Type>< Value>20< /Value><...
stackexchange/codereview