Thursday, December 25, 2008

The "Dot" Behaviour

Its just my opinion about dynamic languages, so no need to be harsh.
Something that I miss in dynamic languages is IDE support, even if it exists, the "dot" behaviour is likley to be not there.
I mean that thing I like about Java and .Net editors is that you can easily make use of it for a quick dirty tool you need to implement, even though you might not no a thing about where to find which APIs, you hit the "dot" and you get a list of APIs supported by the class.
Now this behaviour is hard to find in dynamic langauge editors (for the reason the language type are dynamic), although you can write quick code using dynamic languages compared to Java or .Net, its not easy as every one says it is.
Either you have to go through the whole documentation to find out what your are looking for or try all possibilities.
Yes, you would have to do this sometimes in languages in .Net or Java (and strongly recommend the you read the documents before your use APIs for the sake of knowing what you will use) but for quick and dirty programs , it just a matter of hitting the "dot", and I would not go through the pain of going through documentation for thsi purpose.
Another case that is frustrating is when you know what your supposed to call but you dont really remember the name of the method to call !, .Net and Java editors do much better here then dynamic laguages.

Saturday, November 29, 2008

Back to The Desk

Well, last 2 weeks went in a jiffy, I was on annual leave for 2 weeks and was hopping to spend some time with my family, but it turned out to be that I had to submit 4 assignments and had spend most of my time reading. I have backlogged so much of lectures that I thought its time for me to catch up, and it was boring some times, just proofs, theorm and out of the world ideas, but I think I am kind of liking this Masters.
Anyway, my desk at home is filled with thick books, Networks, Algorithams, Database systems, Coding theory etc...
I am proud to note that, we had some guest lectures from Virtusa to do some presentations and the one that happened last was by Sabri Sawad, Sr S/W Archectect, he did a presentation on Software Archetecture and some times back a presentation from Riza Wadood. Sr Business Consultant.
At office, I'll be doing a training on UML next week for some junior collegues, that better be good. Also had some time to download a tool that was pretty cool, but don't really remember the name of it, I'll be posting something on it very soon.

Tuesday, November 18, 2008

CLIP for VS 2008

The Microsoft Captions Language Interface Pack (CLIP) is a simple language translation solution that uses tooltip captions to display translations for English user interface terms for Visual Studio 2008.
CLIP can help those users who are not good in English to learn and use Visual Studio 2008 by providing translation for the most common user interface elements of the Visual Studio Integrated Development Environment (IDE).
CLIP for Visual Studio 2008 is available in Arabic, Czech, Hebrew, Hindi, Malayalam, Oriya, Polish, Tamil and Turkish, i.e. it will display translations from English into these languages.
You can download CLIP for your langauge
here.

Tuesday, November 4, 2008

CRS and Me Getting Fatter


Picked this picture from Shuail's blog. That my first project, CRS...I would say the golden age.
I dont see most of them alot, either they are not in the same location or not in the company at all.

Well, you can seem me in the corner in a yellows striped shirt, and I was wondering how fat I have become. Me and the workout machine dont go together I guess, every morning I try to get on it and then I think, well lets sleep a liitle bit more..and I never get to do it.

Most recently I serviced my bicycle, so that I could at least ride that on the weekends and get some calories burning..well that did not turn out well either.Anyway the post is about CRS and not about how fat I have become (partially correct). There are some missing in that picture, Rasika, Prabath, Chandima and Mahasen.

Friday, October 31, 2008

No Time For Blog Posting

This is a post to let u'll guys know what I have been upto these days. It has been past one month since I have posted something.
So this is what has been happening, at office..we are targeting on beta and it has been a tough time putting up with defects, so I am sort of going home a bit late these days.
I started my MSc in Computer Science at the University of Colombo last month, so there goes my Saturdays and also some of my other free times where I was learning new stuff and watching technical videos.
The only day left then was Sunday, which I take some time to have a nap and the rest of the day I spend watching movies (all animated ones). I have given up on action, horror and romantic movies as they drag on for 2 hours or so, but animated ones just go until 1 or 1.5 hours.
So, all this adds up to no blog posting..but I am working on a plan to get some free time.

Tuesday, September 23, 2008

Going Bad with UI Prototypes

This whole month went busy at office, it was challenging work, made a number of mistakes and I am happy to say, by the end of the day I learnt out of it.
I was tyring to get the module working with little knowledge of what the requirment was, this led me to lot of re-work and most of the time was spent discussing with the team what API should be given and how things should be done. Now I think it would have been better if we could have understood what we were really building.
I have been developing the front end, most of the time it invloved only UI logic, the only thing that I had to do was, make service calls, get the data and display it, the requirment was based on a document that provided what the UI should provide, that was easy...I started designing the the UI, got a bunch of APIs from the service team, and started filling in, what I did not understand was the whole idea behind the requierment.
As days went on, issues started to rise, and I had to sit with the service team and ask ourselves why we were doing a particular thing , this ultimatley led into rework and hours of time were spent on discussion.
I learnt my lessions, what ever you are doing, understand the business requirment for why you are doing something, without basing your implementation on a mere UI prototype.
Well, guess that's the disadvantage with UI prototypes; you try to implement what ever that is in the prototype without ever thinking why your are doing it.
I would not even want to design a screen for the sake of the UI prototype, without understanding what each and every field does or it's intended purpose.

Sunday, September 7, 2008

Dynamic Language Runtime (DLR), IronRuby and Advantages

What's being popular out there right now is something called IronRuby, which is an implementation of the Ruby language in .Net, which is built indirectly on top of the CLR.
So let’s talk a little about how IronRuby fits into the .Net world, something that you should know at this point is that Microsoft is building a common platform for dynamic languages called the Dynamic Language Runtime or DLR for the short, which runs as a service on top of the CLR.

DLR provides common functionalities like MSIL generation, GC, so that dynamic language implementers can focus on the implementing there dynamic language on top of this without worrying about the “gooing” part to the CLR.
All that the language implementer needs to do at runtime is to parse the language, tokenize it and create a tree structure containing the expressions and statements and pass it on to the DLR.
At the next step the DLR is going to generate MSIL from these trees, and the MSIL would execute under the CLR. Some pretty interesting things to note here is that when the DLR does not know how an operation should be actually executed, it looks at the currently executing dynamic language and ask it how the operation should be done, then the language responds with another tree on how the operation should be done, if the language does not know how the operation should be executed than the DLR takes a default action into evaluating the expression.

