instruction_seed
stringlengths
1
35.8k
_source
stringclasses
1 value
I have a sheet with a custom button on it from where I control the printing process. Now the user clicks on the menu bar's print icon and this produces an "undefined" output. How can I intercept this menu bar button? Thanks
stackexchange/codereview
I work a lot with decision makers looking to use technology better in their businesses. I have found that a picture is worth a thousand words and prototyping a system in a diagram of some sorts always lends a lot to a discussion. I have used Visio, UML (somewhat), Mind Maps, Flow Charts and Mocked Up WinForms to star...
stackexchange/codereview
Having difficulty articulating this correlated subquery. I have two tables fictitious tables, foo and bar. foo has two fields of foo_id and total_count. bar has two fields, seconds and id. I need to aggregate the seconds in bar for each individual id and update the total_count in foo. id is a foreign key in bar for fo...
stackexchange/codereview
What is the best way for converting phone numbers into international format (E.164) using Java? Given a 'phone number' and a country id (let's say an ISO country code), I would like to convert it into a standard E.164 international format phone number. I am sure I can do it by hand quite easily - but I would not be sur...
stackexchange/codereview
Does it make sense to qualify bit fields as signed / unsigned?
stackexchange/codereview
I'm building a data warehouse that includes delivery information for restaurants. The data is stored in SQL Server 2005 and is then put into a SQL Server Analysis Services 2005 cube. The Deliveries information consists of the following tables: FactDeliveres BranchKey DeliveryDateKey ProductKey InvoiceNumber (DD: degen...
stackexchange/codereview
Where I work we only have IE 7. I want to view IE 6 on my computer also. How can I view both on the same computer? I want more than just a screen shot. I want to view both versions of IE as I write code.
stackexchange/codereview
I'm new to Rails development, and I'm trying to figure out how to use an older version of Rails with Apatana's RadRails IDE. I'm trying to help out a friend who has a site built on older version than the one that automatically gets downloaded by RadRails, and I'm pretty sure the two versions wouldn't be compatible (th...
stackexchange/codereview
Using an idea from Bob King idea I wrote the following method. It works great on CD's, removable drives, regular drives. However for a floppy it always return "Not Available". Any ideas? public static void TestFloppy( char driveLetter ) { using( var searcher = new ManagementObjectSearcher( @"SELECT * FROM Win32_Lo...
stackexchange/codereview
I know I can get this to technically work but I'd like to implement the cleanest possible solution. Here's the situation: I have a managed library which wraps an unmanaged C-style library. The C-style library functionality I'm currently wrapping does some processing involving a list of strings. The library's client ...
stackexchange/codereview
I'm trying to find the best way to use 'top' as semi-permanent instrumentation in the development of a box running embedded Linux. (The instrumentation will be removed from the final-test and production releases.) My first pass is to simply add this to init.d: top -b -d 15 >/tmp/toploop.out & This runs top in "batch" ...
stackexchange/codereview
I wonder, why the hell... did the VS team consider that NOT finding a project reference as a non crucial thing? The referenced component 'X' could not be found. should be considered an error... and nothing else. Is there a way (without turning 'Treat all warnings as errors' on) to get this warning as an error in VS2008...
stackexchange/codereview
If we put aside the rights and wrongs of putting demo data into a live system for a minute (that's a whole separate discussion!), we are being asked to store some demo data in our live system so that it can be credibly demonstrated without the appearance of smoke + mirrors (we want to use the same login page for exampl...
stackexchange/codereview
I have a xml blob that's checked against a schema in sql 2005. My website uses xsl to transform and display the blob. How do I add a hyperlink to the xml (in any node) without the sql 2005 schema complaining a node was found in the wrong place? Or the xsl thinking that the hyperlink is a valid xml node? thank you
stackexchange/codereview
Microsoft in its MSDN entry about altering SQL 2005 partitions, listed a few possible approaches: Create a new partitioned table with the desired partition function, and then insert the data from the old table into the new table by using an INSERT INTO...SELECT FROM statement. Create a partitioned clustered index on ...
stackexchange/codereview
Can anyone recommend any good resources for learning C++ Templates? Many thanks.
stackexchange/codereview
I'm looking for a decent sort implementation for arrays in VBA. A Quicksort would be preferred. Or any other sort algorithm other than bubble or merge would suffice. Please note that this is to work with MS Project 2003, so should avoid any of the Excel native functions and anything .net related.
stackexchange/codereview
Say you create a form using ASP.NET MVC that has a dynamic number of form elements. For instance, you need a checkbox for each product, and the number of products changes day by day. How would you handle that form data being posted back to the controller? You can't set up parameters on the action method because you don...
stackexchange/codereview
I'd like to write a Ruby snippet that gets run when my Gem is first installed via [sudo ]gem install mygem. Can it be done?
stackexchange/codereview
I am trying to call a COM object from PHP using the COM interop extension. One function requires an OLE_COLOR as an argument? Is there any way to pass this kind of value from PHP? I have tried passing a simple integer value with no success. $this->oBuilder->Font->Color = 255;
stackexchange/codereview
What is the best way to convert existing jar (without source) written in java 1.5 into java 1.4.x?
stackexchange/codereview
I want to call ShowDialog() when a keyboard hook event is triggered, but I'm having some difficulties: ShowDialog() blocks, so I can't call it from the hook triggered event, because it will block the OS. I can start a new thread and call ShowDialog() from there, but I get some nasty exception. I guess I can't call Sho...
stackexchange/codereview
In programming we face various situations where we are required to make use of intermediate STL containers as the following example depicts: while(true) { set < int > tempSet; for (int i = 0; i < n; i ++) { if (m.size() == min && m.size() <= max) { tempSet.insert(i); } ...
stackexchange/codereview
I would like to know how long it's been since the user last hit a key or moved the mouse - not just in my application, but on the whole "computer" (i.e. display), in order to guess whether they're still at the computer and able to observe notifications that pop up on the screen. I'd like to do this purely from (Py)GTK+...
stackexchange/codereview
I found this: http://www.evolt.org/failover-database-connection-with-php-mysql and similar examples. But is there a better way? I am thinking along the lines of the Automatic Failover Client in the MS SQL Native Client.
stackexchange/codereview
I want to be able to set my country of origin - does this involve testing through a proxy, or is there something that can be set else where?
stackexchange/codereview
After asking this question I was advised not to check in binaries into subversion. My question is then what do I do with 3rd party dlls that are required to be in the bin folder? I need to be able checkout a working copy and have that run as a website with all dlls, etc intact.
stackexchange/codereview
How do I pull out the filename from a full path using regular expressions in C#? Say I have the full path C:\CoolDirectory\CoolSubdirectory\CoolFile.txt. How do I get out CoolFile.txt using the .NET flavor of regular expressions? I'm not really good with regular expressions, and my RegEx buddy and me couldn't figure th...
stackexchange/codereview
I'm working on something that was built on a PC set-up using php and an ms access database. When I port the app to my MAMP environment, I get Fatal error: Call to undefined function odbc_connect() in /path/to/index.php on line 37 line 37 looks like this: return odbc_connect("DRIVER={Microsoft Access Driver (*.mdb)}; ...
stackexchange/codereview
I'm trying to create a fast 2D point inside polygon algorithm, for use in hit-testing (e.g. Polygon.contains(p:Point)). Suggestions for effective techniques would be appreciated.
stackexchange/codereview
What are the “normal” ways to do plug-ins in compiled languages (C#/C/C++/D)? I am specifically interested in language agnostic approaches but language specific is not unacceptable. For the time being, “compile time” plug in approaches (just include the code or not and everything works) are valid but things that can mi...
stackexchange/codereview
Problem : I have multiple projects checked out in my depot. I also have multiple pending numbered change lists, each change list containing checked out files specific to its project. When I check out a new file, it appears in the default change list instead of in the change list that is relevant to its project and I ne...
stackexchange/codereview
Is it ever appropriate to abandon the "getMyValue()" and "setMyValue()" pattern of getters and setters if alternative function names make the API more obvious? For example, imagine I have this class in C++: public class SomeClass { private: bool mIsVisible; public: void draw(); void erase(); } I could ad...
stackexchange/codereview
I'm required to provide a handover to our content editors for the update corporate website I've just released. Apparently a training session with notes isn't sufficient. Fair enough. So more dreaded documentation looms. After a fairly brief trawl over Google, I'm unable to find any relevant and usable template to us...
stackexchange/codereview
I am new to the world of ASP.NET and SQL server, so please pardon my ignorance ... If I have a data structure in C# (for e.g. let's just say, a vector that stores some strings), is it possible to store the contents of the vector as is in SQL table? I want to do this so that it fast to convert that data back into vector...
stackexchange/codereview
One problem I have with open-source is not often the product or documentation, but the level of community involvement and support. Response time for some questions on official forums can take more than a week, which can honestly make a big difference when choosing a platform for commercial services use. However, I find...
stackexchange/codereview
I want to do an HTTP POST that looks like an HMTL form posted from a browser. Specifically, post some text fields and a file field. Posting text fields is straightforward, there's an example right there in the net/http rdocs, but I can't figure out how to post a file along with it. Net::HTTP doesn't look like the best ...
stackexchange/codereview
I have a revision that has been committed to SVN trunk which I would like to roll back. However, I would like to retain the changes in some fashion such as a branch or even a patch file. Any suggestions?
stackexchange/codereview
I've got two directories containing ~20 GB of music files (mostly mp3, some ogg), and I would like to detect all duplicate songs. There are two complicating factors: A song may have different filenames in the two directories. Two files containing the same song may have different ID3 tags and thus have different checks...
stackexchange/codereview
Can somebody explain what is REST and what is SOAP in plain english? And how Web Services work?
stackexchange/codereview
Is there a way in PHP to compile a regular expression, so that it can then be compared to multiple strings without repeating the compilation process? Other major languages can do this -- Java, C#, Python, Javascript, etc.
stackexchange/codereview
I have several xml files, the names of which are stored in another xml file. I want to use xsl to produce a summary of the combination of the xml files. I remember there was a way to do this with the msxml extensions (I'm using msxml). I know I can get the content of each file using select="document(filename)" but I'm...
stackexchange/codereview
I'm trying to determine the best way of having a PHP script determine which server the script/site is currently running on. At the moment I have a switch() that uses $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] to determine which server it's on. It then sets a few paths, db connection parameters, SMTP paramt...
stackexchange/codereview
I've noticed that sometimes wrapper scripts will use ${1:+"$@"} for the parameters rather than just "$@". For example, http://svn.macosforge.org/repository/macports/trunk/dports/editors/vim-app/files/gvim.sh uses exec "$binary" $opts ${1:+"$@"} Can anyone break ${1:+"$@"} down into English and explain why it would be ...
stackexchange/codereview
I have a third-party editor that basically comprises a textbox and a button (the DevExpress ButtonEdit control). I want to make a particular keystroke (Alt + Down) emulate clicking the button. In order to avoid writing this over and over, I want to make a generic KeyUp event handler that will raise the ButtonClick even...
stackexchange/codereview
I want to read all items of a feed in C#. The solutions I've found are only for the latest items like just the last 10 days. Anybody has a good solution for this?
stackexchange/codereview
The "instruments" that are used with Guitar Hero and Rock Band have USB connections. Is there any documentation or reverse-engineering info out there about how to read the messages they generate?
stackexchange/codereview
Is there a way to make awk (gawk) ignore or skip missing files? That is, files passed on the command line that no longer exist in the file system (e.g. rapidly appearing/disappearing files under /proc/[1-9]*). By default, a missing file is a fatal error :-( I would like to be able to do the equivalent of something like...
stackexchange/codereview
I am using the Entity Framework and Linq to Entities. I have created a small database pattern & framework to implement versioning as well as localization. Every entity now consists of two or three tables, (ie Product, ProductBase & ProductLocal). My linq always includes the following boilerplate code: from o in D...
stackexchange/codereview
I'm on SQL Server 2005 and I am getting an error which I am pretty sure should not be getting. Msg 512, Level 16, State 1, Procedure spGetSavedSearchesByAdminUser, Line 8 Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expressi...
stackexchange/codereview
Usercontrol with button - When uc is added dynamically to another page I loose the button handler. ie: I have 1 usercontrol with 1 button - the button has an event handler in the code behind. When i add the UserControl to a page programatically the button handler does not fire. Any idea of an easy way to fix this. Ty...
stackexchange/codereview
I have a system in place which applies calculations to a set of numbers (the specifics aren't really relevant). There are a number of sets of calculations which can be applied by the system users and new sets are added frequently. Currently when a new set of calculations need to be added to the system they are added in...
stackexchange/codereview
I'm working on an integration testing project in .NET. The testing framework executable starts a service and then needs to wait for the service to complete an operation. What is the best approach for the exe to wait on the service to complete its task (the service itself will not exit upon task completion)? Both proces...
stackexchange/codereview
The following code executes a simple insert command. If it is called 2,000 times consecutively (to insert 2,000 rows) an OleDbException with message = "System Resources Exceeded" is thrown. Is there something else I should be doing to free up resources? using (OleDbConnection conn = new OleDbConnection(connectionStri...
stackexchange/codereview
Does anyone know of crossbrowser equivalent of explicitOriginalTarget event parameter? This parameter is Mozilla specific and it gives me the element that caused the blur. Let's say i have a text input and a link on my page. Text input has the focus. If I click on the link, text input's blur event gives me the link ele...
stackexchange/codereview
From the reading that I have done, Core Audio relies heavily on callbacks (and C++, but that's another story). I understand the concept (sort of) of setting up a function that is called by another function repeatedly to accomplish a task. I just don't understand how they get set up and how they actually work. Any e...
stackexchange/codereview
I'm attempting to display some text in my program using (say) Windows GDI and some of the unicode characters are displayed as boxes? What is up? See also: What does it mean when my text is displayed as Question Marks?
stackexchange/codereview
I have multiple layers in an application and i find myself having to bubble up events to the GUI layer for doing status bar changes, etc . . I find myself having to write repeated coded where each layer simply subscribes to events from the lower layer and then in the call back simply raise an event up the chain. Is th...
stackexchange/codereview
My code for sql connection using linq is: var query1 = from u in dc.Usage_Computers where u.DomainUser == s3 select u; // selects all feilds from table GridView1.DataSource = query1; GridView1.DataBind(); I have a field called "Operation" in the table "Domainuser" which has values like "1, 2, 3". ...
stackexchange/codereview
I have backed up an encrypted DB (symmetric key/certificate) and restored it on a different server. Unfortuantely we're having problems with the decryption... hoping someone can help. In the restored db, I can see the Symmetric Key and the Certificate in SSMS, but when I try to Open the key using the cert ( open s...
stackexchange/codereview
I have a project that is stored in a Subversion repository. In this repository, in a different folder, I have a set of libraries that I use in many of my projects. These libraries are stored as binary files, ie. the dll's, pdb's, and xml's. Here's an example layout: <repo-url> \Libraries \SQLite \Sy...
stackexchange/codereview
SqlConnection connection = new SqlConnection(FROM_CONFIGURATION) SqlCommand command = new SqlCommand("SomeSQL", connection); connection.Open(); command.ExecuteNonQuery(); command.Dispose(); connection.Dispose(); It is recommended that the code above should include try/catch (or using) so that if an exception is t...
stackexchange/codereview
How can I create a Delphi TSpeedButton or SpeedButton in C# 2.0?
stackexchange/codereview
I have a flat-file schema that has a header and detail records. It looks something like this: HDR**2401*XX0062484*22750***20081006000000*000******* LIN**001*788-0538-001*4891-788538010*20000*EA**0000*** I need to append two blank lines at the end of the message. Right now, if I have multiple records I get the followin...
stackexchange/codereview
If A references assembly B 1.1 and C, and C references B 1.2, how do you avoid assembly conflicts? I naively assumed C's references would be encapsulated away and would not cause any problems, but it appears all the dll's are copied to the bin, which is where the problem occurs. I understand the two ways around this ar...
stackexchange/codereview
I'm trying to set up a virtual host on a new VPS using apache 2.x on a Ubuntu server. When starting apache I get the error " xxx.241.214.xxx:80 has no VirtualHosts", and the url for the site still points to the default location which means my virtual host file isn't taking effect: <VirtualHost xxx.241.214.xxx:80> Serve...
stackexchange/codereview
When I use a ASP:Calendar control, and give it an ID: <asp:Calendar runat="server" ID="MyCal" /> It looks like this in the rendered html: <table id="NameMangled_MyCal"... /> And I can access the element by ID in javascript like this: var cal= document.getElementById("<%= MyCal.ClientID%>") However, When I make a custom...
stackexchange/codereview
Ok, if I have this right, my code can get cookies at a specific url, but then once I get the cookie, into the container, how can I send it to the client via socket? Like the code directly below does here for regular http-page requests. byte[] buffer = new byte[bz]; rebu = responsestream.Read(buffer, 0, bz); while (rebu...
stackexchange/codereview
I'm attempting to display some text in my program using (say) Windows GDI and some of the unicode characters are displayed as question marks? What is up? See also: What does it mean when my text is displayed as boxes?
stackexchange/codereview
I must be getting daft, but I can't seem to find how to read old-fashioned ini files with VB 6.0. All I can seem to find is about reading from and writing to the registry. Can someone push me in the right direction? Mind you, I am not a programmer, just a hobbyist trying to have some harmless fun with his computer, so ...
stackexchange/codereview
I have a question about locking. This doesn't have to be only about record locking, but anyway. Let's say I'm writing a web accessible CMS. I am struggling with some ideas. I could, on the moment when a user opens an article for editing, flag the article as being 'in use'. so far so good. but when do I remove the flag?...
stackexchange/codereview
On our new platform we are utilizing JSF. Our WebTrends tags are not reflecting the proper page title on this platform. It currently is displaying the name of the users previous page instead of the current page. We are making use of the JSF Navigation rule in which we have some "< redirect />" tags. Has anyone experi...
stackexchange/codereview
I have an existing SQL Server 2005 database that contains data encrypted using a Symmetric key. The symmetric key is opened using a password. I am working on an upgrade to the front end applications that use this database, which include adding dozens of new tables, stored procedures, UDFs, etc. and dozens of modificat...
stackexchange/codereview
I'm profiling a ASP.NET web application. I believe it is very database connection intensive (excessive use of the ADO.NET connection pool). How to I tell w/out debugging how many times it is going to the pool and on average how many connections are available in the pool? Are there counters that will give me this info i...
stackexchange/codereview
I have a multi-timezone web application that stores all of the datetime values in UTC in the database, when actions happen on the server, I can easily convert the time into UTC. However, when a client enters a time or time span, what is the best way to detect and store it? I am currently doing the following: Get the v...
stackexchange/codereview
Basically, I'm trying to selectively copy a table from one database to another. I have two different [Oracle] databases (e.g., running on different hosts) with the same schema. I'm interested in a efficient way to load Table A in DB1 with the result of running a select on Table A in DB2. I'm using JDBC, if that's relev...
stackexchange/codereview
How can I pass arguments to a constructor in an IOC-framework? I want to do something like: (Trying to be IOC-framework agnostic ;) ) object objectToLogFor = xxx; container.Resolve<ILogging>(objectToLogFor); public class MyLogging : ILogging { public MyLogging(object objectToLogFor){} } It seems that this is not...
stackexchange/codereview
We need to provide a solution to do performance testing for our Web Services residing in our development environment. We were planning to create the test scripts using the object model of Microsoft Web Application Stress Tool. I have researched and not been able to find any examples. Can anyone, who may have perhaps u...
stackexchange/codereview
Other than -Wall, what other warnings have people found useful? Options to Request or Suppress Warnings
stackexchange/codereview
Here are the requirements: Must be alphanumeric, 8-10 characters so that it is user friendly. These will be stored as unique keys in database. I am using Guids as primary keys so an option to use GUids to generate these unique Ids would be preferable. I am thinking on the lines of a base-n converter that takes a Guid a...
stackexchange/codereview
I want to sort members by name in the source code. Is there any easy way to do it? I'm using NetBeans, but if there is another editor that can do that, just tell me the name of it.
stackexchange/codereview
Let's say that you have overridden an object's equals() and hashCode() methods, so that they use the object's fields. How you do you check if two references are to the same object, ala the stock equals() method?
stackexchange/codereview
Often, programmers write code that generates other code. (The technical term is metaprogramming, but it is more common than merely cross-compilers; think about every PHP web-page that generates HTML or every XSLT file.) One area I find challenging is coming up with techniques to ensure that both the hand-written source...
stackexchange/codereview
If the C++ runtime msvcr80.dll is missing from a compiled library, is there any way to determine which version was used to create the library or to get it to run on a later version of msvcr80.dll?
stackexchange/codereview
I can't find much information around the web about it. Has anyone used both eConnect and the Dynamics web services to interact (read/write) with Great Plains. I am looking for the pros and cons of both approaches. This product will be installed and configured on various sites, so ease of configuration is really importa...
stackexchange/codereview
I know it's bad to use HTML Tables for everything... and that tables should be used only to present tabular data and not to achieve some style goal. My question is, how do you make HTML forms with CSS so they look nice and aligned like when using tables?
stackexchange/codereview
I'm a c++ programmer and I'm playing around with java after finding JPA which for a few of my current applications is a god send. I haven't touched java since university and I'm having a problem running out of heap space. I'm using the code below as the main part of a not-very-serious test of jdbc/jpa/lucene but I keep...
stackexchange/codereview
Is there any libraries that would allow me to use the same known notation as we use in BeanUtils for extracting POJO parameters, but for easily replacing placeholders in a string? I know it would be possible to roll my own, using BeanUtils itself or other libraries with similar features, but I didn't want to reinvent t...
stackexchange/codereview
I am looking get to grips with functional programming concepts. I've used Javascript for many years for client side scripting in web applications and apart from using prototypes it was all simple DOM manipulation, input validation etc. Of late, I have often read that Javascript is one of the languages that supports f...
stackexchange/codereview
I'm using ccl/openmcl on Mac OS X. (latest versions of both). When the lisp prompt is displayed, using the cursor keys to navigate the current line results in escape codes, rather than movement, eg: Welcome to Clozure Common Lisp Version 1.2-r9226-RC1 (DarwinX8664)! ? (^[[D Here I've pressed the ( key, and then the le...
stackexchange/codereview
I am interacting with an Oracle DB using SQL over an ODBC connection. Is there an SQL command I can use to get the MAC address of the server, or something that uniquely identifies the server hardware or software installation. This is so I can be sure (or at least fairly sure) that I'm talking to the same database all...
stackexchange/codereview
I have a row of data that I need to modify in a database, using a stored procedure. But in order to call that stored procedure, I need to know the name of the each column. How do I determine the name of the columns? (Hardcoding is not an option as we are talking a LOT of columns whose names may change). EDIT: given the...
stackexchange/codereview
What is the PHP preg_replace in C#? I have an array of string that I would like to replace by an other array of string. Here is an example in PHP. How can I do something like that in C# without using .Replace("old","new"). $patterns[0] = '/=C0/'; $patterns[1] = '/=E9/'; $patterns[2] = '/=C9/'; $replacements[0] = 'à';...
stackexchange/codereview
I have an existing Perl program that uses Getopt package and Getopt::Long::Configure with permute as one of the options. However, now I need to keep the order of the options entered by the user. There is an option $RETURN_IN_ORDER mentioned in the Long.pm, however doesn't seem to be used anywhere at all. When I pass r...
stackexchange/codereview
I am probably overlooking something really simple here but I am trying to redirect all bad URLs to an action that filters the URL based on conditions and then either 301 redirects to a suitable page or issues a 404 page. To this end I have a route like this at the end of my route table: routes.MapRoute("Error", "{*url}...
stackexchange/codereview
which library better for faster java application swt or swing?
stackexchange/codereview
I'd like to generate unique random numbers between 0 and 1000 that never repeat (i.e. 6 doesn't show up twice), but that doesn't resort to something like an O(N) search of previous values to do it. Is this possible?
stackexchange/codereview
C# novice here, when the int 'max' below is 0 I get a divide by zero error, I can see why this happens but how should I handle this when max is 0? position is also an int. private void SetProgressBar(string text, int position, int max) { try { int percent = (100 * position) / max; //...
stackexchange/codereview
How can I find the XY coordinates of an HTML element (DIV) from JavaScript if they were not explicitly set?
stackexchange/codereview
Here's a curious one. I have a class A. It has an item of class B, which I want to initialize in the constructor of A using an initializer list, like so: class A { public: A(const B& b): mB(b) { }; private: B mB; }; Is there a way to catch exceptions that might be thrown by mB's copy-constructor while...
stackexchange/codereview