Git Workflow: Branch - Rebase - Squash - Merge

So you want to make a change to your git repo while other people may also be simultaneously working on the same repo. As it takes you longer to make your changes, there is a greater chance that your local repo might already be out of date as other people have pushed their changes. In this setting, you don’t want to make your changes directly in master because otherwise you might end up creating large merge commits which makes your repo’s history convoluted and not very nice.

How to Enable and Use GCC Strict Mode Compilation

One of the great feature that many C++ programmers rarely use is GCC strict mode compilation. Enabling this lets compiler warn you about any potential issues that might often get unnoticed in build noise. Unfortunately there is little documentation, let alone quick tutorial on this subject so I thought to write this up. First, let’s clear this up: There is no official GCC mode called “strict”. I just made that term up.

Downloading All of Hacker News Posts and Comments

Introduction There are two files that contains all stories and comments posted at Hacker News from its start in 2006 to May 29, 2014 (exact dates are below). This was downloaded using simple program available I wrote Hacker News Downloader by making REST API calls to HN’s official APIs. The program used API parameters to paginate through created date of items to retrieve all posts and comments. The file contains entire sequence of JSON responses exactly as returned by API call in JSON array.

Silencing Exceptions in a Little Better Way

Some of the most disastrous code usually takes the following form try { //some code } catch { } Silencing exceptions is almost never good but sometime the problem is minor and you don’t want want to blow up and call for an exit. However wouldn’t it be better if exceptions don’t remain silent and scream for your attention when you are debugging and behave less aggressively otherwise? How about if we can replace above code with following:

The Best Culture Invariant Format for DateTime

If you are looking to display how to display DateTime as text without causing confusion to users in different countries then good choices is either “o” or “r”. The “o” format is in general more preferable as it also puts timezone offset. long t = DateTime.Now.Ticks; Console.WriteLine((new DateTime(t)).ToString("o")); Console.WriteLine((new DateTime(t, DateTimeKind.Local)).ToString("o")); Console.WriteLine((new DateTime(t, DateTimeKind.Unspecified)).ToString("o")); Console.WriteLine((new DateTime(t, DateTimeKind.Utc)).ToString("o")); Prints followings when actual date time is 2009-11-08T17:16:13.7791953 PST: 2009-11-08T17:16:13.7791953 2009-11-08T17:16:13.7791953-08:00 2009-11-08T17:16:13.7791953 2009-11-08T17:16:13.

Find Path of a Command Line Tool

Many times you work on different machines, execute a command line tool but often wonder where that tool is actually installed. One way to figure this out is to look at all environment PATH variables and search them manually in same order as Windows does. But you don’t have to because luckily there is a little known built-in command called WHERE that does that for you: This is similar to Unix commands like WHICH and WHEREIS.

What’s in a name?

When you want to store the name of a person a typical design starts out by creating two fields (in database or class): Person First Name Last Name Soon you realize lot of people have middle name, especially, when name change occurs after marriages. So you go and add one more field: Person First Name Middle Name Last Name This is all good… until you encounter people in countries such as Spain and Cuba who have custom to have two last names.

The ACM Turing Programming Contest Problem Set Archive

Here’s the list of problems used in ACM Turing programming contest. Surprisingly, like many other such contests, lots of problems are s simply a variant of shortest-path problem. The ACM ICPC Problem Set Archive

My New CodeProject Article On Equation Rendering

I just finished my new article on CodeProject. The mission on MimeTeX was started about couple of months ago when in a weekend I just got attracted to MimeTeX’s C code like a magnet ;). Now I’ve built ASP.Net handler, caching, admin etc on the top of it and its looking great! Enabling scientific content on web seems to be my new obsession. So if you take pride in delighting your users with every new release, here’s your brand new feature!

Interesting Headers

The response headers returns with Google’s logo looks like this: Content-Type: image/gif Last-Modified: Mon, 25 Apr 2005 21:06:18 GMT Expires: Sun, 17 Jan 2038 19:14:07 GMT Server: GWS/2.1 Content-Length: 8558 Date: Sat, 16 Jul 2005 01:52:05 GMT And for some gif served by IIS on Win 2003 Server looks like this: Server: Microsoft-IIS/5.0 X-Powered-By: ASP.NET Date: Sat, 16 Jul 2005 02:08:59 GMT Content-Type: image/gif Accept-Ranges: bytes Last-Modified: Fri, 04 Mar 2005 09:12:29 GMT Etag: "

Types Of Database Columns

From an excellent article on Decimal mentions survey of 1,091,916 columns in databases owned by 41 organizations to find that 41.8% of them contained numeric data and 53.7% contained char data.

We are Finite State Machines

From the coolest UML tutorial: Systems that have a fixed number of states, and that respond to a fixed set of events are called finite state machines (FSM). The book “Birth of the Mind” says DNA is nothing like conventional computers. It is FSM.

Five Good Books On Microsoft .Net Framework

In a programming world, to do a criticism against anything and everything Microsoft does is like putting up a fashion statement by beautiful models with their useless cloths. But after spending years in intensive computer programming, Microsoft .Net seems to be the best computer programming environment human kind can possess at this point of time. It’s simply just too perfect (if you forget the stupid “.Net” name tag i.e.) converging several good stuff from lots of things that existed ranging from non-proprietary C++, rival Java, Microsoft’s own VB and my old favorite Borland Delphi.