Thursday, 21 August 2014

Back to Java classes , J2SE development , Environment setup with first HelloWorld example

Hi friends, today I am going to setup J2SE environment for java development to revise what I learned back from my BS degree.

  • To start first we need to install jdk to our system, download latest jdk from :, I just downloaded windows x64 ( for windows 8 ).
  • After installation, need to add jdk's bin location to path Environment veritable. To do that right click "My Computer", then go to "Advance System Settings", click "Environment Variables", under System Variables grid, double click path record, as shown in figure :

and append the full path to the bin folder in jdk after installation at the end of path value separated by semi-colon and click OK.
  • To check everything working fine, just open command prompt and type and enter "javac", if you find screen as shown below, then everything working properly : 

  • Now to compile and run your first java program, open note pad, copy-paste following lines in it and save it as to some location in the drive.

public class HelloWorld {

    public static void main(String[] args) {
        System.out.println("Hello, World");


  • Then go to location where you save above file in command prompt and then run following two commands one by one :
  1. javac
  2. java HelloWorld

  • After second command, you will see output like "Hello, World".
That't it, you are already a java developer now and have written and executed your first java program successfully.

Whats Next :

Will going to present different tutorials and links on J2SE developement soon, so stay tuned, keep codding and enjoy :)

Monday, 18 August 2014

SQL Server 2008 R2 Profiler Tutorial

Hi guys, just revising my profiler skills , found a very nice article on "SQL Server 2008 R2 Profiler",

you can find it here : SQL Server 2008 R2 Profiler Tutorial, enjoy :)

Generate POCO Code First from existing database from in .NET ( Entity Framework 6 Tools for Visual Studio 2012 & 2013 )

Code First is best approach when starting your coding first and generate your database from your written code i.e. Plane Old CLR Objects ( POCO ) classes. But there might be a situation, when you want to use your existing database to develop your .net application using it, in that scenario one option is to use .edmx to generate your context and designer view but some people only used to work with pure poco's don't want to get into designer or database directly, so in that case we could visual studio extension/tool at

Entity Framework 6 Tools for Visual Studio 2012 & 2013 , just need to download .msi file and install it in your system.

After installation, to generate poco's from your existing database do following easy steps :

1 ) Right click to your project/project's folder and click add new item 

 2 ) Then select ADO.NET Entity Data Model and click Add

3 ) Where you can see new Model Content type i.e. Code First From Database, select it and click next

4 ) Establish connection with your database

5) Do next , select the tables you want to enter and click finish and finally you will see following kind of result, where Address and User are POCOs from database and Model1.cs is context class.

That's how you can create pure POCOs and context from existing database and use it in code first fashion, so enjoy :)

Saturday, 16 August 2014

PTCL EVO 3g issue , modem is already in use or not configured properly

Today I faced very annoying issue with PTCL EVO 3g, that is when I connected evo to may laptop ( with OS Windows 8 pro ) first time it configured well and was started working fine but when second time I plug-in the device it starting giving me error " Error:633 modem is already in use or not configured properly " , even I have uninstalled the driver and evo 3g software but still issue was giving me headache, after hours of brain burning I finally got succeed to configure it again to work properly.

Following are steps which needs to follow :

  • First go to Control Panel , then open Device Manager
  • Double click Modems and double click evo USB Modem
  • This will open a new tabbed window, then go to Advanced tab
  • On that tab click Advanced Port Settings and change the COM Port Number to COM1 or COM3 provided that which one is free.

Then restart your system and you have done it.

Friday, 15 August 2014

PetaPoco .Net light weight ORM

Last night I was having discussion on MVC4 with my friend from Morocco who is new in MVC and I got introduced with PetaPoco ( i.e. ORM kind of thing for .net ), my friend was using PetaPoco to map database entities to models. Later on I got little R&D on it and found it amazing as this is just a single file with 1500 lines of code and giving us following top features we usually used to be interested in :

  • Tiny, no dependencies... a single C# file you can easily add to any project.
  • Works with strictly undecorated POCOs, or attributed almost-POCOs.
  • Helper methods for Insert/Delete/Update/Save and IsNew
  • Paged requests automatically work out total record count and fetch a specific page.
  • Easy transaction support.
  • Better parameter replacement support, including grabbing named parameters from object properties.
  • Great performance by eliminating Linq and fast property assignment with DynamicMethod generation.
  • Includes T4 templates to automatically generate POCO classes for you.
  • The query language is SQL... no weird fluent or Linq syntaxes (yes, matter of opinion)
  • Includes a low friction SQL builder class that makes writing inline SQLmucheasier.
  • Hooks for logging exceptions, installing value converters and mapping columns to properties without attributes.
  • Works with SQL Server, SQL Server CE, MySQL, PostgreSQL and Oracle.
  • Works under .NET 3.5 or Mono 2.6 and later.
  • Experimental support for dynamic under .NET 4.0 and Mono 2.8
  • NUnit unit tests.
  • OpenSource (Apache License)
  • All of this in about 1,500 lines of code

PetaPoco can be downloaded from following sources :

  • NuGet -
  • GitHub -

More detail's can be found on their official site :

Whats next :
Console based .Net project with basic crud operation using PetaPoco.

Till then stay tuned and enjoy codding :)

Monday, 11 August 2014

MongoDB Setup ( installation ) and access through command line too and GUI based client

One of the most commonly used Non-Sql database these days is MongoDB. Last week I had a chance to try on it and have found it so easy to make it setup in the system. It is just a three step process to follow and make it working and play with it :

1) First download latest MongoDB zip file from here ( MongoDB ) and extract its contents at C:\Program Files\MongoDB.

2) Create new directory at C:\data\db , which is default directory for MongoDB to store its database files.

3) Now double click mongod.exe from C:\Program Files\MongoDB\bin location, and MongoDB server will be started to listen as shown in figure :

And that's it, you have successfully setup the MongoDB on your system, you can now perform operations in two ways :

1) Through Command Line tool : for command line tool go to C:\Program Files\MongoDB\bin and double click mongo.exe and start executing your commands there. For commands you can follow MongoDB's official documentation at :, to start as basic from command line you can perform CRUD operations by following steps here :

2) Using UI Client for MongoDB : you can use any freeware UI client available for MongoDB, I will prefer Robomongo, its free and extensive, you can download its free copy from :, and here is my post about it : After installation just run it for the first time and give connection name and don't change any default settings and click save.

That's all about how to setup MongoDB and how to play with it, so lets enjoy :)

What's Next : I am currently working on C# sample project to access MongoDB in both simple way and through repository pattern, will create next post on it, till then stay tuned and happy codding :)

Sunday, 10 August 2014

Wamp, change Apache server to run to other port instead of default

Some times port 80 is already occupied by IIS or any other program. In that case you can simple update port no. to run Apache server on, to do this :

Click Wamp server icon
Wamp Server
 in your system tray, go to apache-> httpd.confg , edit this file and place port no. in these lines by finding in file i.e.
Listen [::0]:80
e.g. we can change port 80 to 8080 as :
Listen [::0]:8080

enjoy :)

Wednesday, 6 August 2014

Robomongo, asesome mongodb UI client to play with mongodb server

Last week I played with mongo db a bit, its installation/configuration on Windows and how to manipulate mongodb server using cammond line, mean while I have found asesome tool for mongodb to have UI based interation with mongo server.

Latest copy can be download from :, just try it, its fun :)