instruction_seed
stringlengths
1
35.8k
_source
stringclasses
1 value
I have a JSP that allows users to dynamically create additional form fields to create multiple objects. Perhaps I want to allow users to be able to submit as many line items as they want when submitting an invoice form. How do I create a Struts 2 Action that will be able to take in an ArrayList populated with objects c...
stackexchange/codereview
Been using PHP/MySQL for a little while now, and I'm wondering if there are any specific advantages (performance or otherwise) to using mysql_fetch_object() vs mysql_fetch_assoc() / mysql_fetch_array().
stackexchange/codereview
I have created an SSIS package and it works great on my dev machine. But, when I try to run it on the production server, it errors out on me. Here is the error: Error: The AcquireConection method call to the connection manager "DestinationConnectionOLEDB" failed with error code 0xC0202009. I have figured out the caus...
stackexchange/codereview
I'm trying to show someone a use for interfaces in a crazy situation they've created. They have several unrelated objects in lists, and need to perform an operation on two string properties in each object. I'm pointing out that if they define the properties as part of an interface, they can use the interface object a...
stackexchange/codereview
At my last place of employment, I used BTS quite a bit. However, I've noticed that managers often want to use it for the wrong things, and developers are hesitant to adopt it. So, I'm just wondering, how's BTS being used? Please post experiences, not theories. Thanks!
stackexchange/codereview
Is there a way to assign a process to a core (or more than one core) on a multi-core system running Windows XP? An answer using a GUI is acceptable.
stackexchange/codereview
I have a server access log, with timestamps of each http request, I'd like to obtain a count of the number of requests at each second. Using sed, and cut -c, so far I've managed to cut the file down to just the timestamps, such as: 22-Sep-2008 20:00:21 +0000 22-Sep-2008 20:00:22 +0000 22-Sep-2008 20:00:22 +0000 ...
stackexchange/codereview
Is it possible to do something like this? var pattern = /some regex segment/ + /* comment here */ /another segment/; Or do I have to use new RegExp() syntax and concatenate a string? I'd prefer to use the literal as the code is both more self-evident and concise.
stackexchange/codereview
Is it really advantageous to move to Rake from ant? Anyone migrated from ant and find something monumental? FYI: Current environment is Ant for J2ME builds
stackexchange/codereview
I need to find occurrences of "(+)" in my sql scripts, (i.e., Oracle outer join expressions). Realizing that "+", "(", and ")" are all special regex characters, I tried: grep "\(\+\)" * Now this does return occurrences of "(+)", but other lines as well. (Seemingly anything with open and close parens on the same line....
stackexchange/codereview
I am working on a project that resizes images using PHP's GD library. I would like to be able to add the option to use seam carving to resize images but don't want to require something like ImageMagick (which can do seam carving with its liquid rescale feature) to accomplish this. Since there are no built-in seam carvi...
stackexchange/codereview
What I'm trying to do is encode a gif file, to include in an XML document. This is what I have now, but it doesn't seem to work. Function gifToBase64(strGifFilename) On Error Resume Next Dim strBase64 Set inputStream = WScript.CreateObject("ADODB.Stream") inputStream.LoadFromFile strGifFilename strBase64 = inputSt...
stackexchange/codereview
I have 7-8 xml files. Each one is approximately 50 MB in size. What is the best way to merge files programmatically in C# without getting System.OutOfMemory Exception? So far I have tried reading each file in a StringBuilder and than putting it in an array of string builder but I still get system.outofmemoery exceptio...
stackexchange/codereview
I'm slowly getting back into PHP, and now I run into a problem, I want to install some web software on our host and I need to have either the latest Zend (which they don't have) or IonCube on the server and IonCube requires enable_dl to be on in the php.ini. Now a colleague of mine thinks I can update this via an .htac...
stackexchange/codereview
When you want to add whitespace between HTML elements (using CSS), to which element do you attach it? I'm regularly in situations along these lines: <body> <h1>This is the heading</h1> <p>This is a paragraph</p> <h1>Here's another heading</h1> <div>This is a footer</div> </body> Now, say I wanted 1em of space ...
stackexchange/codereview
Is there a component available list FileUpload which shows files on the server, not the client? I am basically looking for a clean dialog box to select server side files, like the one used in FileUpload.
stackexchange/codereview
When stepping a program in Delphi 7, the CPU window sometimes pops up and then steps through that instructions. I find this an annoyance as I wish to only step Pascal Code. Does anyone know how to disable this CPU pop-up? I would not be sorry if this window never ever shows. It did not happen on Delphi 5 which was m...
stackexchange/codereview
We're working on a rich client (written in Flex) that is connected to a Java backend, using both RMI and JMS. I was thinking about implementing the client in a DDD fashion so that it has Repositories for the CRUD operations on the domain objects. The problem is however that all backend communication happens asynchronou...
stackexchange/codereview
There are situations, where it is practical to have a type-cast return a null value instead of throwing a ClassCastException. C# has the as operator to do this. Is there something equivalent available in Java so you don't have to explicitly check for the ClassCastException?
stackexchange/codereview
Will .Net 4.0 use a new version of the CLR (v2.1, 3.0) or will it stick with the existing v2.0? Supplementary: Is it possibly going to keep with CLR v2.0 and add DLR v1.0? Update: Whilst this might look like a speculative question which cannot be answered, the VS team appear to be releasing more and more info on VS10 a...
stackexchange/codereview
I need to install some .NET software on several PC's. This software needs to check each time it is restarted to see if a newer version exists on the server. The end users will have basic user rights and therefore cannot copy files to the 'Program Files' directory. If a newer version exists, the application closes, an u...
stackexchange/codereview
I'm writing a function that gets the path environment variable of a system, splits up each path, then concats on some other extra characters onto the end of each path. Everything works fine until I use the strcat() function (see code below). char* prependPath( char* exeName ) { char* path = getenv("PATH"); ch...
stackexchange/codereview
Is there a secure way of logging into a Gmail account on a web browser, from an external Java program? I know the following works, but is there a safer alternative? Desktop.getDesktop().browse(new URI( "https://www.google.com/accounts/ServiceLoginAuth?continue=http://mail.google.com/gmail" + "&service=m...
stackexchange/codereview
In terms of quick dynamically typed languages, I'm really starting to like Javascript, as I use it a lot for web projects, especially because it uses the same syntax as Actionscript (flash). It would be an ideal language for shell scripting, making it easier to move code from the front and back end of a site, and less ...
stackexchange/codereview
Several years back, I innocently tried to write a little app to save my tactically placed desktop icons because I was sick of dragging them back to their locations when some event reset them. I gave up after buring WAY too much time having failed to find a way to query, much less save and reset, my icons' desktop posi...
stackexchange/codereview
For example, imagine a simple mutator that takes a single boolean parameter: void SetValue(const bool b) { my_val_ = b; } Does that const actually have any impact? Personally I opt to use it extensively, including parameters, but in this case I wonder if it makes any difference. I was also surprised to learn that you ...
stackexchange/codereview
Say I have a table in a SQL 2005 database with 2,000,000+ records and a few indexes. What advantage is there to using index hints in my queries? Are there ever disadvantages to using index hints in queries?
stackexchange/codereview
How do I loop into all the resources in the resourcemanager? Ie: foreach (string resource in ResourceManager) //Do something with the recource. Thanks
stackexchange/codereview
I need to create a user control in either vb.net or c# to search a RightNow CRM database. I have the documentation on their XML API, but I'm not sure how to post to their parser and then catch the return data and display it on the page. Any sample code would be greatly appreciated! Link to API: http://community.rightno...
stackexchange/codereview
Anybody knows what is mobile capability for render Meta Tags for each adapter? I am using Marg.Wurfl to detect mobile device, and it maps wurfl capabilities to mobile capabilities, but it does not render meta tags.I have found requiresXhtmlCssSuppression capability in ASP.NET Mobile Controls XHTML Adapter Source, but i...
stackexchange/codereview
What is the ideal code to logging ratio? I'm not used to writing logs as most of the applications I've developed have not had much logging. Recently though I've changed job, and I've noticed that you can't see the application code for the calls to log4net. I appreciate that this is useful but surely having too many deb...
stackexchange/codereview
I have a page that contains a form. This page is served with content type text/html;charset=utf-8. I need to submit this form to server using ISO-8859-1 character encoding. Is this possible with Internet Explorer? Setting accept-charset attribute to form element, like this, works for Firefox, Opera etc. but not for IE....
stackexchange/codereview
I'm trying to get started writing some Ruby on Rails apps and have been successful with Mongrel but, I'd like to deploy my apps to my Apache 2.2 instance on Windows? All the tutorials I've found seem out of date and are for older versions of Apache/Rails. Does anyone know of a good, current tutorial for configuring Ap...
stackexchange/codereview
Does anybody know of an up to date tutorial on using Ajax with ASP.net MVC? Most of what I can find seems to talk about older versions of MVC and I suspect that this is an area where there has been a lot of change of late.
stackexchange/codereview
Whenever I'm at a break point in a certain C#.NET application in Visual Studio 2008 and I fire up Microsoft Word 2007, word will fail to open until I restart the C# application. I have a few theories about why, but does anyone know for sure?
stackexchange/codereview
I have a Winform application built with C# and .Net 2.0. I have a textbox set with the MultiLine property. The problem is when someone writes text with multiple lines (press few enters), presses the save button, and then closes and loads the form again, all the new lines disappear (the text is there at least). For exam...
stackexchange/codereview
Is there a way to deactivate the optimization for collocated objects that Weblogic uses by default for a specific EJB ? EDIT: Some context : We have a scheduler service that runs inside one node of the cluster. This is for historic reasons and cannot be changed at the moment. This service makes call to an EJB and we wo...
stackexchange/codereview
I want to use data binding with an XML document to populate a simple form that shows details about a list of people. I've got it all set up and working like so right now: <Window x:Class="DataBindingSample.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/w...
stackexchange/codereview
I am having trouble grabbing the values from the form once processed. I need your help. function updateUser($table, $id) { if($_POST) { processUpdate($table, $id); } else { updateForm($table, $id); } } function processUpdate($table, $id) { print $table; //testing print $id; //testi...
stackexchange/codereview
Is there an easy way to cache things when using urllib2 that I am over-looking, or do I have to roll my own?
stackexchange/codereview
I have a DataGridView with several created columns. I've add some rows and they get displayed correctly; however, when I click on a cell, the content disappears. What am I doing wrong? The code is as follows: foreach (SaleItem item in this.Invoice.SaleItems) { DataGridViewRow row = new DataGridViewRow(); gridVi...
stackexchange/codereview
I need to call an external dll from c#. This is the header definition: enum WatchMode { WATCH_MODE_SYSTEM = 0, WATCH_MODE_APPLICATION = 1 }; LONG ADS_API WDT_GetMode ( LONG i_hHandle, WatchMode * o_pWatchMode ); I've added the enum and the call in C#: public enum WatchMode { WATCH_MODE_SYSTEM ...
stackexchange/codereview
I have a function, parseQuery, that parses a SQL query into an abstract representation of that query. I'm about to write a function that takes an abstract representation of a query and returns a SQL query string. What should I call the second function?
stackexchange/codereview
If I have no connection to internet, does that mean I can't start IDLE (which comes with python 3.0)?
stackexchange/codereview
I have a value and I known that it's units is metersmn/md * kgkn/kd * ssn/sd * KKn/Kd * AAn/Ad Note: the exponents are rational, units of m0.5 are valid The question is how to pick how to break down the units into something more compact for instance if md=kd=sd=Kd=Ad=1 mn=Kn=An=0 kn=1 sn=-1 I can use N/m I suspect t...
stackexchange/codereview
Ok, so I have an nHibernate ICriteria that returns an object. I want to order by a single property but NOT asc or desc I want certain values of the property to come to the top of the repeater based on the selection. Like if I choose "video" I want all records with videos to come to the top. Now, can I do this in the q...
stackexchange/codereview
Like the title says Where and How (i.e. if encrypted, with what method) does Windows XP store WEP/WPA Keys?
stackexchange/codereview
I need to generate random numbers in the range 1 - 10000 continuously with out duplication. Any recommendations? Description: we are building a new version for our application, which maintains records in Sqlite DB. in the last version of our application, we did not had unique key for each record. But now with new upgr...
stackexchange/codereview
I want to create a collection in VB.NET, but I only want it to accept objects of a certain type. For example, I want to create a class called "FooCollection" that acts like a collection in every way, but only accepts objects of type "Foo". I thought I could do this using generics, using the following syntax: Public...
stackexchange/codereview
Is there any easier solution in porting a windows manual-reset event to pthread, than a pthread conditional-variable + pthread mutex + a flag if event is set or unset?
stackexchange/codereview
Let's say I have to implement a piece of T-SQL code that must return a table as result. I can implement a table-valued function or else a stored procedure that returns a set of rows. What should I use? In short, what I want to know is: Which are the main differences between functions and stored procedures? What consid...
stackexchange/codereview
For example, Reductio (for Java/Scala) and QuickCheck (for Haskell). The kind of framework I'm thinking of would provide "generators" for built-in data types and allow the programmer to define new generators. Then, the programmer would define a test method that asserts some property, taking variables of the appropria...
stackexchange/codereview
I am having issues with validators not firing (No expected error messages showing) when using Page.Validate() from code behind. The validators are placed inside an Ajax updatepanel. It seems there are downloadable Ajax versions of the validators. I am not sure if I need these or if VS 2008 SP1 has them already. When th...
stackexchange/codereview
What do you think is a good IDE for learning SmallTalk? I'll only be using it as a hobby, so it has to be free.
stackexchange/codereview
Are there any tools available to log the page load time for a php site? Mainly looking for something that I can see trends of load times over time, I was considering dumping them into a file using error_log(), but I don't know what I could use to parse it and display graphs
stackexchange/codereview
This SELECT * FROM SOME_TABLE WHERE SOME_FIELD LIKE '%some_value%'; is slower than this SELECT * FROM SOME_TABLE WHERE SOME_FIELD = 'some_value'; but what about this? SELECT * FROM SOME_TABLE WHERE SOME_FIELD LIKE 'some_value'; My testing indicates the second and third examples are exactly the same. If that's true,...
stackexchange/codereview
I'm refactoring "spaghetti code" C module to work in multitasking (RTOS) environment. Now, there are very long functions and many unnecessary global variables. When I try to replace global variables that exists only in one function with locals, I get into dilemma. Every global variable is behave like local "static" - e...
stackexchange/codereview
I am using a popup menu in Delphi. I want to use it in a "radio group" fashion where if the user selects an item it is checked and the other items are not checked. I tried using the AutoCheck property, but this allows multiple items to be checked. Is there a way to set the popup menu so that only one item can be che...
stackexchange/codereview
This is a pretty straight forward attempt. I haven't been using python for too long. Seems to work but I am sure I have much to learn. Someone let me know if I am way off here. Needs to find patterns, write the first line which matches, and then add a summary message for remaining consecutive lines which match pattern ...
stackexchange/codereview
Is there a way to view a SVG from either a file or webpage dynamically using Silver light or flash? Edit: I am currently converting them on the server using inkscape. The only trouble with this is the time it takes to make all 60+ pages of the catalog is a little slow. It take 5 min to make it, and some customers (b...
stackexchange/codereview
I have an application - more like a utility - that sits in a corner and updates two different databases periodically. It is a little standalone app that has been built with a Spring Application Context. The context has two Hibernate Session Factories configured in it, in turn using Commons DBCP data sources configured...
stackexchange/codereview
Java supplies standard User Interface guidelines for applications built using Java Swing. The basic guidelines are good, but I really feel the look and feel is really boring and outdated. Is anyone aware of a publicly available Java User Interface Guide that has better look & feel guidelines than the Sun provided guid...
stackexchange/codereview
I have a UserControl (Composite control) that can be shown as the following pseudo XAML code: <UserControl> <DockPanel> <TextBox /> <Button /> </DockPanel> </UserControl> I use this custom control in a bunch of places and style some of them with a WPF Style. This style sets the Background property of the U...
stackexchange/codereview
I fear this is probably a bit of a dummy question, but it has me pretty stumped. I'm looking for the simplest way possible to pass a method of an object into a procedure, so that the procedure can call the object's method (e.g. after a timeout, or maybe in a different thread). So basically I want to: Capture a refere...
stackexchange/codereview
I am writing Eclipse plugins where there are quite a few running jobs. In some cases, I want the job to "sleep" for a while at the current point of execution and continue from that spot (rather than reschedule the job and start it from scratch). My understanding is that using Thread.sleep within Eclipse jobs is quite d...
stackexchange/codereview
I know it's a long shot, but is there some package or means to insert emoticons into a LaTeX document?
stackexchange/codereview
Is there a way to get the C/C++ preprocessor or a template or such to mangle/hash the __FILE__ and __LINE__ and perhaps some other external input like a build-number into a single short number that can be quoted in logs or error messages? (The intention would be to be able to reverse it (to a list of candidates if its ...
stackexchange/codereview
I have been googling for a good time on how to move a file with c# using the TFS API. The idea is to have a folder on which the developers drop database upgrade scripts and the build process get's to the folder creates a build script and moves all the files on the folder to a new folder with the database build version ...
stackexchange/codereview
We have a two-screen DirectX application that previously ran at a consistent 60 FPS (the monitors' sync rate) using a NVIDIA 8400GS (256MB). However, when we swapped out the card for one with 512 MB of RAM the frame rate struggles to get above 40 FPS. (It only gets this high because we're using triple-buffering.) The t...
stackexchange/codereview
Anybody know a nice way to restart a mongrel cluster via capistrano in a "rolling" style, eg, one mongrel at a time. Would be great to have a bit of wait time in there as well for each, to let the mongrel load the rails app up as well. I've done some searching, and haven't found too much, so looking for help before I ...
stackexchange/codereview
I've installed the MSDN Library for Visual Studio 2008 SP1, however, dynamic help in Visual Studio still spawns the RTM Document Explorer. Anyone know how to change it to the SP1 version?
stackexchange/codereview
We have created a web application, using ASP.NET, that allows users to upload documents and attach them to business entities, like customers, contacts and so on. The application runs on the intranet and all files are uploaded through the web application into a shared folder on the server. I would like, right from the ...
stackexchange/codereview
I am using sybase database to query the daily transaction report. I had subquery within my script. Here as it goes: SELECT orders.accountid ,items.x,etc (SELECT charges.mistotal FROM charges where items.id = charges.id) FROM items,orders WHERE date = '2008-10-02' Here I am getting the error message as: Subquery cann...
stackexchange/codereview
Which family should I start to learn? (Never did any programming on microcontroller)
stackexchange/codereview
I need to use InstallUtil to install a C# windows service. I need to set the service logon credentials (username and password). All of this needs to be done silently. Is there are way to do something like this: installutil.exe myservice.exe /customarg1=username /customarg2=password
stackexchange/codereview
Is it possible to sign only part of an applet? Ie, have an applet that pops up no security warnings about being signed, but if some particular function is used (that requires privileges) then use the signed jar? From what I can tell, some (perhaps most) browsers will pop up the warning for a signed applet even if you ...
stackexchange/codereview
I learned to use "exists" instead of "in". BAD select * from table where nameid in ( select nameid from othertable where otherdesc = 'SomeDesc' ) GOOD select * from table t where exists ( select nameid from othertable o where t.nameid = o.nameid and otherdesc = 'SomeDesc' ) The explanation was: ...
stackexchange/codereview
Why am I getting a textbox that returns undefined list of variables? When I run this code: var query = (from tisa in db.TA_Info_Step_Archives where tisa.ta_Serial.ToString().StartsWith(prefixText) select tisa.TA_Serial.ToString()).Distinct().Take(Convert.ToInt32(count)); return query....
stackexchange/codereview
What are some best practices to orchestrate the interaction between complex components that are in your View? I'm not talking about simple widgets like a combo box or a grid control but components that are made up of multiple widgets and that may deserve being unit tested on their own. Would you: Define abstract inter...
stackexchange/codereview
Those of us who use multiple languages to solve problems can combine them in a lot of ways. Personally I use PL/SQL, XSLT, JavaScript, and Java plus the pseudo languages HTML, XML, CSS, Ant, and Bash. What do you use?
stackexchange/codereview
Is it possible to use system.currency. It says system.currency is inaccessible due to its protection level. what is the alternative of currency.
stackexchange/codereview
I was wondering if there was a .NET-compatible CLR that was implemented using the CLI (common language infrastructure), e.g., using .NET itself, or at least if there were any resources that would help with building one. Basically, something like a .NET program that loads assemblies as MemoryStreams, parses the bytecode...
stackexchange/codereview
I'd like my .exe to have access to a resource string with my svn version. I can type this in by hand, but I'd prefer an automated way to embed this at compile time. Is there any such capability in Visual Studio 2008?
stackexchange/codereview
Using the AddHandler method, if I never use RemoveHandler, will that lead to memory leaks in some conditions and situations? I'm not so sure about the truth of this. And are there other causes to memory leaks that are solely available in VB as opposed to C#?
stackexchange/codereview
What's your preferred method of providing a search facility on a website? Currently I prefer to use Lucene.net over Indexing Service / SQL Server full-text search (as there's nothing to set up server-side), but what other ways are being used out there?
stackexchange/codereview
I was writing a (seemingly) straight-forward SQL snippet that drops a column after it makes sure the column exists. The problem: if the column does NOT exist, the code inside the IF clause complains that it can't find the column! Well, doh, that's why it's inside the IF clause! So my question is, why does a piece of co...
stackexchange/codereview
I need to dynamically construct an XPath query for an element attribute, where the attribute value is provided by the user. I'm unsure how to go about cleaning or sanitizing this value to prevent the XPath equivalent of a SQL injection attack. For example (in PHP): <?php function xPathQuery($attr) { $xml = simple...
stackexchange/codereview
Modules or software solutions for generating English pronounceable passwords? Are there similar modules for other languages? -Adam
stackexchange/codereview
I use a structure of function pointers to implement an interface for different backends. The signatures are very different, but the return values are almost all void, void * or int. struct my_interface { void (*func_a)(int i); void *(*func_b)(const char *bla); ... int (*func_z)(char foo); }; But it...
stackexchange/codereview
I've been learning CSS for a while now, but the simplified layout below is still a little beyond me, so I am asking whether anyone knows of a model for such a layout, or would have an explanation to make this work. The page should have 3 bands or blocks: header, bottom, and content. The 'header' would start at left 0,...
stackexchange/codereview
Can someone please provide an implementation of a C function that gets invoked to dump the current stack? It's for a x86 linux system. It can be invoked in 2 ways: explicitly by another function, or after a crash (probably as a trap/int handler). The output can be either to the screen or to a file, as indicated by a ...
stackexchange/codereview
I had defined a custom content type, and I am trying to define a filtered lookup column. I can select the list from where to pick up the column I need, but I can't find any example of the needed format of query string. I can filter the list manually by appending "?FilterField1=columnName&FilterValue1=myValue" to the li...
stackexchange/codereview
I work with a bunch of sets in order to generate constrained random traffic, but I want to be able to call a Specman macro that computes the complement of a set with syntax like: COMPLEMENT begin domain=[0..10,24..30], complementing_set=[2..3,27..30] end and have it generate: [0..1,4..10,24..26] Every time I ...
stackexchange/codereview
So no doubt that building a domain model is something that I think happens best when you approach it as as team. Even going so far as to involve someone who is not technical and a member of the 'business' in the modeling sessions. So much can get done quickly when you put the right people in a room and hammer out thi...
stackexchange/codereview
If I had a Canvas with n number of Visual objects of any shape or size, how would I highlight/outline a Visual object programmatically? Is there something built into WPF to help me?
stackexchange/codereview
I've got it configured, but I want more from it...maybe Cygwin isn't the right tool, but I like how it provides a *nix-like environment within Windows.
stackexchange/codereview
I have a foxpro app, that contains hard coded path for icons and bitmaps. That's how foxpro does it and there is no way around it. And this works fine, except that when a removable drive has been used but is not connected, and when is connected windows assigns the same letter as hard coded path, when opening any form t...
stackexchange/codereview
I am currently developing a Rails application using a database that was designed before I was aware of Rails existence. I have currently created some migrations to add some new tables and new columns to existing tables. I would like to have the migrations to recreate the full database. Which steps should I follow? Shou...
stackexchange/codereview
How do you keep the spoken languages strings in your program up to date? Is there an inexpensive way? Where can you find people to do the conversions over time?
stackexchange/codereview
What are my options when it comes to implementing page compression is asp.net.Right now I have a custom home grown httpmodule and its not very mature. Google links me to MbCompression. The project has few views and downloads which discourages me a bit. Edit: I am under shared hosting, which limits my access to IIS sett...
stackexchange/codereview