instruction
stringlengths
0
30k
|svn|branch|subversion|
|svn|branch|
One way. When you check out the code, look at the last line of svn output: $ svn up ...stuff... Updated to revision 66593. A more direct way: $ svn info Path: . URL: https://svn.example.com/svn/myproject/trunk Repository Root: https://svn.example.com/svn/ Repository UUID: ...
"svn info" will show you the working copy's revision number (see the "Revision" line in the output from "svn info"). Your build system probably allows you to place the relevant part of "svn info"'s output somewhere where it will be reflected in your application. For example, you may specify that when building, a tempor...
I should have stated I was aware of the fact that asserts (here) dissappear in production code. If the if-statement actually corrects invalid input data in production code, this means the assert never went off during testing on debug code, this means you wrote code that you never executed. For me it's an OR situa...
Exception Handling in .net web apps
To answer your first question, you can check if the [Line.Info][1] object for your recording input matches [Port.Info.LINE_IN][2] like this: public static boolean isLineIn(Line.Info lineInfo) { Line.Info[] detected = AudioSystem.getSourceLineInfo(Port.Info.LINE_IN); for (Line.Info lineIn : dete...
Here you go: - Project size: about 1 million lines of code, 30 people - Project time: 9 years - Project life cycle: good old waterfall, due to big customers requirements, but with staggered delivery to the QA team - it is very difficult to be agile when you have customers commitments to large clients - Pr...
Stored procedures can also be used instead of parameterized queries (or ad-hoc queries) for some other advantages too : * If you need to correct something (a sort order etc.) you don't need to recompile your app * You could deny access to all tables for that user account, grant access only to stored procedures and ...
The only thing that works for me: Create the smallest possible implementation of it that's somehow usable and then use it.
As usual, you can usually waste memory to gain some speed. This technique isn't useful for a general purpose allocator, but it does have it's place. Basically, the idea is to write an allocator that returns memory from a pool where all the allocations are the same size. This pool can never become fragmented becau...
<pre><code>javascript:resizeTo(1024,768); vbscript:resizeto(1024,768)</code></pre> Will work in IE7, But consider using something like <pre><code>javascript:moveTo(0,0);resizeTo(1024,768);</code></pre> because IE7 doesn't allow the window to "resize" beyond the screen borders. If you work on a 1024,768 desktop, thi...
Be sure that, when on an HTTPS page, all elements on the page come from an HTTPS address. This means that elements should have relative paths (e.g. "/images/banner.jpg") so that the protocol is inherited, or that you need to do a check on every page to find the protocol, and use that for all elements. NB: This inclu...
In what order are ON DELETE CASCADE constraints processed?
|mysql|database-design|innodb|
Here is an example of what I've got going on: CREATE TABLE Parent (id BIGINT NOT NULL, PRIMARY KEY (id)) ENGINE=InnoDB; CREATE TABLE Child (id BIGINT NOT NULL, parentid BIGINT NOT NULL, PRIMARY KEY (id), KEY (parentid), CONSTRAINT fk_parent FOREIGN KEY (parentid) REFEREN...
|mysql|database-design|postgresql|innodb|
Essentially, yes. In C#, string (actually System.String) is a reference type, so when foo() is called, it receives a pointer to the string in the heap.
For users and groups, the question of pre-existing users should be defined with respect to the needs of the application rather than the contingencies of programming. Perhaps your app requires an administrator; then prepopulate. Or perhaps not - then add code to gracefully ask for a user setup at application launch time...
Create an extension method: public static DateTime ParseExact(this DateTime dt, string formatString) { return DateTime.ParseExact(dt, formatString, new CultureInfo("en-CA", true)); }
SQL Server 2005 "Standard", "Developer" and "Enterprise" editions have [SSIS][1], which replaced DTS from Sql server 2000. SSIS has a built in connection to it's own DB, and you can find a connection that someone else has written for MySQL. [Here][2] is one example. Once you have your connections, you should be able to...
I use a static collection as a private with a public static property that either loads or gets it from the database. Additionally you can add a static datetime that gets set when it gets loaded and if you call for it, past a certain amount of time, clear the static collection and requery it.
I tend to create new applications for each logically separate set of models. e.g.: - User Profiles - Forum Posts - Blog posts
You might look into trying Microsoft's [Web Deployment Projects][1]. They give you much more control over MSBuild, essentially, but it might help solve your deployment/pre-compiling woes. Are we to infer you are using a Web Site project type (and *not* Web Application)? [1]: http://msdn.microsoft.com/en-us/a...
How do you vertically center a custom image in a <li> element across browsers?
|css|
The design for the website I am working on calls for a custom image on lists instead of a bullet. Using the image is fine, but I have been having difficulties ensuring that it is centered against the text of the list item across all browsers. Does anyone know of a standard solution for this?
I don't see why ORM generated schemas are any different to other DB schemas - the problem is the same. Assuming your ORM will spit out a generation script, you can use an external tool to do the diff I've not tried it but google came back with [SQLCompare][1] as one option - I'm sure there are others. [1]: ht...
You can use select to see whether you can safely gets from the socket, see following implementation of a TCPServer using this technique. require 'socket' host, port = 'localhost', 7000 TCPServer.open(host, port) do |server| while client = server.accept begin readfds, writ...
Copying databases to remote locations
From <http://www.sql-server-helper.com/functions/initcap.aspx> CREATE FUNCTION [dbo].[InitCap] ( @InputString varchar(4000) ) RETURNS VARCHAR(4000) AS BEGIN DECLARE @Index INT DECLARE @Char CHAR(1) DECLARE @PrevChar CHAR(1) DECLARE @OutputString ...
When I do a rename in Resharper there's a checkbox below that says "Synchronise file name with class name". Check that and the file is renamed too. Be sure you're using Resharper's rename (right-click/Refactor/Rename) rather than Visual Studio's (right-click/Rename), as the latter definitely doesn't rename the file.
When I do a rename in Resharper there's a checkbox below the textbox where you type the new name that says "Synchronise file name with class name". Check that and the file is renamed too. Be sure you're using Resharper's rename (right-click/Refactor/Rename) rather than Visual Studio's (right-click/Rename), as the la...
The issue may be the "start" command you are using, rather than your file name parsing. For example, this seems to work well on my WinXP machine (using JDK 1.5) import java.io.IOException; import java.io.File; public class test { public static void openDocument(String path) throws IOE...
How to jump to a class definition in CodeRush
|keyboard-shortcuts|coderush|
Just downloaded the CodeRush trial version and I can't easily find the one feature that I really wanted. I would like to be able to start typing a class name and to jump to its definition, sort of like the quick navigator but I want it to search in closed files within my solution as well as open ones. I know R# has t...
Tools like [AutomatedQA TestComplete][1] allow you to make a script which simulates a user controlling your application. Running multiple scripts at the same time could be your stress test. [1]: http://www.automatedqa.com/products/testcomplete/
|.net|exception|
I admit it: I don't bother with too much exception handling. I know I should do more but I can never wrap my head around where to start and where to stop. I'm not being lazy. Far from it. It's that I'm overwrought with exception handling ambivalence. It just seems that there is a seemingly infinite number of places...
|.net|asp.net|exception|
|asp.net|exception|
A piece of advise. Cross-platform programming is like cross-browser programming and the one sure thing to do is test, test and test on all platforms you want to support.
How to profile a silverlight application?
|profiling|silverllight|
Is their any profilers that support Silverlight? I have tried ANTS (Version 3.1) without any success? Does version 4 support it? Any other products I can try?
|silverlight|profiling|
Slightly longer but probably more readable rework of your last four lines: samples = [0 for i in xrange(how_many_days + 1)] for s in xrange(how_many_responses): samples[min(int(how_many_days * weibullvariate(0.5, 2)), how_many_days)] += 1 histogram = zip(timeline, samples) print '\n'.join...
Honestly I would evaluate your customer base and your existing skills. If you've got a 50/50 split, or even a 70/30 split of Windows to non-Windows, you'd likely be better off with Java or some other cross-platform toolkit. Mono is a decent platform (See <a href="http://stackoverflow.com/questions/42627/best-practi...
If your hardware is 32 bit only, then no. If you have 64 bit hardware and a 32 bit operating system, then maybe. See: http://kb.vmware.com/selfservice/dynamickc.do?externalId=1901&sliceId=1&command=show&forward=nonthreadedKC&kcId=1901 For details. It has nothing to do with 1 vs. multiple processors.
<pre><code>javascript:resizeTo(1024,768); vbscript:resizeto(1024,768)</code></pre> Will work in IE7, But consider using something like <pre><code>javascript:moveTo(0,0);resizeTo(1024,768);</code></pre> because IE7 doesn't allow the window to "resize" beyond the screen borders. If you work on a 1024,768 desktop, thi...
How do I keep track of related windows in X11?
|x11|
Unfortunately, my question is not as simple as keeping track of two windows created by the same process. Here is what I have: - Two users, Jack and Jim are remotely logged in to the same Unix system and run X servers - Jack runs an application, 'AwesomeApp', that opens a GUI in a X window - Jim runs anoth...
First plan out the basic outline of the final application. Most important features, basic GUI, program flow, etc. Then refine that so that you don't take on too much at first, remove unnecessary features, and add what else you want in the first version. Then use that outline to start a task list to create the smallest ...
Maybe not the best way, but it certainly works... Also, if you are in vb6 or .net, you can have different methods that cast to proper type too. if cint( getVal( rs("blah") ) )<> 0 then 'do something end if function getVal( v, replacementVal ) if v is nothing then getV...
Maybe not the best way, but it certainly works... Also, if you are in vb6 or .net, you can have different methods that cast to proper type too. if cint( getVal( rs("blah"), "" ) )<> 0 then 'do something end if function getVal( v, replacementVal ) if v is nothing then ...
[Console][1] From documentation: > NOTE: Console is NOT a shell. > Therefore, it does not implement shell > features like command-line completion, > syntax coloring, command history, etc. > > > Console is simply a nice-looking front > end for a shell of your choice > (cmd.exe, 4NT, bash, etc.) Other > ...
Create an extension method: public static DateTime ParseExactDateTime(this string dateString, string formatString) { return DateTime.ParseExact(dateString, formatString, new CultureInfo("en-CA", true)); }
In this specific instance, it is more like: void foo(const char *); .Net strings are immutable and passed by reference. However, in general C# receives a pointer or reference to an object behind the scenes.
I'd be interested in a comparison between Hotspot JIT and profile-guided optimization optimized C++. The problem I see with the Hotspot JIT (and any runtime-profile-optimized JIT compiler) is that statistics must be kept and code modified. While there are isolated cases this will result in faster-running code, I do...
My preference is to store third party libraries in a dependency repository ([Artifactory][1] with [Maven][2] for example) rather than keeping them in Subversion. Since third party libraries aren't managed or versioned like source code, it doesn't make a lot of sense to intermingle them. Remote developers also appre...
no in c# string is unicode. in c# it is not called a pointer, but a reference.
I would suggest any time *any* user data is stored in a database and communicated, use https. Consider this requirement even if the user data is mundane, because even many of these mundane details are used by that user to identify themselves on other websites. Consider all the random security questions your bank asks y...
Why don't you want to use COM? This would have been my suggestion. COM interop has worked really well for me, and I've used COM objects and interfaces in C# (simply reference the COM object and the runtime callable wrapper gets created automatically). Similarly marking a C# class as "Register for COM interop" has w...
>[^\t]+\t|"[^"]+"\t using the Regex definitely looks like the best bet, however this one just returns the whole string. I'm trying to tweak it, but not much luck so far. string[] tokens = System.Text.RegularExpressions.Regex.Split(this.BuildArgs, @"[^\t]+\t|""[^""]+""\t");
No, because this isn't really anything to do with the function; the error is coming from attempting to de-reference a non-existent array key. You can change the warning level of your PHP setup to surpress these errors, but you're better off just not doing this. Having said that, you *could* do something like ...
Save Actions rocks. There you can get your Imports organized (Ctrl+Shift+o) and formatting of code (CTRL + SHIFT + f). Besides from that i love ALt + Shift + R for refactoring. My favorite things is the plugins though: They might cause you to use more time but most of the time they give quality (subjective I know)...
I'd convert it into a single Linq statement: var results = //get your inital results from x in GetInitialResults() //either we don't need to check, or the check passes where string.IsNullOrEmpty(ddlFileName.SelectedItem.Text) || x.FileName.Contains(ddlFileName.Sele...
What's a clean/simple way to ensure the security of a page?
|https|ssl|security|form|
Supposing you have a form that collects and submits sensitive information and you want to ensure it is never accessed via insecure (non-HTTPS) means, how might you best go about enforcing that policy?
|security|ssl|forms|https|
@fatcat1111, in that case by all means a standardized library would be advantageous. As for how to convince the other teams, there are two approaches that I can think of. First point out that standardization across a group always reduces coding effort (discounting for the initial ramp up for people that are new to the ...
>@Brian: I use a trinary operation to do the check for me: return $value ? $value : $default; this returns either $value OR $default. Depending upon the value of $value. If it is 0, false, empty or anything similar the value in $default will be returned. I'm more going for the challenge to emulate function...
[Console][1] From documentation: > NOTE: Console is NOT a shell. > Therefore, it does not implement shell > features like command-line completion, > syntax coloring, command history, etc. > > > Console is simply a nice-looking front > end for a shell of your choice > (cmd.exe, 4NT, bash, etc.) Other > ...
From [7 Habits of Highly Effective People](http://en.wikipedia.org/wiki/The_Seven_Habits_of_Highly_Effective_People), Habit 2: Begin with the End In Mind. With any project you need a clear goal, a point where you can say "I'm finished". Once you have that, you can start planning how to get there.
From [7 Habits of Highly Effective People](http://en.wikipedia.org/wiki/The_Seven_Habits_of_Highly_Effective_People), Habit 2: Begin with the End In Mind. With any project you need a clear goal, a point where you can say "I'm finished". A clear outcome will give you direction. Once you have that, you can start pla...
How do you create a database from an EDM?
|sql|ado.net|entity-framework|
How do you create a database from an Entity Data Model. So I created a database using the EDM Designer in VisualStudio 2008, and now I want to generate the SQL Server Schema to create storage in SQL Server.
There was already similar [question](http://stackoverflow.com/questions/20426/how-to-maintain-a-recursive-invariant-in-a-mysql-database) raised. Here is my answer (a bit edited): I am not sure I understand correctly your question, but this could work [My take on trees in SQL](http://www.depesz.com/index.php/2008/...
I'm using Terminals for remote connection via Telnet, RDC, SSH, ... Combines most used protocolls in one program. URL: http://www.codeplex.com/Terminals
Matt, I think the game you're referring to is [CRobots][1] (or one of its clones, perhaps -- my first contact was with PRobots, in Pascal, if I remember correctly). It was a lot of fun. [1]: http://en.wikipedia.org/wiki/Crobots
In unix (or on a mac), use the [`tee` command][1]: $ echo 123 | tee >(tr 1 a) | tr 1 b b23 a23 Usually you would use `tee` to redirect output to multiple files, but usings >(...) you can redirect to another process. So, in general, $ proc1 | tee >(proc2) ... >(procN-1) | procN will do wh...
I would say the most common mistakes when working with an SSL-enabled site are 1. The site erroneously redirects users to http from a page as https 2. The site doesn't automatically switch to https when it's necessary 3. Images and other assets on an https page are being loading via http, which will trigger a ...
If you mean - will the method be allowed to access the contents of the character space, the answer is yes.
Yes, because a string is of dynamic size, so there must be heap memory behind the scenes However they are NOT the same. in c the pointer points to a string that may also be used elsewhere, so changing it will effect those other places.
The downside to TDD is that it is usually tightly associated with 'Agile' methodology, which places **no** importance on documentation of a system, rather the understanding behind why a test 'should' return one specific value rather than any other resides only in the developer's head. As soon as the developer leav...
For value types (int, double, etc.), the function receives a copy of the value. For other objects, it's a reference pointing to the original object. Strings are special because they are immutable. Technically it means it will pass the reference, but in practice it will behave pretty much like a value type. You ca...
Use this function to filter the output of the explode function function filter_empty(&$arrayvar) { $newarray = array(); foreach ($arrayvar as $k => $value) if ($value !== "") $newarray[$k] = $value; $arra...
You could also use the Convert class Convert.ToDateTime("2008/11/25");
If you're set on doing this in MS Office you can use the Win32::OLE module to control Excel via [OLE][1]. Be warned, that this tends to run slowly and it can be difficult to find documentation for Excel's API. On the plus side, it allows you to do pretty much everything that you can do manually. [1]: http://en.wik...
[Environment.OSVersion][1] [1]: http://msdn.microsoft.com/en-us/library/system.environment.osversion.aspx
Use assertions for validating input you control: private methods and such. Use if statements for validating input you don't control: public interfaces designed for consumption by the user, user input testing etc. Test you application with assertions built in. Then deploy without the assertions.
I don't know if you are using MSBuild(Visual Studio) to build your binaries. But if you would: there is a connection possible between Subverion and MSBuild through [MSBuild Community Tasks Project][1] Here's part of our build script: our (C#) application gets the svn revision number included: <SvnVersi...
$("<div id='xxx'></div>").append($("#someotherdiv").clone()).insertAfter("#somediv > ul") Try to add your generated DOM nodes to the document only after finishing your work. Once the nodes are added to the displayed document, the browser starts listening to any change to refresh the view. Doing all the work b...
$("<div id='xxx'></div>") .append($("#someotherdiv").clone()) .insertAfter("#somediv > ul") Try to add your generated DOM nodes to the document only after finishing your work. Once the nodes are added to the displayed document, the browser starts listening to any change to refresh the view. ...
Go the other way around and use `insertAfter()`. $("<div id='xxx'></div>") .append($("#someotherdiv").clone()) .insertAfter("#somediv > ul") Try to add your generated DOM nodes to the document only after finishing your work. Once the nodes are added to the displayed document, the browser ...
Have you tried to use ";expires=Thu, 01-Jan-1970 00:00:01 GMT" ?