iBATIS.NET the .net port of the iBATIS Java ORM is being used by MySpace.com http://www.infoq.com/news/2006/11/iBATIS-MySpace
Wednesday, December 30, 2009
Thursday, December 24, 2009
[Links] Unit Tests
Top 12 Reasons to Write Unit Tests
http://onjava.com/onjava/2003/04/02/javaxpckbk.html
Six Rules of Unit Testing
http://radio.weblogs.com/0100190/stories/2002/07/25/sixRulesOfUnitTesting.html
Test Review Guidelines
http://www.artofunittesting.com/Test_Review_Guidelines
Advanced Unit Testing
http://www.codeproject.com/KB/cs/autp1.aspx
http://www.codeproject.com/KB/cs/autp2.aspx
http://www.codeproject.com/KB/cs/autp3.aspx
http://www.codeproject.com/KB/cs/autp4.aspx
http://www.codeproject.com/KB/architecture/autp5.aspx
Writing Great Unit Tests: Best and Worst Practices
http://blog.codeville.net/2009/08/24/writing-great-unit-tests-best-and-worst-practises/
IBM InfoSphere Change Data Capture
Enjoy some high level video based talks about CDC:
Maximize Cost Saving while improving visibility into LOB
http://media.sourcemedia.com/sourcemedia/dmr/09/051309ibm/livemeeting.wmv
Closing the loop Real-Time Event Detection and Response
http://media.sourcemedia.com/sourcemedia/dmr/08/093008ibm/livemeeting.wmv
A Leading Jewelry Retailer Improves Customer Service with IBM InfoSphere Change Data Capture
Tuesday, July 28, 2009
Using the free space in one drive to give more space on another
I run into an issue today when I wanted to have something on my C: drive that exceeds the current free space, I have more free space on other drives but I don’t want to go into extending my C: drive by using tools like Partition Magic as I had a bad experience with it before.
I decided to give hard links a try, and after some googling I found that I need to use the junction.exe from Sysinternals because Windows don’t
So, if you need to have a folder on C: drive that points to another folder on D: drive, you just need to call junction like this:
junction C:\MyFolder D:\MyFreeSpace
You will deal with C:\MyFolder as a normal folder, but actually all files will be stored in D:\MyFreeSpace
Sunday, July 05, 2009
Generate (a new) GUID each time you run an MSBuild Script
Sometimes we need to generate a new GUID and use it as part of a build script, for example when building a new version of a Setup project.
MSBuild built-in tasks don’t provide such facility, however there 2 options:
1.MSBuild Community Tasks (Script Task)
The Script task from MSBuild Community Task allows the execution of .net code contained within the task. It will be very simple to call System.Guid.NewGuid() and return the string into an MSBuild Property.
<PropertyGroup>
<GuidGenFunction>
<![CDATA[
public static string ScriptMain() {
return System.Guid.NewGuid().ToString().ToUpper();
}
]]>
</GuidGenFunction>
</PropertyGroup>
<Script Language="C#" Code="$(GuidGenFunction)">
<Output TaskParameter="ReturnValue" PropertyName="NewGuid" />
</Script>
<Message Text="Guid: $(NewGuid)" />
2.Sedodream MSBuild Project (CreateGuid Task)
http://sedodream.codeplex.com/Wiki/View.aspx?title=CreateGuid
Wednesday, February 11, 2009
Automating UI Testing
Automating UI testing is one of topics that I recently became interested in, not because I am trying to be a tester yet; but because we are implementing an automated UI test engine as part of my current development project in ITWorx.
I have to thank Dr. James McCaffrey for authoring his book “.NET Test Automation Recipes: A Problem-Solution Approach”; this book was really the base that get my foot on the road and encouraged me to dig into this mysterious world.
He was as well very helpful when be contacted and asked; guiding his readers into the right direction.
Someone would ask; why did we go into developing our own thing while there are lots of tools to do the same job ? the answer would take more time if I like to describe the business requirements that lead to this decision, but in short we had to make this as part of another application and hence buying a tool was not an option to avoid expensive licensing costs.
Some of the already existing tools that I stumbled upon are:
- HP's QuickTest Pro
- Eggplant
- IBM Rational Robot
I have also written few posts around this topic, they worth checking here
Sunday, November 16, 2008
My programmer personality type is :: PHTC
I came across this programmer personality test http://www.doolwind.com/index.php?page=11 , and below is the results, what about you ?
You're a Planner.
You may be slow, but you'll usually find the best solution. If something's worth doing, it's worth doing right.
You like coding at a High level.
The world is made up of objects and components, you should create your programs in the same way.
You work best in a Team.
A good group is better than the sum of it's parts. The only thing better than a genius programmer is a cohesive group of genius programmers.
You are a Conservative programmer.
The less code you write, the less chance there is of it containing a bug. You write short and to the point code that gets the job done efficiently.
Saturday, September 20, 2008
Monday, July 07, 2008
"Would you please submit a ticket so we can turn on the Virtual machine for you" said the System Engineer
Every body loves virtual machines, aren't you ?
I use virtual machines for development and testing, and they really save time and resources; specially when difference disks are used.
My company has a hosting environment with lost and lost (and may be lost ) of them than I know, and they guys behind those are really doing a good job keeping up with requests to create/modify/host them on Virtual Server(s).
A common thing happens, and it happens often than enough, my VMs goes off, may be the guys need to conserve some resources or spare some RAM for other VMs on the same physical servers.
Anyway, a conversation like this is repeated frequently:
Me : Hi, my VM is not working
System Engineer : Would you please submit a ticket so we can turn on the Virtual machine for you
Me : Can't it be automatically restarted
System Engineer : Oh yes, please mention this in the ticket as well
Me : Okay, thanks
System Engineer : Welcome, waiting for the ticket :)
I do add the ticket, and they do turn it on and set it to auto restart, but after a week every thing goes again.
So, why I am posting this, not to make you feel sad for me, but because I found something that is interesting for this issue; PowerShell.
Yes, PowerShell can be used to turn-on/off VMs on Virtual Server, but I am not yet sure if this can be done remotely, since I will need to turn-on my VM from my PC not from the server that I don't have permission on.
Goggling around, it seems feasible, a post by Ben Armstrong ; author of Professional Microsoft Virtual Server 2005 is about using COM to script Virtual Server , another post {Scripting Virtual Server with PowerShell} by Ben Pearce.
I will try to convince the guys to look at this, and may be someday I will not need to submit a ticket any more.
Sunday, July 06, 2008
Finding distinct nodes via XPath/XSLT 1.0
While XSLT 2.0 has the distinct-values function to get the unique items in a node list, XSLT 1.0 has no equivalent function.
But lots of posts out there is pointing how to use XPath 1.0 to get the same result. The one that was most useful and straight forward for me to apply was the post of Rajendra S Rawat on his blog
Monday, June 30, 2008
Redefine the temp folders
When you install a software, most of the installers will try to extract some files in a temporary folder on the hard drive. The default temporary folder can be accessed by the environment variable TMP or TEMP.
By default, those folders will point to the following folder on your Windows drive (X):\Document and Settings\UserName\Temp , the path may vary according to Windows version.
Sometimes, a huge software installation like Windows Service Packs or Visual Studio Service Packs, will need to extract a (very) large file in the temp folder, and if no enough (here I mean great) free space no installation can take place.
Anyway, keep long story short :) ... to allow your temp folders to go into a new drive, you need to redefine the path associated with the Environment variables:
Go to My Computer , right click Manage, select the Advanced table, click on Environment Variables button, then select the TEMP and TMP variables and point to a new folder , and enjoy large installations on limited free space drives :)
Tuesday, June 10, 2008
PowerShell Seminar @ ITWorx [CuttingEdge-Club]
I will present a seminar at ITWorx CuttingEdge club about PowerShell.
The seminar's presentation :
Monday, June 09, 2008
How to get the Physical Memory size of a remote computer
Using 2 lines of PowerShell to get the Physical memory of a remote computer :
$mem = Get-WmiObject win32_computersystem -computername server-vm-0001
$mem.totalphysicalmemory / 1Gb
This is just an example, and other system information can be retrieved through using the WMI objects, the above script can be easily extended to get the Physical memory (or anything) for all the machines in a whole network.
Tuesday, May 27, 2008
Which Robot kit is suitable for you ?
It seems that robots is no longer a luxury gadget, starting from robo-bugs that one can build from capacitors and resistors found on any old electronic device or radio, to DIY robots and ready to rock robots, the span is very wide.
I found this video from IEEE robotics blogger Mikell Taylor very helpful, she reviews the latest robot kits available in the market.
Monday, April 28, 2008
Batch Processing Word Documents using PowerShell
A friend of mine was organizing a public event, the event has a website and they were asking for registration through a registration webpage or filling a word document and send it by email.
My friend got hundreds of documents on his email, and hence came the problem of processing those documents.
Let us see how we can automate processing those documents using PowerShell.
Firstly, we need to de-attach all the documents from the emails, and save them into a folder. Although this is an interesting thing to accomplish using PowerShell, but my friend had this already done for me using Attachment Extractor <Okay … he was using ThunderBird and this post is not intended for arguing that I will prefer Outlook>
Now, we have all the documents in one folder; or many folders. (We can simply gather them from the whole drive using only 2 lines of PowerShell)
Secondly, let us process all those documents and get all the data out of them into a CSV file ready for Excel, or importing into a database.
1. Getting the folder path and open Word in Hidden mode
$docPath = $args[0]
$all_docs = Get-ChildItem $docPath -filter "*.docx"
$word = New-Object -comobject "Word.Application"
$word.Visible = $False
We are getting the documents folder as a parameter for our script, then we will get all the documents by calling Get-ChildItem and filter that to files with .docx extension, then we created an instance from Word and setting its Visibility to false so we are now working silently.
2. Open each document and list the ContentControls
foreach ( $doc in $all_docs)
{
Write-Host "Processing :" $doc.FullName
$doc = $word.Documents.Open($doc.FullName);
$controls = $doc.ContentControls.Count
Here we are using the foreach cmdlet to enumerate the documents we found in the folder, and then open each of them in Word using the Open method in the Documents collection.
My friend used the Content Controls to restrict users to edit certain fields in the document so he can process the document latter, and this is better than a plain word document to pull your hair trying to develop a parser for it.
Word object model provides a ContentControls collection, which will be holding all the content controls and their properties.
We put a reference to all the content controls in a variable so we can use it afterwards.
3. Create a collection of custom objects holding our data
$item = New-Object System.Object
foreach ( $control in $doc.ContentControls )
{
$item | Add-Member -type NoteProperty -name $control.Title -value $control.Range.Text
}
$all_items += $item
Here we are using the New-Object cmdlet to create a custom object, and using the Add-Member cmdlet to create properties on the fly.
Each property name is the ContentControl’s Title, and the property value equals to the text inside this control. After that we add the new object to a collection
4. Save the collection to a CSV file
$all_items | Export-CSV "Data.CSV"
The PowerShell guys had done a great job here, if we just pipe our collection to the Export-CSV cmdlet, we now has a reflection based enumeration of our objects dumped to the CSV file with an automatic header.
Finally, you got served my friend.
The whole script and sample document can be downloaded here:
To run the script, call it and pass the folder path:
>> ./Process-Documents.ps1 "path-to-the-documents"
It is reminding me with DOS days : Beep Beep Beep Beep
Wednesday, April 16, 2008
How to backup all your documents with 2 lines of PowerShell script
I (and I think all of us) have documents scattered every where in data drive.
Today I wanted to get all the word documents on my D: drive and put them on a shared folder for archiving.
Since I was playing with PowerShell recently, I thought it will be nice to write a script that do that, and the following is what I have written:
| $files = Get-ChildItem -recurse -filter "*.doc*" |
I saved those 2 lines into a file [backup-docs.ps1] and opened PowerShell and navigate to my drive and called this script,and in seconds I found all my documents in the E:\Docs folder ; Thanks to PowerShell
Monday, April 14, 2008
Un-maintainable Code
Paul Stovell (MVP from Australia) had a nice post on his blog; it seems like a fictional dialogue between 2 developers one of them is a new member ask questions to his elder colleague, this dialogue whill light the pulp on how some decisions we take during development, will lead to confusions and hard times to maintain the source code.
Enjoy: http://www.paulstovell.com/blog/the-inline-sql-application-six-months-later
Saturday, March 22, 2008
Auto-wiring an MVC Triad using Unity
I think this post's title is a little bit cryptic, but if you did understood my intentions; you are possibly an IoC geek and may be you know what I am trying to say here.
So, let me explain the phrase from right to left:
Unity: The Unity Application Block (Unity) is a lightweight, extensible dependency injection container with support for constructor, property, and method call injection; it will be part of Entrprise Library version 4.0 and it has its own space on codeplex (www.codeplex.com/unity )
MVC : The famous Model-View-Controller design pattern used in the presentation layer since its invention in the 70s.
Wiring: The MVC pattern requires 3 classes to exist and coordinate together, the Controller class will need an instance of the Model and View, and the View will need a reference to the Model so it can handle the display of the Model.
In the normal life of any MVC based application, we will need some code like this:
Model m = new Model();
View v = new View();
Controller c = new Controller ( m , v);
c.Start();
By this; I mean wiring the classes together so they will be able to communicate.
Auto-Wiring: Is the mechanism of automatically wiring the classes together without the need to write the above code again and again.
One of the auto-wiring techniques is to use the Dependency Injection pattern, and instead of building my own implementation of it, I am using the Unit Application Block.
Unity is able to discover the dependency of the classes based on their constructors, so in the above example; Unity will discover that Controller will need a Model and a View instance so the Controller can be instantiated, and also the same for the View.
Using Unity, all what is needed is to call the Resolve method in the UnityContainer and it will instantiate all the dependencies for us (namely the Model and the View), and will instantiate the controller and pass it the created instances auto-magically.
UnityContainer container = new UnityContainer();
Controller c = container.Resolve<Controller>();
c.Start();
I have made a sample application, you can check to see the above code into action. You will need VS2008,no need to download or setup Unity, since its assemblies are included.
Agree, Disagree? I like to hear your comments.
Thursday, March 20, 2008
powercfg -H ON
Today I run out of space on my C: drive, so I used the Desk Clean up wizard to free some desk space for me, it asked me to clean many things and I blindly checked them all.
Then when I tried to Hibernate the computer, I didn't find the Hibernate option.
Thanks Google, I found a Microsoft KB Article (The Hibernate option is not available in Windows Vista http://support.microsoft.com/kb/929658)
The article says "This issue occurs if one of the following conditions is true: 1) The Disk Cleanup Utility and has been used to delete the Hibernation File Cleaner. " and there are some other conditions ... but what I did to clean my disk space prevented me from Hibernation !!!!
Hmmm, Is it my fault any way ... I shouldn't check all the items in the wizard :(
Oh, I forgot to tell you how to get Hibernate again ... on the command prompt type:
| powercfg -H ON |
