Thursday, December 18, 2014

#Visualization - Graph Design I.Q. Test http://t.co/yNJxGSKQwl -- via Twitter




from Twitter http://ift.tt/161Svjk



December 18, 2014 at 11:21AM

via IFTTT

Wednesday, December 17, 2014

How to Lie with Charts https://t.co/Z6k9lLkoVx -- via Twitter




from Twitter http://ift.tt/161Svjk



December 17, 2014 at 03:33PM

via IFTTT

Tuesday, December 16, 2014

Morning Rituals To Improve Your Appearance http://t.co/rqpgtNwCKv -- via Twitter




from Twitter http://ift.tt/161Svjk



December 16, 2014 at 11:34PM

via IFTTT

A Periodic Table of Visualization Methods http://t.co/BQ2ybxRBMm -- via Twitter




from Twitter http://ift.tt/161Svjk



December 16, 2014 at 01:09PM

via IFTTT

#MDA Model-Driven Architecture - SAP PowerDesinger http://t.co/firnK6XoSB -- via Twitter




from Twitter http://ift.tt/161Svjk



December 16, 2014 at 12:01PM

via IFTTT

Monday, December 15, 2014

RT @AstroSamantha: (IT)Volando controcorrente lungo il Nilo. Un brillante serpente di luci dal Cairo al lago Nasser. http://t.co/ebIuuyTzjB -- via Twitter




from Twitter http://ift.tt/161Svjk



December 15, 2014 at 11:39AM

via IFTTT

Pie chart pyramid http://t.co/5wHmMMS3LX via @flowingdata -- via Twitter




from Twitter http://ift.tt/161Svjk



December 15, 2014 at 10:51AM

via IFTTT

RT @OReillyMedia: An Introduction to d3.js by @alignedleft - start training for free: http://t.co/OgdyQ4VWRs http://t.co/06qryAAFSw -- via Twitter




from Twitter http://ift.tt/161Svjk



December 15, 2014 at 10:34AM

via IFTTT

Tuesday, December 09, 2014

Cartoon: Bulking Up the Data Staff http://t.co/HoHFDCZFSz -- via Twitter




from Twitter http://ift.tt/161Svjk



December 09, 2014 at 03:21PM

via IFTTT

Happiness Around the World http://t.co/hI0lTzPjz4 via @MoveHub -- via Twitter




from Twitter http://ift.tt/161Svjk



December 09, 2014 at 11:01AM

via IFTTT

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 :

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.

http://www.spectrum.ieee.org/video?id=361

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


I was playing around with PowerShell and I tried to dump the content of a text file, but used a word document instead (by mistake), surprisingly; my machine started to Beep like the old DOS days.

Try it yourself, open PowerShell and Type:

Get-Content "path to a word document"

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*"
$files | foreach {copy $_.fullname -Destination E:\Docs}

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

Wednesday, March 12, 2008

Hacking my kids games

Sometimes you feel that the geek inside you is about to explode , this happened to me when I went to buy a new toy to my daughter from the toy store and seen the RC Cars.

I found cheap remote controlled cars for less than 100 LE ( < 15$ )

The toy cars are remotely controlled using Radio frequency, they are called RC Cars for (Radio Controlled Cars)

Once I seen the remote control, I though immediately if it is possible to connect that remote to my PC and control the car using my keyboard !!! why do that ... I don't know but read the article from the beginning again and you will understand.

So, I did a quick search and I found other geeks thinking in the same line, this post (http://www.hackaday.com/2005/02/01/control-an-r-c-car-from-your-pc/) is what I was looking for and this (http://www.engr.uvic.ca/~sbowman/more-moreBetterCircuitDiagram.gif) is the circuit used to connect the remote to the computer parallel port.

As soon as I do that , will let you all know :)

Extreme XML

lots of interesting articles about XML, XPath , XSLT for .net developers:

http://msdn2.microsoft.com/en-us/library/cc294436.aspx

Check them out

