<?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>Echo.2 &#187; hacking</title>
	<atom:link href="http://blogs.infoecho.net/echo/category/hacking/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.infoecho.net/echo</link>
	<description>ping and pong in the ocean of network</description>
	<lastBuildDate>Sat, 29 May 2010 06:00:56 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How to save PDF/Images from Mobile Safari to WebDAV compatible iPhone program?</title>
		<link>http://blogs.infoecho.net/echo/2009/06/27/how-to-save-pdfimages-in-directly-lfrom-mobile-safari-to-webdav-compatible-iphone-program/</link>
		<comments>http://blogs.infoecho.net/echo/2009/06/27/how-to-save-pdfimages-in-directly-lfrom-mobile-safari-to-webdav-compatible-iphone-program/#comments</comments>
		<pubDate>Sat, 27 Jun 2009 17:37:43 +0000</pubDate>
		<dc:creator>Jason Chin</dc:creator>
				<category><![CDATA[hacking]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://blogs.infoecho.net/echo/2009/06/how-to-save-pdfimages-in-directly-lfrom-mobile-safari-to-webdav-compatible-iphone-program/</guid>
		<description><![CDATA[Unlike most desktop browser, there is no &#8220;download&#8221; option to save an image, a PDF file, etc., from the Mobile Safari so one can read thoses files offline. Well, this is purely a restriction imposed by Apple for security or whatever other stupid reasons.  Fortunately, with the most recent update of the operation that [...]]]></description>
			<content:encoded><![CDATA[<p>Unlike most desktop browser, there is no &#8220;download&#8221; option to save an image, a PDF file, etc., from the Mobile Safari so one can read thoses files offline. Well, this is purely a restriction imposed by Apple for security or whatever other stupid reasons.  Fortunately, with the most recent update of the operation that support cut and paste and some third party WebDAV compatible file viewer, there could have a workaround.</p>
<p>I have recently set up a system such that when I found an interesting URL, I can cut and paste the URL to a widget served from my own host such that it will fetch the resource from the URL, and save it to a location that corresponds to the location of a WebDAV service in my web host account. Then, I can setup the WebDAV compatible file viewer (currently, I am using Air Share Pro) to view the file in my WebDAV direcotry.  Specially, you can also download the files in the WevDAV server locally for future offline reading. This is extreme useful. Once the file is local, you don&#8217;t have to worry if you get wifi, EDGE, or 3G signal, and you might also save some battery power since you don&#8217;t have to reload the files from the network when you read a document on and off.</p>
<p>The main caveat is that you probably need your own web hosting service or iDisk that supports WebDAV. Beside that, you will need to some simple CGI/AJAX programming and spend some money to buy a WebDAV compatible file viewer like Air Share Pro. I won&#8217;t be surprised that one day there will be an iPhone app that implements something like this using a similar idea in a more polished way. Nevertheless, such application is always at Apple&#8217;s mercy. Once Apple opens some policy in the OS allowing sharing data and files between application like an real operation system, all workarounds will be totally useless. Wait, actually, the way I set up getting file to iPhone is not limited for submitting URL from Mobile Safari. Any browser can push the resource from an URL to the WebDAV directory, regradless if an desktop OS supports mounting a WebDAV volumn.  Not bad as an quick method to get some useful document in the Internet from a desktop system to iPhone.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.infoecho.net/echo/2009/06/27/how-to-save-pdfimages-in-directly-lfrom-mobile-safari-to-webdav-compatible-iphone-program/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Safari on iPhone to read CHM file</title>
		<link>http://blogs.infoecho.net/echo/2007/09/23/using-safari-on-iphone-to-read-chm-file/</link>
		<comments>http://blogs.infoecho.net/echo/2007/09/23/using-safari-on-iphone-to-read-chm-file/#comments</comments>
		<pubDate>Mon, 24 Sep 2007 01:55:49 +0000</pubDate>
		<dc:creator>Jason Chin</dc:creator>
				<category><![CDATA[hacking]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://blogs.infoecho.net/echo/?p=103</guid>
		<description><![CDATA[iPhone is a fancy toy with a lot of power but Apple deliberately locks a lot of the potential power. One thing I like to do on an iPhone is to be able to read CHM files. As a weekend project, I setup the tool chain for iPhone following the instructions. Then, I grabbed the [...]]]></description>
			<content:encoded><![CDATA[<p>iPhone is a fancy toy with a lot of power but Apple deliberately locks a lot of the potential power. One thing I like to do on an iPhone is to be able to read CHM files. As a weekend project, I setup the tool chain for iPhone following <a href="http://code.google.com/p/iphone-dev/wiki/Building">the instructions</a>. Then, I grabbed the source code of <a href="http://www.jedrea.com/chmlib/"><tt>chmlib</tt></a>. With some minor modification, I was able to compile the <tt>chmlib</tt> as an iPhone binary library. That was very encouraging.</p>
<p>This provides a convenient way to make iPhone as a CHM reader. In the <tt>chmlib</tt> source code distribution, there is an example program that runs as a http-server that serves the content of a CHM as standard web page. The &#8220;mobileSafari&#8221; has no problem to render the results, but the fonts are usually too small to read and the text is typically rendered too wide such that a lot horizontal scrolling becomes annoyingly necessary.</p>
<p>I decided to combine some python code with the <tt>chm_http</tt> server from the <tt>chmlib</tt> source code. I modified the source code of <tt>chm_http</tt> so it can call python code to modify the HTML code in the CHM file, replacing the original CSS with new setting for reading on small screen. Furthermore, I found it was tedious to start the <tt>chm_http</tt> from a terminal every time when you want to read a different book. I wrote another small python script that can scan a directory and find all CHM files in the directory to output an index html page. At the end, I was able to use the mobileSafari pointing to the index page and select the book I want to read. The &#8220;chm_http&#8221; server would start automatically to get the book I like to read.</p>
<p>If you are interested in reading CHM on your iPhone. Get this <a href="http://infoecho.net/files/iphoneCHM.tgz">iphoneCHM.tgz</a> <strike>(the file would be upload soon)</strike>. Copy the &#8220;<tt>chm_http2</tt>&#8220;, &#8220;<tt>rewriteHTML.py</tt>&#8220;, and &#8220;<tt>CHMServer</tt>&#8221; to &#8220;<tt>/usr/local/bin/</tt>&#8221; in your iPhone. Change the permission of these files such that you can run all of them. Put some chm files in <tt>/var/root/Media/CHM_Ebooks/</tt>. Open a terminal in the iPhone or ssh into the iPhone to run &#8220;CHMServer&#8221;. After that, ask the Safari to open this URL <tt>http://127.0.0.1:8000</tt>. You should see the links to the CHM files. You can now click on any of them and enjoy a nice reading time.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.infoecho.net/echo/2007/09/23/using-safari-on-iphone-to-read-chm-file/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>More on google map image tiles</title>
		<link>http://blogs.infoecho.net/echo/2007/02/04/more-on-google-map-image-tiles/</link>
		<comments>http://blogs.infoecho.net/echo/2007/02/04/more-on-google-map-image-tiles/#comments</comments>
		<pubDate>Sun, 04 Feb 2007 21:45:07 +0000</pubDate>
		<dc:creator>Jason Chin</dc:creator>
				<category><![CDATA[hacking]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[map]]></category>

		<guid isPermaLink="false">http://blogs.infoecho.net/echo/?p=90</guid>
		<description><![CDATA[



Lat (-90 ~ 90):




Lon (-180 ~ 180):




Zoom (0-17):





GetMap
Back









no data yet



This is another google map hack. I will write some details about this in the furture. In the mean time, you can also check this out. If you are interested in my source code for this hack, you probably know how to get it anyway.
]]></description>
			<content:encoded><![CDATA[<p><script src="http://blogs.infoecho.net/echo/js/gmh2.js"></script></p>
<table border="0">
<tbody>
<tr>
<td>Lat (-90 ~ 90):</td>
<td>
<input id="gmh2_lat" size="16" value="0" /></td>
</tr>
<tr>
<td>Lon (-180 ~ 180):</td>
<td>
<input id="gmh2_lon" size="16" value="0" /></td>
</tr>
<tr>
<td>Zoom (0-17):</td>
<td>
<input id="gmh2_zl" size="16" value="17" /></td>
</tr>
</tbody>
</table>
<p><button onclick="gmh2_getMap()">GetMap</button><br />
<button onclick="gmh2_backALevel()">Back</button></p>
<table border="0">
<tbody>
<tr>
<td><img id="gmh2_sat" onclick="gmh2_zoomIn(event)" onmousemove="gmh2_updateCoor(event);" src="http://kh0.google.com/kh?&amp;v=14&amp;t=t" alt="bless all mighty google" width="256" height="256" /></td>
</tr>
<tr>
<td><img id="gmh2_map" onclick="gmh2_zoomIn(event);" onmousemove="gmh2_updateCoor(event);" src="http://mt0.google.com/mt?v=w2.37&amp;x=0&amp;y=0&amp;zoom=17" alt="bless all mighty google" width="256" height="256" /></td>
</tr>
<tr>
<td colspan="2"><textarea id="gmh2_output" cols="40" rows="5" readonly="readonly">no data yet</textarea></td>
</tr>
</tbody>
</table>
<p>This is another google map hack. I will write some details about this in the furture. In the mean time, you can also check <a href="http://www.codeproject.com/useritems/googlemap.asp">this</a> out. If you are interested in my source code for this hack, you probably know how to get it anyway.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.infoecho.net/echo/2007/02/04/more-on-google-map-image-tiles/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Extract Google Map Satellite Image Tiles</title>
		<link>http://blogs.infoecho.net/echo/2007/02/03/extract-google-map-satellite-image-tiles/</link>
		<comments>http://blogs.infoecho.net/echo/2007/02/03/extract-google-map-satellite-image-tiles/#comments</comments>
		<pubDate>Sat, 03 Feb 2007 23:50:08 +0000</pubDate>
		<dc:creator>Jason Chin</dc:creator>
				<category><![CDATA[hacking]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[google map]]></category>
		<category><![CDATA[map]]></category>

		<guid isPermaLink="false">http://blogs.infoecho.net/echo/?p=89</guid>
		<description><![CDATA[




















Click the tiles to zoom in for one level.
Clike the &#8220;back&#8221; button to go back.
back



Show URL for the 2nd quarter


Show URL for the 1st quarter




Show URL for the 3rd quarter


Show URL for the 4th quarter


The URL to extract Google&#8217;s satellite image tiles has a very simple encoding. It is simply "http://kh0.google.com/kh?&#038;v=14?t=t" where the argument followed [...]]]></description>
			<content:encoded><![CDATA[<p><script language="javascript" src="http://infoecho.net/blogs/echo/js/gmh.js"></script><br />
</p>
<table cellpadding=0 CELLSPACING="0" border=1>
<tr>
<td>
<img id="lt" width=128 height=128 alt="blesss all mighty google " src="http://kh0.google.com/kh?&#038;v=14&#038;t=tq" onclick="zoom('lt')"/>
</td>
<td>
<img id="rt" width=128 height=128 alt="blesss all mighty google " src="http://kh0.google.com/kh?&#038;v=14&#038;t=tr" onclick="zoom('rt')"/>
</td>
</tr>
<tr>
<td>
<img id="lb" width=128 height=128 alt="blesss all mighty google " src="http://kh0.google.com/kh?&#038;v=14&#038;t=tt" onclick="zoom('lb')"/>
</td>
<td>
<img id="rb" width=128 height=128 alt="blesss all mighty google " src="http://kh0.google.com/kh?&#038;v=14&#038;t=ts" onclick="zoom('rb')"/>
</td>
</tr>
</table>
<p>
Click the tiles to zoom in for one level.<br />
Clike the &#8220;back&#8221; button to go back.<br />
<button onclick="back()";>back</button></p>
<table>
<tr>
<td>
<button onclick="alert(document.getElementById('lt').src)">Show URL for the 2nd quarter</button>
</td>
<td>
<button onclick="alert(document.getElementById('rt').src)">Show URL for the 1st quarter</button>
</td>
</tr>
<tr>
<td>
<button onclick="alert(document.getElementById('lb').src)">Show URL for the 3rd quarter</button>
</td>
<td>
<button onclick="alert(document.getElementById('rb').src)">Show URL for the 4th quarter</button></td>
</tr>
</table>
<p>The URL to extract Google&#8217;s satellite image tiles has a very simple encoding. It is simply <tt>"http://kh0.google.com/kh?&#038;v=14?t=t"</tt> where the argument followed by <tt>t=</tt> is a string composed with letters &#8220;q&#8221;,&#8221;r&#8221;,&#8221;t&#8221; and &#8220;s&#8221;. These letters indicate the quarter of the image tile from the last image.  For example, the first quarter (north-east) of the root image uses &#8220;t=tr&#8221;. The second quarter uses &#8220;t=tq&#8221;, the third quarter uses &#8220;t=tt&#8221; and the forth quarter uses &#8220;t=ts&#8221;. To get the next zoom level, you can just append either &#8220;r&#8221;,&#8221;q&#8221;,&#8221;t&#8221; and &#8220;s&#8221; in the argument. The longer the string, the higher the zoom level. As an example, the URL for the tile that shows Mt. Rainer is &#8220;<a href="http://kh0.google.com/kh?&#038;v=14&#038;t=tqtrtsqtrqrs"><tt>http://kh0.google.com/kh?&#038;v=14&#038;t=tqtrtsqtrqrs/</tt><tt></tt></a>.&#8221;  It would be straight forward to write a program to get the tiles you need by specifying longitude and latitude. This would be handy to composed satellite image for a region you like and print it out.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.infoecho.net/echo/2007/02/03/extract-google-map-satellite-image-tiles/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Block web ad</title>
		<link>http://blogs.infoecho.net/echo/2007/01/29/block-web-ad/</link>
		<comments>http://blogs.infoecho.net/echo/2007/01/29/block-web-ad/#comments</comments>
		<pubDate>Mon, 29 Jan 2007 19:16:14 +0000</pubDate>
		<dc:creator>Jason Chin</dc:creator>
				<category><![CDATA[hacking]]></category>
		<category><![CDATA[google]]></category>

		<guid isPermaLink="false">http://blogs.infoecho.net/echo/?p=87</guid>
		<description><![CDATA[We are living in a world where ads are everywhere.  With powerful servers, web advertisement is ubiquitous.  Unfortunately, I think they are too intrusive most of time.  So, it is generally a good idea to disable the online ads.  For a free solution, there are several common techniques.  First, figure [...]]]></description>
			<content:encoded><![CDATA[<p>We are living in a world where ads are <a href="http://www.nytimes.com/2007/01/15/business/media/15everywhere.html?_r=1&#038;oref=slogin">everywhere</a>.  With powerful servers, web advertisement is ubiquitous.  Unfortunately, I think they are too intrusive most of time.  So, it is generally a good idea to disable the online ads.  For a free solution, there are several common techniques.  First, figure the ad servers&#8217; IP, and use <tt>/etc/hosts</tt> to send the ad request call into void.  Second, use a <a href="http://www.floppymoose.com/"><tt>userContent.css</tt></a> to filter out ads.  For example, if you don&#8217;t like the Google ads. You can put the following lines in your <tt>/etc/hosts</tt> (for OS X or other unix).</p>
<pre>
127.0.0.1   pagead.googlesyndication.com
127.0.0.1   pagead2.googlesyndication.com
127.0.0.1   domains.googlesyndication.com
127.0.0.1   googlesyndication.com
127.0.0.1   www.google-analytics.com
127.0.0.1   partner.googleadservices.com
</pre>
<p>For OS X, you will need to use the Terminal.app to run the command <tt>lookupd -flushcache</tt> to re-flush the DNS cache.</p>
<p>Now, with this setup, I am free from all mighty Google ads.  You can do the same to block other ad providers. Combined with the <tt>userContent.css</tt>, I have regain the nice web browsing experience without the interferences from ads.</p>
<p>I also find out that the Safari plugin <a href="http://fsbsoftware.com/">SafariBlock</a> can block images and flash ads in a convenient way.  Moreover, it can also block specific javascripts although you might have to type the URL pointing to the javascript in SafariBlock&#8217;s preferences by yourself.  For example, you can block the annoying in-text pop-out type ads from <a href="http://intellitxt.com/">Intellitext</a> by putting a new rule in the SafariBlock preferences to block out the URL &#8216;http://*.intellitxt.com/*.js&#8217;. This will block all javascript from Intellitext without disabling javascript totally.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.infoecho.net/echo/2007/01/29/block-web-ad/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Create DMG Automator</title>
		<link>http://blogs.infoecho.net/echo/2006/07/23/create-dmg-automator/</link>
		<comments>http://blogs.infoecho.net/echo/2006/07/23/create-dmg-automator/#comments</comments>
		<pubDate>Sun, 23 Jul 2006 20:36:11 +0000</pubDate>
		<dc:creator>Jason Chin</dc:creator>
				<category><![CDATA[hacking]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://blogs.infoecho.net/echo/?p=76</guid>
		<description><![CDATA[This is a simple bash script to create DMG under Finder.

  for f in &#8220;$@&#8221; do b=$(basename &#8220;$f&#8221;) d=$(dirname &#8220;$f&#8221;) hdiutil create -format UDZO -srcfolder &#8220;$f&#8221; &#8220;$d/$b.dmg&#8221; done

You can use this simple script combined with Automator such that you can create disk image files by selecting files or directories and using the Automator context [...]]]></description>
			<content:encoded><![CDATA[<p>This is a simple bash script to create DMG under Finder.</p>
<blockquote><p>
  for f in &#8220;$@&#8221; do b=$(basename &#8220;$f&#8221;) d=$(dirname &#8220;$f&#8221;) hdiutil create -format UDZO -srcfolder &#8220;$f&#8221; &#8220;$d/$b.dmg&#8221; done
</p></blockquote>
<p>You can use this simple script combined with Automator such that you can create disk image files by selecting files or directories and using the Automator context menu in Finder.</p>
<p>Automator setup</p>
<p><a href="./wp-content/200607231435.jpg" onclick="window.open('./wp-content/200607231435.jpg','popup','width=463,height=191,scrollbars=no,resizable=yes,toolbar=no,directories=no,location=no,menubar=no,status=yes,left=0,top=0');return false"><img src="http://infoecho.net/blogs/echo/wp-content/200607231435-tm.jpg" height="100" width="242" border="1" hspace="4" vspace="4" alt="200607231435" /></a></p>
<p>
Usage:</p>
<p><a href="./wp-content/200607231435-1.jpg" onclick="window.open('./wp-content/200607231435-1.jpg','popup','width=453,height=429,scrollbars=no,resizable=yes,toolbar=no,directories=no,location=no,menubar=no,status=yes,left=0,top=0');return false"><img src="http://infoecho.net/blogs/echo/wp-content/200607231435-1-tm.jpg" height="100" width="105" border="1" hspace="4" vspace="4" alt="200607231435-1" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.infoecho.net/echo/2006/07/23/create-dmg-automator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fix firewire HD problem on a powerbook</title>
		<link>http://blogs.infoecho.net/echo/2006/06/04/fix-firewire-hd-problem-on-a-powerbook/</link>
		<comments>http://blogs.infoecho.net/echo/2006/06/04/fix-firewire-hd-problem-on-a-powerbook/#comments</comments>
		<pubDate>Mon, 05 Jun 2006 02:37:21 +0000</pubDate>
		<dc:creator>Jason Chin</dc:creator>
				<category><![CDATA[hacking]]></category>

		<guid isPermaLink="false">http://blogs.infoecho.net/echo/?p=73</guid>
		<description><![CDATA[After re-organizing some of my daughter&#8217;s video and pictures, it is time to backup my whole user directory. Unfortunately, my PB failed to write to two different firewire HDs. The PB mounted the firewire HDs but it hanged when writing some files (I got such log: Jun 4 23:42:26 ECHO kernel[0]: disk1s3: I/O error.). At [...]]]></description>
			<content:encoded><![CDATA[<p>After re-organizing some of my daughter&#8217;s video and pictures, it is time to backup my whole user directory. Unfortunately, my PB failed to write to two different firewire HDs. The PB mounted the firewire HDs but it hanged when writing some files (I got such log: Jun 4 23:42:26 ECHO kernel[0]: disk1s3: I/O error.). At beginning, I though it was a problem of my firewire enclosure, but it happened on two external HD. I had to conclude the problem was on my PB. So, it was voodoo time. I zapped the PRAM, reseted NVRAM. Reboot, it behaved much better. At least it only hanged after finished copying my /User. This was the message I got in syslog.log</p>
<pre>
Jun  4 23:57:40 ECHO kernel[0]: FireWire (OHCI) Apple ID 31 built-in:
handleARxReqInt - ARx Request packet error, status = 0xe00002c7
</pre>
<p>Well, I unpluged the HD and re-pluged it back. It seemed working fine. I tested to write large files to the other HD, it also worked while it failed consistently before I had reseted the PRAM. So, I guess the problem is solved. I still don&#8217;t know what NVRAM has any thing to do with firewire.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.infoecho.net/echo/2006/06/04/fix-firewire-hd-problem-on-a-powerbook/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Compress Canon A620 AVI and DV to H.264 mp4 file</title>
		<link>http://blogs.infoecho.net/echo/2006/05/31/compress-canon-a620-avi-and-dv-to-h264-mp4-file/</link>
		<comments>http://blogs.infoecho.net/echo/2006/05/31/compress-canon-a620-avi-and-dv-to-h264-mp4-file/#comments</comments>
		<pubDate>Wed, 31 May 2006 14:11:35 +0000</pubDate>
		<dc:creator>Jason Chin</dc:creator>
				<category><![CDATA[hacking]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://blogs.infoecho.net/echo/?p=71</guid>
		<description><![CDATA[Just a memo for myself.
With mencoder, mplayer, ffmpeg and mp4box, I can finally reduce the size of the video files created from my Canon A620 to reasonable sizes such I can put them in my powerbook without depleting the hard drive space.
This is the script for converting AVI to mp4,

mencoder $1 \
-ovc x264 -nosound -ni [...]]]></description>
			<content:encoded><![CDATA[<p>Just a memo for myself.</p>
<p>With mencoder, mplayer, ffmpeg and mp4box, I can finally reduce the size of the video files created from my Canon A620 to reasonable sizes such I can put them in my powerbook without depleting the hard drive space.</p>
<p>This is the script for converting AVI to mp4,</p>
<pre>
mencoder $1 \
-ovc x264 -nosound -ni -sws 0 -x264encopts \
threads=1:me=2:qp_min=22:\
qp_max=51:i4x4:keyint=120:nocabac:deblock:nob_adapt \
-ofps 29.97 -vop harddup -of rawvideo \
-o $1.264

mplayer -vc dummy -vo null -ao pcm:file=$1.wav $1

ffmpeg -i $1.264 -i $1.wav -y -vn -f mp4 -acodec aac \
-ab 96 -ar 11025 -ac 2 -map 1.0:0.0 $1.aac.mp4

MP4Box -fps 29.97 -add $1.264 -add $1.aac.mp4 -new $1.mp4

rm $1.wav
rm $1.264
rm $1.aac.mp4
touch -r $1 $1.mp4
</pre>
<p>For convert DV to mp4, I use</p>
<pre>
ffmpeg -i $1 -y -vcodec h264 -f mp4 -acodec aac \
-deinterlace -b 1280 -aspect 4:3 -s 640x480 -naq \
-parti4x4 -deblock -copyts -keyint_min 120 -h264 1 \
-mv4 1 -bf 2 -coder 1 -parti4x4 -partp4x4 -parti8x8 \
partp8x8 $1.mp4touch -r $1 $1.mp4
</pre>
<p>The results seem pretty reasonable good, while the sizes are still under control.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.infoecho.net/echo/2006/05/31/compress-canon-a620-avi-and-dv-to-h264-mp4-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Open firmware password and firewire enclosure</title>
		<link>http://blogs.infoecho.net/echo/2006/01/31/open-firmware-password-and-firewire-enclosure/</link>
		<comments>http://blogs.infoecho.net/echo/2006/01/31/open-firmware-password-and-firewire-enclosure/#comments</comments>
		<pubDate>Wed, 01 Feb 2006 07:16:27 +0000</pubDate>
		<dc:creator>Jason Chin</dc:creator>
				<category><![CDATA[hacking]]></category>

		<guid isPermaLink="false">http://blogs.infoecho.net/echo/?p=70</guid>
		<description><![CDATA[I have a firewire enclosure using Genesys GL-711 chip. It has been working well. However, I tried to mount it under OS X.4.4 earlier today and failed. The System Profile showed the firewire bus but not the hard drive. My powerbook could still mount other external firewire hard drives using different chipsets and the GL711 [...]]]></description>
			<content:encoded><![CDATA[<p>I have a firewire enclosure using Genesys GL-711 chip. It has been working well. However, I tried to mount it under OS X.4.4 earlier today and failed. The System Profile showed the firewire bus but not the hard drive. My powerbook could still mount other external firewire hard drives using different chipsets and the GL711 box could also work with other computer too. I was very puzzled.</p>
<p>I tried to reset PMU and zapped PR ram. I needed to disable the open firmware password to do so. After the zapping PR-ram, resetting PMU, rebooting the computer, the hard drive controlled by GL-711 showed up. I thought it might be a good idea to set the password again, so I did it. Reboot, the powerbook could not see the hard drive anymore. After a few more rebooting and testing, I confirmed that setting open firmware password affected whether the powerbook 12 inch could see the hard drive or not.</p>
<p>This is such strange bug. How would the open firmware password affect the firewire bus? And why it is so specific to one kind of firewire bridging chip but not the others? I guess it would probably not be easy to figure that out.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.infoecho.net/echo/2006/01/31/open-firmware-password-and-firewire-enclosure/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Safe Sleep</title>
		<link>http://blogs.infoecho.net/echo/2005/11/14/safe-sleep/</link>
		<comments>http://blogs.infoecho.net/echo/2005/11/14/safe-sleep/#comments</comments>
		<pubDate>Tue, 15 Nov 2005 00:11:31 +0000</pubDate>
		<dc:creator>Jason Chin</dc:creator>
				<category><![CDATA[hacking]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://blogs.infoecho.net/echo/?p=65</guid>
		<description><![CDATA[In the recent OS X 10.4.3, it is possible to &#8220;suspend&#8221; my powerbook into hibernate mode that does not use any power (see Andrew&#8217;s Blog).  I write this simple script &#8220;sleepmode&#8221; to make life slightly easier with this feature.

#!/bin/sh
case &#8221;$1&#8221; in
  deep)
    sudo pmset -a hibernatemode 1
  ;;
  [...]]]></description>
			<content:encoded><![CDATA[<p>In the recent OS X 10.4.3, it is possible to &#8220;suspend&#8221; my powerbook into hibernate mode that does not use any power (see <a href="http://www.andrewescobar.com/archive/2005/11/11/how-to-safe-sleep-your-mac/">Andrew&#8217;s Blog</a>).  I write this simple script &#8220;sleepmode&#8221; to make life slightly easier with this feature.</p>
<pre>
#!/bin/sh
case &rdquo;$1&rdquo; in
  deep)
    sudo pmset -a hibernatemode 1
  ;;
  safe)
    sudo pmset -a hibernatemode 3
  ;;
  normal)
    sudo pmset -a hibernatemode 0
  ;;
  go)
    omode=&rdquo;`pmset -g | grep hibernatemode | cut -f 2`&rdquo;
    sudo pmset -a hibernatemode 1
    echo The system is going to the deep sleep in 3 seconds
    sleep 3
    osascript -e 'tell application "Finder" to sleep'
    sudo pmset -a hibernatemode $omode
    echo The system is back to it orginal sleep mode
  ;;
esac

case &rdquo;`pmset -g | grep hibernatemode | cut -f 2`&rdquo; in
  0)
  echo System is in the Normal Sleep Mode
  ;;
  1)
  echo System is in the Deep Sleep Mode
  ;;
  3)
  echo System is in the Safe Sleep Mode
  ;;
esac</pre>
]]></content:encoded>
			<wfw:commentRss>http://blogs.infoecho.net/echo/2005/11/14/safe-sleep/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
