Previous month:
February 2008
Next month:
April 2008

March 2008

New features: .NET Compact Framework 3.5

.NET Framework for Devices has given birth to numerous Windows Mobile based Applications. I have recently been interested in the compact framework because I had bought windows mobile based HTC P3300 with a built in GPS. Previously I wrote code for compact framework 2.0. Since everything has gone 3.5 now a days, I began to wonder what is new in 3.5 and how can I take advantage of the new features. I am going to write down the my finding below.

By the way, this probably is old news to some of you ... so you might not want to continue reading.

First the bad news: No WPF

I was expecting WPF to be present in CF3.5 but there was no WPF, which is quite sad. Instead there were some extremely minor improvements to the windows forms area. However don’t be sad, because Silverlight is coming with support for Windows Mobiles and even Nokia phones.

Good News: Windows Communication Foundation is here

For service based and other communications WCF is present in 3.5 and the client services in the device can connect to the WCF service running in the PC. However the service runtime layer is not present in the compact framework. For ServiceMode contracts you will need to generate a proxy using the NetCFSvcUtil which is present in the Power Toys for .NET Compact Framework. It also supports a subset for WS-Security 1.0 specification is supported. For more on this topic please look up Messaging in the .NET Compact Framework at MSDN.

Second good news: LINQ is supported

Oh yes, … now you can write sql like strange constructs in your CF code with Linq for your device. However for XLinq XPath is not supported.

Minor improvements

If you have hardware support then the Soundplayer can play multiple sounds. See this article in MSDN for details. Unfortunately support for compressed sound is not there yet. You can get OS platform information on WinCEPlatform Enumeration class at Microsoft.WindowsCE.Forms namespace. Some other improvement were done in Logging, GAC and other areas. For more on this please read What's New in the .NET Compact Framework Version 3.5 at MSDN. You can find CF samples at this article ...NET Compact Framework Samples.

For those of you who were hoping make nice WPF apps for CF start using Silverlight.

kick it on DotNetKicks.com

Tiny Utility: Extract Sharepoint Template

Recently I needed to find out the internal contents of a few Sharepoint template file which has the extension "stp". Upon close observation it was observed that the file header started with "MSCF" which is the header for a cab file. I extracted the cab file and found an xml file called manifest.xml and a bunch of other files which looked like this.

a00000.000
b00000.000
...
...
x00000.000

When I looked closer I found that these are actually the files inside a sharepoint web site and the manifest.xml has the location where the files are located. But at the current extracted format the name and location of the files made no sense. However the mapping for these files are written in the manifest file.  So I wrote a small program that read from the manifest.xml file and moved the x0000.000 named files into appropriate folders and directories. So now we have a sharepoint template extraction utility. Please note that the manifest.xml may have a lot more file listed that was once present in your sharepoint site but those files may not present inside the template file thus is not extracted. It looked to me like the manifest file contained all garbage historical files.

To see this, please download Microsoft Cabinet SDK from from here: http://support.microsoft.com/kb/310618

Then compile this attached project and decompile your sharepoint template.

Download SharePointExtractor.zip

kick it on DotNetKicks.com

Linked In recommendations: Your job happiness Barometer

“A purely non geeky writing for geeks”

Disclaimer: The article reflects my personal view based on my small experience in life.

How do you tell if your employee is not happy and is dropping CV at different places? How can you tell that the organization you are working for is not running so well and there may be job cuts? How do you tell if your colleague is planning to move to a new job? 

Well ... there are many ways of finding that out but one of the early indicators can be that person's Linked In activity. I must say that it is not a definite pointer but it's a trend that you can watch.

Recommendations
First early indication of people wanting to change their jobs is that they will start to get recommendations. This process may start one to six months before they change their jobs but the usual time is 3 months before. Now how does this work or how is getting recommendations related to changing jobs?

Well this is how it works ... When someone is unhappy with his job and thinks or plans to move on, then he tries to get recommendations for finding a new job. This is quite rational since the person thinks that a recommendation might help him/her in the future job. Now this may not be done at the very moment the person decided to leave but at the very moment he seriously considered getting another job.

So if you are working for some company and your supervisor starts getting recommendations then you should too. Or if you are in a startup company and your CTO, CEO are getting recommendations then start packing because the company is going down and you are among the first ones to go out the door.

Check out new company before you join
If you are going to join a new company check out their employees at Linked In to see how many of them have gotten recommended in past 3 months. If the number is high then it is an indication of unhappy work environment or a job without career growth.

Other elements
Now a days people have become very expressive and they want to let the world know what they are doing by using Facebook or Twitter. But nothing tells you that someone is looking for better options like Linked In recommendations.

Why?
What I have told you sounds stupid? Can’t people go and ask for recommendations for other reasons? Some people do. But most of us don’t. And if you are a software developer and a good one then I must say that you don’t have a habit of changing jobs. So when do people keep asking for recommendations? (a) when they are angry on their supervisor , (b) when they feel that that their current job is not taking them anywhere, (c) people ask their supervisors to recommend them when they think they will look for better opportunities and it is the best time to get recommendations from their supervisors before thing get bitter. 


Strange C# 3.0 Feature: Partial Methods ... ... What ?!!

At first it was hard to believe or even think up of the concept of what might be a partial method. How can you have a partial method? How does one write it ... by omitting some code? Looks like the C# team have given birth to strange new language feature called partial methods.

Before I go any further there are 2 rules regarding partial methods that must be said.

1. Partial methods can only defined in a partial class

2. Partial method return type must be void and cannot contain any out parameter

Perhaps the naming of partial method has been wrong. It would have been better to call it skeleton method. A partial method is a method that can be called in a function and the signature of the function may be defined but may not have any body. It is like defining a method signature which we may implement later.

For example lets assume we have a class called Foo which has a method called do something and looks like code below

partial class Foo
{
    public void DoSomething(string someParam)
    {            
        // Do something important here ...some logic
        CallSomeMethodSomewhere(param);
    }
}

It is visible that the we are going to do something important inside the method. While we are writing this method we may decide that we want to log the input parameters but at the time we do not want to worry about the logging logic right now and and would rather worry about the method logic we are writing. Now this is where we might want to write a partial method. Let try to how a partial method is declared and used.

partial class Foo
{
    public void DoSomething(string someParam)
    {            
        // Log the input
        Log("DoSomething", someParam);
        // Do something important here
        CallSomeMethodSomewhere(param);
    }

    partial void Log(string functionName, string parameters); }

Now this is a perfectly valid code and will show no compilation errors. Since we have not yet defined the body of the function "Log" the C# 3.0 compiler will just ignore our function call. So a partial method lets us define a method signature and call it even when there is no implementation. Also compiler does not emit any IL for the call that we made. So the code shown below is fully ignored.

Log("DoSomething", someParam); 

Now after we are done with implementing out class, we have decided to write the function
and provide a function body. So now our code looks like this ...

partial class Foo
{     public void DoSomething(string someParam)     {                     // Log the input
        Log("DoSomething", someParam);         // Do something important here
        CallSomeMethodSomewhere(param)     }

    private void Log(string functionName, string parameters)     {
        Console.WriteLine(functionName + ":" + parameters);     }
}

So this way we are not changing the original code at all rather providing the implementation of the function later. One use of the function might be to write functions in you class and call them, while someone else may provide the concrete implementation in a function later. This will allow two persons co-ordinate and use virtual placeholders for code. This is a cleaner approach to write to-do functions later rather than providing a method body and throwing not implemented exception later.


Well ... anyway I found this to be a strange feature of C# 3.0. What did you think?

kick it on DotNetKicks.com