<?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/"
	>

<channel>
	<title>Anooj&#039;s weblog</title>
	<atom:link href="http://anooj.me/blog/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://anooj.me/blog</link>
	<description>From professional to personal</description>
	<lastBuildDate>Sun, 18 Sep 2011 15:24:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Asynchronously backup data before you lose it!</title>
		<link>http://anooj.me/blog/?p=150</link>
		<comments>http://anooj.me/blog/?p=150#comments</comments>
		<pubDate>Thu, 15 Sep 2011 07:00:17 +0000</pubDate>
		<dc:creator>Anooj Narvekar</dc:creator>
				<category><![CDATA[backup]]></category>
		<category><![CDATA[dropbox]]></category>
		<category><![CDATA[MAC]]></category>
		<category><![CDATA[sync]]></category>

		<guid isPermaLink="false">http://anooj.me/blog/?p=150</guid>
		<description><![CDATA[There are limits to everything. My MacBook&#8217;s HDD has yet again got corrupted. This means * I have to reconfigure my ssh keys all authorized servers.. * Reconfigure my vimrc for all the shortcuts, alias&#8217; and other things * Personal documents which you must have forgotten to take backup on ur external storage device Its [...]]]></description>
			<content:encoded><![CDATA[<p>There are limits to everything. My MacBook&#8217;s HDD has yet again got corrupted.<br />
This means<br />
* I have to reconfigure my ssh keys all authorized servers..<br />
* Reconfigure my vimrc for all the shortcuts, alias&#8217; and other things<br />
* Personal documents which you must have forgotten to take backup on ur external storage device</p>
<p>Its time that i actually made use of <a href="https://www.dropbox.com" title="dropbox" target="_blank">dropbox</a>.</p>
<p>What you can do is create symbolic links to files that you want to asynchronously backup as it gets changed</p>
<p>Something like this:<br />
<code><br />
ln -s ~/.ssh/ ~/Dropbox/ssh<br />
</code></p>
<p>Well, if you guys have RAID arch set up then you can read up Jeff Atwood&#8217;s <a href="http://www.codinghorror.com/blog/2008/01/whats-your-backup-strategy.html" title="" target="_blank">blog post</a> which mentions his strategy.</p>
]]></content:encoded>
			<wfw:commentRss>http://anooj.me/blog/?feed=rss2&#038;p=150</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing ruby-pg on MAC Snow Leopard</title>
		<link>http://anooj.me/blog/?p=141</link>
		<comments>http://anooj.me/blog/?p=141#comments</comments>
		<pubDate>Thu, 23 Jun 2011 07:55:11 +0000</pubDate>
		<dc:creator>Anooj Narvekar</dc:creator>
				<category><![CDATA[MAC]]></category>
		<category><![CDATA[leopard]]></category>
		<category><![CDATA[postgres]]></category>
		<category><![CDATA[ruby-gem]]></category>
		<category><![CDATA[snow]]></category>

		<guid isPermaLink="false">http://anooj.me/blog/?p=141</guid>
		<description><![CDATA[Spent almost 2hrs in figuring how to get this done successfully. The error messages are so cryptic. First of all, make sure u have postgres installed on your machine and the path to the postgres bin folder is in the $PATH enviroment variable. You can follow http://anooj.me/blog/?p=64 to set PATH. To confirm, type pg_config in [...]]]></description>
			<content:encoded><![CDATA[<p>Spent almost 2hrs in figuring how to get this done successfully. The error messages are so cryptic.</p>
<p>First of all, make sure u have postgres installed on your machine and the path to the postgres bin folder is in the $PATH enviroment variable. You can follow <a href="http://anoojnarvekar.wordpress.com/2010/01/12/setting-path-environment-variable-in-mac/" title="Setting PATH environment variable in MAC" target="_blank">http://anooj.me/blog/?p=64</a> to set PATH.</p>
<p>To confirm, type pg_config in terminal to see if its in PATH. It should display the pg related configuration</p>
<blockquote><p>
<code><br />
anooj.n@dv-mac-anooj-n ~$ pg_config<br />
BINDIR = /Library/PostgreSQL/8.4/bin<br />
DOCDIR = /Library/PostgreSQL/8.4/doc/postgresql<br />
HTMLDIR = /Library/PostgreSQL/8.4/doc/postgresql<br />
INCLUDEDIR = /Library/PostgreSQL/8.4/include<br />
PKGINCLUDEDIR = /Library/PostgreSQL/8.4/include/postgresql<br />
INCLUDEDIR-SERVER = /Library/PostgreSQL/8.4/include/postgresql/server<br />
LIBDIR = /Library/PostgreSQL/8.4/lib<br />
PKGLIBDIR = /Library/PostgreSQL/8.4/lib/postgresql<br />
LOCALEDIR = /Library/PostgreSQL/8.4/share/locale<br />
MANDIR = /Library/PostgreSQL/8.4/share/man<br />
SHAREDIR = /Library/PostgreSQL/8.4/share/postgresql<br />
SYSCONFDIR = /Library/PostgreSQL/8.4/etc/postgresql<br />
PGXS = /Library/PostgreSQL/8.4/lib/postgresql/pgxs/src/makefiles/pgxs.mk<br />
CONFIGURE = '--prefix=/Users/buildfarm/pginstaller/server/staging/osx' '--with-openssl' '--with-perl' '--with-python' '--with-tcl' '--with-bonjour' '--with-pam' '--with-krb5' '--enable-thread-safety' '--with-libxml' '--with-ossp-uuid' '--with-includes=/usr/local/include/libxml2:/usr/local/include' '--docdir=/Users/buildfarm/pginstaller/server/staging/osx/doc/postgresql' '--with-libxslt' 'CFLAGS=-isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 -headerpad_max_install_names -arch ppc -arch i386' 'LDFLAGS=-L/usr/local/lib'<br />
CC = gcc -no-cpp-precomp<br />
CPPFLAGS = -I/usr/include/libxml2 -I/usr/local/include/libxml2 -I/usr/local/include<br />
CFLAGS = -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 -headerpad_max_install_names -arch ppc -arch i386 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing -fwrapv<br />
CFLAGS_SL =<br />
LDFLAGS = -L/usr/local/lib -L/usr/lib<br />
LDFLAGS_SL =<br />
LIBS = -lpgport -lxslt -lxml2 -lpam -lssl -lcrypto -lkrb5 -lz -lreadline -lm<br />
VERSION = PostgreSQL 8.4.8<br />
</code>
</p></blockquote>
<p>Initially went straight and fired:</p>
<blockquote><p>
<code><br />
anooj.n@dv-mac-anooj-n ~$ sudo gem install ruby-pg<br />
Building native extensions. This could take a while...<br />
ERROR: Error installing ruby-pg:<br />
ERROR: Failed to build gem native extension.</code></p>
<p>/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb &#8211;with-pg-config=/Library/PostgreSQL/8.4/bin/pg_config<br />
checking for main() in -lpq&#8230; yes<br />
checking for libpq-fe.h&#8230; yes<br />
checking for libpq/libpq-fs.h&#8230; yes<br />
checking for PQconnectionUsedPassword()&#8230; no<br />
checking for PQisthreadsafe()&#8230; no<br />
checking for PQprepare()&#8230; no<br />
checking for PQexecParams()&#8230; no<br />
checking for PQescapeString()&#8230; no<br />
checking for PQescapeStringConn()&#8230; no<br />
checking for lo_create()&#8230; no<br />
checking for pg_encoding_to_char()&#8230; no<br />
checking for PQsetClientEncoding()&#8230; no<br />
creating Makefile</p>
<p>make<br />
gcc -I. -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0 -I. -DHAVE_LIBPQ_FE_H -DHAVE_LIBPQ_LIBPQ_FS_H -I/Library/PostgreSQL/8.4/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -arch x86_64 -g -Os -pipe -fno-common -DENABLE_DTRACE -fno-common -pipe -fno-common -c compat.c<br />
In file included from compat.c:16:<br />
compat.h:38:2: error: #error PostgreSQL client version too old, requires 7.3 or later.<br />
In file included from compat.c:16:<br />
compat.h:69: error: conflicting types for ‘PQconnectionNeedsPassword’<br />
/Library/PostgreSQL/8.4/include/libpq-fe.h:293: error: previous declaration of ‘PQconnectionNeedsPassword’ was here<br />
compat.h:70: error: conflicting types for ‘PQconnectionUsedPassword’<br />
/Library/PostgreSQL/8.4/include/libpq-fe.h:294: error: previous declaration of ‘PQconnectionUsedPassword’ was here<br />
compat.h:123: error: redeclaration of enumerator ‘PQERRORS_TERSE’<br />
/Library/PostgreSQL/8.4/include/libpq-fe.h:105: error: previous definition of ‘PQERRORS_TERSE’ was here<br />
compat.h:124: error: redeclaration of enumerator ‘PQERRORS_DEFAULT’<br />
/Library/PostgreSQL/8.4/include/libpq-fe.h:106: error: previous definition of ‘PQERRORS_DEFAULT’ was here<br />
compat.h:126: error: redeclaration of enumerator ‘PQERRORS_VERBOSE’<br />
/Library/PostgreSQL/8.4/include/libpq-fe.h:108: error: previous definition of ‘PQERRORS_VERBOSE’ was here<br />
compat.h:126: error: conflicting types for ‘PGVerbosity’<br />
/Library/PostgreSQL/8.4/include/libpq-fe.h:108: error: previous declaration of ‘PGVerbosity’ was here<br />
compat.h:130: error: redeclaration of enumerator ‘PQTRANS_IDLE’<br />
/Library/PostgreSQL/8.4/include/libpq-fe.h:96: error: previous definition of ‘PQTRANS_IDLE’ was here<br />
compat.h:131: error: redeclaration of enumerator ‘PQTRANS_ACTIVE’<br />
/Library/PostgreSQL/8.4/include/libpq-fe.h:97: error: previous definition of ‘PQTRANS_ACTIVE’ was here<br />
compat.h:132: error: redeclaration of enumerator ‘PQTRANS_INTRANS’<br />
/Library/PostgreSQL/8.4/include/libpq-fe.h:98: error: previous definition of ‘PQTRANS_INTRANS’ was here<br />
compat.h:133: error: redeclaration of enumerator ‘PQTRANS_INERROR’<br />
/Library/PostgreSQL/8.4/include/libpq-fe.h:99: error: previous definition of ‘PQTRANS_INERROR’ was here<br />
compat.h:135: error: redeclaration of enumerator ‘PQTRANS_UNKNOWN’<br />
/Library/PostgreSQL/8.4/include/libpq-fe.h:101: error: previous definition of ‘PQTRANS_UNKNOWN’ was here<br />
compat.h:135: error: conflicting types for ‘PGTransactionStatusType’<br />
/Library/PostgreSQL/8.4/include/libpq-fe.h:101: error: previous declaration of ‘PGTransactionStatusType’ was here<br />
compat.h:140: error: conflicting types for ‘PQtransactionStatus’<br />
/Library/PostgreSQL/8.4/include/libpq-fe.h:285: error: previous declaration of ‘PQtransactionStatus’ was here<br />
compat.h:141: error: conflicting types for ‘PQparameterStatus’<br />
/Library/PostgreSQL/8.4/include/libpq-fe.h:287: error: previous declaration of ‘PQparameterStatus’ was here<br />
compat.h:155: error: conflicting types for ‘PQsetErrorVerbosity’<br />
/Library/PostgreSQL/8.4/include/libpq-fe.h:309: error: previous declaration of ‘PQsetErrorVerbosity’ was here<br />
compat.h:165:2: error: #error unsupported postgresql version, requires 7.3 or later.<br />
compat.c: In function ‘PQsetClientEncoding’:<br />
compat.c:21: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token<br />
compat.c:28: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token<br />
compat.c:35: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token<br />
compat.c:43: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token<br />
compat.c:49: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token<br />
compat.c:55: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token<br />
compat.c:61: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token<br />
compat.c:67: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token<br />
compat.c:73: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token<br />
compat.c:79: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token<br />
compat.c:85: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token<br />
compat.c:93: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token<br />
compat.c:102: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token<br />
compat.c:109: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token<br />
compat.c:115: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token<br />
compat.c:125: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token<br />
compat.c:131: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token<br />
compat.c:137: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token<br />
compat.c:143: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token<br />
compat.c:151: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token<br />
compat.c:159: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token<br />
compat.c:167: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token<br />
compat.c:173: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token<br />
compat.c:179: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token<br />
compat.c:185: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token<br />
compat.c:191: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token<br />
compat.c:197: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token<br />
compat.c:203: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token<br />
compat.c:209: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token<br />
compat.c:218: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token<br />
compat.c:225: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token<br />
compat.c:268: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token<br />
compat.c:327: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token<br />
compat.c:374: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token<br />
compat.c:453: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token<br />
compat.c:527: error: old-style parameter declarations in prototyped function definition<br />
compat.c:527: error: expected ‘{’ at end of input<br />
make: *** [compat.o] Error 1</p>
<p>Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/ruby-pg-0.7.9.2008.01.28 for inspection.<br />
Results logged to /Library/Ruby/Gems/1.8/gems/ruby-pg-0.7.9.2008.01.28/ext/gem_make.out<br />
</code>
</p></blockquote>
<p>The error mentioned something like "PostgreSQL client version too old, requires 7.3 or later.". Don't get fooled by this.</p>
<p>Now try,</p>
<blockquote><p>
<code><br />
anooj.n@dv-mac-anooj-n ~$ sudo env ARCHFLAGS="-arch i386" gem install ruby-pg -- --with-pg-config=/Library/PostgreSQL/8.4/bin/pg_config<br />
Password:<br />
Building native extensions. This could take a while...<br />
Successfully installed ruby-pg-0.7.9.2008.01.28<br />
1 gem installed<br />
Installing ri documentation for ruby-pg-0.7.9.2008.01.28...<br />
Installing RDoc documentation for ruby-pg-0.7.9.2008.01.28...<br />
</code>
</p></blockquote>
<p>PEACE. This worked for me.. <img src='http://anooj.me/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Hopefully this should work for everyone.</p>
<p><strong>UPDATE:</strong><br />
on running rake routes i started getting the following error:</p>
<blockquote><p>
<code><br />
anooj.n@dv-mac-anooj-n ~/workspace/pg/pgweb$ bundle exec rake routes<br />
(in /Users/anooj.n/workspace/pg/pgweb)<br />
rake aborted!<br />
dlopen(/Library/Ruby/Gems/1.8/gems/pg-0.10.0/lib/pg_ext.bundle, 9): no suitable image found.  Did find:<br />
	/Library/Ruby/Gems/1.8/gems/pg-0.10.0/lib/pg_ext.bundle: mach-o, but wrong architecture - /Library/Ruby/Gems/1.8/gems/pg-0.10.0/lib/pg_ext.bundle<br />
<code>
</p></blockquote>
<p>To fix this, i had install postgres manually, i.e. download and compile the source manually which is pretty trivial.</p>
<p>had to change to install command also to </p>
<blockquote><p>
<code><br />
anooj.n@dv-mac-anooj-n ~$ sudo env ARCHFLAGS="-arch x86_64" gem install ruby-pg -- --with-pg-config=/Library/PostgreSQL/8.4/bin/pg_config
</p></blockquote>
<p></code></p>
]]></content:encoded>
			<wfw:commentRss>http://anooj.me/blog/?feed=rss2&#038;p=141</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Fixing the preverifier build error for Mpowerplayer on Mac OS X</title>
		<link>http://anooj.me/blog/?p=125</link>
		<comments>http://anooj.me/blog/?p=125#comments</comments>
		<pubDate>Fri, 27 Aug 2010 17:16:05 +0000</pubDate>
		<dc:creator>Anooj</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[MAC]]></category>
		<category><![CDATA[Mpowerplayer]]></category>
		<category><![CDATA[preverifier]]></category>

		<guid isPermaLink="false">http://anoojnarvekar.wordpress.com/?p=123</guid>
		<description><![CDATA[fixing preverifier build error for Mpowerplayer]]></description>
			<content:encoded><![CDATA[<p>If you’re using the Mpowerlayer SDK for your J2ME development on Mac OS X, and you get the following ant build error:<br />
<code><br />
  $ ant<br />
  Buildfile: build.xml</p>
<p>  compile:</p>
<p>  preverify:<br />
       [exec] Error preverifying class java.lang.Class<br />
       [exec]     VERIFIER ERROR java/lang/Class.newInstance0()Ljava/lang/Object;:<br />
       [exec] Illegal type in constant pool<br />
       [exec] Result: 1</p>
<p>  package:</p>
<p>  BUILD SUCCESSFUL<br />
  Total time: 1 second<br />
</code><br />
Then you can fix it by changing the following entry in your build.xml:<br />
<code><br />
&lt;property name="java.classes.jar"  value="/System/Library/Frameworks/JavaVM.framework/Classes/classes.jar" /&gt;<br />
</code><br />
to<br />
<code><br />
 &lt;property name="java.classes.jar" value="/System/Library/Frameworks/JavaVM.framework/Versions/1.4.2/Classes/classes.jar" /&gt;<br />
</code><br />
This was the solution which i got after researching for quite sometime. However, this might have fixed issue for some, i was still facing the same issue.. <img src='http://anooj.me/blog/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p>So after debugging for some more time, realized that<br />
/System/Library/Frameworks/JavaVM.framework/Versions/1.4.2 was a symlink to the current jdk<br />
<code><br />
dv-mac-anooj-n:Versions anooj$ ls -l<br />
total 64<br />
lrwxr-xr-x  1 root  wheel    5 Jun 26 21:09 1.3 -&gt; 1.3.1<br />
drwxr-xr-x  3 root  wheel  102 Jul 21  2009 1.3.1<br />
lrwxr-xr-x  1 root  wheel   10 Jun 26 21:09 1.4 -&gt; CurrentJDK<br />
lrwxr-xr-x  1 root  wheel   10 Jun 26 21:09 1.4.2 -&gt; CurrentJDK<br />
lrwxr-xr-x  1 root  wheel   10 Jun 26 21:09 1.5 -&gt; CurrentJDK<br />
lrwxr-xr-x  1 root  wheel   10 Jun 26 21:09 1.5.0 -&gt; CurrentJDK<br />
lrwxr-xr-x  1 root  wheel    5 Jun 26 21:09 1.6 -&gt; 1.6.0<br />
drwxr-xr-x  8 root  wheel  272 Jun 26 21:11 1.6.0<br />
drwxr-xr-x  9 root  wheel  306 Jun 26 21:11 A<br />
lrwxr-xr-x  1 root  wheel    1 Jun 26 21:09 Current -&gt; A<br />
lrwxr-xr-x  1 root  wheel    3 Jun 26 21:09 CurrentJDK -&gt; 1.6<br />
</code><br />
So now i just had to remove the symlink :<br />
<code><br />
sudo rm 1.4.2<br />
</code><br />
and paste 1.4.2 version folder here.. Issue resolved.</p>
<p>PS: i got 1.4.2 from my colleagues lappy.. Donno if apple allows you to download it.</p>
]]></content:encoded>
			<wfw:commentRss>http://anooj.me/blog/?feed=rss2&#038;p=125</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Initialize List the way Arrays are initialized</title>
		<link>http://anooj.me/blog/?p=106</link>
		<comments>http://anooj.me/blog/?p=106#comments</comments>
		<pubDate>Tue, 10 Aug 2010 09:53:38 +0000</pubDate>
		<dc:creator>Anooj</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[refactoring]]></category>

		<guid isPermaLink="false">http://anoojnarvekar.wordpress.com/?p=106</guid>
		<description><![CDATA[If you want a fixed size list, wherein you don&#8217;t want to add/remove elements into it then probably this trick will save some line of code: Consider this:   List&#60;Character&#62; vowels = new ArrayList&#60;Character&#62;(); vowels.add('a'); vowels.add('e'); vowels.add('i'); vowels.add('o'); vowels.add('u');  This could have also be written as:   List&#60;Character&#62; vowels = Arrays.asList('a', 'e', 'i', 'o', 'u'); [...]]]></description>
			<content:encoded><![CDATA[<p>If you want a fixed size list, wherein you don&#8217;t want to add/remove elements into it then probably this trick will save some line of code:</p>
<p>Consider this:<br />
<code> <br />
          List&lt;Character&gt; vowels = new ArrayList&lt;Character&gt;();<br />
          vowels.add('a');<br />
          vowels.add('e');<br />
          vowels.add('i');<br />
          vowels.add('o');<br />
          vowels.add('u'); <br />
</code></p>
<p>This could have also be written as:<br />
<code><br />
           List&lt;Character&gt; vowels = Arrays.asList('a', 'e', 'i', 'o', 'u');<br />
</code>
</p>
<p>Trying to add/remove elements from this list will result in an UnsupportedOperationException exception</p>
]]></content:encoded>
			<wfw:commentRss>http://anooj.me/blog/?feed=rss2&#038;p=106</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Javascript refactoring</title>
		<link>http://anooj.me/blog/?p=97</link>
		<comments>http://anooj.me/blog/?p=97#comments</comments>
		<pubDate>Thu, 29 Jul 2010 10:37:48 +0000</pubDate>
		<dc:creator>Anooj</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[refactoring]]></category>

		<guid isPermaLink="false">http://anoojnarvekar.wordpress.com/?p=97</guid>
		<description><![CDATA[Might sound funny.. but ya.. i liked what i did today, so thought of sharing it.. So there was this combo box which needed to be pre-filled with currencies. This list of currencies was also loaded in a javascript array for other reasons. The immediate refactoring was to use array to create options for the [...]]]></description>
			<content:encoded><![CDATA[<p>Might sound funny.. but ya.. i liked what i did today, so thought of sharing it..</p>
<p>So there was this combo box which needed to be pre-filled with currencies. This list of currencies was also loaded in a javascript array for other reasons.</p>
<p>The immediate refactoring was to use array to create options for the combo box. So i created a function which was called on body OnLoad event which would fill the select html element.</p>
<p>Was this required? This function will be called only once that too only onload of the page. Hmmm.. So my next refactoring was to remove the function and make javascript inline with my html body content.. Solved!</p>
<p>The advantages:</p>
<ul>
<li>The function would make no sense, as in imagine a developer checking this code, he would be confused as to where all this function is used.</li>
<li>Debugging is easier. You don&#8217;t have to go to head to check your function, rather can just  write the js code where ur html element is.</li>
</ul>
<p>The disadvantages(as mentioned by <a title="Kirit Parmar" href="http://kiritsinhparmar.tumblr.com/" target="_blank">Kirit Pamar</a>):</p>
<ul>
<li>The javascript code is sent to the client each time a request is made to that page. This would be the case even if we called a method on body load. You could shove this script in a .js file and call the method on body load. This would improve the page load for each subsequent page request.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://anooj.me/blog/?feed=rss2&#038;p=97</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OpenX installation issue with postgres</title>
		<link>http://anooj.me/blog/?p=88</link>
		<comments>http://anooj.me/blog/?p=88#comments</comments>
		<pubDate>Mon, 07 Jun 2010 16:21:28 +0000</pubDate>
		<dc:creator>Anooj</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[issues]]></category>
		<category><![CDATA[MAC]]></category>
		<category><![CDATA[openx]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[postgres]]></category>

		<guid isPermaLink="false">http://anoojnarvekar.wordpress.com/?p=88</guid>
		<description><![CDATA[OpenX official&#8217;s site says that it supports both Postgres as well as Mysql databases. But when i tried to install the OpenX, it only gave Mysql as the database option. Google&#8217;ing didn&#8217;t help much.. Banging head made me check the phpinfo() to check if my local php supports postgres. Luckily it was bang on.. It [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.openx.org/">OpenX</a> official&#8217;s site says that it supports both Postgres as well as  Mysql databases. But when i tried to install the OpenX, it only gave Mysql as the database option. Google&#8217;ing didn&#8217;t help much..<br /> Banging head made me check the phpinfo() to check if my local php supports postgres. Luckily it was bang on.. It was not supporting Postgresql.</p>
<p>Fix:<br /> Downloaded the latest installer for Mac OS X from <a href="http://www.entropy.ch/software/macosx/php/">here</a>. Had to uncomment php module in the httpd.conf file located at /etc/apache2/httpd.conf so that php could be installed..</p>
]]></content:encoded>
			<wfw:commentRss>http://anooj.me/blog/?feed=rss2&#038;p=88</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get size of a required Schema in postgreSQL</title>
		<link>http://anooj.me/blog/?p=77</link>
		<comments>http://anooj.me/blog/?p=77#comments</comments>
		<pubDate>Tue, 19 Jan 2010 15:38:53 +0000</pubDate>
		<dc:creator>Anooj</dc:creator>
				<category><![CDATA[postgre]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[postgres]]></category>
		<category><![CDATA[schema]]></category>

		<guid isPermaLink="false">http://anoojnarvekar.wordpress.com/?p=77</guid>
		<description><![CDATA[Well, so my requirement this time was to get the size of all tables in a particular schema. HOW? AFAIK, there was no direct way to fulfill my requirement. So wrote my own query.. SELECT pg_size_pretty(sum(pg_total_relation_size(&#8216;archival.&#8217;&#124;&#124;table_name))::bigint) FROM information_schema.tables WHERE table_schema=&#8217;archival&#8217;; Where &#8216;archival&#8217; is the schema name. Checkout the type-casting. Short explanation: sum() returns int type, [...]]]></description>
			<content:encoded><![CDATA[<p>Well, so my requirement this time was to get the size of all tables in a particular schema. HOW?</p>
<p>AFAIK, there was no direct way to fulfill my requirement. So wrote my own query..</p>
<p><i>SELECT pg_size_pretty(sum(pg_total_relation_size(&#8216;archival.&#8217;||table_name))::bigint)<br />
FROM information_schema.tables<br />
WHERE table_schema=&#8217;archival&#8217;;</i></p>
<p>Where &#8216;archival&#8217; is the schema name. Checkout the type-casting.<br />
Short explanation: sum() returns int type, but pg_size_pretty() takes bigint as the param data type. Hence the type casting.</p>
<p>NB:- when copying the query, take care of the quotes.</p>
]]></content:encoded>
			<wfw:commentRss>http://anooj.me/blog/?feed=rss2&#038;p=77</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting postgres table and database size</title>
		<link>http://anooj.me/blog/?p=67</link>
		<comments>http://anooj.me/blog/?p=67#comments</comments>
		<pubDate>Tue, 19 Jan 2010 14:14:25 +0000</pubDate>
		<dc:creator>Anooj</dc:creator>
				<category><![CDATA[postgre]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[postgres]]></category>

		<guid isPermaLink="false">http://anoojnarvekar.wordpress.com/?p=67</guid>
		<description><![CDATA[Getting Database size: SELECT pg_database_size(&#8216;user&#8217;); pg_database_size &#8212;&#8212;&#8212;&#8212;&#8212;&#8212; 58241934 Oh.. thats in Bytes.. Make it nicer.. Get db size in MBs. SELECT pg_size_pretty(pg_database_size(&#8216;user_table&#8217;)); pg_size_pretty &#8212;&#8212;&#8212;&#8212;&#8212;- 60 MB Getting Table size: SELECT pg_size_pretty(pg_total_relation_size(&#8216;user_table&#8217;)); pg_size_pretty &#8212;&#8212;&#8212;&#8212;&#8212;- 55 MB]]></description>
			<content:encoded><![CDATA[<p><strong><em>Getting Database size:</em></strong><br />
SELECT pg_database_size(&#8216;user&#8217;);<br />
pg_database_size<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
58241934<br />
<br />
Oh.. thats in Bytes.. Make it nicer.. Get db size in MBs.<br />
<br />
SELECT pg_size_pretty(pg_database_size(&#8216;user_table&#8217;));<br />
pg_size_pretty<br />
&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
60 MB<br />
<br />
<strong><em> Getting Table size</em></strong>:</p>
<p>SELECT pg_size_pretty(pg_total_relation_size(&#8216;user_table&#8217;));<br />
pg_size_pretty<br />
&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
55 MB</p>
]]></content:encoded>
			<wfw:commentRss>http://anooj.me/blog/?feed=rss2&#038;p=67</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting PATH environment variable in MAC</title>
		<link>http://anooj.me/blog/?p=64</link>
		<comments>http://anooj.me/blog/?p=64#comments</comments>
		<pubDate>Tue, 12 Jan 2010 18:21:56 +0000</pubDate>
		<dc:creator>Anooj</dc:creator>
				<category><![CDATA[MAC]]></category>
		<category><![CDATA[leopard]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[path]]></category>

		<guid isPermaLink="false">http://anoojnarvekar.wordpress.com/?p=64</guid>
		<description><![CDATA[This probably most of the MAC users must be knowing, but still would like to document it.: I had a pain myself figuring the way out. Following is the way(or should i say PATH??) to do it: In your terminal, type cd /etc/paths.d/ touch mysql(this could be any name) sudo vi mysql [press i to [...]]]></description>
			<content:encoded><![CDATA[<p>This probably most of the MAC users must be knowing, but still would like to document it.:</p>
<p>I had a pain myself figuring the way out. Following is the way(or should i say PATH??) to do it:</p>
<ul>
<li>In your terminal, type cd /etc/paths.d/</li>
<li>touch mysql(this could be any name)</li>
<li>sudo vi mysql</li>
<li>[press i to insert] type in the path u want to append to the $PATH variable. In my case i wanted to set mysql&#8217;s path. So i had to type(copy paste rather) /usr/local/mysql/bin</li>
<li>[esc] :wq! to save the file.</li>
</ul>
<p>U are done..</p>
<p>There is another way to set up $PATH, which is rather simple but wont be persisted with new sessions(new terminal or terminal tab).</p>
<p>To do so, in terminal u can just say export PATH=$PATH:&lt;the path u want to append&gt;</p>
<p>for ex., PATH=$PATH:/usr/local/mysql/bin</p>
]]></content:encoded>
			<wfw:commentRss>http://anooj.me/blog/?feed=rss2&#038;p=64</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>TextMate Macro recording</title>
		<link>http://anooj.me/blog/?p=58</link>
		<comments>http://anooj.me/blog/?p=58#comments</comments>
		<pubDate>Mon, 21 Dec 2009 11:24:16 +0000</pubDate>
		<dc:creator>Anooj</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[DRY]]></category>
		<category><![CDATA[macro]]></category>
		<category><![CDATA[recording]]></category>
		<category><![CDATA[textmate]]></category>

		<guid isPermaLink="false">http://anoojnarvekar.wordpress.com/?p=58</guid>
		<description><![CDATA[Had to perform a series of regular expression search and replace actions. And had to do this on multiple files.. After doing it manually for sometime, got bored.. Cursed myself for violating DRY principle! Well, to automate it, i used the TextMate&#8217;s bundled recording macro. Easy to use. Just start recording(Bundles-&#62;Macros-&#62;Start Recording). You can now [...]]]></description>
			<content:encoded><![CDATA[<p>Had to perform a series of regular expression search and replace actions. And had to do this on multiple files.. After doing it manually for sometime, got bored.. Cursed myself for violating <a title="DRY" href="http://en.wikipedia.org/wiki/Don%27t_repeat_yourself">DRY</a> principle!</p>
<p>Well, to automate it, i used the <a href="http://macromates.com/">TextMate&#8217;s</a> bundled recording macro. Easy to use. Just start recording(Bundles-&gt;Macros-&gt;Start Recording). You can now replay it on multiple files.. Did my work.. Happy <img src='http://anooj.me/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://anooj.me/blog/?feed=rss2&#038;p=58</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

