Monday, April 20, 2009

Doing it right

I’m a software developer. From time to time, I come to the question why it is good to be a developer? Why is it good to write software?

I don’t have the ultimate answer yet, but I already have a few: making someone's work easier; to able to get out more value from the things we know; because it is a joy for me; because I can teach other developers to find this joy; or simply because it provides a reasonable good salary. (I always pick the one that fits best to my mood, but honestly I can also argue with each of them.)

I’m not working on software that saves lives directly, and there was a time when I was very sad about that. But then I have realized that the world is full of people that also don’t do that, still you can be very happy that they do what they are doing. (Now I cut the long list of examples, because I tend to be too sentimental.) The point is that you are happy with them because they do their job right.

Today I have found the website of the TED community. TED stands for Technology, Entertainment, Design, and it is a community (and a yearly conference) where people try to bring these concepts together and make something remarkable. It is innovative, but not necessarily technology-wise. And very-very inspiring. The best talks from the conferences are also available on-line, so you should better look at them. They are all relatively short (the allowed time for a speech is 18 minutes).

Why does this come here? Because sometimes you have to step back and look at things from a broader perspective in order to step further or gather new ideas. Here are some:

Matthew Childs: Hang in there! 9 life lessons from rock climbing

You will start listening to this as it would be about rock climbing, but you’ll soon realize that this is also about you (and for example software development). (04:48)

Scott McCloud: Understanding comics

As you’ve guessed this is also about more than comics. It is about vision and about finding ways to understand things (take it apart and put it together). About how technology and art can cooperate with each-other. (In this sense, it can be also helpful for software usability.) And last but not least to show how to make a memorable presentation. (17:08)

In McCloud’s talk, there is an interesting list of rules which I have to think of:

  • Learn from everyone
  • Follow no one
  • Watch for patterns
  • Work like hell

I have learned a lot today.

Wednesday, March 18, 2009

Scripting database including data in SQL Server 2008 Management Studio

I was always missing a function in the management studio of the different SQL Server versions. This was to generate a script from an existing database, that also contains the INSERT statements for the existing data in the tables.

Today I have found out, that there is already such a feature in the Management Studio of SQL 2008, although it is not so easy to find it.

Actually it is very simple. You only have to use the “Generate Scripts” wizard, and on the options step, you have to enable the “Script Data” option somewhere at the end of that long list.

wizard options

Sunday, January 18, 2009

Enable WCF hosing in IIS 7

As I was playing with WCF services on Windows 7, I had to set up IIS to host a WCF service. It turned out that it is not as straightforward as I expected. Here is a small summary about the steps that you have to do. (I have found a post of Pandurang Nayak that describes these steps, but that article is not available currently, only through Live Search cache).

  1. Don’t forget to install IIS… :) Yes, it took me some time to realize that it is not installed by default.
  2. When you install IIS (Contol Panel / Programs / Turn Windows features on or off), the sub-components selected by default are not enough. You need at least the Windows authentication, the IIS 6 Management Compatibility (for Visual Studio) and probably some more, but I gave up playing with the sub-components and finally selected all.
    Don’t forget to restart your machine. Although you are not asked to do that, for me it did not work.
    image
  3. Still in the “Turn Windows features on or off” dialog, you have to enable sub components of .NET 3.5: WCF HTTP and Non-HTTP Activation. (Did you know that you can do such things here?)
    image
  4. As I have installed IIS after installing Visual Studio 2008, I had to register the ASP.NET components for IIS by executing C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe –i
  5. Finally you have to register WCF as well for IIS (to understand the .svc extension for example). You can do it by executing C:\Windows\Microsoft.NET\Framework\v3.0\Windows Communication Foundation\ServiceModelReg.exe –i

If you have followed these steps (plus maybe a few more restart) you will be able to host WCF services on IIS 7.

Visual Studio 2008 can help you to configure and debug the virtual directory for you, but for this feature you have to run Visual Studio as administrator.

image

But fortunately there is an informative error message if you forget to do so.

image

Thursday, January 15, 2009

Windows 7 and developing WCF applications

