For a good laugh: read the Modern computer languages are a bit like people in some ways thread in the CodeProject lounge.
–jeroen
Via: The Lounge – CodeProject.
Posted by jpluimers on 2010/06/07
For a good laugh: read the Modern computer languages are a bit like people in some ways thread in the CodeProject lounge.
–jeroen
Via: The Lounge – CodeProject.
Posted in .NET, C#, Delphi, Development, HTML, Java, Opinions, Software Development, VBS, Web Development, WPF | Leave a Comment »
Posted by jpluimers on 2010/06/04
Recently I had to do some work in Visual Studio 2005 and TFS 2005.
I missed the “Folder Compare” feature on one of my machines, and I was sure it was on one of my others.
This feature is standard in Visual Studio 2008. A very handy feature indeed :-)
Then this post reminded me to install the Team Foundation System Power Tools. Read the rest of this entry »
Posted in .NET, Development, Software Development, Visual Studio and tools | 1 Comment »
Posted by jpluimers on 2010/05/26
In C# (well, actually: .NET), there are a couple of ways to compare things:
Sometimes, this leads to confusion, for instance, given
object one = 0; object two = 0; bool same = one == two;
what would you expect the value of same to be?
Actualy, the value is false.
Why?
The reason is that the operator == does not call the System.Object.Equals method.
So the System.Int32.Equals method is never called.
What happens in stead, is that the CEQ instruction is called.
Since both the integer zero values have been boxed into two objects (referred to by one and two), the CEQ will perform the comparison on the object references.
Even though both zero values are the same, both objects have a reference to a different spot in memory (the contents of both memory spots then are the same zero value).
Since one and two refer two different memory locations, the value of same becomes false.
Similar things hold for most types, unless they overload the operator ==.
System.String is a special type.
Even though it not a value type (it is derived from System.Object, not SystemValueType), it behaves like a value type.
One of the things that string does is overload the operator == (and overload the operator !=):
public static bool operator ==(string a, string b)
{
return Equals(a, b);
}
So even though one and two are potentially* referring to different locations, their content is compared, and same becomes true.
string one = "Foo"; string two = "Foo"; bool same = one == two;
*Now lets see these memory locations:
object one = "Foo"; object two = "Foo"; bool same = one == two;
Surprise! Here too, same becomes true.
What happened here is that when the compiler compiles two identical strings into an assembly, they are interned and end up at the same memory location.
Conclusion:
Comparison in .NET is not always 101.
It depends on the types involved, value types versus reference types, boxing, interning and the overloaded operator ==.
–jeroen
PS:
Another special thing about strings is that they are immutable:
A String object is called immutable (read-only) because its value cannot be modified once it has been created. Methods that appear to modify a String object actually return a new String object that contains the modification. If it is necessary to modify the actual contents of a string-like object, use the System.Text.StringBuilder class.
PS2:
Some other interesting links on comparison, interning, etc:
Posted in .NET, C#, Development, Software Development | Leave a Comment »
Posted by jpluimers on 2010/05/25
Posted in .NET, About, Delphi, Development, Opinions, Personal, Software Development | 1 Comment »
Posted by jpluimers on 2010/05/25
Having done quite a bit of C and C++ work in the past, I often still use “Yoda Conditions”, especially in environments where you have both = and == as an operator.
So, in a boolean expression, I often put the constant to test in front of the test.
I recently learned at stackoverflow that quite a few people call these “Yoda Conditions”:
“Yoda Conditions”— the act of using if(constant == variable) instead of if(variable == constant), like if(4 == foo). Because it’s like saying “if blue is the sky” or “if tall is the man”.
Thanks to dreamlax for helping me find that.
This is a problem in languages that have both the = and == operators, and the result of an assignment itself is also a value (i.e. allowing a = b = true). Read the rest of this entry »
Posted in .NET, C#, Delphi, Development, Java, Ruby, Software Development, Web Development | 22 Comments »
Posted by jpluimers on 2010/05/21
Scott Dorman udpated his macro to change the target framework version for all projects in a solution to Visual Studio 2010 and published the new macro on CodeProject.
His new macro now supports these target frameworks:
Notes:
–jeroen
Posted in .NET, C#, C# 2.0, C# 3.0, C# 4.0, Delphi, Development, Prism, Software Development, Visual Studio and tools | 2 Comments »
Posted by jpluimers on 2010/05/14
I always tend to recompile assemblies when something changes they depend upon.
But now I’m even more careful after reading Fabulous Adventures In Coding : Putting a base in the middle.
Especially his checklist is important.
When you use a newer version of an assembly you depend on:
(1) at the very least test your derived types with the new base type — your derived types are relying on the mechanisms of the base types; when a mechanism changes, you have to re-test the code which relies upon that mechanism.
(2) if there was a breaking change, recompile, re-test and re-ship the derived type. And
(3) you might be surprised by what is a breaking change; adding a new override can potentially be a breaking change in some rare cases.
–jeroen
Posted in .NET, C#, C# 2.0, C# 3.0, C# 4.0, Delphi, Development, Prism, Software Development | Leave a Comment »
Posted by jpluimers on 2010/05/13
When you want to deploy WPF, it is important to check if you have sufficient hardware acceleration for your apps.
The most important things to check is the RenderCapability.
It gives you the Tier on which graphics is rendered.
The Tier tells something about hardware acceleration support, including a broad estimate of the pixel shader and vertex shader levels and DirectX versions.
Currently, there are 3 tiers: Read the rest of this entry »
Posted in .NET, C#, C# 3.0, C# 4.0, Development, Software Development, WPF | 1 Comment »
Posted by jpluimers on 2010/04/29
After the excitement of .NET 4.0 and all the tools around it, I totally forgot to mention that SQL Server 2008 R2 got to RTM.
If you are an MSDN subscriber you can download it there.
If you are not, you can download the Microsoft SQL Server 2008 R2 RTM – Express with Management Tools.
Brent Ozar wrote a pretty nice FAQ on the new SQL Server 2008 R2 features, much better than the “what’s new” and press release by Microsoft.
Feature conclusion so far:
–jeroen (who just turned 41 today)
Posted in .NET, Database Development, Delphi, Development, Software Development, SQL Server | 2 Comments »
Posted by jpluimers on 2010/04/28
The Microsoft patterns & practices Developer Center released the Microsoft Enterprise Library 5.0 last week.
This version of the Enterprise Library has a ton of new features, and now has full support for .NET 4.0 and Visual Studio 2010.
Next to using it from C#/VB.NET, I’m looking forward to see how well this can be used from the upcoming Delphi Prism 2011 release (scheduled to be released on May 15th).
Lots of stuff to experiment with :-)
–jeroen
Posted in .NET, C# 4.0, Delphi, Development, Prism, Software Development | Leave a Comment »