<?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-5951350911052608183</id><updated>2012-02-02T18:30:36.455+05:30</updated><category term='linux'/><category term='movie'/><category term='iphone'/><category term='code storm'/><category term='blackberry'/><category term='java'/><category term='wpf'/><category term='apple'/><category term='programming'/><category term='comics'/><category term='gimp'/><category term='design'/><category term='rants'/><category term='windows'/><category term='music'/><category term='games'/><category term='info'/><category term='open source'/><category term='algorithms'/><category term='c++'/><category term='.NET'/><title type='text'>Angelo's Stuff</title><subtitle type='html'>Games, Programming and other goodies</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>73</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-4493161749549291212</id><published>2012-02-02T15:29:00.005+05:30</published><updated>2012-02-02T18:30:36.510+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='rants'/><title type='text'>Lazy Programming</title><content type='html'>&lt;a href="http://imgs.xkcd.com/comics/regular_expressions.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 600px; height: 607px;" src="http://imgs.xkcd.com/comics/regular_expressions.png" border="0" alt="" /&gt;&lt;/a&gt;&lt;p class="p1"&gt;I am a slightly lazy programmer. There I said it! This doesn't necessarily mean that it's a bad thing to be lazy... Lazy programmers try to avoid doing grunt work. They are the ones who will write that tiny tool or that simple script just so they can get out of having to do a repetitive task. Those same utilities will end up being used by others and will in the long run boost productivity!&lt;/p&gt;&lt;p class="p1"&gt;"So, is it good to be lazy?" - one might ask. The answer is - "It entirely depends...". You see, a lazy programmer can also be that fellow most people find uncooperative in a team. He might want to spend two whole days (at crunch time!) writing a script that would save him a few hours of continuous grunt work. If a lazy programmer is forced into a position where automating a task is quite infeasible, then BEWARE! The programmer will now unleash the beast within - moaning, groaning and cursing all the way through to task completion. Another area where lazy programmers don't fit in, is when they are called upon to debug someone else's code. Most programmers hate this part of the job but lazy programmers hate it even more! They will naturally point out flaws in the code architecture (ritually quoting design patterns that should have been used). &lt;/p&gt;&lt;p class="p1"&gt;However, there is one very important thing that lazy programmers love to do! Lazy programmers love to design code. Give them a chance to do so and they will build you a very flexible and generic system (covering lots and lots of use-cases). The same system could be taken and simply "plugged" into other projects with similar requirements! Lazy programmers also tend to write very elegant code with fewer bugs by virtue of the fact that they encourage re-usability.&lt;/p&gt; &lt;p class="p1"&gt;At the end of the day, Lazy programmers are bad soldiers but good Generals. Are you a lazy programmer? Let me know what you think constitutes a lazy programmer in the comments.&lt;/p&gt; &lt;p class="p2"&gt;Happy (lazy) coding!&lt;/p&gt;&lt;p class="p2"&gt;(Above comic, courtesy of &lt;a href="http://xkcd.com/"&gt;http://xkcd.com&lt;/a&gt;)&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-4493161749549291212?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/4493161749549291212/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=4493161749549291212' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/4493161749549291212'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/4493161749549291212'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2012/02/lazy-programming.html' title='Lazy Programming'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-5187809385889287909</id><published>2012-01-05T18:03:00.034+05:30</published><updated>2012-01-05T19:31:46.161+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='gimp'/><category scheme='http://www.blogger.com/atom/ns#' term='design'/><title type='text'>Create an icy glass silhouette with Gimp.</title><content type='html'>&lt;div&gt;Hey folks!&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I came up with a nice effect which I thought was really worth sharing. Refer to the following image for a clear picture (pun intended) of what we are trying to achieve. &lt;/div&gt;&lt;div&gt;&lt;a href="http://1.bp.blogspot.com/-HhHO4iDzbHs/TwWpiJlpCHI/AAAAAAAAAcw/NW595ZFQ3AI/s1600/heartsilhouette.jpg"&gt;&lt;img src="http://1.bp.blogspot.com/-HhHO4iDzbHs/TwWpiJlpCHI/AAAAAAAAAcw/NW595ZFQ3AI/s320/heartsilhouette.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5694143708034304114" style="display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; cursor: pointer; width: 320px; height: 240px; " /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;Note that I am using Gimp 2.6.1 on Windows. Gimp is free software and can be downloaded from &lt;a href="http://www.gimp.org/"&gt;www.gimp.org&lt;/a&gt;. Since I don't want to end up with an extremely long-winded post, I'll just assume that you can find your way around Gimp. If you do find yourself stuck at some point, feel free to comment on this post and I will gladly help you along.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Step 1: Begin with an empty canvas size of 640 x 480.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Step 2: Set the foreground color palette to the following shade of Blue - 80c0ff and bucket fill the background layer.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Step 3: Create a new background layer and name it 'Noise'. Bucket fill this layer with the following shade of Blue: 386597.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Step 4: Go to Filters-&amp;gt;Noise-&amp;gt;Hurl and use the settings in the image below.&lt;/div&gt;&lt;div&gt;&lt;img src="http://1.bp.blogspot.com/-Hfd3vw8V8SU/TwWqFilbDaI/AAAAAAAAAc8/5Iinys7L79M/s200/help1.JPG" border="0" alt="" id="BLOGGER_PHOTO_ID_5694144316039695778" style="color: rgb(0, 0, 238); text-decoration: underline; float: left; margin-top: 0px; margin-right: 10px; margin-bottom: 10px; margin-left: 0px; cursor: pointer; width: 186px; height: 200px; " /&gt;&lt;br class="Apple-interchange-newline"&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Step 5: Go to Filters-&amp;gt;Blur-&amp;gt;Gaussian Blur and apply horizontal and vertical blur radius of 25.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Step 6: Set the opacity of the Noise layer to 70 and the blend mode to Value. Your image at this point should look similar to this.&lt;/div&gt;&lt;div&gt;&lt;img src="http://4.bp.blogspot.com/-x6b9Ja1UsN8/TwWqf-AVwNI/AAAAAAAAAdI/9GBcV14Jt_Q/s200/help1_1.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5694144770076950738" style="color: rgb(0, 0, 238); text-decoration: underline; float: left; margin-top: 0px; margin-right: 10px; margin-bottom: 10px; margin-left: 0px; cursor: pointer; width: 200px; height: 150px; " /&gt;&lt;br class="Apple-interchange-newline"&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Step 7. Now, create a new layer with a white background. Go to Filters-&amp;gt;Noise-&amp;gt;RGB Noise and use settings of 0.2 for Red, 0.2 for Green, 0.2 for Blue and 0.0 for Alpha.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Step 8: Set the opacity of the White layer to 30 and the blend mode to Grain Extract.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Step 9: Create a new transparent layer on top. Name it 'Silhouette'.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Step 10: Set the foreground color to full white and paint haphazardly inside this layer. See the picture below for the kind of painting you should do. &lt;/div&gt;&lt;div&gt;&lt;img src="http://2.bp.blogspot.com/-J5mpbe7afFI/TwWq28hDgxI/AAAAAAAAAdU/llyJc3N_IPM/s200/help2.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5694145164814287634" style="color: rgb(0, 0, 238); text-decoration: underline; float: left; margin-top: 0px; margin-right: 10px; margin-bottom: 10px; margin-left: 0px; cursor: pointer; width: 200px; height: 144px; " /&gt;&lt;br class="Apple-interchange-newline"&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;A real piece of art, huh? You don't need to precisely follow this painting but try to concentrate on the center of the picture since that is where we will ultimately end up placing our silhouette.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Step 11: Gaussian blur the layer with horizontal and vertical blur radius of 100. Change the blend mode of the layer to Value. Your image should now look similar to this.&lt;/div&gt;&lt;div&gt;&lt;img src="http://1.bp.blogspot.com/-WLUg58ZAWT4/TwWrERuollI/AAAAAAAAAdg/3XvvASlinGA/s200/help3.JPG" border="0" alt="" id="BLOGGER_PHOTO_ID_5694145393846687314" style="color: rgb(0, 0, 238); text-decoration: underline; float: left; margin-top: 0px; margin-right: 10px; margin-bottom: 10px; margin-left: 0px; cursor: pointer; width: 200px; height: 144px; " /&gt;&lt;br class="Apple-interchange-newline"&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Step 12: Now, its time for us to put in our silhouette! Make a heart shaped cut-out in the center of the 'Silhouette' layer. You can easily make the top part of the heart with two circles and then use the free select tool for the bottom portion of the heart. Then just delete the area within the selection. Alternatively, you can use the eraser tool and erase in the shape of a heart. No need to be totally meticulous about the shape of the silhouette since we will be blurring it anyway. I've chosen to go with the selection method and if you did the same, you should end up with an image similar to the one below.&lt;/div&gt;&lt;div&gt;&lt;img src="http://1.bp.blogspot.com/-VasPlXiy4Sc/TwWrXs0rGbI/AAAAAAAAAds/LVzjE_5GOGA/s200/help4.JPG" border="0" alt="" id="BLOGGER_PHOTO_ID_5694145727537289650" style="color: rgb(0, 0, 238); text-decoration: underline; float: left; margin-top: 0px; margin-right: 10px; margin-bottom: 10px; margin-left: 0px; cursor: pointer; width: 200px; height: 144px; " /&gt;&lt;br class="Apple-interchange-newline"&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Step 13: Select the entire 'Silhouette' layer (Ctrl + A) and Gaussian Blur it with horizontal and vertical radius of 30.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Step 14: There is no Step 15!&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Here is another variant of the effect. I just played with the colors, opacities and of course did a completely new silhouette.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://1.bp.blogspot.com/-alWCSLs6-2g/TwWs_CiBBoI/AAAAAAAAAeE/UyKfgFhEmfU/s1600/applesilhouette.jpg"&gt;&lt;img src="http://1.bp.blogspot.com/-alWCSLs6-2g/TwWs_CiBBoI/AAAAAAAAAeE/UyKfgFhEmfU/s320/applesilhouette.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5694147502891140738" style="display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; cursor: pointer; width: 320px; height: 134px; " /&gt;&lt;/a&gt;Enjoy!&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-5187809385889287909?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/5187809385889287909/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=5187809385889287909' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/5187809385889287909'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/5187809385889287909'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2012/01/create-icy-glass-silhouette-with-gimp.html' title='Create an icy glass silhouette with Gimp.'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-HhHO4iDzbHs/TwWpiJlpCHI/AAAAAAAAAcw/NW595ZFQ3AI/s72-c/heartsilhouette.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-3145500316522356953</id><published>2011-12-31T10:47:00.021+05:30</published><updated>2012-01-06T18:54:35.605+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='gimp'/><category scheme='http://www.blogger.com/atom/ns#' term='design'/><title type='text'>Create a simple vintage photo effect with Gimp</title><content type='html'>Hey folks!&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Sometimes you might want to take a recent photo and make it look like it was taken with a vintage camera. Here's one easy way to do this. Note that the image processing software that I am using here is Gimp 2.6.1. Gimp is free software and can be downloaded from &lt;a href="http://www.gimp.org/"&gt;http://www.gimp.org/&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Alright, just to give you guys a feel of what we're trying to accomplish, here are before and after shots of a photo that I took when visiting the Chinese Gardens in Singapore.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Before:&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;img src="http://3.bp.blogspot.com/-1RBMM66J9Ws/Tv63hUt9ghI/AAAAAAAAAbo/EltAh0aQy7Q/s320/vintage-before.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5692188762167935506" style="color: rgb(0, 0, 238); text-decoration: underline; float: left; margin-top: 0px; margin-right: 10px; margin-bottom: 10px; margin-left: 0px; cursor: pointer; width: 320px; height: 180px; " /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;/div&gt;&lt;span&gt;&lt;u&gt;&lt;br class="Apple-interchange-newline"&gt;&lt;/u&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;u&gt;&lt;br /&gt;&lt;/u&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;u&gt;&lt;br /&gt;&lt;/u&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;u&gt;&lt;br /&gt;&lt;/u&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;u&gt;&lt;br /&gt;&lt;/u&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;u&gt;&lt;br /&gt;&lt;/u&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;u&gt;&lt;br /&gt;&lt;/u&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;u&gt;&lt;br /&gt;&lt;/u&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;u&gt;&lt;br /&gt;&lt;/u&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;b&gt;After:&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;u&gt;&lt;br /&gt;&lt;/u&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;img src="http://4.bp.blogspot.com/-pW-3CoabzF8/Tv63yrPV6bI/AAAAAAAAAb0/HJ0D--TYWBM/s320/vintage-after.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5692189060271303090" style="color: rgb(0, 0, 238); text-decoration: underline; float: left; margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; cursor: pointer; width: 320px; height: 180px; " /&gt;&lt;br class="Apple-interchange-newline"&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Step 1: Open the image of your choice in Gimp.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Step 2: Duplicate the image layer one time. You can duplicate a layer by clicking on the duplicate button at the bottom of the layers panel window or pressing Shift + Ctrl + D (in Windows).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Step 3: With the new layer selected, go to Colors-&amp;gt;Desaturate. Pick 'Luminosity' among the options presented and then click OK. Your image should now look Black and White.&lt;/div&gt;&lt;div&gt;&lt;a href="http://4.bp.blogspot.com/-PYDSUF5rAGU/Tv6_vrRRd6I/AAAAAAAAAcA/DndziKNoheQ/s1600/help1.jpg"&gt;&lt;img src="http://4.bp.blogspot.com/-PYDSUF5rAGU/Tv6_vrRRd6I/AAAAAAAAAcA/DndziKNoheQ/s200/help1.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5692197804832815010" style="cursor: pointer; width: 138px; height: 200px; " /&gt;&lt;/a&gt;&lt;a href="http://2.bp.blogspot.com/-yUaeawzZKQo/Tv6_v2teR5I/AAAAAAAAAcI/I50ftWnAJAg/s1600/help2.jpg"&gt;&lt;img src="http://2.bp.blogspot.com/-yUaeawzZKQo/Tv6_v2teR5I/AAAAAAAAAcI/I50ftWnAJAg/s200/help2.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5692197807903885202" style="cursor: pointer; width: 200px; height: 121px; " /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Step 4: Change the blend mode of the Black and White Layer to 'Overlay'. The blend mode can be changed from the drop-down menu at the top of the Layers panel.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://2.bp.blogspot.com/-je8c-q_0VtA/Tv6_vyiyWEI/AAAAAAAAAcU/AEMHg8u2MXw/s1600/help3.jpg"&gt;&lt;img src="http://2.bp.blogspot.com/-je8c-q_0VtA/Tv6_vyiyWEI/AAAAAAAAAcU/AEMHg8u2MXw/s200/help3.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5692197806785321026" style="cursor: pointer; width: 141px; height: 200px; " /&gt;&lt;/a&gt; &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Step 5: Change the foreground color to the following shade of Yellow: fbf2a3&lt;/div&gt;&lt;div&gt;&lt;a href="http://4.bp.blogspot.com/--rr0FIqR88c/Tv7D2eymJYI/AAAAAAAAAck/rsbO-mVExdM/s1600/help4.jpg"&gt;&lt;img src="http://4.bp.blogspot.com/--rr0FIqR88c/Tv7D2eymJYI/AAAAAAAAAck/rsbO-mVExdM/s200/help4.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5692202319788516738" style="cursor: pointer; width: 200px; height: 106px; " /&gt;&lt;/a&gt; &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Step 6: Go to Layer-&amp;gt;New Layer (or press Shift + Ctrl + N).  Among the Layer Fill type options, select 'Foreground color'. Leave everything else as is and click OK.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Step 7: Change the blend mode of the new layer to 'Multiply' and set its Opacity to 60. Your image should now have a yellowish tinge.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Step 8: Change the foreground color to the following shade of Magenta: e865b3. Once again, add a new layer with Layer Fill type as 'Foreground color'. Change the blend mode of the new layer to 'Screen' and set its Opacity to 20.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Step 9: Change the foreground color to the following shade of Blue: 0949e9. Again, add a new layer with Layer Fill type as 'Foreground color'. Change the blend mode of the new layer to 'Screen' and set its Opacity to 17.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Step 10: That's it! We're done. You may tweak the opacities of the Yellow, Magenta and Blue layers to make your particular image seem more authentic.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Enjoy!&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-3145500316522356953?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/3145500316522356953/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=3145500316522356953' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/3145500316522356953'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/3145500316522356953'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2011/12/create-simple-vintage-photo-effect-with.html' title='Create a simple vintage photo effect with Gimp'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-1RBMM66J9Ws/Tv63hUt9ghI/AAAAAAAAAbo/EltAh0aQy7Q/s72-c/vintage-before.jpg' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-6423706003860959055</id><published>2011-12-30T13:27:00.006+05:30</published><updated>2011-12-30T16:37:00.108+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='games'/><title type='text'>Light Snake for HTML5!</title><content type='html'>&lt;div style="text-align: center;"&gt;&lt;span &gt;&lt;u&gt;&lt;br /&gt;&lt;/u&gt;&lt;/span&gt;&lt;/div&gt;I have had the good fortune to explore a bit of HTML5, an emerging web standard that is poised to take the online world by storm. The technology isn't quite there yet. Current browser vendors offer differing or incomplete implementations of the standard and it's a bit of a pain to ensure that whatever you write works generically. Still, this is one of those lemons that bears watching...&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The first thing that crossed my mind was to port LightSnake. Its a simple and fun game of snake and requires very minimal player input. And so, I did manage to port the game from C++ to Javascript and get it running acceptably well on most of the major browsers. One notable exception is that dinosaur of all browsers, the one that exists simply to torment all web-developers. Yes, Internet Explorer!&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The project has been hosted on Google App Engine and can be accessed from the following URL: &lt;a href="http://lightsnakegame.appspot.com/"&gt;lightsnakegame.appspot.com&lt;/a&gt; (I wanted to get the app name 'lightsnake', but someone seems to be squatting on it).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Enjoy!&lt;/div&gt;&lt;div&gt;&lt;a href="http://3.bp.blogspot.com/-JHsrlRVLcHY/Tv2bKp6pNxI/AAAAAAAAAbc/uNuuBGyqEHk/s1600/lshtml5.PNG"&gt;&lt;img src="http://3.bp.blogspot.com/-JHsrlRVLcHY/Tv2bKp6pNxI/AAAAAAAAAbc/uNuuBGyqEHk/s320/lshtml5.PNG" border="0" alt="" id="BLOGGER_PHOTO_ID_5691876111418996498" style="display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; cursor: pointer; width: 218px; height: 320px; " /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-6423706003860959055?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/6423706003860959055/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=6423706003860959055' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/6423706003860959055'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/6423706003860959055'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2011/12/light-snake-for-html5.html' title='Light Snake for HTML5!'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-JHsrlRVLcHY/Tv2bKp6pNxI/AAAAAAAAAbc/uNuuBGyqEHk/s72-c/lshtml5.PNG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-5283373094189994176</id><published>2011-11-09T20:50:00.004+05:30</published><updated>2011-11-26T17:43:14.487+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='games'/><title type='text'>Light Snake</title><content type='html'>While listening to some really cool music on &lt;a href="http://soundcloud.com/"&gt;soundcloud&lt;/a&gt;, an image of the old-school Snake game popped up in my head. A game of Snake with neon lights. So, I thought to myself - "Heck, I should make this!" And so I did...&lt;div&gt;&lt;br /&gt;&lt;iframe width="420" height="315" src="http://www.youtube.com/embed/WeKOdaqrD5A" frameborder="0" allowfullscreen=""&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;Needless to say, I didn't sleep that night.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Want to play? Get it from:&lt;/div&gt;&lt;div&gt;1. &lt;a href="http://bit.ly/sFDAFE"&gt;My Microsoft Skydrive&lt;/a&gt;&lt;/div&gt;&lt;div&gt;2. &lt;a href="http://www.indiepubgames.com/game/Light_Snake"&gt;indiePub Games&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-5283373094189994176?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/5283373094189994176/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=5283373094189994176' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/5283373094189994176'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/5283373094189994176'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2011/11/light-snake.html' title='Light Snake'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://img.youtube.com/vi/WeKOdaqrD5A/default.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-3525665474206033853</id><published>2011-10-27T20:56:00.008+05:30</published><updated>2011-11-01T22:48:15.999+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='c++'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><title type='text'>How to erase specific elements from an STL container - the C++ way.</title><content type='html'>STL iterators are tricky little fellows. One moment they act clean and the very next, they throw their hands up and say something cryptic. Consider this snippet that erases all elements whose values are 20 from a vector of integers.&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;&lt;br /&gt;typedef std::vector&amp;lt;int&amp;gt; IntVectorType;&lt;br /&gt;IntVectorType vInt;&lt;br /&gt;&lt;br /&gt;for(IntVectorType::const_iterator iter = vInt.begin();&lt;br /&gt;iter != vInt.end(); ++iter)&lt;br /&gt;{&lt;br /&gt; if( *iter == 20 )&lt;br /&gt; {&lt;br /&gt;     vInt.erase(iter);&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/int&gt;&lt;/code&gt;&lt;br /&gt;&lt;/pre&gt;Lo and behold! The program crashes! This is because when you erase an element from a container all iterators to its position are invalidated. This just happens to be our loop iterator. So, what is an innocent programmer to do?&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Well, there are two ways to erase individual elements in an STL container.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Method 1:&lt;/b&gt; The crude way&lt;span class="Apple-style-span"&gt; ( recommended for cavemen/barbarians/C -programmers ;) )&lt;/span&gt;&lt;/div&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;&lt;br /&gt;IntVectorType::iterator iter = vInt.begin();&lt;br /&gt;while(iter != vInt.end())&lt;br /&gt;{&lt;br /&gt; if( *iter == 20 )&lt;br /&gt; {&lt;br /&gt;     iter = vInt.erase(iter);  // Get iterator to next element.&lt;br /&gt; }&lt;br /&gt; else&lt;br /&gt; {&lt;br /&gt;     ++iter;  // Increment if not erased.&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;/pre&gt;The method vector::erase() returns an iterator to the element that subsequently follows the last element that was erased. So, we just use that iterator to continue looping. Good! Problem solved! Is there a better way?&lt;div&gt;&lt;br /&gt;&lt;b&gt;Method 2:&lt;/b&gt; The modern C++ way (recommended for rockstars/you/me)&lt;/div&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;&lt;br /&gt;struct EraseFromVector&lt;br /&gt;{&lt;br /&gt;    // Functor&lt;br /&gt;    bool operator ()(const int value) const&lt;br /&gt;    {&lt;br /&gt;        return (value == 20);       &lt;br /&gt;    }&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;vInt.erase(std::remove_if(vInt.begin(), vInt.end(), EraseFromVector()), vInt.end());&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Looks like g(r)eek, you say? Alright then, let me explain. Basically, std::remove_if() is a magical chap. He takes two iterators as a range within which to work. For each element within that range, he then checks the unary predicate(our third argument) to see whether the element should be removed or not. If the predicate returns true, the element is removed.&lt;br /&gt;&lt;br /&gt;I did say "removed" but in actuality, remove_if() sends the doomed elements to the back of the container. He doesn't actually remove them. How could he? He doesn't know what kind of container he's working with. Only the container can remove elements.&lt;br /&gt;&lt;br /&gt;The nice thing about remove_if() is that he is guaranteed by the standard to preserve the order of the elements that were not removed. So, if our vector contained the elements 10, 20, 30, 20, 40 in that order, it will now contain the elements 10, 30, 40, 20, 20.&lt;div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Finally, remove_if() returns an iterator to the start of the sequence containing all those miserable elements just sitting there at the back waiting for the axe to fall. We pass this iterator as the first argument to vector::erase() and an iterator to the end of the vector as the second argument. In one full swoop, all elements in the range are erased.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Now, doesn't this seem a lot more fun than a boring old while loop? :)&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-3525665474206033853?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/3525665474206033853/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=3525665474206033853' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/3525665474206033853'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/3525665474206033853'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2011/10/how-to-erase-specific-elements-from-stl.html' title='How to erase specific elements from an STL container - the C++ way.'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-2396470224470598935</id><published>2011-10-08T09:40:00.006+05:30</published><updated>2011-10-08T23:13:05.302+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='design'/><category scheme='http://www.blogger.com/atom/ns#' term='apple'/><title type='text'>R.I.P Steve Jobs</title><content type='html'>At first, the world saw him as nothing more than a &lt;b&gt;nerd&lt;/b&gt;, a &lt;b&gt;high school drop out&lt;/b&gt;, a &lt;b&gt;rebellious kid&lt;/b&gt;. Then the world saw him as a &lt;b&gt;geek&lt;/b&gt;, a &lt;b&gt;competitor&lt;/b&gt;, an &lt;b&gt;irrational&lt;/b&gt; human. Being fired from Apple was the best thing that could have happened because that's what made him a real &lt;b&gt;entrepreneur&lt;/b&gt;. &lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;A man who looked at the potential in smaller companies and brought out the best in them. He believed in beauty and elegance in computers unlike the rest of the world. The world resisted his ideology but never killed it. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;He returned and changed the music industry for the better. He went through a near-death experience. He beat it, came back and changed the entire way we perceived a digital world with the release of the iPhone.  Now, the world sees him in a different light - &lt;b&gt;Visionary&lt;/b&gt;, &lt;b&gt;Creator&lt;/b&gt;, &lt;b&gt;Future Technologist&lt;/b&gt;. &lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Requiem De Pace - &lt;b&gt;Steve Jobs&lt;/b&gt;. You will sorely be missed.&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://2.bp.blogspot.com/-hlyv1u96ASA/To_TJvzqaoI/AAAAAAAAAZc/gAA-Kpzy6Ek/s1600/stevetrib.jpg" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img src="http://2.bp.blogspot.com/-hlyv1u96ASA/To_TJvzqaoI/AAAAAAAAAZc/gAA-Kpzy6Ek/s320/stevetrib.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5660975421033441922" style="display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; cursor: pointer; width: 320px; height: 180px; " /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-2396470224470598935?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/2396470224470598935/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=2396470224470598935' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/2396470224470598935'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/2396470224470598935'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2011/10/rip-steve-jobs.html' title='R.I.P Steve Jobs'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-hlyv1u96ASA/To_TJvzqaoI/AAAAAAAAAZc/gAA-Kpzy6Ek/s72-c/stevetrib.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-4656227496506916597</id><published>2011-09-08T21:55:00.001+05:30</published><updated>2011-09-08T21:55:41.118+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='open source'/><category scheme='http://www.blogger.com/atom/ns#' term='c++'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><title type='text'>ACSVParser: A simple CSV parser writtten in standard C++.</title><content type='html'>Hey folks,&lt;br /&gt;Its been a while since I posted back here... ok, its been a looong while. A lot has been going on. I've pushed forth my career in gaming all the way to Singapore! Yes, that's one of the four asian tigers and it sure is one of the best places to be working as a game developer. That, of course, does not mean I will let this blog lie fallow. So here goes...&lt;br /&gt;&lt;br /&gt;One of the most interesting (vexing?) things about programming is that some of the simplest things turn out to be not so simple at all! Consider a CSV reader. We've probably used one (if not written one of our own) and yet we all know that it could do with a whole lot of customization. Some of the general peeves, I've heard are:&lt;br /&gt;"I don't want to use commas, I like using the caret symbol!"&lt;br /&gt;"Why can't I have new lines in my CSV content?"&lt;br /&gt;"I want to have embedded spaces in my CSV data!"&lt;br /&gt;"I want to sneeze with my eyes open, darn it!"&lt;br /&gt;&lt;br /&gt;All of these (except the last one), led me to stop kicking the can down the road and come up with my own parser. I called it ACSVParser(after yours truly :))&lt;br /&gt;&lt;br /&gt;The project is hosted on github at&amp;nbsp;&lt;a href="https://github.com/angelorohit/ACSVParser"&gt;https://github.com/angelorohit/ACSVParser&lt;/a&gt;&lt;br /&gt;Do check it out and let me know what you think (feedback, suggestions, issues).&lt;br /&gt;&lt;br /&gt;Cheers!&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-4656227496506916597?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/4656227496506916597/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=4656227496506916597' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/4656227496506916597'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/4656227496506916597'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2011/09/acsvparser-simple-csv-parser-writtten.html' title='ACSVParser: A simple CSV parser writtten in standard C++.'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><thr:total>2</thr:total><georss:featurename>Singapore</georss:featurename><georss:point>1.352083 103.819836</georss:point><georss:box>1.098096 103.503979 1.6060699999999999 104.13569299999999</georss:box></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-1659580956568730697</id><published>2011-05-20T09:23:00.003+05:30</published><updated>2011-10-09T16:40:42.121+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='rants'/><title type='text'>Poem - The Warning</title><content type='html'>While going through an old diary of mine, I happened to stumble upon a poem I'd written in high school. It made me remember that I did want to be a writer before I became a programmer. Perhaps someday, I'll be able to do both.&lt;div&gt;&lt;div style="background-color: transparent; "&gt;&lt;p id="internal-source-marker_0.1482216608710587" style="text-align: center; margin-top: 0pt; margin-bottom: 0pt; "&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="text-align: center;"&gt;&lt;span class="Apple-style-span"&gt;&lt;b&gt;The Warning&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;i&gt;&lt;span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "&gt;Spare me your protests for peace and love,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "&gt;You do nothing but put on a lively show…&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "&gt;For then you disbelieve the one above,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "&gt;And meekly forsake the man next door.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "&gt;If autumn leaves were to fall in spring time,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "&gt;Or Snowy flakes were to cover a summer street,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "&gt;You would still call this poem a crime,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "&gt;You would still throw tantrums and stamp your feet.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "&gt;Your hunger-strikes won’t get what you want,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "&gt;This isn’t the way the battle should be won,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "&gt;I see starved looks on faces gaunt,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "&gt;But is what you demand inevitably done?&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "&gt;The bomb blasts you decry aren’t one of a kind,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "&gt;Hold on a bit and press rewind,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "&gt;This happened before but you didn’t mind,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "&gt;Now why would you get that petition signed?&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "&gt;Please don’t belittle this poem of mine,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "&gt;I’d really appreciate it if you spent the time,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "&gt;To work through each and every line,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "&gt;You’ll see there’s always a reason and rhyme.&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-1659580956568730697?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/1659580956568730697/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=1659580956568730697' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/1659580956568730697'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/1659580956568730697'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2011/05/while-going-through-old-diary-of-mine-i.html' title='Poem - The Warning'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-557289622162723500</id><published>2011-04-16T21:40:00.005+05:30</published><updated>2011-04-16T22:19:28.577+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='rants'/><title type='text'>How to install a game in 12 easy steps</title><content type='html'>&lt;div&gt;Hey folks,&lt;/div&gt;Its been quite a while since I posted back here but let it not be said that this blog is dead! I really wanted to share my experience installing Batman Arkham Asylum - Game of the Year Edition. I purchased the game from a popular digital distribution platform - Steam. The payment process was real simple and downloading the game was equally so. The problem came when I wanted to actually install it. And so began a grand adventure to get the game up and running.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Step 1: I Put in the activation code for the game. Straight forward enough.&lt;/div&gt;&lt;div&gt;Step 2: Game happily launches.&lt;/div&gt;&lt;div&gt;Step 3: Game tells me that it requires "Games for Windows - LIVE" (loving called gfwl). I am also told that if I choose not to sign up with a Windows Live account, the game will let me play but NO SAVING!&lt;/div&gt;&lt;div&gt;Step 4: Everybody needs to save their game progress, right? So, I go sign up for a Windows Live account (am I ever going to use that anywhere else?).&lt;/div&gt;&lt;div&gt;Step 5: The same activation code mentioned in Step 1 is required for gfwl. Alright, done and dusted...&lt;/div&gt;&lt;div&gt;Step 6: Now, I am informed that there is an update for gfwl! WHOOPEE! I love downloading updates.&lt;/div&gt;&lt;div&gt;Step 7: My insanely slow internet connection forces me to wait another 20 mins for the update to complete except... SWEET MOMMAYAMA! It never completes..&lt;/div&gt;&lt;div&gt;Step 8: I quit the game and start over, all the while praying to the Norse Gods of Asgard for some hope of salvation. Still no go.&lt;/div&gt;&lt;div&gt;Step 9: I go online and google something retarded like "Cannot update Games for Windows Live".&lt;/div&gt;&lt;div&gt;Step 10: Everyone seems to be having a host of problems each one unique from the rest. I realize that I need to just download and install the darn gfwl service directly. I twiddle my thumbs as my crawling internet connection further keeps me limbo about my fate.&lt;/div&gt;&lt;div&gt;Step 11: Sweet Mana from heaven! The service is installed. It now tells me there is a hotfix for Windows XP. Alright, I'm down with that. The hotfix was likely the issue that caused all hell to break loose n Step 7 anway.&lt;/div&gt;&lt;div&gt;Step 12: Finally! I am allowed to play the game like any normal paying customer should.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The game is simply wonderful! Batman is uber-cool, the Joker is a real gag and Comissioner Gordon looks like Mr. Universe in formals. I'm now enjoying playing the game but I still wonder if I ever needed to go through all that pain just to install the darn game!&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-557289622162723500?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/557289622162723500/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=557289622162723500' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/557289622162723500'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/557289622162723500'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2011/04/how-to-install-game-in-12-easy-steps.html' title='How to install a game in 12 easy steps'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-5182405365158081307</id><published>2010-12-31T11:18:00.008+05:30</published><updated>2010-12-31T11:45:21.212+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='design'/><title type='text'>Happy New Year!</title><content type='html'>&lt;div style="text-align: left;"&gt;Happy 2011 everyone! Have a wonderful year ahead!&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;div&gt;&lt;i&gt;"&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;Ring out the old, ring in the new,&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;Ring, happy bells, across the snow;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;The year is going, let him go;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;Ring out the false, ring in the true.&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;"&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;    &lt;/span&gt;~ Alfred Tennyson, 1850&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_O-rOxpu66eY/TR10igces3I/AAAAAAAAAWg/coNCmuB-v6Y/s1600/macstyle.jpg"&gt;&lt;img src="http://4.bp.blogspot.com/_O-rOxpu66eY/TR10igces3I/AAAAAAAAAWg/coNCmuB-v6Y/s320/macstyle.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5556725651418821490" style="display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; cursor: pointer; width: 320px; height: 240px; " /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;(1600 x 1200 Designed with Gimp 2.6.1)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-5182405365158081307?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/5182405365158081307/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=5182405365158081307' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/5182405365158081307'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/5182405365158081307'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2010/12/happy-2011-everyone-have-wonderful-year.html' title='Happy New Year!'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_O-rOxpu66eY/TR10igces3I/AAAAAAAAAWg/coNCmuB-v6Y/s72-c/macstyle.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-4236747400753327868</id><published>2010-09-24T21:14:00.008+05:30</published><updated>2010-09-24T21:59:31.678+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='games'/><title type='text'>Game Review: NinJump for the iPhone.</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_O-rOxpu66eY/TJzNhVQmGwI/AAAAAAAAAVo/d0lOyP12POM/s1600/img5.jpg"&gt;&lt;/a&gt;NinJump from &lt;a href="http://www.backflipstudios.com/"&gt;Backflip Studios&lt;/a&gt; is one of those games that captures your attention from the get go due to its lovely visuals and simple gameplay. Our protagonist is a Ninja with an uncanny ability to defy gravity and run up walls. Of course, being a Ninja you also get to deal with all manner of enemies ranging from cute little twitter blue birds, squirrels and rival clan Ninjas. Your wall-running quest ends when an enemy manages to tag you. Gameplay goes in short bursts hardly lasting more than 5 minutes at a stretch before you run into an enemy and lose. The game is free to download from the AppStore but includes ads. If you find the ads particularly annoying, you can disable them via an In-App purchase.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Basic Mechanics:&lt;/b&gt;&lt;/div&gt;&lt;div&gt;There are two walls on either side of the screen held in portrait mode and you can bound from wall to wall by simply tapping the screen. When jumping from one wall to the other, the Ninja does a slicing action with his Katana (sword), rending anything that gets in his way. Timing is key. The jumps must be timed so that you slice through your enemies. If you knock into an enemy while running up the wall, its game over.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Power-ups:&lt;/b&gt;&lt;/div&gt;&lt;div&gt;The game isn't as bland as a simple run and slash. There are god-awesome powers too! If you manage to kill three enemies of the same type one after the other, you gain a power-boost that is specific to the enemy that was killed. For instance, if you manage to kill three blue birds in a row, the character will sprout wings and take to the air, smiting anything that gets in his way. After a short while, the power will end and you will become your usual vulnerable self again. The power-ups are particularly visually appealing and when you see them for the first time, you are bound to go "Oh YEAH!" (or some such similar form of exclamation).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;There are also tiny bubbles on the walls which you can grab to get a protective force-shield. The force-shield is good for one hit.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Score System:&lt;/b&gt;&lt;/div&gt;&lt;div&gt;The score you accumulate is a factor of the distance you've covered. This is naturally dependent on how long you manage to survive and how many power-boosts you gain. Destroying attackers is great fun but unfortunately, it doesn't contribute to your score.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;The Good:&lt;/b&gt;&lt;/div&gt;&lt;div&gt;-    Good replay value.&lt;/div&gt;&lt;div&gt;-    Cute visuals.&lt;/div&gt;&lt;div&gt;-    Addicting gameplay.&lt;/div&gt;&lt;div&gt;-    FREE!&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;The Bad:&lt;/b&gt;&lt;/div&gt;&lt;div&gt;-    Really simple (can be seen as a good thing too)&lt;/div&gt;&lt;div&gt;-    Needs more bad guys.&lt;/div&gt;&lt;div&gt;-    Needs a better scoring system.&lt;/div&gt;&lt;div&gt;-    No unlockables? :(&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Get NinJump on the AppStore &lt;a href="http://itunes.apple.com/in/app/ninjump/id379471852?mt=8"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 238); -webkit-text-decorations-in-effect: underline; "&gt;&lt;img src="http://2.bp.blogspot.com/_O-rOxpu66eY/TJzNgpCx8vI/AAAAAAAAAVI/sWKIon_oyuQ/s200/img1.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5520513203906409202" style="float: left; margin-top: 0px; margin-right: 10px; margin-bottom: 10px; margin-left: 0px; cursor: pointer; width: 134px; height: 200px; " /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 238); -webkit-text-decorations-in-effect: underline; "&gt;&lt;span class="Apple-style-span" style="-webkit-text-decorations-in-effect: underline; "&gt;&lt;img src="http://2.bp.blogspot.com/_O-rOxpu66eY/TJzNgrCJBXI/AAAAAAAAAVQ/bsv5sMqyTq4/s200/img2.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5520513204440597874" style="float: left; margin-top: 0px; margin-right: 10px; margin-bottom: 10px; margin-left: 0px; cursor: pointer; width: 134px; height: 200px; " /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 238); -webkit-text-decorations-in-effect: underline; "&gt;&lt;span class="Apple-style-span" style="-webkit-text-decorations-in-effect: underline; "&gt;&lt;span class="Apple-style-span" style="-webkit-text-decorations-in-effect: underline; "&gt;&lt;img src="http://2.bp.blogspot.com/_O-rOxpu66eY/TJzNg4yYspI/AAAAAAAAAVY/1JplR2SmYco/s200/img3.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5520513208132612754" style="float: left; margin-top: 0px; margin-right: 10px; margin-bottom: 10px; margin-left: 0px; cursor: pointer; width: 134px; height: 200px; " /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 238); -webkit-text-decorations-in-effect: underline; "&gt;&lt;span class="Apple-style-span" style="-webkit-text-decorations-in-effect: underline; "&gt;&lt;span class="Apple-style-span" style="-webkit-text-decorations-in-effect: underline; "&gt;&lt;span class="Apple-style-span" style="-webkit-text-decorations-in-effect: underline; "&gt;&lt;img src="http://4.bp.blogspot.com/_O-rOxpu66eY/TJzNhJlFEdI/AAAAAAAAAVg/E_cVPkc_mYw/s200/img4.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5520513212640203218" style="float: left; margin-top: 0px; margin-right: 10px; margin-bottom: 10px; margin-left: 0px; cursor: pointer; width: 134px; height: 200px; " /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 238); -webkit-text-decorations-in-effect: underline; "&gt;&lt;span class="Apple-style-span" style="-webkit-text-decorations-in-effect: underline; "&gt;&lt;span class="Apple-style-span" style="-webkit-text-decorations-in-effect: underline; "&gt;&lt;span class="Apple-style-span" style="-webkit-text-decorations-in-effect: underline; "&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 238); -webkit-text-decorations-in-effect: underline; "&gt;&lt;span class="Apple-style-span" style="-webkit-text-decorations-in-effect: underline; "&gt;&lt;span class="Apple-style-span" style="-webkit-text-decorations-in-effect: underline; "&gt;&lt;span class="Apple-style-span" style="-webkit-text-decorations-in-effect: underline; "&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 238); -webkit-text-decorations-in-effect: underline; "&gt;&lt;span class="Apple-style-span" style="-webkit-text-decorations-in-effect: underline; "&gt;&lt;span class="Apple-style-span" style="-webkit-text-decorations-in-effect: underline; "&gt;&lt;span class="Apple-style-span" style="-webkit-text-decorations-in-effect: underline; "&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 238); -webkit-text-decorations-in-effect: underline; "&gt;&lt;span class="Apple-style-span" style="-webkit-text-decorations-in-effect: underline; "&gt;&lt;span class="Apple-style-span" style="-webkit-text-decorations-in-effect: underline; "&gt;&lt;span class="Apple-style-span" style="-webkit-text-decorations-in-effect: underline; "&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 238); -webkit-text-decorations-in-effect: underline; "&gt;&lt;span class="Apple-style-span" style="-webkit-text-decorations-in-effect: underline; "&gt;&lt;span class="Apple-style-span" style="-webkit-text-decorations-in-effect: underline; "&gt;&lt;span class="Apple-style-span" style="-webkit-text-decorations-in-effect: underline; "&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 238); -webkit-text-decorations-in-effect: underline; "&gt;&lt;span class="Apple-style-span" style="-webkit-text-decorations-in-effect: underline; "&gt;&lt;span class="Apple-style-span" style="-webkit-text-decorations-in-effect: underline; "&gt;&lt;span class="Apple-style-span" style="-webkit-text-decorations-in-effect: underline; "&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 238); -webkit-text-decorations-in-effect: underline; "&gt;&lt;span class="Apple-style-span" style="-webkit-text-decorations-in-effect: underline; "&gt;&lt;span class="Apple-style-span" style="-webkit-text-decorations-in-effect: underline; "&gt;&lt;span class="Apple-style-span" style="-webkit-text-decorations-in-effect: underline; "&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 238); -webkit-text-decorations-in-effect: underline; "&gt;&lt;span class="Apple-style-span" style="-webkit-text-decorations-in-effect: underline; "&gt;&lt;span class="Apple-style-span" style="-webkit-text-decorations-in-effect: underline; "&gt;&lt;span class="Apple-style-span" style="-webkit-text-decorations-in-effect: underline; "&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 238); -webkit-text-decorations-in-effect: underline; "&gt;&lt;span class="Apple-style-span" style="-webkit-text-decorations-in-effect: underline; "&gt;&lt;span class="Apple-style-span" style="-webkit-text-decorations-in-effect: underline; "&gt;&lt;span class="Apple-style-span" style="-webkit-text-decorations-in-effect: underline; "&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 238); -webkit-text-decorations-in-effect: underline; "&gt;&lt;span class="Apple-style-span" style="-webkit-text-decorations-in-effect: underline; "&gt;&lt;span class="Apple-style-span" style="-webkit-text-decorations-in-effect: underline; "&gt;&lt;span class="Apple-style-span" style="-webkit-text-decorations-in-effect: underline; "&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;object width="480" height="385"&gt;&lt;param name="movie" value="http://www.youtube.com/v/4Gi5rRqzZ3M?fs=1&amp;amp;hl=en_US"&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;embed src="http://www.youtube.com/v/4Gi5rRqzZ3M?fs=1&amp;amp;hl=en_US" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-4236747400753327868?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/4236747400753327868/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=4236747400753327868' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/4236747400753327868'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/4236747400753327868'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2010/09/game-review-ninjump-for-iphone.html' title='Game Review: NinJump for the iPhone.'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_O-rOxpu66eY/TJzNgpCx8vI/AAAAAAAAAVI/sWKIon_oyuQ/s72-c/img1.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-9198722098390876766</id><published>2010-07-10T20:44:00.006+05:30</published><updated>2010-07-10T21:00:05.061+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='design'/><title type='text'>iDream wallpaper done with the Gimp</title><content type='html'>&lt;div&gt;I did a nice wallpaper while listening to some cool House/Trance music and this is what I ended up with. Enjoy!&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_O-rOxpu66eY/TDiQc55wnFI/AAAAAAAAATI/wxLAm0LrEx0/s1600/iDream1440x900.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 200px;" src="http://2.bp.blogspot.com/_O-rOxpu66eY/TDiQc55wnFI/AAAAAAAAATI/wxLAm0LrEx0/s320/iDream1440x900.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5492298571832138834" /&gt;&lt;/a&gt;&lt;div style="text-align: center;"&gt;&lt;i&gt;(1440 x 900 widescreen)&lt;/i&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_O-rOxpu66eY/TDiQcWYh-eI/AAAAAAAAATA/tQd-JENtIsw/s1600/iDream1600x1200.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 240px;" src="http://1.bp.blogspot.com/_O-rOxpu66eY/TDiQcWYh-eI/AAAAAAAAATA/tQd-JENtIsw/s320/iDream1600x1200.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5492298562297526754" /&gt;&lt;/a&gt;&lt;div style="text-align: center;"&gt;&lt;i&gt;(1600 x 1200)&lt;/i&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-9198722098390876766?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/9198722098390876766/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=9198722098390876766' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/9198722098390876766'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/9198722098390876766'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2010/07/idream-wallpaper-done-with-gimp.html' title='iDream wallpaper done with the Gimp'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_O-rOxpu66eY/TDiQc55wnFI/AAAAAAAAATI/wxLAm0LrEx0/s72-c/iDream1440x900.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-8831999271634058003</id><published>2010-06-19T20:49:00.010+05:30</published><updated>2011-11-26T14:06:59.476+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='games'/><title type='text'>Game review: Prince of Persia - The Forgotten Sands for the PSP</title><content type='html'>After the Prince of Persia trilogy that became a cult hit among gamers around the world, UbiSoft announced their departure from the current Prince storyline and their venture into a new cel-shaded version of the game. However, before leaving things out to dry, the publishers of the game decided that they would do a fourth title in the POP series – The Forgotten Sands. Prince of Persia: The Forgotten Sands was developed and released for multiple consoles including the Xbox, PS3, Nintendo Wii, DS and the PSP.&lt;br /&gt;&lt;br /&gt;The Forgotten Sands is another epic adventure of the prince that takes place between the events of The Sands of Time and The Warrior Within. What’s really interesting is that the game for the PSP is not just another watered-down story of the one that exists on larger consoles. This time around, the creators decided that handheld owners warranted a unique experience for the Prince and as such the entire storyline is radically different from the one for the Xbox, PS3 and Wii.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-family: verdana;"&gt;THE PLOT:&lt;/span&gt;&lt;br /&gt;The plot begins with a prophecy foretold to Ahihud, the mightiest of fire spirits - &lt;span style="font-style: italic;"&gt;“You will die by the blade he brings. As sure as winter follows fall and day turns to night, a lonely hero with the blood of kings, no mortal soul can withstand his might”&lt;/span&gt;. Fearing that the prophecy would come to pass, Ahihud sends his minions to hunt down and kill all those with royal blood. King Sharaman, the Prince's father locks him in the palace for his own safety but the Prince pursues a mysterious guiding light which offers to help him find his enemy. The light turns out to be Helem, a spirit of time.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-family: verdana;"&gt;GAMEPLAY:&lt;/span&gt;&lt;br /&gt;Ubisoft have taken the PSP game back to its roots by producing a 2.5D platformer(remember the classic Prince of Persia you used to play on DOS?) . The Forgotten Sands is in fact three-dimensional but not free roaming as you would expect in a 3D world. With the help of the spirit of time, the Prince can either accelerate time or slow it down. This makes for some pretty interesting gameplay and inventive puzzle solving. You can make a tiny sandstorm launch the Prince into the air by accelerating it or solidify by slowing it down. Time manipulation is not restricted to sands alone. Any object that Helem hovers over may be subject to acceleration or deceleration. Enemies can be slowed down to a crawl for a short while so that you can quickly dispatch them. Traps can also be brought to a grinding halt for you to safely get past them. As you run through the game, you find glowing orbs of magic called Elixir. Collecting these allow you to purchase upgrades for the Prince. The upgrades are either combat improvements (new combos) or health improvements (extending the health bar for longer life). The good old drinking fountain is still in use as it serves as a checkpoint for the game.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-family: verdana;"&gt;COMBAT:&lt;/span&gt;&lt;br /&gt;Combat is pretty simplistic in The Forgotten Sands. Basic combat involves mashing the square button to hit enemies. You can use the circle button to dodge or throw enemies into the air. You can also use combos in combat once you’ve unlocked them using collected elixir. Most of Ahihud’s minions are pretty easy to take down and don’t really pose a threat. Bosses, however, can be a different story.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-family: verdana;"&gt;GRAPHICS AND ENVIRONMENT:&lt;/span&gt;&lt;br /&gt;Although, the graphics of the game cannot compete with that of larger consoles, It still looks marvellous on the PSP. The artists have paid attention to minor details such as wind being swept in the desert or tiny particles pulsing in a magic world. The cutscenes are engrossing and there’s nothing more rewarding than watching a brand new cutscene of the game after clearing a particularly irksome level. The environment is truly exotic giving you a “wish I were there” feel. Crumbling platforms are common especially in the later levels where you are engaged in a mad rush to clear the level without stopping even for a moment’s breath!&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-family: verdana;"&gt;MUSIC:&lt;/span&gt;&lt;br /&gt;The soundtrack of the game keeps you right in the thick of it, from the arabic-inspired scores to the dark overtones of danger. Voice acting is spectacular as the story unravels through conversations between the Prince and Helem.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-family: verdana;"&gt;VERDICT:&lt;/span&gt;&lt;br /&gt;Fans of the POP Franchise would surely want this game since the story is completely different from the other console versions. The game offers some replay value too by allowing replaying of levels to better your time or collect elixir.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-8831999271634058003?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/8831999271634058003/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=8831999271634058003' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/8831999271634058003'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/8831999271634058003'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2010/06/game-review-prince-of-persia-forgotten.html' title='Game review: Prince of Persia - The Forgotten Sands for the PSP'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-3481668698820943962</id><published>2010-05-23T01:26:00.002+05:30</published><updated>2010-05-23T01:45:49.005+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='rants'/><title type='text'>Two new flavors of spam.</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_O-rOxpu66eY/S_g7IB4cfBI/AAAAAAAAAR4/XPKxfsWHGIM/s1600/final.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 243px;" src="http://3.bp.blogspot.com/_O-rOxpu66eY/S_g7IB4cfBI/AAAAAAAAAR4/XPKxfsWHGIM/s400/final.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5474190356199013394" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-3481668698820943962?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/3481668698820943962/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=3481668698820943962' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/3481668698820943962'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/3481668698820943962'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2010/05/two-new-flavors-of-spam.html' title='Two new flavors of spam.'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_O-rOxpu66eY/S_g7IB4cfBI/AAAAAAAAAR4/XPKxfsWHGIM/s72-c/final.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-8466301520594620138</id><published>2010-04-10T23:05:00.016+05:30</published><updated>2010-04-14T23:48:35.106+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='info'/><category scheme='http://www.blogger.com/atom/ns#' term='blackberry'/><title type='text'>Google Buzz comes to the BlackBerry</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_O-rOxpu66eY/S8C5QkSePkI/AAAAAAAAAQw/S1K1EBdePcc/s1600/Buzz3.bmp"&gt;&lt;/a&gt;&lt;div&gt;A lot of folks have been complaining about Google ignoring the BlackBerry while the iPhone and Android-based mobiles are given preference. They are quite right! Currently, the Gmail mobile application does not have Buzz integration for BlackBerry while Android and the iPhone do. However, Google isn't Evil and so, Buzz has finally reached the BlackBerry as part of the Google Maps 4.0 mobile application. While the Maps app also comes with a lot of other new features for the BlackBerry (voice enabled search, Google Labs integration), the highlight for a social user like me was the Google Buzz feature. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://2.bp.blogspot.com/_O-rOxpu66eY/S8C4GIN_i_I/AAAAAAAAAQQ/S-LKtL-P7SU/s1600/Buzz1.bmp"&gt;&lt;img src="http://2.bp.blogspot.com/_O-rOxpu66eY/S8C4GIN_i_I/AAAAAAAAAQQ/S-LKtL-P7SU/s320/Buzz1.bmp" alt="" id="BLOGGER_PHOTO_ID_5458565163797941234" style="margin: 0px 10px 10px 0px; float: left; cursor: pointer; width: 207px; height: 138px;" border="0" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://3.bp.blogspot.com/_O-rOxpu66eY/S8C4GvfWvWI/AAAAAAAAAQY/Abce_8YXFBk/s1600/LayerSelectBuzz.bmp"&gt;&lt;img src="http://3.bp.blogspot.com/_O-rOxpu66eY/S8C4GvfWvWI/AAAAAAAAAQY/Abce_8YXFBk/s320/LayerSelectBuzz.bmp" alt="" id="BLOGGER_PHOTO_ID_5458565174339747170" style="margin: 0px 10px 10px 0px; float: left; cursor: pointer; width: 210px; height: 140px;" border="0" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt; &lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 238);"&gt;&lt;img src="http://1.bp.blogspot.com/_O-rOxpu66eY/S8C4GxBztcI/AAAAAAAAAQg/vyO2B3rvhLw/s320/Buzz.bmp" alt="" id="BLOGGER_PHOTO_ID_5458565174752687554" style="margin: 0px 10px 10px 0px; float: left; cursor: pointer; width: 209px; height: 140px;" border="0" /&gt;&lt;/span&gt;&lt;/div&gt; &lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 238);"&gt;&lt;/span&gt;&lt;div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Buzz comes as a layer with Maps. Simply enable this Layer and then buzz all you want. You can also post pictures as part of the buzz by selecting a photo stored on your device memory. This isn't exactly like some of those amazing Twitter apps that allow you to take a photo with your built-in camera and tweet it right away but at least its something. As far as I can tell, you can't post a buzz message without tagging it with your location. Considering that this is a Maps application, I guess opting out of specifying the Buzz location isn't part of the deal. I would really like the freedom to preserve my privacy, though. Buzz has been implemented in full swing for this application and I'm sure its only a matter of time before Google rolls it out as part of their Gmail app for the BlackBerry.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 238);"&gt;&lt;img src="http://3.bp.blogspot.com/_O-rOxpu66eY/S8C5QTE7oWI/AAAAAAAAAQo/ehZFHcYZK9M/s320/Buzz2.bmp" alt="" id="BLOGGER_PHOTO_ID_5458566438023045474" style="margin: 0px 10px 10px 0px; float: left; cursor: pointer; width: 320px; height: 214px;" border="0" /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 238);"&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;img src="http://3.bp.blogspot.com/_O-rOxpu66eY/S8C5QkSePkI/AAAAAAAAAQw/S1K1EBdePcc/s320/Buzz3.bmp" alt="" id="BLOGGER_PHOTO_ID_5458566442643242562" style="margin: 0px 10px 10px 0px; text-align: right; float: left; cursor: pointer; width: 320px; height: 214px;" border="0" /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: right;"&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 238);"&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;For a full listing of all the features provided by Google Maps 4.0, read the Google's official blog post &lt;a href="http://googlemobile.blogspot.com/2010/04/google-maps-40-for-blackberry-adds.html"&gt;here&lt;/a&gt;.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-8466301520594620138?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/8466301520594620138/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=8466301520594620138' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/8466301520594620138'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/8466301520594620138'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2010/04/google-buzz-comes-to-blackberry.html' title='Google Buzz comes to the BlackBerry'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_O-rOxpu66eY/S8C4GIN_i_I/AAAAAAAAAQQ/S-LKtL-P7SU/s72-c/Buzz1.bmp' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-1265211103421449101</id><published>2010-02-20T23:40:00.008+05:30</published><updated>2010-02-21T00:18:52.998+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='design'/><title type='text'>Twitter icons and badges.</title><content type='html'>Enjoy these twitter badges and icons!&lt;br /&gt;Some of these images contain transparency. What does that mean? It simply means that you can overlay the image against a background and you will be able to see a portion of the background through it.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Bubble Twitter&lt;/b&gt;:&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_O-rOxpu66eY/S4AnbLLXGiI/AAAAAAAAAOY/sANQG00nSDk/s1600-h/TwitterBubbleRed.png"&gt;&lt;img src="http://2.bp.blogspot.com/_O-rOxpu66eY/S4AnbLLXGiI/AAAAAAAAAOY/sANQG00nSDk/s320/TwitterBubbleRed.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5440391697673951778" style="cursor: pointer; width: 125px; height: 125px; " /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_O-rOxpu66eY/S4Anbdi2bPI/AAAAAAAAAOg/SGv6U-VQupQ/s1600-h/TwitterBubbleYellow.png"&gt;&lt;img src="http://2.bp.blogspot.com/_O-rOxpu66eY/S4Anbdi2bPI/AAAAAAAAAOg/SGv6U-VQupQ/s320/TwitterBubbleYellow.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5440391702604311794" style="cursor: pointer; width: 125px; height: 125px; " /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_O-rOxpu66eY/S4Ana2uw_hI/AAAAAAAAAOQ/GWrjLs_ut1U/s1600-h/TwitterBubbleBrown.png"&gt;&lt;img src="http://2.bp.blogspot.com/_O-rOxpu66eY/S4Ana2uw_hI/AAAAAAAAAOQ/GWrjLs_ut1U/s320/TwitterBubbleBrown.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5440391692185304594" style="cursor: pointer; width: 125px; height: 125px; " /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_O-rOxpu66eY/S4AnaoMJNAI/AAAAAAAAAOI/DdcwlJK9SBM/s1600-h/TwitterBubbleBlue.png"&gt;&lt;img src="http://2.bp.blogspot.com/_O-rOxpu66eY/S4AnaoMJNAI/AAAAAAAAAOI/DdcwlJK9SBM/s320/TwitterBubbleBlue.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5440391688281994242" style="cursor: pointer; width: 125px; height: 125px; " /&gt;&lt;/a&gt;&lt;div&gt;These bubbles really go best against a black background.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_O-rOxpu66eY/S4AnaoMJNAI/AAAAAAAAAOI/DdcwlJK9SBM/s1600-h/TwitterBubbleBlue.png"&gt;&lt;/a&gt;&lt;b&gt;Waving Tweety&lt;/b&gt;:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/21140604@N07/4373218542/" title="Thumbnail by gauntlets_of_fire, on Flickr"&gt;&lt;img src="http://farm3.static.flickr.com/2704/4373218542_6a0f1ce690_o.gif" width="100" height="109" alt="Thumbnail" /&gt;&lt;/a&gt;&lt;a href="http://www.flickr.com/photos/21140604@N07/4373591424/" title="Small by gauntlets_of_fire, on Flickr"&gt;&lt;img src="http://farm3.static.flickr.com/2705/4373591424_3293b00a22_o.gif" width="200" height="217" alt="Small" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://www.flickr.com/photos/21140604@N07/4373591424/" title="Small by gauntlets_of_fire, on Flickr"&gt;&lt;/a&gt;&lt;b&gt;Dark Glass Bird&lt;/b&gt;:&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_O-rOxpu66eY/S4ApOk-F68I/AAAAAAAAAOo/zB0NHPTVdUw/s1600-h/darkbutton125x125.png"&gt;&lt;img src="http://2.bp.blogspot.com/_O-rOxpu66eY/S4ApOk-F68I/AAAAAAAAAOo/zB0NHPTVdUw/s320/darkbutton125x125.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5440393680282577858" style="cursor: pointer; width: 125px; height: 125px; " /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_O-rOxpu66eY/S4ApPMaWb0I/AAAAAAAAAOw/Ospe-p4VPbs/s1600-h/darkbutton200x200.png"&gt;&lt;img src="http://1.bp.blogspot.com/_O-rOxpu66eY/S4ApPMaWb0I/AAAAAAAAAOw/Ospe-p4VPbs/s320/darkbutton200x200.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5440393690870083394" style="cursor: pointer; width: 200px; height: 200px; " /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;If you need any customization for these icons in terms of colour or resolution, feel free to holler at me and I'd be happy to look into it. All these icons were created using the &lt;a href="http://www.gimp.org/"&gt;Gimp &lt;/a&gt;- a free and open source image editing tool.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-1265211103421449101?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/1265211103421449101/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=1265211103421449101' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/1265211103421449101'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/1265211103421449101'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2010/02/twitter-icons-and-badges.html' title='Twitter icons and badges.'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_O-rOxpu66eY/S4AnbLLXGiI/AAAAAAAAAOY/sANQG00nSDk/s72-c/TwitterBubbleRed.png' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-4610990964700352053</id><published>2010-02-15T01:07:00.007+05:30</published><updated>2010-02-15T01:58:38.482+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='wpf'/><category scheme='http://www.blogger.com/atom/ns#' term='design'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><title type='text'>Snow flakes particle system in WPF</title><content type='html'>Hi all! While playing around with a rudimentary particle system that I created, I thought it might be fun to create a screen saver that will do a cool Compiz Fusion style snow fall. Of course, this was just a fun exercise. The screen saver is not configurable at all, except through code.&lt;br /&gt;&lt;br /&gt;&lt;object width="425" height="344"&gt;&lt;param name="movie" value="http://www.youtube.com/v/-nQ12bVb_2Y&amp;hl=en_US&amp;fs=1&amp;"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/-nQ12bVb_2Y&amp;hl=en_US&amp;fs=1&amp;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-4610990964700352053?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/4610990964700352053/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=4610990964700352053' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/4610990964700352053'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/4610990964700352053'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2010/02/snow-flakes-particle-system-in-wpf.html' title='Snow flakes particle system in WPF'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-7341324916702503121</id><published>2010-02-07T05:00:00.007+05:30</published><updated>2010-03-05T04:45:26.101+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='wpf'/><category scheme='http://www.blogger.com/atom/ns#' term='design'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><title type='text'>A 3D Valentines day Greeting card.</title><content type='html'>I'd like to showcase a 3D Greeting card concept created in WPF. Feel free to customize and send this card to others too. The attached readme file in the &lt;a href="http://cid-79f76074870930c7.skydrive.live.com/self.aspx/.Public/Valentines%203D%20Card.zip"&gt;download package&lt;/a&gt; has some information on customizing the card.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;System and Software Requirements:&lt;/span&gt;&lt;br /&gt;A processor better than a PIV.&lt;br /&gt;Windows XP SP2 (with .NET Framework 3.0 or higher installed), Windows Vista or Windows 7.&lt;br /&gt;A graphics card is recommended but not required.&lt;br /&gt;&lt;br /&gt;&lt;object height="344" width="425"&gt;&lt;param name="movie" value="http://www.youtube.com/v/dzV8eun1xwY&amp;amp;hl=en&amp;amp;fs=1"&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;embed src="http://www.youtube.com/v/dzV8eun1xwY&amp;amp;hl=en&amp;amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" height="344" width="425"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-7341324916702503121?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/7341324916702503121/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=7341324916702503121' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/7341324916702503121'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/7341324916702503121'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2010/02/3d-valentines-day-greeting-card.html' title='A 3D Valentines day Greeting card.'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-3539601591905069990</id><published>2010-01-30T19:37:00.004+05:30</published><updated>2010-01-30T19:43:27.737+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='design'/><title type='text'>i "C" - Widescreen Wallpaper</title><content type='html'>While experimenting with the Gimp, I designed this i "C" wallpaper and thought it was worth sharing. I probably could do an i "C++" or i "C#" version too!&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_O-rOxpu66eY/S2Q-Bgjt9tI/AAAAAAAAAMs/-2Qn6Pb0HvQ/s1600-h/ic.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 225px;" src="http://2.bp.blogspot.com/_O-rOxpu66eY/S2Q-Bgjt9tI/AAAAAAAAAMs/-2Qn6Pb0HvQ/s400/ic.jpg" alt="" id="BLOGGER_PHOTO_ID_5432535246156199634" border="0" /&gt;&lt;/a&gt;What do you think?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-3539601591905069990?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/3539601591905069990/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=3539601591905069990' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/3539601591905069990'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/3539601591905069990'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2010/01/i-c-widescreen-wallpaper.html' title='i &quot;C&quot; - Widescreen Wallpaper'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_O-rOxpu66eY/S2Q-Bgjt9tI/AAAAAAAAAMs/-2Qn6Pb0HvQ/s72-c/ic.jpg' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-526489426416034253</id><published>2010-01-24T17:48:00.006+05:30</published><updated>2010-01-24T17:57:06.047+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='comics'/><title type='text'>Its a programmer thing</title><content type='html'>I'm just trying my hand out at web comics and though I'm far from &lt;a href="http://www.penny-arcade.com/comic"&gt;Penny Arcade&lt;/a&gt; or &lt;a href="http://xkcd.com/"&gt;xkcd&lt;/a&gt;, I'd really like to give my readers something to smile about. :)&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_O-rOxpu66eY/S1w746iVzDI/AAAAAAAAAMM/NHVXzkDhEq0/s1600-h/cartoonstrip.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 208px; height: 400px;" src="http://3.bp.blogspot.com/_O-rOxpu66eY/S1w746iVzDI/AAAAAAAAAMM/NHVXzkDhEq0/s400/cartoonstrip.jpg" alt="" id="BLOGGER_PHOTO_ID_5430281099673979954" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-526489426416034253?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/526489426416034253/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=526489426416034253' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/526489426416034253'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/526489426416034253'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2010/01/its-programmer-thing.html' title='Its a programmer thing'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_O-rOxpu66eY/S1w746iVzDI/AAAAAAAAAMM/NHVXzkDhEq0/s72-c/cartoonstrip.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-4834591899176299272</id><published>2010-01-10T17:54:00.002+05:30</published><updated>2010-01-10T18:05:05.757+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='info'/><category scheme='http://www.blogger.com/atom/ns#' term='iphone'/><title type='text'>Testing iPhone Web Apps without an iPhone</title><content type='html'>If you've ever felt the need to see what an iPhone web application looks like without an actual iPhone in hand, then check out &lt;span class="Apple-style-span" style="font-family: Tahoma; font-size: 12px; white-space: pre; "&gt;&lt;a href="http://www.testiphone.com"&gt;http://www.testiphone.com&lt;/a&gt;.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-4834591899176299272?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/4834591899176299272/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=4834591899176299272' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/4834591899176299272'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/4834591899176299272'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2010/01/testing-iphone-web-apps-without-iphone.html' title='Testing iPhone Web Apps without an iPhone'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-8674790240492801345</id><published>2010-01-03T13:42:00.004+05:30</published><updated>2010-01-10T18:05:18.317+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='info'/><category scheme='http://www.blogger.com/atom/ns#' term='iphone'/><title type='text'>AppStore in your web browser</title><content type='html'>If you don't have the iTunes player installed on your machine, you can still view the AppStore in your web browser at &lt;a href="http://app-store.appspot.com/"&gt;http://app-store.appspot.com&lt;/a&gt;. Of course, all you can do is view apps. You cannot download or purchase any. There is also no option to change the AppStore country (defaults to United States). All the same, its nice to know that we don't need the iTunes player to simply browse the AppStore.&lt;br /&gt;&lt;br /&gt;EDIT: I just found two other websites that allow you to browse the AppStore -&lt;br /&gt;&lt;a href="http://www.yappler.com"&gt;http://www.yappler.com&lt;/a&gt; and &lt;a href="http://appshopper.com"&gt;http://appshopper.com&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-8674790240492801345?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/8674790240492801345/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=8674790240492801345' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/8674790240492801345'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/8674790240492801345'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2010/01/appstore-in-your-web-browser.html' title='AppStore in your web browser'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-815419073805891960</id><published>2010-01-01T20:12:00.008+05:30</published><updated>2010-03-07T22:20:41.279+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='info'/><title type='text'>g.ho.st is really cool stuff!</title><content type='html'>Recently, a few friends of mine pointed me to this awesome site - &lt;a href="http://g.ho.st/"&gt;http://g.ho.st/&lt;/a&gt;&lt;br /&gt;Its pronounced "Ghost". Ghost is basically a virtual computer on the internet and its been implemented really well. Best of all, the service is free! Head on over to the link above and check it out. Their intro video is a bit long-winded but it explains the concept of Ghost nicely.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;EDIT:&lt;/b&gt; Looks like the g.ho.st folks couldn't quite manage to pull off the service as a freebie. I received a mail from them which ran as follows:&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;"&lt;i&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Dear Ghost User,&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;We hope you have been enjoying our free Ghost service. Regrettably changes in the marketplace mean that it is no longer economical for us to host the Ghost service and we will be closing down the service on or around March 15. We will instead be focusing on licensing or selling our technology to larger companies.&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;We advise you to migrate ALL important folders, files and emails to another secure place before March 15. You might like to consider Google Docs or Microsoft SkyDrive for files and services such as Gmail or Yahoo! Mail for email. Some instructions for migrating data are included below.&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;i&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;We are really sorry for any inconvenience this may cause you and are very grateful for the fantastic support we had from our community.&lt;/span&gt;&lt;/i&gt;"&lt;/span&gt;&lt;/div&gt;&lt;div&gt;Well, nothing lasts forever. That's a darn shame!&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-815419073805891960?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/815419073805891960/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=815419073805891960' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/815419073805891960'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/815419073805891960'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2010/01/ghost-is-really-cool-stuff.html' title='g.ho.st is really cool stuff!'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-927634496092126955</id><published>2009-12-27T11:38:00.002+05:30</published><updated>2009-12-27T11:40:26.531+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='rants'/><title type='text'>Season's Greetings</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_O-rOxpu66eY/Szb6JQa2AZI/AAAAAAAAAKs/ugt_BdYDigg/s1600-h/RCChristmas.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 214px; height: 183px;" src="http://4.bp.blogspot.com/_O-rOxpu66eY/Szb6JQa2AZI/AAAAAAAAAKs/ugt_BdYDigg/s320/RCChristmas.png" alt="" id="BLOGGER_PHOTO_ID_5419794238520295826" border="0" /&gt;&lt;/a&gt;Its that time of the year when new and wonderful things happen. Wish you all a Merry Christmas and a Happy New Year!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-927634496092126955?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/927634496092126955/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=927634496092126955' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/927634496092126955'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/927634496092126955'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2009/12/seasons-greetings.html' title='Season&apos;s Greetings'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_O-rOxpu66eY/Szb6JQa2AZI/AAAAAAAAAKs/ugt_BdYDigg/s72-c/RCChristmas.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-2351794189626051545</id><published>2009-11-24T09:22:00.023+05:30</published><updated>2009-11-26T10:54:53.586+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='design'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><title type='text'>LWUIT and WPF Gradients Mash-up #2</title><content type='html'>&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;"On the last episode of Angelo's Stuff..."&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;We saw how to create a multi-coloured linear gradient. We also learnt the concept and purpose of gradient stops. This time around, we're going to dive into radial gradients.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;What's so hard about radial gradients?&lt;/span&gt;&lt;br /&gt;First off, there are a couple of things that radically differentiate linear and radial gradients.&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Linear radients are memory efficient. Only a small strip of an image needs to be made and that same image is tiled either horizontally or vertically across the area to be painted. Radial gradients are not tegular. We need an image that is as large as the area to be painted. A lot of memory is going to be used for a fancy effect. The good news is that the memory will be used up at run-time. So, the downloadable application isn't bloated.&lt;/li&gt;&lt;li&gt;Radial gradients have a lot of customization options. Since we're using up a large image, we might as well get our memory's worth.&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;Let's paint the town red!&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;The GradientStop class.&lt;/span&gt;&lt;br /&gt;See &lt;a href="http://angelorohit.blogspot.com/2009/11/lwuit-and-wpf-gradients-mash-up-1.html"&gt;previous post&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;The RadialGradient class. &lt;/span&gt;&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;public class RadialGradient&lt;br /&gt;{&lt;br /&gt;   private Vector vGradientStops;&lt;br /&gt;   private int radiusX, radiusY;&lt;br /&gt;   private int marginTop, marginLeft;&lt;br /&gt;  &lt;br /&gt;   public final static int FILL = 0xffff;&lt;br /&gt;   public final static int CENTER = 0xffff;&lt;br /&gt;&lt;br /&gt;   public RadialGradient(  Vector gradientStops,&lt;br /&gt;                           int radiusX, int radiusY,&lt;br /&gt;                           int marginLeft, int marginTop   )&lt;br /&gt;   {&lt;br /&gt;       vGradientStops = new Vector();&lt;br /&gt;       if(gradientStops != null)&lt;br /&gt;       {&lt;br /&gt;           //Ensure the gradient stops are ordered by offset in the member Vector.&lt;br /&gt;           for(int i = 0; i &lt; gradientStops.size(); ++i)&lt;br /&gt;           {&lt;br /&gt;               GradientStop newGradientStop =&lt;br /&gt;                       (GradientStop) gradientStops.elementAt(i);&lt;br /&gt;               int insertPos = 0;&lt;br /&gt;               for(insertPos = 0; insertPos &lt; vGradientStops.size(); ++insertPos)&lt;br /&gt;               {&lt;br /&gt;                   GradientStop existingGradientStop =&lt;br /&gt;                           (GradientStop) vGradientStops.elementAt(insertPos);&lt;br /&gt;                   if(newGradientStop.getOffset() &lt; existingGradientStop.getOffset())&lt;br /&gt;                   {&lt;br /&gt;                       break;&lt;br /&gt;                   }&lt;br /&gt;               }&lt;br /&gt;&lt;br /&gt;               vGradientStops.insertElementAt(newGradientStop, insertPos);&lt;br /&gt;           }&lt;br /&gt;       }&lt;br /&gt;&lt;br /&gt;       this.radiusX        = radiusX;&lt;br /&gt;       this.radiusY        = radiusY;&lt;br /&gt;       this.marginTop      = marginTop;&lt;br /&gt;       this.marginLeft     = marginLeft;&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   //Getters.&lt;br /&gt;   public Vector getGradientStops()&lt;br /&gt;   { return vGradientStops; }&lt;br /&gt;   public int getRadiusX()&lt;br /&gt;   { return radiusX; }&lt;br /&gt;   public int getRadiusY()&lt;br /&gt;   { return radiusY; }&lt;br /&gt;   public int getMarginLeft()&lt;br /&gt;   { return marginLeft; }&lt;br /&gt;   public int getMarginTop()&lt;br /&gt;   { return marginTop; }&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;The constructor of this class takes the following parameters:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;A Vector of GradientStop&lt;/span&gt;. This allows us to use multiple colours within a single gradient.&lt;/li&gt;&lt;li&gt;An X radius. This is the width of the radial gradient. Specify RadialGradient.FILL in order to have the radial gradient fill the entire width of the painted area.&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;A Y radius. &lt;/span&gt;This is the height of the radial gradient. Specify RadialGradient.FILL in order to have the radial gradient fill the entire height of the painted area.&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;A left margin.&lt;/span&gt; This is the distance of the center of the gradient from the left-most point of the area to be painted. Specify RadialGradient.CENTER to have the radial gradient show up in the horizontal center of the painted area.&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;A top margin.&lt;/span&gt; This is the distance of the center of the gradient from the top-most point of the area to be painted. Specify RadialGradient.CENTER to have the radial gradient show up in the vertical center of the painted area.&lt;/li&gt;&lt;/ol&gt;&lt;span style="font-style: italic;font-size:85%;" &gt;&lt;span style="font-weight: bold;"&gt;What are these margins for?&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;The margins are basically used to space the radial gradient in the area to be painted. Assume that we have a radial gradient with an X radius and Y radius of 20 each. Now let's say that we want to paint this radial gradient at the top left of the painted area. Then all we need to do is specify left and top margins of 10 (half the respective radii). The illustration below should clarify things.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_O-rOxpu66eY/Sw4IAk4BPWI/AAAAAAAAAKI/rtiFvpX8NLU/s1600/marginexample.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 185px;" src="http://4.bp.blogspot.com/_O-rOxpu66eY/Sw4IAk4BPWI/AAAAAAAAAKI/rtiFvpX8NLU/s320/marginexample.jpg" alt="" id="BLOGGER_PHOTO_ID_5408269008510205282" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: bold;"&gt;The Painter.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;We're going to cache an image that is as large as the area to be painted. So, why restrict ourselves to a single radial gradient? Let's call our custom Painter - MultiRadialGradientPainter. The user of our Painter should be able to overlay multiple radial gradients over each other.&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;public class MultiRadialGradientPainter implements Painter&lt;br /&gt;{&lt;br /&gt;   private byte opacity;&lt;br /&gt;   private Image cache;&lt;br /&gt;   private Vector vRadialGradients;&lt;br /&gt;   private int backFillColor;&lt;br /&gt;&lt;br /&gt;   public MultiRadialGradientPainter(  Vector radialGradients,&lt;br /&gt;                                       byte opacity, int backFillColor )&lt;br /&gt;   {&lt;br /&gt;       vRadialGradients    = radialGradients;&lt;br /&gt;       this.opacity        = opacity;       &lt;br /&gt;       this.backFillColor  = backFillColor;&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   //Special case overload for single Radial Gradients only.&lt;br /&gt;   public MultiRadialGradientPainter(  RadialGradient radialGradient,&lt;br /&gt;                                       byte opacity, int backFillColor )&lt;br /&gt;   {&lt;br /&gt;       vRadialGradients    = new Vector();&lt;br /&gt;       vRadialGradients.addElement(radialGradient);&lt;br /&gt;&lt;br /&gt;       this.opacity        = opacity;&lt;br /&gt;       this.backFillColor  = backFillColor;&lt;br /&gt;   }&lt;br /&gt;  &lt;br /&gt;   public void paint(Graphics g, Rectangle rect)&lt;br /&gt;   {&lt;br /&gt;       final Dimension d   = rect.getSize();&lt;br /&gt;       final int x         = rect.getX();&lt;br /&gt;       final int y         = rect.getY();&lt;br /&gt;       final int width     = d.getWidth();&lt;br /&gt;       final int height    = d.getHeight();       &lt;br /&gt;&lt;br /&gt;       final int size = Math.max(width, height);&lt;br /&gt;       if(cache == null || size != cache.getWidth())&lt;br /&gt;       {&lt;br /&gt;           cache = Image.createImage(size, size);&lt;br /&gt;           Graphics dc = cache.getGraphics();&lt;br /&gt;&lt;br /&gt;           //Set the backFillColor before drawing the gradients.&lt;br /&gt;           if(backFillColor &gt;= 0)&lt;br /&gt;           {&lt;br /&gt;               dc.setColor(backFillColor);&lt;br /&gt;               dc.fillRect(0, 0, width, height);&lt;br /&gt;           }&lt;br /&gt;          &lt;br /&gt;           for(int i = 0; i &lt; vRadialGradients.size(); ++i)&lt;br /&gt;           {&lt;br /&gt;               final RadialGradient radialGradient =&lt;br /&gt;                       (RadialGradient)vRadialGradients.elementAt(i);&lt;br /&gt;               int radiusX = radialGradient.getRadiusX();&lt;br /&gt;               int radiusY = radialGradient.getRadiusY();&lt;br /&gt;               int marginLeft = radialGradient.getMarginLeft();&lt;br /&gt;               int marginTop = radialGradient.getMarginTop();&lt;br /&gt;&lt;br /&gt;               if(radiusX &gt;= RadialGradient.FILL)               &lt;br /&gt;                   radiusX = size;                   &lt;br /&gt;               if(radiusY &gt;= RadialGradient.FILL)               &lt;br /&gt;                   radiusY = size;&lt;br /&gt;&lt;br /&gt;               if(marginTop &gt;= RadialGradient.CENTER)&lt;br /&gt;                   marginTop = height / 2;&lt;br /&gt;               if(marginLeft &gt;= RadialGradient.CENTER)&lt;br /&gt;                   marginLeft = width / 2;&lt;br /&gt;&lt;br /&gt;               final Vector vGradientStops = radialGradient.getGradientStops();&lt;br /&gt;               for(int j = vGradientStops.size() - 2; j &gt; -1; --j)&lt;br /&gt;               {&lt;br /&gt;                   GradientStop thisGradientStop =&lt;br /&gt;                               ((GradientStop)vGradientStops.elementAt(j));&lt;br /&gt;                   GradientStop nextGradientStop =&lt;br /&gt;                           ((GradientStop)vGradientStops.elementAt(j + 1));&lt;br /&gt;&lt;br /&gt;                   drawRadialGradient(dc,&lt;br /&gt;                           thisGradientStop.getColor(),&lt;br /&gt;                           nextGradientStop.getColor(),&lt;br /&gt;                           (int)(radiusX * (thisGradientStop.getOffset() / 100.0)),&lt;br /&gt;                           (int)(radiusX * (nextGradientStop.getOffset() / 100.0)),&lt;br /&gt;                           (int)(radiusY * (thisGradientStop.getOffset() / 100.0)),&lt;br /&gt;                           (int)(radiusY * (nextGradientStop.getOffset() / 100.0)),&lt;br /&gt;                           marginLeft, marginTop&lt;br /&gt;                           );&lt;br /&gt;               }&lt;br /&gt;           }&lt;br /&gt;&lt;br /&gt;           if(opacity &lt; 255)&lt;br /&gt;           {&lt;br /&gt;               cache = cache.modifyAlpha(opacity);&lt;br /&gt;           }&lt;br /&gt;       }&lt;br /&gt;&lt;br /&gt;       g.drawImage(cache, x, y);&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   //This routine does the job of drawing a radial gradient.&lt;br /&gt;   private void drawRadialGradient(Graphics dc, int srcColor, int destColor,&lt;br /&gt;                                   int startRadiusX, int endRadiusX,&lt;br /&gt;                                   int startRadiusY, int endRadiusY,&lt;br /&gt;                                   int marginLeft, int marginTop)&lt;br /&gt;   {&lt;br /&gt;       final int srcR = srcColor &gt;&gt; 16;&lt;br /&gt;       final int srcG = srcColor &gt;&gt; 8 &amp;amp; 0xff;&lt;br /&gt;       final int srcB = srcColor &amp;amp; 0xff;&lt;br /&gt;&lt;br /&gt;       final int destR = destColor &gt;&gt; 16;&lt;br /&gt;       final int destG = destColor &gt;&gt; 8 &amp;amp; 0xff;&lt;br /&gt;       final int destB = destColor &amp;amp; 0xff;&lt;br /&gt;&lt;br /&gt;       final int dx = (endRadiusX - startRadiusX);&lt;br /&gt;       final int dy = (endRadiusY - startRadiusY);&lt;br /&gt;       final int biggerDiff = (dx &gt; dy) ? dx : dy;&lt;br /&gt;&lt;br /&gt;       for(int i = biggerDiff; i &gt; 0; --i)&lt;br /&gt;       {&lt;br /&gt;           final int interpolatedR =&lt;br /&gt;                   (int)(srcR + ((destR - srcR) * ((float)i / biggerDiff)));&lt;br /&gt;           final int interpolatedG =&lt;br /&gt;                   (int)(srcG + ((destG - srcG) * ((float)i / biggerDiff)));&lt;br /&gt;           final int interpolatedB =&lt;br /&gt;                   (int)(srcB + ((destB - srcB) * ((float)i / biggerDiff)));&lt;br /&gt;&lt;br /&gt;           final int interpolatedColor =&lt;br /&gt;                   interpolatedB | (interpolatedG &lt;&lt; 8) | (interpolatedR &lt;&lt; 16);&lt;br /&gt;&lt;br /&gt;           dc.setColor(interpolatedColor);&lt;br /&gt;&lt;br /&gt;           final int currentRadiusX = startRadiusX + (i * dx / biggerDiff);&lt;br /&gt;           final int currentRadiusY = startRadiusY + (i * dy / biggerDiff);&lt;br /&gt;&lt;br /&gt;           dc.fillArc(&lt;br /&gt;                   marginLeft - (currentRadiusX / 2),&lt;br /&gt;                   marginTop - (currentRadiusY / 2),&lt;br /&gt;                   currentRadiusX, currentRadiusY, 0, 360);&lt;br /&gt;       }&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;The constructor of MultiRadialGradientPainter takes the following arguments:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;A Vector of RadialGradient.&lt;/span&gt; This allows us to have multiple radial gradients drawn by the painter.&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;Opacity.&lt;/span&gt; A byte value that controls the transparency of the entire painted image.&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;A back fill color. &lt;/span&gt;This colour will be used to fill the remainder of the space in the image where there is no gradient.&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;How about an example?&lt;/span&gt;&lt;br /&gt;We have a simple LWUIT Form with a Label at the top (&lt;span style="font-family:courier new;"&gt;BorderLayout.NORTH&lt;/span&gt;).&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_O-rOxpu66eY/Sw4IwLNAZYI/AAAAAAAAAKQ/z7tlvRle7fg/s1600/FormGradients.JPG"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 232px; height: 309px;" src="http://1.bp.blogspot.com/_O-rOxpu66eY/Sw4IwLNAZYI/AAAAAAAAAKQ/z7tlvRle7fg/s320/FormGradients.JPG" alt="" id="BLOGGER_PHOTO_ID_5408269826252629378" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_O-rOxpu66eY/Sw4JTbLn30I/AAAAAAAAAKY/RDoKfwZYLYU/s1600/LabelGradients.JPG"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 231px; height: 309px;" src="http://1.bp.blogspot.com/_O-rOxpu66eY/Sw4JTbLn30I/AAAAAAAAAKY/RDoKfwZYLYU/s320/LabelGradients.JPG" alt="" id="BLOGGER_PHOTO_ID_5408270431837216578" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:85%;" &gt;&lt;span style="font-family:courier new;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The screenshot on the left shows the Form without &lt;images&gt;the Label. The Form has two radial gradients - one on the top and the other in the center. The screenshot on the right shows the barebones Form with the Label. The Label has a linear gradient.&lt;/images&gt;&lt;br /&gt;&lt;images&gt;&lt;/images&gt;&lt;/div&gt;&lt;images&gt;&lt;br /&gt;This is what the code for setting these gradients looks like:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;{&lt;br /&gt; Vector vGradientStops = new Vector();&lt;br /&gt; vGradientStops.addElement(new GradientStop(0xffffff, (byte)0));&lt;br /&gt; vGradientStops.addElement(new GradientStop(0x434343, (byte)50));&lt;br /&gt; vGradientStops.addElement(new GradientStop(0xffffff, (byte)60));&lt;br /&gt;&lt;br /&gt; theLabel.getStyle().setBgPainter(&lt;br /&gt;         new LinearGradientPainter(vGradientStops, (byte)127, false));&lt;br /&gt;}&lt;br /&gt;{&lt;br /&gt; Vector vGradientStops = new Vector();&lt;br /&gt; vGradientStops.addElement(new GradientStop(0x704700, (byte)0));&lt;br /&gt; vGradientStops.addElement(new GradientStop(0x251801, (byte)100));&lt;br /&gt;&lt;br /&gt; Vector vRadialGradients = new Vector();&lt;br /&gt; vRadialGradients.addElement(&lt;br /&gt;         new RadialGradient(vGradientStops,&lt;br /&gt;         RadialGradient.FILL, RadialGradient.FILL,&lt;br /&gt;         RadialGradient.CENTER, RadialGradient.CENTER));&lt;br /&gt;&lt;br /&gt; Vector vSmallGradientStops = new Vector();&lt;br /&gt; vSmallGradientStops.addElement(new GradientStop(0xffa300, (byte)0));&lt;br /&gt; vSmallGradientStops.addElement(new GradientStop(0xffa300, (byte)50));&lt;br /&gt; vSmallGradientStops.addElement(new GradientStop(0x251801, (byte)100));&lt;br /&gt;&lt;br /&gt; vRadialGradients.addElement(&lt;br /&gt;         new RadialGradient(vSmallGradientStops,&lt;br /&gt;         RadialGradient.FILL, 50,&lt;br /&gt;         RadialGradient.CENTER, 0));&lt;br /&gt;&lt;br /&gt; theForm.getStyle().setBgPainter(&lt;br /&gt;         new MultiRadialGradientPainter(vRadialGradients, (byte)255, 0x251801));&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;Note that the linear gradient is at 50% opacity. When combining the two together, we get the effect as seen below.&lt;br /&gt;&lt;/images&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_O-rOxpu66eY/Sw4MRBi9pGI/AAAAAAAAAKg/zoocP8eDf6E/s1600/finalgradient.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 240px; height: 320px;" src="http://2.bp.blogspot.com/_O-rOxpu66eY/Sw4MRBi9pGI/AAAAAAAAAKg/zoocP8eDf6E/s320/finalgradient.JPG" alt="" id="BLOGGER_PHOTO_ID_5408273689130935394" border="0" /&gt;&lt;/a&gt;&lt;images&gt;Pretty neat, huh?&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;Is that all?&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;Well, yes. That's it. A word of caution: Use radial gradients sparingly. Remember that they require memory allocated for an image that is as large as the area to be painted. If we were to start using radial gradients for all our components then we would run into Out Of Memory exceptions. Also, expect the unexpected. If we do run into an OOM exception, we need to gracefully handle it and fall back on a less fancy UI.&lt;br /&gt;&lt;br /&gt;Whew! That was a pretty long-winded post but I hope the MultiRadialGradientPainter proves useful to LWUIT designer/developers out there. If you find an issue with the code feel free to inform me and I'll be happy to look into it. Happy coding!&lt;br /&gt;&lt;br /&gt;&lt;/images&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-2351794189626051545?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/2351794189626051545/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=2351794189626051545' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/2351794189626051545'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/2351794189626051545'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2009/11/lwuit-and-wpf-gradients-mash-up-2.html' title='LWUIT and WPF Gradients Mash-up #2'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_O-rOxpu66eY/Sw4IAk4BPWI/AAAAAAAAAKI/rtiFvpX8NLU/s72-c/marginexample.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-6764707562944171043</id><published>2009-11-15T09:38:00.017+05:30</published><updated>2009-11-15T10:36:04.116+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='design'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><title type='text'>LWUIT and WPF Gradients Mash-up #1</title><content type='html'>&lt;a href="http://lwuit.blogspot.com/"&gt;Shai Almog's blog&lt;/a&gt; is the one-stop-shop for all things LWUIT. I recently read &lt;a href="http://lwuit.blogspot.com/2008/07/pimp-my-lwuit-part-1-gradient-galore.html"&gt;his entry on GradientPainters&lt;/a&gt; and it floored me! I thought I could enhance it a bit by adding GradientStops to the LinearGradientPainter.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;What is a GradientStop?&lt;/span&gt;&lt;br /&gt;If you come from a WPF background, then you know exactly what a GradientStop is. The fillLinearGradient() routine in LWUIT allows us to smoothly transition between two colours. So, we could go from White to Black and end up with this.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_O-rOxpu66eY/Sv-BBmiZCOI/AAAAAAAAAJw/mf9EYM69wN4/s1600-h/TwoLinearGradient.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 219px; height: 64px;" src="http://1.bp.blogspot.com/_O-rOxpu66eY/Sv-BBmiZCOI/AAAAAAAAAJw/mf9EYM69wN4/s400/TwoLinearGradient.JPG" alt="" id="BLOGGER_PHOTO_ID_5404179942392531170" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;However, if we want to smoothly transition between multiple colours then that's where GradientStops can help us out. Let's say we want to vertically transition from White to Red and then from Red to Black. We start with White at the top and transition to red halfway through. Then we go from red at the half position, all the way to black at the bottom. Your mind's eye should have a picture like the one below.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_O-rOxpu66eY/Sv-BMj5WvII/AAAAAAAAAJ4/MW9fv7x44Sg/s1600-h/MultiLinearGradient.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 219px; height: 64px;" src="http://2.bp.blogspot.com/_O-rOxpu66eY/Sv-BMj5WvII/AAAAAAAAAJ4/MW9fv7x44Sg/s400/MultiLinearGradient.JPG" alt="" id="BLOGGER_PHOTO_ID_5404180130662104194" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;A GradientStop has an offset and colour. The offset is the percentage of the position at which the colour is the strongest. For example, in our multiple colour gradient example above, we would need two GradientStops.&lt;br /&gt;&lt;ol&gt;&lt;li&gt;GradientStop with offset 0 and colour White (0xffffff in LWUIT terms).&lt;/li&gt;&lt;li&gt;GradientStop with offset 50 and colour Red (0xff0000).&lt;/li&gt;&lt;li&gt;GradientStop with offset 100 and colour Black (0x000000).&lt;/li&gt;&lt;/ol&gt;&lt;span style="font-weight: bold;"&gt;Where's the code?&lt;/span&gt;&lt;br /&gt;First, the implementation of the GradientStop class.&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;&lt;br /&gt;public class GradientStop&lt;br /&gt;{&lt;br /&gt;   private int color;&lt;br /&gt;   private byte offset;&lt;br /&gt;&lt;br /&gt;   public GradientStop()&lt;br /&gt;   {&lt;br /&gt;       color = 0x000000;   //Default Black at offset 0.&lt;br /&gt;       offset = 0;&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   public GradientStop(int colorVal, byte offsetVal)&lt;br /&gt;   {&lt;br /&gt;       color = colorVal;&lt;br /&gt;       offset = offsetVal;&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   public int getColor()&lt;br /&gt;   {&lt;br /&gt;       return color;&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   public int getOffset()&lt;br /&gt;   {&lt;br /&gt;       return offset;&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   public void setColor(int value)&lt;br /&gt;   {&lt;br /&gt;       color = value;&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   public void setOffset(byte value)&lt;br /&gt;   {&lt;br /&gt;       offset = value;&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Now, comes the implementation of the enhanced LinearGradientPainter.&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;&lt;br /&gt;&lt;span style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace;"&gt;public class LinearGradientPainter implements Painter&lt;br /&gt;{&lt;br /&gt;   private boolean horizontal;&lt;br /&gt;   private byte opacity;&lt;br /&gt;   private Image cache;&lt;br /&gt;   private Vector vGradientStops;&lt;br /&gt;&lt;br /&gt;   public LinearGradientPainter(   Vector gradientStops,&lt;br /&gt;                                   byte opacity, boolean horizontal)&lt;br /&gt;   {&lt;br /&gt;       vGradientStops = new Vector();&lt;br /&gt;&lt;br /&gt;       if(gradientStops != null)&lt;br /&gt;       {&lt;br /&gt;           //Ensure the gradient stops are ordered by offset in the Vector.&lt;br /&gt;           for(int i = 0; i &lt; gradientStops.size(); ++i)&lt;br /&gt;           {&lt;br /&gt;               GradientStop newGradientStop =&lt;br /&gt;                       (GradientStop) gradientStops.elementAt(i);&lt;br /&gt;               int insertPos = 0;&lt;br /&gt;               for(insertPos = 0; insertPos &lt; vGradientStops.size(); ++insertPos)&lt;br /&gt;               {&lt;br /&gt;                   GradientStop existingGradientStop =&lt;br /&gt;                           (GradientStop) vGradientStops.elementAt(insertPos);&lt;br /&gt;                   if(newGradientStop.getOffset() &lt; existingGradientStop.getOffset())&lt;br /&gt;                   {&lt;br /&gt;                       break;&lt;br /&gt;                   }&lt;br /&gt;               }&lt;br /&gt;&lt;br /&gt;               vGradientStops.insertElementAt(newGradientStop, insertPos);&lt;br /&gt;           }&lt;br /&gt;       }&lt;br /&gt;&lt;br /&gt;       this.horizontal = horizontal;&lt;br /&gt;       this.opacity = opacity;&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   public void paint(Graphics g, Rectangle rect)&lt;br /&gt;   {&lt;br /&gt;       final Dimension d   = rect.getSize();&lt;br /&gt;       final int x         = rect.getX();&lt;br /&gt;       final int y         = rect.getY();&lt;br /&gt;       final int height    = d.getHeight();&lt;br /&gt;       final int width     = d.getWidth();&lt;br /&gt;&lt;br /&gt;       //Horizontal painting of gradient.&lt;br /&gt;       if (horizontal)&lt;br /&gt;       {&lt;br /&gt;           if (cache == null || width != cache.getWidth())&lt;br /&gt;           {&lt;br /&gt;               cache = Image.createImage(width, 1);               &lt;br /&gt;               Graphics dc = cache.getGraphics();&lt;br /&gt;&lt;br /&gt;               for(int i = 0; i &lt; vGradientStops.size() - 1; ++i)&lt;br /&gt;               {&lt;br /&gt;                   GradientStop thisGradientStop =&lt;br /&gt;                           ((GradientStop)vGradientStops.elementAt(i));&lt;br /&gt;                   GradientStop nextGradientStop =&lt;br /&gt;                           ((GradientStop)vGradientStops.elementAt(i + 1));&lt;br /&gt;&lt;br /&gt;                   dc.fillLinearGradient(thisGradientStop.getColor(),&lt;br /&gt;                          nextGradientStop.getColor() ,&lt;br /&gt;                          (int)(width * (thisGradientStop.getOffset() / 100.0)),&lt;br /&gt;                          0,&lt;br /&gt;                          (int)(width * (nextGradientStop.getOffset() / 100.0)),&lt;br /&gt;                          1, horizontal);&lt;br /&gt;               }&lt;br /&gt;&lt;br /&gt;               if(opacity &lt; 255)&lt;br /&gt;               {&lt;br /&gt;                   cache = cache.modifyAlpha(opacity);&lt;br /&gt;               }&lt;br /&gt;           }&lt;br /&gt;           for (int iter = 0; iter &lt; height; ++iter)&lt;br /&gt;           {&lt;br /&gt;               g.drawImage(cache, x, y + iter);&lt;br /&gt;           }           &lt;br /&gt;       }&lt;br /&gt;       //Vertical painting of gradient.&lt;br /&gt;       else&lt;br /&gt;       {&lt;br /&gt;           if (cache == null || height != cache.getHeight())&lt;br /&gt;           {&lt;br /&gt;               cache = Image.createImage(1, height);               &lt;br /&gt;               Graphics dc = cache.getGraphics();&lt;br /&gt;&lt;br /&gt;               for(int i = 0; i &lt; vGradientStops.size() - 1; ++i)&lt;br /&gt;               {&lt;br /&gt;                   GradientStop thisGradientStop =&lt;br /&gt;                           ((GradientStop)vGradientStops.elementAt(i));&lt;br /&gt;                   GradientStop nextGradientStop =&lt;br /&gt;                           ((GradientStop)vGradientStops.elementAt(i + 1));&lt;br /&gt;&lt;br /&gt;                   dc.fillLinearGradient(thisGradientStop.getColor(),&lt;br /&gt;                           nextGradientStop.getColor(),&lt;br /&gt;                           0,&lt;br /&gt;                           (int)(height * (thisGradientStop.getOffset() / 100.0)),&lt;br /&gt;                           1,&lt;br /&gt;                           (int)(height * (nextGradientStop.getOffset() / 100.0)),&lt;br /&gt;                           horizontal);&lt;br /&gt;               }&lt;br /&gt;&lt;br /&gt;               if(opacity &lt; 255)&lt;br /&gt;               {&lt;br /&gt;                   cache = cache.modifyAlpha(opacity);&lt;br /&gt;               }&lt;br /&gt;           }&lt;br /&gt;          &lt;br /&gt;           for (int iter = 0; iter &lt; width; ++iter)&lt;br /&gt;           {&lt;br /&gt;               g.drawImage(cache, x + iter, y);&lt;br /&gt;           }           &lt;br /&gt;       }&lt;br /&gt;   }&lt;br /&gt;}&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;How do I use it?&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;Well usage is pretty simple. Here's an example for our previous multi-gradient case.&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;&lt;br /&gt;Vector vGradientStops = new Vector();&lt;br /&gt;vGradientStops.addElement(new GradientStop(0xffffff, (byte)0));     &lt;br /&gt;vGradientStops.addElement(new GradientStop(0xff0000, (byte)50));     &lt;br /&gt;vGradientStops.addElement(new GradientStop(0x000000, (byte)100));&lt;br /&gt;&lt;br /&gt;myComponent.getStyle().setBgPainter(&lt;br /&gt;             new LinearGradientPainter(vGradientStops, (byte)255, false));    &lt;br /&gt;     &lt;/code&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Where do I go from here?&lt;/span&gt;&lt;br /&gt;Let your imagination run wild!&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_O-rOxpu66eY/Sv-JY_g204I/AAAAAAAAAKA/Z25_ROW1ZOA/s1600-h/ImaginationGradients.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 244px; height: 324px;" src="http://3.bp.blogspot.com/_O-rOxpu66eY/Sv-JY_g204I/AAAAAAAAAKA/Z25_ROW1ZOA/s400/ImaginationGradients.JPG" alt="" id="BLOGGER_PHOTO_ID_5404189140326994818" border="0" /&gt;&lt;/a&gt;&lt;span style="font-weight: bold;"&gt;What about the RadialGradientPainter?&lt;/span&gt;&lt;br /&gt;I haven't forgotten about that. I thought I'd cover just one GradientPainter in this post so as not to bog the reader down. A multi-colour RadialGradientPainter will be covered in a future post.&lt;br /&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/5951350911052608183-6764707562944171043?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/6764707562944171043/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=6764707562944171043' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/6764707562944171043'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/6764707562944171043'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2009/11/lwuit-and-wpf-gradients-mash-up-1.html' title='LWUIT and WPF Gradients Mash-up #1'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_O-rOxpu66eY/Sv-BBmiZCOI/AAAAAAAAAJw/mf9EYM69wN4/s72-c/TwoLinearGradient.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-4074019714614940612</id><published>2009-10-29T17:49:00.003+05:30</published><updated>2010-04-10T23:28:46.842+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='blackberry'/><category scheme='http://www.blogger.com/atom/ns#' term='rants'/><title type='text'>My new BlackBerry Bold 9000</title><content type='html'>I recently had a windfall when I attended a two-day workshop on Mobile Technologies jointly organised by the Computer Society of India (Trivandrum) and IEEE. The folks from &lt;a href="http://www.rim.com/"&gt;Research In Motion&lt;/a&gt; (RIM), Ms. Annie Mathew and Mr. Ranjan Moses were kind enough to give me a BlackBerry Bold 9000. I really must thank them for that. Initially I thought that the phone was aimed at business enterprise users (and I'm not one) but once I got into the details, I found that it had stuff for me too. I can use the phone to play music, watch videos, read e-books and, of course the most important thing, to show off. Apart from showing off, all of these can be done by my PSP but I tend not to look a gift horse in the mouth. As a developer, there's nothing more satisfying than getting your hands on a fancy gadget and writing apps for it. I plan to do just that.&lt;br /&gt;&lt;br /&gt;Here are my two cents on the BlackBerry Bold 9000:&lt;br /&gt;1. Great Joystick. Tickles my finger as I use it giving me good feedback.&lt;br /&gt;2. No touch screen and a run-of-the-mill user interface but this is a business phone, remember? You're paying for the technology that's inside not its external appearance.&lt;br /&gt;3. What's inside? Well plenty. Push technology, data encryption and the like.&lt;br /&gt;4. Great audio and video quality and a 2MP camera to boot.&lt;br /&gt;5. The voice command feature... Just speak into the phone and say "Call &amp;lt;name&amp;gt;" and the phone automatically dials that person's number.&lt;br /&gt;6. The battery life is pretty good too.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_O-rOxpu66eY/SumkpOr1XSI/AAAAAAAAAJo/n_bu3GaLmIY/s1600-h/bb.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 204px; height: 272px;" src="http://1.bp.blogspot.com/_O-rOxpu66eY/SumkpOr1XSI/AAAAAAAAAJo/n_bu3GaLmIY/s400/bb.JPG" alt="" id="BLOGGER_PHOTO_ID_5398026656603790626" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-4074019714614940612?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/4074019714614940612/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=4074019714614940612' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/4074019714614940612'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/4074019714614940612'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2009/10/my-new-blackberry-bold-9000.html' title='My new BlackBerry Bold 9000'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_O-rOxpu66eY/SumkpOr1XSI/AAAAAAAAAJo/n_bu3GaLmIY/s72-c/bb.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-4897206107197672544</id><published>2009-10-03T18:45:00.004+05:30</published><updated>2009-10-04T00:00:53.828+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='wpf'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='design'/><title type='text'>A custom tooltip in WPF</title><content type='html'>Customizing tooltips in WPF is as easy as pie. The following XAML code demonstrates this:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;&lt;br /&gt;&amp;lt;Style x:Key="{x:Type ToolTip}" TargetType="ToolTip"&amp;gt;&lt;br /&gt;     &amp;lt;Setter Property="OverridesDefaultStyle" Value="true"/&amp;gt;&lt;br /&gt;     &amp;lt;Setter Property="HasDropShadow" Value="True"/&amp;gt;&lt;br /&gt;     &amp;lt;Setter Property="Template"&amp;gt;&lt;br /&gt;         &amp;lt;Setter.Value&amp;gt;&lt;br /&gt;             &amp;lt;ControlTemplate TargetType="ToolTip"&amp;gt;&lt;br /&gt;                 &amp;lt;Border CornerRadius="7" HorizontalAlignment="Center" VerticalAlignment="Top" Padding="5" BorderThickness="3,3,3,3"&amp;gt;&lt;br /&gt;                     &amp;lt;Border.Background&amp;gt;&lt;br /&gt;                         &amp;lt;LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"&amp;gt;&lt;br /&gt;                             &amp;lt;GradientStop Color="#CF181818" Offset="0"/&amp;gt;&lt;br /&gt;                             &amp;lt;GradientStop Color="#BE1C1C1C" Offset="1"/&amp;gt;&lt;br /&gt;                         &amp;lt;/LinearGradientBrush&amp;gt;&lt;br /&gt;                     &amp;lt;/Border.Background&amp;gt;&lt;br /&gt;                     &amp;lt;Border.BorderBrush&amp;gt;&lt;br /&gt;                         &amp;lt;LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"&amp;gt;&lt;br /&gt;                             &amp;lt;GradientStop Color="#80FFFFFF" Offset="0"/&amp;gt;&lt;br /&gt;                             &amp;lt;GradientStop Color="#7FFFFFFF" Offset="1"/&amp;gt;&lt;br /&gt;                             &amp;lt;GradientStop Color="#FFFFF18D" Offset="0.344"/&amp;gt;&lt;br /&gt;                             &amp;lt;GradientStop Color="#FFFFF4AB" Offset="0.647"/&amp;gt;&lt;br /&gt;                         &amp;lt;/LinearGradientBrush&amp;gt;&lt;br /&gt;                     &amp;lt;/Border.BorderBrush&amp;gt;&lt;br /&gt;                     &amp;lt;StackPanel&amp;gt;&lt;br /&gt;                         &amp;lt;TextBlock FontFamily="Tahoma" FontSize="11" Text="{TemplateBinding Content}" Foreground="#FFFFFFFF" /&amp;gt;&lt;br /&gt;                     &amp;lt;/StackPanel&amp;gt;&lt;br /&gt;                 &amp;lt;/Border&amp;gt;&lt;br /&gt;             &amp;lt;/ControlTemplate&amp;gt;&lt;br /&gt;         &amp;lt;/Setter.Value&amp;gt;&lt;br /&gt;     &amp;lt;/Setter&amp;gt;&lt;br /&gt;&amp;lt;/Style&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Here's a screenshot of a normal tooltip against the custom tooltip.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_O-rOxpu66eY/SsdWcCW_1qI/AAAAAAAAAJI/8jjug4796Ds/s1600-h/tooltip.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 62px;" src="http://1.bp.blogspot.com/_O-rOxpu66eY/SsdWcCW_1qI/AAAAAAAAAJI/8jjug4796Ds/s320/tooltip.JPG" alt="" id="BLOGGER_PHOTO_ID_5388370518841743010" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-4897206107197672544?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/4897206107197672544/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=4897206107197672544' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/4897206107197672544'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/4897206107197672544'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2009/10/custom-tooltip-in-wpf.html' title='A custom tooltip in WPF'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_O-rOxpu66eY/SsdWcCW_1qI/AAAAAAAAAJI/8jjug4796Ds/s72-c/tooltip.JPG' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-6017708314231365659</id><published>2009-09-22T17:17:00.009+05:30</published><updated>2009-10-04T00:01:23.005+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='windows'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><title type='text'>Take Control of your Scroll</title><content type='html'>I recently ran into a specific issue when developing for a Windows Mobile environment. I had a lot of controls inside a Windows Form and by setting the Form's &lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.scrollablecontrol.autoscroll.aspx"&gt;AutoScroll&lt;/a&gt; &lt;span style="text-decoration: underline;"&gt;&lt;/span&gt;property to true, I could automatically scroll the contents of my form. This was quick and easy but then I found that the scrolling happened one pixel at a time which was just  too slow. It would not really matter in most cases but in this case, I had to support the &lt;a href="http://en.wikipedia.org/wiki/TouchFLO"&gt;TouchFlo&lt;/a&gt; scrolling gesture. Thus began a 2-day hunt for an appropriate solution.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Attempt #1:&lt;/span&gt;&lt;br /&gt;The first thing I looked for was some sort of property or method which could increase the scroll step. Nothing.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Attempt #2:&lt;/span&gt;&lt;br /&gt;The next thing to try was take complete control of the scrolling. I put in my own scrollbar and handled the Scroll event of the scrollbar. This was a reasonable approach but then I realized that the Touch Flo scroll gesture did not work for me. I slapped my forehead and proceeded to the next attempt.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Attempt #3 (Final Solution):&lt;/span&gt;&lt;br /&gt;The only other real solution was to take control of the Windows pumping messages. It turns out that you can override the &lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.control.wndproc.aspx"&gt;WndProc&lt;/a&gt; function for Windows Forms. When it comes to the .NET Compact Framework, though, you can’t do that because its just not supported. I googled for an alternative and found &lt;a href="http://mikeunderhill.blogspot.com/2005/09/overriding-forms-wndproc-in-net-cf-20.html"&gt;this&lt;/a&gt;.  I really must thank Mike Underhill for bailing me out here.&lt;br /&gt;Third time’s a charm, they say and it seemed true in my case. This is what I ended up with.&lt;br /&gt;&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); line-height: 14px; width: 100%; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px;"&gt;&lt;code&gt;&lt;br /&gt;private const int WM_VSCROLL = 0x115;&lt;br /&gt;private const int GWL_WNDPROC = -4;&lt;br /&gt;private const int SB_LINEUP = 0;&lt;br /&gt;private const int SB_LINEDOWN = 1;&lt;br /&gt;&lt;br /&gt;delegate IntPtr WndProcDelegate(IntPtr hWnd, uint msg,&lt;br /&gt;IntPtr wParam, IntPtr lParam);&lt;br /&gt;&lt;br /&gt;//Win32 APIs that I need.&lt;br /&gt;[DllImport("coredll.dll", EntryPoint = "GetWindowLong")]&lt;br /&gt;private static extern IntPtr GetWindowLong(IntPtr hWnd, int nIndex);&lt;br /&gt;&lt;br /&gt;[DllImport("coredll.dll")]&lt;br /&gt;static extern int SetWindowLong(IntPtr hWnd, int nIndex, IntPtr newWndProc);&lt;br /&gt;&lt;br /&gt;[DllImport("coredll.dll")]&lt;br /&gt;static extern IntPtr CallWindowProc(IntPtr lpPrevWndFunc, IntPtr hWnd,&lt;br /&gt;uint Msg, IntPtr wParam, IntPtr lParam);&lt;br /&gt;&lt;br /&gt;private static IntPtr oldWndProc = IntPtr.Zero;&lt;br /&gt;private static WndProcDelegate newWndProc;&lt;br /&gt;private const long lowOrderMask = 0xF;&lt;br /&gt;&lt;br /&gt;public IntPtr WndProc(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam)&lt;br /&gt;{&lt;br /&gt;if (msg == WM_VSCROLL)&lt;br /&gt;{&lt;br /&gt;   long val = ((long)wParam &amp;amp; lowOrderMask);           &lt;br /&gt;&lt;br /&gt;   if (val == SB_LINEDOWN)&lt;br /&gt;   {    &lt;br /&gt;      //Haven’t really found out why the Y position&lt;br /&gt;      //was going negative but this seemed an easy fix. :p      &lt;br /&gt;      AutoScrollPosition =&lt;br /&gt;         new Point(0, - AutoScrollPosition.Y + step);&lt;br /&gt;   }&lt;br /&gt;   else if (val == SB_LINEUP)&lt;br /&gt;   {&lt;br /&gt;      AutoScrollPosition =&lt;br /&gt;         new Point(0, - AutoScrollPosition.Y - step);&lt;br /&gt;   }&lt;br /&gt;  &lt;br /&gt;&lt;br /&gt;   return CallWindowProc(oldWndProc, hWnd, msg, wParam, lParam);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;//Constructor&lt;br /&gt;public Form1()&lt;br /&gt;{&lt;br /&gt;InitializeComponent();&lt;br /&gt;&lt;br /&gt;newWndProc = new WndProcDelegate(WndProc);&lt;br /&gt;oldWndProc = GetWindowLong(pnlContainer.Handle, GWL_WNDPROC);&lt;br /&gt;SetWindowLong(pnlContainer.Handle, GWL_WNDPROC, Marshal.GetFunctionPointerForDelegate(newWndProc));&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Hope this helps someone who ever comes across this problem.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-6017708314231365659?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/6017708314231365659/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=6017708314231365659' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/6017708314231365659'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/6017708314231365659'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2009/09/take-control-of-your-scroll.html' title='Take Control of your Scroll'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-2610388083123419461</id><published>2009-09-05T17:49:00.009+05:30</published><updated>2009-10-04T00:00:53.829+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='wpf'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='design'/><title type='text'>A simple loading animation in XAML.</title><content type='html'>I'm starting to take an interest in XAML art and I'd like to share a simple loading animation with all you WPF programmers out there.&lt;br /&gt;&lt;pre   style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); line-height: 9px; width: 100%;font-family:Andale Mono,Lucida Console,Monaco,fixed,monospace;font-size:12px;"&gt;&lt;code&gt;&lt;br /&gt;&amp;lt;Grid x:Name=&lt;span style="color: rgb(255, 0, 0);"&gt;"AnimGrid"&lt;/span&gt; Width=&lt;span style="color: rgb(255, 0, 0);"&gt;"125"&lt;/span&gt; Height=&lt;span style="color: rgb(255, 0, 0);"&gt;"125"&lt;/span&gt; VerticalAlignment=&lt;span style="color: rgb(255, 0, 0);"&gt;"Center"&lt;/span&gt; Visibility=&lt;span style="color: rgb(255, 0, 0);"&gt;"Visible"&lt;/span&gt;&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;Border HorizontalAlignment=&lt;span style="color: rgb(255, 0, 0);"&gt;"Center"&lt;/span&gt; VerticalAlignment=&lt;span style="color: rgb(255, 0, 0);"&gt;"Center"&lt;/span&gt; Background=&lt;span style="color: rgb(255, 0, 0);"&gt;"#FF303030"&lt;/span&gt; CornerRadius=&lt;span style="color: rgb(255, 0, 0);"&gt;"19"&lt;/span&gt;&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;Ellipse HorizontalAlignment=&lt;span style="color: rgb(255, 0, 0);"&gt;"Center"&lt;/span&gt; Width=&lt;span style="color: rgb(255, 0, 0);"&gt;"125"&lt;/span&gt; Height=&lt;span style="color: rgb(255, 0, 0);"&gt;"125"&lt;/span&gt; VerticalAlignment=&lt;span style="color: rgb(255, 0, 0);"&gt;"Center"&lt;/span&gt;&amp;gt;&lt;br /&gt;&lt;br /&gt;      &amp;lt;Ellipse.Fill&amp;gt;&lt;br /&gt;&lt;br /&gt;          &amp;lt;RadialGradientBrush GradientOrigin=&lt;span style="color: rgb(255, 0, 0);"&gt;"0.5,1.1"&lt;/span&gt;&amp;gt;&lt;br /&gt;&lt;br /&gt;              &amp;lt;GradientStop Color=&lt;span style="color: rgb(255, 0, 0);"&gt;"#FFF1FF00"&lt;/span&gt; Offset=&lt;span style="color: rgb(255, 0, 0);"&gt;"0"&lt;/span&gt;/&amp;gt;&lt;br /&gt;&lt;br /&gt;              &amp;lt;GradientStop Color=&lt;span style="color: rgb(255, 0, 0);"&gt;"#FF000000"&lt;/span&gt; Offset=&lt;span style="color: rgb(255, 0, 0);"&gt;"1"&lt;/span&gt;/&amp;gt;&lt;br /&gt;&lt;br /&gt;              &amp;lt;RadialGradientBrush.Transform&amp;gt;&lt;br /&gt;&lt;br /&gt;                  &amp;lt;RotateTransform x:Name=&lt;span style="color: rgb(255, 0, 0);"&gt;"EllipseTransform"&lt;/span&gt; Angle=&lt;span style="color: rgb(255, 0, 0);"&gt;"0"&lt;/span&gt; CenterX=&lt;span style="color: rgb(255, 0, 0);"&gt;"62.5"&lt;/span&gt; CenterY=&lt;span style="color: rgb(255, 0, 0);"&gt;"62.5"&lt;/span&gt; /&amp;gt;&lt;br /&gt;&lt;br /&gt;              &amp;lt;/RadialGradientBrush.Transform&amp;gt;&lt;br /&gt;&lt;br /&gt;          &amp;lt;/RadialGradientBrush&amp;gt;&lt;br /&gt;&lt;br /&gt;      &amp;lt;/Ellipse.Fill&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;/Ellipse&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/Border&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;TextBlock Text=&lt;span style="color: rgb(255, 0, 0);"&gt;"Please Wait..."&lt;/span&gt; FontSize=&lt;span style="color: rgb(255, 0, 0);"&gt;"16"&lt;/span&gt; FontWeight=&lt;span style="color: rgb(255, 0, 0);"&gt;"Bold"&lt;/span&gt; FontFamily=&lt;span style="color: rgb(255, 0, 0);"&gt;"Trebuchet MS"&lt;/span&gt; Foreground=&lt;span style="color: rgb(255, 0, 0);"&gt;"#FFFFFFFF"&lt;/span&gt; Margin=&lt;span style="color: rgb(255, 0, 0);"&gt;"11,47,-9,30"&lt;/span&gt; FontStyle=&lt;span style="color: rgb(255, 0, 0);"&gt;"Normal"&lt;/span&gt;&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;TextBlock.BitmapEffect&amp;gt;&lt;br /&gt;&lt;br /&gt;      &amp;lt;DropShadowBitmapEffect x:Name=&lt;span style="color: rgb(255, 0, 0);"&gt;"TextBlockShadow"&lt;/span&gt; ShadowDepth=&lt;span style="color: rgb(255, 0, 0);"&gt;"6"&lt;/span&gt; Direction=&lt;span style="color: rgb(255, 0, 0);"&gt;"90"&lt;/span&gt; Softness=&lt;span style="color: rgb(255, 0, 0);"&gt;"0.5"&lt;/span&gt;/&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;/TextBlock.BitmapEffect&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/TextBlock&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;Grid.Triggers&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;EventTrigger RoutedEvent=&lt;span style="color: rgb(255, 0, 0);"&gt;"Grid.Loaded"&lt;/span&gt;&amp;gt;&lt;br /&gt;&lt;br /&gt;      &amp;lt;BeginStoryboard&amp;gt;&lt;br /&gt;&lt;br /&gt;          &amp;lt;Storyboard&amp;gt;&lt;br /&gt;&lt;br /&gt;              &amp;lt;DoubleAnimation Storyboard.TargetName=&lt;span style="color: rgb(255, 0, 0);"&gt;"TextBlockShadow"&lt;/span&gt; Storyboard.TargetProperty=&lt;span style="color: rgb(255, 0, 0);"&gt;"Direction"&lt;/span&gt; RepeatBehavior=&lt;span style="color: rgb(255, 0, 0);"&gt;"Forever"&lt;/span&gt; From=&lt;span style="color: rgb(255, 0, 0);"&gt;"90"&lt;/span&gt; To=&lt;span style="color: rgb(255, 0, 0);"&gt;"450"&lt;/span&gt; Duration=&lt;span style="color: rgb(255, 0, 0);"&gt;"0:0:2"&lt;/span&gt; /&amp;gt;&lt;br /&gt;&lt;br /&gt;              &amp;lt;DoubleAnimation Storyboard.TargetName=&lt;span style="color: rgb(255, 0, 0);"&gt;"EllipseTransform"&lt;/span&gt; Storyboard.TargetProperty=&lt;span style="color: rgb(255, 0, 0);"&gt;"Angle"&lt;/span&gt; From=&lt;span style="color: rgb(255, 0, 0);"&gt;"0"&lt;/span&gt; To=&lt;span style="color: rgb(255, 0, 0);"&gt;"-360"&lt;/span&gt; RepeatBehavior=&lt;span style="color: rgb(255, 0, 0);"&gt;"Forever"&lt;/span&gt; Duration=&lt;span style="color: rgb(255, 0, 0);"&gt;"0:0:2"&lt;/span&gt; /&amp;gt;&lt;br /&gt;&lt;br /&gt;          &amp;lt;/Storyboard&amp;gt;&lt;br /&gt;&lt;br /&gt;      &amp;lt;/BeginStoryboard&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;/EventTrigger&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/Grid.Triggers&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/Grid&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;/pre&gt;This is what the animation looks like:&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_O-rOxpu66eY/SqJ5AlNxx4I/AAAAAAAAAJA/qfVUQPTD1hk/s1600-h/loadingAnimStatic.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 124px; height: 124px;" src="http://4.bp.blogspot.com/_O-rOxpu66eY/SqJ5AlNxx4I/AAAAAAAAAJA/qfVUQPTD1hk/s320/loadingAnimStatic.jpg" alt="" id="BLOGGER_PHOTO_ID_5377993955930654594" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-2610388083123419461?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/2610388083123419461/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=2610388083123419461' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/2610388083123419461'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/2610388083123419461'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2009/09/xaml-is-starting-to-become-in-thing.html' title='A simple loading animation in XAML.'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_O-rOxpu66eY/SqJ5AlNxx4I/AAAAAAAAAJA/qfVUQPTD1hk/s72-c/loadingAnimStatic.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-6023543038343414578</id><published>2009-07-28T12:03:00.002+05:30</published><updated>2009-10-04T00:00:53.830+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='wpf'/><category scheme='http://www.blogger.com/atom/ns#' term='design'/><title type='text'>My take on a Glass Button in WPF.</title><content type='html'>The following video tutorial shows how to create a nifty glass button in WPF using Microsoft Expression Blend 2. This is the first time I've actually made a screencast and it didn't turn out too bad. I'm sure it could be better. So, feel free to comment on anything that you like or don't like.&lt;br /&gt;&lt;br /&gt;&lt;object height="344" width="425"&gt;&lt;param name="movie" value="http://www.youtube.com/v/_hmJmux6Awc&amp;amp;hl=en&amp;amp;fs=1&amp;amp;"&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;embed src="http://www.youtube.com/v/_hmJmux6Awc&amp;amp;hl=en&amp;amp;fs=1&amp;amp;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" height="344" width="425"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-6023543038343414578?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/6023543038343414578/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=6023543038343414578' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/6023543038343414578'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/6023543038343414578'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2009/07/my-take-on-glass-button-in-wpf.html' title='My take on a Glass Button in WPF.'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-5099516081696429530</id><published>2009-07-25T12:28:00.003+05:30</published><updated>2009-07-25T12:50:00.279+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>SMSBalcony on LWUIT Featured Apps Gallery</title><content type='html'>I've been working on this J2ME based mobile application named &lt;a href="http://www.smsbalcony.com/"&gt;SMSBalcony&lt;/a&gt; &lt;span style="text-decoration: underline;"&gt;&lt;/span&gt;and its been featured on the LWUIT Featured Apps Gallery. Check it out &lt;a href="https://lwuit.dev.java.net/nonav/featuredapp.html"&gt;here&lt;/a&gt;. Some of the other apps in the gallery are much better though. :) Perhaps someday, I'll be skilled enough to do stuff like that.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-5099516081696429530?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/5099516081696429530/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=5099516081696429530' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/5099516081696429530'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/5099516081696429530'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2009/07/smsbalcony-on-lwuit-featured-apps.html' title='SMSBalcony on LWUIT Featured Apps Gallery'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-9213595047078182992</id><published>2009-07-19T10:09:00.006+05:30</published><updated>2009-07-19T11:02:11.882+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='games'/><title type='text'>Fate: Another Diablo Clone.</title><content type='html'>Fate is a dungeon crawler released in 2005 by Wild Tangent for the PC. Prima Facie, it seems like just another Diablo clone but there's a lot more to it. Ever since I completed Diablo II (about 3 times with different warrior classes :) ), I lay in wait for another Diablo Clone to come my way. Titan Quest (released in 2006) was great and maybe I'll blog about that someday. Diablo III is still in the works. So, in the meantime, let's talk about Fate.&lt;br /&gt;&lt;br /&gt;Here are some of the nice things that I noted about Fate:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;The game isn't as dark and gritty as Diablo II. The graphics are a lot more kiddish. Its 3D though but I find that sometimes when 2D artwork is done well in can look a lot better than a 3D game.&lt;/li&gt;&lt;li&gt;You have a pet (a dog or a cat) that fights on your behalf and can run back to town to sell items. The pet can also be transformed into some of the monsters that we encounter by feeding it fish!&lt;/li&gt;&lt;li&gt;Death isn't as frustrating as in Diablo. If the player dies, Fate itself appears and offers to resurrect the player (at the cost of experience, gold or both).&lt;/li&gt;&lt;li&gt;The dungeon level layouts and monsters and treasures are randomized.&lt;/li&gt;&lt;li&gt;You don't have different character classes as in Diablo II. The decision to be groomed as a brawler, sorceror or something in between is made while playing the game (Like purchasing sorceror items, giving more priority to Magic points instead of Strength).&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;Hope you enjoy some of the screenies I've posted of Fate and check out the links below to know more about the game.&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_O-rOxpu66eY/SmKstaQkE_I/AAAAAAAAAH4/9-lGHmL9sJI/s1600-h/Scrn1Enhanced.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 192px;" src="http://2.bp.blogspot.com/_O-rOxpu66eY/SmKstaQkE_I/AAAAAAAAAH4/9-lGHmL9sJI/s320/Scrn1Enhanced.jpg" alt="" id="BLOGGER_PHOTO_ID_5360036402667197426" border="0" /&gt;&lt;/a&gt;&lt;span style="font-size:85%;"&gt;(&lt;span style="font-weight: bold;"&gt;"Don't bite the townsfolk."&lt;/span&gt; My pet may look like a Widow Spider but its still a dog at heart.)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_O-rOxpu66eY/SmKuprCaTNI/AAAAAAAAAIA/XAj1R1i2SJ4/s1600-h/Scrn2Enhanced.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 192px;" src="http://1.bp.blogspot.com/_O-rOxpu66eY/SmKuprCaTNI/AAAAAAAAAIA/XAj1R1i2SJ4/s320/Scrn2Enhanced.jpg" alt="" id="BLOGGER_PHOTO_ID_5360038537475017938" border="0" /&gt;&lt;/a&gt;&lt;span style="font-size:85%;"&gt;(Me and the boys taking care of business.)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_O-rOxpu66eY/SmKvAnEs9VI/AAAAAAAAAII/R431pNA3KTk/s1600-h/Scrn3Enhanced.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 192px;" src="http://3.bp.blogspot.com/_O-rOxpu66eY/SmKvAnEs9VI/AAAAAAAAAII/R431pNA3KTk/s320/Scrn3Enhanced.jpg" alt="" id="BLOGGER_PHOTO_ID_5360038931547878738" border="0" /&gt;&lt;/a&gt;&lt;span style="font-size:85%;"&gt;(&lt;span style="font-weight: bold;"&gt;"Neat particle effects, guys but that won't stop me from taking you OUT!"&lt;/span&gt;)&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;Links:&lt;br /&gt;&lt;a href="http://en.wikipedia.org/wiki/Fate_%28video_game%29"&gt;Wiki link to Fate&lt;/a&gt;&lt;br /&gt;&lt;a href="http://games.wildtangent.com/fate/fate/"&gt;Official Fate Game site&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-9213595047078182992?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/9213595047078182992/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=9213595047078182992' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/9213595047078182992'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/9213595047078182992'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2009/07/fate-another-diablo-clone.html' title='Fate: Another Diablo Clone.'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_O-rOxpu66eY/SmKstaQkE_I/AAAAAAAAAH4/9-lGHmL9sJI/s72-c/Scrn1Enhanced.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-6620123237211157322</id><published>2009-07-18T12:37:00.003+05:30</published><updated>2009-07-18T12:43:37.826+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='c++'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><title type='text'>SuperFactory: A generic object factory implementation in C++</title><content type='html'>If you ever wanted to use an &lt;a href="http://en.wikipedia.org/wiki/Abstract_factory_pattern"&gt;object factory&lt;/a&gt; that works out of the box in C++, then this article written by &lt;a href="http://francisxavieronline.googlepages.com/"&gt;Francis Xavier&lt;/a&gt; might help you out.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.gamedev.net/reference/snippets/features/supFactory/"&gt;http://www.gamedev.net/reference/snippets/features/supFactory/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-6620123237211157322?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/6620123237211157322/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=6620123237211157322' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/6620123237211157322'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/6620123237211157322'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2009/07/superfactory-generic-object-factory.html' title='SuperFactory: A generic object factory implementation in C++'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-4579415343283238827</id><published>2009-07-06T11:21:00.004+05:30</published><updated>2009-07-06T12:38:55.297+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='c++'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><title type='text'>Cppcheck - An open source C++ static analysis tool</title><content type='html'>How would you identify potential flaws in your code? Conducting a code review would make sure that:&lt;br /&gt;1. Possible errors/exceptions are dealt with.&lt;br /&gt;2. Proper design patterns and good coding idioms have been used.&lt;br /&gt;3. Common logical errors are eliminated and more...&lt;br /&gt;&lt;br /&gt;However if bugs were introduced by a human in the first place, then those self-same bugs could be missed during a code review. Human program-comprehension is not very reliable.&lt;br /&gt;&lt;br /&gt;Now, what if there were a tool to conduct the code review? That's what &lt;a href="http://en.wikipedia.org/wiki/Static_code_analysis"&gt;&lt;span style="font-weight: bold;"&gt;Static Code Analysis&lt;/span&gt;&lt;/a&gt; is for. It involves the analysis of program code without actually executing it. Of course, unlike a human, a tool that automates the process of static analysis can't really consider design issues on a large scale. It can offer advice about certain basic design patterns and good programming practices but it can't go beyond that and look at the big picture.&lt;br /&gt;&lt;br /&gt;There are plenty of great static analysis tools around. You can get a complete list &lt;a href="http://en.wikipedia.org/wiki/List_of_tools_for_static_code_analysis"&gt;here&lt;/a&gt;. If you're a C/C++ programmer, you might want to try out Cppcheck. Its been GPL licensed and has a QT application front end for those who don't want to get their hands dirty with the command line. :)&lt;br /&gt;&lt;br /&gt;&lt;a href="http://en.wikipedia.org/wiki/Cppcheck"&gt;Wiki entry on Cppcheck&lt;/a&gt;&lt;br /&gt;&lt;a href="http://sourceforge.net/projects/cppcheck/"&gt;SourceForge Project site of CppCheck&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-4579415343283238827?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/4579415343283238827/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=4579415343283238827' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/4579415343283238827'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/4579415343283238827'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2009/07/cppcheck-open-source-c-static-analysis.html' title='Cppcheck - An open source C++ static analysis tool'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-9180517560723281123</id><published>2009-06-27T21:39:00.004+05:30</published><updated>2009-06-27T22:26:07.110+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='music'/><title type='text'>AIMP2: A free Audio Player</title><content type='html'>AIMP2 is a free audio player. While the player appears free for now, there might possibly be a paid version in the future. The look and feel of AIMP2 lies somewhere between players like VLC (not so great looking...) and WinAmp (overkill!). I found this player to be pretty feature rich and less buggy too.&lt;br /&gt;&lt;br /&gt;Check it out at &lt;a href="http://www.aimp2.us"&gt;http://www.aimp2.us&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src="http://www.aimp2.us/pic/aimp2.gif" border="1" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-9180517560723281123?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/9180517560723281123/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=9180517560723281123' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/9180517560723281123'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/9180517560723281123'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2009/06/aimp2-free-audio-player.html' title='AIMP2: A free Audio Player'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-6323617609388998797</id><published>2009-04-15T14:08:00.000+05:30</published><updated>2009-06-14T01:17:11.978+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='windows'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><title type='text'>Customizing the items in a WinForms ComboBox</title><content type='html'>The combo box is one of the favoured means by which users can select one from a group of pre-defined options. It provides a neat interface and reduces on-screen clutter. The items in a combo box are strings by default and for most cases, string items are sufficient for presenting data to the user. For example, a list of cities like "Wayanad", "Trivandrum" and "Ernakulam". However, there may be cases where strings are not enough.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;What do we have?&lt;/span&gt;&lt;br /&gt;We have an application that displays a demographic map of civil conflict. Areas on this map are categorised as high, medium and low risk. High risk areas are characterized by a red colour, medium risk areas are yellow and low risk areas are grey.&lt;br /&gt;Now, these legend colours need to be presented to the user (There are only three colours here but there could be more). Further more, the user might want to select an area of risk and additional data will be presented to the user based on his/her selection.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;What do we need?&lt;/span&gt;&lt;br /&gt;We need more than just a standard combo box, we need a customized combo box! Let's call this type of combo box a LegendComboBox. A LegendComboBox will display a rectangle with a colour inside it along with a string. This can be accomplished by manually drawing the items inside the combo box instead of letting it be drawn for us.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://farm4.static.flickr.com/3383/3425095901_d017fbd897_o.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 258px; height: 73px;" src="http://farm4.static.flickr.com/3383/3425095901_d017fbd897_o.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;How do we get what we need?&lt;/span&gt;&lt;br /&gt;Before we dive into creating our LegendComboBox, we need to realize the item(s) that this combo box will hold. Obviously, a simple string won't do because we also need to specify the legend colour for that string. In order to store this information, let's create a new class named LegendItem.&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); line-height: 14px; width: 100%; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px;"&gt;&lt;code&gt;&lt;br /&gt;//The type of item that can be added to a LegendComboBox.&lt;br /&gt;public class LegendItem&lt;br /&gt;{&lt;br /&gt;public object Data { get; set; }&lt;br /&gt;public Color Color { get; set; }&lt;br /&gt;}&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Now, that we know what type of items will be added to the LegendComboBox, let's create the combo box itself.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;Step1:&lt;/span&gt; We start by deriving our LegendComboBox from System.Windows.Forms.ComboBox.&lt;br /&gt;That way it looks and smells just like a regular combo box.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;Step2:&lt;/span&gt; In the constructor of LegendComboBox we do two things.&lt;br /&gt;First, we set the DrawMode of this combo box to OwnerDrawVariable. This indicates that we want to manually draw the items in the combo box. Secondly, we register a function with the DrawItem event. This function will be invoked whenever a particular item in the combo box is to be drawn on the screen.&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); line-height: 14px; width: 100%; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px;"&gt;&lt;code&gt;&lt;br /&gt;public class LegendComboBox : System.Windows.Forms.ComboBox&lt;br /&gt;{&lt;br /&gt;   public LegendComboBox()&lt;br /&gt;   {&lt;br /&gt;    this.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawVariable;&lt;br /&gt;    this.DrawItem += new DrawItemEventHandler(LegendComboBox_DrawItem); &lt;br /&gt;    ...   &lt;br /&gt;   }&lt;br /&gt;}&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;Step3:&lt;/span&gt; The next step is to actually define the function that we registered with the DrawItem event of our combo box. This function will have a prototype of:&lt;br /&gt;void LegendComboBox_DrawItem(object sender, DrawItemEventArgs e);&lt;br /&gt;&lt;br /&gt;DrawItemEventArgs provides data about the item to be drawn.&lt;br /&gt;This data includes the index of the item to be drawn, the graphics surface on which to do the drawing, and the area within which we can do the drawing.&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); line-height: 14px; width: 100%; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px;"&gt;&lt;code&gt;&lt;br /&gt;void LegendComboBox_DrawItem(object sender, DrawItemEventArgs e)&lt;br /&gt;{&lt;br /&gt;e.DrawBackground();&lt;br /&gt;LegendItem currentItem = null;&lt;br /&gt;Rectangle rect = new Rectangle(2, e.Bounds.Top + 2,&lt;br /&gt;                               e.Bounds.Height, e.Bounds.Height - 4);&lt;br /&gt;try&lt;br /&gt;{&lt;br /&gt;   currentItem = (LegendItem)this.Items[e.Index];&lt;br /&gt;}&lt;br /&gt;catch (InvalidCastException)&lt;br /&gt;{           &lt;br /&gt;   //If the item in the combo box is not of type LegendItem,&lt;br /&gt;   //then we just draw the item without the legend colour.&lt;br /&gt;   e.Graphics.DrawString(this.Items[e.Index].ToString(), this.Font,&lt;br /&gt;       new SolidBrush(this.ForeColor), e.Bounds);&lt;br /&gt;&lt;br /&gt;   return;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;//Draw rectangle with legend colour.&lt;br /&gt;e.Graphics.FillRectangle(new SolidBrush(currentItem.Color), rect);&lt;br /&gt;e.Graphics.DrawString(currentItem.Data.ToString(), this.Font,&lt;br /&gt;   new SolidBrush(this.ForeColor),&lt;br /&gt;   new Rectangle(e.Bounds.X + rect.Width + 2,&lt;br /&gt;                   e.Bounds.Y, e.Bounds.Width, e.Bounds.Height));           &lt;br /&gt;}&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;That's it. We're done.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;How do we use what we've got?&lt;/span&gt;&lt;br /&gt;Using the LegendComboBox is pretty straightforward. Create an instance of this class and then add LegendItems to it.&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); line-height: 14px; width: 100%; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px;"&gt;&lt;code&gt;&lt;br /&gt;LegendComboBox cboLegend = new LegendComboBox();&lt;br /&gt;cboLegend.Items.Add(new LegendItem { Data = "High Risk", Color = Color.Red });&lt;br /&gt;cboLegend.Items.Add(new LegendItem { Data = "Medium Risk", Color = Color.Yellow });&lt;br /&gt;cboLegend.Items.Add(new LegendItem { Data = "Low Risk", Color = Color.Gray });&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;A better solution would be to make this LegendComboBox a control that can be used in any WinForms application.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;What have we learnt?&lt;/span&gt;&lt;br /&gt;Through an example, we've seen that a WinForms combo box can be customized to display more than just string data. As a matter of fact, the DrawItem event is available for the ListBox and TabControl controls as well. Also, we aren't restricted to just drawing shapes for our items, we could even draw images and more.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-6323617609388998797?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/6323617609388998797/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=6323617609388998797' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/6323617609388998797'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/6323617609388998797'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2009/04/customizing-items-in-winforms-combobox.html' title='Customizing the items in a WinForms ComboBox'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-3180481523909174257</id><published>2009-02-12T11:21:00.000+05:30</published><updated>2009-06-14T01:17:11.979+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='windows'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><title type='text'>Creating an uninstall shortcut for your MSI package</title><content type='html'>Microsoft, as a general rule, expect every user to uninstall applications from the Add/Remove Programs tool in the Control Panel. However, there might be cases where one might want to add an 'Uninstall Program' shortcut to the Start-&gt;Programs Menu. The steps below are a walkthrough for creating a simple MSI package using Visual Studio 2008 and adding an 'Uninstall Program' shortcut to the Programs Menu as well.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Basic Walkthrough for creating an MSI Installation package in Visual Studio 2008.&lt;/span&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Open the project for which an MSI Installation package is to be added in Visual Studio 2008.&lt;/li&gt;&lt;li&gt;Right click the Solution of the Project in the Solution Explorer and select Add-&gt;New Project from the context menu.&lt;/li&gt;&lt;li&gt;Expand the &lt;span style="font-style: italic;"&gt;'Other Project Types&lt;/span&gt;' category and choose '&lt;span style="font-style: italic;"&gt;Setup Project&lt;/span&gt;' from the '&lt;span style="font-style: italic;"&gt;Setup and Deployment category&lt;/span&gt;'. Enter a name and location for the MSI package to be created and click OK.&lt;/li&gt;&lt;li&gt;A Setup project will be added to the project solution. Right Click the Setup Project in the Solution Explorer and select View-&gt;File System from the context menu.&lt;/li&gt;&lt;li&gt;Right click '&lt;span style="font-style: italic;"&gt;Application Folder&lt;/span&gt;' in the new window and select Add-&gt;Project Output. Now, select '&lt;span style="font-style: italic;"&gt;Primary Output&lt;/span&gt;' from the dialog box that pops up and click OK. A '&lt;span style="font-style: italic;"&gt;Primary Output from xxx&lt;/span&gt;' entry should appear in the Application Folder. This is the main executable of the project.&lt;/li&gt;&lt;li&gt;Right click the '&lt;span style="font-style: italic;"&gt;Primary Output from xxx&lt;/span&gt;' entry and select '&lt;span style="font-style: italic;"&gt;Create Shortcut to Primary Output from xxx&lt;/span&gt;'. Repeat this step one more time to create two shortcuts.&lt;/li&gt;&lt;li&gt;Cut one of the shortcuts and paste it in the &lt;span style="font-style: italic;"&gt;User's Desktop&lt;/span&gt; folder. Similarly cut the other shortcut and paste it in the &lt;span style="font-style: italic;"&gt;User's Program Menu&lt;/span&gt; folder. Rename each of these shortcuts to something more appropriate (such as the application name).&lt;/li&gt;&lt;/ol&gt;&lt;span style="font-weight: bold;"&gt;Creating an Uninstall Program shortcut.&lt;/span&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Browse to the MSI project folder (using Windows Explorer), right click and select New-&gt;Shortcut from the context menu. In the Create Shortcut Wizard dialog that pops up type '&lt;span style="font-family:courier new;"&gt;%windir%\system32\msiexec.exe -x {prodCode}&lt;/span&gt; ' as the location of the shortcut, where &lt;span style="font-family:courier new;"&gt;prodCode&lt;/span&gt; &lt;span style="font-family:courier new;"&gt;&lt;/span&gt;is the Product Code of the MSI package. This Product Code can be identified from the Project Properties of the MSI Project in Visual Studio. Also, provide a proper name for the shortcut (such as Uninstall xxx, where xxx is the name of the application) and click Finish.&lt;/li&gt;&lt;li&gt;The next step involves adding this shortcut to the User's Programs Menu folder of the MSI project in Visual Studio. The problem is that files with extension .lnk (extension of the shortcut) cannot be added to the Project. So, first we need to rename the shortcut extension from .lnk to .txt. Open up a DOS command window and browse to the location of the shortcut using the '&lt;span style="font-style: italic;"&gt;cd&lt;/span&gt;' command. Now type '&lt;span style="font-family:courier new;"&gt;ren xxx.lnk xxx.txt&lt;/span&gt;' where &lt;span style="font-family:courier new;"&gt;xxx&lt;/span&gt; is the name of the shortcut item.&lt;/li&gt;&lt;li&gt;Now, simply drag the renamed shortcut into the User's Programs Menu folder of the MSI project. &lt;/li&gt;&lt;li&gt;Rename the shortcut from .txt back to .lnk.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Build the MSI project and the necessary setup files will be created in the bin folder of the project.&lt;/li&gt;&lt;/ol&gt;Hope this helps someone out. Have a good day.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-3180481523909174257?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/3180481523909174257/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=3180481523909174257' title='12 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/3180481523909174257'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/3180481523909174257'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2009/02/creating-uninstall-shortcut-for-your.html' title='Creating an uninstall shortcut for your MSI package'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><thr:total>12</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-3683737983389181307</id><published>2008-12-23T16:06:00.000+05:30</published><updated>2009-06-14T01:26:17.448+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='c++'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><title type='text'>Casting with Multiple Inheritance</title><content type='html'>&lt;span style="font-weight: bold; font-style: italic;font-size:85%;" &gt;&lt;span style="font-family:arial;"&gt;(Reader Level : Intermediate)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;(Knowledge assumptions : C++ casts, Multiple Inheritance)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;The Question:&lt;/span&gt;&lt;br /&gt;Given the classes:&lt;br /&gt;&lt;pre   style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); line-height: 14px; width: 100%;font-family:Andale Mono,Lucida Console,Monaco,fixed,monospace;font-size:12px;"&gt;&lt;code&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;struct&lt;/span&gt; A { &lt;span style="color: rgb(0, 0, 255);"&gt;int&lt;/span&gt; _aValue; };&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;struct&lt;/span&gt; B { &lt;span style="color: rgb(0, 0, 255);"&gt;float&lt;/span&gt; _bValue; };&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;class&lt;/span&gt; C : &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; A, &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; B { };&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;Consider the following statements:&lt;br /&gt;&lt;pre   style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); line-height: 14px; width: 100%;font-family:Andale Mono,Lucida Console,Monaco,fixed,monospace;font-size:12px;"&gt;&lt;code&gt;C objC;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;void&lt;/span&gt; *pC = &amp;objC;&lt;br /&gt;&lt;br /&gt;A *pA = &lt;span style="color: rgb(0, 0, 255);"&gt;reinterpret_cast&lt;/span&gt;&amp;lt;A*&amp;gt;( pC );&lt;br /&gt;&lt;br /&gt;B *pB = &lt;span style="color: rgb(0, 0, 255);"&gt;reinterpret_cast&lt;/span&gt;&amp;lt;B*&amp;gt;( pC );&lt;br /&gt;&lt;br /&gt;...&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;Are both pA and pB valid? Why or why not?&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;The Answer:&lt;/span&gt;&lt;br /&gt;pA is valid. pB is invalid.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;The Reason:&lt;/span&gt;&lt;br /&gt;Many feel that the order in which base classes are inherited does not matter for multiple inheritance. However, in some cases, it does matter. This is one of those cases.&lt;br /&gt;&lt;br /&gt;When creating an instance of C, its A subobject will be instantiated first and then its B subobject. This behaviour is due to the fact that C inherits from A first and then from B. The 'this' pointer of the A subobject will be at an offset of 0 bytes from the 'this' pointer of objC. On the other hand, the B subobject will be at an offset of 4 bytes from the 'this' address of objC. The displacement of 4 bytes is attributed to the integer member _aValue of class A.&lt;br /&gt;The following diagrams should make things clear.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_O-rOxpu66eY/SVDuxwzbOEI/AAAAAAAAAHA/fjYt3UInPRs/s1600-h/Subobjects1.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 295px; height: 180px;" src="http://1.bp.blogspot.com/_O-rOxpu66eY/SVDuxwzbOEI/AAAAAAAAAHA/fjYt3UInPRs/s400/Subobjects1.JPG" alt="" id="BLOGGER_PHOTO_ID_5282984901587187778" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_O-rOxpu66eY/SVDlBNH2XjI/AAAAAAAAAGw/TulxmTeMw6s/s1600-h/AddressTable.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 421px; height: 58px;" src="http://1.bp.blogspot.com/_O-rOxpu66eY/SVDlBNH2XjI/AAAAAAAAAGw/TulxmTeMw6s/s400/AddressTable.JPG" alt="" id="BLOGGER_PHOTO_ID_5282974171770805810" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Now, what happens when you cast from a void* to A*? The compiler doesn't know that the actual type of pC is C*. So, it assumes that pA can point to the 'this' address of pC. That's fair because the A subobject of an instance of C will be at the starting address of objC. However, when making the cast from void* to B*, the compiler assumes that the B subobject is at the starting address of objC. That isn't true and hence, pB is invalid.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Corollary:&lt;/span&gt;&lt;br /&gt;Now that we know why pB is invalid, let's see if we can correct it. Obviously, reinterpret_cast is ugly and unreliable.&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Would a static_cast do any better?&lt;/span&gt;&lt;br /&gt;Unfortunately, no. A static_cast works at compile time and as stated before the compiler doesn't know anything about the actual type of pC.&lt;br /&gt;&lt;span style="font-style: italic;"&gt;How about a dynamic_cast? &lt;/span&gt;&lt;br /&gt;A dynamic_cast would nip our futile attempts in the bud by refusing to cast from void* to anything.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;The take-home message:&lt;/span&gt;&lt;br /&gt;reinterpret_cast is bad but void* is &lt;a href="http://www.parashift.com/c++-faq-lite/big-picture.html#faq-6.15"&gt;evil&lt;/a&gt;!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-3683737983389181307?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/3683737983389181307/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=3683737983389181307' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/3683737983389181307'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/3683737983389181307'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2008/12/casting-with-multiple-inheritance.html' title='Casting with Multiple Inheritance'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_O-rOxpu66eY/SVDuxwzbOEI/AAAAAAAAAHA/fjYt3UInPRs/s72-c/Subobjects1.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-161075077702271266</id><published>2008-12-05T13:46:00.000+05:30</published><updated>2009-06-14T01:15:26.721+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='rants'/><title type='text'>The three aspects of a successful Software Engineer</title><content type='html'>A wise person once told me that there are three aspects to a successful software engineer.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;1.    Attitude.&lt;/span&gt;&lt;br /&gt;A person must have a good outlook and should always strive to do the best that he/she can. That defines attitude. A bad attitude could be attributed to the work environment (colleagues, work interest, monetary satisfaction, bosses etc.) but a good software engineer will try not to let such annoyances affect him.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;2.    Motivation.&lt;/span&gt;&lt;br /&gt;Motivation means having a reason to do things. It gives a person a purpose and goal. If the odds are stacked against a person, then he/she must rise to the occasion.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;3.    Ability.&lt;/span&gt;&lt;br /&gt;Ability involves the capability of a person. The ability of a software engineer is determined by the skills in his/her domain of expertise.&lt;br /&gt;&lt;br /&gt;Now, here’s the interesting part. The aforementioned facets of a software engineer must go in that order of precedence. By having a good attitude and an “Up and at ‘em” disposition, one can discover motivation. Once a software engineer finds a reason to do something, then he/she will not quit until the job has been done and done well. A good attitude and proper motivation will naturally make a person pay attention to trivial details. It will make him or her push forward beyond normal limits and that’s what garners ability. An individual could be born with great skill but that could be put to little use unless he/she develops a good attitude.&lt;br /&gt;Laugh in the most trying of times, never give up even if the chips are down and show others respect irrespective of whether you like them or not. That’s what a healthy attitude demands.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-161075077702271266?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/161075077702271266/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=161075077702271266' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/161075077702271266'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/161075077702271266'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2008/12/three-aspects-of-successful-software.html' title='The three aspects of a successful Software Engineer'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-8993934961005626011</id><published>2008-10-22T17:13:00.000+05:30</published><updated>2009-06-14T01:26:17.449+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='c++'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><title type='text'>Eliminate duplicate elements from a container</title><content type='html'>&lt;span style="font-weight: bold; font-style: italic;font-size:85%;" &gt;&lt;span style="font-family:arial;"&gt;(Reader Level : Intermediate)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;(Knowledge assumptions : templates, STL)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;One of the grandest things about STL is that it keeps us from re-inventing the wheel. In a practical world, it just doesn't make sense for a developer to create a doubly linked list or a queue from scratch. We have STL containers for that purpose. However, with great knowledge comes great responsibility. Its important to know what STL does under the hood, rather than just using it blindly. A lot of books out there have covered this topic but one of the most important ones that springs immediately to mind is &lt;span style="font-family:Arial,Helvetica;"&gt;&lt;b&gt;&lt;a href="http://www.josuttis.com/libbook/"&gt;The C++ Standard Library - A Tutorial and Reference&lt;/a&gt; &lt;/b&gt;by &lt;span style="font-weight: bold;"&gt;Nicolai M. Josuttis&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;Enough of the prologue... Let's get down to a problem. There are times when one might have a container with duplicate element values. Whether such a scenario is justifiable or not may depend on a number of things. The first thing, we need to look into is the container itself and ask ourselves - "Is this the right container for the job? Why not use an std::set or an std::map instead?" If redesigning our code to use a more suitable container isn't a viable solution, then read on.&lt;br /&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;pre   style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); line-height: 14px; width: 100%;font-family:Andale Mono,Lucida Console,Monaco,fixed,monospace;font-size:12px;"&gt;&lt;code&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;template&lt;/span&gt;&amp;lt;&lt;span style="color: rgb(0, 0, 255);"&gt;class&lt;/span&gt; ContainerType&amp;gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;void&lt;/span&gt; RemoveDuplicates( ContainerType&amp;amp; input )&lt;br /&gt;{&lt;br /&gt; ContainerType::iterator currentPosIter = input.begin();&lt;br /&gt; currentPosIter;&lt;br /&gt;&lt;br /&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;for&lt;/span&gt;( ContainerType::iterator iter = input.begin(); iter != input.end(); ++iter )&lt;br /&gt; {&lt;br /&gt;   &lt;span style="color: rgb(0, 0, 255);"&gt;if&lt;/span&gt;( std::find( input.begin(), currentPosIter, *iter ) == currentPosIter )&lt;br /&gt;   { &lt;br /&gt;     *currentPosIter = *iter;&lt;br /&gt;     ++currentPosIter;&lt;br /&gt;   }&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; input.erase(currentPosIter, input.end() );&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;The above function removes duplicates from any STL container as long as that container supports an erase method. Let's take it for a test drive, shall we?&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;pre   style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); line-height: 14px; width: 100%;font-family:Andale Mono,Lucida Console,Monaco,fixed,monospace;font-size:12px;"&gt;&lt;code&gt;&lt;int&gt;&lt;int&gt;&lt;std::deque&gt;&lt;int&gt;&lt;int&gt;std::deque&amp;lt;&lt;span style="color: rgb(0, 0, 255);"&gt;int&lt;/span&gt;&amp;gt; myDeque;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 136, 0);"&gt;//Add some values to the deque.&lt;/span&gt;&lt;br /&gt;myDeque.push_back(0);&lt;br /&gt;myDeque.push_back(1);&lt;br /&gt;myDeque.push_back(1);&lt;br /&gt;myDeque.push_back(0);&lt;br /&gt;myDeque.push_back(2);&lt;br /&gt;myDeque.push_back(2);&lt;br /&gt;myDeque.push_back(3);&lt;br /&gt;myDeque.push_back(1);&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 136, 0);"&gt;//Before erasing duplicates.&lt;/span&gt;&lt;br /&gt;std::cout &amp;lt;&amp;lt; &lt;span style="color: rgb(255, 0, 0);"&gt;"Before erasing duplicates."&lt;/span&gt; &amp;lt;&amp;lt; &lt;span style="color: rgb(255, 0, 0);"&gt;"\n"&lt;/span&gt;;&lt;br /&gt;std::copy( myDeque.begin(), myDeque.end(), std::ostream_iterator&amp;lt;&lt;span style="color: rgb(0, 0, 255);"&gt;int&lt;/span&gt;&amp;gt;( std::cout, &lt;span style="color: rgb(255, 0, 0);"&gt;"\n"&lt;/span&gt; ) );&lt;br /&gt;std::cout &amp;lt;&amp;lt; &lt;span style="color: rgb(255, 0, 0);"&gt;"\n\n"&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;RemoveDuplicates&amp;lt;std::deque&amp;lt;&lt;span style="color: rgb(0, 0, 255);"&gt;int&lt;/span&gt;&amp;gt; &amp;gt;( myDeque );&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 136, 0);"&gt;//After erasing duplicates.&lt;/span&gt;&lt;br /&gt;std::cout &amp;lt;&amp;lt; &lt;span style="color: rgb(255, 0, 0);"&gt;"After erasing duplicates."&lt;/span&gt; &amp;lt;&amp;lt; &lt;span style="color: rgb(255, 0, 0);"&gt;"\n"&lt;/span&gt;;&lt;br /&gt;std::copy( myDeque.begin(), myDeque.end(), std::ostream_iterator&amp;lt;&lt;span style="color: rgb(0, 0, 255);"&gt;int&lt;/span&gt;&amp;gt;( std::cout, &lt;span style="color: rgb(255, 0, 0);"&gt;"\n"&lt;/span&gt; ) )&lt;span style="font-family:Arial,Helvetica;"&gt;;&lt;/span&gt;&lt;/int&gt;&lt;/int&gt;&lt;/std::deque&gt;&lt;/int&gt;&lt;/int&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Arial,Helvetica;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-8993934961005626011?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/8993934961005626011/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=8993934961005626011' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/8993934961005626011'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/8993934961005626011'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2008/10/eliminate-duplicate-elements-from.html' title='Eliminate duplicate elements from a container'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-2718824572460930614</id><published>2008-10-14T20:14:00.000+05:30</published><updated>2009-06-14T01:26:17.449+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='c++'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><title type='text'>Template Parameter friends</title><content type='html'>&lt;span style="font-weight: bold; font-style: italic;font-size:85%;" &gt;&lt;span style="font-family:arial;"&gt;(Reader Level : Intermediate)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;(Knowledge assumptions : templates, friend)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;&lt;br /&gt;The problem:&lt;/span&gt;&lt;br /&gt;Currently, the C++ standard does not allow you to write code like this:&lt;br /&gt;&lt;pre   style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); line-height: 14px; width: 100%;font-family:Andale Mono,Lucida Console,Monaco,fixed,monospace;font-size:12px;"&gt;&lt;code&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;template&lt;/span&gt;&amp;lt;&lt;span style="color: rgb(0, 0, 255);"&gt;class&lt;/span&gt; T1, &lt;span style="color: rgb(0, 0, 255);"&gt;class&lt;/span&gt; T2&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;class&lt;/span&gt; MyClass&lt;br /&gt;{&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;  friend&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt; class&lt;/span&gt; T1;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;  friend&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt; class&lt;/span&gt; T2;&lt;br /&gt;};&lt;/code&gt;&lt;/pre&gt;You can’t make the template parameter of a class be a friend of that particular class. This might seem a reasonable requirement but the language does not allow you to do this, at least not directly.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;The workaround:&lt;/span&gt;&lt;br /&gt;In order to accomplish what we require here’s a quick workaround.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-weight: bold;"&gt;For the GCC compiler:-&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;pre   style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); line-height: 14px; width: 100%;font-family:Andale Mono,Lucida Console,Monaco,fixed,monospace;font-size:12px;"&gt;&lt;code&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;#define&lt;/span&gt; MAKE_FRIEND(T) &lt;span style="color: rgb(0, 0, 255);"&gt;friend&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;class&lt;/span&gt; MakeFriend&amp;lt;T&amp;gt;::Result&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;template&lt;/span&gt;&amp;lt;&lt;span style="color: rgb(0, 0, 255);"&gt;class&lt;/span&gt; T&amp;gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;class&lt;/span&gt; MakeFriend&lt;br /&gt;{&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt;:&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;  typedef&lt;/span&gt; T Result;&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;template&lt;/span&gt;&amp;lt;&lt;span style="color: rgb(0, 0, 255);"&gt;class&lt;/span&gt; T1, &lt;span style="color: rgb(0, 0, 255);"&gt;class&lt;/span&gt; T2&amp;gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;class&lt;/span&gt; MyClass&lt;br /&gt;{&lt;br /&gt; MAKE_FRIEND(T1);&lt;br /&gt; MAKE_FRIEND(T2);&lt;br /&gt;};&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;For Microsoft's compiler:-&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;pre   style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); line-height: 14px; width: 100%;font-family:Andale Mono,Lucida Console,Monaco,fixed,monospace;font-size:12px;"&gt;&lt;code&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;#define&lt;/span&gt; MAKE_FRIEND(T) &lt;span style="color: rgb(0, 0, 255);"&gt;friend&lt;/span&gt; MakeFriend&amp;lt;T&amp;gt;::Result&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;template&lt;/span&gt;&amp;lt;&lt;span style="color: rgb(0, 0, 255);"&gt;class&lt;/span&gt; T&amp;gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;class&lt;/span&gt; MakeFriend&lt;br /&gt;{&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt;:&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;  typedef&lt;/span&gt; T Result;&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;template&lt;/span&gt;&amp;lt;&lt;span style="color: rgb(0, 0, 255);"&gt;class&lt;/span&gt; T1, &lt;span style="color: rgb(0, 0, 255);"&gt;class&lt;/span&gt; T2&amp;gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;class&lt;/span&gt; MyClass&lt;br /&gt;{&lt;br /&gt; MAKE_FRIEND(T1);&lt;br /&gt; MAKE_FRIEND(T2);&lt;br /&gt;};&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Note the use of the 'class' keyword in the MAKE_FRIEND macro for the GCC compiler but not for the Microsoft compiler. If either T1 or T2 is not a class, then your compiler will complain. For example, if you try to instantiate an object with:&lt;br /&gt;&lt;pre   style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); line-height: 14px; width: 100%;font-family:Andale Mono,Lucida Console,Monaco,fixed,monospace;font-size:12px;"&gt;&lt;code&gt;MyClass&amp;lt;SomeClass, &lt;span style="color: rgb(0, 0, 255);"&gt;int&lt;/span&gt;&amp;gt; myClassObj;&lt;/code&gt;&lt;/pre&gt;then the GCC compiler will say &lt;span style="font-weight: bold;"&gt;error: invalid type ‘int’ declared ‘friend’&lt;/span&gt;. But that makes sense, doesn’t it?&lt;br /&gt;&lt;br /&gt;The code above has been tested on GCC 3.4.5 and on Microsoft Visual Studio 2008 (using the Microsoft Compiler).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-2718824572460930614?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/2718824572460930614/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=2718824572460930614' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/2718824572460930614'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/2718824572460930614'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2008/10/problem-currently-c-standard-does-not.html' title='Template Parameter friends'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-8671988304275836145</id><published>2008-08-08T04:04:00.000+05:30</published><updated>2009-06-14T01:26:17.450+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='c++'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><title type='text'>Alexandrescu to the rescue</title><content type='html'>&lt;span style="font-weight: bold; font-style: italic;font-size:85%;" &gt;&lt;span style="font-family:arial;"&gt;(Reader Level : Intermediate)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;(Knowledge assumptions : templates, std::vector, std::string)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;I've recently taken a fancy to &lt;a href="http://erdani.org/"&gt;Andrei Alexandrescu's Modern C++ design&lt;/a&gt;. Its a fabulous book and anyone who is serious about becoming a good C++ programmer ought to read it. However, the book is not for the novice or the faint of heart. Someone on &lt;a href="http://www.codeguru.com/"&gt;CodeGuru&lt;/a&gt; even suggested that the reader wear a helmet while reading this book so that his/her brain would not explode!&lt;br /&gt;&lt;br /&gt;Now let me tell my story...&lt;br /&gt;I was writing a string tokenizer in C++. The basic idea was to split a parse string into tokens using another string as the delimiter. The resultant token strings can be returned as a vector of strings.&lt;br /&gt;&lt;pre   style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); line-height: 14px; width: 100%;font-family:Andale Mono,Lucida Console,Monaco,fixed,monospace;font-size:12px;"&gt;&lt;code&gt;&lt;span style="font-family:Andale Mono,Lucida Console,Monaco,fixed,monospace;"&gt;std::vector&amp;lt;std::string&amp;gt; Tokenize( &lt;span style="color: rgb(0, 0, 255);"&gt;const&lt;/span&gt; std::string&amp;amp; str, &lt;span style="color: rgb(0, 0, 255);"&gt;const&lt;/span&gt; std::string&amp;amp; delimitStr )&lt;br /&gt;{&lt;br /&gt; std::vector&amp;lt;std::string&amp;gt; result;&lt;br /&gt;&lt;span style="color: rgb(0, 136, 0);"&gt;  //////Rest of the code goes here...//////////&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;  return&lt;/span&gt; result;&lt;br /&gt;}&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Seems pretty sensible, right? Now here's the problem. What if I wanted to give the user the power to specify what kind of STL container he/she wanted to use. Perhaps, a list would be more pertinent, or maybe a deque. In order to do that the Tokenize() function needs to be templated. So here was my first attempt..&lt;br /&gt;&lt;pre   style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); line-height: 14px; width: 100%;font-family:Andale Mono,Lucida Console,Monaco,fixed,monospace;font-size:12px;"&gt;&lt;code&gt;&lt;span style="font-family:Andale Mono,Lucida Console,Monaco,fixed,monospace;"&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;template&lt;/span&gt;&amp;lt;&lt;span style="color: rgb(0, 0, 255);"&gt;class&lt;/span&gt; Container&amp;gt;&lt;br /&gt;Container Tokenize( &lt;span style="color: rgb(0, 0, 255);"&gt;const&lt;/span&gt; std::string&amp;amp; str, &lt;span style="color: rgb(0, 0, 255);"&gt;const&lt;/span&gt; std::string&amp;amp; tokenStr )&lt;br /&gt;{&lt;br /&gt; Container result;&lt;br /&gt;&lt;span style="color: rgb(0, 136, 0);"&gt;  //////Rest of the code goes here...//////////&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;  return&lt;/span&gt; result;&lt;br /&gt;}&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Alright, that seems nice enough and the user would have to call this Tokenizer() routine as:&lt;br /&gt;&lt;pre   style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); line-height: 14px; width: 100%;font-family:Andale Mono,Lucida Console,Monaco,fixed,monospace;font-size:12px;"&gt;&lt;code&gt;Tokenize&amp;lt;std::list&amp;lt;std::string&amp;gt; &amp;gt;( &lt;span style="color: rgb(255, 0, 0);"&gt;"breakmeintoathousandpieces"&lt;/span&gt;, &lt;span style="color: rgb(255, 0, 0);"&gt;"e"&lt;/span&gt; );&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Unfortunately, that's redundant because we know that the result is a container of string tokens. Furthermore, the user should not be given the opportunity to misuse the algorithm by specifying something other than std::string for the template argument. It should be fair to simply say:&lt;br /&gt;&lt;pre   style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); line-height: 14px; width: 100%;font-family:Andale Mono,Lucida Console,Monaco,fixed,monospace;font-size:12px;"&gt;&lt;code&gt;Tokenize&amp;lt;std::list&amp;gt;( &lt;span style="color: rgb(255, 0, 0);"&gt;"breakmeintoathousandpieces"&lt;/span&gt;, &lt;span style="color: rgb(255, 0, 0);"&gt;"e"&lt;/span&gt; );&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;That won't work however because then the container type would be incomplete. I was wondering how to resolve this problem when it hit me! The use of Template Template Parameters was illustrated for designing Policy classes in Modern C++ Design. It suited my purpose wonderfully!&lt;br /&gt;This is what my revised Tokenizer() function looked like:&lt;br /&gt;&lt;pre   style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); line-height: 14px; width: 100%;font-family:Andale Mono,Lucida Console,Monaco,fixed,monospace;font-size:12px;"&gt;&lt;code&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;template&lt;/span&gt;&amp;lt; &lt;span style="color: rgb(0, 0, 255);"&gt;template&lt;/span&gt;&amp;lt;&lt;span style="color: rgb(0, 0, 255);"&gt;class&lt;/span&gt;&amp;gt; &lt;span style="color: rgb(0, 0, 255);"&gt;class&lt;/span&gt; Container &amp;gt;&lt;br /&gt;Container&amp;lt;std::string&amp;gt; Tokenize( &lt;span style="color: rgb(0, 0, 255);"&gt;const&lt;/span&gt; std::string&amp;amp; str, &lt;span style="color: rgb(0, 0, 255);"&gt;const&lt;/span&gt; std::string&amp;amp; tokenStr )&lt;br /&gt;{&lt;br /&gt; Container&amp;lt;std::string&amp;gt; result;&lt;br /&gt;&lt;span style="color: rgb(0, 136, 0);"&gt;  //////Rest of the code goes here...//////////&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;  return&lt;/span&gt; result;&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;This example was just to illustrate the use of template template parameters. As Alexandrescu so beautifully put it - &lt;span style="font-style: italic; font-weight: bold;"&gt;"It is as if &lt;/span&gt;&lt;span style="font-weight: bold;"&gt;WidgetManager &lt;/span&gt;&lt;span style="font-style: italic; font-weight: bold;"&gt;&lt;span style="font-size:85%;"&gt;(the class he templated)&lt;/span&gt; were a little code generation engine, and you configure the ways in which it generates code."&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;If you really have a solid reason to tokenize anything complex, of course, I would recommend using &lt;a href="http://www.boost.org/doc/libs/1_35_0/libs/tokenizer/tokenizer.htm"&gt;Boost::Tokenizer&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-8671988304275836145?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/8671988304275836145/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=8671988304275836145' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/8671988304275836145'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/8671988304275836145'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2008/08/alexandrescu-to-rescue.html' title='Alexandrescu to the rescue'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-7822276766625163641</id><published>2008-07-10T12:49:00.001+05:30</published><updated>2009-08-16T20:03:47.277+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='c++'/><category scheme='http://www.blogger.com/atom/ns#' term='algorithms'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><title type='text'>Sorting Stuff with Heap Sort - Part III</title><content type='html'>In part I and II of this series, we learnt about Heap Sort and how to construct a heap out of unsorted data. Now, let's move on. Once the heap is constructed, we need to sort it.&lt;br /&gt;&lt;br /&gt;You might have noticed that the SIFT function takes a heap size as one of its arguments. If the SIFT function already knows what heap it is working on, why would it be necessary to pass in the heapSize separately? The reason is that SIFT doesn't have to sift a node through the entire heap. It can work with a smaller part of the heap. In the HEAPIFY routine, everytime we invoked SIFT, we passed a constant heap size to it but we would like to be able to specify a smaller heap size if we want. We'll see the reason for this soon.&lt;br /&gt;&lt;br /&gt;We already know that the top-most node in any heap is the largest value. In order to sort the heap, what we do is swap the top node (or in other words the 0th element in the list) with the last node in the heap (the element whose index is inputDataList.length()-1). Now our largest value is at the bottom of the heap. Next, we reduce the size of the heap to be sorted and sift the top-most node using the reduced heap size as an argument. The top node, of course, has to be sifted so that we get a proper heap again. We keep swapping and sifting until the size of the heap to be sorted becomes zero.&lt;br /&gt;&lt;br /&gt;The following algorithm performs sorting of a heap:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;&lt;br /&gt;1. i = inputDataList.length()-1&lt;br /&gt;2. while(i &gt; 0)&lt;br /&gt;{&lt;br /&gt;3. SWAP(0, i)&lt;br /&gt;4. SIFT(0, i)&lt;br /&gt;5. i = i - 1&lt;br /&gt;}&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;That's all there is to it. Here's some C++ code that I had written to augment this series. If the algorithms I've provided seem a bit vague, feel free to look at the code &lt;a href="http://angelorohit.googlepages.com/HeapSort.cpp"&gt;here&lt;/a&gt;. Also, check out this nice Heap Sort visualization &lt;a href="http://www2.hawaii.edu/%7Ecopley/665/HSApplet.html"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-7822276766625163641?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/7822276766625163641/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=7822276766625163641' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/7822276766625163641'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/7822276766625163641'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2008/07/sorting-stuff-with-heap-sort-part-iii.html' title='Sorting Stuff with Heap Sort - Part III'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-4876315953631485315</id><published>2008-06-15T07:01:00.000+05:30</published><updated>2009-06-14T01:15:26.722+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='rants'/><title type='text'>Firefox Download Day</title><content type='html'>This post is a slight digression but you could think of it as a news update... I've just been informed along with some 21,000 odd Indians out there that the &lt;a href="http://www.spreadfirefox.com/en-US/worldrecord"&gt;download day&lt;/a&gt; for Firefox is June 17th. I see a lot of Internet Explorer users blissfully using the worst browser that exists for a single platform - Windows! Firefox is free of charge, more secure, well-featured and open-sourced. What can IE do that Firefox cannot? The answer is nothing. So, then why use something that is second-rate? It's not that you have to shell out a packet to use Firefox. It's absolutely free! I guess, the only reason IE still exists is because it comes for free with Microsoft Windows.&lt;br /&gt;&lt;br /&gt;Hopefully when Firefox 3 sets a world record for the most software downloaded in a 24-hour period, more web-users will sit up and take notice. We are a country with the second largest population in the world. Let's prove that we are also willing to embrace a future of free and open-source software by participating in this important event.&lt;br /&gt;&lt;br /&gt;On a side-note, I wouldn't recommend any NIN fan opening &lt;a href="http://remix.nin.com"&gt;http://remix.nin.com&lt;/a&gt; with IE6.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-4876315953631485315?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/4876315953631485315/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=4876315953631485315' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/4876315953631485315'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/4876315953631485315'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2008/06/firefox-download-day.html' title='Firefox Download Day'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-4287366001807586393</id><published>2008-06-10T13:07:00.000+05:30</published><updated>2009-06-14T01:24:33.531+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='algorithms'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><title type='text'>Sorting Stuff with Heap Sort - Part II</title><content type='html'>&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;font-family:georgia;" &gt;Why do we call it ‘Heap’ sort?&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;Heap sort begins by building a heap of the data. A heap can be visualized as a binary tree where each parent node is greater than its successors. In practice, the heap can easily be represented by a simple array where the left and right children of the i&lt;sup&gt;th&lt;/sup&gt; node in the array will be at positions 2*i+1 and 2*i+2 respectively. For example, the following is a heap:&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_O-rOxpu66eY/SE55KRSQ4AI/AAAAAAAAAEs/iZ58m3wYBUI/s1600-h/heapTree.PNG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://2.bp.blogspot.com/_O-rOxpu66eY/SE55KRSQ4AI/AAAAAAAAAEs/iZ58m3wYBUI/s320/heapTree.PNG" alt="" id="BLOGGER_PHOTO_ID_5210235036259901442" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;This heap above can be represented using an array as follows:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_O-rOxpu66eY/SE55nVNaBhI/AAAAAAAAAE8/a6zUFJcZrWE/s1600-h/heapArray.PNG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://4.bp.blogspot.com/_O-rOxpu66eY/SE55nVNaBhI/AAAAAAAAAE8/a6zUFJcZrWE/s320/heapArray.PNG" alt="" id="BLOGGER_PHOTO_ID_5210235535529477650" border="0" /&gt;&lt;/a&gt;Note that the i&lt;sup&gt;th&lt;/sup&gt; element has the (2i+1)&lt;sup&gt;th&lt;/sup&gt; and (2i+2)&lt;sup&gt;th&lt;/sup&gt; elements as its children. The fact that the heap can be represented like this means that we can do an in-place sort without having to construct an entirely new data structure for storage. There are a couple of interesting features of the heap which are to be noted:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;1.&lt;/span&gt; Each node is greater than its successors (for sorting in ascending order).&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;2.&lt;/span&gt; By virtue of (1), the largest node will always be on top of the heap.&lt;br /&gt;&lt;br /&gt;Now that we know what the heap is, let’s see how we can generate such a heap out of unsorted data.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;font-family:georgia;" &gt;Building the Heap.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;Before we talk about building a heap, we must first discuss a &lt;span style="font-weight: bold; font-style: italic;"&gt;sifting procedure&lt;/span&gt;. The sifting procedure basically sifts a given node downward through the tree until it reaches its rightful place in the tree. I may keep using the term ‘node’ simply because its easier to visualize things that way but remember that in practice, a node is nothing but an element in a list. The sifting algorithm is pretty straight-forward.&lt;br /&gt;&lt;pre   style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); line-height: 14px; width: 100%;font-family:Andale Mono,Lucida Console,Monaco,fixed,monospace;font-size:12px;"&gt;&lt;code&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Procedure SIFT(int siftNode, int heapSize)&lt;/span&gt;&lt;br /&gt;1. Start with the position of the node to be sifted.&lt;br /&gt;2. If either of the sift node’s children are larger than it, then swap the sift node with the larger of its children.&lt;br /&gt;3. If neither of the sift node’s children are larger than it or the end of the heap has been reached then exit.&lt;br /&gt;4. Otherwise, go to step 2.&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;/pre&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_O-rOxpu66eY/SE57RES9ejI/AAAAAAAAAFE/gB0gao7LkNU/s1600-h/sifting.PNG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://2.bp.blogspot.com/_O-rOxpu66eY/SE57RES9ejI/AAAAAAAAAFE/gB0gao7LkNU/s320/sifting.PNG" alt="" id="BLOGGER_PHOTO_ID_5210237352055503410" border="0" /&gt;&lt;/a&gt;Using the sift procedure, we can easily build an initial heap out of seemingly unsorted data. We start with the last node in the tree or in other words, the last element in the input data list. We then invoke our earlier sift procedure on this element. Then we move onto the previous element in the list and the cycle continues until we have sifted all of the elements in the list. The result will be a nice heap. For grasping the idea better, the following algorithm should suffice. Note that the algorithm assumes a zero based input data list.&lt;br /&gt;&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); line-height: 14px; width: 100%; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px;"&gt;&lt;code&gt;&lt;br /&gt;&lt;b&gt;Procedure Heapify()&lt;/b&gt;&lt;br /&gt;1. siftNode = inputDataList.length()-1&lt;br /&gt;2. while siftNode &gt;= 0&lt;br /&gt; {&lt;br /&gt;3. Invoke SIFT( siftNode, inputDataList.length() )&lt;br /&gt;4. siftNode = siftNode – 1&lt;br /&gt; }&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Sometimes, building an initial heap out of the input data is known as &lt;span style="font-weight: bold; font-style: italic;"&gt;“Heapifying”&lt;/span&gt; the data. We are not done yet. The heap has to now be sorted and we'll see how that can be done soon. Until then, have a nice week!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-4287366001807586393?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/4287366001807586393/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=4287366001807586393' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/4287366001807586393'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/4287366001807586393'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2008/06/sorting-stuff-with-heap-sort-part-ii.html' title='Sorting Stuff with Heap Sort - Part II'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_O-rOxpu66eY/SE55KRSQ4AI/AAAAAAAAAEs/iZ58m3wYBUI/s72-c/heapTree.PNG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-6370058512663628438</id><published>2008-06-05T08:15:00.000+05:30</published><updated>2009-06-14T01:24:33.532+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='algorithms'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><title type='text'>Sorting Stuff with Heap Sort - Part I</title><content type='html'>&lt;p class="MsoNormal"&gt;I’m starting a small series of blog posts that will explain the Heap Sort algorithm in depth. I’ve noticed that this is an academic topic that few are willing to touch but I am! I hope you find this short series informative.&lt;/p&gt;            &lt;p class="MsoNormal"&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;font-family:georgia;" &gt;The Basics.&lt;/span&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;First, lets get through the basics of any sorting algorithm. A &lt;span style="font-weight: bold; font-style: italic;"&gt;sorting algorithm&lt;/span&gt; is an algorithm that seeks to arrange the elements of a data structure (think, a simple List) in a particular order. In most cases, we prefer the elements to be sorted in either ascending or descending order. The efficiency of an algorithm can be measured in terms of its &lt;span style="font-weight: bold; font-style: italic;"&gt;Time Complexity&lt;/span&gt; or &lt;span style="font-weight: bold; font-style: italic;"&gt;Space Complexity&lt;/span&gt;. The term Time Complexity refers to the amount of time that an algorithm takes to process the input and produce the desired output. The term Space Complexity refers to the amount of space or memory that an algorithm takes to produce the expected result. Generally, the complexity of an algorithm (time or space) is expressed as a function of the size of the problem, n. This is known as the &lt;span style="font-weight: bold; font-style: italic;"&gt;Big-Oh Notation&lt;/span&gt;. So, if we were to say that a sorting algorithm has a time complexity of O(n), it means that the algorithm will take a factor of 10 units of time to sort 10 values. If the complexity of the algorithm were O(n&lt;sup&gt;2&lt;/sup&gt;), then it would take a factor of 100 units of time to sort 10 values. Note that I have said that the algorithm will take "a factor of" time because this factor would depend on the particular problem. For example, if we were sorting simple integers, we could expect this factor to be a lot less than if we were sorting strings. Also, the complexity of an algorithm can be specified for &lt;span style="font-weight: bold; font-style: italic;"&gt;Best, Worst or Average case&lt;/span&gt; scenarios. A best case scenario for a sorting algorithm would, of course, be if the data were already sorted in the first place. A worst case for a sorting algorithm would arise if the data were arranged in a manner that is contrary to the working of the algorithm. Generally, a good algorithm is measured for its worst-case scenario but in some cases, we also consider the average case.&lt;br /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;Heap Sort&lt;/span&gt; is an O(nLogn) time complexity algorithm. This is in stark contrast with other sorting algorithms such as &lt;a href="http://en.wikipedia.org/wiki/Bubble_sort"&gt;Bubble Sort&lt;/a&gt; (the unjustifiably most famous sort) which has an average or worst case complexity of O(n&lt;sup&gt;2&lt;/sup&gt;). In my next post, we will dive into the Heap Sort algorithm and find out the reason as to why its called Heap Sort in the first place.&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/5951350911052608183-6370058512663628438?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/6370058512663628438/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=6370058512663628438' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/6370058512663628438'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/6370058512663628438'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2008/06/sorting-stuff-with-heap-sort.html' title='Sorting Stuff with Heap Sort - Part I'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-7531628211316674169</id><published>2008-05-27T20:03:00.000+05:30</published><updated>2009-06-14T01:15:26.723+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='rants'/><title type='text'>Why use a wrist-watch?</title><content type='html'>Of late I've been going around without a wrist-watch. I've reasoned that the time display is now a feature provided by many other gadgets that I tend to carry such as my mobile phone or my iPod. Worst case, I could always accost someone and ask them the time. However, there was one particular situation where I actually needed my wrist-watch and it wasn't available - while writing my exams. I obviously couldn't whisk out my mobile (or worse my iPod) and tell the time. It would be rather obtrusive if I brought my analog alarm clock to the exam hall and kept it on my desk. So, the only other alternative was my wrist-watch. The only problem was that I hadn't used my wrist-watch for a very long time and its battery had died. In the end, I just requested the invigilator to inform me as each hour went by.&lt;br /&gt;&lt;br /&gt;All along, I've felt that wearing a wrist-watch was more of a fashion statement than anything else. Reminds me, I've got to remember to replace the battery in my watch even if I don't actually wear it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-7531628211316674169?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/7531628211316674169/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=7531628211316674169' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/7531628211316674169'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/7531628211316674169'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2008/05/why-use-wrist-watch.html' title='Why use a wrist-watch?'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-8645070263067703283</id><published>2008-05-12T01:12:00.000+05:30</published><updated>2009-06-14T01:14:19.215+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='open source'/><category scheme='http://www.blogger.com/atom/ns#' term='windows'/><title type='text'>Setting up Code::Blocks on Windows</title><content type='html'>This blog post is a how-to manual on how to set up Code::Blocks for Windows along with some other libraries such SDL and GTK+.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;What is Code::Blocks?&lt;/span&gt;&lt;br /&gt;Code::Blocks is an Integrated Development Environment(IDE) for C++. This means that it provides a convenient means for programmers to type and execute their programs. You will need to provide a compiler for any IDE and there are several C/C++ compilers for the Windows environment. Since, this walk-through is newbie oriented, I will simply assume that you do not have any particular compiler in hand.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Setting up Code::Blocks on Windows.&lt;/span&gt;&lt;br /&gt;In order to set up Code::Blocks for your Windows OS, go to &lt;a href="http://www.codeblocks.org/downloads/5"&gt;http://www.codeblocks.org/downloads/5&lt;/a&gt; . You will see two setup files for Windows 2000/XP/Vista. The first setup assumes that you already have a compiler to use with the IDE. The second setup, comes with the MinGW compiler for Windows. Download this setup from its Sourceforge link. Once you've downloaded the file &lt;span style="font-style: italic; font-weight: bold;font-family:arial;" &gt;codeblocks-8.02mingw-setup.exe&lt;/span&gt;, then do a full install of the IDE. I'm going to assume that the selected installation path for the IDE is &lt;span style="font-weight: bold; font-style: italic;font-family:arial;" &gt;C:\Program Files\CodeBlocks&lt;/span&gt;. The installation is pretty straight-forward and there should not be any problems. Try creating a new Console Application using the Project Wizard.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Setting up Simple DirectMedia Library for Code::Blocks on Windows.&lt;/span&gt;&lt;br /&gt;Setting up SDL for Code::Blocks is pretty easy. Download the SDL 1.2 development bundle from the direct link &lt;a href="http://www.libsdl.org/release/SDL-devel-1.2.13-mingw32.tar.gz"&gt;here&lt;/a&gt;. Untar the contents of the file. You should get a folder named something like &lt;span style="font-weight: bold; font-style: italic;font-family:arial;" &gt;SDL-1.2.13&lt;/span&gt; and within that folder you should find folders named &lt;span style="font-weight: bold; font-style: italic;font-family:arial;" &gt;include, lib, bin&lt;/span&gt; etc. Code::Blocks expects to see the file &lt;span style="font-weight: bold; font-style: italic;font-family:arial;" &gt;SDL.h&lt;/span&gt; within the include folder but as of now, if you look inside the &lt;span style="font-weight: bold; font-style: italic;font-family:arial;" &gt;include&lt;/span&gt; folder, you will find another folder named &lt;span style="font-weight: bold; font-style: italic;font-family:arial;" &gt;SDL&lt;/span&gt;. Copy all the header files from within the &lt;span style="font-weight: bold; font-style: italic;font-family:arial;" &gt;SDL&lt;/span&gt; folder one level up to the include folder and delete the folder &lt;span style="font-weight: bold; font-style: italic;font-family:arial;" &gt;SDL&lt;/span&gt;. Then, copy the entire &lt;span style="font-weight: bold; font-style: italic;font-family:arial;" &gt;SDL-1.2.13&lt;/span&gt; folder to &lt;span style="font-weight: bold; font-style: italic;font-family:arial;" &gt;C:\Program Files\CodeBlocks&lt;/span&gt;. Now, fire up Code::Blocks and try creating a sample SDL project using the Project Wizard. When asked to specify SDL's location, just provide the path as &lt;span style="font-weight: bold; font-style: italic;font-family:arial;" &gt;C:\Program Files\CodeBlocks\SDL-1.2.13&lt;/span&gt;. Hopefully, everything should go as planned.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Setting up GTK+ for Code::Blocks on Windows.&lt;/span&gt;&lt;br /&gt;Setting up GTK+ for Code::Blocks is even easier. Download the GTK+ development bundle from the direct link &lt;a href="http://ftp.gnome.org/pub/gnome/binaries/win32/gtk+/2.12/gtk+-bundle-2.12.9.zip"&gt;here&lt;/a&gt;. This zip file is a tarbomb, so neatly unzip the contents of this file to a folder named &lt;span style="font-weight: bold; font-style: italic;font-family:arial;" &gt;gtk+-bundle-2.12.9&lt;/span&gt;. Copy this entire folder to &lt;span style="font-weight: bold; font-style: italic;font-family:arial;" &gt;C:\Program Files\CodeBlocks&lt;/span&gt;. Now try creating a new GTK+ project using the Project Wizard. When asked to specify GTK's location, just provide the path as &lt;span style="font-weight: bold; font-style: italic;font-family:arial;" &gt;C:\Program Files\CodeBlocks\gtk+-bundle-2.12.9.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-8645070263067703283?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/8645070263067703283/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=8645070263067703283' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/8645070263067703283'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/8645070263067703283'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2008/05/setting-up-codeblocks-on-windows.html' title='Setting up Code::Blocks on Windows'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-5826964319636558099</id><published>2008-05-10T18:10:00.000+05:30</published><updated>2009-06-14T01:26:17.451+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='c++'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><title type='text'>const_iterator : Safety or Necessity?</title><content type='html'>&lt;span style="font-weight: bold; font-style: italic; font-size: 85%;"&gt;&lt;span style="font-family: arial;"&gt;(Reader Level : Beginner)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;(Knowledge assumptions : const-correctness, std::vector, iterators)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;A while back I asked a senior programmer a very naive but valid doubt.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;"Are const iterators used only to enforce safety or are there cases where they could be absolutely necessary?"&lt;/span&gt;&lt;br /&gt;In reply, this is what I got and the answer was clear.&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 12px; width: 100%;"&gt;&lt;code&gt;&lt;br /&gt;#include &amp;lt;iostream&amp;gt;&lt;br /&gt;#include &amp;lt;vector&amp;gt;&lt;br /&gt;&lt;br /&gt;class A&lt;br /&gt;{&lt;br /&gt;private:&lt;br /&gt;std::vector&amp;lt;int&amp;gt; _vector;&lt;br /&gt;&lt;br /&gt;public:&lt;br /&gt;void Init()&lt;br /&gt;{&lt;br /&gt;   _vector.push_back( 1 );&lt;br /&gt;   _vector.push_back( 2 );&lt;br /&gt;   _vector.push_back( 3 );&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void Display() const&lt;br /&gt;{&lt;br /&gt;   for(std::vector&amp;lt;int&amp;gt;::const_iterator itr = _vector.begin(); itr != _vector.end(); ++itr)    &lt;br /&gt;      std::cout &amp;lt;&amp;lt; (*itr) &amp;lt;&amp;lt; std::endl;&lt;br /&gt;}&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;int main(int argc, char *argv[])&lt;br /&gt;{&lt;br /&gt;A a;&lt;br /&gt;&lt;br /&gt;a.Init();&lt;br /&gt;a.Display();&lt;br /&gt;&lt;br /&gt;std::cout&amp;lt;&amp;lt;"\n\n";&lt;br /&gt;return 0;&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;If we were to try replacing the const_iterator in the Display() function with a normal iterator, the code would simply not compile. This is because the Display() routine is itself const and hence, we must guarantee that no member functions are altered within it. A normal iterator cannot give such a guarantee but a const_iterator can.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-5826964319636558099?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/5826964319636558099/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=5826964319636558099' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/5826964319636558099'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/5826964319636558099'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2008/05/constiterator-safety-or-necessity.html' title='const_iterator : Safety or Necessity?'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-8061289673410020448</id><published>2008-05-04T15:14:00.000+05:30</published><updated>2009-06-14T01:26:17.452+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='c++'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='code storm'/><title type='text'>Code Storm#1 Solutions</title><content type='html'>In response to my previous post of the Great Triangle Challenge here are the results:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;This is how I managed to solve the problem.&lt;/li&gt;&lt;/ul&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 10px; width: 100%;"&gt;&lt;code&gt;&lt;br /&gt;#define ABS(X) ( ((X) &amp;lt; 0)?(-(X)) : (X) )&lt;br /&gt;&lt;br /&gt;void Pyramid(const int n)&lt;br /&gt;{&lt;br /&gt;   for(int count = 0; count &amp;lt; (n*2 - 1)*n; ++count)&lt;br /&gt;   {&lt;br /&gt;     ((count/(n*2-1) - ABS( count%(n*2 - 1)-(n-1) ) + 1) &amp;gt; 0) ?&lt;br /&gt;     std::cout&amp;lt;&amp;lt;(count/(n*2-1) - ABS( count%(n*2-1)-(n-1) ) + 1) :&lt;br /&gt;     std::cout&amp;lt;&amp;lt;" ";&lt;br /&gt;&lt;br /&gt;     if((count+1)%(n*2 - 1) == 0)&lt;br /&gt;         std::cout&amp;lt;&amp;lt;std::endl;&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Hopefully, the code comments help in explaining the algorithm. The basic idea revolves around the fact that every row contains n*2 - 1 entries including the spaces to be printed. Let's call this the lengthOfRow. Hence, everytime the count becomes a factor of n*2 - 1, we print a newline. Also, we calculate the deviation of a value from the central value in each row. This is done by saying count%lengthOfRow - (n-1). If this deviation is found to be a positive deviation from the maximum value of that row, then we print it otherwise a whitespace is displayed.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Verdict:&lt;/span&gt; This method is relatively fast if compiler optimizations are turned on. The code is quite unreadable, though and it uses one extra variable in a single loop.&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;This method was provided by Francis Xavier, my elder brother. ;)&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 10px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;&lt;br /&gt;void Pyramid(int num)&lt;br /&gt;{&lt;br /&gt;    // We can only print numbers upto 1.&lt;br /&gt;    if( (num % 10) &lt; 1 ) return;&lt;br /&gt;&lt;br /&gt;    if( num &gt; 1)// Print the upper rows first.&lt;br /&gt;        Pyramid( num - 1 );&lt;br /&gt;&lt;br /&gt;    // Print this row&lt;br /&gt;    switch( (num % 10) - 1 )&lt;br /&gt;    {&lt;br /&gt;        case 0: std::cout &lt;&lt; "        1        " &lt;&lt; "\n"; break;  &lt;br /&gt;        case 1: std::cout &lt;&lt; "       121       " &lt;&lt; "\n"; break;   &lt;br /&gt;        case 2: std::cout &lt;&lt; "      12321      " &lt;&lt; "\n"; break;   &lt;br /&gt;        case 3: std::cout &lt;&lt; "     1234321     " &lt;&lt; "\n"; break;   &lt;br /&gt;        case 4: std::cout &lt;&lt; "    123454321    " &lt;&lt; "\n"; break;   &lt;br /&gt;        case 5: std::cout &lt;&lt; "   12345654321   " &lt;&lt; "\n"; break;   &lt;br /&gt;        case 6: std::cout &lt;&lt; "  1234567654321  " &lt;&lt; "\n"; break;   &lt;br /&gt;        case 7: std::cout &lt;&lt; " 123456787654321 " &lt;&lt; "\n"; break;   &lt;br /&gt;        case 8: std::cout &lt;&lt; "12345678987654321" &lt;&lt; "\n"; break;   &lt;br /&gt;    }&lt;br /&gt;}&lt;/code&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Look at the code closely and you will notice the ingenuity involved. First of all, the necessity to use an extra variable is circumvented because the count is wrapped up in the number of rows. Another idea which I certainly had not thought of was the use of recursion to perform some sort of looping. Finally, the best part was the idea to hard-code the nine rows but in an elegant manner.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Verdict:&lt;/span&gt; This method is extremely efficient. It uses no extra loops or variables. Another advantage going for it is that the code is extremely easy to read (unlike my method). Fantastic!&lt;br /&gt;&lt;br /&gt;If anyone feels that they have a better algorithm than the one provided by Francis Xavier, feel free to email me at angelorohit[at]gmail[dot]com. Please don't attempt to post code in the comments section here as it is quite likely that the code would show up without proper formatting.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-8061289673410020448?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/8061289673410020448/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=8061289673410020448' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/8061289673410020448'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/8061289673410020448'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2008/05/code-storm1-solutions.html' title='Code Storm#1 Solutions'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-8877293026653893160</id><published>2008-04-28T00:50:00.000+05:30</published><updated>2009-06-14T01:26:17.452+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='c++'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='code storm'/><title type='text'>Code Storm#1: The Great Triangle Challenge</title><content type='html'>I came across a nice C/C++ challenge on the web. Check it out &lt;a href="http://cc.byexamples.com/20070529/pascal-triangle-challenge/"&gt;here&lt;/a&gt;. Granted that's not a Pascal Triangle, it's just a pattern. In any case, the goal is to generate the pattern below using the fewest number of loops and variables.&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;&lt;br /&gt;        1&lt;br /&gt;       121&lt;br /&gt;      12321&lt;br /&gt;     1234321&lt;br /&gt;    123454321&lt;br /&gt;   12345654321&lt;br /&gt;  1234567654321&lt;br /&gt; 123456787654321&lt;br /&gt;12345678987654321&lt;/code&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;There are a few ground rules to be followed:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;The number of rows displayed in the pattern is determined by the user at run-time. The minimum number of rows is zero and the maximum number of rows that the user can provide is 9.&lt;/li&gt;&lt;li&gt;You must have a function whose prototype is void Pyramid(int n) and this function must be invoked. Error checking for the number of allowed rows (0-9) need not be done within this function.&lt;/li&gt;&lt;li&gt;The variable n which is passed as an argument to Pyramid() is not counted as an extra variable.&lt;/li&gt;&lt;li&gt;You are free to use any number of extra functions. Every argument passed by value to an extra function will be counted as an extra variable. The main() routine of course, is an exception.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;The term 'loop' refers to any looping construct of the language. This includes for, while, do-while and goto as well.&lt;/li&gt;&lt;li&gt;You are free to use any number of macros. Since, macros are effectively nothing but code substitution, macro arguments are not counted as extra variables.&lt;/li&gt;&lt;li&gt;printf() or the overloaded insertion operator of cout can be used for printing to standard ouput. Any other in-built library function that is used will involve weighing its internal source. For example, if you invoke strlen() once, then this would count as one extra loop but not an extra variable.&lt;/li&gt;&lt;li&gt;If two solutions use the same number of loops and the same number of variables, then the one that is more efficient in terms of time complexity will be the better solution.&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;If anyone does come up with a good solution to this problem, feel free to email me your source code at angelorohit[at]gmail[dot]com. Please don't attempt to post code in the comments section here as it is quite likely that the code would show up without proper formatting. I will post the worthy code in my next blog post. Have fun!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-8877293026653893160?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/8877293026653893160/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=8877293026653893160' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/8877293026653893160'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/8877293026653893160'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2008/04/code-storm-great-triangle-challenge.html' title='Code Storm#1: The Great Triangle Challenge'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-8438542787877812479</id><published>2008-04-20T19:52:00.000+05:30</published><updated>2009-06-14T01:00:05.458+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='movie'/><title type='text'>Movie Review: Into The Wild</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_O-rOxpu66eY/SAW_obfpHII/AAAAAAAAACo/QO1SE49lIxE/s1600-h/IntoTheWildImg.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 209px; height: 142px;" src="http://2.bp.blogspot.com/_O-rOxpu66eY/SAW_obfpHII/AAAAAAAAACo/QO1SE49lIxE/s320/IntoTheWildImg.jpg" alt="" id="BLOGGER_PHOTO_ID_5189764846910512258" border="0" /&gt;&lt;/a&gt;Normally I'm an action junkie when it comes to movies, so its funny that 'Into the Wild' was not an action flick. The basic plot is as follows: &lt;b&gt;After graduating from Emory University, top student and athlete Christopher McCandless abandons his possessions, gives his entire $24,000 savings account to charity and hitchhikes to Alaska to live in the wilderness. Along the way, Christopher encounters a series of characters that shape his life.&lt;/b&gt;&lt;br /&gt;&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;&lt;br /&gt;Seems pretty boring, right? That's what I thought when I read the plot summary on IMDB but I watched the movie anyway. It turns out that I was wrong and the movie offers some great insights into the philosophy of life and the spirituality that one can gain through adventure. This film is based on a book by Jon Krakauer who wrote about the true exploits of an American wanderer named Chris McCandless.  At the end of the movie, you may become a bit cynical (as I did) due to certain developments in the plot. Then I remembered that this is an actual true story and that I was entirely missing the take home message. At any rate, whether you like or dislike this film, you are sure to have several opinions about it. To give it credit, Into the Wild won the 2007 Golden Globe Awards and was also nominated for the Academy Awards. It has also received favourable reviews from most movie critics. The acting, in my humble opinion, was top notch. Emile Hirsch (of Alpha Dog fame) plays McCandless and does a pretty good job. The film was directed by Sean Penn who was also involved in production as well as screenplay. One of the biggest assets of the film is probably its great soundtrack. The music is truly beautiful and it keeps you in touch with each scene. Don't google anything about the film until you've actually watched it. Otherwise you're just ruining the whole experience!&lt;br /&gt;&lt;br /&gt;Some links to check out AFTER you've watched 'Into The Wild':&lt;br /&gt;&lt;a href="http://en.wikipedia.org/wiki/Christopher_McCandless"&gt;Wiki on Chris McCandless&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.intothewild.com/"&gt;Official film site&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-8438542787877812479?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/8438542787877812479/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=8438542787877812479' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/8438542787877812479'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/8438542787877812479'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2008/04/movie-review-into-wild.html' title='Movie Review: Into The Wild'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_O-rOxpu66eY/SAW_obfpHII/AAAAAAAAACo/QO1SE49lIxE/s72-c/IntoTheWildImg.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-1885578104089768109</id><published>2008-04-13T07:33:00.001+05:30</published><updated>2009-06-14T00:57:14.606+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>Creating a custom GRUB bootsplash</title><content type='html'>&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;Creating your own GRUB bootsplash image does not require you to be an artist or an image-editing wizard. It's very easy.&lt;br /&gt;Every GRUB bootsplash image must have the following characteristics:&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;a)&lt;/span&gt; Image format must be of the &lt;span style="font-family:courier new;"&gt;xpm&lt;/span&gt; format. GRUB will load compressed images even faster.&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;b)&lt;/span&gt; Image resolution must be 640x480, irrespective of whether your monitor is widescreen or not.&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;c)&lt;/span&gt; Image can only have a maximum 14 colours. No more.&lt;br /&gt;&lt;br /&gt;Armed with these facts, let's go ahead and try to create our own bootsplash image. The image editing software that I am going to use for this purpose is the &lt;a href="http://www.gimp.org/"&gt;GIMP&lt;/a&gt; (GNU Image Manipulation Program).&lt;br /&gt;First, pick out an image that you really like. The format doesn't matter at this point. It can be jpg, bmp, png, anything you like.&lt;br /&gt;&lt;br /&gt;Now open the image in GIMP. Resize the image to a 640x480 resolution. Go to &lt;span style="font-weight: bold;font-family:courier new;" &gt;Image-&amp;gt;Scale Image&lt;/span&gt; and set Width to 640 and the Height to 480. You can tweak the other settings in the same dialog if you want. After that click on the &lt;span style="font-weight: bold;font-family:courier new;" &gt;Scale&lt;/span&gt; button.&lt;br /&gt;&lt;br /&gt;Next we need to make our image only have a maximum of 14 colours. So, go to &lt;span style="font-weight: bold;font-family:courier new;" &gt;Image-&amp;gt;Mode-&amp;gt;Indexed&lt;/span&gt;. Click on the Generate optimum palette radio button and set the Maximum number of colors to 14. Now we probably have a pretty ugly looking image. :)&lt;br /&gt;&lt;br /&gt;Finally, save the image with extension xpm. You could call it something like &lt;span style="font-family:courier new;"&gt;bootsplash.xpm&lt;/span&gt;. Alright, we've got our image. Let's compress it. Open up a terminal and navigate to the folder where you saved &lt;span style="font-family:courier new;"&gt;bootsplash.xpm&lt;/span&gt; using the &lt;span style="font-family:courier new;"&gt;cd&lt;/span&gt; command. Then type:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;&lt;br /&gt;gzip bootsplash.xpm&lt;/code&gt;&lt;/pre&gt;The &lt;span style="font-family:courier new;"&gt;gzip&lt;/span&gt; utility will compress our image and its name gets changed to &lt;span style="font-family:courier new;"&gt;bootsplash.xpm.gz&lt;/span&gt;. That's it! We're done. You can now set it as your new GRUB bootsplash. Enjoy!&lt;br /&gt;&lt;br /&gt;By the way, this is what my own GRUB bootsplash looks like.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_O-rOxpu66eY/R_sOJACUnLI/AAAAAAAAACA/PMH2NGgHRgc/s1600-h/GRUBBootSplash.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://2.bp.blogspot.com/_O-rOxpu66eY/R_sOJACUnLI/AAAAAAAAACA/PMH2NGgHRgc/s320/GRUBBootSplash.jpg" alt="" id="BLOGGER_PHOTO_ID_5186754943638609074" border="0" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-1885578104089768109?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/1885578104089768109/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=1885578104089768109' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/1885578104089768109'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/1885578104089768109'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2008/04/creating-custom-grub-bootsplash_9979.html' title='Creating a custom GRUB bootsplash'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_O-rOxpu66eY/R_sOJACUnLI/AAAAAAAAACA/PMH2NGgHRgc/s72-c/GRUBBootSplash.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-7638392161499828655</id><published>2008-04-07T04:48:00.000+05:30</published><updated>2009-06-14T00:57:14.606+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>Mess around with your GRUB menu</title><content type='html'>GRUB stands for &lt;span style="font-weight: bold;"&gt;GRand Unified Bootloader&lt;/span&gt;. I don't know why, but someone thought that it would be a funny play on the term "Grand Unification Theory" in physics. Essentially, GRUB is a bootloader program that loads when you boot into your PC. Using the GRUB menu, you can then pick your operating system of choice (if you happen to have more than one). I've been using Linux for a while now and today I'll show you how to tweak your GRUB menu settings so that it looks and behaves the way you might want it to. The Linux distribution that I currently use is Kubuntu 7.10. As such, many of the commands that I use may be Ubuntuish.&lt;br /&gt;&lt;br /&gt;Let's get started. The options for your GRUB menu are stored in a file named &lt;span style="font-family:courier new;"&gt;menu.lst&lt;/span&gt;. Typically, this file will be located at &lt;span style="font-family:courier new;"&gt;/boot/grub&lt;/span&gt;. Before making any changes to &lt;span style="font-family:courier new;"&gt;menu.lst&lt;/span&gt;, let's first take a backup of the file. Open up a terminal and type the following:&lt;br /&gt;&lt;pre   style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); line-height: 14px; width: 100%;font-family:Andale Mono,Lucida Console,Monaco,fixed,monospace;font-size:12px;"&gt;&lt;code&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;sudo cp /boot/grub/menu.lst /boot/grub/menu.lst_backup&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;The shell should prompt you for your root password. Once you enter your password, the contents of the file &lt;span style="font-family:courier new;"&gt;menu.lst&lt;/span&gt; will be copied to another file named &lt;span style="font-family:courier new;"&gt;menu.lst_backup&lt;/span&gt;.&lt;br /&gt;Now type:&lt;br /&gt;&lt;pre   style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); line-height: 14px; width: 100%;font-family:Andale Mono,Lucida Console,Monaco,fixed,monospace;font-size:12px;"&gt;&lt;code&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;sudo nano /boot/grub/menu.lst&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt; to take a look at the &lt;span style="font-family:courier new;"&gt;menu.lst&lt;/span&gt; file. I'd imagine the file contents to be something like this.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_O-rOxpu66eY/R_ldfgCUnKI/AAAAAAAAAB4/UjEcXKW8cHk/s1600-h/test.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 204px; height: 118px;" src="http://2.bp.blogspot.com/_O-rOxpu66eY/R_ldfgCUnKI/AAAAAAAAAB4/UjEcXKW8cHk/s320/test.jpg" alt="" id="BLOGGER_PHOTO_ID_5186279241650838690" border="0" /&gt;&lt;/a&gt;Any line in this file that starts with a # symbol is a comment. This means that it will be safely ignored when GRUB reads this file.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;1. Changing the default OS.&lt;/span&gt;&lt;br /&gt;You can change the OS that loads by default in the GRUB menu. In order to do this, first count the entries in the menu starting from zero (not one). Now, locate the line in the &lt;span style="font-family:courier new;"&gt;menu.lst&lt;/span&gt; file that says &lt;span style="font-family:courier new;"&gt;default&amp;lt;space&amp;gt;n&lt;/span&gt; where &lt;span style="font-family:courier new;"&gt;n&lt;/span&gt; is literally a number. Change that number to the entry you want. For example, in order to make the first entry in the list as the default OS to be loaded, change the line in &lt;span style="font-family:courier new;"&gt;menu.lst&lt;/span&gt; to &lt;span style="font-family:courier new;"&gt;default 0&lt;/span&gt;&lt;br /&gt;Save the file and exit the editor by pressing Ctrl+O and Ctrl+X (only for nano). A common mistake that many make is inadvertently change the commented line in the file. If there is a commented line leave it as is.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;2. Changing the timeout.&lt;/span&gt;&lt;br /&gt;Generally, the GRUB menu gives you about five seconds to decide which OS you want to boot. At the end of this time, GRUB automatically boots into the default OS. To change the timeout, simply find the line in &lt;span style="font-family:courier new;"&gt;menu.lst&lt;/span&gt; that says &lt;span style="font-family:courier new;"&gt;timeout&lt;/span&gt; and change it to &lt;span style="font-family:courier new;"&gt;timeout&amp;lt;space&amp;gt;n&lt;/span&gt; where &lt;span style="font-family:courier new;"&gt;n&lt;/span&gt; is the number of seconds you want to set. I usually set this value to 15. Save the file and exit the editor.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;3. Changing the splash image.&lt;/span&gt;&lt;br /&gt;Here's a fun customization that you can do. Most GRUB menu screens are purely black with white text. If you want to change the GRUB menu screen to that of a picture, you can easily do that. Get a nice GRUB splash image from the net. You can find plenty under the BootSplash section on &lt;a href="http://www.kde-look.org/"&gt;http://www.kde-look.org&lt;/a&gt;&lt;br /&gt;The grub splash image file should be something like &lt;span style="font-family:courier new;"&gt;filename.xpm.gz&lt;/span&gt;. If your splash image file is not in the xpm format, then it cannot be loaded by GRUB. Alright, now to set this picture as a grub splash, copy it to &lt;span style="font-family:courier new;"&gt;/boot/grub&lt;/span&gt;. Do the following:&lt;br /&gt;&lt;pre   style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); line-height: 14px; width: 100%;font-family:Andale Mono,Lucida Console,Monaco,fixed,monospace;font-size:12px;"&gt;&lt;code&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;sudo cp &lt;/span&gt;&amp;lt;PATH_TO_IMAGE&amp;gt;&lt;span style="font-family:courier new;"&gt; /boot/grub/bootsplash.xpm.gz&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;where PATH_TO_IMAGE is the logical path to the GRUB bootsplash image file that you intend to use. Now reopen &lt;span style="font-family:courier new;"&gt;menu.lst&lt;/span&gt; with root previleges.&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;sudo nano /boot/grub/menu.lst&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Add a new line to this file (preferably after the initial comments):&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;splashimage /boot/grub/bootsplash.xpm.gz&lt;/span&gt;&lt;br /&gt;Save and exit the editor.&lt;br /&gt;Now everytime you boot your system, you should see the pretty new GRUB splash image instead of that boring dark one!&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;NOTE:&lt;/span&gt; If at any point, you realise that you've messed up your &lt;span style="font-family:courier new;"&gt;menu.lst&lt;/span&gt; file, then just retrieve it from the backup that we had first created.&lt;br /&gt;Type: &lt;pre   style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); line-height: 14px; width: 100%;font-family:Andale Mono,Lucida Console,Monaco,fixed,monospace;font-size:12px;"&gt;&lt;code&gt;&lt;span style="font-family:courier new;"&gt;sudo cp menu.lst_backup menu.lst&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-7638392161499828655?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/7638392161499828655/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=7638392161499828655' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/7638392161499828655'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/7638392161499828655'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2008/04/mess-around-with-your-grub-menu.html' title='Mess around with your GRUB menu'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_O-rOxpu66eY/R_ldfgCUnKI/AAAAAAAAAB4/UjEcXKW8cHk/s72-c/test.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-2580561327587408940</id><published>2008-04-01T14:05:00.000+05:30</published><updated>2009-06-14T01:13:29.116+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='open source'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>Kubuntu 7.10 CD request</title><content type='html'>I feel quite happy today because the Kubuntu Gutsy CD that I requested from &lt;a href="http://www.canonical.com/"&gt;Canonical&lt;/a&gt; has arrived. I requested for the 32-bit version of the CD on the 7th of March and today is April Fool's. So, it totally took little more than three weeks to deliver the CD. I figured that since I lived in India which is quite some distance from the US, I'd at least have to pay for the shipping charges. The truth is that I didn't have to pay a dime, no shipping charges - nothing! A friend of mine told me that he had also got some free Ubuntu stickers along with his CD request. I didn't but that's okay because now &lt;a href="http://angelorohit.blogspot.com/2008/03/more-free-stuff-open-stickers.html"&gt;I can make my own stickers&lt;/a&gt;. :D&lt;br /&gt;&lt;br /&gt;&lt;a href="https://shipit.ubuntu.com/"&gt;https://shipit.ubuntu.com/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-2580561327587408940?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/2580561327587408940/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=2580561327587408940' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/2580561327587408940'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/2580561327587408940'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2008/04/kubuntu-710-cd-request.html' title='Kubuntu 7.10 CD request'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-821716655427192271</id><published>2008-03-26T23:50:00.000+05:30</published><updated>2009-06-14T01:00:13.439+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='open source'/><title type='text'>What is FLOSS?</title><content type='html'>&lt;span style="font-weight: bold;"&gt;FLOSS &lt;/span&gt;stands for &lt;span style="font-weight: bold; font-style: italic;"&gt;Free 'Libre' Open Source Software&lt;/span&gt;. It is a term that is used to represent software that has very limited restrictions on its license. Users of FLOSS are given the right to read and alter its source code. It is important to remember that free software does not mean that the software is free of charge. It means that the software is free from restrictions. Think of it in terms of "free speech" rather than "free food". Of course, there's lots of software out there that can be both. Just imagine a world where you don't have to simply file a bug report on the software that you use and then wait for the manufacturers to get back to you (which could be a very long wait!). Perhaps, if you have the technical knowledge, you could add to the software or call upon others to try and improve it. This would benefit not just you but all other users of that piece of software. Folks used to call such software that is free of restrictions as FOSS without the 'L'. However, this caused some level of ambiguity since it led to the assumption that one did not have to pay for the software. Such a notion would have spelt doom for any business prospects that such software might have. Once the word 'Libre' (meaning Liberty in Spanish or French) was brought in, the meaning became clear. So what FLOSS can you get? Well, apart from your dentist, here's an extensive &lt;a href="http://en.wikipedia.org/wiki/List_of_open_source_software_packages"&gt;list&lt;/a&gt; compiled by Wikipedia. I'm not too much of an activist. So, I wouldn't tell you to get rid of your proprietary (possibly pirated?) software. You probably use free software anyway. If you use &lt;a href="http://www.mozilla.com/en-US/firefox/"&gt;Firefox&lt;/a&gt;, &lt;a href="http://www.videolan.org/vlc/"&gt;VLC&lt;/a&gt; or &lt;a href="http://www.gimp.org/"&gt;Gimp&lt;/a&gt;, then you are already a part of the solution. There are other useful applications that you could use. All it takes is an open mind to make a difference.&lt;br /&gt;&lt;br /&gt;Other important links:-&lt;br /&gt;&lt;a href="http://www.fsf.org/"&gt;Free Software Foundation&lt;/a&gt;&lt;br /&gt;&lt;a href="http://en.wikipedia.org/wiki/List_of_software_licenses#Free_software_licenses"&gt;Info on Free and Non-free Software Licenses&lt;/a&gt;&lt;span style="text-decoration: underline;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;a href="http://makethemove.net/"&gt;Making the Move&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-821716655427192271?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/821716655427192271/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=821716655427192271' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/821716655427192271'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/821716655427192271'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2008/03/what-is-floss.html' title='What is FLOSS?'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-4621239211268078158</id><published>2008-03-17T19:56:00.000+05:30</published><updated>2009-06-14T01:26:17.453+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='c++'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><title type='text'>An introduction to the STL : Priority Queues</title><content type='html'>&lt;span style="font-weight: bold; font-style: italic;font-size:85%;" &gt;&lt;span style="font-family:arial;"&gt;(Reader Level : Beginner)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;(Knowledge assumptions : classes, std::vector, std::string, queues)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;Hello all! This time we're going to look at another STL container - the &lt;span style="font-weight: bold;"&gt;Priority Queue&lt;/span&gt;. You probably know what a queue is but just in case you don't or your memory could use some jogging, here goes... A queue is a &lt;span style="font-weight: bold;"&gt;First In First Out&lt;/span&gt; data structure. It means that the first element you put into the queue is the first one to leave the queue. Think of it as one of those long queues at the supermarket. The sooner you enter the queue, the sooner you can leave. So what is a priority queue? A priority queue is a queue where elements are entered based on their priority. If the wife of the supermarket's Manager had to do some shopping, she might not have to wait in line(hypothetically speaking ;)). She could immediately walk to the front of the queue and check out her purchases. If the Manager's daughter were also present, then she would stand behind the wife because she doesn't get as much importance as the mother but is still more important than the rest of the frustrated patrons. I know, I know. Silly example but hopefully you get the idea. In order to illustrate the beauty of a priority queue let me describe a rather contrived problem. This question was presented to me for a programming competition held at my college university.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;The Problem:&lt;/span&gt; Write a C++ program to accept a list of words from the user. The user must also enter a weight associated with each word. Finally, display the words in decreasing order of their weights.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Solution Attempt #1 : Using a vector:&lt;/span&gt;&lt;br /&gt;The user having to enter words and associated weights is pretty basic stuff. So, I'm not going to write any of that code in order to keep this blog post as short as possible. Here's one possible way to do it with vectors.&lt;br /&gt;&lt;pre   style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); line-height: 12px; width: 100%;font-family:Andale Mono,Lucida Console,Monaco,fixed,monospace;font-size:12px;"&gt;&lt;code&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;#include&lt;/span&gt; &amp;lt;iostream&amp;gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;#include&lt;/span&gt; &amp;lt;string&amp;gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;#include&lt;/span&gt; &amp;lt;vector&amp;gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;#include&lt;/span&gt; &amp;lt;algorithm&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 136, 0);"&gt;//This class encapsulates a word that can be prioritized based on a number.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;class&lt;/span&gt; PrioritizedWord&lt;br /&gt;{&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;private&lt;/span&gt;:&lt;br /&gt; std::string m_word;&lt;br /&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;int&lt;/span&gt; m_priority;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt;:&lt;br /&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;explicit&lt;/span&gt; PrioritizedWord()&lt;br /&gt; {}&lt;br /&gt;&lt;br /&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;explicit&lt;/span&gt; PrioritizedWord(&lt;span style="color: rgb(0, 0, 255);"&gt;const&lt;/span&gt; std::string&amp;amp; word, &lt;span style="color: rgb(0, 0, 255);"&gt;const&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;int&lt;/span&gt; priority = 0) : m_word(word), m_priority(priority)&lt;br /&gt; {}&lt;br /&gt;           &lt;br /&gt; &lt;span style="color: rgb(0, 136, 0);"&gt;//Compares two words. This overloaded operator prioritizes words according to their weight.&lt;/span&gt;&lt;br /&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;const&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;bool&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;operator&lt;/span&gt; &amp;lt;(&lt;span style="color: rgb(0, 0, 255);"&gt;const&lt;/span&gt; PrioritizedWord&amp;amp; pW) &lt;span style="color: rgb(0, 0, 255);"&gt;const&lt;/span&gt;&lt;br /&gt; {&lt;br /&gt;     &lt;span style="color: rgb(0, 0, 255);"&gt;return&lt;/span&gt; (m_priority &amp;lt; pW.m_priority);&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; &lt;span style="color: rgb(0, 136, 0);"&gt;//Overloaded "put to" operator for streaming output.&lt;/span&gt;&lt;br /&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;friend&lt;/span&gt; std::ostream&amp;amp; &lt;span style="color: rgb(0, 0, 255);"&gt;operator&lt;/span&gt; &amp;lt;&amp;lt;(std::ostream&amp;amp; out, &lt;span style="color: rgb(0, 0, 255);"&gt;const&lt;/span&gt; PrioritizedWord&amp;amp; pW)&lt;br /&gt; {&lt;br /&gt;     out&amp;lt;&amp;lt;pW.m_word;&lt;br /&gt;     &lt;span style="color: rgb(0, 0, 255);"&gt;return&lt;/span&gt; out;&lt;br /&gt; }&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;int&lt;/span&gt; main()&lt;br /&gt;{&lt;br /&gt;std::vector&amp;lt;PrioritizedWord&amp;gt;    vWords;&lt;br /&gt;&lt;br /&gt;vWords.push_back(PrioritizedWord(&lt;span style="color: rgb(255, 0, 0);"&gt;"Angelo"&lt;/span&gt;, 23));&lt;br /&gt;vWords.push_back(PrioritizedWord(&lt;span style="color: rgb(255, 0, 0);"&gt;"This"&lt;/span&gt;, -1));&lt;br /&gt;vWords.push_back(PrioritizedWord(&lt;span style="color: rgb(255, 0, 0);"&gt;"Here"&lt;/span&gt;, 51));&lt;br /&gt;vWords.push_back(PrioritizedWord(&lt;span style="color: rgb(255, 0, 0);"&gt;"Was"&lt;/span&gt;, -1));&lt;br /&gt;&lt;br /&gt;std::sort(vWords.begin(), vWords.end());&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;for&lt;/span&gt;(std::vector&amp;lt;PrioritizedWord&amp;gt;::size_type i = 0; i &amp;lt; vWords.size(); ++i)&lt;br /&gt;{&lt;br /&gt; std::cout&amp;lt;&amp;lt;vWords[i];&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;return&lt;/span&gt; 0;&lt;br /&gt;}&lt;/code&gt;&lt;/pre&gt;We are sorting the vector contents using a function named &lt;span style="font-family:courier new;"&gt;sort&lt;/span&gt; that is available in the pre-compiled header &lt;span style="font-family:courier new;"&gt;&amp;lt;algorithm&amp;gt;&lt;/span&gt;. The working of the &lt;span style="font-family:courier new;"&gt;sort&lt;/span&gt; function is beyond the scope of this post but I'll provide a link at the end. Also, note the use of the overloaded less-than operator. We need to overload this operator because the &lt;span style="font-family:courier new;"&gt;sort()&lt;/span&gt; function will compare two &lt;span style="font-family:courier new;"&gt;PrioritizedWord&lt;/span&gt;'s using it. Don't forget the &lt;span style="font-family:courier new;"&gt;const&lt;/span&gt; at the end of the operator definition. &lt;span style="font-family:courier new;"&gt;sort()&lt;/span&gt; expects that our overloaded operator routine will not alter any class member variables. If you forget to be const-correct in this case, the compiler will bite your head off!&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Solution Attempt #2 : Using a priority queue:&lt;/span&gt;&lt;br /&gt;We'll use the same class &lt;span style="font-family:courier new;"&gt;PrioritizedWord&lt;/span&gt; from above. That way my lazy self won't have to do much typing. :D&lt;br /&gt;&lt;pre   style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); line-height: 12px; width: 100%;font-family:Andale Mono,Lucida Console,Monaco,fixed,monospace;font-size:12px;"&gt;&lt;code&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;#include&lt;/span&gt; &amp;lt;iostream&amp;gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;#include&lt;/span&gt; &amp;lt;string&amp;gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;#include&lt;/span&gt; &amp;lt;queue&amp;gt;  &lt;span style="color: rgb(0, 136, 0);"&gt;//Instead of vectors, we now use a queue.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 136, 0);"&gt;//PrioritizedWord Class definition goes here.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;int&lt;/span&gt; main()&lt;br /&gt;{&lt;br /&gt;std::priority_queue&amp;lt;PrioritizedWord&amp;gt;    wordQueue;&lt;br /&gt;&lt;br /&gt;wordQueue.push(PrioritizedWord(&lt;span style="color: rgb(255, 0, 0);"&gt;"Angelo"&lt;/span&gt;, 23));&lt;br /&gt;wordQueue.push(PrioritizedWord(&lt;span style="color: rgb(255, 0, 0);"&gt;"Here"&lt;/span&gt;, 51));&lt;br /&gt;wordQueue.push(PrioritizedWord(&lt;span style="color: rgb(255, 0, 0);"&gt;"Was"&lt;/span&gt;, -1));&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 136, 0);"&gt;//Peek and pop until the priority queue is empty.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;while&lt;/span&gt;(!wordQueue.empty())&lt;br /&gt;{&lt;br /&gt;  std::cout&amp;lt;&amp;lt;wordQueue.top()&amp;lt;&amp;lt;&lt;span style="color: rgb(255, 0, 0);"&gt;" "&lt;/span&gt;;&lt;br /&gt;  wordQueue.pop();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;return&lt;/span&gt; 0;&lt;br /&gt;}&lt;/code&gt;&lt;/pre&gt;Note that this time we didn't have to sort anything because the words were pushed into the queue based on their priority. This means that at the end of our input, the words in the priority queue are already sorted based on their weights. Pretty neat, huh? I'd say that in this case a priority queue leads to more elegant code when compared to using a vector. The stuff that I said earlier about being const-correct with regard to the overloaded less-than operator applies here too. The &lt;span style="font-family:courier new;"&gt;push()&lt;/span&gt; function is the one who actually prioritizes the words. Here are some good links to read up on.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.sgi.com/tech/stl/priority_queue.html"&gt;SGI Documentation on Priority Queues&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.cppreference.com/cpppriority_queue/index.html"&gt;Member functions of STL Priority Queue&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.sgi.com/tech/stl/sort.html"&gt;SGI Documentation on sort algorithm&lt;/a&gt;&lt;br /&gt;Enjoy!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-4621239211268078158?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/4621239211268078158/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=4621239211268078158' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/4621239211268078158'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/4621239211268078158'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2008/03/introduction-to-stl-priority-queues.html' title='An introduction to the STL : Priority Queues'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-2272724297228092228</id><published>2008-03-14T10:18:00.000+05:30</published><updated>2009-06-14T01:12:34.319+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='open source'/><title type='text'>More Free Stuff: Open Stickers</title><content type='html'>Recently, a friend &lt;span style="text-decoration: underline;"&gt;&lt;/span&gt;of mine pointed me to a &lt;a href="http://www.openstickers.com/"&gt;site&lt;/a&gt; that gave free sticker books. You can download them for free, print and use them wherever you like. The theme of the stickers was Open Source. I'm a big supporter of the Open Source philosophy (more on that later). I decided to give my laptop a makeover. Here's what I ended up with:&lt;br /&gt;&lt;div style="text-align: right;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://farm4.static.flickr.com/3087/2331310628_368c450b7e_o.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 187px; height: 102px;" src="http://farm4.static.flickr.com/3087/2331310628_368c450b7e_o.jpg" alt="" border="2" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://farm4.static.flickr.com/3236/2331310630_0f309a7312_o.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 144px; height: 104px;" src="http://farm4.static.flickr.com/3236/2331310630_0f309a7312_o.jpg" alt="" border="2" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://farm3.static.flickr.com/2148/2331310620_1c19a2851e_o.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 150px; height: 132px;" src="http://farm3.static.flickr.com/2148/2331310620_1c19a2851e_o.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://farm3.static.flickr.com/2199/2331310618_9faecac157_o.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 182px; height: 133px;" src="http://farm3.static.flickr.com/2199/2331310618_9faecac157_o.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://farm3.static.flickr.com/2327/2331310624_7eccd94a99_o.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 113px; height: 84px;" src="http://farm3.static.flickr.com/2327/2331310624_7eccd94a99_o.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://farm3.static.flickr.com/2053/2331310622_ab945b0ede_o.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 109px; height: 57px;" src="http://farm3.static.flickr.com/2053/2331310622_ab945b0ede_o.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://farm3.static.flickr.com/2238/2330250265_cb93b2ebbc_o.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 112px; height: 83px;" src="http://farm3.static.flickr.com/2238/2330250265_cb93b2ebbc_o.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;You can get these cool stickers too!&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.openstickers.com/"&gt;&lt;img style="border: medium none ; margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 173px; height: 93px;" src="http://www.openstickers.com/banners/banner1.png" alt="" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-2272724297228092228?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/2272724297228092228/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=2272724297228092228' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/2272724297228092228'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/2272724297228092228'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2008/03/more-free-stuff-open-stickers.html' title='More Free Stuff: Open Stickers'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-5149258297344184893</id><published>2008-03-09T18:56:00.000+05:30</published><updated>2009-06-14T01:12:58.030+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='open source'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><title type='text'>Free Stuff - Code::Blocks new release</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.codeblocks.org/"&gt;&lt;img style="border: medium none ; margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="http://2.bp.blogspot.com/_O-rOxpu66eY/R9P3jgzqW7I/AAAAAAAAABw/6TYnyo8YAFw/s320/Code_Blocks_logo.jpg" alt="" id="BLOGGER_PHOTO_ID_5175752586252934066" border="0" /&gt;&lt;/a&gt;I've been waiting for this for a long time (nearly two years actually). &lt;span style="font-weight: bold;"&gt;Code::Blocks 8.02&lt;/span&gt; is here! I mentioned this free C++ IDE in a previous &lt;a href="http://angelorohit.blogspot.com/2008/01/out-with-old-stuff-teach-new-stuff.html"&gt;post&lt;/a&gt; of mine. At that time, it was called Code::Blocks 1.0 RC2. Now, the developers of Code::Blocks have decided to go with the &lt;a href="http://www.ubuntu.com/"&gt;Ubuntu&lt;/a&gt; style of versioning ie; "Year.Month". I must say that this IDE has begun to show much promise. I find it very intuitive and pretty feature-rich (code profiling, code statistics, code-completion and all that jazz) for something that's completely free. The best part, IMHO, is that Code::Blocks is cross-platform. Earlier, it was easy to download and install this IDE for Windows but when it came to Linux you had to configure it from source. They did have some packages targeting specific distributions but many of the links were broken. Now, the Linux packages have been given a face-lift. They even have a Mac OS X binary on the download page. Spiffy!&lt;br /&gt;Interested? Hop on over and give it a try.&lt;br /&gt;&lt;a href="http://www.codeblocks.org/"&gt;Code::Blocks 8.02 Free C++ IDE&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://farm3.static.flickr.com/2320/2320447905_e271372840_b.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px;" src="http://farm3.static.flickr.com/2320/2320447905_e271372840_b.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;span style="font-weight: bold;font-size:85%;" &gt;Screenshot1:    Building and executing a simple SDL application with Code::Blocks 8.02&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://farm4.static.flickr.com/3018/2321276078_b007731513_o.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px;" src="http://farm4.static.flickr.com/3018/2321276078_b007731513_o.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;span style="font-weight: bold;font-size:85%;" &gt;Screenshot2: An amazing number of project templates for developers from all walks of life.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://farm4.static.flickr.com/3176/2320447907_ce700f1d22_o.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px;" src="http://farm4.static.flickr.com/3176/2320447907_ce700f1d22_o.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;span style="font-weight: bold;font-size:85%;" &gt;Screenshot3: Programming doesn't have to be stressful with the BYO Games tetris plugin. There's one for snake as well.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-5149258297344184893?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/5149258297344184893/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=5149258297344184893' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/5149258297344184893'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/5149258297344184893'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2008/03/free-stuff-codeblocks-new-release.html' title='Free Stuff - Code::Blocks new release'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_O-rOxpu66eY/R9P3jgzqW7I/AAAAAAAAABw/6TYnyo8YAFw/s72-c/Code_Blocks_logo.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-1044655414122314760</id><published>2008-03-08T02:51:00.000+05:30</published><updated>2009-06-14T01:25:08.704+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='c++'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><title type='text'>An introduction to the STL : Maps</title><content type='html'>&lt;span style="font-weight: bold; font-style: italic;font-size:85%;" &gt;&lt;span style="font-family:arial;"&gt;(Reader Level : Beginner)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;(Knowledge assumptions : std::string, std::vector)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;Hello! Today we're going to discuss another popular data structure in the STL - &lt;span style="font-weight: bold;"&gt;Maps&lt;/span&gt;. Maps are basically associative arrays or hash tables where each element consists of a unique key that identifies a particular value. Once a key is stored in the map, then it cannot be changed. Only the value it identifies can be changed. If we want to associate a new key with a value, then the entire element(key + value) must be removed from the map and the new element inserted. To actually see the beauty of maps, let us attempt to solve a simple problem.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;The Problem:&lt;/span&gt; Write a C++ program to find the character with most number of occurrences in a string.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Solution attempt #1 : Using Vectors&lt;/span&gt;&lt;br /&gt;&lt;pre   style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); line-height: 12px; width: 100%;font-family:Andale Mono,Lucida Console,Monaco,fixed,monospace;font-size:12px;"&gt;&lt;code&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;#include&lt;/span&gt; &amp;lt;iostream&amp;gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;#include&lt;/span&gt; &amp;lt;string&amp;gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;#include&lt;/span&gt; &amp;lt;vector&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;const&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;char&lt;/span&gt; VectorMethodOfCounting(&lt;span style="color: rgb(0, 0, 255);"&gt;const&lt;/span&gt; std::string&amp;amp; str)&lt;br /&gt;{&lt;br /&gt;std::vector&amp;lt;&lt;span style="color: rgb(0, 0, 255);"&gt;unsigned&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;int&lt;/span&gt;&amp;gt; vCharCount(26);&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;char&lt;/span&gt; mostUsedChar = &lt;span style="color: rgb(255, 0, 0);"&gt;'\0'&lt;/span&gt;;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;unsigned&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;int&lt;/span&gt; count = 0, currentIndex;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;for&lt;/span&gt;(std::string::size_type i = 0; i &amp;lt; str.length(); ++i)&lt;br /&gt;{&lt;br /&gt;   &lt;span style="color: rgb(0, 136, 0);"&gt;//Calculate the index of this character in the vector.&lt;/span&gt;&lt;br /&gt;   currentIndex = str[i] - &lt;span style="color: rgb(255, 0, 0);"&gt;'a'&lt;/span&gt;;&lt;br /&gt;   ++vCharCount[currentIndex];&lt;br /&gt;&lt;br /&gt;   &lt;span style="color: rgb(0, 0, 255);"&gt;if&lt;/span&gt;(vCharCount[currentIndex] &amp;gt; count)&lt;br /&gt;   {&lt;br /&gt;       mostUsedChar = str[i];&lt;br /&gt;       count = vCharCount[currentIndex];&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;return&lt;/span&gt; mostUsedChar;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;int&lt;/span&gt; main()&lt;br /&gt;{&lt;br /&gt;std::string myString = &lt;span style="color: rgb(255, 0, 0);"&gt;"thebrowncowjumpedoverthemoon"&lt;/span&gt;;&lt;br /&gt;std::cout&amp;lt;&amp;lt;VectorMethodOfCounting(myString);&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;return&lt;/span&gt; 0;&lt;br /&gt;}&lt;/code&gt;&lt;/pre&gt;Basically, what we've done here is create a vector for all twenty-six characters in the english alphabet. This vector will maintain a count of the occurrences of each alphabet in our string. Then, we loop through the characters of the string. As we encounter, each character in the string, we determine its index in the vector by subtracting its ASCII value from that of 'a'. We also maintain a record of the character with the most occurrences till date. When we finish iterating through the string, we return this character.&lt;br /&gt;This solution, of course, works but it has some pretty serious drawbacks. The first shortcoming is that it only works with lowercase strings. If the string were to contain uppercase characters or other special characters like spaces, then the solution fails. We could resize the vector to account for all 256 ASCII characters (or maybe all UNICODE characters) but then that would be wasted space if only a handful of characters were actually present in the string. Also, as we will soon see, this problem could have been solved more elegantly. I especially hate that part where we determined the index of the character in the vector.&lt;br /&gt;&lt;br /&gt;Now, on to maps. If we analyse the problem more closely, we will come to the conclusion that what we really want to do is maintain a count of the number of occurrences for each character in the string. In other words, each unique character in the string is associated with a count. This concept could best be represented with a map where each element consists of a character as the key and an integer as the value. Let's try doing that.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Solution attempt #2 : Using Maps&lt;/span&gt;&lt;br /&gt;&lt;pre   style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); line-height: 12px; width: 100%;font-family:Andale Mono,Lucida Console,Monaco,fixed,monospace;font-size:12px;"&gt;&lt;code&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;#include&lt;/span&gt; &amp;lt;iostream&amp;gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;#include&lt;/span&gt; &amp;lt;string&amp;gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;#include&lt;/span&gt; &amp;lt;map&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;const&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;char&lt;/span&gt; MapMethodOfCounting(&lt;span style="color: rgb(0, 0, 255);"&gt;const&lt;/span&gt; std::string&amp;amp; str)&lt;br /&gt;{&lt;br /&gt;   std::map&amp;lt;&lt;span style="color: rgb(0, 0, 255);"&gt;char&lt;/span&gt;, &lt;span style="color: rgb(0, 0, 255);"&gt;unsigned&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;int&lt;/span&gt;&amp;gt; mapCharCount;&lt;br /&gt;   &lt;span style="color: rgb(0, 0, 255);"&gt;char&lt;/span&gt; mostUsedChar = &lt;span style="color: rgb(255, 0, 0);"&gt;'\0'&lt;/span&gt;;&lt;br /&gt;   &lt;span style="color: rgb(0, 0, 255);"&gt;unsigned&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;int&lt;/span&gt; count = 0;&lt;br /&gt;&lt;br /&gt;   &lt;span style="color: rgb(0, 0, 255);"&gt;for&lt;/span&gt;(std::string::size_type i = 0; i &amp;lt; str.length(); ++i)&lt;br /&gt;   {&lt;br /&gt;       ++mapCharCount[str[i]];&lt;br /&gt;&lt;br /&gt;       &lt;span style="color: rgb(0, 0, 255);"&gt;if&lt;/span&gt;(mapCharCount[str[i]] &amp;gt; count)&lt;br /&gt;       {&lt;br /&gt;           mostUsedChar = str[i];&lt;br /&gt;           count = mapCharCount[str[i]];&lt;br /&gt;       }&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   &lt;span style="color: rgb(0, 0, 255);"&gt;return&lt;/span&gt; mostUsedChar;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;int&lt;/span&gt; main()&lt;br /&gt;{&lt;br /&gt;   std::string myString = &lt;span style="color: rgb(255, 0, 0);"&gt;"thebrowncowjumpedoverthemoon"&lt;/span&gt;;&lt;br /&gt;   std::cout&amp;lt;&amp;lt;MapMethodOfCounting(myString);&lt;br /&gt;&lt;br /&gt;   &lt;span style="color: rgb(0, 0, 255);"&gt;return&lt;/span&gt; 0;&lt;br /&gt;}&lt;/code&gt;&lt;/pre&gt;A little explanation is in order. In order to use maps, we need to include the pre-compiled header "map". The next thing we do is create a map named &lt;span style="font-family:courier new;"&gt;mapCharCount&lt;/span&gt;. The first &lt;span style="font-family:courier new;"&gt;char &lt;/span&gt;in the syntax is the data type of the keys and the &lt;span style="font-family:courier new;"&gt;unsigned int&lt;/span&gt; is the data type of the values. Everything else is pretty much the same with the exception of the indexing. Unlike our vector method, indexing into the map based on the key is easy. Our key is the character &lt;span style="font-family:courier new;"&gt;str[i]&lt;/span&gt;, so we retrieve the value (the count) by &lt;span style="font-family:courier new;"&gt;mapCharCount[str[i]]&lt;/span&gt;. Pure elegance!&lt;br /&gt;&lt;br /&gt;There's more to maps than meets the eye. For more information on maps, feel free to read up on the following links:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.sgi.com/tech/stl/Map.html"&gt;SGI Documentation on Maps&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.cppreference.com/cppmap/index.html"&gt;Member functions of STL Map&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;In my next post, I'll talk about another STL container - The Priority Queue.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-1044655414122314760?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/1044655414122314760/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=1044655414122314760' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/1044655414122314760'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/1044655414122314760'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2008/03/introduction-to-stl-maps.html' title='An introduction to the STL : Maps'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-5744496072590091289</id><published>2008-03-03T19:22:00.000+05:30</published><updated>2009-06-14T01:25:08.705+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='c++'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><title type='text'>An introduction to the STL : Vectors</title><content type='html'>&lt;span style="font-weight: bold; font-style: italic;font-size:85%;" &gt;&lt;span style="font-family:arial;"&gt;(Reader Level : Beginner)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;(Knowledge assumptions : Arrays)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;Today I'm going to cover a pretty basic standard library provision that I feel every C++ programmer should know about - Standard Template Library &lt;span style="font-weight: bold;"&gt;Vectors&lt;/span&gt;. Vectors (don't mind the wierd sounding name) are similar to C-style arrays but with more safety. Whenever I explain a concept, I prefer to illustrate what I mean with some code. Let's first try to create a one-dimensional C-style array of type int:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 12px; width: 100%;"&gt;&lt;code&gt;&lt;span style="color:#0000ff;"&gt;#include&lt;/span&gt; &amp;lt;iostream&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;int&lt;/span&gt; main()&lt;br /&gt;{&lt;br /&gt;    &lt;span style="color:#0000ff;"&gt;int&lt;/span&gt; myArray[3];&lt;br /&gt;&lt;br /&gt;    myArray[0] = 10;&lt;br /&gt;    myArray[1] = 20;&lt;br /&gt;    myArray[2] = 30;&lt;br /&gt;    &lt;span style="color:#008800;"&gt;//myArray[3] = 40;    //Can't add any more.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;    &lt;span style="color:#0000ff;"&gt;for&lt;/span&gt;(&lt;span style="color:#0000ff;"&gt;int&lt;/span&gt; i = 0; i &amp;lt; 4; ++i)  &lt;span style="color:#008800;"&gt;//Out of bounds!&lt;/span&gt;&lt;br /&gt;    {&lt;br /&gt;        std::cout&amp;lt;&amp;lt;myArray[i]&amp;lt;&amp;lt;std::endl;&lt;br /&gt;    }&lt;br /&gt;   &lt;br /&gt;    &lt;span style="color:#0000ff;"&gt;return&lt;/span&gt; 0;&lt;br /&gt;}&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;One of the biggest drawbacks of C-style arrays is that the dimension(s) of an array must be known at the time of declaration. This generally leads to wastage of allocated space. In our example, we can't add more than 3 integers to the array because we've already decided on its maximum size at compile time.&lt;br /&gt;Another shortcoming of arrays is that its very easy to trip up and access beyond the bounds of an array. In our example, we inadvertently tried to print the value of &lt;span style="font-family:courier new;"&gt;myArray[3]&lt;/span&gt; simply because its quite hard to remember a hard-coded dimension. Of course, there's lots of other ways by which an out-of-bounds access can happen but we'll just stick to the basics for the time being.&lt;br /&gt;&lt;br /&gt;Alright then, let's rewrite the exact same code as above, only this time we'll use Vectors.&lt;br /&gt;&lt;pre   style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); line-height: 12px; width: 100%;font-family:Andale Mono,Lucida Console,Monaco,fixed,monospace;font-size:12px;"&gt;&lt;code&gt;&lt;span style="color: rgb(0, 0, 255);font-family:courier new;" &gt;#include&lt;/span&gt;&lt;span style="font-family:courier new;"&gt; &amp;lt;iostream&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);font-family:courier new;" &gt;#include&lt;/span&gt;&lt;span style="font-family:courier new;"&gt; &amp;lt;vector&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);font-family:courier new;" &gt;int&lt;/span&gt;&lt;span style="font-family:courier new;"&gt; main()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    std::vector&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);font-family:courier new;" &gt;int&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&amp;gt; myVector;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    myVector.push_back(10);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    myVector.push_back(20);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    myVector.push_back(30);  &lt;/span&gt;&lt;span style="color: rgb(0, 136, 0);font-family:courier new;" &gt;//Add some more if you like. :)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);font-family:courier new;" &gt;    for&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;(&lt;/span&gt;&lt;span style="font-family:courier new,mon;"&gt;std::vector&amp;lt;int&amp;gt;::size_type&lt;/span&gt;&lt;span style="font-family:courier new;"&gt; i = 0; i &amp;lt; myVector.size(); ++i)  &lt;/span&gt;&lt;span style="color: rgb(0, 136, 0);font-family:courier new;" &gt;//Safer...&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;        std::cout&amp;lt;&amp;lt;myVector[i];&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    }&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);font-family:courier new;" &gt;    return&lt;/span&gt;&lt;span style="font-family:courier new;"&gt; 0;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;At the top we include the pre-compiled header file for using vectors. In &lt;span style="font-family:courier new;"&gt;main()&lt;/span&gt;, we declare a vector of integers called &lt;span style="font-family:courier new;"&gt;myVector&lt;/span&gt;. By default, the initial size of &lt;span style="font-family:courier new;"&gt;myVector &lt;/span&gt;will be zero which means that there is no memory allocated for it. Note that, vectors are also named within the &lt;span style="font-family:georgia;"&gt;std &lt;/span&gt;namespace just as &lt;span style="font-family:courier new;"&gt;cout &lt;/span&gt;is. After we declare the vector, we then add data to this vector using a function named &lt;span style="font-family:courier new;"&gt;push_back()&lt;/span&gt;. Since this is an integer vector, we push integers into the vector. This means that at the end of the three pushes, our vector will be as follows:&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;myVector[0] = 10;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;myVector[1] = 20;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;myVector[2] = 30;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;However, we couldn't just substitute these statements in place of the three &lt;span style="font-family:courier new;"&gt;push_back()&lt;/span&gt; function calls. Why? Remember that the size of &lt;span style="font-family:courier new;"&gt;myVector&lt;/span&gt; was zero when we declared it. So, trying to access an element of the vector through an index will lead to an out-of-bounds access. Finally, we iterate through all the elements in the vector and display the value of each element. The function&lt;span style="font-family:courier new;"&gt; size()&lt;/span&gt; gives us the number of elements in the vector. So, there's no way we could iterate beyond the bounds of the vector. Now you may ask, what's with that wierd data type with which the variable 'i' was declared? It's nothing but a defined type that is implementation specific for vectors. Since we are iterating over the elements of the vector based on its size, the maximum value of the variable i can be the maximum size for any vector.&lt;br /&gt;&lt;br /&gt;There are lots of other cool things one could easily do with vectors. For example, you could resize a vector(doing that with an array would be a major headache) or clear the contents of the vector in one go. Unfortunately, all those cool things are beyond the scope of this measly blog post. The following links should help you get started on STL Vectors:&lt;br /&gt;&lt;a href="http://www.codeguru.com/cpp/cpp/cpp_mfc/stl/article.php/c4027/"&gt;A Beginner's Tutorial For std::vector, Part 1&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.cppreference.com/cppvector/index.html"&gt;Member functions of STL Vector&lt;/a&gt;&lt;br /&gt;In my next post, I hope to introduce you to another useful STL container.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-5744496072590091289?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/5744496072590091289/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=5744496072590091289' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/5744496072590091289'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/5744496072590091289'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2008/03/introduction-to-stl-vectors.html' title='An introduction to the STL : Vectors'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-1052998132930820516</id><published>2008-02-27T04:26:00.000+05:30</published><updated>2009-06-14T01:25:08.705+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='c++'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><title type='text'>const pointers and typedef</title><content type='html'>&lt;span style="font-weight: bold; font-style: italic;font-size:85%;" &gt;&lt;span style="font-family:arial;"&gt;(Reader Level : Beginner)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;(Knowledge assumptions : Pointers, typedef, std::vector...)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;Sometimes we create our own types using the &lt;span style="font-weight: bold;font-family:courier new;" &gt;typedef&lt;/span&gt; keyword in C++. For eg;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255); font-weight: bold;font-family:courier new;" &gt;typedef&lt;/span&gt;&lt;span style="font-weight: bold;font-family:courier new;" &gt; std::vector&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255); font-weight: bold;font-family:courier new;" &gt;int&lt;/span&gt;&lt;span style="font-weight: bold;font-family:courier new;" &gt;&amp;gt; INTVECTOR;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;If we write                     : &lt;span style="color: rgb(0, 0, 255); font-weight: bold;font-family:courier new;" &gt;const&lt;/span&gt;&lt;span style="font-weight: bold;font-family:courier new;" &gt; INTVECTOR myVector;&lt;/span&gt;&lt;br /&gt;It is the same as               :&lt;span style="font-weight: bold;font-family:courier new;" &gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255); font-weight: bold;font-family:courier new;" &gt;const&lt;/span&gt;&lt;span style="font-weight: bold;font-family:courier new;" &gt; std::vector&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255); font-weight: bold;font-family:courier new;" &gt;int&lt;/span&gt;&lt;span style="font-weight: bold;font-family:courier new;" &gt;&amp;gt; myVector;&lt;/span&gt;&lt;br /&gt;This means that the type (in this case, a vector of ints) itself is constant and we can't do stuff like this:&lt;br /&gt;&lt;span style="font-weight: bold;font-family:courier new;" &gt;myVector.push_back(10);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Let's look at a typedef for a pointer.&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255); font-weight: bold;font-family:courier new;" &gt;typedef&lt;/span&gt;&lt;span style="font-weight: bold;font-family:courier new;" &gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255); font-weight: bold;font-family:courier new;" &gt;int&lt;/span&gt;&lt;span style="font-weight: bold;font-family:courier new;" &gt;* INTPTR&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;If we write   : &lt;span style="color: rgb(0, 0, 255); font-weight: bold;font-family:courier new;" &gt;const&lt;/span&gt;&lt;span style="font-weight: bold;font-family:courier new;" &gt; INTPTR pInt;&lt;/span&gt;&lt;br /&gt;Is it equivalent to writing? : &lt;span style="color: rgb(0, 0, 255); font-weight: bold;font-family:courier new;" &gt;const&lt;/span&gt;&lt;span style="font-weight: bold;font-family:courier new;" &gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255); font-weight: bold;font-family:courier new;" &gt;int&lt;/span&gt;&lt;span style="font-weight: bold;font-family:courier new;" &gt;* pInt;&lt;/span&gt;&lt;br /&gt;To answer that we need to think about what these two statements syntactically mean.&lt;br /&gt;&lt;br /&gt;In the former statement, we are saying that the type (in this case, the integer pointer) itself is constant and that we can't change it in anyway. That statement prevents us from doing stuff like this:&lt;span style="font-family:courier new;"&gt; &lt;span style="font-weight: bold;"&gt;pInt++;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In the second statement, we are informing the compiler that the value that the pointer "points" to is constant.&lt;br /&gt;That means we CAN do : &lt;span style="font-weight: bold;font-family:courier new;" &gt;pInt++;&lt;/span&gt;&lt;br /&gt;But we can't do  : &lt;span style="font-weight: bold;font-family:courier new;" &gt;*pInt = 20;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In other words,&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255); font-weight: bold;font-family:courier new;" &gt;const&lt;/span&gt;&lt;span style="font-weight: bold;font-family:courier new;" &gt; INTPTR pInt;&lt;/span&gt; is equivalent to &lt;span style="color: rgb(0, 0, 255); font-weight: bold;font-family:courier new;" &gt;int&lt;/span&gt;&lt;span style="font-weight: bold;font-family:courier new;" &gt;* &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255); font-weight: bold;font-family:courier new;" &gt;const&lt;/span&gt;&lt;span style="font-weight: bold;font-family:courier new;" &gt; pInt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-1052998132930820516?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/1052998132930820516/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=1052998132930820516' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/1052998132930820516'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/1052998132930820516'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2008/02/const-pointers-and-typedef.html' title='const pointers and typedef'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-5185651916384336662</id><published>2008-02-25T09:21:00.000+05:30</published><updated>2009-06-14T01:25:08.706+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='c++'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><title type='text'>Defining a user-defined type within a templated class definition</title><content type='html'>&lt;span style="font-weight: bold; font-style: italic;font-size:85%;" &gt;&lt;span style="font-family:arial;"&gt;(Reader Level : Intermediate)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;(Knowledge assumptions : Classes, Templates, Structures...)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;Ever tried declaring a class, structure, array or an enum within a templated class? Perhaps, the code could be something like this:&lt;br /&gt;&lt;pre   style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); line-height: 14px; width: 100%;font-family:Andale Mono,Lucida Console,Monaco,fixed,monospace;font-size:12px;"&gt;&lt;code&gt;&lt;span style="color: rgb(0, 0, 255);font-family:courier new;" &gt;template&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);font-family:courier new;" &gt;class&lt;/span&gt;&lt;span style="font-family:courier new;"&gt; T&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);font-family:courier new;" &gt;class&lt;/span&gt;&lt;span style="font-family:courier new;"&gt; MyClass&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);font-family:courier new;" &gt;public&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;:&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);font-family:courier new;" &gt;    struct&lt;/span&gt;&lt;span style="font-family:courier new;"&gt; MyStruct&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;        T m_d1, m_d2, m_d3;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    };&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);font-family:courier new;" &gt;    const&lt;/span&gt;&lt;span style="font-family:courier new;"&gt; MyStruct&amp;amp; GetStructure() &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);font-family:courier new;" &gt;const&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);font-family:courier new;" &gt;private&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    MyStruct m_struct;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;};&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);font-family:courier new;" &gt;template&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);font-family:courier new;" &gt;class&lt;/span&gt;&lt;span style="font-family:courier new;"&gt; T&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);font-family:courier new;" &gt;const&lt;/span&gt;&lt;span style="font-family:courier new;"&gt; MyClass&amp;lt;T&amp;gt;::MyStruct&amp;amp; MyClass&amp;lt;T&amp;gt;::GetStructure() &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);font-family:courier new;" &gt;const&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);font-family:courier new;" &gt;    return&lt;/span&gt;&lt;span style="font-family:courier new;"&gt; m_struct;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-family:courier new;"&gt;MyStruct&lt;/span&gt; &lt;/span&gt;is not a general-purpose structure. It's used primarily for &lt;span style="font-size:100%;"&gt;&lt;span style="font-family:courier new;"&gt;MyClass&lt;/span&gt;. &lt;/span&gt;So, it makes sense to scope it within &lt;span style="font-family:courier new;"&gt;MyClass &lt;/span&gt;itself. However, this code will not compile. The following errors were reported by the Microsoft Visual Studio 2005 compiler.&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;warning: 'MyClass&lt;t&gt;::MyStruct' : dependent name is not a type&lt;/t&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;error: syntax error : missing ';' before '&amp;amp;'&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;error: missing type specifier - int assumed. Note: C++ does not support default-int&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;fatal error: unable to recover from previous error(s); stopping compilation&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Clearly the cause of this lies in the fact that the compiler can't discern the type of &lt;span style="font-size:100%;"&gt;&lt;span style="font-family:courier new;"&gt;MyStruct &lt;/span&gt;&lt;/span&gt;in the &lt;span style="font-size:100%;"&gt;&lt;span style="font-family:courier new;"&gt;GetStructure()&lt;/span&gt;&lt;/span&gt; definition. A look at the standards provides the solution. The relevant citation is from &lt;span style="font-weight: bold;"&gt;Section 14.6&lt;/span&gt;:&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;font-family:arial;" &gt;"When a qualified-id is intended to refer to a type that is not a member of the current instantiation (14.6.2.1) and its nested-name-specifier depends on a template-parameter (14.6.2), it shall be prefixed by the keyword typename, forming a typename-specifier."&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;The revised &lt;span style="font-size:100%;"&gt;&lt;span style="font-family:courier new;"&gt;GetStructure()&lt;/span&gt;&lt;/span&gt; definition for &lt;span style="font-size:100%;"&gt;&lt;span style="font-family:courier new;"&gt;MyClass &lt;/span&gt;&lt;/span&gt;should be as follows:&lt;br /&gt;&lt;pre   style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); line-height: 14px; width: 100%;font-family:Andale Mono,Lucida Console,Monaco,fixed,monospace;font-size:12px;"&gt;&lt;code&gt;&lt;span style="color: rgb(0, 0, 255);font-family:courier new;" &gt;template&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);font-family:courier new;" &gt;class&lt;/span&gt;&lt;span style="font-family:courier new;"&gt; T&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);font-family:courier new;" &gt;const&lt;/span&gt;&lt;span style="font-family:courier new;"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255); font-weight: bold;font-family:courier new;" &gt;typename&lt;/span&gt;&lt;span style="font-family:courier new;"&gt; MyClass&amp;lt;T&amp;gt;::MyStruct&amp;amp; MyClass&amp;lt;T&amp;gt;::GetStructure() &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);font-family:courier new;" &gt;const&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;           &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);font-family:courier new;" &gt;return&lt;/span&gt;&lt;span style="font-family:courier new;"&gt; m_struct;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-5185651916384336662?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/5185651916384336662/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=5185651916384336662' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/5185651916384336662'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/5185651916384336662'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2008/02/defining-user-defined-type-within.html' title='Defining a user-defined type within a templated class definition'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-277481105884454095</id><published>2008-02-12T01:42:00.000+05:30</published><updated>2009-06-14T01:25:08.706+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='c++'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><title type='text'>The Pimpl pattern</title><content type='html'>&lt;span style="font-weight: bold; font-style: italic;font-size:85%;" &gt;&lt;span style="font-family:arial;"&gt;(Reader Level : Beginner)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;(Knowledge assumptions : Classes, Pointers...)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;The &lt;strong&gt;Private Implementation (Pimpl)&lt;/strong&gt; pattern allows the implementation of a whole interface without the need to recompile the modules which use it. As with most design patterns, this pattern can best be explained with an example. Let's say that we have a class named Student. Our Student class is very popular in our project because many other classes use it. The header file of the Student class, "Student.h" may be as follows:&lt;br /&gt;&lt;pre   style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); line-height: 14px; width: 100%;font-family:Andale Mono,Lucida Console,Monaco,fixed,monospace;font-size:12px;"&gt;&lt;code&gt;&lt;span style="color: rgb(0, 0, 255);font-family:courier new;" &gt;#ifndef&lt;/span&gt;&lt;span style="font-family:courier new;"&gt; STUDENT_HEADER&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);font-family:courier new;" &gt;#define&lt;/span&gt;&lt;span style="font-family:courier new;"&gt; STUDENT_HEADER&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);font-family:courier new;" &gt;#include&lt;/span&gt;&lt;span style="font-family:courier new;"&gt; &amp;lt;string&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);font-family:courier new;" &gt;class&lt;/span&gt;&lt;span style="font-family:courier new;"&gt; Student&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);font-family:courier new;" &gt;private&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    std::string m_name;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;};&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);font-family:courier new;" &gt;#endif&lt;br /&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;We may have many classes that contain instances of Student. For example, a Subject class may have an aggregation of Students. So, each of the classes that contain Student(s) would probably have to include "Student.h". Now let's say that at some point in time, colleges allow students to carry mobile phones freely (I know that's not likely. :D). Now, our Student will have a contact number that we might want to record. Professors already had mobiles all along. So, let's say that we already have a class named ContactNo that stores all types of numbers, be they Landline, Mobile or Pagers. "Student.h" becomes...&lt;br /&gt;&lt;pre   style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); line-height: 14px; width: 100%;font-family:Andale Mono,Lucida Console,Monaco,fixed,monospace;font-size:12px;"&gt;&lt;code&gt;&lt;span style="color: rgb(0, 0, 255);font-family:courier new;" &gt;#ifndef&lt;/span&gt;&lt;span style="font-family:courier new;"&gt; STUDENT_HEADER&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);font-family:courier new;" &gt;#define&lt;/span&gt;&lt;span style="font-family:courier new;"&gt; STUDENT_HEADER&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);font-family:courier new;" &gt;#include&lt;/span&gt;&lt;span style="font-family:courier new;"&gt; &amp;lt;string&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);font-family:courier new;" &gt;#include&lt;/span&gt;&lt;span style="font-family:courier new;"&gt; &lt;/span&gt;&lt;span style="color: rgb(204, 0, 0);font-family:courier new;" &gt;"ContactNo.h"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);font-family:courier new;" &gt;class&lt;/span&gt;&lt;span style="font-family:courier new;"&gt; Student&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);font-family:courier new;" &gt;private&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    std::string m_name;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    ContactNo m_contactNo;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;};&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);font-family:courier new;" &gt;#endif&lt;br /&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;After making the relevant changes, we need to do a full re-compile of the source. To our dismay, we might find that the compile time has become unbearably long. Why? It's because we included "Contact.h" in our popular "Student.h". With that one simple change, the header files of all the classes that used to just include "Student.h" will now also include "Contact.h". If our Student was that popular, then this might mean a lot of unnecessary inclusions. To add insult to injury, the contact number of the Student might never even be used by many classes. For example, our Subject class would have no reason to know the contact number of the Students who take that subject. That's why m_contactNo is a private member of Student. You might think that the entire situation is a bit contrived but I assure you its not and there can be situations where you might desperately be seeking a way to reduce compile times, especially in the case of large projects. This is where the &lt;strong&gt;Pimpl&lt;/strong&gt; pattern comes in. Basically, what we need to somehow achieve is the removal of "ContactNo.h" from "Student.h". What we do is take the private implementation of the class (in our case, m_contactNo of Student) and pack it into a simple internal structure. A pointer to this structure, called an&lt;strong&gt; opaque pointer&lt;/strong&gt; or &lt;strong&gt;d-pointer&lt;/strong&gt; is then made a private member of the class. We also need to take care of dynamically creating and destroying the implementation structure for every object of the wrapping class.&lt;br /&gt;&lt;br /&gt;This is then our "Student.h" file with the Pimpl pattern.&lt;br /&gt;&lt;pre   style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); line-height: 14px; width: 100%;font-family:Andale Mono,Lucida Console,Monaco,fixed,monospace;font-size:12px;"&gt;&lt;code&gt;&lt;span style="color: rgb(0, 0, 255);font-family:courier new;" &gt;#ifndef&lt;/span&gt;&lt;span style="font-family:courier new;"&gt; STUDENT_HEADER&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);font-family:courier new;" &gt;#define&lt;/span&gt;&lt;span style="font-family:courier new;"&gt; STUDENT_HEADER&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);font-family:courier new;" &gt;#include&lt;/span&gt;&lt;span style="font-family:courier new;"&gt; &amp;lt;string&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);font-family:courier new;" &gt;class&lt;/span&gt;&lt;span style="font-family:courier new;"&gt; Student&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);font-family:courier new;" &gt;private&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    std::string m_name;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);font-family:courier new;" &gt;    struct&lt;/span&gt;&lt;span style="font-family:courier new;"&gt; PIMPL; &lt;/span&gt;&lt;span style="color: rgb(0, 136, 0);font-family:courier new;" &gt;//Forward declaration.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    PIMPL* pimpl; &lt;/span&gt;&lt;span style="color: rgb(0, 136, 0);font-family:courier new;" &gt;//The opaque pointer.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);font-family:courier new;" &gt;public&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    Student();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    ~Student();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;};&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);font-family:courier new;" &gt;#endif&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Our "Student.cpp" file could be:&lt;br /&gt;&lt;pre   style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); line-height: 14px; width: 100%;font-family:Andale Mono,Lucida Console,Monaco,fixed,monospace;font-size:12px;"&gt;&lt;code&gt;&lt;span style="color: rgb(0, 0, 255);font-family:courier new;" &gt;#include&lt;/span&gt;&lt;span style="font-family:courier new;"&gt; &lt;/span&gt;&lt;span style="color: rgb(204, 0, 0);font-family:courier new;" &gt;"Student.h"&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);font-family:courier new;" &gt;#include&lt;/span&gt;&lt;span style="font-family:courier new;"&gt; &lt;/span&gt;&lt;span style="color: rgb(204, 0, 0);font-family:courier new;" &gt;"ContactNo.h"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 136, 0);font-family:courier new;" &gt;//Private Implementation structure.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);font-family:courier new;" &gt;struct&lt;/span&gt;&lt;span style="font-family:courier new;"&gt; Student::PIMPL&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    ContactNo m_contactNo;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;};&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;Student::Student()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    pimpl = &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);font-family:courier new;" &gt;new&lt;/span&gt;&lt;span style="font-family:courier new;"&gt; PIMPL;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;Student::~Student()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);font-family:courier new;" &gt;    if&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;(pimpl)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);font-family:courier new;" &gt;        delete&lt;/span&gt;&lt;span style="font-family:courier new;"&gt; pimpl;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;If we want to access the contact number of the student internally we do it as &lt;span&gt;pimpl-&amp;gt;m_contactNo&lt;/span&gt;. Now that we've seen how useful the Pimpl pattern can be, let's talk about its downside. By using the Pimpl pattern, our code has become a little more complex (less readable anyway) and we've also got to do a dynamic allocation for every instance of Student that is created. For large objects with relatively fewer instances, this probably won't be an issue but for small objects with several instances, Pimpl may not fit the bill.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-277481105884454095?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/277481105884454095/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=277481105884454095' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/277481105884454095'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/277481105884454095'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2008/02/reducing-compile-times-in-large-c.html' title='The Pimpl pattern'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-1454314277193831723</id><published>2008-01-23T20:36:00.000+05:30</published><updated>2009-06-14T01:11:46.702+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='comics'/><title type='text'>The stuff Superheroes are made of - Video3.</title><content type='html'>And let's wrap it up with the final video. I got the entire series from the Marvel Comics website. I'm sure they'll soon have more videos like these... So you could always check back there.&lt;br /&gt;&lt;embed src="http://services.brightcove.com/services/viewer/federated_f8/271543564" bgcolor="#FFFFFF" flashvars="videoId=1381640623&amp;amp;playerId=271543564&amp;amp;viewerSecureGatewayURL=https://services.brightcove.com/services/amfgateway&amp;amp;servicesURL=http://services.brightcove.com/services&amp;amp;cdnURL=http://admin.brightcove.com&amp;amp;domain=embed&amp;amp;autoStart=false&amp;amp;" base="http://admin.brightcove.com" name="flashObj" seamlesstabbing="false" type="application/x-shockwave-flash" swliveconnect="true" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" height="412" width="486"&gt;&lt;/embed&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-1454314277193831723?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/1454314277193831723/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=1454314277193831723' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/1454314277193831723'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/1454314277193831723'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2008/01/stuff-superheroes-are-made-of-video3.html' title='The stuff Superheroes are made of - Video3.'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-4645921870063912522</id><published>2008-01-23T20:35:00.000+05:30</published><updated>2009-06-14T01:11:46.703+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='comics'/><title type='text'>The stuff Superheroes are made of - Video2.</title><content type='html'>Here's the second video of Iron Man's Adventure.&lt;br /&gt;&lt;embed src="http://services.brightcove.com/services/viewer/federated_f8/271543564" bgcolor="#FFFFFF" flashvars="videoId=1373327747&amp;amp;playerId=271543564&amp;amp;viewerSecureGatewayURL=https://services.brightcove.com/services/amfgateway&amp;amp;servicesURL=http://services.brightcove.com/services&amp;amp;cdnURL=http://admin.brightcove.com&amp;amp;domain=embed&amp;amp;autoStart=false&amp;amp;" base="http://admin.brightcove.com" name="flashObj" seamlesstabbing="false" type="application/x-shockwave-flash" swliveconnect="true" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" height="412" width="486"&gt;&lt;/embed&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-4645921870063912522?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/4645921870063912522/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=4645921870063912522' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/4645921870063912522'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/4645921870063912522'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2008/01/stuff-superheroes-are-made-of-video2.html' title='The stuff Superheroes are made of - Video2.'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-1089460061720670905</id><published>2008-01-23T20:28:00.000+05:30</published><updated>2009-06-14T01:11:46.703+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='comics'/><title type='text'>The stuff Superheroes are made of - Video1.</title><content type='html'>I'm a great fan of both the Marvel and DC Comic universes. Here are three great videos that might satiate your appetite (or probably not...)&lt;br /&gt;&lt;embed src="http://services.brightcove.com/services/viewer/federated_f8/271543564" bgcolor="#FFFFFF" flashvars="videoId=1364171698&amp;amp;playerId=271543564&amp;amp;viewerSecureGatewayURL=https://services.brightcove.com/services/amfgateway&amp;amp;servicesURL=http://services.brightcove.com/services&amp;amp;cdnURL=http://admin.brightcove.com&amp;amp;domain=embed&amp;amp;autoStart=false&amp;amp;" base="http://admin.brightcove.com" name="flashObj" seamlesstabbing="false" type="application/x-shockwave-flash" swliveconnect="true" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" height="412" width="486"&gt;&lt;/embed&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-1089460061720670905?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/1089460061720670905/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=1089460061720670905' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/1089460061720670905'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/1089460061720670905'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2008/01/stuff-superheroes-are-made-of-video1.html' title='The stuff Superheroes are made of - Video1.'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-6838232405214136782</id><published>2008-01-20T20:57:00.000+05:30</published><updated>2009-06-14T01:01:25.489+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='music'/><title type='text'>Album recommendation - The Goo Goo Dolls</title><content type='html'>Music is a funny thing...Normally, you go out and buy an album because you like one particular song that's been playing over and over on VH1. When you do buy the album, you realise that the rest of the tracks suck (not always). After a little while, even the song that you really liked isn't so nice anymore because its been done to death on TV. That's why its always a good idea to do a little background check on music. There are lots of sites out there that let you preview a 30 seconds of each track before you buy the album. Use this feature. You'll be able to make a better decision. Unless you're a die-hard fan of the artist, always make sure that the tracks measure up to your taste in music. &lt;br /&gt;&lt;br /&gt; That said, I have an album recommendation to make. If there's anyone out there who's into Alternative Rock, give &lt;a href="http://en.wikipedia.org/wiki/Goo_Goo_Dolls"&gt;The Goo Goo Dolls&lt;/a&gt; a listen. I really love this band and one of my favourite albums is &lt;a href="http://www.amazon.com/Let-Love-Goo-Dolls/dp/B000EGDC82"&gt;Let Love In&lt;/a&gt;. I'm not going to write a review on any of the songs simply because one man's symphony is another man's cacophony.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-6838232405214136782?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/6838232405214136782/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=6838232405214136782' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/6838232405214136782'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/6838232405214136782'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2008/01/album-recommendation-goo-goo-dolls.html' title='Album recommendation - The Goo Goo Dolls'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-314095869647848036</id><published>2008-01-13T08:30:00.001+05:30</published><updated>2009-06-14T01:25:08.707+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='c++'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><title type='text'>MI isn't Mission Impossible</title><content type='html'>I don't want to start a war of ideas on whether Multiple Inheritance is a good thing or not. I know several good programmers who can't get along without multiple inheritance and there are other smart people who feel that multiple inheritance is detrimental to their work. At the end of the day, it comes down to the simple truth that multiple inheritance is not evil in itself, its the way you use it. Sure, it can trip you up in ways you never thought of before but it can also be a very powerful language feature that makes code more elegant and reusable. A while back, I wrote an article on the common "gotchas" with multiple inheritance in C++ and submitted it to &lt;a href="http://www.codeguru.com/"&gt;Codeguru&lt;/a&gt;. Please feel free to read the article &lt;a href="http://www.codeguru.com/cpp/cpp/string/general/article.php/c13005/"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-314095869647848036?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/314095869647848036/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=314095869647848036' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/314095869647848036'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/314095869647848036'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2008/01/mi-isnt-mission-impossible.html' title='MI isn&apos;t Mission Impossible'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-4057067233557177434</id><published>2008-01-09T00:12:00.002+05:30</published><updated>2009-06-14T01:25:08.707+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='c++'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='windows'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='rants'/><title type='text'>Out with the old stuff, Teach the new stuff</title><content type='html'>I've always wanted to talk about coding in schools, especially C++. I see many schools and colleges that portray to teach C++, but in reality teach the C-style of coding. I find this approach unacceptable. For example, many courses (even MCA) talk about character arrays when in reality the syllabus should be dealing with std::string. As if that weren't bad enough...&lt;br /&gt;&lt;br /&gt;I've also noticed that many educational institutions use archaic compilers for C++ coding. This, in my opinion, is infinitely worse. Even if a student wanted to code correctly, he would not be able to do so. The most commonly used C/C++ compiler is Borland's Turbo C++ 3.0 compiler. This compiler does not conform to the C++ '98 standard. A very simple example of this is the boolean data type which the standards approve of but Turbo C++ does not support it. The truth is that Turbo C++ is an obsolete compiler and Borland themselves do not work on it anymore. Continuing to use such a compiler will ensure that you never learn anything that is industry standard. There are quite a few non-commercial compilers that are standards compliant.&lt;br /&gt;1. &lt;a href="http://www.mingw.org/"&gt;&lt;span style="font-weight: bold;"&gt;The MinGW (Minimalistic GNU for Windows)&lt;/span&gt;&lt;/a&gt; compiler for Windows.&lt;br /&gt;2. &lt;a href="http://gcc.gnu.org/"&gt;&lt;span style="font-weight: bold;"&gt;GCC (GNU Compiler Collection)&lt;/span&gt;&lt;/a&gt; for almost every platform.&lt;br /&gt;&lt;br /&gt;If you are a student and don't want the hassle of bothering to download and configure a particular compiler for your IDE, then I recommend these IDEs:&lt;br /&gt;1. &lt;span style="font-weight: bold;"&gt;&lt;a href="http://www.microsoft.com/express/"&gt;Microsoft Visual Studio Express Edition&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;Its the most professional free IDE out there. Of course, it only works under Windows and comes with the Microsoft Compiler.&lt;br /&gt;2. &lt;a href="http://www.codeblocks.org/"&gt;&lt;span style="font-weight: bold;"&gt;Code::Blocks&lt;br /&gt;&lt;/span&gt;&lt;/a&gt;I really love this IDE and the best part is that it works on Windows, Linux and now even the Mac OS. It also supports a variety of compilers.&lt;br /&gt;3. &lt;a href="http://www.bloodshed.net/devcpp.html"&gt;&lt;span style="font-weight: bold;"&gt;Bloodshed Dev C++ 5.0&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;A great IDE for students. It comes in two flavours - one with the MinGW compiler and another without any compiler. Dev C++ is also exclusively for Windows.&lt;br /&gt;4. &lt;a style="font-weight: bold;" href="http://geany.uvena.de/"&gt;Geany&lt;/a&gt;&lt;br /&gt;Geany is a newcomer to the scene and I've really noted it for supporting several languages and being extremely light-weight. Geany is also being actively developed for multiple OS platforms.&lt;br /&gt;5. Finally, if you work on Linux, I recommend either &lt;a href="http://www.kdevelop.org/"&gt;&lt;span style="font-weight: bold;"&gt;KDevelop&lt;/span&gt;&lt;/a&gt; or &lt;a href="http://anjuta.sourceforge.net/"&gt;&lt;span style="font-weight: bold;"&gt;Anjuta&lt;/span&gt;&lt;/a&gt;. I now use Code::Blocks as a standard IDE for both Windows and Linux, though.&lt;br /&gt;&lt;a href="http://www.kdevelop.org/"&gt;&lt;/a&gt;&lt;br /&gt;If you're going to do stuff, then you have to do it right.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-4057067233557177434?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/4057067233557177434/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=4057067233557177434' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/4057067233557177434'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/4057067233557177434'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2008/01/out-with-old-stuff-teach-new-stuff.html' title='Out with the old stuff, Teach the new stuff'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5951350911052608183.post-5465639228903544375</id><published>2008-01-07T07:58:00.001+05:30</published><updated>2009-06-14T01:14:43.826+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='rants'/><title type='text'>Start Stuff</title><content type='html'>&lt;span style="font-family:verdana;"&gt;Hi all! I've been deliberating for some time on whether I should start a blog or not. I guess I've got stuff to talk about and so I've finally taken the plunge. Here's the Disclaimer : "Nothing I've got to say is earth-shattering. Read at your own risk!" First, a little about myself. I am a student pursuing my Master's Degree in Computer Applications which I am due to complete in a few months. As you might have suspected, I am interested in tech talk. That's not the only stuff that I will talk about, though. I love listening to music and once in a while I will try to suggest and maybe even do a review on a good music album. The main reason as to why I've started this blog is so that I can share ideas and information. A lot of my time is spent in coding and I find out nifty tricks or read about such tricks elsewhere. I also come across coding bugs and perhaps if I post solutions to common problems other programmers could benefit from them. I also want to share my views on certain issues in the digital world (Read as : "I want to start a rant"). I play plenty of PC-based games and maybe once in a while I could talk about some of the games that I play. Of course, I welcome comments. If you find some error in a post of mine or just want to chip in with your view, go ahead. The world will be the better for it. Alright then. After all that's been said, let's start doing stuff.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5951350911052608183-5465639228903544375?l=angelorohit.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://angelorohit.blogspot.com/feeds/5465639228903544375/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5951350911052608183&amp;postID=5465639228903544375' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/5465639228903544375'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5951350911052608183/posts/default/5465639228903544375'/><link rel='alternate' type='text/html' href='http://angelorohit.blogspot.com/2008/01/start-stuff.html' title='Start Stuff'/><author><name>Angelo</name><uri>http://www.blogger.com/profile/01579724014827853355</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_O-rOxpu66eY/TKRjA4ECnEI/AAAAAAAAAVw/fFBdF0FWK0s/S220/musicorb.png'/></author><thr:total>0</thr:total></entry></feed>
