<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>++++++++++[&#62;+++++++++&#62;++++++++++&#62;+++++++++++&#60;&#60;+++++&#62;+++++&#62;++++++++.---.++++.&#60;+++++.&#62;---.-.</title>
	<atom:link href="http://viswanathgs.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://viswanathgs.wordpress.com</link>
	<description></description>
	<lastBuildDate>Wed, 14 Sep 2011 09:48:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='viswanathgs.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>++++++++++[&#62;+++++++++&#62;++++++++++&#62;+++++++++++&#60;&#60;+++++&#62;+++++&#62;++++++++.---.++++.&#60;+++++.&#62;---.-.</title>
		<link>http://viswanathgs.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://viswanathgs.wordpress.com/osd.xml" title="++++++++++[&#62;+++++++++&#62;++++++++++&#62;+++++++++++&#60;&#60;+++++&#62;+++++&#62;++++++++.---.++++.&#60;+++++.&#62;---.-." />
	<atom:link rel='hub' href='http://viswanathgs.wordpress.com/?pushpress=hub'/>
		<item>
		<title>std::vector::push_back &#8211; the internals</title>
		<link>http://viswanathgs.wordpress.com/2011/09/13/stdvectorpush_back-the-internals/</link>
		<comments>http://viswanathgs.wordpress.com/2011/09/13/stdvectorpush_back-the-internals/#comments</comments>
		<pubDate>Tue, 13 Sep 2011 19:42:22 +0000</pubDate>
		<dc:creator>viswanathgs</dc:creator>
				<category><![CDATA[c++]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[stl]]></category>

		<guid isPermaLink="false">http://viswanathgs.wordpress.com/?p=355</guid>
		<description><![CDATA[The vector container of C++ STL does provide much more functionality than a simple array, but dynamic memory allocation always comes at a price. In particular, pushing back an element into a vector is not as simple as it might look. Vectors, in particular, are different from a majority of  other STL containers in that [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=viswanathgs.wordpress.com&amp;blog=9579004&amp;post=355&amp;subd=viswanathgs&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The vector container of C++ STL does provide much more functionality than a simple array, but dynamic memory allocation always comes at a price. In particular, pushing back an element into a vector is not as simple as it might look. Vectors, in particular, are different from a majority of  other STL containers in that the memory allocation is contiguous. Resizing the memory allocated to a vector has two issues.</p>
<ul>
<li>resizing for every push_back is extremely costly</li>
<li>contiguous memory may not be free at the location you wish to expand</li>
</ul>
<p>I have assimilated what I found after a little googling and some code-probing here.</p>
<p>The implementation of vector in STL never resizes the vector to size()+1 for every push_back. That would just be way too costly and the performance loss would be huge. One solution is to resize the vector to size()+c every time the end of the vector is reached. That is, increment the size by a constant amount c instead of 1 when the vector is full. So, whenever push_back is called, if the capacity of the underlying container is greater that the number of elements currently present in the vector, no resizing/reallocation takes place. When the size of the vector is equal to the capacity of the container, size gets increased by c. The drawback with this idea is that the constant c is independent of the size of the vector. Choosing an appropriate value for c requires a knowledge of the application in which the vector is used.</p>
<p>A quick look at the implementation of vector in STL should clarify things. Here is the STL source code for the vector container: <a href="http://www.sgi.com/tech/stl/stl_vector.h">http://www.sgi.com/tech/stl/stl_vector.h</a>. Thanks to variable naming conventions, it is a fairly trivial task to get a grasp of what the hell is going on underneath the container by just reading a couple of functions.</p>
<p>push_back():<br />
<code></code></p>
<pre>  void push_back(const _Tp&amp; __x) {
    if (_M_finish != _M_end_of_storage) {
      construct(_M_finish, __x);
      ++_M_finish;
    }
    else
      _M_insert_aux(end(), __x);
  }</pre>
<p>If we have not reached the end of storage, the new element is just inserted and the end iterator is incremented by 1. When the vector runs out of capacity, the function _M_insert_aux() gets invoked.</p>
<p>_M_insert_aux():<br />
<code></code></p>
<pre>template &lt;class _Tp, class _Alloc&gt;
void
vector&lt;_Tp, _Alloc&gt;::_M_insert_aux(iterator __position, const _Tp&amp; __x)
{
  if (_M_finish != _M_end_of_storage) {
    construct(_M_finish, *(_M_finish - 1));
    ++_M_finish;
    _Tp __x_copy = __x;
    copy_backward(__position, _M_finish - 2, _M_finish - 1);
    *__position = __x_copy;
  }
  else {
    const size_type __old_size = size();
    const size_type __len = __old_size != 0 ? 2 * __old_size : 1;
    iterator __new_start = _M_allocate(__len);
    iterator __new_finish = __new_start;
    __STL_TRY {
      __new_finish = uninitialized_copy(_M_start, __position, __new_start);
      construct(__new_finish, __x);
      ++__new_finish;
      __new_finish = uninitialized_copy(__position, _M_finish, __new_finish);
    }
    __STL_UNWIND((destroy(__new_start,__new_finish),
                  _M_deallocate(__new_start,__len)));
    destroy(begin(), end());
    _M_deallocate(_M_start, _M_end_of_storage - _M_start);
    _M_start = __new_start;
    _M_finish = __new_finish;
    _M_end_of_storage = __new_start + __len;
  }
}</pre>
<p>The else clause basically has what we are looking for. If the old size is 0, the new size is set to 1, otherwise, new size is set to twice that of the old size. So, basically, whenever the container gets full, its capacity is doubled, leading to an exponential growth in the capacity. This addresses our first issue.</p>
<p>I ran a couple of simple programs to empirically gauge the performance variations. The code below simulates the method of incrementing the size by 1 for each push_back.<br />
<code></code></p>
<pre>#include &lt;vector&gt;

using namespace std;

const int MAX_ITERATIONS = 1e7;

int main() {
	vector&lt;int&gt; v;
	int i;
	for (i = 0; i &lt; MAX_ITERATIONS; i++) {
		v.resize(v.size()+1);
		v[i] = i;
	}
	return 0;
}</pre>
<p>The time taken for 10^7 reallocations is quite staggering.</p>
<pre>viswanathgs@viswanathgs-laptop:~$ time ./single

real	0m2.194s
user	0m2.100s
sys	0m0.092s</pre>
<p>Incrementing the capacity by a constant amount (128, in my case) results in a major performance boost.<br />
<code></code></p>
<pre>for (i = 0; i &lt; MAX_ITERATIONS; i++) {
	if (i == v.size()) v.resize(v.size()+128);
	v[i] = i;
}
viswanathgs@viswanathgs-laptop:~$ time ./constant

real	0m0.289s
user	0m0.212s
sys	0m0.072s</pre>
<p>Finally, using just std::vector::push_back, I got a slightly better improvement in the running time.</p>
<pre>viswanathgs@viswanathgs-laptop:~$ time ./exponential

real 0m0.265s
user 0m0.152s
sys 0m0.108s</pre>
<p>Although the improvement in time here is just marginal, the latter method is better for containers with objects of larger sizes. The reason for this will become more apparent when we address the second issue.</p>
<p>So, it&#8217;s settled that we reallocate sizes exponentially, but doubling the size of a vector means having to find contiguous free space at the current location of the vector, which is almost always not possible. The only solution here is to find a contiguous empty block of size twice the current container capacity and to move/copy all the elements to the new location. Looking into the function _M_insert_aux(), this is basically what STL does. But, what about the overhead due to copy? Does this mean push_back does not always take constant time? Yes. Every time reallocation takes place, O(n) copy has to be done, but since the increment in capacity is exponential, the number of times we reallocate (and hence the number of times we copy) decreases exponentially compared to the first two cases. Hence, the amortized complexity of push_back for all the elements in the vector remains constant.</p>
<p>Also, for a vector of large-sized objects, moving the elements around often means too much delay. Reducing the number of reallocations here is crucial, and this is the reason why doubling the capacity seems to work better than a constant increase in capacity. Yet another case of time-space trade-off.</p>
<p>The following code pushes back 1e7 objects of a class that holds 10 ints.<br />
<code></code></p>
<pre>class Class {
    int a[10];
};

int main() {
    vector&lt; Class &gt; v;
    Class obj;
    int i;
    for (i = 0; i &lt; MAX_ITERATIONS; i++) {
        v.push_back(obj);
    }
    return 0;
}
viswanathgs@viswanathgs-laptop:~$ time ./objects 

real	0m1.602s
user	0m0.460s
sys	0m0.952s</pre>
<p>Since we have now learnt that elements are copied during every reallocation, it would be a much wiser choice to store pointers to objects in the vector rather than the entire objects. This improves performance as only addresses are copied (4 bytes) and not the objects along with their member variables. Compare the previous running time with the one below.<br />
<code></code></p>
<pre>int main() {
    vector&lt; Class* &gt; v;
    int i;
    for (i = 0; i &lt; MAX_ITERATIONS; i++) {
        v.push_back(new Class());
    }
    return 0;
}
viswanathgs@viswanathgs-laptop:~$ time ./pointers

real	0m1.213s
user	0m0.592s
sys	0m0.616s</pre>
<p>Moving elements to a different location also leads to problems like invalidating the iterators that point to elements in the current memory location. It&#8217;s quite amazing how these issues are taken care of in the STL. Also, to know the capacity of the container at anytime, use the function vector::capacity. vector::size returns the number of elements currently in the vector (which is basically end_iter &#8211; start_iter), whereas vector::capacity returns the maximum number of elements the container underneath can hold without further reallocation.</p>
<p>That&#8217;s all folks!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/viswanathgs.wordpress.com/355/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/viswanathgs.wordpress.com/355/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/viswanathgs.wordpress.com/355/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/viswanathgs.wordpress.com/355/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/viswanathgs.wordpress.com/355/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/viswanathgs.wordpress.com/355/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/viswanathgs.wordpress.com/355/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/viswanathgs.wordpress.com/355/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/viswanathgs.wordpress.com/355/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/viswanathgs.wordpress.com/355/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/viswanathgs.wordpress.com/355/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/viswanathgs.wordpress.com/355/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/viswanathgs.wordpress.com/355/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/viswanathgs.wordpress.com/355/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=viswanathgs.wordpress.com&amp;blog=9579004&amp;post=355&amp;subd=viswanathgs&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://viswanathgs.wordpress.com/2011/09/13/stdvectorpush_back-the-internals/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d7a638c07dbff5ff0f0ade93ded36bd3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">viswanathgs</media:title>
		</media:content>
	</item>
		<item>
		<title>BrainF*ck</title>
		<link>http://viswanathgs.wordpress.com/2011/09/13/brainfck/</link>
		<comments>http://viswanathgs.wordpress.com/2011/09/13/brainfck/#comments</comments>
		<pubDate>Tue, 13 Sep 2011 16:47:24 +0000</pubDate>
		<dc:creator>viswanathgs</dc:creator>
				<category><![CDATA[esoteric]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[self-obsession]]></category>

		<guid isPermaLink="false">http://viswanathgs.wordpress.com/?p=349</guid>
		<description><![CDATA[++++++++++[&#62;+++++++++&#62;++++++++++&#62;+++++++++++&#60;&#60;&#60;-]&#62;+++++&#62;+++++&#62;++++++++.&#60;.&#62;---.++++.&#60;&#60;++.&#62;+++++.&#60;.&#62;&#62;---.&#60;------.-.&#62;-. There aren&#8217;t many who can identify the above to be a working code from an actual programming language. BrainF*ck is an absolutely pointless, but pretty amusing esoteric programming language. Anyway, the above code prints viswanathgs. The language has just 8 valid characters in total. (Source: Wikipedia) Brainf*ck command C equivalent &#62; ++ptr; &#60; --ptr; [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=viswanathgs.wordpress.com&amp;blog=9579004&amp;post=349&amp;subd=viswanathgs&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<pre>++++++++++[&gt;+++++++++&gt;++++++++++&gt;+++++++++++&lt;&lt;&lt;-]&gt;+++++&gt;+++++&gt;++++++++.&lt;.&gt;---.++++.&lt;&lt;++.&gt;+++++.&lt;.&gt;&gt;---.&lt;------.-.&gt;-.</pre>
<p>There aren&#8217;t many who can identify the above to be a working code from an actual programming language. BrainF*ck is an absolutely pointless, but pretty amusing esoteric programming language. Anyway, the above code prints viswanathgs.</p>
<p>The language has just 8 valid characters in total.</p>
<p>(Source: Wikipedia)</p>
<table>
<tbody>
<tr>
<th align="center">Brainf*ck command</th>
<th align="left">C equivalent</th>
</tr>
<tr>
<td><code>&gt;</code></td>
<td><code>++ptr;</code></td>
</tr>
<tr>
<td><code>&lt;</code></td>
<td><code>--ptr;</code></td>
</tr>
<tr>
<td><code>+</code></td>
<td><code>++*ptr;</code></td>
</tr>
<tr>
<td><code>-</code></td>
<td><code>--*ptr;</code></td>
</tr>
<tr>
<td><code>.</code></td>
<td><code>putchar(*ptr);</code></td>
</tr>
<tr>
<td><code>,</code></td>
<td><code>*ptr=getchar();</code></td>
</tr>
<tr>
<td><code>[</code></td>
<td><code>while (*ptr) {</code></td>
</tr>
<tr>
<td><code>]</code></td>
<td><code>}</code></td>
</tr>
</tbody>
</table>
<p>Here is a walk-through of the code above.<br />
<code></code></p>
<pre>+++++ +++++
[
 &gt; +++++ ++++
 &gt; +++++ +++++
 &gt; +++++ +++++ +
 &lt;&lt;&lt;-
]</pre>
<p>Just 4 memory locations have been used here. The first line increments the value at loc[0] 10 times. This is used as a counter for the while loop that follows. The statements in the loop perform loc[1] += 9, loc[2] += 10 and loc[3] += 11. The last line before ] decrements loc[0] (the loop counter) by 1. At the end of the loop, the values at loc[1] to loc[3] are 90, 100, 110 respectively.<br />
<code></code></p>
<pre>&gt; +++++
&gt; +++++
&gt; +++++</pre>
<p>This does nothing but add 5 to each of loc[1], loc[2] and loc[3]. Now the values at loc[1] to loc[3] are 95, 105 and 115, the ASCII values of &#8216;_&#8217;, &#8216;i&#8217; and &#8216;s&#8217; respectively.</p>
<pre>+++ .</pre>
<p>This just adds 3 to loc[3] (the current memory location is loc[3] remember. I did not decrement the pointer from the previous step). Now loc[3] has the ASCII value of &#8216;v&#8217; which just gets printed.</p>
<pre>&lt; .</pre>
<p>The pointer is decremented by one, and the memory location now is loc[2], which already has 115 as its value (the ASCII for &#8216;i&#8217;). The rest of the code pretty much prints the remaining characters. Now, it should be a fairly simple task to write an interpreter for BrainF*ck!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/viswanathgs.wordpress.com/349/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/viswanathgs.wordpress.com/349/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/viswanathgs.wordpress.com/349/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/viswanathgs.wordpress.com/349/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/viswanathgs.wordpress.com/349/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/viswanathgs.wordpress.com/349/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/viswanathgs.wordpress.com/349/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/viswanathgs.wordpress.com/349/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/viswanathgs.wordpress.com/349/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/viswanathgs.wordpress.com/349/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/viswanathgs.wordpress.com/349/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/viswanathgs.wordpress.com/349/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/viswanathgs.wordpress.com/349/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/viswanathgs.wordpress.com/349/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=viswanathgs.wordpress.com&amp;blog=9579004&amp;post=349&amp;subd=viswanathgs&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://viswanathgs.wordpress.com/2011/09/13/brainfck/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d7a638c07dbff5ff0f0ade93ded36bd3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">viswanathgs</media:title>
		</media:content>
	</item>
		<item>
		<title>DeltaDrain &#8211; A Java ME Mobile App to manage delta among friends!</title>
		<link>http://viswanathgs.wordpress.com/2011/02/12/deltadrain-a-java-me-mobile-app-to-manage-delta-among-friends/</link>
		<comments>http://viswanathgs.wordpress.com/2011/02/12/deltadrain-a-java-me-mobile-app-to-manage-delta-among-friends/#comments</comments>
		<pubDate>Sat, 12 Feb 2011 19:57:52 +0000</pubDate>
		<dc:creator>viswanathgs</dc:creator>
				<category><![CDATA[delta]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[java me]]></category>
		<category><![CDATA[mobile app]]></category>
		<category><![CDATA[nightout]]></category>
		<category><![CDATA[thedudewing]]></category>

		<guid isPermaLink="false">http://viswanathgs.wordpress.com/?p=299</guid>
		<description><![CDATA[For starters, delta is a slang of TheDudeWing, referring to the amount of money you owe the others in your gang or the others owe you. DeltaDrain is a mobile app I wrote last night in Java, that allows you to add people, manage delta, and view the history of last 20 transactions with each [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=viswanathgs.wordpress.com&amp;blog=9579004&amp;post=299&amp;subd=viswanathgs&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>For starters, delta is a slang of TheDudeWing, referring to the amount of money you owe the others in your gang or the others owe you. DeltaDrain is a mobile app I wrote last night in Java, that allows you to add people, manage delta, and view the history of last 20 transactions with each person.</p>
<p>Download: <a href="http://www.box.net/shared/rlktttx6gl">DeltaDrain.jar</a></p>
<p>Source Code: <a href="https://github.com/viswanathgs/DeltaDrain">https://github.com/viswanathgs/DeltaDrain</a></p>
<h4>App Overview</h4>
<div id="attachment_306" class="wp-caption alignright" style="width: 310px"><a href="http://viswanathgs.files.wordpress.com/2011/02/scr000001.jpg"><img class="size-medium wp-image-306" title="&quot;My Buggers&quot; list" src="http://viswanathgs.files.wordpress.com/2011/02/scr000001.jpg?w=300&#038;h=168" alt="" width="300" height="168" /></a><p class="wp-caption-text">&quot;My Buggers&quot; list</p></div>
<p>Here are some screenshots of the app on a Nokia N97 mini. On opening the app, &#8220;My Buggers&#8221;, a list of people that you generally maintain delta with, are displayed. People can be added to or removed from this list by selecting &#8220;Add Bugger&#8221; or &#8220;Delete Bugger&#8221; respectively in the menu.</p>
<div id="attachment_308" class="wp-caption alignright" style="width: 310px"><a href="http://viswanathgs.files.wordpress.com/2011/02/scr000002.jpg"><img class="size-medium wp-image-308" title="Main Menu" src="http://viswanathgs.files.wordpress.com/2011/02/scr000002.jpg?w=300&#038;h=168" alt="" width="300" height="168" /></a><p class="wp-caption-text">Main Menu</p></div>
<p>Selecting a person from this list takes you to a different form, where you can add the amount of money that you borrow (to be entered as a positive integer), or the amount of money that you lend (to be entered as a negative integer). In addition to this, the form has a comment section allowing you to enter some data about the transaction (generally, you might enter dhaba, aavin, etc). This feature comes in handy when you&#8217;re dealing with people like Mayank Badani, who can fool you into believing that he never borrowed anything from you in Bru!</p>
<div id="attachment_312" class="wp-caption alignleft" style="width: 310px"><a href="http://viswanathgs.files.wordpress.com/2011/02/scr000003.jpg"><img class="size-medium wp-image-312" title="Update Delta" src="http://viswanathgs.files.wordpress.com/2011/02/scr000003.jpg?w=300&#038;h=168" alt="" width="300" height="168" /></a><p class="wp-caption-text">Update Delta</p></div>
<div id="attachment_314" class="wp-caption alignleft" style="width: 310px"><a href="http://viswanathgs.files.wordpress.com/2011/02/scr000004.jpg"><img class="size-medium wp-image-314" title="View Delta, Category and History" src="http://viswanathgs.files.wordpress.com/2011/02/scr000004.jpg?w=300&#038;h=168" alt="" width="300" height="168" /></a><p class="wp-caption-text">View Delta, Category and History</p></div>
<p>Selecting &#8220;View Bugger Info&#8221; from the menu, takes you to a form that displays the current delta value, which is positive if you owe the person, and negative, if the person owes you. This form also contains two more sections &#8211; Category and History. History displays the amount, date, time and comments pertaining to the last 20 transactions that you had with this person in reverse chronological order.</p>
<p>Category can take four different values based on the following criteria:</p>
<p>1. If you currently owe the person an amount greater than 199 bucks, then, this person is called a &#8220;Bank&#8221;.</p>
<p>2. If this person currently owes you an amount greater than 199, then he falls under &#8220;Bitch-face&#8221;.</p>
<p>3. If, in any of the last 20 transactions with that person, he has borrowed a single digit amount from you, he is called &#8220;Cheap-ass&#8221;.</p>
<p>4. In all other cases, the person belongs to the category &#8220;Wokay&#8221;.</p>
<h4>DeltaDrain &#8211; How I learned to stop worrying and code an app</h4>
<div id="attachment_305" class="wp-caption alignright" style="width: 310px"><a href="http://viswanathgs.files.wordpress.com/2011/02/13022011103.jpg"><img class="size-medium wp-image-305" title="DeltaDrainSpecs" src="http://viswanathgs.files.wordpress.com/2011/02/13022011103.jpg?w=300&#038;h=225" alt="" width="300" height="225" /></a><p class="wp-caption-text">Anirudh&#039;s DeltaDrain Specs!</p></div>
<p>It all began when TheDudeWing stopped by at Nescafe this friday night and ended up quarreling over their deltas. Anirudh, with his usual sense of zeal, pitched in the idea of creating a mobile app to maintain delta, and for the first time, even the non-compsci&#8217;s of the wing showed much excitement about something compsci&#8217;ish and got into framing the ideas and specifications for the app. After a 15-minute discussion in my room that involved 6-7 _elite_ members of the wing, we had a specification ready.</p>
<p>The rest of the task was upon me. I fired up Netbeans 6.9, only to find that I don&#8217;t have Java ME. I dug up my external drive, installed Netbeans 6.7.1 with Java ME, started writing a couple of classes for the back-end, by which time much of the wing&#8217;s initial enthu had wearied down. I tried using the visual MIDlet feature of Netbeans, and eventhough it allows you to visualize the control flow and trivializes the task of defining which commands and features belong to which entities in the GUI, I was not very comfortable with it preventing me from modifying the skeleton code. After a certain point, the front-end code had become so obscure that I had to trash it and re-code the front-end, this time without using the visual MIDlet.</p>
<p>Java ME&#8217;s record management system, RecordStore, stores records in the form of byte[]. I was hoping that I could convert my objects directly to an array of bytes using Java&#8217;s ObjectOutputStream. As it turns out, Java ME does not have support for ObjectStream, and to work around the issue, I had to write my own wrappers that convert byte[] to Object and vice versa.</p>
<p>After a night-out and a substantial part of the next afternoon patching up stuff, TheDudeWing&#8217;s app (bar features like splash-screens that I thought would be too irritating) was ready! Yay!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/viswanathgs.wordpress.com/299/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/viswanathgs.wordpress.com/299/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/viswanathgs.wordpress.com/299/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/viswanathgs.wordpress.com/299/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/viswanathgs.wordpress.com/299/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/viswanathgs.wordpress.com/299/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/viswanathgs.wordpress.com/299/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/viswanathgs.wordpress.com/299/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/viswanathgs.wordpress.com/299/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/viswanathgs.wordpress.com/299/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/viswanathgs.wordpress.com/299/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/viswanathgs.wordpress.com/299/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/viswanathgs.wordpress.com/299/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/viswanathgs.wordpress.com/299/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=viswanathgs.wordpress.com&amp;blog=9579004&amp;post=299&amp;subd=viswanathgs&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://viswanathgs.wordpress.com/2011/02/12/deltadrain-a-java-me-mobile-app-to-manage-delta-among-friends/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d7a638c07dbff5ff0f0ade93ded36bd3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">viswanathgs</media:title>
		</media:content>

		<media:content url="http://viswanathgs.files.wordpress.com/2011/02/scr000001.jpg?w=300" medium="image">
			<media:title type="html">&#34;My Buggers&#34; list</media:title>
		</media:content>

		<media:content url="http://viswanathgs.files.wordpress.com/2011/02/scr000002.jpg?w=300" medium="image">
			<media:title type="html">Main Menu</media:title>
		</media:content>

		<media:content url="http://viswanathgs.files.wordpress.com/2011/02/scr000003.jpg?w=300" medium="image">
			<media:title type="html">Update Delta</media:title>
		</media:content>

		<media:content url="http://viswanathgs.files.wordpress.com/2011/02/scr000004.jpg?w=300" medium="image">
			<media:title type="html">View Delta, Category and History</media:title>
		</media:content>

		<media:content url="http://viswanathgs.files.wordpress.com/2011/02/13022011103.jpg?w=300" medium="image">
			<media:title type="html">DeltaDrainSpecs</media:title>
		</media:content>
	</item>
		<item>
		<title>EtymoSucker &#8211; Python script to extract etymologies for Barron&#8217;s word list</title>
		<link>http://viswanathgs.wordpress.com/2010/12/03/etymosucker-python-script-to-extract-etymologies-for-barrons-word-list/</link>
		<comments>http://viswanathgs.wordpress.com/2010/12/03/etymosucker-python-script-to-extract-etymologies-for-barrons-word-list/#comments</comments>
		<pubDate>Fri, 03 Dec 2010 13:53:44 +0000</pubDate>
		<dc:creator>viswanathgs</dc:creator>
				<category><![CDATA[gre]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://viswanathgs.wordpress.com/?p=226</guid>
		<description><![CDATA[Learning all the words in Barron&#8217;s GRE word list is quite a daunting task. Trying to remember a word by understanding its etymology, than just blind cramming, does help to an extent. Thanks to my laziness to go online and search every word, I wrote a script that does the task. Quick and dirty. [If you are [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=viswanathgs.wordpress.com&amp;blog=9579004&amp;post=226&amp;subd=viswanathgs&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Learning all the words in Barron&#8217;s GRE word list is quite a daunting task. Trying to remember a word by understanding its etymology, than just blind cramming, does help to an extent. Thanks to my laziness to go online and search every word, I wrote a script that does the task. Quick and dirty.</p>
<p>[If you are not worried about the details, scroll down and download the etymology file]</p>
<p><a href="http://www.postech.ac.kr/~gla/">Sungwoo Park</a> has a complete list of the Barron&#8217;s words that he compiled while he was preparing for GRE. His word list in various formats can be found here: <a href="http://www.postech.ac.kr/~gla/gre/">www.postech.ac.kr/~gla/gre/</a>. The script, first retrieves the 4842 words ASCII text file from his site, and creates a list.</p>
<pre style="border:solid 1px;font-size:1.2em;margin:10px;padding:10px;"><code>def main():
    word_list_file = urllib.urlopen('http://www.postech.ac.kr/~gla/gre/33new.txt')
    word_list = []

    print 'Obtaining Barron\'s word list from www.postech.ac.kr/~gla/gre/33new.txt...'
    for line in word_list_file:
        if not line or line == '\n':
            continue
        if (line[0] == 'h' or line[0] == 's') and line[1] == ' ':
            continue
        if line[0] == 'n' and line[1] == ' ':
            line = line[2:]

        word = line.split()[0]
        if word[-1] == '-':
            continue

        if not word.isalpha():
            word = cleanse(word)

        word_list.append(word)

    word_list_file.close()

    parser = etymoparser.Parser('barrons_etymology.html')
    count = 1

    print 'Extracting etymologies from www.etymonline.com...'
    for word in word_list:
        if count % 50 == 0:
            print 'Extracting etymology for word', str(count), '(' + word + ')'
        parser.getetymo(word)
        count += 1

    parser.close()
</code></pre>
<p>The word list text file is read using the urllib module. Park has actually added around 1300 words to this text file, additional to the 3500 in Barron&#8217;s. Such words are preceded by an &#8216;s&#8217; mark. The script ignores such words. But, if you are the kind of person who targets a 1600, edit the lines in etymosucker.py</p>
<pre style="border:solid 1px;font-size:1.2em;margin:10px;padding:10px;"><code>        if (line[0] == 'h' or line[0] == 's') and line[1] == ' ':
            continue
        if line[0] == 'n' and line[1] == ' ':
            line = line[2:]
</code></pre>
<p>to</p>
<pre style="border:solid 1px;font-size:1.2em;margin:10px;padding:10px;"><code>        if line[0] == 'h' and line[1] == ' ':
            continue
        if (line[0] == 'n' or line[0] == 's') and line[1] == ' ':
            line = line[2:]
</code></pre>
<p>and execute the script.</p>
<p>Some of the words in the text file contain non-alpha characters including &#8216;\&#8217;, &#8216;^&#8217;, etc. The functions <code>cleanse</code> and <code>eraseall</code> strip these characters off from the word.</p>
<pre style="border:solid 1px;font-size:1.2em;margin:10px;padding:10px;"><code>def eraseall(word, char):
    pos = word.find(char)
    while pos != -1:
        word = word[:pos] + word[pos+1:]
        pos = word.find(char)

    return word

def cleanse(word):
    word = word.replace('_', ' ')

    pos = word.find('(')
    if pos != -1:
        word = word[:pos]

    word = eraseall(word, '\\')
    word = eraseall(word, '\'')
    word = eraseall(word, '^')

    return word</code></pre>
<p>Each word is then added to the word list. Once the word list has been created, <code>etymoparser</code> does the job of retrieving the etymology of each word from <a href="http://www.etymonline.com">www.etymonline.com</a>.<br />
The constructor of <code>etymoparser.Parser</code> creates the output html file, and writes the opening tags &lt;html&gt;, &lt;head&gt;, &lt;body&gt;, &lt;table&gt;, etc.</p>
<pre style="border:solid 1px;font-size:1.2em;margin:10px;padding:10px;"><code>class Parser:
    def __init__(self, out_file_name):
        self.outfile = open(out_file_name, 'w')
        self.outfile.write('''&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt;&lt;head&gt;&lt;title&gt;Barron's GRE Word List Etymology&lt;/title&gt;&lt;/head&gt;&lt;body&gt;&lt;table style="font-size:14px"&gt;''')
        self.count = 1
</code></pre>
<p>The function <code>getetymo</code> of the class <code>Parser</code> retrieves the etymonline.com html page corresponding to the given query. A quick &lt;Ctrl&gt;+U on etymonline.com search page shows that the desired info generally lies between the comments <code>&lt;!--NAVIGATION--&gt;</code> and <code>&lt;!--DICTIONARY--&gt;</code>. If this section does not contain the string &#8220;No matching terms found&#8221;, it is extracted.</p>
<pre style="border:solid 1px;font-size:1.2em;margin:10px;padding:10px;"><code>    def getetymo(self, word):
        etymo_file = urllib.urlopen('http://www.etymonline.com/index.php?search=' + word + '&amp;searchmode=term')

        etymo = ''
        in_etymo = False

        for line in etymo_file:
            if not in_etymo and line.find('&lt;!-- NAVIGATION --&gt;') != -1:
                in_etymo = True
                continue
            if in_etymo and line.find('&lt;!-- DICTIONARY --&gt;') != -1:
                break
            if not in_etymo:
                continue
            etymo += line

        if etymo.find('No matching terms found') != -1:
            return

        start = etymo.find('&lt;dd')
        end = etymo.find('&lt;/dd&gt;')

        assert start != -1
        assert end != -1

        etymo = etymo[start:end+5]

        self.writeetymo(word, etymo)
</code></pre>
<p>The extracted string is now passed to the function <code>writeetymo</code>, which encloses it in &lt;tr&gt; and &lt;td&gt; tags and writes it to the output html file.</p>
<pre style="border:solid 1px;font-size:1.2em;margin:10px;padding:10px;"><code>    def writeetymo(self, word, etymo):
        self.outfile.write('&lt;!--' + str(self.count) + '--&gt;' + '&lt;tr&gt; &lt;td&gt;&lt;b&gt;' + word + '&lt;/b&gt;&lt;/td&gt; &lt;td&gt;' + etymo + '&lt;/td&gt; &lt;/tr&gt;' + '\n')
        self.count += 1
        self.outfile.flush()
</code></pre>
<p>Finally, on closing the parser, the closing tags &lt;/table&gt;, &lt;/body&gt; and &lt;/html&gt; are written to the output html file.</p>
<pre style="border:solid 1px;font-size:1.2em;margin:10px;padding:10px;"><code>    def close(self):
        self.outfile.write('&lt;/table&gt; &lt;/body&gt; &lt;/html&gt;')
        self.outfile.close()</code></pre>
<p>The time taken to extract etymologies of all the words could vary from 45 minutes to 2 hours, depending on your internet connection. Out of the 4842 words from Park&#8217;s text file, 3963 words are from Barron&#8217;s, if I&#8217;m correct. Out of these, 3800 words have their etymologies defined in etymonline.com, which are tabulated in the output html file.</p>
<p><strong>Downloads:</strong><br />
EtymoSucker Source [zip, 2.6KB]: <a href="http://www.box.net/shared/vkp0imedy1">http://www.box.net/shared/vkp0imedy1</a><br />
Etymology file [html, 1.9MB]: <a href="http://www.box.net/shared/xtxvzzsui1">http://www.box.net/shared/xtxvzzsui1</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/viswanathgs.wordpress.com/226/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/viswanathgs.wordpress.com/226/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/viswanathgs.wordpress.com/226/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/viswanathgs.wordpress.com/226/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/viswanathgs.wordpress.com/226/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/viswanathgs.wordpress.com/226/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/viswanathgs.wordpress.com/226/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/viswanathgs.wordpress.com/226/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/viswanathgs.wordpress.com/226/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/viswanathgs.wordpress.com/226/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/viswanathgs.wordpress.com/226/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/viswanathgs.wordpress.com/226/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/viswanathgs.wordpress.com/226/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/viswanathgs.wordpress.com/226/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=viswanathgs.wordpress.com&amp;blog=9579004&amp;post=226&amp;subd=viswanathgs&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://viswanathgs.wordpress.com/2010/12/03/etymosucker-python-script-to-extract-etymologies-for-barrons-word-list/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d7a638c07dbff5ff0f0ade93ded36bd3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">viswanathgs</media:title>
		</media:content>
	</item>
		<item>
		<title>Gnome Development &#8211; Getting Started</title>
		<link>http://viswanathgs.wordpress.com/2010/01/05/gnome-development-getting-started/</link>
		<comments>http://viswanathgs.wordpress.com/2010/01/05/gnome-development-getting-started/#comments</comments>
		<pubDate>Tue, 05 Jan 2010 13:56:00 +0000</pubDate>
		<dc:creator>viswanathgs</dc:creator>
				<category><![CDATA[foss]]></category>
		<category><![CDATA[gnome]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://viswanathgs.wordpress.com/?p=122</guid>
		<description><![CDATA[I have long wanted to contribute to open source projects but didn&#8217;t know where/how to begin. This semester holidays, combined with NOSIP (Novell OpenSource Internship Program, more about this in the next post) provided me with the time to learn and begin my Gnome journey. I&#8217;m writing a simple &#8216;getting started&#8217; guide to anyone willing [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=viswanathgs.wordpress.com&amp;blog=9579004&amp;post=122&amp;subd=viswanathgs&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I have long wanted to contribute to open source projects but didn&#8217;t know where/how to begin. This semester holidays, combined with <a href="http://www.gnomebangalore.org">NOSIP</a> (Novell OpenSource Internship Program, more about this in the next post) provided me with the time to learn and begin my Gnome journey. I&#8217;m writing a simple &#8216;getting started&#8217; guide to anyone willing to contribute to any of the Gnome projects.</p>
<h3>What is GNOME?</h3>
<p>If you aren&#8217;t aware of what <a href="http://www.gnome.org/">GNOME</a> (GNU Object Model Environment) is, it is a desktop environment for Unix/Unix-like operating systems, running on top of the OS. Another famous desktop environment is <a href="http://www.kde.org/">KDE</a> (K Desktop Environment), which fancies looks more than anything else. The projects under Gnome include the pretty famous text editor Gedit, file manager Nautilus, mail client Evolution among many others. For a complete list of Gnome projects, look <a href="http://projects.gnome.org/">here</a>. Gnome uses the <a href="http://www.gtk.org/">Gtk+</a> toolkit for development (more about Gtk+ below) and KDE uses the <a href="http://qt.nokia.com/">Qt</a> toolkit.</p>
<h3>Building from Source</h3>
<p>Before you can modify the source, you need to build the project from its source code. The source code for Gnome is maintained in Git, from where it has to be downloaded and built.</p>
<h3>Git &#8211; The distributed revision control</h3>
<p>Git is a <a href="http://en.wikipedia.org/wiki/Revision_control">revision control</a> system used to manage and maintain the development of softwares and changes made to the source when usually a team of people are working on it. Source code management has become vital for orderly development of open source projects as usually a large number of people work on them. Gnome recently moved from svn (Subversion) to git. Git was developed by Linus Torvalds for maintaining the source of linux kernel. The advantage of Git over Svn is that, git is distributed. A distributed revision control system contains more than one central repositories, and any change to be made, can be made to your own branch, which can then be merged with other branches. You need not require network as you would be having a branch locally on your computer. But, in the case of centralized version control systems like svn, you should have &#8216;commit&#8217; access to submit your changes to the trunk (or befriend a person having commit access, of course). Other projects using git include Perl, Debian, Android, Fedora. The source code for all the Gnome projects is available for online browsing at <a href="http://git.gnome.org/browse/">git.gnome.org</a>.</p>
<p>Now, let&#8217;s say you want to download gedit from git. This is what you would do.</p>
<p>Fire up your terminal.</p>
<pre style="border:solid 1px;font-size:1.2em;margin:10px;padding:10px;"><code>$ git clone git://git.gnome.org/gedit</code></pre>
<p>This will download the source code of gedit in your current working directory. Now, cd into gedit and</p>
<pre style="border:solid 1px;font-size:1.2em;margin:10px;padding:10px;"><code>$ ./configure
$ make
$ sudo make install</code></pre>
<p>This builds and installs gedit from source.</p>
<p>Note: Sometimes you would be using <code>./autogen.sh</code> instead of <code>./configure</code></p>
<h3>Jhbuild &#8211; Automate the building process</h3>
<p>If you had tried building gedit as given above by just downloading from git, most probably you would have encountered errors while doing <code>./configure</code> . This is because, the dependency packages for gedit have not been installed. You can read the error produced, which would probably complain about the absence of packages and install them yourself, or use jhbuild to automate the building of all the depending modules, alleviating the trouble from you.</p>
<p>Before that, you need to install jhbuild. First install the jhbuild dependencies listed <a href="http://live.gnome.org/JhbuildDependencies">here</a> for your distro. Once that is done, create a directory in your home to download all the source code from git. It is advisable that you use the same directory name given here.</p>
<pre style="border:solid 1px;font-size:1.2em;margin:10px;padding:10px;"><code>$ mkdir -p ~/checkout/gnome2
$ cd ~/checkout/gnome2</code></pre>
<p>Now download jhbuild from git and install it.</p>
<pre style="border:solid 1px;font-size:1.2em;margin:10px;padding:10px;"><code>$ git clone git://git.gnome.org/jhbuild
$ ./autogen.sh
$ make
$ make install</code></pre>
<p>Add jhbuild to the PATH environment variable.</p>
<pre style="border:solid 1px;font-size:1.2em;margin:10px;padding:10px;"><code>$ PATH=$PATH:~/.local/bin
$ echo PATH=$PATH:~/.local/bin &gt;&gt; ~/.bashrc</code></pre>
<p>This updates the PATH variable in the .bashrc file in home. Be sure to use &gt;&gt; and not &gt; as the latter will overwrite the file while the former just appends to the file.</p>
<p>Copy the sample jhbuildrc file to your home.</p>
<pre style="border:solid 1px;font-size:1.2em;margin:10px;padding:10px;"><code>$ cp ~/checkout/gnome2/jhbuild/sample.jhbuildrc ~/.jhbuildrc</code></pre>
<p>You can edit the .jhbuildrc file in your home to change the modulesets, but, in our case you need not do anything.</p>
<p>We need a directory where we could install gnome. Again, it&#8217;s better to use the same directory name as listed here.</p>
<pre style="border:solid 1px;font-size:1.2em;margin:10px;padding:10px;"><code>$ sudo mkdir -p /opt/gnome2</code></pre>
<p>Since all the installation takes place in the above directory, we obviously need that directory to be owned by us instead of &#8216;sudo&#8217;ing everytime.</p>
<pre style="border:solid 1px;font-size:1.2em;margin:10px;padding:10px;"><code>$ sudo chown your_user_name /opt/gnome2</code></pre>
<p>Now, do</p>
<pre style="border:solid 1px;font-size:1.2em;margin:10px;padding:10px;"><code>$ jhbuild sanitycheck</code></pre>
<p>If this throws any error, do</p>
<pre style="border:solid 1px;font-size:1.2em;margin:10px;padding:10px;"><code>$ jhbuild bootstrap</code></pre>
<p>This downloads the packages required for compiling the packages in the Gnome moduleset.</p>
<p>Do a sanitycheck again. One of the common errors you will find now is the absence of db2html. Install the package docbook-utils to fix this. Unless the sanitycheck produces no error, you can&#8217;t proceed. Check <a href="http://live.gnome.org/JhbuildDependencies/">here</a> for common problems existing with sanitycheck after bootstrap and fix them, if any.</p>
<p>Now that jhbuild is installed, we are ready to build entire gnome or any particular program along with all the dependencies.</p>
<p>To build the latest gnome from source, type in</p>
<pre style="border:solid 1px;font-size:1.2em;margin:10px;padding:10px;"><code>$ jhbuild build</code></pre>
<p>To build any particular program, say gedit, type in</p>
<pre style="border:solid 1px;font-size:1.2em;margin:10px;padding:10px;"><code>$ jhbuild build gedit</code></pre>
<p>To list all the modules that will be installed,</p>
<pre style="border:solid 1px;font-size:1.2em;margin:10px;padding:10px;"><code>$ jhbuild list [package_name]</code></pre>
<p>Gedit depends on around 35 modules. Jhbuild will take care of downloading all of them from git and installing them. During building, if jhbuild throws any error (which is sure to happen), the cause would be the absence of packages. Just google the error produced, find out the missing package and installing it manually. It&#8217;s really difficult to list all the errors that would be produced, as it depends on your distro and your computer. I faced a much lesser number of errors while building Gnome Evolution in OpenSuse 11.2 than in Ubuntu 9.10.</p>
<p>Once the build is complete, you can now run gedit (or any other program that you have built) by</p>
<pre style="border:solid 1px;font-size:1.2em;margin:10px;padding:10px;"><code>$ jhbuild run gedit</code></pre>
<p>Before going through the source code, we could have an overview of the toolkit Gnome uses for its development.</p>
<h3>Gtk+ Toolkit</h3>
<p>As mentioned earlier, Gnome uses <a href="http://www.gtk.org/">Gtk+</a> (GIMP toolkit) in its source. Gtk+ is a widget toolkit for creating GUI applications. It is object oriented and written in C (irony?), but also has bindings for many other languages like C++ (gtkmm), Python (pygtk), PHP (PHP-Gtk), Perl (Gtk2-Perl), Java (java-gnome) among others. Gtk+ was actually developed for use in GIMP and later the Gnome community adopted it for all its projects. Unless you learn the basics of Gtk+, the source code would make little sense to you.<br />
Here is a hello world program in Gtk+.</p>
<blockquote><p><code>#include &lt;gtk/gtk.h&gt;<br />
int main(int argc, char *argv[])<br />
{<br />
GtkWidget *window;</code></p>
<p>gtk_init(&amp;argc, &amp;argv);</p>
<p>window = gtk_window_new (GTK_WINDOW_TOPLEVEL);<br />
gtk_window_set_title (GTK_WINDOW(window), &#8220;Hello World&#8221;);</p>
<p>gtk_widget_show_all (window);</p>
<p>g_signal_connect (G_OBJECT(window), &#8220;destroy&#8221;, G_CALLBACK(gtk_main_quit), NULL);</p>
<p>gtk_main();<br />
return 0;<br />
}</p></blockquote>
<p>The above code produces a simple Gtk Window with the title &#8220;Hello World&#8221; on it. The program closes when you click the close button on the titlebar.<br />
To compile the code</p>
<pre style="border:solid 1px;font-size:1.2em;margin:10px;padding:10px;"><code>$ gcc hello.c `pkg-config --libs --cflags gtk+-2.0`</code></pre>
<p>assuming the file is saved as hello.c. Make sure pkg-config is installed.<br />
Now, run the program by</p>
<pre style="border:solid 1px;font-size:1.2em;margin:10px;padding:10px;"><code>$ ./a.out</code></pre>
<p>Glade is an user-interface designer that can be used with gtk+ to produce GUI applications easily.<br />
A basic tutorial on Gtk+ and Glade is available at <a href="http://www.micahcarrick.com/12-24-2007/gtk-glade-tutorial-part-1.html">http://www.micahcarrick.com/12-24-2007/gtk-glade-tutorial-part-1.html</a><br />
To learn more about the different widgets of gtk+, <a href="http://zetcode.com/tutorials/gtktutorial/">http://zetcode.com/tutorials/gtktutorial/</a> is a great tutorial.<br />
<a href="http://www.amazon.com/Foundations-Development-Experts-Voice-Source/dp/1590597931">Foundations of Gtk+ Development</a> is a book providing an in-depth knowledge of Gtk+.</p>
<h3>Finding an itch to scratch &#8211; Bugzilla</h3>
<p>Bugzilla is a bug-tracking tool employed to file and manage bugs. Gnome bugzilla is available at <a href="https://bugzilla.gnome.org">bugzilla.gnome.org</a>. Every bug has an associated number. Bugs are classified based on the product or the severity of the bug or its priority. Once you find a bug that interests you, you would want to fix it. If the source code of your project has fewer number of lines, it would not be a big deal to find the bug. But this is not the case with most of the Gnome projects. But, the task of finding the bug could be easily simplified by using grep, which is one command you would probably be using the most number of times. Furthermore, if you have questions regarding the bug, you can always post them as a comment in bugzilla.</p>
<p>In case you are working on a feature or an enhancement or a pretty severe bug, you would want to inform other developers through the mailing list, so that the same work is not reproduced. Each project has its own mailing list, where you can post your problems as a developer or suggestions for new features, etc. Here is a list of all the Gnome mailing lists &#8211; <a href="http://mail.gnome.org/mailman/listinfo/">http://mail.gnome.org/mailman/listinfo</a>.</p>
<p>IRC&#8217;s are a great place to hangout for technical discussions. Again, each project has an IRC channel, where you would find its developers. All IRC channels of Gnome are listed here &#8211; <a href="http://live.gnome.org/GnomeIrcChannels">http://live.gnome.org/GnomeIrcChannels</a>.</p>
<h3>Generating patches</h3>
<p>A patch file is the difference between the source code before and after a commit. To fix a bug, first grep for some pattern related to the bug to locate the file to edit.</p>
<pre style="border:solid 1px;font-size:1.2em;margin:10px;padding:10px;"><code>$ cd ~/checkout/gnome2/gedit
$ git grep "pattern_you_want_to_search_for" *</code></pre>
<p><code>git grep</code> recursively searches for the provided pattern in the mentioned directory and all its sub-directories. The output will be the names of files in which the given pattern is found, with each file name followed by the line containing the pattern. Once you find the file and edit it, you can rebuild the source to test your change. This can be done as</p>
<pre style="border:solid 1px;font-size:1.2em;margin:10px;padding:10px;"><code>jhbuild build gedit --start-at=gedit --no-network</code></pre>
<p>The &#8211;no-network option tells jhbuild not to checkout the source in from the git repository. If you do not use this option, you need an active internet connection while rebuilding.</p>
<p>If you are satisfied with the change, you can submit it as a patch to bugzilla. The difference in the file edited before and after the change can be viewed using</p>
<pre style="border:solid 1px;font-size:1.2em;margin:10px;padding:10px;"><code>git diff</code></pre>
<p>The lines beginning with + indicate the new lines that have been included and those beginning with &#8211; are the ones removed. You can save this output in a file with .patch extension.</p>
<pre style="border:solid 1px;font-size:1.2em;margin:10px;padding:10px;"><code>git diff &gt; name_of_patch.patch</code></pre>
<p>Submit the patch so that it gets verified and committed to the main branch.<br />
To commit the changes to your working branch on your computer, use</p>
<pre style="border:solid 1px;font-size:1.2em;margin:10px;padding:10px;"><code>git commit -a</code></pre>
<p>It&#8217;s good to use a meaningful comment for your commits.</p>
<p>Further, tools like valgrind and gdb make debugging easier by finding memory leaks and other hard-to-trace bugs.</p>
<h3>Further Reading</h3>
<p><a href="http://live.gnome.org/GnomeLove">GnomeLove</a> &#8211; Collection of resources for Gnome developers and enthusiasts.<br />
<a href="http://library.gnome.org/devel/gtk-tutorial/stable/">Gtk+ 2.0 Tutorial</a> &#8211; Official Gtk+ tutorial.<br />
<a href="http://en.wikipedia.org/wiki/Valgrind">Valgrind</a> &#8211; A tool to trace memleaks.<br />
<a href="http://en.wikipedia.org/wiki/GNU_Debugger">GDB</a> &#8211; Wikipage on Gnome Debugger.</p>
<p>Have fun hacking!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/viswanathgs.wordpress.com/122/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/viswanathgs.wordpress.com/122/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/viswanathgs.wordpress.com/122/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/viswanathgs.wordpress.com/122/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/viswanathgs.wordpress.com/122/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/viswanathgs.wordpress.com/122/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/viswanathgs.wordpress.com/122/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/viswanathgs.wordpress.com/122/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/viswanathgs.wordpress.com/122/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/viswanathgs.wordpress.com/122/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/viswanathgs.wordpress.com/122/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/viswanathgs.wordpress.com/122/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/viswanathgs.wordpress.com/122/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/viswanathgs.wordpress.com/122/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=viswanathgs.wordpress.com&amp;blog=9579004&amp;post=122&amp;subd=viswanathgs&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://viswanathgs.wordpress.com/2010/01/05/gnome-development-getting-started/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d7a638c07dbff5ff0f0ade93ded36bd3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">viswanathgs</media:title>
		</media:content>
	</item>
		<item>
		<title>Problem with optical drive!</title>
		<link>http://viswanathgs.wordpress.com/2009/12/24/problem-with-optical-drive/</link>
		<comments>http://viswanathgs.wordpress.com/2009/12/24/problem-with-optical-drive/#comments</comments>
		<pubDate>Thu, 24 Dec 2009 13:53:10 +0000</pubDate>
		<dc:creator>viswanathgs</dc:creator>
				<category><![CDATA[dell]]></category>
		<category><![CDATA[laptop]]></category>

		<guid isPermaLink="false">http://viswanathgs.wordpress.com/?p=116</guid>
		<description><![CDATA[I had just got a copy of ThinkDigit December 09 issue. They gave four DVD&#8217;s with this issue. Inserted the first DVD in my laptop&#8217;s slot load optical drive. None of their stuff interested me. The second one went in. This one was boring too. So was the third one. Then inserted the fourth one, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=viswanathgs.wordpress.com&amp;blog=9579004&amp;post=116&amp;subd=viswanathgs&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I had just got a copy of ThinkDigit December 09 issue. They gave four DVD&#8217;s with this issue. Inserted the first DVD in my laptop&#8217;s slot load optical drive. None of their stuff interested me. The second one went in. This one was boring too. So was the third one. Then inserted the fourth one, thinking I could atleast skim through the soft-copies of the past year&#8217;s Digit magazine archives. But the drive starting grunting suddenly. Fearing the worst, I pressed the eject button &#8211; nothing happened. Eject button again &#8211; again nothing. Oops! The DVD got stuck in the drive. A quick googling let me know that many fellow Studio XPS owners had had this problem. Despite having heard stories of Dell&#8217;s poor customer service, I logged on to their customer support website, filed the problem. The next day, got a confirmation call from Bangalore. The third day, the Dell support engineer from Wipro, rang me up and took my address. The fourth day, got my drive replaced! Thanks to Dell, my problem got fixed in just four working days!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/viswanathgs.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/viswanathgs.wordpress.com/116/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/viswanathgs.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/viswanathgs.wordpress.com/116/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/viswanathgs.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/viswanathgs.wordpress.com/116/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/viswanathgs.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/viswanathgs.wordpress.com/116/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/viswanathgs.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/viswanathgs.wordpress.com/116/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/viswanathgs.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/viswanathgs.wordpress.com/116/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/viswanathgs.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/viswanathgs.wordpress.com/116/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=viswanathgs.wordpress.com&amp;blog=9579004&amp;post=116&amp;subd=viswanathgs&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://viswanathgs.wordpress.com/2009/12/24/problem-with-optical-drive/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d7a638c07dbff5ff0f0ade93ded36bd3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">viswanathgs</media:title>
		</media:content>
	</item>
		<item>
		<title>The Go Programming Language</title>
		<link>http://viswanathgs.wordpress.com/2009/12/03/the-go-programming-language/</link>
		<comments>http://viswanathgs.wordpress.com/2009/12/03/the-go-programming-language/#comments</comments>
		<pubDate>Thu, 03 Dec 2009 18:16:41 +0000</pubDate>
		<dc:creator>viswanathgs</dc:creator>
				<category><![CDATA[go]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://viswanathgs.wordpress.com/?p=92</guid>
		<description><![CDATA[Go is a new experimental open-source programming language from Google. Go is now under development and is primarily for systems programming though it can be put to lots of other tasks too. The syntax of the language is similar to that of C. But there have been changes in few areas like you don&#8217;t need [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=viswanathgs.wordpress.com&amp;blog=9579004&amp;post=92&amp;subd=viswanathgs&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Go is a new experimental open-source programming language from Google. Go is now under development and is primarily for <a href="http://en.wikipedia.org/wiki/System_programming">systems programming</a> though it can be put to lots of other tasks too. The syntax of the language is similar to that of C. But there have been changes in few areas like you don&#8217;t need parenthesis around if condition and for statements and braces are necessary even if there is only one statement inside the if or for.</p>
<p>This is what Google says in its blog about Go.</p>
<blockquote><p>Go attempts to combine the development speed of working in a dynamic language like Python with the performance and safety of a compiled language like C or C++. In our experiments with Go to date, typical builds feel instantaneous; even large binaries compile in just a few seconds. And the compiled code runs close to the speed of C. Go is designed to let you move fast.</p>
<p>We’re hoping Go turns out to be a great language for systems programming with support for multi-processing and a fresh and lightweight take on object-oriented design, with some cool features like true closures and reflection.</p></blockquote>
<p>A hello world program in Go.</p>
<pre style="border:solid 1px;font-size:1.2em;margin:10px;padding:10px;"><code>package main
import "fmt"
func main() {
fmt.Printf("Hello, 世界\n")
}
</code></pre>
<p>If you are wondering about the non-English characters(Japanese), Go supports Unicode.<br />
To learn about the language, go to <a href="http://golang.org">GoLang.org</a>.</p>
<p>This is a <a href="http://video.google.com/videosearch?q=type%3Agoogle+engEDU">Google Tech talk</a> by <a href="http://en.wikipedia.org/wiki/Rob_Pike">Rob Pike</a>, a lead developer of Go. Other advancements include compilation speed. Go seems to have considerably reduced the compile time as Rob demonstrates in the video. He justifies the necessity of a new language mentioning the problems in existing languages are endemic and adding features through libraries will only make the language fat.</p>
<p>Go&#8217;s goals:</p>
<ul>
<li> The efficiency of a statically-typed compiled language</li>
<li> with the ease of programming of a dynamic language.</li>
<li> Safety: type-safe and memory-safe.</li>
<li> Good support for concurrency and communication.</li>
<li> Efficient, latency-free garbage collection.</li>
<li> High-speed compilation.</li>
</ul>
<span style="text-align:center; display: block;"><a href="http://viswanathgs.wordpress.com/2009/12/03/the-go-programming-language/"><img src="http://img.youtube.com/vi/rKnDgT73v8s/2.jpg" alt="" /></a></span>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/viswanathgs.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/viswanathgs.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/viswanathgs.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/viswanathgs.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/viswanathgs.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/viswanathgs.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/viswanathgs.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/viswanathgs.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/viswanathgs.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/viswanathgs.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/viswanathgs.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/viswanathgs.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/viswanathgs.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/viswanathgs.wordpress.com/92/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=viswanathgs.wordpress.com&amp;blog=9579004&amp;post=92&amp;subd=viswanathgs&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://viswanathgs.wordpress.com/2009/12/03/the-go-programming-language/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d7a638c07dbff5ff0f0ade93ded36bd3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">viswanathgs</media:title>
		</media:content>
	</item>
		<item>
		<title>Configuring reliance LXU800 modem in ubuntu</title>
		<link>http://viswanathgs.wordpress.com/2009/10/18/configuring-reliance-lxu800-modem-in-ubuntu/</link>
		<comments>http://viswanathgs.wordpress.com/2009/10/18/configuring-reliance-lxu800-modem-in-ubuntu/#comments</comments>
		<pubDate>Sun, 18 Oct 2009 08:27:46 +0000</pubDate>
		<dc:creator>viswanathgs</dc:creator>
				<category><![CDATA[datacard]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[modem]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://viswanathgs.wordpress.com/?p=72</guid>
		<description><![CDATA[I&#8217;m now using reliance datacard in my hostel. Reliance provided me with LXU800 modem. When I tried installing it in ubuntu 9.04 using wvdialconf, expecting ubuntu to have the hardware support, it didn&#8217;t work. After playing around and some googling, I finally configured it and have put down the steps here. First, make sure wvdial [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=viswanathgs.wordpress.com&amp;blog=9579004&amp;post=72&amp;subd=viswanathgs&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m now using reliance datacard in my hostel. Reliance provided me with LXU800 modem. When I tried installing it in ubuntu 9.04 using wvdialconf, expecting ubuntu to have the hardware support, it didn&#8217;t work. After playing around and some googling, I finally configured it and have put down the steps here.</p>
<p>First, make sure wvdial is installed. If not,</p>
<blockquote><p><code style="font-size:12px;">sudo apt-get install wvdial</code></p></blockquote>
<p>To add the module usbserial into the kernel, type the following in the terminal.</p>
<blockquote><p><code style="font-size:12px;">sudo modprobe usbserial vendor='0xeab' product='0x9357'<br />
</code></p></blockquote>
<p>The vendor and product serials are specific to LXU800 modem. If you are trying to configure any other modem, you would want to google to get the corresponding serials.</p>
<p>Now, we edit the file <code style="font-size:12px;">/etc/wvdial.conf</code><br />
Open the above file in your favourite text editor with sudo. In the file, enter the phone number (mostly #777), username and password. Remove the semicolons, if any, at the beginning of each of these lines. Add the following line to the end of this file</p>
<blockquote><p><code style="font-size:12px;">Stupid mode = Yes</code></p></blockquote>
<p>The modem has been configured successfully.</p>
<p>To dial, everytime you have to type the following three lines.</p>
<blockquote><p>sudo modprobe usbserial vendor=&#8217;0xeab&#8217; product=&#8217;0&#215;9357&#8242;<br />
sudo wvdialconf<br />
sudo wvdial</p></blockquote>
<p>To make things simpler, you can create a shell script with these lines and run it everytime you want to connect to the internet.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/viswanathgs.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/viswanathgs.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/viswanathgs.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/viswanathgs.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/viswanathgs.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/viswanathgs.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/viswanathgs.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/viswanathgs.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/viswanathgs.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/viswanathgs.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/viswanathgs.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/viswanathgs.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/viswanathgs.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/viswanathgs.wordpress.com/72/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=viswanathgs.wordpress.com&amp;blog=9579004&amp;post=72&amp;subd=viswanathgs&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://viswanathgs.wordpress.com/2009/10/18/configuring-reliance-lxu800-modem-in-ubuntu/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d7a638c07dbff5ff0f0ade93ded36bd3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">viswanathgs</media:title>
		</media:content>
	</item>
		<item>
		<title>Random Funny xkcd</title>
		<link>http://viswanathgs.wordpress.com/2009/10/18/random-funny-xkcd/</link>
		<comments>http://viswanathgs.wordpress.com/2009/10/18/random-funny-xkcd/#comments</comments>
		<pubDate>Sun, 18 Oct 2009 07:45:11 +0000</pubDate>
		<dc:creator>viswanathgs</dc:creator>
				<category><![CDATA[random]]></category>
		<category><![CDATA[xkcd]]></category>

		<guid isPermaLink="false">http://viswanathgs.wordpress.com/?p=63</guid>
		<description><![CDATA[Came across this funny comic at xkcd. Travelling-Salesman problem !<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=viswanathgs.wordpress.com&amp;blog=9579004&amp;post=63&amp;subd=viswanathgs&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Came across this funny comic at xkcd.</p>
<p style="text-align:center;font-size:16px;"><strong>Travelling-Salesman problem !</strong></p>
<div id="attachment_66" class="wp-caption aligncenter" style="width: 490px"><img class="size-full wp-image-66" title="Traveling Salesman" src="http://viswanathgs.files.wordpress.com/2009/10/image202.png?w=480&#038;h=212" alt="Traveling Salesman problem" width="480" height="212" /><p class="wp-caption-text">Traveling Salesman problem</p></div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/viswanathgs.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/viswanathgs.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/viswanathgs.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/viswanathgs.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/viswanathgs.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/viswanathgs.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/viswanathgs.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/viswanathgs.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/viswanathgs.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/viswanathgs.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/viswanathgs.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/viswanathgs.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/viswanathgs.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/viswanathgs.wordpress.com/63/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=viswanathgs.wordpress.com&amp;blog=9579004&amp;post=63&amp;subd=viswanathgs&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://viswanathgs.wordpress.com/2009/10/18/random-funny-xkcd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d7a638c07dbff5ff0f0ade93ded36bd3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">viswanathgs</media:title>
		</media:content>

		<media:content url="http://viswanathgs.files.wordpress.com/2009/10/image202.png" medium="image">
			<media:title type="html">Traveling Salesman</media:title>
		</media:content>
	</item>
		<item>
		<title>Vista, Ubuntu, OpenSolaris &#8211; Triple Boot</title>
		<link>http://viswanathgs.wordpress.com/2009/09/20/vista-ubuntu-opensolaris-triple-boot/</link>
		<comments>http://viswanathgs.wordpress.com/2009/09/20/vista-ubuntu-opensolaris-triple-boot/#comments</comments>
		<pubDate>Sun, 20 Sep 2009 14:13:00 +0000</pubDate>
		<dc:creator>viswanathgs</dc:creator>
				<category><![CDATA[boot]]></category>
		<category><![CDATA[grub]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://viswanathgs.wordpress.com/2009/09/20/vista-ubuntu-opensolaris-triple-boot</guid>
		<description><![CDATA[If anyone is willing to try out OpenSolaris and has Vista and Ubuntu pre-installed, you might face some issues with the grub(i.e., the bootloader). I just successfully completed the triple boot setup and I would be taking you through my installation process. Partitioning: First, you need a primary partition to install opensolaris. Use the &#8216;Disk [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=viswanathgs.wordpress.com&amp;blog=9579004&amp;post=15&amp;subd=viswanathgs&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span style="font-family:arial;">If anyone is willing to try out OpenSolaris and has Vista and Ubuntu pre-installed, you might face some issues with the grub(i.e., the bootloader). I just successfully completed the triple boot setup and I would be taking you through my installation process.</span></p>
<p><span style="font-weight:bold;font-family:arial;">Partitioning:</span></p>
<p><span style="font-family:arial;">First, you need a primary partition to install opensolaris. Use the &#8216;Disk Management&#8217; utility of vista to create/resize/format your partitions as per your needs. OpenSolaris recommends atleast 9GB of space for your partition. Don&#8217;t forget to backup essential data in the partition you want to format or you will end up losing them.</span></p>
<p><span style="font-weight:bold;">Installing OpenSolaris:</span></p>
<p>Once you have got a primary partition, insert the opensolaris cd and reboot your computer. If you don&#8217;t have a cd, you can download its image from <a href="http://www.opensolaris.com/get/index.jsp">http://www.opensolaris.com/get/index.jsp</a> and write it or you can order a free cd from <a href="https://oscd.sun.com/">https://oscd.sun.com/</a> , though the latter option requires you wait for a month or so.</p>
<p>Booting into the live cd, you will be asked for keyboard layout and default language. Once you enter them, gnome loads. You have an &#8216;Install OpenSolaris&#8217; icon. This will guide you through the installation process. In step 2 of installation, you would be asked for the partition to which opensolaris has to be installed. Set the partition that you had prepared as &#8216;Solaris&#8217;. The other steps need no explanation.</p>
<p><span style="font-weight:bold;">Editing the grub:</span></p>
<p>After installing, when you reboot the system, the opensolaris grub loads and provides you with options for Windows and OpenSolaris, but not for Ubuntu.</p>
<p>Now, we&#8217;ll be editing the ubuntu grub to add a chainloader to the solaris grub.</p>
<p><span style="font-weight:bold;">Part I: Recover ubuntu grub</span></p>
<p>i. Boot into ubuntu live cd.</p>
<p>ii.  Open the terminal.</p>
<p>iii. Enter</p>
<blockquote><p><code style="font-size:12px;">sudo fdisk -l</code></p></blockquote>
<p>This will list the details of all the partitions in your hard disks. This is what the command displays in my laptop.</p>
<pre><span style="color:#000000;"><span style="font-size:11px;">Disk /dev/sda: 500.1 GB, 500107862016 bytes
 255 heads, 63 sectors/track, 60801 cylinders
 Units = cylinders of 16065 * 512 = 8225280 bytes
 Disk identifier: 0x60000000</span></span>
<span style="color:#000000;font-size:11px;">Device Boot      Start         End      Blocks   Id  System
 /dev/sda1              21        6522    52224000    7  HPFS/NTFS
 /dev/sda2            6522       11749    41984000   83  Linux
 /dev/sda3   *       11749       14299    20480000   bf  Solaris
 /dev/sda4           14299       60802   373536768    f  W95 Ext'd (LBA)
 /dev/sda5           14299       60802   373535744    7  HPFS/NTFS</span></pre>
<p>Note down the partitions in which linux and solaris are installed. The &#8216;a&#8217; after /dev/sd represents the hard disk in which the partition is present.  &#8216;a&#8217; refers to first hard disk, &#8216;b&#8217; to second, etc. The number represents the partition in that hard disk. In the terminal, I would be typing (hd0,1) to represent linux partition and (hd0,2) to represent solaris partition. Here, the partition numbering starts for 0. Write down the partitions in which linux and solaris have been installed in your computer.</p>
<p>iv. In the terminal type       <span style="font-size:12px;">sudo grub</span></p>
<p>v. In the grub prompt, type</p>
<blockquote><p><span style="font-size:12px;">root (hd0,1)</span></p>
<p>&nbsp;</p>
</blockquote>
<p>*Replace (hd0,1) with the partition in which ubuntu is installed in your computer.</p>
<p>vi. Type      <span style="font-size:12px;"> </span></p>
<blockquote><p>setup (hd0)</p></blockquote>
<p><span style="font-family:arial;">Once it says done, you have got back your ubuntu grub, but you can&#8217;t boot opensolaris from it. So, we now have to add a chainloader to the solaris grub in the ubuntu grub.</span></p>
<p><span style="font-weight:bold;">Part II: Chainloading to solaris grub from ubuntu grub</span></p>
<p><span style="font-family:arial;">Reboot your system and remove the live cd. Boot into ubuntu (from the ubuntu grub which loads now). Open the terminal and type</span></p>
<blockquote><p><span style="font-size:12px;">sudo gedit /boot/grub/menu.lst</span></p></blockquote>
<p>This opens the grub menu. At the end of the file, append the following lines and save the file.</p>
<blockquote><p>title OpenSolaris</p>
<p>rootnoverify (hd0,2)</p>
<p>makeactive</p>
<p>chainloader +1</p>
<p>boot</p></blockquote>
<p>*Replace (hd0,2) with the partition where you have solaris installed.</p>
<p>Reboot the system and you have ubuntu grub loading first with an option to OpenSolaris grub other than vista and ubuntu.</p>
<p><strong>Edit:</strong> Not Applicable for Ubuntu 9.10 (Karmic Koala). Karmic uses grub2, whose architecture differs from the previous grub.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/viswanathgs.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/viswanathgs.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/viswanathgs.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/viswanathgs.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/viswanathgs.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/viswanathgs.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/viswanathgs.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/viswanathgs.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/viswanathgs.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/viswanathgs.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/viswanathgs.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/viswanathgs.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/viswanathgs.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/viswanathgs.wordpress.com/15/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=viswanathgs.wordpress.com&amp;blog=9579004&amp;post=15&amp;subd=viswanathgs&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://viswanathgs.wordpress.com/2009/09/20/vista-ubuntu-opensolaris-triple-boot/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d7a638c07dbff5ff0f0ade93ded36bd3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">viswanathgs</media:title>
		</media:content>
	</item>
	</channel>
</rss>
