Great Primer for Threading Basics in .Net

I stumbled across this article from one of my LinkedIn friends,  Threads in C#

It answered one of my questions about thread pooling in a very concise, easy to understand fashion.  It is a short article, but he then goes into the Task Parallel Library, something that I really enjoy.

If you are asking why should I care about this, I use the magic of Async/Await.  These are the fundamental technologies and techniques that they are built upon.

Keep in mind that not many people are experts in highly concurrent systems, I am not one of them either.  But hopefully by reading this article we will all be a little better in how we implement parallelism/concurrency.

Cheers!

Visual Basic Basics: Visual Basic 2010 – Implicit Line Continuation

VB Line Continuation Operator (_ underscore)

Yay _

no more _

under scores _

for line continuation!!!!!_

It was one of my pain points in VB. Please visit the below, he does a wonderful job explaining it.

Visual Basic 2010 : Implicit Line Continuation – Fryan’s Digital World.

And of course, we all know that Visual Basic is superior to C#:

http://www.simple-talk.com/dotnet/.net-framework/10-reasons-why-visual-basic-is-better-than-c/

Honestly I like both, but I am partial to VB, C# is a little more masochistic.

VB.Net C# Designtime Error ~ ‘.ctor’ is not a valid identifier.

Tired of searching you project for that string? The answer is simple, which was proposed by Vladmir from Serbia on MSDN. The name of your class or form shares it’s name with a function or subroutine contained within that class. Like below:

public class Form1

private sub Form1()

end sub

end class

Changing the name of the method will fix this issue.

DataGridViewComboBoxColumn requires multiple clicks to select an item

I am reposting this because I think this guy did a good job posting this. I wish I got to this first! 🙂

DataGridViewComboBoxColumn requires multiple clicks to select an item.

DirectoryOperationException – The object does not exist.

System.DirectoryService.Protocols Library

This was a very frustrating error. I was able to connect to LDAP through LDAPadmin but not through a program I was creating. “The object does not exist” error occurs, at least in my experience when the credentials you are passing to the server do not authenticate.

In this case I was getting nowhere. Resorting to Wireshark, filtering against port 389, which is the port for LDAP resulted in me seeing a backslash in the credentials being passed as well as the username coming after the organization, which is wrong for my environment.

The resolution was to set the domain to nothing in VB or null in C# in my Net.NetworkCredential object. At the same time moving the organization to the username property.

Dim credLDAP As New Net.NetworkCredential(“cn=username”,”password”, “o=domain”)
does not work, but this does:
Dim credLDAP As New Net.NetworkCredential(“cn=username,o=domain”,”password”, nothing)

WinDbg – Dot Net Debugging Without Source Code

Debugging with WinDbg can be challenging but rewarding. One area where Windbg shines is in the area of debugging dot net without the source code.

I am very much a beginner on this but I will tell you some things that I have found invaluable. First one, Tess Ferrandez is a goddess! She is an ASP.Net Escallation Engineer at Microsoft. Her blog, If Broken It Is, Fix It You Should, is absolutely filled full of tips and tricks. She also has a very good video at DNR Tv.

Setting Up Your PC To Use WinDbg

If you are debugging  a Dot Net Program’s crash dump, you are going to need the following file off of that computer: mscordacwks*.dll. You are going to need the version of it that the program is using. The asterick (*) is where the versioning would be in the file name. You are going to want to place it in the same folder as WinDbg with the following syntax for the file name:
mscordacwks_x86_x86_2.0.50727.3603.dll

The x86 is obviously for the x86 system architecture, you can also use x64 or the IA64 for the Itanium line. Following that you have the version of Dot Net 2.0.50727 followed by the exact version number of the dll, in this case 3603.

You can then run the .loadby sos mscorwks

If you do not do this correctly you will see something like this trying to run one of the SOS (Dot Net, managed code commands):

Failed to load data access DLL, 0x80004005
Verify that 1) you have a recent build of the debugger (6.2.14 or newer)
2) the file mscordacwks.dll that matches your version of mscorwks.dll is
in the version directory
3) or, if you are debugging a dump file, verify that the file
mscordacwks_<arch>_<arch>_<version>.dll is on your symbol path.
4) you are debugging on the same architecture as the dump file.
For example, an IA64 dump file must be debugged on an IA64
machine.

You can also run the debugger command .cordll to control the debugger’s
load of mscordacwks.dll.  .cordll -ve -u -l will do a verbose reload.
If that succeeds, the SOS command should work on retry.

If you are debugging a minidump, you need to make sure that your executable
path is pointing to mscorwks.dll as well.

In this case change the name of the dll to the correct name and then run the .cordll -ve -u -l command.

David Douglass’ blog has a great cheat sheet for common commands in WinDbg: .Net On My Mind

I just want to take a minute to thank people following this blog, you are a few but devoted bunch! If you have any questions, comments, or topic suggestions, I will be more than happy to discuss them.

12/27/2009 – Happy Winter Solstice! Compiled vs. Interpreted Languages

Business meeting Sorry I haven’t had any recent posts lately with all the holiday festivities, I simply didn’t have the time. One thing I did take time to think about is the current state of programming. I must say that I am rather disappointed that a lot of the people graduating college these days have not experienced the joys and sorrows of compiling and linking program.

Modern programming has changed a lot through the years. I think a great deal of changes were brought about through the creation of Java. I have to give it props, it was the first widely popular and accepted interpreted languages. I know some people might say Perl or Lisp (I myself used to be a Perl Monger) came sooner and have a large fan base. Sun’s Java paved the way for the modern programming languages.

Microsoft was quick to follow Sun with their product Dot Net. This is where I spend most of my days anymore for work. They did come up with a slightly different product, an interpretive framework on which C#, Visual Basic, and now F# are a part. Visual Basic is now the most popular language from Microsoft and C# is now a distant second.

These interpreted languages are fast to develop in but still rely on a middle layer to interpret the code you wrote into something the CPU will understand. To this end it is both a strength and a weakness. With this you can adapt your code to change at runtime, which in reality maybe five percent of developers/programmers use this on a regular basis. Another strength is that it is heavily abstracted and which makes coding faster for experienced programmers and allows the novice to do something that they otherwise wouldn’t be able to do.

Not much has changed in compiled languages recently, I think part of this could be due to the fact that Dot Net and Java are so popular. C++ is still popular and in use today. Although its market share is really dwindling. C++ is great for being able to tell the computer exactly what you want. In C++ you are some much closer to the machine code, you can practically see the registers getting loaded and the flags being set on the processor.

Of course, once a compiled program is running, nothing comes between it and the CPU (except for the OS). Lots of control comes with the compiled language as does responsibility and tedium.

A lot of really good practices, patterns, and algorithms are heading to the scrap heap if compiled languages fade into obscurity. I know people will say they will never go away and you are right, they won’t; but they just will not be used by Joe Programmer, who is just trying to pay the mortgage.

These kids today don’t know how good they have it. I still hear the tales of yore; where one man would wire the circuits to just get program to work. I fortunately am not one of them. I am sure I would have learned a lot from experience like that; perhaps the newbies coming into field would benefit from the things I have learned in my personal tales of yore. mailbox