Yes, I know that this is weird, but I have installed Windows 7 to my development notebook to see how it survives. (Ok, I have a backup XP as well on the machine.)

Generally it works very well, I have not found any major problem with Windows 7, and it seems that the stability has been improved a lot since the pre-beta.

The only problem I have encountered so far is with WCF service applications. If I create a WCF service and host it on the ASP.NET Development server, then all of the WCF requests return an HTTP error:

The remote server returned an unexpected response: (400) Bad Request.

WCF Test Client error dialog

This can even be reproduced with the simplest WCF service that is created for example with the “WCF Service Application” project template.

It is also interesting that the service serves the WSDL request well, it just produces the error when you call a service method. With IIS (after I was able to set it up) the service worked fine.

I have no idea currently what can cause this behavior, but it can be reproduced on other Windows 7 machines as well.

Update: It's a known security-related issue with Cassini in Windows 7 beta build 7000 and will be fixed in next release. (see http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/123f0d20-a018-48b0-ab92-4aae749f2d5e/)

Thanks to Johan for the update (http://weblogs.asp.net/jdanforth/archive/2009/03/14/bad-request-with-wcf-service-in-cassini-on-windows-7-beta.aspx).

Tuesday, January 13, 2009

OracleClient problem in .NET 2.0 SP2 (comes with VS2008 SP1)

As mentioned in a lot of sources, Visual Studio 2008 SP1, in spite of its name, also contains service packs for the .NET core components. Namely:

  • .NET 2.0 SP2
  • .NET 3.0 SP2
  • .NET 3.5 SP1

Unfortunately there is not too much information available what these components contain, but it seems that they may seriously affect applications that were running perfectly before.

It seems for example that .NET 2.0 SP2 contains a change in the System.Data.OracleClient assembly that may break applications using an Oracle database.

The most visible result of the issue is that LOB handling fails with the exception:

Modifying a LOB requires that the connection be transacted.

Although this issue causes breaks in applications, there are even more dangerous effects of the bug. The transactions may automatically switch “Auto-commit” mode that can produce inconsistent and corrupt data in the database even without any visible error. More details here.

In December, Microsoft released an update to the .NET Framework service packs: KB959209

Funnily, Microsoft has not stopped confusing developers with the updates. Although the title of the update is “Microsoft .NET Framework 3.5 Family Update”, it contains updates for .NET 2.0 SP2, .NET 3.0 SP2 and .NET 3.5 SP1. You can install these updates individually. (To resolve the Oracle issue, it is enough to install the fix for .NET 2.0 SP2.)

Update: It seems that the update can be installed only to English .NET frameworks. Other language versions (e.g. German) can be also found at Microsoft Download Center (although it is not so easy). Here are the most common download links for German .NET frameworks:

Wednesday, January 7, 2009

WCF Security Guidance

Probably it is well known, but I've only found it now:

patterns & practices: WCF Security Guidance Project

It is a complete book about WCF security on-line (you can download it or just browse through it). With its scenario-based approach and the practical samples and "how-to" chapters it seems to be very useful.

Tuesday, December 16, 2008

Visual Studio 2010 - Historical Debugger

I've played a little bit with Visual Studio 2010, trying out the automated web UI tests, but I have found a feature that became quickly my favorite from the VS20010 feature list. This is the historical debugger.

The idea is easy: the IDE collects and stores information about the debugged application (important events, called methods, parameters, (handled) exceptions, etc.) that allows you later to jump back in time, and check what happened before you have actually run into a problem that you want to fix. You can walk through the execution steps and review when the things went wrong. (The experience is a little bit similar like the call stack window, but here you are not constrained to the callers and you can get much more information about the executed methods.)

Of course nothing is for free, the application will be slower with this historical debugger, but MS addressed this problem, and you can fine-tune the information to be collected (or even switch it off), and you can also limit the size of the collected data (it always keeps the last part of it, so when you break the execution the information that is relevant to the experienced problem will be most likely still available).

You can see a nice screencast about this new feature by Habib Heydarian and also some screenshots from Pavel Nikolov.