Something interesting to note here is that, these trees that the DLR gets back from asking questions on how to do certain thing in a language is actually cached, so that the next time the DLR encounters something like that, it looks at the cache for an answer, and does not go through asking the language for help.

The DLR is still being built and up to now developers involved in the DLR , says there are lot more work to be done.
The whole point of the DLR and the language actually complies into MSIL and gets executed under the CLR is interoperability between these dynamic languages built on top of the DLR and other .Net languages. This would actually mean that you can consume a library that was written on one of these languages inside C# or vise versa, i.e. consuming a C# library from these dynamic languages.

This brings us to the advantages of this hectic effort, something that most developers face is covering unit testing of there respective module, one the problems that they face is the time limit when writing these in something like C# or Java.
Now, with dynamic languages being able to interop, you can write your unit testing in a language like IronRuby and consume your .Net APIs. This is much easier cos' writing your test cases in a dynamic language is must faster, and increase your productivity.

Another area where this can help is in the area of domain specific languages (DSL), where your domain specific grammar can be written in a language like IronRuby or IronPython and where your actual code generation can happen in a statically type language like C#.
This effort is also worth while in places where we use XMl as “processing” language, like in build scripts, where your build "logic" can be written in a language like IronRuby, after all writing logic in a programming language is much easier then writing in XML, I never liked XML for these purposes anyway..

There are some dynamic languages that are being implemented now, like IronRuby and IronPython, and there initial implementation can be downloaded and played around with. I choose IronRuby as the language and trying it out a little bit now a days, you can try it out too, but before that, try learning the real power in dynamic languages and try playing around with Ruby before you go ahead with IronRuby.

Wednesday, September 3, 2008

Don't Try To Handle What You Cannot Handle

One thing that came up last week was that the sorting on one of the paged grid did not work, ok…so we were hunting the bug down, but lucky something popped up in the log file and saved the day.
Clicking on the sort headers, makes a service call to retrieve the sorted data, and the UI code was written in such a way that the service call is trapped inside a try-catch block, and if any exception occurred, the exception is logged and empty data returned.


And unfortunately the service query had a bug on it. So which brings me to the point, you should catch exceptions only when you can handle it, for example, you might have anticipated that a DuplicateNameException would be thrown, well go ahead, catch it and show a nice message to the user, but if you cant, don’t put it inside a catch block and bypass the exception just for the sake of not crashing the UI.
If you really want to log it, fine, log it then remember to re-throw the exception although re-throwing as its own performance cost.


And to be amazed, the error was there al the time and no one noticed it, which brings to the justifiation the if you dont handel exceptions that you cant handle, you would have seen the issue so much earlier.

Monday, August 18, 2008

The Same Old Story Continues and Continues...

I have put my source to build, hence have some time to write a post…
It’s been a while since there was a new post on this blog, reason?..ah work. There is much change that’s going on that does not give me time to write anything new.

But this does not stop me from reading and experementing something new, so let me give you an insight on what I have been doing on my weekends.
I have been hooked up on learning about the Microsoft Dynamic Language Runtime (DLR), have been going through some videos and articles on that, and also to get a feel on all this, I started learning Ruby and started using IronRuby (the Microsoft implementation of Ruby). I am still in the process of learning more on this...but as it seems the process is slow as a worm.

Well,I hope I’ll be back again to blogging anytime sooner…I miss those free times

Sunday, July 27, 2008

ADO.NET Data Services

In Traditional web applications, you request a page and the the server, process the request, makes some database calls if needed and put your data and HTML together and pass on to the client.This model has now changed with RIA, using AJAX, Silverlight and others

Take for an example a hotel reservation page that uses AJAX for user interactions. Maybe the intital page loads with all available countries in a combo box. and when the user selects a country, all the hotels for that country is retrived through a AJAX call.


Now, this is different form the typical web model, initially by requesting this page, the server send out HTML and presentation logic (javascript in this case for AJAX) to the client. The request for the hotels for a particular country is a pure data call, where only data flows in the form of XML.

This example was just used to demonstrate the change from the traditionl web model, but you would find a lot more pure data calls then just one (like in this case) in real world web applications.

The ADO.NET Data Serveice (formally called Astoria), helps developers in this area, providing a simple but yet a powerful way to expose data centric operations.
Data services, exposes your data as a RESTful services, so that your data could be accessed as a web resource, i.e through URLs.
As RESTful services support the CRUD operations, you can use HTTP verbs like POST to insert data, PUT to update data, GET to retrive data and DELETE to delete data.

for an example, you can access all the hotels of a specific country like this,
http://www.hotelservice.svc/County(SriLanka)/Hotels..

Tthis would retrive all the hotels in Sri Lanka. The Country and Hotel in the above URL are conceptual entites in your data source of your domain.

The data from the data services can be retrived in multiple represnetation,presently the data service framework exposes data in JSON, ATOM and in POX (plain old XML).

Building a ADO.NET data services is simple. Listed below are some of the common steps when creating a ADO .NET data service.


1) Create a Entity Data Model(EDM) representing your data. The EDM was introduced part of the ADO.NET Entity Framework.
2) Create a data service class representing your entites created in the EDM.

So, Lets make this concept more concrete, lets say my database contains two table, Country and Hotel. I can create an EDM model pointing to my database.
Now, my generated model would contain 2 conceptual entities called Country and Hotel.
Next step, I create a data service (called hotelservice.svc ) based on the generated EDM model.
Now I can access all the Countries using the URL
http://www.hotelservice.svc/Country
You can see that I am actually pointing to the entity that is in my EDM model, which in turns points to the Country table.
I can access the Country with the name India like this (country name is my primary key)
http://www.hotelservice.svc/Country(India)

I can list all the Hotels for the country India like this
http://www.hotelservice.svc/Country(India)/Hotel
and so on..

What makes the ADO.NET data services very simple is that, you dont need to write code for each and every operations you provide, think about it, you would have to write a service opeartion, write your SQL query, connect to a database, execute it, get the result set, convert it into a format your client understands and send it back to the client, but with data services, all this is done for you, only things
you might have to do when exposing data in a database would be to create an EDM model and create a data service (just a few line of code, minimum of 2 lines) and the rest is done by the framework for you.

You can expose data that does not inherantly come from databases, by exposing the data to the data service framework through the IQueryable interface (introduced with LINQ).
The point of this artical is just to introduce ADO.NET data services and not to give you an example of a working sample, you can find more about how to create data services here.


