I have passed my first MS exam Although it covers many aspects of .NET, it is the most stupid exam I have ever taken (Econometrics which I passed on a 6th attempt does not count :D)
Questions are very confusing and when you do not memorize most of .NET classes and methods you will probably fail. Many possible answers differ only by method signatures and you need to know exactly when the parameter A must be on position 1 and the parameter B must be on position 2. I am a little bit disappointed because there were no questions about designing and solving problems. IMHO this kind of exam does not prove that a programmer has any useful skills.
I would like to show you my simple, portable OpenGL framework in action. I work on it in my spare time. It’s nothing special but it is not developed to write a computer game. It mainly helps me learning how to create various 3D effects using shaders. I decided not to write an engine or something which is very trendy (I hate that word) - just a simple framework which is able to render models in my own format, render textures available in memory, change render states and write text. Also an interactive console which can change many internal options and print debug information.
Below there is a simple, diffuse lighting model computed per fragment.
Here are two screenshots presenting difference between vertex and fragment computations:
Interactive console and wireframed rendering:
Rendering text and textures from memory:
Sorry for the poor quality of the movie but it’s youtube only
No source code or binaries, I’m sorry. The code isn’t tested well and in fact shaders look lame (I created them in a hurry) - please, forgive me this time
Every programmer must sometimes use a debugger In fact, most of our job is filled with debugging rather than writing code.
In the .NET framework there are many great features we can use to make us life easier. Today I am gonna present you a few very useful things from System.Diagnostics namespace.
Debugger class:
This is a class which allows us a communication with a attached debugger. It has multiple members but there are 3 of them I want you to notice.:
Break - It just sends a break signal to a debugger. Very useful when we want to conditionally stop the execution of our application
Launch - It can launch a debugger and attach it to a process
Log - It posts a message to the attached debugger
IMHO, the most useful of those three methods is Break. Priceless when we have an unexpected situation in a code. Thanks to this method we are able to break an execution of a program. Look at this snippet:
Debug class:
Another good class which provides us helper methods in debugging process. Noticeable are:
Assert - Evaluates a condition and displays a message if a condition is false. Well known for a "test driven" programmers.
Fail - Outputs a failure message. Quite similar to the previous one but it doesn't evaluate an expression.
Indent and Unident - useful for output formatting.
Write, WriteLine and Print - write information to the Debug / Trace listeners
WriteIf, WriteLineIf - The same as above but only when specified condition is met
Ok, those classes are in fact primitive but here is something that is very useful in debugging complex hierarchical objects.
Ladies and Gentleman - please welcome Debug attributes. Thanks to them a developer is able to declaratively specify how an application should behave during debugging process.
Let's say that you do not want a debugger step into a piece of code (because it's tested and works well) - no problem, there is DebuggerHiddenAttribute. Actually it stops a breakpoint from being set inside anything that it decorates.
C#:
class Foo { [DebuggerHidden()] publicvoid Bar() { // impossible to debug here } }
Let's say that we want to determine how a class or a property is displayed in a debugger window. There are two other attributes: DebuggerBrowsableAttribute and DebuggerDisplayAttribute. This code will do a trick with local variable / watch window in Visual Studio:
[DebuggerDisplay("Value of Bar is: {_bar}")] publicint Bar {
get { return _bar; } } }
and a debugger view:
Nice You can ofcourse set some parameters to those attributes. There are more attributes such as DebuggerStepThroughAttribute but I recommend further reading on MSDN.
"Unexpected Error 0x8ffe2740 Occurred" - this message appeared today on my PC when I was trying to start IIS. A while of "googling" revealed that this is rather normal behavior of the server