January 5th, 2009
>
Here is a short example of how to use the Find method together with an anonymous delegate in C#.
(there are plenty of examples on the web but most forget to use an external variable)
var myExternalVariable = “Cool”;
List list = new List(new string[] {“Cows”,”Are”,”Cool”});
var possibleWord =
list.Find(delegate(string s)
{ return s == myExternalVariable; });
if you want to be even hairier, translate to lambda
var possibleWord = list.Find(s => s == myVariable);
Sort.
January 5th, 2009
>
People tend to do two things. What they think is fun and what they are measured on.
Measuring is a two-edged sword and should be used with prejudice.
Giving people fun things to work with is more like icecream with a strawberry on top.
Like this:
People do things they are measured on. Since one cannot measure brilliancy and why-you-rise-in-the-morning, measuring tends to give focus to other things like klocs or amount of green unit test lights.
I worked with a guy who was fast as lightning with the drawback that everything was finished the first day; often even before the code was written. So instead of harrassing him about estimates and CRUD I let him hack away and just finished what he started. His focus was code code code and my became customer satisfaction. Both of us where satisfied.
December 30th, 2008
>
An important code regarding programming is to write code that is easy to read.
I have many times written code, polished it and then rewritten it to the original text since it was easier to read. This is considered mature and a good thing.
A month ago I wrote code like this:
return AllControlsRecursively((Control)form
).FindAll( control => (null == control as IDirty) ? false : true
).ConvertAll( control => (IDirty)control );
I thought about it for several days and then decided to leave the code as it was.
My reasoning behind this is that once upon a time I had problem understanding Fn in BASIC. Later * and & in C. Then I had to learn inheritance, virtual methods and abstract. Today it is lambda methods, WCF and WPF.
One day one has to decide to get the fingers dirty. That day is every day.
December 29th, 2008
>
Look into upgrading the 3G dongle software if your Huawei220e doesn’t work with Vista.
My Huawei 3G dongle worked nicely with my WinXP and even better with my Asus Eee.
When I changed to Vista it refused to work properly. The driver and UI installed correctly but failed to neither work nor give me a usable error message. I looked at the internet for several days without finding a solution, not even on 3’s pages. Later I by chance talked to a colleague and he told med to update it at the store for free. The first clerk didn’t have a clue what I was talking about but the next exchanged the dongle for a piece of paper and told me to wait for two days.
After two days I got the dongle back and now it works so so with Vista and not yet with my Eee.
On a note all software is not removed from the computer when uninstalled. Even though I uninstalled the software it still remembered my pin code.
The UI is also not navigable with the keyboard, a mouse is needed.
Huawei being one of the bigger, probably biggest, manufacturer of 3G dongles for laptops should really have better software.
December 29th, 2008
>
The Drop down list box is often, incorrectly, called a Combo box.
It does not sound like a big issue but user interface wise it is. A Drop down listbox only takes existing values as a Combo box allows entering of new, unknown, values. When talking about Combo boxes don’t forget to clarify what should happen if the user enters a value that doesn’t exist in the list.
Like this:
“We would like to select the Customer from a Combo box.”
“What should happen if the user enters the name of a Customer that doesn’t exist?”
“The Customer should be created.”
“Where from?”
December 27th, 2008
>
A just received a message from 3 that my 3G connection is not compatible with Flash10.
My question is -how can a user interface thingamajig destroy a network connection? What made someone come up with the bright idea that a network connection should only be useable through a graphical interface?
December 11th, 2008
>
VSNet remembers which attribute use used lastly so just start typing, there is no need to click.
Like so:
You layout a WinForm in Visual Studio. Either when you are finished or as you layout the controls you name them. There is no need to click and mark the Name attribute in the Atribute panel; VSNet remembers which attribute you typed last.
Example: Drop a label on the form. Click the Name attribute. Write the name. Drop another label on the form. Just start typing the new name without clicking anywhere. What you type goes right into the right property.
Might save some time.
November 17th, 2008
>
Change window in Visual Studio 2008 through the shortcut ctrl-tab. It goes through the windows in recent order so you get back to where you where.
If you want to get back to where you where in the same window use ctrl-minus. Go forward again with ctrl-plus.
Note: for older versions of Visual Studio you have to have the US keyboard layout, the swedish does not work with ctrl-minus.
To show the open windows either use the Window menu (alt-w-w) or the “small window menu” dropdown ctrl-alt-down.
November 2nd, 2008
>
One way to classify the custom exceptions thrown by an application is by how fatal they are. An Eric Lippert has a good idea which somewhat rhymes with my own thoughts of 3 levels of importance.
November 1st, 2008
When you have decided that open sourcing your code would be a good idea the next question follows; which license?
Claes Mogren wrote a short and good description about some licenses and the thoughts behind them: http://informationhunger.blogspot.com/2008/10/open-source-license-primer.html
Update other articles are here and here.