instruction
stringlengths
0
30k
|version-control|
I know there are at least 10 different ways to structure project in version control. I'm curious what some methods being used are and which ones work for you. I've worked with SVN, TFS, and currently/unfortunately VSS. I've seen version control implemented very poorly and just OK, but never great. Just to get the ...
One of the most comprehensive solutions is Cognos.
One of the most comprehensive solutions is Cognos. Dislike: You wouldn't believe how many CDs it ships in... its huge.
Hobby or Serious project, [![alt text][1]](http://svn1clicksetup.tigris.org/files/documents/3106/33794/Svn1ClickSetup-1.3.3.exe) gives you all you need with ease :) [1]: http://svn1clicksetup.tigris.org/images/svn1click.png
SVN with SmartSVN or tortoiseSVN ? not really all that lightweight, but good practice for the big bad world.
You can also type command '-i' while less is running. It toggles case sensivity for searches.
[Double Brace Initialization][1] took me by surprise a few months ago when I first discovered it, never heard of it before. [ThreadLocals][2] are typically not so widely known as a way to store per-thread state. Since JDK 1.5 Java has had extremely well implemented and robust concurrency tools beyond just locks, ...
See this MSDN Forum Post: [Creating a new Table in SQL Server from ADO.net DataTable][1]. Here the poster seems to be trying to do the same thing as you, and provides code that generates a Create Table statement using the schema contained in a DataTable. Assuming this works as it should, you could then take tha...
The [GZipStream][1] class might be what you want. [1]: http://msdn.microsoft.com/en-us/library/system.io.compression.gzipstream.aspx
How do I use T-SQL Group By
|sql|
I know I need to have (although I don't know why) an Order By clause on the end of a SQL query that uses any aggregate functions like count, sum, avg, etc: select count(userID), userName from users group by userName When else would GROUP BY be useful, and what are the performance ramifications?
Counting the number of times tags are used might be a google example: Select TagName,Count(*) As TimesUsed From Tags Group By TagName Order TimesUsed If your simply wanting a distinct value of tags, I would prefer to use the distant statement. Select Distinct TagName From Tags Order By TagName Asc
GROUP BY also helps when you want to generate a report that will average or sum a bunch of data. You can GROUP By the Department ID and the SUM all the sales revenue or AVG the count of sales for each month.
Group By forces the entire set to be populated before records are returned (since it is an implicit sort). For that reason (and many others), never use a Group By in a subquery.
If you are on Mac OSX, I found <a href = "http://www.versionsapp.com/">Versions</a> to be an incredible (free) GUI front-end to SVN.
@superjoe30 I use SVN for all of my personal projects. I started off with running svn on my home machine but eventually migrated over to Dreamhost. Their hosting packages that include Subversion are pretty reasonable.
>[superjoe30 writes](http://stackoverflow.com/questions/2658/#2674): >>Related question (perhaps answers can be edited to answer this question as well): >> >>What about using source control on your own computer, if you're the sole programmer? Is >>this good practice? Are there related tips or tricks? I use SVN fo...
<http://www.csszengarden.com/> The images are not Creative Commons, but the CSS is.
<pre> CREATE TABLE #tmpSizeChar ( table_name sysname , row_count int, reserved_size varchar(50), data_size varchar(50), index_size varchar(50), unused_size varchar(50)) CREATE TABLE #tmpSizeInt ( table_name sysname , row_count int, ...
You can mark variables as "[silent][1]" like this: $!variable If $variable is null, nothing will be rendered. If it is not null, its value will render as it normally would. [1]: http://velocity.apache.org/engine/releases/velocity-1.5/vtl-reference-guide.html
I kind of like perfmon my self. It comes with windows out of the box, and has support for a whole lot of different measurements.
Extensions are, in general, a way for graphics card vendors to add new functionality to OpenGL without having to wait until the next revision of the OpenGL spec. There are different types of extensions: 1. Vendor extension - only one vendor provides a certain type of functionality. - Example: `NV_vertex_progra...
On my Vista system typing S won't launch an lnk file unless I have the environment variable PATHEXT set with .lnk in the list. When I do S will work in cmd.exe and I have to do .\S in powershell.
On my Vista system typing S won't launch a lnk file unless I have the environment variable PATHEXT set with .lnk in the list. When I do. S will work in cmd.exe and I have to do .\S in powershell.
Why not use LINQ: System.Collections.Generic.Dictionary<string, int> myDict = new Dictionary<string, int>(); myDict.Add("one", 1); myDict.Add("four", 4); myDict.Add("two", 2); myDict.Add("three", 3); var sortedDict = (from entry in myDict orderby entry.Value as...
Why not use LINQ: System.Collections.Generic.Dictionary<string, int> myDict = new Dictionary<string, int>(); myDict.Add("one", 1); myDict.Add("four", 4); myDict.Add("two", 2); myDict.Add("three", 3); var sortedDict = (from entry in myDict orderby entry.Value as...
Do you mean that from a set of N colors, you need to pick M colors, where M < N, such that M is the *best* representation of the N colors in the M space? As a better example, reduce a true-color (24 bit color space) to a 8-bit mapped color space (GIF?). There are quantization algorithms for this, like the [Adapti...
You can try [SuperCopier](http://sourceforge.net/projects/supercopier/), it replaces the standard Windows copy mechanism while loaded. It can retry failed files at the end, resume a canceled copy (even a copy canceled by Windows), accepts "All" for every answers. You can even answer the annoying questions (file alre...
You can split them in to RGB HEX format so that you can compare the R with R's of a different color, same with the G and B. Same format as HTML XX XX XX RR GG BB 00 00 00 = black ff ff ff = white ff 00 00 = red 00 ff 00 = green 00 00 ff = blue So the only thing you would ne...
How about good old Command-Line Xcopy? With S: being the source and T: the target: xcopy /K /R /E /I /S /C /H /Y s:\*.* t:\ (German-speakers can easily memorize the command line arguments, hence I always use xcopy)
How about good old Command-Line Xcopy? With S: being the source and T: the target: xcopy /K /R /E /I /S /C /H /G /X /Y s:\*.* t:\ > /K Copies attributes. Normal Xcopy will reset read-only attributes. > > /R Overwrites read-only files. > > /E Copies directories and subdirectories, including em...
@theprise If I were wanting to use an incrementing loop instead of an instantiated list (problems with memory for massive numbers...), what would be a good way to do that without building the list?
@theprise If I were wanting to use an incrementing loop instead of an instantiated list (problems with memory for massive numbers...), what would be a good way to do that without building the list? It doesn't seem like it would be cheaper to do a divisibility check for the given integer (X % 3) than just the chec...
I am not sure why would you say that unit tests are going be removed once refactoring is completed. Actually your unit-test suite should run after main build (you can create a separate "tests" build, that just runs the unit tests after the main product is built). Then you will immediately see if changes in one piece br...
I recommend you should either add the `<br/>` line breaks or maybe use line-break entity - `&#x000D;`
I don't see what's wrong with <Line> tags. Apparently, the visualization of the data is important to you, important enough to keep it in your data (via line breaks in your first example). Fine. Then really keep it, don't rely on "magic" to keep it for you. Keep every bit of data you'll need later on and can't deduce ...
I'm not in a position to modify the permissions on folders (especially outside of the virtual directory home folder), and don't already have an App_Data folder, so am a bit hesitant to go with that. So for the moment I'm going with the CommonApplicationData Folder. - On Vista/Server 2008 this is C:\ProgramDat...
If you're using .NET 3.5 have a look at the Enumerable.Cast<TResult> method. It's an extension method so you can call it directly on the List<string>. List<string> sl = new List<string>(); IEnumerable<object> ol; ol = sl.Cast<object>(); It's not exactly what you asked for but should do the trick.
If you're using .NET 3.5 have a look at the Enumerable.Cast<TResult> method. It's an extension method so you can call it directly on the List<string>. List<string> sl = new List<string>(); IEnumerable<object> ol; ol = sl.Cast<object>(); It's not exactly what you asked for but should do the trick. ...
> I'm not in a position to modify the permissions on folders (especially outside of the virtual directory home folder), and don't already have an App_Data folder, so am a bit hesitant to go with that. If you have a website, you clearly have a folder somewhere. Can you not add a (non-web-facing) subfolder? It seems...
I would **strongly** advise against putting unrelated data in a given Git repository. The overhead of creating new repositories is quite low, and that is a *feature* that makes it possible to keep different lineages completely separate. Fighting that idea means ending up with unnecessarily tangled history, whic...
I would **strongly** advise against putting unrelated data in a given Git repository. The overhead of creating new repositories is quite low, and that is a *feature* that makes it possible to keep different lineages completely separate. Fighting that idea means ending up with unnecessarily tangled history, whic...
Just use the [HttpWebRequest][1] class in the System.Net namespace to request the file and download it. Then use [GZipStream][2] class in the System.IO.Compression namespace to extract the contents to the location you specify. They provide examples. [1]: http://msdn.microsoft.com/en-us/library/system.net.httpw...
I use [VisualSVN Server][1] (free) and [Tortoise SVN][2] (free) for school, work, hobbies, everything. If you want Visual Studio integration, you can use [Visual SVN][3] ($49) or [AnkhSVN][4] (free). [1]: http://www.visualsvn.com/server [2]: http://tortoisesvn.tigris.org [3]: http://www.visualsvn.com/visua...
Pick your flavour of distributed version control. I like Mercurial, other folks swear by Git and Bazaar. There's no need to make a fake server to put a directory under version control, which, IMO, makes it very ideal for small projects. I'm not sure if any of these have Visual Studio plugins, though.
A nice abstraction on top of Jsch is Apache [commons-vfs][1] which offers a virtual filesystem API that makes accessing and writing SFTP files almost transparent. Worked well for us. [1]: http://commons.apache.org/vfs/
You can use WebClient in System.Net to download: WebClient Client = new WebClient (); Client.DownloadFile("http://data.dot.state.mn.us/dds/det_sample.xml.gz", " C:\mygzipfile.gz"); then use [#ziplib][1] to extract Edit: or GZipStream... forgot about that one [1]: http://sharpdevelop.net/OpenSou...
Try the [SharpZipLib][1], a C# based library for compressing and uncompressing files using gzip/zip. Sample usage can be found on this [blog post][2]: using ICSharpCode.SharpZipLib.Zip; FastZip fz = new FastZip(); fz.ExtractZip(zipFile, targetDirectory,""); [1]: http://www.icshar...
Here is a post I wrote last year that shows how to decompress a gzip file using C# and the built-in GZipStream class. <http://blogs.msdn.com/miah/archive/2007/09/05/zipping-files.aspx> As for downloading it, you can use the standard [WebRequest](http://msdn.microsoft.com/en-us/library/system.net.webrequest.aspx) or...
Kyle has the right approach in asking about the interaction. There is no "correct" answer without knowing what the usage patterns are likely to be. Any architectural decision -- especially at this level -- is a trade-off. You must ask yourself: - What kind of messages need to be passed between the systems? ...
Honestly it depends on what fits in to your environment better. If you are using a lot of Non-Microsoft tools, nunit, ccnet, ncover. You will probably find better support with nant. Alternatively if you are using MSTest, TFSBuild, you will probably find MSBuild a better environment. I would learn both and use which...
Well, as a first point of call, I'd say of the common metrics HSV (Hue, Saturation and Value) or HSL are better representative of how humans perceive colour than say RGB or CYMK. See [HSL, HSV on Wikipedia][1]. I suppose naively I would plot the points in the HSL space for the two colours and calculate the magnitud...
This also sounds to me like some kind of *resistance graph* where you try to map out the path of least resistance. If you inverse the requirements, path of maximum resistance, it could perhaps be used to produce a set that from the start produces maximum difference as you go, and towards the end starts to go back to va...
This also sounds to me like some kind of *resistance graph* where you try to map out the path of least resistance. If you inverse the requirements, path of maximum resistance, it could perhaps be used to produce a set that from the start produces maximum difference as you go, and towards the end starts to go back to va...
I would **strongly** advise against putting unrelated data in a given Git repository. The overhead of creating new repositories is quite low, and that is a *feature* that makes it possible to keep different lineages completely separate. Fighting that idea means ending up with unnecessarily tangled history, whic...
I'm not sure if I completely understand this, but: 70966 / 70 seconds = 1013.8 So dividing the "value" by 1013.8 should get the duration, approximately... Edit: Yes, Ben is right, you should divide by 1000. I got 1013.8 because the 70 seconds was rounded down from 70.966 seconds to 70.
> Is what I'm trying to do possible? If so, what am I doing wrong? It's certainly possible. What's wrong is that `HTMLDecorator.__init__()` doesn't accept parameters. Here's a simple example: def decorator (func): def new_func (): return "new_func %s" % func () return new_fun...
To expand on what [Ben][1] said, it looks like they are milliseconds, and the display value is rounded slightly, possibly to the nearest 100 milliseconds and then 'cropped' to seconds. This would explain why 30533 is 30s and 70966 is 70s. [1]: http://stackoverflow.com/questions/37483/calculate-video-duration#374...
Your almost looking at it the wrong way, no 3party tool that is not aware of your application methods/naming/data/domain is going to going to be able to perfectly protect you. Something like SQL injection prevention is something that has to be in the code, and best written by the people that wrote the SQL, because t...
Xcopy keeps the Date Modified, only the Date Created and Date Accessed will change. (tested on XP Pro, try it on a small folder to check if you're using Vista as I did not test it under Vista)
Xcopy keeps the Date Modified, only the Date Created and Date Accessed will change. (tested on XP Pro, try it on a small folder to check if you're using Vista as I did not test it under Vista) Edit: You MAY want to redirect the Output though: xcopy /K /R ....... s:\*.* t:\ >c:\xcopy.log 2>&1 That way, i...
The CC.Net interface is generated via an XSL transform on your XML files put together as specified in the ccnet.config file for your projects. The XSL is already written for things like FxCop - check your server's CC xsl directory for examples - shouldn't be too hard to write your own to add in the info - just remembe...
If you've already got a bunch of custom tasks you use with nAnt, stick with it - you don't gain much with MSBuild. That said, there doesn't seem to be anything that nAnt can do that MSBuild can't at its core. Both can call external tools, both can run .Net-based custom tasks, and both have a bunch of community tasks ...
On windows, curses works out of the box, ncurses doesn't, and for a progress bar curses should be sufficient. So, use curses instead of ncurses. Also, both curses and ncurses are wafer-thin wrappers around the c library - that means you don't really need Ruby-specific tutorials. However, on the [site for the Pick...
Sanitising user input using Python
|python|xss|
What's the best way to sanitise user input for a Python-based web app? Is there a single function to remove HTML chars and any other necessary characters combinations to ensure that an XSS or SQL injection attack isn't possible?
Lightweight source control
|sourcecontrol|
I am looking for a lightweight source control system for use on "hobby" projects with only one person (myself) working on the project. Does anyone have any suggestions?
|version-control|
|sourcecontrol|
I am looking for a lightweight source control system for use on "hobby" projects with only one person (myself) working on the project. Does anyone have any suggestions? Ideally it should interface with Visual Studio to either naively or through another plug-in, outside of that, anything that works would be nice to be r...
|version-control|
I am looking for a lightweight source control system for use on "hobby" projects with only one person (myself) working on the project. Does anyone have any suggestions? Ideally it should interface with Visual Studio either naively or through another plug-in, outside of that, anything that works would be nice to be repl...
How do you download and extract a gzipped file with C#?
|c#|gzip|
I need to periodically download, extract and save the contents of http://data.dot.state.mn.us/dds/det_sample.xml.gz to disk. Anyone have experience downloading gzipped files with C#?
|c#|.net|gzip|
**break** causes the program counter to jump out of the scope of the innermost loop for(i = 0; i < 10; i++) { if(i == 2) break; } Works like this for(i = 0; i < 10; i++) { if(i == 2) goto BREAK; } BREAK:; **continue** jumps to th...
If you have access to SQL Server, then SourceGear's Vault is free for a single user. If you want to go even further, Axosoft's OnTime issue tracking is also free for single user use. I use both at home (for free) and we also use both (licensed) at our company. Both integrate into Visual Studio, and OnTime also suppo...
It's a simple matter of division: - 70966 / 70 seconds (1:10 minutes) = 1013.8 - 30533 / 30 = 1017.76 - 7007 / 7 = 1001 Looks like the numbers are nothing but milliseconds. 70966 displays as 1:10 minutes because it shaves of the millisecond part (last 3 digits).
Asserts in C/C++ only run in debug builds. So this won't happen at runtime. In general asserts should mark things that if they happen indicate a bug, and generally show assumptions in your code etc. If you want to have code that checks for errors at runtime (in release) you should probably use exceptions rather tha...
@shrughes.blogspot.com: I don't know about removing all but two - I've been sketching out various runs of the algorithm and assuming that parallel runs may remove an edge more than once I can't find a situation where I'm left without a spanning tree. Whether or not it's minimal I don't know.
How about parsing the HTML data and extracting the data with the help of the parser ? I'd try something like the author described in chapter 8.3 in the Dive Into Python [(link)][1] book [1]: http://diveintopython.org/
Yes, as a matter of fact there is. You will need to write a custom assert function yourself, as C++'s `assert()` is exactly C's `assert()`, with the `abort()` "feature" bundled in. Fortunately, this is surprisingly straightforward. _Assert.hh_ template <typename X, typename A> inline void Assert(A asse...
Get a keyboard launcher program like [Launchy][1] [1]: http://www.launchy.net/
How do I get the current location of an iframe?
|asp.net|javascript|dom|iframe|
I have built a basic data entry application allowing users to browse external content in iframe and enter data quickly from the same page. One of the data variables is the URL. Ideally I would like to be able to load the iframes current url into a textbox with javascript. I realize now that this is not going to happen...
[AutoHotkey][1] is a reasonably god program for implementing windows key shortcuts. You might instead define WIN + G to be "open browser to google" which gives you a better response time (don't have to wait for start menu to popup, etc) There are macro programs that change the macros used based on the window that's...
How can I avoid global state?
|testing|state|global|
So, I was reading the Google testing blog, and it says that global state is bad and makes it hard to write tests. I believe it--my code is difficult to test right now. So how do I avoid global state? The biggest things I use global state (as I understand it) for is managing key pieces of information between our de...
I use a lot the "intellisense" snippets in Visual Studio. You can include your own snippets and press double tab when they appear in the list. That's definitely a time saver.
Not that performance usually matters with 99% of the times you need to do this, but if you had to do this in a loop several million times I would highly suggest that you use .Equals or == because as soon as it finds a character that doesn't match it throws the whole thing out as false, but if you use the CompareTo it w...
Get the current logged in OS user in Adobe Air
|apache-flex|air|