instruction_seed
stringlengths
1
35.8k
_source
stringclasses
1 value
I'm getting a JS error on displaying a page: Nothing concrete is specified but the line where it seems to be thrown. When looking into the source code of the page, I see the error is thrown inside the following script, but I can't understand why! It's only about loading images! <SCRIPT language=JavaScript> <!-- fun...
stackexchange/codereview
What is the difference between Object-Oriented Modeling and Object-Oriented Programming? I overheard a conversation on my subway train this morning and it seems that these things are different. Aren't they?
stackexchange/codereview
We all know that prepared statements are one of the best way of fending of SQL injection attacks. What is the best way of creating a prepared statement with an "IN" clause. Is there an easy way to do this with an unspecified number of values? Take the following query for example. SELECT ID,Column1,Column2 FROM MyTab...
stackexchange/codereview
Need a function that takes a character as a parameter and returns true if it is a letter.
stackexchange/codereview
LRESULT result = ::SendMessage(hWnd, s_MaxGetTaskInterface, (WPARAM)&pUnkReturn, 0); The value of result after the call is 0 I expect it to return with a valid value of pUnkReturn , but it returns with a NULL value . Necessary Information before this call : const UINT CMotionUtils::s_MaxGetTaskInterface = RegisterWi...
stackexchange/codereview
Are .css files always needed? Or may I have a .css "basic" file and define other style items inside the HTML page? Does padding, borders and so on always have to be defined in a .css file that is stored separately, or may I embed then into an HTML page?
stackexchange/codereview
What's the widest overview and where are the deepest analysis of different replication methods and problems?
stackexchange/codereview
I have a problem that confuses my users, being that although an item is highlighted (by the hover style) when the user mouses over it, they have to mouse over the actual item text, sometimes quite small compared to the item. Is there a way to make the whole item clickable?
stackexchange/codereview
We have a large ASP classic code base but I'm looking to do future development in ASP.NET (and potentially in the future port across what we have). The natural choice of language seems to be VB (existing code is VBScript) but am I being too hasty? Does the choice of language, in the long run, even make a difference?
stackexchange/codereview
I'm looking for a good tool to profile a java webapp. I'd like to get performance information and memory usage if possible. Any suggestions?
stackexchange/codereview
I need to generate some passwords, I want to avoid characters that can be confused for each other. Is there a definitive list of characters I should avoid? my current list is il10o8B3Evu![]{} Are there any other pairs of characters that are easy to confuse? for special characters I was going to limit myself to those un...
stackexchange/codereview
so, I'm running Apache on my laptop. If I go to "localhost", I get the page that says, If you can see this, it means that the installation of the Apache web server software on this system was successful. You may now add content to this directory and replace this page. except, I can't add content and replace that pag...
stackexchange/codereview
How can I execute a.exe using the Cygwin shell? I created a C file in Eclipse on Windows and then used Cygwin to navigate to the directory. I called gcc on the C source file and a.exe was produced. I would like to run a.exe.
stackexchange/codereview
I have a table defined (see code snippet below). How can I add a constraint or whatever so that the LastUpdate column is automatically updated anytime the row is changed? CREATE TABLE dbo.Profiles ( UserName varchar(100) NOT NULL, LastUpdate ...
stackexchange/codereview
I recently heard of WSDL.Exe, but I am not sure where to find this program. Does anyone know where I can find or download it?
stackexchange/codereview
I'm wondering, how expensive it is to have many threads in waiting state in java 1.6 x64. To be more specific, I'm writing application which runs across many computers and sends/receives data from one to another. I feel more comfortable to have separate thread for each connected machine and task, like 1) sending data, ...
stackexchange/codereview
In ASP.NET, when storing a value in the application cache with absolute expiry is there a method to retrieve the date/time when the item will expire? The application cache item will be refreshed if expired based on user requests.
stackexchange/codereview
I am using DirectoryInfo.GetDirectories() recursively to find the all the sub-directories under a given path. However, I want to exclude the System folders and there is no clear way for that. In FindFirstFile/FindNextFile things were clearer with the attributes.
stackexchange/codereview
Is there a good object-relational-mapping library for PHP? I know of PDO/ADO, but they seem to only provide abstraction of differences between database vendors not an actual mapping between the domain model and the relational model. I'm looking for a PHP library that functions similarly to the way Hibernate does for J...
stackexchange/codereview
I've sometimes had a problem with my field-, table-, view- oder stored procedure names. Example: SELECT from, to, rate FROM Table1 The Problem is that from is a reserved word in SQL-92. You could put the fieldname in double quotes to fix this, but what if some other db tools wants to read your database? It is your ...
stackexchange/codereview
I've seen several examples of code like this: if not someobj: #do something But I'm wondering why not doing: if someobj == None: #do something Is there any difference? Does one have an advantage over the other?
stackexchange/codereview
I am dynamically compiling code in my client application. When I start the application with Java Web Start I get an exception. The exception only occurs when it is run through Java Web Start. //The exception evolver.core.model.change.execution.ExecutionException: Compilation failed! DynamicComparator.java:2: package e...
stackexchange/codereview
Has anyone experienced issues with Java's default garbage collector while running apps on VmWare instances? I am experiencing issues where full garbage collections are not running as often as I would expect and am curious if the VmWare variable has anything to do with it.
stackexchange/codereview
How do I read a file into a std::string, i.e., read the whole file at once? Text or binary mode should be specified by the caller. The solution should be standard-compliant, portable and efficient. It should not needlessly copy the string's data, and it should avoid reallocations of memory while reading the string. One...
stackexchange/codereview
Is there any way that my script can retrieve metadata values that are declared in its own header? I don't see anything promising in the API, except perhaps GM_getValue(). That would of course involve a special name syntax. I have tried, for example: GM_getValue("@name"). The motivation here is to avoid redundant specif...
stackexchange/codereview
I'm looking for a good way to represent organic growth - especially trees and flowers - using code. I've found Lindenmayer Systems as a reasonable way to portray this, but need a good place to start programming this. Any good suggestions?
stackexchange/codereview
How do I programatically (Using C#) find out what the path is of my My Pictures folder? Does this work on XP and Vista?
stackexchange/codereview
I'd like to show/hide a column at runtime based on a particular condition. I'm using "Print when expression" to conditionally show/hide this column (and it's header) in my report. When the column is hidden, the space it would have occupied is left blank, which is not particularly attractive. I would prefer if the extra...
stackexchange/codereview
I'm not asking about converting a LaTeX document to html. What I'd like to be able to do is have some way to use LaTeX math commands in an html document, and have it appear correctly in a browser. This could be done server or client side.
stackexchange/codereview
How do you organize your Extension Methods? Say if I had extensions for the object class and string class I'm tempted to separate these extension methods into classes IE: public class ObjectExtensions { ... } public class StringExtensions { ... } am I making this too complicated or does this make sense?
stackexchange/codereview
It seems like MS really left a massive gaping hole in their automated testing tools in Visual Studio for web pages with AJAX components and I have been hard pressed to find any commentary or third party add-ons that remedy the problem. Anyone have any advice on automating web tests in MSVS for AJAX pages?
stackexchange/codereview
I've got a situation where I have a DLL I'm creating that uses another third party DLL, but I would prefer to be able to build the third party DLL into my DLL instead of having to keep them both together if possible. This with is C# and .NET 3.5. The way I would like to do this is by storing the third party DLL as an e...
stackexchange/codereview
I use pstack to analyze core dump files in Solaris How else can I analyze the core dump from solaris? What commands can be used to do this? What other information will be available from the dump?
stackexchange/codereview
When a getter returns a property, such as returning a List of other related objects, should that list and it's objects be immutable to prevent code outside of the class, changing the state of those objects, without the main parent object knowing? For example if a Contact object, has a getDetails getter, which returns a...
stackexchange/codereview
The second question is: When do I use what of these two?
stackexchange/codereview
Previously I have asked to strip text from a field and convert it to an int, this works successfully. But now, I would like to do an INNER JOIN on this new value. So I have this: SELECT CONVERT(int, SUBSTRING(accountingTab.id, PATINDEX('%[0-9]%', accountingTab.id), 999)) AS 'memId', userDetails.title, userDetails.lna...
stackexchange/codereview
I'm using VS2005 in a solution with a mix of VB and C# in different projects. I use this solution on several different computers and XML comments with both /// (c#) and ''' (VB) have been fine for months. all of a sudden, on my main development machine, they've stopped working in VB. They still work in C#. They work in...
stackexchange/codereview
How do I generate WSDL from a Web Service in Ruby using Soap4R (SOAP::RPC::StandaloneServer) that would be consumed from .NET?
stackexchange/codereview
I'm still a little unclear and when to wrap a lock around some code. My general rule-of-thumb is to wrap an operation in a lock when it reads or writes to a static variable. But when a static variable is ONLY read (e.g. it's a readonly that is set during type initialization), accessing it doesn't need to be wrapped in...
stackexchange/codereview
Is it worth designing a system to expect test accounts and products to be present and active in production, or should there be no contamination of production databases with test entities, even if your shipping crew knows not to ship any box addressed to "Test Customer"? I've implemented messaging protocols that have a ...
stackexchange/codereview
In an ASP.NET 2.0 website, I have a string representing some well-formed XML. I am currently creating an XmlDocument object with it and running an XSL transformation for display in a Web form. Everything was operating fine until the XML input started to contain namespaces. How can I read in this string and allow name...
stackexchange/codereview
I'm importing a MySQL dump and getting the following error. $ mysql foo < foo.sql ERROR 1153 (08S01) at line 96: Got a packet bigger than 'max_allowed_packet' bytes Apparently there are attachments in the database, which makes for very large inserts. This is on my local machine, a Mac with MySQL 5 installed from the...
stackexchange/codereview
I'm building a widget, and I've been using iframes to present content within it. At some point, I might start serving third party HTML and JS, so I thought iframes would be a good idea. It does make the widget javascript a little more complicated, and I'm concerned that this might not be the best implementation. Do yo...
stackexchange/codereview
I'm trying to get a number of third party applications to work on my Windows Mobile 5 smartphone. I've installed the latest version (3.5) of the Microsoft.NET Compact Framework, but whenever I run the apps I get an error message which states: "This application [Application Name] requires a newer version of the Microsof...
stackexchange/codereview
I have CSV data loaded into a multidimensional array. In this way each "row" is a record and each "column" contains the same type of data. I am using the function below to load my CSV file. function f_parse_csv($file, $longest, $delimiter) { $mdarray = array(); $file = fopen($file, "r"); while ($line = fgetcs...
stackexchange/codereview
Is it possible to do pseudo-streaming(eg start playback at any point) with wmv files and silverlight? This is possible using Flash in a progressive download setup but can it be done on the Microsoft track?
stackexchange/codereview
I have a desktop application (Windows Forms) which my client hosts on a Citrix server. I would like to launch the user's locally configured mail client to send mail from my application. How do I do this? In addition to this, I will need to attach a file to the email before it is sent.
stackexchange/codereview
I have to deal with text files in a motley selection of formats. Here's an example (Columns A and B are tab delimited): A B a Name1=Val1, Name2=Val2, Name3=Val3 b Name1=Val4, Name3=Val5 c Name1=Val6, Name2=Val7, Name3=Val8 The files could have headers or not, have mixed delimiting schemes, have columns with na...
stackexchange/codereview
I have a SharePoint site with multiple lists, some of which have the same fields - a choice of products or countries. How can I build the lists in a way that I configure the choice field once and use it in multiple lists, so that in the future, if I add a value to the choice, I add it only once?
stackexchange/codereview
Working on a somewhat complex page for configuring customers at work. The setup is that there's a main page, which contains various "panels" for various groups of settings. In one case, there's an email address field on the main table and an "export" configuration that controls how emails are sent out. I created a...
stackexchange/codereview
I am redesigning a command line application and am looking for a way to make its use more intuitive. Are there any conventions for the format of parameters passed into a command line application? Or any other method that people have found useful?
stackexchange/codereview
Using eclipse 3.3.2 with MyEclipse installed. For some reason if a file isn't called build.xml then it isnt' recognised as an ant file. The file association for *.xml includes ant and says "locked by 'Ant Buildfile' content type. The run-as menu is broken. Even if the editor association works run-as doesn't. The ant bu...
stackexchange/codereview
I have an IList that contains items ( parent first ), they need to be added to a Diagram Document in the reverse order so that the parent is added last, drawn on top so that it is the first thing to be selected by the user. What's the best way to do it? Something better/more elegant than what I am doing currently which...
stackexchange/codereview
Normal practice is to use case studies, construct work- and data-flows, etc. But this does not necessarily create a shared vocabulary between the user/sponsor and the analyst-designer: one or the other, both normally, will have to acquire terms and views of the "internals" of the others area of expertise, and this usua...
stackexchange/codereview
I just started using SVN, and I have a cache directory that I don't need under source control. How can I ignore the whole directory/folder with SVN? I am using Versions and TextMate on OS X and commandline.
stackexchange/codereview
The following JavaScript supposes to read the popular tags from an XML file and applies the XSL Stylesheet and output to the browser as HTML. function ShowPopularTags() { xml = XMLDocLoad("http://localhost/xml/tags/popular.xml?s=94987898"); xsl = XMLDocLoad("http://localhost/xml/xsl/popular-tags.xsl"); if (win...
stackexchange/codereview
I'd like to increase developers' "comfort level" in our team a bit. We are using Visual Studio 2008 and TortoiseCVS + WinCVS, but no integration as of yet. In your CVS/Visual Studio experience, what is the best integration tool in terms of "supports basic CVS functionality add/diff/update/commit/annotate/etc", "works o...
stackexchange/codereview
This isn't a holy war, this isn't a question of "which is better". What are the pros of using the following format for single statement if blocks. if (x) print "x is true"; if(x) print "x is true"; As opposed to if (x) { print "x is true"; } if(x) { print "x is true"; } If you format your single stateme...
stackexchange/codereview
What libraries can I use to build a GUI for an Erlang application? Please one option per answer.
stackexchange/codereview
When using PyWin I can easily load a python file into a fresh interactive shell and I find this quite handy for prototyping and other exploratory tasks. I would like to use Komodo as my python editor, but I haven't found a replacement for PyWin's ability to restart the shell and reload the current module. How can I d...
stackexchange/codereview
Hi were can I find training videos for MySQL ?
stackexchange/codereview
Using classic templates, publishing via FTP to a custom domain. I want to add custom elements such as: a tree view for archived posts (expanding using CSS/JavaScript) a tag cloud a slideshow of images
stackexchange/codereview
I have a scenario where I have to check whether user has already opened Microsoft Word. If he has, then I have to kill the winword.exe process and continue to execute my code. Does any one have any straight-forward code for killing a process using vb.net or c#?
stackexchange/codereview
Can someone explain when to use each of these? They almost seem interchangeable in many cases. The Custom Control gets added to the toolbar while the User Control (ascx) can not. The Custom Control does not get rendered in the Designer while the User Control does. Beyond that, how do you choose which is the right ...
stackexchange/codereview
I'd like to be able to hook into a 3rd party application to see what SQL Statements are being executed. Specifically, it is a VB6 application running on SQL Server 2005. For example, when the application fills out a grid, I'd like to be able to see exactly what query produced that data.
stackexchange/codereview
I'm supposed to create a simple rule engine in C#. Any leads on how I can proceed?. It's a minimalistic rule engine, and would use SQL server as the back end. Do we have any general blueprint or design patterns that generally apply to rule engines? What kind of .Net technologies can I use to design one? Any directions ...
stackexchange/codereview
Visual Studio randomly crashes when adding/removing references and projects. Any thoughts why? Will installing Sp1 help? EDIT: I do not work with any addons except SourceSafe. I do most of my development in connected mode. Developing using: Visual Studio 2008 WinXp Terminal Service -> Win2k3 Sp2 (64bit) VS...
stackexchange/codereview
I haven't been able to find any documentation on hardware access via the iPhone SDK so far. I'd like to be able to send signals via the dock connector to an external hardware device but haven't seen any evidence that this is accessible via the SDK (not interested in possibilities on jailbroken iPhones). Anyone have any...
stackexchange/codereview
Everywhere I look always the same explanation pop ups. Configure the view resolver. <bean id="viewMappings" class="org.springframework.web.servlet.view.ResourceBundleViewResolver"> <property name="basename" value="views" /> </bean> And then put a file in the classpath named view.properties with some key-valu...
stackexchange/codereview
I have a web app which connects to a server using a TCP connection and reads a binary document which it then writes to its response object. In other words it's transferring a file from a backend server using a custom protocol and returning that file to its client through HTTP. The server sends a status code and a mime ...
stackexchange/codereview
I need to have a script read the files coming in and check information for verification. On the first line of the files to be read is a date but in numeric form. eg: 20080923 But before the date is other information, I need to read it from position 27. Meaning line 1 position 27, I need to get that number and see if ...
stackexchange/codereview
There are two popular naming conventions: vc90/win64/debug/foo.dll foo-vc90-win64-debug.dll Please discuss the problems/benefits associated with either approach. I am also wondering if it is possible to expose meta-data (i.e. compiler, platform, build-type) in approach #1 in an easy to use, cross-platform manner.
stackexchange/codereview
Pretty basic question, I'm trying to write a regex in Vim to match any phrase starting with "abc " directly followed by anything other than "defg". I've used "[^defg]" to match any single character other than d, e, f or g. My first instinct was to try /abc [^\(defg\)] or /abc [^\<defg\>] but neither one of those works...
stackexchange/codereview
Below is a list of locks that SQL Server 2000 is meant to support. I am a bit confused as to what the "intent" locks actually mean. I've looked around on the Web and the answers seem to be a bit cryptic. Further to getting an answer to my specific question, I am hoping to use this question as a Wiki for what each lock...
stackexchange/codereview
When you use composition, then you can mock the other objects from which your class-under-test depends, but when you use inheritance, you can't mock the base class. (Or can you?) I generally try to prefer composition over inheritance, but sometimes inheritance really seems like the best tool for the job - well, at leas...
stackexchange/codereview
How is possible to set some special column values when update/insert entities via NHibernate without extending domain classes with special properties? E.g. every table contains audit columns like CreatedBy, CreatedDate, UpdatedBy, UpdatedDate. But I dont want to add these poperties to the domain classes. I want to keep...
stackexchange/codereview
This is a good candidate for the "Works on My Machine Certification Program". I have the following code for a LinkButton... <cc1:PopupDialog ID="pdFamilyPrompt" runat="server" CloseLink="false" Display="true"> <p>Do you wish to upgrade?</p> <asp:HyperLink ID="hlYes" runat="server" Text="Yes" CssClass="button"></asp...
stackexchange/codereview
I'm writing a number of articles meant to teach beginning programming concepts through the use of poker-related topics. Currently, I'm working on the subject of shuffling. As Jeff Atwood points out on CodingHorror.com, one simple shuffling method (iterating through an array and swapping each card with a random card els...
stackexchange/codereview
I have migrated a couple of project from Subversion to git. It work really well but when I clone my repository, it's really long because I have all the history of a lot of .jar file included in the transfer. Is there a way to keep only the latest version of certain type of file in my main repository. I mainly want to d...
stackexchange/codereview
I'm working on a project using the ANTLR parser library for C#. I've built a grammar to parse some text and it works well. However, when the parser comes across an illegal or unexpected token, it throws one of many exceptions. The problem is that in some cases (not all) that my try/catch block won't catch it and ins...
stackexchange/codereview
I want to receive the following HTTP request in PHP: Content-type: multipart/form-data;boundary=main_boundary --main_boundary Content-type: text/xml <?xml version='1.0'?> <content> Some content goes here </content> --main_boundary Content-type: multipart/mixed;boundary=sub_boundary --sub_boundary Content-type: a...
stackexchange/codereview
Not for the first time, I've accidentally done "svn switch" from somewhere below the root of my project. This switches that subdirectory only, but how do I undo this? If I try switching the subdirectory back to the original branch I get: "svn: Directory 'subdir\_svn' containing working copy admin area is missing" Upda...
stackexchange/codereview
I have a JSF woodstock table with checkboxes. When a row is selected I want to do some processing with those items. I managed to get a selection of RowKey objects but can't find out how to get the original objects I put in back. The table is populated by an ObjectListDataProvider.
stackexchange/codereview
What is the best way of doing this? tmpnam() returns a path to a file in the root of the drive, which requires administrator privileges on Windows Vista, so this is not an option.
stackexchange/codereview
The Query Optimizer is estimating that the results of a join will have only one row, when the actual number of rows is 2000. This is causing later joins on the dataset to have an estimated result of one row, when some of them go as high as 30,000. With a count of 1, the QO is choosing a loop join/index seek strategy fo...
stackexchange/codereview
In a .net 2 winforms application, what's a good way to set the culture for the entire application? Setting CurrentThread.CurrentCulture for every new thread is repetitive and error-prone. Ideally I'd like to set it when the app starts and forget about it.
stackexchange/codereview
When you use a standard Windows "file open" dialog using GetOpenFileName(), the shell will load various DLLs that it requires to display the file list, including custom ones. In my application, I found that the DLL that TortoiseCVS uses to draw overlays on the icons was calling GdiPlusShutdown(), and so some time after...
stackexchange/codereview
MXML lets you do some really quite powerful data binding such as: <mx:Button id="myBtn" label="Buy an {itemName}" visible="{itemName!=null}"/> I've found that the BindingUtils class can bind values to simple properties, but neither of the bindings above do this. Is it possible to do the same in AS3 code, or is Flex si...
stackexchange/codereview
What I'm looking for is a simple timer queue possibly with an external timing source and a poll method (in this way it will be multi-platform). Each enqueued message could be an object implementing a simple interface with a virtual onTimer() member function.
stackexchange/codereview
I am looking for a good primer or technical description of the System Call mechanism that is used by operating systems to transition from user space to the kernel to invoke functions such as "open", "read", "write", etc... Is there anything other than the Wikipedia entry? Websites, pdfs, books, source code, all are wel...
stackexchange/codereview
I'm looking for a framework to generate Java source files. Something like the following API: X clazz = Something.createClass("package name", "class name"); clazz.addSuperInterface("interface name"); clazz.addMethod("method name", returnType, argumentTypes, ...); File targetDir = ...; clazz.generate(targetDir); Then, ...
stackexchange/codereview
Is there any way to use a constant as a hash key? For example: use constant X => 1; my %x = (X => 'X'); The above code will create a hash with "X" as key and not 1 as key. Whereas, I want to use the value of constant X as key.
stackexchange/codereview
What are some good package naming conventions for domain specific object models. For example, say you have a Person.java POJO, would you put it in a mydomain.model or mydomain.entity or mydomain.om (object model) package. The idea is to separate the MVC model objects from the domain object model. Our MVC based appl...
stackexchange/codereview
In our project we have a standard auto-generated designer.cs file, linked to a DBML file, that contains all our object classes that map onto our database tables. We want to pass these objects directly through a WCF Service and so they need decorating with the [DataContract] and [DataMember] attributes where appropriate...
stackexchange/codereview
Apparently you can easily obtain a client IP address in WCF 3.5 but not in WCF 3.0. Anyone know how?
stackexchange/codereview
Every so often I get an error saying one of my tables "is marked as crashed and should be repaired". I then do a REPAIR TABLE and repair it. What causes them to be marked as crashed and how can I prevent it? I am using MyISAM tables with MySQL 5.0.45.
stackexchange/codereview
Suppose I have a directory /dir inside which there are 3 symlinks to other directories /dir/dir11, /dir/dir12, and /dir/dir13. I want to list all the files in dir including the ones in dir11, dir12 and dir13. To be more generic, I want to list all files including the ones in the directories which are symlinks. find .,...
stackexchange/codereview
See title. By lightweight markup I mean something like markdown or wikitext.
stackexchange/codereview
I'd like to make status icons for a C# WinForms TreeList control. The statuses are combinations of other statuses (eg. a user node might be inactive or banned or inactive and banned), and the status icon is comprised of non-overlapping, smaller glyphs. I'd really like to avoid having to hand-generate all the possibl...
stackexchange/codereview
What would the differences be in implementing remote business logic? Currently we are planning on using ADF to develop front-end web applications (moving from Struts). What are the differences between the front end calling EJBs using TopLink vs ADF Business Components through RMI in terms of scalability as the migratio...
stackexchange/codereview