Sunday, December 09, 2007

MSBuild Exec Task fail if we have any space in the command

To execute an external application using MSBuild, I use the built in Exec task. A problem we all face is spaces in command line we execute. and this makes MSBuild unhappy , the task will fail.

To correct that, we should surround the command path and any paramters with quotation, a trick from old DOS days, but this also will not work as MSBuild is an XML file and " is reserved for attributes.

The trick here is to use the " in MSBuild scripts whenever you need a " , this makes your script really ugly, here I found another guy who rasie the issue to an upper level.


My prefered way to do that is to have the external application and each parameter in a separate property; just to make the command line itself more readable.



<Target Name="Run-External-App">
 <Exec Command="$(ToolPath) $(Param1) $(Param1)"/>


Wednesday, November 21, 2007

Give Your Applications Mapping Capabilities

A couple of articles have been published on devx (thanks to Bruno Zambetti) discussing the development of mapping applications using .NET and Google Earth.

Part 1:

Part 2 :

Wednesday, November 07, 2007

Capture a Screen Shot using C#

Capture an image of the Screen using this C# code

Thanks to James Crowley ( )

Tuesday, October 30, 2007

Thursday, October 25, 2007

Congratulations for all of my colleagues and myself for the promotions
Go Worx Go …

Microsoft UI Automation Library

As part of Windows Vista, Microsoft has released the new GUI automation library available through the .NET Framework 3.0, so it works on Windows Vista, Windows XP and Windows Server® 2003. Moreover, it works seamlessly with both Windows Presentation Foundation UIs and HWND-based applications.

For more information:

Monday, October 22, 2007

Spy ++, # and other Windows Debugging tools

Remember the Spy++ tool shipped with Visual Studio long ago?

I was a fan of this tool, as it tells me the internals of any windows application and the controls that compose its GUI.

Trying to use this tool with .net application will tell you no useful information, because it examines the Win32 structures inside the application which is not the same thing from a .net developer point of view.

A bunch of tools will provide the same features but for .net world, here are some links:


.NET Object Spy and InvokeRemote

Runtime Object Editor


A simple Windows forms properties spy

Managed Spy

Dynamic Event Hooks for Object Debugging

Automate applications using VBScript

I have just discovered a nice feature in Windows Script Host; which is the SendKeys method in the WScript.Shell class.

Using this method to send a stream of key strokes to another application would allow for remote automation or (for example) creating application tutorials.

Cut the following code, paste in a text file and give it .vbs extension, double click the file to run it and watch J


Set WshShell = WScript.CreateObject("WScript.Shell")

WshShell.Run "notepad"

WScript.Sleep 100

WshShell.AppActivate "Untitled - Notepad"

WScript.Sleep 100

WshShell.SendKeys "Hello"

How to set the value of a DataGridView cell programmatically

The new DataGridView control doesn't have a Cells collection, but it has Rows,Columns and a default indexer.

To set the value of a certain cell in the DataGridView, it is easy to use the indexer like this:

dataGridView1[1,1].Value = "New Value";

Or, we can do that using the Rows collection:

Rows[1].Cells[1].Value = "New Value";

For more information about the DataGridView see those links:

A New Grid Control in Windows Forms

Monday, August 20, 2007

Nunit + MSBuild


I wanted to run the test cases for my libraries as a part of building them, so I will make sure every time I have to build the libraries that they are functioning correctly.


Unfortunatly, the built-in tasks will not do that be default; the option here is to call the nunit-console using the


Then doing a simple google search, I found MSBuildCommunityTasks.


MSBuild Community Tasks Project is an open source project for some missing and useful tasks, one of them is the Nunit task.


After I got the installer,I tried to find the documentation and see how to use the Nunit task, but I haven't seen any example on how to use it.


Try and Error; this is the last resort, but I also got some information by looking into the source code of the Nunit task itself to know how to allow the task to find the nunit-console.exe.


I followed the following steps to actually get my Nunit test cases to run during my build.


1 - import the MSBuild.Community.Tasks.Targets files:



