instruction_seed
stringlengths
1
35.8k
_source
stringclasses
1 value
I've been trying to design a database schema for a side project but I havent been able to produce anything that I'm comfortable with. I'm using ASP.Net with LINQ for my data access: I'm going to allow users to specify up to 10 "items" each with 2 numeric properties, and 1 referential property, the item name. If I were ...
stackexchange/codereview
On Ubuntu Linux with Gnome, running my Swing application by double clicking on the jar file in Gnomes file browser leads to errors because required libraries that are dynamically loaded via the Java Plugin Framework (residing in subdirectories) are not found. The base libraries for the framework itself are resolved cor...
stackexchange/codereview
In .net, is there a way using reflection to determine if a parameter on a method is marked with the "params" keyword?
stackexchange/codereview
I wish to dynamically change the scroll position of a Silverlight ListBox from C#, and I need to know how to access the ScrollViewer element of a ListBox control from C#? Thanks guys, Jeff
stackexchange/codereview
In a forms model, I used to get the current logged-in user by: Page.CurrentUser How do I get the current user inside a controller class in ASP.NET MVC?
stackexchange/codereview
Here is the question: Can TortoiseSvn work on Windows 2008 without turning off User Account Control? Here is the story: I just moved my test server to Windows 2008 and I am having problems with TortoiseSvn. I am logged on as an administrator, but when I go to update some code from the Subversion repository, I get a m...
stackexchange/codereview
I tried this: ALTER TABLE My.Table DROP MyField and got this error: -MyField is not a constraint. -Could not drop constraint. See previous errors. There is just one row of data in the table and the field was just added. EDIT: Just to follow up, the sql was missing COLUMN indeed. Now I get even more seriously looking e...
stackexchange/codereview
A while ago I had a query that I ran quite a lot for one of my users. It was still being evolved and tweaked but eventually it stablised and ran quite quickly, so we created a stored procedure from it. So far, so normal. The stored procedure, though, was dog slow. No material difference between the query and the proc...
stackexchange/codereview
I've got a java server (not web based, more like a big, many-threaded standalone application) that needs to talk to a MS SQL Server database. I just worked on a different project that ported a home-grown O/R layer from oracle to SQL Server, and it ran into significant problems because of too many oracle assumptions (l...
stackexchange/codereview
I am trying to add a png image resource in a specific Silverlight project folder. I would like to refer to this image with in my tag? I only seem to get this working when the xaml file containing the image tag is located in the same directory as the png file. For example in the xap file the png file would be locate...
stackexchange/codereview
Do I really have to learn Objective-C to develop solid Mac Apps? As Mac users tend to use only applications that have a nice (native) GUI, i don't think that Mono and GTK+ or any Java GUI (Swing) will fit their needs. There are projects like Cocoa#, PyObjC and RubyCocoa, but are they ready for primetime? So do I really...
stackexchange/codereview
I have a plugin for OpenFire that creates and delivers a message to a user using XMPPServer.getInstance().getMessageRouter().route(message) What I would like to know is what happens to that message if the user is not online. My goal is to only have the message delivered if the user is online, and fail or be routed t...
stackexchange/codereview
I'm trying to use TJCLHashMap family of classes, but apparently this class has no useful public methods. All methods are "protected". How to use this class? Although JCL comes with some samples, I seem to miss something. A basic example would be great.
stackexchange/codereview
What are the current best practices in the Rails world for displaying a calendar month view with event items bound to the days in the month (like in Backpack or Google Calendar, for example)? I don't need anything like fancy stuff like drag and drop support. I'm just looking for code to let me get a list of events in ...
stackexchange/codereview
I have some scripts that ought to have stopped running but hang around forever. Is there some way I can figure out what they're writing to STDOUT and STDERR in a readable way? I tried, for example, to do: $ tail -f /proc/(pid)/fd/1 but that doesn't really work. It was a long shot anyway. Any other ideas? strace on ...
stackexchange/codereview
Has anyone tested sorting with Selenium? I'd like to verify that sorting a table in different ways work (a-z, z-a, state, date, etc.). Any help would be very much appreciated. /Göran
stackexchange/codereview
How can i, in a bash script, execute a command when the user stops the script (with ctrl - c)? Currently, i have this: afplay file.mp3 while true: do osascript -e "set volume 10" end But i would like it to execute killall afplay when the user is finished with it, regardless if it is command-c or another keypress.
stackexchange/codereview
I am currently working on software that must emit SNMP traps for SNMP versions 1 & 2 and possibly v3 in the future. I have downloaded several and found them to be either too complex or too simplistic. All I want is to view traps and analyze the data structures within them, and the ability to import my custom MIB's. The...
stackexchange/codereview
I have an existing C++ project on a linux environment, and would like to import it into the Eclipse IDE. Not sure if I should start a new Eclipse C++ project, or if there was some way to import the source files?
stackexchange/codereview
I have mapped several java classes like Customer, Assessment, Rating, ... to a database with Hibernate. Now i am thinking about a history-mode for all changes to the persistent data. The application is a web application. In case of deleting (or editing) data another user should have the possibility to see the changes ...
stackexchange/codereview
How to cancel a keypress event in a textbox after pressing the return key.
stackexchange/codereview
I have an IList of type Breadcrumb which is just a lightweight class that has NavigationTitle, NavigationUrl and IsCurrent properties. It is cached on the webserver. I have a method that builds out the current breadcrumb trail up until the first Breadcrumb that has IsCurrent set to true... using the code below. Its ver...
stackexchange/codereview
When I try to allocate a Texture2D the app just crashes. I've stepped through the code where the crash occurs... all I can tell is "EXC BAD ACCESS". Here is the line in the app delegate that makes it crash: _textures[myTex] = [[Texture2D alloc] initWithImage: [UIImage imageNamed:@"sometex.png"]]; sometex.png has bee...
stackexchange/codereview
I am currently updating a web app that uses ActiveX objects in client side code to manipulate some xml. Of course, this app only works in IE and I need to get it cross browser compatible. I am looking to get a javascript xml library to handle the cross browser oddities, and was wondering if the ASP.Net ajax library wo...
stackexchange/codereview
I've been working with some C# legacy code and I've been seeing a lot of @ symbols in front of variable names. What does this signify or do? Currently I'm seeing it a lot in front of variables with common names that aren't reserved. E.g.: MyProcedure(@step.LoadInstanceId, @step.ResultCode, @step.StatusCode); Given tha...
stackexchange/codereview
I have a query like this: SELECT TABLE_NAME, COLUMN_NAME, IS_NULLABLE, DATA_TYPE FROM MY_DB.INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME = 'OrderId' ORDER BY TABLE_NAME GO The OrderId column is of user-defined data type. But DATA_TYPE in the query shows underlying system type (i.e. bigint). How can I show the user-def...
stackexchange/codereview
I have an abstract base class which acts as an interface. I have two "sets" of derived classes, which implement half of the abstract class. ( one "set" defines the abstract virtual methods related to initialization, the other "set" defines those related to the actual "work". ) I then have derived classes which use mult...
stackexchange/codereview
I'm working on a stripes app that uses a bit of jQuery to make the UI more dynamic/usable. I set up an Error Resolution, so if an error is thrown, the user is redirected to an error.jsp page. However, if an error is thrown during a jQuery Ajax call, instead of redirecting to the error.jsp page, I get html printed to th...
stackexchange/codereview
Our application defines a URL scheme whose resolution is context-sensitive: The content of the URL depends on the state of an in-progress database transaction. As such, to retrieve the content I cannot, for example, open a new database connection. However, I can't see a way to get at external context from the URLStr...
stackexchange/codereview
In my spring application context file, I have something like: <util:map id="someMap" map-class="java.util.HashMap" key-type="java.lang.String" value-type="java.lang.String"> <entry key="some_key" value="some value" /> <entry key="some_key_2" value="some value" /> </util:map> In java class, the implementatio...
stackexchange/codereview
I've heard the advice that you should avoid try catch blocks if possible since they're expensive. My question is specifically about the .NET platform: Why are try blocks expensive? Summary of Responses: There are clearly two camps on this issue: those that say that try blocks are expensive, and those that say "maybe a ...
stackexchange/codereview
I need to create reports in a C# .NET Windows app. I've got an SQL Server 2005 database, Visual Studio 2005 and am quite OK with creating stored procedures and datasets. Can someone please point me in the right direction for creating reports? I just can't seem work it out. Some examples would be a good start, or a simp...
stackexchange/codereview
I have reasonable experience to manage my own server, so gogrid style management is not a problem. But seems mosso is a tag cheaper somewhat- except the very difficult to access compute cycles terms. Anyone could share about this would be very welcomed.
stackexchange/codereview
Does anyone have any info on creating/drawing a customised ListView object? Currently Im working on a project that requires a customised look and feel within the application. I am using a standard (Windows.Forms) ListView which is not in the same style as the rest of the GUI. We are NOT using a toolbox for custom contr...
stackexchange/codereview
I believe there is a discussion on this very topic somewhere on the net but I lost the url and I am unable to find it via googling. What I might try right now would be: ISessionFactoryHolder factoryHolder = ActiveRecordMediator<EntityClass>.GetSessionFactoryHolder(); ISession session = factoryHolder.CreateSession(typeo...
stackexchange/codereview
I am using Spring Forms for my web application. For nested properties, the form tag generates the input elements having id / name in form of . For example, Person is the command class and Address is contained into its address field then the city element would be, <input type="text" id="address**.**city" name="address**...
stackexchange/codereview
I have two strings and would like to display the difference between them. For example, if I have the strings "I am from Mars" and "I am from Venus", the output could be "I am from Venus". (Typically used to show what changed in an audit log, etc.) Is there a simple algorithm for this? I am using C# but I guess a generi...
stackexchange/codereview
Possible Duplicate: ASP.NET MVC Performance I know there is a learning curve, but what about performance? It seems to me that web forms would be less performant, but I havent tried MVC yet to know for sure. What is everyone else experiencing?
stackexchange/codereview
This article describes a way, in C#, to allow the addition of arbitrary value types which have a + operator defined for them. In essence it allows the following code: public T Add(T val1, T val2) { return val1 + val2; } This code does not compile as there is no guarantee that the T type has a definition for the '+'...
stackexchange/codereview
In an application I work on, any business logic error causes an exception to be thrown, and the calling code handles the exception. This pattern is used throughout the application and works well. I have a situation where I will be attempting to execute a number of business tasks from inside the business layer. The ...
stackexchange/codereview
I'm starting a project which I think would benefit from bindings (I've got a source list table, several browser views, etc), but I think it would also be quite doable, and perhaps more understandable, without them. From my limited experience I've found bindings to be difficult to troubleshoot and very "magic" (e.g. it'...
stackexchange/codereview
I am trying to sort a list of products by their name in a .Net application written in C#, to obtain the same list that I would get from an SQL Server database through an order by: select * from Products order by ProductName Unfortunately, the application sorting behaves differently than the database sorting. It is prob...
stackexchange/codereview
I want to setup a statistics monitoring platform to watch a specific service, but I'm not quiet sure how to go about it. Processing the intercepted data isn't my concern, just how to go about it. One idea was to setup a proxy between the client application and the service so that all TCP traffic went first to my prox...
stackexchange/codereview
Is anyone aware of any gems, tutorials, or solutions enabling a user to sign in to a website at one domain and automatically given access to other partner domains in the same session? I have two rails apps running, let's call them App-A and App-B. App-A has a database associated with it, powering the registration and ...
stackexchange/codereview
My app open file in subdirectory of directory where it is executed, subdirectory is called sample and it contains files: example.raf (example extension, non significant) background.gif example.raf contains relative path to background.gif (in this case only file name cause the files is in same directory as raf) and op...
stackexchange/codereview
So here I am just about to start a big project using LINQ to SQL and then I read this: Is LINQ to SQL Truly Dead? by Jonathan Allen for InfoQ.com Well, I don't want to be supporting LINQ to SQL indefinitely if it's a dead end. So, how should I get started learning about ADO.NET Entity Framework?
stackexchange/codereview
How do I create a grails war file so that it doesn't have the version number (e.g. foo-0.1.war) attached to the end when I execute the 'grails war' command?
stackexchange/codereview
In my C# source code I may have declared integers as: int i = 5; or Int32 i = 5; In the currently prevalent 32-bit world they are equivalent. However, as we move into a 64-bit world, am I correct in saying that the following will become the same? int i = 5; Int64 i = 5;
stackexchange/codereview
Is there any way that I can change how a Literal of a code snippet renders when it is used in the code that the snippet generates? Specifically I'd like to know if I can have a literal called say, $PropertyName$ and then get the snippet engine to render "_$PropertyName$ where the first character is made lowercase. I ca...
stackexchange/codereview
I am building an ontology-processing tool and need lots of examples of various owl ontologies, as people are building and using them in the real world. I'm not talking about foundational ontologies such as Cyc, I'm talking about smaller, domain-specific ones.
stackexchange/codereview
Prefer responses via php or ROR if possible! Example: The slide widget at www.slide.com can be deployed anywhere on the web. But the slide developers have centralized edit capabilities to these widgets. A change to the widget core, will update across all installed widgets. Can this be done with an entire...
stackexchange/codereview
My client has an old MS SQL 2000 database that uses varchar(50) fields to store names. He tried to use this database to capture some data (via a web form). Some of the form-fillers are from other countries, and the varchar fields went nutty when some of these folks entered their names. Is it possible to recover the dat...
stackexchange/codereview
I need to use C# programatically to append several preexisting docx files into a single, long docx file - including special markups like bullets and images. Header and footer information will be stripped out, so those won't be around to cause any problems. I can find plenty of information about manipulating an individ...
stackexchange/codereview
I'm trying to access the command line and execute a command, and then return the output to my aspx page. A good example would be running dir on page load of an aspx page and returning the output via Response.Write(). I have tried using the code below. When I try debugging this it runs but never finishes loading and no ...
stackexchange/codereview
What's the easiest programmatic way to restart a service on a remote Windows system? Language or method doesn't matter as long as it doesn't require human interaction.
stackexchange/codereview
I've got an in-memory dataset with several fields, one of which is a primary key that another dataset references as a foreign key. Thing is, the master dataset can have multiple references to the detail dataset. (This is modeling an object that contains a dynamic array of other objects.) If there was only one of each...
stackexchange/codereview
After "check-in" of a .docx file to SharePoint and editing it the RevNum property is set to 2. This does not make sense, can someone explain why this is?
stackexchange/codereview
I see little functional difference between using a property public readonly property foo as string get return bar end get end property or a function public function foo() as string return bar end function Why would I want to use one form over the other? Thanks!
stackexchange/codereview
I have a login page where I authenticate the user. When the authentication pass, I then redirect the user to another page via Response.Redirect with the url defined in login control's destinationpageurl. It work fine in firefox but when i test it with IE. It just redirect the user back to the login page. does anyone kn...
stackexchange/codereview
I'm running a PL/SQL block that is supposed to be calling a stored procedure who's output parameters are supposed to be populating variables in the PL/SQL block. The procedure compiles, and the PL/SQL block runs successfully. But I'd like to check the values of the variables populated by the procedure. Is there a way t...
stackexchange/codereview
My Source control explorer is displaying wrong random or empty names, i.e. in the folders area I see TFSServer > TeamProject > Branch > "Do not share t" while the source location textbox has the correct $/TFSServer/TeamProject/Branch/FolderName. I'm not sure if this is related to sharing the drop location folder on the...
stackexchange/codereview
I know that it's possible to get SVN to send emails after a commit using hooks, but I was just wondering if there's any way to create a personal "watch list" like MediaWiki (Wikipedia) has, whereby you only get notified if there have been changes to certain files?
stackexchange/codereview
i need to redirect all of the stdout of a program except the first line into a file. Is there a common unix program that removes lines from stdin and spits the rest out to stdout?
stackexchange/codereview
Im trying to get into some basic JavaFX game development and I'm getting confused with some circle maths. I have a circle at (x:250, y:250) with a radius of 50. My objective is to make a smaller circle to be placed on the circumference of the above circle based on the position of the mouse. Where Im getting confused is...
stackexchange/codereview
Using jquery how do I focus the first element (edit field, text area, dropdown field, etc) in the form when the page load? Something like: document.forms[0].elements[0].focus(); but using jquery. Another requirement, don't focus the first element when the form has class="filter".
stackexchange/codereview
I've been trying to use Firebug's profiler to better understand the source of some JavaScript performance issues we are seeing, but I'm a little confused by the output. When I profile some code the profiler reports Profile (464.323 ms, 26,412 calls). I suspect that the 464.323 ms is the sum of the execution time for th...
stackexchange/codereview
I have both Fruityloops and Propellerheads Reason software synths on my Windows PC. Any way I can get at and script these from either Visual Basic or Python? Or at least send Midi messages to the synths from code? Update : attempts to use something like a "midi-mapper" (thanks for link MusiGenesis) don't seem to work. ...
stackexchange/codereview
What's your experience with doctrine? I've never been much of an ORM kind of guy, I mostlymanaged with just some basic db abstraction layer like adodb. But I understood all the concepts and benifits of it. So when a project came along that needed an ORM I thought that I'd give one of the ORM framework a try. I've to ...
stackexchange/codereview
I've been driving myself crazy trying to get the Entity Framework to work as expected (or at least as I expect) in an ASP.NET environment, specifically dealing with objects belonging to different contexts when attempting to save to the database. What are the best practices when dealing with the Entity Framework and ASP...
stackexchange/codereview
Does anyone know how to generate SQL scripts from a query? For example, Script some tables. Do custom action 1. Script the views. Do custom action 2. Etc.
stackexchange/codereview
We've talked about personal password management here but how do you guys manage your passwords at a company wide level?
stackexchange/codereview
I am not a 'programmer' but want to develop a database application using Alpha Software Platinum v 9. The app would allow users to list classified ads via a web site and browse for items being sold etc. Does anyone have experience with Alpha software and is it really as easy they state on their site? Again, I am not...
stackexchange/codereview
Already implemented performance boosters : - Get compatible image of GraphicsConfiguration to draw on - Enable OpenGL pipeline in 1.5: Not possible due to severe artifacts So far I am fine, the main profiled bottleneck of the program is drawing an image with several thousand tiles. Unfortunately it is not regular, else...
stackexchange/codereview
I'm using the Lengauer and Tarjan algorithm with path compression to calculate the dominator tree for a graph where there are millions of nodes. The algorithm is quite complex and I have to admit I haven't taken the time to fully understand it, I'm just using it. Now I have a need to calculate the dominator trees of th...
stackexchange/codereview
Could someone tell me if its possible to add a policy to create default columns in a table schema using the SQL 2008 Policy management features So for example I may have a desire to have a Date column in all of my tables called CreateDate and no DBA could create a table without a column of type datetime with name "Crea...
stackexchange/codereview
For a web app I'm working on, I need to know the lat/lon of about 300 US cities. I also need to know the lat/lon for every US zip code. Does anyone know of a free source to get this information?
stackexchange/codereview
I'm developing a piece in VB.NET. Inside my primary form, I'm creating a new form to use as a dialog. I was wondering if there was a way to, upon the close of the new dialog, save it's size settings for each user (probably in a file on their machine, through XML or something?)
stackexchange/codereview
Since a lot of email clients ignore the HEAD tag, can I embed an inline stylesheet in the body?
stackexchange/codereview
Im in the situation that I often send small codesnippets and xml-snippets to coworkers and partners via my outlook. Has anyone got a good idea or tool that I can use to have my pastes syntaxhighlighted before I paste them into an email. I was thinking of an intermediate paste to "$fancytool" and then I would have some...
stackexchange/codereview
Here's the deal. I have an XML document with a lot of records. Something like this: print("<?xml version="1.0" encoding="utf-8" ?> <Orders> <Order> <Phone>1254</Phone> <City>City1</City> <State>State</State> </Order> <Order> <Phone>98764321</Phone> <Cit...
stackexchange/codereview
I have a git repository which tracks an svn repository. I cloned it using --stdlayout. I created a new local branch via git checkout -b foobar Now I want this branch to end up in …/branches/foobar in the svn repository. How do I go about that? (snipped lots of investigative text. see question history if you care)
stackexchange/codereview
I created a grid in procedural code on my WPF page. Now I want to reference that grid. Grid grid = (Grid)This.FindName("myGridName") does not work. Ideas?
stackexchange/codereview
Problem solved: Thanks guys, see my answer below. I have a website running in Tomcat 5.5 hooked up to a MySQL5 database using Hibernate3. One record simply refuses to keep any changes performed on it. If I change the record programmatically, the values revert back to what they were previously. If I manually modify the...
stackexchange/codereview
I have a device that supports 4-color graphics (much like CGA in the old days). I wanted to use PIL to read the image and convert it using my 4-color palette (of red, green, yellow, black), but I can't figure out if it's even possible at all. I found some mailing list archive posts that seem to suggest other people ha...
stackexchange/codereview
I am using BSD style pty/tty pairs to implement running a sub shell. When the user exits the sub shell, how do I detect in the master process that this has occurred? I am using select(nfds, &read_fds, NULL, NULL, &timeout); with the master pty file descriptor set in the read_fds on the master side.
stackexchange/codereview
I want to be able to get a list of all differences between two JavaScript object graphs, with the property names and values where the deltas occur. For what it is worth, these objects are usually retrieved from the server as JSON and typically are no more than a handful of layers deep (i.e. it may be an array of objec...
stackexchange/codereview
I am writing an application using labview and need to use external code. I have read that using CINs are old fashioned and 'wrong' to use. Is this correct? Should I use shared dlls instead? What are the advantages/disadvantages of both methods?
stackexchange/codereview
I've been trying to understand the strict aliasing rules as they apply to the char pointer. Here this is stated: It is always presumed that a char* may refer to an alias of any object. Ok so in the context of socket code, I can do this: struct SocketMsg { int a; int b; }; int main(int argc, char** argv) { /...
stackexchange/codereview
How to make a shadow to main window widget on windows using Qt?
stackexchange/codereview
I'm writing a MFC app that uses the MS Mappoint OCX. I need to display the locations of people and vehicles on the map and the best of doing this appears to be with Pushpin objects. I have no problem displaying a stock pushpin icon with some text but want to change the icon to a custom designed one. From the limited am...
stackexchange/codereview
So I have some html like so: <div id="avatar_choices"> <label for="id_choice_0"> <input id="id_choice_0" type="radio" name="choice" value="7" /> <img src="someimage.jpg" /> </label> <label for="id_choice_1"> <input id="id_choice_1" type="radio" name="choice" value="8" /> <img...
stackexchange/codereview
I'm working on a firefox extension and have been developing it in Firefox 3, I went to test it on Firefox 2 and for some reason, none of my HTTP requests is firing. The format of the requests are below (using prototype): theResponse = function(response){ //some code } new Ajax.Request(url,{ method:'get', p...
stackexchange/codereview
In C#, how do I set the Identity of a Thread? For example, if I have Thread MyThread, which is already started, can I change MyThread's Identity? Or is this not possible?
stackexchange/codereview
I'm dynamically generating an asp form, and I would like to add the label and input elements inside a list. For example, I would like to end up with something like: <ul> <li><label for="input"/><input id=input"/></li> </ul> To do this, I create a Label object and a TextBox object, then assign the AssociatedControlId p...
stackexchange/codereview
When an Expression<T> is compiled, is the resultant code implicitly cached by the framework? I'm thinking along the lines of the static Regex methods where the framework implicitly compiles and caches the last few regexes. If compiled Expression<T> objects are not cached, can you recommend some best practices for keepi...
stackexchange/codereview
In my experience it seems that most people will tell you that it is unwise to force a garbage collection but in some cases where you are working with large objects that don't always get collected in the 0 generation but where memory is an issue, is it ok to force the collect? Is there a best practice out there for doi...
stackexchange/codereview
Do you bother initialising java bean values? Say, for example: ([g|s]etters omitted) public class SomeClass { private String foo; private Date bar; private Baz someObject; } (Yes, this is a POJO being used as a bean rather than a Java Bean in the strictest sense) In the empty constructor, do you initia...
stackexchange/codereview
I have recently made use of the SrcSrv feature in the Debugging Tools For Windows, but have noticed that when I index the pdb with SVNIndex.cmd it does not pick up any of the files that are from an external link. Any suggestions ?
stackexchange/codereview
Imagine the radio of a car, does the electro magnetic fields through which the car goes through, have interference in the processing? It's easy to understand that a strong field can corrupt data. But what about the data under processment? Can it also be changed? If so how could you protect your code against this? (with...
stackexchange/codereview
Given an object: let myObject = { "ircEvent": "PRIVMSG", "method": "newURI", "regex": "^http://.*" }; How do I remove the property regex to end up with the following myObject? let myObject = { "ircEvent": "PRIVMSG", "method": "newURI" };
stackexchange/codereview