What makes data services easy to use is there capabilty to provide common functionalites like filtering,sorting, ordering of data and paging, through request parameters in the url, for an example, If I want all the 3 star hotels in Sri Lanka, I can send out a request like this,
http://www.hotelservice.svc/Country(SriLanka)/Hotels?$filter=Type eq '3star'

The other operations are as easy as this, the framework even provides a parameter called $value, that allows you to retrive only data without the surrounding XML markup.

You can also restrict the types of operations that users can do on the service, like providing user only with read only access to your data.
You can download the CTP version of the ADO.NET here...try it out.

Monday, July 21, 2008

Making Applications Offline With Microsoft Sync Framework

Computers are not just on dektops anymore, we see mobile computing theses days. With the heavy use of laptops and smart phone.
When data is on the move, there are advantages of taking your data offline, this would typically mean that your client would have a data cache locally.

Having data locally has its own advantages, for example, your data is highly available, you can work offline even without connecting to your network (maybe while your flying). This model also reduces the network congestion, as users have there own copy of the data, they do not need to access the data via a network (this would be mostly true, when your applications is a few updates to the data but requires a large number of reads).

So, then again, you can work offline but you would also want to persist your changes or use the upto date date.This is where sycronization comes in, and so does Microsoft Sync Framework.
The Microsoft Sync Framework, is a set of libraries that can be used to develop offline applications, The framework will takecare of all the syncronization that your application needs, whether it be syncronizing your changes to the central data store or syncronizing your local data cache with upto date from the central store.


Sync Framew0ork, can be used with any data source as long as you have a provider for it, the provider would be responisble for making the actual data source specific call to syncronize data.

The Sync Framework also provides implementatins for resolving conflicts within data according to defined policies.
You can extend the Sync Framework for different data sources by simply creating your own provider, the framework also has a few default provider implementations like providers for ADO.Net data sources, file providers and also a SyncFeed provider for rss/atom feeds.
MIX has a nice video on ths framework on action and you can learn more and download the Sync Framework here.

Tuesday, July 8, 2008

PEX - Automated Exploratory Program Testing

One of the prodcuts that is being reserched at Microsoft is PEX (program exploration).The team released a 0.5 version product last month and you can download it here.So what is PEX anyway, what does it try to solve?, Remeber how you wrote a method with "amazing" logic and you also wrote nice test cases to test this function, if the function is not very complex and have only a few paths it can take, you would end up with maybe a test case or two and some set of input data.But if your function is very complex and has a complex , you have to go through each and every path the program would take and generate you test data (and not to metion the test cases).
What PEX does is, it "scans" your program (the method you want to test) and comes with a set of test data for each and every path. Lets take an example.

[TestMethod] // mark this as a test case
[PexMethod] //PEX attribute
public void TestMethod1(int i, int y)
{
GetNumber(i, y);
}

//The method you want to test
private int GetNumber(int i, int y)
{
int j = i / y;
if (j > 0)

return 0;
else
return 1;
}

The example is explantory (I have used MS Test), but with a few exceptions that the test case is now parameterized, to take in the parameters needed by the function that is being tested. And also you can see that a [PexMethod] attribute is added on top of the test case for PEX to recognize the test case.

You can see, that PEX created data for all possible paths of the function. Running PEX on your methods would also ensure that you delt with the most unexpected inputs as well, for an example an exception that might turn out for a value that the user passed into method that you never thought about in your test cases, making your program stable (in this example a DivideByZeroException, and if we had more paths our function could have taken, PEX would generate more test cases).

PEX work with .NET 2.0 and higher, there is also a VS 2008 add-in that you can use. Currently PEX is supports MS TEST, but they are planning to write extensions for other test tools as well.

A cool thing about PEX, is that it creates code for each and every test case it creates, so that also means that you can debug the generated test cases.

Friday, July 4, 2008

ATOM and WCF Syndication

Something that got me intrested is, syndication feeds, more particularly on ATOM 1.0.This might not be new news for most of us, but for the sake of a post after a long time, I had to do this !.
Most of us might use feed readers, I use Feedreader, and for the people who dont know what this is all about, let me give you an intro.
Think of you visiting my blog, every day to see if I have posted something new, well thats hactic, but instead the feed reader can do this for you.
You simply subscribe to the Atom feed in the blog using your feed reader and your feed reader would periodically check if the blog has been updated, if so it will retrive a summary of the recently updated posts in the blog, and if you want to view the details, you can just click on a link and go there.
ATOM is the standard that these blogs expose there post summaries, so the feed reader knows exactly how to display the information.you can read more about ATOM here..
ATOM can also be used in business applications, for an example, say my defect tracking system exposes the defects assigned to a person as an ATOM feed, I can subscribe to this feed through a feed reader and get a complete summmary of the defects that are assigned to me.OR for another example, say my HR department exposes the new joinees service as an ATOM feed, well I could just subscribe to that feed and get updated with all the new joinees of the company.
The new .NET 3.5 Web Programming Model (on that we used to create RESTFul services), particularly WCF Syndication, allows us to create ATOM feeds easily.Not only this you can expose you feed in RSS and ATOM at the same time (RSS, for your information, partially replaced RSS).
It would be great if I could give you an example on "how" easy it is...but times up..got to go..

Wednesday, June 25, 2008

WinForms : DesignMode

Back to WinForms...It was a user control which calls a service, I knew that if I wrap the service call inside a ComponentModel.DesignMode, I could get away with the service call being called at design time and the designer throwing me exceptions...Now this is not an issue at all when your are designing the control, cos' Visual Studio does not create an instance of the user control that is being designed, instead it creates a base class, UserControl, this is also true when you designing a form, a Form instance is created. Therefore .ctor of the control being designed is never called, so doesn't the service call.Now if I drag an drop this control (ctrl1) into another a control(ctrl2), the control's DesignMode property is true, but if I now drag the ctrl1 into a form, the DesignMode of ctrl1 is false.This basically means that ctrl2 is sited in the form and not ctrl1, makes sense right?.There are two work around that you can use to avoide this...1) See if the current process that is hosting the form is devenv, This is not a flexible solution, as this will not work if you open your view in a different environment.2) Use the LicenceManager class to see if we are in DesingMode or runtime.

Friday, June 13, 2008

Going Parallel With Parallel Extension For .Net 3.5

