<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-6487100581508098433</id><updated>2012-01-19T04:39:27.540-08:00</updated><category term='linux'/><category term='visual studio'/><category term='c#'/><category term='j2me'/><category term='tools'/><category term='javascript'/><category term='web'/><category term='php'/><category term='process'/><category term='mobile applications'/><category term='security'/><category term='tutorial'/><category term='unicode'/><category term='project management'/><category term='cmm'/><category term='c++'/><category term='science'/><title type='text'>Kaisar's blog</title><subtitle type='html'>Technologies, computing and programming are my passions. I talk about these passions here.&lt;br&gt;&lt;br&gt;

It seems like I'm posting more on C++.. The language just fascinates me everyday and I like to think myself as an expert of the language.

You're welcome to send me questions and comments in &lt;b&gt;m.kaisar at-the-rate gmail dot-com&lt;/b&gt;.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://kaisar-haque.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://kaisar-haque.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>RoboSmith</name><uri>http://www.blogger.com/profile/07878693490452605144</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>40</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6487100581508098433.post-2813584668596346892</id><published>2011-06-03T09:14:00.000-07:00</published><updated>2011-06-03T09:14:15.085-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='web'/><title type='text'>Linux running on JavaScript</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div style="text-align: left;"&gt;Suddenly came across this amazing project.. Linux running ‘on’ the web browser. It’s a virtual machine written in JavaScript, it can boot a small linux image supporting basic commands, file system, vi, and even.. a C compiler!&lt;br /&gt;&lt;br /&gt;URL: &lt;a href="http://bellard.org/jslinux/"&gt;http://bellard.org/jslinux/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;You can edit, compile and run the sample hello.c program using the compiler called tcc.&lt;br /&gt;&lt;br /&gt;To compile: tcc -o hello hello.c&lt;br /&gt;To run: ./hello&lt;br /&gt;&lt;br /&gt;All that running on top of JavaScript!.. absolutely mind blowing!&lt;br /&gt;&lt;br /&gt;By the way, only the following browsers are supported:&lt;/div&gt;&lt;ul style="text-align: left;"&gt;&lt;li&gt;Firefox 4.x&lt;/li&gt;&lt;li&gt;Chrome 11&lt;/li&gt;&lt;li&gt;Opera 11.11&lt;/li&gt;&lt;li&gt;Internet Explorer 9&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6487100581508098433-2813584668596346892?l=kaisar-haque.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kaisar-haque.blogspot.com/feeds/2813584668596346892/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6487100581508098433&amp;postID=2813584668596346892' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/2813584668596346892'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/2813584668596346892'/><link rel='alternate' type='text/html' href='http://kaisar-haque.blogspot.com/2011/06/linux-running-on-javascript.html' title='Linux running on JavaScript'/><author><name>RoboSmith</name><uri>http://www.blogger.com/profile/07878693490452605144</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6487100581508098433.post-3768831684362065316</id><published>2011-04-24T14:38:00.000-07:00</published><updated>2011-04-24T15:57:28.371-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='c++'/><title type='text'>C++: Is 'this' safe in the constructor?</title><content type='html'>I've been working hard on something very interesting during the Easter holidays. Wanted to take a quick break, listen to some good music and make a blog post. Alright, my favorite Sony earbuds are on and queued the songs. Now here goes the quick post.&lt;br /&gt;&lt;br /&gt;Very often C++ beginners get confused about when and how 'this' pointer can be used. Most common confusion is probably:&lt;br /&gt;&lt;br /&gt;Is it safe to use 'this' in the constructor?&lt;br /&gt;&lt;br /&gt;Having the confusion, many amateurs avoid using 'this' pointer in constructor. Well, such confusion is harmful for the programmer, project and the company funding the project.&lt;br /&gt;&lt;br /&gt;The short answer to the question is: yes, 'this' is very safe in the constructor. All members (or objects) derived (from parent class in case of inheritance) and defined in the class 'will be' allocated and initialized before the constructor gets executed. So you can safely access the members of the class in the constructor.&lt;br /&gt;&lt;br /&gt;Now, that was a short answer. For a comprehensive one, we need to discuss in what order objects are created and destroyed and how to use the RAII (Resource Acquisition Is Initialization) idiom. I'll try to make this the topic of my next post.&lt;br /&gt;&lt;br /&gt;For a brief discussion on how objects are initialized, you can read this post:&lt;br /&gt;&lt;a href="http://kaisar-haque.blogspot.com/2008/06/c-avoid-using-assignments-in.html"&gt;http://kaisar-haque.blogspot.com/2008/06/c-avoid-using-assignments-in.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Talking about 'this' reminds me of the 'suicidal code'. Six years ago, I have seen the following use of 'this' in a very important server component:&lt;br /&gt;&lt;br /&gt;//now commit suicide&lt;br /&gt;delete this;&lt;br /&gt;&lt;br /&gt;Needless to say that's an architectural disaster. Many of the times we see such disasters in codes of fresh grades. A good way to avoid this is to train your new team mates on idioms like RAII.&lt;br /&gt;&lt;br /&gt;Stay tuned for my next post :).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6487100581508098433-3768831684362065316?l=kaisar-haque.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kaisar-haque.blogspot.com/feeds/3768831684362065316/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6487100581508098433&amp;postID=3768831684362065316' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/3768831684362065316'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/3768831684362065316'/><link rel='alternate' type='text/html' href='http://kaisar-haque.blogspot.com/2011/04/c-is-this-safe-in-constructor.html' title='C++: Is &apos;this&apos; safe in the constructor?'/><author><name>RoboSmith</name><uri>http://www.blogger.com/profile/07878693490452605144</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6487100581508098433.post-3591475220066633927</id><published>2011-04-15T15:02:00.000-07:00</published><updated>2011-04-15T16:02:35.008-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='c++'/><title type='text'>C++ is not C</title><content type='html'>C++ compilers (g++ or visual c++ for example) can compile many C codes, but not necessarily all of them. Here is a simple but lame example:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt; &lt;span style="color:Blue;"&gt;class&lt;/span&gt;, &lt;span style="color:Blue;"&gt;template&lt;/span&gt;;&lt;/pre&gt;&lt;br /&gt;Above code compiles fine with a C code but not with C++, as 'class' and 'template' are keywords in C++. But again, it's really a lame example.&lt;br /&gt;&lt;br /&gt;A good example is the feature set of C99. Here are some codes that are valid in C but not in C++:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;font color='Blue'&gt;int&lt;/font&gt; vec[&lt;font color='Maroon'&gt;5&lt;/font&gt;] = { [&lt;font color='Maroon'&gt;1&lt;/font&gt;]=&lt;font color='Maroon'&gt;10&lt;/font&gt;, [&lt;font color='Maroon'&gt;3&lt;/font&gt;]=&lt;font color='Maroon'&gt;20&lt;/font&gt; }; &lt;font color='Green'&gt;// designated initializers&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;&lt;font color='Blue'&gt;typedef&lt;/font&gt; &lt;font color='Blue'&gt;struct&lt;/font&gt;&lt;br /&gt;{&lt;br /&gt;    &lt;font color='Blue'&gt;char&lt;/font&gt; name[&lt;font color='Maroon'&gt;20&lt;/font&gt;];&lt;br /&gt;    &lt;font color='Blue'&gt;int&lt;/font&gt; ID;&lt;br /&gt;    &lt;font color='Blue'&gt;int&lt;/font&gt; age;&lt;br /&gt;}Employee;&lt;br /&gt;&lt;br /&gt;Employee emp = {.ID = &lt;font color='Maroon'&gt;0&lt;/font&gt;, .age = &lt;font color='Maroon'&gt;0&lt;/font&gt;};&lt;br /&gt;&lt;br /&gt;&lt;font color='Blue'&gt;int&lt;/font&gt; main()&lt;br /&gt;{&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The reason for not having the support for the C99 code in some major C++ compilers is that C++ was standardized in 98 and C99 standards came after that.&lt;br /&gt;&lt;br /&gt;Will try to post more on this later.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6487100581508098433-3591475220066633927?l=kaisar-haque.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kaisar-haque.blogspot.com/feeds/3591475220066633927/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6487100581508098433&amp;postID=3591475220066633927' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/3591475220066633927'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/3591475220066633927'/><link rel='alternate' type='text/html' href='http://kaisar-haque.blogspot.com/2011/04/c-is-not-c.html' title='C++ is not C'/><author><name>RoboSmith</name><uri>http://www.blogger.com/profile/07878693490452605144</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6487100581508098433.post-5085013471244408791</id><published>2011-04-15T15:00:00.000-07:00</published><updated>2011-04-15T16:03:03.617-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='visual studio'/><category scheme='http://www.blogger.com/atom/ns#' term='c++'/><title type='text'>C++: WorldLight</title><content type='html'>WordLight is a nice little add-in for Visual Studio 2008. When you select some text in the editor, it searches and highlights the same string in rest of the code.&lt;br /&gt;&lt;br /&gt;URL: &lt;a href="http://code.google.com/p/wordlight/"&gt;http://code.google.com/p/wordlight/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;If you have VisualAssist, you may not need this. Otherwise, you'll enjoy this add-in.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6487100581508098433-5085013471244408791?l=kaisar-haque.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kaisar-haque.blogspot.com/feeds/5085013471244408791/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6487100581508098433&amp;postID=5085013471244408791' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/5085013471244408791'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/5085013471244408791'/><link rel='alternate' type='text/html' href='http://kaisar-haque.blogspot.com/2011/04/worldlight.html' title='C++: WorldLight'/><author><name>RoboSmith</name><uri>http://www.blogger.com/profile/07878693490452605144</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6487100581508098433.post-7300169130691894574</id><published>2011-04-15T14:56:00.000-07:00</published><updated>2011-04-17T14:53:00.554-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tools'/><title type='text'>Windows Directory Statistics</title><content type='html'>The terabytes of hard drives in the market rarely makes us concerned about disk space utilization. However we don't get that luxury for solid state drives. I was running out of disk space with the 128 GB SSD in my work PC and needed to clean up a bit. This tool helped me to do that better.&lt;br /&gt;&lt;br /&gt;Windows Directory Statistics&lt;br /&gt;URL: &lt;a href="http://sourceforge.net/projects/windirstat"&gt;http://sourceforge.net/projects/windirstat&lt;/a&gt;/&lt;br /&gt;&lt;br /&gt;It helps you to understand disk utilization and clean up space more easily. It shows disk, file and directory sizes in a treelist as well as graphically in a treemap.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6487100581508098433-7300169130691894574?l=kaisar-haque.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kaisar-haque.blogspot.com/feeds/7300169130691894574/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6487100581508098433&amp;postID=7300169130691894574' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/7300169130691894574'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/7300169130691894574'/><link rel='alternate' type='text/html' href='http://kaisar-haque.blogspot.com/2011/04/windows-directory-statistics.html' title='Windows Directory Statistics'/><author><name>RoboSmith</name><uri>http://www.blogger.com/profile/07878693490452605144</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6487100581508098433.post-4946681324412867198</id><published>2010-06-21T04:17:00.000-07:00</published><updated>2011-04-15T15:54:47.130-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='c++'/><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><title type='text'>C++: Convert string to int or vice-versa</title><content type='html'>strinstream is very useful for many basic jobs with strings, for example parsing numeric data from a string, converting a string to int/float, converting int/float to string, etc.&lt;br /&gt;&lt;br /&gt;Here goes examples of how to use stringstream to convert to and from strings.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;#&lt;span style="color:Blue;"&gt;include&lt;/span&gt; &amp;lt;&lt;span style="color:Blue;"&gt;iostream&lt;/span&gt;&amp;gt;&lt;br /&gt;#&lt;span style="color:Blue;"&gt;include&lt;/span&gt; &amp;lt;sstream&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:Blue;"&gt;using&lt;/span&gt; &lt;span style="color:Blue;"&gt;namespace&lt;/span&gt; &lt;span style="color:Blue;"&gt;std&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt; main()&lt;br /&gt;{&lt;br /&gt;   stringstream ss;&lt;br /&gt;   &lt;span style="color:Blue;"&gt;string&lt;/span&gt; s;&lt;br /&gt;   &lt;span style="color:Blue;"&gt;int&lt;/span&gt; n;&lt;br /&gt;&lt;br /&gt;   &lt;span style="color:Green;"&gt;//to convert int to string&lt;/span&gt;&lt;br /&gt;   n = &lt;span style="color:Maroon;"&gt;1024&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;   ss.clear();&lt;br /&gt;   ss &amp;lt;&amp;lt; n;        &lt;span style="color:Green;"&gt;//write the int to stringstream&lt;/span&gt;&lt;br /&gt;   ss &amp;gt;&amp;gt; s;        &lt;span style="color:Green;"&gt;//read back the value as a string&lt;/span&gt;&lt;br /&gt;   &lt;span style="color:Blue;"&gt;cout&lt;/span&gt; &amp;lt;&amp;lt; &lt;span style="color:Maroon;"&gt;"string value: "&lt;/span&gt; &amp;lt;&amp;lt; s &amp;lt;&amp;lt; &lt;span style="color:Blue;"&gt;endl&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;   &lt;span style="color:Green;"&gt;//to convert int to string&lt;/span&gt;&lt;br /&gt;   s = &lt;span style="color:Maroon;"&gt;"2048"&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;   ss.clear();&lt;br /&gt;   ss &amp;lt;&amp;lt; s;        &lt;span style="color:Green;"&gt;//write the string to stringstream&lt;/span&gt;&lt;br /&gt;   ss &amp;gt;&amp;gt; n;        &lt;span style="color:Green;"&gt;//read back the value as an int&lt;/span&gt;&lt;br /&gt;   &lt;span style="color:Blue;"&gt;cout&lt;/span&gt; &amp;lt;&amp;lt; &lt;span style="color:Maroon;"&gt;"int value: "&lt;/span&gt; &amp;lt;&amp;lt; n &amp;lt;&amp;lt; &lt;span style="color:Blue;"&gt;endl&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Have fun!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6487100581508098433-4946681324412867198?l=kaisar-haque.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kaisar-haque.blogspot.com/feeds/4946681324412867198/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6487100581508098433&amp;postID=4946681324412867198' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/4946681324412867198'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/4946681324412867198'/><link rel='alternate' type='text/html' href='http://kaisar-haque.blogspot.com/2010/06/c-example-convert-string-to-int-or-vice.html' title='C++: Convert string to int or vice-versa'/><author><name>RoboSmith</name><uri>http://www.blogger.com/profile/07878693490452605144</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6487100581508098433.post-1939431140506564451</id><published>2010-06-21T02:38:00.000-07:00</published><updated>2010-06-21T03:21:23.663-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='c++'/><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><title type='text'>C++: Failed Conditions</title><content type='html'>At ReliSource, we used to have a mailing list called CPP in which we submitted C/C++ related facts/questions (and solutions). I'll share some of those facts/questions in my blog.&lt;br /&gt;&lt;br /&gt;Here goes a quick C/C++ problem that I'm sure you will find interesting.&lt;br /&gt;&lt;br /&gt;// x is a numeric variable (of built in/intrinsic data type).&lt;br /&gt;&lt;br /&gt;if (x &gt; 10)&lt;br /&gt;{&lt;br /&gt;                  cout &lt;&lt; "x is &gt; 10\n";&lt;br /&gt;}&lt;br /&gt;else if (x &lt;= 10)&lt;br /&gt;{&lt;br /&gt;                  cout &lt;&lt; "x is &lt;= 10\n";&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;For some reason, the program didn't output anything, none of the if or else-if was executed. What can be the reason?&lt;br /&gt;&lt;br /&gt;You shall find the answer in the comments after a week of this post (if someone already doesn't answer it).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6487100581508098433-1939431140506564451?l=kaisar-haque.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kaisar-haque.blogspot.com/feeds/1939431140506564451/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6487100581508098433&amp;postID=1939431140506564451' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/1939431140506564451'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/1939431140506564451'/><link rel='alternate' type='text/html' href='http://kaisar-haque.blogspot.com/2010/06/c-failed-conditions.html' title='C++: Failed Conditions'/><author><name>RoboSmith</name><uri>http://www.blogger.com/profile/07878693490452605144</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6487100581508098433.post-356752117841480206</id><published>2010-02-11T22:15:00.000-08:00</published><updated>2010-02-11T22:22:58.362-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='c++'/><category scheme='http://www.blogger.com/atom/ns#' term='project management'/><title type='text'>An excellent article on interviewing</title><content type='html'>Following is an excellent article on interviewing:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.joelonsoftware.com/articles/GuerrillaInterviewing3.html"&gt;http://www.joelonsoftware.com/articles/GuerrillaInterviewing3.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;A colleague of mine referred to this article while we were discussing how to improve our interview process. It's a long one but quite worth reading. I felt like these are the words of my mind.&lt;br /&gt;&lt;br /&gt;Following are some excerpts for those who are feeling lazy and/or busy :).&lt;br /&gt;&lt;br /&gt;===Excerpts start===&lt;br /&gt;&lt;br /&gt;You’re going to see three types of people in your interviews. At one end of the scale, there are the unwashed masses, lacking even the most basic skills for this job. They are easy to ferret out and eliminate, often just by asking two or three quick questions. At the other extreme you’ve got your brilliant superstars who write lisp compilers for fun, in a weekend, in Assembler for the Nintendo DS. And in the middle, you have a large number of “maybes” who seem like they might just be able to contribute something. The trick is telling the difference between the superstars and the maybes, because the secret is that you don’t want to hire any of the maybes. Ever.&lt;br /&gt;&lt;br /&gt;---&lt;br /&gt;&lt;br /&gt;How do you detect smart in an interview? The first good sign is that you don’t have to explain things over and over again. The conversation just flows. Often, the candidate says something that shows real insight, or brains, or mental acuity. So an important part of the interview is creating a situation where someone can show you how smart they are.&lt;br /&gt;&lt;br /&gt;---&lt;br /&gt;&lt;br /&gt;The worst kind of interviewer is the blowhard. That’s the kind who blabs the whole time and barely leaves the candidate time to say, “yes, that’s so true, I couldn’t agree with you more.” Blowhards hire everyone; they think that the candidate must be smart because “he thinks so much like me!”&lt;br /&gt;&lt;br /&gt;The second worst kind of interviewer is the Quiz Show Interviewer. This is the kind of person who thinks that smart means “knows a lot of facts.” They just ask a bunch of trivia questions about programming and give points for correct answers. Just for fun, here is the worst interview question on Earth: “What’s the difference between varchar and varchar2 in Oracle 8i?” This is a terrible question. There is no possible, imaginable correlation between people that know that particular piece of trivia and people that you want to hire. Who cares what the difference is? You can find out online in about fifteen seconds!&lt;br /&gt;&lt;br /&gt;----&lt;br /&gt;&lt;br /&gt;What should you look for during the open ended questions?&lt;br /&gt;One: Look for passion. Smart people are passionate about the projects they work on. They get very excited talking about the subject. They talk quickly, and get animated.&lt;br /&gt;&lt;br /&gt;---&lt;br /&gt;&lt;br /&gt;These softball questions seem too easy, so when I first started asking them, I had to admit that I really expected everyone to sail right through them. What I discovered was that everybody solved the problem, but there was a lot of variation in how long it took them to solve.&lt;br /&gt;&lt;br /&gt;---&lt;br /&gt;&lt;br /&gt;Serge Lang, a math professor at Yale, used to give his Calculus students a fairly simple algebra problem on the first day of classes, one which almost everyone could solve, but some of them solved it as quickly as they could write while others took a while, and Professor Lang claimed that all of the students who solved the problem as quickly as they could write would get an A in the Calculus course, and all the others wouldn’t. The speed with which they solved a simple algebra problem was as good a predictor of the final grade in Calculus as a whole semester of homework, tests, midterms, and a final.&lt;br /&gt;&lt;br /&gt;You see, if you can’t whiz through the easy stuff at 100 m.p.h., you’re never gonna get the advanced stuff.&lt;br /&gt;&lt;br /&gt;---&lt;br /&gt;&lt;br /&gt;15 years of experience interviewing programmers has convinced me that the best programmers all have an easy aptitude for dealing with multiple levels of abstraction simultaneously. In programming, that means specifically that they have no problem with recursion (which involves holding in your head multiple levels of the call stack at the same time) or complex pointer-based algorithms (where the address of an object is sort of like an abstract representation of the object itself).&lt;br /&gt;&lt;br /&gt;I’ve come to realize that understanding pointers in C is not a skill, it’s an aptitude. In first year computer science classes, there are always about 200 kids at the beginning of the semester, all of whom wrote complex adventure games in BASIC for their PCs when they were 4 years old. They are having a good ol’ time learning C or Pascal in college, until one day they professor introduces pointers, and suddenly, they don’t get it. They just don’t understand anything any more.&lt;br /&gt;&lt;br /&gt;For some reason most people seem to be born without the part of the brain that understands pointers. Pointers require a complex form of doubly-indirected thinking that some people just can’t do, and it’s pretty crucial to good programming.&lt;br /&gt;&lt;br /&gt;---&lt;br /&gt;&lt;br /&gt;A lot of the “script jocks” who started programming by copying JavaScript snippets into their web pages and went on to learn Perl never learned about pointers, and they can never quite produce code of the quality you need.&lt;br /&gt;&lt;br /&gt;---&lt;br /&gt;&lt;br /&gt;Sadly, despite the fact that I think that all good programmers should be able to handle recursion and pointers, and that this is an excellent way to tell if someone is a good programmer, the truth is that these days, programming languages have almost completely made that specific art unnecessary.&lt;br /&gt;&lt;br /&gt;---&lt;br /&gt;&lt;br /&gt;A lot of programmers that you might interview these days are apt to consider recursion, pointers, and even data structures to be a silly implementation detail which has been abstracted away by today’s many happy programming languages. “When was the last time you had to write a sorting algorithm?” they snicker.&lt;br /&gt;&lt;br /&gt;Still, I don’t really care. I want my ER doctor to understand anatomy, even if all she has to do is put the computerized defibrillator nodes on my chest and push the big red button, and I want programmers to know programming down to the CPU level, even if Ruby on Rails does read your mind and build a complete Web 2.0 social collaborative networking site for you with three clicks of the mouse.&lt;br /&gt;&lt;br /&gt;===end===&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6487100581508098433-356752117841480206?l=kaisar-haque.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kaisar-haque.blogspot.com/feeds/356752117841480206/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6487100581508098433&amp;postID=356752117841480206' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/356752117841480206'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/356752117841480206'/><link rel='alternate' type='text/html' href='http://kaisar-haque.blogspot.com/2010/02/excellent-article-on-interviewing.html' title='An excellent article on interviewing'/><author><name>RoboSmith</name><uri>http://www.blogger.com/profile/07878693490452605144</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6487100581508098433.post-7939812509638420447</id><published>2009-09-07T03:35:00.000-07:00</published><updated>2009-09-07T04:00:02.054-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mobile applications'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>Maemo 5 - Linux at the core of next generation mobile OS</title><content type='html'>It's been long since I felt excited about any new mobile OS. Maemo 5 seems to be a very promising mobile OS for the next generation of mobile devices.&lt;br /&gt;&lt;br /&gt;Multiple desktops, multitasking, Mozilla based browser, desktop widgets, cool UI, speed all seems to be best of what other OS has to offer. And guess what, it runs on Linux. The Symbian OS 9.4, Windows Mobile 6.5 or iPhone OS 3.. all seem to be moving ahead somewhat slowly. Comparing to them, Maemo 5 seems to be a leap ahead. It seems to be the next best thing after iPhone OS 1 came out thousands of years ago :).&lt;br /&gt;&lt;br /&gt;Nokia will release N900 in a few months, the company's first phone running on Maemo 5. N900 itself has good spec with 600 MHz ARM processor, 256 MB RAM, 32 GB ROM, high-end cam, etc.&lt;br /&gt;&lt;br /&gt;You can check more about Maemo at: &lt;a href="http://maemo.nokia.com/"&gt;http://maemo.nokia.com/&lt;/a&gt; and more about N900 at &lt;a href="http://maemo.nokia.com/n900/"&gt;http://maemo.nokia.com/n900/&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6487100581508098433-7939812509638420447?l=kaisar-haque.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kaisar-haque.blogspot.com/feeds/7939812509638420447/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6487100581508098433&amp;postID=7939812509638420447' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/7939812509638420447'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/7939812509638420447'/><link rel='alternate' type='text/html' href='http://kaisar-haque.blogspot.com/2009/09/maemo-5-linux-at-core-of-next.html' title='Maemo 5 - Linux at the core of next generation mobile OS'/><author><name>RoboSmith</name><uri>http://www.blogger.com/profile/07878693490452605144</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6487100581508098433.post-799417604480070593</id><published>2009-02-18T12:12:00.000-08:00</published><updated>2009-02-18T13:07:57.568-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='c++'/><title type='text'>C++: Pointer to members</title><content type='html'>Pointer to member operators are not an everyday operators that we use but those can be useful if used in the correct way. Pointer to member operator ::* is used to declare a pointer that points to a member variable, pointer or function of a class. The operators .* and -&gt;* are used to access it.&lt;br /&gt;&lt;br /&gt;Following is an example of how we can use Pointer to member function (also called member function pointer).&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;span style="color:Teal;"&gt;  1 &lt;/span&gt;#&lt;span style="color:Blue;"&gt;include&lt;/span&gt; &lt;&lt;span style="color:Blue;"&gt;iostream&lt;/span&gt;&gt;&lt;br /&gt;&lt;span style="color:Teal;"&gt;  2 &lt;/span&gt;&lt;span style="color:Blue;"&gt;using&lt;/span&gt; &lt;span style="color:Blue;"&gt;namespace&lt;/span&gt; &lt;span style="color:Blue;"&gt;std&lt;/span&gt;;&lt;br /&gt;&lt;span style="color:Teal;"&gt;  3 &lt;/span&gt;&lt;br /&gt;&lt;span style="color:Teal;"&gt;  4 &lt;/span&gt;&lt;span style="color:Blue;"&gt;class&lt;/span&gt; A{&lt;br /&gt;&lt;span style="color:Teal;"&gt;  5 &lt;/span&gt;&lt;span style="color:Blue;"&gt;public&lt;/span&gt;:&lt;br /&gt;&lt;span style="color:Teal;"&gt;  6 &lt;/span&gt;      A(){&lt;br /&gt;&lt;span style="color:Teal;"&gt;  7 &lt;/span&gt;      }&lt;br /&gt;&lt;span style="color:Teal;"&gt;  8 &lt;/span&gt;      &lt;span style="color:Blue;"&gt;int&lt;/span&gt; Func(&lt;span style="color:Blue;"&gt;int&lt;/span&gt; a){&lt;br /&gt;&lt;span style="color:Teal;"&gt;  9 &lt;/span&gt;              &lt;span style="color:Blue;"&gt;return&lt;/span&gt; a * &lt;span style="color:Maroon;"&gt;2&lt;/span&gt;;&lt;br /&gt;&lt;span style="color:Teal;"&gt; 10 &lt;/span&gt;      }&lt;br /&gt;&lt;span style="color:Teal;"&gt; 11 &lt;/span&gt;&lt;br /&gt;&lt;span style="color:Teal;"&gt; 12 &lt;/span&gt;};&lt;br /&gt;&lt;span style="color:Teal;"&gt; 13 &lt;/span&gt;&lt;br /&gt;&lt;span style="color:Teal;"&gt; 14 &lt;/span&gt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt; main(){&lt;br /&gt;&lt;span style="color:Teal;"&gt; 15 &lt;/span&gt;      &lt;span style="color:Blue;"&gt;int&lt;/span&gt; (A::*fp)(&lt;span style="color:Blue;"&gt;int&lt;/span&gt;) = &amp;amp;A::Func;&lt;br /&gt;&lt;span style="color:Teal;"&gt; 16 &lt;/span&gt;&lt;br /&gt;&lt;span style="color:Teal;"&gt; 17 &lt;/span&gt;      A a;&lt;br /&gt;&lt;span style="color:Teal;"&gt; 18 &lt;/span&gt;      &lt;span style="color:Blue;"&gt;cout&lt;/span&gt; &lt;&lt; (a.*fp)(&lt;span style="color:Maroon;"&gt;10&lt;/span&gt;) &lt;&lt; &lt;span style="color:Blue;"&gt;endl&lt;/span&gt;;&lt;br /&gt;&lt;span style="color:Teal;"&gt; 19 &lt;/span&gt;&lt;br /&gt;&lt;span style="color:Teal;"&gt; 20 &lt;/span&gt;      &lt;span style="color:Blue;"&gt;return&lt;/span&gt; &lt;span style="color:Maroon;"&gt;0&lt;/span&gt;;&lt;br /&gt;&lt;span style="color:Teal;"&gt; 21 &lt;/span&gt;}&lt;br /&gt;&lt;span style="color:Teal;"&gt; 22&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;Following is another (almost random) example of how we can write generic classes to wrap pointer to member function to use with multiple classes.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;span style="color:Teal;"&gt;  1 &lt;/span&gt;#&lt;span style="color:Blue;"&gt;include&lt;/span&gt; &amp;lt;&lt;span style="color:Blue;"&gt;iostream&lt;/span&gt;&amp;gt;&lt;br /&gt;&lt;span style="color:Teal;"&gt;  2 &lt;/span&gt;&lt;span style="color:Blue;"&gt;using&lt;/span&gt; &lt;span style="color:Blue;"&gt;namespace&lt;/span&gt; &lt;span style="color:Blue;"&gt;std&lt;/span&gt;;&lt;br /&gt;&lt;span style="color:Teal;"&gt;  3 &lt;/span&gt;&lt;br /&gt;&lt;span style="color:Teal;"&gt;  4 &lt;/span&gt;&lt;span style="color:Blue;"&gt;class&lt;/span&gt; A{&lt;br /&gt;&lt;span style="color:Teal;"&gt;  5 &lt;/span&gt;&lt;span style="color:Blue;"&gt;public&lt;/span&gt;:&lt;br /&gt;&lt;span style="color:Teal;"&gt;  6 &lt;/span&gt;      &lt;span style="color:Blue;"&gt;int&lt;/span&gt; Func1(&lt;span style="color:Blue;"&gt;int&lt;/span&gt; a){&lt;br /&gt;&lt;span style="color:Teal;"&gt;  7 &lt;/span&gt;              &lt;span style="color:Blue;"&gt;return&lt;/span&gt; a * &lt;span style="color:Maroon;"&gt;2&lt;/span&gt;;&lt;br /&gt;&lt;span style="color:Teal;"&gt;  8 &lt;/span&gt;      }&lt;br /&gt;&lt;span style="color:Teal;"&gt;  9 &lt;/span&gt;&lt;br /&gt;&lt;span style="color:Teal;"&gt; 10 &lt;/span&gt;};&lt;br /&gt;&lt;span style="color:Teal;"&gt; 11 &lt;/span&gt;&lt;br /&gt;&lt;span style="color:Teal;"&gt; 12 &lt;/span&gt;&lt;span style="color:Blue;"&gt;class&lt;/span&gt; B{&lt;br /&gt;&lt;span style="color:Teal;"&gt; 13 &lt;/span&gt;&lt;span style="color:Blue;"&gt;public&lt;/span&gt;:&lt;br /&gt;&lt;span style="color:Teal;"&gt; 14 &lt;/span&gt;      &lt;span style="color:Blue;"&gt;int&lt;/span&gt; Func2(&lt;span style="color:Blue;"&gt;int&lt;/span&gt; a){&lt;br /&gt;&lt;span style="color:Teal;"&gt; 15 &lt;/span&gt;              &lt;span style="color:Blue;"&gt;return&lt;/span&gt; a / &lt;span style="color:Maroon;"&gt;2&lt;/span&gt;;&lt;br /&gt;&lt;span style="color:Teal;"&gt; 16 &lt;/span&gt;      }&lt;br /&gt;&lt;span style="color:Teal;"&gt; 17 &lt;/span&gt;&lt;br /&gt;&lt;span style="color:Teal;"&gt; 18 &lt;/span&gt;};&lt;br /&gt;&lt;span style="color:Teal;"&gt; 19 &lt;/span&gt;&lt;br /&gt;&lt;span style="color:Teal;"&gt; 20 &lt;/span&gt;&lt;span style="color:Blue;"&gt;template&lt;/span&gt; &amp;lt;&lt;span style="color:Blue;"&gt;class&lt;/span&gt; T&amp;gt;&lt;br /&gt;&lt;span style="color:Teal;"&gt; 21 &lt;/span&gt;&lt;span style="color:Blue;"&gt;class&lt;/span&gt; MemFnPtr&lt;br /&gt;&lt;span style="color:Teal;"&gt; 22 &lt;/span&gt;{&lt;br /&gt;&lt;span style="color:Teal;"&gt; 23 &lt;/span&gt;&lt;span style="color:Blue;"&gt;public&lt;/span&gt;:&lt;br /&gt;&lt;span style="color:Teal;"&gt; 24 &lt;/span&gt;      MemFnPtr(&lt;span style="color:Blue;"&gt;int&lt;/span&gt; (T::*fp)(&lt;span style="color:Blue;"&gt;int&lt;/span&gt;), T &amp;amp;t) : m_fp(fp), m_t(t){&lt;br /&gt;&lt;span style="color:Teal;"&gt; 25 &lt;/span&gt;      }&lt;br /&gt;&lt;span style="color:Teal;"&gt; 26 &lt;/span&gt;      &lt;span style="color:Blue;"&gt;int&lt;/span&gt; Fn(&lt;span style="color:Blue;"&gt;int&lt;/span&gt; n)&lt;br /&gt;&lt;span style="color:Teal;"&gt; 27 &lt;/span&gt;      {&lt;br /&gt;&lt;span style="color:Teal;"&gt; 28 &lt;/span&gt;            &lt;span style="color:Blue;"&gt;return&lt;/span&gt; ((m_t).*(m_fp))(n);&lt;br /&gt;&lt;span style="color:Teal;"&gt; 29 &lt;/span&gt;      }&lt;br /&gt;&lt;span style="color:Teal;"&gt; 30 &lt;/span&gt; &lt;br /&gt;&lt;span style="color:Teal;"&gt; 31 &lt;/span&gt;      &lt;span style="color:Green;"&gt;//member vars&lt;/span&gt;&lt;br /&gt;&lt;span style="color:Teal;"&gt; 32 &lt;/span&gt;      &lt;span style="color:Blue;"&gt;int&lt;/span&gt; (T::*m_fp)(&lt;span style="color:Blue;"&gt;int&lt;/span&gt;);&lt;br /&gt;&lt;span style="color:Teal;"&gt; 33 &lt;/span&gt;      T &amp;amp;m_t;&lt;br /&gt;&lt;span style="color:Teal;"&gt; 34 &lt;/span&gt;};&lt;br /&gt;&lt;span style="color:Teal;"&gt; 35 &lt;/span&gt;&lt;br /&gt;&lt;span style="color:Teal;"&gt; 36 &lt;/span&gt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt; main(){&lt;br /&gt;&lt;span style="color:Teal;"&gt; 37 &lt;/span&gt;      A a_obj;&lt;br /&gt;&lt;span style="color:Teal;"&gt; 38 &lt;/span&gt; &lt;br /&gt;&lt;span style="color:Teal;"&gt; 39 &lt;/span&gt;      MemFnPtr&amp;lt;A&amp;gt; fp_a(&amp;amp;A::Func1, a_obj);&lt;br /&gt;&lt;span style="color:Teal;"&gt; 40 &lt;/span&gt;      &lt;span style="color:Blue;"&gt;cout&lt;/span&gt; &amp;lt;&amp;lt; fp_a.Fn(&lt;span style="color:Maroon;"&gt;10&lt;/span&gt;) &amp;lt;&amp;lt; &lt;span style="color:Blue;"&gt;endl&lt;/span&gt;;&lt;br /&gt;&lt;span style="color:Teal;"&gt; 41 &lt;/span&gt;&lt;br /&gt;&lt;span style="color:Teal;"&gt; 42 &lt;/span&gt;      B b_obj;&lt;br /&gt;&lt;span style="color:Teal;"&gt; 43 &lt;/span&gt;&lt;br /&gt;&lt;span style="color:Teal;"&gt; 44 &lt;/span&gt;      MemFnPtr&amp;lt;B&amp;gt; fp_b(&amp;amp;B::Func2, b_obj);&lt;br /&gt;&lt;span style="color:Teal;"&gt; 45 &lt;/span&gt;      &lt;span style="color:Blue;"&gt;cout&lt;/span&gt; &amp;lt;&amp;lt; fp_b.Fn(&lt;span style="color:Maroon;"&gt;10&lt;/span&gt;) &amp;lt;&amp;lt; &lt;span style="color:Blue;"&gt;endl&lt;/span&gt;;&lt;br /&gt;&lt;span style="color:Teal;"&gt; 46 &lt;/span&gt;&lt;br /&gt;&lt;span style="color:Teal;"&gt; 47 &lt;/span&gt;      &lt;span style="color:Blue;"&gt;return&lt;/span&gt; &lt;span style="color:Maroon;"&gt;0&lt;/span&gt;;&lt;br /&gt;&lt;span style="color:Teal;"&gt; 48 &lt;/span&gt;}&lt;br /&gt;&lt;span style="color:Teal;"&gt; 49 &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6487100581508098433-799417604480070593?l=kaisar-haque.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kaisar-haque.blogspot.com/feeds/799417604480070593/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6487100581508098433&amp;postID=799417604480070593' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/799417604480070593'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/799417604480070593'/><link rel='alternate' type='text/html' href='http://kaisar-haque.blogspot.com/2009/02/c-pointer-to-member-function-operator.html' title='C++: Pointer to members'/><author><name>RoboSmith</name><uri>http://www.blogger.com/profile/07878693490452605144</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6487100581508098433.post-4861800903919914354</id><published>2009-02-18T10:43:00.000-08:00</published><updated>2009-02-18T12:10:45.388-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='c++'/><title type='text'>C++ Problem: Define that macro</title><content type='html'>I'm planning to post some C++ programming problems that I come across and shall post their solutions too (I'll try to post multiple solutions). Here goes the first one:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Problem:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;DO_REPORTING is MACRO which when called at the start of a function with appropriate parameter, prints the value of the parameter at the start of the function and also somehow prints the value before leaving the function. For the following code expected output would be:&lt;br /&gt;&lt;br /&gt;Before:2&lt;br /&gt;After:4&lt;br /&gt;Before:4&lt;br /&gt;After:2&lt;br /&gt;&lt;br /&gt;How would you get this output without changing anything in class A and inside main function?&lt;br /&gt;&lt;pre&gt;&lt;span style="color:Teal;"&gt;  1 &lt;/span&gt;#&lt;span style="color:Blue;"&gt;include&lt;/span&gt; &amp;lt;&lt;span style="color:Blue;"&gt;iostream&lt;/span&gt;&amp;gt;&lt;br /&gt;&lt;span style="color:Teal;"&gt;  2 &lt;/span&gt;&lt;span style="color:Blue;"&gt;using&lt;/span&gt; &lt;span style="color:Blue;"&gt;namespace&lt;/span&gt; &lt;span style="color:Blue;"&gt;std&lt;/span&gt;;&lt;br /&gt;&lt;span style="color:Teal;"&gt;  3 &lt;/span&gt;&lt;br /&gt;&lt;span style="color:Teal;"&gt;  4 &lt;/span&gt;&lt;span style="color:Blue;"&gt;#define&lt;/span&gt; DO_REPORTING(type,variable) ;&lt;br /&gt;&lt;span style="color:Teal;"&gt;  5 &lt;/span&gt;&lt;br /&gt;&lt;span style="color:Teal;"&gt;  6 &lt;/span&gt;&lt;span style="color:Blue;"&gt;class&lt;/span&gt; A{&lt;br /&gt;&lt;span style="color:Teal;"&gt;  7 &lt;/span&gt;&lt;span style="color:Blue;"&gt;protected&lt;/span&gt;:&lt;br /&gt;&lt;span style="color:Teal;"&gt;  8 &lt;/span&gt;      &lt;span style="color:Blue;"&gt;int&lt;/span&gt; val;&lt;br /&gt;&lt;span style="color:Teal;"&gt;  9 &lt;/span&gt;&lt;span style="color:Blue;"&gt;public&lt;/span&gt;:&lt;br /&gt;&lt;span style="color:Teal;"&gt; 10 &lt;/span&gt;      A(&lt;span style="color:Blue;"&gt;int&lt;/span&gt; v){&lt;br /&gt;&lt;span style="color:Teal;"&gt; 11 &lt;/span&gt;            val = v;&lt;br /&gt;&lt;span style="color:Teal;"&gt; 12 &lt;/span&gt;      }&lt;br /&gt;&lt;span style="color:Teal;"&gt; 13 &lt;/span&gt;      &lt;span style="color:Blue;"&gt;void&lt;/span&gt; FuncMult(){&lt;br /&gt;&lt;span style="color:Teal;"&gt; 14 &lt;/span&gt;            DO_REPORTING(&lt;span style="color:Blue;"&gt;int&lt;/span&gt;, val);&lt;br /&gt;&lt;span style="color:Teal;"&gt; 15 &lt;/span&gt;            val *= &lt;span style="color:Maroon;"&gt;2&lt;/span&gt;;&lt;br /&gt;&lt;span style="color:Teal;"&gt; 16 &lt;/span&gt;      }&lt;br /&gt;&lt;span style="color:Teal;"&gt; 17 &lt;/span&gt;      &lt;span style="color:Blue;"&gt;void&lt;/span&gt; FuncDiv(){&lt;br /&gt;&lt;span style="color:Teal;"&gt; 18 &lt;/span&gt;            DO_REPORTING(&lt;span style="color:Blue;"&gt;int&lt;/span&gt;, val);&lt;br /&gt;&lt;span style="color:Teal;"&gt; 19 &lt;/span&gt;            val /= &lt;span style="color:Maroon;"&gt;2&lt;/span&gt;;&lt;br /&gt;&lt;span style="color:Teal;"&gt; 20 &lt;/span&gt;      }&lt;br /&gt;&lt;span style="color:Teal;"&gt; 21 &lt;/span&gt;      &lt;span style="color:Blue;"&gt;int&lt;/span&gt; GetVal(){&lt;br /&gt;&lt;span style="color:Teal;"&gt; 22 &lt;/span&gt;            &lt;span style="color:Blue;"&gt;return&lt;/span&gt; val;&lt;br /&gt;&lt;span style="color:Teal;"&gt; 23 &lt;/span&gt;      }&lt;br /&gt;&lt;span style="color:Teal;"&gt; 24 &lt;/span&gt;};&lt;br /&gt;&lt;span style="color:Teal;"&gt; 25 &lt;/span&gt;&lt;br /&gt;&lt;span style="color:Teal;"&gt; 26 &lt;/span&gt;&lt;span style="color:Blue;"&gt;int&lt;/span&gt; main(){&lt;br /&gt;&lt;span style="color:Teal;"&gt; 27 &lt;/span&gt;      A a(&lt;span style="color:Maroon;"&gt;2&lt;/span&gt;);&lt;br /&gt;&lt;span style="color:Teal;"&gt; 28 &lt;/span&gt;      a.FuncMult();&lt;br /&gt;&lt;span style="color:Teal;"&gt; 29 &lt;/span&gt;      a.FuncDiv();&lt;br /&gt;&lt;span style="color:Teal;"&gt; 30 &lt;/span&gt;      &lt;span style="color:Blue;"&gt;return&lt;/span&gt; &lt;span style="color:Maroon;"&gt;0&lt;/span&gt;;&lt;br /&gt;&lt;span style="color:Teal;"&gt; 31 &lt;/span&gt;}&lt;br /&gt;&lt;span style="color:Teal;"&gt; 32 &lt;/span&gt;&lt;br /&gt;&lt;span style="color:Teal;"&gt; 33 &lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Solution 1:&lt;/span&gt;&lt;br /&gt;&lt;pre&gt;&lt;span style="color:Teal;"&gt;  1 &lt;/span&gt;&lt;span style="color:Blue;"&gt;#define&lt;/span&gt; DO_REPORTING(type,variable) Report&amp;lt;type&amp;gt; r(val);&lt;br /&gt;&lt;span style="color:Teal;"&gt;  2 &lt;/span&gt;&lt;br /&gt;&lt;span style="color:Teal;"&gt;  3 &lt;/span&gt;&lt;span style="color:Blue;"&gt;template&lt;/span&gt; &amp;lt;&lt;span style="color:Blue;"&gt;class&lt;/span&gt; T&amp;gt;&lt;br /&gt;&lt;span style="color:Teal;"&gt;  4 &lt;/span&gt;&lt;span style="color:Blue;"&gt;class&lt;/span&gt; Report{&lt;br /&gt;&lt;span style="color:Teal;"&gt;  5 &lt;/span&gt;      T &amp;amp;val;&lt;br /&gt;&lt;span style="color:Teal;"&gt;  6 &lt;/span&gt;&lt;span style="color:Blue;"&gt;public&lt;/span&gt;:&lt;br /&gt;&lt;span style="color:Teal;"&gt;  7 &lt;/span&gt;      Report(T &amp;amp;v):val(v){&lt;br /&gt;&lt;span style="color:Teal;"&gt;  8 &lt;/span&gt;            &lt;span style="color:Blue;"&gt;cout&lt;/span&gt; &amp;lt;&amp;lt; &lt;span style="color:Maroon;"&gt;"Before:"&lt;/span&gt; &amp;lt;&amp;lt; val &amp;lt;&amp;lt; &lt;span style="color:Blue;"&gt;endl&lt;/span&gt;;&lt;br /&gt;&lt;span style="color:Teal;"&gt;  9 &lt;/span&gt;      }&lt;br /&gt;&lt;span style="color:Teal;"&gt; 10 &lt;/span&gt;      ~Report(){&lt;br /&gt;&lt;span style="color:Teal;"&gt; 11 &lt;/span&gt;            &lt;span style="color:Blue;"&gt;cout&lt;/span&gt; &amp;lt;&amp;lt; &lt;span style="color:Maroon;"&gt;"After:"&lt;/span&gt; &amp;lt;&amp;lt; val &amp;lt;&amp;lt; &lt;span style="color:Blue;"&gt;endl&lt;/span&gt;;&lt;br /&gt;&lt;span style="color:Teal;"&gt; 12 &lt;/span&gt;      }&lt;br /&gt;&lt;span style="color:Teal;"&gt; 13 &lt;/span&gt;};&lt;br /&gt;&lt;span style="color:Teal;"&gt; 14 &lt;/span&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6487100581508098433-4861800903919914354?l=kaisar-haque.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kaisar-haque.blogspot.com/feeds/4861800903919914354/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6487100581508098433&amp;postID=4861800903919914354' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/4861800903919914354'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/4861800903919914354'/><link rel='alternate' type='text/html' href='http://kaisar-haque.blogspot.com/2009/02/c-problem-define-that-macro.html' title='C++ Problem: Define that macro'/><author><name>RoboSmith</name><uri>http://www.blogger.com/profile/07878693490452605144</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6487100581508098433.post-8294175443999640302</id><published>2008-08-18T02:17:00.000-07:00</published><updated>2008-08-18T02:28:53.212-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='web'/><title type='text'>Don't click it!</title><content type='html'>It's been long since I got excited about a web site. I have to say, I'm very impressed with the idea, creativity, innovation and the intuitive interface of this web site/project. It's based on the idea that you don't need to click to navigate.. they strongly suggest that you don't click at all!&lt;br /&gt;&lt;br /&gt;Check it out here: &lt;a href="http://www.dontclick.it/"&gt;http://www.dontclick.it/&lt;/a&gt;. Check out the whole web site, all pages to get the real fun.&lt;br /&gt;&lt;br /&gt;I feel like pulling out the buttons of my mouse :P.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6487100581508098433-8294175443999640302?l=kaisar-haque.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kaisar-haque.blogspot.com/feeds/8294175443999640302/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6487100581508098433&amp;postID=8294175443999640302' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/8294175443999640302'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/8294175443999640302'/><link rel='alternate' type='text/html' href='http://kaisar-haque.blogspot.com/2008/08/dont-click-it.html' title='Don&apos;t click it!'/><author><name>RoboSmith</name><uri>http://www.blogger.com/profile/07878693490452605144</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6487100581508098433.post-5669234084116441426</id><published>2008-07-06T09:09:00.000-07:00</published><updated>2008-07-07T03:24:42.799-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='c++'/><title type='text'>C++: What's the difference between class and struct?</title><content type='html'>What's the difference between class and struct?&lt;br /&gt;&lt;br /&gt;A beginner would say:&lt;br /&gt;&lt;br /&gt;"There are a lot of differences, class is a C++ element and struct is a C one. We can have functions, virtual functions, inheritance, different access modifiers private, protected, public in a class but probably not in a struct. A struct generally holds member variables only."&lt;br /&gt;&lt;br /&gt;(Just to clarify, the above statement is completely wrong.)&lt;br /&gt;&lt;br /&gt;Intermediate and most advanced C++ programmers would say:&lt;br /&gt;&lt;br /&gt;"class and struct do not have  any difference, except the fact that class members are by default private and struct members are by default public. The keywords class and struct are interchangeable."&lt;br /&gt;&lt;br /&gt;The above statement is correct to some extent and would satisfy most questioners, however, there are some special cases where class and struct are not interchangeable.&lt;br /&gt;&lt;br /&gt;Consider the following code which compiles well in a C++ complier:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 0, 153);"&gt;template&lt;/span&gt; &lt;&lt;span style="color: rgb(51, 0, 153);"&gt;class&lt;/span&gt; T&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 0, 153);"&gt;void&lt;/span&gt; fn()&lt;br /&gt;{&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Now replace the keyword 'class' with 'struct' and compile it..&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 0, 153);"&gt;template&lt;/span&gt; &lt;&lt;span style="color: rgb(51, 0, 153);"&gt;struct&lt;/span&gt; T&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 0, 153);"&gt;void&lt;/span&gt; fn()&lt;br /&gt;{&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;It gives a compiler error! According to MSDN's definition of the template keyword:&lt;br /&gt;&lt;br /&gt;"The &lt;i&gt;template-parameter-list&lt;/i&gt; is a comma-separated list of template  parameters, which may be types (in the form &lt;b&gt;class&lt;/b&gt; &lt;i&gt;identifier&lt;/i&gt;,  &lt;b&gt;typename&lt;/b&gt; &lt;i&gt;identifier&lt;/i&gt;, or &lt;b&gt;template &lt;  &lt;/b&gt;&lt;i&gt;template-parameter-list&lt;/i&gt;&lt;b&gt; &gt; class &lt;/b&gt;&lt;i&gt;identifier&lt;/i&gt;) or  non-type parameters to be used in the template body."&lt;br /&gt;&lt;br /&gt;So the template parameter list doesn't take the keyword 'struct'!&lt;br /&gt;&lt;br /&gt;The template mechanism itself was introduced in later phase of the C++ evolution, some years later than the first version of C++. The 'struct' keyword was probably ignored when defining template which was considered to be an advance feature of C++.&lt;br /&gt;&lt;br /&gt;"Another reasonable use of the C struct in C++, then, is when you want to pass all or  part of a complex class object to a C function. This struct declaration serves  to encapsulate that data and guarantees a compatible C storage layout. This  guarantee, however, is maintained only under composition." said Stanley B. Lippman, author of several C++ books.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6487100581508098433-5669234084116441426?l=kaisar-haque.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kaisar-haque.blogspot.com/feeds/5669234084116441426/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6487100581508098433&amp;postID=5669234084116441426' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/5669234084116441426'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/5669234084116441426'/><link rel='alternate' type='text/html' href='http://kaisar-haque.blogspot.com/2008/07/c-whats-difference-between-class-and.html' title='C++: What&apos;s the difference between class and struct?'/><author><name>RoboSmith</name><uri>http://www.blogger.com/profile/07878693490452605144</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6487100581508098433.post-4772350815073167690</id><published>2008-07-06T02:56:00.000-07:00</published><updated>2008-07-14T02:53:34.389-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='visual studio'/><category scheme='http://www.blogger.com/atom/ns#' term='c++'/><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><title type='text'>C++: Accessing the virtual table directly</title><content type='html'>This post is not intended for beginners. To understand the content of this topic, you need to have basic understanding of what virtual functions are.&lt;br /&gt;&lt;br /&gt;We know that the run time binding or virtual function mechanism is implemented by a virtual table. If a class has at least one virtual function a virtual table will be created for that class. To be specific, 'only one' virtual table will be created for all of the instances/objects of that class. Each of the instances and objects will have a pointer to the virtual table.&lt;br /&gt;&lt;br /&gt;The same thing is true for a class hierarchy. Meaning, if class Z derives class Y and class Y derives class X, only one virtual table will be created for all instances/objects of class X, Y and Z. Each of the instances and objects of X, Y and Z will have a pointer to the virtual table.&lt;br /&gt;&lt;br /&gt;===============&lt;br /&gt;Added on July 14, 2008:&lt;br /&gt;The virtual tables for each of class X, Y and Z share common information but they are not necessarily the same table for each of these classes. The scenario is complex for multiple and virtual inheritance. I would like to discuss them in future posts.&lt;br /&gt;===============&lt;br /&gt;&lt;br /&gt;A pointer is 32 bit/4 bytes in a 32-bit architecture and 64-bit/8 bytes in a 64-bit architecture. So all instances/objects of a class or class hierarchy, where we have a virtual table, will have additional 4 bytes in them and 8 bytes in case of a 64-bit architecture.&lt;br /&gt;&lt;br /&gt;This pointer is called virtual table pointer, sometimes 'vptr'. In VC++ compiler, the objects will have a pointer named '__vfptr' in them and in some other compiler it's '__vptr_X', where X is the class name.&lt;br /&gt;&lt;br /&gt;Now  __vfptr is not directly accessible from your code. For example, if you write the following code you'll get a compiler error as the __vfptr is not available for your use.&lt;br /&gt;&lt;br /&gt;&lt;pre class="codeHTML"&gt;&lt;span class="lineNumber"&gt;  1&lt;/span&gt; &lt;span class="othertext"&gt;X&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="othertext"&gt;a&lt;/span&gt;&lt;span class="punctuation"&gt;;&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt;  2&lt;/span&gt; &lt;/span&gt;&lt;span class="predefined"&gt;cout&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="unknownchar"&gt;&amp;lt;&lt;/span&gt;&lt;span class="unknownchar"&gt;&amp;lt;&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="othertext"&gt;a&lt;/span&gt;&lt;span class="punctuation"&gt;.&lt;/span&gt;&lt;span class="punctuation"&gt;_&lt;/span&gt;&lt;span class="punctuation"&gt;_&lt;/span&gt;&lt;span class="othertext"&gt;vfptr&lt;/span&gt;&lt;span class="punctuation"&gt;;&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;However, if you debug the code in VC++, you can see the 'a.__vfptr' in the variable watch windows. Interesting ha?&lt;br /&gt;&lt;br /&gt;Okay, now we'd like to see how we can access the virtual table even if the compiler doesn't want us to. Let's have class X with a virtual function fn() which simply prints a member variable and we want to access the virtual table of class X to call the function fn() using it. The following code does that.&lt;br /&gt;&lt;br /&gt;&lt;pre class="codeHTML"&gt;&lt;span class="lineNumber"&gt;  1&lt;/span&gt; &lt;span class="punctuation"&gt;#&lt;/span&gt;&lt;span class="predefined"&gt;include&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="unknownchar"&gt;&lt;&lt;/span&gt;&lt;span class="predefined"&gt;iostream&lt;/span&gt;&lt;span class="unknownchar"&gt;&gt;&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt;  2&lt;/span&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt;  3&lt;/span&gt; &lt;/span&gt;&lt;span class="keyword"&gt;using&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="keyword"&gt;namespace&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="predefined"&gt;std&lt;/span&gt;&lt;span class="punctuation"&gt;;&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt;  4&lt;/span&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt;  5&lt;/span&gt; &lt;/span&gt;&lt;span class="lineComment"&gt;//a simple class&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt;  6&lt;/span&gt; &lt;/span&gt;&lt;span class="keyword"&gt;class&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="othertext"&gt;X&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt;  7&lt;/span&gt; &lt;/span&gt;&lt;span class="punctuation"&gt;{&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt;  8&lt;/span&gt; &lt;/span&gt;&lt;span class="keyword"&gt;public&lt;/span&gt;&lt;span class="punctuation"&gt;:&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt;  9&lt;/span&gt;  &lt;/span&gt;&lt;span class="lineComment"&gt;//fn is a simple virtual function&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 10&lt;/span&gt;  &lt;/span&gt;&lt;span class="keyword"&gt;virtual&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="builtinType"&gt;void&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="othertext"&gt;fn&lt;/span&gt;&lt;span class="punctuation"&gt;(&lt;/span&gt;&lt;span class="punctuation"&gt;)&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 11&lt;/span&gt;  &lt;/span&gt;&lt;span class="punctuation"&gt;{&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 12&lt;/span&gt;   &lt;/span&gt;&lt;span class="predefined"&gt;cout&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="unknownchar"&gt;&lt;&lt;/span&gt;&lt;span class="unknownchar"&gt;&lt;&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="stringliteral"&gt;"n = "&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="unknownchar"&gt;&lt;&lt;/span&gt;&lt;span class="unknownchar"&gt;&lt;&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="othertext"&gt;n&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="unknownchar"&gt;&lt;&lt;/span&gt;&lt;span class="unknownchar"&gt;&lt;&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="predefined"&gt;endl&lt;/span&gt;&lt;span class="punctuation"&gt;;&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 13&lt;/span&gt;  &lt;/span&gt;&lt;span class="punctuation"&gt;}&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 14&lt;/span&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 15&lt;/span&gt;  &lt;/span&gt;&lt;span class="lineComment"&gt;//a member variable&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 16&lt;/span&gt;  &lt;/span&gt;&lt;span class="builtinType"&gt;int&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="othertext"&gt;n&lt;/span&gt;&lt;span class="punctuation"&gt;;&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 17&lt;/span&gt; &lt;/span&gt;&lt;span class="punctuation"&gt;}&lt;/span&gt;&lt;span class="punctuation"&gt;;&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 18&lt;/span&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 19&lt;/span&gt; &lt;/span&gt;&lt;span class="builtinType"&gt;int&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="othertext"&gt;main&lt;/span&gt;&lt;span class="punctuation"&gt;(&lt;/span&gt;&lt;span class="punctuation"&gt;)&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 20&lt;/span&gt; &lt;/span&gt;&lt;span class="punctuation"&gt;{&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 21&lt;/span&gt;  &lt;/span&gt;&lt;span class="lineComment"&gt;//create an object (obj) of class X&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 22&lt;/span&gt;  &lt;/span&gt;&lt;span class="othertext"&gt;X&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="punctuation"&gt;*&lt;/span&gt;&lt;span class="othertext"&gt;obj&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="unknownchar"&gt;=&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="keyword"&gt;new&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="othertext"&gt;X&lt;/span&gt;&lt;span class="punctuation"&gt;(&lt;/span&gt;&lt;span class="punctuation"&gt;)&lt;/span&gt;&lt;span class="punctuation"&gt;;&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 23&lt;/span&gt;  &lt;/span&gt;&lt;span class="othertext"&gt;obj&lt;/span&gt;&lt;span class="punctuation"&gt;-&lt;/span&gt;&lt;span class="unknownchar"&gt;&gt;&lt;/span&gt;&lt;span class="othertext"&gt;n&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="unknownchar"&gt;=&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="integerLiteral"&gt;10&lt;/span&gt;&lt;span class="punctuation"&gt;;&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 24&lt;/span&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 25&lt;/span&gt;  &lt;/span&gt;&lt;span class="lineComment"&gt;//get the virtual table pointer of object obj&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 26&lt;/span&gt;  &lt;/span&gt;&lt;span class="builtinType"&gt;int&lt;/span&gt;&lt;span class="punctuation"&gt;*&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="othertext"&gt;vptr&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="unknownchar"&gt;=&lt;/span&gt;&lt;span class="whitespace"&gt;  &lt;/span&gt;&lt;span class="punctuation"&gt;*&lt;/span&gt;&lt;span class="punctuation"&gt;(&lt;/span&gt;&lt;span class="builtinType"&gt;int&lt;/span&gt;&lt;span class="punctuation"&gt;*&lt;/span&gt;&lt;span class="punctuation"&gt;*&lt;/span&gt;&lt;span class="punctuation"&gt;)&lt;/span&gt;&lt;span class="othertext"&gt;obj&lt;/span&gt;&lt;span class="punctuation"&gt;;&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 27&lt;/span&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 28&lt;/span&gt;  &lt;/span&gt;&lt;span class="lineComment"&gt;// we shall call the function fn, but first the following assembly code&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 29&lt;/span&gt;  &lt;/span&gt;&lt;span class="lineComment"&gt;//  is required to make obj as 'this' pointer as we shall call&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 30&lt;/span&gt;  &lt;/span&gt;&lt;span class="lineComment"&gt;//  function fn() directly from the virtual table&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 31&lt;/span&gt;  &lt;/span&gt;&lt;span class="punctuation"&gt;_&lt;/span&gt;&lt;span class="punctuation"&gt;_&lt;/span&gt;&lt;span class="othertext"&gt;asm&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 32&lt;/span&gt;  &lt;/span&gt;&lt;span class="punctuation"&gt;{&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 33&lt;/span&gt;   &lt;/span&gt;&lt;span class="othertext"&gt;mov&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="othertext"&gt;ecx&lt;/span&gt;&lt;span class="punctuation"&gt;,&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="othertext"&gt;obj&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 34&lt;/span&gt;  &lt;/span&gt;&lt;span class="punctuation"&gt;}&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 35&lt;/span&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 36&lt;/span&gt;  &lt;/span&gt;&lt;span class="lineComment"&gt;//function fn is the first entry of the virtual table, so it's vptr[0]&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 37&lt;/span&gt;  &lt;/span&gt;&lt;span class="punctuation"&gt;(&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="punctuation"&gt;(&lt;/span&gt;&lt;span class="builtinType"&gt;void&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="punctuation"&gt;(&lt;/span&gt;&lt;span class="punctuation"&gt;*&lt;/span&gt;&lt;span class="punctuation"&gt;)&lt;/span&gt;&lt;span class="punctuation"&gt;(&lt;/span&gt;&lt;span class="punctuation"&gt;)&lt;/span&gt;&lt;span class="punctuation"&gt;)&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="othertext"&gt;vptr&lt;/span&gt;&lt;span class="punctuation"&gt;[&lt;/span&gt;&lt;span class="integerLiteral"&gt;0&lt;/span&gt;&lt;span class="punctuation"&gt;]&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="punctuation"&gt;)&lt;/span&gt;&lt;span class="punctuation"&gt;(&lt;/span&gt;&lt;span class="punctuation"&gt;)&lt;/span&gt;&lt;span class="punctuation"&gt;;&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 38&lt;/span&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 39&lt;/span&gt;  &lt;/span&gt;&lt;span class="lineComment"&gt;//the above is the same as the following&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 40&lt;/span&gt;  &lt;/span&gt;&lt;span class="lineComment"&gt;//obj-&gt;fn();&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 41&lt;/span&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 42&lt;/span&gt;  &lt;/span&gt;&lt;span class="keyword"&gt;return&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="integerLiteral"&gt;0&lt;/span&gt;&lt;span class="punctuation"&gt;;&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 43&lt;/span&gt; &lt;/span&gt;&lt;span class="punctuation"&gt;}&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 44&lt;/span&gt; &lt;/span&gt;&lt;/pre&gt;Please note, this code is compiler dependent and may only work on VC++ compilers and it'll work correctly when you'll run it in 'Release' mode. Here goes some explanation of the code.&lt;br /&gt;&lt;br /&gt;In line 26, we have:&lt;br /&gt;&lt;pre class="codeHTML"&gt;&lt;span class="whitespace"&gt;&lt;span class="lineNumber"&gt; 26&lt;/span&gt;  &lt;/span&gt;&lt;span class="builtinType"&gt;int&lt;/span&gt;&lt;span class="punctuation"&gt;*&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="othertext"&gt;vptr&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="unknownchar"&gt;=&lt;/span&gt;&lt;span class="whitespace"&gt;  &lt;/span&gt;&lt;span class="punctuation"&gt;*&lt;/span&gt;&lt;span class="punctuation"&gt;(&lt;/span&gt;&lt;span class="builtinType"&gt;int&lt;/span&gt;&lt;span class="punctuation"&gt;*&lt;/span&gt;&lt;span class="punctuation"&gt;*&lt;/span&gt;&lt;span class="punctuation"&gt;)&lt;/span&gt;&lt;span class="othertext"&gt;obj&lt;/span&gt;&lt;span class="punctuation"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;The virtual table pointer __vfptr is available in the first 4 bytes of the object. In this line, we get the value of the pointer __vfptr or the address of the virtual table as an integer pointer (say as a pointer to an integer array).&lt;br /&gt;&lt;br /&gt;The first entry of the virtual table is the function pointer of the virtual function 'fn'. We can access the first entry using vptr[0] (as this is just an array). So, in line 37, we just call the function using the function pointer. But wait, you might be asking why the following assembly line is there before that function call.&lt;br /&gt;&lt;pre class="codeHTML"&gt;&lt;span class="whitespace"&gt;&lt;span class="lineNumber"&gt; 33&lt;/span&gt;   &lt;/span&gt;&lt;span class="othertext"&gt;mov&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="othertext"&gt;ecx&lt;/span&gt;&lt;span class="punctuation"&gt;,&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="othertext"&gt;obj&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;If you take another look into the implementation of function fn(), you can see that it prints out the member variable 'n', which is only avaliable to object 'obj'. Inside the function fn(), 'obj' needs to be set as 'this' pointer, to give the function fn() access to all it's members.&lt;br /&gt;&lt;br /&gt;When we call the function fn() in this way: obj-&gt;fn(), the compiler does the job for us and sets 'obj' as 'this' before calling the function. But in line 37, we couldn't specify anything to the function fn() saying it is called for the object 'obj', so the function won't find out where to get the value of 'n' from. This is why we expicitly need to set the 'obj' as 'this' before we call the function fn() in line 37. We did that in line 33, in the assembly code. This line is again VC++ specific. In VC++, 'this' pointer is set in the register 'ECX'. Some other compiler may handle that differently.&lt;br /&gt;&lt;br /&gt;If we had more virtual function, we could have access them using next indexes of vptr: vptr[1], vptr[2], etc.&lt;br /&gt;&lt;br /&gt;We have learned some interesting facts about the virtual functions and the virtual table. We may not have any use of this kind of code where we need to directly access the virtual table in our general applications but this helps when you want to know more about C++ internals.&lt;br /&gt;&lt;br /&gt;Enjoy!&lt;br /&gt;&lt;br /&gt;July 12, 2008:&lt;br /&gt;We assumed here that the vptr is placed in the beginning of the class object. here's a note on that:&lt;br /&gt;&lt;br /&gt;Traditionally, the vptr has been placed after all the explicitly declared members of  the class. More recently, it has been placed at the beginning of the class  object. The C++ Standard allows the  compiler the freedom to insert these internally generated members anywhere, even  between those explicitly declared by the programmer.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6487100581508098433-4772350815073167690?l=kaisar-haque.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kaisar-haque.blogspot.com/feeds/4772350815073167690/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6487100581508098433&amp;postID=4772350815073167690' title='18 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/4772350815073167690'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/4772350815073167690'/><link rel='alternate' type='text/html' href='http://kaisar-haque.blogspot.com/2008/07/c-accessing-virtual-table.html' title='C++: Accessing the virtual table directly'/><author><name>RoboSmith</name><uri>http://www.blogger.com/profile/07878693490452605144</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>18</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6487100581508098433.post-725068299116267671</id><published>2008-06-28T03:00:00.000-07:00</published><updated>2008-07-06T05:17:09.090-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='c++'/><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><title type='text'>C++: Avoid using assignments in constructors</title><content type='html'>In my post &lt;a href="http://kaisar-haque.blogspot.com/2008/03/coding-better-c.html"&gt;Coding better C++&lt;/a&gt;, I've suggested a list of techniques to improve C++ coding. I shall try to explain them one at a time in the future posts. In this post, I've talked about "4. Avoid using assignments in constructors, use initializer list to initialize members".&lt;br /&gt;&lt;br /&gt;The initialize list is used to avoid double construction of a contained object. Take the following example:&lt;br /&gt;&lt;span style="color: rgb(51, 0, 153);"&gt;&lt;/span&gt;&lt;pre class="codeHTML"&gt;&lt;span class="lineNumber"&gt;  1&lt;/span&gt; &lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt;  2&lt;/span&gt; &lt;/span&gt;&lt;span class="othertext"&gt;Class&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="othertext"&gt;Student&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt;  3&lt;/span&gt; &lt;/span&gt;&lt;span class="punctuation"&gt;{&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt;  4&lt;/span&gt; &lt;/span&gt;&lt;span class="keyword"&gt;public&lt;/span&gt;&lt;span class="punctuation"&gt;:&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt;  5&lt;/span&gt;  &lt;/span&gt;&lt;span class="othertext"&gt;Student&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="punctuation"&gt;(&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="keyword"&gt;const&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="builtinType"&gt;char&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="punctuation"&gt;*&lt;/span&gt;&lt;span class="punctuation"&gt;_&lt;/span&gt;&lt;span class="othertext"&gt;name&lt;/span&gt;&lt;span class="punctuation"&gt;)&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt;  6&lt;/span&gt;  &lt;/span&gt;&lt;span class="punctuation"&gt;{&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt;  7&lt;/span&gt;   &lt;/span&gt;&lt;span class="othertext"&gt;name&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="unknownchar"&gt;=&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="punctuation"&gt;_&lt;/span&gt;&lt;span class="othertext"&gt;name&lt;/span&gt;&lt;span class="punctuation"&gt;;&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt;  8&lt;/span&gt;  &lt;/span&gt;&lt;span class="punctuation"&gt;}&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt;  9&lt;/span&gt; &lt;/span&gt;&lt;span class="keyword"&gt;private&lt;/span&gt;&lt;span class="punctuation"&gt;:&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 10&lt;/span&gt;  &lt;/span&gt;&lt;span class="predefined"&gt;string&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="othertext"&gt;name&lt;/span&gt;&lt;span class="punctuation"&gt;;&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 11&lt;/span&gt; &lt;/span&gt;&lt;span class="punctuation"&gt;}&lt;/span&gt;&lt;span class="punctuation"&gt;;&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;We create an object of the Student, for example, in the following way.&lt;br /&gt;&lt;pre class="codeHTML"&gt;&lt;span class="whitespace"&gt;&lt;span class="lineNumber"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="othertext"&gt;Student&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="othertext"&gt;s&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="punctuation"&gt;(&lt;/span&gt;&lt;span class="punctuation"&gt;“&lt;/span&gt;&lt;span class="othertext"&gt;Abc&lt;/span&gt;&lt;span class="punctuation"&gt;”&lt;/span&gt;&lt;span class="punctuation"&gt;)&lt;/span&gt;&lt;span class="punctuation"&gt;;&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt; The following executions take place:&lt;br /&gt;&lt;p&gt;1. string name is initialized&lt;br /&gt;   a. string::string() function is called&lt;br /&gt;2. body of the Student::Student(const char *) constructor is called&lt;br /&gt;3. the line name = _name is executed&lt;br /&gt;   a. string::operator=(const char *) function is called&lt;/p&gt; A note to experts: we’ve ignored memory allocation steps and detailed assembly steps of the function calls to keep things simple.&lt;br /&gt;&lt;br /&gt;As you can see the result of the step 1.a, string::string(), is discarded by step 3.a, string::operator=(const char *), the step 1.a is therefore redundant.&lt;br /&gt;&lt;br /&gt;We can optimize this with the initializer list, in the following way:&lt;br /&gt;&lt;span style="color: rgb(51, 0, 153);"&gt;    &lt;/span&gt;&lt;pre class="codeHTML"&gt;&lt;span class="lineNumber"&gt;  1&lt;/span&gt; &lt;span class="othertext"&gt;Class&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="othertext"&gt;Student&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt;  2&lt;/span&gt; &lt;/span&gt;&lt;span class="punctuation"&gt;{&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt;  3&lt;/span&gt; &lt;/span&gt;&lt;span class="keyword"&gt;public&lt;/span&gt;&lt;span class="punctuation"&gt;:&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt;  4&lt;/span&gt;  &lt;/span&gt;&lt;span class="othertext"&gt;Student&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="punctuation"&gt;(&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="keyword"&gt;const&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="builtinType"&gt;char&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="punctuation"&gt;*&lt;/span&gt;&lt;span class="punctuation"&gt;_&lt;/span&gt;&lt;span class="othertext"&gt;name&lt;/span&gt;&lt;span class="punctuation"&gt;)&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="punctuation"&gt;:&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="othertext"&gt;name&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="punctuation"&gt;(&lt;/span&gt;&lt;span class="punctuation"&gt;_&lt;/span&gt;&lt;span class="othertext"&gt;name&lt;/span&gt;&lt;span class="punctuation"&gt;)&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt;  5&lt;/span&gt;  &lt;/span&gt;&lt;span class="punctuation"&gt;{&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt;  6&lt;/span&gt;  &lt;/span&gt;&lt;span class="punctuation"&gt;}&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt;  7&lt;/span&gt; &lt;/span&gt;&lt;span class="keyword"&gt;private&lt;/span&gt;&lt;span class="punctuation"&gt;:&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt;  8&lt;/span&gt;  &lt;/span&gt;&lt;span class="predefined"&gt;string&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="othertext"&gt;name&lt;/span&gt;&lt;span class="punctuation"&gt;;&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt;  9&lt;/span&gt; &lt;/span&gt;&lt;span class="punctuation"&gt;}&lt;/span&gt;&lt;span class="punctuation"&gt;;&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 10&lt;/span&gt; &lt;/span&gt;&lt;/pre&gt;In this way, the string 'name' is initialized only once and with the value of _name and it calls the string::string(const char *) function directly.&lt;br /&gt;&lt;br /&gt;Many optimizations require some kind of a trade-off. You often trade speed for clarity, simplicity, re-usability, or some other metric. But in this example, optimization requires no sacrifice at all. This constructor will generate the exact same Student object with the exception of improved performance.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6487100581508098433-725068299116267671?l=kaisar-haque.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kaisar-haque.blogspot.com/feeds/725068299116267671/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6487100581508098433&amp;postID=725068299116267671' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/725068299116267671'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/725068299116267671'/><link rel='alternate' type='text/html' href='http://kaisar-haque.blogspot.com/2008/06/c-avoid-using-assignments-in.html' title='C++: Avoid using assignments in constructors'/><author><name>RoboSmith</name><uri>http://www.blogger.com/profile/07878693490452605144</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6487100581508098433.post-2548825641537747446</id><published>2008-06-21T22:00:00.000-07:00</published><updated>2008-06-27T13:09:17.665-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='process'/><category scheme='http://www.blogger.com/atom/ns#' term='project management'/><title type='text'>Project management thoughts - 3. Parallel development issues</title><content type='html'>This is a continuation of the "Project management thoughts" series. Please read the previous posts if you haven't already.&lt;br /&gt;&lt;br /&gt;In this post, I shall talk about why the parallel development of prototype and real application is not a good idea in a case like ours.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Why prototype and real development should not be in parallel&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The purpose of the prototype is to try out different brainstorming results of the client and solidifying requirements from it. Now, the scope of the new requirements and 'change requests' to already solidified requirements have no limits, officially.&lt;br /&gt;&lt;br /&gt;Let's take a break and do some basic maths of project management. A project has three main key factors: Time (T), Material (M) and Resources (R). Time is proportional to material and inversely proportional to resources. This can be represented in the following way.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;T = M / R&lt;br /&gt;or T x R = M&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Meaning: 1. If your time is fixed and if you increase your material, you also need to increase your resources, 2. If your resources are fixed and if you increase your material, you also need to increase your time, 3. If you material is fixed and if you change your resources, your time will get changed, and so on.&lt;br /&gt;&lt;br /&gt;I'm sure  most of us know this in one form or another and I only described in details for the newbies.&lt;br /&gt;&lt;br /&gt;Now back to the prototype, if the prototype continuously gives us new requirements through out the whole project time line, we need to have time open ended, according to the simple math that we done above, but that not an option in the first place. This is fixed time project.&lt;br /&gt;&lt;br /&gt;Besides new requirements, the prototype will also yield a list of small and large changes (large, in terms of task volume). These changes need to get reflected in the already built features of the real application. The changes, of course, are materials (M) which requires more time (T).&lt;br /&gt;&lt;br /&gt;The changes imposed from the prototype will virtually have no limits. If we have already implemented, for example, 20 features in the real application that were previously solidified, those may require complete or partial reworks in a very short time. Adjusting major changes in the requirements makes a solid codebase messy, making it more vulnerable  to major bugs. Re-structuring, re-designing (the software design) and re-implementing are probably the last things a development team wants to do. If requirements get changed every now and then, which we cannot guarantee, may end up with unexpectedly weak software design and codebase.&lt;br /&gt;&lt;br /&gt;There are also other factors of why it doesn't seem to be a good idea to run prototype and real application development in parallel. One of them is the time it takes to solidify requirements from the prototype. If we assume that we shall get requirements solidified from the prototype at a constant rate (or at a good rate) then it would be very wrong in real life. In practical scenarios we may get some or many of requirements solidified from the prototype and we may also need to wait a significant amount of time to get something solidified as it is very much dependent on client's decisions. 'Waiting' on a dependency for uncertain period of time for a  'fixed time and resources' project like ours (or in any project), is just one of the failure factors.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;The better solution&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Our proposed solution was to complete the prototype application first, with the effort of the full development team, solidifying requirements from it, and then working on the real application, again with the effort of the full development team.&lt;br /&gt;&lt;br /&gt;This solves a lot of problems, the ones that I mentioned above. The only concern with this way is, can we really complete the prototype with all ideas of the client in time and then can we finalize requirements from the prototype in time? Well, it requires effort from both of the side, the team and the client. Both parties need to work aggressively towards one goal, which is to identify requirements within a given time frame.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;To be continued.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Coming up soon: The team formation, the technologies, the tools used, the prototype phase, the software design phase..&lt;br /&gt;&lt;br /&gt;[I shall continue to talk about my project management experiences and thoughts about this project in regular posts. I hope you shall find them interesting or useful].&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6487100581508098433-2548825641537747446?l=kaisar-haque.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kaisar-haque.blogspot.com/feeds/2548825641537747446/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6487100581508098433&amp;postID=2548825641537747446' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/2548825641537747446'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/2548825641537747446'/><link rel='alternate' type='text/html' href='http://kaisar-haque.blogspot.com/2008/06/project-management-thoughts-3-parallel.html' title='Project management thoughts - 3. Parallel development issues'/><author><name>RoboSmith</name><uri>http://www.blogger.com/profile/07878693490452605144</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6487100581508098433.post-1653449618634016541</id><published>2008-06-20T13:06:00.000-07:00</published><updated>2008-06-20T15:05:22.812-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='process'/><category scheme='http://www.blogger.com/atom/ns#' term='project management'/><title type='text'>Project management thoughts - 2. The initial team and tasks</title><content type='html'>This is a continuation of the "Project management thoughts" series. Please read the previous posts if you haven't already.&lt;br /&gt;&lt;br /&gt;In this post, I shall mostly talk about the initial tasks of the project TP and my thoughts about it.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;The initial team&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Even though the project now have 20 engineers, it began only with 2 engineers. The primary goals of the initial team were to understand high level requirements of the project and to estimate required resources for the project. The initial team members were:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;A senior engineer with around 2 years of experiences, skilled in C#, Java and PHP&lt;/li&gt;&lt;li&gt;Myself&lt;/li&gt;&lt;/ol&gt;The initial team worked around for 3 weeks to capture high level requirements of the project, business goals of the client, preferred development process of the client, preferred technologies of the client and the time line of the project. The detailed requirements specification was not defined and one of the first goals of the project is to identify and solidify the requirements.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;The initial plan&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The client wants to identify the detailed requirements with a prototype project. The prototype project will follow agile development method and needs to have a weekly build on which the client would like to try out a few different ideas and solidify detailed requirements as the builds go on. Basically the prototype project will be a brain storming ground for the client and requirements capturing ground for us (ReliSource).&lt;br /&gt;&lt;br /&gt;The client wants a separate development project to run in parallel to the prototype project and the solidified requirement sets should be sent to the development project team for real implementation.&lt;br /&gt;&lt;br /&gt;The idea is to test different things on the prototype, solidifying them and to build them in the real application. Both of the prototype development and real application development needs to go in parallel and the project, actually the first release, needs to be completed within six months.&lt;br /&gt;&lt;br /&gt;Sounds doable? Well, not exactly. I shall post about 1. why not, 2. how we proposed a different strategy which was doable and also made the client happy, in my next post.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6487100581508098433-1653449618634016541?l=kaisar-haque.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kaisar-haque.blogspot.com/feeds/1653449618634016541/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6487100581508098433&amp;postID=1653449618634016541' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/1653449618634016541'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/1653449618634016541'/><link rel='alternate' type='text/html' href='http://kaisar-haque.blogspot.com/2008/06/project-management-thoughts-2-initial.html' title='Project management thoughts - 2. The initial team and tasks'/><author><name>RoboSmith</name><uri>http://www.blogger.com/profile/07878693490452605144</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6487100581508098433.post-6290197183616478491</id><published>2008-06-13T13:15:00.000-07:00</published><updated>2008-06-13T14:18:01.628-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='process'/><category scheme='http://www.blogger.com/atom/ns#' term='project management'/><title type='text'>Project management thoughts - 1. Introduction</title><content type='html'>I'm currently working with a team of size 20. I'm playing a dual role of project manager and technical lead at the same time. I'll try to share my experiences with this relatively large team and my thoughts on project management. The age of the project is two and half months and is currently scheduled for four more months.&lt;br /&gt;&lt;br /&gt;I'm planning to blog about this live project as it goes on which I believe is a courageous step. I shall try to maintain the privacy and not to disclose sensitive project information here.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;The team&lt;/span&gt;&lt;br /&gt;The team has 20 engineers, including me, with the following distribution.&lt;br /&gt;&lt;ul&gt;&lt;li&gt;14 developers&lt;/li&gt;&lt;ul&gt;&lt;li&gt;9 developers have 1 year of experiences on average&lt;/li&gt;&lt;li&gt;5 developers have 2 years of experiences on average&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;4 SQAs&lt;/li&gt;&lt;ul&gt;&lt;li&gt;1 release engineer/SQA lead, with 3+ years of experiences&lt;br /&gt;&lt;/li&gt;&lt;li&gt;3 engineers with 1 year of experiences of average&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;1 graphics designer&lt;/li&gt;&lt;ul&gt;&lt;li&gt;2+ years of experiences&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;1 project manager&lt;/li&gt;&lt;ul&gt;&lt;li&gt;that's me with 5+ years of experiences&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;All engineers are computer science graduates, mostly from BUET (Bangladesh University of Engineering and Technologies), NSU (North South University) and EWU (East West University). The designer is a graduate of Dhaka University.&lt;br /&gt;&lt;br /&gt;All development engineers are good problem solvers, strong in C++ or C# or Java, strong in OOP and are dedicated. One of them even went to ACM world finals.&lt;br /&gt;&lt;br /&gt;So, overall, it's a brilliant team.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;The project&lt;/span&gt;&lt;br /&gt;The project is a medium scale web application. I cannot disclose the description of the project but the type of the project is to build and manage networks between two groups of people.&lt;br /&gt;&lt;br /&gt;The project is fresh development from the scratch where we do not need to work on existing  codebase. Let's call the project 'The Project' or TP in short ;).&lt;br /&gt;&lt;br /&gt;TP has two sub projects, let's call them:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;TPX - which is for the first user group&lt;/li&gt;&lt;li&gt;TPY - which is for the 2nd user group&lt;/li&gt;&lt;/ul&gt;TP also has another sub project for a group of people who need to administrate the whole application. Let's call it:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;TPZ  - which is for administrator users&lt;/li&gt;&lt;/ul&gt;Three of the sub-projects TPX, TPY and TPZ will serve  different target user groups as mentioned above.&lt;br /&gt;&lt;br /&gt;The project is targeted towards massive user groups, say several thousand from the first user group and hundreds of thousands from second user group will use the application within a year of lunching the application. The project will have rigorous database transactions for most of the features and functionalities.&lt;br /&gt;&lt;br /&gt;Professional and rich user experience is very important in this project. The project will have good looking UI components, for which we have a dedicated graphics designer.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;To be continued.&lt;/span&gt;&lt;br /&gt;[I shall continue to talk about my project management experiences and thoughts about this project in regular posts. I hope you shall find them interesting or useful].&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6487100581508098433-6290197183616478491?l=kaisar-haque.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kaisar-haque.blogspot.com/feeds/6290197183616478491/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6487100581508098433&amp;postID=6290197183616478491' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/6290197183616478491'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/6290197183616478491'/><link rel='alternate' type='text/html' href='http://kaisar-haque.blogspot.com/2008/06/project-management-thoughts-1.html' title='Project management thoughts - 1. Introduction'/><author><name>RoboSmith</name><uri>http://www.blogger.com/profile/07878693490452605144</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6487100581508098433.post-8912954444688566932</id><published>2008-06-13T13:03:00.001-07:00</published><updated>2008-06-13T14:21:18.150-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='process'/><category scheme='http://www.blogger.com/atom/ns#' term='project management'/><title type='text'>Empowerment of SQA</title><content type='html'>This has probably become a hot topic recently. The 'scope of the empowerment' really needs to be defined. What 'powers' does empowerment include and what not? Whatever we say it 'includes', does it apply to all projects? even of different types?&lt;br /&gt;&lt;br /&gt;SQA team, if empowered, needs definition of what they can do and what not. There can be some serious do's. For example, can they stop a software release which has many bugs? If so, can your team, your company or the client effort it? What is the real intention of this action, better quality even if it hampers project timeline and the business of the client?&lt;br /&gt;&lt;br /&gt;There can be some less serious do's of SQA empowerment, for example: SQA team suggests to improve usability (a simple example of this: a numeric textbox takes all characters and validates and shows error later on if the input is not a number. SQA team suggests that the textbox should allow only number keystrokes in the first place). Now this sort of details may not be mentioned in the spec and so, in general, the developers argue with the SQA (may be because they feel lazy). According to empowerment do's, should the SQA be able to insist the developers to follow the suggestion?&lt;br /&gt;&lt;br /&gt;If you want to empower SQA and try to draw some lines on their do's and don'ts then you're most likely to rediscover a simple fact.&lt;br /&gt;In most of the companies, SQA teams are so much dominated by the development team that they (SQA) cannot raise their voices even if they see something is terribly wrong. It's the problem with a developer's perspective of the SQA team. In general, a developer feels much superior to a similar ranking SQA and feels he (developer) know much more and his work is the most important thing in the project's success.&lt;br /&gt;&lt;br /&gt;So, now the empowerment is needed to make the developers feel that SQAs have some power too (!!) and a developer cannot just overlook their suggestions(?). Is this the main reason behind empowerment of SQA? if so, then let's look at the origin of the issue again. Is it again a developer's mindset and his careless or superior attitude towards a SQA? Can this be fixed? And is the officially declared 'SQA empowerment' the only way?&lt;br /&gt;&lt;br /&gt;In Bangladesh, most of the SQA engineers cannot do programming or understand mature coding and the 'white box' is just too much for them. Some seriously lack knowledge of latest technologies, techniques and advance skills (for example, only few SQAs have ever built and installed a software on Linux command prompt, unless it's a project-specific task). So, SQAs, in general, fall behind technical capabilities of developers. This should be addressed and SQAs need much improvement in the technical areas to make a good impression with rest of the team.&lt;br /&gt;&lt;br /&gt;Developers should learn the importance of others' comments. One developer sometimes doesn't value the suggestions of other good developers, let alone the SQAs. Horribly some seniors do that as well! This issue needs to be handled by the Project Manager or above. Developers should receive a 'clear message' saying: not to overlook other's suggestions and comments and to strongly collaborate with the SQA team.&lt;br /&gt;&lt;br /&gt;If you can handle the root of the problem, 'empowerment' or other 'forceful' ideas might not be needed. Peaceful solutions are good for the project health and the forceful ones might not be so, rather they can introduce chaos.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6487100581508098433-8912954444688566932?l=kaisar-haque.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kaisar-haque.blogspot.com/feeds/8912954444688566932/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6487100581508098433&amp;postID=8912954444688566932' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/8912954444688566932'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/8912954444688566932'/><link rel='alternate' type='text/html' href='http://kaisar-haque.blogspot.com/2008/06/empowerment-of-sqa.html' title='Empowerment of SQA'/><author><name>RoboSmith</name><uri>http://www.blogger.com/profile/07878693490452605144</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6487100581508098433.post-1560048061128526508</id><published>2008-05-30T00:36:00.000-07:00</published><updated>2008-05-30T01:09:43.309-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='science'/><title type='text'>Black boxes are not black</title><content type='html'>As the name itself suggests, 'Black boxes' in commercial airplanes are black by most people's assumptions, as the case was with me. But I recently learned that black boxes are not black, rather they are bright orange or red in most commercial airplanes.&lt;br /&gt;&lt;br /&gt;Interestingly, in Boeing 747, the black boxes (there are two) are bright red and all other aviation electronic boxes are black :). The unique bright color helps locating the 'black box' quickly in case of an accident.&lt;br /&gt;&lt;br /&gt;You can verify at: &lt;a href="http://www.howstuffworks.com/black-box.htm"&gt;http://www.howstuffworks.com/black-box.htm&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6487100581508098433-1560048061128526508?l=kaisar-haque.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kaisar-haque.blogspot.com/feeds/1560048061128526508/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6487100581508098433&amp;postID=1560048061128526508' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/1560048061128526508'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/1560048061128526508'/><link rel='alternate' type='text/html' href='http://kaisar-haque.blogspot.com/2008/05/black-boxes-are-not-black.html' title='Black boxes are not black'/><author><name>RoboSmith</name><uri>http://www.blogger.com/profile/07878693490452605144</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6487100581508098433.post-1092945881342470811</id><published>2008-03-16T09:19:00.000-07:00</published><updated>2008-03-16T11:15:04.510-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='c++'/><title type='text'>Coding better C++</title><content type='html'>I've prepared a short guideline for writing better codes in C++. I've prepared the list from my C++ experiences and studies. Each item of the list needs good amount of explanation which is outside of the scope of this post. I'll try to explain them in the future posts in my blog. For now, if you need more information on an suggested item, you can look up on the internet or in the books.&lt;br /&gt;&lt;br /&gt;Here it goes:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;C++ is not C. Stop mixing C and C++ unless it is required. Start thinking in C++.&lt;/li&gt;&lt;li&gt;Have a C++ coding standard defined or follow the coding standard defined for your project or organization.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Design from outside, design the interfaces first.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Avoid using assignments in constructors, use initializer list to initialize members.&lt;/li&gt;&lt;li&gt;Know the need of copy constructor and define when needed.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Use virtual destructor when your class is used as a base class.&lt;/li&gt;&lt;li&gt;Never call a destructor (unless you're using a placement new). If you do, you may need to revise your software design.&lt;/li&gt;&lt;li&gt;Avoid using placement new.&lt;/li&gt;&lt;li&gt;Avoid using Macros for functions. Use Inline functions instead.&lt;/li&gt;&lt;li&gt;Avoid using Array, unless you have to. Use standard library containers like Vector, etc.&lt;/li&gt;&lt;li&gt;Avoid C style cast, use the C++ casts.&lt;/li&gt;&lt;li&gt;Use references when you can and pointers when you have to.&lt;/li&gt;&lt;li&gt;Use composition when you can and private inheritance when you have to.&lt;/li&gt;&lt;li&gt;Use const for function parameters when you can.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Be careful about static initializations, you might get unexpected behavior if the static variables/objects has dependencies.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Be careful about multiple inheritance. Understand the 'dreaded diamond'.&lt;/li&gt;&lt;li&gt;Be careful about floats and doubles. They may give you unexpected behaviors.&lt;/li&gt;&lt;li&gt;Avoid constant literals in the code. Separate them in static inline functions or macros.&lt;/li&gt;&lt;/ol&gt;Each suggestion, mentioned above, will take time to get used to (if you're not already). For example, item 1 says "C++ is not C. Stop mixing C and C++ unless it is required. Start thinking in C++.". Now if you were a C programmer, it is not easy to stop using C, for example: it may become difficult for you to stop using stdio functions and using iostream instead. It'll take time and practice. (Please note, stdio functions might have advantages over iostream but that's not the point here).&lt;br /&gt;&lt;br /&gt;Once you get used to all of the suggested points, you'll find that your code is much much better than many others and of course, more optimized and less error prone. Let me emphasize, 'these are golden suggestions, try to follow them'.&lt;br /&gt;&lt;br /&gt;Happy coding :).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6487100581508098433-1092945881342470811?l=kaisar-haque.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kaisar-haque.blogspot.com/feeds/1092945881342470811/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6487100581508098433&amp;postID=1092945881342470811' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/1092945881342470811'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/1092945881342470811'/><link rel='alternate' type='text/html' href='http://kaisar-haque.blogspot.com/2008/03/coding-better-c.html' title='Coding better C++'/><author><name>RoboSmith</name><uri>http://www.blogger.com/profile/07878693490452605144</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6487100581508098433.post-7457344812015032582</id><published>2008-03-16T08:27:00.000-07:00</published><updated>2011-06-19T03:58:19.135-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='web'/><title type='text'>How to begin web programming with PHP</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;I am often asked, 'how to begin web programming with PHP?'. Following is a response that I had given few weeks ago. Hope this will be useful for anyone willing to start learning PHP.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Things you need to know to begin web programming with PHP:&lt;br /&gt;&lt;/b&gt; &lt;br /&gt;&lt;ul&gt;&lt;li&gt;Good knowledge of HTML&lt;/li&gt;&lt;li&gt;Some knowledge of CSS&lt;/li&gt;&lt;li&gt;Some knowledge of JavaScript&lt;/li&gt;&lt;li&gt;Good knowledge of MySQL Database, SQL (as most php applications are database driven)&lt;/li&gt;&lt;li&gt;Good knowledge of PHP&lt;/li&gt;&lt;li&gt;Using and configuring Apache&lt;/li&gt;&lt;/ul&gt;&lt;b&gt;Tutorial Links:&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;Here are the links to tutorials that may help you to accelerate your learning process.&lt;b&gt;&lt;br /&gt;&lt;/b&gt; &lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;HTML:&lt;/b&gt;&lt;/li&gt;&lt;ul&gt;&lt;li&gt;Very good short tutorial: &lt;a href="http://www.w3schools.com/html/html_intro.asp" target="_blank"&gt;http://www.w3schools.com/html&lt;wbr&gt;&lt;/wbr&gt;/html_intro.asp&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Good tutorial: &lt;a href="http://www.w3.org/MarkUp/Guide/" target="_blank"&gt;http://www.w3.org/MarkUp/Guide/&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Advanced tutorial: &lt;a href="http://www.w3.org/MarkUp/Guide/Advanced.html" target="_blank"&gt;http://www.w3.org/MarkUp/Guide&lt;wbr&gt;&lt;/wbr&gt;/Advanced.html&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;&lt;b&gt;CSS:&lt;/b&gt;&lt;/li&gt;&lt;ul&gt;&lt;li&gt;Very good short tutorial: &lt;a href="http://www.w3schools.com/css/css_intro.asp" target="_blank"&gt;http://www.w3schools.com/css&lt;wbr&gt;&lt;/wbr&gt;/css_intro.asp&lt;/a&gt;&lt;/li&gt;&lt;li&gt;A good tutorial: &lt;a href="http://www.w3.org/Style/Examples/011/firstcss" target="_blank"&gt;http://www.w3.org/Style&lt;wbr&gt;&lt;/wbr&gt;/Examples/011/firstcss&lt;/a&gt;&lt;/li&gt;&lt;li&gt;A detailed tutorial: &lt;a href="http://www.html.net/tutorials/css/" target="_blank"&gt;http://www.html.net/tutorials&lt;wbr&gt;&lt;/wbr&gt;/css/&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;&lt;b&gt;JavaScript:&lt;/b&gt;&lt;/li&gt;&lt;ul&gt;&lt;li&gt;Very good short tutorial on JavaScript: &lt;a href="http://www.w3schools.com/js/js_intro.asp" target="_blank"&gt;http://www.w3schools.com/js/js&lt;wbr&gt;&lt;/wbr&gt;_intro.asp&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Detailed tutorial: &lt;a href="http://www.webdeveloper.com/javascript/javascript_js_tutorial.html" target="_blank"&gt;http://www.webdeveloper.com&lt;wbr&gt;&lt;/wbr&gt;/javascript/javascript_js&lt;wbr&gt;&lt;/wbr&gt;_tutorial.html&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;&lt;b&gt;PHP:&lt;/b&gt;&lt;/li&gt;&lt;ul&gt;&lt;li&gt;Very good short tutorial on PHP: &lt;a href="http://www.w3schools.com/php/php_intro.asp" target="_blank"&gt;http://www.w3schools.com/php&lt;wbr&gt;&lt;/wbr&gt;/php_intro.asp&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Very good detailed tutorial on PHP: &lt;a href="http://devzone.zend.com/node/view/id/627" target="_blank"&gt;http://devzone.zend.com/node&lt;wbr&gt;&lt;/wbr&gt;/view/id/627&lt;/a&gt; (go through all the parts)&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;b&gt;Recommended Setup:&lt;br /&gt;&lt;/b&gt; &lt;br /&gt;&lt;ul&gt;&lt;li&gt;Wamp Server (&lt;a href="http://www.wampserver.com/en/download.php"&gt;http://www.wampserver.com/en/download.php&lt;/a&gt;) which includes Apache web server, PHP and MySQL.&lt;/li&gt;&lt;li&gt;Editor: Notepad++ (&lt;a href="http://notepad-plus-plus.org/download"&gt;http://notepad-plus-plus.org/download&lt;/a&gt;).&lt;/li&gt;&lt;li&gt;HTML Editor: DreamWeaver, FrontPage. &lt;/li&gt;&lt;li&gt;  References (must have): php manual.chm, mysql manual.chm, javascript referenece books.&lt;/li&gt;&lt;/ul&gt;&lt;b&gt;Recommendations:&lt;br /&gt;&lt;/b&gt; &lt;br /&gt;&lt;ul&gt;&lt;li&gt;Keep the references handy/near to you.&lt;/li&gt;&lt;li&gt;Search in Google for more tutorials&lt;/li&gt;&lt;li&gt;Look into well known PHP frameworks (search for: top php frameworks).&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Look into open source projects to learn how real life applications are done.&lt;/li&gt;&lt;li&gt;Practice well :)&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6487100581508098433-7457344812015032582?l=kaisar-haque.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kaisar-haque.blogspot.com/feeds/7457344812015032582/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6487100581508098433&amp;postID=7457344812015032582' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/7457344812015032582'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/7457344812015032582'/><link rel='alternate' type='text/html' href='http://kaisar-haque.blogspot.com/2008/03/how-to-begin-web-programming-with-php.html' title='How to begin web programming with PHP'/><author><name>RoboSmith</name><uri>http://www.blogger.com/profile/07878693490452605144</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6487100581508098433.post-382756373764223009</id><published>2008-01-10T10:38:00.000-08:00</published><updated>2008-03-16T08:50:31.681-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='c#'/><title type='text'>C# never made me anymore happier than today!</title><content type='html'>I wasn't anymore happier than today in ... hmm... in the last few months!&lt;br /&gt;&lt;br /&gt;I have been working with a project where I need to convert a VB.Net project into C# one. The whole project contains 40 other C++ projects which are mostly libraries and plug-ins. The full project is huge.. only the source files (.cpp, .h, .vb) are probably 50+ MB.&lt;br /&gt;&lt;br /&gt;Now there are freeware tools, both web based and desktop ones, to convert a chunk of VB.Net code to C# ones. There are some good articles on that as well. SharpDevelop, the open source C# development tool has a built in feature to convert VB.Net codes/solutions to C#. Some web based free conversion services are based on SharpDevelop. SharpDevelop does a average job in real life applications (like the one I'm working with) but it's far from being 'good'. It produces numerous amount of errors which of course we need to fix manually. It's really poor for converting VB's "implicit type conversion",  "globals" and many other common stuff!&lt;br /&gt;&lt;br /&gt;As our client suggested, I used a commercial conversion tool, it's from vbconversions.net. This one was not as fool as the open source or freeware ones but it yielded a lot of errors too. One funny thing with this tool is that it horribly masses up name spaces and some function parameters (which are not of intrinsic type or has name space), and of course it fails handling VB's implicit conversions too.&lt;br /&gt;&lt;br /&gt;After fixing thousands of errors for almost a week we finally got our project compiling! Then the final moment arrived, we wanted to run it! We did.. and (as to my expectation)..  it crashed horribly!&lt;br /&gt;&lt;br /&gt;After one more week of debugging and tracing down the almost untraceable, horrible and ugly crashes.. I almost began to loose patients!&lt;br /&gt;&lt;br /&gt;But today, some horrible thread related bugs were solved dramatically.. and guess what.. finally .. we got what we wanted... we got it running today! The project loads and shows the 3D models the way it should do.. well, even though there are a lot of bugs we need smash!&lt;br /&gt;&lt;br /&gt;When the project ran and gave me the same output of the VB.Net project, it was a beautiful thing to see and a very interesting moment. It made me really happy.. :)&lt;br /&gt;&lt;br /&gt;Now, it gives a lot of inspiration and stamina to fix the rest of bugs. I'll have a formal QA first on this stage of the project and then start fixing. So rest of the bugs, be aware.. here I come.. :)&lt;br /&gt;&lt;br /&gt;By the way, the client of the project I am working for is one of the leading game development companies in the world, everyone knows their name and it's interesting to work for them.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6487100581508098433-382756373764223009?l=kaisar-haque.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kaisar-haque.blogspot.com/feeds/382756373764223009/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6487100581508098433&amp;postID=382756373764223009' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/382756373764223009'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/382756373764223009'/><link rel='alternate' type='text/html' href='http://kaisar-haque.blogspot.com/2008/01/c-never-made-me-anymore-happier-than.html' title='C# never made me anymore happier than today!'/><author><name>RoboSmith</name><uri>http://www.blogger.com/profile/07878693490452605144</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6487100581508098433.post-1429851789188331067</id><published>2007-12-17T03:06:00.000-08:00</published><updated>2007-12-17T03:35:42.718-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='web'/><title type='text'>Upcoming Google Knol - a Wikipedia killer?</title><content type='html'>Google has just announced their latest upcoming application called 'Google Knol'. It's a tool for posting and sharing information in the form of articles. Much like Wikipedia, Google Knol just seems to be more social and focusing more on the author's name, and of course its 'Google' branded. 'Google branded' means Knol will have more higher rank results than the Wikipedia, answers.com or other sites in search results on general topics.&lt;br /&gt;&lt;br /&gt;Users can share, rate, suggest edit, add contents to articles. There can be more than one article on a topic from different authors, unlike Wikipedia. In Wikipedia, all aurthors edit/enhance one article per topic. Wikipedia is 'topic centric' where as Google Knol will be 'author centric'.&lt;br /&gt;&lt;br /&gt;Here's the intro at Google's official blog:&lt;br /&gt;"The web contains an enormous amount of information, and Google has helped to make that information more easily accessible by providing pretty good search facilities. But not everything is written nor is everything well organized to make it easily discoverable. There are millions of people who possess useful knowledge that they would love to share, and there are billions of people who can benefit from it. We believe that many do not share that knowledge today simply because it is not easy enough to do that. The challenge posed to us by Larry, Sergey and Eric was to find a way to help people share their knowledge. This is our main goal."&lt;br /&gt;&lt;br /&gt;So is this a Wikipedia killer? In my point of view, it's not gonna be an easy task for Google to takeover the popularity of Wikipedia anytime soon. They need something more jaw breaking (a feature, functionality or an idea) to do so. Well only time can tell the 'actual' story.. :).&lt;br /&gt;&lt;br /&gt;More on Google's Blog:&lt;br /&gt;&lt;a href="http://googleblog.blogspot.com/2007/12/encouraging-people-to-contribute.html"&gt;http://googleblog.blogspot.com/2007/12/encouraging-people-to-contribute.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Constructive comments by Roger Ehrenberg, who's not so optimistic about the success of Knol, is here:&lt;br /&gt;&lt;a href="http://seekingalpha.com/article/57457-google-knol-not-setting-the-world-on-fire."&gt;http://seekingalpha.com/article/57457-google-knol-not-setting-the-world-on-fire.&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6487100581508098433-1429851789188331067?l=kaisar-haque.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kaisar-haque.blogspot.com/feeds/1429851789188331067/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6487100581508098433&amp;postID=1429851789188331067' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/1429851789188331067'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/1429851789188331067'/><link rel='alternate' type='text/html' href='http://kaisar-haque.blogspot.com/2007/12/upcoming-google-knol-wikipedia-killer.html' title='Upcoming Google Knol - a Wikipedia killer?'/><author><name>RoboSmith</name><uri>http://www.blogger.com/profile/07878693490452605144</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6487100581508098433.post-796544962004114394</id><published>2007-12-11T17:56:00.000-08:00</published><updated>2007-12-11T18:54:12.853-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='visual studio'/><category scheme='http://www.blogger.com/atom/ns#' term='c++'/><category scheme='http://www.blogger.com/atom/ns#' term='c#'/><category scheme='http://www.blogger.com/atom/ns#' term='web'/><title type='text'>Visual Studio.Net for free</title><content type='html'>Yes, many of us do not know this fact but there are free editions of the mighty Visual Studio IDE, the languages: Visual C++, Visual C#, Visual Basic and SQL Server. It's called the 'Express Editions'.&lt;br /&gt;&lt;br /&gt;Visual Studio Express Editions (2005, 2008, etc) are free versions of Visual Studio professional editions with limitations on some professional and enterprise features. Targets of Express Editions are mostly beginners, hobbyist and students.&lt;br /&gt;&lt;br /&gt;This very good strategy of Microsoft is definitely targeted to reach the mass market and make more programmers divert to or become Visual Studio developers. Open source tools, languages and operating systems are causing Microsoft to loose ground at an alarming rate over the last few years. The free editions are one of few and good steps of Microsoft against it.&lt;br /&gt;&lt;br /&gt;Whatever the reasons for the express editions are, it's a great news for beginners, students and hobbyists. I've used C# express edition (2005) for a moderate sized application earlier this year and hardly noticed any significant changes. You can easily switch between the Visual Studio professional and express editions too. So, if you begin developing an application in Express Edition and want to move to professional edition later, it's a piece of cake!&lt;br /&gt;&lt;br /&gt;Web site &amp;amp; downloads: &lt;a href="http://www.microsoft.com/express/"&gt;http://www.microsoft.com/express/.&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6487100581508098433-796544962004114394?l=kaisar-haque.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kaisar-haque.blogspot.com/feeds/796544962004114394/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6487100581508098433&amp;postID=796544962004114394' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/796544962004114394'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/796544962004114394'/><link rel='alternate' type='text/html' href='http://kaisar-haque.blogspot.com/2007/12/visual-studionet-for-free.html' title='Visual Studio.Net for free'/><author><name>RoboSmith</name><uri>http://www.blogger.com/profile/07878693490452605144</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6487100581508098433.post-5530912682370658535</id><published>2007-12-11T16:53:00.000-08:00</published><updated>2007-12-11T19:10:15.287-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='web'/><title type='text'>Ext JS 2.0 final is out</title><content type='html'>As the title says, Ext JS 2.0 final has been released on December 4, 2007.  You can check it out and download it at &lt;a href="http://extjs.com/"&gt;extjs.com&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Ext JS 1.1 rocked my heart. I had used it in a bio-informatics web 2.0 application (basically a DNA sequence/template modification application with lots of complex business rules, built with .Net 2 and Ext JS). Ext JS 1.1 dramatically improved the application GUI over another GUI framework we used earlier.&lt;br /&gt;&lt;br /&gt;Ext JS is definitely one of the best choices if you're planning for a heavy weight GUI based web application but may not be a good choice if you're planning for a lightweight application. The main reason behind this is the 'bluky' size of the library. To use all features of the library, you can include the full library in your application, which is around 580 KB for Ext JS 1.1.1 and 614 KB for Ext JS 2.0. In that case, the only thing may bother you, the lightweight lovers, 'a lot' is the load time of your page/application. It's definitely very noticeable in the slower speed internet connection (like dial-ups).&lt;br /&gt;&lt;br /&gt;With Ext JS 1.1, it was difficult to choose the specific library parts of the library for any specific features or widgets, for example the nice window message box dialogs. 'Packages' didn't help much, or I do not know how to use them :). If you have any expectations from Ext JS 2.0 about being it any more lightweight or choosing specific library parts easily, it may disappoint you. But you'll definitely like the more dramatics Ext 2.0 has to offer over its predecessor.&lt;br /&gt;&lt;br /&gt;Ext 2.0 offers newer components, layouts, better examples and a better documentation. It's worth of upgrading to it for your current web 2.0 application, if time permits.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6487100581508098433-5530912682370658535?l=kaisar-haque.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kaisar-haque.blogspot.com/feeds/5530912682370658535/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6487100581508098433&amp;postID=5530912682370658535' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/5530912682370658535'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/5530912682370658535'/><link rel='alternate' type='text/html' href='http://kaisar-haque.blogspot.com/2007/12/ext-js-20-final-is-out.html' title='Ext JS 2.0 final is out'/><author><name>RoboSmith</name><uri>http://www.blogger.com/profile/07878693490452605144</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6487100581508098433.post-1949850574950192141</id><published>2007-12-05T02:55:00.000-08:00</published><updated>2007-12-05T03:31:04.368-08:00</updated><title type='text'>Animoto - A.I. creates your music videos!</title><content type='html'>"Animoto is a web application that automatically generates professionally produced videos using patent-pending Cinematic Artificial Intelligence technology and high-end motion design. Each video is a fully customized orchestration of user-selected images and music. Produced in widescreen format, Animoto videos have the visual energy of a music video and the emotional impact of a movie trailer.&lt;br /&gt;&lt;br /&gt;The heart of Animoto is its newly developed Cinematic A.I. technology that thinks like an actual director and editor. It analyzes and combines user-selected images and music with the same sophisticated post-production skills and techniques that are used in television and film. The technology takes into account every nuance of a song: the genre, song structure, energy, rhythm, instrumentation, and vocals. Whether it's punk, pop, hip-hop or a classical Stravinsky piece, every Animoto video is totally customized. Even videos generated with an identical set of images and music will each have a completely distinct set of motion design. No two videos are the same. They can be emailed, and embedded in pages on websites including social network sites like Facebook and MySpace."&lt;br /&gt;&lt;br /&gt;The above text is taken from the Animoto web site.&lt;br /&gt;&lt;br /&gt;So A.I. creates music videos for you! Can things be anymore cool? :) I guess this application will get huge popularity in a few days. YouTube fans won't wait to publish thousands of their own music videos, created with this, right away.&lt;br /&gt;&lt;br /&gt;You can create only short length, 30 seconds videos for free but you can create as many as you want.&lt;br /&gt;&lt;br /&gt;Check it out at http://animoto.com/.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6487100581508098433-1949850574950192141?l=kaisar-haque.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kaisar-haque.blogspot.com/feeds/1949850574950192141/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6487100581508098433&amp;postID=1949850574950192141' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/1949850574950192141'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/1949850574950192141'/><link rel='alternate' type='text/html' href='http://kaisar-haque.blogspot.com/2007/12/animoto-ai-creates-your-music-videos.html' title='Animoto - A.I. creates your music videos!'/><author><name>RoboSmith</name><uri>http://www.blogger.com/profile/07878693490452605144</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6487100581508098433.post-2596180875199384222</id><published>2007-12-01T20:24:00.000-08:00</published><updated>2007-12-01T20:43:16.042-08:00</updated><title type='text'>Why Good Programmers Are Lazy and Dumb</title><content type='html'>Please check out this very interesting article, you'll surely be convinced that you're lazy and dumb and will realize why you've been coding so hard all these years :). I really liked this article. Here goes the first few lines from the article:&lt;br /&gt;&lt;br /&gt;"I realized that, paradoxically enough, good programmers need to be both lazy and dumb.&lt;br /&gt;&lt;br /&gt;Lazy, because only lazy programmers will want to write the kind of tools that might replace them in the end. Lazy, because only a lazy programmer will avoid writing monotonous, repetitive code – thus avoiding redundancy, the enemy of software maintenance and flexible refactoring. Mostly, the tools and processes that come out of this endeavor fired by laziness will speed up the production."&lt;br /&gt;&lt;br /&gt;URL: &lt;a href="http://blogoscoped.com/archive/2005-08-24-n14.html"&gt;http://blogoscoped.com/archive/2005-08-24-n14.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Chao!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6487100581508098433-2596180875199384222?l=kaisar-haque.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kaisar-haque.blogspot.com/feeds/2596180875199384222/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6487100581508098433&amp;postID=2596180875199384222' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/2596180875199384222'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/2596180875199384222'/><link rel='alternate' type='text/html' href='http://kaisar-haque.blogspot.com/2007/12/why-good-programmers-are-lazy-and-dumb.html' title='Why Good Programmers Are Lazy and Dumb'/><author><name>RoboSmith</name><uri>http://www.blogger.com/profile/07878693490452605144</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6487100581508098433.post-3820761426718103897</id><published>2007-11-30T16:42:00.000-08:00</published><updated>2011-04-24T17:06:19.508-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='c++'/><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><title type='text'>How to become a good programmer</title><content type='html'>At ReliSource, many of the times I am involved in the hiring process and need to take several interviews per week/month. Over the last two years, I’m observing one unfortunate truth which is: Bangladesh is lacking enough skilled programmers. Some people have talked about this issue previously and I think it’s time to take some real steps to improve the situation so that we do not face a disaster in the near future.    &lt;p&gt;I’m putting some suggestions here for the fresh graduates and the college freshmen on how to become a good programmer.&lt;/p&gt;    &lt;p&gt;In my own definition, a fresh graduate good/skilled programmer should have the followings:&lt;/p&gt;  &lt;ol style="margin-top: 0in;" start="1" type="1"&gt;&lt;li&gt;Strong      skill of one or more good languages like C++, Java and C#.&lt;/li&gt;&lt;ol style="margin-top: 0in;" start="1" type="a"&gt;&lt;li&gt;Must       have strong skills with control structures. Don’t mess up if you’re asked       to print out triangle or other shaped piles of ‘x’s with loops.&lt;/li&gt;&lt;li&gt;Must       have strong skills with recursion. You must know how to transform a       looped task into a recursive one and vice versa, for example: multiplication       using addition recursively.&lt;/li&gt;&lt;li&gt;If       your language is C/C++, you must know how to play with pointers and       references.&lt;/li&gt;&lt;li&gt;Understand       pass by value and reference.&lt;/li&gt;&lt;li&gt;Clearly       understand scopes and memory allocation, de-allocation. Know when a object is destroyed and when to destroy.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Know       the usage of all operators including bit-wise ones.&lt;/li&gt;&lt;/ol&gt;&lt;li&gt;In-depth      knowledge of OOP.&lt;/li&gt;&lt;ol style="margin-top: 0in;" start="1" type="a"&gt;&lt;li&gt;Only       being able to write classes and doing encapsulation and inheritance is       not what you should call good OOP.&lt;/li&gt;&lt;li&gt;Clearly       understand how function overloading, overriding, polymorphism works. &lt;/li&gt;&lt;li&gt;Clearly       understand how constructor/destructor (if any) works with inheritance.&lt;/li&gt;&lt;li&gt;Clearly       know the difference and use of Interfaces and Abstract classes.&lt;/li&gt;&lt;li&gt;Know       how to overload operators. Why and how copy constructor is defined/used.&lt;/li&gt;&lt;/ol&gt;&lt;li&gt;Know common      data structures&lt;/li&gt;&lt;ol style="margin-top: 0in;" start="1" type="a"&gt;&lt;li&gt;At       least know the common data structures like stack, queue, linked list,       doubly linked list (know circular version of all of them) and trees.&lt;/li&gt;&lt;li&gt;Be a       skilled implementer of any of those, have clear concept of how push, pop,       add, delete, peek etc method works on those data structures.&lt;/li&gt;&lt;/ol&gt;&lt;li&gt;Know      most common algorithms well&lt;/li&gt;&lt;ol style="margin-top: 0in;" start="1" type="a"&gt;&lt;li&gt;You       don’t need to memorize pseudo codes line by line but you need to have       clear concept of most common algorithms of sorting(bubble, quick, merge,       heap, bucket, etc), searching (including DFS, BFS), etc.&lt;/li&gt;&lt;li&gt;As a       fresher you must know their time and space complexities, pitfalls and       improvements (if any).&lt;/li&gt;&lt;/ol&gt;&lt;li&gt;General      computing concepts:&lt;/li&gt;&lt;ol style="margin-top: 0in;" start="1" type="a"&gt;&lt;li&gt;Know       processes and threads, how are they related to each other, how to program       them, etc.&lt;/li&gt;&lt;li&gt;Understand       TCP/IP: Don’t think it’s only the network administrator’s task to understand       TCP/IP. All programmers ever doing any network or web programming should       have clear TCP/IP concepts and understanding.&lt;/li&gt;&lt;/ol&gt;&lt;li&gt;Be      skilled in debugging in IDEs:&lt;/li&gt;&lt;ol style="margin-top: 0in;" start="1" type="a"&gt;&lt;li&gt;Be skilled       in any of Visual Studio/Visual Studio.Net, Eclipse, Netbeans,       KDevelop, etc.&lt;/li&gt;&lt;li&gt;Know       how to debug your code.&lt;/li&gt;&lt;/ol&gt;&lt;li&gt;Have      basic knowledge of Software Engineering and SDLC.&lt;/li&gt;&lt;/ol&gt;    &lt;p&gt;Some advice for college freshmen:&lt;/p&gt;  &lt;ol style="margin-top: 0in;" start="1" type="1"&gt;&lt;li&gt;Start      with C++ or Java, avoid starting with scripting languages:&lt;/li&gt;&lt;ol style="margin-top: 0in;" start="1" type="a"&gt;&lt;li&gt;If       you’re learning programming for the first time, avoid starting with scripting       or loosely typed languages like: PHP, ASP, Perl, etc or Visual Basic. It       may destroy your understanding of program execution, data types, memory       allocation, etc.&lt;/li&gt;&lt;li&gt;Start       with C++ or Java. If you want to me to be specific, start with C++, you’ll       love it for the rest of your life.. :) It’ll be easier for you to learn (almost)       any other language (like: C#, PHP, ASP, etc).&lt;/li&gt;&lt;li&gt;If       you ask, do you need to know C to start with C++? Or should you learn C       first and then C++? C definitely helps a lot for learning C++ but it's not mandatory to start with C.&lt;/li&gt;&lt;/ol&gt;&lt;li&gt;If you      want to be a good programmer, keep on coding at least 20 hours a week for the      next 4 years :).&lt;/li&gt;&lt;li&gt;Never stop learning new technologies that are coming out      everyday.&lt;/li&gt;&lt;li&gt;Know some of the many languages/technologies but be master of one. Know at least one language very well.&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;  &lt;p&gt;Good luck!&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6487100581508098433-3820761426718103897?l=kaisar-haque.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kaisar-haque.blogspot.com/feeds/3820761426718103897/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6487100581508098433&amp;postID=3820761426718103897' title='48 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/3820761426718103897'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/3820761426718103897'/><link rel='alternate' type='text/html' href='http://kaisar-haque.blogspot.com/2007/11/how-to-become-good-programmer.html' title='How to become a good programmer'/><author><name>RoboSmith</name><uri>http://www.blogger.com/profile/07878693490452605144</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>48</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6487100581508098433.post-3051376132920262678</id><published>2007-11-30T15:35:00.000-08:00</published><updated>2007-11-30T15:46:18.341-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='c++'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>An interesting interview with great programmers</title><content type='html'>&lt;p&gt;Please check out this interesting interview.&lt;br /&gt;&lt;br /&gt;The following persons were interviewed:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Bjarne Stroustrup - C++ creator&lt;/li&gt;&lt;li&gt;Linus Torvalds - The Linux kernel author&lt;/li&gt;&lt;li&gt;James Gosling - The Java language creator&lt;/li&gt;&lt;li&gt;Peter Norvig - Research Director at Google, a well known Lisper, author of famous (in some circles at least) books about AI.&lt;/li&gt;&lt;li&gt;Guido Van Rossum - The Python language creator&lt;/li&gt;&lt;li&gt;Tim Bray - One of the XML and Atom specifications author and a blogger too.&lt;/li&gt;&lt;li&gt;Dave Thomas - Author of the “Pragmmatic Programmer”, “Programming Ruby” and other great books about programming.&lt;/li&gt;&lt;li&gt;David Heinemeier Hansson - Author of the Rails Framework - the new hot web development framework.&lt;/li&gt;&lt;li&gt;Steve Yegge - Probably the least known from guys here, but also made one of the most interestings answers, has a popular weblog about programming. He is also the author of a game called “Wyvern”.&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;The following questions were asked:&lt;/p&gt;&lt;ol&gt;&lt;li&gt;How did you learn programming? Were any schools of any use? Or maybe you didn’t even bother with ending any schools :) ?&lt;/li&gt;&lt;li&gt;What do you think is the most important skill every programmer should posses?&lt;/li&gt;&lt;li&gt;Do you think mathematics and/or physics are an important skill for a programmer? Why?&lt;/li&gt;&lt;li&gt;What do you think will be the next big thing in computer programming? X-oriented programming, y language, quantum computers, what?&lt;/li&gt;&lt;li&gt;If you had three months to learn one relatively new technology, which one would You choose?&lt;/li&gt;&lt;li&gt;What do you think makes some programmers 10 or 100 times more productive than others?&lt;/li&gt;&lt;li&gt;What are your favourite tools (operating system, programming/scripting language, text editor, version control system, shell, database engine, other tools you can’t live without) and why do you like them more than others?&lt;/li&gt;&lt;li&gt;What is your favourite book related to computer programming?&lt;/li&gt;&lt;li&gt;What is Your favourite book NOT related to computer programming?&lt;/li&gt;&lt;li&gt;What are your favourite music bands/performers/compositors?&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;Url: &lt;a href="http://www.stifflog.com/2006/10/16/stiff-asks-great-programmers-answer/"&gt;http://www.stifflog.com/2006/10/16/stiff-asks-great-programmers-answer/&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Chao!&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6487100581508098433-3051376132920262678?l=kaisar-haque.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kaisar-haque.blogspot.com/feeds/3051376132920262678/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6487100581508098433&amp;postID=3051376132920262678' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/3051376132920262678'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/3051376132920262678'/><link rel='alternate' type='text/html' href='http://kaisar-haque.blogspot.com/2007/11/interesting-interview-with-great.html' title='An interesting interview with great programmers'/><author><name>RoboSmith</name><uri>http://www.blogger.com/profile/07878693490452605144</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6487100581508098433.post-3470195585921978810</id><published>2007-11-22T13:40:00.000-08:00</published><updated>2007-11-30T16:53:49.677-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='c++'/><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><title type='text'>Some interesting facts about the origin of C++</title><content type='html'>If you don't know them alredy, enjoy:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;BCPL’s // comment convention was (re)introduced in C++.&lt;/li&gt;&lt;li&gt;The class concept (with derived classes and virtual functions) was borrowed from Simula67.&lt;/li&gt;&lt;li&gt;C++’s facility for overloading operators and the freedom to place a declaration wherever a statement can occur resembles Algol68.&lt;/li&gt;&lt;li&gt;Templates were partly inspired by Ada’s generics (both their strengths and their weaknesses) and partly by Clu’s parameterized modules.&lt;/li&gt;&lt;li&gt;The C++ exception-handling mechanism was inspired partly by Ada, Clu, and ML.&lt;/li&gt;&lt;li&gt;Other developments in the 1985 to 1995 time span – such as multiple inheritance, pure virtual functions, and namespaces – were primarily generalizations driven by experience with the use of C++ rather than ideas imported from other languages.&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;Source:The C++ Programming Language, Special Edition by Bjarne Stroustrup.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6487100581508098433-3470195585921978810?l=kaisar-haque.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kaisar-haque.blogspot.com/feeds/3470195585921978810/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6487100581508098433&amp;postID=3470195585921978810' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/3470195585921978810'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/3470195585921978810'/><link rel='alternate' type='text/html' href='http://kaisar-haque.blogspot.com/2007/11/some-interesting-facts-about-c.html' title='Some interesting facts about the origin of C++'/><author><name>RoboSmith</name><uri>http://www.blogger.com/profile/07878693490452605144</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6487100581508098433.post-8987031628417898438</id><published>2007-11-22T12:21:00.000-08:00</published><updated>2007-11-30T16:52:13.563-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><title type='text'>Linux: Using the 'find' command.</title><content type='html'>In Linux, often times you'll need to find files using patterns like '*.txt' or 'sys*.*' and do operations with the results. You can do that in several ways. A harder way will be writing a complicated script using the 'ls' and 'grep' commands in pipe. But the 'find' command is one of the easier ways. I'm using the terms 'easier' as I'm not sure of the 'easiest' way as I am not a Linux guru.. well yet.. ;)&lt;br /&gt;&lt;br /&gt;The 'find' command is powerfull but if you're a begginer, you'll hardly understand the help or manual of it. I won't re-write the man page in some easy way here, rather I'll just give some examples so that you can quickly use it and understand the man page later on. So, here goes the examples:&lt;br /&gt;&lt;br /&gt;1. Search all '.txt' files in the current directory, including its subdirectories:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;find . -iname "*.txt"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;2. Search all files with the name 'pre_*.txt' (example: pre_01.txt, pre_abcd.txt, etc) in the 'src/dir', including its subdirectories:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;find src/dir -iname "pre_*.txt"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;3. Search all '.txt' files in the current directory, including its subdirectories, and copy/move them to another directory:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;find . -iname "*.txt" -exec cp {} /dest/dir \;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;find . -iname "*.txt" -exec mv {} /dest/dir \;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Note: don't forget the '\;' in the end, it won't work otherwise.&lt;br /&gt;&lt;br /&gt;4. Find all .htm files in the current directory, including its subdirectories, and compress them into a gzip file naming 'output.tar.gz', maintaining the directory structure that they were found in:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;find . -iname "*.htm" &gt; temp.txt&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;tar -czT temp.txt -f output.tar.gz&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I hope this post will be helpful to you sometime.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6487100581508098433-8987031628417898438?l=kaisar-haque.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kaisar-haque.blogspot.com/feeds/8987031628417898438/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6487100581508098433&amp;postID=8987031628417898438' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/8987031628417898438'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/8987031628417898438'/><link rel='alternate' type='text/html' href='http://kaisar-haque.blogspot.com/2007/11/linux-using-find-command.html' title='Linux: Using the &apos;find&apos; command.'/><author><name>RoboSmith</name><uri>http://www.blogger.com/profile/07878693490452605144</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6487100581508098433.post-2304810530927238969</id><published>2007-08-21T12:40:00.000-07:00</published><updated>2008-03-16T11:38:08.071-07:00</updated><title type='text'>A Comparison of Digital Camcorder Sensors</title><content type='html'>Few days ago, I did some research on the digital camcorder models. I have created an interesting matrix comparing the sensors of the cameras at different price levels. I'll share that with you here.&lt;br /&gt;&lt;br /&gt;If you are new to the digital camcorder world, you can check out the introductory articles in the links provided at the end of this post. I'll put some summary here:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Definition:&lt;/span&gt; There are two types of definitions: Standard and High definition (Hi-def). Standard is an old technology for regular TVs providing 540 lines of resolution. Hi-def is newer and superior to Standard defition, providing 1080 lines (4 times) of resolution on hi-def TVs. Hi-def is a very expensive technology at this moment but in near future (say in next 3 years), this will be the widely accepted one.&lt;br /&gt;&lt;br /&gt;I'll refer to standard definition in this article and the comparison table is for standard definition cameras.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Storage/Media Types:&lt;/span&gt; This plays a vital role on the price and performance of the camera. There are 4 main types of storages: Mini DV, Mini DVD, Hard Drive and SD (or SDHC). Here's a very brif summary of these formats:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;MiniDV&lt;/span&gt; is the least expensive, has capacity of 1 hour of high quality video. Data format is DV and takes 2+ hours (approx.) to transfer to PC and write a DVD before you can play it on your DVD player.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;MiniDVD&lt;/span&gt; is expensive, has capacity of 20 mins of high quality video. Data format is MPEG2 and can be played back on DVD player instantly.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Hard Drive (HDD)&lt;/span&gt; has no external media requirement and thus has no running cost. It has capacity of 7 hours (on 30 GB, 15 hours on 60 GB) of high quality video. Data format is MPEG2 and takes around 30 mins (approx.) to transfer to a PC and write a DVD.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;SD/SDHC&lt;/span&gt; is very expensive, 2 GB SD card can hold 20 mins of high quality video only. Like HDD, it takes 30 mins (approx.) to prepare a DVD using a PC.&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;span style="font-weight: bold;"&gt;Manufacturers:&lt;/span&gt; The four main manufacturer companies are: Sony, Panasonic, Canon and JVC. Canon and Sony dominates the lower price models, Panasonic dominates the 3 CCD world and JVC dominates with a lot of Hard Drive cameras.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Sensor:&lt;/span&gt; This is the first most important factor behind picture quality. Sensor type, physical size and resolution (number of pixels) are important. There are two types of sensors CCD and CMOS. Just a high level summary would be: lower range of camcorders have 1/6" CCD sensors and higher ends have 1/3" or better CMOS sensors. The higher resolution of the sensor is, the better the picture gets.&lt;br /&gt;&lt;br /&gt;In the comparison table, the column 'Sensor - Total Pixels' specifies the total number of pixel the camera sensor has and the column 'Sensor - Effective Pixels' specifies the effective number of pixels used to capture the video.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;The comparison table:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;br /&gt;Here it goes:&lt;br /&gt;&lt;table id="table1" style="border-collapse: collapse;" border="1" width="100%"&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td width="15%"&gt;&lt;b&gt;Price Range&lt;br /&gt;(Approx.)&lt;/b&gt;&lt;/td&gt;   &lt;td width="20%"&gt;&lt;b&gt;Model&lt;/b&gt;&lt;/td&gt;   &lt;td width="15%"&gt;&lt;b&gt;Storage Type&lt;/b&gt;&lt;/td&gt;   &lt;td width="20%"&gt;&lt;b&gt;Sensor - Type&lt;/b&gt;&lt;/td&gt;   &lt;td width="15%"&gt;&lt;b&gt;Sensor - Total Pixels&lt;/b&gt;&lt;/td&gt;   &lt;td width="15%"&gt;&lt;b&gt;Sensor - Effective Pixels&lt;/b&gt;&lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td rowspan="3" width="15%"&gt;US$ 285 (BDT 20k)&lt;/td&gt;   &lt;td width="20%"&gt;Sony DCR-HC26&lt;/td&gt;   &lt;td width="15%"&gt;Mini DV&lt;/td&gt;   &lt;td width="20%"&gt;CCD&lt;/td&gt;   &lt;td width="15%"&gt;680k&lt;/td&gt;   &lt;td width="15%"&gt;340k&lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td width="20%"&gt;Sony DCR-HC28&lt;/td&gt;   &lt;td width="15%"&gt;Mini DV&lt;/td&gt;   &lt;td width="20%"&gt;CCD&lt;/td&gt;   &lt;td width="15%"&gt;680k&lt;/td&gt;   &lt;td width="15%"&gt;340k&lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td width="20%"&gt;Panasonic NV-GS27&lt;/td&gt;   &lt;td width="15%"&gt;Mini DV&lt;/td&gt;   &lt;td width="20%"&gt;CCD&lt;/td&gt;   &lt;td width="15%"&gt;800k&lt;/td&gt;   &lt;td width="15%"&gt;400k&lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td width="15%"&gt;US$ 357 (BDT 25k)&lt;/td&gt;   &lt;td width="20%"&gt;Sony DCR-HC36&lt;/td&gt;   &lt;td width="15%"&gt;Mini DV&lt;/td&gt;   &lt;td width="20%"&gt;CCD&lt;/td&gt;   &lt;td width="15%"&gt;680k&lt;/td&gt;   &lt;td width="15%"&gt;340k&lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td rowspan="3" width="15%"&gt;US$ 428 (BDT 30k)&lt;/td&gt;   &lt;td width="20%"&gt;Sony DCR-HC46&lt;/td&gt;   &lt;td width="15%"&gt;Mini DV&lt;/td&gt;   &lt;td width="20%"&gt;CCD&lt;/td&gt;   &lt;td width="15%"&gt;1M&lt;/td&gt;   &lt;td width="15%"&gt;680k&lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td width="20%"&gt;Sony DCR-DVD605&lt;/td&gt;   &lt;td width="15%"&gt;Mini DVD&lt;/td&gt;   &lt;td width="20%"&gt;CCD&lt;/td&gt;   &lt;td width="15%"&gt;800k&lt;/td&gt;   &lt;td width="15%"&gt;400k&lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td width="20%"&gt;Sony DCR-DVD608&lt;/td&gt;   &lt;td width="15%"&gt;Mini DVD&lt;/td&gt;   &lt;td width="20%"&gt;CCD&lt;/td&gt;   &lt;td width="15%"&gt;640k&lt;/td&gt;   &lt;td width="15%"&gt;340k&lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td rowspan="3" width="15%"&gt;US$ 500 (BDT 35k)&lt;/td&gt;   &lt;td width="20%"&gt;Panasonic NV-GS230&lt;/td&gt;   &lt;td width="15%"&gt;Mini DV&lt;/td&gt;   &lt;td width="20%"&gt;3CCD&lt;/td&gt;   &lt;td width="15%"&gt;800k x 3&lt;/td&gt;   &lt;td width="15%"&gt;400k x 3&lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td width="20%"&gt;Panasonic NV-GS180&lt;/td&gt;   &lt;td width="15%"&gt;Mini DV&lt;/td&gt;   &lt;td width="20%"&gt;3CCD&lt;/td&gt;   &lt;td width="15%"&gt;800k x 3&lt;/td&gt;   &lt;td width="15%"&gt;400k x 3&lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td width="20%"&gt;Sony DCR-DVD705/708&lt;/td&gt;   &lt;td width="15%"&gt;Mini DVD&lt;/td&gt;   &lt;td width="20%"&gt;CCD&lt;/td&gt;   &lt;td width="15%"&gt;1M&lt;/td&gt;   &lt;td width="15%"&gt;690k&lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td rowspan="3" width="15%"&gt;US$ 570 (BDT 40k)&lt;/td&gt;   &lt;td width="20%"&gt;Panasonic VDR-D250&lt;/td&gt;   &lt;td width="15%"&gt;Mini DVD&lt;/td&gt;   &lt;td width="20%"&gt;3CCD&lt;/td&gt;   &lt;td width="15%"&gt;800k&lt;/td&gt;   &lt;td width="15%"&gt;340k&lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td width="20%"&gt;Sony DCR-GS320&lt;/td&gt;   &lt;td width="15%"&gt;Mini DV&lt;/td&gt;   &lt;td width="20%"&gt;3CCD&lt;/td&gt;   &lt;td width="15%"&gt;800k x 3&lt;/td&gt;   &lt;td width="15%"&gt;640k x 3&lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td width="20%"&gt;Sony DCR-SR42&lt;/td&gt;   &lt;td width="15%"&gt;HDD&lt;/td&gt;   &lt;td width="20%"&gt;CCD&lt;/td&gt;   &lt;td width="15%"&gt;680k&lt;/td&gt;   &lt;td width="15%"&gt;340k&lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td rowspan="3" width="15%"&gt;US$ 642 (BDT 45k)&lt;/td&gt;   &lt;td width="20%"&gt;Sony DCR-SR62&lt;/td&gt;   &lt;td width="15%"&gt;HDD&lt;/td&gt;   &lt;td width="20%"&gt;CCD&lt;/td&gt;   &lt;td width="15%"&gt;1M&lt;/td&gt;   &lt;td width="15%"&gt;690k&lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td width="20%"&gt;JVC GZ-MG155&lt;/td&gt;   &lt;td width="15%"&gt;HDD&lt;/td&gt;   &lt;td width="20%"&gt;CCD&lt;/td&gt;   &lt;td width="15%"&gt;1M&lt;/td&gt;   &lt;td width="15%"&gt;690k&lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td width="20%"&gt;Panasonic SDR-H250&lt;/td&gt;   &lt;td width="15%"&gt;HDD/SD&lt;/td&gt;   &lt;td width="20%"&gt;3CCD&lt;/td&gt;   &lt;td width="15%"&gt;800k x 3&lt;/td&gt;   &lt;td width="15%"&gt;640k x 3&lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td rowspan="2" width="15%"&gt;US$ 714 (BDT 50k)&lt;/td&gt;   &lt;td width="20%"&gt;Sony DCR-HC96&lt;/td&gt;   &lt;td width="15%"&gt;Mini DV&lt;/td&gt;   &lt;td width="20%"&gt;CCD&lt;/td&gt;   &lt;td width="15%"&gt;3.3M&lt;/td&gt;   &lt;td width="15%"&gt;2.05M&lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td width="20%"&gt;Sony DCR-DVD805/405&lt;/td&gt;   &lt;td width="15%"&gt;Mini DVD&lt;/td&gt;   &lt;td width="20%"&gt;1/3" CCD&lt;/td&gt;   &lt;td width="15%"&gt;3.3M&lt;/td&gt;   &lt;td width="15%"&gt;2M&lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td rowspan="3" width="15%"&gt;US$ 857+  (BDT 60k+)&lt;br /&gt;&lt;/td&gt;   &lt;td width="20%"&gt;Sony DCR-DVD905/505&lt;/td&gt;   &lt;td width="15%"&gt;Mini DVD&lt;/td&gt;   &lt;td width="20%"&gt;1/3" ClearVID CMOS&lt;/td&gt;   &lt;td width="15%"&gt;2M&lt;/td&gt;   &lt;td width="15%"&gt;1.9M&lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td width="20%"&gt;Sony DCR-SR200&lt;/td&gt;   &lt;td width="15%"&gt;HDD&lt;/td&gt;   &lt;td width="20%"&gt;1/3" ClearVid CMOS&lt;/td&gt;   &lt;td width="15%"&gt;2M&lt;/td&gt;   &lt;td width="15%"&gt;1M&lt;/td&gt;  &lt;/tr&gt;  &lt;tr&gt;   &lt;td width="20%"&gt;Sony DCR-SR300&lt;/td&gt;   &lt;td width="15%"&gt;HDD&lt;/td&gt;   &lt;td width="20%"&gt;1/2.9" ClearVid CMOS&lt;/td&gt;   &lt;td width="15%"&gt;3M&lt;/td&gt;   &lt;td width="15%"&gt;1.7M&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;p style="font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;(Prices are as of August 2007 in Dhaka, Bangladesh).&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="font-weight: bold;"&gt; Summary/Notes:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Lower end camcorders having 340k effective pixel sensors produce bad quality videos.&lt;/li&gt;&lt;li&gt;Cameras with 640k/690k effective pixel sensors produces moderate quality videos.&lt;/li&gt;&lt;li&gt;Mid range 3CCD camcorders produces superb and natural colors and brightness.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;If you have the budget, go for 1/3.0" ClearVid CMOS or better sensors.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;miniDV produces highest quality videos. Hard drive, on the other hand, gives most room and conveniences for managing clips.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;b&gt;Links:&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;These are some very good sites where you'll get a lot of reviews and specs:&lt;b&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://reviews.cnet.com/"&gt;reviews.cnet.com/&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.camcorderinfo.com/"&gt;camcorderinfo.com&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.simplydv.co.uk/"&gt;simplydv.co.uk&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.digitalcamera-hq.com/"&gt;digitalcamera-hq.com&lt;/a&gt;/&lt;/li&gt;&lt;/ul&gt;I hope the article will be helpful to you.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6487100581508098433-2304810530927238969?l=kaisar-haque.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kaisar-haque.blogspot.com/feeds/2304810530927238969/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6487100581508098433&amp;postID=2304810530927238969' title='13 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/2304810530927238969'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/2304810530927238969'/><link rel='alternate' type='text/html' href='http://kaisar-haque.blogspot.com/2007/08/comparison-of-digital-camcorder-sensors.html' title='A Comparison of Digital Camcorder Sensors'/><author><name>RoboSmith</name><uri>http://www.blogger.com/profile/07878693490452605144</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>13</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6487100581508098433.post-962483467354760878</id><published>2007-07-23T03:07:00.001-07:00</published><updated>2011-04-15T16:09:43.016-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='c++'/><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><title type='text'>C++: A nice thread class</title><content type='html'>Java and .Net have very nice and easy ways to create threads. We can trun any class into a thread  within seconds and that's probably one of their  coolest features. As a Win32 C++ programmer, we don't have this advantage. But we can achieve this very easily. Here is how.&lt;br /&gt;&lt;br /&gt;Following is my thread class which you need to include to make threading a piece of cake.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;The class:&lt;/span&gt;&lt;br /&gt;&lt;pre&gt;&lt;span class="lineNumber"&gt;  1&lt;/span&gt; &lt;span class="keyword"&gt;class&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="othertext"&gt;Thread&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt;  2&lt;/span&gt; &lt;/span&gt;&lt;span class="punctuation"&gt;{&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt;  3&lt;/span&gt; &lt;/span&gt;&lt;span class="keyword"&gt;public&lt;/span&gt;&lt;span class="punctuation"&gt;:&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt;  4&lt;/span&gt;  &lt;/span&gt;&lt;span class="othertext"&gt;Thread&lt;/span&gt;&lt;span class="punctuation"&gt;(&lt;/span&gt;&lt;span class="punctuation"&gt;)&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt;  5&lt;/span&gt;  &lt;/span&gt;&lt;span class="punctuation"&gt;{&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt;  6&lt;/span&gt;     &lt;/span&gt;&lt;span class="othertext"&gt;hThread&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="unknownchar"&gt;=&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="integerLiteral"&gt;0&lt;/span&gt;&lt;span class="punctuation"&gt;;&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt;  7&lt;/span&gt;  &lt;/span&gt;&lt;span class="punctuation"&gt;}&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt;  8&lt;/span&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt;  9&lt;/span&gt;  &lt;/span&gt;&lt;span class="builtinType"&gt;void&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="othertext"&gt;start&lt;/span&gt;&lt;span class="punctuation"&gt;(&lt;/span&gt;&lt;span class="punctuation"&gt;)&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 10&lt;/span&gt;  &lt;/span&gt;&lt;span class="punctuation"&gt;{&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 11&lt;/span&gt;     &lt;/span&gt;&lt;span class="punctuation"&gt;_&lt;/span&gt;&lt;span class="othertext"&gt;threadObj&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="unknownchar"&gt;=&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="otherLiteral"&gt;this&lt;/span&gt;&lt;span class="punctuation"&gt;;&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 12&lt;/span&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 13&lt;/span&gt;     &lt;/span&gt;&lt;span class="othertext"&gt;DWORD&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="othertext"&gt;threadID&lt;/span&gt;&lt;span class="punctuation"&gt;;&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 14&lt;/span&gt;     &lt;/span&gt;&lt;span class="othertext"&gt;hThread&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="unknownchar"&gt;=&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="othertext"&gt;CreateThread&lt;/span&gt;&lt;span class="punctuation"&gt;(&lt;/span&gt;&lt;span class="integerLiteral"&gt;0&lt;/span&gt;&lt;span class="punctuation"&gt;,&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="integerLiteral"&gt;0&lt;/span&gt;&lt;span class="punctuation"&gt;,&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="othertext"&gt;threadProc&lt;/span&gt;&lt;span class="punctuation"&gt;,&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="punctuation"&gt;_&lt;/span&gt;&lt;span class="othertext"&gt;threadObj&lt;/span&gt;&lt;span class="punctuation"&gt;,&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="integerLiteral"&gt;0&lt;/span&gt;&lt;span class="punctuation"&gt;,&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="punctuation"&gt;&amp;amp;&lt;/span&gt;&lt;span class="othertext"&gt;threadID&lt;/span&gt;&lt;span class="punctuation"&gt;)&lt;/span&gt;&lt;span class="punctuation"&gt;;&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 15&lt;/span&gt;  &lt;/span&gt;&lt;span class="punctuation"&gt;}&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 16&lt;/span&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 17&lt;/span&gt;  &lt;/span&gt;&lt;span class="builtinType"&gt;void&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="othertext"&gt;stop&lt;/span&gt;&lt;span class="punctuation"&gt;(&lt;/span&gt;&lt;span class="punctuation"&gt;)&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 18&lt;/span&gt;  &lt;/span&gt;&lt;span class="punctuation"&gt;{&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 19&lt;/span&gt;     &lt;/span&gt;&lt;span class="keyword"&gt;if&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="punctuation"&gt;(&lt;/span&gt;&lt;span class="othertext"&gt;hThread&lt;/span&gt;&lt;span class="punctuation"&gt;)&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 20&lt;/span&gt;      &lt;/span&gt;&lt;span class="othertext"&gt;TerminateThread&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="punctuation"&gt;(&lt;/span&gt;&lt;span class="othertext"&gt;hThread&lt;/span&gt;&lt;span class="punctuation"&gt;,&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="integerLiteral"&gt;0&lt;/span&gt;&lt;span class="punctuation"&gt;)&lt;/span&gt;&lt;span class="punctuation"&gt;;&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 21&lt;/span&gt;  &lt;/span&gt;&lt;span class="punctuation"&gt;}&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 22&lt;/span&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 23&lt;/span&gt;  &lt;/span&gt;&lt;span class="keyword"&gt;virtual&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="builtinType"&gt;void&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="othertext"&gt;run&lt;/span&gt;&lt;span class="punctuation"&gt;(&lt;/span&gt;&lt;span class="punctuation"&gt;)&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="unknownchar"&gt;=&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="integerLiteral"&gt;0&lt;/span&gt;&lt;span class="punctuation"&gt;;&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 24&lt;/span&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 25&lt;/span&gt; &lt;/span&gt;&lt;span class="keyword"&gt;protected&lt;/span&gt;&lt;span class="punctuation"&gt;:&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 26&lt;/span&gt;  &lt;/span&gt;&lt;span class="keyword"&gt;static&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="builtinType"&gt;unsigned&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="builtinType"&gt;long&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="punctuation"&gt;_&lt;/span&gt;&lt;span class="punctuation"&gt;_&lt;/span&gt;&lt;span class="othertext"&gt;stdcall&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="othertext"&gt;threadProc&lt;/span&gt;&lt;span class="punctuation"&gt;(&lt;/span&gt;&lt;span class="builtinType"&gt;void&lt;/span&gt;&lt;span class="punctuation"&gt;*&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="othertext"&gt;ptr&lt;/span&gt;&lt;span class="punctuation"&gt;)&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 27&lt;/span&gt;  &lt;/span&gt;&lt;span class="punctuation"&gt;{&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 28&lt;/span&gt;     &lt;/span&gt;&lt;span class="punctuation"&gt;(&lt;/span&gt;&lt;span class="punctuation"&gt;(&lt;/span&gt;&lt;span class="othertext"&gt;Thread&lt;/span&gt;&lt;span class="punctuation"&gt;*&lt;/span&gt;&lt;span class="punctuation"&gt;)&lt;/span&gt;&lt;span class="othertext"&gt;ptr&lt;/span&gt;&lt;span class="punctuation"&gt;)&lt;/span&gt;&lt;span class="punctuation"&gt;-&lt;/span&gt;&lt;span class="unknownchar"&gt;&amp;gt;&lt;/span&gt;&lt;span class="othertext"&gt;run&lt;/span&gt;&lt;span class="punctuation"&gt;(&lt;/span&gt;&lt;span class="punctuation"&gt;)&lt;/span&gt;&lt;span class="punctuation"&gt;;&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 29&lt;/span&gt;     &lt;/span&gt;&lt;span class="keyword"&gt;return&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="integerLiteral"&gt;0&lt;/span&gt;&lt;span class="punctuation"&gt;;&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 30&lt;/span&gt;  &lt;/span&gt;&lt;span class="punctuation"&gt;}&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 31&lt;/span&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 32&lt;/span&gt;  &lt;/span&gt;&lt;span class="othertext"&gt;Thread&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="punctuation"&gt;*&lt;/span&gt;&lt;span class="punctuation"&gt;_&lt;/span&gt;&lt;span class="othertext"&gt;threadObj&lt;/span&gt;&lt;span class="punctuation"&gt;;&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 33&lt;/span&gt;  &lt;/span&gt;&lt;span class="othertext"&gt;HANDLE&lt;/span&gt;&lt;span class="whitespace"&gt;    &lt;/span&gt;&lt;span class="othertext"&gt;hThread&lt;/span&gt;&lt;span class="punctuation"&gt;;&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 34&lt;/span&gt; &lt;/span&gt;&lt;span class="punctuation"&gt;}&lt;/span&gt;&lt;span class="punctuation"&gt;;&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 35&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;span style="font-weight: bold;"&gt;Example of usages:&lt;/span&gt;&lt;br /&gt;&lt;pre&gt;&lt;span class="whitespace"&gt;&lt;span class="lineNumber"&gt; 36&lt;/span&gt; &lt;/span&gt;&lt;span class="keyword"&gt;class&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="othertext"&gt;YourClass&lt;/span&gt;&lt;span class="punctuation"&gt;:&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="keyword"&gt;public&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="othertext"&gt;Thread&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 37&lt;/span&gt; &lt;/span&gt;&lt;span class="punctuation"&gt;{&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 38&lt;/span&gt; &lt;/span&gt;&lt;span class="keyword"&gt;public&lt;/span&gt;&lt;span class="punctuation"&gt;:&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 39&lt;/span&gt;  &lt;/span&gt;&lt;span class="othertext"&gt;YourClass&lt;/span&gt;&lt;span class="punctuation"&gt;(&lt;/span&gt;&lt;span class="punctuation"&gt;)&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="punctuation"&gt;{&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="punctuation"&gt;}&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 40&lt;/span&gt;  &lt;/span&gt;&lt;span class="unknownchar"&gt;~&lt;/span&gt;&lt;span class="othertext"&gt;YourClass&lt;/span&gt;&lt;span class="punctuation"&gt;(&lt;/span&gt;&lt;span class="punctuation"&gt;)&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="punctuation"&gt;{&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="punctuation"&gt;}&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 41&lt;/span&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 42&lt;/span&gt;  &lt;/span&gt;&lt;span class="lineComment"&gt;//the run function, you need to override this one&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 43&lt;/span&gt;  &lt;/span&gt;&lt;span class="builtinType"&gt;void&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="othertext"&gt;run&lt;/span&gt;&lt;span class="punctuation"&gt;(&lt;/span&gt;&lt;span class="punctuation"&gt;)&lt;/span&gt;&lt;span class="punctuation"&gt;;&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 44&lt;/span&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 45&lt;/span&gt; &lt;/span&gt;&lt;span class="keyword"&gt;private&lt;/span&gt;&lt;span class="punctuation"&gt;:&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 46&lt;/span&gt;  &lt;/span&gt;&lt;span class="lineComment"&gt;//private variables&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 47&lt;/span&gt; &lt;/span&gt;&lt;span class="punctuation"&gt;}&lt;/span&gt;&lt;span class="punctuation"&gt;;&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 48&lt;/span&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 49&lt;/span&gt; &lt;/span&gt;&lt;span class="builtinType"&gt;void&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="othertext"&gt;YourClass&lt;/span&gt;&lt;span class="punctuation"&gt;:&lt;/span&gt;&lt;span class="punctuation"&gt;:&lt;/span&gt;&lt;span class="othertext"&gt;run&lt;/span&gt;&lt;span class="punctuation"&gt;(&lt;/span&gt;&lt;span class="punctuation"&gt;)&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 50&lt;/span&gt; &lt;/span&gt;&lt;span class="punctuation"&gt;{&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 51&lt;/span&gt;  &lt;/span&gt;&lt;span class="lineComment"&gt;//Add your threaded code here&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 52&lt;/span&gt; &lt;/span&gt;&lt;span class="punctuation"&gt;}&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 53&lt;/span&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 54&lt;/span&gt; &lt;/span&gt;&lt;span class="builtinType"&gt;int&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="othertext"&gt;main&lt;/span&gt;&lt;span class="punctuation"&gt;(&lt;/span&gt;&lt;span class="punctuation"&gt;)&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 55&lt;/span&gt; &lt;/span&gt;&lt;span class="punctuation"&gt;{&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 56&lt;/span&gt;  &lt;/span&gt;&lt;span class="othertext"&gt;YourClass&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="othertext"&gt;obj&lt;/span&gt;&lt;span class="punctuation"&gt;;&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 57&lt;/span&gt;  &lt;/span&gt;&lt;span class="othertext"&gt;obj&lt;/span&gt;&lt;span class="punctuation"&gt;.&lt;/span&gt;&lt;span class="othertext"&gt;start&lt;/span&gt;&lt;span class="punctuation"&gt;(&lt;/span&gt;&lt;span class="punctuation"&gt;)&lt;/span&gt;&lt;span class="punctuation"&gt;;&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 58&lt;/span&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 59&lt;/span&gt;  &lt;/span&gt;&lt;span class="lineComment"&gt;//the thread is running&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 60&lt;/span&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 61&lt;/span&gt;  &lt;/span&gt;&lt;span class="othertext"&gt;obj&lt;/span&gt;&lt;span class="punctuation"&gt;.&lt;/span&gt;&lt;span class="othertext"&gt;stop&lt;/span&gt;&lt;span class="punctuation"&gt;(&lt;/span&gt;&lt;span class="punctuation"&gt;)&lt;/span&gt;&lt;span class="punctuation"&gt;;&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 62&lt;/span&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 63&lt;/span&gt;  &lt;/span&gt;&lt;span class="lineComment"&gt;//the thread is stopped&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 64&lt;/span&gt;  &lt;/span&gt;&lt;span class="keyword"&gt;return&lt;/span&gt;&lt;span class="whitespace"&gt; &lt;/span&gt;&lt;span class="integerLiteral"&gt;0&lt;/span&gt;&lt;span class="punctuation"&gt;;&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 65&lt;/span&gt; &lt;/span&gt;&lt;span class="punctuation"&gt;}&lt;/span&gt;&lt;span class="whitespace"&gt;&lt;br /&gt;&lt;span class="lineNumber"&gt; 66&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Looks cool, right? It's your turn to try it. Happy threading.&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6487100581508098433-962483467354760878?l=kaisar-haque.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kaisar-haque.blogspot.com/feeds/962483467354760878/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6487100581508098433&amp;postID=962483467354760878' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/962483467354760878'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/962483467354760878'/><link rel='alternate' type='text/html' href='http://kaisar-haque.blogspot.com/2007/07/c-nice-thread-class_23.html' title='C++: A nice thread class'/><author><name>RoboSmith</name><uri>http://www.blogger.com/profile/07878693490452605144</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6487100581508098433.post-4110597007578800560</id><published>2007-06-24T03:23:00.000-07:00</published><updated>2008-12-08T21:08:02.075-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mobile applications'/><category scheme='http://www.blogger.com/atom/ns#' term='j2me'/><title type='text'>PExpenses for J2ME - My open source personal expense tracker.</title><content type='html'>&lt;div align="left"&gt;Few days ago, I was looking for a free Symbian or J2ME application for tracking my expenses using my phone easily. I downloaded 3/4 but all of them disapointed me. So, last night I created and uploaded this open source project.&lt;br /&gt;&lt;br /&gt;PExpenses is a financial tool to track personal expenses with a quick and user friendly gui.&lt;br /&gt;&lt;br /&gt;User can enter his/her daily expenses very quickly and can see meaningful reports of the expenses very easily. User can also set password for the application to prevent unwanted access to it.&lt;br /&gt;&lt;br /&gt;The project is in Beta stage and has a few limitations like report screen is not very good, you cannot edit entries and no export to Excel/cvs functionality. But I have plans to add/fix these soon. Meanwhile, you can start using it :).&lt;br /&gt;&lt;br /&gt;Screen shots from my phone:&lt;/div&gt;&lt;div align="center"&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_IpYXbR4Nro4/Rn5RUznPQMI/AAAAAAAAABU/bBYTejtRIpg/s1600-h/Screenshot0001.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5079586847614517442" style="" alt="" src="http://3.bp.blogspot.com/_IpYXbR4Nro4/Rn5RUznPQMI/AAAAAAAAABU/bBYTejtRIpg/s320/Screenshot0001.jpg" border="0" /&gt;&lt;/a&gt; &lt;/div&gt;&lt;div align="center"&gt;Fig-1: The settings screen.&lt;/div&gt;&lt;div align="center"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div align="center"&gt;&lt;a href="http://4.bp.blogspot.com/_IpYXbR4Nro4/Rn5RVDnPQOI/AAAAAAAAABk/_HSNdsvh7O8/s1600-h/Screenshot0003.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5079586851909484770" style="" alt="" src="http://4.bp.blogspot.com/_IpYXbR4Nro4/Rn5RVDnPQOI/AAAAAAAAABk/_HSNdsvh7O8/s320/Screenshot0003.jpg" border="0" /&gt;&lt;/a&gt; &lt;/div&gt;&lt;div align="center"&gt;Fig-2: New Entry screen&lt;/div&gt;&lt;div align="center"&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_IpYXbR4Nro4/Rn5RVDnPQPI/AAAAAAAAABs/5jrwHERPdmg/s1600-h/Screenshot0004.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5079586851909484786" style="" alt="" src="http://4.bp.blogspot.com/_IpYXbR4Nro4/Rn5RVDnPQPI/AAAAAAAAABs/5jrwHERPdmg/s320/Screenshot0004.jpg" border="0" /&gt;&lt;/a&gt; &lt;/div&gt;&lt;div align="center"&gt;Fig-3: Main &amp;amp; expenses report screen&lt;/div&gt;&lt;p&gt;&lt;strong&gt;&lt;br /&gt;Project homepage:&lt;br /&gt;&lt;/strong&gt;&lt;a href="http://code.google.com/p/pexpenses/"&gt;http://code.google.com/p/pexpenses/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;SVN Checkout:&lt;br /&gt;&lt;/strong&gt;&lt;a href="http://pexpenses.googlecode.com/svn/trunk/pexpenses"&gt;http://pexpenses.googlecode.com/svn/trunk/pexpenses&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Tools/SDKs used:&lt;br /&gt;&lt;/strong&gt;JDK 1.5, NetBeans 4.1, J2ME Wireless Toolkit 2.2.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Download release:&lt;br /&gt;&lt;/strong&gt;PExpenses v1.0.3 (jar and jad file) from here: &lt;a href="http://pexpenses.googlecode.com/files/PExpenses1.0.3.zip"&gt;http://pexpenses.googlecode.com/files/PExpenses1.0.3.zip&lt;/a&gt; &lt;/p&gt;&lt;p&gt;Join the project to improve it more. To join the project, please mail me at m.kaisar [at] gmail.com.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6487100581508098433-4110597007578800560?l=kaisar-haque.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kaisar-haque.blogspot.com/feeds/4110597007578800560/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6487100581508098433&amp;postID=4110597007578800560' title='15 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/4110597007578800560'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/4110597007578800560'/><link rel='alternate' type='text/html' href='http://kaisar-haque.blogspot.com/2007/06/pexpenses-for-j2me-open-source-personal.html' title='PExpenses for J2ME - My open source personal expense tracker.'/><author><name>RoboSmith</name><uri>http://www.blogger.com/profile/07878693490452605144</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_IpYXbR4Nro4/Rn5RUznPQMI/AAAAAAAAABU/bBYTejtRIpg/s72-c/Screenshot0001.jpg' height='72' width='72'/><thr:total>15</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6487100581508098433.post-3784652783985686075</id><published>2007-06-21T17:30:00.000-07:00</published><updated>2007-08-14T13:59:27.824-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='cmm'/><category scheme='http://www.blogger.com/atom/ns#' term='process'/><title type='text'>CMM &amp; Processes - Where does Bangladesh stand?</title><content type='html'>&lt;p&gt;Today, in the SQABD mailing group, I noticed the following two questions:&lt;br /&gt;&lt;br /&gt;1. Would you please inform me that how many companies of BD actually make a proper use of RUP, XP and so...&lt;br /&gt;&lt;br /&gt;2. In terms of our country, process improvement is its initial stage......Not many company is working on SPI..... Look at India, where are they and where are we...?&lt;br /&gt;&lt;br /&gt;I had seen these types of questions before and would like to answer with an explanation from my perspective. I'll start by commenting the questions again:&lt;br /&gt;&lt;br /&gt;1. Would you please inform me that how many companies of BD actually make a proper use of RUP, XP and so...&lt;br /&gt;&lt;br /&gt;If you need the number, it's not "many". If you need to know why, you'll find my comments about it later in this post.&lt;br /&gt;&lt;br /&gt;2. In terms of our country, process improvement is its initial stage......Not many company is working on SPI..... Look at India, where are they and where are we...?&lt;br /&gt;&lt;br /&gt;I would like to ask a few questions first: what's the size of the largest software company in Bangladesh? Let me ask the question in another way: how many of the software companies in Bangladesh is of size 100 or more? (including all employees - engineers, admin, management?) How many CMM level 2 (first certification level) companies we have? (we know anyone is in Level 1 by default).&lt;br /&gt;&lt;br /&gt;Now, let's ask the same questions about India... If you do a little googling, you'll find that Infosys alone has 72,000 employees and Wipro has 68,000. India has got 60 CMM Level 5 companies, which is 75% in the whole world!!&lt;br /&gt;&lt;br /&gt;And we compare ourselves with India every now and then?!!!! IMHO, comparing a new born with a 30 years old man is not always a good idea.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Let's dig a little deeper..&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;So, we should agree that regarding software industries, our country is in a very negligible state comparing to the "giant" India. (I don't want to discuss the reasons for that, it's out of the scope of this topic.) So, even they are t-o-o large, can we compare their engineering processes with ours? why or why not? You may also ask, why can't we follow from the begging what they are following at their mature stages?&lt;br /&gt;&lt;br /&gt;To get the answers, we need to stop "guessing" and do some studies on CMM implementations first, if we haven't already. I strongly recommend everyone to read "CMM in Practice" by "Pankaj Jalote". (You may not get the book in Bangladesh.) If you don't know him already: He is Professor and Chairman of the Department of CSE at IIT, Kanpur and he is a legend in engineering processes and CMM. He worked with the processes at Infosys for many years. Now, here goes my answer to my above questions:&lt;br /&gt;&lt;br /&gt;First, I'd really like to clarify the terms and relations between, "Process" and "CMM".&lt;br /&gt;&lt;br /&gt;There are two main categories of processes: Engineering and Business. They are both important for any company, engineering process alone cannot improve the company. There are a lot of engineering and business processes defined/sketched out there. You can define your own too.&lt;br /&gt;&lt;br /&gt;If a company wants to follow an existing engineering process, it must study and know what the other common engineering processes are. The company should do some studies about them, try to compare them and find which one fits best to the company. It is very important to know that some processes fit good only to some particular types of projects. For example, where the client doesn't know the requirements (as they don't in many practical cases), you can't fit IBM RUP into it, Prototype may do a better job in that case. For another instance, you may not be able to fit all of your junior coders into XP as it was built for experienced ones. Iterative waterfall, Incremental Evoluation, RAD, Staged delivery processes has their own glories. Some processes are more completely defined than other, you'll find good and complete documentation on them as you may not find on some other. You may also need to understand license types, training and certification costs for some proprietary processes.&lt;br /&gt;&lt;br /&gt;Next, so we learned about the different processes, why wait to implement one?&lt;br /&gt;&lt;br /&gt;One size doesn't fit all! Yes, none of the business processes and engineering processes will fit your company 100%. You may need to customize it, which is known as 'tailoring' in many processes. To do so, you need to know what your company needs now and potentially in the future and what not at all. It's a lot of work.&lt;br /&gt;&lt;br /&gt;CMM, defined by CMU SEI, on the other hand, does not define an engineering process. It's a process evaluation framework. It defines the maturity models and the qualities a process need to have to achive the maturity levels. You need to study and outline what your processes need to have if you want to achieve the next CMM level. There are 18 important KPAs (Key Process Areas) you need to have a good idea of. There are different CMMs (extensions and versions) including SE-CMM, SA-CMM, SW-CMM, P-CMM and CMMI.&lt;br /&gt;&lt;br /&gt;Next, the hardest part is the real life implementation. Even if you define your dream process set, it will be a nightmare to implement it in a team, let alone in the whole company. It takes a lot of effort and dedication to implement even some simple processes.&lt;br /&gt;&lt;br /&gt;For that, you need to have dedicated "Software Engineering Process Group" with one/more dedicated "Process Coach". According to Pankaj Jalote, typical size of the SEPG is 1.5% of size of the company. Task of the SEPG is to understand, define, implement, ensure implementation, study improvement and improve the process itself.&lt;br /&gt;&lt;br /&gt;This is where Bangladesh failed so far. Take an example of a good company of Bangladesh: Company X has 50 engineers. Size of SEPG should be less than 1 (if we take 1.5%), as the company size is very small, say we took 1 or 2. Now the problems are:&lt;/p&gt;&lt;ol&gt;&lt;li&gt;Company X doesn't even know they need a SEPG. &lt;/li&gt;&lt;li&gt;When they know, Company X doesn't want to effort (even) 2 senior guys just for implementing processes! They keep asking, what's the output, what's the benefit, etc.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;It's a whole lot of tasks for a 2 person team. It will take a long time to complete all of the steps and even get to CMM level 2. It's not in months, it may take years.&lt;/li&gt;&lt;li&gt;Company X cannot even effort a third company (say from India) to come and assist them. Moreover, no other company will understand your works and process needs more than you do.&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;I hope, you all agree with these problems. This is the scenario of a company of size 50, think about the smaller ones of 10, 20 or 30!&lt;/p&gt;&lt;p&gt;Now compare the scenario with a small/medium size Indian company of size 1,000. SEPG is (1.5%) 15 people. A team that large can work much faster and better. They will succeed to get into higher CMM levels very fast.&lt;br /&gt;&lt;br /&gt;The reason why I explained a lot about the whole implementation effort is really to give you an idea about the real life effort required and why things fail with us. I had worked in such a SEPG in a company. I learned some of the facts mentioned above while working in it.&lt;br /&gt;&lt;br /&gt;Please post your comments, if any.&lt;/p&gt;Note: Few figures were corrected on June 28, 2007.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6487100581508098433-3784652783985686075?l=kaisar-haque.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kaisar-haque.blogspot.com/feeds/3784652783985686075/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6487100581508098433&amp;postID=3784652783985686075' title='25 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/3784652783985686075'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/3784652783985686075'/><link rel='alternate' type='text/html' href='http://kaisar-haque.blogspot.com/2007/06/cmm-processes-where-bangladesh-stands.html' title='CMM &amp; Processes - Where does Bangladesh stand?'/><author><name>RoboSmith</name><uri>http://www.blogger.com/profile/07878693490452605144</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>25</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6487100581508098433.post-8782808036919636818</id><published>2007-05-20T07:35:00.000-07:00</published><updated>2007-12-11T18:55:27.874-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='security'/><title type='text'>Use the right antivirus!</title><content type='html'>I would like to share a painful experience with the Antivirus applications we trust!&lt;br /&gt;&lt;br /&gt;Few days ago my home PC got infected with a worm (IM-Worm.Win32.Sohanad.t) that attacks the Windows OS, disables all important tools including:&lt;br /&gt;Task manager, regedit, msconfig, ..even the command prompt!&lt;br /&gt;&lt;br /&gt;It creates its copies in most drives, primarily in removable ones and creates autorun.inf to auto run itself, creates a copy of itself (exe file) for each folder in the removable drive!&lt;br /&gt;&lt;br /&gt;So, you may ask, didn’t I have an updated antivirus? Yes, I had and that’s the point of my email. I had Norton Antivirus 2005 with the latest definitions updated. Unfortunately even after manual updates and manual scans on the infected exe files it couldn’t find any threats!&lt;br /&gt;&lt;br /&gt;More bad news! I tried all of the following top most antivirus and anti-malware applications but they couldn’t detect the virus:&lt;br /&gt;&lt;br /&gt;PC Cillin 2004 with updates, Adware Professional with updates, Spyware Doctor, SpyBot Search &amp;amp; Destroy!&lt;br /&gt;&lt;br /&gt;So I did some googling to learn which are the current ‘top 10’ antivirus applications. I found ‘Kaspersky 6’ to be the top most one in several ‘good’ web sites. I never heard of it! Interestingly Norton, Trend Micro, McCafe are not in ‘top 5’.&lt;br /&gt;&lt;br /&gt;I downloaded and updated Kaspersky and it could detect and clean the virus very well! I installed it in my office PC and it got 2 spywares which our default Network antivirus couldn’t find! Don’t know how long the spyware was in my PC!&lt;br /&gt;&lt;br /&gt;Summary: I suggest all to recheck the ‘top 5’ list of antiviruses to get ‘true’ protection from latest viruses/malwares. I found Kaspersky good for my case.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6487100581508098433-8782808036919636818?l=kaisar-haque.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kaisar-haque.blogspot.com/feeds/8782808036919636818/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6487100581508098433&amp;postID=8782808036919636818' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/8782808036919636818'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/8782808036919636818'/><link rel='alternate' type='text/html' href='http://kaisar-haque.blogspot.com/2007/05/use-right-antivirus.html' title='Use the right antivirus!'/><author><name>RoboSmith</name><uri>http://www.blogger.com/profile/07878693490452605144</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6487100581508098433.post-9213261137507666553</id><published>2007-05-19T17:51:00.000-07:00</published><updated>2007-12-11T18:56:25.733-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='unicode'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='web'/><title type='text'>Online (Comprehensive) English to Bengali Dictionary</title><content type='html'>Last week I was looking for a web based dictionary in the web. I found two sites with very poor collection of the word translation. (Details mentioned end of the article). At once I decided to give one whole night a try and create my own online dictionary. And guess what? I did.&lt;br /&gt;&lt;br /&gt;How: After some googling, I got two good Unicode based dictionary databases. But none of them translate from English to Bengali. They were Bengali to English and Bengali to Bengali. Hmm.. they don't seem to be much useful, do they?&lt;br /&gt;&lt;br /&gt;This is what I did: created my db schema, wrote a php code to parse and enter the entries of two dictionaries into one db table without any duplicates (Bengali and English translations strings into separate fields), wrote another php code to parse the English translation strings and do 'word indexing' and store indexes into another table. Then I created a search page. That's all, I'm done.&lt;br /&gt;&lt;br /&gt;The search page searches in the indexed words, prioritize and sort them by their original positions in the translation strings and also categories the results. Works like a charm.&lt;br /&gt;&lt;br /&gt;Try it now: &lt;a href="http://www.ittefaq.com/dict"&gt;www.ittefaq.com/dict&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;I'll work on the application some more soon and will make a release. And yes, I do need to check the License types of the data sources :).&lt;br /&gt;&lt;br /&gt;The other online dictionaries:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.virtualbangladesh.com/dictionary.php"&gt;www.virtualbangladesh.com/dictionary.php&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.bangladict.org/"&gt;www.bangladict.org&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;These dictionaries are good starts but look dummy and not really useful.&lt;/p&gt;&lt;p&gt;I may make my dictionary open source soon.&lt;/p&gt;&lt;p&gt;Happy translating!&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6487100581508098433-9213261137507666553?l=kaisar-haque.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kaisar-haque.blogspot.com/feeds/9213261137507666553/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6487100581508098433&amp;postID=9213261137507666553' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/9213261137507666553'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/9213261137507666553'/><link rel='alternate' type='text/html' href='http://kaisar-haque.blogspot.com/2007/05/online-comprehensive-english-to-bengali.html' title='Online (Comprehensive) English to Bengali Dictionary'/><author><name>RoboSmith</name><uri>http://www.blogger.com/profile/07878693490452605144</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6487100581508098433.post-3631250868059536091</id><published>2007-05-03T16:20:00.001-07:00</published><updated>2007-11-30T16:55:01.515-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><category scheme='http://www.blogger.com/atom/ns#' term='web'/><title type='text'>JavaScript - Yet another toggle (show/hide) combo box code</title><content type='html'>You probably already have found or used code to toggle 'select' elements (combo boxes). But some of them have prototype dependancies, some don't work for non-form based elements and some don't work with ajax based pages.&lt;br /&gt;&lt;br /&gt;I just wrote this tiny code that seem to do the job on IE, both form and non-form based elements, both ajax and non-ajax based pages. Check it out:&lt;br /&gt;&lt;pre&gt;&lt;span style="color: rgb(63, 127, 89);"&gt;/*&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(63, 127, 89);"&gt; * toggle select boxes by Kaisar&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(63, 127, 89);"&gt; */&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(127, 0, 85);"&gt;function&lt;/span&gt; toggleSelectBoxes()&lt;br /&gt;{&lt;br /&gt;  &lt;span style="font-weight: bold; color: rgb(127, 0, 85);"&gt;var&lt;/span&gt; elems = document.getElementsByTagName(&lt;span style="color: rgb(42, 0, 255);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(42, 0, 255);"&gt;select&lt;/span&gt;&lt;span style="color: rgb(42, 0, 255);"&gt;"&lt;/span&gt;);&lt;br /&gt;  &lt;span style="font-weight: bold; color: rgb(127, 0, 85);"&gt;if&lt;/span&gt; (elems)&lt;br /&gt;      &lt;span style="font-weight: bold; color: rgb(127, 0, 85);"&gt;for&lt;/span&gt; (i=0; i&amp;lt;elems.length; i++)&lt;br /&gt;          elems[i].style.display = elems[i].style.display == &lt;span style="color: rgb(42, 0, 255);"&gt;'none'&lt;/span&gt; ? &lt;span style="color: rgb(42, 0, 255);"&gt;''&lt;/span&gt; : &lt;span style="color: rgb(42, 0, 255);"&gt;'none'&lt;/span&gt;;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6487100581508098433-3631250868059536091?l=kaisar-haque.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kaisar-haque.blogspot.com/feeds/3631250868059536091/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6487100581508098433&amp;postID=3631250868059536091' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/3631250868059536091'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/3631250868059536091'/><link rel='alternate' type='text/html' href='http://kaisar-haque.blogspot.com/2007/05/javascript-yet-another-toggle-showhide_03.html' title='JavaScript - Yet another toggle (show/hide) combo box code'/><author><name>RoboSmith</name><uri>http://www.blogger.com/profile/07878693490452605144</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6487100581508098433.post-1552395272301910688</id><published>2006-10-18T03:41:00.000-07:00</published><updated>2007-05-19T14:08:33.936-07:00</updated><title type='text'>The First Post</title><content type='html'>Hmm.. what does it feel like to maintain a blog on regular basis? I always thought I'm too busy for blogging. But I should just give it a try.. so here goes my first post!&lt;br /&gt;&lt;br /&gt;I'm Kaisar 26/M, live in Dhaka, graduated in Computer Science from North South University, Dhaka. I'm working as a Senior Software Engineer at ReliSource Technologies Ltd. I've have around 4 years of working experinces, mostly in languages like C++/VC++, Java, VB and PHP. I worked with technologies like NMS, Embedded Systems, VOIP, CMS, etc. Besides, I've keen interest in Computer Vision, Cognative Computing, Robotics and Digital Electronics. I like music and movies a lot.&lt;br /&gt;&lt;br /&gt;I'll try to post on different technologies and less about my personal life here in this blog.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6487100581508098433-1552395272301910688?l=kaisar-haque.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kaisar-haque.blogspot.com/feeds/1552395272301910688/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6487100581508098433&amp;postID=1552395272301910688' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/1552395272301910688'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6487100581508098433/posts/default/1552395272301910688'/><link rel='alternate' type='text/html' href='http://kaisar-haque.blogspot.com/2006/10/first-post.html' title='The First Post'/><author><name>RoboSmith</name><uri>http://www.blogger.com/profile/07878693490452605144</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
