instruction_seed
stringlengths
1
35.8k
_source
stringclasses
1 value
I have an application that manages patient demographic information. Along with this data a user can scan a picture of a patient and assign that picture to a patient. When the user clicks the scan button a separate application is opened as a dialog in order to scan the image. When running this on XP everything worked fi...
stackexchange/codereview
Can anyone recommend for/against the time-travel functions in postgresql's contrib/spi module? Is there an example available anywhere? Tnx
stackexchange/codereview
I understand that IronPython is an implementation of Python on the .NET platform just like IronRuby is an implementation of Ruby and F# is more or less OCaml. What I can't seem to grasp is whether these languages perform closer to their "ancestors" or closer to something like C# in terms of speed. For example, is Ir...
stackexchange/codereview
I have a data set whose elements are displayed as rows in a DataGrid. The sort order for the rows changes in response to external events. My initial thought was to store the rows as an ObservableCollection and resort the collection after updates. However I ran into two problems: 1) the ObservableCollection does not ...
stackexchange/codereview
One of the biggest challenges that I've encountered with SharePoint is that it doesn't lend itself nicely to the typical project environment, which, at minimum, contain development and production environments. The issues I've run into the most are that content and lists are so tightly coupled that it makes it difficul...
stackexchange/codereview
Disclaimer: I've solved the problem using Expressions from System.Linq.Expressions, but I'm still looking for a better/easier way. Consider the following situation : var query = from c in db.Customers where (c.ContactFirstName.Contains("BlackListed") || c.ContactLastName.Contains("BlackListed") ||...
stackexchange/codereview
I added a project to an existing solution that is currently under source control using TFS, but for some reason I cannot check in the new project. When I view my pending changes, none of the files in the new project show up. None of the files have a plus (for a new file) next to them. What did I do wrong? How do I ...
stackexchange/codereview
I have an XML schema that includes multiple addresses: <xs:element name="personal_address" maxOccurs="1"> <!-- address fields go here --> </xs:element> <xs:element name="business_address" maxOccurs="1"> <!-- address fields go here --> </xs:element> Within each address element, I include a "US State" enumeration: <...
stackexchange/codereview
I'm exploring the iPhone SDK and want to create and use a UI component like the figure below. A rounded table with cells in which each cell can have some label text, maybe an input text field and an action button that would take it to the next screen. The table should not be screen filling. But... I can't figure out ho...
stackexchange/codereview
I recently stumbled across this entry in the google testing blog about guidelines for writing more testable code. I was in agreement with the author until this point: Favor polymorphism over conditionals: If you see a switch statement you should think polymorphisms. If you see the same if condition repeated in many p...
stackexchange/codereview
There is probably is simple fix for this but I currently have code similar to dim dr as dbDataReader try dr = connection.getDataReader(sql_str) Catch ex as sqlClientException log.error(ex) finally if not IsNothing(dr) then dr.close end if end try However Visual Studio still warns me that the if...
stackexchange/codereview
When printing in Windows forms, or doing a print preview, a dialog is displayed with text like Page [P] of [DOC] where [P] is page number and [DOC] is the name of the document. The dialog also contains a button to allow the user to cancel the print job. How can I change the text displayed? What I would prefer is text ...
stackexchange/codereview
I'm attempting to determine the row length in bytes of a table by executing the following stored procedure: CREATE TABLE #tmp ( [ID] int, Column_name varchar(640), Type varchar(640), Computed varchar(640), Length int, Prec int, Scale int, Nullable varchar(640), TrimTrailingBlanks varchar(640)...
stackexchange/codereview
I have a Rails application that in the erb code, I use a select box. What I would like to do is reload the page passing the sort parameter. My controller already handles it, but I don't know how to reload the page with the selected value from my select box. Here is my code: <% @options = {:latest => 'lastest' , :alphab...
stackexchange/codereview
I have a Visual Studio 2008 solution with two projects in it. A C++ DLL and a Csharp application. The Csharp application uses [DllImport] to access the functions in the DLL, and has a dependency set on the DLL. For some reason, setting the dependency isn't sufficient to cause VS to copy the DLL to the build path of the...
stackexchange/codereview
I'm writing a config file and I need to define if the process expects a windows format file or a unix format file. I've got a copy of the expected file - is there a way I can check if it uses \n or \r\n without exiting emacs?
stackexchange/codereview
I am looking for reference documentation for designMode in Firefox 2/3 and IE 6/7/8. Does anyone have links to good references?
stackexchange/codereview
I need to do some work with a backup WSS .dat file and I'm having real trouble making it do anything. I've got it installed through stsadm and that appears to have gone smoothly, but the site now redirects me to an error page - just the classic "File Not Found" one, but in the URL it suggests the errortext would be "Cl...
stackexchange/codereview
I'd like to configure visual studio 2005 to copy .dll's based on whether the OS is 64-bit or 32-bit during a build. I do not want to specify what the platform target is. My first attempt was to use a batch file to lookup the Windows version, but some 32-bit and 64-bit versions of Windows share the same version number...
stackexchange/codereview
Eg. ConnectionDetails cd = new ConnectionDetails (); cd.ProviderName = "System.Data.OleDb"; cd.DataSource = "serverAddress"; cd.Catalog = "database"; cd.UserId = "userId"; cd.Password = "password"; string connectionString = cs.CreateConnectionString(); // Should return: // "Provider=SQLOLEDB;Data Source=serverAddress;...
stackexchange/codereview
I have a collection of elements that I need to operate over, calling member functions on the collection: std::vector<MyType> v; ... // vector is populated For calling functions with no arguments it's pretty straight-forward: std::for_each(v.begin(), v.end(), std::mem_fun(&MyType::myfunc)); A similar thing can be done...
stackexchange/codereview
I need to serialize an object to JSON. I'm using jQuery. Is there a "standard" way to do this? My specific situation: I have an array defined as shown below: var countries = new Array(); countries[0] = 'ga'; countries[1] = 'cd'; ... and I need to turn this into a string to pass to $.ajax() like this: $.ajax({ type...
stackexchange/codereview
I want to be able to do the following: $normal_array = array(); $array_of_arrayrefs = array(&$normal_array); // Here I want to access the $normal_array reference **as a reference**, // but that doesn't work obviously. How to do it? end($array_of_arrayrefs)["one"] = 1; // choking on this one print $normal_array[...
stackexchange/codereview
Is there a way to programaticaly install a ssl cert for iis 6 and 7?
stackexchange/codereview
I'm looking into some possible options for unit testing C++ classes. So, short and to the point, what are you using?
stackexchange/codereview
This was something originally discussed during a presentation given by Charles Brian Quinn of the Big Nerd Ranch at acts_as_conference. He was discussing what he had learned from instructing a Ruby on Rails Bootcamp to many people both new to programming and new to Rails. One particular slide that stood out was along ...
stackexchange/codereview
I have a SQL CLR function in SQL Server 2005. I want to profile this function to make sure there are no memory leaks. Any recommendations on how to determine if my function is behaving properly?
stackexchange/codereview
I have the following component public class MyTimer : IMyTimer { public MyTimer(TimeSpan timespan){...} } Where timespan should be provided by the property ISettings.MyTimerFrequency. How do I wire this up in windsor container xml? I thought I could do something like this: <component id="settings" ...
stackexchange/codereview
I have around 3500 flood control facilities that I would like to represent as a network to determine flow paths (essentially a directed graph). I'm currently using SqlServer and a CTE to recursively examine all the nodes and their upstream components and this works as long as the upstream path doesn't fork alot. Howeve...
stackexchange/codereview
I am developing a forms app (not web) for Windows Mobile, using .NET CF 3.5. I need an HTML editor control. I'm looking for something along the lines of a simple FCKEditor, but for using in a forms app (EXE). Any suggestions?
stackexchange/codereview
I'm trying to write an app using Ruby on Rails and I'm trying to achieve the following: The app needs to receive UDP messages coming in on a specific port (possibly 1 or more per second) and store them in the database so that the rest of my Rails app can access it. I was thinking of writing a separate daemon that w...
stackexchange/codereview
I have a legacy WinForms Mdi App in VB.Net 2.0 which I am adding functionality to. One of the additions is a warning which needs to be raised when the current time nears a specified value (a deadline). My intention is to check the time once an hour until there is less than an hour until the deadline, then display warni...
stackexchange/codereview
I have an XML file loaded into a DOM document, I wish to iterate through all 'foo' tags, getting values from every tag below it. I know I can get values via $element = $dom->getElementsByTagName('foo')->item(0); foreach($element->childNodes as $node){ $data[$node->nodeName] = $node->nodeValue; } However, what I'...
stackexchange/codereview
In PHP, replace one URL with another within a string e.g. New post on the site <a href="http://stackoverflow.com/xyz1">http://stackoverflow.com/xyz1</a></p> becomes: New post on the site <a href="http://yahoo.com/abc1">http://yahoo.com/abc1</a></p> Must work for repeating strings as above. Appreciate this is simple ...
stackexchange/codereview
I need to be able to take a string like: '''foo, bar, "one, two", three four''' into: ['foo', 'bar', 'one, two', 'three four'] I have an feeling (with hints from #python) that the solution is going to involve the shlex module.
stackexchange/codereview
do you use a tool? or just manually make them?
stackexchange/codereview
If I'm deep in a nest of loops I'm wondering which of these is more efficient: if (!isset($array[$key])) $array[$key] = $val; or $array[$key] = $val; The second form is much more desirable as far as readable code goes. In reality the names are longer and the array is multidimensional. So the first form ends up lookin...
stackexchange/codereview
I have a database on ms sql 2000 that is being hit by hundreds of users at a time. There are intense reports using reporting services 2005 hitting the same database. When there are lots of reports running and people using the database concurrently we see blocking processes to the level that the system starts to give ti...
stackexchange/codereview
If I were to use more than one, what order should I use modifier keywords such as: public, private, protected, virtual, abstract, override, new, static, internal, sealed, and any others I'm forgetting.
stackexchange/codereview
Our company has a point of sale system with many extras, such as ordering and receiving functionality, sales and order history etc. Our main issue is that the system was not designed properly from the ground up, so it takes too long to make fixes and handle requests from our customers. Also, the current technology we a...
stackexchange/codereview
Is it possible to define a class in C# such that class GenericCollection<T> : SomeBaseCollection<T> where T : Delegate I couldn't for the life of me accomplish this last night in .NET 3.5. I tried using delegate, Delegate, Action<T> and Func<T, T> It seems to me that this should be allowable in some way. I'm trying to...
stackexchange/codereview
Is there a CIL instruction to exchange the first two elements in the stack?
stackexchange/codereview
In my project I have a class that is inherited by many other classes. We'll call it ClassBase. public class ClassInheritFromBase : ClassBase When ClassBase is being inherited, ReSharper throws an "Ambiguous reference" warning on the ClassBase, and anything inside the new class that inherited from ClassBase does not ha...
stackexchange/codereview
If I have the following Linq code: context.Table1s.InsertOnSubmit(t); context.Table1s.InsertOnSubmit(t2); context.Table1s.InsertOnSubmit(t3); context.SubmitChanges(); And I get a database error due to the 2nd insert, Linq throws an exception that there was an error. But, is there a way to find out that it was the 2n...
stackexchange/codereview
What is the correct way to do this? For example, how would I change a stored procedure with this signature: CREATE PROCEDURE dbo.MyProcedure @Param BIT = NULL AS SELECT * FROM dbo.SomeTable T WHERE T.SomeColumn = @Param So that giving @Param with a value of 1 or 0 performs the filter, but not specifying it or ...
stackexchange/codereview
On a Use Case diagram can you show things that an actor cannot do, for example because they won't have permissions to do it? Or is it just implied due to the fact that they won't have a line joining them to the particular use case?
stackexchange/codereview
I am getting a very non specific error when trying to connect to SQL server on remote server. I feel like I have made all the correct settings, allow TCP/IP, restarted the service, added rights to NT AUTHORITY\NETWORK SERVICE and other related users for the database. I can get to the aspx page, but as soon as I hit sub...
stackexchange/codereview
I want to be able to specify the file name stem for the log file in a Specman test. I need to hard-code the main *.elog filename so that I don't get variance between tests and confuse the post-processing scripts. Is there a constraint or command line I can pass into Specman?
stackexchange/codereview
The SQL implementation of relational databases has been around in their current form for something like 25 years (since System R and Ingres). Even the main (loosely adhered to) standard is ANSI-92 (although there were later updates) is a good 15 years old. What innovations can you think of with SQL based databases in ...
stackexchange/codereview
Should I create two CFile objects and copy one into the other character by character? Or is there something in the library that will do this for me?
stackexchange/codereview
Can anyone recommend a .NET winforms control that offers similar functionality to the address bar in Windows Explorer, auto-completing file paths? I'm not too bothered about Vista-style breadcrumbs - quite happy with a simple XP-style textbox-only appearance, but I'd like it to offer auto-complete suggestions based on ...
stackexchange/codereview
I am writing a little application, which is writing jpeg images at a constant rate on a SD card. I choose an EXT3 filesystem, but the same behaviour was observed with an EXT2 filesystem. My writing loop looks like this : get_image() fwrite() fsync() Or like this : get_image() fopen() fwrite() fsync() fclose() I also...
stackexchange/codereview
In Eclispe you can do Ctrl+Shift+R and a Window popup where you can write the name of the file (or just the beginning of it) and to press enter to go directly to the file. What is the equivalence in Visual Studio 2005? (Ctrl+Shift+F is not what I would like).
stackexchange/codereview
I need a Project management tool that works in Linux, and has Gantt charts. It doesn't have to be free, just not expensive. I don't care how it stores the information I give it, as long as I can access it. I must be able to print the Gantt charts. Must work in Linux. With those requirements, what can you recommend? T...
stackexchange/codereview
In Eclipse (Ganymede) I'm debugging some code that uses Apache Commons HttpClient and would like to step into the HttpClient code. I've downloaded the source code and tried to attach it in the normal fashion (CTRL-click on the method name and use the Attach Source button). I've tried to attach both as external file and...
stackexchange/codereview
I am using Visual Studio Team System 2008, version 9.0.30729.1 SP. I have a database project that I was working with yesterday with no issues - I was able to build and deploy the database successfully. Today, however, when I open the solution I receive what is listed as a "Warning" that halts any Build/Deploy/etc proce...
stackexchange/codereview
I'm writting a simple prototype front end using a GridView that is populated via function, rather than being linked directly to a SqlServer data source. So I can delete a row/record from grid/underlying database I am currently Setting the AutoGenerateDeleteButton = true Displaying the unique record ids in the first co...
stackexchange/codereview
I asked this question a while back and basically the project almost consists of reproducing excel in the browser. We want people to input data in an excel-like way. The question i have is, what is the best control to use? Should i use a regular table, and then append columns to it, or should i use a datagrid and fli...
stackexchange/codereview
Why are pipes considered dangerous to use? What can be done to avoid these security issues? I'm mostly interested in Windows, but if you have other OS information, please provide.
stackexchange/codereview
I am trying to use concat_ws inside a group_concat command. With a query, which simplified looks like: SELECT item.title, GROUP_CONCAT( CONCAT_WS( ',', attachments.id, attachments.type, attachments.name ) ) as attachments FROM story AS item LEFT OUTER JOIN story_attachment AS attachments ON item.id = attachments...
stackexchange/codereview
I have a string which is like this: this is [bracket test] "and quotes test " I'm trying to write something in Python to split it up by space while ignoring spaces within square braces and quotes. The result I'm looking for is: ['this','is','bracket test','and quotes test ']
stackexchange/codereview
I reloaded an old project, and tried to run it only to run into the Binding Failure MDA Assistant: BindingFailure was detected Message: The assembly with display name 'SoapTest.XmlSerializers' failed to load in the 'LoadFrom' binding context of the AppDomain with ID 1. The cause of the failure was: System.IO.FileNo...
stackexchange/codereview
I understand that an id must be unique within an HTML/XHTML page. For a given element, can I assign multiple ids to it? <div id="nested_element_123 task_123"></div> I realize I have an easy solution with simply using a class. I'm just curious about using ids in this manner.
stackexchange/codereview
...just like packages do. I use Emacs (maybe, it can offer some kind of solution). For example (defun the-very-very-long-but-good-name () ...) is not to useful later in code. But the name like Fn-15 or the first letters abbreviation is not useful too. Is it possible either to have an alias like for packages or to acces...
stackexchange/codereview
We're reviewing one of the company's system's exception handling and found a couple of interesting things. Most of the code blocks (if not all of them) are inside a try/catch block, and inside the catch block a new BaseApplicationException is being thrown - which seems to be coming from the Enterprise Libraries. I'm i...
stackexchange/codereview
open_basedir limits the files that can be opened by PHP within a directory-tree. I am storing several class libraries and configuration files outside of my web root directory. This way the web server does not make them publicly accessible. However when I try to include them from my application I get an open_basedir r...
stackexchange/codereview
I want to create a component that allows us to have compound keyboard shortcuts associated with an arbitrary command, like the Visual Studio IDE and Microsoft Office do. That is, keyboard shortcuts consisting of a sequence of multiple keystrokes, such as Ctrl + W + C. In Visual Studio this opens the class-view. When th...
stackexchange/codereview
Ok, so I'm building bread crumbs and depending on the value of the breadcrumb an image will be the seperator. So "HOME" will have one image and "SEARCH" will have another. I know I can do this programatically (at least I ASSUME) but is there an easier way to do this? Can I link an image to a node based on the value of...
stackexchange/codereview
Is there a ColdFusion analog for the deployment descriptor/web.xml file found in a J2EE web container? I know CF is running on top of JRun and that I could just tweak the JRun dd, but what about an application-specific configuration file? Is there something like this that I'm not aware of or do you just have to roll yo...
stackexchange/codereview
I have a set of Word documents which I want to publish using a PHP tool I've written. I copy and paste the Word documents into a text box and then save them into MySQL using the PHP program. The problem I Have arises from all the non-standard characters that Word documents have, like curly quotes and ellipses ("..."). ...
stackexchange/codereview
What are the differences between pipes in Windows and Linux?
stackexchange/codereview
I created a simple class with a DependencyProperty. When setting the value, I observe that ValidateValueCallback is called before CoerceValueCallback. On wpftutorial and in other books, it is stated that coercion is called before validation.
stackexchange/codereview
Shouldn't this be a pretty straightforward operation? However, I see there's neither a size() nor length() method.
stackexchange/codereview
I have a .asp application where image files (.PDF) are stored in a directory (fed by a copier/scanner). The created file names are stored in a database table. When a query is launched from the web page a link to the file is created. When clicked the image should be displayed. This functionality works 100% in Internet...
stackexchange/codereview
I've got a text box bound to an object's property (in fact several text boxes) on a form. This for is an editor for an object. When i'm editing some objects and modify values in the one of the text boxes i can't exit from the text box (neither by tab nor clicking on another text box). However that's not always the case...
stackexchange/codereview
We have PHP 5.2.6 deployed to c:\php and in that folder there is the php.ini file. On Windows, can a website override these settings similar to the way that apache has .htaccess? e.g. DirectoryIndex index.php index.html <IfModule mod_php5.c> php_flag magic_quotes_gpc off php_flag register_globals off </IfModule> <IfM...
stackexchange/codereview
I am writing a diagnostic page for SiteScope and one area we need to test is if the connection to the file/media assets are accesible from the web server. One way I think I can do this is load the image via code behind and test to see if the IIS status message is 200. So basically I should be able to navigate to wit...
stackexchange/codereview
Is Eclipse the best IDE for Java? If not, is there something better? I want to know and possibly try it out. Thanks.
stackexchange/codereview
Does anyone know how to scan an image with X++?
stackexchange/codereview
I have an if condition which checks for value and the it throws new NumberFormatException Is there any other way to code this if (foo) { throw new NumberFormatException } // .. catch (NumberFormatException exc) { // some msg... }
stackexchange/codereview
I'm setting up a new project using CruiseControl.net 1.4. I see from ccnet contributions that there are two options for a subversion repository number labeller - a feature that I would really like to make use of. 1) SVNLabeller available from jcxsoftware and 2) Svnrevisionlabeller available from google code My problem ...
stackexchange/codereview
How do I totally disable caching in nHibernate?
stackexchange/codereview
So I assume I'm not the only one. I'm wondering if there are others out there who have compiled a personal code library. Something that you take from job to job that has examples of best practices, things you are proud of, or just common methods you see yourself using over and over. I just recently started my C# libra...
stackexchange/codereview
From day 1 of my programming career, I started with object-oriented programming. However, I'm interested in learning other paradigms (something which I've said here on SO a number of times is a good thing, but I haven't had the time to do). I think I'm not only ready, but have the time, so I'll be starting functional p...
stackexchange/codereview
When calling php via cli, the current directory is NOT changed to the one of the script. All the scripts i have running in crontab run via the CLI, so this is an issue. I'm currently fixing the problem by doing a chdir() with the absolute path where the script is, but i REALLY dont like hardcoding paths into stuff like...
stackexchange/codereview
.NET Framework 3.5 SP1 installs the .NET Framework 2.0 SP2 and the .NET Framework 3.0 SP2 behind the scenes. These installation packages (especially .NET Framework 2.0 SP2) are not available directly from Microsoft. Is there a way to extract them from the .NET Framework 3.5 SP1 installation package?
stackexchange/codereview
Is there any good reason that an empty set of round brackets (parentheses) isn't valid for calling the default constructor in C++? MyObject object; // ok - default ctor MyObject object(blah); // ok MyObject object(); // error I seem to type "()" automatically everytime. Is there a good reason this isn't allowed?...
stackexchange/codereview
Can I setup a custom MIME type through ASP.NET or some .NET code? I need to register the Silverlight XAML and XAP MIME types in IIS 6.
stackexchange/codereview
I have data that looks like CUSTOMER, CUSTOMER_ID, PRODUCT ABC INC 1 XYX ABC INC 1 ZZZ DEF CO 2 XYX DEF CO 2 ZZZ DEF CO 2 WWW GHI LLC 3 ZYX I'd like to write a query that'd make the data look like this: CUSTOMER, CUSTOMER_ID, PR...
stackexchange/codereview
I'm currently studying Computer Science at College where they mainly teach Java standard edition, I see that in the industry this isn't used much, instead Java EE is used. If my College is teaching me Java SE rather than Java EE does this make me less employable? And what exact are the differences? different syntax? di...
stackexchange/codereview
I know that primary keys based on Guids do not have the best performance (due to the fragmentation), but they are globally unique and allow replication scenarios. Integral identifiers, on the other side, have greater performance at the cost of scalability. But in what scenarios would someone want to use sequential uniq...
stackexchange/codereview
So what I'm looking for here is something like PHP's print_r function. This is so I can debug my scripts by seeing what's the state of the object in question.
stackexchange/codereview
In PHP, I am able to use a normal function as a variable without problem, but I haven't figured out how to use a static method. Am I just missing the right syntax, or is this not possible? (EDIT: the first suggested answer does not seem to work. I've extended my example to show the errors returned.) function foo1($a,...
stackexchange/codereview
I have an Internet Explorer only web application. I'm exploring what we can do to automate the testing. Selenium looks like a good tool, but to be able to activate links etc. I need to tell it where they are. The application wasn't built with this kind of testing in mind, so there generally aren't id attributes on the...
stackexchange/codereview
I've been using Winforms since .NET 1.1 and I want to start learning WPF. I'm looking for some good resources for a beginner in WPF. What should I read, what tools do I need, and what are the best practices I should follow?
stackexchange/codereview
When you create your mapping files, do you map your properties to fields or properties : <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="Foo" namespace="Foo.Bar" > <class name="Foo" table="FOOS" batch-size="100"> [...] <property name="FooProperty1" access="field.camelcase" column="FOO_1" type=...
stackexchange/codereview
I am writing in C#. How can i find out which methods/functions I can use in an unmanaged dll that doesn't belong to windows? Exmaple : I have some installed software on my computer, it has a dll, and i want to know what my options are as to creating code to connect to that software?
stackexchange/codereview
I want to use the DateTime.TryParse method to get the datetime value of a string into a Nullable. But when I try this: DateTime? d; bool success = DateTime.TryParse("some date text", out (DateTime)d); the compiler tells me 'out' argument is not classified as a variable Not sure what I need to do here. I've also t...
stackexchange/codereview
This may seem a bit trivial, but I have not been able to figure it out. I am opening up a SPSite and then trying to open up a SPWeb under that SPSite. This is working fine on the VPC, which has the same Site Collection/Site hierarchy, but on production, I get an exception telling me that the URL is invalid when I try...
stackexchange/codereview
I need specifically to load a JPG image that was saved as a blob. GDI+ makes it very easy to retrieve images from files but not from databases...
stackexchange/codereview