Now a days, almost all computers being used have multiple cores, for an example technologies like dual core.But, although you have dual core, generally you write programs that run on a single core, this does not utilize the total power of the multiple CPU or core that you have.
This is exactly the power what Microsoft Parallel Extensions for .NET Framework 3.5 (a.k.a PFX).gives you.
With PFX, you can write flexible programs that would take advantage of utilizing multiple cores in the environment it is deployed in, giving you high performance and scalabilty.
PFX comes in 2 "Flavours", Task Parallel Library (TPL) and PLINQ.
TPL gives you general APIs that can be used to make your program run in parallel, for an example , take the for loop below
for(int i = 0; i < 1000000; i++ )
{ //Do something that is not dependent on other iterations }

the for loop does 1000000 iterations, and does something that is not dependent on other iterations. Running this program in a mulit core machine , will only utilize one CPU and not at it's best and eventually the response time is also high.
This for loop can be easily made to run in parallel, as the iterations are not dependent on each other.
With PFX, you can re-write your program like this

Parallel.For(0, 1000000, i => (/*Do somthing */));

This program would run faster as PFX assigns chunks of iterations to the mulitple CPUs. You would also see that the almost 100% of CPUs power is used if you are on a dual core.
Parallel is a class in the PFX that gives you high level static APIs for looping and invoking in parallel, you can have a look at the docs if you want more... :)
PLINQ on the other hand, is a way to make your queries run in parallel, this applies to in-memory objects and xml. Queries that hit databases is not a candidate for parallisam and hench cannot be used with PLINQ.You can find some introductory samples and videos at the MSDN Parallel Computing section.

Wednesday, June 11, 2008

Weekend at Namunukala.

Last weekend we took some time off, at Bandarawela. Climbing the Namunkala mountain and visiting some natural pools. It was a fun guranteed trip after all. This is our team.



Monday, June 9, 2008

Velocity : Distributed Caching

Caching is one way you could increase your applications response time. For an example, take
a hotel reservation system, where you might need to show a list of hotels for a particular
country in your reservation page.

For each and every reservation made by users, a service call or a direct database call is onvloved to fetch the list of hotels for the country the user has selected, and when the number of concurrent users to your system increases, the performance of your system decreases too.
To avoid these hits, caching of your hotel objects or a hotel dataset can be used, so you application can use these to respond to a request without calling the service or making a call to the database, further more the cache is updated at periodic intervals to accomadate changes to the underlying data.
Velocity is an in-memory distibuted caching solution from Microsoft, still in it's CTP,
addresses application scalabilty.

In typical applications you would cache your data in the host your application is running
in, but using Velocity, you can configure muiltple hosts (nodes) to act as your application's in-memory cache, in other words, your application cache is distributed.
This adds on the capabilty to scale you application, for an example, if a need arises, you
can easily add a another host to your existing distributed cache so increasing the
performance and through put of your application.

Although your cached objects are distributed, Velocity gives you an interface to retrive your
cached objects in a unfied way, that is in your code you would access your cached
objects as if they reside in your local machine without the need to identify in which host
the actual cached object resides.

Velocity also gives you the capabilty to duplicate your cached object in terms of a primary and secondry "caches", so that you can stil use your secondary cache if your primary cache fails, making availabilty first class.You can read more about velocity here

Thursday, June 5, 2008

Better Late Then Never

It's been a few weeks since I have blogged, was a bit hooked up on catching on with some of the MS technologies.I started learning the ADO.Net entity Framework, downloaded some videos, samples and ye, did some pretty intresting stuffs with it.Then there was last week, when one of my friends asked me a question on web services, got a bit confused and I had to dig into some of the ws-* standards and WCF Security, and finally thought of going through the specificaions at w3c, and I ended up reading the ws-security and ws-addressing spec.Then there was this week, started looking at some presentations on the ADO.Net data services on MIX 08, still doing this !!!. and another thing about all these is that I am getting not much of time to do all these readings, cos' I have hooked up into some of the old cartoons that I always wanted to watch, like the X-Men, King Artuher, The Mask etc...Well for all, I guess its better late then never !!!

Saturday, May 24, 2008

.NET Framework Client Profile

The .NET framwork keeps on growing and so does the size, so it has become apparent that a lighter version of the .NET Framework is needed.
Last week, Microsoft released the Visual Studio 2008 and .NET Framework 3.5 SP1 Beta. This includes the .NET Framework Client Profile,a smaller, optimized verson of the .NET framework needed for clients applications to run.The size of this framework is approximatley 27 MB (not that small), some of the assemblies that still lies in the beta but will be removed in the RTM version are

System.Management,

System.Messaging,
System.ServiceProcess,
System.Web,
System.Web.RegularExpressions

Visula Studio 2008 also has an option where you can make sure that an application targeted for the Client Profile Framework does not reference assemblies that are not included in the Client Profile Framework.You can have a look at the list of assemblies that are inluded in the client profile here

Monday, May 12, 2008

WS-* and REST, Which Is Better and Why?

I have been hooked up to REST these days after having some times to go through the WCF Web Programming Model (I know I am lagging behind in technologies !).
While looking at the pros and cons of REST and WS-*, I could see more then few web pages, blogs, on the debate of what’s the best solution for SOA.
REST is easy to use, no SOAP-client tool kits needed to generate web service proxies, as the fundamental concept behind REST being every operation is accessed by its unique URI, it's just a matter of typing it in your web browser, this also makes testing easier for developers (as all they need to do to see if the service is working, is to type the url in the browser !)
Further more if your are practicing an asynchronous pattern such as using AJAX, it might be very easy to call a REST service, get the response in JSON and do the processing on the client side, this is much easier then using the typical DOM method to parse XML.
When it comes to coupling, REST is more loosely coupled then WS-* services, because with WS-* web services, the client needs to know a great deal about the service and if the web service changes, your client need to update for it to continue working, but with REST, your only need to know the URL of the resource and nothing more, this makes REST more loosely coupled then WS-* web services.
From the non-functional requirement point of view, simplicity of architecture, performance due to no or less XML overhead and caching of result set (page) which is
built into the back bones of HTTP and the ability to server a huge number of clients due caching and clustering support built into REST (HTTP), stand out.
This does not mean WS-* or SOAP web services are going away...WS-* web services from my opinion are the best choice for enterprise applications (although there is a debate to this), with it's reliability, security and transactional capabilities.
REST does not support distributed transaction directly, and when it comes to security, REST has to entirely depend on the best it has, SSL.
REST would always be a better choice when it comes to developing services when you don’t know your clients, in other words the type of clients. As a final point, it’s is very clear that when it comes to WS-* web services, there are more alternatives when it comes to making architectural decisions and if advanced functionality delivered by WS-* is needed, it is no easy thing to extend RESTful services to deliver this
So finally to say, I am not saying REST is better then SOAP or vice versa, but what I am saying it's a matter of
pure architectural decision.
This is not a compressive comparison between REST and WS-* but instead a snap shot.