2 - Copy the Nunit\bin directory to my source code folder tree under a top level folder; example:







3 - Created a property in the Msbuild script to hold the relative path to nunit binaries







4 - My library and its tests are part of the same solution, so the MSBuild task <<MSBuild> will build the library and the tests at the sametime.






5 - Then come the play with Nunit task to actually run the test cases:








Notice that:

I had to set the DisableShadowCopy="true" to run the tests in their original location and instruct nunit-console not to make a copy in a temp folder


6 - I liked to organize a little bit, so I have created 2 targets; one for the build and one for the test, then a single target to call them both; which makes my build script looks like this:






<Project xmlns="" DefaultTargets="BuildAll" >


<Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets"/>








<Target Name="BuildAll" DependsOnTargets="MyLibrary;MyLibrary-Test">



<Target Name="MyLibrary">

<MSBuild Projects="MyLibrary.sln" Targets="Build" />




<Target Name="MyLibrary-Test">












Monday, August 13, 2007

ITWorx wins Microsoft's 2007 Partner of the Year Award

ITWorx , one of the largest software professional services firms in the region, and Microsoft Gold Certified Partner, has received yet another award to add to its portfolio, winning '2007 Microsoft Custom Development Solutions Partner of the Year, Web Development', at the Microsoft Worldwide Partner Conference on July 11th in Denver, Colorado.

More info:

Go Worx Go

Thursday, June 07, 2007

Microsoft Plans Visual Studio Shell

Visual Studio Shell, a scaled-down version of Visual Studio, it is intended to allow developers to build Visual Studio functionality atop their own vertical tools, as well as integrating various languages such as Fortran, Cobol, Ruby and PHP.

Developers will be able to use Visual Studio Shell in two modes: integrated and isolated. The integrated mode is built upon Microsoft's existing Visual Studio Premier Partner Edition 2005, primarily used by language integrators.

The isolated option allows partners and developers to build products on top of Visual Studio, with the ability to customize the experience so that it doesn't necessarily look like Visual Studio
for more information visit Visual Studio Extensibility , and Craig Skibo's WebLog

Sunday, May 13, 2007

SQL Compact Edition Resources

SQL Compact Edition is an embedded database designed to work on multiple devices (from PDAs to Desktops), it is the successor of SQL Mobile and SQL CE products originally targeting mobile devices only

The following links is a collection of videos from Channel 9, and Steve Lasker blogs about this product.

'SQL Everywhere Edition' - What. How. Why.

Deployment Options for SQL Server Everywhere Programming options for SQL Server Everywhere

Video of installing the SQL Server Everywhere Edition CTP

Demo Videos of SQL Mobile / SQL Server Everywhere Edition

Bill Vaughn on Microsoft SQL Server 2005 Compact Edition

Thursday, May 10, 2007

Busy or Lazy


I haven’t blogged since a while, this is not laziness (believe me!), but a bit busy.

Nowadays, I am investigating in different .net technologies at once, and fixing issues in other applications, while being blessed with a new baby girl that sometimes steel the sleep of my eyes J

On the technology side; I am investigating SQL Compact Edition, .net Cryptography and a little bit around Data Patterns, learning some new skills like debugging/troubleshooting production issues using WinDbg and Memory dumps.

As soon as I have time, I will post links and resources here … so keep tuned.

Sunday, April 08, 2007

DotNetNuke 4.5 Released


DotNetNuke (the free open source web portal framework) releases its 4.5 version, the new version is featureing a web based installer ,integrated AJAX support , a new Solution Explorerand , inline editing , editing the DNN Profile properties , and other more features.

Enjoy thenew icons for Admin menus :)

Wednesday, April 04, 2007

ORA-14450: attempt to access a transactional temp table already in use

I got this Oracle Error while executing an Alter Table Drop Column statement, because the table is still in use, the Drop column will not continue, I had to wait until all sessions for my schema disconnect.

The sessions can be shown in Oracle Enterprise Manager, if you are in a development environment or you have enough authority ... you can Kill the active sessions :),295199,sid63_gci1223614,00.html

