Wednesday, September 07, 2011
Wednesday, July 20, 2011
How Digital Detectives Deciphered Stuxnet
http://www.wired.com/threatlevel/2011/07/how-digital-detectives-deciphered-stuxnet/all/
This is one of best stories I have read, as thrilling & chilling as it gets.
This is one of best stories I have read, as thrilling & chilling as it gets.
Thursday, June 23, 2011
Wednesday, June 22, 2011
OO Programming & TDD: Useful Links
OO Design Principles
http://mmiika.wordpress.com/oo-design-principles/
Effective Tests: Test Doubles
http://www.aspiringcraftsman.com/2011/05/16/effective-tests-test-doubles/
The Art of Separation of Concerns
http://www.aspiringcraftsman.com/2008/01/03/art-of-separation-of-concerns/
http://mmiika.wordpress.com/oo-design-principles/
Effective Tests: Test Doubles
http://www.aspiringcraftsman.com/2011/05/16/effective-tests-test-doubles/
The Art of Separation of Concerns
http://www.aspiringcraftsman.com/2008/01/03/art-of-separation-of-concerns/
Friday, June 17, 2011
Tuesday, May 24, 2011
Amazon's Dynamo - scalable key-value store
http://www.allthingsdistributed.com/2007/10/amazons_dynamo.html
Overview of techniques used in building a scalabale decentralized key value store.
Overview of techniques used in building a scalabale decentralized key value store.
Friday, April 29, 2011
Screen - detach a process from console
Ever wondered how to start a download from server at night from your laptop and shut it down with out disrupting the download?
Of course there are many ways, use RDP etc but screen is a better choice because its powerful.It gives the power of resuming from where we left.
http://www.howtoforge.com/linux_screen
Of course there are many ways, use RDP etc but screen is a better choice because its powerful.It gives the power of resuming from where we left.
http://www.howtoforge.com/linux_screen
Tuesday, April 19, 2011
C++ Singleton Pattern
Friday, April 02, 2010
Perl HowTo: Parsing command line options
Sample program to work with CLI options. Play with this program options and pay attention to the reported usage errors to better understand how GetOptions() work. # CODE STARTS HERE
#!perl -w =head1 Using GetOptions() to process CLI options Ref: http://perldoc.perl.org/Getopt/Long.html =cut # Required module use Getopt::Long; use strict; my $grade = 'A'; my $pcile = 0.0; my $name = ''; my $result = 0; # Fail by default my $promote = 0; my @marks = (); my %history = (); sub show_usage() { print "\nUsage: --name name --grade [A|B|C|D] --marks m1 m2 m3\n" . " [--pass] [--promote | --nopromote]\n\n"; exit( 0 ); } if ( !scalar( @ARGV ) ) { show_usage(); } if ( !GetOptions( 'name=s' => \$name, # = - mandatory, string 'grade:s' => \$grade, # : - optional, string 'percentile:f' => \$pcile, # read float value 'marks=i{3}' => \@marks, # sequence of 3 numerals 'pass' => \$result, # optional, flag 'promote!' => \$promote, # -promote and -nopromote 'history:s{2}' => \%history ) ) # sequence of 2 strings { show_usage(); } print "\n SUMMARY \n\n"; print "Name : $name\n"; print "Marks : "; foreach( @marks ) { print $_ . " "; } print "\n"; print "Grade : $grade\n"; print "Percentile: $pcile\n"; print "Result : $result\n"; print "Promote? : $promote\n"; print "\n"; print "History : "; foreach( keys( %history ) ) { print $_ . " = " . $history{$_} . "; "; } print "\n"; 0; # CODE ENDS HERE
Wednesday, February 10, 2010
vim command to delete lines
My fingertips know the command to delete all the lines starting from current line till EOF (that's d + shift g) but I rarely remember the command to delete all the lines up to head of the file.
Luckily, vim offers a simple approach to delete desired lines, all we need to be aware is the following
Luckily, vim offers a simple approach to delete desired lines, all we need to be aware is the following
- . (dot) - represents current line
- $ - represents EOF
- syntax: start_line_num,end_line_num vim_cmd
- Delete all the lines starting from current line : .,$ del
- Delete lines starting from 1 to so far : 1,. del
- Delete all lines between 10 and 25 (inclusive) : 10,25 del
- Delete all lines between 10 and 25 (inclusive) : 10,+14 del
- Delete next 15 lines including the current : .,+14 del
- Delete last 15 lines including the current : .,-14 del
Tuesday, November 03, 2009
Open Source Projects and Volunteers
Why only a handful of projects attract attention of developers/volunteers?
Moshe Bar and Karl Fogel in their book Source Development with CVS points that In a system that relies largely on volunteer energy, convenience is not a mere luxury—it is often the factor that determines whether people will contribute to your project or turn their attention to something with fewer obstacles to participation. Projects are competing for volunteer attention on their merits, and those merits include not only the quality of the software itself, but also potential developers’ ease of access to the source and the readiness of the maintainers to accept good contributions.
Point taken.
Moshe Bar and Karl Fogel in their book Source Development with CVS points that In a system that relies largely on volunteer energy, convenience is not a mere luxury—it is often the factor that determines whether people will contribute to your project or turn their attention to something with fewer obstacles to participation. Projects are competing for volunteer attention on their merits, and those merits include not only the quality of the software itself, but also potential developers’ ease of access to the source and the readiness of the maintainers to accept good contributions.
Point taken.
Saturday, October 10, 2009
Coding standards do no harm
Coding standards aid in picking up new code faster, it can help in debugging too. For example it's almost safe to skip a const qualified method while debugging a problem (just make sure that there are no mutable members).
Lately I had crazy time debugging a problem that eventually boiled down to non adherence of coding standards. Here it goes ...
A new API that looks as simple as below was added to a self sufficient component which compiles clean after the change was made.
It turned out that other component has defined a macro which is neither long nor uses UPPER_CASE. Of course it's their choice!
Lately I had crazy time debugging a problem that eventually boiled down to non adherence of coding standards. Here it goes ...
A new API that looks as simple as below was added to a self sufficient component which compiles clean after the change was made.
int process_data( const char * str, char delim = ' ' );Suddenly another component that depends on the modified header fails to compile with error C2143: missing ')' before 'string'. That's a bit of shock!. By the way the other component doesn't use the new API at all.
It turned out that other component has defined a macro which is neither long nor uses UPPER_CASE. Of course it's their choice!
#define delim TEXT(" ") // andYou are punished for using a simple looking identifier (delim) and it takes efforts to understand that you are being punished!
#define TEXT( str ) L##str // just token pasting ...
Saturday, August 01, 2009
Defining INT_MIN
A bit of googling revealed that above warning can be dangerous. To understand the underlying problem, here is my own version of INT_MIN.
#define INT32_MIN -2147483648
As 2147483648 is greater than max 32-bit signed int value (MAX_INT), it is treated as unsigned int
if ( 1 > INT32_MIN ) // comparing two unsigned values
std::cout << "I am sure, 1 gt INT32_MIN";
else
std::cout << "Surprse! it says, 1 lt INT32_MIN";
#define INT32_MIN (-2147483647 - 1) // don't forget to put the braces around
1. More detailed explanation is available here
2.
Labels:
INT_MIN,
limits.h,
programming,
warning C4146
Tuesday, June 23, 2009
Quote from IBM GTO 2008
Good quote from IBM's Global Technology Outlook 2008.
A computer, like anything else, works best when it is built and used for a specific purpose. Though far more complex than a hammer or saw, a computer is a tool just the same. And all tools must be designed to a task.
A computer, like anything else, works best when it is built and used for a specific purpose. Though far more complex than a hammer or saw, a computer is a tool just the same. And all tools must be designed to a task.
Sunday, February 08, 2009
exstr dupms core on lenghty strings
Make messages normally uses exstr to extract strings that needs to be localized. It looks like exstr suffers from buffer overflow vulnerability. It dumps core on Solaris 9 with the following program snippet. exstr doesn't seem to process a lengthy string.
In order to generate message strings, I had to break the above snippet into ugly looking pieces - quite bad, I had to split the options mid way.
void PrintUsage()
{
std::cout << "#mycmd -option1 -subopt1 -subopt2 -suboption3 \n\
-option2 -subopt1 -sbuopt2 -subopt3 \n\
......................... \n\
......................... \n\
-option15 -subopt1 -subopt2"
<< std::endl;
}
In order to generate message strings, I had to break the above snippet into ugly looking pieces - quite bad, I had to split the options mid way.
void PrintUsage()
{
std::cout << "#mycmd -option1 -subopt1 -subopt2 -suboption3 \n\
-option2 -subopt1 -sbuopt2 -subopt3 \n\
......................... \n\
.........................\n\
-option9 -subopt1 -subopt2";
std::cout << " -option10 -subopt1 -subopt2 -suboption3 \n\
-option11 -subopt1 -sbuopt2 -subopt3 \n\
......................... \n\
.........................\n\
-option15 -subopt1 -subopt2";
<< std::endl;
}
Tuesday, January 06, 2009
VIXIMO's VixML platform for iphone
Looks cool, featuring
- Physics engine
- 2D and 3D visual effects
- Easy to use by non programmers
- Physics engine
- 2D and 3D visual effects
- Easy to use by non programmers
Tuesday, December 09, 2008
Zoetrope, new concept aimed at providing access to temporal web content. It lest people see how things (any) have evolved over a period of time. One useful thing that can be done using Zoetrope is to spot the best time to buy books on Amazon :-)
Zoetrope in action
Zoetrope in action
Tuesday, November 18, 2008
Really cool stuff
Usability is still an issue with PCs. There are smart people (who works around an issue instead of simply nodding in disgust) out in the world ... proof? check this video
Tuesday, September 02, 2008
Google Chrome
Wish, it comes out soon :-)
http://blogoscoped.com/archive/2008-09-01-n47.html
http://blogoscoped.com/google-chrome/
http://blogoscoped.com/archive/2008-09-01-n47.html
http://blogoscoped.com/google-chrome/
Un named structures and VS8
With two un-named structures , the linker on Windows has thrown the following error
unnamed_struct.obj : fatal error LNK1179: invalid or corrupt file:
duplicate COMDAT '??1@@QAE@XZ'
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual
Studio 8\VC\BIN\link.EXE"' : return code '0x49b'
Stop.
The above is observed even with the varying number of struct members.
Known Issue: If two unnamed structs both declare a method with the same signature
and both are referenced, the compiler generates the same signature for both methods.
The linker then flags the .obj file as invalid due to duplicate COMDAT records
(More about this issue here)
The solution to this problem is, not to use more than one un-named structures
Subscribe to:
Posts (Atom)