Tuesday, May 6, 2008

RESTful Example

Here is an example on how you would create a RESTful webservice with the WCF Web programming model. I assume that you know how to write a WCF service and host it in IIS.
In this example I am going to create a service that will say "Hello" plus a string that is passed into the service, further more the service is going to be hosted in IIS.
the following is a WCF service class,
[ServiceContract]

public interface ITest
{
[OperationContract]
[WebGet(UriTemplate="/SayHello/{str}",ResponseFormat= ebMessageFormat.Xml)]
string SayHello(string str);
}
public class TestImpl : ITest

{
public string SayHello(string str) { return "Hello " + str; }
}

SayHello is our service operation. Note that this is a general WCF service with addittion of a [WebGet] attribute on top of our service operation. by using the [WebGet] attribute we mean that the operation is to be invoked with the HTTP GET verb.The next step is to define our .svc file for our service, the content of the .svc file would look like this.
< @ ServiceHost language=c# Debug="true" Service="RestService.TestImpl" Factory="System.ServiceModel.Activation.WebServiceHostFactory" % >

Again this a general .svc file with the exception of having a WebServiceHostFactory specifed as a factory class to create the appopriate webHttpbinding endpoint.
Now all we have to do is host the service in IIS. The binding used to create RESTfull services, the webHttpbinding does not support multiple authentication, therefor make sure to select only one type of authentication for the directory security in IIS.
We are done...you can access you service like this (assuming that your IIS is running local):
http://localhost/RestService/RstSvc.svc/SayHello/ Iron Man
your response would look something like this...

<string xmlns="http://schemas.microsoft.com/2003/10/Serialization/%22>Hello Iron Man</string >
If you notice carefully, you would see that the way we sent the request is mapped to our [WebGet] attribute's UriTemplate : [WebGet(UriTemplate="/SayHello/{str})]" where {str} is a place holder for the parameter of the operation. You would also see that the response format is set to xml. ResponseFormat= WebMessageFormat.Xml, so the response will be sent to us in xml.


Saturday, May 3, 2008

RESTful Web Services and the WCF Web Programming Model

REST (Representational State Transfer) is not a new thing to the web service world; you can find a lot about what it is on the net, but for formality...REST is an architectural style (not a standard) it simply means web services are identified as resources and each operation as a unique URI assigned to it.You invoke the object's operation using the HTTP verbs like GET, POST etc...
Most web services are being shifted to using this style, for an example yahoo web services use REST. But some companies continue to have a REST service in addition to the SOAP based service.
One of the advantages of using REST over SOAP based services is that REST is light weight, as there is not much XML markup; for an example, REST does not use the SOAP header which is chunky.
Another benefit of REST is that the client accessing the service does not need special SOAP tool kit to use the service, as the service operation is identified as a URI, it is just a matter of accessing it like a web page in a browser.
REST responses can also be of variety, currently XML, raw binary data and JSON responses are supported.
.NET provides a way to create RESTful web service through the WCF web programming model. This basically allows you to build your RESTful services on top of WCF; this also means that you can expose your current WCF service as a RESTful service by adding certain attributes to you operation contracts and exposing it on a different endpoint.
WCF 3.5 supports a webHttpBinding for this purpose and also a WebServiceHost class to host your RESTful service.So how is this done?.. look at the code sample below.

[ServiceContract]
public interface ICalculator
{
[OperationContract]
[WebGet]
int Add(int num1, int num2);
}

In addition to the general {OperationContract}, a [WebGet] attribute is added, this just signals the frame work that the Add method is exposed as a RESTful operation as well.On the next post I will show you how we can create a RESTful service in WCF.


Friday, May 2, 2008

Finalization, Know What it Costs

This is a post about object finalization in .NET.
Finalization is not as inexpensive as we think, it increases the pressure put on GC.All objects that need finalization are moved into a finalizable queue and the actual finalization happens in a separate thread. Because the objects full state may be needed, the object itself and all the object it points to are promoted to the next generation (this is needed so that GC does not clean these objects off in the current round), and these objects are cleaned up only after the following GC.
Due to this reason, resources that need to be released should be wrapped in as small a finalizable object as possible, for instance if your class needs a reference to an unmanaged resource, then you should wrap the unmanaged resource in a separate finalizable class and make that a member of your class and furthermore the parent should be a non-finalizable
class. This approach will assure that only the wrapped class (class that contains the unmanaged resource) will be promoted.And as mentioned earlier the finalization occurs in a separate thread and furthermore there is only one finalization thread hence if a finalizer causes this thread to block, all the other objects needing finalization in the queue will not be called and your application will
leak !!!.

Therefore, when implementing finalizers, keep it as simple as possible.A good practice to follow when the lifetime of an object is explicitly know, is to implement the dispose pattern, by implementing the IDisposable interface and calling it explicitly; or use the using statment to wrap you created instance, so that once the scope of the object is no longer valid the dispose method of the object is called.
A time may arise when you may at some places know the lifetime of the object but at some point you may not; in this case put your clean up code in a separate function, call that function in the finalizer and also in your dispose method, additioanlly call the GC.SupressFinalization() in your dispose method after the clean up method; this will inform GC not to run the finalizer.

Friday, April 25, 2008

Prabath Siriwardena on Open Id

When I joined in has as a software engineer, one of my first mentors was Prabath Siriwardena. Although it was just 5-6 months in his team, I learnt a lot from him, ranging from writing good code to, team work. He recently acquired his MSc in computer Science from the University of Moratuwa. and today works at WSO2 in the open id integration team. You can listen to his pod cast on Open id here, in this talk he mentions about what open id tries to solve and it's advantages.

Tuesday, April 22, 2008

Initializer Running in The Opposite Order as Constructors

What would be the output of this C# program be?

class Program
{
static void Main(string[] args)
{
new Derived();
}
}

public class Base
{
A ob = new A("Initialized base A");
public Base() { Console.WriteLine("In base constructor");}
}

public class Derived : Base
{
A ob = new A("Initialized derived A");
public Derived() { Console.WriteLine("In derived constructor");}
}

public class A
{
public A(string str) { Console.WriteLine(str);}
}

if your answer was :
Initialized base A
In base constructor
Initialized derived A
In derived constructor
Then you are wrong !!!, actually the answer is

Initialized derived A
Initialized base A
In base constructor
In derived constructor
Weird right?, the order is reversed, the initializers are called first in the order derived then base, then
the constructors get called from base to derived.

