<?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:blogger='http://schemas.google.com/blogger/2008' 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-26443211</id><updated>2014-03-20T07:24:55.274+06:00</updated><category term="system admin"/><category term="programming"/><category term="MacOSX"/><category term="Tips and Tricks"/><category term="Scripts"/><category term="Ubuntu"/><category term="projects"/><category term="Java"/><category term="Xcode"/><category term="events"/><category term="network admin"/><category term="3d modelling and animation"/><category term="Firefox"/><category term="Gentoo"/><category term="Linux Gaming"/><category term="Mobile"/><category term="Sabayon"/><category term="Vista"/><category term="computer vision"/><category term="gsoc"/><category term="image processing"/><category term="javascript"/><category term="open source"/><category term="personal"/><category term="python"/><category term="web development"/><title type='text'>KiSS</title><subtitle type='html'>Keep it Simple, Stupid!</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://zaher14.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26443211/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://zaher14.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/26443211/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Abu Zaher Faridee</name><uri>https://plus.google.com/104067291049623797029</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-K2Xh7yMl0iU/AAAAAAAAAAI/AAAAAAAAApo/neDDkE7Fml8/s512-c/photo.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>65</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-26443211.post-3376767143274360715</id><published>2012-05-03T13:08:00.001+06:00</published><updated>2012-05-04T02:02:09.876+06:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="gsoc"/><title type='text'>Back to Blogging (And This Time for Real :P)</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;After a failed attempt last year to get back to blogging, I&#39;m trying it again this year. I really wanted to get back, but got busy will a lot of stuff.&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;Firstly, there was the Google Summer of Code Mentoring part for &lt;a href=&quot;http://www.apertium.org/&quot; target=&quot;_blank&quot;&gt;Apertium&lt;/a&gt;, it was a great enlightening experience for me. Normally, I&#39;ve alway been the receiving end of orders, this time I was coordinating project plans and helping my student to give the best effort he could. The project ended in successful completion of most of the goals we envisioned.&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;Secondly I had to simultaneously continue my Masters study as well as working in a software company to pay bills. After all these, there was little time for me to do any actual blogging.&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;Google Summer of Code is becoming a habit for me.&amp;nbsp;I&#39;ve been selected as a student this year (once again), this time I&#39;d be working with &amp;nbsp;&lt;a href=&quot;http://www.nescent.org/&quot; target=&quot;_blank&quot;&gt;National Evolutionary Synthesis Center (NESCent)&lt;/a&gt; on the idea Apply machine learning algorithms to ecology data&quot;&amp;nbsp;. I&#39;d be elaborating on the idea in a later post. This is such a great opportunity for me to further diversity my skills and knowledge base.&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;There is a reason for me coming back to Google Summer of Code each year (either as a student or as a mentor). This is because I love working with open source projects. The most interesting aspect of working with open source projects is that you get the freedom to do all kind of creative stuffs and nobody is stopping you from doing that unless you do something completely stupid. I&#39;ve got my fair share of working with commercial projects in different software campaniles, in those places creativities cannot take priorities over business demands (luckily, the&amp;nbsp;&lt;a href=&quot;http://www.apurbatech.com/&quot; target=&quot;_blank&quot;&gt;company&lt;/a&gt;&amp;nbsp;I&#39;ve been working for builds most of it&#39;s applications on top of open source components, so I have no complaints for them).&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;I&#39;d try to be regular this time, even if I have to post my rants about my ongoing Summer of Code project.&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://zaher14.blogspot.com/feeds/3376767143274360715/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26443211&amp;postID=3376767143274360715' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26443211/posts/default/3376767143274360715'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26443211/posts/default/3376767143274360715'/><link rel='alternate' type='text/html' href='http://zaher14.blogspot.com/2012/05/back-to-blogging-and-this-time-for-real.html' title='Back to Blogging (And This Time for Real :P)'/><author><name>Abu Zaher Faridee</name><uri>https://plus.google.com/104067291049623797029</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-K2Xh7yMl0iU/AAAAAAAAAAI/AAAAAAAAApo/neDDkE7Fml8/s512-c/photo.jpg'/></author><thr:total>0</thr:total><georss:featurename>Dhaka, Bangladesh</georss:featurename><georss:point>23.709921 90.407143</georss:point><georss:box>23.5936145 90.249214500000008 23.8262275 90.5650715</georss:box></entry><entry><id>tag:blogger.com,1999:blog-26443211.post-8262369257503732379</id><published>2011-08-12T07:46:00.001+06:00</published><updated>2011-08-12T07:52:11.395+06:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Tips and Tricks"/><title type='text'>Customizing Function Key Mode in Macbook with KeyRemap4MacBook</title><content type='html'>&lt;div&gt;&lt;p&gt;If you are a MacBook user you&#39;d find this trick pretty handy. We have to use IDEs like Eclipse and Netbeans every day for our large scale java development in office. For those who are familiar with these IDEs, there are a lot of shortcut keys involved if you want to work fast and a lot of these shortcut keys comprises of function keys. Function keys are by default mapped to different Macbook related functions like brightness up/up, volume up/down which is pretty handy for general usage.&lt;/p&gt;&lt;p&gt;Unfortunately, if you want to behave them as normal function keys, you have to press the &lt;strong&gt;fn&lt;/strong&gt;&amp;nbsp;while pressing the function keys. This is pretty cumbersome for day to day use on the other hand (Imagine then Eclipse shortcut for &lt;em&gt;running last launched &lt;/em&gt;which normally involves &lt;strong&gt;Shift + Command + F11&lt;/strong&gt;, now in this case you&#39;d need to use &lt;strong&gt;Shift + Command + Fn + F11&lt;/strong&gt;)&lt;/p&gt;&lt;p&gt;You can switch the default behavior by going to keyboard preference, then checking on&lt;strong&gt; &quot;Use all F1, F2, etc. keys as standard function keys&quot;&lt;/strong&gt;. But again, now to change the volume, you&#39;d have to keep&amp;nbsp;&lt;strong&gt;Fn&lt;/strong&gt; button pressed while pressing F11/F12 (in MacBook Pro). This is agian cumbersome.&lt;/p&gt;&lt;p&gt;Woundn&#39;t it be better if there was a nifty trick to switch between these two modes quickly. Like when you are busy in office working in your IDE you&#39;d want to behave the function keys as normal but when you are wathcing movies or browsing, you&#39;d want the default mac os behavior? And with a flip of a switch you could do that easily.&lt;/p&gt;&lt;p&gt;For this trick we are going to use KeyRemap4MacBook utility. Downlaod it from&amp;nbsp;&lt;a href=&quot;http://pqrs.org/macosx/keyremap4macbook/&quot; target=&quot;_blank&quot;&gt;http://pqrs.org/macosx/keyremap4macbook/&lt;/a&gt;. It&#39;s a free utility, so don&#39;t worry. Now go to keyboard preferences and make sure&amp;nbsp;&lt;strong&gt;&quot;Use all F1, F2, etc. keys as standard function keys&quot;&lt;/strong&gt; is checked. We&#39;d need this for our trick to work.&lt;/p&gt;&lt;p&gt;&lt;img src=&quot;http://lh6.ggpht.com/-hpPS4gHI5I8/TkR_TYP8JVI/AAAAAAAAAhQ/LWyj63fs_uo/%25255BUNSET%25255D.png&quot; alt=&quot;&quot; width=&quot;748&quot; height=&quot;677&quot; /&gt;&lt;/p&gt;&lt;p&gt;Now go to KeyRemap4MacBook prefernces, and go to &#39;&lt;strong&gt;Pass Through Mode&#39; &lt;/strong&gt;option. Then check on &lt;strong&gt;&#39;Change Fn+Escape to toggle &quot;Pass Through Mode&quot;&#39;&lt;/strong&gt;.&lt;/p&gt;&lt;p&gt;&lt;img src=&quot;http://lh5.ggpht.com/-VHNbtohBFnE/TkR_gcvb2EI/AAAAAAAAAhU/3iKn0WPfM6w/%25255BUNSET%25255D.png&quot; alt=&quot;&quot; width=&quot;748&quot; height=&quot;734&quot; /&gt;&lt;/p&gt;&lt;p&gt;Now go to &lt;strong&gt;&quot;Change F1..F19 Key&quot;&lt;/strong&gt;&amp;nbsp;and check the &lt;strong&gt;&quot;Macbook Pro: Keyboard Preferences Configured to Standard Function Keys&quot; &lt;/strong&gt;(I&#39;m a macbook pro user, so this option is for me, if you own a Macbook Air, check the other options).&lt;/p&gt;&lt;p&gt;&lt;img src=&quot;http://lh6.ggpht.com/-3XBXm0lG-KY/TkR_t_ZCXsI/AAAAAAAAAhY/BiXePUHWgjU/%25255BUNSET%25255D.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;&lt;p&gt;All set up. Now your macbook function keys behave in the default behavior of brightness up/down, volume up/down mode. So when you fire up your IDE, just press &lt;strong&gt;Fn+Escape&lt;/strong&gt; and you&#39;d go into function key mode, just use your shotcuts as you like, when you want to switch back, just press &lt;strong&gt;Fn+Escape&lt;/strong&gt; again.&lt;/p&gt;&lt;p&gt;&lt;em&gt;&lt;strong&gt;KeyRemap4MacBook&lt;/strong&gt;&lt;/em&gt; is an awesome tool. It&#39;s really really powerful and comes with a lot more cool tricks, like emacs mode. I&#39;d come up with some more explanations later. This awesome tool is free to use. Do donate to the developer, I think he really did a great job.&lt;/p&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26443211/posts/default/8262369257503732379'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26443211/posts/default/8262369257503732379'/><link rel='alternate' type='text/html' href='http://zaher14.blogspot.com/2011/08/customizing-function-key-mode-in.html' title='Customizing Function Key Mode in Macbook with KeyRemap4MacBook'/><author><name>Abu Zaher Faridee</name><uri>https://plus.google.com/104067291049623797029</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-K2Xh7yMl0iU/AAAAAAAAAAI/AAAAAAAAApo/neDDkE7Fml8/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh6.ggpht.com/-hpPS4gHI5I8/TkR_TYP8JVI/AAAAAAAAAhQ/LWyj63fs_uo/s72-c/%25255BUNSET%25255D.png" height="72" width="72"/></entry><entry><id>tag:blogger.com,1999:blog-26443211.post-7208290669077676290</id><published>2011-08-04T07:52:00.000+06:00</published><updated>2011-08-04T07:02:50.063+06:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="personal"/><title type='text'>Back to Blogging World</title><content type='html'>&lt;div&gt;&lt;p&gt;Hey Folks,&lt;/p&gt;&lt;p&gt;I&#39;m back again to blogging world. I has been nearly two years since I was detatched from my blog. A lot of things have happened since then. I&#39;ve participated in Google Summer of Code 2009 and 2010 as a student for Apertium project and this year I&#39;m working there as a mentor. I&#39;ve graduated in this time, learned a lot about the &#39;real&#39; world out there and joined a startup company where I work on open source Enterprise Intregation solution. I love it there.&lt;/p&gt;&lt;p&gt;It&#39;d take me to some time to come back to my writing skills, it&#39;s gone pretty rusty all these years, but I guess better late than never.&lt;/p&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://zaher14.blogspot.com/feeds/7208290669077676290/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26443211&amp;postID=7208290669077676290' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26443211/posts/default/7208290669077676290'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26443211/posts/default/7208290669077676290'/><link rel='alternate' type='text/html' href='http://zaher14.blogspot.com/2009/06/back-to-blogging-world.html' title='Back to Blogging World'/><author><name>Abu Zaher Faridee</name><uri>https://plus.google.com/104067291049623797029</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-K2Xh7yMl0iU/AAAAAAAAAAI/AAAAAAAAApo/neDDkE7Fml8/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26443211.post-8352117404444919386</id><published>2009-07-06T11:48:00.003+07:00</published><updated>2009-08-24T05:26:56.022+07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="system admin"/><category scheme="http://www.blogger.com/atom/ns#" term="Ubuntu"/><title type='text'>Macbook: Know Your Battery&#39;s Capacity</title><content type='html'>I wanted to check how&#39;s my Macbook&#39;s battery was doing. In Ubuntu, it pretty straightforward.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;zaher@zaher-macbook:~$ cat /proc/acpi/battery/BAT0/state&lt;br /&gt;present:                 yes&lt;br /&gt;capacity state:          ok&lt;br /&gt;charging state:          charged&lt;br /&gt;present rate:            0 mW&lt;br /&gt;remaining capacity:      47490 mWh&lt;br /&gt;present voltage:         12435 mV&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;And ...&lt;br /&gt;&lt;pre&gt;zaher@zaher-macbook:~$ cat /proc/acpi/battery/BAT0/info&lt;br /&gt;present:                 yes&lt;br /&gt;design capacity:         50200 mWh&lt;br /&gt;last full capacity:      48750 mWh&lt;br /&gt;battery technology:      rechargeable&lt;br /&gt;design voltage:          10950 mV&lt;br /&gt;design capacity warning: 250 mWh&lt;br /&gt;design capacity low:     100 mWh&lt;br /&gt;capacity granularity 1:  10 mWh&lt;br /&gt;capacity granularity 2:  10 mWh&lt;br /&gt;model number:            ASMB016&lt;br /&gt;serial number:         &lt;br /&gt;battery type:            LION016&lt;br /&gt;OEM info:                DPON016&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Ahh, 48750/50200 = 97%, Not bad after 2 years of 24x7 punishment (yeah I keep it running all day,  I download a lot :P). Let me know your&#39;s too.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26443211/posts/default/8352117404444919386'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26443211/posts/default/8352117404444919386'/><link rel='alternate' type='text/html' href='http://zaher14.blogspot.com/2009/07/macbook-know-your-battery-capacity.html' title='Macbook: Know Your Battery&amp;#39;s Capacity'/><author><name>Abu Zaher Faridee</name><uri>https://plus.google.com/104067291049623797029</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-K2Xh7yMl0iU/AAAAAAAAAAI/AAAAAAAAApo/neDDkE7Fml8/s512-c/photo.jpg'/></author></entry><entry><id>tag:blogger.com,1999:blog-26443211.post-5853687252417361879</id><published>2009-06-27T00:23:00.002+07:00</published><updated>2009-06-27T00:28:23.759+07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="programming"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><title type='text'>Python: Simple Singleton for Mysql Access</title><content type='html'>I was trying to come up with a simple implementation of Singleton pattern in python, its a bit different from other language constructs. Here is the code implementing a single point database access using MySQLdb.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(68, 68, 68);&quot;&gt;#! /usr/bin/python&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;import&lt;/strong&gt; &lt;span style=&quot;color: rgb(32, 64, 160);&quot;&gt;MySQLdb&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;import&lt;/strong&gt; &lt;span style=&quot;color: rgb(32, 64, 160);&quot;&gt;sys&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;class&lt;/strong&gt; &lt;span style=&quot;color: rgb(32, 64, 160);&quot;&gt;Conn&lt;/span&gt;&lt;span style=&quot;color: rgb(68, 68, 255);&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: rgb(32, 64, 160);&quot;&gt;object&lt;/span&gt;&lt;span style=&quot;color: rgb(68, 68, 255);&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: rgb(68, 68, 255);&quot;&gt;:&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(32, 64, 160);&quot;&gt;__instance&lt;/span&gt; &lt;span style=&quot;color: rgb(68, 68, 255);&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: rgb(32, 64, 160);&quot;&gt;None&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(32, 64, 160);&quot;&gt;__conn&lt;/span&gt; &lt;span style=&quot;color: rgb(68, 68, 255);&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: rgb(32, 64, 160);&quot;&gt;None&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;   &lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt; def&lt;/span&gt;&lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt; __init__&lt;/span&gt;&lt;span style=&quot;color: rgb(32, 64, 160);&quot;&gt;(self)&lt;/span&gt;:&lt;br /&gt;&lt;/strong&gt;        &lt;strong&gt;try&lt;/strong&gt;&lt;span style=&quot;color: rgb(68, 68, 255);&quot;&gt;:&lt;/span&gt;&lt;br /&gt;  &lt;strong&gt;if&lt;/strong&gt; &lt;span style=&quot;color: rgb(32, 64, 160);&quot;&gt;Conn&lt;/span&gt;.&lt;span style=&quot;color: rgb(32, 64, 160);&quot;&gt;__instance&lt;/span&gt; &lt;span style=&quot;color: rgb(68, 68, 255);&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: rgb(68, 68, 255);&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: rgb(32, 64, 160);&quot;&gt;None&lt;/span&gt;&lt;span style=&quot;color: rgb(68, 68, 255);&quot;&gt;:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;      &lt;span style=&quot;color: rgb(32, 64, 160);&quot;&gt;Conn&lt;/span&gt;.&lt;span style=&quot;color: rgb(32, 64, 160);&quot;&gt;__instance&lt;/span&gt; &lt;span style=&quot;color: rgb(68, 68, 255);&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: rgb(32, 64, 160);&quot;&gt;self&lt;/span&gt;&lt;br /&gt;      &lt;span style=&quot;color: rgb(32, 64, 160);&quot;&gt;Conn&lt;/span&gt;.&lt;span style=&quot;color: rgb(32, 64, 160);&quot;&gt;__conn&lt;/span&gt; &lt;span style=&quot;color: rgb(68, 68, 255);&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: rgb(32, 64, 160);&quot;&gt;MySQLdb&lt;/span&gt;.&lt;span style=&quot;color: rgb(32, 64, 160);&quot;&gt;connect&lt;/span&gt; &lt;span style=&quot;color: rgb(68, 68, 255);&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: rgb(32, 64, 160);&quot;&gt;host&lt;/span&gt;&lt;span style=&quot;color: rgb(68, 68, 255);&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 128, 0);&quot;&gt;&quot;localhost&quot;&lt;/span&gt;, &lt;span style=&quot;color: rgb(32, 64, 160);&quot;&gt;user&lt;/span&gt;&lt;span style=&quot;color: rgb(68, 68, 255);&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 128, 0);&quot;&gt;&quot;user&quot;&lt;/span&gt;, &lt;span style=&quot;color: rgb(32, 64, 160);&quot;&gt;passwd&lt;/span&gt;&lt;span style=&quot;color: rgb(68, 68, 255);&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 128, 0);&quot;&gt;&quot;pass&quot;&lt;/span&gt;, &lt;span style=&quot;color: rgb(32, 64, 160);&quot;&gt;db&lt;/span&gt;&lt;span style=&quot;color: rgb(68, 68, 255);&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 128, 0);&quot;&gt;&quot;dbname&quot;&lt;/span&gt;&lt;span style=&quot;color: rgb(68, 68, 255);&quot;&gt;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;except&lt;/strong&gt; &lt;span style=&quot;color: rgb(32, 64, 160);&quot;&gt;MySQLdb&lt;/span&gt;.&lt;span style=&quot;color: rgb(32, 64, 160);&quot;&gt;Error&lt;/span&gt;, &lt;span style=&quot;color: rgb(32, 64, 160);&quot;&gt;e&lt;/span&gt;&lt;span style=&quot;color: rgb(68, 68, 255);&quot;&gt;:&lt;/span&gt;&lt;br /&gt;  &lt;strong&gt;print&lt;/strong&gt; &lt;span style=&quot;color: rgb(0, 128, 0);&quot;&gt;&quot;Error %d: %s&quot;&lt;/span&gt; &lt;span style=&quot;color: rgb(68, 68, 255);&quot;&gt;%&lt;/span&gt; &lt;span style=&quot;color: rgb(68, 68, 255);&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: rgb(32, 64, 160);&quot;&gt;e&lt;/span&gt;.&lt;span style=&quot;color: rgb(32, 64, 160);&quot;&gt;args&lt;/span&gt;&lt;span style=&quot;color: rgb(68, 68, 255);&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: rgb(68, 68, 255);&quot;&gt;]&lt;/span&gt;, &lt;span style=&quot;color: rgb(32, 64, 160);&quot;&gt;e&lt;/span&gt;.&lt;span style=&quot;color: rgb(32, 64, 160);&quot;&gt;args&lt;/span&gt;&lt;span style=&quot;color: rgb(68, 68, 255);&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: rgb(68, 68, 255);&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: rgb(68, 68, 255);&quot;&gt;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span style=&quot;color: rgb(32, 64, 160);&quot;&gt;sys&lt;/span&gt;.&lt;span style=&quot;color: rgb(32, 64, 160);&quot;&gt;exit&lt;/span&gt;&lt;span style=&quot;color: rgb(68, 68, 255);&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: rgb(68, 68, 255);&quot;&gt;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;   &lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt; def&lt;/span&gt;&lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt; get_connection&lt;/span&gt;&lt;span style=&quot;color: rgb(32, 64, 160);&quot;&gt;(self)&lt;/span&gt;:&lt;br /&gt;&lt;/strong&gt;        &lt;strong&gt;return&lt;/strong&gt; &lt;span style=&quot;color: rgb(32, 64, 160);&quot;&gt;Conn&lt;/span&gt;.&lt;span style=&quot;color: rgb(32, 64, 160);&quot;&gt;__conn&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;if&lt;/strong&gt; &lt;span style=&quot;color: rgb(32, 64, 160);&quot;&gt;__name__&lt;/span&gt; &lt;span style=&quot;color: rgb(68, 68, 255);&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: rgb(68, 68, 255);&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: rgb(0, 128, 0);&quot;&gt;&quot;__main__&quot;&lt;/span&gt;&lt;span style=&quot;color: rgb(68, 68, 255);&quot;&gt;:&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(32, 64, 160);&quot;&gt;conn&lt;/span&gt; &lt;span style=&quot;color: rgb(68, 68, 255);&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: rgb(68, 68, 255);&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: rgb(32, 64, 160);&quot;&gt;Conn&lt;/span&gt;&lt;span style=&quot;color: rgb(68, 68, 255);&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: rgb(68, 68, 255);&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: rgb(68, 68, 255);&quot;&gt;)&lt;/span&gt;.&lt;span style=&quot;color: rgb(32, 64, 160);&quot;&gt;get_connection&lt;/span&gt;&lt;span style=&quot;color: rgb(68, 68, 255);&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: rgb(68, 68, 255);&quot;&gt;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(0, 128, 0);&quot;&gt;&#39;&#39;&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 128, 0);&quot;&gt;&#39; Do your thing &#39;&lt;/span&gt;&lt;span style=&quot;color: rgb(0, 128, 0);&quot;&gt;&#39;&#39;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(32, 64, 160);&quot;&gt;conn&lt;/span&gt;.&lt;span style=&quot;color: rgb(32, 64, 160);&quot;&gt;close&lt;/span&gt;&lt;span style=&quot;color: rgb(68, 68, 255);&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: rgb(68, 68, 255);&quot;&gt;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;It&#39;s not perfect I guess, but right now it serves the purpose. You are welcome to put down any valuable advice into this.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26443211/posts/default/5853687252417361879'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26443211/posts/default/5853687252417361879'/><link rel='alternate' type='text/html' href='http://zaher14.blogspot.com/2009/06/python-simple-singleton-for-mysql.html' title='Python: Simple Singleton for Mysql Access'/><author><name>Abu Zaher Faridee</name><uri>https://plus.google.com/104067291049623797029</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-K2Xh7yMl0iU/AAAAAAAAAAI/AAAAAAAAApo/neDDkE7Fml8/s512-c/photo.jpg'/></author></entry><entry><id>tag:blogger.com,1999:blog-26443211.post-449289473270863391</id><published>2009-06-26T11:52:00.001+07:00</published><updated>2009-06-26T11:52:26.714+07:00</updated><title type='text'>Mysql: Dumping only stored procedures</title><content type='html'>&lt;div xmlns=&#39;http://www.w3.org/1999/xhtml&#39;&gt;I had to find a way to dump ONLY the stored procedures from a mysql database. Here is how I did it.&lt;code&gt;&lt;br /&gt;mysqldump --routines --no-create-info --no-data --no-create-db --skip-opt &quot;databasename&quot; &amp;gt; stored_procedure.sql&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;PS. This is the shortest post that I ever made. :)&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26443211/posts/default/449289473270863391'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26443211/posts/default/449289473270863391'/><link rel='alternate' type='text/html' href='http://zaher14.blogspot.com/2009/06/mysql-dumping-only-stored-procedures.html' title='Mysql: Dumping only stored procedures'/><author><name>Abu Zaher Faridee</name><uri>https://plus.google.com/104067291049623797029</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-K2Xh7yMl0iU/AAAAAAAAAAI/AAAAAAAAApo/neDDkE7Fml8/s512-c/photo.jpg'/></author></entry><entry><id>tag:blogger.com,1999:blog-26443211.post-6677677376660059334</id><published>2009-06-25T14:02:00.001+07:00</published><updated>2009-06-25T14:02:28.149+07:00</updated><title type='text'>Python: C++ style cin, cout in Python</title><content type='html'>&lt;div xmlns=&#39;http://www.w3.org/1999/xhtml&#39;&gt;Ready to bring some flavor of C++ into python? If you like cout, cin in C++ and also a python programmer, you&#39;d definitely like this snippet.&lt;br/&gt;&lt;pre&gt;import sys&lt;br /&gt;class ostream:&lt;br /&gt;    def __init__(self, file):&lt;br /&gt;        self.file = file&lt;br /&gt;        &lt;br /&gt;    def __lshift__(self, obj):&lt;br /&gt;        self.file.write(str(obj));&lt;br /&gt;        return self&lt;br /&gt;cout = ostream(sys.stdout)&lt;br /&gt;cerr = ostream(sys.stderr)&lt;br /&gt;endl = &#39;\n&#39;&lt;br /&gt;&lt;br /&gt;x, y = &#39;Printing&#39;, &#39;like C++&#39;&lt;br /&gt;cout &amp;lt;&amp;lt; x &amp;lt;&amp;lt; &quot; &quot; &amp;lt;&amp;lt; y &amp;lt;&amp;lt; endl&lt;br /&gt;&lt;/pre&gt;Pretty cool, huh. I found this and a lot of other cool stuffs from &lt;a href=&#39;http://www.norvig.com/&#39;&gt;Peter Norvig&lt;/a&gt;&#39;s blog. Its such a nice blog, just subscribed to it.&lt;br/&gt;&lt;br/&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26443211/posts/default/6677677376660059334'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26443211/posts/default/6677677376660059334'/><link rel='alternate' type='text/html' href='http://zaher14.blogspot.com/2009/06/python-c-style-cin-cout-in-python.html' title='Python: C++ style cin, cout in Python'/><author><name>Abu Zaher Faridee</name><uri>https://plus.google.com/104067291049623797029</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-K2Xh7yMl0iU/AAAAAAAAAAI/AAAAAAAAApo/neDDkE7Fml8/s512-c/photo.jpg'/></author></entry><entry><id>tag:blogger.com,1999:blog-26443211.post-1310910728850803611</id><published>2009-06-21T10:41:00.002+07:00</published><updated>2009-06-21T11:41:18.738+07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="computer vision"/><category scheme="http://www.blogger.com/atom/ns#" term="image processing"/><category scheme="http://www.blogger.com/atom/ns#" term="open source"/><category scheme="http://www.blogger.com/atom/ns#" term="programming"/><category scheme="http://www.blogger.com/atom/ns#" term="projects"/><title type='text'>Computer Vision: Working with OpenCV and beyond</title><content type='html'>&lt;div xmlns=&#39;http://www.w3.org/1999/xhtml&#39;&gt;&lt;font face=&#39;sans-serif&#39;&gt;For my software Engineering project, I had chosen to work on something different other than database and information management system that we typically take in this course. I&#39;ve had enough of it in my last term. So this time we three group members choose to work on Computer Vision System. At first we where quite confused because we knew nothing about this field and given our inexperience, it was really difficult. Even our project requirement was a bit hazy, so to speak :)&lt;br/&gt;&lt;br/&gt;We tried to learn about the basic concepts of computer vision, image analysis and had to go through an extensive set of frameworks to evaluate which fits our needs. Initially our project requirement was to detect/recognize human facial structure but this was later retrofitted with object detection and feature extraction. Through the course of time we tried to study a lot of research papers (most of them seemed to me like Egyptian Hieroglyphics, :(( ...). &lt;br/&gt;&lt;br/&gt;The first framework we came across was &lt;a href=&#39;http://torch3vision.idiap.ch/downloads.php&#39;&gt;Torch3Vision&lt;/a&gt;. This framework is built on top of Torch3, which is gives the user a lot of image processing algorithms. Torch3Vision is extensively built for Facial detection. While it was really a good framework, it proved a bit sturdy to customize for our general need as the project requirement started to change.&lt;br/&gt;&lt;br/&gt;We later started to study about &lt;a href=&#39;http://en.wikipedia.org/wiki/Content_Based_Image_Retrieval_System&#39;&gt;Content Based Image Retrieval&lt;/a&gt; (CBIR) techniques, two of the framework we took into account was &lt;a href=&#39;http://www.gnu.org/software/gift/&#39;&gt;GIFT&lt;/a&gt; (also known as GNUIFT, to avoid name confusion with another open source tool) and &lt;a href=&#39;http://www.semanticmetadata.net/lire/&#39;&gt;Lire&lt;/a&gt;. Lire is written in java and uses Lucene api in the backend, while GIFT is written in C/C++. These implementations enable the user to search images by &#39;Query by Example&#39;, not what we exactly wanted to do. So yeah, another dead end what it seemed ...&lt;br/&gt;&lt;br/&gt;The last one, and which of course we choose to work on was OpenCV.&lt;a href=&#39;http://sourceforge.net/projects/opencvlibrary/&#39;&gt; OpenCV&lt;/a&gt; is an open source library initially built and later sponsored by Intel. It is used extensively in various fields of computer vision, so its in active development and well documented. It also comes with a comprehensive e-book that can help you a lot in crunching the heavy duty libs for the first time.&lt;br/&gt;&lt;br/&gt;We also took help from another project that uses OpenCV library to detect objects using &#39;Boosted Histograms&#39; method, its called &lt;a href=&#39;http://code.google.com/p/objectdet/&#39;&gt;objectdet&lt;/a&gt;. Here I&#39;m going to go through the basic steps of running OpenCV library in Linux as well as compiling objectdet in Linux. Though OpenCV comes with all major linux distros, I recommend direcetly downloading and compiling from the svn. They have a very extensive wiki, &lt;a href=&#39;http://opencv.willowgarage.com/wiki/InstallGuide&#39;&gt;this&lt;/a&gt; &lt;/font&gt;&lt;font face=&#39;sans-serif&#39;&gt;page has the detailed instructions for installing in all OS. One thing I&#39;d like to mention here, is the CMake based build is more straightforward than Autotools as it sometimes (on rare occasions) breaks.&lt;/font&gt;&lt;br/&gt;&lt;font face=&#39;sans-serif&#39;&gt;&lt;br/&gt;After you have OpenCV set up and running, you can try to install &#39;objectdet&#39; on your system (I&#39;m running it in a Ubuntu 9.04). It hasn&#39;t been on active development for a while and running the old code with new libs can surely have its moments(!!!).&lt;/font&gt;&lt;br/&gt;&lt;code&gt;&lt;br/&gt;sudo apt-get install build-essential libxml++-dev libboost-filesystem-dev&lt;br/&gt;svn checkout http://objectdet.googlecode.com/svn/trunk/ objectdet-read-only&lt;br/&gt;cd objectdet-read-only/objectdet&lt;br/&gt;chmod a+X autogen.sh&lt;br/&gt;./autogen.sh&lt;br/&gt;mv Makefile.am makefile.am&lt;br/&gt;sudo ln -s /usr/lib/libboost_filesystem.a /usr/lib//libboost_filesystem-gcc.a&lt;br/&gt;sudo ln -s /usr/lib/libboost_filesystem.so /usr/lib//libboost_filesystem-gcc.so&lt;br/&gt;./configure --with-opencv-headers=/usr/local/include/opencv/&lt;br/&gt;cd src&lt;br/&gt;make&lt;br/&gt;sudo make install&lt;br/&gt;cd ..&lt;br/&gt;&lt;/code&gt;&lt;br/&gt;&lt;font face=&#39;sans-serif&#39;&gt;Run the demo&lt;/font&gt;&lt;br/&gt;&lt;code&gt;&lt;br/&gt;src/objectdet -i images/000537.png -c classifiers/cabmodel_interm_nst40_VOC06car01train5_trainval_orienthistmod.xml&lt;br/&gt;&lt;/code&gt;&lt;br/&gt;&lt;font face=&#39;sans-serif&#39;&gt;A simple window with a car being detected should appear. Here the xml file contains the trained data for the &#39;car&#39; object. How to create this trained xml? Well, that&#39;s the harder part, I&#39;ll try to write that in my next post &lt;/font&gt;&lt;font face=&#39;sans-serif&#39;&gt;when I get some time from my GSoC project.&lt;/font&gt;&lt;font face=&#39;sans-serif&#39;&gt;&lt;br/&gt;&lt;br/&gt;If you are interested in working in Computer Vision and searching for a good set of library, apart from the above mentioned ones, also take a look at these.&lt;br/&gt;&lt;br/&gt;1. &lt;a href=&#39;http://gandalf-library.sourceforge.net/&#39;&gt;Gandalf&lt;/a&gt; (yeah Gandalf, I really liked the name)&lt;br/&gt;2. &lt;a href=&#39;http://viper.unige.ch/doku.php&#39;&gt;This site&lt;/a&gt; hosts a lot of computed vision projects&lt;br/&gt;3. &lt;a href=&#39;http://ltilib.sourceforge.net/doc/homepage/index.shtml&#39;&gt;LTI-LIB&lt;/a&gt;&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26443211/posts/default/1310910728850803611'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26443211/posts/default/1310910728850803611'/><link rel='alternate' type='text/html' href='http://zaher14.blogspot.com/2009/06/computer-vision-working-with-opencv-and.html' title='Computer Vision: Working with OpenCV and beyond'/><author><name>Abu Zaher Faridee</name><uri>https://plus.google.com/104067291049623797029</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-K2Xh7yMl0iU/AAAAAAAAAAI/AAAAAAAAApo/neDDkE7Fml8/s512-c/photo.jpg'/></author></entry><entry><id>tag:blogger.com,1999:blog-26443211.post-103312976839671704</id><published>2009-06-17T15:03:00.001+06:00</published><updated>2009-06-17T15:03:35.288+06:00</updated><title type='text'>Python: Working in Unicode</title><content type='html'>&lt;div xmlns=&#39;http://www.w3.org/1999/xhtml&#39;&gt;For my ongoing Google Summer of Code project, I need to write a lot of scripts that run analysis on Bengali words. So far I had been doing away with shell scripts and a lot of php-cli scripts. But writing long object oriented code in php seems a bit cumbersome to me (that&#39;s my personal opinion, no offense to the die hard php-lovers :)), so I decided to move to python. Most of the scripts that my mentor provided me was also in python, so it made really good sense.&lt;br/&gt;&lt;br/&gt;While working on unicode based characters in python, you&#39;ll often come across this type error message (this cost me a while to fix).&lt;br/&gt;&lt;br/&gt;&lt;code&gt;&lt;br/&gt;UnicodeEncodeError: &#39;ascii&#39; codec can&#39;t encode characters in position 0-3: ordinal not in range(128)&lt;br/&gt;&lt;/code&gt;&lt;br/&gt;&lt;br/&gt;This will happen if you do not set your character encoding in your python file to &lt;code&gt;UTF-8&lt;/code&gt;. First you need to make sure the first few lines of your programm looks like this.&lt;br/&gt;&lt;br/&gt;&lt;code&gt;&lt;br/&gt;#!/usr/bin/python&lt;br/&gt;# coding=utf-8&lt;br/&gt;# -*- encoding: utf-8 -*-&lt;br/&gt;&lt;/code&gt;&lt;br/&gt;&lt;br/&gt;This enables you to write unicode characters in your source code. But this does not enable you to print them in  console and you&#39;ll still keep getting the same error I previously mentioned.&lt;br/&gt;&lt;br/&gt;To solve this you need to add the following code in your &lt;code&gt;/usr/lib/python2.5/sitecustomize.py&lt;/code&gt; file (This might change depending your installed python version)&lt;br/&gt;&lt;br/&gt;&lt;code&gt;&lt;br/&gt;import sys;&lt;br/&gt;sys.setdefaultencoding(&#39;utf-8&#39;)&lt;br/&gt;&lt;/code&gt;&lt;br/&gt;&lt;br/&gt;I first tried to did this in the source code but it didn&#39;t work. I kept getting this error&lt;br/&gt;&lt;code&gt;&lt;br/&gt;AttributeError: &#39;module&#39; object has no attribute &#39;setdefaultencoding&#39;&lt;br/&gt;&lt;/code&gt;&lt;br/&gt;&lt;br/&gt;I&#39;m no python expert, but maybe python&#39;s default behavior is not to allow changing of the encoding in runtime just for safety (an increasing amount of system tools are written in python these days and they run all the time in Gnome and KDE). That&#39;d make more sense.&lt;br/&gt;&lt;br/&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26443211/posts/default/103312976839671704'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26443211/posts/default/103312976839671704'/><link rel='alternate' type='text/html' href='http://zaher14.blogspot.com/2009/06/python-working-in-unicode.html' title='Python: Working in Unicode'/><author><name>Abu Zaher Faridee</name><uri>https://plus.google.com/104067291049623797029</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-K2Xh7yMl0iU/AAAAAAAAAAI/AAAAAAAAApo/neDDkE7Fml8/s512-c/photo.jpg'/></author></entry><entry><id>tag:blogger.com,1999:blog-26443211.post-1445537738535020849</id><published>2009-05-02T21:23:00.002+06:00</published><updated>2009-06-01T18:56:47.614+06:00</updated><title type='text'>Fun with Posix Threads: Bank Teller Problem</title><content type='html'>A few weeks earlier we were given an interesting assignment on POSIX threads. The problem statement is as follows:&lt;br /&gt;&lt;br /&gt;&lt;i&gt;&quot;You have to simulate a multiteller bank. The bank has two tellers. Customers enter the bank one at a time. Each teller has a separate queue. A new arriving customer joins the shortest queue, choosing the leftmost in case of ties. Each teller takes one customer from his queue and services the customer (ignore the service time). If the teller finds that his queue is empty then it goes to sleep. There will be three Apartments. Each apartment will produce customers for the bank. Both queues have length of 5 customers. So whenever Queue is full no customer is allowed to enter the bank. In that case the apartment goes to sleep.&quot;&lt;br /&gt;&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;The POSIX library has a lot of powerful tools for handling this kind of problems. With my very little experience, I decided to stick with just mutex and semaphores. But one thing came to my mind, since I&#39;m an avid fan of java&#39;s threading model, I decided code it in the Java way!!! Yes create a C++ class that behaves like a Java thread class. You just override the run function just like in Java, and you&#39;ve got a new thread.&lt;br /&gt;&lt;br /&gt;Let&#39;s get into some details, shall we? This is the &lt;code&gt;Thread.h&lt;/code&gt; file. Here you can find the Thread class, &lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;#ifndef THREAD_H&lt;br /&gt;#define THREAD_H&lt;br /&gt;&lt;br /&gt;#include &amp;lt;cstdio&amp;gt;&lt;br /&gt;#include &amp;lt;string&amp;gt;&lt;br /&gt;#include &amp;lt;exception&amp;gt;&lt;br /&gt;#include &amp;lt;cassert&amp;gt;&lt;br /&gt;#include &amp;lt;cstdlib&amp;gt;&lt;br /&gt;&lt;br /&gt;#include &amp;lt;pthread.h&amp;gt;&lt;br /&gt;#include &amp;lt;semaphore.h&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;class Thread{&lt;br /&gt;protected:&lt;br /&gt;&lt;br /&gt;    pthread_t thread;&lt;br /&gt;    int res;&lt;br /&gt;    void *thread_result;&lt;br /&gt;&lt;br /&gt;    volatile bool stoprequested;&lt;br /&gt;    volatile bool running;&lt;br /&gt;&lt;br /&gt;    // this semaphore is just for a safety precation&lt;br /&gt;    sem_t safety_sem;&lt;br /&gt;&lt;br /&gt;    static void* __run(void *object){&lt;br /&gt;        void *exit_status;&lt;br /&gt;&lt;br /&gt;        printf(&quot;Calling the run function for thread.\n&quot;);&lt;br /&gt;        //                 this is the crutial part,&lt;br /&gt;        reinterpret_cast&lt;Thread *&gt;(object)-&gt;run();&lt;br /&gt;&lt;br /&gt;        pthread_exit(exit_status);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    virtual void run(){&lt;br /&gt;        printf(&quot;If you are seeing this, it means have to run this programme again\n\&lt;br /&gt;               This happened because the overridden run fuction did not get the time to be instantiated as the thread got created too earlier\n&quot;);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;public:&lt;br /&gt;    const char *id;&lt;br /&gt;&lt;br /&gt;    int start(){&lt;br /&gt;        //        assert(running == false);&lt;br /&gt;        if(running == false){&lt;br /&gt;            running = true;&lt;br /&gt;            printf(&quot;Creating the thread with id %s\n&quot;, id);&lt;br /&gt;            usleep(200);&lt;br /&gt;&lt;br /&gt;            // we are using this semaphore so that this function waits upto the point when the dereived class gets instantiated&lt;br /&gt;            sem_wait(&amp;safety_sem);&lt;br /&gt;&lt;br /&gt;            res = pthread_create(&amp;thread, NULL, __run, this);&lt;br /&gt;            if(res != 0){&lt;br /&gt;                perror(&quot;Thread creation failed\n&quot;);&lt;br /&gt;                exit(EXIT_FAILURE);&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;        return 0;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    Thread(const char *id): running(false), stoprequested(false){&lt;br /&gt;        this-&gt;id = id;&lt;br /&gt;        sem_init(&amp;safety_sem, 0, 0);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    void stop(){&lt;br /&gt;        //        assert(running == true);&lt;br /&gt;        if(running == true){&lt;br /&gt;            running = false;&lt;br /&gt;            stoprequested = true;&lt;br /&gt;            res = pthread_join(thread, &amp;thread_result);&lt;br /&gt;            if(res != 0){&lt;br /&gt;                printf(&quot;Thread joining failed&quot;);&lt;br /&gt;            }&lt;br /&gt;            printf(&quot;%s: Thread is returning\n&quot;, id);&lt;br /&gt;        }&lt;br /&gt;        sem_destroy(&amp;safety_sem);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    ~Thread(){&lt;br /&gt;        if(stoprequested == false){&lt;br /&gt;            stop();&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    bool isAlive(){&lt;br /&gt;        return running;&lt;br /&gt;    }&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;#endif // THREAD_H&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Now we&#39;ll need a thread safe queue implementation.&lt;br /&gt;Here is the code in &lt;code&gt;SafeQueue.h&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;#ifndef SAFEQUEUE_H&lt;br /&gt;#define SAFEQUEUE_H&lt;br /&gt;&lt;br /&gt;#include &amp;lt;semaphore.h&amp;gt;&lt;br /&gt;#include &amp;lt;pthread.h&amp;gt;&lt;br /&gt;#include &amp;lt;queue&amp;gt;&lt;br /&gt;#include &amp;lt;vector&amp;gt;&lt;br /&gt;&lt;br /&gt;using namespace std;&lt;br /&gt;&lt;br /&gt;class SafeQueue{&lt;br /&gt;&lt;br /&gt;protected:&lt;br /&gt;    sem_t sem_full;&lt;br /&gt;    sem_t sem_empty;&lt;br /&gt;    pthread_mutex_t mutex_common;&lt;br /&gt;&lt;br /&gt;    queue&lt;int&gt; q;&lt;br /&gt;    int max_queue_size;&lt;br /&gt;    char* name;&lt;br /&gt;&lt;br /&gt;public:&lt;br /&gt;&lt;br /&gt;    SafeQueue(const int max_queue_size, char* name){&lt;br /&gt;        this-&gt;max_queue_size = max_queue_size;&lt;br /&gt;        this-&gt;name = name;&lt;br /&gt;&lt;br /&gt;        sem_init(&amp;sem_full, 0, max_queue_size);&lt;br /&gt;        sem_init(&amp;sem_empty, 0, 0);&lt;br /&gt;        pthread_mutex_init(&amp;mutex_common, 0);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    // this function is thread safe&lt;br /&gt;    void push(int i, const char* thread_id){&lt;br /&gt;&lt;br /&gt;        // if full, go to sleep&lt;br /&gt;        sem_wait(&amp;sem_full);&lt;br /&gt;&lt;br /&gt;        pthread_mutex_lock(&amp;mutex_common);&lt;br /&gt;        //            cout &lt;&lt; thread_id &lt;&lt; &quot;: inside lock&quot; &lt;&lt; endl;&lt;br /&gt;        q.push(i);&lt;br /&gt;        cout &lt;&lt; thread_id &lt;&lt; &quot;: Pushing data: &quot; &lt;&lt; i &lt;&lt; &quot;, in &quot; &lt;&lt; name &lt;&lt;&quot;, queue size is: &quot; &lt;&lt; q.size() &lt;&lt; endl;&lt;br /&gt;&lt;br /&gt;        pthread_mutex_unlock(&amp;mutex_common);&lt;br /&gt;&lt;br /&gt;        // we release the empty semaphore&lt;br /&gt;        sem_post(&amp;sem_empty);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    // this function is thread safe&lt;br /&gt;    void pop(int *i, const char* thread_id){&lt;br /&gt;&lt;br /&gt;        // if empty go to sleep&lt;br /&gt;        sem_wait(&amp;sem_empty);&lt;br /&gt;&lt;br /&gt;        pthread_mutex_lock(&amp;mutex_common);&lt;br /&gt;&lt;br /&gt;        *i = q.front();&lt;br /&gt;        q.pop();&lt;br /&gt;        cout &lt;&lt; thread_id &lt;&lt; &quot;: Popping data: &quot; &lt;&lt; *i &lt;&lt; &quot; from &quot;&lt;&lt; name &lt;&lt; &quot; queue size is: &quot; &lt;&lt; q.size() &lt;&lt; endl;&lt;br /&gt;&lt;br /&gt;        pthread_mutex_unlock(&amp;mutex_common);&lt;br /&gt;        // we release the full semapore, because the queue is now one element short of being full&lt;br /&gt;        // so that other thread can now push into this queue&lt;br /&gt;        sem_post(&amp;sem_full);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    // helper function, needed when we want to use this objects mutex from outside&lt;br /&gt;    pthread_mutex_t* getMutex(){&lt;br /&gt;        return &amp;mutex_common;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    // this function is NOT thread safe, use only when needed in conjuncture with getMutex function&lt;br /&gt;    unsigned get_size(){&lt;br /&gt;        return q.size();&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    ~SafeQueue(){&lt;br /&gt;        sem_destroy(&amp;sem_empty);&lt;br /&gt;        sem_destroy(&amp;sem_full);&lt;br /&gt;        pthread_mutex_destroy(&amp;mutex_common);&lt;br /&gt;    }&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;#endif // SAFEQUEUE_H&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;I also needed to create a parallel queue implementation which, upon call gives me the pointer to the least populated queue. Code for &lt;code&gt;ParallelQueue.h&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;#ifndef PARALLELQUEUE_H&lt;br /&gt;#define PARALLELQUEUE_H&lt;br /&gt;&lt;br /&gt;#include &amp;lt;semaphore.h&amp;gt;&lt;br /&gt;#include &amp;lt;pthread.h&amp;gt;&lt;br /&gt;#include &amp;lt;queue&amp;gt;&lt;br /&gt;#include &amp;lt;vector&amp;gt;&lt;br /&gt;&lt;br /&gt;#include &quot;SafeQueue.h&quot;&lt;br /&gt;&lt;br /&gt;using namespace std;&lt;br /&gt;&lt;br /&gt;class ParallelQueue{&lt;br /&gt;&lt;br /&gt;protected:&lt;br /&gt;    pthread_mutex_t mutex;&lt;br /&gt;&lt;br /&gt;    vector&lt;SafeQueue*&gt; vq;&lt;br /&gt;&lt;br /&gt;    SafeQueue* min_q;&lt;br /&gt;&lt;br /&gt;public:&lt;br /&gt;    ParallelQueue(vector&lt;SafeQueue*&gt; vq){&lt;br /&gt;        pthread_mutex_init(&amp;mutex, 0);&lt;br /&gt;        this-&gt;vq = vq;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    void push_min(int data, const char* thread_id){&lt;br /&gt;        unsigned i;&lt;br /&gt;        pthread_mutex_lock(&amp;mutex);&lt;br /&gt;&lt;br /&gt;        // lock all the queue&lt;br /&gt;        min_q = &amp;(* vq[0]);&lt;br /&gt;        for(i=0; i&lt;vq.size(); i++){&lt;br /&gt;            pthread_mutex_lock((vq[i])-&gt;getMutex());&lt;br /&gt;            // find the min queue&lt;br /&gt;            if((vq[i])-&gt;get_size() &lt; min_q-&gt;get_size()){&lt;br /&gt;                min_q = vq[i];&lt;br /&gt;            }&lt;br /&gt;            pthread_mutex_unlock((vq[i])-&gt;getMutex());&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        // insert into the min queue&lt;br /&gt;        min_q-&gt;push(data, thread_id);&lt;br /&gt;&lt;br /&gt;        pthread_mutex_unlock(&amp;mutex);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    ~ParallelQueue(){&lt;br /&gt;        pthread_mutex_destroy(&amp;mutex);&lt;br /&gt;    }&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;#endif // PARALLELQUEUE_H&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Finally the &lt;code&gt;main.cpp&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;#include &amp;lt;iostream&amp;gt;&lt;br /&gt;#include &amp;lt;queue&amp;gt;&lt;br /&gt;#include &amp;lt;stdexcept&amp;gt;&lt;br /&gt;#include &amp;lt;exception&amp;gt;&lt;br /&gt;#include &amp;lt;algorithm&amp;gt;&lt;br /&gt;&lt;br /&gt;#include &quot;Thread.h&quot;&lt;br /&gt;#include &quot;ParallelQueue.h&quot;&lt;br /&gt;&lt;br /&gt;//using namespace std;&lt;br /&gt;&lt;br /&gt;#ifndef _REENTRANT&lt;br /&gt;#define _REENTRANT&lt;br /&gt;#endif&lt;br /&gt;&lt;br /&gt;#define QUEUE_SIZE                  5&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;// this class gives a unique customer id, each time its called, and its thread safe&lt;br /&gt;class UniqueCustomer{&lt;br /&gt;public:&lt;br /&gt;    int id;&lt;br /&gt;    pthread_mutex_t id_mutex;&lt;br /&gt;&lt;br /&gt;    UniqueCustomer(): id(0){&lt;br /&gt;        pthread_mutex_init(&amp;id_mutex, 0);&lt;br /&gt;    }&lt;br /&gt;    ~UniqueCustomer(){&lt;br /&gt;        pthread_mutex_destroy(&amp;id_mutex);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    void setNextCustomerId(int *id){&lt;br /&gt;        pthread_mutex_lock(&amp;id_mutex);&lt;br /&gt;        *id = this-&gt;id;&lt;br /&gt;        this-&gt;id++;&lt;br /&gt;        pthread_mutex_unlock(&amp;id_mutex);&lt;br /&gt;    }&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;// the global variable for getting a unique customer&lt;br /&gt;UniqueCustomer uc;&lt;br /&gt;&lt;br /&gt;class Producer: public Thread{&lt;br /&gt;private:&lt;br /&gt;    SafeQueue* q;&lt;br /&gt;    ParallelQueue *pq;&lt;br /&gt;    int max_producer_delay;&lt;br /&gt;&lt;br /&gt;public:&lt;br /&gt;    Producer(SafeQueue* q, const int max_producer_delay, const char* id): Thread(id){&lt;br /&gt;        this-&gt;q = q;&lt;br /&gt;        this-&gt;max_producer_delay = max_producer_delay;&lt;br /&gt;        // this is a must&lt;br /&gt;        sem_post(&amp;safety_sem);&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    Producer(ParallelQueue* pq, const int max_producer_delay, const char *id): Thread(id){&lt;br /&gt;        this-&gt;pq = pq;&lt;br /&gt;        this-&gt;max_producer_delay = max_producer_delay;&lt;br /&gt;        sem_post(&amp;safety_sem);&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    void run(){&lt;br /&gt;        int data;&lt;br /&gt;        printf(&quot;%s: Starting\n&quot;, id);&lt;br /&gt;        for(int i=0; i &lt; 100; i++){&lt;br /&gt;            //            cout &lt;&lt; id &lt;&lt; &quot;: trying to push &quot; &lt;&lt; i &lt;&lt; endl;&lt;br /&gt;            uc.setNextCustomerId(&amp;data);&lt;br /&gt;//            q-&gt;push(data, id);&lt;br /&gt;            pq-&gt;push_min(data, id);&lt;br /&gt;            sleep(rand() % max_producer_delay + 1);&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    ~Producer(){&lt;br /&gt;    }&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;class Consumer: public Thread{&lt;br /&gt;&lt;br /&gt;private:&lt;br /&gt;    SafeQueue* q;&lt;br /&gt;    int max_consumer_delay;&lt;br /&gt;&lt;br /&gt;public:&lt;br /&gt;    Consumer(SafeQueue *q, const int max_consumer_delay,const char* id): Thread(id){&lt;br /&gt;        // this is a must&lt;br /&gt;        this-&gt;max_consumer_delay = max_consumer_delay;&lt;br /&gt;        this-&gt;q = q;&lt;br /&gt;        sem_post(&amp;safety_sem);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    void run(){&lt;br /&gt;        int i;&lt;br /&gt;        printf(&quot;%s: Starting\n&quot;, id);&lt;br /&gt;        while(1){&lt;br /&gt;            q-&gt;pop(&amp;i, id);&lt;br /&gt;            //            cout &lt;&lt; id &lt;&lt; &quot;: popped &quot; &lt;&lt; i &lt;&lt; endl;&lt;br /&gt;            sleep(rand() % max_consumer_delay + 1);&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    ~Consumer(){&lt;br /&gt;    }&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;int main (void)&lt;br /&gt;{&lt;br /&gt;    try{&lt;br /&gt;        srand(time(NULL));&lt;br /&gt;&lt;br /&gt;        SafeQueue sq1 = SafeQueue(QUEUE_SIZE, (char *)&quot;Queue 1&quot;);&lt;br /&gt;        SafeQueue sq2 = SafeQueue(QUEUE_SIZE, (char *)&quot;Queue 2&quot;);&lt;br /&gt;&lt;br /&gt;        vector&lt; SafeQueue* &gt; vq;&lt;br /&gt;        vq.push_back(&amp;sq1);&lt;br /&gt;        vq.push_back(&amp;sq2);&lt;br /&gt;&lt;br /&gt;        ParallelQueue pq = ParallelQueue(vq);&lt;br /&gt;&lt;br /&gt;        Producer prod1 = Producer(&amp;pq, 2, &quot;Producer 1&quot;);&lt;br /&gt;        Producer prod2 = Producer(&amp;pq, 3, &quot;Producer 2&quot;);&lt;br /&gt;&lt;br /&gt;        Consumer cons1 = Consumer(&amp;sq1, 4, &quot;Consumer 1&quot;);&lt;br /&gt;        Consumer cons2 = Consumer(&amp;sq2, 2, &quot;Consumer 2&quot;);&lt;br /&gt;&lt;br /&gt;        cons1.start();&lt;br /&gt;        prod1.start();&lt;br /&gt;&lt;br /&gt;        cons2.start();&lt;br /&gt;        prod2.start();&lt;br /&gt;&lt;br /&gt;    }catch(exception &amp;ex){&lt;br /&gt;        printf(&quot;%s\n&quot;, ex.what());&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    return 0;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;You can see that the thread functions has become pretty simple, you just need to make sure that the data you are accessing belongs to a syncronized class and don&#39;t have to worry about anything else. I&#39;m looking for a better solution though, as there are some quirks in the code(see the comments). Might take a look into Boost&#39;s thread lib too if I can get the time (which most probably won&#39;t happen :().</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26443211/posts/default/1445537738535020849'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26443211/posts/default/1445537738535020849'/><link rel='alternate' type='text/html' href='http://zaher14.blogspot.com/2009/05/fun-with-posix-threads-bank-teller_02.html' title='Fun with Posix Threads: Bank Teller Problem'/><author><name>Abu Zaher Faridee</name><uri>https://plus.google.com/104067291049623797029</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-K2Xh7yMl0iU/AAAAAAAAAAI/AAAAAAAAApo/neDDkE7Fml8/s512-c/photo.jpg'/></author></entry><entry><id>tag:blogger.com,1999:blog-26443211.post-7115930500684008181</id><published>2009-04-29T17:52:00.001+06:00</published><updated>2009-04-29T17:52:24.474+06:00</updated><title type='text'>Update: CityCell Zoom in Ubuntu 9.04</title><content type='html'>&lt;div xmlns=&#39;http://www.w3.org/1999/xhtml&#39;&gt;So far so goood. The new Ubuntu boots in less than 15 minues, has more eye candy than anything before. But at what cost? They have stripped the new distro of &lt;code&gt;wvdial&lt;/code&gt;. Yes, its true.&lt;br/&gt;&lt;br/&gt;Not only that, the &lt;code&gt;usbserial&lt;/code&gt; module is built into kernel. This might sound advantageous in the first glance, but what about when you have to pass the module parameters into kernel, every time you boot?&lt;br/&gt;&lt;br/&gt;I have found a work around for this problem, hope it helps people like me who are dependent on EDGE/GPRS. Here I&#39;m going to describe the extra things that needs to be done to get things working. Details are in  my previus post, hope you don&#39;t mind. :)&lt;br/&gt;&lt;br/&gt;First you need to open &lt;code&gt;/boot/grub/menu.lst&lt;/code&gt; and add some parameters to the kernel. Find the line which is similar to this:&lt;br/&gt;&lt;code&gt;&lt;br/&gt;kernel		/boot/vmlinuz-2.6.29.1-macbook root=UUID=c660e7d4-95e3-42a0-8967-8de554d76fb4 ro quiet splash&lt;/code&gt;&lt;br/&gt;&lt;br/&gt;and change it to this:&lt;br/&gt;&lt;code&gt;&lt;br/&gt;kernel		/boot/vmlinuz-2.6.29.1-macbook root=UUID=c660e7d4-95e3-42a0-8967-8de554d76fb4 ro quiet splash usbserial.vendor=0x05c6 usbserial.product=0x3197&lt;/code&gt;&lt;br/&gt;&lt;br/&gt;The vendor and product sting can be found using &lt;code&gt;lsusb&lt;/code&gt; command. Reboot the system.&lt;br/&gt;&lt;br/&gt;Now comes the stupid part. Jaunty come with no wvdial, so you need to download the files manually. The files are&lt;br/&gt;&lt;code&gt;&lt;br/&gt;libuniconf4.4_4.4.1-0.2ubuntu2_i386.deb&lt;br/&gt;libwvstreams4.4-base_4.4.1-0.2ubuntu2_i386.deb&lt;br/&gt;libwvstreams4.4-extras_4.4.1-0.2ubuntu2_i386.deb&lt;br/&gt;libxplc0.3.13_0.3.13-1build1_i386.deb&lt;br/&gt;wvdial_1.60.1+nmu2_i386.deb&lt;br/&gt;&lt;/code&gt;&lt;br/&gt;&lt;br/&gt;Try looking them up in &lt;code&gt;http://archive.ubuntu.com/ubuntu/pool/&lt;/code&gt;. Once you download them put those downloaded files in the same folder, and then do a &lt;code&gt;$sudo dpkg -i *.deb&lt;/code&gt;.&lt;br/&gt;&lt;br/&gt;The rest of the process is pretty straightforward. You can find those &lt;a href=&#39;http://zaher14.blogspot.com/2009/03/citycell-zoom-in-ubuntu.html&#39;&gt;here&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;&lt;div class=&#39;zemanta-pixie&#39;&gt;&lt;img src=&#39;http://img.zemanta.com/pixy.gif?x-id=95706358-7fd2-82e3-b75a-1858f409c7fb&#39; class=&#39;zemanta-pixie-img&#39;/&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://zaher14.blogspot.com/feeds/7115930500684008181/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26443211&amp;postID=7115930500684008181' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26443211/posts/default/7115930500684008181'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26443211/posts/default/7115930500684008181'/><link rel='alternate' type='text/html' href='http://zaher14.blogspot.com/2009/04/update-citycell-zoom-in-ubuntu-904.html' title='Update: CityCell Zoom in Ubuntu 9.04'/><author><name>Abu Zaher Faridee</name><uri>https://plus.google.com/104067291049623797029</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-K2Xh7yMl0iU/AAAAAAAAAAI/AAAAAAAAApo/neDDkE7Fml8/s512-c/photo.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26443211.post-5096586477220791645</id><published>2009-04-18T22:05:00.004+06:00</published><updated>2009-04-28T06:49:20.312+06:00</updated><title type='text'>Subversion 101</title><content type='html'>This post covers the fundamentals of subversion, the popular version control system. I&#39;ll show how to use subversion to version-control &lt;code&gt;&lt;b&gt;linux-2.6.29.1&lt;/b&gt;&lt;/code&gt; kernel on your local server (I had to set this up for easy management of my kernel assignment). But before we begin, let&#39;s get familiar with some of the subversion terms.&lt;br/&gt;&lt;br /&gt;&lt;br /&gt;You do a &lt;code&gt;&lt;b&gt;check-out&lt;/b&gt;&lt;/code&gt; when you download some project from the server to your local machine, this creates the &lt;code&gt;&lt;b&gt;working copy&lt;/b&gt;&lt;/code&gt; for your subsequent modification.&lt;br/&gt;&lt;br /&gt;&lt;br /&gt;You do a &lt;code&gt;&lt;b&gt;check-in&lt;/b&gt;&lt;/code&gt; or &lt;code&gt;&lt;b&gt;commit&lt;/b&gt;&lt;/code&gt; when you upload your changes to the server.&lt;br/&gt;&lt;br /&gt;&lt;br /&gt;Self explanatory, &lt;code&gt;&lt;b&gt;update&lt;/b&gt;&lt;/code&gt; updates your code with the latest changes from the server.&lt;br/&gt;&lt;br /&gt;&lt;br /&gt;Doing an &lt;code&gt;&lt;b&gt;export&lt;/b&gt;&lt;/code&gt; will download the latest update from the server, but without subversion &lt;code&gt;&lt;b&gt;metadata&lt;/b&gt;&lt;/code&gt;, so you cannot upload the changes to the server from here. This mode is generally used to make the distribution tars.&lt;br/&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;b&gt;import&lt;/b&gt;&lt;/code&gt; will bring the data imported under subversion&#39;s control system.&lt;br/&gt;&lt;br /&gt;&lt;br /&gt;Now that we know the basic, let&#39;s do some command line stuff. I&#39;m assuming you have subversion installed in your system by now. In Ubuntu you can easily do this by &lt;code&gt;&lt;b&gt;sudo apt-get install subversion svnadmin&lt;/b&gt;&lt;/code&gt;.&lt;br/&gt;&lt;br /&gt;&lt;br /&gt;First step is to create the repository, typically its created in &lt;code&gt;&lt;b&gt;/var/svn/&lt;/b&gt;&lt;/code&gt;. So issue the command &lt;code&gt;&lt;b&gt;svnadmin create /var/svn&lt;/b&gt;&lt;/code&gt;.&lt;br/&gt;&lt;br /&gt;&lt;br /&gt;subversion can be run under several protocols, like &lt;code&gt;&lt;b&gt;svn://&lt;/b&gt;&lt;/code&gt; or &lt;code&gt;&lt;b&gt;http://&lt;/b&gt;&lt;/code&gt;. But right now we don&#39;t want to bother with that, we&#39;ll use simple &lt;code&gt;&lt;b&gt;file://&lt;/b&gt;&lt;/code&gt; for local access.&lt;br/&gt;&lt;br /&gt;&lt;br /&gt;First we need to create several folders in our repository. &lt;code&gt;&lt;b&gt;trunk&lt;/b&gt;&lt;/code&gt; is the folder where we&#39;ll put or main code. We&#39;ll use&lt;code&gt;&lt;b&gt; branches&lt;/b&gt;&lt;/code&gt; and &lt;code&gt;&lt;b&gt;tags&lt;/b&gt;&lt;/code&gt; when we think that we need to create several fork of the same project. So,&lt;br/&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;b&gt;&lt;br /&gt;svn mkdir file:///var/svn/trunk&lt;br /&gt;svn mkdir file:///var/svn/branches&lt;br /&gt;svn mkdir file:///var/svn/tags&lt;br /&gt;&lt;/b&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Now import your linux source code into svn,&lt;br /&gt;&lt;code&gt;&lt;b&gt;&lt;br /&gt;svn import ~/src/linux-2.6.29 file:///var/svn/trunk/linux-2.6.29.1 --message &quot;Importing linux kernel 2.6.29.1&quot;&lt;br /&gt;&lt;/b&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Go to the folder where you want to create the working copy.&lt;br /&gt;&lt;code&gt;&lt;b&gt;&lt;br /&gt;svn checkout file:///var/svn/trunk/linux-2.6.29.1&lt;br /&gt;&lt;/b&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Edit files as needed. Then check status by,&lt;br /&gt;&lt;code&gt;&lt;b&gt;&lt;br /&gt;svn status&lt;br /&gt;&lt;/b&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Update code from server&lt;br /&gt;&lt;code&gt;&lt;b&gt;&lt;br /&gt;svn update&lt;br /&gt;&lt;/b&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Commit your changes&lt;br /&gt;&lt;code&gt;&lt;b&gt;&lt;br /&gt;svn commit --message &quot;Added some feature&quot;&lt;br /&gt;&lt;/b&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Create a branch&lt;br /&gt;&lt;code&gt;&lt;b&gt;&lt;br /&gt;svn cp file:///var/svn/trunk/linux-2.6.29.1 file://var/svn/branches/linux-2.6.29.1-vanilla -m &quot;Creating a branch for the vanilla kernel&quot;&lt;br /&gt;&lt;/b&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;If you don&#39;t like command line, use &lt;code&gt;&lt;b&gt;rapidsvn&lt;/b&gt;&lt;/code&gt;. It has a really nice GUI. Also popular IDE like Netbeans and Eclipse has build in subversion support.&lt;br /&gt;&lt;br /&gt;I&#39;ll try to cover using subversion over http in my next post.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26443211/posts/default/5096586477220791645'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26443211/posts/default/5096586477220791645'/><link rel='alternate' type='text/html' href='http://zaher14.blogspot.com/2009/04/subversion-101.html' title='Subversion 101'/><author><name>Abu Zaher Faridee</name><uri>https://plus.google.com/104067291049623797029</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-K2Xh7yMl0iU/AAAAAAAAAAI/AAAAAAAAApo/neDDkE7Fml8/s512-c/photo.jpg'/></author></entry><entry><id>tag:blogger.com,1999:blog-26443211.post-1020085509254903507</id><published>2009-04-17T09:16:00.006+06:00</published><updated>2009-04-17T13:07:54.655+06:00</updated><title type='text'>Linux Kernel: Speed Up Compilation</title><content type='html'>I have been having a hard time for the last few days in doing my &quot;Linux Kernel Assignment&quot;. No, programming is not the hardest part. Waiting for the kernel to compile is the main problem. Its pathetically the moment when you become the sitting duck. :). So here are some of the things I came across to speed up the compilation.&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Make sure you have &lt;code&gt;ccache&lt;/code&gt; installed and configured. As the name suggests, &lt;code&gt;ccache&lt;/code&gt; dramatically speeds up subsequent compilations by caching the object files. In most new Fedora distros, its enabled by default. You can check it by doing &lt;code&gt;$which gcc&lt;/code&gt;. If it says something like &lt;code&gt;/usr/lib/ccache/gcc&lt;/code&gt;, you are all set up. If not, try google, :)&lt;br /&gt;You can see see its status by issuing command &lt;code&gt;$ccache -s&lt;/code&gt;. Its good to set the cache amount a bigger than default, so &lt;code&gt;$ccache -M 2G&lt;/code&gt; will set the cache to 2GB which is enough for everyone.&lt;/li&gt;&lt;li&gt; Use &lt;code&gt;gcc&lt;/code&gt; option &lt;code&gt;-pipe&lt;/code&gt; whenever possible. Self explanatory, it uses pipes instead of temporary files.&lt;/li&gt;&lt;li&gt;If you have dual core or quad core processor and a lot of RAM, you&#39;ll notice that while compiling, only a fraction of your processor and RAM gets used. This is because there is only one compile process running at a time. You can specify multiple &lt;code&gt;make&lt;/code&gt; jobs by passing parameter like this &lt;code&gt;$make -j 2&lt;/code&gt;. Here, make will run at most 2 jobs at a time, taking full advantage of your multi-core CPU and RAM. Some argue on setting higher value, but I do not recommend it, as it likely to have negative effect because of the large amount of context switched in the CPU. People say that this approach leads to race conditions but I haven&#39;t bumped into any of that yet.&lt;/li&gt;&lt;li&gt;For Linux Kernel compilation, make sure you have &lt;code&gt;CONFIG_DEBUG_KERNEL&lt;/code&gt; unset in &lt;code&gt;.config&lt;/code&gt; file. If set, this builds your kernel with debugging symbol making your kernel a lot bigger and significantly longer to build. It will make kernel debugging impossible though, but when you are in a hurry, this really makes more sense. Also strip the &lt;code&gt;.config&lt;/code&gt; file from any unnecessary drivers/modules you don&#39;t require, but this will require you to have a thorough knowledge about both your PC and running kernel.&lt;/li&gt;&lt;li&gt;For those with high speed network (ethernet or more), give a try to &lt;code&gt;distcc&lt;/code&gt;, that distributes the compilation among multiple machine. The configuration is quite straight forward. Check the references section for details. &lt;/li&gt;&lt;li&gt;Try &lt;code&gt;tmpfs&lt;/code&gt;. It enables you to mount any folder in your file system in RAM, so theoretically speeding up the compilation. Try mounting your build folder with &lt;code&gt;tmpfs&lt;/code&gt; like this &lt;code&gt;$sudo mount -t tmpfs -o size=500M,mode=0777 tmpfs /usr/src/linux-build&lt;/code&gt;.&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;Using the above mentioned method, you can get a clean build of 2.6.29 kernel in less than 15 minutes. Let me know if you have any problems or come up with any better solutions. :)&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;References:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;https://help.ubuntu.com/community/Kernel/Compile&lt;br /&gt;&lt;p&gt;http://www.linux.org/docs/ldp/howto/Modules/speedup.html&lt;/p&gt;&lt;p&gt;http://en.gentoo-wiki.com/wiki/Portage_TMPDIR_on_tmpfs&lt;/p&gt;&lt;p&gt;http://www.ibm.com/developerworks/linux/library/l-distcc.html&lt;/p&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26443211/posts/default/1020085509254903507'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26443211/posts/default/1020085509254903507'/><link rel='alternate' type='text/html' href='http://zaher14.blogspot.com/2009/04/linux-kernel-speed-up-compilation.html' title='Linux Kernel: Speed Up Compilation'/><author><name>Abu Zaher Faridee</name><uri>https://plus.google.com/104067291049623797029</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-K2Xh7yMl0iU/AAAAAAAAAAI/AAAAAAAAApo/neDDkE7Fml8/s512-c/photo.jpg'/></author></entry><entry><id>tag:blogger.com,1999:blog-26443211.post-6301377413349976649</id><published>2009-04-03T22:16:00.001+06:00</published><updated>2009-04-03T22:21:26.205+06:00</updated><title type='text'>Ubuntu: Easy kernel compile for newbies</title><content type='html'>&lt;div xmlns=&#39;http://www.w3.org/1999/xhtml&#39;&gt;Building a fully optimised kernel just for your pc is one of most exiting things to do. But manual kernel compilation not an easy task and occasionally things go haywire all the time. Luckily Ubuntu comes with some nifty tools to make it easier than ever. Here is a short how-to for the starters. Remember, these are the basic steps. I&#39;ve skipped most of the exiting parts to make it as simple as possible. &lt;br/&gt;&lt;ul&gt;&lt;li&gt;Download the latest Kernel from &lt;a href=&#39;http://kernel.org/&#39;&gt;&lt;code&gt;http://kernel.org/&lt;/code&gt;&lt;/a&gt;. For e.g. linux-2.6.29.tar.bz2&lt;/li&gt;&lt;li&gt;Create a folder named &lt;code&gt;src&lt;/code&gt; in your home folder and put the downloaded file in it.&lt;/li&gt;&lt;li&gt;Untar the file&lt;ul&gt;&lt;code&gt;$tar xvjf ~/src/linux-2.6.29.tar.bz2&lt;br/&gt;$cd ~/src/linux-2.6.29&lt;/code&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;ul&gt;&lt;code/&gt;&lt;/ul&gt;&lt;code&gt;Run the Following commands to install the necessary packages to build the kernel&lt;/code&gt;&lt;ul&gt;&lt;code&gt;$sudo apt-get install build-essential fakeroot initramfs-tools libncurses5 libncurses5-dev&lt;/code&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;Create a base config file, we&#39;ll reuse the current kernel&#39;s config&lt;br/&gt;&lt;ul&gt;&lt;code&gt;$cp -vi /boot/config-`uname -r` .config&lt;code/&gt;&lt;/code&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;Run this command, a graphical window will appear. Here you can make change to the kernel configs. Right now we won&#39;t change anything. So just run it and save.&lt;br/&gt;&lt;ul&gt;&lt;code&gt;$make menuconfig&lt;code/&gt;&lt;/code&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;Do a cleaning in the source tree&lt;ul&gt;&lt;code&gt;$make-kpkg clean&lt;code/&gt;&lt;/code&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;The real stuff, build the kernel (this will take a really long time, so grab a cup of cofee). I&#39;ll call this version &#39;paladin&#39;.&lt;br/&gt;&lt;ul&gt;&lt;code&gt;$fakeroot make-kpkg --initrd --append-to-version=-paladin kernel-image kernel-headers&lt;code/&gt;&lt;/code&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;Install the packages&lt;ul&gt;&lt;code&gt;$sudo dpkg -i ~/src/*.deb&lt;code/&gt;&lt;/code&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;Do a reboot and enjoy the new kernel&lt;/li&gt;&lt;li&gt;If anything goes wrong (kernel panic !!!), you might need to take a socond look at the configurations.&lt;br/&gt;&lt;/li&gt;&lt;/ul&gt;&lt;code&gt;&lt;br/&gt;&lt;/code&gt;&lt;br/&gt;&lt;br/&gt;&lt;div class=&#39;zemanta-pixie&#39;&gt;&lt;img src=&#39;http://img.zemanta.com/pixy.gif?x-id=394a7867-8dee-8929-b50c-a14dffed6593&#39; class=&#39;zemanta-pixie-img&#39;/&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://zaher14.blogspot.com/feeds/6301377413349976649/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26443211&amp;postID=6301377413349976649' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26443211/posts/default/6301377413349976649'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26443211/posts/default/6301377413349976649'/><link rel='alternate' type='text/html' href='http://zaher14.blogspot.com/2009/04/ubuntu-easy-kernel-compile-for-newbies.html' title='Ubuntu: Easy kernel compile for newbies'/><author><name>Abu Zaher Faridee</name><uri>https://plus.google.com/104067291049623797029</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-K2Xh7yMl0iU/AAAAAAAAAAI/AAAAAAAAApo/neDDkE7Fml8/s512-c/photo.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26443211.post-1820450694213408265</id><published>2009-03-28T21:45:00.001+06:00</published><updated>2009-03-28T21:45:05.780+06:00</updated><title type='text'>CityCell Zoom in Ubuntu</title><content type='html'>&lt;div xmlns=&#39;http://www.w3.org/1999/xhtml&#39;&gt;One of my friends just asked me on how to connect to Internet in Ubuntu/Linux using Citycell Zoom. Here goes the procedure.&lt;br/&gt;&lt;br/&gt;Connect your zoom device/phone to your PC/laptops USB port.&lt;br/&gt;&lt;br/&gt;Issue this command in the shell:&lt;br/&gt;&lt;code&gt;&lt;br/&gt;	$lsusb&lt;br/&gt;&lt;/code&gt;&lt;br/&gt;&lt;br/&gt;You shall get a list of devices:&lt;br/&gt;&lt;br/&gt;&lt;code&gt;&lt;br/&gt;Bus 005 Device 004: ID 05ac:8300 Apple, Inc. Built-in iSight (no firmware loaded)&lt;br/&gt;Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub&lt;br/&gt;Bus 004 Device 003: ID 05ac:8205 Apple, Inc. Bluetooth HCI MacBookPro&lt;br/&gt;Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub&lt;br/&gt;Bus 003 Device 002: ID 05ac:8240 Apple, Inc. IR Receiver [build-in]&lt;br/&gt;Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub&lt;br/&gt;Bus 002 Device 004: ID 15ca:00c3 Textech International Ltd. Mini Optical Mouse&lt;br/&gt;Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub&lt;br/&gt;Bus 001 Device 004: ID 05c6:3197 Qualcomm, Inc. CDMA Wireless Modem/Phone&lt;br/&gt;Bus 001 Device 003: ID 05ac:021a Apple, Inc. &lt;br/&gt;Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub&lt;br/&gt;&lt;/code&gt;&lt;br/&gt;&lt;br/&gt;Note the line:&lt;br/&gt;&lt;code&gt;&lt;br/&gt;Bus 001 Device 004: ID 05c6:3197 Qualcomm, Inc. CDMA Wireless Modem/Phone&lt;br/&gt;&lt;/code&gt;&lt;br/&gt;&lt;br/&gt;The line has following meaninng.&lt;br/&gt;&lt;br/&gt;&lt;code&gt;&lt;br/&gt;Vendor ID: 05c6&lt;br/&gt;Product ID: 3197&lt;br/&gt;&lt;/code&gt;&lt;br/&gt;&lt;br/&gt;Now execute following command in shell&lt;br/&gt;&lt;br/&gt;&lt;code&gt;&lt;br/&gt;$sudo modprobe usbserial vendor=0x05c6 product=0x3197&lt;br/&gt;&lt;/code&gt;&lt;br/&gt;&lt;br/&gt;Now back to good old wvdial&lt;br/&gt;&lt;code&gt;&lt;br/&gt;sudo wvdialconf&lt;br/&gt;&lt;/code&gt;&lt;br/&gt;&lt;br/&gt;It shall now find a modem in &lt;code&gt;/dev/ttyUSB0&lt;/code&gt;&lt;br/&gt;&lt;br/&gt;Now open &lt;code&gt;/etc/wvdial.conf&lt;/code&gt; and make sure you have the following lines in it.&lt;br/&gt;&lt;br/&gt;&lt;code&gt;&lt;br/&gt;Phone=#777&lt;br/&gt;Username = waps&lt;br/&gt;Password = waps&lt;br/&gt;Stupid Mode = 1&lt;br/&gt;&lt;/code&gt;&lt;br/&gt;&lt;br/&gt;Now run &lt;code&gt;$sudo wvdial&lt;/code&gt; from your shell and you have net. :)&lt;br/&gt;&lt;br/&gt;Happy Linuxing ...&lt;br/&gt;&lt;br/&gt;&lt;div class=&#39;zemanta-pixie&#39;&gt;&lt;img src=&#39;http://img.zemanta.com/pixy.gif?x-id=fa4d32ae-5d0c-8f9a-aede-6545f57812c7&#39; class=&#39;zemanta-pixie-img&#39;/&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://zaher14.blogspot.com/feeds/1820450694213408265/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26443211&amp;postID=1820450694213408265' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26443211/posts/default/1820450694213408265'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26443211/posts/default/1820450694213408265'/><link rel='alternate' type='text/html' href='http://zaher14.blogspot.com/2009/03/citycell-zoom-in-ubuntu.html' title='CityCell Zoom in Ubuntu'/><author><name>Abu Zaher Faridee</name><uri>https://plus.google.com/104067291049623797029</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-K2Xh7yMl0iU/AAAAAAAAAAI/AAAAAAAAApo/neDDkE7Fml8/s512-c/photo.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26443211.post-3255024110448385739</id><published>2009-03-04T11:07:00.004+06:00</published><updated>2009-03-04T11:16:07.659+06:00</updated><title type='text'>Mozilla Weave: Bringing Desktop and Web Applications closer</title><content type='html'>&lt;div&gt;&quot;&lt;span class=&quot;Apple-style-span&quot;   style=&quot; color: rgb(102, 102, 102);  font-weight: bold; font-family:&#39;Helvetica Neue&#39;;font-size:13px;&quot;&gt;As the Web continues to evolve and more of our lives move online, we believe that Web browsers like Firefox can and should do more to broker rich experiences while increasing user control over their data and personal information.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;    style=&quot;font-family:&#39;Helvetica Neue&#39;;font-size:100%;color:#666666;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:13px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt; &lt;p style=&quot;margin: 0.0px 0.0px 14.0px 0.0px; line-height: 18.0px; font: 13.0px Helvetica Neue; color: #666666&quot;&gt;One important area for exploration is the blending of the desktop and the Web through deeper integration of the browser with online services.&quot;&lt;/p&gt;&lt;div&gt;&lt;a href=&quot;http://labs.mozilla.com/2007/12/introducing-weave/&quot;&gt;http://labs.mozilla.com/2007/12/introducing-weave/&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Just got my account activated @ Mozilla Weave Project.&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26443211/posts/default/3255024110448385739'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26443211/posts/default/3255024110448385739'/><link rel='alternate' type='text/html' href='http://zaher14.blogspot.com/2009/03/mozilla-weave-bringing-desktop-and-web.html' title='Mozilla Weave: Bringing Desktop and Web Applications closer'/><author><name>Abu Zaher Faridee</name><uri>https://plus.google.com/104067291049623797029</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-K2Xh7yMl0iU/AAAAAAAAAAI/AAAAAAAAApo/neDDkE7Fml8/s512-c/photo.jpg'/></author></entry><entry><id>tag:blogger.com,1999:blog-26443211.post-34548940006366515</id><published>2009-03-03T19:21:00.002+06:00</published><updated>2009-03-04T01:21:13.725+06:00</updated><title type='text'>Mac: Google Chrome on OS X</title><content type='html'>Yeah, like all Mac users I&#39;m angry too. There is no mac version of &lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_0&quot;&gt;Google&#39;s&lt;/span&gt; Chrome browser. Google has yet to release it for OS X, but here is the good news. Chrome&#39;s opens source version known as Chromium&#39;s source tree is open. So anyone can download it and try it out for themselves. Its far from finished, but you can at least get your hands dirty with Chromium in OS X.&lt;br /&gt;&lt;br /&gt;Here are some links you&#39;ll need to get started.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://code.google.com/p/chromium/wiki/MacBuildInstructions&quot; style=&quot;text-decoration: none;&quot;&gt;http://code.google.com/p/chromium/wiki/MacBuildInstructions&lt;/a&gt;&lt;a href=&quot;http://dev.chromium.org/developers/how-tos/get-the-code&quot;&gt;http://dev.chromium.org/developers/how-tos/get-the-code&lt;/a&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Or if you are lazy like me, download the already built dmg image from &lt;a href=&quot;http://www.latko.org/2009/02/13/chromium-build-for-os-x/&quot;&gt;this&lt;/a&gt; link.&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26443211/posts/default/34548940006366515'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26443211/posts/default/34548940006366515'/><link rel='alternate' type='text/html' href='http://zaher14.blogspot.com/2009/03/mac-google-chrome-on-os-x.html' title='Mac: Google Chrome on OS X'/><author><name>Abu Zaher Faridee</name><uri>https://plus.google.com/104067291049623797029</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-K2Xh7yMl0iU/AAAAAAAAAAI/AAAAAAAAApo/neDDkE7Fml8/s512-c/photo.jpg'/></author></entry><entry><id>tag:blogger.com,1999:blog-26443211.post-9089828762208412666</id><published>2009-03-02T16:15:00.006+06:00</published><updated>2009-03-02T20:18:02.324+06:00</updated><title type='text'>Safari: Checking iPhone Version of Your Site Right from Safari</title><content type='html'>I must say, I&#39;m greatly impressed at the new public beta release of Apples Safari&#39;s version 4. Tons of new features proved that its living up to expectations. Some notable features that caught my eye were,  firebug like web inspector, new intuitive tabbed browsing, and some cosmetic features like cover flow like history browsing and opera like top site marker (Check out the screen-shot below)&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://2.bp.blogspot.com/_qZgIETMJjmk/SavqTQkjSpI/AAAAAAAAATQ/YhmKgrz3jIw/s1600-h/Picture+6.png&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 309px;&quot; src=&quot;http://2.bp.blogspot.com/_qZgIETMJjmk/SavqTQkjSpI/AAAAAAAAATQ/YhmKgrz3jIw/s400/Picture+6.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5308594202372950674&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://3.bp.blogspot.com/_qZgIETMJjmk/SavqSgeTB7I/AAAAAAAAATI/dqPsYrXJQeY/s1600-h/Picture+7.png&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 324px;&quot; src=&quot;http://3.bp.blogspot.com/_qZgIETMJjmk/SavqSgeTB7I/AAAAAAAAATI/dqPsYrXJQeY/s400/Picture+7.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5308594189461817266&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://3.bp.blogspot.com/_qZgIETMJjmk/SavqR61OMYI/AAAAAAAAATA/LK6Er7AtwIM/s1600-h/Picture+8.png&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 270px;&quot; src=&quot;http://3.bp.blogspot.com/_qZgIETMJjmk/SavqR61OMYI/AAAAAAAAATA/LK6Er7AtwIM/s400/Picture+8.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5308594179357421954&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;To enable the debug menu, you need to enable it from the preferences tab.&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://3.bp.blogspot.com/_qZgIETMJjmk/SaviGyS6LWI/AAAAAAAAASY/f3hD-ZLuK_U/s1600-h/Picture+1.png&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 271px;&quot; src=&quot;http://3.bp.blogspot.com/_qZgIETMJjmk/SaviGyS6LWI/AAAAAAAAASY/f3hD-ZLuK_U/s400/Picture+1.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5308585191994436962&quot; /&gt;&lt;/a&gt;You&#39;ll see a new &quot;Develop&quot; menu has appeared. Now to the thing what this post is all about. From the Develop menu, set your user agent to &quot;Mobile Safari&quot;.&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://3.bp.blogspot.com/_qZgIETMJjmk/SaviG0ZKghI/AAAAAAAAASg/zHsAhBKAdPM/s1600-h/Picture+2.png&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 195px; height: 400px;&quot; src=&quot;http://3.bp.blogspot.com/_qZgIETMJjmk/SaviG0ZKghI/AAAAAAAAASg/zHsAhBKAdPM/s400/Picture+2.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5308585192557543954&quot; /&gt;&lt;/a&gt;&lt;br /&gt;Now just go to any site that has special pages for iPhone, my Gmail Looks like this.&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://4.bp.blogspot.com/_qZgIETMJjmk/SaviHLVSEaI/AAAAAAAAASo/D29Gx7mBTbs/s1600-h/Picture+3.png&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 241px; height: 400px;&quot; src=&quot;http://4.bp.blogspot.com/_qZgIETMJjmk/SaviHLVSEaI/AAAAAAAAASo/D29Gx7mBTbs/s400/Picture+3.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5308585198715277730&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://1.bp.blogspot.com/_qZgIETMJjmk/SaviHpittvI/AAAAAAAAASw/rXfhIdZnjbA/s1600-h/Picture+4.png&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 242px; height: 400px;&quot; src=&quot;http://1.bp.blogspot.com/_qZgIETMJjmk/SaviHpittvI/AAAAAAAAASw/rXfhIdZnjbA/s400/Picture+4.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5308585206824679154&quot; /&gt;&lt;/a&gt;And this is my how my Facebook profile looks in iPhone.&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://2.bp.blogspot.com/_qZgIETMJjmk/SaviHxoJUGI/AAAAAAAAAS4/3ezYK7cp2OE/s1600-h/Picture+5.png&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 242px; height: 400px;&quot; src=&quot;http://2.bp.blogspot.com/_qZgIETMJjmk/SaviHxoJUGI/AAAAAAAAAS4/3ezYK7cp2OE/s400/Picture+5.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5308585208994943074&quot; /&gt;&lt;/a&gt;And you never had to use an iPhone to check it out.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26443211/posts/default/9089828762208412666'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26443211/posts/default/9089828762208412666'/><link rel='alternate' type='text/html' href='http://zaher14.blogspot.com/2009/03/safari-checking-iphone-version-of-your.html' title='Safari: Checking iPhone Version of Your Site Right from Safari'/><author><name>Abu Zaher Faridee</name><uri>https://plus.google.com/104067291049623797029</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-K2Xh7yMl0iU/AAAAAAAAAAI/AAAAAAAAApo/neDDkE7Fml8/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/_qZgIETMJjmk/SavqTQkjSpI/AAAAAAAAATQ/YhmKgrz3jIw/s72-c/Picture+6.png" height="72" width="72"/></entry><entry><id>tag:blogger.com,1999:blog-26443211.post-1004267192293451921</id><published>2009-01-16T21:57:00.001+06:00</published><updated>2009-01-16T21:58:35.373+06:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="MacOSX"/><category scheme="http://www.blogger.com/atom/ns#" term="Scripts"/><category scheme="http://www.blogger.com/atom/ns#" term="Tips and Tricks"/><category scheme="http://www.blogger.com/atom/ns#" term="Xcode"/><title type='text'>Tips: Download iPhone SDK with wget</title><content type='html'>&lt;div xmlns=&#39;http://www.w3.org/1999/xhtml&#39;&gt;Since its final release, I&#39;ve been trying to download iPhone&#39;s SDK from Apple&#39;s website. The whopping 1.6 GB download seems a pretty daunting task in my unstable line, and some of apple&#39;s web sites features made it pretty impossible in no time.&lt;br/&gt;&lt;br/&gt;My download failed three times after 50-70% completion, each time either I have manually paused the download for some reason or my connection was having some problem. And apples server did not give me any resume feature in any of the download  managers. Downloading 1.6 GB with Firefox&#39;s own download manger seemed an option, but what if Firefox crashes?&lt;br/&gt;&lt;br/&gt;At last, I thought of giving good ol&#39; wget a try and it didn&#39;t fail me. If you are in a similar situation like me, try this.&lt;br/&gt;&lt;ol&gt;&lt;li&gt;Downlaod &#39;Export Cookie&#39; addon for firefox from &lt;a href=&#39;https://addons.mozilla.org/en-US/firefox/addon/8154&#39;&gt;here&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Log into &lt;a href=&#39;http://developer.apple.com/iphone/index.action&#39;&gt;iPhone Developer Site&lt;/a&gt; using your apple developer account, if you don&#39;t have one, just register, its free.&lt;/li&gt;&lt;li&gt;Export your cookie using the addon to a file named &#39;cookies.txt&#39;&lt;/li&gt;&lt;li&gt;Run this from the command line&lt;p&gt;&lt;code&gt;wget --limit-rate=5k --tries=inf -server-response --continue --load-cookies cookies.txt http://adcdownload.apple.com/iphone/iphone_sdk_for_iphone_os_2.2__9m2621__final/iphone_sdk_for_iphone_os_2.2_9m2621_final.dmg&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;Now you can pause and resume the download at your will. I have used &lt;b&gt;--limit-rate=5k &lt;/b&gt;so that I can also browse without much overhead.&lt;br/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://zaher14.blogspot.com/feeds/1004267192293451921/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26443211&amp;postID=1004267192293451921' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26443211/posts/default/1004267192293451921'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26443211/posts/default/1004267192293451921'/><link rel='alternate' type='text/html' href='http://zaher14.blogspot.com/2009/01/tips-download-iphone-sdk-with-wget.html' title='Tips: Download iPhone SDK with wget'/><author><name>Abu Zaher Faridee</name><uri>https://plus.google.com/104067291049623797029</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-K2Xh7yMl0iU/AAAAAAAAAAI/AAAAAAAAApo/neDDkE7Fml8/s512-c/photo.jpg'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26443211.post-8760603234094954182</id><published>2009-01-14T19:35:00.007+06:00</published><updated>2009-04-28T07:15:50.417+06:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="web development"/><title type='text'>Javascript: Getting Current Window Dimension</title><content type='html'>Javascript function to get current window height and width. Works with most of the browsers.&lt;br /&gt;&lt;br /&gt;&lt;pre name=&quot;code&quot; class=&quot;js&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;// function to get the current width of the window&lt;br /&gt;function getWidth(){&lt;br /&gt;var x = 0;&lt;br /&gt;if (self.innerHeight){&lt;br /&gt;   x = self.innerWidth;&lt;br /&gt;}else if (document.documentElement &amp;amp;&amp;amp; document.documentElement.clientHeight){&lt;br /&gt;   x = document.documentElement.clientWidth;&lt;br /&gt;}else if (document.body){&lt;br /&gt;   x = document.body.clientWidth;&lt;br /&gt;}&lt;br /&gt;return x;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// function to get the current height of the window&lt;br /&gt;function getHeight(){&lt;br /&gt;var y = 0;&lt;br /&gt;if (self.innerHeight){&lt;br /&gt;   y = self.innerHeight;&lt;br /&gt;}else if (document.documentElement &amp;amp;&amp;amp; document.documentElement.clientHeight){&lt;br /&gt;   y = document.documentElement.clientHeight;&lt;br /&gt;}else if (document.body){&lt;br /&gt;   y = document.body.clientHeight;&lt;br /&gt;}&lt;br /&gt;return y;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://zaher14.blogspot.com/feeds/8760603234094954182/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26443211&amp;postID=8760603234094954182' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26443211/posts/default/8760603234094954182'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26443211/posts/default/8760603234094954182'/><link rel='alternate' type='text/html' href='http://zaher14.blogspot.com/2009/01/javascript-getting-current-window.html' title='Javascript: Getting Current Window Dimension'/><author><name>Abu Zaher Faridee</name><uri>https://plus.google.com/104067291049623797029</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-K2Xh7yMl0iU/AAAAAAAAAAI/AAAAAAAAApo/neDDkE7Fml8/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26443211.post-8254536374818351941</id><published>2008-10-06T18:28:00.009+06:00</published><updated>2009-01-16T22:23:03.306+06:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Scripts"/><category scheme="http://www.blogger.com/atom/ns#" term="system admin"/><category scheme="http://www.blogger.com/atom/ns#" term="Tips and Tricks"/><category scheme="http://www.blogger.com/atom/ns#" term="Ubuntu"/><title type='text'>System Admin: EDGE/GPRS via Bluetooth in Linux Simplified</title><content type='html'>&lt;div xmlns=&#39;http://www.w3.org/1999/xhtml&#39;&gt;This is an update to one of my earlier posts. I was trying to find a more portable way with wvdial and came up with this.&lt;br/&gt;&lt;br/&gt;Start with the same command,&lt;br/&gt;&lt;code&gt;&lt;br/&gt;$hcitool scan&lt;br/&gt;&lt;/code&gt;&lt;br/&gt;We get some info&lt;br/&gt;&lt;pre&gt;&amp;lt;code&amp;gt;Scanning ...&amp;lt;br /&amp;gt; 00:1D:FD:36:9E:DB 3110c Emerald&amp;lt;br /&amp;gt;&amp;lt;/code&amp;gt;&amp;lt;br /&amp;gt;&lt;/pre&gt;Here &quot;00:1D:FD:36:9E:DB&quot; is the blue-tooth address of my phone.&lt;br/&gt;&lt;br/&gt;Time to put this address into good use. We&#39;re going to bind this blue-tooth address with a specific device identifier.&lt;br/&gt;&lt;code&gt;&lt;br/&gt;$sudo rfcomm bind 0 00:1D:FD:36:9E:DB 1&lt;br/&gt;&lt;/code&gt;&lt;br/&gt;Let me put some light into this command, the second argument in this command (in this case 0) is the device identifier, the third is the blue-tooth address (distinct for each device) and the fourth is the channel number which is typically 1.&lt;br/&gt;&lt;br/&gt;After executing this command this mobile phone is directly accessible through /dev/rfcomm0&lt;br/&gt;&lt;br/&gt;As said earlier, we are going to use &lt;code&gt;wvdial&lt;/code&gt; this time. But we need to do another trick.&lt;br/&gt;&lt;code&gt;&lt;br/&gt;$sudo ln -s /dev/rfcomm0 /dev/ttyS4&lt;br/&gt;&lt;/code&gt;&lt;br/&gt;Now we just run&lt;br/&gt;&lt;code&gt;&lt;br/&gt;$sudo wvdialconf&lt;br/&gt;&lt;/code&gt;&lt;br/&gt;You should see some output in the terminal&lt;br/&gt;&lt;code&gt;&lt;br/&gt;Editing `/etc/wvdial.conf&#39;.&lt;br/&gt;&lt;br/&gt;Scanning your serial ports for a modem.&lt;br/&gt;&lt;br/&gt;ttyS0&amp;lt;*1&amp;gt;: ATQ0 V1 E1 -- failed with 2400 baud, next try: 9600 baud&lt;br/&gt;ttyS0&amp;lt;*1&amp;gt;: ATQ0 V1 E1 -- failed with 9600 baud, next try: 115200 baud&lt;br/&gt;ttyS0&amp;lt;*1&amp;gt;: ATQ0 V1 E1 -- and failed too at 115200, giving up.&lt;br/&gt;Modem Port Scan&amp;lt;*1&amp;gt;: S1   S2   S3&lt;br/&gt;WvModem&amp;lt;*1&amp;gt;: Cannot get information for serial port.&lt;br/&gt;ttyS4&amp;lt;*1&amp;gt;: ATQ0 V1 E1 -- OK&lt;br/&gt;ttyS4&amp;lt;*1&amp;gt;: ATQ0 V1 E1 Z -- OK&lt;br/&gt;ttyS4&amp;lt;*1&amp;gt;: ATQ0 V1 E1 S0=0 -- OK&lt;br/&gt;ttyS4&amp;lt;*1&amp;gt;: ATQ0 V1 E1 S0=0 &amp;amp;C1 -- OK&lt;br/&gt;ttyS4&amp;lt;*1&amp;gt;: ATQ0 V1 E1 S0=0 &amp;amp;C1 &amp;amp;D2 -- OK&lt;br/&gt;ttyS4&amp;lt;*1&amp;gt;: ATQ0 V1 E1 S0=0 &amp;amp;C1 &amp;amp;D2 +FCLASS=0 -- OK&lt;br/&gt;ttyS4&amp;lt;*1&amp;gt;: Modem Identifier: ATI -- Nokia&lt;br/&gt;ttyS4&amp;lt;*1&amp;gt;: Speed 4800: AT -- OK&lt;br/&gt;ttyS4&amp;lt;*1&amp;gt;: Speed 9600: AT -- OK&lt;br/&gt;ttyS4&amp;lt;*1&amp;gt;: Speed 19200: AT -- OK&lt;br/&gt;ttyS4&amp;lt;*1&amp;gt;: Speed 38400: AT -- OK&lt;br/&gt;ttyS4&amp;lt;*1&amp;gt;: Speed 57600: AT -- OK&lt;br/&gt;ttyS4&amp;lt;*1&amp;gt;: Speed 115200: AT -- OK&lt;br/&gt;ttyS4&amp;lt;*1&amp;gt;: Speed 230400: AT -- OK&lt;br/&gt;ttyS4&amp;lt;*1&amp;gt;: Speed 460800: AT -- OK&lt;br/&gt;ttyS4&amp;lt;*1&amp;gt;: Max speed is 460800; that should be safe.&lt;br/&gt;ttyS4&amp;lt;*1&amp;gt;: ATQ0 V1 E1 S0=0 &amp;amp;C1 &amp;amp;D2 +FCLASS=0 -- OK&lt;br/&gt;&lt;br/&gt;Found a modem on /dev/ttyS4.&lt;br/&gt;Modem configuration written to /etc/wvdial.conf.&lt;br/&gt;ttyS4&lt;info&gt;: Speed 460800; init &quot;ATQ0 V1 E1 S0=0 &amp;amp;C1 &amp;amp;D2 +FCLASS=0&quot;&lt;br/&gt;&lt;/info&gt;&lt;/code&gt;&lt;br/&gt;Open up /etc/wvdial.conf with your favourite text editor and add this line&lt;br/&gt;&lt;code&gt;&lt;br/&gt;&lt;span style=&#39;font-weight: bold;&#39;&gt;Init3 = AT+CGDCONT=1,&quot;IP&quot;,&quot;gpinternet&quot;&lt;/span&gt;&lt;br/&gt;&lt;/code&gt;&lt;br/&gt;Set phone number to &lt;code style=&#39;font-weight: bold;&#39;&gt;*99***1#&lt;/code&gt; and Username and Password to anything you like.&lt;br/&gt;&lt;br/&gt;At last run&lt;br/&gt;&lt;code&gt;&lt;br/&gt;$sudo wvdial&lt;br/&gt;&lt;/code&gt;&lt;br/&gt;If you did everything right, you would see samilar output to this&lt;br/&gt;&lt;code&gt;&lt;br/&gt;--&amp;gt; WvDial: Internet dialer version 1.60&lt;br/&gt;--&amp;gt; Cannot get information for serial port.&lt;br/&gt;--&amp;gt; Initializing modem.&lt;br/&gt;--&amp;gt; Sending: ATZ&lt;br/&gt;ATZ&lt;br/&gt;OK&lt;br/&gt;--&amp;gt; Sending: ATQ0 V1 E1 S0=0 &amp;amp;C1 &amp;amp;D2 +FCLASS=0&lt;br/&gt;ATQ0 V1 E1 S0=0 &amp;amp;C1 &amp;amp;D2 +FCLASS=0&lt;br/&gt;OK&lt;br/&gt;--&amp;gt; Sending: AT+CGDCONT=1,&quot;IP&quot;,&quot;gpinternet&quot;&lt;br/&gt;AT+CGDCONT=1,&quot;IP&quot;,&quot;gpinternet&quot;&lt;br/&gt;OK&lt;br/&gt;--&amp;gt; Modem initialized.&lt;br/&gt;--&amp;gt; Sending: ATDT*99***1#&lt;br/&gt;--&amp;gt; Waiting for carrier.&lt;br/&gt;ATDT*99***1#&lt;br/&gt;CONNECT&lt;br/&gt;~[7f]}#@!}!} } }2}#}$@#}!}$}%\}&quot;}&amp;amp;} }*} } g}%~&lt;br/&gt;--&amp;gt; Carrier detected.  Waiting for prompt.&lt;br/&gt;~[7f]}#@!}!} } }2}#}$@#}!}$}%\}&quot;}&amp;amp;} }*} } g}%~&lt;br/&gt;--&amp;gt; PPP negotiation detected.&lt;br/&gt;--&amp;gt; Starting pppd at Mon Oct  6 12:22:38 2008&lt;br/&gt;--&amp;gt; Pid of pppd: 17504&lt;br/&gt;--&amp;gt; Using interface ppp0&lt;br/&gt;--&amp;gt; pppd: ا[06][08][08]�[06][08][08]�[06][08]&lt;br/&gt;--&amp;gt; pppd: ا[06][08][08]�[06][08][08]�[06][08]&lt;br/&gt;--&amp;gt; pppd: ا[06][08][08]�[06][08][08]�[06][08]&lt;br/&gt;--&amp;gt; pppd: ا[06][08][08]�[06][08][08]�[06][08]&lt;br/&gt;--&amp;gt; local  IP address 10.130.11.226&lt;br/&gt;--&amp;gt; pppd: ا[06][08][08]�[06][08][08]�[06][08]&lt;br/&gt;--&amp;gt; remote IP address 10.6.6.6&lt;br/&gt;--&amp;gt; pppd: ا[06][08][08]�[06][08][08]�[06][08]&lt;br/&gt;--&amp;gt; primary   DNS address 202.56.4.120&lt;br/&gt;--&amp;gt; pppd: ا[06][08][08]�[06][08][08]�[06][08]&lt;br/&gt;--&amp;gt; secondary DNS address 202.56.4.121&lt;br/&gt;--&amp;gt; pppd: ا[06][08][08]�[06][08][08]�[06][08]&lt;br/&gt;&lt;/code&gt;&lt;br/&gt;&lt;br/&gt;Fire up your browser and enjoy the net.&lt;br/&gt;&lt;br/&gt;[&lt;b&gt;Update&lt;/b&gt;: Some have reported that the DNS don&#39;t get updated automatically, in that case you might need to update /etc/resolv.conf file manually.]&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://zaher14.blogspot.com/feeds/8254536374818351941/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26443211&amp;postID=8254536374818351941' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26443211/posts/default/8254536374818351941'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26443211/posts/default/8254536374818351941'/><link rel='alternate' type='text/html' href='http://zaher14.blogspot.com/2008/10/edgegprs-via-bluetooth-in-linux-simpler.html' title='System Admin: EDGE/GPRS via Bluetooth in Linux Simplified'/><author><name>Abu Zaher Faridee</name><uri>https://plus.google.com/104067291049623797029</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-K2Xh7yMl0iU/AAAAAAAAAAI/AAAAAAAAApo/neDDkE7Fml8/s512-c/photo.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26443211.post-625072597040100777</id><published>2008-09-12T16:57:00.004+06:00</published><updated>2009-01-16T22:24:27.028+06:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="MacOSX"/><category scheme="http://www.blogger.com/atom/ns#" term="Scripts"/><title type='text'>MacOS X: iSync AppleScript</title><content type='html'>&lt;div xmlns=&#39;http://www.w3.org/1999/xhtml&#39;&gt;I wanted to run iSync Priodically everyday so that my mobile and MacBook get synced regularly, this is what I found after some googling:&lt;br/&gt;&lt;br/&gt;tell application &quot;System Events&quot; to set isync_running to (name of processes) contains &quot;iSync&quot;&lt;br/&gt;&lt;pre&gt;&amp;lt;code&amp;gt;&amp;lt;br /&amp;gt;tell application &quot;iSync&quot;&amp;lt;br /&amp;gt;  activate&amp;lt;br /&amp;gt;  if isync_running is not true then&amp;lt;br /&amp;gt;      tell application &quot;System Events&quot; to set visible of process &quot;iSync&quot; to false&amp;lt;br /&amp;gt;  end if&amp;lt;br /&amp;gt;  synchronize&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;  repeat until syncing is false&amp;lt;br /&amp;gt;      delay 1&amp;lt;br /&amp;gt;  end repeat&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;  if sync status is 2 then&amp;lt;br /&amp;gt;      if isync_running is false then&amp;lt;br /&amp;gt;          quit&amp;lt;br /&amp;gt;      end if&amp;lt;br /&amp;gt;  else&amp;lt;br /&amp;gt;      activate&amp;lt;br /&amp;gt;  end if&amp;lt;br /&amp;gt;end tell&amp;lt;br /&amp;gt;&amp;lt;/code&amp;gt;&lt;/pre&gt;&lt;br/&gt;save the file with a .scpt extension and add the script in iCal to run every day.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://zaher14.blogspot.com/feeds/625072597040100777/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26443211&amp;postID=625072597040100777' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26443211/posts/default/625072597040100777'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26443211/posts/default/625072597040100777'/><link rel='alternate' type='text/html' href='http://zaher14.blogspot.com/2008/09/simple-applescript.html' title='MacOS X: iSync AppleScript'/><author><name>Abu Zaher Faridee</name><uri>https://plus.google.com/104067291049623797029</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-K2Xh7yMl0iU/AAAAAAAAAAI/AAAAAAAAApo/neDDkE7Fml8/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26443211.post-9152682909726700077</id><published>2008-07-19T10:04:00.002+06:00</published><updated>2009-01-16T22:21:27.114+06:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="MacOSX"/><category scheme="http://www.blogger.com/atom/ns#" term="system admin"/><category scheme="http://www.blogger.com/atom/ns#" term="Tips and Tricks"/><category scheme="http://www.blogger.com/atom/ns#" term="Ubuntu"/><title type='text'>Tips: Run Linux apps in Mac OSX Seamlessly</title><content type='html'>&lt;div xmlns=&#39;http://www.w3.org/1999/xhtml&#39;&gt;I have been using Vmware Fusion to run Ubuntu 8.04 and Windows XP for a while. I really like the idea of &lt;span style=&#39;font-weight: bold;&#39;&gt;Unity&lt;/span&gt; while using Windows in Vmware as it seamlessly integrates Windows and Mac OSX apps. &lt;p style=&#39;margin: 0px; min-height: 14px;&#39;&gt;&lt;br/&gt;&lt;/p&gt; &lt;p style=&#39;margin: 0px;&#39;&gt;I was a little sad to find out there is no such feature for Linux. Guess what, I was wrong. While I was fiddling with different ssh options, I came across a feature called X11 forwarding. With the use of X11 forwarding, its easy to accomplish the same effect. All you need is just add&lt;span style=&#39;font-weight: bold;&#39;&gt; &#39;-X&#39;&lt;/span&gt; option while you ssh and make sure you have a working X11 environment installed in your Leopard.&lt;/p&gt; &lt;p style=&#39;margin: 0px; min-height: 14px;&#39;&gt;&lt;br/&gt;&lt;/p&gt; &lt;p style=&#39;margin: 0px;&#39;&gt;$ssh&lt;span class=&#39;Apple-converted-space&#39;&gt;  &lt;/span&gt;-X &lt;a href=&#39;mailto:zaher@172.16.90.128&#39;&gt;zaher@172.16.90.128&lt;/a&gt;&lt;span class=&#39;Apple-converted-space&#39;&gt; &lt;/span&gt;&lt;/p&gt; &lt;p style=&#39;margin: 0px; min-height: 14px;&#39;&gt;&lt;br/&gt;&lt;/p&gt; &lt;p style=&#39;margin: 0px;&#39;&gt;Its as simple as that. After login, just run any graphical program you want like a native application. You can also disable X11 in your VM since it has the added benefit of using low memory than usual as no X11 us running in your Virtual Machine.&lt;br/&gt;&lt;/p&gt; &lt;p style=&#39;margin: 0px; min-height: 14px;&#39;&gt;&lt;br/&gt;&lt;/p&gt; &lt;p style=&#39;margin: 0px;&#39;&gt;Here is a screenshot of Firefox, Gimp and OpenOffice.Org running from my Ubuntu Hardy Heron in Leopard.&lt;/p&gt;&lt;br/&gt;&lt;p style=&#39;margin: 0px;&#39;&gt;&lt;a href=&#39;http://bp2.blogger.com/_qZgIETMJjmk/SIFpC-48jnI/AAAAAAAAAM8/QAW2akkIoOA/s1600-h/Picture+2.PNG&#39; onblur=&#39;try {parent.deselectBloggerImageGracefully();} catch(e) {}&#39;&gt;&lt;img border=&#39;0&#39; id=&#39;BLOGGER_PHOTO_ID_5224572542688988786&#39; alt=&#39;&#39; src=&#39;http://bp2.blogger.com/_qZgIETMJjmk/SIFpC-48jnI/AAAAAAAAAM8/QAW2akkIoOA/s400/Picture+2.PNG&#39; style=&#39;margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;&#39;/&gt;&lt;/a&gt;&lt;/p&gt;&lt;p style=&#39;margin: 0px;&#39;&gt;&lt;br/&gt;&lt;/p&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://zaher14.blogspot.com/feeds/9152682909726700077/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26443211&amp;postID=9152682909726700077' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26443211/posts/default/9152682909726700077'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26443211/posts/default/9152682909726700077'/><link rel='alternate' type='text/html' href='http://zaher14.blogspot.com/2008/07/simple-trick-to-run-your-linux-apps-in.html' title='Tips: Run Linux apps in Mac OSX Seamlessly'/><author><name>Abu Zaher Faridee</name><uri>https://plus.google.com/104067291049623797029</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-K2Xh7yMl0iU/AAAAAAAAAAI/AAAAAAAAApo/neDDkE7Fml8/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://bp2.blogger.com/_qZgIETMJjmk/SIFpC-48jnI/AAAAAAAAAM8/QAW2akkIoOA/s72-c/Picture+2.PNG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26443211.post-2215699525097914827</id><published>2008-07-18T10:36:00.002+06:00</published><updated>2008-07-18T11:33:18.913+06:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="MacOSX"/><title type='text'>Mission: Recover Disk Space: Part 2</title><content type='html'>Hmm, the mission is going pretty well, next step download &lt;a href=&quot;http://monolingual.sourceforge.net/%20&quot;&gt;Monolingual&lt;/a&gt;. This cool Open Source tool checks your MacOSX system for redundancies like localized documentations, not platform specific apps and gives you a choice to remove them selectively.&lt;br /&gt;&lt;br /&gt;I was able to about 2.8 Gigs from my last run, as I only kept English and Bengali localizations and Intel specific installations.&lt;br /&gt;&lt;br /&gt;I love the icon of this app very much, :P</content><link rel='replies' type='application/atom+xml' href='http://zaher14.blogspot.com/feeds/2215699525097914827/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26443211&amp;postID=2215699525097914827' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26443211/posts/default/2215699525097914827'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26443211/posts/default/2215699525097914827'/><link rel='alternate' type='text/html' href='http://zaher14.blogspot.com/2008/07/mission-recover-disk-space-part-2.html' title='Mission: Recover Disk Space: Part 2'/><author><name>Abu Zaher Faridee</name><uri>https://plus.google.com/104067291049623797029</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-K2Xh7yMl0iU/AAAAAAAAAAI/AAAAAAAAApo/neDDkE7Fml8/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26443211.post-1547614953359807627</id><published>2008-07-18T10:16:00.001+06:00</published><updated>2008-07-18T11:34:50.625+06:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="MacOSX"/><title type='text'>Mission: Recover Disk Space: Part 1</title><content type='html'>This was getting more and more annoying day by day. My hard drive was getting full day by day as i kept installing new apps but somehow the rate of hard drive usage  wasn’t matching the applications installed. Something was wrong and something need to be done.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;I installed &lt;a href=&quot;http://www.omnigroup.com/applications/omnidisksweeper/&quot;&gt;OmniDiskSweeper&lt;/a&gt; and gave it run. I noted a folder called /cores which was taking a whooping 5.4Gigs. Suspicious, I looked it up and came to know that this is the folder where my Leopard keeps its memory dump files after any system crash for debugging purposes. Since it didn’t concern me, I just safely deleted these annoying core.xxxxx files to reclaim my precious 5.4 Gigs.&lt;br /&gt;&lt;br /&gt;So if you are also running out of space, don’t forget to check that folder.</content><link rel='replies' type='application/atom+xml' href='http://zaher14.blogspot.com/feeds/1547614953359807627/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=26443211&amp;postID=1547614953359807627' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26443211/posts/default/1547614953359807627'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26443211/posts/default/1547614953359807627'/><link rel='alternate' type='text/html' href='http://zaher14.blogspot.com/2008/07/mission-recover-disk-space-part-1.html' title='Mission: Recover Disk Space: Part 1'/><author><name>Abu Zaher Faridee</name><uri>https://plus.google.com/104067291049623797029</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-K2Xh7yMl0iU/AAAAAAAAAAI/AAAAAAAAApo/neDDkE7Fml8/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry></feed>