Monday, March 03, 2008

Microsoft Robotics Studio Links


 

MSDN Robotics Forums

http://forums.microsoft.com/MSDN/default.aspx?ForumGroupID=383&SiteID=1


 

Microsoft Robotics Downloads

http://msdn2.microsoft.com/en-us/robotics/aa731520.aspx

Introductory Courseware for Microsoft Robotics Studio

http://www.microsoft.com/downloads/details.aspx?FamilyId=F294C8E7-6617-4DD8-8354-7E97F3167E1A&displaylang=en


 

Channel 9 Videos

Robots and BizTalk Services

http://channel9.msdn.com/ShowPost.aspx?PostID=386824

Microsoft Robotics Studio and Lego Mindstorms NXT

http://channel9.msdn.com/ShowPost.aspx?PostID=325661

Microsoft Robotics Tour:

Part 1:CCR, VPL, Simulation - http://channel9.msdn.com/Showpost.aspx?postid=303072

Part 2:CCR, VPL, Simulation - http://channel9.msdn.com/Showpost.aspx?postid=303135

Singapore Sumo-Robot How-To

#1: Getting the Robotics Bits

http://channel9.msdn.com/Showpost.aspx?postid=309026

#2: Understanding Your Robot's Inputs and Outputs

http://channel9.msdn.com/Showpost.aspx?postid=309686

#3: Building Your First Robot

http://channel9.msdn.com/Showpost.aspx?postid=309685

#4: Understanding Your Robot's Code Methods

http://channel9.msdn.com/Showpost.aspx?postid=309688


 


 


 

CCR Programming - Jeffrey Richter and George Chrysanthakopoulos

http://channel9.msdn.com/showpost.aspx?postid=219308

Microsoft Robotics Studio

http://channel9.msdn.com/ShowPost.aspx?PostID=206574


 

    

Walter Stiers - Academic Relations Team (BeLux)

http://blogs.msdn.com/walterst/archive/tags/Robotics/default.aspx


 


 

Windows Embedded Academic Program (WEMAP)
The Windows Embedded Academic Program (WEMAP) helps provide a better understanding of the Windows CE and Windows XP Embedded operating systems to academia. As a participant in this program, you can learn how to educate the next generation of embedded developers on Windows Embedded technologies. You can participate in a variety of programs, including student competitions like the Windows Embedded Student ChallengE and discounted hardware programs, such as the Hardware Empowerment Program.


 

HowTo Videos: Robotics and .Net fundamentals

http://blogs.msdn.com/dawate/archive/2007/12/14/robotics-and-net-fundamentals-series.aspx

http://channel8.msdn.com/Posts/HowTo-Videos-Robotics-and-Net-fundamentals/

Monday, February 11, 2008

Return an exit code from a C# Windows Application

To exit an Windows Forms Application, we have the option to use Application.Exit() or the System.Environment.Exit().