Imagine that one day you thought of putting a abstract method in the class Base and which you implement in the Derived class , but the
implimentaion of the abstract method in Derived accesses a instance variable in the Derived class.
In this instance if the initializers ran in the order of the constructors , you will end up with a null point exception.

although this looks reasonable, it also means the you can call a method in the Derived class from the Base class even without calling
the Derived constructor...how weired is that.

Friday, April 18, 2008

Unity Explained

I had some time in the night to make use of the MS Unity applcation block, and I thought of writting a post on an example written uing Unity.
To use the dependency injection in your code via Unity is just 2 steps.
1) Create an instance of the Unity container, like this.
//Import UnityContainer container = new UnityContainer();
UnityContainer container = new UnityContainer();


2) Register your type with the Unity container. This can be done through a configuration file or thorugh code, for our example we are using the latter approach.
container.RegisterType <IService, ServiceImpl>();

3) Get the required instance from the container, using the Resolve()
DisplayClass display = container.Resolve<DisplayClass>();

The complete code example is as follows :

using System;

using Microsoft.Practices.Unity;
using Microsoft.Practices.ObjectBuilder2;
namespace unity1

{
class Program
{
static void Main(string[] args)
{
//Create the container
UnityContainer container = new UnityContainer();

//Register the our type
container.RegisterType <IService, ServiceImpl>();

//Get an instance of our type NOTE : an instance of ServiceImpl
//will in be constructor injected into the DisplayClass when it is created

DisplayClass display = container.Resolve<DisplayClass>();

display.Show();
}
}

public interface IService
{
void Show();
}

public class ServiceImpl : IService
{
public void Show()
{
Console.WriteLine("In ServieImpl Show()");
}
}

public class DisplayClass
{

private IService srv;
public DisplayClass(IService srv)
{
this.srv = srv;
}

public void Show()
{
srv.Show();
}
}
}

In this example you can see that the ServiceImple class impliments the IService interface and we register this type with the container in our
main method, also you can see that the Display class's constructor takes an instance of IService.
In our main method we create an instance out of the DisplayClass using the Resolve method of the container and whats nice is that an instance of IService is created by the container and used to instansiate the DisplayClass.

Sunday, April 13, 2008

Dependency injection and MS Unity Application Block

Building flexible and maintainable application means to achieve decoupled or very loosely coupled design.
Loosely coupled application also mean that you can test them easily using mocks.
Two ways of achieving loosely coupled nature in an application is via techniques Dependency injection and service locator.
When we talk about dependency injection we are talking about plug-in based development and it's all about how to get a concrete implementation into your application without re-compiling your code..
You can read about dependency injection here, but this post is not about what dependency injection is but about frameworks that lets us do this in a productive manner.
Frameworks like Spring uses dependency injection techniques and there are other containers available.
What I am interested about is the container that Microsoft released last week, the Unity Application block.
This is a container that allows you use dependency injection in a productive manner in the .Net applications:


Unity tries to achieve the following vie dependency injection:
1) Provides simplified object creation.


2) Support of requirement abstraction, this allows you to specify dependencies at runtime or in a configuration file.

3) It increases flexibility by deferring component configuration to the container.
Unity is the new member to the MS pattern and practice, you can learn more about unity in it's official community site here...

Thursday, April 10, 2008

Exception Handling Best Practices

Thought of writing some thing on exception and how it should be handled. These are some of the practices to be followed when managing exceptions in code to give you some more performance.

1) Do not use exceptions to control application logic. Throwing an exception is expensive (building the stack trace, etc are expensive). For an example when searching for a student and when it does not exist, do not throw a StudentNotFoundException, as this is a common scenario, return a boolean to indicate this or else another way is to return an enumerated type to denote error.


2) Use validation code to avoid exceptions, examples like checking for null etc..can avoid unnecessarily generating exceptions.

3) Use a “finally “ block to ensure resources are released (everyone knows that by default.)

4) Re-throwing exceptions with the “throw” keyword is expensive this is same as throwing a new exception.

5) Don’t catch exception that you can’t handle. The best way is to let it propagate up the call stack so a most suitable user can (part of the code that is...) handle it.

6) Do not catch general exception, this leads hard to debug when it’s time to do so !.


Wednesday, April 9, 2008

Same Old Story...

Ok, here we go again..it's a new project, a new cubical and a code base that I need to start familiarizing...well that adds up to, I don’t get time to blog or at least read something new, ye the same old story..
After much consideration I applied for an ADSL line at home, my first thought was not too, as the weekends are allocated for family, friends and long hours of sleep, but then again I could at least do something...so I went for it.
The funniest thing was that I applied through SLT last month and still my ADSL line was not activated. Finally I called the branch I applied the line through, to find out that my application never reached the ADSL division, great!!!.
I had something to say to SLT that day over the phone...and the operator called me back after 10 minutes to apologize and to say that she will submit it to the ADSL division right away. So hopefully I will be back to blogging in a couple of days.

Friday, April 4, 2008

The Whole New Environment...

I should have learnt from my lessons! Every time I move into a new project, it seems that everything goes wrong, why?

My development environment tends to work counter to my expectation.

I have noticed this in almost all the projects I have worked in, the reason being, the tools and other stuff specific to the previous project play almost against the environment needed for the current project. How to overcome this issue? Simple, take a backup of all your souvenirs in your machine and format. This seems to do the stuff as always and I think this should be the case, starting with a whole new environment for your new system (just my opinion).

Tuesday, April 1, 2008

IE 8 Beta

Here is the link where you can download Internet Explorer 8 beta., There are some new features that has been added, you can read more about it here.The only reason I installed IE 7 was due to it's "Tab" feature, but after some use I understood it was not like IE 6 but lot of hangs, crashes and was not much of a stable product. No offence but, it's my opinion.IE 8 beta was released for download, I think 2 weeks back, but I did not have much intrest but then again it does have some new features, maybe it will prove much better to me then IE7.

Thursday, March 27, 2008

Ranking Functions : ROW_NUMBER

One of the features that was included in SQL Server 2005 were ranking functions and I bumped into one of these last week, The ROW_NUMBER().
This function allows you to provide a sequential integer value to the results of your query. This comes in handy when you want to rank your data according to some criteria.
Let me throw an example…I have a table that has a set of student marls, I can use a query shown below to actually rank the students according to there marks.

SELECT ROW_NUMBER() OVER(ORDER BY Score DESC) AS Rank,
StudentName, Score
FROM Students
ORDER BY StudentName.

