Hamza Khalid

Stay Agile, Expect Change
Need For Speed Pro Street

" Need for Speed Pro Speed Exclusive Smoke Trailer " has been released by the NFS Team. Trailer revealed some exciting graphics and ground-breaking game play. You can watch it here

Share this post:                                       
Posted: Aug 09 2007, 01:01 PM by hamza khalid | with no comments
Filed under:
101 Ways To Know Your Software Project Is Doomed
This is a hilarious post "101 ways to know your software project is doomed". If your have been involved in software development at an IT firm then there are good chances that you might have experienced some of these items. I specially liked the following ones.

  • All performance issues are resolved by getting larger machines.
  • The phrase ‘It works on my machine’ is heard more than once a day.
  • Every bug is prioritized as ‘Critical’.
  • Your team believes ORM is a ‘fad’.
  • Your favorite software pattern is God Object.
  • Your white boards are mostly white (VersionOne).


 

 

Share this post:                                       
Posted: Aug 09 2007, 12:18 PM by hamza khalid | with no comments
Filed under:
The Geek Code

The Geek Code is a series of letters and symbols used by self-described "geeks" to inform fellow geeks about their personality, appearance, interests, and opinions. The idea is that everything that makes a geek individual and different from all the other geeks in the world can be written down (encoded) in this very compact format. Then other geeks can read the geek code and work back from that to discover what the writer looks like, what interests s/he has, and so forth. This is deemed to be efficient in some sufficiently geeky manner.

The Geek Code was invented by Robert Hayden in 1993 and is defined at geekcode.com. I have used Chris Gushue's Geek Code Generator to generate my geek code you can download it here .

Here is my Geek Code whats yours !!


-----BEGIN GEEK CODE BLOCK-----
GIT d+ s:-- a-- C+++ UL P-- L--- E-- W+++ N++ o+ K- w++++
O--- M-- V PS- PE+++ Y-- PGP- t--- 5 X+++ R tv+ b- DI-- D+
G++ e++ h++ !r !y+
------END GEEK CODE BLOCK------

 

Share this post:                                       
Posted: Aug 09 2007, 11:49 AM by hamza khalid | with no comments
Filed under:
SINGLE LINE OF HTML CRASHES IE:

A Japanese blogger identified a problem in IE which causes the browser to crash. I tried it on iE7 beta 3 & IE6 and it crashed both of them. Here is the link along with the script that causes IE to crash. The second link looks like it was part of a campaign to promote Firefox.

 

Link 1:   http://hamachiya.com/junk/ie_crash.html

script :   " <style>*{position:relative}</style><table><input></table> "

 

Link 2:   http://www.crashie.com/

script :   " <script>for(x in document.write){document.write(x);}</script> "

Share this post:                                       
Posted: Aug 08 2007, 07:14 PM by hamza khalid | with no comments
Filed under:
Microsoft Astoria:

Microsoft recently announced one of its upcoming project Codename Astoria at  MIX '07. Astoria is an implementation of RESTful architecture to provide data services over HTTP without using any underlying Messaging services such as Web Services or SOAP. Before going in further details lets take a look at REST architecture.

Representational State Transfer (REST) is a style of software architecture for distributed hypermedia systems such as the World Wide Web.

“Representational State Transfer is intended to evoke an image of how a well-designed Web application behaves: a network of web pages (a virtual state-machine), where the user progresses through an application by selecting links (state transitions), resulting in the next page (representing the next state of the application) being transferred to the user and rendered for their use.”

— Dr. Roy Fielding,(def from wikipedia)

Systems that follow Fielding's REST principles are often referred to as RESTful;


Astoria: Data Services for the Web

Project Astoria consists of a combination of patterns, libraries and an online service that explores the concept of data services for the web. Currently, Astoria data services use relational databases as the underlying store, but in general the nature of the store does not surface in the Astoria interfaces.

