tag:blogger.com,1999:blog-26478267504620300322024-03-12T19:49:38.678-04:00tawtaoMy Notestawtaohttp://www.blogger.com/profile/17266883568788173890noreply@blogger.comBlogger32125tag:blogger.com,1999:blog-2647826750462030032.post-42523252227495003422020-03-21T06:57:00.004-04:002020-03-21T07:11:42.449-04:00Vim Videos That Wow! MeI have been using vim for years, but these two videos change how I use vim tremendously.<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6K1hadIoS0GV4tMergul18_BH7Qs08YCossBlH6TPCPDrIHtKn_5kGpkFK9PWCmJpJtXPCwC_vPHM18vRnn5qnUjPXkut7VLXdVA6yPBGtgc-OXoZ4taLrbMmVcRz3jhTjKDqsv2tg14/s1600/2020-03-21-064914_1269x1405_scrot.png" imageanchor="1" style="clear: left; display: inline !important; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" data-original-height="283" data-original-width="500" height="113" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6K1hadIoS0GV4tMergul18_BH7Qs08YCossBlH6TPCPDrIHtKn_5kGpkFK9PWCmJpJtXPCwC_vPHM18vRnn5qnUjPXkut7VLXdVA6yPBGtgc-OXoZ4taLrbMmVcRz3jhTjKDqsv2tg14/s200/2020-03-21-064914_1269x1405_scrot.png" width="200" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6K1hadIoS0GV4tMergul18_BH7Qs08YCossBlH6TPCPDrIHtKn_5kGpkFK9PWCmJpJtXPCwC_vPHM18vRnn5qnUjPXkut7VLXdVA6yPBGtgc-OXoZ4taLrbMmVcRz3jhTjKDqsv2tg14/s1600/2020-03-21-064914_1269x1405_scrot.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"></a></div>
<a href="https://www.youtube.com/watch?v=wlR5gYd6um0&t=1s" target="_blank">Mastering the Vim Languages</a><br />
<br />
Chris Toomey give a talk on vim language. If you wanna learn why vim is so great or use vim more efficiently, you should start with this one. Chris also includes lots of resources in this talk if you want to follow deeply into this topic.<br />
<div>
<br />
<br />
<br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWLlljDF3upgEYYOmztE4jQ1ocwjVkQbRFcY5b9scyv5obE5u__5ncLoDzueni9OvoiR83LpZJ5_DgDhfEFjyI7zie1tvLwEj0cMl1z431WnkknNAw1Kmh4KRJuxcoL9XaLnRAPuuj78U/s1600/2020-03-21-065229_1269x1405_scrot.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" data-original-height="282" data-original-width="500" height="112" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWLlljDF3upgEYYOmztE4jQ1ocwjVkQbRFcY5b9scyv5obE5u__5ncLoDzueni9OvoiR83LpZJ5_DgDhfEFjyI7zie1tvLwEj0cMl1z431WnkknNAw1Kmh4KRJuxcoL9XaLnRAPuuj78U/s200/2020-03-21-065229_1269x1405_scrot.png" width="200" /> </a><a href="https://www.youtube.com/watch?v=3TX3kV3TICU" target="_blank">Let Vim Do The Typing</a><br />
<br />
Presented by George Brocklehurst, talking about vim completing, basically. I found the talk very practically useful and somewhat different form Toomey’s talk.</div>
<div>
<br /></div>
tawtaohttp://www.blogger.com/profile/17266883568788173890noreply@blogger.com0tag:blogger.com,1999:blog-2647826750462030032.post-22574758199787817722018-08-25T00:09:00.005-04:002018-08-25T00:09:56.603-04:00Tracking movement of the moon shot<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjbOlcpP0ustPYoYJAMYBEqDAMZcsH1D6_AAFZzXWJ1SY6hz0PSDYBhzWG_7rOB7PqUh7dA1sWyqyKhujwH3jQYj23G7DZclU53WM1dLItngty1b_cd_nKt784wrwHL3qCiyncQpUMNko4/s1600/combine-0050-0055.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="869" data-original-width="1300" height="426" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjbOlcpP0ustPYoYJAMYBEqDAMZcsH1D6_AAFZzXWJ1SY6hz0PSDYBhzWG_7rOB7PqUh7dA1sWyqyKhujwH3jQYj23G7DZclU53WM1dLItngty1b_cd_nKt784wrwHL3qCiyncQpUMNko4/s640/combine-0050-0055.jpg" width="640" /></a></div>
<br />
<br />
Everyday Challenge: Day 15,<br />
<br />
With knowledge how to take a moon picture from yesterday post, I now can combine those pictures into an interesting one.<br />
<br />
By taking each moon 5 mins apart on a tripod, and combine them with photo editing tool like Gimp (sorry, not photoshop). I am able to track the moon moves across the night sky.<br />
<br />
Gimp is a powerful tool, so much so I have to sense a decent amount of time to learn how to combine to create this picture. Anyway, it worths to trytawtaohttp://www.blogger.com/profile/17266883568788173890noreply@blogger.com0tag:blogger.com,1999:blog-2647826750462030032.post-3050948167693698852018-08-23T20:55:00.001-04:002018-08-23T21:58:16.560-04:00Moon shot with A7Rii Super35 + Canon 200mm F/2.8@ F11.<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgajs7qfTGsRMwXpH0VG-FgyGvuYruSJFWOMYOGopyibba7asbdME8Y3AQsr5GQCChWJSu6X2zkltpZve4eGzWmI-ulmN8ZBJDRQDAlbuesCKH8cCFcJzcUkJUlLrk04gBJjAUYhuADKWo/s1600/_DSC0049.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1195" data-original-width="1195" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgajs7qfTGsRMwXpH0VG-FgyGvuYruSJFWOMYOGopyibba7asbdME8Y3AQsr5GQCChWJSu6X2zkltpZve4eGzWmI-ulmN8ZBJDRQDAlbuesCKH8cCFcJzcUkJUlLrk04gBJjAUYhuADKWo/s640/_DSC0049.jpg" width="640" /></a></div>
<br />
This moon shot was taken by A7Rii using Super35 mode, with Canon 200mm F2.8@F11 (equivalent to ~ 300mm).<br />
<br />
To get this shot, you need to take the shot underexposure, which allows the camera to see all detail of the moon surface. Otherwise, you can only see a big white ball.<br />
<br />
By using the lowest possible ISO, the noise is reduced significantly. By setting the aperture to F11, the lens will perform at the best and also further underexposure the image. By manually setting speed to 1/200-1/300, I can simply handheld. Make sure, that you do not underexposure too much.<br />
<br />
A7Rii in Super35 mode made 200mm to be 300mm, which help a bit.<br />
<br />
Here you have it!<br />
<div>
<br /></div>
tawtaohttp://www.blogger.com/profile/17266883568788173890noreply@blogger.com0tag:blogger.com,1999:blog-2647826750462030032.post-92043322355367309482018-08-22T03:12:00.002-04:002018-08-22T03:20:38.393-04:00Is your camera sensor clean?<div style="background-color: white; color: #1d2129; font-family: Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 6px; margin-top: 6px;">
Let ask a question, is your camera sensor clean?<br />
<br /></div>
<div style="background-color: white; color: #1d2129; font-family: Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 6px; margin-top: 6px;">
Here how I answer this question. I take out the camera, in this case, a Sony A7R, and put on my trusty Canon 100mm Macro with MC11. I set the aperture to F11 and take pictures of the sky. I choose an area of that sky that quite featureless.<br />
<br /></div>
<div class="text_exposed_show" style="background-color: white; color: #1d2129; display: inline; font-family: Helvetica, Arial, sans-serif; font-size: 14px;">
<div style="font-family: inherit; margin-bottom: 6px;">
The key is to set aperture to F11. This allow the dust on sensor appear on the picture. If you use low aperture like, F2.8, F4, the dust images get blurry too much and you can not see them. If you see one at this aperture, the dust has to be a big one.<br />
<br /></div>
<div style="font-family: inherit; margin-bottom: 6px; margin-top: 6px;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhoGEfsksM5kNC9tWehfzIGF4Tkpx7o5xht_qw4A47eTRGZs3L1-HX_VnNgSM8FbkDnfW867_SueQ3G67WDypYul2ZxFWY0GAw4xrg1N_UA1bjhigHHPomt-whfo2pJ2KzF1L0NZrWk62M/s1600/DSC02718.JPG" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" data-original-height="1068" data-original-width="1600" height="266" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhoGEfsksM5kNC9tWehfzIGF4Tkpx7o5xht_qw4A47eTRGZs3L1-HX_VnNgSM8FbkDnfW867_SueQ3G67WDypYul2ZxFWY0GAw4xrg1N_UA1bjhigHHPomt-whfo2pJ2KzF1L0NZrWk62M/s400/DSC02718.JPG" width="400" /></a>The first picture is the jpg come out directly from the camera. Look closely, you will see a few blurry spots here and there, especially the lower right corner of the pictures. I think it is not so bad. In normal shooting, the dust images won't show up in the pictures.<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br /></div>
<div style="font-family: inherit; margin-bottom: 6px; margin-top: 6px;">
<br />
<b>Could I say this sensor clean?</b><br />
<br /></div>
<div style="font-family: inherit; margin-bottom: 6px; margin-top: 6px;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhucCWLZn31fTIw_wPh6qt7egW_lBf51LRiGXEmm_C7ipCkg8JHTNbC0loAHvY_Z3r64fG3mZ7l99dzzIODzXnkdJXvZBcks0bjnh5veqYF1SZrhw0EiIm6VyjuTYaQUCbKe-KGeupgDCc/s1600/DSC02718.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" data-original-height="1068" data-original-width="1600" height="266" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhucCWLZn31fTIw_wPh6qt7egW_lBf51LRiGXEmm_C7ipCkg8JHTNbC0loAHvY_Z3r64fG3mZ7l99dzzIODzXnkdJXvZBcks0bjnh5veqYF1SZrhw0EiIm6VyjuTYaQUCbKe-KGeupgDCc/s400/DSC02718.jpg" width="400" /></a>Far from it! ... Let turn up the contrast, as shown in the second picture, then a lot more dark spot show up.<br />
<br /></div>
<div style="font-family: inherit; margin-bottom: 6px; margin-top: 6px;">
It is impossible to keep your sensor dust free because every time to change lens, some dusts will get into your sensor.<br />
<br /></div>
<div style="font-family: inherit; margin-bottom: 6px; margin-top: 6px;">
So there is no "big" dark spot show up in the pictures, I probably won't do any thing about it. May be, I just use "Rocket-Air Blower" to blow some dust away from the sensor If I see some spots. Otherwise, I probably send the camera to clean ... and that $$.<br />
<br />
<br />
<br /></div>
</div>
tawtaohttp://www.blogger.com/profile/17266883568788173890noreply@blogger.com0tag:blogger.com,1999:blog-2647826750462030032.post-52937829154651303062014-08-18T22:45:00.002-04:002014-08-18T22:53:05.595-04:00Setup Brother Printer on 64bits debian base linux, like CrunchBag or UbuntuI just get a new printer - Brother HL-2270DW series. It's compatible with linux and brother have drivers for it! Unfortunately, the driver is for 32bits (i386) systems. So what next?<br />
<div>
<br />
I assume USB connection.<br />
<br /></div>
<div>
It is simple really. All we have to do is to config our system to support multiple architecture, aka Multiarch, and then use the 32bits drivers. You can read about debian Multiarch <a href="https://wiki.debian.org/Multiarch/HOWTO">here</a>.
</div>
<div>
<br /></div>
<div>
First we have to add i386 architecture support to your system by:
</div>
<div>
<br /></div>
<pre class="code"><strong>## add i386 support
$ dpkg --add-architecture i386
## and update the system
$ apt-get update</strong></pre>
Then we need the add i386 support library. Since la32-libs is replace by libstdc++:i386, so we have to do the following
<br />
<pre class="code"><strong>## add i386 support libraries
$ apt-get install libstdc++:i386</strong></pre>
Once we finished adding support library for our i386 architecture, then we just simply install drivers downloaded from Brother website:
<br />
<pre class="code"><strong>## install drivers start from "LPR printer driver"
$ dpkg -i hl2270dwlpr-2.1.0-1.i386.deb
## and then "CUPSwrapper printer driver"
$ dpkg -i cupswrapperHL2270DW-2.0.4-2.i386.deb</strong></pre>
We can download the drivers from brother website <a href="http://support.brother.com/g/b/downloadtop.aspx?c=us&lang=en&prod=hl2270dw_all">here</a>:
<br />
<div>
<br /></div>
To confirm that drivers install correctly, just run:
<br />
<pre class="code"><strong>$ system-config-printer</strong></pre>
tawtaohttp://www.blogger.com/profile/17266883568788173890noreply@blogger.com0tag:blogger.com,1999:blog-2647826750462030032.post-17909027893644710262014-04-05T23:16:00.001-04:002014-04-05T23:42:38.222-04:00Linux on Android using Complete Linux Installer: Hiccup and Fix!The benefit of having a full linux distribution running on android device, such as Asus transformer Prime/Infinity, is up to who you are. For me as a developer, it's really a great platform for me to play around with new language, practice new skill and, experiment with new tools without mass up with my work notebook. For sys admin, it's quite a nice to have a full bowl linux to work on ... And I think Complete Linux Installer does a good job helping me to setup a linux distribution on android device.<br />
<div>
<br /></div>
<div>
Nothing perfect thou. There are a few hiccup ... a few annoying issues which may or may not have a fix for it. Keep in mind, the app allow to have a full linux running on android by chroot to a linux image, and connect to it with vnc or ssh. There will be some issues that there is no solution for it (or there is but I don't know :p)</div>
<div>
<br /></div>
<h3>
Where is my eth0?</h3>
<div>
First hiccup after boot the system is this error message:</div>
<pre class="code">If connecting from a different mach ... android device use the address below:
eth0: error fetching interface information: Device not found</pre>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhEK5o-4JT2oOtFBy32uccw-kx7FuFz5wK-YYDPkpN4jhQBYsFIbuJ5oWEu1LGW66YF5pSM6lxOTLFvGT_eFE1mrb69MU7poyoJHVvYxhGo_sjNVdvAzv1f0DJqLXF_jZda6I4NEDe08Ac/s1600/Screenshot+-+04052014+-+10:37:42+PM.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhEK5o-4JT2oOtFBy32uccw-kx7FuFz5wK-YYDPkpN4jhQBYsFIbuJ5oWEu1LGW66YF5pSM6lxOTLFvGT_eFE1mrb69MU7poyoJHVvYxhGo_sjNVdvAzv1f0DJqLXF_jZda6I4NEDe08Ac/s1600/Screenshot+-+04052014+-+10:37:42+PM.png" height="164" width="320" /></a></div>
This is a simply the /root/init.sh expect the network interface to be "eth0". Unfortunately, that is not always true. To find out which interface you have, use "ifconfig". In my case, it is "wlan0".<br />
<br />
To fix this, simply edit /root/init.sh script. Change "eth0" to "wlan0", in my case, and you will be done.<br />
<br />
<br />
<br />
<br />
<div>
</div>
<h3>
How much disk space I have?, "df" issue</h3>
<div>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjAiuLuTM2V4z9YF338iBb_g4UwIl2s9BJ1fOjK9n0IUkqZrqzq1dC0TjBqrAOQUK5NJwnaNASjAA7FlzYPqoNeCmdBqLrDnRLy-PoLlyc47YF-5gFzEzO5aDSPGq6Rz8sZvOpclrhWJMA/s1600/Screenshot+-+04052014+-+10:46:48+PM.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjAiuLuTM2V4z9YF338iBb_g4UwIl2s9BJ1fOjK9n0IUkqZrqzq1dC0TjBqrAOQUK5NJwnaNASjAA7FlzYPqoNeCmdBqLrDnRLy-PoLlyc47YF-5gFzEzO5aDSPGq6Rz8sZvOpclrhWJMA/s1600/Screenshot+-+04052014+-+10:46:48+PM.png" /></a>This is quite annoy when simple command like "df" (diskfree) doesn't work at all. It's not report any thing. This is because the "df" command can not read file table which provide this information. Fortunately, there are easy solution for issue if all you want is to see how much disk space available.</div>
<div>
<br /></div>
<div>
By simply alias "df" to take which file system to report on, it's solve the problem. This time you edit /root/.bashrc script to add alias, as shown. This fix is only report disk space on "/" and "/sdcard", and it's not useful for other system tools which require to have device information.</div>
<div>
<br /></div>
<br />
<h3>
Where is my external sdcard?</h3>
<div>
Like me, you probably have external microsd card install with the system. Is the "/sdcard" refer to this external sdcard? ... No it's not. It's the internal sdcard that come with the prime tablet.</div>
<div>
<br /></div>
<div>
Sorry to say, I don't know the answer to this question because the external sd card is mount on "/Removable/SD" which can not be access in the chroot system. There might be a way to allow access to /Removeable/SD from the chroot system, but I do not know now. If you know, please comment below. :)</div>
<div>
<br /></div>
<h3>
Can I create normal account? What do I need to know?</h3>
<div>
Obviously, running the system as root is not a good idea. First thing, create a user using command</div>
<pre class="code">$ adduser new_user</pre>
<div>
<br />
What you need to do after that is adding the new_user to the following groups:
</div>
<div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3C7jJVn8HP2Q47Ak4K999WD-YHc20ws3miq7qTVFC1JYPNqM99ICgR28_CW0yvNAja0XcjFXFTTzEF9Rmk5I0A13XvX5u7-MPLnFHqP0CARei_GDY-wGsrmbZJ0VkZux7v7QQh9KnNuc/s1600/Screenshot+-+04052014+-+11:09:15+PM.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3C7jJVn8HP2Q47Ak4K999WD-YHc20ws3miq7qTVFC1JYPNqM99ICgR28_CW0yvNAja0XcjFXFTTzEF9Rmk5I0A13XvX5u7-MPLnFHqP0CARei_GDY-wGsrmbZJ0VkZux7v7QQh9KnNuc/s1600/Screenshot+-+04052014+-+11:09:15+PM.png" height="79" width="320" /></a></div>
This will allow new_user to use network and also access both read and write to internal sdcard.<br />
<br />
I also recommand to add new_user to group: sudo, users, ssh, and crontab if you plan to use it.<br />
<br />
However, it's still booting directly to root! Obviously, you can just type<br />
<br />
<pre class="code">$ su -l new_user</pre>
<div>
<br /></div>
And you will be right at home. However, it's an extra step to do after boot, which kinda annoying.<br />
However, we can do this automatically but edit "/root/init.sh" once again.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNlVDLH2sY9EGEhwZZ5zojNGlcxWMUkvUtbE-VFK-DnR2u17TlHKhC8YU96q6sVsV2MKLC3k0nzXDWqx8OX-pss6tQ6ticUr4p90zDw69JG5Smucb_BArKaeQAcjrTaQ1CmfsXorUw8xo/s1600/Screenshot+-+04052014+-+11:23:44+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNlVDLH2sY9EGEhwZZ5zojNGlcxWMUkvUtbE-VFK-DnR2u17TlHKhC8YU96q6sVsV2MKLC3k0nzXDWqx8OX-pss6tQ6ticUr4p90zDw69JG5Smucb_BArKaeQAcjrTaQ1CmfsXorUw8xo/s1600/Screenshot+-+04052014+-+11:23:44+PM.png" height="90" width="400" /></a></div>
<br />
The line "/bin/bash -i" is responsible for spwan a shell. We just has to replace that line with<br />
"/bin/su -l new_user" and the system will boot directly to the new_user.<br />
<br />
That's it! for today. See you next post ... which I will try to get more memory to the system by enabling swap image. :)</div>
<div>
<br /></div>
tawtaohttp://www.blogger.com/profile/17266883568788173890noreply@blogger.com0tag:blogger.com,1999:blog-2647826750462030032.post-88820238119940858682014-04-05T21:49:00.001-04:002014-04-05T23:37:37.359-04:00Using Linux on Android with Complete Linux Installater and debian testing-Large image.If you have android tablet/phone and you wish to use full linux on it. You are in luck. I am running one on Asus Transformer Prime. You need to root the device thou. You can find out how to root your device from xda-developers.com.<br />
<div>
<br /></div>
<div>
Here is going to be my experience with "Complete Linux Installater" app, which you can find it on the app store for free. There is also a donation version too, $3.50.</div>
<div>
<br /></div>
<div>
What I like about Compete Linux Installer, is simplicity, good guide line and various of distribution of linux you can choose from. </div>
<div>
<br /></div>
<div>
I start with debian testing (Jessie) small image. It's 2GB image file, and very easy to setup ... just follow the instruction and it will be done in second after long downloading and extracting of the image. There are a few hiccup that might consider annoying. I have fixed some of these "hiccup", and shared with you later.</div>
<div>
<br /></div>
<h3>
Setup with debian testing LARGE image file:</h3>
<div>
Get back to my major issue. Since 2GB is too small after I try to get some serious work on it, I try debian testing LARGE image. This time it's not that simple any more. I find couple major issues with it.<br />
<br /></div>
<h4>
<b>Get The Right File:</b></h4>
<div>
First of all, the zip large image that I download by follow the app is damaged and can not be extract. I try different mirrors, always get the same result. So I googling and find this </div>
<div>
<br />
<a href="http://sourceforge.net/projects/linuxonandroid/files/Debian/Testing/Large/">http://sourceforge.net/projects/linuxonandroid/files/Debian/Testing/Large/</a></div>
<div>
<br /></div>
<div>
which you can directly download. Notice that there are couple of images you can download from,</div>
<div>
debian-testing, debian-8.LARGE.ext2 and debian-8.LARGE.ext4 ... The question is which one?</div>
<div>
<br /></div>
<div>
If you follow the app, it will download debian-8.LARGE.ext2 file, which about 500MB. This is the damage one. Since debian-8.LARGE.ext4 is about the same size, it's also damage one. The one that you have to download is</div>
<div>
<br /></div>
<div>
debian-testing.LARGE.ext4 (1.0GB) file.</div>
<div>
<br /></div>
<h4>
<b>Change the Script:</b></h4>
<div>
After a long wait for downloading and extracting, I expecting this image should work like a charm! ... Unfortunately, the bootscript is expecting the file system to be ext2, not ext4. This can be solved pretty easily by changing the bootscript. The bootscript.sh is located here:</div>
<pre class="code"><strong>/data/data/com.zpwebsites.linuxonandroid/files/bootscript.sh
</strong></pre>
Use any editor you like, obviously :) ... and looking for the word "ext2", and the line is look some thing like this:<br />
<pre class="code"><strong>$bbox mount -t ext2 /dev/block/loop255 $mnt</strong></pre>
<b>$bbox</b> is refer to "busybox" which the app provided. You can change to the one that you like, but I won't recommend. <b>$mnt</b> is the mount point, which is <b>/data/local/mnt</b>.
Since the large image that I download is using ext4, I would have to change "ext2" to "ext4". The line become:
<br />
<pre class="code"><strong>$bbox mount -t ext4 /dev/block/loop255 $mnt</strong></pre>
<br />
At this point you should be about to boot up the debian testing LARGE image with ext4 file system, and enjoy 3.5gb space!<br />
<br />
<a href="http://www.tawtao.com/2014/04/linux-on-android-using-complete-linux.html">Next post</a>, I am going to talk about hiccup that annoyance me and how I fix it.tawtaohttp://www.blogger.com/profile/17266883568788173890noreply@blogger.com0tag:blogger.com,1999:blog-2647826750462030032.post-53810108004037472502013-02-16T01:48:00.000-05:002013-02-16T01:55:48.086-05:00Mortgage Biweekly Option, the true.<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhrnfTcLxuLuWs644nHtEZ6Lu5GSLiuRo5Z3I8ZoFNatx8dZS2H6CijPo6lVvD-xyg57lU0Dpz4m-47s7F8zLeCJygwl_GnYqVxzLa3voSylycwq3CuNoDHHY0qpUAMNrPKbJ5gT6jxmBc/s1600/money.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="133" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhrnfTcLxuLuWs644nHtEZ6Lu5GSLiuRo5Z3I8ZoFNatx8dZS2H6CijPo6lVvD-xyg57lU0Dpz4m-47s7F8zLeCJygwl_GnYqVxzLa3voSylycwq3CuNoDHHY0qpUAMNrPKbJ5gT6jxmBc/s200/money.jpg" width="200" /></a>Couple weeks ago, a little landed on my inbox. It's about "Biweekly Option" payment for mortgage.<br />
Essentially say, if I setup a smaller biweekly payment (half of the monthly payment), I will reduce my loan term from 30 year to about 23.9 years. Therefore, I will save money on interest!<br />
<br />
Ding! ... save money ... shoter team loan ... wow all good stuff! :D<br />
<br />
So I called the number that they give me on the letter ...<br />
<br />
Wait a minute, this is not my lender ... it's another financial instrution. What is going on here?<br />
So I drop the call right away, and then start googling to find out how the "Biweekly Option" really work ... or worthwhile!<br />
<br />
In short: <b>No</b>.<br />
Long answer: it's depend, if you really want to pay off your mortgage early ... ya do it! <b>BUT</b> <u><i><b>do it yourself</b></i></u>. You <b>don't need </b>the service offer in the letter.<br />
<br />
<a href="http://www.fivecentnickel.com/2008/04/22/are-bi-weekly-mortgage-payment-programs-a-scam/">Here</a> is where I findout about this Biweekly option ... the true!<br />
<br />
Just in case, if you wonder. I did call my lender, and they don't offer option to pay biweekly. They just say "No".tawtaohttp://www.blogger.com/profile/17266883568788173890noreply@blogger.com0tag:blogger.com,1999:blog-2647826750462030032.post-20092279148224365122012-10-28T09:54:00.002-04:002012-10-28T14:44:55.554-04:00Luminance HDR - A Linux HDR tool that I can actually use.<div style="text-align: center;">
About a year ago, I came across <a href="http://qtpfsgui.sourceforge.net/"><b>Luminance HDR</b></a> during a search<br />
for linux HDR tools. I wasn't so impressed back then.<br />
<br /></div>
<div>
<div>
<div style="text-align: center;">
Now, after try Luminace HDR again, I was stunned by the result I get. </div>
<div style="text-align: center;">
And Yes, I find a Linux HDR tool that I can actually use! </div>
</div>
<div>
<div style="text-align: center;">
<br /></div>
<div style="text-align: center;">
I took these pictures at <a href="http://www.myfranciscan.org/">Franciscan Monastery</a>, a lost gem in DC.<br />
You will find original photos at the end of the post.</div>
<div style="text-align: center;">
<br /></div>
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDOEFFFUU3o5BywrGEYGt_WgnC6XQkIv9PcJT5mhajhWfXCViosCqxP9mlbI7pYjOfFvsMOSwJ6jF4089I41r8VEmH9O9MprTVXeDnnN9pbZ38mkLuG20NqckKkbJ32T8m0AXm3qE_5xs/s1600/untitled_pregamma_1_mantiuk06_contrast_mapping_0.1_saturation_factor_0.8_detail_factor_5.9-001.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDOEFFFUU3o5BywrGEYGt_WgnC6XQkIv9PcJT5mhajhWfXCViosCqxP9mlbI7pYjOfFvsMOSwJ6jF4089I41r8VEmH9O9MprTVXeDnnN9pbZ38mkLuG20NqckKkbJ32T8m0AXm3qE_5xs/s640/untitled_pregamma_1_mantiuk06_contrast_mapping_0.1_saturation_factor_0.8_detail_factor_5.9-001.jpg" width="426" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgq0SGYxtB0EDibicZcr7xgYN1jsVpxFXJiXDLerJFbaAJvdd9VdLb8kUqkad3SwvRztZZFSeAv2J2JcYTzk_zqwhbS7xay26192WXu9d0KnrQy-OuvHiOYN4FgJbQNMJLtEMVioAhBpeE/s1600/img0307-09_pregamma_1_mantiuk08_auto_luminancecolorsaturation_1_contrastenhancement_1.75.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgq0SGYxtB0EDibicZcr7xgYN1jsVpxFXJiXDLerJFbaAJvdd9VdLb8kUqkad3SwvRztZZFSeAv2J2JcYTzk_zqwhbS7xay26192WXu9d0KnrQy-OuvHiOYN4FgJbQNMJLtEMVioAhBpeE/s640/img0307-09_pregamma_1_mantiuk08_auto_luminancecolorsaturation_1_contrastenhancement_1.75.jpg" width="424" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<a name='more'></a><div style="text-align: center;">
<br />
<b>The original pictures</b></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYGjOPuZlG7N3oFzn7DA9emxg-NaBlIa2pa7Kr8POuo_OGnBBfvxnoqq7IIi0m8IdJt0A2HrL_k8cQ0Bvan_taG8h1MHKZUHwHCE6TwXnhATiPTEfhYQExKeNtkg1SkL1hy5mRkNNDnU4/s1600/IMG_0408.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYGjOPuZlG7N3oFzn7DA9emxg-NaBlIa2pa7Kr8POuo_OGnBBfvxnoqq7IIi0m8IdJt0A2HrL_k8cQ0Bvan_taG8h1MHKZUHwHCE6TwXnhATiPTEfhYQExKeNtkg1SkL1hy5mRkNNDnU4/s200/IMG_0408.jpg" width="132" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibg_jO4E6SX8A7Mg55lt0IuxuB2YAQm8sIWsWhLqjijJ6jQS36Ng2ddMVDGaw7dvWAH6N9_tdV_TcTFzo5p073XZ56E7xaq7hBGNXEAPGj84D5ftCCqRqttoH56GouAEiTxW_lIFMf8Yk/s1600/IMG_0409.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibg_jO4E6SX8A7Mg55lt0IuxuB2YAQm8sIWsWhLqjijJ6jQS36Ng2ddMVDGaw7dvWAH6N9_tdV_TcTFzo5p073XZ56E7xaq7hBGNXEAPGj84D5ftCCqRqttoH56GouAEiTxW_lIFMf8Yk/s200/IMG_0409.jpg" width="132" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgC_MlzwDXyzdgmYl5DiMxyqEZu-I1TuZsjoTN4iGwsPnZdqkOtLrBeKl46E761JyAtsx9EwUA4l8LsWYddW6D-cf_1z7ih_vtDDG5OQDx6jfh6ZMS6bT0dahvkExMiogRAXFO9768absw/s1600/IMG_0410.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgC_MlzwDXyzdgmYl5DiMxyqEZu-I1TuZsjoTN4iGwsPnZdqkOtLrBeKl46E761JyAtsx9EwUA4l8LsWYddW6D-cf_1z7ih_vtDDG5OQDx6jfh6ZMS6bT0dahvkExMiogRAXFO9768absw/s200/IMG_0410.jpg" width="132" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpOuvsmCnj9MB8ocKNniYd14OCOSxnwD20TQcqZQ38tGVCkNe69PXfn87WirisdOikLzqlQ6U1YWBKlXlsM_dNkBuQ0xxP1ajI6_WCY_40yLU78eps452_keN-c29_M0duza2NJfBGhMQ/s1600/IMG_0307-001.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpOuvsmCnj9MB8ocKNniYd14OCOSxnwD20TQcqZQ38tGVCkNe69PXfn87WirisdOikLzqlQ6U1YWBKlXlsM_dNkBuQ0xxP1ajI6_WCY_40yLU78eps452_keN-c29_M0duza2NJfBGhMQ/s200/IMG_0307-001.jpg" width="133" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhpz_7jD4whce5pOnWtx4PvfIQ_9iY9Thwyn4Y6eBMisfylLCcqUrOUrk-vRSI3IrxFmOfQbg9ulcwaZLR46Yr5Hjdm4mEl4IsFZzfvzqeD22HGvLl5xmJ7jcCZ00WUH_mqws_nAQagy9o/s1600/IMG_0308-001.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhpz_7jD4whce5pOnWtx4PvfIQ_9iY9Thwyn4Y6eBMisfylLCcqUrOUrk-vRSI3IrxFmOfQbg9ulcwaZLR46Yr5Hjdm4mEl4IsFZzfvzqeD22HGvLl5xmJ7jcCZ00WUH_mqws_nAQagy9o/s200/IMG_0308-001.jpg" width="133" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj20VCz53Y816hDqfbYG1SXHiPZh1ftO4k1Vem2aebD3PKwzzO1Yqrju_PZ51LmMJ1b9AA8sDUMkCWMZrxgkvBY5cWVIhZ_TZb0A_mZEuz0uEXiDZU-dFZEgFn2mYdSrHLuqAKrE4voEvQ/s1600/IMG_0309-001.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj20VCz53Y816hDqfbYG1SXHiPZh1ftO4k1Vem2aebD3PKwzzO1Yqrju_PZ51LmMJ1b9AA8sDUMkCWMZrxgkvBY5cWVIhZ_TZb0A_mZEuz0uEXiDZU-dFZEgFn2mYdSrHLuqAKrE4voEvQ/s200/IMG_0309-001.jpg" width="133" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
</div>
tawtaohttp://www.blogger.com/profile/17266883568788173890noreply@blogger.com0tag:blogger.com,1999:blog-2647826750462030032.post-40229364237798138652012-10-23T21:43:00.001-04:002012-10-23T21:53:46.328-04:00Dead Center Photography<div style="text-align: center;">
Inspired by this group:</div>
<div style="text-align: center;">
<a href="http://www.facebook.com/groups/295457230558311/295499733887394/?comment_id=295620357208665&notif_t=group_comment">The Dead Center C</a></div>
<div style="text-align: center;">
<br /></div>
<div style="text-align: center;">
Another look, another perspective!</div>
<div style="text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvV1FRB7RbRs_ZmDV9CNlJP6FDaJlbvtBBCfRY0Xtnv90rz5lpwDynhPLc8gTvMmLdQtf-lFdgzn1St1aTFzDU_NOZnFfzc3dSzp1h8ns02Ok_uM9NkAJjeWtBeTKTripM4w3hJYAH88Q/s1600/IMG_0109.CR2.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvV1FRB7RbRs_ZmDV9CNlJP6FDaJlbvtBBCfRY0Xtnv90rz5lpwDynhPLc8gTvMmLdQtf-lFdgzn1St1aTFzDU_NOZnFfzc3dSzp1h8ns02Ok_uM9NkAJjeWtBeTKTripM4w3hJYAH88Q/s400/IMG_0109.CR2.jpg" width="400" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRmJSH7rHlnIyoUCJo5eUNLuER2mPSTAyJpPugt-cYjNdGOjyNFUujGCEyNVhNtezGDt9FNzWF7nU1QSr2mlT7YkK0L7hcRQ5Vz8bmXa74LgTkK-gwtrONwkT1Un0VyeOvd5SWC4GdqWc/s1600/IMG_6026.CR2-001.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRmJSH7rHlnIyoUCJo5eUNLuER2mPSTAyJpPugt-cYjNdGOjyNFUujGCEyNVhNtezGDt9FNzWF7nU1QSr2mlT7YkK0L7hcRQ5Vz8bmXa74LgTkK-gwtrONwkT1Un0VyeOvd5SWC4GdqWc/s400/IMG_6026.CR2-001.jpg" width="398" /></a> </div>
<br />
<a name='more'></a><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8HDfxADZEMSgVnnX8zzuSQ0PqXa3z3CdFY4NUS0ZaAHAWSDXYxAJTOu0WslJd2HJ1oMXebGVSnF2_bhpF2YdeyxrwzrQNh5SllwfJ1kfEII4cg3FIvCF5931FDq22luiVEjKd3nIIR1k/s1600/IMG_9299_300_301_tonemapped.tif.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8HDfxADZEMSgVnnX8zzuSQ0PqXa3z3CdFY4NUS0ZaAHAWSDXYxAJTOu0WslJd2HJ1oMXebGVSnF2_bhpF2YdeyxrwzrQNh5SllwfJ1kfEII4cg3FIvCF5931FDq22luiVEjKd3nIIR1k/s400/IMG_9299_300_301_tonemapped.tif.jpg" width="398" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjkywwn8k5DY2KuPFrbrDlBP6xHaIQwZBwNGZL2CpoW3n-diZzQ_fZJZJs7r_-GhbiEmC34bQHboifg5eS0SvhI1FjoWAS-9fx_GCWQ-M4IP-rT35OKIks4kmyFAk-J4i2kCB-qpbtViZs/s1600/IMG_9237.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="425" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjkywwn8k5DY2KuPFrbrDlBP6xHaIQwZBwNGZL2CpoW3n-diZzQ_fZJZJs7r_-GhbiEmC34bQHboifg5eS0SvhI1FjoWAS-9fx_GCWQ-M4IP-rT35OKIks4kmyFAk-J4i2kCB-qpbtViZs/s640/IMG_9237.jpg" width="640" /></a></div>
<div style="text-align: center;">
<br /></div>
tawtaohttp://www.blogger.com/profile/17266883568788173890noreply@blogger.com0tag:blogger.com,1999:blog-2647826750462030032.post-56143289387791920712012-10-18T23:13:00.001-04:002012-10-19T09:04:34.773-04:00Canon 5D Mark II vs Mark III<a href="http://2.bp.blogspot.com/-pNjojhY4Fl4/UIDKFtVIDGI/AAAAAAAAErg/rm_oxiyNWwo/s1600/300px-Canon_EOS_5D.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="166" src="http://2.bp.blogspot.com/-pNjojhY4Fl4/UIDKFtVIDGI/AAAAAAAAErg/rm_oxiyNWwo/s200/300px-Canon_EOS_5D.jpg" width="200" /></a>First of all, I have to admit that I do not have neither 5D Mark II or Mark III. But I do own a Canon 5D thou. It was a little surprise for me when I heart about Mark III because I was still thinking about upgrade to Mark II.<br />
<div>
<br /></div>
<div>
Don't get me wrong, I love my 5D and I don't need the video features. That why I am still thinking about upgrade to Mark II (and never did). Should I upgrade to Mark III then? or Should I just save some money by upgrade to Mark II? ... Here what I found out:</div>
<div>
<br /></div>
<div>
You can find full spec and full review of Mark II <a href="http://www.dpreview.com/products/canon/slrs/canon_eos5dmkii">here</a> and Mark III <a href="http://www.dpreview.com/products/canon/slrs/canon_eos5dmkiii">here</a>.</div>
<br />
<center>
<table border="1px" style="border-collapse: collapse; width: 95%;">
<tbody>
<tr bgcolor="#BBBBBB">
<td></td>
<td><b>5D</b></td>
<td><b>Mark II</b></td>
<td><b>Mark III</b></td>
</tr>
<tr>
<td>Price</td>
<td> discontinue</td>
<td>1,799</td>
<td>3,459</td>
</tr>
<tr>
<td>year</td>
<td>Aug 2005</td>
<td>Sept 2008</td>
<td>Mar 2012</td>
</tr>
<tr bgcolor="#DDDDDD">
<td colspan="4">Photography Features</td>
</tr>
<tr>
<td>LCD Size</td>
<td>2.5"</td>
<td>3.0"</td>
<td>3.2"</td>
</tr>
<tr>
<td>Max Resolution</td>
<td>4368x2912</td>
<td>5616x3744</td>
<td>5760x3940</td>
</tr>
<tr>
<td>(megapixels)</td>
<td>12.7</td>
<td>21.2</td>
<td>22.3</td>
</tr>
<tr>
<td>Processor</td>
<td>Digic II</td>
<td>Digic 4</td>
<td>Digic 5</td>
</tr>
<tr>
<td>ISO (Auto)</td>
<td>100-1600 in 1/3 stops</td>
<td>100-6400 in 1/3 stops</td>
<td>100-25600 in 1/3 stops</td>
</tr>
<tr>
<td>(manual)</td>
<td>50, 3200</td>
<td>50, 12800 and 51200</td>
<td>50, 51200 and 102400</td>
</tr>
<tr>
<td>Auto focus points</td>
<td>9</td>
<td>9</td>
<td>61</td>
</tr>
<tr>
<td>Viewfinder Coverage</td>
<td>96%</td>
<td>98%</td>
<td>100%</td>
</tr>
<tr>
<td>Continuous Drive</td>
<td>3 fps (60 JPEG, 17 RAW)</td>
<td>3.9 fps (78 JPEG, 13 RAW)</td>
<td>6 fps</td>
</tr>
<tr>
<td>Exposure Compensation</td>
<td>±2 EV (at 1/3 EV, 1/2 EV steps)</td>
<td>±2 EV (at 1/3 EV, 1/2 EV steps)</td>
<td>±5 EV (at 1/3 EV, 1/2 EV steps)</td>
</tr>
<tr>
<td>AE Bracketing</td>
<td>±2 (3 frames at 1/3 EV, 1/2 EV steps)</td>
<td>±2 (3 frames at 1/3 EV, 1/2 EV steps)</td>
<td bgcolor="#EEEEEE">±3 (2, 3, 5, 7 frames at 1/3 EV, 1/2 EV steps)</td>
</tr>
<tr>
<td>Muli-exposure</td>
<td>no</td>
<td>no</td>
<td bgcolor="#EEEEEE">up to 9 exposures</td>
</tr>
<tr>
<td>HDR in cameras</td>
<td>no</td>
<td>no</td>
<td bgcolor="#EEEEEE">5 options</td>
</tr>
<tr>
<td>Horizon level</td>
<td>no</td>
<td>no</td>
<td>dual axis leveling</td>
</tr>
<tr>
<td>Weight</td>
<td>895g</td>
<td bgcolor="#EEEEEE">850g</td>
<td>950g</td>
</tr>
<tr>
<td>Memory Card</td>
<td>1 CF</td>
<td>1 CF</td>
<td bgcolor="#EEEEEE">1 CF and 1 SD</td>
</tr>
<tr bgcolor="#DDDDDD">
<td colspan="4">Video Features</td>
</tr>
<tr>
<td>1080</td>
<td>n/a</td>
<td>yes</td>
<td>yes</td>
</tr>
<tr>
<td>720</td>
<td>n/a</td>
<td>no</td>
<td>60,50</td>
</tr>
<tr>
<td>640</td>
<td>n/a</td>
<td>30,25</td>
<td>30,25</td>
</tr>
<tr>
<td>Longest clip</td>
<td>n/a</td>
<td>12 mins (approx)</td>
<td>30 mins</td>
</tr>
<tr>
<td>Microphone/
Headphone Jack</td>
<td>n/a</td>
<td>mono/no</td>
<td>mono/yes</td>
</tr>
<tr>
<td>Audio level ctrl</td>
<td>n/a</td>
<td>yes (pre recording)</td>
<td>yes (while recording)</td>
</tr>
<tr>
<td>Aperture control in video</td>
<td>n/a</td>
<td>no</td>
<td>yes</td>
</tr>
<tr>
<td>Histogram in video</td>
<td>n/a</td>
<td>no</td>
<td>yes</td>
</tr>
<tr>
<td>Chromatic Aberration fix</td>
<td>n/a</td>
<td>no</td>
<td>yes</td>
</tr>
<tr>
<td>Time code support</td>
<td>n/a</td>
<td>no</td>
<td>yes</td>
</tr>
</tbody></table>
</center>
<br />
Overall, Mark III is an improvement over Mark II in the photography featrues, little bit bigger censor, faster processor, wider range ISO, more auto focus points, two memory cards, etc. Mark III is greatly improve on HDR support, such as, HDR in cameras, AE Bracketing and Multi-exposure, and 6 fps would help to get better HDR pictures. For me, I wish to have 5 or 7 frame AE Bracketing for quite some time.<br />
<br />
Beside HDR, I would say, other improved features are nice the have. It's won't convince me to pay almost double to get Mark III.<br />
<br />
Obviously the different between Mark II and Mark III is in video features. I don't know much about it but I can see that Mark III is greatly improve over Mark II. If the video features are important to you, then you should consider Mark III.<br />
<br />
On the other hand, if you are looking for your first canon full frame camera, spend some time looking at Mark II, specially at this price. It is a great photography tools and it is must better than 5D. It come with video features that you can explore. If I am not mistake, Mark II is very successful in this area too.<br />
<br />
For me, I already have 5D. I am still happy with it and I don't really need video features. So I probably wait and see how Mark IV is going to look like.tawtaohttp://www.blogger.com/profile/17266883568788173890noreply@blogger.com0tag:blogger.com,1999:blog-2647826750462030032.post-55515308753894086332012-10-15T00:00:00.000-04:002012-10-15T00:45:32.786-04:00Light & Lamp<div style="text-align: center;">
Hope you like it!</div>
<div style="text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggvvFq28mU6JkSK_RQUbyHjvu7_zqDktx3tJIMAfnuYeoYe9rV-2G4QRnaGkMi4y4XO9cUSu1pkSoXxkZLpLwe_Rp2aPkxOkUTbxu49IPKqiN5XuZXcW3yP8z4gy6FSzui9wxFeJOW6-A/s1600/IMG_0819.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em; text-align: center;"><img border="0" height="426" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggvvFq28mU6JkSK_RQUbyHjvu7_zqDktx3tJIMAfnuYeoYe9rV-2G4QRnaGkMi4y4XO9cUSu1pkSoXxkZLpLwe_Rp2aPkxOkUTbxu49IPKqiN5XuZXcW3yP8z4gy6FSzui9wxFeJOW6-A/s640/IMG_0819.jpg" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgr1aBb4gCUOjjHYF2pxLku3re_RUHqVRqvmIvBzWaqSNGdFuRlSucos9f3Mann6euGfo0hMTGPyxkSj52pKqh-KCP3gCeEUi3ISmsNh86AahH04Y7vfRGR9xZAEjWHXVrkR1_3RPvnxUg/s1600/IMG_0472.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgr1aBb4gCUOjjHYF2pxLku3re_RUHqVRqvmIvBzWaqSNGdFuRlSucos9f3Mann6euGfo0hMTGPyxkSj52pKqh-KCP3gCeEUi3ISmsNh86AahH04Y7vfRGR9xZAEjWHXVrkR1_3RPvnxUg/s640/IMG_0472.JPG" width="426" /></a></div>
<br />
<a name='more'></a><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgrFB9exHXtF8Y7gobpnjSqoIWr7iQLX0HlHeJJQIv7oaCGmxG3meukcK2SXLEUNr3O42fLvu7V5fYJqJ77QTPIUB_6EPzdMt8bnTRzU7OipKe1i07mT3TxcBW0c2IM6XSF6O1fUm8dMbU/s1600/IMG_0147.CR2.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgrFB9exHXtF8Y7gobpnjSqoIWr7iQLX0HlHeJJQIv7oaCGmxG3meukcK2SXLEUNr3O42fLvu7V5fYJqJ77QTPIUB_6EPzdMt8bnTRzU7OipKe1i07mT3TxcBW0c2IM6XSF6O1fUm8dMbU/s640/IMG_0147.CR2.jpg" width="426" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijoPB89qhzDteY6aw_IFMTtF19Ci_bz3r6jdxfLPIuuw1xE_W4oYCyd4q26TX80wVzLrLVmwfdMIv9IBUrzpA6wFe91-eJG9_MNU9pVqv2CQNR7BfcoW8IhmxeFGKHEH-4CovyZaKISFI/s1600/6753052413_ec845d7c2b_b.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="426" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijoPB89qhzDteY6aw_IFMTtF19Ci_bz3r6jdxfLPIuuw1xE_W4oYCyd4q26TX80wVzLrLVmwfdMIv9IBUrzpA6wFe91-eJG9_MNU9pVqv2CQNR7BfcoW8IhmxeFGKHEH-4CovyZaKISFI/s640/6753052413_ec845d7c2b_b.jpg" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div style="text-align: center;">
<br /></div>
tawtaohttp://www.blogger.com/profile/17266883568788173890noreply@blogger.com1tag:blogger.com,1999:blog-2647826750462030032.post-87857089304896349002012-10-14T00:07:00.001-04:002012-10-24T09:01:46.778-04:00Setup Keyboard Layout for OpenBox<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhGrNKnHcNcWh-ORjSrkHVkkpQJqjhxqFDWKVamxvRh353yt49FNLRUMoBZAdyZKVgL-0kpD_GrcWoQlURh3l31Nl-QOc-e6jTOzn3JwJZi1K7uqAxDRycJAz1esYSUr79JkWGTYUvLCw/s1600/xxkb.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhGrNKnHcNcWh-ORjSrkHVkkpQJqjhxqFDWKVamxvRh353yt49FNLRUMoBZAdyZKVgL-0kpD_GrcWoQlURh3l31Nl-QOc-e6jTOzn3JwJZi1K7uqAxDRycJAz1esYSUr79JkWGTYUvLCw/s1600/xxkb.png" /></a>OpenBox doesn't have a keyboard layout setup program to assist you, as ubuntu or window does. However it is not that difficult to do it yourself. There are two things that you need to do: add new keyboard layout and show what current layout you are using. The easiest way to setup US and Thai keyboard layout for OpenBox is to add this two commands into you OpenBox autostart file, locale at: <span style="font-family: Courier New, Courier, monospace;"><b>~/.config/openbox/autostart</b></span><br />
<br />
<pre class="code"><strong>## enable thai keyboard
setxkbmap -layout us,th -option grp:toggle
xxkb &
</strong></pre>
The command <b><span style="font-family: Courier New, Courier, monospace;">setxkbmap</span></b> is setting layout to US(<span style="font-family: Courier New, Courier, monospace;"><b>us</b></span>) as the first layout and Thai (<span style="font-family: Courier New, Courier, monospace;"><b>th</b></span>) as second. I choose <i><b>right-alt</b></i> key to switch the layout by using option '<span style="font-family: Courier New, Courier, monospace;"><b>grp:toggle</b></span>'. Learn more about other layouts or options, look at the file '<b><span style="font-family: Courier New, Courier, monospace;">/usr/share/X11/xkb/rules/base.lst</span></b>'. You might want to read resources I listed at the end of the post too.<br />
<br />
The second command <b><span style="font-family: Courier New, Courier, monospace;">xxkb</span></b> will give you a layout switcher and indicator on your panel. Make sure you have the "<b><span style="font-family: Courier New, Courier, monospace;">&</span></b>" at the end of the line, otherwise the autostart won't finished. The <b><span style="font-family: Courier New, Courier, monospace;">xxkb</span></b> need a config file '<b><span style="font-family: Courier New, Courier, monospace;">.xxkbrc</span></b>' in your home directory. Here is mine:<br />
<a name='more'></a><br />
<pre class="code"><strong>XXkb.mainwindow.enable: yes
XXkb.mainwindow.appicon: yes
XXkb.mainwindow.type: tray
XXkb.mainwindow.in_tray: yes
XXkb.mainwindow.geometry: 16x16+0+0
XXkb.mainwindow.label.enable: yes
XXkb.mainwindow.label.text.1: us
XXkb.mainwindow.label.text.2: th
XXkb.mainwindow.label.background: black
XXkb.mainwindow.label.foreground: white
XXkb.mainwindow.label.font: -misc-*-r-*-14-*
XXkb.controls.two_state: no
XXkb.group.alt: 2
XXkb.group.base: 1
XXkb.button.enable: no
XXkb.bell.enable: no
</strong></pre>
Certainly, I do not know all the options for the <span style="font-family: Courier New, Courier, monospace;"><b>.xxkbrc</b></span>, but at least I need to match the <b><span style="font-family: Courier New, Courier, monospace;">*.label.text.1</span></b> to <b><span style="font-family: Courier New, Courier, monospace;">us</span></b>, and <b><span style="font-family: Courier New, Courier, monospace;">*.label.text.2</span></b> to <b><span style="font-family: Courier New, Courier, monospace;">th</span></b>. It's the order of layout that I set in <b><span style="font-family: Courier New, Courier, monospace;">setxkbmap</span></b>. If you prefer graphic, instead of text, read [1]. Surely, you can play around with foreground, background, and font.<br />
<br />
This setup will give you a user level setup. It's won't stay around when you logout of your acccount. To do system-wise setup, you need to twist your X-window configuration files, and I won't get into that in this post.<br />
<br />
Here some resources that I fine helpful. Thanks for reading :)<br />
<br />
[1] <a href="http://crunchbanglinux.org/forums/topic/12727/keyboard-layout-switcher-and-indicator-for-usqwertyusdvorak/">http://crunchbanglinux.org/forums/topic/12727/keyboard-layout-switcher-and-indicator-for-usqwertyusdvorak/</a><br />
[2] <a href="http://forums.freebsd.org/showthread.php?s=a893694385754994b12f193e01a5af91&t=10500">http://forums.freebsd.org/showthread.php?s=a893694385754994b12f193e01a5af91&t=10500</a><br />
[3] <a href="http://forums.freebsd.org/showthread.php?t=25506">http://forums.freebsd.org/showthread.php?t=25506</a><br />
[4] <a href="http://betabug.ch/blogs/ch-athens/1242">http://betabug.ch/blogs/ch-athens/1242</a>tawtaohttp://www.blogger.com/profile/17266883568788173890noreply@blogger.com0tag:blogger.com,1999:blog-2647826750462030032.post-69564212230066193352012-10-13T03:23:00.001-04:002012-10-13T03:41:06.155-04:00Observer Pattern In RubyLet add one more pattern into the <a href="http://www.tawtao.com/search/label/design%20pattern"><b>design pattern series</b></a> by consider <a href="http://en.wikipedia.org/wiki/Observer_pattern"><b>Observer pattern</b></a>. In observer pattern, there is a subject which will be observed by multiple observers. When an event happen with the subject, all observers who registered with the subject will get notify. One obvious example of this pattern is you and my blog. If you are subscribed to my blog, you will get notify when my blogs get updated. This relation between subject and observers provide a clear pattern. It's clear enough to be implemented as a module in ruby standard library, called <a href="http://www.ruby-doc.org/stdlib-1.9.3/libdoc/observer/rdoc/Observable.html"><b>Observable</b></a>.<br />
<br />
<div>
In this post, I am going to use this observable module to implement a program that allow me follow stocks prices, and also calculate the average over time.<br />
<br />
Assume that the stock market allow me to read current stock price with a function call "<b><span style="font-family: Courier New, Courier, monospace;">get_current_price(stock_symbol)</span></b>". With this method, I can implement a simple class, SimpleStockWatcher, to read the current price and calculate the average as follow:</div>
<pre style="border: 1px solid black; padding-left: 5px;"><strong>class SimpleStockWatcher
def initialize(symbol)
@symbol = symbol
@sum = 0
@count = 0
end
def update
price = get_current_price(@symbol)
@sum += price
@count += 1
show(price)
end
def show(price)
puts "Symbol #{@symbol}"
puts " Time: #{Time.now}"
puts " Current Price: #{price}"
puts " Average: #{@sum/@count}"
end
end
</strong></pre>
If I want to monitor Bank of America (BOA), and Google (GOOG), I implement the following loop:<br />
<pre style="border: 1px solid black; padding-left: 5px;"><strong>stocks = [ SimpleStockWatcher("BOA"), SimpleStockWatcher("GOOG") ]
loop do
stocks.each(&:update)
sleep(1)
end
</strong></pre>
This loop will print the stocks price and average very second.<br />
<br />
Now, I want to add more analysis, say 30 or 100 days moving average. No problem, I add more code into the SimpleStockWatcher. Then every second we get the stock prices, average, 30-day moving average, and 100-days moving average.<br />
<br />
Let get a bit more complicate, I want to show only current price and 30-days moving average for stock "BOA". For "GOOG", I want to show current price, the average, and 100-days moving average. How do I satisfy this requirement?<br />
<br />
<a name='more'></a><br />
Look carefully, StockWatcher is doing two things. One is get current price for symbols. For any stock, StockWatcher does this in the same way. Another part of StockWatcher is doing different analysis on the price. This part is different from stock to stock. So the analysis are parts of StockWatcher need to be able to <b>change</b>. If you follow my <a href="http://www.tawtao.com/search/label/strategy"><b>previous posts</b></a>, you know we need to separate the analysis parts from StockWatcher. In this case, I separate the analysis parts into CurrentPriceAnalyzer, AverageAnalyzer, MovingAverageAnalyzer, etc. Each analyzer is responsible for only one analysis.<br />
<br />
However, <b><i>there is a specific relation between the StockWatcher and these analyzer objects</i></b>. Basically, when the stock price change, the StockWatcher will notify any analyzers. Here, where the observer pattern come in. The pattern is already implemented as a module within ruby standard library, called <a href="http://www.ruby-doc.org/stdlib-1.9.3/libdoc/observer/rdoc/Observable.html" style="font-weight: bold;">Obervable</a>, and I am going to use it to implement a solution to this problem.<br />
<br />
Now, StockWatcher has only responsibility to get the stock price and notify the analyzers if the price change. Most of the implementation is taking care of by including the Observable Module:<br />
<pre style="border: 1px solid black; padding-left: 5px;"><strong>require "observer"
class StockWatcher
include Observable
def initialize(symbol)
@symbol = symbol
@price = 0.0
end
def update
read_current_price
notify_observers(Time.now, @symbol, @price)
end
def read_current_price
next_price = get_current_price(@symbol)
if @price != next_price
changed
@price = next_price
end
end
end
</strong></pre>
<br />
Observable Module provides methods <span style="font-family: Courier New, Courier, monospace;"><b>changed</b></span> and <span style="font-family: Courier New, Courier, monospace;"><b>notify_observers</b></span> which used in the StockWatcher. The changed method need to be called when the price change. This will set an internal stage and allow the notify_observers to send notification to registered observers.<br />
<br />
The notify_observers pass it arguments to the observers when the notification happen. The observers have to implement a method that receive the same list of argument. For example, the CurrentPrinceAnalyzer implement <span style="font-family: Courier New, Courier, monospace;"><b>update</b></span> method to receive the notification from StockWatcher, as shown:<br />
<pre style="border: 1px solid black; padding-left: 5px;"><strong>class CurrentPriceAnalyzer
def update(time, symbol, price)
puts "#{time} #{symbol}: price #{price}"
end
end
</strong></pre>
And that all it need for CurrentPriceAnalyzer. It's only show the current price.<br />
<br />
On the other hard, the AveragePriceAnalyzer need to do a little bit more:<br />
<pre style="border: 1px solid black; padding-left: 5px;"><strong>class AveragePriceAnalyzer
def initialize
@sum = 0.0
@count = 0
end
def average
@sum/@count
end
def show(time, symbol)
puts "#{time} #{symbol}: average #{average}"
end
def update(time, symbol, price)
@sum += price
@count += 1
show(time, symbol)
end
end
</strong></pre>
It's keep the sum and count how many time it's get notify, and calculate average from these internal stage.<br />
<br />
Finally I can implement the loop to get update stock price, and do analysis, as follow:<br />
<pre style="border: 1px solid black; padding-left: 5px;"><strong>boa = StockWatcher.new("BOA")
goog = StockWatcher.new("GOOG")
current = CurrentPriceAnalyzer.new
boa_avg = AveragePriceAnalyzer.new
goog_avg = AveragePriceAnalyzer.new
thirty = MovingAverageAnalyzer.new(30)
hundred = MovingAverageAnalyzer.new(100)
boa.add_observer(current, :update)
boa.add_observer(boa_avg, :update)
boa.add_observer(thirty, :update)
goog.add_observer(current, :update)
goog.add_observer(goog_avg, :update)
goog.add_observer(hundred, :update)
loop do
boa.update
goog.update
sleep(1)
end
</strong></pre>
<br />
The method <b style="font-family: 'Courier New', Courier, monospace;">add_observer</b><span style="font-family: inherit;">, which also provided by Observable Module, is called to add an observers to the subject, a StockWatcher object. It's also tell the subject which method to call when the observers need to be notify.</span><br />
<br />
In this case, the BOA stock watcher object has 3 analyzers, current, boa_avg, and thirty. All implement update method for notification. Similarly, Google stock watcher also has 3 analyzers, current, goog_avg and hundred. Notice that the boa and goog can not use the same instance for AveragePriceAnalyzer, because it's has internal stage specific for each stock.<br />
<br />
Again, it's come down to the word <b>change</b>. We still have to identify what need to be changed and separate that part out of the object. However, with the specific relation between subject and observers, we can easily identify what part need to be separated out (and become observers). The relation also provide a clear pattern, and it is clear enough to be generalized and implemented into a module. All we need to do are, include and know how to use them.tawtaohttp://www.blogger.com/profile/17266883568788173890noreply@blogger.com0tag:blogger.com,1999:blog-2647826750462030032.post-58810510031258148552012-10-11T00:58:00.000-04:002012-10-11T01:31:10.826-04:00Transformer Prime and Linux Installer<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxz2uS3PwTcM4IcmHzrg0V75rzYlSI61q-w93-rkR2uq784PNGH-_lJcwbJFnvEJr6z_ITOZp3cETnNBw1G9xdBJhOOcrCzA5wF_HBAHzsejOKmjYdIhh6siGf9FVEKGa2XfeKWw7SPMA/s1600/nexus_android-logo-font_thumb.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxz2uS3PwTcM4IcmHzrg0V75rzYlSI61q-w93-rkR2uq784PNGH-_lJcwbJFnvEJr6z_ITOZp3cETnNBw1G9xdBJhOOcrCzA5wF_HBAHzsejOKmjYdIhh6siGf9FVEKGa2XfeKWw7SPMA/s1600/nexus_android-logo-font_thumb.png" /></a>Android is a great platform for consuming. I means, using it for internet, email, read books, keep your notes, etc. One may go as future as write a book, create art work, edit photos, compose musics, etc. There is an app for every thing you want, even for a linux enthusiastic like me. What I mean is I can use linux side by side with android.<br />
<br />
First of all, you can find instruction to install Ubuntu on prime <a href="http://forum.xda-developers.com/showthread.php?t=1603921"><b>here</b></a> on the xda-developers site, if you are interested. It's risky, but you will get full ubuntu running on the prime. I won't go into this approach thou. It's not what I aim for.<br />
<br />
For me, I prefer another method, chroot to a linux image file. This method allow me to run linux along side with android. I can do things that android does great, like reading email, facebook, websurfing, view pictures, read books, etc. I also can do things that normally android won't allow you. Actually, I can do pretty much every thing that linux provide you.<br />
<br />
The idea is to create a linux image file on your android device, mount the image file to android system, and chroot to it.<br />
<br />
Guess what, there is an app for that too. It's call "linux installer". Unfortunately, it's some what doesn't work perfectly on transformer prime.<br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgQ6J3YDmHjp4HjtYl_JkFrDxTYg6FtW8oShLu1znmyDwggrklulzv78bXVawN4lP6xfXKSXlKVthCe8CRZO8yiDaeZGnCxaY7htoTxjKHYlTPIMF9wdZ7wnUz1gGzT6Oj07v2mZLAUw54/s1600/penguin.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgQ6J3YDmHjp4HjtYl_JkFrDxTYg6FtW8oShLu1znmyDwggrklulzv78bXVawN4lP6xfXKSXlKVthCe8CRZO8yiDaeZGnCxaY7htoTxjKHYlTPIMF9wdZ7wnUz1gGzT6Oj07v2mZLAUw54/s1600/penguin.jpg" /></a>The app work only with rooted device, which mean you need to unlock you prime. After installed linux installer 4.1 (the version at the time this blog is written) from the market to your prime, you have to setup before you can go ahead with installation by select menu and setup. By default, there are couple options are disable. I choose to enable all of them, specially<br />
<ul>
<li>Bind Android</li>
<li>Allow write to /system</li>
<li>Allow remount with dev/exec</li>
</ul>
<div>
should be turn on. It's make the chroot integrate better with android.</div>
<div>
<br /></div>
<div>
By default, the debian/squeeze is chosen for distribution/version. Don't forget to choose your hostname, and domain name. I leave the chroot launcher script and other options untouched. </div>
<div>
<br /></div>
<div>
For the loop file location, I leave it at the default location. You should take note where it is. My is "/storage/sdcard0/Linux.loop". It's important that you need to know about this.</div>
<div>
<br /></div>
<div>
For the loop file size, it's need to be above 300MB. However, we are not going to use this loop file anyway, so choose some thing small, say 300.</div>
<div>
<br />
<a name='more'></a><br /></div>
<div>
After exist the menu, you now can process with installation. If this is your first time, you need to create a target loop, which will create loop file at the location you specify. Then format the target loop. It's take time, specially if the loop file is big.</div>
<div>
<br /></div>
<div>
If all go well, you should be able to mount the target loop. Then try to "install in loop", which basically install linux distribution you choose to the loop file. </div>
<div>
<br /></div>
<div>
Here the installation stop! I get an installation dialog which keep running, no sign of error or success. You can see the progress in the message box next to the linux symbol. I get an error in here. No matter what I try, it's seem I can not finish "install in loop" process.</div>
<div>
<br /></div>
<div>
Fortunately, I successfully install in loop on my phone. That mean, I have create a working Linux.loop image file on my phone. More importantly, my phone, the Atrix 4G, has the same CPU architecture as prime, armel (Tiger 3). All I have to do is <b>copy the Linux.loop from the phone to the prime</b>. And continue the installation on the prime. After mount the new loop file, you have to install linuxchroot, this menu become available only if your Linux.loop file is create successfully. In this case, on other device.</div>
<div>
<br /></div>
<div>
<b><span style="font-size: large;">In short, I create the Linux.loop file on other device, copy over and use it on my prime device. The most important thing is, it's have to be the same cpu architecture. Otherwise, it's won't work.</span></b></div>
<div>
<br /></div>
<div>
My Linux.loop file is 3000MB, which big enough to install all software I want, and still have some space to spare. I am fortunate that my phone has enough space to create this big loop file. If you don't, you can create a smaller file, then use any linux box to create a bigger loop file, format it, mount it using loop device (that why they call it's loop file), and copy the content over. It's will work with no problem. </div>
<div>
<br /></div>
<div>
I contact the developer, and learn that the problem is in the busybox embedded in the version 4.1. It's will be fixed in 4.2. Until then ... </div>
tawtaohttp://www.blogger.com/profile/17266883568788173890noreply@blogger.com0tag:blogger.com,1999:blog-2647826750462030032.post-15359679844837951362012-10-09T00:58:00.000-04:002012-10-10T08:39:30.410-04:00Carpeting and Traffic light - ConclusionDon't you feel the approach that I used in the previous post, <a href="http://www.tawtao.com/2012/10/carpeting-and-traffic-lighting-what-do.html">traffic light setting</a>, is a little bit overwhelming? I don't blame you if you do. But it does demonstrate some thing important, it's show what we can do with the problem.<br />
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-BuFQWZc2PPQ/UHH0OwomW-I/AAAAAAAAEm8/xQSRktd-OCg/s1600/1349645346606.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="117" src="http://4.bp.blogspot.com/-BuFQWZc2PPQ/UHH0OwomW-I/AAAAAAAAEm8/xQSRktd-OCg/s200/1349645346606.jpg" width="200" /></a></div>
<div>
First, with this approach, I always get an answer which may be "no, I can not do it in 3 turn per cycle" or "yes, I can". Not only that, I get a specific light setup, a pretty good one. Even with more complicate situations, say bigger intersections, I still definitely get an answer.</div>
<div>
<br /></div>
<div>
I also know that there is no way to let every one pass through safely only 2 turns per cycle, no matter how much I try. It is definitely good to know your limit, isn't it?</div>
<div>
<br /></div>
<div>
Moreover, if I have a problem that have hundreds of directions. Once I turn the problem to a graph, I probably going to look up a solution of graph coloring, which suit my case, or use one if it's already out there. Either way, I have a pretty good idea how to solve my problem.</div>
<div>
<br />
You probably realize by now that I am using mathematical abstraction, a graph, to help us to understand, learn more about limitations and provide a solution to the problem.<br />
<br />
This concept is important in computer science, because when you try to solve problem with computers, you actually turn a real problem into an abstract problem in computers. Mathematics give you a good guide line now to implement these abstractions. This what you are going to learn when you go to collage for computer degree, learning to solve problem using mathematics, and learn how to implement it in computers<br />
<div>
<br />
<a name='more'></a><br /></div>
In my line of work, a software engineer, If we start with right design and good implementation, the software is less likely to have problems, and easy to maintain. On the other hand, if start with bad design, it is going to cause problems, difficult to maintain and difficult adapt to new requirement.<br />
<br />
Many times, I don't have full understand the problem, but I do have implement a systems. A good practice is implement as minimum as possible but still satisfy the requirements. However, if I am blindingly follow this practice, I probably end up with a system that difficult to adapt to new requirement later, which may cause more problem and need to be rewritten later.<br />
<br />
To implement as minimum as possible need a good design to guide the implementation, like driving with a good map. Where do I get that good design? That right, mathematics.<br />
<br />
I really hope to convince you, learning mathematical abstraction such as graph, tree, set, hash it's not a waste of time. It's will help you become a better problem solver. It's explores you to many problems, and good solutions. It's also good practice for problem solving. Those skills become very important when you have to dealing with problems in the real world.<br />
<br />
Have any thought? Let me know. Thanks for reading.</div>
tawtaohttp://www.blogger.com/profile/17266883568788173890noreply@blogger.com0tag:blogger.com,1999:blog-2647826750462030032.post-87173716832876390892012-10-07T16:49:00.000-04:002012-10-09T22:20:54.556-04:00Carpeting and Traffic light, what do they have in common? - Part 2In the previous post, I define a <a href="http://www.tawtao.com/2012/10/carpeting-and-traffic-light-what-do.html">carpeting problem</a>. It quite a simple problem that can be described, including a solution in couple paragraphs. The traffic light problem is quite more complex.<br />
<br />
<b>Traffic light setting</b>: I want to setup a traffic light on a intersection (figure 1), which A, B, and C are two-way streets, while D is a one way street, and have to make sure that every one can get thought the intersection safely.<br />
<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"><tbody>
<tr><td style="text-align: center;"><a href="http://2.bp.blogspot.com/-3xp0z2r8COk/UHF-2GvcBLI/AAAAAAAAElE/Rp1z3TSLZgY/s1600/1349615297067.jpg" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="143" src="http://2.bp.blogspot.com/-3xp0z2r8COk/UHF-2GvcBLI/AAAAAAAAElE/Rp1z3TSLZgY/s200/1349615297067.jpg" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">figure 1</td></tr>
</tbody></table>
<div>
If I setup the light as follow:</div>
<div>
<ol>
<li>let A go to B and C, and block every one else</li>
<li>let B go to A and C, and block every one else</li>
<li>let C go to A and B, and block every one else</li>
<li>let D go to A, B and C and block every one else.</li>
</ol>
<div>
There will be 4 turns signal for each cycle. I ensure that every one get their turn, and pass through the intersection safely. </div>
</div>
<div>
<br /></div>
<div>
You may notice that while we let A go to B and C, in the same time C can safely go to A. This raise the question, can we do 3 turns signal in each cycle, and still let every one get through safely?</div>
<div>
<br />
<a name='more'></a><br /></div>
<div>
Let start by draw a picture that will help answer the question.</div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/--7e8CCMP-sw/UHHYC0sI9oI/AAAAAAAAElo/Hmh8R76xOtE/s1600/1349638100095.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="188" src="http://3.bp.blogspot.com/--7e8CCMP-sw/UHHYC0sI9oI/AAAAAAAAElo/Hmh8R76xOtE/s320/1349638100095.jpg" width="320" /></a></div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div>
This picture shows different car directions and relations between them. For example, If I let cars go from D to B (DB), then I can let the car go from D to C (DC), but I can not allow any cars from B to A (BA), or C to A (CA). The cars will crash!. In the picture, I use the red line to connect between directions that can not be allowed at the same time.</div>
<div>
<br /></div>
<div>
I apply this rule to all possible directions, and I get this picture:</div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-BuFQWZc2PPQ/UHH0OwomW-I/AAAAAAAAEm8/xQSRktd-OCg/s1600/1349645346606.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="188" src="http://4.bp.blogspot.com/-BuFQWZc2PPQ/UHH0OwomW-I/AAAAAAAAEm8/xQSRktd-OCg/s320/1349645346606.jpg" width="320" /></a></div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div>
Please note that I did not draw AB, BC, or DA, they are right turn. If the drivers are carefully turn, it's always possible. With this picture, I can setup the signal only 3 turn per cycle, as follow:</div>
<div>
<ol>
<li>let C to B, and D to B</li>
<li>let B to A, and C to A</li>
<li>let A to C, and D to C.</li>
</ol>
<div>
and still guarantee every one get through safely. </div>
<div>
<br /></div>
<div>
More importantly, It's also show that I can not do better than 3 turns! Why?, consider the BA, CB, and AC. If I allow one of these direction, I can not allow the other two. It's has to be at least 3 turns to allows all three directions to get through.</div>
</div>
<div>
<br /></div>
<div>
The picture, some what, look similar to the picture I draw for the carpeting problem, isn't it? That true because, with some preparation, I end up with the same <a href="http://en.wikipedia.org/wiki/Graph_coloring"><b>graph coloring problem</b></a>. For the carpeting, the preparation is quite easy, but not so for the traffic light setup.</div>
<div>
<br /></div>
<div>
<a href="http://www.tawtao.com/2012/10/carpeting-and-traffic-light-conclusion.html"><b>Next time</b></a> I come back with more discussion.</div>
tawtaohttp://www.blogger.com/profile/17266883568788173890noreply@blogger.com0tag:blogger.com,1999:blog-2647826750462030032.post-86585393185977040652012-10-07T08:46:00.004-04:002012-10-09T22:21:37.143-04:00Carpeting and Traffic light, what do they have in common?Nothing ... you may say so. And I completely agree with you. However, what I am talking about is two problems, Carpeting a house and Traffic light setting. They may have some thing in common that might surprise you. I have to be more specific, haven't I?<br />
<br />
<b>Carpeting a house</b>: I want to fully carpeting this house with one condition. I want every room that connect to each other have different color. For the room that is not directly connect, may share the same color.<br />
<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="http://1.bp.blogspot.com/-PuQQ0Hb-YD8/UHFv12PJyUI/AAAAAAAAEjw/TaSIWkQPEeM/s1600/1349611446357.jpg" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="116" src="http://1.bp.blogspot.com/-PuQQ0Hb-YD8/UHFv12PJyUI/AAAAAAAAEjw/TaSIWkQPEeM/s200/1349611446357.jpg" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">figure 1</td></tr>
</tbody></table>
For this particular house, kitchen (K) and living room (L) are connected, they have to have different color. Assuming the small area in front of rest room (R) is belongs to kitchen. All bedroom (MB, B1 and B2) can have the same color. In this case, 3 colors is enough. But can I do this with two color?<br />
<br />
Remember the small area in front of restroom is belongs to Kitchen, so B1 and B2 are not directly connected, so living room.<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"><tbody>
<tr><td style="text-align: center;"><a href="http://2.bp.blogspot.com/-cR1W7TfSge4/UHFyiJY3HRI/AAAAAAAAEkA/0m0WpxPCEIg/s1600/1349612121351.jpg" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="117" src="http://2.bp.blogspot.com/-cR1W7TfSge4/UHFyiJY3HRI/AAAAAAAAEkA/0m0WpxPCEIg/s200/1349612121351.jpg" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">figure 2</td></tr>
</tbody></table>
<br />
Let draw this floor plan differently (figure 2): All the room are connected directly to kitchen, except the master bedroom (MB). We have to choose two different colors for kitchen and living room, say C1 for kitchen and C2 for living room. Then we can use C1 for master bedroom and C2 for bedroom 1 and 2. Using two colors is possible then.<br />
<br />
<a name='more'></a><br /><br />
In this particular problem drawing the floor plan differently give us clearer view of the problem. It's may not be necessary in this case because the floor plan are small and simple but for more complex one, redrawing would help.<br />
<br />
<b><br /></b>
<b>Traffic light setting</b>: Now I am a traffic light engineer, and I want to setup a traffic light on this intersection, show in figure 3: Let A, B, and C are two-way streets, while D is one way street. I can setup the light this way:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-3xp0z2r8COk/UHF-2GvcBLI/AAAAAAAAEkg/HJZFAM7fNeY/s1600/1349615297067.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="187" src="http://3.bp.blogspot.com/-3xp0z2r8COk/UHF-2GvcBLI/AAAAAAAAEkg/HJZFAM7fNeY/s320/1349615297067.jpg" width="320" /></a></div>
<ol>
<li>let A go to B and C</li>
<li>let B go to A and C</li>
<li>let C go to A and B</li>
<li>let D go to A, B and C</li>
</ol>
<div>
That mean in one cycle, I have 4 steps and I guarantee that every one have their turn. But, again, can I do this in 3 steps (hopefully shorten the cycles)? That is not quite easy to answer, isn't it? Let keep it for the next post, stay tuned.</div>
<br />
<br />tawtaohttp://www.blogger.com/profile/17266883568788173890noreply@blogger.com0tag:blogger.com,1999:blog-2647826750462030032.post-3079948775305970692012-10-06T07:10:00.002-04:002012-10-06T07:27:16.799-04:00Square Photography<div style="text-align: center;">
Look interesting right? :)<br />
It change my perspective. Why don't you try it!</div>
<div style="text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWH3gysYvyviBLJ0JClo5t7ifmjgk6OCgj672Hm7Z5pAuUND3cRMVgNK7g9Y2yNUtHyz3_6fAToQSpBMxDyV01E_SysYwPmvZfBe_PHZTt0b7NzcR9nQZTLjDN0hNn2nyTue-g1s1PuQY/s1600/IMG_9434_5_6_tonemapped.tif.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWH3gysYvyviBLJ0JClo5t7ifmjgk6OCgj672Hm7Z5pAuUND3cRMVgNK7g9Y2yNUtHyz3_6fAToQSpBMxDyV01E_SysYwPmvZfBe_PHZTt0b7NzcR9nQZTLjDN0hNn2nyTue-g1s1PuQY/s320/IMG_9434_5_6_tonemapped.tif.jpg" width="318" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiUmkIaru4ehw-B2RKWkJkipeP9DMmiHEDgt5Rr0qUuFfEkJt3KfDaQs9p2eKtiskmeq_eQMiEWuq8xXsem40AfZTMVJwx9PXDX3sRExxZ5mDTWgPJnR_n2BMTJmaFQWp3z7tN3wXbyOsU/s1600/IMG_0545.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiUmkIaru4ehw-B2RKWkJkipeP9DMmiHEDgt5Rr0qUuFfEkJt3KfDaQs9p2eKtiskmeq_eQMiEWuq8xXsem40AfZTMVJwx9PXDX3sRExxZ5mDTWgPJnR_n2BMTJmaFQWp3z7tN3wXbyOsU/s320/IMG_0545.JPG" width="320" /></a> </div>
<br />
<a name='more'></a><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXJnFRIXSJYQiDdBDi1ainLv2zYr_iLEtNmtEnJ88ourpi17Hxx6NaWzmf1MTeJnOi4W2_I92ojBkstes5wAg9NnMpOszeWHjyLduiiIg8b_3iXnDBVUBI0H69VLN_JM5SZ6fyDi-A5MA/s1600/img_5589.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXJnFRIXSJYQiDdBDi1ainLv2zYr_iLEtNmtEnJ88ourpi17Hxx6NaWzmf1MTeJnOi4W2_I92ojBkstes5wAg9NnMpOszeWHjyLduiiIg8b_3iXnDBVUBI0H69VLN_JM5SZ6fyDi-A5MA/s320/img_5589.jpg" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixquOw5-GcHRBpgcUzkinRNCRnOf3KT0G23M3LfiulfG-oWd3pEAxIBoZfkeFMF3cXobXitgnhZHm1ihd7oWfRWbPfLjrOKnsn1uEBwESKx0JgMweSmDxzQws0sqVXHsvY2IE1cYlJCVs/s1600/IMG_2461.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixquOw5-GcHRBpgcUzkinRNCRnOf3KT0G23M3LfiulfG-oWd3pEAxIBoZfkeFMF3cXobXitgnhZHm1ihd7oWfRWbPfLjrOKnsn1uEBwESKx0JgMweSmDxzQws0sqVXHsvY2IE1cYlJCVs/s320/IMG_2461.JPG" width="320" /></a></div>
<br />tawtaohttp://www.blogger.com/profile/17266883568788173890noreply@blogger.com2tag:blogger.com,1999:blog-2647826750462030032.post-17765491629252360562012-10-05T02:02:00.001-04:002020-03-18T18:38:25.933-04:00Rails Namespace, Nested Resource and form_forCouple days ago, I ran into a problem when I try to use namespace, nested resources and form_for in Rails 3 and ruby 1.9.3. I try to setup some thing similar to this, a namespace <b>:admin</b>, with nested resources <b>:menus</b>, and <b>:menu_items.</b> Here is the routes.rb:<br />
<pre style="border: 1px solid black; padding-left: 10px;"><strong>namespace :admin do
resources :menus do
resources :menu_items
end
end</strong></pre>
I think it's probably common used case. Unfortunately, I got this error when I try to create a new <b>MenuItem</b> in <b>menu_items/_form.html.erb
</b><br />
<pre style="border: 1px solid black; padding-left: 10px;"><strong>undefind method 'admin_menu_items_path' for #<#<Class ...
...
1: <%= form_for(@admin_menu_item)do |f| %>
...
17: end
</strong></pre>
I realize that the standard scaffolding won't work for me, so I start googling. Right away, I get a lot of hits. It's seem to be a common issue. However, the solutions create quite a confusion for me. I try different solutions, some looking good but don't work! .. Here is what I find working.<br />
<br />
First, in admin/menu_items_controller.rb, method 'new':
<br />
<pre style="border: 1px solid black; padding-left: 10px;"><strong>def new
@menu = Admin::Menu.find(params[:menu_id])
@menu_item = @menu.menu_items.build
...
end
</strong></pre>
It load up the <span style="font-family: "courier new" , "courier" , monospace;"><b>@menu</b></span>, and build <span style="font-family: "courier new" , "courier" , monospace;"><b>@menu_item</b></span>, nothing surprise me. I also get rid of than "<span style="font-family: "courier new" , "courier" , monospace;"><b>admin</b></span>" prefix. It's simpler that way.<br />
<br />
<a name='more'></a><br />
<br />
<span style="font-family: inherit;">Next, I move <b>form_for</b> statement, from the partial <b>_form.html.erb</b> to <b>new.html.erb</b>. Here the <b>form_for</b> statement in <b>new.html.erb</b> looks like:</span><br />
<pre style="border: 1px solid black; padding-left: 10px;"><strong><span style="font-size: x-small;">...
<%= form_for [@menu, @menu_item], :url => admin_menu_menu_items_path do |f| %>
<%= render :partial => 'form', :locals => { :f => f } %>
<%= end %>
...</span>
</strong></pre>
I pass <span style="font-family: "courier new" , "courier" , monospace;"><b>[@menu, @menu_item]</b></span> as the first argument of form_for. That make sense to me because of the nested resources. However, this is not enough to handle namespace. To do so, I need to specify :url, which usually infer from the first argument of form_for. Unfortunately auto generate routing doesn't work here, probably because of the namespace. By far, specifying :url the cleanest solution I have seen.<br />
<br />
I have to move <b>form_for</b> because the partial <b>_form.html.erb</b> is also used by <b>edit.html.erb</b>. Since this solution require to specify :url, the line <b>form_for</b> can not be in the <b>_form.html.erb</b> any more.<br />
<br />
One other thing, to pass variable <b>f</b> as local variable to partial <b>_form.html.erb</b>, you need the keyword <b>:partial</b> there. I still don't understand this line doesn't work!<br />
<pre style="border: 1px solid black; padding-left: 10px;"><strong><%= render 'form', :locals => { :f => f } %></strong></pre>
Why won't <b>render 'form'</b> take <b>:locals </b>options the same way as <b>render :partial => 'form'</b> does? It's a mystery to me.
<br />
<br />
Of course, you still need to workout a few route naming around forms. Basically adding the <b>menu</b> resource name in the route naming, for example for the <b>link_to 'back'</b>, instead of <span style="font-family: "courier new" , "courier" , monospace;"><b>admin_menu_items_path</b></span>, it's become <b><span style="font-family: "courier new" , "courier" , monospace;">admin_menu_menu_items_path(@menu)</span></b>.<br />
<br />
A few problems here and there, but I would say, Rails 3 have come a long way handling namespace and nested resources. I remember in Rails 2, to use namespace is quite fun!.
tawtaohttp://www.blogger.com/profile/17266883568788173890noreply@blogger.com0tag:blogger.com,1999:blog-2647826750462030032.post-4284293724365798302012-10-04T00:33:00.000-04:002012-10-06T06:15:07.103-04:00Permutation and Mathematical Induction<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEEbT6CM72UeNrowENkiod34Jvx8ievxTivgnULRN8azU2526GYJ6iBev49OdqhrxAn0uyknLwyl9wPGmdscnJKG8Z8k_znSuMQSL4h0gn2fG8h_mjX6bpTpC1tOvRyr5WDC1r-SIJknU/s1600/math_code.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="152" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEEbT6CM72UeNrowENkiod34Jvx8ievxTivgnULRN8azU2526GYJ6iBev49OdqhrxAn0uyknLwyl9wPGmdscnJKG8Z8k_znSuMQSL4h0gn2fG8h_mjX6bpTpC1tOvRyr5WDC1r-SIJknU/s200/math_code.png" width="200" /></a></div>
<script src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript">
</script>
Last <a href="http://www.tawtao.com/2012/10/chinese-abacus-and-mathematical.html">post</a>, I show how basic mathematical induction works. Now, I am going to use it to prove that an algorithm is work correct. In this case, we are going to prove a permutation algorithm, which take an array of <u>unique</u> numbers L, and return an an array of all permutations of L. Let call it perms(L). For example:<br />
<br />
<ol>
<li>If L = [ ], then perms(L) would be [ [ ] ].</li>
<li>If L = [1, 2, 3], the result of perms(L) will be an array [ [1, 2, 3], [1, 3, 2], [2, 1, 3], [2, 3, 1], [3, 1, 2], [3, 2, 1]]. Note: the arrary could be any order.</li>
</ol>
The algorithm that I am going to prove is shown here:<br />
<pre style="border: 1px solid black; padding-left: 5px;"><strong> 1: def perms(L)
2: return [[]] if L.size == 0
3: result = []
4: L.each do |elm|
5: L1 = L - [elm]
6: perms(L1).each |p|
7: p1 = [elm] + p
8: result << p1
9: end
10: end
11: return result
12: end
</strong></pre>
<br />
The exact statement that I want to prove to you is: <i><b>for any given array L of size n, the perms(L) is an array of all size-n permutation of L.</b></i><br />
<br />
<i>First, basis step</i>: Let L = [ ]. The L.size will be 0. Then the perms(L) will return immediately with value [ [ ] ], which is the array of all size-0 permutation of L.<br />
<br />
<i>Inductive step</i>: Let assume statement is true for any array with size n. We have to show that for any array L of size n+1, perms(L) will return an array of all size-(n+1) permutation of L.<br />
<br />
<a name='more'></a><br /><br />
Since L have size n+1, the perms won't return immediately and the result is set to an empty array [ ].<br />
<br />
In the loop start at line 4: we create an array L1 for each element <i><b>elm</b></i> of L by subtract [<i><b>elm</b></i>] from L. The new array L1 have size n, and contain all other element of L, except the <b><i>elm</i></b>. By assumption, perms(L1) is an array contain all size-n permutation of L1.<br />
<br />
Then for an element <b><i>elm</i></b>, the loop start at line 6: create all possible size n+1 permutation of L that start with element <b style="font-style: italic;">elm</b>, and also add them to the result array. Since outer loop (line 4:) goes thought all possible element of L, then the result after the loop would contain all possible size n+1 permutation of L. \(#\)<br />
<br />
Some may argue that this is not really mathematical induction, it's more like induction reasoning. I say, the important is the basic principal is the same, prove basis case, then show the induction step. Moreover, if you look at the induction proof in graph theory books, or algorithm books, you probably see some thing similar to this.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
Hopefully you find this post is interesting and help you to understand more proof that using mathematical induction. Some time it's doesn't clearly stage which part is basis step, which part is induction step, but it's all there, otherwise the proof is not complete.tawtaohttp://www.blogger.com/profile/17266883568788173890noreply@blogger.com0tag:blogger.com,1999:blog-2647826750462030032.post-89426758309925411982012-10-03T01:37:00.003-04:002012-10-06T07:16:16.580-04:00Chinese Abacus and Mathematical Induction <script src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript">
</script><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi11CgqeylkWYjP8OjPrL9vEDYuUyTBUt89IOSPa052wow6W2sbrFtZzp6lnW7e_PCxcRPRM7GvAej3y94_0AcqDLs0w2b7z131wVS16OyoNmn9xBD8MtnJyXqBkQBTD5ol9Ynr_s_YPDI/s1600/traditional-chinese-calculator.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="150" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi11CgqeylkWYjP8OjPrL9vEDYuUyTBUt89IOSPa052wow6W2sbrFtZzp6lnW7e_PCxcRPRM7GvAej3y94_0AcqDLs0w2b7z131wVS16OyoNmn9xBD8MtnJyXqBkQBTD5ol9Ynr_s_YPDI/s200/traditional-chinese-calculator.jpg" width="200" /></a>
When I was a kid, I used to practice Chinese Abacus every day. Me and my brother turn this boring practice into a competition, and the winner is the person who can do 1 + 2 + ... + 100 faster! Of course, it's has to be correct. At that time, we were told that the correct value is 5050, and we did not question about it.<br />
<div>
<br /></div>
<div>
Now, I kinda wonder, if I am going to proof to some one that 1 + 2 + ... + 100 = 5050, how can I do that? Here one way to do it.</div>
<div>
<br /></div>
<div>
First line up two line of sum this way, one from 1 to 100, another from 100 to 1.</div>
<div>
<br /></div>
<pre> 1 + 2 + 3 + ... + 100
100 + 99 + 98 + ... + 1
---------------------------------------
101 + 101 + 101 + ... + 101 = 101 * 100
</pre>
<div style="text-align: left;">
<br />
Then, sum each column. As you can see, sum value in each column is equal 101. Since we know that there is going to be 100 column. So the sum of the last line, which is sum of those two line, is 101 * 100. Because we start with 2 lines, the sum of \(1 + 2 + 3 + ... + 100\) = \(101 \cdot 100 / 2 = 5050 \).<br />
<br />
This way, we can also show that, for any given interger \(n \ge 1\)<br />
$$ \displaystyle\sum_{i=1}^{n} i = 1 + 2 + ... + n = \frac{n\dot(n+1)}{2}$$<br />
Nice!, It's probably require a genius to come up with the proof like this, don't you think?<br />
<br />
Another way, we can use <b>mathematical induction</b> to proof this statement too. It's more systematic, and can be generalize to prove more complex statements. The proof by mathematical induction has two parts, basis step and induction step. Basically, we have to show the basis is true, then show if any given number is true, then the next one also true.<br />
<br />
<a name='more'></a><br />
<br />
To proof by induction, we start with basis case: \(n = 1\)<br />
\[ \displaystyle\sum_{i=1}^{1} i = 1 = \frac{1\cdot (1+1)}{2} \]<br />
Then, we assume the statement is true for any given number \(k\),<br />
\( \displaystyle\sum_{i=1}^{k} i = \frac{ k (k + 1) }{2} \)<br />
we have to show that the statement is also true for \(k + 1\), and here it is:<br />
<br />
\begin{align*}<br />
\displaystyle\sum_{i=1}^{k + 1} i<br />
&= \displaystyle\sum_{i=1}^{k } i + (k + 1)<br />
\\ &= \frac{k (k+1)}{2} + (k + 1)<br />
\\ &= \frac{k (k+1) + 2 (k + 1)}{2}<br />
\\ &= \frac{(k + 1) ((k + 1) + 1)}{2}<br />
\end{align*}<br />
<div>
<br /></div>
<div>
Compare to the first method, mathematical induction seem to be more complicated. However, this method can be extended to prove more complex statements on more well-founded structures, such as graph, and trees. </div>
<div>
<br /></div>
<div>
<a href="http://www.tawtao.com/2012/10/permutation-and-mathematical-induction.html">Next time</a> we shall see how can we use mathematical inductions in other more complex problem.</div>
</div>
tawtaohttp://www.blogger.com/profile/17266883568788173890noreply@blogger.com0tag:blogger.com,1999:blog-2647826750462030032.post-78788046362872149182012-10-02T01:12:00.000-04:002012-10-06T06:15:41.244-04:00Writing Math Equation in Dynamic Page Blogs<script src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript">
</script>
<br />
<div dir="ltr">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcx2ROCFraBiTrsWexz9-IAiaZnS5ApiEv1vKCjmV3mVRT7NCqfQ0iW-BSWkdIMx6cjYA01ClRQENjzMvB-rDSCJxE5XuNFrlZ5h91zJK3O5ZBQE71QquEyKAMkUP3rrj_M9gMAy7qrII/s1600/math_eq.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="108" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcx2ROCFraBiTrsWexz9-IAiaZnS5ApiEv1vKCjmV3mVRT7NCqfQ0iW-BSWkdIMx6cjYA01ClRQENjzMvB-rDSCJxE5XuNFrlZ5h91zJK3O5ZBQE71QquEyKAMkUP3rrj_M9gMAy7qrII/s200/math_eq.png" width="200" /></a><a href="http://www.mathjax.org/">Mathjax</a> is an open source Javascript display engine for mathematics. It's allow you to rendered math equation on all modern browsers without have to download reader, plugins or fonts.</div>
<br />
Mathjax support Tex, LaTax and MathML equations. Better than word, here is an example.<br />
<br />
<pre style="border: 1px solid black; padding-left: 10px;"><strong>When \(a \ne 0\), there are two solutions to \(ax^2 + bx + c = 0\)
and they are $$x = {-b \pm \sqrt{b^2-4ac} \over 2a}.$$
</strong></pre>
<br />
Which produce:<br />
When \(a \ne 0\), there are two solutions to \(ax^2 + bx + c = 0\) and they are
$$x = {-b \pm \sqrt{b^2-4ac} \over 2a}.$$
<br />
<br />
What not so trivial to me is how to set it up. Basically, to endable MathJax in web platform, you have to add the line to header section.<br />
<pre style="border: 1px solid black; padding-left: 10px;"><strong><script src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?
config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script>
</strong></pre>
<br />
Unfortunately, it's won't work with Dynamic Page, which I am using. Because the content of the post is showed in a popup page, the in the main page itself. The solution, the script have to be <u>added into the post itself</u>.<br />
<br />
Here what I did:
<br />
<ol>
<li>open the post</li>
<li>edit in html mode</li>
<li>copy the script on top of the post</li>
</ol>
<div>
Then start writing the math equation! That all it's take.</div>
<div>
<br /></div>
<div>
Mathjax has an excellent documentation how to use it <a href="http://docs.mathjax.org/en/latest/index.html">here</a>. It's really cool! :)</div>
tawtaohttp://www.blogger.com/profile/17266883568788173890noreply@blogger.com0tag:blogger.com,1999:blog-2647826750462030032.post-84714470566084057082012-10-01T23:10:00.000-04:002012-10-06T06:15:56.390-04:00Favor Composition over Inheritance - ConclusionIt all come down to the word "<b>change</b>". Change is the key to decided which one should be inherited and which one should be composite.<br />
<br />
The base class Duck has-a name, and swim. So does the MallardDuck which inherited from Duck. It is-a Duck after all. MallardDuck also has-a behavior fly and quack. But these two behavior are not inherited from Duck thou. Both are composite part of MallardDuck.<br />
<br />
<i><b>What make swim, different from fly? Can we consider swim as a behavior, and implement it in the same way as fly?</b></i><br />
The answer is in the word "change". The swim does not change. All subclass has the same swim method. While, fly and quack are not the same in all subclass. Of course, nothing prevent us from implementing swim in the same way as we did with fly. But why do we need to do more complicate code if we don't need too. Inherited would work great for swim.<br />
<br />
<b><i>Can we just override and make change in the subclass as needed? </i></b><br />
Yes, we can. However, if the change are the same in two different subclass, then we code duplication! Consider, both MallardDuck and RedheadDuck can fly with wing. That means we would have to make the same change to MallardDuck and RedheadDuck. By implement the part of the duck that can be changed into module, we can pick and choose what behavior we want. You can see in the <a href="http://www.tawtao.com/2012/09/favor-composition-over-inheritance-part_29.html">part 3</a>, it is make much more sense, easily to understand and maintain.<br />
<br />
<i><b>Object vs Module, which one should I use?</b></i><br />
Obviously, if you want ability to change the behavior at run time, you would have to use object approach. But that is not the only advantage object approach has over module. The object give you much control over <u>namespace</u> and help you avoid <u>name collision</u>.<br />
<br />
Consider the module implementation, when we include the module, all the methods are defined in the same name space. Which means it's possible we can get name collision. Specially, if the module are large, and very complicated, say 10 or may be 20 methods defined. It's possible two modules have the same method name but doing different thing. For example, if we happen to include both Behavior::FlyWithWing and Behavior::NotFly, one of the fly method will get overridden.<br />
<br />
On the other hand, if we implement using objects, it's name collision won't happen, because all the methods would be contained in the object itself.<br />
<br />
For the problem that is not so complex, the module would be a good choice, because it's easier to understand, and manage. Beside, with good naming convention, the name collision can be avoid easily.<br />
<br />
Knowing when to use inheritance or composition is one of the most important skill to learn. What every way you choose to implement, separated part of the object that can be change, and use them to compost the new object is the key to handling change. If it's not change, just inherited it!<br />
<br />
Always, start with the simple solution, but also know where are you heading help you make the right choice.<br />
<br />
Thanks for reading this far. :)tawtaohttp://www.blogger.com/profile/17266883568788173890noreply@blogger.com0tag:blogger.com,1999:blog-2647826750462030032.post-14735677479982606872012-09-30T23:11:00.001-04:002012-10-06T06:17:00.285-04:00Favor Composition over Inheritance - Part 4<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWttY64gvCxF5iRHx6gQ_bGiVxowFe9d0ZUtZtqfw2oxtPei0BPZgKer4dFUkv2ndQAwFABnYKEm_ZdGnqrWqqVUr0ugSRR5-VvjVRjr9qzzVjf3u1Xj873WnF2Wm3xbePLwwQ4_PR-LU/s1600/IMG_5617.CR2.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWttY64gvCxF5iRHx6gQ_bGiVxowFe9d0ZUtZtqfw2oxtPei0BPZgKer4dFUkv2ndQAwFABnYKEm_ZdGnqrWqqVUr0ugSRR5-VvjVRjr9qzzVjf3u1Xj873WnF2Wm3xbePLwwQ4_PR-LU/s1600/IMG_5617.CR2.jpg" /></a>Previously in the <a href="http://www.tawtao.com/2012/09/favor-composition-over-inheritance-part_29.html">programming series posts</a>, I show how to use module to implement composition. One limitation of using module is, duck can not change behavior at run time. Such as MallardDuck can only fly with wing. How can we allow an instance of duck to change their behavior at run time? An answer is using object instead of module.<br />
<br />
To support this feature, the base class, now, hold all the behaviors implemented for subclass. That quite different from using module, which the base class know nothing about subclass behaviors at all.<br />
<pre style="border: 1px solid black; padding-left: 5px;"><strong>class Duck
attr_reader :name
attr_accessor :fly_behavior, :quack_behavior
def initialize
@name = "mallard duck"
@fly_behavior = nil
@quack_behavior = nil
end
def fly
fly_behavior.fly
end
def quack
quack_behavior.quack
end
end
</strong></pre>
<br />
In this case, the base class by default has no behaviors. It's the subclass job to create, and assign default behaviors of the subclass when initiate an instance. For example, MallardDuck default behavior for flying is fly with wing, etc.<br />
<pre style="border: 1px solid black; padding-left: 5px;"><strong>require './duck'
require './behavior/fly_with_wing'
require './behavior/quack_loud'
class MallardDuck &lt; Duck
def initialize
@name = "mallard duck"
@fly_behavior = Behavior::FlyWithWing.new
@quack_behavior = Behavior::QuackLoud.new
end
end
</strong></pre>
<br />
<a name='more'></a><br /><br />
For the behaviors, instead of module, it's become a class.<br />
<pre style="border: 1px solid black; padding-left: 5px;"><strong>module Behavior
class FlyWithWing
def fly
puts 'Fly with wing.'
end
end
end
</strong></pre>
<br />
Here an implementation of duck_app.rb. This example show an instance of MallardDuck, which first can fly and then the same duck can not fly any more when the behavior re-assigned. It still quack loadly thou.<br />
<pre style="border: 1px solid black; padding-left: 5px;"><strong>require './mallard_duck'
require './behavior/not_fly'
mduck = MallardDuck.new
p mduck.name
mduck.fly
mduck.fly_behavior = Behavior::NotFly.new
mduck.fly
mduck.quack</strong></pre>
<br />
Here you have it! A duck that can change behavior at run time.
<br />
<br />
This implementation of composition is quite similar to java "interface" implementation using in the head first design pattern book [1]. To be almost exactly the same, we would duplicate fly, and quack method all over the sub-classes. That is some how a give and a curse of ruby!<br />
<br />
I still one more to go on this topic, a comparison for module and object approaches. Stay tuned!<br />
<br />
<span style="background-color: #fafafa; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px;">[1] Head First Design Patterns, Eric Freema, Elisabeth Freeman, O'Reilly 2004.</span>tawtaohttp://www.blogger.com/profile/17266883568788173890noreply@blogger.com0