The difference is discussed here (http://geekswithblogs.net/mtreadwell/archive/2004/06/06/6123.aspx) and the suggestion was made to use System.Environment.Exit() for console applications since it can accept an exit code which will be returned to the Operating System.

But for Windows applications, what should we do ?

I have tried to modify the Main function definition so it will have a return value, a lesson learned from C/C++ old days, then add a property to my main form to indicate if my application would report a success or failure report

And so, my Main function will look like this :

 

        [STAThread]
       
static int Main(string[] arguments)
        {

            Application.EnableVisualStyles()
;
           
Application.SetCompatibleTextRenderingDefault(false);

           
MainForm mainForm = new MainForm();
            Application.Run(mainForm)
;

           
//return exit code
            // 0  : no problem
            // -1 : error occured

           
int exitCode = mainForm.Succeeded == true ? 0 : -1;
            return
exitCode;
           

       
}

 

This approach can be extended to report different exit codes for different scenarios (think about MSBuild or NAnt exit codes).

Saturday, February 09, 2008

Guidelines for Test-Driven Development

 

Jeffrey Palermo has an interesting article on MSDN about TDD in .net development, discussing the process of Red-Green-Refactor, benefits of TDD and what characterizes a good unit test

Microsoft Sync Framework

According to Microsoft definition; the Sync Framework is "a comprehensive synchronization platform enabling collaboration and offline for applications, services and devices with support for any data type, any data store, any transfer protocol, and network topology."

What does it mean for us developers?

Hmmm, I am trying to think about an example here. Take Microsoft Outlook and Microsoft Groove as an example; both are collaboration platforms, can work offline and online, and support many protocols.

Look at the technical options that we have now if we need to build something like this:

  • Database Replication
  • Offline Application Block
  • WCF with Queued Messages

I don't know of any other option, but each of the above options has different approach and has issues and limitations as well.

The Sync framework is coming to put a uniform way of building applications like Outlook without pain, the framework is now addressing Data, files and feeds synchronization in addition to having the ability to role your own providers; think about synchronizing an Oracle database with an Outlook folder or a SharePoint list.

The concept is discussed in Introduction to the Microsoft Sync Framework Runtime , while the motivations, goals and approach is briefly discussed by Moe Khosravy the Lead Program Manager on his article Next Generation Synchronization Framework or watch him talk about it on Channel8 http://channel8.msdn.com/Posts/Sync-your-Facebook-with-your-phone-Whats-the-Sync-Framework/

There is also a number of Screen casts http://blogs.msdn.com/sync/archive/2008/01/14/microsoft-sync-framework-sync-services-for-ado-net-video-webcasts.aspx

So, what are you waiting for, go ahead and download the SDK (http://www.microsoft.com/downloads/details.aspx?FamilyId=C88BA2D1-CEF3-4149-B301-9B056E7FB1E6&displaylang=en) and start playing.

Interested on the subject, or have played with it … let me know by commenting on this post

Friday, February 08, 2008

[Architecting Desktop Applications with 2.0] MSDN Webcast series

MSDN Webcast: Architecting Desktop Applications with 2.0 (Part 01 of 15): Smart Clients and N-tier Design (Level 300)

MSDN Webcast: Architecting Desktop Applications with 2.0 (Part 02 of 15): Design Patterns for GUI Applications (Level 300)

MSDN Webcast: Architecting Desktop Applications with 2.0 (Part 03 of 15): Creating Dynamic and Configurable Applications (Level 300)

MSDN Webcast: Architecting Desktop Applications with 2.0 (Part 04 of 15): Architecting a Secure Desktop Application (Level 300)

MSDN Webcast: Architecting Desktop Applications with 2.0 (Part 05 of 15): Designing the Business Tier (Level 300)

MSDN Webcast: Architecting Desktop Applications with 2.0 (Part 06 of 15): Designing the Data Access Tier (Level 300)

MSDN Webcast: Architecting Desktop Applications with 2.0 (Part 07 of 15): Best Practices for Developing N-Tier Applications (Level 300)

MSDN Webcast: Architecting Desktop Applications with 2.0 (Part 08 of 15): Turning Tiers into Components (Level 300)

MSDN Webcast: Architecting Desktop Applications with 2.0 (Part 09 of 15): Build, Build, Build, Test, Test, Test (Level 300)

MSDN Webcast: Architecting Desktop Applications with 2.0 (Part 10 of 15): Multithreading for Performance and Responsiveness (Level 300) (Level 300)

MSDN Webcast: Architecting Desktop Applications with 2.0 (Part 11 of 15): Designing Distributed Applications Around Remote Access (Level 300) (Level 300)

MSDN Webcast: Architecting Desktop Applications with 2.0 (Part 12 of 15): Designing Distributed Applications Around Web Services (Level 300) (Level 300)

MSDN Webcast: Architecting Desktop Applications with 2.0 (Part 13 of 15): Securing a Distributed Application (Level 300) (Level 300)

MSDN Webcast: Architecting Desktop Applications with 2.0 (Part 14 of 15): ClickOnce Deployment (Level 300) (Level 300)

MSDN Webcast: Architecting Desktop Applications with 2.0 (Part 15 of 15): Learning from Agile Development (Level 300) (Level 300)

Tuesday, January 15, 2008

How to get the month name according to the current windows local

I used the DateTimeFormatInfo class to get the month name as a string by calling this method GetMonthName(int) , then I found that it retrun the English representation of the month even in non english regional settings (Windows locale).

The culture aware class is the CultureInfo, which can be accessed from the Current thread, so simply call:

System.Threading.Thread.CurrentThread.CurrentCulture.DateTimeFormat.GetMonthName(monthNumber);

to get a culture specific month name.

Thursday, January 10, 2008

Blogs/Casts I read and recommend

ARCast.TV - Exotic Locations, Global Perspective and Architectural Insight… It’s ARCast.TV with Ron Jacobs

RSS Feed :http://channel9.msdn.com/rss.aspx?ShowID=26

 

Scott Hanselman - Scott Hanselman's Thoughts on .NET, WebServices, and Life , also listen to his PodCast (www.hanselminutes.com)

RSS Feed : http://feeds.feedburner.com/ScottHanselman

 

MSDN Nuggets - not the stuff we eat ... its MSDN Nuggets

RSS Feed :  http://www.microsoft.com/uk/msdn/nuggets/rss.aspx?t=all

 

 Daniel Moth a Microsoft geek and a former MVP (lots of Screen Casts)

RSS Feed : http://feeds.feedburner.com/DanielMoth

VS2005 Gotcha : DataTable with Seed = 0 will kill you

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 &quot; 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>&quot;my-external-application.exe&quot;</ToolPath>
    <Param1>&quot;my-param-value&quot;</Param1>
    <Param2>&quot;my-param-value&quot;</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.

Part 1:http://www.devx.com/webdev/Article/35662

Part 2 : http://www.devx.com/webdev/Article/35744

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

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:

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/


 

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

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

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:
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

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.
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

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 :)





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)

  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

 