The goal of Astoria is to facilitate the creation of flexible data services that are naturally integrated with the web. As such, Astoria uses URIs to point to pieces of data and simple, well-known formats to represent that data, such as JSON and plain XML. This results in the data service being surfaced to the web as a REST-style resource collection that is addressable with URIs and that agents can interact with using the usual HTTP verbs such as GET, POST or DELETE.

In order for the system to understand and leverage semantics over the data that is surfacing, Astoria models the data exposed through the data service using a model called the Entity Data Model (EDM), an Entity-Relationship derivative. This organizes the data in the form of instances of "entity types", or "entities", and the associations between them as described in the Astoria Overview document .

The URI addressing scheme used by Astoria is also very simple it follows convention based approach (as used in ruby on Rails and in java struts 2.0 for mapping URLs to methods) to access the underlying data source. some examples are
http://myserver/data.svc/Customers[ALFKI]/Orders 
http://myserver/data.svc/Customers[ALFKI]/Orders[Active eq true]

The URL upto http://myserver/data.svc/ is the physical URL while the rest is logical which refers to the Customers table
using ALFKI as key to retrieve orders of that customer. Entities are exposed on Uri on which we can perform GET, POST or DELETE operations. Astro when combined with LINQ becomes more powerful as the underlying source can be a Relational Database or any other datasource. 

Links & References:

http://astoria.mslivelabs.com/
http://en.wikipedia.org/wiki/Representational_State_Transfer
http://www.xfront.com/REST-Web-Services.html
http://www.infoq.com/news/2007/05/astoria
http://www.base4.net/Blog.aspx?ID=395
http://udidahan.weblogs.us/2007/05/01/does-rest-simplify-communication-more-than-soa/

Share this post:                                       
Testing Live Writer Beta

I have recently installed Windows Live Writer. From now on i will use Windows Live writer to post.

Share this post:                                       
Posted: Apr 16 2007, 04:39 PM by hamza khalid | with no comments
Filed under:
NDepend .Net Dependency Analyzer

NDepend is a very nice .Net Code Metric Analyzer tool that analyzes your application by using some predefined Code-Matrices. it will analyze your Assemblies for dependencies and will provide a clear picture of what is happening inside your application in the form of reports, diagrams and metrics. It is easy to use and with its powerful Code Query Language (CQL) you can build your own queries to inspect your application. it can be integrated with MSBuild or Nant Tasks. you can download it here

Share this post:                                       
Microsoft Infrastructure Optimization and Security

After Attending a seminar on Microsoft Infrastructure and security it was revealed to me that a lot of work is going on in this field as well. a breed of products are availalbe like Microsoft ForeFront,MOM, SMS, Exchange Server 2007 etc.

More detailed information  about infrastructure optimization is available on the following link:
http://www.microsoftio.com/

Share this post:                                       
Posted: Feb 23 2007, 07:01 PM by hamza khalid | with no comments
Filed under:
Build Process Optimization in VS2005

Introduction:

 VS2005 takes a lot of time to build 'Web Site Projects' which is frustrating and cumbersome.

Here are some optimizations that will make the build process much faster.



Step 1: Changing Target Platform


Description:

 By default project target platform is set to ‘Any CPU’ or ‘Mixed platforms’ in VS2005

Resolution:

Go to Properties by Right Clicking your Solution. Under Configuration Properties-> Configuration menu change the projects target platform from "Any CPU or Mixed platforms" to "x86".if x86 does not exists then create it from Configuration manager by selecting new category from 'Active Solution Platform'.

You will see a performance boost for all your Class library projects.




Step 2: Enable Batch Compilation

 

Description:

Turning batch=true in Web.Config means that all your stuff within one directory is compiled into one Dll at once. Switching batch=false means Dll's for every single page. As I mentioned, on my machine the batch=true option is very slow. Every time when I start debugging by F5 the whole app is compiled and for every page an xml file is generated and so on... Turning off batch compilation makes start debugging rocket fast.

 

Resolution:

In Web.Config File under compilation tag set batch=false.

 



Step 3: Leveraging Server-Side Compilation

Description:

