instruction_seed stringlengths 1 35.8k | _source stringclasses 1
value |
|---|---|
I have a Queue<T> object that I have initialised to a capacity of 2, but obviously that is just the capacity and it keeps expanding as I add items. Is there already an object that automatically dequeues an item when the limit is reached, or is the best solution to create my own inherited class?
| stackexchange/codereview |
I'm using Microsoft AjaxControlToolkit for modal popup window.
And on a modal popup window, when a postback occurred, the window was closing. How do I prevent from the closing action of the modal popup?
| stackexchange/codereview |
I want to reference a COM DLL in a .NET project, but I also want to make sure that the interop DLL created will have the correct version (so that patches will know when the DLL must be changed).
If I use TlbImp I can specify the required version with the /asmversion flag but when I add it directly from Visual Studio it... | stackexchange/codereview |
I'm looking for a method, or a code snippet for converting std::string to LPCWSTR
| stackexchange/codereview |
I am looking for good methods of manipulating HTML in PHP. For example, the problem I currently have is dealing with malformed HTML.
I am getting input that looks something like this:
<div>This is some <b>text
As you noticed, the HTML is missing closing tags. I could use regex or an XML Parser to solve this problem. H... | stackexchange/codereview |
What is the difference between Math.Floor() and Math.Truncate() in .NET?
| stackexchange/codereview |
How do you expose a LINQ query as an ASMX web service?
Usually, from the business tier, I can return a typed DataSet or a DataTable which can be serialized for transport over ASMX.
How can I do the same for a LINQ query?
Is there a way to populate a typed DataSet or a DataTable via a LINQ query?
public static MyDataT... | stackexchange/codereview |
How do I store binary data in MySQL?
| stackexchange/codereview |
I have lots of article store in MS SQL server 2005 database in a table called Articles-
"Articles (ArticleID, ArticleTitle, ArticleContent)"
Now I want some SP or SQL query which could return me similar Article against any user's input (very much like "Similar Posts" in blogs OR "Related Questions" in stackoverflow). ... | stackexchange/codereview |
Is there any query which can return me the number of revisions made to the structure of a database table?
Secondly, how can I determine the number of pages (in terms of size) present in mdf or ldf files?
| stackexchange/codereview |
I am having a strange DB2 issue when I run DBUnit tests. My DBUnit tests are highly customized, but I don't think it is the issue. When I run the tests, I get a failure:
SQLCODE: -1084, SQLSTATE: 57019
which translates to
SQL1084C Shared memory segments cannot be allocated.
It sounds like a weird memory issue, ... | stackexchange/codereview |
Having been a PHP developer on LAMP servers for quite a while, is there anything that I will need to take into consideration while preparing an application for IIS on windows.
| stackexchange/codereview |
I'm using Visual C++ 2005 and would like to know the simplest way to connect to a MS SQL Server and execute a query.
I'm looking for something as simple as ADO.NET's SqlCommand class with it's ExecuteNonQuery(), ExecuteScalar() and ExecuteReader().
Sigh offered an answer using CDatabase and ODBC.
Can anybody demonstrat... | stackexchange/codereview |
I am using MSBuild to build my stuff. I want to use CruiseControl.net as by Build Server.
Now, CCNET refers nAnt a lot, but it looks as if ccnet can do most of the stuff nant could do through the project configuration and msbuild. Also, nAnt seems a bit unsupported, with a Beta release that is almost a year old now.
In... | stackexchange/codereview |
Is there any way to check whether a file is locked without using a try/catch block?
Right now, the only way I know of is to just open the file and catch any System.IO.IOException.
| stackexchange/codereview |
I'd like to create a progress bar to indicate the status of an a batch job in Ruby.
I've read some tutorials / libraries on using (n)curses, none of which were particularly helpful in explaining how to create an "animated" progress bar in the terminal or using curses with Ruby.
I'm already aware of using a separate t... | stackexchange/codereview |
I wanted some of those spiffy rounded corners for a web project that I'm currently working on.
I thought I'd try to accomplish it using javascript and not CSS in an effort to keep the requests for image files to a minimum (yes, I know that it's possible to combine all required rounded corner shapes into one image) and ... | stackexchange/codereview |
In Java 5 and above you have the foreach loop, which works magically on anything that implements Iterable:
for (Object o : list) {
doStuff(o);
}
However, Enumerable still does not implement Iterable, meaning that to iterate over an Enumeration you must do the following:
for(; e.hasMoreElements() ;) {
doStuff(e.nex... | stackexchange/codereview |
I've had a lot of good experiences learning about web development on w3schools.com. It's hit or miss, I know, but the PHP and CSS sections specifically have proven very useful for reference.
Anyway, I was wondering if there was a similar site for jQuery. I'm interested in learning, but I need it to be online/searchable... | stackexchange/codereview |
Is it possible to remote-debug a Visual C++ 6.0 application running on a Windows NT machine from a developer workstation running Windows XP?
If so, what is the procedure for doing so?
| stackexchange/codereview |
I have tried both of :
ini_set('include_path', '.:/usr/share/php5:/usr/share/php5/PEAR:lib:app/classes');
and also :
php_value include_path ".:/usr/share/php5:/usr/share/php5/PEAR:lib:app/classes"
in the .htaccess file.
Both methods actually do work but only intermittently. That is, they will work fine for about 37 p... | stackexchange/codereview |
I have a table with more than a millon rows. This table is used to index tiff images. Each image has fields like date, number, etc. I have users that index these images in batches of 500. I need to know if it is better to first insert 500 rows and then perform 500 updates or, when the user finishes indexing, to do the ... | stackexchange/codereview |
We are about to get a canned package in that has been modified to our needs. I'm part of the team setup to prepare tests for it. It has an Oracle back end and I believe it's written in C++ .NET.
My question is what free or open source testing tools would you recommend.
Thanks
Ken
| stackexchange/codereview |
I'm writing a tool to run a series of integration tests on my product. It will install it and then run a bunch of commands against it to make sure its doing what it is supposed to. I'm exploring different options for how to markup the commands for each test case and wondering if folks had insight to share on this. I'm ... | stackexchange/codereview |
When should I include PDB files for a production release? Should I use the Optimize code flag and how would that affect the information I get from an exception?
If there is a noticeable performance benefit I would want to use the optimizations but if not I'd rather have accurate debugging info. What is typically done f... | stackexchange/codereview |
When looking at a SSI printenv dump I see a variable URI_REQUEST.
When reading the Apache mod_include docs I see DOCUMENT_URI which they define as "The (%-decoded) URL path of the document requested by the user."
Anyone know the difference between the two?
TIA.
| stackexchange/codereview |
I'm looking for the fastest way to obtain the value of π, as a personal challenge. More specifically, I'm using ways that don't involve using #define constants like M_PI, or hard-coding the number in.
The program below tests the various ways I know of. The inline assembly version is, in theory, the fastest option, thou... | stackexchange/codereview |
If I have a trigger before the update on a table, how can I throw an error that prevents the update on that table?
| stackexchange/codereview |
In the SSW rules to better SQL Server Database there is an example of a full database maintenance plan: SSW. In the example they run both a Reorganize Index and then a Rebuild Index and then Update Statistics. Is there any point to this? I thought Reorganize Index was a fast but less effective version of Rebuild Index?... | stackexchange/codereview |
I was trying to get my head around XAML and thought that I would try writing some code.
Trying to add a grid with 6 by 6 column definitions then add a text block into one of the grid cells. I don't seem to be able to reference the cell that I want. There is no method on the grid that I can add the text block too. Th... | stackexchange/codereview |
What kinds of considerations are there for migrating an application from NHibernate 1.2 to 2.0? What are breaking changes vs. recommended changes?
Are there mapping issues?
| stackexchange/codereview |
I need to know about Epoll On linux System.
Could you recommend manual or guides about epoll library?
need more detailed guides. it's better to have some examples.
help me. and Thank you for reading.
| stackexchange/codereview |
I want to create a client side mail creator web page. I know the problems of using the mailto action in an html form (not standard, no default mail appication set on the client). But the web page isn't very important, and they don't care very much.
The mail created by the mailto action has the syntax:
subject: undefin... | stackexchange/codereview |
First of all, I know how to build a Java application. But I have always been puzzled about where to put my classes. There are proponents for organizing the packages in a strictly domain oriented fashion, others separate by tier.
I myself have always had problems with
naming,
placing
So,
Where do you put your domai... | stackexchange/codereview |
Is there any free or commercial component written in .NET (no COM interop) that will work with most twain scanners?
| stackexchange/codereview |
We have a requirement in project to store all the revisions(Change History) for the entities in the database. Currently we have 2 designed proposals for this:
e.g. for "Employee" Entity
Design 1:
-- Holds Employee Entity
"Employees (EmployeeId, FirstName, LastName, DepartmentId, .., ..)"
-- Holds the Employee Revision... | stackexchange/codereview |
While the C# spec does include a pre-processor and basic directives (#define, #if, etc), the language does not have the same flexible pre-processor found in languages such as C/C++. I believe the lack of such a flexible pre-processor was a design decision made by Anders Hejlsberg (although, unfortunately, I can't find ... | stackexchange/codereview |
I'm trying to fetch some HTML from various blogs and have noticed that different providers use the same tag in different ways.
For example, here are two major providers that use the meta name generator tag differently:
Blogger: <meta content='blogger' name='generator'/> (content first, name later and, yes, single quot... | stackexchange/codereview |
Has anyone tried installing SQL Server 2008 Developer on a machine that already has 2005 Developer installed?
I am unsure if I should do this, and I need to keep 2005 on this machine for the foreseeable future in order to test our application easily. Since I sometimes need to take backup files of databases and make ava... | stackexchange/codereview |
How do I generate an ETag HTTP header for a resource file?
| stackexchange/codereview |
I'm having issues getting the C sockets API to work properly in C++ on z/OS.
Although I am including sys/socket.h, I still get compile time errors telling me that AF_INET is not defined.
Am I missing something obvious, or is this related to the fact that being on z/OS makes my problems much more complicated?
I discover... | stackexchange/codereview |
I am looking for a (preferably) command-line tool that can reformat the C# source code on a directory tree. Ideally, I should be able to customize the formatting. Bonus points if the tool can be run on Mono (or Linux).
| stackexchange/codereview |
I'm about to start a fairly Ajax heavy feature in my company's application. What I need to do is make an Ajax callback every few minutes a user has been on the page.
I don't need to do any DOM updates before, after, or during the callbacks.
I don't need any information from the page, just from a site cookie which sh... | stackexchange/codereview |
Can anyone point me to some decent introductions to WS-Security?
I'm looking for tutorials or something that provide a fairly gentle introduction to the subject, though I don't mind if it assumes basic knowledge of web services and SOAP. Most of the stuff I've seen so far is very technical and you need a lot of complex... | stackexchange/codereview |
How do you specify a callback for rb->pcm_play_data()?
| stackexchange/codereview |
Original Question
I am looking for a function that attempts to quantify how "distant" (or distinct) two colors are. This question is really in two parts:
What color space best represents human vision?
What distance metric in that space best represents human vision (euclidean?)
| stackexchange/codereview |
We have been using CruiseControl for quite a while with NUnit and NAnt. For a recent project we decided to use the testing framework that comes with Visual Studio, which so far has been adequate.
I'm attempting to get the solution running in CruiseControl. I've finally got the build itself to work; however, I have bee... | stackexchange/codereview |
I have heard umpteen times that we 'should not mix business logic with other code' or statements like that. I think every single code I write (processing steps I mean) consists of logic that is related to the business requirements..
Can anyone tell me what exactly consists of business logic? How can it be distinguished... | stackexchange/codereview |
Using SqlServer, and trying to update rows from within the same table. I want to use a table alias for readability.
This is the way I am doing it at the moment:
UPDATE ra
SET ra.ItemValue = rb.ItemValue
FROM dbo.Rates ra, dbo.Rates rb
WHERE ra.ResourceID = rb.ResourceID
AND ra.PriceSched = 't8'
AND rb.PriceSched = 't9... | stackexchange/codereview |
XPO is the object relational mapper of choice at my company. Any thoughts on the pros and cons?
I was just looking for general feeling and anecdotes about the product. We are not switching to XPO. We are just getting rid of hard coded sql strings living in the app and moving completely to ORM for all data access.
| stackexchange/codereview |
What would you recommend for OS X development of a graphical application like those possible in WPF?
My specific background is in Smalltalk & Java, but I currently work mostly in DHTML/.NET (ASP.NET/C#).
| stackexchange/codereview |
I've heard rumors that PHP is planning on introducing a "goto" command. What is it supposed to be doing?
I've tried searching a bit, but haven't found anything awfully descriptive. I understand that it won't be a "GOTO 10"-like command...
| stackexchange/codereview |
How do I forcefully unload a ByteArray from memory using ActionScript 3?
I have tried the following:
// First non-working solution
byteArray.length = 0;
byteArray = new ByteArray();
// Second non-working solution
for ( var i:int=0; i < byteArray.length; i++ ) {
byteArray[i] = null;
}
| stackexchange/codereview |
How can I monitor an SQL Server database for changes to a table without using triggers or modifying the structure of the database in any way? My preferred programming environment is .NET and C#.
I'd like to be able to support any SQL Server 2000 SP4 or newer. My application is a bolt-on data visualization for another c... | stackexchange/codereview |
I am aware that in .NET there are three timer types (see Comparing the Timer Classes in the .NET Framework Class Library). I have chosen a threaded timer as the other types can drift if the main thread is busy, and I need this to be reliable.
The way this timer works in the control of the timer is put on another thread... | stackexchange/codereview |
What is the best way of testing a function that throws on failure? Or testing a function that is fairly immune to failure?
For instance; I have a I/O Completion Port class that throws in the constructor if it can't initialise the port correctly. This uses the Win32 function of CreateIoCompletionPort in the initialiser ... | stackexchange/codereview |
I'm trying to find the correct names for these 2 "types" of coding expressions in LINQ so that I can refer to them correctly. I want to say that the first is called "Fluent Style"?
var selectVar = arrayVar.Select( (a,i) => new { Line = a });
var selectVar =
from s in arrayVar
select new { Line = s };
| stackexchange/codereview |
Depending on my mood I seem to waffle back and forth between wanting a Lisp-1 and a Lisp-2. Unfortunately beyond the obvious name space differences, this leaves all kinds of amusing function name/etc problems you run into. Case in point, trying to write some code tonight I tried to do (map #'function listvar) which, ... | stackexchange/codereview |
Question as stated in the title.
| stackexchange/codereview |
I'm trying to wrap my head around reflection, so I decided to add plugin capability to a program that I'm writing. The only way to understand a concept is to get your fingers dirty and write the code, so I went the route of creating a simple interface library consisting of the IPlugin and IHost interfaces, a plugin imp... | stackexchange/codereview |
I heard that if you use port 443 (the port usually used for https) for ssh, the encrypted packets look the same to your isp.
Could this be a way to avoid traffic shaping/throttling?
| stackexchange/codereview |
I've been interacting with Amazon S3 through S3Fox and I can't seem to delete my buckets. I select a bucket, hit delete, confirm the delete in a popup, and... nothing happens. Is there another tool that I should use?
| stackexchange/codereview |
To analyze lots of text logs I did some hackery that looks like this:
Locally import logs into Access
Reprocess Cube link to previous mdb in Analisis Service 2000 (yes it is 2k)
Use Excel to visualize Cube (it is not big - up to milions raw entries)
My hackery is a succes and more people are demanding an access to m... | stackexchange/codereview |
I'm trying to create a bookmarklet for posting del.icio.us bookmarks to a separate account.
I tested it from the command line like:
wget -O - --no-check-certificate \
"https://seconduser:thepassword@api.del.icio.us/v1/posts/add?url=http://seet.dk&description=test"
This works great.
I then wanted to create a bookmarkle... | stackexchange/codereview |
Does anyone remember the XMP tag?
What was it used for and why was it deprecated?
| stackexchange/codereview |
In C, are the shift operators (<<, >>) arithmetic or logical?
| stackexchange/codereview |
Original Question
If you are given N maximally distant colors (and some associated distance metric), can you come up with a way to sort those colors into some order such that the first M are also reasonably close to being a maximally distinct set?
In other words, given a bunch of distinct colors, come up with an orderi... | stackexchange/codereview |
I need to copy hundreds of gigs of random files around on my computer and am pretty leery of using the vanilla file copy built into Windows.
I don't want it to hang on a "Are you sure?", "Are you really sure?", "Even zip files?", "Surely not read-only files too!" loop as soon as I step away.
I don't want it to work for... | stackexchange/codereview |
I'm working on a .net solution that is run completely inside a single network. When users make a change to the system, I want to launch an announcement and have everyone else hear it and act accordingly. Is there a way that we can broadcast out messages like this (like UDP will let you do) while keeping guaranteed del... | stackexchange/codereview |
When building a VS 2008 solution with 19 projects I sometimes get:
The "GenerateResource" task failed unexpectedly.
System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
at System.IO.MemoryStream.set_Capacity(Int32 value)
at System.IO.MemoryStream.EnsureCapacity(Int32 value)
... | stackexchange/codereview |
I am starting a new web application in PHP and this time around I want to create something that people can extend by using a plugin interface.
How does one go about writing 'hooks' into their code so that plugins can attach to specific events?
| stackexchange/codereview |
Let's say you create a wizard in an HTML form. One button goes back, and one goes forward. Since the back button appears first in the markup when you press Enter, it will use that button to submit the form.
Example:
<form>
<!-- Put your cursor in this field and press Enter -->
<input type="text" name="field1" /... | stackexchange/codereview |
Which of the following has the best performance?
I have seen method two implemented in JavaScript with huge performance gains, however, I was unable to measure any gain in C# and was wondering if the compiler already does method 2 even when written like method 1.
The theory behind method 2 is that the code doesn't have... | stackexchange/codereview |
I'm writing an app that will need to make use of Timers, but potentially very many of them. How scalable is the System.Threading.Timer class? The documentation merely say it's "lightweight", but doesn't explain further. Do these timers get sucked into a single thread (or very small threadpool) that processes all the... | stackexchange/codereview |
For classes that have a long list of setters that are used frequently, I found this way very useful (although I have recently read about the Builder pattern in Effective Java that is kinda the same).
Basically, all setter methods return the object itself so then you can use code like this:
myClass
.setInt(1)
.s... | stackexchange/codereview |
This might seem like a stupid question I admit. But I'm in a small shop me plus two designers. Our backups are getting out of hand because they just copy/paste files if they need to make a change (version).
I was all set to try Subversion to handle all of our files my text (code) files and their photoshop/illustrator ... | stackexchange/codereview |
I am writing a few extensions to mimic the map and reduce functions in Lisp.
public delegate R ReduceFunction<T,R>(T t, R previous);
public delegate void TransformFunction<T>(T t, params object[] args);
public static R Reduce<T,R>(this List<T> list, ReduceFunction<T,R> r, R initial)
{
var aggregate = initial;
... | stackexchange/codereview |
Imagine you homebrew a custom gui framework that doesn't use windows handles (compact framework, so please don't argue with "whys"). One of the main disadvantages of developing such a framework is that you lose compatability with the winform designer.
So my question is to all of you who know a lot about VS customisatio... | stackexchange/codereview |
The Entity Framework does not support the Expression.Invoke operator. You receive the following exception when trying to use it:
"The LINQ expression node type 'Invoke' is not supported in LINQ to Entities.
Has anyone got a workaround for this missing functionality? I would like to use the PredicateBuilder detailed ... | stackexchange/codereview |
I'm using Castle Windsor to do some dependency injection, specifically I've abstracted the DAL layer to interfaces that are now being loaded by DI.
Once the project is developed & deployed all the .bin files will be in the same location, but for while I'm developing in Visual Studio, the only ways I can see of getting ... | stackexchange/codereview |
How do I "name" a browser window in ROR, such that I can open a page in it later, from another (popup) window (using the target="name" html parameter)
| stackexchange/codereview |
I have an information retrieval application that creates bit arrays on the order of 10s of million bits. The number of "set" bits in the array varies widely, from all clear to all set. Currently, I'm using a straight-forward bit array (java.util.BitSet), so each of my bit arrays takes several megabytes.
My plan is to l... | stackexchange/codereview |
Some WPF controls (like the Button) seem to happily consume all the available space in its' container if you don't specify the height it is to have.
And some, like the ones I need to use right now, the (multiline) TextBox and the ListBox seem more worried about just taking the space necessary to fit their contents, and... | stackexchange/codereview |
What would be the easiest way to separate the directory name from the file name when dealing with SaveFileDialog.FileName in C#?
| stackexchange/codereview |
Despite primarily being a windows user, I am a huge fan of rsync. Now, I don't want to argue the virtues of rsync vs any other tool...this is not my point.
The only way I've ever found of running rsync on windows is via a version that is built to run on top of Cygwin, and as Cygwin has issues with Unicode, so does rsy... | stackexchange/codereview |
I am coding a client-server application using Eclipse's RCP.
We are having trouble testing the interaction between the two sides
as they both contain a lot of GUI and provide no command-line or other
remote API.
Got any ideas?
| stackexchange/codereview |
I'm working on some code to paste into the currently active OpenOffice document directly from C#. I can't include any of the OpenOffice libraries, because we don't want to package them, so we're using reflection to get access to the OpenOffice API.
My question involves using a dispatcher through reflection. I can't f... | stackexchange/codereview |
I've been using PHP & MySQL for ages and am about to start using PostgreSQL instead.
What's the preferred method?
Is it via the PDO objects or is there something better?
| stackexchange/codereview |
I got into a mini-argument with my boss recently regarding "project failure." After three years, our project to migrate a codebase to a new platform (a project I was on for 1.5 years, but my team lead was on for only a few months) went live. He, along with senior management of both my company and the client (I'm one of... | stackexchange/codereview |
I know that this should be easy but how do I export/save a DataGridView to excel?
| stackexchange/codereview |
What is the best solution for maintaining backup and revision control on live websites?
As part of my job I work with several live websites. We need an efficient means of maintaining backups of the live folders over time. Additionally, updating these sites can be a pain, especially if a change happens to break in the ... | stackexchange/codereview |
I need the name of the current logged in user in my Air/Flex application. The application will only be deployed on Windows machines. I think I could attain this by regexing the User directory, but am open to other ways.
| stackexchange/codereview |
I saw many questions asking 'how' to unit test in a specific language, but no question asking 'what', 'why', and 'when'.
What is it?
What does it do for me?
Why should I use it?
When should I use it (also when not)?
What are some common pitfalls and misconceptions
| stackexchange/codereview |
I have a regex that is going to end up being a bit long and it'd make it much easier to read to have it across multiple lines.
I tried this but it just barfs.
preg_match(
'^J[0-9]{7}:\s+
(.*?) #Extract the Transaction Start Date msg
\s+J[0-9]{7}:\s+Project\sname:\s+
(.*?) #Extrac... | stackexchange/codereview |
How do I get Perl to read the contents of a given directory into an array?
Backticks can do it, but is there some method using 'scandir' or a similar term?
| stackexchange/codereview |
Here is the issue I am having: I have a large query that needs to compare datetimes in the where clause to see if two dates are on the same day. My current solution, which sucks, is to send the datetimes into a UDF to convert them to midnight of the same day, and then check those dates for equality. When it comes to ... | stackexchange/codereview |
Here's a problem I ran into recently. I have attributes strings of the form
"x=1 and y=abc and z=c4g and ..."
Some attributes have numeric values, some have alpha values, some have mixed, some have dates, etc.
Every string is supposed to have "x=someval and y=anotherval" at the beginning, but some don't. I have thre... | stackexchange/codereview |
I have a DataTable with a Name column. I want to generate a collection of the unique names ordered alphabetically. The following query ignores the order by clause.
var names =
(from DataRow dr in dataTable.Rows
orderby (string)dr["Name"]
select (string)dr["Name"]).Distinct();
Why does the orderby not get e... | stackexchange/codereview |
Are there any open source (or I guess commercial) packages that you can plug into your site for monitoring purposes? I'd like something that we can hook up to our ASP.NET site and use to provide reporting on things like:
performance over time
current load
page traffic
SQL performance
PU time monitoring
Ideally in c#... | stackexchange/codereview |
What's the cleanest, most effective way to validate decimal numbers in JavaScript?
Bonus points for:
Clarity. Solution should be clean and simple.
Cross-platform.
Test cases:
01. IsNumeric('-1') => true
02. IsNumeric('-1.5') => true
03. IsNumeric('0') => true
04. IsNumeric('0.42') => true
05. IsNumer... | stackexchange/codereview |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.