Situation

  • 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.

Problem

· 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.

 

Solution

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 VB.net and C#.

There is one free wrapper; which I didn't use myself ... but the library seems to be updated regularly (http://www.infinitec.de/libraries/exchange/infinitec_exchange_0_99_2.aspx)

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:

1) http://download.microsoft.com/download/3/c/9/3c9f031b-7e6f-44e6-875e-471fe7b7809c/HDI01-AJAX-B1-GetStarted.zip

2) http://download.microsoft.com/download/3/c/9/3c9f031b-7e6f-44e6-875e-471fe7b7809c/HDI02-AJAX-B1-GetStarted-Toolkit.zip

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 [http://www.dnncreative.com/Forum/tabid/88/forumid/4/postid/1919/view/topic/Default.aspx]

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.

Enjoy http://channel9.msdn.com/shows/The_Code_Room

Tuesday, December 26, 2006

u can't connect the dots looking forward, u can only connect them looking backwords

Watch Apple CEO Steve Jobs talking about his story:

http://www.youtube.com/watch?v=xjfRICAisB0

Monday, September 18, 2006

Organize your Settings

The trick that might not been famous, is that we can add multiple settings to a single VS2005 project; this will make organizing settings into groups more useful from a programming point of view or an administration point of view.

Let's say that we have a project with more than 30 entries in its Settings designer, managing this huge number of settings might lead to some errors.

Why not split those settings into groups, for example AdminSettings and OperationSettings.

By default a VS2005 project ca have one settings class auto-generated by the settings designer; this class will get the name Settings. We can get rid of this class or leave it and add one or two other by Selecting New Item from the Add menu.


Then we can select the Settings File and name it what ever we want.

We can then use drag and drop to move the newly added settings to the Properties folder



Doing this, we will maintain all settings in the Properties folder,hence to get the name space Properties for all our settings.