In the OVER() clause you can specify multiple order-by clauses.
This function also as its use when it comes to pagination of data. Take a look at the query below.

SELECT *
FROM (SELECT ROW_NUMBER() OVER(ORDER BY score DESC, StundentName) AS rownum,
StudentName, Score
FROM Students) AS D
WHERE rownum BETWEEN 4 AND 6
ORDER BY score DESC, StudentName.

This query fetches the rows between 4 to 6.

You can find more about ranking functions here.

Wednesday, March 26, 2008

IIS 7 admin pack

One of the core features of IIS 7 is that developers can write .Net modules and plug it in and extend the web server’s functionalities.

This also meant the MS can release future pack to easily extend IIS features.

And last week MS released a technical preview for the IIS 7 admin module; this includes some cool features that web developers can benefit. Some of the new features include:

1)       Built in report visualization of IIS log reporting.

2)       A configuration editor that provides control over editing configuration files (web.config).

3)       Built-in SQL Server database management, including the ability to create, delete, and edit tables and indexes, create/edit SPROCs and execute custom queries - which means you can use the module to remotely manage your hosted applications

4)       And more…

Monday, March 24, 2008

Wrestle Mania 24

My favorite sport is wrestling, and really I don’t care if it’s real or not…as long as I enjoy it. Just like the world cup in cricket, in WWE it’s Wrestle Mania, and this time the event is taking place on the 30th of this month.

There is going to be some real matches this time and some of the ones that I will not try to miss are:

Batista vs Umaga

Edge vs The Undertaker for the World Heavy Weight Championship

John Cena vs Triple H vs Randy Orton for the WWE Championship

You can find more information on WWE

Wednesday, March 19, 2008

Tech-talk on LINQ

I presented a Tech-talk to my fellow Virtusan’s on LINQ last Monday. Around 25 people came in and in no time the place was turned it to a question base. Well, fortunately I was prepared and it was great answering those questions. Some of the areas I covered were on query expression, LINQ to objects and LINQ to SQL. The presentation was planned for 1 hour but it took an additional 20 minutes for me to finish but still there was something more for me to tell them.

Today I got the rating and the comments from the people who attended and it was 4.25 out of 5, not bad for the first Tech-talk. Anyway most of the comments indicated that they wanted to learn more about LINQ and at the end of the day I was happy that I was able to do something that other people really like.

 

Friday, March 14, 2008

Weekend at Ahungalla

This weekend the the whole account here at Virtusa are leaving for "Heritance" at Ahungalla to take a day off from the "busy" work life. It seems that there is going to be a quiet a lot of fun planned.
However I will not be able to join them, as I got a family function to attend to...ye ..bad luck.
Last time we went on our quartely project trip, it was fun though...thought of posting a pic out of that trip. Belive me I was not drinking !!!



Thursday, March 13, 2008

One-to-Many mapping in LINQ

Thought of posting about how you can map a simple one-many reletionship in LINQ.
Lets take for an example the relationship between a country and its cities, which is one to many, one country can have many cities, If I define a class called Country and City and then ofcourse two table called Country and City,
I can map the reletionship in a simple way that looks like this

[Table]
class Country
{
[Column(IsPrimaryKey=true)]
public int CountryId{get; set;}

[Colum]
public string CountryName{get; set;}

[Association(OtherKey="CountryId")]
public EnitySet Cities{get; set;}
}

I guess the example explains it all. The Association attribute on the cities property actually
iniitiates this reletionship and you can see the return type is a EntitySet of type City.
The OtherKey property of the Association attribute is used to provide the property name on the
City class which should be comapred with the CountryId in the Country class.
The names of all the names of types in the class above exactly map to the names in the database i.e
there is a Country table and a CountryId column in the table.
Make sure to set the IsPrimaryKey=true to the correct field.

Tuesday, March 11, 2008

Automatic Properties

I was writing a piece of test code in VS2008 and the prop code snippet want just generate the private field, did some goggling around and found this out.
Well, you may remember in the days of VS2003 when you had to write your private fields and then write the property getter and setter for it, that was cumbersome, I remember when it became to hard for me to write all these properties and I had to write a tool to generate the properties (not a very cool tool though). What’s worse some properties only set the passed parameter into the private field and return it in the getter, like this

private string studenName_;

public string StudentName

{

get {return studentName_;}

set {studentName_ = value;}

}

In .Net 3.5 , through a feature called Automatic properties you can write the above code as

public string StudentName { get; set; } and

at compile time the compiler will emite code to construct a privet field.

Pre-Allocated

Not much of work these days, the truth is there is no work at all. I already blogged about the project I am currently allocated being closed off at the end of March, however, I am “sort” of pre-allocated to another project again from the same client I was working on earlier Surprisingly, the project is called “Sorcerer”.

This one is a bit on the domain and there seems to be new modules coming in for development, but again this is again on .NET 1.1, but I agreed on it for the only reason that I can’t still figure out.

Anyway, this is supposed to be going on until July or August, but I doubt it…

And again I am preparing for a tech-talk that I am going to present on LINQ next week, so I am a bit hooked up on the presentations and some more reading on LINQ. So for the moment I have run out of work but I guess they are not planning to keep me in this state for long.

Tuesday, March 4, 2008

LINQ to SQL

This is an abstract of LINQ to SQL; this provides a better way to linq your entites class to the database tables. For example lets say you have

a table called “tbl_customer” with fields “customer_name” and “customer_id”, you would map your entity class “Customer” as follows

[Table(Name=”tbl_customer”)]

public class Customer

{

[Column(Name=”customer_id”)] public int CustomerId;

[Column(Name=”customer_name”)] public string CustomerName

}

You can query you database by making use of the DataContext class, like this…

DataContext db = new DataContext(databaseConnectinString);

Table<Customer> customers = db.GetTable<Customer>();

var query = from cust in customers

where cust.CustomerId = 12

select cust;

Simple right?

This is a simple snippet of what you can do, but LINQ to SQl provides more flexibility, like sql type conversions, complied queries etc.

Some of you would not like the mapping that done in code…I don’t either, you can use xml mapping files to do this mapping. I will post something on this soon.

Thursday, February 28, 2008

Project closure...End of March

It’s another month to go !. Ye, I am talking about my project; I was working on the security, task scheduling and logging component of an ETL application. It’s been 1+ years since I started on this project, it’s based on a J2ee backend, and .Net 1.1 front end.

At first I did not like the project as it was being developed in .Net 1.1, but as it went on I learnt many things especially on designing, globalization techniques and most off all managing customer communication.