Visual Studio 2005 is leveraging ASP.Net 2.0 server-side compilation.  The IDE is primarily validating that the site will compile.  For most edit/run iterations it's not really necessary to validate/build the entire site on every F5 or solution build. While this does improve build performance because ASP.Net is only compiling the files needed for the request on F5, it doesn't help the developer identify all the compilation issues within the IDE before running.

Resolution:

Change Build options for the web site project:  (Property pages <shift><F4> -> Build)

    “Start Action (F5)” should be either "build page" or "no build".  -  Improves F5 performance

    “Build Solution Action” unchecks “Build Web as part of solution.”  -  Makes <ctrl><shift><B> very fast.

 

 

 

Step 4: Resolve Dueling Assembly References

 

Description:

The “easiest quick fix” way to resolve this issue is to modify one or more of your assembly file-based references to not be “automatic refresh enabled”.  You can do this by deleting the .refresh files within your \bin directory that produce that shared conflict.  This will avoid having VS auto-update the assemblies, and so will prevent the Dueling Assembly Reference update conflict altogether.   You might find it useful to quickly disable this behavior by deleting the .refresh files as a stop-gap, and then re-enable the auto-refresh behavior once you fix the shared assembly conflicts.


Resolution:

Navigate to your website bin Directory and delete all *.refresh files.




Step 5: Disabling HTML Schema Validation


Description:

VS2005 has a background thread that continuously monitors all open aspx files for errors.

 

Resolution:

On the Tools menu, click Options.

In the Options dialog box, expand the Text Editor node and the HTML node, and then click Validation.

To disable validation, clear the Show errors check box and then click OK.

 


Step 6:Disable Antivirus On Access Scanning

 

Description:

VS2005 hits the file-system a lot, and obviously needs to reparse any file within a project that has changed the next time it compiles.  One issue I've seen reported several times are cases where virus scanners, Spybot detectors, and/or desktop search indexing tools end up monitoring a directory containing a project a little too closely, and continually change the timestamps of these files (they don't alter the contents of the file - but they do change a last touched timestamp that VS also uses.  This then causes a pattern of: you make a change, rebuild, and then in the background the virus/search tool goes in and re-searches/re-checks the file and marks it as altered - which then causes VS to have to re-build it again. Check for this if you are seeing build performance issues, and consider disabling the directories you are working on from being scanned by other programs.  I've also seen reports of certain Spybot utilities causing extreme slowness with VS

Debugging - so you might want to verify that you aren't having issues with those either.


Resolution:

Watch out for Virus Checkers, Spy-Bots, and Search/Indexing Tools.

 

Results:
 Initially my project was taking around 4-5 mins to compile, but after optimizing it was reduced to 10 secs.

Share this post:                                       
Posted: Feb 23 2007, 04:44 PM by hamza khalid | with no comments
Filed under:
Happy New Year !
Wishing all the members and viewers, a very Happy New Year.
Share this post:                                       
Posted: Jan 03 2007, 12:50 PM by hamza khalid | with no comments
Filed under:
Server.CreateObject() in C# and VB

consider the following code written in C# that utilizes the classic ASP CDONTS Class to send email

Object obj=new Object();
obj=Server.CreateObject("CDONTS.NewMail");
obj.To ="
abc@xyz.com" ;
obj.From ="
abc@xyz.com" ;
obj.Subject="Test" ;
obj.Body="Test email message using CDONTS ";
obj.Send();


The above code will not compile in c# since type of Obj is not known. we need to reference
the Com component of CDONTS class and then explicitly type cast Obj. So instead of referencing, i found a quick solution that solved my problem and here it is.
 i just rewrote the above code in VB.NET


Dim obj as Object
obj=Server.CreateObject("CDONTS.NewMail")
obj.To ="
abc@xyz.com
obj.From ="
abc@xyz.com
obj.Subject="Test" 
obj.Body="Test email message using CDONTS "
obj.Send()  

and it worked like a charm.. without any Exceptions?? Strange for a C# geek. Thanks to VB.net's loose coupling.

