instruction_seed
stringlengths
1
35.8k
_source
stringclasses
1 value
The rich presentational capabilities of WPF and Silverlight mean developers like me will be working closely with graphic designers more often these days, as is the case in my next project. Does anyone out there have any tips and experience (from both points of view) on making this go more smoothly? For example, whe...
stackexchange/codereview
According to the documentation the return value from a slot doesn't mean anything. Yet in the generated moc code I see that if a slot returns a value this value is used for something. Any idea what does it do? Here's an example of what I'm talking about. this is taken from code generated by moc. 'message' is a slot th...
stackexchange/codereview
We use SQL Server 2000 MSDE for an Point Of Sale system running on about 800 cash registers. Each box has its own copy, and only the local software accesses it. This is a newly updated platform for the cash register vendor--who shall remain nameless. Routinely we are seeing corruption of Master, MSDB, Model and the da...
stackexchange/codereview
I would like to replace only the group in parenthesis in this expression : my_string.gsub(/<--MARKER_START-->(.)*<--MARKER_END-->/, 'replace_text') so that I get : <--MARKER_START-->replace_text<--MARKER_END--> I know I could repeat the whole MARKER_START and MARKER_END blocks in the substitution expression but I thou...
stackexchange/codereview
Scenario: You have an ASP.Net webpage that should display the next image in a series of images. If 1.jpg is currently loaded, the refresh should load 2.jpg. Assuming I would use this code, where do you get the current images name. string currImage = MainPic.ImageUrl.Replace(".jpg", ""); currImage = currImage.Replace(...
stackexchange/codereview
I have recently begun working on a project to establish how best to leverage the processing power available in modern graphics cards for general programming. It seems that the field general purpose GPU programming (GPGPU) has a large bias towards scientific applications with a lot of heavy math as this fits well with t...
stackexchange/codereview
Yup, long title. I've been programming in PHP for the last 6 years or so for work and personal projects, but I've got an idea for a desktop app (which incidentally, uses a web REST api). I'm debating on how to approach this - I've got some experience in Java, C++, Perl and Python, but have never had the chance or oppo...
stackexchange/codereview
I was inserting data into a MS Access database using JDBC-ODBC driver. The blank mdb file was 2KB. After populating this database, the size grew to 155MB. Then I was deleting the data. But I found the size of mdb remains the same as 155MB. I don't get any errors. But is it normal this way? I would expect the fil...
stackexchange/codereview
Doesn't work with other modules, but to give an example. I installed Text::CSV_XS with a CPAN setting: 'makepl_arg' => q[PREFIX=~/lib], When I try running a test.pl script: $ perl test.pl #!/usr/bin/perl use lib "/homes/foobar/lib/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi"; use Text::CSV_XS; print "te...
stackexchange/codereview
As you work in a legacy codebase what will have the greatest impact over time that will improve the quality of the codebase? Remove unused code Remove duplicated code Add unit tests to improve test coverage where coverage is low Create consistent formatting across files Update 3rd party software Reduce warnings gener...
stackexchange/codereview
I have a .net assembly that has a COM+ ServicedCopmonent in it and at the moment I install it into the GAC to get everything working. This means that I need to have every assembly that it references in the GAC as well. During development it is quite painful to make changes to thes assemblies, re-install them to the GA...
stackexchange/codereview
I am currently using Linq to NHibernate (although that is not an issue with regards to this question) to execute queries against my database and I want to be able to test whether the current IQueryable result instance has been executed or not. The debugger knows that my IQueryable has not been 'invoked' because it tell...
stackexchange/codereview
We're in the process of setting up a new framework and way of doing business for our new internal apps. Our current design dictates that all security logic should be handled by our database, and all information (and I mean all) will be going in and out of the database via stored procedures. The theory is, the data acce...
stackexchange/codereview
How can I start a project in CodePlex.com?
stackexchange/codereview
Up until now I've been able to get away with using the default routing that came with ASP.NET MVC. Unfortunately, now that I'm branching out into more complex routes, I'm struggling to wrap my head around how to get this to work. A simple example I'm trying to get is to have the path /User/{UserID}/Items to map to the...
stackexchange/codereview
I have a typical parent/child relationship. Writing news in .NET and adding children works fine, NHibernate plays nice and adds the correct relationships. However, when passing a JSON object from the client to some method that serializes my JSON into the .NET representation, NHibernate seems to get confused. It comes u...
stackexchange/codereview
This is something simple I came up with for this question. I'm not entirely happy with it and I saw it as a chance to help improve my use of STL and streams based programming. std::wifstream file(L"\\Windows\\myini.ini"); if (file) { bool section=false; while (!file.eof()) { std::wstring line; std::getlin...
stackexchange/codereview
I have a question about loops in flash.... In a tile game I'm making a have a mini map of the whole level. The way it renders the map is a function with a for loop in another for loop. It cycles through each tile position and attaches a map piece (basically a 3x3 pixel square) which is colored according to what the til...
stackexchange/codereview
I have one thread that writes results into a Queue. In another thread (GUI), I periodically (in the IDLE event) check if there are results in the queue, like this: def queue_get_all(q): items = [] while 1: try: items.append(q.get_nowait()) except Empty, e: break retur...
stackexchange/codereview
Just getting my head around Ruby metaprogramming. The mixin/modules always manage to confuse me. include: mixes in specified module methods as instance methods in the target class extend: mixes in specified module methods as class methods in the target class So is the major difference just this or is a bigger dragon...
stackexchange/codereview
I mean, I always was wondered about how the hell somebody can develop algorithms to break/cheat the constraints of legal use in many shareware programs out there. Just for curiosity.
stackexchange/codereview
I am planning to develop an operating system for the x86 architecture. What options of programming languages do I have? What types of compilers are there available, preferably on a Windows environment? Are there any good sources that will help me learn more about operating system development? Is it better to test my ...
stackexchange/codereview
It seems quite a few mainstream languages support function literals these days. They are also called anonymous functions, but I don't care if they have a name. The important thing is that a function literal is an expression which yields a function which hasn't already been defined elsewhere, so for example in C, &print...
stackexchange/codereview
I'm creating an ORM in PHP, and I've got a class 'ORM' which basically creates an object corresponding to a database table (I'm aiming for similar to/same functionality as an ActiveRecord pattern.) ORM itself extends 'Database', which sets up the database connection. So, I can call: $c = new Customer(); $c->name = 'Jo...
stackexchange/codereview
Suppose you work at a medium-to-large software company with many independently-developed projects (independent coders) but which rely on each other (dependent code). If it were up to you, would you make sure each project produced stable branches so that the other projects could more reliably use those branches, or woul...
stackexchange/codereview
I'm storing an object (TTF_Font) in a shared_ptr that is provided to me from a third-party API. I cannot use new or delete on the object, so the shared_ptr is also provided a "freeing" functor. // Functor struct CloseFont { void operator()(TTF_Font* font) const { if(font != NULL) { TTF_Close...
stackexchange/codereview
I would like to install SQLExpress2005 as an instance "SQLExpress" and install SQLExpresss2008 as "SQLExpress2008" instance. Is there any problem with doing this on the same machine?
stackexchange/codereview
I'm making an automated script to read a list from a site posting the latest compiled code. That's the part I've already figured out. The next part of the script is to grab that compiled code from a server with an Untrusted Cert. This is how I'm going about grabbing the file: $web = new-object System.Net.WebClient $w...
stackexchange/codereview
What is the best way to configure iPlanet/Sun ONE be the HTTP/HTTPS front end to a JBoss/Tomcat application? Are there any performance considerations? How would this compare with the native integration between Apache httpd and Tomcat?
stackexchange/codereview
The NetBeans 6.1 editor doesn't seem to like to wrap comments, and the code formatter seems to ignore them. For JavaDoc comments, this behaviour seems inappropriate, as you can end up spending a lot of wasted time manually reflowing paragraphs. I was wondering if there's some magic setting to get the builtin code form...
stackexchange/codereview
Does Information Hiding mean I should minimize the number of properties my classes have? Is that right? Do you tend to make your classes private fields with methods?
stackexchange/codereview
I recently heard of BDD and found it very similar to TDD. Which of these two do you use (if any)? and which are the pros and cons of each?
stackexchange/codereview
I can use properties of an Excel Worksheet to tell if the worksheet is protected (Worksheet.Protection, Worksheet.ProtectContents etc). How can I tell using VBA if the entire workbook has been protected?
stackexchange/codereview
Is there any way that I can remove the Print item from the context menu when you right-click on an email with VBA? I am forever right-clicking to reply to an email, only to accidentally click Print and have Outlook send it directly to the printer quicker than I can stop it. NB: I am using Outlook 2007.
stackexchange/codereview
Inno Setup is a nice easy to use installer. It is rated high in this stackoverflow question. I have a need to install a plugin to a folder relative to the installation folder of a 3rd Party application. It isn't obvious from the docs how to do this.
stackexchange/codereview
I am displaying pages from an external site (that I own) in an iframe in one of my pages. It's all fine except when viewed in Opera with the browser window size reduced (not widescreen), when the iframe shrinks and squashes the content. It works in widescreen (maximize browser window), and is OK in IE7, Firefox, Chrome...
stackexchange/codereview
We're using Crystal 11 through their webserver. When we run a report, it does the Sql query and displays the first page of the report in the Crystal web reportviewer. When you hit the next page button, it reruns the Sql query and displays the next page. How do we get the requerying of the data to stop? We also have mul...
stackexchange/codereview
How is it that Ruby allows a class access methods outside of the class implicitly? Example: class Candy def land homer end end def homer puts "Hello" end Candy.new.land #Outputs Hello
stackexchange/codereview
In other words may one use /<tag[^>]*>.*?<\/tag>/ regex to match the tag html element which does not contain nested tag elements? For example (lt.html): <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>greater than sign in attribute value</title> </...
stackexchange/codereview
As a Java developer who is reading Apple's Objective-C 2.0 documentation: I wonder what "sending a message to nil" means - let alone how it is actually useful. Taking an excerpt from the documentation: There are several patterns in Cocoa that take advantage of this fact. The value returned from a message to nil ...
stackexchange/codereview
When you search in Google (i'm almost sure that Altavista did the same thing) it says "Results 1-10 of about xxxx"... This has always amazed me... What does it mean "about"? How can they count roughly? I do understand why they can't come up with a precise figure in a reasonable time, but how do they even reach this "ap...
stackexchange/codereview
GWT gets locale from either the locale property or the locale query string. If neither is specified, it uses the "default" (ie en_US) locale. Why doesn't it get it from the browser settings? It seems the only solution to this is to replace your static html launch page with something like a JSP that reads the browser ...
stackexchange/codereview
How can I setup a shared ccache without falling into a permissions problem? I would like to run a nightly or CI build with latest changes and share all created binaries throughout the R&D using a large ccache repository.
stackexchange/codereview
I had recently a problem with oom-killer starting to kill processes after some time. I could see that the memory was consumed, but by the time I got to the server it wasn't clear anymore what consumed it. Is there a good non-obvious place to get more info about oom-killer? E.g. detailed info about processes at the time...
stackexchange/codereview
I am looking for a free tool to load Excel data sheet into an Oracle database. I tried the Oracle SQL developer, but it keeps throwing a NullPointerException. Any ideas?
stackexchange/codereview
I'm writing some semi-portable code and want to be able to detect when I'm compiling for iPhone. So I want something like #ifdef IPHONE_SDK.... Presumably Xcode defines something, but I can't see anything under project properties, and Google isn't much help.
stackexchange/codereview
One of my nasty (?) programming habits in C++ and Java is to always precede calls or accesses to members with a this. For example: this.process(this.event). A few of my students commented on this, and I'm wondering if I am teaching bad habits. My rationale is: Makes code more readable — Easier to distinguish fields f...
stackexchange/codereview
I have been given a requirement where I need to support multiple databases in the same instance, to support multi-tenancy. Each DB has an identical schema. The user logs into a specific database by choosing from a list, and all subsequent calls will go to that DB until they log out. I want to hot swap the session facto...
stackexchange/codereview
I have the following XML structure: <?xml version="1.0" ?> <course xml:lang="nl"> <body> <item id="787900813228567" view="12000" title="0x|Beschrijving" engtitle="0x|Description"><![CDATA[Dit college leert studenten hoe ze een onderzoek kunn$ <item id="5453116633894965" view="12000" title="0x|Onderwijsvorm" e...
stackexchange/codereview
I recently read somewhere that writing a regexp to match an email address, taking into account all the variations and possibilities of the standard is extremely hard and is significantly more complicated than what one would initially assume. Why is that? Are there any known and proven regexps that actually do this full...
stackexchange/codereview
It's quite a simple question - how do I sort a collection? I've got a CSV file with rows in a random order. I'd like to sort the rows according to the date in one column. Do I add the rows to a recordset? Can I sort with a Scripting.Dictionary? I've clearly been spoilt with .NET and Linq, and now I find myself back in ...
stackexchange/codereview
See title: what does it mean for a C++ function to be inline?
stackexchange/codereview
Visual Studio 2005 doesn't provide an interface for creating relationships between tables in a SQL Server CE database (I'm using version 3.0) and you can't open a Compact Edition DB using Management Studio as far as I know. Any ideas?
stackexchange/codereview
What's the best tool that you use to monitor Web Service, SOAP, WCF, etc. traffic that's coming and going on the wire? I have seen some tools that made with Java but they seem to be a little crappy. What I want is a tool that sits in the middle as a proxy and does port redirection (which should have configurable listen...
stackexchange/codereview
I am working on Linux with the GCC compiler. When my C++ program crashes I would like it to automatically generate a stacktrace. My program is being run by many different users and it also runs on Linux, Windows and Macintosh (all versions are compiled using gcc). I would like my program to be able to generate a stack ...
stackexchange/codereview
Can there be buffer overflow/overrun vulnerabilities in completely managed asp.net web portal.If yes how can this be tested.
stackexchange/codereview
Just found this out the hard way. I wanted to pop up a FontDialog to allow the user to choose a font.. one of those familiar dialogs..
stackexchange/codereview
In C++, it's not possible to initialize array members in the initialization list, thus member objects should have default constructors and they should be properly initialized in the constructor. Is there any (reasonable) workaround for this apart from not using arrays? [Anything that can be initialized using only the i...
stackexchange/codereview
I was using an enum in which the constant was a Class. I needed to invoke a method on the constant but could not introduce a compile time dependency and the enum was not always available at runtime (part of optional install). Therefore, I wanted to use reflection. This is easy, but I hadn't used reflection with enums...
stackexchange/codereview
Is it possible to enumerate all the current errors being displayed through an "Error Provider" without having to access the controls?
stackexchange/codereview
I'm looking for a free, preferably open source, http image processing server. I.e. I would send it a request like this: http://myimageserver/rotate?url=http%3A%2F%2Fstackoverflow.com%2FContent%2FImg%2Fstackoverflow-logo-250.png&angle=90 and it would return that image rotated. Features wanted: Server-side caching Seve...
stackexchange/codereview
I've been looking at F# recently, and while I'm not likely to leap the fence any time soon, it definitely highlights some areas where C# (or library support) could make life easier. In particular, I'm thinking about the pattern matching capability of F#, which allows a very rich syntax - much more expressive than the c...
stackexchange/codereview
I am selecting rows from a table, but some of the columns are a text type, but they always have numeric data in them. How can I format them as numbers? e.g. column quantity heading 'Quantity' format 999,999 However, since the column in the table is text, the numeric formatting is ignored.
stackexchange/codereview
I'm not happy with the rendering of HTML by Swing's JEditorPane. In particular bullets for unordered lists are hideous. Customising the rendering seems extremely difficult. Therefore I'm looking for a replacement with better HTML rendering. Does this exist? (I asked Google, and found nothing except a promising dead lin...
stackexchange/codereview
I'm implementing a cache in a class library that i'm using in an asp.net application. I created my cache object as a singleton pattern with a static method to update the cache which is really just loading a member variable/property with a collection of data i need cached (got some locking logic ofcourse). I figured it...
stackexchange/codereview
We have redesigned the structure to a website which has several business units. Now I want to redirect (301) to the new page. IE: was www.example.com/abc now www.example.com/default.aspx?article=abc I have tried to use Global.asax to do this, and it works properly when I debug through it. if (Request.RawUrl....
stackexchange/codereview
I need to set the text within a DIV element dynamically. What is the best, browser safe approach? I have prototypejs and scriptaculous available. <div id="panel"> <div id="field_name">TEXT GOES HERE</div> </div> Here's what the function will look like: function showPanel(fieldName) { var fieldNameElement = documen...
stackexchange/codereview
I am creating an SQL view for a file that strips out the spaces in a particular field. My question is if there is a why to set a key on that new view so a person can still CHAIN the file. We are on V5R3.
stackexchange/codereview
I am releasing a database build to SQL Server 2000 via a batch file using isql. The batch file is used so multiple files are released consistently to different SQL Servers (development, test, live). The SQL Server uses ANSI code page 1252 (from sp_helpsort) but isql is an OEM client using code page 437. This means that...
stackexchange/codereview
I try to fetch a Wikipedia article with Python's urllib: f = urllib.urlopen("http://en.wikipedia.org/w/index.php?title=Albert_Einstein&printable=yes") s = f.read() f.close() However instead of the html page I get the following response: Error - Wikimedia Foundation: Request: GET http://en.wikipedia.org/w/in...
stackexchange/codereview
Assume that we have N erlang nodes, running same application. I want to share an mnesia table T1 with all N nodes, which I see no problem. However, I want to share another mnesia table T2 with pairs of nodes. I mean the contents of T2 will be identical and replicated to/with only sharing pair. In another words, I want ...
stackexchange/codereview
python's time module seems a little haphazard. For example, here is a list of methods in there, from the docstring: time() -- return current time in seconds since the Epoch as a float clock() -- return CPU time since process start as a float sleep() -- delay for a number of seconds given as a float gmtime() -- convert...
stackexchange/codereview
I am adding custom controls to a FlowLayoutPanel. Each control has a date property. I would like to sort the controls in the flowlayoutpanel based on the date property. I can't presort the controls before I add them because it is possible for the user to add more. My current thought is when the ControlAdded event for t...
stackexchange/codereview
I am starting a new ASP.NET MVC project to learn with, and am wondering what's the optimal way to set up the project(s) to connect to a SQL server for the data. For example lets pretend we have a Product table and a product object I want to use to populate data in my view. I know somewhere in here I should have an int...
stackexchange/codereview
I need to figure out how to get the data from D3D textures and surfaces back to system memory. What's the fastest way to do such things and how? Also if I only need one subrect, how can one read back only that portion without having to read back the entire thing to system memory? In short I'm looking for concise des...
stackexchange/codereview
I have a string of arbitrary length, and starting at position p0, I need to find the first occurrence of one of three 3-letter patterns. Assume the string contain only letters. I need to find the count of triplets starting at position p0 and jumping forward in triplets until the first occurrence of either 'aaa' or 'bbb...
stackexchange/codereview
I have built a CFC designed to serve as a dynamic, aging cache intended for almost everything worth caching. LDAP queries, function results, arrays, ojects, you name it. Whatever takes time or resources to calculate and is needed more than once. I'd like to be able to do a few things: share the CFC between application...
stackexchange/codereview
After I develop my add-in for Microsoft Office ( and in the process messed up all my menu bars and tool bars) using Visual Studio For Office, is there anyway to restore the MS Office to default? For the record, Clean Solution alone is not enough!
stackexchange/codereview
I am using the open source Javascript WYSIWYG from OpenWebWare and Asp.Net RequiredFieldValidator on the TextBox which I am calling the WYSIWYG for. Everything works fine, but the first time I try to submit the form, I get the server-side RFV ErrorMessage "Required", but if I submit a second time, it goes through. Am ...
stackexchange/codereview
I have a problem with the design of a VetoableChangeListener. I implement the VetoableChangeListener interface to listen changes of a property in a model class, so when the model fires vetoableChange(PropertyChangeEvent evt) throws PropertyVetoException …I try to save the change in a DB, which could fail (by an SQLEx...
stackexchange/codereview
When you use Zedgraph for linegraphs and set IsSmooth to true, the lines are nicely curved instead of having hard corners/angles. While this looks much better for most graphs -in my humble opinion- there is a small catch. The smoothing algorithm makes the line take a little 'dive' or 'bump' before going upwards or down...
stackexchange/codereview
Whilst working on a recent project, I was visited by a customer QA representitive, who asked me a question that I hadn't really considered before: How do you know that the compiler you are using generates machine code that matches the c code's functionality exactly and that the compiler is fully deterministic? To thi...
stackexchange/codereview
I am following the M-V-VM pattern for my WPF UI. I would like to hook up a command to the TextChanged event of a TextBox to a command that is in my ViewModel class. The only way I can conceive of completing this task is to inherit from the TextBox control, and implement ICommandSource. I can then instruct the command t...
stackexchange/codereview
In C++, I'm trying to catch all types of exceptions in one catch (like catch(Exception) in C#). How is it done? And what's more, how can one catch divide-by-zero exceptions?
stackexchange/codereview
Okay, here is the 411 - I have the following event handler in my Global.asax.cs file: private void Global_PostRequestHandlerExecute(object sender, EventArgs e) { if (/* logic that determines that this is an ajax call */) { // we want to set a cookie Response.Cookies.Add(new HttpCookie("MyCookie", "tru...
stackexchange/codereview
Is there a way to alter the precision of an existing decimal column in Microsoft SQL Server?
stackexchange/codereview
This is my setting: I have written a .NET application for local client machines, which implements a feature that could also be used on a webpage. To keep this example simple, assume that the client installs a software into which he can enter some data and gets some data back. The idea is to create a webpage that holds...
stackexchange/codereview
When is it appropriate to use a class in Visual Basic for Applications (VBA)? I'm assuming the accelerated development and reduction of introducing bugs is a common benefit for most languages that support OOP. But with VBA, is there a specific criterion?
stackexchange/codereview
I'm trying to profile SQL reporting services, used from ASP.NET application. In SQL profiler all the SQL run by ASP.NET shows up. It looks like the reporting SQL (from the RDL) doesn't show. Is there some setting or filter I'm missing?
stackexchange/codereview
I need to do some emulation of some old DOS or mainframe terminals in Flex. Something like the image below for example. The different coloured text is easy enough, but the ability to do different background colours, such as the yellow background is beyond the capabilities of the standard Flash text. I may also need to...
stackexchange/codereview
My stored procedure is called as below from an SQL instegartion package within SQL Server 2005 EXEC ? = Validation.PopulateFaultsFileDetails ? , 0 Though i'm not sure what the ? means
stackexchange/codereview
How do I write an Excel workbook to a MemoryStream without first saving it to the file system? All options within the Microsoft.Office.Interop.Excel.WorkBook save options take a filename.
stackexchange/codereview
How can I use JUnit idiomatically to test that some code throws an exception? While I can certainly do something like this: @Test public void testFooThrowsIndexOutOfBoundsException() { boolean thrown = false; try { foo.doStuff(); } catch (IndexOutOfBoundsException e) { thrown = true; }...
stackexchange/codereview
I'm trying to insert some import lines into a python source file, but i would ideally like to place them right after the initial docstring. Let's say I load the file into the lines variable like this: lines = open('filename.py').readlines() How to find the line number, where the docstring ends?
stackexchange/codereview
I'm implementing a email newsletter sender service using .NET and Windows Server technologies. Are there comprehensive guidelines which could help avoiding emails being trapped by spam filters and other mechanisms? They should cover all aspects of (legal) bulk mail sending: SMTP configuration, DNS, HTML content, images...
stackexchange/codereview
CLR profiler does not seem to work with the Silverlight CLR. Does another memory profiler exist?
stackexchange/codereview
Alright, I have been doing the following (variable names have been changed): FileInputStream fis = null; try { fis = new FileInputStream(file); ... process ... } catch (IOException e) { ... handle error ... } finally { if (fis != null) fis.close(); } Recently, I started using FindBugs, whic...
stackexchange/codereview
I am using following PHP code to connect to MS Access database: $odb_conn = new COM("ADODB.Connection"); $connstr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=". $db_path.";"; $odb_conn->open($connstr); How can I retrieve database catalog/metadata from the mdb file? FOUND THE SOLUTION $rs_meta = $odb_conn->OpenSch...
stackexchange/codereview
I have been tasked with implementing a PKI library in C# for a company project, and have been unable to find a good implementation of it. There appear to be multiple libraries, and many broken links pointing to MSDN libraries that have been removed. I've seen people using Crypt32.dll, people building their own librarie...
stackexchange/codereview
Is there a way to increase the stack size of a Windows application at compile/link time with GCC?
stackexchange/codereview