I was also exposed to working with several teams (as we were handling the common service), and this proved to be very challenging and useful when it came to different viewpoint and opinions.

I did not learn any new technologies in this project but I did learn most of the things that I might be able to carry forward in other projects in the future.

Yesterday, the clients officially announced that project is getting closed down, and probably it would stay until the end of March.

Well, I know what I am going to really miss when this is all over, coming late to work…

Monday, February 25, 2008

ASP.NET MVC Framework

ASP.NET MVC Framework is another extension that has been added to .net 3.5, this framework allows developers to create ASP.NET projects using the MVC pattern (of course as the name suggests!).I took a look at it and it seems pretty easy to use. You can learn more about it here.


Just to give an idea about how easy controllers can be implemented, take a look at the code below...
public class CustomerController : Controller
{
[ControllerAction]
public void ListCustomers()
{
}
}

The CustomerController class extends the base class System.Web.MVC.Controller, this base class does most of the job.
For an example, when a request comes in the form www.mainsite.com/Customers/ListCustomers, the framwork automatically calls the above method , cool ne?

Friday, February 22, 2008

Extension methods and Lambda expressions

Maybe it’s a bit late for me to post about .Net 3.5 + VS 2008, but that’s what I am exactly doing these days.
My first interest in the language was on Lambda expressions and extension methods and then LINQ.
I have learnt quite some stuff about LINQ, meaning the basic, but still did not have a time to try out LINQ to SQL, maybe I will, in the coming week.

Just to give you an idea about Lambda expressions, this is an evolution of anonymous methods in .Net 2.0 and this comes in handy when using LINQ. You can read more about Lambda function here.
Extension methods are really cool stuff, this allow you to add new methods to the public contract of an existing CLR type, without having to sub-class it or recompile the original type. So for an example you can write a extension method like Print() and add it to the string class and you can use is it like this.

String str = “Say Hello World”;
str,Print();
You can read more about Extension methods here.

Another thing that I tried out was the object Initialize feature, this allows you to set field values when creating objects.Note that the actual field initialization occurs after calling the default ctor. For an example I can do this ...
Student stu = new Student{FirstName = "Nairooz", LastName = "NIlafdeen"};
you can read more about this here

Wednesday, February 20, 2008

LINQ

LINQ, Language Integrated Query is a new feature in .Net 3.5. Tradiationally, a programmer
needs to different query language to query different datasources, for example, data sources like
Sql databases, XML and in-memory objects. This meant the programmer needed to learn
different query languages for each and every technology. There was another problem as well, queries were
written in string form and cannot be validated at complie time.
LINQ tries to address these problems, by giving the programmer a singel query language
for any data source for which providers are available.
The cool thing about LINQ is, it is in-built into the language such as C# and VB.Net and Visual studio provides Intellsense support.
This is a sample query of what LINQ can do:

public void Linq11() {
List products = GetProductList();//Get an ArrayList of products, not from the database

var productInfos =
from p in products
select new {p.ProductName, p.Category, Price = p.UnitPrice};

Console.WriteLine("Product Info:");
foreach (var productInfo in productInfos)
{
Console.WriteLine("{0} is in the category {1} and costs {2} per unit.", productInfo.ProductName, productInfo.Category, productInfo.Price);
}
}

Thursday, February 14, 2008

Being part of an interview

I always wanted to be part of an interview, and today I got the chance. I was given a chance to accompany one of the interviewers at Virtusa. I got a chance to throw some question as well, not very hard once but you know…basically I did not have much questions.

Anyway, kind of liking this, maybe I should do this often.

 

Wednesday, February 13, 2008

Memory leaks in managed code

This was something we ran into in our application used custom GUI components, and well those were rough days…

 

You sometimes hear that a managed language like C# or Java does away with memory leaks, and frees the programmer from having to think about freeing objects from memory. Well this is not especially true for GUI code.

The main reason for this is the use of the Observer pattern. While a good thing in it self, the observer pattern leads to the “Lapsed Listener” anti-pattern. This is when an object A subscribed to an event of object B which is a long living object (for an example a child form subscribing to event in the parent MDI form) goes out of play without unsubscribing to the event on object B (the child form closes but without unsubscribing from the event on the MDI parent).

This would result in object A never being garbage collected until object B is out of business, what’s worse, if object A reference other objects C and D , this will also not get garbage collected as well.

 

This would lead into couple of problems…

1)       Memory usage of the application grows with time.

2)       If the leaked objects includes controls that hold GDI objects (Windows, Pens etc..), eventually you may run out of these.

3)       The unwanted and presumed –dead objects are still capable of receiving events, this may cause crashes.

 

The general solution is to make sure you unsubscribe from parent events in your dispose method (in .Net).

We had to use a tool to monitor memory consumption and then fix them most probably by disposing events and so…The tools we used to monitor memory were Sci-tech Memory profiler and ANTs profiler both of which are not free, but the best tools in the market for this job..

Tuesday, February 12, 2008

SharePoint training

I was having my usual time at home today when I remembered “my god I have a training to catch”…

I had to race into office and finally made it at around 10 AM. The training was on Microsoft SharePoint server, the trainer was Joy Pradeep one of the MVP of Sri Lanka.

The training was good but the first few hours were mostly concentrated on the administration side of SharePoint, I did not get a chance to look into the development section of as I had to attend to another one of those “urgent” tasks.

I remember the same thing happening when I was in a BizTalk training, the first day was great (with some network games on the training lab), and as it turned out be the 2nd day I had to miss it.

Monday, February 11, 2008

ILMerge

Cool tool for .Net, ILMerge. This allows you to merge two assemblies into one target assembly. One most obvious use for this would be when you have two project one written in C# and one in VB.Net, using ILMerge you can combine these assemblies to distribute to your customer as if you have developed it in one project !!!.
span>

Friday, February 8, 2008

Debugging WCF services hosted in IIS 6.0

I have been doing some sample projects in WCF (hosted in IIS 6.0), and today I was trying to debug the service like I have done with web services and ASP.net but with no luck, the break point does not get hit at all !!!, After some goggling found out that direct debugging of projects in the same solution is not possible with WCF.

The work around is to run your client and then attach to the external process aspnet_wp.exe and your break points will hit.

Debugging of WCF services in the same solution will be possible in VS 2008.

Back for good!!!

Ok guys I am back in the mood to blog, I do remember I said this before but this time it’s for the best...I have been having a hard time at work and did not fins sufficient time to send a post.

I have made up mind to take some time of my work to post a message or two at least every week !!!