Prabir's Blog

open source geek and lover of all tech  

Enabling the exchange of code and understanding among software companies and open source communities

The CodePlex Foundation, a non-profit foundation formed with the mission of enabling the exchange of code and understanding among software companies and open source communities, launched today, September 10, 2009.

For more info please check http://www.codeplex.org

I usually like running some software as portable. It allows me to easily use the same configurations across various computers.

One of the software that I use is a bash shell from called msys. I have attached the zip file which can be downloaded at the and of the post.

Note: It only contains the core shell and no other stuffs such as the binutils and C/C++ compilers.

msysCORE-1.0.11-20080826_portable.zip (2.88 mb)

Sep

Undo in Git

We are not perfect. There are may times when we make a mistake and need to revert back to the previous stage. Usually the most common way to do it would be by using Ctrl+Z.

How many times have you wanted to undo your commit? Did you ever make a spelling mistake? You did the wrong commit. If so here is the answer.

There are basically two ways to do it in Git. One is using soft reset and the other one using hard reset.

1. Soft Reset

This undo's your commit and keeps changes you have made in the working tree.

git reset --soft HEAD^

2. Hard Reset

This undo’s your commit and also resets your working tree to the last commit.

git reset --hard HEAD^

Lately I have been a fan of git for making it as my default version control system. I have been learning it and also trying use it for my current projects.

There are quite a bunch of free git hosting around, but you basically have to open source your codes. So I searched around the net for some private hosting, which allows to hide the codes from public access. It might be helpful for you guys.

Here’s the list.

Internet Explorer 8 has taken the javascript development to the next level by providing a rich developer integration with the browser. In this post I will explain one of the core feature that I use often when debugging my web applications containing javascript.

Traditionally one of the best way to debug was using the alert function. But this is quite annoying as we have to press ok all the time. IE8 creators understood this and have created a set of functions to easily allow us to debug.

Instead of using alert, you can use console.clear(), console.log(), console.info(),console.error(),console.warn() to provide better information when debugging.

console.clear();
console.log("hello world from js to ie8 console");
console.info("sample info");
console.error("sample error");
console.warn("sample warning");
var x = "hello";
var y = 10;
var z=1.1;
console.log("string:%s:int:%i,real:%f",x,y,z);
image

The parameters for the console functions have the same format as printf function in c. Anyways I have put some examples above to make it easier.

  • %s  string
  • %i   integer (whole numbers only)
  • %f   floating point numbers (decimal values)

I would recommend you to use proper info, error and warn rather than just log as it even allows us to filter as shown below.

image

If you get image  at the bottom of you IE on status bar, it is basically the error telling the the console is undefined. In order to solve it, open the IE developer tools (press F12) and refresh the page. This automatically registers the console and you will not get any javascript errors.