instruction_seed
stringlengths
1
35.8k
_source
stringclasses
1 value
How would I have a JavaScript action that may have some effects on the current page but would also change the URL in the browser so if the user hits reload or bookmark, then the new URL is used? It would also be nice if the back button would reload the original URL. I am trying to record JavaScript state in the URL.
stackexchange/codereview
Is there a best practice when it comes to setting client side "onclick" events when using ASP.Net controls? Simply adding the onclick attribute results in a Visual Studio warning that onclick is not a valid attribute of that control. Adding it during the Page_Load event through codebehind works, but is less clear tha...
stackexchange/codereview
I am creating a decoupled WMI provider in a class library. Everything I have read points towards including something along these lines: [System.ComponentModel.RunInstaller(true)] public class MyApplicationManagementInstaller : DefaultManagementInstaller { } I gather the purpose of this installation is because the Wind...
stackexchange/codereview
Say I have two tables I want to join. Categories: id name ---------- 1 Cars 2 Games 3 Pencils And items: id categoryid itemname --------------------------- 1 1 Ford 2 1 BMW 3 1 VW 4 2 Tetris 5 2 Pong 6 3 Foobar Pencil Fa...
stackexchange/codereview
I have a class that processes a 2 xml files and produces a text file. I would like to write a bunch of unit / integration tests that can individually pass or fail for this class that do the following: For input A and B, generate the output. Compare the contents of the generated file to the contents expected output W...
stackexchange/codereview
I have an Image column (Allow Null = true) in SQL Server 2005. I am using Crystal Reports designer (ver 10.5) that comes with Visual Studio 2008. Crystal sees the column as blob field and puts an image object for the column. When I am trying to limit the record selection by using NOT ISNULL({Employee.Picture}) as ...
stackexchange/codereview
Besides the dynamic nature of Python (and the syntax), what are some of the major features of the Python language that Java doesn't have, and vice versa?
stackexchange/codereview
I'm using hibernate validator framework with Spring. A class implementing the Spring Validator validates objects with Hibernate's ClassValidator. To localize ClassValidator's error messages I need to pass a ResourceBundle into the class' constructor. My ApplicationCountext has a MessageSource bean (ReloadableResourceBu...
stackexchange/codereview
I am trying to write a Windows Form and ASP.NET C# front-end and MSAccess backend for a pretty small database concept I have. I have written this application once before in just MSAccess but I now need the app and database to be in different places. I have now figured out (thanks to a StackOverflow user) that ADO will...
stackexchange/codereview
I would like to add a typing speed indicator just below the textarea we use on our contact form. It is just for fun and to give the user some interactivity with the page while they are completing the form. It should display the average speed while typing and keep the last average when the keystrokes are idle. When they...
stackexchange/codereview
I have a webapp that segfaults when the database in restarted and it tries to use the old connections. Running it under gdb --args apache -X leads to the following output: Program received signal SIGSEGV, Segmentation fault. [Switching to Thread -1212868928 (LWP 16098)] 0xb7471c20 in mysql_send_query () from /usr/lib/l...
stackexchange/codereview
I need to put video playback to my game, and the video must be in a texture so that it is played inside the game world. I am using Java (Java3D, JOGL). Any idea on how I can do this?
stackexchange/codereview
If you had to iterate through a loop 7 times, would you use: for (int i = 0; i < 7; i++) or: for (int i = 0; i <= 6; i++) There are two considerations: performance readability For performance I'm assuming Java or C#. Does it matter if "less than" or "less than or equal to" is used? If you have insight for a diff...
stackexchange/codereview
I have a BulletedList in asp.net that is set to DisplayMode="LinkButton". I would like to trigger the first "bullet" from a javascript, can this be done? And if so, how?
stackexchange/codereview
If I open a file using urllib2, like so: remotefile = urllib2.urlopen('http://example.com/somefile.zip') Is there an easy way to get the file name other then parsing the original URL? EDIT: changed openfile to urlopen... not sure how that happened. EDIT2: I ended up using: filename = url.split('/')[-1].split('#')[0].s...
stackexchange/codereview
Is there any free hosting for Javascript? Recently google has been hosting jQuery,etc... and Yahoo hosts it's YUI, which is great, but it'd be even better if there was a service that could host user scripts and things like that. Any ideas?
stackexchange/codereview
I'd like to do some basic profiling of my code, but found that the DateTime.Now in C# only have a resolution of about 16 ms. There must be better time keeping constructs that I haven't yet found.
stackexchange/codereview
I am used to TYPO3 where I just can upload an image within the content element an then just determine the size an so on. Is there a way to handle images in drupal somehow like this?
stackexchange/codereview
When reading my RSS feed with the Thunderbird feed reader, some entries are duplicated. Google Reader does not have the same problem. Here is the faulty feed: http://plcoder.net/rss.php?rss=Blog There is a problem, but where? I added a GUID, but the problem remains. Other feeds do not duplicate like mine, so I will do ...
stackexchange/codereview
I have an application that seems to throw exceptions only after the program has been closed. And it is very inconsistent. (We all know how fun inconsistent bugs are...) My guess is there is an error during the clean up process. But these memory read/write errors seem to indicate something wrong in my "unsafe" code us...
stackexchange/codereview
I have a class holding complex scientific computations. It is set up to only allow a user to create a properly instantiated case. To properly test the code, however, requires setting internal state variables directly, since the reference documents supply this data in their test cases. Done improperly, however, it ca...
stackexchange/codereview
I'd like to be able to add a class to images that adds a border that makes them look like a stack of photos. Anyone know how to do this? Clarifications: Ideally something like the stack shown here but it doesn't need to be interactive and only needs to work for a single photo. I also don't mind using javascript if ne...
stackexchange/codereview
Given : Group hasMany Persons but the relationship is independent (ie. Persons can exist without belonging to a Group), should the foreign key in the persons' table (ie group_id) be set to 0 (or NULL) when deleting a group? If you do not, the person will try to belong to a group that doesn't exist. The reason I ask...
stackexchange/codereview
I've got a really odd error message that only occurs when I add the following line to my project: std::list<CRect> myVar; It's worth noting that it doesn't have to be a std::list, it can be std::vector or any other STL container I assume. Here is the error message: Error 1 error LNK2005: "public: __thiscall std::li...
stackexchange/codereview
I encountered the following ddl in a pl/sql script this morning: create index genuser.idx$$_0bdd0011 ... My initial thought was that the index name was generated by a tool...but I'm also not a pl/sql superstar so I could very well be incorrect. Does the double dollar sign have any special significance in this statement...
stackexchange/codereview
I have a bunch of tasks in a MySQL database, and one of the fields is "deadline date". Not every task has to have to a deadline date. I'd like to use SQL to sort the tasks by deadline date, but put the ones without a deadline date in the back of the result set. As it is now, the null dates show up first, then the rest ...
stackexchange/codereview
short: Is there a way in Ruby to DRY-ify this: def entry_point_one begin do_something rescue MySyntaxErrorOne, MySyntaxErrorTwo, MySyntaxErrorEtc => syn_err raise syn_err.exception(syn_err.message) end end def entry_point_two begin do_something_else rescue MySyntaxErrorOne, MySyntaxErrorTwo, MySy...
stackexchange/codereview
I have a set of objects in a Vector from which I'd like to select a random subset (e.g. 100 items coming back; pick 5 randomly). In my first (very hasty) pass I did an extremely simple and perhaps overly clever solution: Vector itemsVector = getItems(); Collections.shuffle(itemsVector); itemsVector.setSize(5); While ...
stackexchange/codereview
This question is similar to my earlier question. I have used ASP .Net in Visual Studio 2005 about 4 years ago. How long would it take to get back up to speed with the latest versions?
stackexchange/codereview
Syntax Shorthand for the ready-event by roosteronacid Line breaks and chainability by roosteronacid Nesting filters by Nathan Long Cache a collection and execute commands on the same line by roosteronacid Contains selector by roosteronacid Defining properties at element creation by roosteronacid Access jQuery function...
stackexchange/codereview
I am trying to find all matches in a string that begins with | |. I have tried: if ($line =~ m/^\\\|\s\\\|/) which didn't work. Any ideas?
stackexchange/codereview
I'm creating a generic class and in one of the methods I need to know the Class of the generic type currently in use. The reason is that one of the method's I call expects this as an argument. Example: public class MyGenericClass<T> { public void doSomething() { // Snip... // Call to a 3rd party lib T bea...
stackexchange/codereview
I am trying to store an xml value in my app.config file. The app.config does not like this and I cannot use the <![CDATA[ construct to ignore the XML'ness of my value. Is there a way to do it? Value example:<FieldRef Name='LinkfileName' Nullable='True'/><FieldRef Name='Web' Nullable='True'/>
stackexchange/codereview
I have a photo website and i want to support tags as my original category bucketing is starting to fail (some pictures are family and vacations, or school and friends). Is there an agreed tagging db schema? I still want to support having photos as part of an album. Right now i have a few tables: Photos PhotoID Phot...
stackexchange/codereview
I'd like to eliminate dependencies on hardcoded paths for configuration data in my Java apps, I understand that using ResourceBundle will help me use the classloader to find resources. Can someone tell me how I would replace a hardcoded path to a resource (say a .properties configuration data file required by a class) ...
stackexchange/codereview
I am supposed to provide my users a really simple way of capturing video clips out of my OpenGL application's main window. I am thinking of adding buttons and/or keyboard shortcuts for starting and stopping the capture; when starting, I could ask for a filename and other options, if any. It has to run in Windows (XP/Vi...
stackexchange/codereview
I've seen a few sites that list related searches when you perform a search, namely they suggest other search queries you may be interested in. I'm wondering the best way to model this in a medium-sized site (not enough traffic to rely on visitor stats to infer relationships). My initial thought is to store the top 10 r...
stackexchange/codereview
I am doing .net programming in addition to c and c++ development and want more flexibility on my home machine. I want to be able to have both Linux (probably Ubuntu) and Windows Vista on my home computer. Is there a way I can install both and on boot be prompted for which one to start? Is there a way to set Windows ...
stackexchange/codereview
I have fname and lname in my database, and a name could be stored as JOHN DOE or john DOE or JoHN dOE, but ultimately I want to display it as John Doe fname being John and lname being Doe
stackexchange/codereview
The rails scirpt script/performance/request require a session script, what is the best way to generate this session script?
stackexchange/codereview
I've been searching and can't find the download files on opengl.org. can someone please point me to the right direction?
stackexchange/codereview
I need help logging errors from T-SQL in SQL Server 2000. We need to log errors that we trap, but are having trouble getting the same information we would have had sitting in front of SQL Server Management Studio. I can get a message without any argument substitution like this: SELECT MSG.description from master.dbo.s...
stackexchange/codereview
This request is based in MS Access VBA. I would like to know what the most efficient way is, to see if an item exists in a listbox control.
stackexchange/codereview
Can anyone point me to a good, simple, example of a Google API (AJAX Search API I suppose?) that can be implemented in VB.net (2008)? I have tried to sign up for a Google API key but it wants a URL from which the search will be executed from. I dont have a URL for this example. I tried http://localhost but then was...
stackexchange/codereview
I'm trying to wrap my head around SharePoint. Why is it good? Why is it bad? At a glance it appears to offer some incredible collaboration tools. However, the cost looks astronomical and it seems to be rigid & difficult to customize. To those who've worked with SharePoint; please describe something good and somethin...
stackexchange/codereview
I want to copy and paste text from a Office 2007 document (docx) into a textarea. On Window, using Firefox 3, there is additional jiberish that gets put into the field: ...Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4 Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer...
stackexchange/codereview
I have a class which is designed to spin up a background thread, from which calls will be made into a manager. This manager will be mocked for the purposes of unit test. The relevant fragment of code is: MockRepository mocks = new MockRepository(); ICacheManager manager = mocks.CreateMock<ICacheManager>(); Expect.On(...
stackexchange/codereview
Here is what I have: context "Create ingredient from string" do context "1 cups butter" do setup do @ingredient = Ingredient.create(:ingredient_string => "1 cups butter") end should "return unit" do assert_equal @ingredient.unit, 'cups' end ...
stackexchange/codereview
What's the best way to maintain a multiple databases across several platforms (Windows, Linux, Mac OS X and Solaris) and keep them in sync with one another? I've tried several different programs and nothing seems to work!
stackexchange/codereview
Is there any way (maybe directly editing resource files) to configure a Tab Control (add/remove tabs and their captions and contents) at design time with Visual Studio 2008 without SP1 (I heard that SP1 has such feature)? P.S.: I use c++ with wtl
stackexchange/codereview
I'm attempting to use extension methods to add an operater overload to the C# StringBuilder class. Specifically, given StringBuilder sb, I'd like sb += "text" to become equivalent to sb.Append("text"). Here's the syntax for creating an extension method for StringBuilder: public static class sbExtensions { public s...
stackexchange/codereview
When an ASP.NET application is running under IIS6.0 in Windows 2003 Server with impersonation, what user account is relevant for deciding file read/write/execute access privileges? I have two scenarios where I am trying to understand what access to grant/revoke. I thought the most relevant user is probably the identi...
stackexchange/codereview
I have a project that I'm working on and I need to be able to print out ID cards from the program. Are there any products out there that are reasonably priced so I can design a document for print and use it in .NET? I'm trying to avoid using System.Drawing from having to do it manually because when the company I work f...
stackexchange/codereview
On a server I have to take care of, errors from a vhost do not go to the standard PHP error log. In the php.ini we have log = /var/log/file and phpinfo() does not show any difference between the vhost and the whole server. But the callback function set up by set_error_handler() catches errors which are not in the ph...
stackexchange/codereview
I know what MVC is and I work in webforms but I don't know how MVC will be that much different. I guess the code behind model will be different. So will it be like webforms minus the code behind and instead having it in a controller? I see there are other related posts but I don't they address this.
stackexchange/codereview
JyDT is a good Jython Eclipse plugin. However, it doesn't allow Jython debugging in the Debug perspective. Jython provides a command-line debugger (Pdb) but it operates outside Eclipse.
stackexchange/codereview
I have a very interesting problem on my LinqToSql model. On some of my tables i have a references to other tables and in LinqToSql this is represented by a EnitiyRef class, when you are trying to access the references table LinqToSql will load the reference from the database. On my development machine everything worked...
stackexchange/codereview
I'm trying to setup some friendly URLs on a SharePoint website. I know that I can do the ASP.Net 2.0 friendly URLs using RewritePath, but I was wondering if it was possible to make use of the System.Web.Routing that comes with ASP.NET 3.5 SP1. I think I've figured out how to get my route table loaded, but I'm not clea...
stackexchange/codereview
I have several properties that are dependent on the environment the application is running. For example, there are links to another application that is being developed concurrantly that get displayed in the header and footer. I want those links to be different depending on what environment they are in. This is slightl...
stackexchange/codereview
I need to create a news ticker that is updated via an RSS feed. Any ideas on how to implement this? I would prefer Javascript but any language is acceptable.
stackexchange/codereview
I really don't like the VS2008 Start Page. I don't need the RSS reader, Getting started or Headlines. The only thing useful is "Recent Projects" Is there a way to customize it or replace with a better one? It will be nice that the page contains Favorites Projects and Recent projects. P.S. I know that I can disabled it ...
stackexchange/codereview
C++ preprocessor #define is totally different. Is the PHP define() any different than just creating a var? define("SETTING", 0); $something = SETTING; vs $setting = 0; $something = $setting;
stackexchange/codereview
I have a legacy VB6 application that was built using MSDE. As many client's database grow towards the MSDE 2 GB limit they are upgraded to SQL 2005 Express. This has proven very successful until today. I have spent the entire day troubleshooting a client's network on which our application runs unacceptably slowly, when...
stackexchange/codereview
If I have two dates (ex. '8/18/2008' and '9/26/2008'), what is the best way to get the number of days between these two dates?
stackexchange/codereview
I have a folder, '/var/unity/conf' with some properties files in it, and I'd like the Caucho's Resin JVM to have that directory on the classpath. What is the best way to modifiy resin.conf so that Resin knows to add this directory to the classpath?
stackexchange/codereview
Using JDK1.5 how does one send a binary attachemnt (such as a PDF file) easily using the JavaMail API?
stackexchange/codereview
I know just the question is a bit of heresey, but I'm curious... Sure, there are the express editions. But when Microsoft is effectively competing for 'hearts and minds' in an OSS world, it seems more than a bit counterproductive to charge devs who wholeheartedly support .NET high subscription fees for Microsoft softwa...
stackexchange/codereview
I want to talk to a flash server which uses RTMP, but I don't want to use Flash, but rather c# or java. I was looking at Red5 but their client API seems to be a bit wobbly. Does anyone have any other ideas?
stackexchange/codereview
the mylyn plugin in Eclipse (Trac connector) contains the option to attach and then retrive the "context" of an issue. Attaching the context results in attaching a zipped XML file to the issue entry in the Trac system. However, I don't quite understand what is this context is. Initially I thought that this was all the ...
stackexchange/codereview
I have been looking at the Model-View-ViewModel pattern that is suggested by several people out there (especially John Gossman, take a look at this post and this podcast), but what other patterns (if any) have people used and liked ... and where do they add value? I have also stumbled across: Model-View-ViewModel Pres...
stackexchange/codereview
Exception Thrown: "System.ComponentModel.ReflectPropertyDescriptor is not marked as Serializable" Does this mean I missed marking something as serializable myself, or is this something beyond my control?
stackexchange/codereview
Since I've joined twitter I have found it very helpful to keep my finger on the pulse of technology and where it is going. I follow many of the top Microsoft developers and find it interesting to see their struggles, opinions, and influences... codinghorror / Jeff Atwood shanselman / Scott Hanselman haacked / Phi...
stackexchange/codereview
The Pragmatic Programmer advocates the use of code generators. Do you create code generators on your projects? If yes, what do you use them for?
stackexchange/codereview
I've written a small service (plain Win32) and I'd like to know if it's possible to run multiple instances of it when multiple users are logged on. Basically, let's say we've got UserA and UserB for UserA the service would log on as "domain\UserA" and for UserB the service would log on as "domain\UserB" - this is from ...
stackexchange/codereview
Is it always possible to ping localhost and it resolves to 127.0.0.1? I know Windows Vista, XP, Ubuntu and Debian do it but does everyone do it?
stackexchange/codereview
Is there any way to embed a widget in a data-bound DataGridViewCell when it is not in editing mode? For example, we are wanting to display an existing calendar widget in a cell. That cell contains a comma separated list of dates. We want to show the calendar instead of the text. We could create a custom cell and ov...
stackexchange/codereview
What's the best way to manage a slew of browser UI tests? I'm looking for an approach that may have worked for you in the past when dealing with numerous automated browser tests. Obvious answers such as "they should be refactored into lower-level UI tests" aren't what I'm looking for. Ultimately these tests are incredi...
stackexchange/codereview
Microsoft recently announced that the Javascript/HTML DOM library jQuery will be integrated into the ASP.NET MVC framework and into ASP.NET / Visual Studio. What is the best practice or strategy adopting jQuery using ASP.NET 2.0? I'd like to prepare a large, existing ASP.NET Web Application (not MVC) for jQuery. How wo...
stackexchange/codereview
I'm trying to consume a SOAP webservice from an Adobe Flex 3 application, but the server tell me "Invalid SOAP Envelope. SOAP Body does not contain a message nor a fault". I already wrote other test clients (with both Delphi and C#) and I'm sure it's all ok on the server side, so I need to examine the SOAP envelope Fle...
stackexchange/codereview
last time I asked how to populate a data structure here. Now I would like to know if there's something in Java, like the print_r I use in PHP, to represent what I have populated in the Maps and lists without having to do my own algorithm. Any ideas?
stackexchange/codereview
If you are creating a 1d array in Python, is there any benefit to using the NumPy package?
stackexchange/codereview
I am going to write a database application for the camp I work for. I am thinking about writing it in C# with a Windows GUI interface but using a browser as the application is seeming more and more appelaing for various reasons. What I am wondering is why someone would not choose to write an application as a web applic...
stackexchange/codereview
We use Spring + Hibernate for a Webapp. This Webapp will be deployed on two unrelated production sites. These two production sites will use the Webapp to generate and use Person data in parallel. What I need to do, is to make sure that the Persons generated on these two unrelated production sites all have distinct PKs,...
stackexchange/codereview
I have a WCF service hosted for internal clients - we have control of all the clients. We will therefore be using a data contracts library to negate the need for proxy generation. I would like to use some readonly properties and have some datacontracts without default constructors. Thanks for your help...
stackexchange/codereview
I have a contract in the offering from a client to develop an intranet application for capturing/manipulating/displaying a fairly complex set of marketing data. I've done this sort of thing before so the analysis, database etc. holds no issues for me, but the client would most likely prefer ASP.NET as they have some (...
stackexchange/codereview
On Linux/NPTL, threads are created as some kind of process. I can see some of my process have a weird cmdline: cat /proc/5590/cmdline hald-addon-storage: polling /dev/scd0 (every 2 sec) Do you have an idea how I could do that for each thread of my process? That would be very helpful for debugging.
stackexchange/codereview
I have an application written in java, and I want to add a flash front end to it. The flash front end will run on the same computer as the java app in the stand alone flash player. I need two way communication between the two parts, and have no idea how to even start going about this. I suppose I could open a socket b...
stackexchange/codereview
We are developing automated regression tests using VMWare and NUnit. We have divided tests into steps and now I would like to see each step be examined for performance regression. Simply timing the tests, as NUnit does, does not seem reliable. I have figured in a acceptance factor of about 15% but our steps can differ ...
stackexchange/codereview
I have this DataTable that has a varying set of columns except for a sequence number. | Sequence | Value | Tax | Duty | Total | Any number of columns should be accepted with unique column names. To display that table, I need to use an ObjectDataSource mapped to a presenter class with a Select method. class Presenter {...
stackexchange/codereview
Background: I am developing a site in Asp.net 2.0 . Up until now i was handling both the design and development of the site. I used css for the design part. Now the company wants to outsource the design work to a web designer. Question: How exactly are a designer and developer supposed to coordinate What specificat...
stackexchange/codereview
Using reflection in .Net, what is the differnce between: if (foo.IsAssignableFrom(typeof(IBar))) And if (foo.GetInterface(typeof(IBar).FullName) != null) Which is more appropriate, why? When could one or the other fail?
stackexchange/codereview
I'm trying to determine if the user is using 24 hour or 12 hour time, and there doesn't seem to be a good way to figure this out other than creating an NSDateFormatter and searching the format string for the period field ('a' character) Here's what I'm doing now: NSDateFormatter *formatter = [[NSDateFormatter alloc] in...
stackexchange/codereview
I'm using the wxGlade designer to generate the GUI for a small application. It generates a class, inherited from wxFrame, which is the main application window. In order to facilitate the maintenance, I'd like to avoid writing additional code in this generated class. But all the widgets created with the wxGlade are actu...
stackexchange/codereview
How to unit test the windows workflows?
stackexchange/codereview
Specifically MSSQL 2005.
stackexchange/codereview
I'm trying to extend the TextBox, ComboBox and Panel controls using IExtenderProvider but I cannot get it to work properly. I'm starting to believe that I haven't understood the concept completely. Does anybody know any good resources on the web (with examples) on how IExtenderProvider is used?
stackexchange/codereview
This is a question for anyone who has the pleasure to work in both Java and C#. Do you find that you have to make a mental context switch of some kind when you move from one to the other? I'm working in both at the moment and because the syntax and libraries are so similar and yet subtly different I'm finding it frustr...
stackexchange/codereview
Suppose some Windows service uses code that wants mapped network drives and no UNC paths. How can I make the drive mapping available to the service's session when the service is started? Logging in as the service user and creating a persistent mapping will not establish the mapping in the context of the actual service....
stackexchange/codereview
Every time I try to create a new project or solution in visual studio (2005 and 2008), I get an error saying, "Project Creation failed." I even tried running vs in administrative mode, but I still get the same answer. Anyone have any suggestions, in short of uninstalling all of VS and reinstalling it?
stackexchange/codereview
Vi and Vim allow for really awesome customization, typically stored inside a .vimrc file. Typical features for a programmer would be syntax highlighting, smart indenting and so on. What other tricks for productive programming have you got, hidden in your .vimrc? I am mostly interested in refactorings, auto classes and ...
stackexchange/codereview