Thursday, January 10, 2008
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.
<Project>
<PropertyGroup>
<ToolPath>"my-external-application.exe"</ToolPath>
<Param1>"my-param-value"</Param1>
<Param2>"my-param-value"</Param2>
</PropertyGroup>
<Target Name="Run-External-App">
<Exec Command="$(ToolPath) $(Param1) $(Param1)"/>
</Target>
</Project>
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.
Wednesday, November 07, 2007
Capture a Screen Shot using C#
Capture an image of the Screen using this C# code http://www.developerfusion.co.uk/show/4630/
Thanks to James Crowley (http://www.jamescrowley.co.uk/ )
Tuesday, October 30, 2007
MessageBox replacements for Window Forms
Unhappy with the MessageBox.Show? Then take a look on the following components:
MsgBoxGo
http://windowsclient.net/downloads/folders/controlgallery/entry1605.aspx
InformationBox
http://www.codeplex.com/InfoBox
MessageBoxExLib
http://www.codeproject.com/cs/miscctrl/MessageBoxEx.asp
Message Dialog
Thursday, October 25, 2007
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:
http://msdn2.microsoft.com/en-us/library/ms747327.aspx
http://msdn.microsoft.com/msdnmag/issues/07/03/Bugslayer/default.aspx
http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=352&SiteID=1
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
http://www.codeproject.com/csharp/RuntimeObjectEditor.asp
http://www.acorns.com.au/Projects/Hawkeye/
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
http://www.windowsclient.net/Samples/Go%20To%20Market/DataGridView/DataGridView%20FAQ.doc
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:
<Import
Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets"/>
2 - Copy the Nunit\bin directory to my source code folder tree under a top level folder; example:
\My-Source-Code
+--\Tools
+--\Nunit
+--\MyLibrary
3 - Created a property in the Msbuild script to hold the relative path to nunit binaries
<PropertyGroup>
<NUnit-ToolPath>.\Tools\NUnit</NUnit-ToolPath>
</PropertyGroup>
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.
<MSBuild
Projects="MyLibraryWithTests.sln"
Targets="Build"
/>
5 - Then come the play with Nunit task to actually run the test cases:
<NUnit
Assemblies=".\bin\Debug\MyLibrary.Tests.exe"
ToolPath="$(NUnit-ToolPath)"
DisableShadowCopy="true"
/>
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="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="BuildAll" >
<Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets"/>
<!--ToolsSettings-->
<PropertyGroup>
<NUnit-ToolPath>..\Tools\NUnit</NUnit-ToolPath>
</PropertyGroup>
<Target Name="BuildAll" DependsOnTargets="MyLibrary;MyLibrary-Test">
</Target>
<Target Name="MyLibrary">
<MSBuild Projects="MyLibrary.sln" Targets="Build" />
</Target>
<Target Name="MyLibrary-Test">
<NUnit
Assemblies=".\bin\Debug\MyLibrary-Test.exe"
ToolPath="$(NUnit-ToolPath)"
DisableShadowCopy="true"
/>
</Target>
</Project>
Monday, August 13, 2007
ITWorx wins Microsoft's 2007 Partner of the Year Award
More info:
http://www.microsoft.com/presspass/press/2007/jun07/06-11FinalistPOTYPR.mspx
http://www.itworx.com/News/Press+Releases/ITWorx+Counted+Among+Top+Finalists+for+the+2007+Microsoft+Partner+of+the+Year+Award+in+Custom+Develo.htm
http://www.ameinfo.com/128502.html
Go Worx Go
Thursday, June 07, 2007
Microsoft Plans Visual Studio Shell
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 Studiofor 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.
http://channel9.msdn.com/Showpost.aspx?postid=218346
Deployment Options for SQL Server Everywhere
http://channel9.msdn.com/Showpost.aspx?postid=212855
ADO.net Programming options for SQL Server Everywhere
http://channel9.msdn.com/Showpost.aspx?postid=212857
Video of installing the SQL Server Everywhere Edition CTP
Demo Videos of SQL Mobile / SQL Server Everywhere 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 :)

http://ora-14450.ora-code.com/
http://expertanswercenter.techtarget.com/eac/knowledgebaseAnswer/0,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
http://www.technicat.com/writing/programming.html
5 Habits of Highly Effective Software Developers
http://www.infoq.com/news/five-habits-software-development
7 Habits of Highly Effective Technology Leaders
http://portal.acm.org/citation.cfm?id=1226736.1226737&coll=GUIDE&dl=&idx=J79&part=periodical&WantType=periodical&title=Communications%20of%20the%20ACM&CFID=15151515&CFTOKEN=6184618
7 Habits of Highly Effective Web Apps
http://twopointouch.com/2007/02/21/7-habits-of-highly-effective-web-apps/
7 Habits of Highly Effective DBAs
http://www.dmreview.com/article_sub.cfm?articleId=1062133
6 Habits of Highly Effective CIOs
http://www.cio.com/archive/061503/effective.html
7 Habits of Highly Effective Information Security Leaders
http://blogs.techrepublic.com.com/security/?p=177
7 Habits of Highly Effective Bloggers
http://money.cnn.com/magazines/business2/business2_archive/2006/09/01/8384326/index.htm
11 Habits of Highly Effective Geeks
http://www.bbspot.com/News/2005/02/top_11_habits_highly_effective_geeks.html
The Seven Habits of Highly Effective BizTalkers
http://geekswithblogs.com/asmith/articles/17333.aspx
7 Habits For Highly Effective Mind Power
http://www.increasebrainpower.com/mp8-7-habits.html
Seven habits of highly effective writers
http://ieeexplore.ieee.org/xpl/freeabs_all.jsp?tp=&arnumber=749367&isnumber=16189
Seven qualities of highly effective technology trainers
http://www.doug-johnson.com/dougwri/7habits.html
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 http://www.microsoft.com/technet/sysinternals/Miscellaneous/DebugView.mspx 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)
- 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 - 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 - 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 - Desktop Applications
- 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 - Web Application
- Convert your VS2003 web projects to VS2005 using this tutorial ()
- Consider the ObjectDataSource