Sunday, March 18, 2007

7 Habits of Highly Effective ...

The famous book 7 Habits of Highly Effective People by Stephen Covey has inspired many other people to author similar articles, I have collected some articles hope that I will have time to read them later.


7 Habits of Highly Effective Programmers

5 Habits of Highly Effective Software Developers

7 Habits of Highly Effective Technology Leaders

7 Habits of Highly Effective Web Apps

7 Habits of Highly Effective DBAs

6 Habits of Highly Effective CIOs

7 Habits of Highly Effective Information Security Leaders

7 Habits of Highly Effective Bloggers

11 Habits of Highly Effective Geeks

The Seven Habits of Highly Effective BizTalkers

7 Habits For Highly Effective Mind Power

Seven habits of highly effective writers

Seven qualities of highly effective technology trainers

Tuesday, March 13, 2007

Troubleshooting Draco.NET

Draco.NET is a Windows service application designed to facilitate continuous integration. Draco.NET monitors your source code repository, automatically rebuilds your project when changes are detected and then emails you the build result along with a list of changes since the last build.

While using Draco, you would need to know what is going on, what is worng and you will face issues that you need to figure out if the service is running correctly or not ... if this is the case with you; then this post is for you ...

Check Draco log

Draco is a windows service, and has no user interface by default, but Draco logs all the activities in its log file draco.log.

If you are not a fan of log files and want to see what is going on in real time, then keep reading.

Use DebugView to see the status in Draco in realtime

Download DebugView and run it on the Draco machine, then add the Default listener to Draco.exe.config

Then enjoy the monitoring J

Adjust the Periods of polling and waiting

Draco will poll VSS to check for modifications, if it find any; waits another period called the quite period to give the chance for some one checking-in files to finish. Practically the default periods may not be perfect, it worth increasing them.

Draco failed to start … what is wrong

If Draco service failed to start and then you may or may not get a message box like this

Check the EventViewer for an event log that belongs to Draco, the complete error message is there for you to figure out what is wronge.


That’s it for now, if I learned more I will share it soon.

Tuesday, March 06, 2007

Migrate to .net 2.0

[In Progress]

I know that I should be talking about migration to .net 3.0, but as I havn't do this ... let us help folks whom still in 0.1 and 1.1 to get to 2.0

Migration to .net 2.0 form my point of view is not only to hjave your solutions/projects compile well on the VS2005 and the new framework, it is really to migrate to new features and benfites of 2.0 which I will take about in this post.


New Features (that you should kill your self for not doing them)

  1. Generics
    belive me, I have cut down lots and lots of code from a large VS2003/.net 1.1 application ( about 10 projects in 5 solutions) after migrating all my Type Safe collections to Generics collections and Generics methods
  2. MSBuild
    MSBuild is native in .net 2.0, you don't need NAnt ... MSBuild can deal with VS2005 projets and solutions directly and lots of features which worth another post
  3. Test Classes
    Now; VS2005 will help you test your code;either in Test first approach or code first approach ... do you have NUnit tests? ok;convert them using this tool
  4. Desktop Applications
    1. ToolStrips please
      Go to the office 2003 look and feel quickly with ToolStrips and MenuStrips, if you have been using ToolBars for a long time and fear of breaking your code, then follow this step by step guide to [Replace] toolbars with toolstrips
  5. Web Application
    1. Convert your VS2003 web projects to VS2005 using this tutorial ()
    2. Consider the ObjectDataSource

Tuesday, February 13, 2007

Release notes … Completed Successfully



  • You are using Visual Source Safe as a source code repository.
  • Multiple developers in the team, each of them have a set of features/bugs to work on.
  • You have more than one source code repository; for example a development and production.
  • For configuration management purpose; it is required a release notes document for each developer to list the files added/modified/deleted in the source code.


· Release notes is an error prone task, developers always forget to list some files or take long time to prepare the release notes

· You end up with wasted time for unreliable documents with missing information.



