instruction_seed
stringlengths
1
35.8k
_source
stringclasses
1 value
We have several common libs. Ideally we want them all to use the latest version of a dll even if they have been compiled against an older different version (assume the latest version is backward compatible) e.g we have: Project dll Common controls dll Logging dll Database access dll Project and common controls referen...
stackexchange/codereview
What do the brackets do in a sql statement? For example, in the statement: insert into table1 ([columnname1], columnname2) values (val1, val2) Also, what does it do if the table name is in brackets?
stackexchange/codereview
I have a large 'Manager' class which I think is doing too much but I am unsure on how to divide it into more logical units. Generally speaking the class basically consists of the following methods: class FooBarManager { GetFooEntities(); AddFooEntity(..); UpdateFooEntity(..); SubmitFooEntity(..); GetFooType...
stackexchange/codereview
I have a simple iphone app that's based on the CrashLanding sample app. So basically you tap the title screen and do some stuff... all on the same "view". I want to add an "options" screen/page/view whatever with a few UISwitches. What's the easiest way to do this? Cheers!
stackexchange/codereview
When we execute select count(*) from table_name it returns the number of rows. What does count(1) do? What does 1 signify here? Is this the same as count(*) (as it gives the same result on execution)?
stackexchange/codereview
I've been trying to get up to speed on some of the newer features in C# and one of them that I haven't had occasion to use is anonymous types. I understand the usage as it pertains to LINQ queries and I looked at this SO post which asked a similar question. Most of the examples I've seen on the net are related to LINQ...
stackexchange/codereview
I always felt that expecting exceptions to be thrown on a regular basis and using them as flow logic was a bad thing. Exceptions feel like they should be, well, the "exception". If you're expecting and planning for an exception, that would seem to indicate that your code should be refactored, at least in .NET... Howe...
stackexchange/codereview
I've tried restarting apache and the cached pages still appear, so there must be a folder someplace. I don't have a 'public/cache', so what other places should I look? Is there a URL flag that could trigger this effect as well?
stackexchange/codereview
Recently, Lee Baldwin showed how to write a generic, variable argument memoize function. I thought it would be better to return a simpler function where only one parameter is required. Here is my total bogus attempt: local function memoize(f) local cache = {} if select('#', ...) == 1 then return function...
stackexchange/codereview
I have a method lets say: private static String drawCellValue( int maxCellLength, String cellValue, String align) { } and as you can notice, I have a parameter called align. Inside this method I'm going to have some if condition on whether the value is a 'left' or 'right'.. setting the parameter as String, obvious...
stackexchange/codereview
When running command-line queries in MySQL you can optionally use '\G' as a statement terminator, and instead of the result set columns being listed horizontally across the screen, it will list each column vertically, which the corresponding data to the right. Is there a way to the same or a similar thing with the DB2 ...
stackexchange/codereview
I'm working on a C++ library that (among other stuff) has functions to read config files; and I want to add tests for this. So far, this has lead me to create lots of valid and invalid config files, each with only a few lines that test one specific functionality. But it has now got very unwieldy, as there are so many f...
stackexchange/codereview
I have a class hierarchy as such: +-- VirtualNode | INode --+ +-- SiteNode | | +-- AbstractNode --+ | +-- SiteSubNode And a corresponding NodeCollection class that is build on INode. In order to disp...
stackexchange/codereview
See: Understanding Pointers In many C flavoured languages, and some older languages like Fortran, one can use Pointers. As someone who has only really programmed in basic, javascript, and actionscript, can you explain to me what a Pointer is, and what it is most useful for? Thanks!
stackexchange/codereview
I was wondering as to the practicalities of storing an in memory tree structure as directory tree for persistence purposes. In my case he target filesystem will be ZFS, and once the structure has been created it will be accessed by multiple processes infrequently. How performant is using a Directory Tree as a mechanism...
stackexchange/codereview
What are the possibilities of a programmer to handle data that are rarely used but cannot be simply deleted because at least reporting still requires it? Some examples I am thinking of: Discountinued funding types of older years of a university Unused currencies (e.g. Italian lira) Names of disappeared countries (e.g....
stackexchange/codereview
I'm writing a Rails plugin that builds up a menu in a view. I'm using link_to to build the link and current_page? to set class="active" on the current page. I've included ActionView::Helpers::UrlHelper so I can use link_to. To get current_page? working in the view, I've had to inherit the current class (apparently Acti...
stackexchange/codereview
I'm using PHP's PDO layer for data access in a project, and I've been reading up on it and seeing that it has good innate support for persistent DB connections. I'm wondering when/if I should use them. Would I see performance benefits in a CRUD-heavy app? Are there downsides to consider, perhaps related to security? If...
stackexchange/codereview
Navision 5.0 includes a feature to export to Word or Excel. Is it possible to make this work with OpenOffice.org Writer or Calc instead? If so, what has to be done to set it up? I have been told by my Navision reseller that the feature works best with Office 2007, and export to Excel 2003 works. No mention of Office...
stackexchange/codereview
What does the following code do in C/C++? if (blah(), 5) { //do something }
stackexchange/codereview
How does TCP/IP report errors when packet delivery fails permanently? All Socket.write() APIs I've seen simply pass bytes to the underlying TCP/IP output buffer and transfer the data asynchronously. How then is TCP/IP supposed to notify the developer if packet delivery fails permanently (i.e. the destination host is no...
stackexchange/codereview
I've read somewhere that functional programming is suitable to take advantage of multi-core trend in computing. I didn't really get the idea. Is it related to the lambda calculus and von neumann architecture?
stackexchange/codereview
Is it a problem if you use the global keyword on variables you don't end up using? Compare: function foo() { global $fu; global $bah; if (something()) { $fu->doSomething(); } else { $bah->doSomething(); } } function bar() { if (something()) { global $fu; $fu->doS...
stackexchange/codereview
Although I played with it before, I'm finally starting to use Dvorak (Simplified) regularly. I've been in a steady relationship with Vim for several years now, and I'm trying to figure out the best way to remap the key bindings to suit my newfound Dvorak skills. How do you remap Vim's key bindings to best work with Dvo...
stackexchange/codereview
Unless I am missing an obvious built-in method, what is the quickest way to get the nth occurrence of a string within a string? I realize that I could loop the IndexOf method by updating its start index on each iteration of the loop. But doing it this way seems wasteful to me.
stackexchange/codereview
I coded something using Date statement in Access VBA. It was working fine until the start of this month, but now I am seeing that the Date has automatically changed the format from dd/mm/yyyy to mm/dd/yyyy. Has anyone else encountered the same problem?
stackexchange/codereview
I am working with an n-tiered architecture in Visual Studio 2008 (Developer Edition), and I have run into an issue. We are running unit tests on every method of our services layer, and I am attempting to see the code coverage results, to ensure I'm hitting all the main paths through my methods. When I attempt to view t...
stackexchange/codereview
I do web site debugging with Internet Explorer (as well as other browsers), but my problem is with Internet Explorer, as it is the browser I usually use for regular browsing. In order to debug you need to turn on debug mode in the advanced options. OK, fine. It's turned on. But the issue I have, that is quite annoying,...
stackexchange/codereview
I wish to use xml and xsl to generate controls on an asp.net page. I currently have a asp.net content page that contains a xml control. When the page is loaded, an xml file is loaded and the required element is extracted and set as the xml control's DocumentContent and the xml control's TransformSource is set to the ap...
stackexchange/codereview
In the linker the binary destination is specified as: $(OutDir)\$(ProjectName).exe I've looked through every setting and I can't see where OutDir is defined. How do I change this?
stackexchange/codereview
I am building a project involving natural language processing, since the nlp module currently only deal with english text, so I have to make sure the user submitted content (not long, only several words) is in english. Are there established ways to achieve this? Python or Javascript way preferred.
stackexchange/codereview
JavaScript doesn't seem to have a native trim() method. How can I trim white spaces at the start and end of a string with JavaScript?
stackexchange/codereview
How, in the simplest possible way, distinguish between Windows XP and Windows Vista, using Python and pywin32 or wxPython? Essentially, I need a function that called will return True iff current OS is Vista: >>> isWindowsVista() True
stackexchange/codereview
This seems very noisy to me. Five lines of overhead is just too much. m_Lock.EnterReadLock() Try Return m_List.Count Finally m_Lock.ExitReadLock() End Try So how would you simply this?
stackexchange/codereview
I need to build a simple HTTP server in C. Any guidance? Links? Samples?
stackexchange/codereview
A question about different methods of outputting html from PHP; what are the performance differences between these: Method 1 - variable concatenation $html = ''; $html .= '<ul>'; for ($k = 1; $k < = 1000; $k++){ $html .= '<li> This is list item #'.$k.'</li>'; } $html .= '</ul>'; echo $html; Method 2 - output buffe...
stackexchange/codereview
I'm about to push out a website soon and so I've gotten in the last stages. Time to optimize the baby! The website performs pretty good overall, with an average framerate of 32fps. But at some heavy animation parts it likes to drop a couple of frames to about 22fps. Which is not that horrible. But I'm tweaking it as mu...
stackexchange/codereview
I'm setting up a server to offer JIRA and SVN. I figure, I'll use LDAP to keep the identity management simple. So, before I write one.... is there a good app out there to let users change their ldap password? I want something that lets a user authenticate with ldap and update their password. A form with username,...
stackexchange/codereview
How can I prevent this exception when making a soap call to a server that is using a self signed certificate? require "rubygems" gem "httpclient", "2.1.2" require 'http-access2' require 'soap/rpc/driver' client = SOAP::RPC::Driver.new( url, 'http://removed' ) client.options[ 'protocol.http.ssl_config.verify_mode' ] = O...
stackexchange/codereview
Pretty simple scenario. I have a web service that receives a byte array that is to be saved as a particular file type on disk. What is the most efficient way to do this in C#?
stackexchange/codereview
I believe several of us have already worked on a project where not only the UI, but also data has to be supported in different languages. Such as - being able to provide and store a translation for what I'm writing here, for instance. What's more, I also believe several of us have some time-triggered events (such as w...
stackexchange/codereview
We just did a move from storing all files locally to storing them on a network drive. The problem is that is where my Visual Studio projects are also stored now (no versioning system yet, working on that). I've heard of problems with doing this in the past, but never heard of a work-around. Is there a work around now? ...
stackexchange/codereview
In my user model, I have an attribute called "nickname" and validates as such: validates_format_of :nickname, :with => /[a-zA-Z0-9]$/, :allow_nil => true However, it is currently letting this string pass as valid: a?c I only want to accept alphanumeric strings - does anyone know why my regular expression is failing? ...
stackexchange/codereview
When I shrink a sql server database using the GUI (All Tasks->Shrink Database->Accept all defaults, click OK), it finishes quickly. But if I run this command, it takes a very very long time. DBCC SHRINKDATABASE('my_database') What am I missing? This is in SQL Server 2000.
stackexchange/codereview
I'm writing some code for a class constructor which loops through all the properties of the class and calls a generic static method which populates my class with data from an external API. So I've got this as an example class: public class MyClass{ public string Property1 { get; set; } public int Property2 { get; s...
stackexchange/codereview
Whats the best way to round in VBA Access? My current method utilizes the Excel method Excel.WorksheetFunction.Round(... But I am looking for a means that does not rely on Excel.
stackexchange/codereview
Before you start firing at me, I'm NOT looking to do this, but someone in another post said it was possible. How is it possible? I've never heard of inheriting from anything using reflection. But I've seen some strange things...
stackexchange/codereview
Is there a way to call an EJB that is served through WebSphere (iiop://host:port/ejbName) from a vanilla JRE (like Sun). A lot of people have been telling me that this type of architecture relies in a homogenous environment. Thoughts?
stackexchange/codereview
Does anyone have any information about getting the current versions of ASP.NET MVC (Preview 5) working on Mono 2.0? There was info on the old versions (Preview 2, maybe Preview 3), but I've seen no details about making Preview 5 actually work. The Mono Project Roadmap indicates ASP.NET 3.5 for Mono 2.4 (next year). Any...
stackexchange/codereview
I am trying to capture output from an install script (that uses scp) and log it. However, I am not getting everything that scp is printing out, namely, the progress bar. screen output: Copying /user2/cdb/builds/tmp/uat/myfiles/* to server /users/myfiles as cdb cdb@server's password: myfile 100% |********...
stackexchange/codereview
Am working on sybase ASE 15. Looking for something like this Select * into #tmp exec my_stp; my_stp returns 10 data rows with two columns in each row.
stackexchange/codereview
I have the following preprocessor divective: #ifndef NDEBUG #define TRACE printf #else #define TRACE(...) #endif and example of usage is: TRACE("TRACE: some parameter = %i\n", param); In C all works perfectly well when I build both debug and release versions, but in C++ compiler emits the following: warning: invalid ...
stackexchange/codereview
What's the best available online resource.
stackexchange/codereview
What is a C#'s analog of std::pair in C++? I found System.Web.UI.Pair class, but I'd prefer something template-based.
stackexchange/codereview
I understand benefits of dependency injection itself. Let's take Spring for instance. I also understand benefits of other Spring featureslike AOP, helpers of different kinds, etc. I'm just wondering, what are the benefits of XML configuration such as: <bean id="Mary" class="foo.bar.Female"> <property name="age" value...
stackexchange/codereview
How can I detect the current text formatting at the cursor position in a WPF RichTextBox?
stackexchange/codereview
I would like to know what are your practices when you test your classes. For example, I like to use inheritance, with my fixtures. Given two classes BaseClass, SubClass, I make two other classes BaseClassFixture and SubClassFixture (SubClassFixture is a sub class of BaseClassFixture). So I'm sure that I don't break cod...
stackexchange/codereview
I am building a C#/ASP.NET app with an SQL backend. I am on deadline and finishing up my pages, out of left field one of my designers incorporated a full text search on one of my pages. My "searches" up until this point have been filters, being able to narrow a result set by certain factors and column values. Being th...
stackexchange/codereview
There are many scenarios where it would be useful to call a Win32 function or some other DLL from a PowerShell script. to Given the following function signature: bool MyFunction( char* buffer, int* bufferSize ) I hear there is something that makes this easier in PowerShell CTP 2, but I'm curious how this is best done ...
stackexchange/codereview
So I have made a webservice that interfaces with a set of data contained in a WMI namespace. It works fine when I run it with the ASP.net in built development web server, and returns the data as requested. However when I publish it to an IIS 6 server (win 2003), the webservice no longer allows me to execute the WMI met...
stackexchange/codereview
I was trying the following example, but with external URLs: Using WebViews The example shows how to load an HTML file from assets folder (file:// url) and display it in a WebView. But when I try it with external URLs (like http://google.com), I am always getting a "Website Not Available" error. Android's built-in brow...
stackexchange/codereview
I've got a nice little class built that acts as a cache. Each item has an expiration TimeSpan or DateTime. Each time an attempt to access an item in the cache is made, the item's expiration is checked, and if it's expired, the item is removed from the cache and nothing is returned. That's great for objects that are acc...
stackexchange/codereview
I want to be able to explore the contents of a DB for this version of the DB. I was thinking of using the Squirrel DB client (which needs a JDBC driver). Therefore, I'm looking for a JDBC type 4 driver for SQL SERVER 3.5. Can somone point me to a FREE OR open source or trial ware ? If no JDBC driver, how do MS develop...
stackexchange/codereview
I have an application that I have to run as Administrator. One small part of that application is to start other applications with Process.Start The started applications will also be run as administrators, but I'd rather see them run as the 'normal' user. How do I accomplish that? /johan/
stackexchange/codereview
The target driver I'm building is not a native driver but a minidriver working with Microsoft Universal Pinter Driver According to DDK: Descriptions of these items [fonts in my case] are placed in a resource DLL, as described in the Platform SDK documentation. It then goes on to say: In the printer's resource DL...
stackexchange/codereview
In a nutshell, there's a global stylesheet: a { font-family: Arial; } I want to use a different font family for a particular link: <a href="..." style="font-family: Helvetica;">...</a> or <span style="font-family: Helvetica;"><a href="...">...</a></span> but nothing works. Is there an easy way to do this? P.S. I'm d...
stackexchange/codereview
What tricks can be used to stop javascript callouts to various online services from slowing down page loading? The obvious solution is to do all the javascript calls at the bottom of the page, but some calls need to happen at the top and in the middle. Another idea that comes to mind is using iframes. Have you ever ha...
stackexchange/codereview
A while a go I had to developed a music site that allowed audio files to be uploaded to a site and then converted in to various formats using ffmpeg, people would then download the uploaded audio files after purchasing them and a tmp file would be created and placed at the download location and was only valid for each ...
stackexchange/codereview
When I disable ViewState for the page. It does not allow any other control to use ViewState .. even if I set EnableViewState="true" for that particular control .. is it possible to enable ViewState for a control when ViewState is disabled for the page itself? if not how can disable viewstate for controls on page except...
stackexchange/codereview
Is it correct to say that typically user_dump_dest is on a local drive? If so, are there issues with mounting a NAS volume to both Unix and Windows and pointing user_dump_dest at that? If so, what are they? Are any issues worth not doing this in prod?
stackexchange/codereview
I and two others are working on a project at the university. In the project we are making a prototype of a MMORPG. We have decided to use PostgreSQL as our database. The other databases we considered were MS SQL-server and MySQL. Does somebody have a good reference which will justify our choice? (preferably written du...
stackexchange/codereview
I am trying to learn some programming related terms, and I often come over the word "handler". Can anyone please explain what it means and when to use it?
stackexchange/codereview
I have a dict, which I need to pass key/values as keyword arguments.. For example.. d_args = {'kw1': 'value1', 'kw2': 'value2'} example(**d_args) This works fine, but if there are values in the d_args dict that are not accepted by the example function, it obviously dies.. Say, if the example function is defined as def...
stackexchange/codereview
I stumbled across this code and am too proud to go and ask the author what it means. Hashtable^ tempHash = gcnew Hashtable(iterators_); IDictionaryEnumerator^ enumerator = tempHash->GetEnumerator(); What is gcnew and how important is it to use that instead of simply new? (I'm also stumped by the caret; I asked about ...
stackexchange/codereview
I just came across this code and a few Google searches turn up no explanation of this mysterious (to me) syntax. Hashtable^ tempHash = gcnew Hashtable(iterators_); IDictionaryEnumerator^ enumerator = tempHash->GetEnumerator(); What the heck does the caret mean? (The gcnew is also new to me, and I asked about that her...
stackexchange/codereview
How to calculate CRC_B encoding in C# as described in ISO 14443? Here is some background info: CRC_B encoding This annex is provided for explanatory purposes and indicates the bit patterns that will exist in the physical layer. It is included for the purpose of checking an ISO/IEC 14443-3 Type B implementation...
stackexchange/codereview
I'm investigating an annotation-based approach to validating Spring beans using spring modules. In this tutorial, the following bean (getters and setters omitted) is used as an example: public final class User { @NotBlank @Length(max = 80) private String name; @NotBlank @Email @Length(max = 80...
stackexchange/codereview
We run an old Windows NT Machine, fully patched running IIS4.0. Today we were hit by "linuXploit_crew", and they took down our websites for a minute or two. (luckily we were quick to notice a change on the websites and fix it within minutes of the attack). However -- After fixing the website, I'm left with trying to fi...
stackexchange/codereview
Is there a command within the bash shell of fedora that will give me the currently assigned IP address?
stackexchange/codereview
We're going through a massive migration project at the minute and trying to validate the code that is deployed to the live estate matches the code we have in source control. Obviously the .net code is easy to compare because we can disassemble. I don't believe this is possible in vb6 exes because of the manner of compi...
stackexchange/codereview
What is the best practice for setting up a LAMP server in terms of linux users and groups? If there are multiple sites hosted on the same server, is it best to have a single user that owns all site source files (and uploads) that is in the same group as apache - or to have a different user for each site (so that each ...
stackexchange/codereview
I have read the documentation on this and I think I understand. An AutoResetEvent resets when the code passes through event.WaitOne(), but a ManualResetEvent does not. Is this correct?
stackexchange/codereview
As part of a build setup on a windows machine I need to add a registry entry and I'd like to do it from a simple batch file. The entry is for a third party app so the format is fixed. The entry takes the form of a REG_SZ string but needs to contain newlines ie. 0xOA characters as separators. I've hit a few problems. Fi...
stackexchange/codereview
The in-house application framework we use at my company makes it necessary to put every SQL query into transactions, even though if I know that none of the commands will make changes in the database. At the end of the session, before closing the connection, I commit the transaction to close it properly. I wonder if the...
stackexchange/codereview
Does windows have any decent sampling (eg. non-instrumenting) profilers available? Preferably something akin to Shark on MacOS, although i am willing to accept that i am going to have to pay for such a profiler on windows. I've tried the profiler in VS Team Suite and was not overly impressed, and was wondering if ther...
stackexchange/codereview
Environment: VS2008 (ATL), Borland Developer Studio 2006. Hello all. I'm having some troubles with ActiveX control events. Here is a brief description of my app architecture: There is an inproc COM server which contains STA ActiveX control (aka control) and MTA COM object (aka object). Here is the IDL definition of...
stackexchange/codereview
Is it a good practice to implement event handling through WeakReference if that event is the only thing holding the reference and that we would need the object to be garbage collected? As an argument to this: Folks say that if you subscribe to something it’s your responsibility to unsubscribe and you should do it....
stackexchange/codereview
It appears that in PHP objects are passed by reference. Even assignment operators do not appear to be creating a copy of the Object. Here's a simple, contrived proof: <?php class A { public $b; } function set_b($obj) { $obj->b = "after"; } $a = new A(); $a->b = "before"; $c = $a; //i would especially expect thi...
stackexchange/codereview
How can I delete the contents of a local folder in Python? The current project is for Windows, but I would like to see *nix also.
stackexchange/codereview
I ran into an interesting (and very frustrating) issue with the equals() method today which caused what I thought to be a well tested class to crash and cause a bug that took me a very long time to track down. Just for completeness, I wasn't using an IDE or debugger - just good old fashioned text editor and System.out...
stackexchange/codereview
In a script, when a command-let or other executable statement errors out, is there a try/catch type of mechanism to recover from these errors? I haven't run across one in the documentation.
stackexchange/codereview
I'm trying to subclass NSCell for use in a NSTableView. The cell I want to create is fairly complicated so it would be very useful if I could design it in Interface Builder and then load the NSCell from a nib. Is this possible? How do I do it?
stackexchange/codereview
We have been given the directive to make sure that when we develop we are running out of the administrator and poweruser groups to prevent security holes. What are the steps to take to make this possible, but still be able to debug, code, and install when needed? We develop ASP.NET as well as VB.NET applications. Th...
stackexchange/codereview
Are there any good packages or methods for doing extensive CRUD (create-retrieve-update-delete) interfaces in the Turbogears framework. The FastDataGrid widget is too much of a black box to be useful and CRUDTemplate looks like more trouble than rolling my own. Ideas? Suggestions?
stackexchange/codereview
I'm looking for a way to visualize a piece of GML I'm receiving. What is the best freely available java library to use for this task?
stackexchange/codereview
What avenues are there for using an XSD to generate message instances? I seem to remember reading about generating classes from XSD, but can't find anything specific now. I know you can generate classes and datasets from XSD, but I'm looking for a pattern for automating the actual generation of the messages. BTW, SO ...
stackexchange/codereview
What is the best way to keep your configuration files (e.g httpd.conf, my.cnf, .bashrc ...) under version control? In adition to the versioning benefit, I want the solution to work as backup as well, so that I can bring a brand new server and checkout (or export) the config files out of SVN directly A good touch will b...
stackexchange/codereview
Oracle FAQ defines temp table space as follows: Temporary tablespaces are used to manage space for database sort operations and for storing global temporary tables. For example, if you join two large tables, and Oracle cannot do the sort in memory, space will be allocated in a temporary tablespace for do...
stackexchange/codereview
Given a credit card number and no additional information, what is the best way in PHP to determine whether or not it is a valid number? Right now I need something that will work with American Express, Discover, MasterCard, and Visa, but it might be helpful if it will also work with other types.
stackexchange/codereview
I'm using Visual Studio 6.0 and Visual Basic 6.0. I have them integrated but when I check out a Project and then try to edit a module in that project it's locked and I have to manually right-click on it and do a Check Out to unlock it. I thought there was a way to have VSS automatically check out the file for editing. ...
stackexchange/codereview