Share this post:                                       
Posted: Nov 20 2006, 03:25 PM by hamza khalid | with no comments
Filed under:
How to Shoot Yourself in the Foot in Any Programming Language

The proliferation of modern programming languages (all of which seem to have stolen countless features from one another) sometimes makes it difficult to remember what language you’re currently using. This guide is offered as a public service to help programmers who find themselves in such dilemmas.

C
You shoot yourself in the foot.

C++
You accidentally create a dozen clones of yourself and shoot them all in the foot. Providing emergency medical assistance is impossible since you can’t tell which are bitwise copies and which are just pointing at others and saying, “That’s me, over there.”

JAVA
After importing java.awt.right.foot.* and java.awt.gun.right.hand.*, and writing the classes and methods of those classes needed, you’ve forgotten what the hell you’re doing.

Ruby
Your foot is ready to be shot in roughly five minutes, but you just can’t find anywhere to shoot it.

PHP
You shoot yourself in the foot with a gun made with pieces from 300 other guns.

ASP.NET
Find a gun, it falls apart. Put it back together, it falls apart again. You try using the .GUN Framework, it falls apart. You stab yourself in the foot instead.

SQL
SELECT @ammo:=bullet FROM gun WHERE trigger = ‘PULLED’;
INSERT INTO leg (foot) VALUES (@ammo);

Perl
You shoot yourself in the foot, but nobody can understand how you did it. Six months later, neither can you. (via Andy)

Javascript
YOu’ve perfected a robust, rich user experience for shooting yourself in the foot. You then find that bullets are disabled on your gun.

CSS
You shoot your right foot with one hand, then switch hands to shoot your left foot but you realize that the gun has turned into a banana.

FORTRAN
You shoot yourself in each toe, iteratively, until you run out of toes, then you read in the next foot and repeat. If you run out of bullets, you continue anyway because you have no exception-handling ability.

Modula2
After realizing that you can’t actually accomplish anything in this language, you shoot yourself in the head.

COBOL
Using a COLT 45 HANDGUN, AIM gun at LEG.FOOT, THEN place ARM.HAND.FINGER. on HANDGUN.TRIGGER and SQUEEZE. THEN return HANDGUN to HOLSTER. CHECK whether shoelace needs to be retied.

LISP
You shoot yourself in the appendage which holds the gun with which
you shoot yourself in the appendage which holds the gun with which
you shoot yourself in the appendage which holds the gun with which
you shoot yourself in the appendage which holds the gun with which
you shoot yourself in the appendage which holds ….

BASIC
Shoot yourself in the foot with a water pistol. On big systems, continue until entire lower body is waterlogged.

FORTH
Foot in yourself shoot.

APL
You shoot yourself in the foot, then spend all day figuring out how to do it in fewer characters.

Pascal
The compiler won’t let you shoot yourself in the foot.

SNOBOL
If you succeed, shoot yourself in the left foot.
If you fail, shoot yourself in the right foot.

Concurrent Euclid
You shoot yourself in somebody else’s foot.

HyperTalk
Put the first bullet of the gun into the foot of the left leg of you.
Answer the result.

Motif
You spend days writing a UIL description of your foot, the trajectory, the bullet, and the intricate scrollwork on the ivory handles of the gun. When you finally get around to pulling the trigger, the gun jams.

Unix
% ls
foot.c foot.h foot.o toe.c toe.o
% rm * .o
rm: .o: No such file or directory
% ls
%

Paradox
Not only can you shoot yourself in the foot, your users can too.

Revelation
You’ll be able to shoot yourself in the foot just as soon as you figure out what all these bullets are for.

Visual Basic
You’ll shoot yourself in the foot, but you’ll have so much fun doing it that you won’t care.

Prolog
You tell your program you want to be shot in the foot. The program figures out how to do it, but the syntax doesn’t allow it to explain.

Ada
After correctly packaging your foot, you attempt to concurrently load the gun, pull the trigger, scream and shoot yourself in the foot. When you try, however, you discover that your foot is of the wrong type.

