instruction
stringlengths
0
30k
You're using an ANSI escape sequence, which has very limited color options. I use an .Xdefaults file (explained in [this tutorial][1]). These options won't make your shell prompt all colorful, but is used by editors such as vim. Be aware that .Xdefaults can be picky about UNIX (CR) vs Windows (CRLF) line endings. ...
As mentioned several times, a deeply nested single inheritance hierarchy should impose no additional overhead for a virtual call (above the overhead imposed for any virtual call). However, when multiple inheritance is involved, there is sometimes a very slight additional overhead when calling the virtual function th...
As mentioned several times, a deeply nested single inheritance hierarchy should impose no additional overhead for a virtual call (above the overhead imposed for any virtual call). However, when multiple inheritance is involved, there is sometimes a very slight additional overhead when calling the virtual function th...
Unit tests I believe are for testing public methods. Your public methods use your private methods, so indirectly they are also getting tested.
If you don't test your private methods, how do you know they won't break?
How do you resolve crashing Windbg Logger on Vista?
|debugging|windows-vista|windbg|
I would like to use the [Logger][1] tool that ships with the [Microsoft Debugging Tools for Windows][2]. However, on Vista it crashes even with built-in Vista applications: > logger calc or > logger notepad The issue occurs if I run the tool from a command prompt with or without administrator righ...
In Python, everything is shared, except for function-local variables (because each functioncall gets its own set of locals, and threads are always separate functioncalls.) And even then, only the variables themselves (the names that refer to objects) are local to the function; objects themselves are always global, and ...
Jeff Atwood has a post on this here: http://www.codinghorror.com/blog/archives/000229.html
Jeff Atwood has a post on this here: http://www.codinghorror.com/blog/archives/000229.html He eventually went with Edit Pad Pro, because "Based on my prior usage history, I felt that EditPad Pro was the best fit: it's quite fast on large text files, has best-of-breed regex support, and it doesn't pretend to be an ID...
OpenFire is a good gpl java implementation of a jabber server. It has plenty of option plugins you can use and it can intergrate quite well with Active Directory [OpenFire][1] [1]: http://www.igniterealtime.org/projects/openfire/index.jsp
Check out [Code Converter][1] by Telerik. [1]: http://converter.telerik.com/
Since I supervise daily merges of source code,... I can only recommend against it. It is pretty, but if you do merges on a regular basis, the benefit of 'easier to read' is quickly far less than the effort involved in merging that code. Since that format can not be automated in a easy way, the first developer who...
Since I supervise daily merges of source code,... I can only recommend against it. It is pretty, but if you do merges on a regular basis, the benefit of 'easier to read' is quickly far less than the effort involved in merging that code. Since that format can not be automated in a easy way, the first developer who...
A quick caveat for my answer - it's nearly 10 years since I worked with Progress so my knowledge is probably more than a little out of date. Checking the [Progress Language Reference][1] [PDF] seems to show the two functions I remember are still there: `ROWID` and `RECID`. The `ROWID` function is newer and is prefe...
A quick caveat for my answer - it's nearly 10 years since I worked with [Progress][1] so my knowledge is probably more than a little out of date. Checking the [Progress Language Reference][2] [PDF] seems to show the two functions I remember are still there: `ROWID` and `RECID`. The `ROWID` function is newer and is ...
I'd consider experimenting with sprints that are shorter then one month. Personally I find one-two week iterations more effective at getting effective feedback quickly. It also prevents any issues that may be causing problems at the iteration level building up to levels that become harder to manage. Even for the...
There's a lot of good answers here, so i thought I'd just add one more to the list: I got a book called Project Oberon more than a decade ago, which has some very well written text on the compiler. The book really stands out in the sense that the source and explanations is very hands on and readable. The complete te...
There's a lot of good answers here, so i thought I'd just add one more to the list: I got a book called Project Oberon more than a decade ago, which has some very well written text on the compiler. The book really stands out in the sense that the source and explanations is very hands on and readable. The complete te...
Click event of textbox? Or even MouseCaptureChanged event works for me.
Click event of textbox? Or even MouseCaptureChanged event works for me. - OK. doesn't work. So you have to do 2 things: private bool f = false; private void textBox_MouseClick(object sender, MouseEventArgs e) { if (this.f) { this.textBox.SelectAll(); } this.f = false; } ...
Click event of textbox? Or even MouseCaptureChanged event works for me. - OK. doesn't work. So you have to do 2 things: private bool f = false; private void textBox_MouseClick(object sender, MouseEventArgs e) { if (this.f) { this.textBox.SelectAll(); } this.f = false; } ...
- **Does multiple inheritance slow down a class?** As mentioned several times, a deeply nested single inheritance hierarchy should impose no additional overhead for a virtual call (above the overhead imposed for any virtual call). However, when multiple inheritance is involved, there is sometimes a very sl...
I wrote a [blog post][1] about this a while ago. The performance overhead of throwing an exception should not play any role in your decision. If you're doing it right, after all, an exception is *exceptional*. [1]: http://typethinker.blogspot.com/2007/04/checks-exceptions-and-assertions.html
It may be that it's the Korn shell in which case try <ESC>k. bash at least will allow you to switch modes with "set -o vi" or "set -o emacs".
Instead of running your production server on Linux have you considered to run rails on Windows? I am currently developing an application using SQL Server and until know it seems to run fine. These are the steps to access a SQL Server database from a Rails 2.0 application running on Windows. The SQL Server adapter...
The default shell in Solaris has command history, but you can also use Bash instead, it's more user friendly. Just type 'bash' (no quotes) at the command line. You can also edit /etc/passwd to make bash your default shell.
There are some restrictions on the free accounts (namely 200MB) but we've recently set up an account with [Assembla][1] for a small project. It provides SVN (optionally externally hosted), Trac, a wiki, and several other built-in tools, similar to SourceForge. Your project does not need to be open source. [1]: h...
I have a simple set of rules: 1) Use return codes for things you expect your immediate caller to react to. 2) Use exceptions for errors that are broader in scope, and may reasonable be expected to be handled by something many levels above the caller so that awareness of the error does not have to percolate up thr...
I find myself worrying about missing the boat on something from time to time but when I actually sit down and learn some hot new technology I find that it's primarily a new combination of fundamental technologies I've already seen. My appoach is to make sure I have a good grasp of algorithms, data structures, commu...
I think it's best to just test the public interface of an object. From the point of view of the outside world, only the behavior of the public interface matters and this is what your unit tests should be directed towards. Once you have some solid unit tests written for an object you do not want to have to go back a...
This is mostly like Brian's except it didn't compile due to mismatched parens and I changed the IF to not have the select in it. It is important to note that we use DateNAME here rather than datePART because datePART is dependent on the value set by SET DATEFIRST, which sets the first day of the week. CREATE FU...
I am not an expert in this field, but unit testing should test behaviour, not implementation. Private methods are strictly part of the implementation, so IMHO should not be tested.
C# - How do you get total amount of RAM the computer has?
|c#|memory|performancecounter|
I'm wanting to get the total amount of RAM my computer has using C#. Using the PerformanceCounter I can get the amount of Available ram, by setting: counter.CategoryName = "Memory"; counter.Countername = "Available MBytes"; But I can't seem to find a way to get the total amount of memory. How would I g...
For vectors, this [thread][1] on the msdn forums has a code snippet for setting a watch on a vector index that might help. [1]: http://social.msdn.microsoft.com/forums/en-US/vsdebug/thread/c09f4fe4-4783-4dbb-8d36-85489fa2a4ae
Try a test app in C that doesn't spawn the JVM but instead tries to allocate more and more memory. See whether the test app can reach the 2 GB barrier.
How to create a GUID in Javascript?
|javascript|algorithm|guid|
I'm trying to create globally-unique identifiers in Javascript. I'm not sure what routines are available on all browsers, how "random" and seeded the built-in random number generator is, etc.. The GUID's should be at least 32 characters and should stay in the ASCII range to avoid trouble when passing them around.
A quick caveat for my answer - it's nearly 10 years since I worked with [Progress][1] so my knowledge is probably more than a little out of date. Checking the [Progress Language Reference][2] [PDF] seems to show the two functions I remember are still there: `ROWID` and `RECID`. The `ROWID` function is newer and is ...
A quick caveat for my answer - it's nearly 10 years since I worked with [Progress][1] so my knowledge is probably more than a little out of date. Checking the [Progress Language Reference][2] [PDF] seems to show the two functions I remember are still there: `ROWID` and `RECID`. The `ROWID` function is newer and is ...
You can probably fix this by giving your user account full access to that folder. Navigate to the folder in windows explorer. Right click on the folder and select properties. Select the security tab, then the Edit button, and add full control for yourself. Yes - I suppose it's a potential security issue, but you hav...
Check out this [post][1] by Brad Abrams and also the comment by Brian Grunkemeyer for some more information on how object.GetHashCode works. Also, take a look at the first comment on Ayande's blog [post][2]. I don't know if the current releases of the Framework still follow these rules or if they have actually changed ...
CI is not intended as a deployment mechanism. It *is* good to have your CI execute any automated deployment to a QA/Test server, to ensure those aspects of your build work, but I would not use a CI system like Cruise Control or Bamboo as the means of deployment. CI is for building the codebase periodically to autom...
I do similarly to you. When you have tons of controls it all becomes messy, so I prefix each name with the capitals of the control class. For example: TextBox -> tbName DataGrid -> dgName Panel -> pName This makes it clear how to handle new controls (i.e. how to derive the prefix)
First make sure your that you are using [Web Application Projects](http://msdn.microsoft.com/en-us/asp.net/aa336618.aspx) (WAP). In our experience, compared to Website Projects, WAP compiles roughly 10x faster. Then, consider migrating all the logic (including complex UI components) into separate library projects. T...
Bitmap effects work by looking at the post-rendered pixels and running standard image manipulation on them. It should only be dependent on the color of the pixels. I wonder if their algorithms don't work well on white. Try changing the color to see if that has an effect -- if it does, you might want to try putting ...
Bitmap effects work by looking at the post-rendered pixels and running standard image manipulation on them. It should only be dependent on the color of the pixels. I wonder if their algorithms don't work well on white. Try changing the color to see if that has an effect -- if it does, you might want to try putting ...
I do most of my programming work on a development server at work, so in the evening I simply detach my screen session and re-attach it in the morning, so it takes just a few seconds until I'm exactly where I left the day before. I have some macros defined in mutt to clean up my inbox (archive commit mails etc.), I h...
Free open source asp.net file managers?
|asp.net|file-manager|
Any good ones? So far I have found IZWebFileManager, OXFileManager and AWS File Picker. The file manager should be able to delete, copy, rename, download & upload files.
[Devel::Size](http://search.cpan.org/perldoc?Devel::Size) is the answer to your question. However, [Cache::SizeAwareMemoryCache](http://search.cpan.org/perldoc?Cache::SizeAwareMemoryCache) and [Tie::Cache](http://search.cpan.org/perldoc?Tie::Cache) already implement what you're looking for (with somewhat different i...
Click event of textbox? Or even MouseCaptureChanged event works for me. - OK. doesn't work. So you have to do 2 things: private bool f = false; private void textBox_MouseClick(object sender, MouseEventArgs e) { if (this.f) { this.textBox.SelectAll(); } this.f = false; } ...
Click event of textbox? Or even MouseCaptureChanged event works for me. - OK. doesn't work. So you have to do 2 things: private bool f = false; private void textBox_MouseClick(object sender, MouseEventArgs e) { if (this.f) { this.textBox.SelectAll(); } this.f = false; } ...
[Cascade][1] supports doing a build on every single change committed to the repository. [1]: http://www.conifersystems.com/cascade/
You're talking about EV (extended validation) SSL. [Digicert][1] are very competitive for this ($488 per year) and also standard SSL certificates. Whoever you go for though, make sure you check what browser compatibility they have as some of the cheaper ones do not have as wide support as the more expensive ones meanin...
I would say use SWITCH. This way you only have to implement differing outcomes. Your ten identical cases can use the default. Should one change all you need to is explicitly implement the change, no need to edit the default. It's also far easier to add or remove cases from a SWITCH than to edit IF and ELSEIF. sw...
What is your favorite Python mocking library?
|python|mocking|
What is your single favorite mocking library for Python?
The icon you see is from an Extended Validation Certificate (EV Certificate). They are notoriously higher-priced, though Verisign is not the only certificate authority that sells them. You can find them for around the $500 mark as well. [Microsoft maintains a list of CAs that work with IE7.][1] I selected two or three ...
Because chrome uses the webkit to render HTML, you can be assured if it works in safari, it'll work under chrome, however it's rendering engine [isn't up to scratch](http://www.flickr.com/photos/kurafire/2822606444/) quite yet. I think writing applications that take advantage of it is similar to writing iPhone applicat...
Is IIS7 migration a piece of cake
|migration|iis-7|
I wish to migrate a website to windows 2008 platform, is there any obvious pitfalls i should be aware of? code base is c# 3.5,asp.net with ms ajax.
This has been asked so many times. Like here: http://stackoverflow.com/questions/88359/what-is-the-best-c-to-vbnet-converter
The Mozilla [documentation][1] is good. Sites that benefit from it the most are ones that behave almost like a desktop application and need high interactivity. You can usually improve usability on almost any site by using it, however. [1]: http://developer.mozilla.org/En/AJAX
expanding on the "dict as switch" idea. if you want to use a default value for your switch: def f(x): try: return { 'a': 1, 'b': 2, }[x] except KeyError: return 'default'
If you aren't interested in the nitty gritty, you could use a higher-level library like [JQuery][1] or [Prototype][2] to create the underlying Javascript for you. The main benefit is a vastly more responsive user interface for web-based applications. [1]: http://jquery.com/ [2]: http://www.prototypejs.org/
I'm liking some of GoogleChrome- the Start page with your 9 most recent is the winner for me. The interface takes a little getting used to, but the speed is impressive, especially with Gmail. However, it glitches with Java, which rules it out for serious work at the moment. I use FireFox mostly and have Chrome for ...
The problem with websites in VS2k5 is that, when they get compiled, the resulting dlls are a mess. No namespaces, weird names, etc. If you truly want to generate a Sandcastle Help File, look at converting your website into a web application. You can definitely generate source code docs for that.
I am starting on a new project at work that I am really looking forward to. We are still in the initial design stage and have just recently completed the Logical System Architecture. We have ordered new servers for the testing and staging environments and are setting up a Continuous Integration (CI) build system based ...
|c++|pointers|
Personally, I use this website to do it for me: http://puzzleware.net/codehtmler/default.aspx
I think it's good practice. Many ASP.NET devs are unaware that their viewstates add tremendous baggage to the HTML that's being sent to their users' browsers.
- `C-a C` will clear the screen, including the prompt - `clear` (command, not key combination) will clear the screen, leaving a prompt
- `C-a C` will clear the screen, including the prompt - `clear` (command, not key combination) will clear the screen, leaving a prompt ETA: misread the original question; these will just clear the visible text, but will not clear the buffer!
It's a good practice. Unless you use ViewState values on postbacks, or they are required by some complex control itself it's good idea to save on ViewState as part of what will be sent to the client.
This is not possible without creating a custom control. You'll need to inherit from UIControl or UIView and provide a custom drawRect method. You'll also need to respond to touch and drag events to update the state of the control. I have not done this myself, but I would be prepared for a fairly significant amount of w...
Getting IIS6 to play nice with WordPress Pretty Permalinks
|iis-6|wordpress|mod-rewrite|permalinks|
I've got a WordPress powered blog that I'm trying to get setup on our IIS6 server and everything works besides the permalink structure which I'm having a big headache with. After googling around/wordpress codex I learned that it's because IIS6 doesn't have the equivalent of Apache's mod_rewrite which is required for...
You have many LNF (Look And Feel) **[displayed here][1]** but they have not exactly a 'Java User Guide' Provided. However **[MigLayout][2]** does follow closely the main User Interface standards that exist out there (including some obcure points of [button order][3]): > For instance the OK and Cancel buttons have...
Maybe you can use the **!!** command, to repeat the previous one.
Use "echo $SHELL" to see what your login shell is. If it's ksh or bash, try "set -o emacs". If that works, you'll be able to use ^P to go back a command. ^R lets you search for a command, ^F and ^B to move around within the command.
What's your price range? Do you want a straght SVN provider or do you want to host a website too? For Straight SVN Hosting Check out http://cvsdude.com/ http://www.assembla.com/ Only Hosting provider I can think of with SVN support (outside of a VPS provider) would be http://www.dreamhost.com
How can I create a directory listing of a subversion repository.
|svn|
I have a client that is asking me to give them a listing of every file and folder in the source code (and then a brief explanation of the source tree). Is there an easy way to create some sort of decently formatted list like this from a subversion repository?
I dislike return codes because they cause the following pattern to mushroom throughout your code CRetType obReturn = CODE_SUCCESS; obReturn = CallMyFunctionWhichReturnsCodes(); if ( obReturn == CODE_BLOW_UP) { // bail out goto FunctionExit; } Soon a method call consisting of ...
What JavaScript Repository should I use?
|javascript|open-source|
Many languages have standard repositories where people donate useful libraries that they want others to have access to. For instance Perl has CPAN, PHP has PEAR, Ruby has RubyGems, and so on. What is the best option for JavaScript? I ask because a few months ago I ported [Statistics::Distributions][1] from Perl to...
You are right that CSS positioning is the way to go. Here's a quick run down: `position: relative` will layout an element relative to *itself.* In other words, the elements is laid out in normal flow, then it is removed from normal flow and offset by whatever values you have specified (top, right, bottom, left). It'...
It's obviously language dependent. In the past with c++, I've declared the testing class to be a friend class. Unfortunately, this does require your production code to know about the testing class.
One big advantage of having CSS in an external file is that **one rule can apply to many different pages**. Here is a contrast of three CSS approaches: **Inline Styles** - to change the color to blue, you have to find each place that the red style exists - maybe on many pages. <pre> &lt;span style="color: red;"&gt...