The question in the title does not refer to the actions you take when you are about to exit your application, issues like logging, closing file handles, freeing unmanaged resources and so on. It does literally refer to the exit action itself:
The idea for that post came to my mind after I had to solve a weird bug where pressing the Exit button led to a freeze in an application that I work on. It turned out that I was not using the proper Exit method although I was aware to the fact that there are 2 possibilities. Sometimes, when you are in a middle of a coding momentum, writing a lot of code, you can miss the little details. Those will come back to hunt you later on, and the most difficult thing about it is that everything was functioning fine for about a year before the bug showed his ugly face.
Lets first understand the difference between the 2 Exit methods:
Continue Reading...
That’s it, the 9th post of the series of programming job interview challenge is out and alive. 19 readers provided answers to job interview challenge #8, Pieter G was the first to provide a correct answer:
The fastest way I can come up with is to generate a finite state machine at initialization. The transitions between states would be defined by the records you look for in the pattern and one transition for an unmatched record. When the machine enters the goal state is should send the notification (how to most quickly do that I leave to someone else). When reaching the goal state the machine should not terminate but continue (else we may miss a occurrence).
You can see more details about the solution in those blog entries:
Continue Reading...
Every one of us, software developers, experienced situations where the .Net Framework could not locate an assembly and ended up facing the TypeLoadException. These failures usually happen due to an assembly deployed to the wrong location or a mismatch in version numbers or cultures. A quick way to check what went wrong is to open the module window (Visual Studio) during debugging but that may be sometimes impossible or inconvenient because:
-
We may not have Visual Studio installed.
-
We installed the product in the customer site and we don’t have the code available.
-
It is some third party assemblies which causes the problems.
Luckily, there is an assembly binding log viewer which displays information that helps us diagnose why the .NET Framework can not locate an assembly at run time. This tool is called
Continue Reading...
Software errors, are so prevalent and so harmful that they cost the U.S. economy an estimated $59.5 billion annually. There are many examples of very serious and detrimental software errors such as:
Obviously, we would like to deliver a “bug free product” to our customers, but unfortunately, this is an un achievable goal. While some errors can be very easily eliminated, other are very evasive. What are the measures taken into consideration when we decide if an error is evasive or not? Lets create a list of software error parade and talk about it:
Continue Reading...
The eighth post of the series of programming job interview challenge is out. 68 readers provided answers to job interview challenge #7 and most of them had the correct solution. As rvh mentioned, the trick here was to understand that the round table has a symmetric shape and: Actually this algorithm isn’t limited to just a round table. It will work with any shape that is symmetric with respect to both x and y axes. I couldn’t describe the correct answer better than Yoav Zobel, as he was the first one who also formally proved his algorithm:
The Correct answer (as provided by Yoav Zobel):
Continue Reading...
After publishing 10 Visual Studio shortcuts you must know and then 11 more Visual Studio shortcuts, a colleague of mine, Elan Kynsky, introduced me an MSDN page called Visual Studio 2005 IDE Tips and Tricks. This is a long article where you can learn
a couple of useful things about Visual Studio, but what attracted me most, was the “Creating a keyboard shortcuts cheat sheet” section.
As we all know, there are a lot of keyboard shortcuts in Visual Studio. We mentioned only 21 of them here at Dev102.com but according to this article, there are about 450 shortcuts available. That fact, made me realize that I know less than 10% of them… Fortunately, we can write a macro that enumerate all of the available shortcuts. To achieve that goal, go to Tools->Macros->”Macros IDE”, a macros window will pop up, expand the MyMacros project (in the project explorer), expand MyMacros namespace and double click on Module1. Copy the following code to the Macros IDE and run it.
Continue Reading...
That’s it, Times up on the sixth in the series of job interview questions. There were 39 people who answered and the first one to give a correct answer was leppie from the IronScheme project.
The correct answer is that both will return false.
You could sum up the answer by saying Boxing.
An ArrayList hold objects, so when you insert a ValueType into it, it will be boxed and become an object. When you compare List[0] to List[1] you are comparing references, and they will never be the same because they are pointing to different objects. This is the reason for getting the false in both comparison. It is true that in the second comparison you are comparing a double and an int ( 2.0 and 2), but that is not why you get false, it is due to the Boxing.
Continue Reading...
Today we are taking a comic break from code and from programming. I received some pictures of unsuccessful logos, you will be the judges…
Continue Reading...
SVG (Scalable Vector Graphics) is an open W3C standard for graphics file format and Web development language based on XML. Those image are made up of lines, curves and other “smooth” elements so when you zoom in on a SVG it stays smooth (unlike GIF, JPEG, PNG).
Imagine you can draw some of your user interface elements in a vector drawing application like: Adobe, InkScape (free) or Skencil (free) and convert your work into WPF XAML or Silverlight XAML. ViewerSVG (SVG to xaml converter) is your tool.

Continue Reading...
We all know the propertyGrid control, which provides a user interface for browsing the properties of an object. What about having a WPF propertyGrid? Well, yesterday I noticed that there is a work in progress on an open source WPF property grid. Tomer Shamam announced in his blog Essential WPF that he accepted Microsoft Israel OPEN UP challenge (open source contest) and created a new project - WPF property grid. As he stated, it is currently only a Proof of concept and the interface and its usage may change in next releases. I think that its worth tracking…
Continue Reading...