<?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>infinite possibility</title>
	<atom:link href="http://anypossibility.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://anypossibility.com/blog</link>
	<description>Naoko Reeves&#039;s Blog</description>
	<lastBuildDate>Sat, 14 Aug 2010 06:16:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>strace for Mac OS X</title>
		<link>http://anypossibility.com/blog/2010/08/strace-for-mac-os-x/</link>
		<comments>http://anypossibility.com/blog/2010/08/strace-for-mac-os-x/#comments</comments>
		<pubDate>Sat, 14 Aug 2010 06:16:36 +0000</pubDate>
		<dc:creator>naoko</dc:creator>
				<category><![CDATA[Bash Shell]]></category>

		<guid isPermaLink="false">http://anypossibility.com/blog/?p=124</guid>
		<description><![CDATA[In Leopard it’s called dtrace, but it’s simpler if you just call dtruss Here is the manual: NAME dtruss &#8211; process syscall details. Uses DTrace. - SYNOPSIS dtruss [-acdeflhoLs] [-t syscall] { -p PID &#124; -n name &#124; command } - DESCRIPTION dtruss prints details on process system calls. It is like a DTrace ver- sion of [...]]]></description>
			<content:encoded><![CDATA[<div>
<p>In Leopard it’s called <code>dtrace</code>, but it’s simpler if you just call <code>dtruss</code></p>
<p>Here is the manual:</p>
<div id="_mcePaste"><strong>NAME</strong></div>
<div id="_mcePaste">dtruss &#8211; process syscall details. Uses DTrace.</div>
<div>-</div>
<div id="_mcePaste"><strong>SYNOPSIS</strong></div>
<div id="_mcePaste">dtruss [-acdeflhoLs] [-t syscall] { -p PID | -n name | command }</div>
<div>-</div>
<div id="_mcePaste"><strong>DESCRIPTION</strong></div>
<div id="_mcePaste">dtruss prints details on process system calls. It is like a DTrace ver-</div>
<div id="_mcePaste">sion of truss, and has been designed to be less intrusive than truss.</div>
<div id="_mcePaste">Of particular interest is the elapsed times and on cpu times, which can</div>
<div id="_mcePaste">identify  both  system calls that are slow to complete, and those which</div>
<div id="_mcePaste">are consuming CPU cycles.</div>
<div id="_mcePaste">Since  this  uses  DTrace,  only  the  root  user  or  users  with  the</div>
<div id="_mcePaste">dtrace_kernel privilege can run this command.</div>
<div>-</div>
<div id="_mcePaste"><strong>OPTIONS</strong></div>
<div id="_mcePaste">-a     print all details</div>
<div id="_mcePaste">-b bufsize</div>
<div id="_mcePaste">dynamic  variable  buffer  size.  Increase  this  if  you notice</div>
<div id="_mcePaste">dynamic  variable  drop  errors.  The  default  is  &#8221;4m&#8221;  for  4</div>
<div id="_mcePaste">megabytes per CPU.</div>
<div id="_mcePaste">-c     print system call counts</div>
<div id="_mcePaste">-d     print relative timestamps, us</div>
<div id="_mcePaste">-e     print elapsed times, us</div>
<div id="_mcePaste">-f     follow children as they are forked</div>
<div id="_mcePaste">-l     force printing of pid/lwpid per line</div>
<div id="_mcePaste">-L     don&#8217;t print pid/lwpid per line</div>
<div id="_mcePaste">-n name</div>
<div id="_mcePaste">examine processes with this name</div>
<div id="_mcePaste">-o     print on-cpu times, us</div>
<div id="_mcePaste">-s     print stack backtraces</div>
<div id="_mcePaste">-p PID examine this PID</div>
<div id="_mcePaste">-t syscall</div>
<div id="_mcePaste">examine this syscall only</div>
<div id="_mcePaste">-</div>
<div><strong>EXAMPLES</strong></div>
<div id="_mcePaste">run and examine the &#8220;df -h&#8221; command</div>
<div id="_mcePaste"># dtruss df -h</div>
<div id="_mcePaste">examine PID 1871</div>
<div id="_mcePaste"># dtruss -p 1871</div>
<div id="_mcePaste">examine all processes called &#8220;tar&#8221;</div>
<div id="_mcePaste"># dtruss -n tar</div>
<div id="_mcePaste">run test.sh and follow children</div>
<div id="_mcePaste"># dtruss -f test.sh</div>
<div id="_mcePaste">run the &#8220;date&#8221; command and print elapsed and on cpu times,</div>
<div id="_mcePaste"># dtruss -eo date</div>
<div id="_mcePaste">-</div>
<div><strong>FIELDS</strong></div>
<div id="_mcePaste">PID/LWPID</div>
<div id="_mcePaste">Process ID / Lightweight Process ID</div>
<div id="_mcePaste">RELATIVE</div>
<div id="_mcePaste">relative  timestamps  to  the start of the thread, us (microsec-</div>
<div id="_mcePaste">onds)</div>
<div id="_mcePaste">ELAPSD elapsed time for this system call, us</div>
<div id="_mcePaste">CPU    on-cpu time for this system call, us</div>
<div id="_mcePaste">SYSCALL(args)</div>
<div id="_mcePaste">system call name, with arguments (some may be evaluated)</div>
<div>-</div>
<div id="_mcePaste"><strong>DOCUMENTATION</strong></div>
<div id="_mcePaste">See the DTraceToolkit for further documentation under the  Docs  direc-</div>
<div id="_mcePaste">tory. The DTraceToolkit docs may include full worked examples with ver-</div>
<div id="_mcePaste">bose descriptions explaining the output.</div>
<div id="_mcePaste">-</div>
<div><strong>EXIT</strong></div>
<div id="_mcePaste">dtruss will run forever until Ctrl-C is hit, or if a command  was  exe-</div>
<div id="_mcePaste">cuted dtruss will finish when the command ends.</div>
<div id="_mcePaste">-</div>
<div><strong>AUTHOR</strong></div>
<div id="_mcePaste">Brendan Gregg [Sydney, Australia]</div>
<div id="_mcePaste">-</div>
<div><strong>SEE ALSO</strong></div>
<div id="_mcePaste">procsystime(1M), dtrace(1M), truss(1)</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://anypossibility.com/blog/2010/08/strace-for-mac-os-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bathroom Remodeling</title>
		<link>http://anypossibility.com/blog/2010/08/bathroom-remodeling/</link>
		<comments>http://anypossibility.com/blog/2010/08/bathroom-remodeling/#comments</comments>
		<pubDate>Sat, 14 Aug 2010 06:15:45 +0000</pubDate>
		<dc:creator>naoko</dc:creator>
				<category><![CDATA[Home Improvement]]></category>

		<guid isPermaLink="false">http://anypossibility.com/blog/?p=136</guid>
		<description><![CDATA[2008-11 We bought this house in Nov 2008. I am Japanese and taking bath has been just my part of my life. However, we fall in love with this house so much that we accepted fact that the house only had Shower in Master. We were thinking&#8230; well, bathtub can be easily installed! We can [...]]]></description>
			<content:encoded><![CDATA[<p><strong>2008-11</strong><br />
We bought this house in Nov 2008. I am Japanese and taking bath has been just my part of my life. However, we fall in love with this house so much that we accepted fact that the house only had Shower in Master. We were thinking&#8230; well, bathtub can be easily installed! We can knock down the closet and place shower there and place bathtub where current shower stall is.</p>
<p><strong>2010-01</strong><br />
So yeah&#8230; about one year has passed. We got estimate from a few contractors and I was like wow&#8230; placing bathtub is not so cheap especially in our case, major pluming work was involving. First we got estimate from homeDepot. They told me it will be like $30K. Then we met a couple of contractors &#8211; both were like $13k or so&#8230; because of the limited space we have, I have to pick small bathtub and of course, smaller shower&#8230;. I just didn&#8217;t see the value paying that much to have small bathtub with smaller shower space&#8230; Long story short, I decided that steam sauna is what I want&#8230;<br />
1) Greener &#8211; it use much less water than bath<br />
2) Don&#8217;t have to sacrifice on shower space<br />
3) and a lots of benefit &#8211; just google &#8220;steam sauna benefit&#8221;</p>
<div id="attachment_137" class="wp-caption alignnone" style="width: 310px"><a href="http://anypossibility.com/blog/wp-content/uploads/2010/08/before1.png"><img class="size-medium wp-image-137" title="bathroom_before1" src="http://anypossibility.com/blog/wp-content/uploads/2010/08/before1-300x228.png" alt="old bathroom" width="300" height="228" /></a><p class="wp-caption-text">Old Bathroom</p></div>
<p><strong>2010-08</strong><br />
We found one company called Bath-Pro who we feel we can trust and offers very reasonable price. The construction was finally started on Aug 9th.</p>
<p><strong>2010-08-09 [Day 1]</strong><br />
They did demo</p>
<div id="attachment_139" class="wp-caption alignnone" style="width: 235px"><a href="http://anypossibility.com/blog/wp-content/uploads/2010/08/bathroom_day1.jpg"><img class="size-medium wp-image-139" title="bathroom_day1" src="http://anypossibility.com/blog/wp-content/uploads/2010/08/bathroom_day1-e1281765949574-225x300.jpg" alt="Bathroom Remodeling Day 1" width="225" height="300" /></a><p class="wp-caption-text">Bathroom Remodeling Day 1</p></div>
<p><strong>2010-08-10/11 [Day 2 &#038; 3]</strong><br />
They placed bench and soffit ceiling so that they can tile the ceiling.<br />
<div id="attachment_140" class="wp-caption alignnone" style="width: 235px"><a href="http://anypossibility.com/blog/wp-content/uploads/2010/08/bathroom_day3_1.jpg"><img src="http://anypossibility.com/blog/wp-content/uploads/2010/08/bathroom_day3_1-e1281766123535-225x300.jpg" alt="Bathroom Remodel Day 3" title="bathroom_day3_1" width="225" height="300" class="size-medium wp-image-140" /></a><p class="wp-caption-text">Bathroom Remodel Day 3</p></div> </p>
<p><strong>2010-08-10/11 [Day 4~]</strong><br />
I got too excited about design and forgot to check some critical thing.. Permit. My husband thought that they are professional so he assumed that they already got permit for this construction. But I wasn&#8217;t sure so I checked with them&#8230; they told me it is up to home owner&#8230; We requested Permit from city. Phew&#8230; good thing we checked with them. If you google &#8220;bathroom remodiling permit&#8221;, you will see all kinds of helpful information. We decided that getting Permit is right thing to do especially installation of Steam Sauna involves running electric cable etc&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://anypossibility.com/blog/2010/08/bathroom-remodeling/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Home Solar &#8211; Lease or Purchase</title>
		<link>http://anypossibility.com/blog/2010/08/home-solar-lease-or-purchase/</link>
		<comments>http://anypossibility.com/blog/2010/08/home-solar-lease-or-purchase/#comments</comments>
		<pubDate>Fri, 06 Aug 2010 12:19:52 +0000</pubDate>
		<dc:creator>naoko</dc:creator>
				<category><![CDATA[Green Living]]></category>

		<guid isPermaLink="false">http://anypossibility.com/blog/?p=114</guid>
		<description><![CDATA[I have read great things about SolarCity and Sungevity &#8211; I believe they are the two leading solar leasing company at the time of writing. I got estimate form both companies. They do lease very differently&#8230; SloarCity ask you for some down payment then low monthly fee for 20 years regardless of power company you [...]]]></description>
			<content:encoded><![CDATA[<p>I have read great things about SolarCity and Sungevity &#8211; I believe they are the two leading solar leasing company at the time of writing.</p>
<p>I got estimate form both companies. They do lease very differently&#8230;</p>
<p>SloarCity ask you for some down payment then low monthly fee for 20 years regardless of power company you are with.</p>
<p>Sungevity on the other hand requires No down payment. This is probably the only way to go if you have no cache. No down payment and you can go green. Sugevity also wants &#8220;inflation rate&#8221; to be added every year. So my monthly payment will increase 2.5% every year. This isn&#8217;t too bad considering recent energy rate increase.</p>
<p>Both SolarCity and Sungevity will give you &#8220;Performance Guarantee&#8221; with lease option &#8211; meaning that if Solar System generates less than what they projected, they will pay you. Also maintenance is included. So going Solar not only help our planet but also save us money guaranteed!!!! At this point I just could not find any reason why we don&#8217;t want to go Solar.</p>
<p>Before we decide to go with this lease option I wanted to see what purchase option would be&#8230; Lease make Solar system VERY affordable but after 10/20 years, it is not yours&#8230; You end up paying about $20K and you will be given option to purchase at the end of the lease.</p>
<p>So I wanted to see what Purchase option might look like. I reviewed some discussion about Solar lease vs purchase. Both side has valid point. Some says lease is scam&#8230; but I don&#8217;t think so&#8230; Yes you end up paying more money than purchase option but there are many people out there who just cannot come up with cache. Though in my research, if you have cache, purchase is the definitely the way to go.</p>
<p>Purchase option with Sangevity and SolarCity weren&#8217;t so fascinating. I think this is because they are trying to promote lease option more than purchase option.</p>
<p>I got quote from American Solar Electric. After the Rebate and Federal Credit, I will end up paying something like $8500. I am going to get quote from other company and see but my mind has almost decided. I will go with purchasing option.</p>
<p>I was listening to NPR this morning saying that my power company lost millions of revenue due to energy efficient rebate etc&#8230; so they will increase rate again in 2012 or 2014 (can&#8217;t remember) so again, it just no brainer&#8230; having own power generator is the way to go.</p>
]]></content:encoded>
			<wfw:commentRss>http://anypossibility.com/blog/2010/08/home-solar-lease-or-purchase/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Latin 1 to UTF-8</title>
		<link>http://anypossibility.com/blog/2010/08/latin-1-to-utf-8-2/</link>
		<comments>http://anypossibility.com/blog/2010/08/latin-1-to-utf-8-2/#comments</comments>
		<pubDate>Thu, 05 Aug 2010 14:35:49 +0000</pubDate>
		<dc:creator>naoko</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://anypossibility.com/blog/?p=105</guid>
		<description><![CDATA[Long story short, I was doing some screen scraping on web application. My web app use Latin 1 and target is using UTF-8. So I had a few issues to resolve in order for it to work&#8230; 1. Display Issue: If target site has beyond ascii character, it wasn&#8217;t displaying correctly. To resolve this was [...]]]></description>
			<content:encoded><![CDATA[<p>Long story short, I was doing some screen scraping on web application. My web app use Latin 1 and target is using UTF-8. So I had a few issues to resolve in order for it to work&#8230;</p>
<p>1. Display Issue: If target site has beyond ascii character, it wasn&#8217;t displaying correctly. To resolve this was easy. I walk through the characters and replaced with html encode if character code is higher than base ascii&#8230;.(yes i know&#8230; the scripting language that I use doesn&#8217;t offer nice libraries&#8230;)</p>
<p>2. Posting Issue: This was the pain one&#8230; because my web app use Latin 1, anything higher than ascii is translated as HTML Encoding. So to post to UTF-8 site, there are 2 steps involving. (1) Convert HTML Encoded character to Unicode (2) Convert Unicode to URL Encode<br />
2.1. Convert HTML Encoded character to Unicode: This is very simple. Basically use this regenx pattern &#8220;&#[0-9]{3.5};&#8221; to look for HTML Encoded character and extract numeric only and wrap with command to convert it to character (for instance in php it is chr).</p>
<p>2.2. Convert Unicode to URL Encode: Now that you have Unicode prepared, all you have to do is to do url-encoding! (and no, the scripting language i use doesn&#8217;t offer native solution. and yes, I have plan to switch scripting language. so this is for person like me who stuck with language that offers very limited set of libary)<br />
2.2.1. My First Attempt: use curl &#8211;data-urlencode option. Please note that this was added in version 7.18.0. If you are Mac user like me, you can install/upgrade curl using MacPorts or you can download source from here and install. Unfortunately I could not use this option&#8230; because there is one restriction to this &#8211; &#8220;content cannot contain = or @ symbols, as that will then make the syntax match&#8221;.<br />
2.2.2.My Second Attempt: Relies on Shell&#8230; Now this is almost always works! I decided to use php rawurlencode. Calling like this from terminal works like a charm.</p>
<blockquote><p>$ php -r &#8220;echo rawurlencode(&#8216;ξακσλξ&#8217;)</p></blockquote>
<p>Issue the command via plugin to execute shell command did not work. It is not unicode supported so it end up returning url encode of ??????<br />
I contacted plugin vendor and he is planning to release unicode support soon&#8230; so until then somehow </p>
<p>My co-worker found this article: http://akameng.com/web/php_utf_unicode_convertor. Ooooo, this shows the formula to how to convert this using integer division and multiplication without using bitwise operation. <a href="http://home.tiscali.nl/t876506/utf8tbl.html">This article</a> also explains this formula.<br />
If ud <128 (7F hex) then UTF-8 is 1 byte long, the value of ud.</p>
<blockquote><p>If ud >=128 and <=2047 (7FF hex) then UTF-8 is 2 bytes long.<br />
   byte 1 = 192 + (ud div 64)<br />
   byte 2 = 128 + (ud mod 64)</p></blockquote>
<p>So as a final product (for now) I have code like this:</p>
<blockquote><p>$ php -r &#8220;echo rawurlencode(chr(206).chr(190).chr(32).chr(32).chr(195).chr(169).chr(110).chr(100));&#8221;</p></blockquote>
<p>I am done for now.</p>
]]></content:encoded>
			<wfw:commentRss>http://anypossibility.com/blog/2010/08/latin-1-to-utf-8-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Inspirational Movie FUEL</title>
		<link>http://anypossibility.com/blog/2010/07/movie-fuel/</link>
		<comments>http://anypossibility.com/blog/2010/07/movie-fuel/#comments</comments>
		<pubDate>Mon, 19 Jul 2010 01:22:56 +0000</pubDate>
		<dc:creator>naoko</dc:creator>
				<category><![CDATA[Green Living]]></category>

		<guid isPermaLink="false">http://anypossibility.com/blog/?p=92</guid>
		<description><![CDATA[The movie was released in 2008 but I just found this today while browsing new avaialble on Netflix. Josh Tickell just refused to give up to make change for human and mother earth. Thank you very much for the inspiration.]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://joshtickell.com/">movie</a> was released in 2008 but I just found this today while browsing new avaialble on <a href="http://www.netflix.com/WiHome">Netflix</a>.<br />
Josh Tickell just refused to give up to make change for human and mother earth.<br />
Thank you very much for the inspiration. </p>
]]></content:encoded>
			<wfw:commentRss>http://anypossibility.com/blog/2010/07/movie-fuel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PostgreSQL: Dump Schema Only or Triggers Only</title>
		<link>http://anypossibility.com/blog/2010/07/postgresql-dump-schema-only-or-triggers-only/</link>
		<comments>http://anypossibility.com/blog/2010/07/postgresql-dump-schema-only-or-triggers-only/#comments</comments>
		<pubDate>Sat, 17 Jul 2010 21:59:46 +0000</pubDate>
		<dc:creator>naoko</dc:creator>
				<category><![CDATA[Bash Shell]]></category>
		<category><![CDATA[PostgreSQL]]></category>

		<guid isPermaLink="false">http://anypossibility.com/blog/?p=84</guid>
		<description><![CDATA[I needed to extract triggers only, sequence/index only etc when we migrated database. I received advice from postgresql General List and thought I should post exact step/script of how to accomplish this. Open Terminal: 1. dump schema only pg_dump -h localhost -p 5432 &#8211;username UserName &#8211;schema-only &#8211;format c &#8211;file path_to_backup.backup &#8211;schema &#8216;public&#8217; db_name 2. create [...]]]></description>
			<content:encoded><![CDATA[<p>I needed to extract triggers only, sequence/index only etc when we migrated database.<br />
I received advice from postgresql General List and thought I should post exact step/script of how to accomplish this.</p>
<p>Open Terminal:</p>
<p>1. dump schema only</p>
<blockquote><p>pg_dump -h localhost -p 5432 &#8211;username UserName &#8211;schema-only &#8211;format c &#8211;file path_to_backup.backup &#8211;schema &#8216;public&#8217; db_name</p></blockquote>
<p>2. create list of item that you want to extract<br />
2.1. TRIGGERS only</p>
<blockquote><p>pg_restore &#8211;list &#8220;path_to_backup.backup&#8221; | awk &#8216;/[0-9]*; [0-9]* [0-9]* (TRIGGER)/ { print }&#8217; &gt; &#8220;path_to_triggers.list&#8221;</p></blockquote>
<p>2.2. SEQUENCE, INDEX</p>
<blockquote><p>pg_restore &#8211;list &#8220;path_to_backup.backup&#8221; | awk &#8216;/[0-9]*; [0-9]* [0-9]* (SEQUENCE|INDEX)/ { print }&#8217; &gt; &#8220;path_to_seq.list&#8221;</p></blockquote>
<p>3. Create SQL script from the list<br />
3.1. TRIGGERS only</p>
<blockquote><p>pg_restore  -L path_to_triggers.list -f dest_path_triggers.sql path_to_backup.backup</p></blockquote>
<p>3.2. SEQUENCE, INDEX</p>
<blockquote><p>pg_restore  -L path_to_seq.list -f dest_path_seq.sql path_to_backup.backup</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://anypossibility.com/blog/2010/07/postgresql-dump-schema-only-or-triggers-only/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>nightly backup (pg_dump) with shell script and cron job</title>
		<link>http://anypossibility.com/blog/2010/07/nightly-backup-pg_dump-with-shell-script-and-cron-job/</link>
		<comments>http://anypossibility.com/blog/2010/07/nightly-backup-pg_dump-with-shell-script-and-cron-job/#comments</comments>
		<pubDate>Sat, 10 Jul 2010 15:00:05 +0000</pubDate>
		<dc:creator>naoko</dc:creator>
				<category><![CDATA[PostgreSQL]]></category>

		<guid isPermaLink="false">http://anypossibility.com/blog/?p=41</guid>
		<description><![CDATA[1. write a shell script #!/bin/bash #backup.sh logfile=&#8221;/backups/logfile.log&#8221; # Location to place backups. backup_dir=&#8221;/backups&#8221; touch $logfile timeslot=`date +%y%m%d_%H%M` databases=(&#8220;db1&#8243; &#8220;db2&#8243; &#8220;db3&#8243;) # get length of an array tLen=${#databases[@]} for (( i=0; i&#60;${tLen}; i++ )); do echo &#8220;Vacuum Starting at `date` for database: ${databases[$i]} &#8221; &#62;&#62; $logfile timeinfo=`date &#8216;+%T %x&#8217;` psql -c &#8220;vacuum verbose analyze&#8221; -d [...]]]></description>
			<content:encoded><![CDATA[<p>1. write a shell script</p>
<blockquote>
<div id="_mcePaste">#!/bin/bash</div>
<div>#backup.sh</div>
<div id="_mcePaste">logfile=&#8221;/backups/logfile.log&#8221;</div>
<div id="_mcePaste"># Location to place backups.</div>
<div id="_mcePaste">backup_dir=&#8221;/backups&#8221;</div>
<div id="_mcePaste">touch $logfile</div>
<div id="_mcePaste">timeslot=`date +%y%m%d_%H%M`</div>
<div id="_mcePaste">databases=(&#8220;db1&#8243; &#8220;db2&#8243; &#8220;db3&#8243;)</div>
<div id="_mcePaste"># get length of an array</div>
<div id="_mcePaste">tLen=${#databases[@]}</div>
<div id="_mcePaste">for (( i=0; i&lt;${tLen}; i++ )); do</div>
<div id="_mcePaste">echo &#8220;Vacuum Starting at `date` for database: ${databases[$i]} &#8221; &gt;&gt; $logfile</div>
<div id="_mcePaste">timeinfo=`date &#8216;+%T %x&#8217;`</div>
<div id="_mcePaste">psql -c &#8220;vacuum verbose analyze&#8221; -d ${databases[$i]} -U postgres &gt;&gt; $logfile</div>
<div id="_mcePaste">echo &#8220;Vacuum completed. Backup Starting at `date` for database: ${databases[$i]} &#8221; &gt;&gt; $logfile</div>
<div id="_mcePaste">pg_dump ${databases[$i]} -h 127.0.0.1  -U postgres | gzip &gt; &#8220;$backup_dir/${databases[$i]}-$timeslot-backup.gz&#8221;</div>
<div id="_mcePaste">echo &#8220;Backup and Vacuum complete at `date` for database: ${databases[$i]} &#8221; &gt;&gt; $logfile</div>
<div id="_mcePaste">done</div>
</blockquote>
<p>2. Add an entry to crontab to execute the script above<br />
2.1. open terminal and login as postgres: $ su &#8211; postgres<br />
2.2. list cron job: $ crontab -l<br />
2.3. edit cron job:<br />
2.3.1. $ crontab -e #in terminal vi editor will open)<br />
2.3.2. i for insert mode<br />
2.3.3. enter entry. for instance, to run it every 1 am:<br />
<blockquote>00 01 * * * path_to_backup.sh &gt; /dev/null </p></blockquote>
<p>2&gt;&amp;1<br />
2.3.4. ESC key to exist edit mode<br />
2.3.5. :wq to save and quit</p>
]]></content:encoded>
			<wfw:commentRss>http://anypossibility.com/blog/2010/07/nightly-backup-pg_dump-with-shell-script-and-cron-job/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>great moral leader are made of:</title>
		<link>http://anypossibility.com/blog/2010/07/18/</link>
		<comments>http://anypossibility.com/blog/2010/07/18/#comments</comments>
		<pubDate>Tue, 06 Jul 2010 02:13:43 +0000</pubDate>
		<dc:creator>naoko</dc:creator>
				<category><![CDATA[inspirational quotes]]></category>

		<guid isPermaLink="false">http://anypossibility.com/blog/?p=18</guid>
		<description><![CDATA[I salute the man who is going through life always helpful, knowing no fear, and to whom aggressiveness and resentment are alien. - Albert Einstein]]></description>
			<content:encoded><![CDATA[<blockquote><p>I salute the man who is going through life always helpful, knowing no fear, and to whom aggressiveness and resentment are alien.</p></blockquote>
<p>- Albert Einstein</p>
]]></content:encoded>
			<wfw:commentRss>http://anypossibility.com/blog/2010/07/18/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Install NetBeans 6.9 to OS X 10.5.8</title>
		<link>http://anypossibility.com/blog/2010/07/install-netbeans-6-9-to-os-x-10-5-8/</link>
		<comments>http://anypossibility.com/blog/2010/07/install-netbeans-6-9-to-os-x-10-5-8/#comments</comments>
		<pubDate>Mon, 05 Jul 2010 23:23:34 +0000</pubDate>
		<dc:creator>naoko</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://anypossibility.com/blog/?p=4</guid>
		<description><![CDATA[NetBeans 6.9 is a great PHP IDE and I have been pretty happy about it. Although initially, I almost gave up installing this on my MacBook Pro &#8211; After installation was done and launch the application I have encountered an error saying &#8220;Cannot run on older version of Java 6 Standard Edition. Please install Java [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://netbeans.org/features/php/">NetBeans 6.9</a> is a great PHP IDE and I have been pretty happy about it. Although initially, I almost gave up installing this on my MacBook Pro &#8211; After installation was done and launch the application I have encountered an error saying &#8220;<em>Cannot run on older version of Java 6 Standard Edition.<br />
Please install Java 6 Standard Edition or newer or use &#8211;jdkhome switch to point to its installation directory.</em>&#8221;</p>
<p><strong>To solve this problem</strong>:</p>
<p>Application: Utilities: Java Preference &gt;&gt; Drag Java SE 6 to the top</p>
<p><strong>If this doesn&#8217;t fix the issue try</strong>:</p>
<p>Terminal: type &#8220;env&#8221;. Do you see JAVA_HOME is defined? If so, is this pointing to older version? If so fixing that should resolve the issue (at least it resolved my case). Here is how I fixed:</p>
<ol>
<li>my JAVA_HOME was set to<br />
<blockquote><p><code>/Library/Java/Home</code></p></blockquote>
<p> which was simply the symlink to </p>
<blockquote><p><code>System/Library/Frameworks/ JavaVM.framework/Versions/1.5.0/Home</code></p></blockquote>
</li>
<li>rename the symlink to Home_old</li>
<li>then create new symlink point to 1.6 (SE 6) as follows: ln -s<br />
<blockquote><p><code>/System/Library/Frameworks/ JavaVM.framework/Versions/1.6.0/Home /Library/Java/Home</code></p></blockquote>
</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://anypossibility.com/blog/2010/07/install-netbeans-6-9-to-os-x-10-5-8/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
