Tuesday, August 2, 2011

Atomic operations in C/C++

The atomic operations provided by GCC [1] come in quite handy even though they are limited to a few data types and in fact Intel-specific. AFAIK SPARC has it's own set of variants.

[1] http://gcc.gnu.org/onlinedocs/gcc-4.4.0/gcc/Atomic-Builtins.html#Atomic-Builtins

Monday, August 1, 2011

SSH/SCP without entering password

It is quite cumbersome if you are to re-enter password each time you invoke scp/ssh. Especially when you have a build system managing hundreds of binaries and scp deploying each of them to a remote run environment.

I found [1] quite useful in that regard.

[1] - http://www.thegeekstuff.com/2008/06/perform-ssh-and-scp-without-entering-password-on-openssh/comment-page-1/#comment-119367

Tuesday, October 19, 2010

_MSC_VER Values

VC6 - 1200
VC7 - 1300
VC7.1 - 1310
VC8 - 1400
VC9 - 1500

WINVER and _WIN32_WINNT Values

NT – 0X0400
2000 - 0x0500
XP - 0X0501
Server 2003 - 0X0502
Vista - 0X0600
Windows 7 - 0X0601

Saturday, October 16, 2010

Two ways to proof of 0.999… = 1

Long Division

1/9 = 0.111...
9 x (1/9) = 9 x 0.111...
1 = 0.999...

Digit Manipulation

X = 0.999...
10X = 9.999...
10X - X = 9.999... - 0.999...
9X = 9
X = 1

Source : http://en.wikipedia.org/wiki/0.999...#Digit_manipulation

Wednesday, October 13, 2010

Hex/int conversion in C

int –> Hex

int i = 10;
void* h =  (void*)i;

Hex –> int

void* h = 0xa;
int i = (int)((const char*)h - (const char*)0);

Monday, June 28, 2010

GMail targeting under 1sec load time with HTML5

According to Google, many of the upcoming features of GMail are going to be  HTML5-ready. They hope HTML5 will speed up loading and execution time of GMail. Google’s goal is to get their Web-based email service to load in under 1 second. While going through the original article I noticed a couple of interesting things.

Speed is a feature! – Truly it is. I do believe speed is one of the most critical decision factor when it comes to selecting a software application. To be honest I am very much happy about the load and execution time of Google, but they are looking for more. Interesting!.

Currently, the Gmail program is comprised of 443,000 lines of JavaScript, with 978,000 lines if comments are included. – I did actually not know that it was written completely in JavaScript in the first place. The interesting point is roughly each line of JavaScript is accompanied by one line of comment. That implies how vital the comments are in a software programming and of course how complex the GMail logic is ;-).