Automate the release notes creation and let developers focus on coding and debugging, let them live in Visual Studio not in MS Word or Excel

  1. Assign feature/bug set for a developer.
  2. The developer shall start by getting the latest version of the source code stored in the source code repository.
  3. The developer will create a label on VSS before making any modification on any files, for example (Dev-X-YYMMDD-0).
  4. The developer will check-out files, work on his local machine and no files shall be checked-in until he finish all the assigned tasks.
  5. We are not talking about a process, so skip talking about how to make a code review or Check-in polices and so on …
  6. The developer should check-in all the affected files, should add useful information in the check-in comment; for example Feature No. or Bug ID.
  7. Then creates a new label like(Dev-X-YYMMDD-1).
  8. Use VssReporter to get the list of modifications between the two labels [Screen Shot will be here]
  9. Export the list as CSV or XML.

Finally, you have the list of modifications occurred, the CSV file can be used directly from MS Excel or use the XML file to make further reporting like the following ideas:

    • Create an XSLT to produce a fancy report with grouping on the Application/Module level or Solution/Project level.
    • Create an XSLT to produce a batch or script that will pull the affected files into a new folder with the same folder structure to create a Delta package.
    • Create XSLT for any other thing in your mind, you have and XML file that has all the affected files with attributes like when/what and whom.

Credits goes to my colleagues Tarek and Zidan, where we spent nights merging code of 7 developers from 2 sites. We came up with this approach to reduce time in release notes preparation and focus on development.

Sunday, February 11, 2007

Reading Exchange Public Calendar folder using WebDAV

WebDAV is the only choice you have to programmatically access an Exchange Server 2000/2003 public calendar folder, either to read or write.

I ave read about web services support in Exchange 2007, but not yet tested that.

Marc has a great post showing how to access a calendar folder using C# Using .NET and WebDAV to access an Exchange server

Using WebDAV is not easy, you have to compose the proper formatted XML request and then wait to the response and parse it to get the results, when you need to query using dates; which is the case for Calendars you have to use a special format inside the XML request.

I have used a WebDAV wrapper library which was great in hiding those details; it offers wrapping classes like Calendar and Contact with properties and method which carries all the XML stuff for you; the library has samples in both and C#.

There is one free wrapper; which I didn't use myself ... but the library seems to be updated regularly (

The only drawback of using WebDAV is requirement of a new HTTP connection for each request.

When a large number of requests is required (like doing a request for each appointment in a personal calendar folder) you simply exceed the number of outgoing HTTP requests that a server can handle, using .net we get a WebException in this situation because an HTTP request object can't been created.

Monday, January 29, 2007

Get up to speed with AJAX

Microsoft has published the release version of ASP.NET AJAX Extensions 1.0.

To get up to speed; download and view this following 2 videos:



You will learn what to download and from where, how to install and how to start your first AJAX based website

Friday, January 26, 2007

Clone a DNN instance

I have run across this useful tip, if you have a production DotNetNuke installation, and you want to take it offline for testing or development; then you shall follow some steps to  get it working on localhost after it was configured for production.

Enjoy []

Tuesday, January 16, 2007

ORA-28009: connection to sys should be as sysdba or sysoper

I got a strange thing here, using SQL Plus as SysDBA is some what different than IMP.

To specify the connection string; you need the following format: username/password@instance as SYSDBA.

For SQL Plus:

This should be wrapped by double quotes "username/password@instance as SYSDBA"

For IMP:

This should be wrapped by single quotes 'username/password@instanceas SYSDBA' ; double quotes will not work.

Wired !

Thursday, January 11, 2007

The Code Room [Episode #3: Security]

Are you ready?

Get your laptop, sharpen your mind, show up your skills, team with geeks and start the challenge

This is the theme of Code Room, another interesting show from Microsoft.

The latest show really rocks, 2 teams; the bad guys trying to hack a web application, and the good guys trying to get them down.

Learning SQL injection, session hijacking , threat analysis basics needs hours of reading and trials, but with this episode of Code Room, those stuff will flow into your mind smoothly and finally you get a good introduction about securing web applications in an interesting way.