Tuesday, July 31, 2007

New Toy: Windows PowerShell

Finally, I got my hands on Windows PowerShell. I knew about it before, but was putting it off.... I shouldn't have! There are too many cool things about it, here are two: 1) It is very, very, very, very logical, structured, object oriented. 2) It is integrated with .NET beyond imagination. Full direct access to .NET classes and more. See the screen below where I fetched Nordwind data from MS SQL Server! Check this article to see how to use ADO.NET to work with a database. 3) It is truly extensible. The fun of writing CmdLets is all ahead of me now:-)

AddThis Social Bookmark Button

Sunday, July 29, 2007

Virtual Subversion Appliance, and Ingore Filter for C#

My working with Virtual Subversion appliance has been a breeze. I had problem with network: every time I carried my laptop between two wired and two wireless networks, it used to loss svn server. It was elegantly resolution is to switch VM network adapter settings from Bridged to Host. Now I love it: Fire VMWare Workstation (5 sec), Resume VM (1 sec) yeah, does wake up quickly! Commit changes - I am getting to like Tortoise! Suspend VM, exit VMWare. Done, and the whole svn is gone as if was never present on my computer. In fact it wasn't :-)

To the second point. Working with C# project, I got to filter out the noise when committing changes. Here is my C# ignore list:


Tip: Files work fine if separated by a blankspace. However directories should be delimited with new lines. If you use TortoiseSVN, make sure to use a new line. Click on the image to see closely.

Labels: , ,

AddThis Social Bookmark Button

Monday, July 23, 2007

How to do HttpPost with .NET Web Service?

What kind of Web Service binding does .NET create for you when you use "Add Web Reference"? Right, it is Soap and Soap2, and from the wizard we have no control over it. Note however that Service Help Page does use HTTP POST even if it is not enabled by the underlying . Don’t let this fact confuse you: your auto generated WSDL won’t have the HTTP-POST binding.

So if by some reason I want my my .NET Web Service to use HTTP POST, how would I do it? Read on!

Service Side: tell Web Service to support it and expose it in web.config.

<add name="HttpSoap"/>
<add name="HttpPost"/>
<add name="Documentation"/>
<add name="HttpPostLocalhost"/>
Now your WSDL has the HTTP-POST binding, and can generate HTTP-POST stubs.

Client Side: tell WS client to use it. That means, client proxy should inherit from HttpPostClientProtocol rather then SoapHttpClientProtocol. Add Web Reference doesn’t give a control of what always inserts. Instead, use wsdl /protocol:HttpPost. What I did:
1) Generate another proxy with wsdl (in command line, wsdl /out:ReferenceHttpPost.cs /protocol:HttpPost Service1.wsdl).
2) Add it to my project.
3) Extract interface from Web Reference auto-generated file (reference.cs). Danger! Refresh Reference will kill the change. So I better rename it to something like ReferenceSoap.cs, and update the project to use it.
4) Create a factory that returns either SOAP or HTTP-POST based proxy.
5) Make WS client use the factory to get a desired proxy.

Tip 1. The proxy generated by wsdl will have URL hardcoded in a constructor, while the Web Reference one knows to use the URL from config file. Copy-paste constructor code from Web Reference generated so that they are the same. Something like
public Service1() {
this.Url = global::WinClient.Properties.Settings.Default.

Tip 2. If running wsdl /protocol:HttpPost generates Warning: no class generated, it simply means wsdl misses POST binding. See Service Side.


AddThis Social Bookmark Button

Sunday, July 08, 2007

Virtual Subversion for Small Software Project?

Virtual appliance idea is lovely.

You are a .NET developer, starting a small software project. It comes along, and you feel it is time for source control. You want to use Subversion because friends say it is cool and fancy. But installing and configuring subversion is a mess and a pain. You are reluctant, if you never did it. And intimidated, if you have already tried.

The answer is Virtual Appliances. Look how lovely:

I download a virtual appliance with subversion installed and preconfigured. Power up a Virtual machine; with couple of touches my subversion server is up and running. No mess on my laptop. No dusty ubuntu box in the corner. No installing Apache, no configuring subversion. All is prepared and packaged professionally. I bring up the VM when you need it, and where you need it. In the morning, check out, in the evening, check in. The rest of the day it can sleep as a file on my pocket USB hard drive. As the team grows we will run it 24/7 on the network server. Sounds ideal for a small mobile team.

Reality check.

Googling "subversion virtual appliance" brings up JumpBox and Young Technologies. I go for Young[*]. Download VM: 15 min at 180Kb/s. Unzip it: 3 minutes. Fire up VMWare Workstation (VMWare Player or VMWare Server would do just fine). Open VM, boot it up. From my host machine, go http://srvsvc. Hey it works!

As the Youge Tech VM has ssh daemon on, I switched to using Putty. It is convenient: doesn't lock the mouse cursor as VM console, and works faster.

Following the instructions, I created repository, and exposed it with WebSVN.

Figuring out the versions of installed software took another half hour. Yeah, I am slow on Unix. Subversion 1.3.1, Apache 2.0.55. Why should one care about Apache? I don't quite like TortoiseSVN with all that integration to Windows Explorer. And subversion windows clients are different binaries for Apache 2.0 and 2.2. While installing CollabNET my laptop crashed badly. Finally I settled with TortoiseSVN.

Bridged network is a bit funky when I switch from wire to wires and back. No more walking to the balcony and to the office and back.

Another glimpse: I can connect to Samba \\svnsrv\Public share from remote Win200, but can't do it from the host WinXP machine.

The rest of the day was headache with setting up authorization for subversion repositories. I kept on getting "Authorization failed". Before I forgot, here is how it should look to work. Go to /var/svnroot/myrepo/conf . There are three files there. Edit passwd and svnserve.conf. Don't touch authz unless you know what you're doing.

sudo vi passwd


sudo vi svnserve.conf

anon-access = none
anon-access = write
#For simplicity, forget about it
#authz-db = authz

realm = MyRep

You say "man it is subversion trivia, it is all in the book, you have to know it to use Subversion". Yes, but it defeats the whole point. A virtual appliance should be appliance! Preferably made in Japan, so that I just power it up and get back to playing with my project.

The biggest disappointment came at the end: I can't run the VM from USB Hard drive! Urrrr! And why? Cause the damn virtual hard drive was configured to be a single file! Wrong: should have been 2GB chunks. Worst part, it can't be changed.

Virtual appliance idea is lovely. Young Tech Subversion implementation is close, but not close enough. Should I have gone for JumpBox?

Results: summer Sunday spent, subversion running, play project checked in, blog post done.

[*]>Why Young Technologies? No particular reason except JumpBox VM also has Track on board, which I didn't care or want at the moment.

See also:
Virtual Subversion Appliance, and Ingore Filter for C#
Further Development of Virtual Subversion applience at "Dmitri on Virtualization"


AddThis Social Bookmark Button

Thursday, July 05, 2007

Hiring a Software Tester

Hiring is always a challenge. Hiring a software tester is a new challenge to me. For those who share the interest, here is an influentional reading from Cem Kaner:
"RECRUITING SOFTWARE TESTERS". Make yourself comfortable and take a coffee. It is 55 pages of deep thoughts on all aspects of hiring, well applicable to any knowledge worker.

PS. As you smart readers have already guessed: we are hiring a Software Tester at Opalis. Pass the word, drop a line at dzimine at opalis.com

AddThis Social Bookmark Button