instruction_seed
stringlengths
1
35.8k
_source
stringclasses
1 value
Duplicate of: When/Why to use Cascading in SQL Server? I've always been too scared to use DELETE CASCADE, but as I get more confident (lazy :D), I'm thinking how bad can it be, is it best practise to use it or should I avoid it and clean up my foreign keys etc the old fashioned way (with stored procedures)?
stackexchange/codereview
I'm trying to squeeze some more performance out of my rendering pipeline. The (by far) slowest part is performing a java.awt.imaging.LookupOp on a large image. The image size is about 2048x2048. I have figured out that having the filter done along with the drawing operation is much faster than calling the filter met...
stackexchange/codereview
I am looking to implement horizontal scrolling using jQuery.SerialScroll (based on jQuery.ScrollTo). I currently have a continuous horizontal scrolling working with liScroll as I discuss in this post. However, now I need discrete scrolling and I have SerialScroll working perfectly for vertical scrolling. For some reaso...
stackexchange/codereview
This is a simplified version of the problem. We have customers who send us lots of data and then query it. We are required by them to have several "public" ids they can query our data by. (Most want to query our system via the id they send along with the data, but not always). For simplicity, we'll call them "pid",...
stackexchange/codereview
Enterprise Architect has a way to generate the documentation in HTML/RTF/etc. that you could publish, but you have to use its GUI to do that manually. When you have your *.eap files in a CVS/Subversion server, it would be useful to have a script that would check out daily the latest version and publish it in a web serv...
stackexchange/codereview
The offending command that msi executes is: .\devenv.com /command "View.Toolbox" /setup This fails with Date execution prevention error. devenv.exe log contains a bunch of errors like this: <entry> <record>120</record> <time>2008/10/21 12:32:01.277</time> <type>Warning</type> <source>Microsoft Visual...
stackexchange/codereview
Are there ways except CAPTCHAs for web apps like pastie.org or p.ramaze.net? CAPTCHAs take too long for a small paste for my taste.
stackexchange/codereview
Is contract to interface as object is to class? What is the need to differentiate identical things like this, from the code to the executing code? I sort of get the idea behind naming a class a class and the instantiated executing class an object, but overall, is that the only reason for these semi-redundant terms?
stackexchange/codereview
during beta testing we discovered connection pooling error messages . Therefore I have been going through the code and closing down the SqlDataReader objects wherever they have been left unclosed. What I need to know is how to close a datareader (or if there is a need at all to close) that is specified in the SelectSta...
stackexchange/codereview
Are XML parsers (provided by standard libraries) faster than custom written parsers? If so, why?
stackexchange/codereview
On my website, I have several html files I do not link off the main portal page. Without other people linking to them, is it possible for Jimmy Evil Hacker to find them?
stackexchange/codereview
My company, a C++ house, is always looking to hire recent grads. However due to the Java Schools phenomenon, we typically end up interviewing strong Java programmers with maybe a minute smattering of C++. Often the C++ classes don't really prepare students for working in C++. Nevertheless, often these are bright kids, ...
stackexchange/codereview
I want to make a generic class that accepts only serializable classes, can it be done with the where constraint? The concept I'm looking for is this: public class MyClass<T> where T : //[is serializable/has the serializable attribute]
stackexchange/codereview
I could probably find this out from somewhere else but thought it would be a nice question to have on stack overflow. .NET 2.0 by default stopped managed exe's running from network shares despite the fact you can run unmanaged exe's. I have seen mention's that this was changed in .NET 3.5 SP1 Is this true? Would that ...
stackexchange/codereview
This might be a old question: Why does IEnumerable<T> inherit from IEnumerable? This is how .NET do, but it brings a little trouble. Every time I write a class implements IEumerable<T>, I have to write two GetEnumerator() functions, one for IEnumerable<T> and the other for IEnumerable. And, IList<T> doesn't inherit fro...
stackexchange/codereview
I have a function that automatically exports a table into a CSV file, then I try to attach that same file into a function that will email it. I have sent attachments using html mime mail before, but I was wondering if that created CSV file needs to be stored on the server first before attaching it to the email?
stackexchange/codereview
What are the best ways of dealing with UTC Conversion and daylight saving times conversion. What are the problems and their solutions. All in C# .Net 2.0. Also any existing problems with this in .Net 2.0.
stackexchange/codereview
I have several user drawn controls on a form, unfortunately when the form is shown the user drawn controls are showing the previous forms background rather than the current forms background. The OnPaint event is very simple, and the OnBackgroundPaint event is empty... Like this: protected override void OnPaint(...
stackexchange/codereview
What is the best way to approach removing items from a collection in C#, once the item is known, but not it's index. This is one way to do it, but it seems inelegant at best. //Remove the existing role assignment for the user. int cnt = 0; int assToDelete = 0; foreach (SPRoleAssignment spAssignment in workspace.RoleAs...
stackexchange/codereview
How can I use CRTP in C++ to avoid the overhead of virtual member functions?
stackexchange/codereview
Taking shs's question a step further... Why isn't all government sponsored software open source? I can see excluding some for security purposes, but the rest? Didn't we as tax payers already pay for it? The government has no rights, only the people, so how can the government license something? Who is the licensee? ...
stackexchange/codereview
This project is the probable first step in migrating a large CMS from Classic ASP to .Net. I'd like to use LINQ for querying the DB. Does anyone have any ideas for strategies to make this happen? I understand this is a vague question at this point, but I'm gathering information. Thanks, KevDog
stackexchange/codereview
As a subversion user you'll have a local configuration folder /<userhome>/.subversion/ in your user home. In there is a config file containing, among others, auto-props. These properties are applied to files that you add to the repository, e.g. by svn add <file> Now here's my question (actually two questions): How do...
stackexchange/codereview
I'm running an Eclipse RCP application. I've enabled the flags -console -consolelog -debug and now it's humming along logging to it's console. However, I'd like it to log to a file. If I start the application from within the Eclipse IDE, I can select a file for it to redirect the console to. There must be some equivale...
stackexchange/codereview
every time i create a FileInfo object and access it's lastaccesstime property, it's always a few minutes off. the file property window remains constant, however the application shows that it is usually a few minutes after the property window time. Also, i noticed that if i drag the file to the cmd window to pass the fi...
stackexchange/codereview
I am searching for a decompiler for a C program. The binary is a 32-bit x86 Linux executable. Objdump works fine, so basically I am searching for something which attempts to reconstruct the C source from the asm source.
stackexchange/codereview
I'm trying to write a simple game/utility to calculate poker odds. I know there's plenty of resources that talk about the formulas to do so, but I guess I'm having trouble translating that to code. Particularly, I'm interested in Texas Hold-em ... I understand that there are several different approaches, one being th...
stackexchange/codereview
Given a point such as (0, 0, 0) and a vector like (x, y, z). What is the easiest way to align the negative Z-axis centered at (0, 0, 0) to point in the direction of this vector? Examples using OpenGL would be welcome, but not neccessary.
stackexchange/codereview
I am a little confused by the multitude of ways in which you can import modules in Python. import X import X as Y from A import B I have been reading up about scoping and namespaces, but I would like some practical advice on what is the best strategy, under which circumstances and why. Should imports happen at a mo...
stackexchange/codereview
Is there anyway to automatically run javascript:window.print() when the page finishes loading?
stackexchange/codereview
After staring at this 3D cube and these triangles for a while I started wondering if there's any good reliable Javascript graphics library with basic 3D support. Any suggestion?
stackexchange/codereview
I was using god to start and monitor my starling and workling daemons. Works awesome on development machine but "workling_starling_client" refuses to start on my production machine.
stackexchange/codereview
I would like to cross-reference construct a distance chart similar to the one here (example is a road-distance cross-reference chart) and, ideally, store the data in SQL Server 2008 (preferably the Express version). It needs these properties / abilities Every column has a corresponding row with the same name (ie. not ...
stackexchange/codereview
All paint programs, independent of how simple or complex they are, come with a fill tool. This basically replaces the color of a closed region with another color. I know that there are different APIs to do this, but I am interested in the algorithm. What would be an efficient algorithm to implement this tool? A couple ...
stackexchange/codereview
If this is true, I'd like to know why. Do we see a great percentage of secure and high traffic web applications built in LAMP?
stackexchange/codereview
I have a class that implements multiple interfaces. I would like to register these interfaces via XML. All I've found is documentation for the new Fluent Interface. Is this option supported via XML? What would be involved in adding this feature?
stackexchange/codereview
I have two models indexed for searching (User and Item). I'm trying to do a geo-search across models: ThinkingSphinx::Search.search('keywords', :geo => [ degrees_to_radians(params[:lat].to_f), degrees_to_radians(params[:lon].to_f) ], ) But I only get an error: Sphinx Error: index item_core,item_delta,user_core,u...
stackexchange/codereview
I'm having problems with Iterator.remove() called on a HashSet. I've a Set of time stamped objects. Before adding a new item to the Set, I loop through the set, identify an old version of that data object and remove it (before adding the new object). the timestamp is included in hashCode and equals(), but not equalsD...
stackexchange/codereview
What is the first thing you do when you install Visual Studio? I am talking about anything customization-wise (so we don't get answers based on 'I create a new project'). Do you have a favorite font? Do you have a must have extension you couldn't possibly live without? Do you have a keyboard shortcut you like to set?...
stackexchange/codereview
Say I have a simple j2EE ear: foo.ear - foo.war I would like to deploy the same ear twice so I rename the ear: bar.ear - foo.war The META-INF\application.xml file looks like this: <application> <module> <web> <web-uri>foo.war</web-uri> <context-root>/baz</context-root> </we...
stackexchange/codereview
I think questions like this are the reason why I don't like working with PHP. The manual is good, if you can find what you are looking for. After reading through the Array Functions, I didn't see one that provides the functionality I need. I have an array (in my case, numerically indexed) that I want to scan for a part...
stackexchange/codereview
I've implemented a set of draggable elements that can be dropped into some containers using jQuery. What I need is an animation that moves an element to a specific container without user interaction. The problem is that the elements and the drop containers are in completely different parts of the DOM and mostly positio...
stackexchange/codereview
In the spirit of Best Practices: Always return a ____, never a ____, I face a similar question in my upcoming migration from JDK1.4.2 to JDK5 and more. (Yes, I know, JDK1.4.2 is EOL! ;-) ). For functions returning a collection (which are not simple property collections), I always prefer (in JDK1.4.2) returning an Array...
stackexchange/codereview
Just a few quick questions from me: What is the best way to inserting a Flash SWF file into a flex, that will enable me to have it start from frame 0 on reentry of that framework? Would this be States, Viewstack? Is there a way of using forward and back buttons to navigate through displaying a set of States rather than...
stackexchange/codereview
When printing RFC documents on my A4 format printer I noticed that I print more than it is considered to be one page in RFC document. I figure this is because probably RFC is written in North American paper letter format (216 × 279 mm) and I want to use ISO A4 format (210 × 297 mm). Info on Paper size. So my question i...
stackexchange/codereview
Can Thread.getContextClassLoader() be null ? The javadoc is not really clear. Should a library take this case into account ? Update: the reason I asked is that beansbinding.dev.java.net does not work in this case (and my code does setContextClassLoader(null)
stackexchange/codereview
Is there any plans for Microsoft to support LINQ to SQL beyond MS SQL server?
stackexchange/codereview
Anyone know of a JS library that will allow me to syntax highlight a code block, then highlight line-level diffs? For example, in a subversion diff, I'd like to highlight the characters on the line that have changed (as well as highlighting the fact that there are change(s) on the line). Edit: I'm after something that...
stackexchange/codereview
This is a slightly.. vain question, but BuildBot's output isn't particularly nice to look at.. For example, compared to.. phpUnderControl Jenkins Hudson CruiseControl.rb ..and others, BuildBot looks rather.. archaic I'm currently playing with Hudson, but it is very Java-centric (although with this guide, I found it...
stackexchange/codereview
The exception mentions FILE* __cdecl _getstream I'm calling fopen and it keeps crashing. AfxMessageBox("getting here 1"); FILE* filePtr = fopen(fileName, "rb"); AfxMessageBox("getting here 2"); For some reason, I never get to the second message box. Interestingly, when I'm in debug mode, the app works perfectly. Why...
stackexchange/codereview
I know that you can use a dummy "int" parameter on operator++ and operator-- to override the postfix versions of those operators, but I vaguely recall something about a dummy parameter that you could declare on a destructor. Does anyone know anything about that, and if so, what that dummy parameter did? This was in my ...
stackexchange/codereview
I want to serialize and deserialize a list of objects into a file. But I found that if I use CArchive, the new content will overwrite the original content in the file, which is not my expectation. Is there any method to allow me to read and write from a specified location in the file? Thank you!
stackexchange/codereview
I am calling an unmanaged C++ dll that expects a char* as one of its parameters and I want to push a byte[] into it. The project is written in VB.NET. What type of marshalling will work for this?
stackexchange/codereview
Is there a way to delete a folder, lets call it FolderX from an SVN trunk recursively? A quick search on google only tells me how to recursively delete all .svn folders and this is not what I want to do
stackexchange/codereview
I am building an ASP.NET web site where the users may upload photos of themselves. There could be thousands of photos uploaded every day. One thing my boss has asked a few time is if there is any way we could detect if any of the photos are showing too much 'skin' and automatically move flag these as 'Adults Only' befo...
stackexchange/codereview
What to do automatic nightly build of .NET web application and upload to the test server. Or, if this tool is overkill, please suggest something else.
stackexchange/codereview
If I wanted to replace the * with a column name, what would it be? create type mytable$t as table of number; / declare mytmou mytable$t := myTable$T(); cnt pls_integer ; begin mytmou := myTable$T(1,2,3,4,5,6); SELECT count(*) into cnt From Table (mytmou); dbms_output.put_line(cnt); end; 6
stackexchange/codereview
We have simple web-based data entry internal business app. Now business wants to be able to attach a document to a row in the database that represents business entity. Document can be Word, Excel, PDF. How can we do that? I think creating yet another home grown document management system is not a good idea. Instead we ...
stackexchange/codereview
How do I tell if my application (compiled in Visual Studio 2008 as Any CPU) is running as a 32-bit or 64-bit application?
stackexchange/codereview
I'm using several variants of the Validator controls (RequiredFieldValidator, CompareValidator, etc) and am using the CssClass property of the validator. I can see (via Firebug) that the class is being applied, but the validator control itself is adding a style element to it, namely color: red. But I don't want that....
stackexchange/codereview
I've got a Excel VSTO 2005 application I need to debug, I've tried attaching to the process EXCEL.EXE in Visual Studio 2005 to no avail. Does anyone know what to do in order to debug managed code running in a VSTO Excel Application?
stackexchange/codereview
Is there a better way to implement copy construcor for matlab for a handle derived class other than adding a constructor with one input and explicitly copying its properties? obj.property1 = from.property1; obj.property2 = from.property2; etc. Thanks, Dani
stackexchange/codereview
How exactly can one implement a Log off function when using ASP.NET Forms Authentication on an intranet application? How will this work if I am an administrator and want to log in "as someone else" into the application? Please share your ideas
stackexchange/codereview
I am using C# and ASP.NET with version 2.0 of the .NET Framework library on this particular project. We are also using the AjaxControlToolkit. The AjaxControlToolkit should have the controls available to make a descent User Interface solution to the problem I'm facing. I have run into this in a few projects in the l...
stackexchange/codereview
We have a simple registration form for our website users where we only require an e-mail address and a password (both repeated twice to make sure they are correct). We require that the user confirm their e-mail accounts by clicking a link in an e-mail. We see that a lot of users don't bother following the link in the e...
stackexchange/codereview
I want to create a .bat file so I can just click on it so it can run: svcutil.exe /language:cs /out:generatedProxy.cs /config:app.config http://localhost:8000/ServiceModelSamples/service Can someone help me with the structure of the .bat file?
stackexchange/codereview
How do you deal with a DateTime that should be able to contain an uninitialized value (equivalent to null)? I have a class which might have a DateTime property value set or not. I was thinking of initializing the property holder to DateTime.MinValue, which then could easily be checked. I've been searching a lot but cou...
stackexchange/codereview
I need to prepare for my exam and this is the probable question for the test. Given a frustum method such as frustum(-1,1, -0.5, 0.5, 1, 2) how to convert this to a projection matrix? The above example from my textbook but the writers don't define it in detail. If anyone can explain this in detail, I'd appreciate very ...
stackexchange/codereview
Can someone tell me what the statuses mean in SQL Server's sp_who command? Why might a spid be suspended? What does it mean to be "runnable"? Thanks!
stackexchange/codereview
I'm trying to pass a parameter into a component that requires a System.TimeSpan. I'm only able to get the 'long ticks' ctor to resolve. Here's a snippet of the config file: <component id="timeInForce" type="System.TimeSpan, mscorlib"> <parameters> <hours>0</hours> <minutes>15</minutes> <seconds>0</seconds...
stackexchange/codereview
I want to do something like this: SQL.Text := Format('select foo from bar where baz like ''%s%''',[SearchTerm]); But Format doesn't like that last '%', of course. So how can I escape it? \%? %%? Or do I have to do this: SQL.Text := Format('select foo from bar where baz like ''%s''',[SearchTerm+'%']); ?
stackexchange/codereview
I'm having some trouble figuring out how to use more than one left outer join using LINQ to SQL. I understand how to use one left outer join. I'm using VB.NET. Below is my SQL syntax. T-SQL SELECT o.OrderNumber, v.VendorName, s.StatusName FROM Orders o LEFT OUTER JOIN Vendors v ON v.Id = o.Vendor...
stackexchange/codereview
I'd like to have a blank line after my bash prompt and before the output on my Mac. It should look like this would: echo; ls Can I add a newline to my bash prompt and then go back up one line to wait for user input? Is there something obvious I'm missing?
stackexchange/codereview
I am building a fun little app to determine if I should bike to work. I would like to test to see if it is either Raining or Thunderstorm(ing). public enum WeatherType : byte { Sunny = 0, Cloudy = 1, Thunderstorm = 2, Raining = 4, Snowing = 8, MostlyCloudy = 16 } I was thinking I could do something like: WeatherType ...
stackexchange/codereview
I've made a Django site, but I've drank the Koolaid and I want to make an IPhone version. After putting much thought into I've come up with two options: Make a whole other site, like i.xxxx.com. Tie it into the same database using Django's sites framework. Find some time of middleware that reads the user-agent, and ...
stackexchange/codereview
I created a new SharePoint portal for testing purposes using a manually added HOSTS record. I have it all tested and want to expose it to the outside world using a URL from our DNS. I can't seem to find a straight forward way to change the URL of a SharePoint portal. Does anyone know where this setting is? Thanks.
stackexchange/codereview
Is it possible to disable the options dialog box for a .net console application? Or somehow keep the user from changing the console properties?
stackexchange/codereview
Developing a website and just trying to get back into the swing of (clever) SQL queries etc, my mind had totally gone tonight! There is a website http://www.ufindus.com/ which has a textbox allowing you to enter either a place name or a postcode/zipcode. I am trying to do something similiar but I am rubbish at SQL - s...
stackexchange/codereview
We're currently replacing all special characters and spaces in our URLs with hypens (-). From an SEO and readability point-of-view this works fine. However, in some cases, we are feeding parts of the URL into a search after stripping the hyphens out. The problem occurs when the search term should have hyphens as it ret...
stackexchange/codereview
Our testers are in the process of evaluating Visual Studio Team System 2008 Test Edition. As they are unfamiliar with the use of Visual Studio, I would like to give them as much help as I can. I have had a look on Amazon for books on the Test edition of VS.Net, but there is only one VS.Net 2005 test edition book. Does ...
stackexchange/codereview
Dear stack overflow community, I've been given the task of overhauling a couple of websites for a large corporation I'm working for, as well as developing an internal intranet site for content management and document storage within the organization. My "problem" is this: They want me to use a framework/set of languages...
stackexchange/codereview
Reporting Services 2000 Standard Edition (currently RTM but hope to have SP2 soon). I have a report which takes in a parameter - PlantID I'd like to email a pdf of this report every month to the 80 different plant managers So I have a table: PlantID ManagerEmail 1 BillySmith@company.com 2 FredJones...
stackexchange/codereview
If I import a library to use a method, would it be worth it? Does importing take up a lot of memory?
stackexchange/codereview
I have no trouble building 1.35.0, as well as 1.36.0 on the timesys arm-gcc toolchain, both statically (link-static) as well as dynamically (.so, default option). However, when I try to link a simple sample filesystem app: #include <boost/filesystem.hpp> #include <iostream> namespace fs = boost::filesystem; int main(...
stackexchange/codereview
I have some code in .Net to draw some text content using GDI+. I used GraphicsUnit.Point to size the text. It's working wonderfully on-screen, and even if Print it. I've been asked to make a system that generates a PDF, and I got ComponentOne's PDF control. It has got similar interface to GDI+. The problem is: Font siz...
stackexchange/codereview
What is the difference between the CIL instructions "Call" and "Callvirt"?
stackexchange/codereview
I am trying to write a web application in C# ASP.NET 3.5 and want to include a Microsoft Office Access Web Datasheet in my application. I can't find an example on how to use it anywhere. It's the editing view in a SharePoint grid so I know it's possible, I just can't find out how to implement it. Any help would be gre...
stackexchange/codereview
I'm trying to get this piece of code working a little better. I suspect it's the loop reading one byte at a time. I couldn't find another way of doing this with gzip decompression. Implementing a StreamReader is fine, but it returns a string which I can't pass to the decompression stream. Is there a better way? byte[] ...
stackexchange/codereview
If I notice that a hash table (or any other data structure built on a hash table) is filling up, at what point should you build a new table with more buckets. And given n items in the table so far, how do you figure out how many buckets to use in the new one? So let's say I have 100 buckets. Should I reorganize it when...
stackexchange/codereview
I am building an msi using WISE. The Dialogs appear fine when run on a 1280x800 resolution screen. But when I run the same msi on a 800x480 resolution screen, the installer dialog appears really huge and you cannot see the whole dialog on the screen.However, the dialog now comes up with a vertical and horizontal scroll...
stackexchange/codereview
I have a site, and it will be sold to different clients but for maintenance reasons, we will be keeping one codebase. So this means that this one codebase will have to be dynamic enough to have different styles and so forth, depending on the client. The domain would be a subdomain-type system, so: projectname.clientnam...
stackexchange/codereview
In order to handle concurrency issue, is locking-- any form of locking, whether it's row, table or database locking a good solution? If not, how to handle concurrency issue?
stackexchange/codereview
I'm looking for some help with creating a horizontal menubar in HTML. The menubar will have menus such as File, Edit, View and when you mouseover or click on the File menu (for example), the menu will be displayed showing menu items such as New, Open, etc. Ideally, I'd like to create the menubar and menus using pure HT...
stackexchange/codereview
Using the client-side ASP.NET AJAX library, I have created an instance of a client component with the $create shortcut-method (http://msdn.microsoft.com/da-dk/library/bb397487(en-us).aspx). The object is attached to a DOM element. Now I need to get a reference to the instance, but it is neither registered on window or ...
stackexchange/codereview
I recently installed RailRoad gem to generate an .svg diagram of my app's models and controllers. The rake task keeps breaking with a similar error: 1.8/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:263:in `load_missing_constant': uninitialized constant I tried the rake task on 2 se...
stackexchange/codereview
I realize I'm probably just dumb and missing something big and important, but I can't figure out how to specify a timeout in twisted using reactor.listenUDP. My goal is to be able to specify a timeout, and after said amount of time, if DatagramProtocol.datagramReceived has not been executed, have it execute a callback ...
stackexchange/codereview
I have a list of cities, states/provinces, and countries and I need to find their respective timezones easily. Specifically, I need to know which Windows TimeZone they map to. So far this has been a difficult process, because there's no easy way to pass a city to something and get a timezone back (a timezone being an ...
stackexchange/codereview
How do I create a toolbar for Excel using an XLA document?
stackexchange/codereview
In this question, I was given a really cool answer to alternating an image and its description between left and right, respectively. Now I want to apply styling to both, e.g. padding-top, padding-bottom etc. How do I apply a style to both the RowStyle and AlternatingRowStyle in this scenario. <AlternatingRowStyle CssC...
stackexchange/codereview
How can I convert a varchar field of the form YYYYMMDD to a datetime in T-SQL? Thank you.
stackexchange/codereview