Assembly
You try to shoot yourself in the foot only to discover you must first reinvent the gun, the bullet, and your foot. After that’s done, you pull the trigger, the gun beeps several times, then crashes.

370 JCL
You send your foot down to MIS with a 4000-page document explaining how you want it to be shot. Three years later, your foot comes back deep-fried.

Python
You try to shoot yourself in the foot but you just keep hitting the whitespace between your toes. (via Marco Azaro)

.Net
Microsoft shoots you in the foot.

Microsoft accidentally shoots you in foot. Promises service pack to reattach your foot sometime in the next year. 18 months later you get service pack that removes your colon along with the rest of your foot.

Java -

Build a well formed class with a well designed shootmyselfinthefoot method, start your program and hold your foot still for 40 minutes while your app loads.

For JAVA, I think it should have been:

You waste 2 hours trying to implement a generic foot shooting framework, solving classpath issues, profiling the bullet shooting algo (because at first the bullet is too slow and bounce off the foot), adding performance tweaks and reducing the memory usage (the gun is too heavy), adding try {shooting} catch(whatever could go wrong) to make sure you find out why it doesn’t work only to ‘finally’ figure out that you can risk moving your foot for an indefinite amount of time because the jvm is too slow to boot and shoot, and that the bullet pauses in mid air because of a garbage collection…

AJAX:

The gun makes an XMLHTTPRequest for the bullet which arrives some unspecified time later, killing a bird.

 

CSS:
You try to shoot your left foot, you miss 2 pixels. You try to shoot your right foot, you miss 1 pixel. Finally you try to shoot your head, you miss 10 pixels. Then you realize you’re using MS IE gun.

EJB

- Define a Foot interface
- Define a FootHome
- Define a FootImpl
- Define a Bullet interface
- Define a BulletHome
- Define a BulletImpl
- Define a Gun interface
- Define a GunHome
- Define a GunImpl
- Get the FootHome from the context
- Catch NamingException because you JNDI isn’t setup
- Get existing Foot from FootHome
- Fix error because you forgot to narrow the instance
- Create new Gun
- Be shocked that it actually worked successfully
- Create new Bullet instance
- gun.shoot(bullet, foot);
- Catch TransactionRolledBackException because your isolation level was incorrect
- rm -rf *.java *.class

Python:

gun.shoot(me.foot) works once you tell Python that you have a gun and a body, but you keep aiming at the whitespace between your toes because you never used any in Perl.


Hibernate / NHibernate
And in the last but not least  For hibernate users
You create Entities for Gun, Bullet and Foot and then create there Gun.hbm.xml, Bullet.hbm.xm and Foot.hbm.xml Mapping Files . and then..

Foot foot =new Foot();
Gun gun =new Gun();
gun.Bullets.Add(10);

gun.Fire(foot);

When you run it, gun drops a bullet very slowly, and nothing happens to your foot ???
then you suddenly figure out in hibernate mapping (Lazy=’true’)


#crossposted from
http://www.fullduplex.org/humor/2006/10/how-to-shoot-yourself-in-the-foot-in-any-programming-language/

Share this post:                                       
Posted: Nov 20 2006, 03:20 PM by hamza khalid | with 2 comment(s)
Filed under:
3-Tier, 3-Layer, MVC: a Trio of Famous Trios

Most of the people think that 3 Tier architecture, three- Layer architecture and MVC . all are same. i found a very nice article on msdn that discusses these three terminologies and their differences.

http://blogs.msdn.com/diegumzone/archive/2006/10/09/3_2D00_Tier_2C00_-3_2D00_Layer_2C00_-MVC_3A00_-a-Trio-of-Famous-Trios.aspx

by the way what do you people think?

Share this post:                                       
ASP.NET Page Life Cycle

Yesterday I found this cool diagram on google drawn by Léon Andrianarivony that shows asp.net 2.0 page life cycle events.

http://pointerx.net/photos/screenshots/images/852/original.aspx

 

Share this post:                                       
Posted: Sep 25 2006, 11:25 AM by hamza khalid | with no comments
Filed under: