instruction
stringlengths
0
30k
If you have to use them use capitals, this draws attention to them and singles them out from being mistakenly interpreted as "Class" names. Drawing attention to them has the additional benefit of catching someone's eye that will come along and refactor your code and remove them. ;)
I vaguely recall having problems with SSRS on one machine when we changed the "Enable HTTP Keep-Alives" setting in IIS. Try toggling that checkbox (I don't remember whether it was checked or unchecked when it caused us problems).
if ($entry.EntryType -eq "Error") Being Object Oriented, you want to test the property in question with one of the standard comparison operators you can find [here][1]. I have a [PS script][2] watching logs remotely for me right now - some simple modification should make it work for you. [1]: http://ww...
if ($entry.EntryType -eq "Error") Being Object Oriented, you want to test the property in question with one of the standard comparison operators you can find [here][1]. I have a [PS script][2] watching logs remotely for me right now - some simple modification should make it work for you. edit: I suppose I ...
They are kind of the goto of Java - not sure if C# has them. I have never used them in practice, I can't think of a case where avoiding them wouldn't result in much more readable code. But if you have to- I think all caps is ok. Most people won't use labelled breaks, so when they see the code, the caps will jump ou...
> I know, I should not use labels. >But just assume, I have some code, that could gain a lot in readability from labeled breaks, how do I format them. Mo, your premise is wrong. The question shouldn't be 'how do I format them?' Your question should be 'I have code that has a large amount of logic inside loops...
I find VisualSVN to be well worth the money. There are ways to do it with Tortoise, but the integration of VisualSVN is very nice. I had tried over VS-integration tools before like Ankh and was not impressed. V-SVN has really upped the level of interaction with the repository from the IDE. The quick trick in Tortois...
Flyweight really is just a way of conserving resources in situations where there are thousands of objects with intrinsic shared state, so it could be useful in higher level languages than C/C++. Maybe the GOFs example using glyphs in a document was not the best choice to illustrate this pattern. I think there's a lo...
Like Rob Allen, I use SQL Compare / Data Compare by Redgate. I also use the Database publishing wizard by Microsoft. I also have a console app I wrote in C# that takes a sql script and runs it on a server. This way you can run large scripts with 'GO' commands in it from a command line or in a batch script. I use Mic...
Version Control for Graphics
|version-control|graphics|versioning|
Say a development team includes (or makes use of) graphic artists who create all the images that go into a product. Such things include icons, bitmaps, screen backgrounds, button images, animations, etc. Obviously, everything needed to build a piece of software should be under some form of version control. Should ...
I think John is correct. "My main concern is that instantiating and disposing one huge DataContext class all the time for individual operations that relate to specific areas of the Database would be impose an unnecessary imposition on application resources" How do you support that statement? What is your experim...
What are the best practices when using SWIG with C#?
|swig|c#|c|
Has anybody out there used the [SWIG][1] library with C#? If you have, what pitfalls did you find and what is the best way to use the library? I am thinking about using it as a wrapper for a program that was written in C and I want to wrap the header files where I can use them in my .NET application. [1]: http...
|c#|c|swig|
Has anybody out there used the [SWIG][1] library with C#? If you have, what pitfalls did you find and what is the best way to use the library? I am thinking about using it as a wrapper for a program that was written in C and I want to wrap the header files where I can use them in my .NET application. ####Edit: So...
Has anybody out there used the [SWIG][1] library with C#? If you have, what pitfalls did you find and what is the best way to use the library? I am thinking about using it as a wrapper for a program that was written in C and I want to wrap the header files where I can use them in my .NET application. ####Edit: So...
The best way that I know of because of leap years and everything is: DateTime birthDate = new DateTime(2000, 1, 1); int age = (DateTime.Now - birthDate).Days /365; Hope this helps.
The best way that I know of because of leap years and everything is: DateTime birthDate = new DateTime(2000, 1, 1); int age = Convert.ToInt32((DateTime.Now - birthDate).TotalDays /365.25D); Hope this helps.
The best way that I know of because of leap years and everything is: DateTime birthDate = new DateTime(2000,3,1); int age = (int)Math.Floor((DateTime.Now - birthDate).TotalDays / 365.25D); Hope this helps.
I have been using the 64Bit version of TortoiseSVN for ages and I have never had issues with it on Windows 64Bit or Vista 64Bit. I am currently not aware of any other similiar SVN clients that do work on Vista. Is it possible the problem could lie within the configuration of TortoiseSVN or even the installation of Vist...
I'll second Diago's answer. I use TortoiseSVN on Vista x64 pretty heavily. I did upgrade directly from an older version to 1.5.2 though, and never used 1.5.1. Have you tried 1.5.2?
TortoiseSVN in combination with VisualSVN for VS.
I too get explorer crashes in Vista (I'm not in the 64Bit version though). I'm using Vista Super Saijen (or whatever they are calling the most expensive version). I'm not having any bugs with Tortoise. My explorer does, however, crash about every other day (sometimes multiple times a day if it's having an "off" day)...
The answer above is correct but I think there is a lot of confusing additional detail there. The basic answer is "in a BLOB column". BLOB is short for Binary Large OBject and that column type is specifically for handling binary data. See [the relevant manual page][1]. [1]: http://http://dev.mysql.com/doc/re...
The answer above is correct but I think there is a lot of confusing additional detail there. The basic answer is "in a BLOB column". BLOB is short for Binary Large OBject and that column type is specifically for handling binary data. See [the relevant manual page][1]. [1]: http://dev.mysql.com/doc/refman/5....
Wound up using this, kind of a hack, but actually works pretty well. Only thing is you have to be very careful with your semicolons. : D var strSql:String = stream.readUTFBytes(stream.bytesAvailable); var i:Number = 0; var strSqlSplit:Array = strSql.split(";"); for (i = 0; i < strSqlSplit.length; i...
It depends on how the property is used. For example, say you have a student object that has a name property. You could use your Get method to pull the name from the database, if it hasn't been retrieved already. This way you are reducing unnecessary calls to the database. Now let's say you have a private integer cou...
[OpenNETCF][1] is a large collection of classes, components and controls for the compact framework. I'm not sure that they have anything that'll jazz up your UI, but it'd be worth a look. [1]: http://www.opennetcf.com/
I tried mono 1.9.1 (Mono 2.0 beta) and had some problems with sorting, generated columns, and some nasty exceptions.
A number of vendors provide controls for the Windows Mobile environment. [Component One Mobile][1] [Pocket PC Controls][2] [Resco Mobile Forms Toolkit][3] [1]: http://www.componentone.com/SuperProducts/StudioMobile/ [2]: http://www.pocketpccontrols.com/ [3]: http://www.resco.net/developer/mobile...
You didn't specify what you meant by fastest. If you want to get the answer quickly without writing any code, I would give the [gpsbabel radius filter][1] a go. [1]: http://www.gpsbabel.org/htmldoc-1.3.3/filter_radius.html
Why is git better than Subversion?
|subversion|git|
I've been using Subversion for a few years and after using SourceSafe, I just love Subversion. Combined with TortoiseSVN, I can't really imagine how it could be any better. Yet there's a growing number of developers claiming that Subversion has problems and that we should be moving to the new breed of distributed ver...
|svn|subversion|git|
|svn|git|
|svn|git|
Use the value of the $TMP environment variable, and if that doesn't exist, use `/tmp`.
Use the value of the $TMPDIR environment variable, and if that doesn't exist, use `/tmp`.
Run them as a two stage process with your "autorun" script calling the second script in a new terminal eg gnome-terminal -e top --title Testing Would run top in a new gnome terminal window with the title "Testing" You can add additional arguments like setting the geometry to determine the size and location of...
xterm -e shellscript.sh or (if xterm isn't installed) gnome-terminal -e shellscript.sh or (if you're using kubuntu / kde) konsole -e shellscript.sh
If you query the registry, you can retrieve the data about the registered file type and then call the app directly passing the command line arguments. See [Programmatically Checking and Setting File Types][1] for an example of retrieving shell information for a file type. [1]: http://www.blackwasp.co.uk/Program...
Using my code from [this][1] answer you can get command associated with xls extension. Then you can pass this command to Process.Start method. [1]: http://stackoverflow.com/questions/24954/windows-list-and-launch-applications-associated-with-an-extension#24974
From the demos of the designer I've seen, it's not a flawless tool. It is a version 1.0 product, so it's bound to have some pain points. The change type is one of them it seems. From watching the designer and the code generation, I figured that one would break either at compile time (not likely) or at run-time (when th...
I feel your pain. We have an application which is 'cross-platform'. A typical client/server application where the client needs to be able to run on windows and linux. Since our client base mostly uses windows we work using VS2008 (the debugger makes life a lot easier) - however we still need to perform linux builds. ...
Well, flyweight is a ridiculous pattern to use in a word processor. IIRC, they had each character being referenced as a object. With a pointer being wider than a character and all the processing associated with indirection, you'd be mad to use that particular pattern that way in a word processor.
Well, [flyweight][1] is a ridiculous pattern to use in a word processor. IIRC, they had each character being referenced as a object [note: it was for each *glyph*, which is still crazy because your OS will happily draw that for you]. With a pointer being wider than a character and all the processing associated with i...
Well, [flyweight][1] is a ridiculous pattern to use in a word processor. IIRC, they had each character being referenced as a object [note: it was for each *glyph*, which is still crazy because your OS will happily draw that for you]. With a pointer being wider than a character and all the processing associated with i...
You should really check the Free as in Beer option of [AnkhSVN][1]. They made some major improvements in v2.x and I don't feel penalized anymore when doing ReSharper refactoring-ninja moves inside Visual Studio. [1]: http://ankhsvn.open.collab.net/
PHP doesn't support enums, which might be one area of mismatch. Also, watch out for collection types, PHP despite it's OO features, tends to have no alternative to over-using the array datatype. Check out the sections on the PHP manual on iterators if you would like to see beyond this. Public, protected, private,...
Use something like Host Monitor <http://www.ks-soft.net/hostmon.eng/> to monitor the Event Log for messages related to the failover event, which can send you an alert via email/SMS. I'm curious though how you wouldn't need to know that the failover happened, because don't you have to then update the datasources in y...
We use subversion. Just place a folder under /trunk/docs for comps and have designers check out and commit to that folder. Works like a champ.
I found the answer to my own question by finding a more compatible implementation of <code>stdbool.h</code> that is compliant with the C99 standard. <pre><code>#ifndef _STDBOOL_H #define _STDBOOL_H #include <stdint.h> /* C99 Boolean types for compilers without C99 support */ /* http://www.opengroup.org/onli...
'goto' usage
|language-agnostic|
I've long been under the impression that 'goto' should never be used if possible. While perusing libavcodec (which is written in C) the other day, I noticed multiple uses of it. Is it ever advantageous to use 'goto' in a language that supports loops and functions? If so, why?
|language-agnostic|
I would definately put the graphics under version control. The diff might not be very useful from within a diff tool like diffmerge, but you can still checkout two versions of the graphic and view them side by side to see the differences. I don't see any reason why the resultant graphics shouldn't be kept in the sav...
@lomaxx TortoiseSVN includes a program called TortoiseIDiff which looks to be a diff for images. I haven't used it but looks intriguing.
Interesting question. I don't have a bunch of experience working directly with designers on a project. When I have, it's been through a contractual sort of agreement where they "delivered" a design. I have done some of my own design work for both web sites and desktop applications, and though I have not used source ...
I'm agreeing with Mike Stone also. My company recently implemented a new user table for outside clients (as opposed to internal users who authenticate through LDAP). For the external users, we chose to store the GUID as the primary key, and store the username as varchar with unique constraints on the username field. ...
Learning a new programming language or technology is for one of three reasons:<br/> 1. Need: you're starting a project for building a web application and you don't know anything about ASP.NET<br/> 2. Enthusiasm: you're very excited about ASP.NET MVC. why not try that?<br/> 3. Free time: but who has that anyway. T...
Compressing / Decompressing Folders & Files in C#?
|c#|compression|folders|file|
Anyone know of a good way to do this in C# quickly? Handling large files might be necessary. Thanks in advance? :)
Compressing / Decompressing Folders & Files in C#?
Anyone know of a good way to do this in C# quickly? Handling large files might be necessary. Thanks in advance? :) ![alt text][1] [1]: http://kevinx.net/labs/php/badge.php?txt=FireFox%20ReloadEvery%20Power%20User&c=g
Anyone know of a good way to do this in C# quickly? Handling large files might be necessary. Thanks in advance? :) ![alt text][1] [1]: http://kevinx.net/labs/php/badge.php?txt=F5%20F5%20F5%20F5%20&c=g
Anyone know of a good way to do this in C# quickly? Handling large files might be necessary. Thanks in advance? :) ![alt text][1] [1]: http://kevinx.net/labs/php/badge.php?txt=F5%20F5%20F5%20F5%20F5%20F5%20F5%20F5%20F5%20F5%20F5%20F5%20F5%20F5%20F5%20F5%20F5%20F5%20F5%20F5%20F5%20F5%20F5%20F5%20F5%20F5%20F5%2...
Anyone know of a good way to do this in C# quickly? Handling large files might be necessary. Thanks in advance? :) ![alt text][1] [1]: http://kevinx.net/labs/php/badge.php?txt=F5%20F5%20F5%20F5%20F5%20F5%20F5%20F5%20F5%20F5%20F5%20F5%20F5%20F5%20F5%20F5%20F5%20F5%20F5%20F5%20F5%20F5%20F5%20F5%20F5%20F5%20F5%2...
@Daniel You could just add a second host header and internal IP address to the site for internal non-ssl access 172.16.3.1:443:portal.mycompany.com 172.16.3.2:80:internalportal
It's important to know what is available with the Windows API. I don't think you need to crank out code with it, but you should know how it works. The .NET Framework contains a lot of functionality, but it doesn't provide managed code equivalents for the entire Windows API. Sometimes you have to get a bit closer to ...
We are using a similar solution to what you described. We have our code stored on the Windows side of the world and UNIX (QNX 4.25 to be exact) has access though an NFS mount (thanks to UNIX services for Windows). We have an ssh into UNIX to run make and the pipe to output into VS. Accessing the code is fast, builds...
This is due to how subversion works. Each revision is really a snapshot of the repository identified by that revision number. If all your projects share a repository then it is unavoidable. Typically, in my experience, however you would setup separate repositories for completely unrelated projects. So short answer is n...
Can I configure VisualStudio 2008 to always build the startup project?
|visual-studio|
I have a solution with several projects, where the startup project has a post-build event that does all the copying of "plugin" projects and other organizing tasks. After upgrading the solution from VS 2005 to VS 2008, it appears as though the post-build event only fires if I modify the startup project, which means my ...
I store one project per repository, and like a previous [commenter][1] on this [subversion question][2], I mark shared projects as external, so that they are only in source control once. I'm just starting to add a CI build server (CruiseControl.NET), so I'll have to see how that all works out, but if my build script...
The revision number should really only be an identifier for a particular version. Whether it's sequential for a project or not shouldn't matter. That being said, I can understand that it's less than ideal. Most projects I've encountered have been setup in a single repository and the revision ids behave in this way. ...
Developer Setup for Starting Out with Cocoa/Mac Programming
|mac|macos|cocoa|
I'd like to start experimenting with Cocoa and programming for Mac OSX. I'm not terribly concerned with Objective C syntax/constructs/bheaviors at this point, but more curious as to an efficient setup on in terms of an editor and/or IDE that will get me going quickly. Is there any IDE even remotely similar to Visual ...
This may be too basic or limited of a solution, but couldn't you do a [String.split()][1] on each line of the file, remembering the result array of the first line to generate the XML, and just spit each line's array data out with the proper XML elements padding each iteration of a loop? [1]: http://java.sun.com/...
This has religious war potential, but it seems to me that if you're using a getter/setter, you should use it internally as well - using both will lead to maintenance problems down the road (e.g. some adds code to a setter that *needs* to run every time that property is set, and the property is being set internally w/o ...
This has religious war potential, but it seems to me that if you're using a getter/setter, you should use it internally as well - using both will lead to maintenance problems down the road (e.g. somebody adds code to a setter that *needs* to run every time that property is set, and the property is being set internally ...
Rolling your own PHP solution will certainly work though I'm not sure if there is a good way to automatically duplicate the schema from one DB to the other (maybe this was your question). If you are just copying data, and/or you need custom code anyway to convert between modified schemas between the two DB's, I woul...
> Am I just going overboard here? Perhaps ;) Another approach would be to utilize a private/protected method to actually do the getting (caching/db/etc), and a public wrapper for it that increments the count: PHP: public function getName() { $this->incrementNameCalled(); return $this->...
Another tool to try would be the SQLMaestro suite - http://www.sqlmaestro.com It is a little tricky nailing down the precise tool, but they have a variety of tools, both free and for purchase that handle a wide variety of tasks for multiple database platforms. I'd suggest trying the Data Wizard tool first for MySQL, si...
Well, it seems with C# 3.0 properties' default implementation, the decision is taken for you; you HAVE to set the property using the (possibly private) property setter. I personally only use the private member-behind when not doing so would cause the object to fall in an less than desirable state, such as when initi...
As stated in some of the comments: Sometimes you should, sometimes you shouldn't. The great part about private variables is that you are able to see all the places they are used when you change something. If your getter/setter does something you need, use it. If it doesn't matter you decide. The opposite case could ...
In college I've had numerous design and [UML][1] oriented courses, and I recognize that UML can be used to benefit a software project, especially [use-case][2] mapping, but is it really practical? I've done a few co-op work terms, and it appears that UML is not used heavily in the industry. Is it worth the time durin...
Getting Started with Unit Testing
|bestpractices|unit-testing|
Unit tests are small blocks of innocuous code that use your assumptions to see if a function returns the expected result. My question is, what are the current "best practices" in terms of tools as well as when and where to use unit testing as part of your daily coding? Lets try to be somewhat language agnostic a...
|bestpractices|unittesting|
|unit-testing|
C# Database Access: DBNull vs null