Wednesday, February 24, 2010

Learning Perl: List all environment variables

Listing all the environment variables using the built-in %ENV hash and simple for loop:

my @env_names = keys %ENV;

my $n;
my $v;

for ($k=0 ; $k<=$#env_names ; $k++)
{
    $n = $env_names[$k];
    $v = $ENV{"$n"};
    print "\n $n=$v";
}

A much shorter version using for each:

my @env_names = keys %ENV;
my $v;
foreach (@env_names)
{

    $v = $ENV{"$_"};
    print "\n $_=$v";
}

Putting it all in one line

print "\n $_=" , $ENV{"$_"} foreach (keys %ENV);

However, DOS still attractive … just use the SET command to get same result of the above :)

Thursday, February 04, 2010

Monday, January 11, 2010

Tuesday, January 05, 2010

IBM software architect kit

Get yourself a wealth of architecture resources in the following kit from IBM:

https://www6.software.ibm.com/developerworks/offers/kits/archkit1/index.html

Monday, January 04, 2010

Learn DB2 in one day

 

A complete online video based course to learn DB2

http://www.channeldb2.com/group/db2oncampus

Wednesday, December 30, 2009

MySpace.com uses iBATIS.NET for persistence

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

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 :