instruction_seed
stringlengths
1
35.8k
_source
stringclasses
1 value
I am programmatically exporting data (using PHP 5.2) into a .csv test file. Example data: Numéro 1 (note the accented e). The data is utf-8 (no prepended BOM). When I open this file in MS Excel is displays as Numéro 1. I am able to open this in a text editor (UltraEdit) which displays it correctly. UE reports the c...
stackexchange/codereview
When I parse my xml file (variable f) in this method, I get an error C:\Documents and Settings\joe\Desktop\aicpcudev\OnlineModule\map.dtd (The system cannot find the path specified) I know I do not have the dtd, nor do I need it. How can I parse this File object into a Document object while ignoring DTD reference e...
stackexchange/codereview
I need to develop a generic jQuery-based search plugin for the ASP.NET MVC application I'm building, but I can't figure out how it's supposed to fit, or what the best practice is. I want to do the following: $().ready(function() { $('#searchHolder').customSearch('MyApp.Models.User'); }); As long as I have impleme...
stackexchange/codereview
Assuming a MySQL datastore, when would you NOT want to use memcached in a Ruby on Rails app?
stackexchange/codereview
I'm trying to find a good way to print leading 0, such as 01001 for a ZIP Code. While the number would be stored as 1001, what is a good way to do it? I thought of using either case statements or if to figure out how many digits the number is and then convert it to an char array with extra 0's for printing, but I can't...
stackexchange/codereview
What are some good ways to catch business logic exceptions or return values from SQL in C#? For instance, upon creating a new user, if the user already exists, the system and the user must be notified. I have used the raise_error() method with a particular state int value, I have used a stored procedure returning int...
stackexchange/codereview
I could probably write this myself, but the specific way I'm trying to accomplish it is throwing me off. I'm trying to write a generic extension method similar to the others introduced in .NET 3.5 that will take a nested IEnumerable of IEnumerables (and so on) and flatten it into one IEnumerable. Anyone have any idea...
stackexchange/codereview
This is the text from MSDN comment: "According to the book ATL Internals (2ed) the use of attributes is deprecated and should not be used in new ATL projects." But WHY?!!
stackexchange/codereview
I have some code that creates a fairly large xml DOM and writes it off to a file (up to 50-100MB) . It basically creates the DOM and then calls a toString on it and writes it out with ofstream. Is there a way to get streaming output of the generated dom so that it doesn't create the whole structure in memory all at onc...
stackexchange/codereview
I'm running some JMeter tests against a Java process to determine how responsive a web application is under load (500+ users). JMeter will give the response time for each web request, and I've written a script to ping the Tomcat Manager every X seconds which will get me the current size of the JVM heap. I'd like to col...
stackexchange/codereview
See the question. I want to see the methods and classes offered by a DLLs library.
stackexchange/codereview
I want to find out all the subdomains of a given domain. I found a hint which tells me to dig the authoritative nameserver with the following option: dig @ns1.foo.example example.com axfr But this never works. Has anyone a better idea/approach?
stackexchange/codereview
I am curious whether it is OK to copy a directory that is under version control and start working on both copies. I know it can be different from one VCS to another, but I intentionally don't specify any VCS since I am curious about different cases. I was talking to a coworker recently about doing it in SVN. I think it...
stackexchange/codereview
Summary What's the best way to ensure a table cell cannot be less than a certain minimum width. Example I want to ensure that all cells in a table are at least 100px wide regards of the width of the tables container. If there is more available space the table cells should fill that space. Browser compatibility I possi...
stackexchange/codereview
I have a .NET 3.5 web application for which I have implemented a class called CalculationsCounterManager (code below). This class has some shared/static members that manage the creation and incrementing of two custom performance counters that monitor data calls to a SQL Server database. Execution of these data calls ...
stackexchange/codereview
Documentation can be found here It says in the example: onDrop: Called whenever a Draggable is released over the Droppable and the Droppable is accepts it. The callback gets three parameters: the Draggable element, the Droppable element and the Event. You can extract additional information about the drop – like if the ...
stackexchange/codereview
I am getting the following error when I put class files in subfolders of my App_Code folder: errorCS0246: The type or namespace name 'MyClassName' could not be found (are you missing a using directive or an assembly reference?) This class is not in a namespace at all. Any ideas?
stackexchange/codereview
As a programming exercise, I've written a Ruby snippet that creates a class, instantiates two objects from that class, monkeypatches one object, and relies on method_missing to monkeypatch the other one. Here's the deal. This works as intended: class Monkey def chatter puts "I am a chattering monkey!" end ...
stackexchange/codereview
I have some controls in the tablelayoutpanel but the tab index for the control are not working properly.
stackexchange/codereview
I've installed Oracle XE with APEX, but forgot to write down the URL to access it. How may I determine the URL?
stackexchange/codereview
Subversion is a great way to update our web applications on our servers. With a simple svn update all changed files get... well, changed. Except for the omnipresent configuration files such as config.php which hold the database access configuration, server paths etc. And are therefore different on my local development ...
stackexchange/codereview
I know this can be done in IE by creating an ActiveX object, but how do I do it in FF. The navigator.plugins['Adobe Acrobat'] object lets me know if it's installed or not, but it doesn't contain the version number. Any ideas?
stackexchange/codereview
I'm considering using reporting services 05 SP2 with share point integration on a new reporting project. In this project's reports users can only see records they own. I was thinking a simple userId parameter on the report would allow me to filter the report's results to only these "owned" records. I'm curious: Can I...
stackexchange/codereview
I've been asked to find a way to send an alert to a blackberry when certain conditions are met on an Excel 2007 spreadsheet. The alert can be an SMS (preferred) or an email. The cell values are changing throughout the day from a DDE feed. What are the typical solutions that people use to solve this?
stackexchange/codereview
I'm trying to balance a set of currency values using vb.net. The totals for both these values is cast as a double. I'm getting rounding errors in some situations. What's the best way to avoid this? Is there a type I can use in preference to double? How do I round the resultant value to two decimal places? Here's my co...
stackexchange/codereview
At my workplace, the traffic blocker/firewall has been getting progressively worse. I can't connect to my home machine on port 22, and lack of ssh access makes me sad. I was previously able to use SSH by moving it to port 5050, but I think some recent filters now treat this traffic as IM and redirect it through anoth...
stackexchange/codereview
I love CherryPy's API for sessions, except for one detail. Instead of saying cherrypy.session["spam"] I'd like to be able to just say session["spam"]. Unfortunately, I can't simply have a global from cherrypy import session in one of my modules, because the cherrypy.session object isn't created until the first time a ...
stackexchange/codereview
Has anyone else seen people do this: private string _name; public string Name{ get{ return _name; } set{ _name = value;}} I understand using accessors if you are going to exercise some sort of control over how it gets set or perform some sort of function on it when there is a get. But if you are just going to do this,...
stackexchange/codereview
Currently I monitoring a particular file with a simple shell one-liner: filesize=$(ls -lah somefile | awk '{print $5}') I'm aware that Perl has some nice modules to deal with Excel files so the idea is to, let's say, run that check daily, perhaps with cron, and write the result on a spreadsheet for further statistica...
stackexchange/codereview
Is there a an event for ListViews that are activated when one of the column headers are clicked on? The plan was to add some text to the user's clipboard when they click on the column header. Is there any easy way to do this?
stackexchange/codereview
Starting new .NET projects always involves a bit of work. You have to create the solution, add projects for different tiers (Domain, DAL, Web, Test), set up references, solution structure, copy javascript files, css templates and master pages etc etc. What I'd like is an easy way of cloning any given solution. If you ...
stackexchange/codereview
What is the best way to automatically install an MSI file or installer .exe? We want to do some automated testing from our build system on the installed copy of the product. Our installer has the usual license acceptance screen, install location, etc. As FryHard pointed out there are two options in particular that see...
stackexchange/codereview
Further to my previous question about the Optimal RAID setup for SQL server, could anyone suggest a quick and dirty way of benchmarking the database performance on the new and old servers to compare them? Obviously, the proper way would be to monitor our actual usage and set up all sorts of performance counters and cap...
stackexchange/codereview
We get sometimes the following error from our partner's database: <i>ORA-01438: value larger than specified precision allows for this column</i> The full response looks like the following: <?xml version="1.0" encoding="windows-1251"?> <response> <status_code></status_code> <error_text>ORA-01438: value larger than ...
stackexchange/codereview
What is the best way to create a custom title for pages in a Rails app without using a plug-in?
stackexchange/codereview
<div id="myDiv"> <a>...</a> <a>...</a> <a>...</a> <a>...</a> <a>...</a> <a>...</a> </div> If you wanted to select the 2nd, 3rd and 4th a tags in the above example, how would you do that? The only thing I can think of is: $("#myDiv a:eq(1), #myDiv a:eq(2), #myDiv a:eq(3)") But that doesn'...
stackexchange/codereview
Note: Originally this question was asked for PostgreSQL, however, the answer applies to almost any database which has a JDBC driver that can detect foreign-key associations. Querying PostgreSQL data dictionary for foreign-keys and relationship between tables is very straightforward, but how can I use that information...
stackexchange/codereview
In javascript, we can do: ["a string", 10, {x : 1}, function() {}].push("another value"); What is the Scala equivalent?
stackexchange/codereview
Let me start with a specific example of what I'm trying to do. I have an array of year, month, day, hour, minute, second and millisecond components in the form [ 2008, 10, 8, 00, 16, 34, 254 ]. I'd like to instantiate a Date object using the following standard constructor: new Date(year, month, date [, hour, minute, se...
stackexchange/codereview
I basically want to use link_to to link to the index method of a controller. I tried: <%= link_to 'Recipes', Recipe %> but that outputs: <a href="/recipes/Recipe">Recipes</a> Which is clearly not right, if it left off that last bit it would do exactly what I want it to. I thought that with RESTful stuff I somehow ...
stackexchange/codereview
I have a table with one field that can point to a foreign key in one of 3 other tables based on what the descriminator value is (Project, TimeKeep, or CostCenter. Usually this is implemented with subclasses, and I am wondering if what I have below will work. Note the subclass name is the same as the parent class and ...
stackexchange/codereview
I am using Netbeans 6.1 and Tomcat 6.0.1.6. I made some very minor changes to a project that had been working and now I am getting the following error: com.sun.rave.web.ui.appbase.ApplicationException: org.apache.jasper.JasperException: Could not add one or more tag libraries. The only change I made was to a backing be...
stackexchange/codereview
Is there a simple way to convert a string to Title Case? E.g. john smith becomes John Smith. I'm not looking for something complicated like John Resig's solution, just (hopefully) some kind of one- or two-liner.
stackexchange/codereview
I have an old project that was built using visual studio 2003 and I recompiled it with vs2005 recently. However, during runtime, I get the following error: list iterator not incrementable I traced the program to this function: void InputQueue::update() { list<PCB>::iterator iter; list<PCB>::iterator iterTemp; ...
stackexchange/codereview
In a Test project in Visual Studio 2008 (Pro), I created a Test project, and I want to configure the project properties to give a command line argument to the tests. I set the properties, but then realized I have no idea how to actually use the argument. How do you get the arguments from MSTest?
stackexchange/codereview
What am I doing wrong here? string q = "john s!"; string clean = Regex.Replace(q, @"([^a-zA-Z0-9]|^\s)", string.Empty); // clean == "johns". I want "john s";
stackexchange/codereview
We have a Microsoft SQL Server 2005 database that needs to be converted back to SQL Server 2000. Does anybody have any suggestions on the approach or tools I should use to perform this conversion? We don't utilise any SQL Server 2005 specific features in the database so this should not make the conversion problematic. ...
stackexchange/codereview
The rich text editor must be implemented in Java, provide Swing support, and preferably be open source. I'm looking to integrate it into an existing Java/Swing application. Thanks.
stackexchange/codereview
There are lots of web application frameworks available these days, for pretty much every language out there. In your experience, what are their strengths, weaknesses, and unique features? Assuming the luxury of choice, what factors would lead you to consider one over another other? I'm most interested in people's dir...
stackexchange/codereview
My friend accidentally bought a laptop with Windows Vista Home Basic Edition. He figured out how to install IIS on it, but it doesn't seem to have either the management console or the admin tools. Is there any way for him to configure a site or import an IIS 6 config file? EDIT: "Windows Vista Home Edition" --> "Window...
stackexchange/codereview
How can I use HttpWebRequest (.NET, C#) asynchronously?
stackexchange/codereview
I use log4net in just about every code project. I was wondering what other generally useful code projects are available?
stackexchange/codereview
Is there good example code or a test project for explaining the Model–view–presenter (MVP) pattern. There are a lot of explanation links, but I want to have some good example code to show others without reinventing the wheel.
stackexchange/codereview
What book or website would you recommend to learn about QEMU? I'd like to see some usage examples as well as how to use the APIs.
stackexchange/codereview
I have several different c# worker applications that run various continuous tasks: sending emails from queue, importing new orders from website database to orders database, making database backups and restores, running data processing for OLTP -> OLAP, and other related tasks. Before, I released these as windows servic...
stackexchange/codereview
I'm trying to make things simpler. Here is my code: If Threading.Monitor.TryEnter(syncRoot) Then Try 'do something Finally Threading.Monitor.Exit(syncRoot) End Try Else 'do something else End If This is even worse than the ReaderWriterLock in terms of...
stackexchange/codereview
I have a couple of solutions, but none of them work perfectly. Platform ASP.NET / VB.NET / .NET 2.0 IIS 6 IE6 (primarily), with some IE7; Firefox not necessary, but useful Allowed 3rd Party Options Flash ActiveX (would like to avoid) Java (would like to avoid) Current Attempts Gmail Style: You can use javascript to...
stackexchange/codereview
How can I dismiss dialog in Cocoa application when user presses Esc or Enter key? I have OK button, is it possible to make it default button?
stackexchange/codereview
How do some programs edit whats being displayed on the terminal (to pick a random example, the program 'sl')? I'm thinking of the Linux terminal here, it may happen in other OS's too, I don't know. I've always thought once some text was displayed, it stayed there. How do you change it without redrawing the entire scre...
stackexchange/codereview
i have a wordpress blog and want to give people the same user experience for adding comments that is in stackoverflow. There are a number of comments ajax plugins out there but i can't find a working one that allows you to inline on the main page, go in and add comments without first drilling down into a seperate sing...
stackexchange/codereview
I'm a huge fan of bzr and I'm glad they're working on tortoise for it, but currently it's WAY too slow to be useful. The icons are almost always incorrect and when I load a directory in explorer with a lot of branches it locks up my entire system for anywhere from 10 seconds to 2 minutes. I look forward to trying it ...
stackexchange/codereview
How do you detect if Socket#close() has been called on a socket on the remote side?
stackexchange/codereview
I call my JavaScript function. Why do I sometimes get the error 'myFunction is not defined' when it is defined? For example. I'll occasionally get 'copyArray is not defined' even in this example: function copyArray( pa ) { var la = []; for (var i=0; i < pa.length; i++) la.push( pa[i] ); return la; }...
stackexchange/codereview
I have code from an old website that I needed to modify. There are two pages that I modified some form code in. I modified the max length of a textbox and I modified slightly a line or two of code in a function. The "btnSubmit_Click" function as it happens. With the new code FTPed up on the webserver, when I click on t...
stackexchange/codereview
I need to get the "td" element of a table. I do not have the ability to add a mouseover or onclick event to the "td" element, so I need to add them with JQUERY. I need JQUERY to add the mouseover and onclick event to the all "td" elements in the table. Thats what I need, maybe someone can help me out?
stackexchange/codereview
I have a report created in Crystal (the version that comes with Visual Studio 2005) that contains an IFieldObject that I want to use to display some rich text. I have set the TextFormat of the IFieldObject to crRTFText, however when I run the report the textbox displays all the rtf markup rather than actually displayi...
stackexchange/codereview
Is there a way in PHP to make HTTP calls and not wait for a response? I don't care about the response, I just want to do something like file_get_contents(), but not wait for the request to finish before executing the rest of my code. This would be super useful for setting off "events" of a sort in my application, or tr...
stackexchange/codereview
What's your favorite open source database design/modeling tool? I'm looking for one that supports several databases, especially Firebird SQL but I can't find one on Google.
stackexchange/codereview
We use an IBM database known as Universe that holds all of our user id's, passwords, and profile information in a table called USERINFO. Can I use the Membership Provider to connect to this database and authenticate the user? The database access is actually through a web service since we don't have a direct connect ...
stackexchange/codereview
I have an ASP.Net 2.0 application in which the Session_Start event is not firing in my Global.asax file. Can anyone tell why this is happening and how I can get it working? The application worked fine on my Windows XP development machine, but stopped working when deployed to the server (Win Server 2003/IIS 6/ASP.Net 2....
stackexchange/codereview
While running through the cheat sheet "create a navigation rule" for the Eclipse JavaServer Faces tooling it says "select the page control from the palette and ...". But where's this "palette"?
stackexchange/codereview
In IE when I insert text into a <pre> tag the newlines are ignored: <pre id="putItHere"></pre> <script> function putText() { document.getElementById("putItHere").innerHTML = "first line\nsecond line"; } </script> Using \r\n instead of a plain \n does not work. <br/> does work but inserts an extra blank line in FF...
stackexchange/codereview
How is it possible for this to be true XmlDocument d = BuildReportXML(schema); DataSet ds = new DataSet(); ds.ReadXmlSchema(schema); ds.ReadXml(new XmlNodeReader(d)); Schema is the schema location that I apply to the XmlDocument before I start setting data, assuring that all the columns are of the correct type. Then I...
stackexchange/codereview
I have a .net app that I've written in c#. On some forms I frequent update the display fields. In some cases every field on the form (textboxes, labels, picturebox, etc) has its value changed. Plus the frequency of the changes could possibly be every second. However, currently there is a horrible flickering everytime t...
stackexchange/codereview
I am trying to update an element in a list with Lotus Formula. I thought you would do it like this: x := "0":"0":"0"; x[1] := "1"; But when I try to save I get the following error: := must be immediately preceded by a field or variable name
stackexchange/codereview
My Delphi7 project will not run on my clients computer if i don't have a few of the runtime packages in the path. eg rtl70.bpl I have Build with runtime packages unticked, so shouldn't they be complied into the exe? Edit: the Project uses Jedi Packages (TJvPlugin) and running the program with out any plugin installed w...
stackexchange/codereview
I have some really complicated legacy code I've been working on that crashes when collecting big chunks of data. I've been unable to find the exact reason for the crashes and am trying different ways to solve it or at least recover nicely. The last thing I did was enclose the crashing code in a try ... except clean...
stackexchange/codereview
Over the years, I have tried many times to find a good, easy to use, cross platform tool for some basic software system diagramming. The UML tools I have tried seemed to get in my way more than help. So far, the solution I keep returning to is Visio, which is both Windows-only and expensive. Although its far from id...
stackexchange/codereview
I am embedding Ruby into my C project and want to load several files that define a class inherited from my own parent class. Each inherited class needs to set some variables on initialization and I don't want to have two different variables for Ruby and C. Is there a way to define a class variable that has an own custo...
stackexchange/codereview
Do .net applications run on linux? Are there any free/paid interop libraries available ?
stackexchange/codereview
Can someone provide a regular expression for parsing name/value pairs from a string? The pairs are separated by commas, and the value can optionally be enclosed in quotes. For example: AssemblyName=foo.dll,ClassName="SomeClass",Parameters="Some,Parameters"
stackexchange/codereview
I have a webpage that pulls information from a database, converts it to .csv format, and writes the file to the HTTPResponse. string csv = GetCSV(); Response.Clear(); Response.ContentType = "text/csv"; Response.Write(csv); This works fine, and the file is sent to the client with no problems. However, when the file ...
stackexchange/codereview
A team member has run into an issue with an old in-house system where a user double-clicking on a link on a web page can cause two requests to be sent from the browser resulting in two database inserts of the same record in a race condition; the last one to run fails with a primary key violation. Several solutions and...
stackexchange/codereview
I'm looking for a good way to visualize ASP.NET session state data stored in SQL server, preferably without creating a throwaway .aspx page. Is there a good way to get a list of the keys (and serialized data, if possible) directly from SQL server? Ideally, I'd like to run some T-SQL commands directly against the databa...
stackexchange/codereview
Code I am trying to run: $query = "DESCRIBE TABLE TABLENAME"; $result = odbc_exec($h, $query); The result: PHP Warning: odbc_exec(): SQL error: [unixODBC][IBM][iSeries Access ODBC Driver][DB2 UDB]SQL0104 - Token TABLENAME was not valid. Valid tokens: INTO., SQL state 37000 in SQLExecDirect in ... There were no ...
stackexchange/codereview
Is there a way to automatically increment the "minimum required version" fields in a ClickOnce deployment to always equal the current build number? Basically, I always want my deployment to be automatically updated at launch. I suspect I'm going to need a some pre-/post-build events, but I hope there's an easier way.
stackexchange/codereview
I would like to run multiple copies of my application and force the first to open on one monitor and the second instance on a second monitor
stackexchange/codereview
If I load the nextimg URL manually in the browser, it gives a new picture every time I reload. But this bit of code shows the same image every iteration of draw(). How can I force myimg not to be cached? <html> <head> <script type="text/javascript"> function draw(){ var canvas = document.getElementB...
stackexchange/codereview
<DataTemplate x:Key="Genre_DataTemplate"> <RadioButton GroupName="One" Content="{Binding... </DataTemplate> Above code is the ItemTemplate of my ItemsControl, I want all the Radiobuttons instantiated should behave as if it is in a group, I know the reason because the generated RadioButtons are not adjacent i...
stackexchange/codereview
SQL Server profiler is great for profiling SQL Server performance for web apps. However, when I'm testing my webapp I'd like a summary of database hits/duration per page. Does anybody know of any utilities for giving you this kind of information?
stackexchange/codereview
I've registered custom protocol "xyz" on Windows Vista: HKEY\_CLASSES\_ROOT\xyz = "URL:Extensions Protocol" It works OK with my application. Open "Control Panel -> Programs -> Default Programs -> Set Associations", scroll the list to the end. Here is the list of protocols. I would like to see my custom protocol a...
stackexchange/codereview
It seems that DrawFrameControl() creates Font and Brush objects, select them into dc, and doesn't delete them. (according to BoundsChecker messages). Does anyone faced such thing?
stackexchange/codereview
Mobile Safari is a very capable browser, and it can handle my website as it is perfectly. However, there are a few elements on my page that could be optimized for browsing using this device; such as serving specific thumbnails that are smaller than the desktop counterparts to help fit more content into the screen. I wo...
stackexchange/codereview
For example int f(int a) { ... return a > 10; } is that considered acceptable (not legal, I mean is it ``good code''), or should it always be in a conditional, like this int f(int a) { ... if (a > 10) return 1; else return 0; }
stackexchange/codereview
I'd like to be able to click on a file to revert it, or check in a directory, etc. It would be much more convenient to have these available from the right click menu.
stackexchange/codereview
We have a few operations where we are doing a large number of large string concatenations, and have recently encountered an out of memory exception. Unfortunately, debugging the code is not an option, as this is occurring at a customer site. So, before looking into a overhaul of our code, I would like to ask: what i...
stackexchange/codereview
I'm trying to debug an application (under PostgreSQL) and came across the following error: "current transaction is aborted, commands ignored". As far as I can understand a "transaction" is just a notion related to the underlying database connection. If the connection has an auto commit "false", you can execute queries ...
stackexchange/codereview
We have recently migrated a large, high demand web application to Tomcat 5.5 from Tomcat 4 and have noticed some peculiar slowdown behavior that appears to be related to JVM pauses. In order to run our application and support increased load over time on Tomcat 4, many not so standard JVM parameters were set and tuned ...
stackexchange/codereview
Rather than population said DOM object with an external page such as HTML CFM or PHP, what if I simply want to send text? I've tried: $("#myDOMObject").val("some text"); No errors, but the object value doesn't update either.
stackexchange/codereview
What's a good way for an IE hosted .net user control (e.g., < object classid="myctrl.dll#init">) to pull down an unmanaged dll for it to use? For Click-once, this is easy with a manifest, but ie hosted controls don't get installed in the click-once app cache and instead run out of the download cache. Copy the dll th...
stackexchange/codereview