<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7712898164041001720</id><updated>2024-10-06T22:21:29.139-07:00</updated><category term="python"/><category term="programming"/><category term="blender"/><category term="opencl"/><category term="go"/><category term="haskell"/><category term="math"/><title type='text'>Dr. Squirrel And Magic Glasses</title><subtitle type='html'>English translations of selected articles from http://weijr-note.blogspot.com</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://weijr-eng.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7712898164041001720/posts/default'/><link rel='alternate' type='text/html' href='http://weijr-eng.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>tjwei</name><uri>http://www.blogger.com/profile/13263392105910479364</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>17</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7712898164041001720.post-1134308543854886290</id><published>2014-12-19T00:52:00.002-08:00</published><updated>2014-12-19T00:52:38.826-08:00</updated><title type='text'>Augmented Reality with Leap Motion, OpenCV, Three.js</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;iframe allowfullscreen=&#39;allowfullscreen&#39; webkitallowfullscreen=&#39;webkitallowfullscreen&#39; mozallowfullscreen=&#39;mozallowfullscreen&#39; width=&#39;320&#39; height=&#39;266&#39; src=&#39;https://www.youtube.com/embed/2qUu4Wovt-g?feature=player_embedded&#39; frameborder=&#39;0&#39;&gt;&lt;/iframe&gt;&lt;/div&gt;
Another happy exploring with IPython notebook.&lt;br /&gt;
OpenCV is used to calibrating the camera, and find out the position of the camera in Leap motion coordinate. Then, match the webgl camera setting, and have some fun.&lt;br /&gt;
&lt;br /&gt;
See also a google hangout presentation with the help of leapmition.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;iframe allowfullscreen=&#39;allowfullscreen&#39; webkitallowfullscreen=&#39;webkitallowfullscreen&#39; mozallowfullscreen=&#39;mozallowfullscreen&#39; width=&#39;320&#39; height=&#39;266&#39; src=&#39;https://www.youtube.com/embed/ZEZQjnoG2hw?feature=player_embedded&#39; frameborder=&#39;0&#39;&gt;&lt;/iframe&gt;&lt;/div&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://weijr-eng.blogspot.com/feeds/1134308543854886290/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://weijr-eng.blogspot.com/2014/12/augmented-reality-with-leap-motion.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7712898164041001720/posts/default/1134308543854886290'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7712898164041001720/posts/default/1134308543854886290'/><link rel='alternate' type='text/html' href='http://weijr-eng.blogspot.com/2014/12/augmented-reality-with-leap-motion.html' title='Augmented Reality with Leap Motion, OpenCV, Three.js'/><author><name>tjwei</name><uri>http://www.blogger.com/profile/13263392105910479364</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7712898164041001720.post-989651105189878355</id><published>2014-09-19T17:55:00.001-07:00</published><updated>2014-09-19T18:02:07.231-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="opencl"/><category scheme="http://www.blogger.com/atom/ns#" term="programming"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><title type='text'>Finding low and high md5/sha512 hashes with OpenCL and Python</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhUVCTHNUQG3VtXMx3P8a_hozpdWnw0ZmzqueHkYu0sTgc4FSVRBr9Cvd8TXt4J34A-ZBC0PIgB1txXQ1EnnLB4tV_Mr1pdPe0LYdp3uwXEkagPHjTf3_RqUGNItmxSMUlrvw7VV5CSL8Q/s1600/2014-09-20+08:47:14+%E7%9A%84%E8%9E%A2%E5%B9%95%E6%93%B7%E5%9C%96.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhUVCTHNUQG3VtXMx3P8a_hozpdWnw0ZmzqueHkYu0sTgc4FSVRBr9Cvd8TXt4J34A-ZBC0PIgB1txXQ1EnnLB4tV_Mr1pdPe0LYdp3uwXEkagPHjTf3_RqUGNItmxSMUlrvw7VV5CSL8Q/s1600/2014-09-20+08:47:14+%E7%9A%84%E8%9E%A2%E5%B9%95%E6%93%B7%E5%9C%96.png&quot; height=&quot;268&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
Currently the leader of&amp;nbsp;&lt;a href=&quot;https://www.crysys.hu/hashgame/&quot;&gt;The Famous Hash Game&lt;/a&gt;(for MD5)&amp;nbsp;and &lt;a href=&quot;http://www.h11e.com/&quot;&gt;hash|challenge&lt;/a&gt;, with my&amp;nbsp;HD7970, IPython notebook, and PyOpenCL, atitweak, and kernels modified from oclcrack and John the Ripper.&lt;br /&gt;
Source code can be found at&amp;nbsp;&lt;a href=&quot;http://nbviewer.ipython.org/github/tjwei/tjw_ipynb/blob/master/lowest%20md5.ipynb&quot;&gt;http://nbviewer.ipython.org/github/tjwei/tjw_ipynb/blob/master/lowest%20md5.ipynb&lt;/a&gt;&lt;br /&gt;
and&amp;nbsp;&lt;a href=&quot;http://nbviewer.ipython.org/github/tjwei/tjw_ipynb/blob/master/lowest%20sha512.ipynb&quot;&gt;http://nbviewer.ipython.org/github/tjwei/tjw_ipynb/blob/master/lowest%20sha512.ipynb&lt;/a&gt;&lt;br /&gt;
The hash rate on my HD7970 GE is about 6.8 ghash/s for md5 and 175 mhash/s for sha512&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://weijr-eng.blogspot.com/feeds/989651105189878355/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://weijr-eng.blogspot.com/2014/09/finding-lowest-and-highest-md5sha512.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7712898164041001720/posts/default/989651105189878355'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7712898164041001720/posts/default/989651105189878355'/><link rel='alternate' type='text/html' href='http://weijr-eng.blogspot.com/2014/09/finding-lowest-and-highest-md5sha512.html' title='Finding low and high md5/sha512 hashes with OpenCL and Python'/><author><name>tjwei</name><uri>http://www.blogger.com/profile/13263392105910479364</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhUVCTHNUQG3VtXMx3P8a_hozpdWnw0ZmzqueHkYu0sTgc4FSVRBr9Cvd8TXt4J34A-ZBC0PIgB1txXQ1EnnLB4tV_Mr1pdPe0LYdp3uwXEkagPHjTf3_RqUGNItmxSMUlrvw7VV5CSL8Q/s72-c/2014-09-20+08:47:14+%E7%9A%84%E8%9E%A2%E5%B9%95%E6%93%B7%E5%9C%96.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7712898164041001720.post-7901729160182583720</id><published>2014-09-10T01:52:00.001-07:00</published><updated>2014-09-19T19:54:22.598-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="opencl"/><category scheme="http://www.blogger.com/atom/ns#" term="programming"/><title type='text'>Real Programmers Use One-Way Hash Function</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHwUzIrUjvsZAXFI5UDNYew4pzFRhIstdGA4u58A8Jjo0yZ8R1FXMOpsEfijG_Of_AQ2RZlO6WF888nAf_4qY1EVq0H8mEY_Pv3_r4PXu7CFFWbV1d_2xmmCX445VcSVq1iYT1gXKIjeE/s1600/2014-09-10+17:16:05+%E7%9A%84%E8%9E%A2%E5%B9%95%E6%93%B7%E5%9C%96.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHwUzIrUjvsZAXFI5UDNYew4pzFRhIstdGA4u58A8Jjo0yZ8R1FXMOpsEfijG_Of_AQ2RZlO6WF888nAf_4qY1EVq0H8mEY_Pv3_r4PXu7CFFWbV1d_2xmmCX445VcSVq1iYT1gXKIjeE/s1600/2014-09-10+17:16:05+%E7%9A%84%E8%9E%A2%E5%B9%95%E6%93%B7%E5%9C%96.png&quot; height=&quot;442&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
GNU nano is a text editor - a program often used to edit the source code of other programs. Emacs, Vim and ed are all progressively more &quot;hard core&quot; editors. cat is a Unix program that concatenates and outputs the contents of files. Things get steadily more ridiculous from here. Using a magnetised needle to flip bits on a hard drive requires nanometer precision and binary mastery, but in the early days of programming people did use needles sometimes to fix bugs on Punched cards. The use of a magnetized needle may also be a reference to the Apollo AGC guidance computer, whose instructions were physically written as patterns of wires looped around or through cylindrical magnets in order to record binary code. &amp;nbsp;--&amp;nbsp;&lt;a href=&quot;http://www.explainxkcd.com/wiki/index.php/378:_Real_Programmers&quot;&gt;http://www.explainxkcd.com/wiki/index.php/378:_Real_Programmers&lt;/a&gt;&lt;/blockquote&gt;
For a real programmer, writing binary executable directly seems to be a bit too easy, even with magnetized needles. The real hard core way is using one-way hash functions, like sha2 or md5.&lt;br /&gt;
&lt;br /&gt;
In the spirit of &lt;a href=&quot;http://weijr-eng.blogspot.tw/2013/10/great-python-challenge.html&quot;&gt;Great Python Challenge&lt;/a&gt;, which were used to promote PyCon APAC 2014, I posted a challenge on my Facebook, aksing if anyone can use one-way hash function to write program, for example:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot; style=&quot;background-color: black;&quot;&gt;
cat 0.c| shasum -a 384 | xxd -p -r &amp;gt; a.out &amp;amp;&amp;amp; chmod a+x a.out &amp;amp;&amp;amp; ./a.out&lt;/blockquote&gt;
sha384 was chosen because it is possible to fit an ELF binary into sha384 digest (see &lt;a href=&quot;http://www.muppetlabs.com/~breadbox/software/tiny/teensy.html&quot;&gt;http://www.muppetlabs.com/~breadbox/software/tiny/teensy.html&lt;/a&gt;).&lt;br /&gt;
&lt;br /&gt;
After I posted the challenge, I was trying to find a solution myself too. It turns out that it is possible to do so.&lt;br /&gt;
Follow below steps (Copy&amp;amp; Paste) to try the code:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot; style=&quot;background-color: black;&quot;&gt;
mkdir test&lt;br /&gt;
cd test&lt;br /&gt;
wget&amp;nbsp;https://raw.githubusercontent.com/tjwei/tjw_ipynb/master/0.c&lt;br /&gt;
sh 0.c&lt;br /&gt;
gcc 0.c &amp;amp;&amp;amp; ./a.out&lt;br /&gt;
cat 0.c | shasum -a 384 | xxd -p -r &amp;gt; a.out &amp;amp;&amp;amp; chmod a+x a.out&lt;br /&gt;
./a.out&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;br /&gt;
&lt;b&gt;The story&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
The first solution is&amp;nbsp;&lt;a href=&quot;https://github.com/tjwei/tjw_ipynb/blob/master/a.c&quot;&gt;https://github.com/tjwei/tjw_ipynb/blob/master/a.c&lt;/a&gt;&lt;br /&gt;
Sort of working, but I am not satisfied because I&#39;d expect it can at least say &quot;Hello World!&quot;.&lt;br /&gt;
My 2nd attpemt is&amp;nbsp;&lt;a href=&quot;https://raw.githubusercontent.com/tjwei/tjw_ipynb/aa733143a5a76f460122e93028f49693d53931e8/0.c&quot;&gt;https://raw.githubusercontent.com/tjwei/tjw_ipynb/aa733143a5a76f460122e93028f49693d53931e8/0.c&lt;/a&gt;&lt;br /&gt;
which is not bad, it does say &quot;Hello World!&quot;, but still has some issues I don&#39;t like.&lt;br /&gt;
I realized that I have to search the solution harder. First thing I did was to reduce the length of the code to fit in 112 bytes, so that the whole code can be fit in one sha512 block. This can speed up the hashing by a factor of 5~7. In order to do that, all description, which was in the comment of the code, &amp;nbsp;were moved to a webpage and the url is shortened.&lt;br /&gt;
Then, I use OpenCL and a customized kernel to do the sha384 hashing. On my HD7970 ghz edition, it can do 160 mhash/s, without overclocking the card.&lt;br /&gt;
You can find the final result:&amp;nbsp;&lt;a href=&quot;https://github.com/tjwei/tjw_ipynb/blob/master/0.c&quot;&gt;https://github.com/tjwei/tjw_ipynb/blob/master/0.c&lt;/a&gt;&lt;br /&gt;
And working notebook at:&lt;br /&gt;
&lt;a href=&quot;http://nbviewer.ipython.org/github/tjwei/tjw_ipynb/blob/master/RealMan2.ipynb&quot;&gt;http://nbviewer.ipython.org/github/tjwei/tjw_ipynb/blob/master/RealMan2.ipynb&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
And&lt;br /&gt;
&lt;br /&gt;
Since it is a challenge, I do receive some replies. An answer from Kuo-Tung is quite good too, see &amp;nbsp;&lt;a href=&quot;http://paste.plurk.com/show/1982392/&quot;&gt;http://paste.plurk.com/show/1982392/&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://weijr-eng.blogspot.com/feeds/7901729160182583720/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://weijr-eng.blogspot.com/2014/09/real-programmers-use-one-way-hash.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7712898164041001720/posts/default/7901729160182583720'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7712898164041001720/posts/default/7901729160182583720'/><link rel='alternate' type='text/html' href='http://weijr-eng.blogspot.com/2014/09/real-programmers-use-one-way-hash.html' title='Real Programmers Use One-Way Hash Function'/><author><name>tjwei</name><uri>http://www.blogger.com/profile/13263392105910479364</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHwUzIrUjvsZAXFI5UDNYew4pzFRhIstdGA4u58A8Jjo0yZ8R1FXMOpsEfijG_Of_AQ2RZlO6WF888nAf_4qY1EVq0H8mEY_Pv3_r4PXu7CFFWbV1d_2xmmCX445VcSVq1iYT1gXKIjeE/s72-c/2014-09-10+17:16:05+%E7%9A%84%E8%9E%A2%E5%B9%95%E6%93%B7%E5%9C%96.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7712898164041001720.post-2032204968880298578</id><published>2014-09-09T05:24:00.003-07:00</published><updated>2014-09-09T05:26:00.563-07:00</updated><title type='text'>Poor man&#39;s Holograph</title><content type='html'>&lt;iframe width=&quot;560&quot; height=&quot;315&quot; src=&quot;http://www.youtube.com/embed/YrdY7jVC5SA&quot; frameborder=&quot;0&quot; allowfullscreen&gt;&lt;/iframe&gt;
&lt;br /&gt;
&lt;iframe width=&quot;560&quot; height=&quot;315&quot; src=&quot;http://www.youtube.com/embed/klrQEkiqK8g&quot; frameborder=&quot;0&quot; allowfullscreen&gt;&lt;/iframe&gt;
&lt;br /&gt;
This is a simple proof of concept, using an Android Phone as a Swept-volume display. Above showing a cube, two of the sides display english letters. Because the refresh rate of the the my android screen the the frame rate of my video recoreder, the actual result is better than it seems on the video (kind of like recording a CRT wtih a video recoreder) &lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; You can find a lot of POV Display videos on youtube&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;
&lt;iframe allowfullscreen=&quot;allowfullscreen&quot; frameborder=&quot;0&quot; height=&quot;315&quot; src=&quot;http://www.youtube.com/embed/huHlfEiqA6Y&quot; width=&quot;420&quot;&gt;&lt;/iframe&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; and Volume Display like Led Cube&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;iframe width=&quot;420&quot; height=&quot;315&quot; src=&quot;http://www.youtube.com/embed/6mXM-oGggrM&quot; frameborder=&quot;0&quot; allowfullscreen&gt;&lt;/iframe&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;Swept-volume display is something in between of led cude and POV. &lt;br /&gt;
The good thing is X,Y resolution is much better than LED cube, the phone (old acer stream) has a 480x800 AMOLED screen.  
However, the resolution on Z-axis is ver low, 6～8 pixels if we are lucky.&lt;br /&gt;



</content><link rel='replies' type='application/atom+xml' href='http://weijr-eng.blogspot.com/feeds/2032204968880298578/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://weijr-eng.blogspot.com/2014/09/poor-mans-holograph.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7712898164041001720/posts/default/2032204968880298578'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7712898164041001720/posts/default/2032204968880298578'/><link rel='alternate' type='text/html' href='http://weijr-eng.blogspot.com/2014/09/poor-mans-holograph.html' title='Poor man&#39;s Holograph'/><author><name>tjwei</name><uri>http://www.blogger.com/profile/13263392105910479364</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/YrdY7jVC5SA/default.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7712898164041001720.post-6691139677276022605</id><published>2014-09-09T05:12:00.001-07:00</published><updated>2014-09-09T05:12:42.529-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="programming"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><title type='text'>A GIF image can be run as Python, Ruby, JavaScript, and Jave program.</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWHHHWC06mcQCvLxWTfx_BGoSH_FEFBO8tU_iGLW1jRYOpPZ0ydTobypHYAwsNZ2xJoCwl5xaECRga8fhZ49jxheXDZYM-e2PwAnvpY8HOqUM5-nT4ky-VyBAL7OrPMfRmowYcuapCJ9A/s1600/face6.gif&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWHHHWC06mcQCvLxWTfx_BGoSH_FEFBO8tU_iGLW1jRYOpPZ0ydTobypHYAwsNZ2xJoCwl5xaECRga8fhZ49jxheXDZYM-e2PwAnvpY8HOqUM5-nT4ky-VyBAL7OrPMfRmowYcuapCJ9A/s400/face6.gif&quot; height=&quot;303&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
The above image, face6.gif, is a proper GIF can be run as python script in window/linux/mac/cygwin.&lt;br /&gt;
That is, try&lt;br /&gt;
&lt;b&gt;python face6.gif&lt;/b&gt;&lt;br /&gt;
in command line, it can be executed (by CPython).&lt;br /&gt;
Moreover, it can run as ruby, perl, and java program.&lt;br /&gt;
&lt;b&gt;ruby -x face6.gif&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;perl -x face6.gif&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;java -jar face6.gif&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
If you rename face6.gif to face6.html and open it with a web browser, the &amp;nbsp;&lt;b&gt;javascript&lt;/b&gt;&amp;nbsp; code with print &quot;Python rocks&quot;.&lt;br /&gt;
&lt;br /&gt;
You can also try&lt;br /&gt;
&lt;b&gt;rar x face6.gif&lt;/b&gt;&lt;br /&gt;
and not suprising, you can use also open it with any image viewer.&lt;br /&gt;
&lt;br /&gt;
Since it is a jar file, so using unzip -v face6.gif, &amp;nbsp;you can find java classes. It also contains a &amp;nbsp;__main__.py, but __main__.py won&#39;t be executed by CPython. This is because CPython does not like zip files with comment.&lt;br /&gt;
&lt;iframe allowfullscreen=&quot;allowfullscreen&quot; frameborder=&quot;0&quot; height=&quot;315&quot; src=&quot;http://www.youtube.com/embed/KC6XiNPMyio&quot; width=&quot;560&quot;&gt;&lt;/iframe&gt;</content><link rel='replies' type='application/atom+xml' href='http://weijr-eng.blogspot.com/feeds/6691139677276022605/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://weijr-eng.blogspot.com/2014/09/a-gif-image-can-be-run-as-python-ruby.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7712898164041001720/posts/default/6691139677276022605'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7712898164041001720/posts/default/6691139677276022605'/><link rel='alternate' type='text/html' href='http://weijr-eng.blogspot.com/2014/09/a-gif-image-can-be-run-as-python-ruby.html' title='A GIF image can be run as Python, Ruby, JavaScript, and Jave program.'/><author><name>tjwei</name><uri>http://www.blogger.com/profile/13263392105910479364</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWHHHWC06mcQCvLxWTfx_BGoSH_FEFBO8tU_iGLW1jRYOpPZ0ydTobypHYAwsNZ2xJoCwl5xaECRga8fhZ49jxheXDZYM-e2PwAnvpY8HOqUM5-nT4ky-VyBAL7OrPMfRmowYcuapCJ9A/s72-c/face6.gif" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7712898164041001720.post-2822381243310375110</id><published>2014-09-09T04:02:00.000-07:00</published><updated>2014-09-09T04:02:04.214-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="python"/><title type='text'>Enhace PyCon APAC video recordings with the help of slides and OpenCV</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjqCIcaQ0OgNg2gwIhucF5jzUaKRW3Xj7DdIxQOltI3_Q4lkGJDYl97UexI6hwDqtnoiFHEXrrWbVfQ5SkpbeCdWXzeRkzK9HyHHgRiNywm0Ia9TwtvDXu7DJ0dE2-UHlN5X-7wGGfkIKM/s1600/interactive.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjqCIcaQ0OgNg2gwIhucF5jzUaKRW3Xj7DdIxQOltI3_Q4lkGJDYl97UexI6hwDqtnoiFHEXrrWbVfQ5SkpbeCdWXzeRkzK9HyHHgRiNywm0Ia9TwtvDXu7DJ0dE2-UHlN5X-7wGGfkIKM/s1600/interactive.png&quot; height=&quot;489&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
The quality of some of the video recordings of PyCon APAC 2014 are really poor (see below examples). Since most of speakers release their slide files under creative common license, we thought we might use these slides to repair the video.&lt;br /&gt;
The basic ideal to render the slides as images, and match the video recordings, and then use the rendered slides to replace the poor images in the video recordings.&lt;br /&gt;
First, I was thinking about some like feature matching and tried to use ORB to find key points on videos and slides. Unfortunately, &amp;nbsp;the quality of video recordings is so poor, that feature matching does not work, at least not work if we use ORB.&lt;br /&gt;
My second attempts is using linear algebra to do template matching. It turns out that CV_TM_CCOEFF_NORMED method works good enough.&lt;br /&gt;
However, we need to manually find the position of the slide image in the video recordings. The position depends on speakers laptop and perhaps the video connector. But it seems to be fixed for the entire talk. So we only need to adjust the parameter once for each talk.&lt;br /&gt;
With the help of IPython interactive widgets, it is not too difficult to do that manually. And by using SIFT feature matching, we can find the parameters semi-automatically.&lt;br /&gt;
All we need to do manually is to find a frame of video recordings and a rendered image of the slides that match each other.&lt;br /&gt;
I guess it won&#39;t be to hard to make the whole process full automatic, but the semi-automatic tools is good enough for our original purpose.&lt;br /&gt;
The followings are the tools we uses.&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://nbviewer.ipython.org/github/tjwei/tjw_ipynb/blob/master/VideoSlidesSyncWrite.ipynb&quot;&gt;VideoSlidesSyncWrite.ipynb&lt;/a&gt;&amp;nbsp;automatically sync the video and slides and then encode the video (see below).&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://nbviewer.ipython.org/github/tjwei/tjw_ipynb/blob/master/Interactive_compare.ipynb&quot;&gt;Interactive_compare.ipynb&lt;/a&gt;&amp;nbsp;interactive tool to find the parameters(above picture)&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjqKaP2UBEWYRllXIKlwT0crntj6DmhArbWl8z-fD-cVwxkaJIyxDqVHvntfyI71symh5n8ZzNjuVsWOPn9oLT8QFq90KNJoNKz2Fy0pnfE_bs91EdwOMb90eq-D4nQ978q-fMU3uSKnO0/s1600/%E8%9E%A2%E5%B9%95%E6%93%B7%E5%9C%962.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjqKaP2UBEWYRllXIKlwT0crntj6DmhArbWl8z-fD-cVwxkaJIyxDqVHvntfyI71symh5n8ZzNjuVsWOPn9oLT8QFq90KNJoNKz2Fy0pnfE_bs91EdwOMb90eq-D4nQ978q-fMU3uSKnO0/s1600/%E8%9E%A2%E5%B9%95%E6%93%B7%E5%9C%962.png&quot; height=&quot;532&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
The following is the outline of our process&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Extract pdf as a series of png images. Althoug there are python modules like wand can do that in python, we shamelessly using shell call to do that with ImageMagick convert.&lt;/li&gt;
&lt;li&gt;Find out the coordinates and size &amp;nbsp;of the slides in the video recording using interactive tool&lt;/li&gt;
&lt;li&gt;convert the images to 256x256 gray scale, using CV_TM_CCOEFF_NORMED to find the matching slide. 256x256 is a quite arbitrary choice, and perhaps more than enough. Perhaps 128x128 should work just fine.&lt;/li&gt;
&lt;li&gt;The cut-off parameter does not need to be to precise. Some value between 0.5 and 0.95 should work most the time.&lt;/li&gt;
&lt;li&gt;Manually put some slides into black list. This is mostly because pdf files does not contain the slides animation that used in the actual talk. If the pdf includes the animation that can be generated into a series of png images, then our algorithm works very well.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Because don&#39;t know how to encode video with audio with OpenCV, So shamelessly call the avconv to do merge the generated video and original audio track. &amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&amp;nbsp;Followings are some scree shot of the enhanced videos and original videos.&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgK9RBQehUrh96RmuFug8vSsXfpOJWRU2HzxHfdIuIO0AEiOvLTLRxt-6Rzm9c4Ke1TCWkuJfUDos9oJw-3MMNE45yKQcJT4E7EdQ-vbRTNzVNRAqA0duHri_C8wyr-x6rD6K26Vi_PL6I/s1600/grs1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgK9RBQehUrh96RmuFug8vSsXfpOJWRU2HzxHfdIuIO0AEiOvLTLRxt-6Rzm9c4Ke1TCWkuJfUDos9oJw-3MMNE45yKQcJT4E7EdQ-vbRTNzVNRAqA0duHri_C8wyr-x6rD6K26Vi_PL6I/s1600/grs1.png&quot; height=&quot;180&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Toomore&#39;s talk. &amp;nbsp;This recording is the &quot;motivation&quot; of this project.&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPzlVJgmIW5sGvk669z4Y07Cm2hzRJCxyFH7NMO7lHRXiWRQyYNBvttnjvit7wmhKoNbaGokZV1dasb4obEvBujhmAczo8TFJ-lC4BwQC9PUzt-w34c2lG5S1vea5UtwwlmdWen0EuNW0/s1600/grs3.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPzlVJgmIW5sGvk669z4Y07Cm2hzRJCxyFH7NMO7lHRXiWRQyYNBvttnjvit7wmhKoNbaGokZV1dasb4obEvBujhmAczo8TFJ-lC4BwQC9PUzt-w34c2lG5S1vea5UtwwlmdWen0EuNW0/s1600/grs3.png&quot; height=&quot;179&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;The text of original recording is unreadable.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgsOODMZ2mpdSjxmAkgm5Hc0Rmthbji-IalAUe-mmvJkjy3ATS-Ln0g1ys-g8gU0p2HqZBh4X6xsu_03794LNhbTN_CYkhcER0N7vh2XUYEWWrBefjZWGtOxl0_didbu_yM-oEdxm4y0ZE/s1600/grs2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgsOODMZ2mpdSjxmAkgm5Hc0Rmthbji-IalAUe-mmvJkjy3ATS-Ln0g1ys-g8gU0p2HqZBh4X6xsu_03794LNhbTN_CYkhcER0N7vh2XUYEWWrBefjZWGtOxl0_didbu_yM-oEdxm4y0ZE/s1600/grs2.png&quot; height=&quot;180&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/td&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/td&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOpGPhLQ6VymqjHoBCOWq9WiHpRxV5LisSjeyq9_SyTHyOLX-BC_hQ_zN8SJDVFqS37hqtaE5HfCVv8NHahdS6p93gTfcoehc_OGdAuHwJ6t3YuhERyLRuYV0x7KGNNRWCQhX0PZzy35I/s1600/sv3.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOpGPhLQ6VymqjHoBCOWq9WiHpRxV5LisSjeyq9_SyTHyOLX-BC_hQ_zN8SJDVFqS37hqtaE5HfCVv8NHahdS6p93gTfcoehc_OGdAuHwJ6t3YuhERyLRuYV0x7KGNNRWCQhX0PZzy35I/s1600/sv3.png&quot; height=&quot;180&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Tseng&#39;s talk. The quality of the video recording is equally poor.&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjj4CSlNFM-_9aChOP5lcFTRZ3dvuaOFLKA70jakrraC0S5KbP_Sqm2oDPCpDYOkKcvJIXuu7t_gkXF7JAbjzqOOZLE_u752e5z_Ups-VkyRhLM8ZLkOFkAUfKgeSXKI_0X3pIyaQf99rM/s1600/sv2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjj4CSlNFM-_9aChOP5lcFTRZ3dvuaOFLKA70jakrraC0S5KbP_Sqm2oDPCpDYOkKcvJIXuu7t_gkXF7JAbjzqOOZLE_u752e5z_Ups-VkyRhLM8ZLkOFkAUfKgeSXKI_0X3pIyaQf99rM/s1600/sv2.png&quot; height=&quot;180&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjT9NSk0VaB46RnFw1N3nv5w3Jz1cUReFN9OzJV-BOHvD7FwC1YSYi058DtmD9L4FvRAhi6b5tv7dDbWrfXps67MP6Yn-tDXuCr4ZCSTx9cvNXQPARaqqcdCcSo3OgFr7QYV1Ajq7LViFY/s1600/sv1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjT9NSk0VaB46RnFw1N3nv5w3Jz1cUReFN9OzJV-BOHvD7FwC1YSYi058DtmD9L4FvRAhi6b5tv7dDbWrfXps67MP6Yn-tDXuCr4ZCSTx9cvNXQPARaqqcdCcSo3OgFr7QYV1Ajq7LViFY/s1600/sv1.png&quot; height=&quot;180&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;The final result is quite good, but the slides has been updated, so the match failed for the cover slide.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj4_JFqdusdd8KipCckoa2Oi1e4PcQzmyyFQSXDVRnsLjPhDS2rPVhbGOvcrBOX8oDuVD6K8c5XN6D9Bk-8ANHP8DqDgv7CaXrWyu1APM0-b7Srf0188BB8tkuaKKeuwhzFt6aEHppp5lM/s1600/fabric2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj4_JFqdusdd8KipCckoa2Oi1e4PcQzmyyFQSXDVRnsLjPhDS2rPVhbGOvcrBOX8oDuVD6K8c5XN6D9Bk-8ANHP8DqDgv7CaXrWyu1APM0-b7Srf0188BB8tkuaKKeuwhzFt6aEHppp5lM/s1600/fabric2.png&quot; height=&quot;180&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Cheng-Lung Sung&#39;s talk is different, seems like perspective transformation might be needed.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGeIMZigo3VvChkXSk08GxPrehOF6FcnD65ooN0bhj-4qzfhc92lffp1CzU540cv-dQ5_35aEX1wrMj9EYey5jd_RhsOzrMss67cGONw2j6CvT-3sZYy1b8Cm6ZYj1nn6CT7yuGn4B0Cg/s1600/fabric1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGeIMZigo3VvChkXSk08GxPrehOF6FcnD65ooN0bhj-4qzfhc92lffp1CzU540cv-dQ5_35aEX1wrMj9EYey5jd_RhsOzrMss67cGONw2j6CvT-3sZYy1b8Cm6ZYj1nn6CT7yuGn4B0Cg/s1600/fabric1.png&quot; height=&quot;180&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;We thought we might need to modified our interactive tools, however, affine transformation works.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiH3k0G8Y2GZuN7OCJBH4Rn440K5mIWtVqoKms7pgJUGh4KOyXlKqnDeOaYCETTudZ9JAKMsAqVVQ8JzuXUvPqY79n0J1rllPGZzjNDhGCGFobpt3eC0qdBRivm73AqzTtHjMoWZDQRPk0/s1600/fabric3.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiH3k0G8Y2GZuN7OCJBH4Rn440K5mIWtVqoKms7pgJUGh4KOyXlKqnDeOaYCETTudZ9JAKMsAqVVQ8JzuXUvPqY79n0J1rllPGZzjNDhGCGFobpt3eC0qdBRivm73AqzTtHjMoWZDQRPk0/s1600/fabric3.png&quot; height=&quot;180&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgw5Rncj5cpmPa3ORxVaBGfVDNh6ffWZ76U-EaaXED1Vm8Clq6ej2OdcJZazWXTMWlb69h6ac5ghSYVBJguOrBRCqv0dqg29qMHif9XhW8HE-40wwGgAgz3rbd63KEpHzhiex8vvGkUREU/s1600/fabric4.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgw5Rncj5cpmPa3ORxVaBGfVDNh6ffWZ76U-EaaXED1Vm8Clq6ej2OdcJZazWXTMWlb69h6ac5ghSYVBJguOrBRCqv0dqg29qMHif9XhW8HE-40wwGgAgz3rbd63KEpHzhiex8vvGkUREU/s1600/fabric4.png&quot; height=&quot;180&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiDcz5eXlt5y_dT227-IXX247ggomPSI28LgC0G2HKSRuk2ktgwkvb8_qaJDXvcv4zAqI511jxf3gEIduT7TRlH93ATjg6ZCVXBMifWkccpbp1VAQS9A7OJ5gX-7GdS54_lQ7nUK6oh0eM/s1600/summly1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiDcz5eXlt5y_dT227-IXX247ggomPSI28LgC0G2HKSRuk2ktgwkvb8_qaJDXvcv4zAqI511jxf3gEIduT7TRlH93ATjg6ZCVXBMifWkccpbp1VAQS9A7OJ5gX-7GdS54_lQ7nUK6oh0eM/s1600/summly1.png&quot; height=&quot;179&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Even with recordings with better quality, like the recording of Andy&#39;s talk, our tools still enhance the quality significantly.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSUzZGDCQjGqnnQ7z0k9ViV5nzih9dpQWH_PyTRZHbRqkVGAk016XbtwKLDqqeahko2uoHwkJKJq3V4QQ_Od20cwfUjY7gGUsv883rYXGbwiajRDRoowrf6GbwtGQoBChRfCGLlK0RKGk/s1600/summly2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSUzZGDCQjGqnnQ7z0k9ViV5nzih9dpQWH_PyTRZHbRqkVGAk016XbtwKLDqqeahko2uoHwkJKJq3V4QQ_Od20cwfUjY7gGUsv883rYXGbwiajRDRoowrf6GbwtGQoBChRfCGLlK0RKGk/s1600/summly2.png&quot; height=&quot;180&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitJjey5KdFj1DLFZSV3GDlRZFnPTA_gAehgpokRio0YacN9mRmzW2KOQyUeuLfYT0DPg9JmLZscAJ4FZyvMGOtNE6pMGFIossSKetj_4tGhTpHo-U3hKkt94JsnDvof9yH5GDjo7UAUfk/s1600/vote1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitJjey5KdFj1DLFZSV3GDlRZFnPTA_gAehgpokRio0YacN9mRmzW2KOQyUeuLfYT0DPg9JmLZscAJ4FZyvMGOtNE6pMGFIossSKetj_4tGhTpHo-U3hKkt94JsnDvof9yH5GDjo7UAUfk/s1600/vote1.png&quot; height=&quot;180&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJqx2NxuTe7adSP9uaf_fdph8CClKM0dEmenfI5gNTrGcCZY9Y8nFjXkRnwECdAyzk3kGdVgedhimYIw5EOUZp9eYvhlU0NIlUxBZoDQ9ADT9fSvxocX1OC_mqP4QHEu7xU5V2Uls6Q4c/s1600/vote2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJqx2NxuTe7adSP9uaf_fdph8CClKM0dEmenfI5gNTrGcCZY9Y8nFjXkRnwECdAyzk3kGdVgedhimYIw5EOUZp9eYvhlU0NIlUxBZoDQ9ADT9fSvxocX1OC_mqP4QHEu7xU5V2Uls6Q4c/s1600/vote2.png&quot; height=&quot;180&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgL3qkV2-TSjsl1xnLDSffJjfs6NPYicpGvymMay32R4MxCsm97siICUwQRFwhiY0cd5MHky1bBHcRLon2XHAFPs0lsJNJwoGuox4iDdjozSIzMhUxGToDCfG2RrGKD9Fw6XNNVjAuFRHI/s1600/vote3.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgL3qkV2-TSjsl1xnLDSffJjfs6NPYicpGvymMay32R4MxCsm97siICUwQRFwhiY0cd5MHky1bBHcRLon2XHAFPs0lsJNJwoGuox4iDdjozSIzMhUxGToDCfG2RrGKD9Fw6XNNVjAuFRHI/s1600/vote3.png&quot; height=&quot;180&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2OjSWcbUmgUHfmye2sTX1xF3sSxW19MJ7doByEDFDdzcu4yCTuaQruYVqQyhSYLbl8N0iZcfsCxku_lnikr4GNEygSU-TPTe0v808tqdi8MDTwUA1WRasf29KNVEpgTru61u4LHp_2_Y/s1600/feature.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2OjSWcbUmgUHfmye2sTX1xF3sSxW19MJ7doByEDFDdzcu4yCTuaQruYVqQyhSYLbl8N0iZcfsCxku_lnikr4GNEygSU-TPTe0v808tqdi8MDTwUA1WRasf29KNVEpgTru61u4LHp_2_Y/s1600/feature.png&quot; height=&quot;640&quot; width=&quot;568&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;feature matching in the interactive tool&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-69TzUjmf0DACPWGV6uT2CBV3Je8pG-hO0QdwGr6-Mwg-zoDaF0xzOqUt-uYMNJ40JTs35L5Hxezbrcg6jJzNV-RKr1n2shFSGtlvCDb7c0NSEY-3HuYl-RQDmjwVMck9qWL3WkbFUuc/s1600/feature2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-69TzUjmf0DACPWGV6uT2CBV3Je8pG-hO0QdwGr6-Mwg-zoDaF0xzOqUt-uYMNJ40JTs35L5Hxezbrcg6jJzNV-RKr1n2shFSGtlvCDb7c0NSEY-3HuYl-RQDmjwVMck9qWL3WkbFUuc/s1600/feature2.png&quot; height=&quot;640&quot; width=&quot;486&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
The followings are the enhanced videos&amp;nbsp;&lt;iframe allowfullscreen=&quot;&quot; frameborder=&quot;0&quot; height=&quot;480&quot; src=&quot;//www.youtube.com/embed/MSOlZeDN3qc?list=UUHLnNgRnfGYDzPCCH8qGbQw&quot; width=&quot;853&quot;&gt;&lt;/iframe&gt;
&lt;iframe allowfullscreen=&quot;&quot; frameborder=&quot;0&quot; height=&quot;480&quot; src=&quot;//www.youtube.com/embed/NiTb_UMLQfc?list=UUHLnNgRnfGYDzPCCH8qGbQw&quot; width=&quot;853&quot;&gt;&lt;/iframe&gt;
&lt;iframe allowfullscreen=&quot;&quot; frameborder=&quot;0&quot; height=&quot;480&quot; src=&quot;//www.youtube.com/embed/hBKYx0u7-ZU?list=UUHLnNgRnfGYDzPCCH8qGbQw&quot; width=&quot;853&quot;&gt;&lt;/iframe&gt;
&lt;iframe allowfullscreen=&quot;&quot; frameborder=&quot;0&quot; height=&quot;480&quot; src=&quot;//www.youtube.com/embed/1eBOhyWkHgE?list=UUHLnNgRnfGYDzPCCH8qGbQw&quot; width=&quot;853&quot;&gt;&lt;/iframe&gt;
&lt;iframe allowfullscreen=&quot;&quot; frameborder=&quot;0&quot; height=&quot;480&quot; src=&quot;//www.youtube.com/embed/LQehhjL_BvE?list=UUHLnNgRnfGYDzPCCH8qGbQw&quot; width=&quot;853&quot;&gt;&lt;/iframe&gt;
&lt;iframe allowfullscreen=&quot;&quot; frameborder=&quot;0&quot; height=&quot;480&quot; src=&quot;//www.youtube.com/embed/ID9xtnwchuk?list=UUHLnNgRnfGYDzPCCH8qGbQw&quot; width=&quot;853&quot;&gt;&lt;/iframe&gt;</content><link rel='replies' type='application/atom+xml' href='http://weijr-eng.blogspot.com/feeds/2822381243310375110/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://weijr-eng.blogspot.com/2014/09/enhace-pycon-apac-video-recordings-with.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7712898164041001720/posts/default/2822381243310375110'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7712898164041001720/posts/default/2822381243310375110'/><link rel='alternate' type='text/html' href='http://weijr-eng.blogspot.com/2014/09/enhace-pycon-apac-video-recordings-with.html' title='Enhace PyCon APAC video recordings with the help of slides and OpenCV'/><author><name>tjwei</name><uri>http://www.blogger.com/profile/13263392105910479364</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjqCIcaQ0OgNg2gwIhucF5jzUaKRW3Xj7DdIxQOltI3_Q4lkGJDYl97UexI6hwDqtnoiFHEXrrWbVfQ5SkpbeCdWXzeRkzK9HyHHgRiNywm0Ia9TwtvDXu7DJ0dE2-UHlN5X-7wGGfkIKM/s72-c/interactive.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7712898164041001720.post-490354209182279579</id><published>2014-09-09T03:06:00.002-07:00</published><updated>2014-09-09T03:06:47.807-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="programming"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><title type='text'>Solve  HITCON 2014 CTF with IPython notebook</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhyQ8_vMtCzMywAUjdgGU3AnUYik4gO2g7V7TGBEZJDck4m4HA80x_iK8uEkyiPG83SHv3nvOO82wT3XXFB7ay0xQTyQXZAlLp3mjktsllZusx7hae_J9qrqXpgavghij2YjhuRJqKTBIQ/s1600/solution.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhyQ8_vMtCzMywAUjdgGU3AnUYik4gO2g7V7TGBEZJDck4m4HA80x_iK8uEkyiPG83SHv3nvOO82wT3XXFB7ay0xQTyQXZAlLp3mjktsllZusx7hae_J9qrqXpgavghij2YjhuRJqKTBIQ/s1600/solution.png&quot; height=&quot;480&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
This my first CTF, try to solve it with IPython noteook. I only got 7 flags, but solve it with IPython notebook is a fun experience for me, very interactive and I can visualize my progress. See QR maze video below. Using IPython notebook and the power of python, the telnet based maze can be easily visualized in a web browser, and I won&#39;t lose my progress between the telnet connections, because every thing is kept in the IPython kernel.&lt;br /&gt;
Most of ipynb files can be found at&amp;nbsp;&lt;a href=&quot;http://nbviewer.ipython.org/github/tjwei/tjw_ipynb/tree/master/&quot;&gt;http://nbviewer.ipython.org/github/tjwei/tjw_ipynb/tree/master/&lt;/a&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;iframe allowfullscreen=&#39;allowfullscreen&#39; webkitallowfullscreen=&#39;webkitallowfullscreen&#39; mozallowfullscreen=&#39;mozallowfullscreen&#39; width=&#39;320&#39; height=&#39;266&#39; src=&#39;https://www.youtube.com/embed/uPXhLQjpInU?feature=player_embedded&#39; frameborder=&#39;0&#39;&gt;&lt;/iframe&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://weijr-eng.blogspot.com/feeds/490354209182279579/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://weijr-eng.blogspot.com/2014/09/solve-hitcon-2014-ctf-with-ipython.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7712898164041001720/posts/default/490354209182279579'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7712898164041001720/posts/default/490354209182279579'/><link rel='alternate' type='text/html' href='http://weijr-eng.blogspot.com/2014/09/solve-hitcon-2014-ctf-with-ipython.html' title='Solve  HITCON 2014 CTF with IPython notebook'/><author><name>tjwei</name><uri>http://www.blogger.com/profile/13263392105910479364</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhyQ8_vMtCzMywAUjdgGU3AnUYik4gO2g7V7TGBEZJDck4m4HA80x_iK8uEkyiPG83SHv3nvOO82wT3XXFB7ay0xQTyQXZAlLp3mjktsllZusx7hae_J9qrqXpgavghij2YjhuRJqKTBIQ/s72-c/solution.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7712898164041001720.post-1982061830176484420</id><published>2014-06-22T21:22:00.001-07:00</published><updated>2017-08-10T02:38:20.632-07:00</updated><title type='text'>Some of my draft papers on mental poker</title><content type='html'>&lt;div data-angle=&quot;0&quot; data-canvas-width=&quot;542.891948856447&quot; data-font-name=&quot;g_font_4_0&quot; dir=&quot;ltr&quot; style=&quot;font-family: sans-serif; font-size: 16.6043px; left: 238.553px; top: 251.764px; transform-origin: 0% 0% 0px; transform: rotate(0deg) scale(1.37668, 1);&quot;&gt;
&lt;/div&gt;
&lt;div data-angle=&quot;0&quot; data-canvas-width=&quot;542.891948856447&quot; data-font-name=&quot;g_font_4_0&quot; dir=&quot;ltr&quot; style=&quot;font-family: sans-serif; font-size: 16.6043px; left: 238.553px; top: 251.764px; transform-origin: 0% 0% 0px; transform: rotate(0deg) scale(1.37668, 1);&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg5sbz0pOkAfwHzPiJGPhudzNNde2DffSlg3l6ayU9o4LLCsRQam9A-M2Dl0ZQO_0U0mOVts5vG4x3ELda0nFnUF0OV89V5yqJFNFZKIbBoHZ_vOr3Lc5TqalAy_LjqdovnqQ9vWwzjyvE/s1600/1086-poker-chips-playing-cards.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;419&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg5sbz0pOkAfwHzPiJGPhudzNNde2DffSlg3l6ayU9o4LLCsRQam9A-M2Dl0ZQO_0U0mOVts5vG4x3ELda0nFnUF0OV89V5yqJFNFZKIbBoHZ_vOr3Lc5TqalAy_LjqdovnqQ9vWwzjyvE/s1600/1086-poker-chips-playing-cards.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.dropbox.com/s/jwwhcskc8w7ofz8/constant%20round%20%20mental%20poker%207.pdf?dl=0&quot;&gt;SECURE AND PRACTICAL CONSTANT ROUND MENTAL POKER TZER-JEN WEI (2013)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.dropbox.com/s/de5c6rexo7ypju1/More%20improvement%202%20rev3.pdf?dl=0&quot;&gt;COMMUNICATION EFFICIENT SHUFFLE FOR MENTAL POKER PROTOCOLS TZER-JEN WEI&amp;nbsp; (2011)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;a href=&quot;https://www.dropbox.com/s/dz31pkiglne6m2b/Simple%20Efficient%20Protocol.ps?dl=0&quot;&gt;Fast Mental Poker (2010)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div data-angle=&quot;0&quot; data-canvas-width=&quot;114.11985327917063&quot; data-font-name=&quot;g_font_5_0&quot; dir=&quot;ltr&quot; style=&quot;font-family: sans-serif; font-size: 14.944px; left: 452.943px; top: 325.919px; transform-origin: 0% 0% 0px; transform: rotate(0deg) scale(1.25406, 1);&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div data-angle=&quot;0&quot; data-canvas-width=&quot;114.11985327917063&quot; data-font-name=&quot;g_font_5_0&quot; dir=&quot;ltr&quot; style=&quot;font-family: sans-serif; font-size: 14.944px; left: 452.943px; top: 325.919px; transform-origin: 0% 0% 0px; transform: rotate(0deg) scale(1.25406, 1);&quot;&gt;
Source code can be found at&amp;nbsp;&lt;a href=&quot;https://github.com/tjwei/mental_poker&quot;&gt;https://github.com/tjwei/mental_poker&lt;/a&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://weijr-eng.blogspot.com/feeds/1982061830176484420/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://weijr-eng.blogspot.com/2014/06/some-of-my-draft-papers-on-mental-poker.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7712898164041001720/posts/default/1982061830176484420'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7712898164041001720/posts/default/1982061830176484420'/><link rel='alternate' type='text/html' href='http://weijr-eng.blogspot.com/2014/06/some-of-my-draft-papers-on-mental-poker.html' title='Some of my draft papers on mental poker'/><author><name>tjwei</name><uri>http://www.blogger.com/profile/13263392105910479364</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg5sbz0pOkAfwHzPiJGPhudzNNde2DffSlg3l6ayU9o4LLCsRQam9A-M2Dl0ZQO_0U0mOVts5vG4x3ELda0nFnUF0OV89V5yqJFNFZKIbBoHZ_vOr3Lc5TqalAy_LjqdovnqQ9vWwzjyvE/s72-c/1086-poker-chips-playing-cards.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7712898164041001720.post-3056522281545974789</id><published>2013-12-22T01:33:00.002-08:00</published><updated>2013-12-22T01:33:32.283-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="programming"/><title type='text'>First you learn to code, then you code to learn</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj45Gy8NVDNMFQqtzedoYdvAqLqWm1bvyAXp3t8RVpyYQfvuea8BD3lN15vH5sWsnPXi0tOWm7FjoS-6eT1SkvcMqIdPNOBBpDaAf5_xW-eFT2Ret5CWMHicUgLSn75lqS1COt46_tWsGc/s1600/2013+-+1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj45Gy8NVDNMFQqtzedoYdvAqLqWm1bvyAXp3t8RVpyYQfvuea8BD3lN15vH5sWsnPXi0tOWm7FjoS-6eT1SkvcMqIdPNOBBpDaAf5_xW-eFT2Ret5CWMHicUgLSn75lqS1COt46_tWsGc/s640/2013+-+1.png&quot; width=&quot;452&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://weijr-eng.blogspot.com/feeds/3056522281545974789/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://weijr-eng.blogspot.com/2013/12/first-you-learn-to-code-then-you-code.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7712898164041001720/posts/default/3056522281545974789'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7712898164041001720/posts/default/3056522281545974789'/><link rel='alternate' type='text/html' href='http://weijr-eng.blogspot.com/2013/12/first-you-learn-to-code-then-you-code.html' title='First you learn to code, then you code to learn'/><author><name>tjwei</name><uri>http://www.blogger.com/profile/13263392105910479364</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj45Gy8NVDNMFQqtzedoYdvAqLqWm1bvyAXp3t8RVpyYQfvuea8BD3lN15vH5sWsnPXi0tOWm7FjoS-6eT1SkvcMqIdPNOBBpDaAf5_xW-eFT2Ret5CWMHicUgLSn75lqS1COt46_tWsGc/s72-c/2013+-+1.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7712898164041001720.post-3867981832266123086</id><published>2013-10-31T19:34:00.001-07:00</published><updated>2013-11-02T08:31:27.711-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="python"/><title type='text'>Great Python Challenge</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2Do7QbiZmcicVa1DofM6VQj0QDZnA9-JDkq-1mD9gRjOy8neHrg9C-tHJceJ28fN9fZ6yW8fTaWXMrnTDyKov9TDKl7ocUb2WEMRStU0zDyuho9qm-eLv-KO_7hVV0mehyphenhyphenQXwkHI2vtg/s1600/rect3301.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2Do7QbiZmcicVa1DofM6VQj0QDZnA9-JDkq-1mD9gRjOy8neHrg9C-tHJceJ28fN9fZ6yW8fTaWXMrnTDyKov9TDKl7ocUb2WEMRStU0zDyuho9qm-eLv-KO_7hVV0mehyphenhyphenQXwkHI2vtg/s320/rect3301.png&quot; width=&quot;195&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
Just like &quot;The Great Giraffe Challenge&quot;, let us take&amp;nbsp; the Great Python Challenge.&lt;br /&gt;
&lt;br /&gt;
The answer will be a piece of very short, one-liner like Python code. So it won&#39;t take too much of your time.&lt;br /&gt;
&lt;br /&gt;
As usual, if you failed, changed your profile to a python related picture until, say, you find out the answer.&lt;br /&gt;
&lt;br /&gt;
Are you ready?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;br /&gt;
Please write a simple http server in less than 40 characters of Python code.&lt;/blockquote&gt;
&lt;br /&gt;
&lt;br /&gt;
A server can only send &quot;Error Response&quot; or worse does not count. A server can only serve one request does not count. It has to be something like a SimpleHTTPServer at least.&lt;br /&gt;
You can use either standard CPython 2.x or 3.x. Only the standard library are allowed. &lt;br /&gt;
The solution should not rely on command line argument,&amp;nbsp; environment variable,&amp;nbsp;or similar technique to by pass the limit.&lt;br /&gt;
All you can use is CPython and it&#39;s standard library.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So, got your answer yet?&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
If you think you know Python, then chances are you can do that.&lt;br /&gt;
If your code contains exactly 40 characters, please try harder.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
But there are more,&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
Same as above, but please write it in less than 35 characters. &lt;/blockquote&gt;
&lt;br /&gt;
A bit more fun and challenging, right?&lt;br /&gt;
Can you do that?&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
But we are not done yet, now&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
Same as above, but please write it in less than&amp;nbsp; 30 characters.&lt;/blockquote&gt;
&lt;br /&gt;
I didn&#39;t find the last answer by myself without the help from friends, so I changed my facebook profile to the picture on the top of this post.&lt;br /&gt;
&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
If you can write a python web server in 29, 28 or even 25 characters, then very well done, good job.&lt;br /&gt;
We have one more task for you, &lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
Same as above, but please write it in less than&amp;nbsp; 25 characters.&lt;/blockquote&gt;
</content><link rel='replies' type='application/atom+xml' href='http://weijr-eng.blogspot.com/feeds/3867981832266123086/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://weijr-eng.blogspot.com/2013/10/great-python-challenge.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7712898164041001720/posts/default/3867981832266123086'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7712898164041001720/posts/default/3867981832266123086'/><link rel='alternate' type='text/html' href='http://weijr-eng.blogspot.com/2013/10/great-python-challenge.html' title='Great Python Challenge'/><author><name>tjwei</name><uri>http://www.blogger.com/profile/13263392105910479364</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2Do7QbiZmcicVa1DofM6VQj0QDZnA9-JDkq-1mD9gRjOy8neHrg9C-tHJceJ28fN9fZ6yW8fTaWXMrnTDyKov9TDKl7ocUb2WEMRStU0zDyuho9qm-eLv-KO_7hVV0mehyphenhyphenQXwkHI2vtg/s72-c/rect3301.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7712898164041001720.post-3398064376648796403</id><published>2013-04-24T22:50:00.000-07:00</published><updated>2013-04-24T22:50:00.977-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="go"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><title type='text'></title><content type='html'>The reflect package of Go 1.1 adds functions SliceOf, ChanOf，and MakeFunc.&lt;br /&gt;
With the help of these new functions, we can do things similar to Python&#39;s map, list, iterator comprehension, and decorator in Go.
 &lt;br /&gt;
The followings is a simple demonstration of functionality similar to Python&#39;s map function and list comprehension.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;script src=&quot;https://gist.github.com/anonymous/5457725.js&quot;&gt;&lt;/script&gt;</content><link rel='replies' type='application/atom+xml' href='http://weijr-eng.blogspot.com/feeds/3398064376648796403/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://weijr-eng.blogspot.com/2013/04/the-reflect-package-of-go-1.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7712898164041001720/posts/default/3398064376648796403'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7712898164041001720/posts/default/3398064376648796403'/><link rel='alternate' type='text/html' href='http://weijr-eng.blogspot.com/2013/04/the-reflect-package-of-go-1.html' title=''/><author><name>tjwei</name><uri>http://www.blogger.com/profile/13263392105910479364</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7712898164041001720.post-955121800167412179</id><published>2013-04-15T06:37:00.000-07:00</published><updated>2013-04-15T20:26:02.236-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="math"/><title type='text'>Math Proofs of Google Code Jam Qualification Round 2013 Problems</title><content type='html'>&lt;script type=&quot;text/x-mathjax-config&quot;&gt;
     MathJax.Hub.Config({
       styles: {
      &quot;.MathJax_Preview&quot;: {
           color: &quot;#FFFFFF&quot;
         },
         &quot;.MathJax&quot;: {
           color: &quot;#FFFFFF&quot;
         },
       &quot;.MathJax_SVG svg &gt; g, .MathJax_SVG_Display svg &gt; g&quot;: {
      fill: &quot;#FFF&quot;,
      stroke: &quot;#FFF&quot;
       }

       }
     });
&lt;/script&gt;
&lt;style&gt;
.Proof {
  background : #222222;
}
.Theorem {
 background : #000022;
}
.Corollary {
 background : #001111;
}
&lt;/style&gt;
&lt;script src=&quot;http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML&quot; type=&quot;text/javascript&quot;&gt;
&lt;/script&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhK5sW2ZYJsUWNOyqVTGeXvh1vEAuGpU6qpBYRNiBCnxirQdOPtLBDUsYijgzDNfZJGy2HiYMgDTbjEsLm8dX_guLm8w0VY_VGWQBMyrkCQ-vygpM2LzNq9oEmuGclR7a6idpJ8zdnBU6c/s1600/google-codejam-2013.jpg&quot; imageanchor=&quot;1&quot; &gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhK5sW2ZYJsUWNOyqVTGeXvh1vEAuGpU6qpBYRNiBCnxirQdOPtLBDUsYijgzDNfZJGy2HiYMgDTbjEsLm8dX_guLm8w0VY_VGWQBMyrkCQ-vygpM2LzNq9oEmuGclR7a6idpJ8zdnBU6c/s320/google-codejam-2013.jpg&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
Problems of Google Code Jam Qualification Round 2013 can be found at &lt;a href=&quot;http://code.google.com/codejam/contest/2270488/dashboard&quot;&gt;http://code.google.com/codejam/contest/2270488/dashboard&lt;/a&gt;

&lt;div id=&quot;globalWrapper&quot;&gt;
&lt;script type=&quot;math/tex&quot;&gt;
\newcommand{\lyxlock}{}
&lt;/script&gt;
&lt;noscript&gt;
&lt;div class=&quot;warning&quot;&gt;
Warning: &lt;a href=&quot;http://www.mathjax.org/&quot;&gt;MathJax&lt;/a&gt; requires JavaScript to correctly process the mathematics on this page. Please enable JavaScript on your browser.
&lt;/div&gt;&lt;hr/&gt;
&lt;/noscript&gt;
&lt;h1 class=&quot;Section&quot;&gt;
&lt;a class=&quot;toc&quot; name=&quot;toc-Section-1&quot;&gt;1&lt;/a&gt; Problem A. Tic-Tac-Toe-Tomek
&lt;/h1&gt;
&lt;div class=&quot;Unindented&quot;&gt;
No math involved, but complex number is builtin in python and go, so I use &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
0,i,1,-1
&lt;/script&gt;
&lt;/span&gt; to represent &amp;ldquo; &amp;ldquo;, T, O, X. So if&lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
\left\Vert \sum_{i=1}^{4}a_{i,i}\right\Vert &gt;3
&lt;/script&gt;
&lt;/span&gt;, then some one won. &lt;br/&gt;
&lt;br/&gt;

&lt;/div&gt;
&lt;h1 class=&quot;Section&quot;&gt;
&lt;a class=&quot;toc&quot; name=&quot;toc-Section-2&quot;&gt;2&lt;/a&gt; Problem B. Lawnmower
&lt;/h1&gt;
&lt;div class=&quot;Theorem&quot;&gt;
&lt;b&gt;Theorem.&lt;/b&gt;&lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
\left(a_{i,j}\right)
&lt;/script&gt;
&lt;/span&gt; is a possible pattern if &lt;span class=&quot;MathJax_Preview&quot;&gt;
&lt;script type=&quot;math/tex;mode=display&quot;&gt;

a_{i,j}=\min\left(\max\left(\left\{ a_{i,k}\right\} \right),\max\left(\left\{ a_{k,j}\right\} \right)\right)

&lt;/script&gt;

&lt;/span&gt;
 for every &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
i,j
&lt;/script&gt;
&lt;/span&gt;.
&lt;/div&gt;
&lt;div class=&quot;Proof&quot;&gt;
&lt;b&gt;Proof.&lt;/b&gt; 
&lt;/div&gt;
&lt;div class=&quot;Proof&quot;&gt;
Can be easily proved by induction on &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
N=\sum_{i,j}M-a_{i,j}
&lt;/script&gt;
&lt;/span&gt;, where &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
M=\max\left(\left\{ a_{i,j}\right\} \right)
&lt;/script&gt;
&lt;/span&gt;.
&lt;/div&gt;
&lt;div class=&quot;Unindented&quot;&gt;
         
&lt;/div&gt;
&lt;div class=&quot;Indented&quot;&gt;
     
&lt;/div&gt;
&lt;h1 class=&quot;Section&quot;&gt;
&lt;a class=&quot;toc&quot; name=&quot;toc-Section-3&quot;&gt;3&lt;/a&gt; Problem C. Fair and Square
&lt;/h1&gt;
&lt;div class=&quot;Unindented&quot;&gt;
Let &lt;span class=&quot;MathJax_Preview&quot;&gt;
&lt;script type=&quot;math/tex;mode=display&quot;&gt;

N=a_{n}10^{n}+a_{n-1}10^{n-1}+\cdots+a_{1}10+a_{0}

&lt;/script&gt;

&lt;/span&gt;
, where &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
a_{i}\in\left\{ 0,1,\ldots9\right\} 
&lt;/script&gt;
&lt;/span&gt; and &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
a_{n}\neq0
&lt;/script&gt;
&lt;/span&gt;. Denote by &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
\delta_{k}\left(x\right)
&lt;/script&gt;
&lt;/span&gt; the &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
\left(n-k+1\right)
&lt;/script&gt;
&lt;/span&gt;-th digit of &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
x
&lt;/script&gt;
&lt;/span&gt;, then we have &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
\delta_{k}\left(x\right)=a_{k}
&lt;/script&gt;
&lt;/span&gt;. 
&lt;/div&gt;
&lt;div class=&quot;Indented&quot;&gt;
Assume &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
N
&lt;/script&gt;
&lt;/span&gt; is a palindrome, i.e., &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
a_{i}=a_{n-1}
&lt;/script&gt;
&lt;/span&gt; for every &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
i
&lt;/script&gt;
&lt;/span&gt; .
&lt;/div&gt;
&lt;div class=&quot;Indented&quot;&gt;
Let &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
b_{k}
&lt;/script&gt;
&lt;/span&gt; be the coefficient of &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
x^{k}
&lt;/script&gt;
&lt;/span&gt; of &lt;span class=&quot;MathJax_Preview&quot;&gt;
&lt;script type=&quot;math/tex;mode=display&quot;&gt;

\left(a_{n}x^{n}+a_{n-1}x^{n-1}+\cdots+a_{1}+a_{0}\right)^{2},

&lt;/script&gt;

&lt;/span&gt;
 that is, &lt;span class=&quot;MathJax_Preview&quot;&gt;
&lt;script type=&quot;math/tex;mode=display&quot;&gt;

b_{k}=\sum_{i=\max\left(0,k-n\right)}^{\min\left(k,n\right)}a_{i}a_{k-i}.

&lt;/script&gt;

&lt;/span&gt;
&lt;br/&gt;
&lt;br/&gt;

&lt;/div&gt;
&lt;div class=&quot;Theorem&quot;&gt;
&lt;b&gt;Theorem.&lt;/b&gt; &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
N^{2}
&lt;/script&gt;
&lt;/span&gt; is also a palindrome iff &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
b_{k}\leq9
&lt;/script&gt;
&lt;/span&gt; for all &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
k
&lt;/script&gt;
&lt;/span&gt;.
&lt;/div&gt;
&lt;div class=&quot;Proof&quot;&gt;
&lt;b&gt;Proof.&lt;/b&gt;
&lt;/div&gt;
&lt;div class=&quot;Proof&quot;&gt;
(&lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
\Leftarrow
&lt;/script&gt;
&lt;/span&gt;)
&lt;/div&gt;
&lt;div class=&quot;Proof&quot;&gt;
Trivial. 
&lt;/div&gt;
&lt;div class=&quot;Proof&quot;&gt;
(&lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
\Rightarrow
&lt;/script&gt;
&lt;/span&gt;)
&lt;/div&gt;
&lt;div class=&quot;Proof&quot;&gt;
Observe that &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
b_{k}=b_{2n-k}
&lt;/script&gt;
&lt;/span&gt; for all &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
k
&lt;/script&gt;
&lt;/span&gt;. We prove the statement by mathematical induction on &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
k
&lt;/script&gt;
&lt;/span&gt; for &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
k\leq n
&lt;/script&gt;
&lt;/span&gt;.
&lt;/div&gt;
&lt;div class=&quot;Proof&quot;&gt;
Case &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
k=0
&lt;/script&gt;
&lt;/span&gt;:
&lt;/div&gt;
&lt;div class=&quot;Proof&quot;&gt;
Since &lt;span class=&quot;MathJax_Preview&quot;&gt;
&lt;script type=&quot;math/tex;mode=display&quot;&gt;

a_{n}^{2}10^{2n}\leq N^{2}&lt;\left(a_{n}+1\right)^{2}10^{2n}

&lt;/script&gt;

&lt;/span&gt;
 and &lt;span class=&quot;MathJax_Preview&quot;&gt;
&lt;script type=&quot;math/tex;mode=display&quot;&gt;

\delta_{0}\left(N^{2}\right)=\delta_{0}\left(a_{0}^{2}\right)=\delta_{0}\left(a_{n}^{2}\right),

&lt;/script&gt;

&lt;/span&gt;
it is easy to see that &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
a_{0}=a_{n}\in\left\{ 1,2,3\right\} 
&lt;/script&gt;
&lt;/span&gt;. So &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
b_{0}=a_{0}^{2}\leq9
&lt;/script&gt;
&lt;/span&gt;.
&lt;/div&gt;
&lt;div class=&quot;Proof&quot;&gt;
Moreover, we also know that &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
N^{2}
&lt;/script&gt;
&lt;/span&gt; has &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
2n+1
&lt;/script&gt;
&lt;/span&gt; digits and hence &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
\delta_{2n-k}\left(N^{2}\right)=\delta_{k}\left(N^{2}\right)
&lt;/script&gt;
&lt;/span&gt; for all &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
k\leq2n
&lt;/script&gt;
&lt;/span&gt;. 
&lt;/div&gt;
&lt;div class=&quot;Proof&quot;&gt;
Case &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
k&gt;0
&lt;/script&gt;
&lt;/span&gt;:
&lt;/div&gt;
&lt;div class=&quot;Proof&quot;&gt;
Suppose &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
b_{i}\leq9
&lt;/script&gt;
&lt;/span&gt; for all &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
i&lt;k
&lt;/script&gt;
&lt;/span&gt;, we want to show &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
b_{k}\leq9
&lt;/script&gt;
&lt;/span&gt;. 
&lt;/div&gt;
&lt;div class=&quot;Proof&quot;&gt;
By the induction hypothesis, we know that &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
\delta_{2n-i}\left(N^{2}\right)=\delta_{i}\left(N^{2}\right)=b_{i}=b_{2n-i}
&lt;/script&gt;
&lt;/span&gt; for all &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
i&lt;k
&lt;/script&gt;
&lt;/span&gt;. So
&lt;/div&gt;
&lt;div class=&quot;Proof&quot;&gt;
&lt;span class=&quot;MathJax_Preview&quot;&gt;
&lt;script type=&quot;math/tex;mode=display&quot;&gt;
\begin{eqnarray*}
10^{2n-k-1}\cdot\left\lfloor \frac{N^{2}}{10^{2n-k-1}}\right\rfloor  &amp; = &amp; \sum_{i=2n-k-1}^{2n}\delta_{i}\left(N^{2}\right)10^{i}\\
 &amp; = &amp; \sum_{i=2n-k-1}^{2n}b_{i}10^{i}
\end{eqnarray*}
&lt;/script&gt;

&lt;/span&gt;

&lt;/div&gt;
&lt;div class=&quot;Proof&quot;&gt;
On the other hand, &lt;span class=&quot;MathJax_Preview&quot;&gt;
&lt;script type=&quot;math/tex;mode=display&quot;&gt;
\begin{eqnarray*}
\left\lfloor \frac{N^{2}}{10^{2n-k-1}}\right\rfloor  &amp; = &amp; \left\lfloor \frac{\sum_{i=0}^{2n}b_{i}10^{i}}{10^{2n-k-1}}\right\rfloor \\
 &amp; = &amp; \frac{\sum_{i=2n-k-1}^{2n}b_{i}10^{i}}{10^{2n-k-1}}+\left\lfloor \frac{\sum_{i=0}^{2n-k}b_{i}10^{i}}{10^{2n-k-1}}\right\rfloor .
\end{eqnarray*}
&lt;/script&gt;

&lt;/span&gt;
Therefore, &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
\left\lfloor \frac{\sum_{i=0}^{2n-k}b_{i}10^{i}}{10^{2n-k-1}}\right\rfloor =0
&lt;/script&gt;
&lt;/span&gt;, hence &lt;span class=&quot;MathJax_Preview&quot;&gt;
&lt;script type=&quot;math/tex;mode=display&quot;&gt;

b_{k}=b_{2n-k}\leq\frac{\sum_{i=0}^{2n-k}b_{i}10^{i}}{10^{2n-k}}&lt;10.

&lt;/script&gt;

&lt;/span&gt;

&lt;/div&gt;
&lt;div class=&quot;Unindented&quot;&gt;
  
&lt;/div&gt;
&lt;div class=&quot;Indented&quot;&gt;
  
&lt;/div&gt;
&lt;div class=&quot;Corollary&quot;&gt;
&lt;b&gt;Corollary.&lt;/b&gt; &lt;a class=&quot;Label&quot; name=&quot;cor:.l9&quot;&gt; &lt;/a&gt;&lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
N^{2}
&lt;/script&gt;
&lt;/span&gt; is also a palindrome iff &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
\sum_{i=0}^{n}a_{i}^{2}\leq9
&lt;/script&gt;
&lt;/span&gt;.
&lt;/div&gt;
&lt;div class=&quot;Proof&quot;&gt;
&lt;b&gt;Proof.&lt;/b&gt; 
&lt;/div&gt;
&lt;div class=&quot;Proof&quot;&gt;
&lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
b_{n}=\sum_{i=0}^{n}a_{i}a_{n-i}=\sum_{i=0}^{n}a_{i}^{2}
&lt;/script&gt;
&lt;/span&gt;. 
&lt;/div&gt;
&lt;div class=&quot;Proof&quot;&gt;
(&lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
\Leftarrow
&lt;/script&gt;
&lt;/span&gt;)
&lt;/div&gt;
&lt;div class=&quot;Proof&quot;&gt;
&lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
b_{n}\geq b_{k}
&lt;/script&gt;
&lt;/span&gt; for every &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
k
&lt;/script&gt;
&lt;/span&gt; by Cauchy-Schwarz inequility.
&lt;/div&gt;
&lt;div class=&quot;Proof&quot;&gt;
(&lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
\Rightarrow
&lt;/script&gt;
&lt;/span&gt;)
&lt;/div&gt;
&lt;div class=&quot;Proof&quot;&gt;
Trivial. 
&lt;/div&gt;
&lt;div class=&quot;Unindented&quot;&gt;

&lt;/div&gt;
&lt;div class=&quot;Indented&quot;&gt;
In particular, if &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
N\neq3
&lt;/script&gt;
&lt;/span&gt;, then &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
a_{i}\in\left\{ 0,1,2\right\} 
&lt;/script&gt;
&lt;/span&gt;.&lt;br/&gt;

&lt;/div&gt;
&lt;h1 class=&quot;Section&quot;&gt;
&lt;a class=&quot;toc&quot; name=&quot;toc-Section-4&quot;&gt;4&lt;/a&gt; Problem D. Treasure
&lt;/h1&gt;
&lt;div class=&quot;Unindented&quot;&gt;
Let &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
T\subseteq\mathbb{N}
&lt;/script&gt;
&lt;/span&gt; be the set of all key types. Assume &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
0\notin T
&lt;/script&gt;
&lt;/span&gt;. 
&lt;/div&gt;
&lt;div class=&quot;Indented&quot;&gt;
Construct a directed graph &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
G=\left(V,E\right)
&lt;/script&gt;
&lt;/span&gt; as following:
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
V=T\cup\left\{ 0\right\} 
&lt;/script&gt;
&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
\left(0,j\right)\in E
&lt;/script&gt;
&lt;/span&gt; iff we starts with at least one key of type &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
j
&lt;/script&gt;
&lt;/span&gt;.
&lt;/li&gt;
&lt;li&gt;
If &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
i\neq0
&lt;/script&gt;
&lt;/span&gt;, then &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
\left(i,j\right)\in E
&lt;/script&gt;
&lt;/span&gt; iff there is a key of type &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
j
&lt;/script&gt;
&lt;/span&gt; in a box of type &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
i
&lt;/script&gt;
&lt;/span&gt;.&lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
b_{n}\geq b_{k}
&lt;/script&gt;
&lt;/span&gt; for every palidrone &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
N
&lt;/script&gt;
&lt;/span&gt; by Cauchy-Schwarz inequility.
&lt;/li&gt;

&lt;/ul&gt;
&lt;div class=&quot;Unindented&quot;&gt;
Denote by &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
B\left(i\right)
&lt;/script&gt;
&lt;/span&gt; the number of boxes of type &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
i
&lt;/script&gt;
&lt;/span&gt; and &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
K\left(i\right)
&lt;/script&gt;
&lt;/span&gt;the total number of keys of type &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
i
&lt;/script&gt;
&lt;/span&gt; (including the keys you start with and keys in boxes).&lt;br/&gt;
&lt;br/&gt;

&lt;/div&gt;
&lt;div class=&quot;Theorem&quot;&gt;
&lt;b&gt;Theorem.&lt;/b&gt; All box can be opened iff for every &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
j\in T
&lt;/script&gt;
&lt;/span&gt;, &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
B\left(j\right)\leq K\left(j\right)
&lt;/script&gt;
&lt;/span&gt; and there is a directed path from &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
0
&lt;/script&gt;
&lt;/span&gt; to &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
j
&lt;/script&gt;
&lt;/span&gt; in graph &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
G
&lt;/script&gt;
&lt;/span&gt;.
&lt;/div&gt;
&lt;div class=&quot;Proof&quot;&gt;
&lt;b&gt;Proof.&lt;/b&gt; 
&lt;/div&gt;
&lt;div class=&quot;Proof&quot;&gt;
(&lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
\Rightarrow
&lt;/script&gt;
&lt;/span&gt;)
&lt;/div&gt;
&lt;div class=&quot;Proof&quot;&gt;
If &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
B\left(j\right)&gt;K\left(j\right)
&lt;/script&gt;
&lt;/span&gt;, then we don’t have enough keys of type &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
j
&lt;/script&gt;
&lt;/span&gt; to open all boxes of type &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
j
&lt;/script&gt;
&lt;/span&gt;. 
&lt;/div&gt;
&lt;div class=&quot;Proof&quot;&gt;
If there is no path from &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
0
&lt;/script&gt;
&lt;/span&gt; to &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
j
&lt;/script&gt;
&lt;/span&gt;, then it means we are unable to get any key of type &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
j
&lt;/script&gt;
&lt;/span&gt;. 
&lt;/div&gt;
&lt;div class=&quot;Proof&quot;&gt;
(&lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
\Leftarrow
&lt;/script&gt;
&lt;/span&gt;)
&lt;/div&gt;
&lt;div class=&quot;Proof&quot;&gt;
We prove this by induction on the number of boxes. Denote by &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
N
&lt;/script&gt;
&lt;/span&gt; the number of boxes.
&lt;/div&gt;
&lt;div class=&quot;Proof&quot;&gt;
Assume for every &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
j\in T
&lt;/script&gt;
&lt;/span&gt;, &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
B\left(j\right)\leq K\left(j\right)
&lt;/script&gt;
&lt;/span&gt; and there is a directed path from &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
0
&lt;/script&gt;
&lt;/span&gt; to &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
j
&lt;/script&gt;
&lt;/span&gt; in graph &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
G
&lt;/script&gt;
&lt;/span&gt;.
&lt;/div&gt;
&lt;div class=&quot;Proof&quot;&gt;
Case &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
N=1
&lt;/script&gt;
&lt;/span&gt;:
&lt;/div&gt;
&lt;div class=&quot;Proof&quot;&gt;
Then all vertices in &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
G
&lt;/script&gt;
&lt;/span&gt; are leaves except &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
0
&lt;/script&gt;
&lt;/span&gt; and the type of the only box. So there must be an edge from 0 to the type of the box.
&lt;/div&gt;
&lt;div class=&quot;Proof&quot;&gt;
Case &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
N&gt;1
&lt;/script&gt;
&lt;/span&gt;:
&lt;/div&gt;
&lt;div class=&quot;Proof&quot;&gt;
Suppose the theorem holds for the case with &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
N-1
&lt;/script&gt;
&lt;/span&gt; boxes.
&lt;/div&gt;
&lt;div class=&quot;Proof&quot;&gt;
There are at least one &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
\left(0,i\right)\in E
&lt;/script&gt;
&lt;/span&gt;. Consider we open a box of type &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
i
&lt;/script&gt;
&lt;/span&gt; (that contains a key of type &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
i
&lt;/script&gt;
&lt;/span&gt; if possible). Assume we destroy the key and the box just opened, then we have a setting of &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
N-1
&lt;/script&gt;
&lt;/span&gt; boxes. In this setting, we still have &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
B\left(j\right)\leq K\left(j\right)
&lt;/script&gt;
&lt;/span&gt; for all &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
j
&lt;/script&gt;
&lt;/span&gt;. Let &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
G&#39;=\left(V&#39;,E&#39;\right)
&lt;/script&gt;
&lt;/span&gt; be the directed graph of this &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
\left(N-1\right)
&lt;/script&gt;
&lt;/span&gt;-box setting.
&lt;/div&gt;
&lt;div class=&quot;Proof&quot;&gt;
If &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
B\left(i\right)=1
&lt;/script&gt;
&lt;/span&gt;, then all children of &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
j
&lt;/script&gt;
&lt;/span&gt; in &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
G
&lt;/script&gt;
&lt;/span&gt; become children of &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
0
&lt;/script&gt;
&lt;/span&gt;, &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
0
&lt;/script&gt;
&lt;/span&gt; can still reach all other types in &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
G&#39;
&lt;/script&gt;
&lt;/span&gt;. 
&lt;/div&gt;
&lt;div class=&quot;Proof&quot;&gt;
Assume &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
B\left(i\right)&gt;1
&lt;/script&gt;
&lt;/span&gt;. 
&lt;/div&gt;
&lt;div class=&quot;Proof&quot;&gt;
If &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
\left(i,i\right)\in E
&lt;/script&gt;
&lt;/span&gt;, then we can open a box of type &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
i
&lt;/script&gt;
&lt;/span&gt; that contains a key of type &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
i
&lt;/script&gt;
&lt;/span&gt;.
&lt;/div&gt;
&lt;div class=&quot;Proof&quot;&gt;
Otherwise, because &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
K\left(i\right)\geq B\left(i\right)&gt;1
&lt;/script&gt;
&lt;/span&gt;, we still hold at least one key of type &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
i
&lt;/script&gt;
&lt;/span&gt; after we open a box of type &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
i
&lt;/script&gt;
&lt;/span&gt; (and destroy the key). 
&lt;/div&gt;
&lt;div class=&quot;Proof&quot;&gt;
Either way, &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
\left(0,i\right)\in E&#39;
&lt;/script&gt;
&lt;/span&gt;. Therefore, for every child &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
j
&lt;/script&gt;
&lt;/span&gt; of &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
i
&lt;/script&gt;
&lt;/span&gt; in &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
G
&lt;/script&gt;
&lt;/span&gt;, either 
&lt;/div&gt;
&lt;div class=&quot;Proof&quot;&gt;
1. &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
\left(0,j\right)\in E&#39;
&lt;/script&gt;
&lt;/span&gt; (if a key of type &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
j
&lt;/script&gt;
&lt;/span&gt; is in the box we just opened), or 
&lt;/div&gt;
&lt;div class=&quot;Proof&quot;&gt;
2. &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
\left(i,j\right)\in E&#39;
&lt;/script&gt;
&lt;/span&gt; and so there is a path from &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
0
&lt;/script&gt;
&lt;/span&gt; to &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
i
&lt;/script&gt;
&lt;/span&gt; and then to &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
j
&lt;/script&gt;
&lt;/span&gt;. 
&lt;/div&gt;
&lt;div class=&quot;Proof&quot;&gt;
So &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
0
&lt;/script&gt;
&lt;/span&gt; can still reach very vertex in &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
G&#39;
&lt;/script&gt;
&lt;/span&gt;.
&lt;/div&gt;
&lt;div class=&quot;Proof&quot;&gt;
By induction hypothesis, the remaining &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
N-1
&lt;/script&gt;
&lt;/span&gt; can also be opened. 
&lt;/div&gt;
&lt;div class=&quot;Unindented&quot;&gt;
  
&lt;/div&gt;
&lt;div class=&quot;Indented&quot;&gt;
  
&lt;/div&gt;
&lt;div class=&quot;Indented&quot;&gt;
By the proof of the theorem, there is a simple algorithm to open all boxes: open any box unless you have just one key of that type and box does not contain a key that can open itself.
&lt;/div&gt;
&lt;div class=&quot;Indented&quot;&gt;
However, this algorithm may not yield a &quot;lexicographically smallest&quot; way to open the boxes.
&lt;/div&gt;
&lt;div class=&quot;Indented&quot;&gt;
The solve the problem, you should open the box with smallest number such that either this box is the last one of type &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
i
&lt;/script&gt;
&lt;/span&gt; or there is still a way to get a type &lt;span class=&quot;MathJax_Preview&quot;&gt;&lt;script type=&quot;math/tex&quot;&gt;
i
&lt;/script&gt;
&lt;/span&gt; key. 
&lt;/div&gt;

&lt;hr class=&quot;footer&quot;/&gt;
&lt;div class=&quot;footer&quot; id=&quot;generated-by&quot;&gt;
Document generated by &lt;a href=&quot;http://elyxer.nongnu.org/&quot;&gt;eLyXer 1.2.5 (2013-03-10)&lt;/a&gt; on &lt;span class=&quot;create-date&quot;&gt;2013-04-16T11:23:46.409386&lt;/span&gt;
&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://weijr-eng.blogspot.com/feeds/955121800167412179/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://weijr-eng.blogspot.com/2013/04/math-of-google-code-jam-qualification.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7712898164041001720/posts/default/955121800167412179'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7712898164041001720/posts/default/955121800167412179'/><link rel='alternate' type='text/html' href='http://weijr-eng.blogspot.com/2013/04/math-of-google-code-jam-qualification.html' title='Math Proofs of Google Code Jam Qualification Round 2013 Problems'/><author><name>tjwei</name><uri>http://www.blogger.com/profile/13263392105910479364</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhK5sW2ZYJsUWNOyqVTGeXvh1vEAuGpU6qpBYRNiBCnxirQdOPtLBDUsYijgzDNfZJGy2HiYMgDTbjEsLm8dX_guLm8w0VY_VGWQBMyrkCQ-vygpM2LzNq9oEmuGclR7a6idpJ8zdnBU6c/s72-c/google-codejam-2013.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7712898164041001720.post-2227772580316666837</id><published>2013-03-19T09:17:00.000-07:00</published><updated>2013-03-19T09:19:10.521-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="blender"/><title type='text'>Py Girl 3rd try</title><content type='html'>Py Girl&amp;nbsp; &lt;span class=&quot;st&quot;&gt;impersonate &lt;/span&gt;(or perhaps it counts as cosplay) Haruhi Suzumiya.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgkXniwSYXWLO5KzHCMBOsYJK-a_VjP7_Zhs7Ubm1v-pmGuy4ZaUQRqhpnxOsCtIeKHZIroMJMlPS1bwICmD76NyYrLyEgxe4d3poMMsgmjgJ6G1eYogxbBSFOA2z5NZvIo7ZyRQhCM7Dg/s1600/pygirl-editor3.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgkXniwSYXWLO5KzHCMBOsYJK-a_VjP7_Zhs7Ubm1v-pmGuy4ZaUQRqhpnxOsCtIeKHZIroMJMlPS1bwICmD76NyYrLyEgxe4d3poMMsgmjgJ6G1eYogxbBSFOA2z5NZvIo7ZyRQhCM7Dg/s1600/pygirl-editor3.png&quot; height=&quot;640&quot; width=&quot;441&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&amp;nbsp;Anime style.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRTuja5HbnRX3mAO2U5XMMtYfGSomzsp1ZJ2q-aX7EAo9KlCehpJ0j-TIFaA7wYVdiQGXvVy8vTRtym9SdEl4ssUWdjW1d7uh-HgGoQsrMi3f-nT4w9oEddEROmIcnb02Qvt23-JIAggg/s1600/pygirl-editor-bw.png&quot; height=&quot;640&quot; style=&quot;margin-left: auto; margin-right: auto;&quot; width=&quot;441&quot; /&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Black white manga style.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgYYd_KUzCY_97LdcAUb4Ct-ARCvAe4Tc4Z9Pbs8c263ygZkroBhXpwQ3gs0NCZyBo5X7-WJmufOyzd1CuwAMAfaQQviquHUj_JX79kVBgAvWqhJB_9ThdrZzsn0UJlx-4qkljHjGGn43c/s1600/pygirl-editor.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgYYd_KUzCY_97LdcAUb4Ct-ARCvAe4Tc4Z9Pbs8c263ygZkroBhXpwQ3gs0NCZyBo5X7-WJmufOyzd1CuwAMAfaQQviquHUj_JX79kVBgAvWqhJB_9ThdrZzsn0UJlx-4qkljHjGGn43c/s1600/pygirl-editor.png&quot; height=&quot;360&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Blender renderd and edited in gimp&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://weijr-eng.blogspot.com/feeds/2227772580316666837/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://weijr-eng.blogspot.com/2013/03/py-girl-3rd-try.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7712898164041001720/posts/default/2227772580316666837'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7712898164041001720/posts/default/2227772580316666837'/><link rel='alternate' type='text/html' href='http://weijr-eng.blogspot.com/2013/03/py-girl-3rd-try.html' title='Py Girl 3rd try'/><author><name>tjwei</name><uri>http://www.blogger.com/profile/13263392105910479364</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgkXniwSYXWLO5KzHCMBOsYJK-a_VjP7_Zhs7Ubm1v-pmGuy4ZaUQRqhpnxOsCtIeKHZIroMJMlPS1bwICmD76NyYrLyEgxe4d3poMMsgmjgJ6G1eYogxbBSFOA2z5NZvIo7ZyRQhCM7Dg/s72-c/pygirl-editor3.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7712898164041001720.post-7601952960068347127</id><published>2013-03-12T22:40:00.000-07:00</published><updated>2013-03-12T22:41:46.556-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="haskell"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><title type='text'>Project Euler Problem 198</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhg3D9eCjk2LAEo0KAgVvcKBRIULitJ5Pb08uqzAneEMy-5H6zH00irIalgDAH0y1Z5RHLsa2ppAAL0sp2xN4KLN9dp_rshzcaMTys3QDrDKHdvr0oKSDE-nv60TZsuJb2YIp-67p8glgY/s1600/euler_portrait.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhg3D9eCjk2LAEo0KAgVvcKBRIULitJ5Pb08uqzAneEMy-5H6zH00irIalgDAH0y1Z5RHLsa2ppAAL0sp2xN4KLN9dp_rshzcaMTys3QDrDKHdvr0oKSDE-nv60TZsuJb2YIp-67p8glgY/s400/euler_portrait.png&quot; width=&quot;329&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;a href=&quot;http://weijr-note.blogspot.tw/2008/06/project-euler-198.html&quot;&gt;Original post in Chinese: 2008/06/project-euler-198.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Project Euler &lt;a href=&quot;http://projecteuler.net/index.php?section=problems&amp;amp;id=198&quot;&gt; Problem 198&lt;/a&gt; asek you to find all ambiguous numbers between 0~0.01 with denominator no more than  10^8, where by definition,  a real number x ambiguous, if there is at least one denominator bound m for which x possesses two best rational approximations.  For example, let x=9/40 and m=6, then 1/5 and 1/4 are both best rational approximation of x with denominator no more than 6. Clearly, an ambiguous number is necessarily rational.&lt;br /&gt;
This seems to be difficult if you don&#39;t have certain number theory background knowledge. On the other hand, if you do have the certain knowledge, you may think 10^8 is kind of too small for a Euler project problem. IIRC, you can find a nice algorithm in Knuth&#39;s The Art of Computer Programming.&lt;br /&gt;
However, it is pretty straightforward to solve it by recursion using Haskell:&lt;br /&gt;
&lt;blockquote&gt;
&lt;br /&gt;
&lt;pre style=&quot;display: block;&quot;&gt;&lt;pre style=&quot;background: #000; display: block;&quot;&gt;f a b l m | a*b&amp;gt;l || &lt;span style=&quot;color: #226622;&quot;&gt;(&lt;/span&gt;a==&lt;span style=&quot;color: #cc0000;&quot;&gt;1&lt;/span&gt; &amp;amp;&amp;amp; b &amp;gt; m&lt;span style=&quot;color: #226622;&quot;&gt;)&lt;/span&gt;  = &lt;span style=&quot;color: #cc0000;&quot;&gt;0&lt;/span&gt;
         | otherwise = &lt;span style=&quot;color: #226622;&quot;&gt;(&lt;/span&gt;f a c l m&lt;span style=&quot;color: #226622;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;+1&lt;/span&gt;+&lt;span style=&quot;color: #226622;&quot;&gt;(&lt;/span&gt;f c b l m&lt;span style=&quot;color: #226622;&quot;&gt;)&lt;/span&gt; where c=a+b
main = putStrLn $ show result
      where result= &lt;span style=&quot;color: #226622;&quot;&gt;(&lt;/span&gt;f &lt;span style=&quot;color: #cc0000;&quot;&gt;1&lt;/span&gt; &lt;span style=&quot;color: #cc0000;&quot;&gt;100&lt;/span&gt; l2 m&lt;span style=&quot;color: #226622;&quot;&gt;)&lt;/span&gt; + &lt;span style=&quot;color: #cc0000;&quot;&gt;49&lt;/span&gt;+l2-m
      l = &lt;span style=&quot;color: #cc0000;&quot;&gt;10&lt;/span&gt;^&lt;span style=&quot;color: #cc0000;&quot;&gt;8&lt;/span&gt;
      l2 = l `div` &lt;span style=&quot;color: #cc0000;&quot;&gt;2&lt;/span&gt;
      m = floor &lt;span style=&quot;color: #226622;&quot;&gt;(&lt;/span&gt;sqrt &lt;span style=&quot;color: #226622;&quot;&gt;(&lt;/span&gt;fromIntegral l2&lt;span style=&quot;color: #226622;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #226622;&quot;&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;span style=&quot;color: #226622;&quot;&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/blockquote&gt;
As easy as 7 lines of code, yet the code is a pretty straightforward translation of the mathematics behind it. 
However, using Python to solve it is a totally different story. The above recursion exceeds the limit of numbers of function calls in python. The following is a loop based solution: &lt;br /&gt;
&lt;pre style=&quot;background: #000; display: block;&quot;&gt;&lt;blockquote&gt;
&lt;pre class=&quot;javascript&quot; style=&quot;display: block;&quot;&gt;&lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;&lt;/span&gt;
def p198&lt;span style=&quot;color: #226622;&quot;&gt;(&lt;/span&gt;M=&lt;span style=&quot;color: #cc0000;&quot;&gt;10&lt;/span&gt;**&lt;span style=&quot;color: #cc0000;&quot;&gt;8&lt;/span&gt;, z=&lt;span style=&quot;color: #cc0000;&quot;&gt;100&lt;/span&gt;, cnt=&lt;span style=&quot;color: #cc0000;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #226622;&quot;&gt;)&lt;/span&gt;:
 M2=M/&lt;span style=&quot;color: #cc0000;&quot;&gt;2&lt;/span&gt;
 a=m=int&lt;span style=&quot;color: #226622;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #226622;&quot;&gt;&lt;/span&gt;M2&lt;span style=&quot;color: #226622;&quot;&gt;&lt;/span&gt;**&lt;span style=&quot;color: #cc0000;&quot;&gt;0.5&lt;/span&gt;&lt;span style=&quot;color: #226622;&quot;&gt;)&lt;/span&gt;
 stack=range&lt;span style=&quot;color: #226622;&quot;&gt;(&lt;/span&gt;z,m&lt;span style=&quot;color: #226622;&quot;&gt;)&lt;/span&gt;
 &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;while&lt;/span&gt; stack:
     b=stack&lt;span style=&quot;color: #226622;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;-1&lt;/span&gt;&lt;span style=&quot;color: #226622;&quot;&gt;]&lt;/span&gt;
     &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;if&lt;/span&gt; a*b&amp;gt;M2:
         a=stack.&lt;span style=&quot;color: #006600;&quot;&gt;pop&lt;/span&gt;&lt;span style=&quot;color: #226622;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #226622;&quot;&gt;)&lt;/span&gt;
     &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;else&lt;/span&gt;:
         cnt+=&lt;span style=&quot;color: #cc0000;&quot;&gt;1&lt;/span&gt;
         stack.&lt;span style=&quot;color: #006600;&quot;&gt;append&lt;/span&gt;&lt;span style=&quot;color: #226622;&quot;&gt;(&lt;/span&gt;a+b&lt;span style=&quot;color: #226622;&quot;&gt;)&lt;/span&gt;
 &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;return&lt;/span&gt; cnt+M2-z/&lt;span style=&quot;color: #cc0000;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #226622;&quot;&gt;
&lt;/span&gt;&lt;/pre&gt;
&lt;tt&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;&lt;/span&gt;&lt;/tt&gt;&lt;/blockquote&gt;
&lt;/pre&gt;
The code is directly copy from the code I gave on Project Euler website, so it does not look good. &lt;br /&gt;
With the help of psyco, it is fairly fast, but is not very readable by human and can not be considered as a straightforward interpretation of the mathematics behind the problem.&lt;br /&gt;
On the contrary, doing some easy tasks in Haskell is not so elegant. For example, suppose we want to find the integer part of the square root of an integer n, and then print it on the screen. Doing this task in python is as simple as you can imagine. 
&lt;br /&gt;
&lt;blockquote style=&quot;background: #000;&quot;&gt;
print int(x**0.5).&lt;/blockquote&gt;
To do this in Haskell, you will have to convert the integer n to a float point number, then take square root, then take floor, then covert it to an integer, and then convert it to a text before it is ready to print on screen.  &lt;br /&gt;
&lt;blockquote style=&quot;background: #000;&quot;&gt;
putStrLn.show $ (floor . sqrt)  (fromIntegral n)&lt;/blockquote&gt;
If there are a lot of float point numbers and integers involved, then you probably need to do the coversion every here and there in your code. 
I know that those conversions exist for a good reason, however, sometimes you just fell like to do a quick and simple computation.
&lt;br /&gt;
Sure Haskell can make complicate tasks simple and make simple tasks complicate. 
</content><link rel='replies' type='application/atom+xml' href='http://weijr-eng.blogspot.com/feeds/7601952960068347127/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://weijr-eng.blogspot.com/2013/03/project-euler-problem-198.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7712898164041001720/posts/default/7601952960068347127'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7712898164041001720/posts/default/7601952960068347127'/><link rel='alternate' type='text/html' href='http://weijr-eng.blogspot.com/2013/03/project-euler-problem-198.html' title='Project Euler Problem 198'/><author><name>tjwei</name><uri>http://www.blogger.com/profile/13263392105910479364</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhg3D9eCjk2LAEo0KAgVvcKBRIULitJ5Pb08uqzAneEMy-5H6zH00irIalgDAH0y1Z5RHLsa2ppAAL0sp2xN4KLN9dp_rshzcaMTys3QDrDKHdvr0oKSDE-nv60TZsuJb2YIp-67p8glgY/s72-c/euler_portrait.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7712898164041001720.post-1771527374974017399</id><published>2013-03-10T09:24:00.000-07:00</published><updated>2013-03-12T21:52:04.597-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="blender"/><title type='text'>Py Girl, 2nd try</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7DNbje9Gkd7y3KL-byYxO2CAfZYBL2hrz3n5HTwiMAJWerDsG2uhWmeSsCIY84ije48b1j8vqq6betOG5GFLbUK56OlFWAk9Owsyhtn8iQcCA4_u8HOmKO2453ELqx9wVi9CCsog7n9M/s1600/pygirl6.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;360&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7DNbje9Gkd7y3KL-byYxO2CAfZYBL2hrz3n5HTwiMAJWerDsG2uhWmeSsCIY84ije48b1j8vqq6betOG5GFLbUK56OlFWAk9Owsyhtn8iQcCA4_u8HOmKO2453ELqx9wVi9CCsog7n9M/s1600/pygirl6.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
Looks a bit better than &lt;a href=&quot;http://weijr-eng.blogspot.tw/2013/03/the-life-of-py-girl-py-debut.html&quot;&gt;the first try&lt;/a&gt;, but still not quite there.&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&amp;nbsp;It is created using blender&amp;nbsp;+ freestyle like before. I also use gimp to auto balance the color. The original blender rendered image can be found below.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2zPAYqy5uticchXMC2OM7fbVqMl9t8YGN_vkufTYwLDcenEy3J49BdFG1v60RljbFbwThN0jTSqJ5h4Sn3DlKEhRZLsDIQTetqOgFOblFYG979oCbdfkep59QZ30kWHbEHhRc4WBgHpQ/s1600/pygirl5.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;225&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2zPAYqy5uticchXMC2OM7fbVqMl9t8YGN_vkufTYwLDcenEy3J49BdFG1v60RljbFbwThN0jTSqJ5h4Sn3DlKEhRZLsDIQTetqOgFOblFYG979oCbdfkep59QZ30kWHbEHhRc4WBgHpQ/s1600/pygirl5.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
The basic idea of this image is inspired by &lt;a href=&quot;http://en.wikipedia.org/wiki/N%C3%BCwa&quot;&gt;Nüwa&lt;/a&gt; and &lt;a href=&quot;http://en.wikipedia.org/wiki/The_Legend_of_Sword_and_Fairy&quot;&gt;Zhao Ling&#39;er&lt;/a&gt;, as suggested by &lt;span class=&quot;gD&quot; name=&quot;Jenny JS Liang&quot;&gt;Jenny JS Liang.&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;gD&quot; name=&quot;Jenny JS Liang&quot;&gt;The background image features a landscape painting of &lt;a href=&quot;http://en.wikipedia.org/wiki/Fan_Kuan&quot;&gt;Fan Kuan&lt;/a&gt;. &lt;/span&gt;

&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj0mLyugD1CHUWwqRp_YNyiysRQgZj9xLilFDIVoFydGFU9dxH3RcNdB1JmBAMm9ZYlwKbsCDZ4O9QbObg6ugSO0liBB-KkViSfpIqRIV_9eR2ZwsDT5ty7HBc7rGJcEPGuk6W24w5_HNM/s1600/snow-1-a.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj0mLyugD1CHUWwqRp_YNyiysRQgZj9xLilFDIVoFydGFU9dxH3RcNdB1JmBAMm9ZYlwKbsCDZ4O9QbObg6ugSO0liBB-KkViSfpIqRIV_9eR2ZwsDT5ty7HBc7rGJcEPGuk6W24w5_HNM/s320/snow-1-a.jpg&quot; width=&quot;263&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span class=&quot;gD&quot; name=&quot;Jenny JS Liang&quot;&gt;The .blend &amp;nbsp;file can be downloaded at &amp;nbsp;&lt;a href=&quot;http://www.blendswap.com/blends/view/67026&quot;&gt;Blend Swap&lt;/a&gt;.&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://weijr-eng.blogspot.com/feeds/1771527374974017399/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://weijr-eng.blogspot.com/2013/03/py-girl-2nd-try.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7712898164041001720/posts/default/1771527374974017399'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7712898164041001720/posts/default/1771527374974017399'/><link rel='alternate' type='text/html' href='http://weijr-eng.blogspot.com/2013/03/py-girl-2nd-try.html' title='Py Girl, 2nd try'/><author><name>tjwei</name><uri>http://www.blogger.com/profile/13263392105910479364</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7DNbje9Gkd7y3KL-byYxO2CAfZYBL2hrz3n5HTwiMAJWerDsG2uhWmeSsCIY84ije48b1j8vqq6betOG5GFLbUK56OlFWAk9Owsyhtn8iQcCA4_u8HOmKO2453ELqx9wVi9CCsog7n9M/s72-c/pygirl6.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7712898164041001720.post-432702395762938386</id><published>2013-03-10T09:03:00.003-07:00</published><updated>2013-03-10T09:03:58.984-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="blender"/><title type='text'>Blender Renderting Time (On computers available to me)</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgaSz3EQc1ob4IzGFrq11PMob5jcMraW2iUUf4blK4MlnuMJKHAr3so7Y5O5OzBYpEJFa7V3aY6tAcOljugSDDo_jMauIjwmUuTaJx1TJlLBnNNjFjuykkU8PIvQbM0z9fPm14TUqrWhw/s1600/x3.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgaSz3EQc1ob4IzGFrq11PMob5jcMraW2iUUf4blK4MlnuMJKHAr3so7Y5O5OzBYpEJFa7V3aY6tAcOljugSDDo_jMauIjwmUuTaJx1TJlLBnNNjFjuykkU8PIvQbM0z9fPm14TUqrWhw/s1600/x3.png&quot; height=&quot;360&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
This a simple test of&amp;nbsp; of the rendering time of&amp;nbsp; blender internal render.&lt;br /&gt;
I was curious how Xoom or Azure compares to my desktops and laptops. However, running blender in the chrooted ubuntu of&amp;nbsp; my xoom causes a segment fault ( for both the ubuntu blender and a 2.66 blender compiled by me).&lt;br /&gt;
&lt;br /&gt;
The test .blend file is my &lt;a href=&quot;http://weijr-note.blogspot.tw/2013/02/python-debut.html&quot;&gt;Python Girl &lt;/a&gt;video.&amp;nbsp; The video has 800 blender rendered frames (frame 600 - frame 1400). But in this test, only one of every 4 frames between frame 1250 and frame 1346 are rendered. We measure the difference between the modified time of 1250.png and 1346.png.&lt;br /&gt;
&lt;br /&gt;The blender used in this test is freestyle branch. On windows,&amp;nbsp; a 32bit executable is used. 64 bit binaries are used on linux and OSX. &lt;br /&gt;
The followings are the results：&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Core i7-2700 Ubuntu 12.10: 19min 16sec&lt;/li&gt;
&lt;li&gt;Azure extra large 8 core Ubuntu 12.10:&amp;nbsp; 32min 45sec&lt;/li&gt;
&lt;li&gt;Core 2 Quads Q9500 Win7: 53min 8 sec&lt;/li&gt;
&lt;li&gt;Macbook Air Core i5-3317u: 60min&lt;/li&gt;
&lt;li&gt;Win8 Core 2 Duo T5600: about 3 hours (I had a train to catch, so unable to finish the rendering)&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
The segment fault on&amp;nbsp; Xoom could be caused by kernel incompatibility or because Xoom does not have enough RAM. But compiling blender on Xoom took like 10 hours while compiling on my Core i7 desktop took only 10-20 minutes. &lt;br /&gt;
If possible, it would be interesting to run the same test on an ipad, iphone, EC2,&amp;nbsp; raspberry Pi, or high end android phone like HTC One, Butterfly, or may padfone infinity, S4.&lt;br /&gt;
&lt;ul&gt;
&lt;/ul&gt;
</content><link rel='replies' type='application/atom+xml' href='http://weijr-eng.blogspot.com/feeds/432702395762938386/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://weijr-eng.blogspot.com/2013/03/blender-renderting-time-on-computers.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7712898164041001720/posts/default/432702395762938386'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7712898164041001720/posts/default/432702395762938386'/><link rel='alternate' type='text/html' href='http://weijr-eng.blogspot.com/2013/03/blender-renderting-time-on-computers.html' title='Blender Renderting Time (On computers available to me)'/><author><name>tjwei</name><uri>http://www.blogger.com/profile/13263392105910479364</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgaSz3EQc1ob4IzGFrq11PMob5jcMraW2iUUf4blK4MlnuMJKHAr3so7Y5O5OzBYpEJFa7V3aY6tAcOljugSDDo_jMauIjwmUuTaJx1TJlLBnNNjFjuykkU8PIvQbM0z9fPm14TUqrWhw/s72-c/x3.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7712898164041001720.post-1126389232277001235</id><published>2013-03-06T00:08:00.000-08:00</published><updated>2013-03-12T21:54:47.704-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="blender"/><title type='text'>The Life of Py : Girl Py Debut</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;iframe allowfullscreen=&#39;allowfullscreen&#39; webkitallowfullscreen=&#39;webkitallowfullscreen&#39; mozallowfullscreen=&#39;mozallowfullscreen&#39; width=&#39;320&#39; height=&#39;266&#39; src=&#39;https://www.youtube.com/embed/FBK7vx4tf5A?feature=player_embedded&#39; frameborder=&#39;0&#39;&gt;&lt;/iframe&gt;&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
Girl Py or Python Girl is an anthropomorphic character of Python programming language. The original purpose of this character is to promote PyCon Taiwan. 
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
Most tools used to create Girl Py are python related.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
The main tool is Blender with freestyle, which is no doubt a python related 3d rendering and modeling tools. &lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
The body of the character is created using Makehuman. Makehuman contains a lot of Python code, in fact, the version I used is the pure python branch.
Makehuman is designed for modeling realistic human bodies instead of manga style ones. Fotunately, makehuman support customized skin and target. I made a manga skin and manga target for it. The result of first draft looks like the following.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFDtE0o0FaSnh3iHyWm0RpaS8AhB2K9g1NVAmdKfN5Uka3Q3YDoQVRIA1gWWmkjluN2jKwnJA2IYTY9tjapBad5nNy-URJZWz4ixz6P23XSKDAo1oWYPiqFF2aDkICa1CS8JvLxgklxmY/s1600/pygirl1.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;360&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFDtE0o0FaSnh3iHyWm0RpaS8AhB2K9g1NVAmdKfN5Uka3Q3YDoQVRIA1gWWmkjluN2jKwnJA2IYTY9tjapBad5nNy-URJZWz4ixz6P23XSKDAo1oWYPiqFF2aDkICa1CS8JvLxgklxmY/s640/pygirl1.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
The hair color is actually black, but the light was too strong, so it looks very pink.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
The face generated by my manga target is kind of ugly and scary, but does not look that bad with smooth modifer.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
After playing with makehuman and blender awhile, I was getting more familier with these tools and improve the target a bit.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
It looks less scary and more smooth now but still ugly. &lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgnYzF-2IGMedGHpfsELuhXdjV2cNGdKpyT8k9LNnbzd6GzevggJ6bOxjpi1ai5i6Rz15JsONRGY4oQgPp6nhjHPy7ok-EsOeO0wrrwQmX-3adEZnAP_cszyMYEr1Gl-CHA5If5-YRIpig/s1600/face1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;360&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgnYzF-2IGMedGHpfsELuhXdjV2cNGdKpyT8k9LNnbzd6GzevggJ6bOxjpi1ai5i6Rz15JsONRGY4oQgPp6nhjHPy7ok-EsOeO0wrrwQmX-3adEZnAP_cszyMYEr1Gl-CHA5If5-YRIpig/s640/face1.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
After adding some manga style material, it looks like the following&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAsqIzMvjbPTkxo79qK-8-fOg0A2rjgz__J_Jd-O-k9N1WkfPxBwdOc0cR3f-1klUiqYtPw8xxwb37F3FbX7RCjkpdxNkwwM7QqsWCtez0TR97m8V_zS8QYrMLg5kM1b1gmaAyoDerxEg/s1600/face2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;360&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAsqIzMvjbPTkxo79qK-8-fOg0A2rjgz__J_Jd-O-k9N1WkfPxBwdOc0cR3f-1klUiqYtPw8xxwb37F3FbX7RCjkpdxNkwwM7QqsWCtez0TR97m8V_zS8QYrMLg5kM1b1gmaAyoDerxEg/s640/face2.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
Still not good. Because of the time constraint, I decided to model the face by blender directly instead. Using the models list at the end of the video as reference and inspiration, the result is the following:&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvGzQ2fyBUvyUIqRAUJmII0opjJA_sII1XygSCP-jmoJGluB9FjC-gZXsad2EdjpuT4a4L1q9ELl5Hm2rntqYhC2scAd0pMGXHDKZXkos4bUHBbRdkG8uyF9vwJdkJ_3N9238c2QbP_wg/s1600/face4.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;360&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvGzQ2fyBUvyUIqRAUJmII0opjJA_sII1XygSCP-jmoJGluB9FjC-gZXsad2EdjpuT4a4L1q9ELl5Hm2rntqYhC2scAd0pMGXHDKZXkos4bUHBbRdkG8uyF9vwJdkJ_3N9238c2QbP_wg/s640/face4.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
It looks like this in Blender&#39;s opengl view &lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5YcZn207EMUTZ2cDR3WXUWSUgIe7dBFks-CxMOvdXW5zSoihqppX8Oqba8EODYO6joL1lYwB9aFpCv3GzO0BjnO-hP1QXL0-PPvoTjqY7TcLe_fzVPd-bMAY6A9RMtHIvJ3xByyu1SIc/s1600/face3.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;180&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5YcZn207EMUTZ2cDR3WXUWSUgIe7dBFks-CxMOvdXW5zSoihqppX8Oqba8EODYO6joL1lYwB9aFpCv3GzO0BjnO-hP1QXL0-PPvoTjqY7TcLe_fzVPd-bMAY6A9RMtHIvJ3xByyu1SIc/s320/face3.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
The python code featured in the video is PyLottery of PyCon Taiwan 2012, which generates an animated snake to fetch random lottery balls.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
Other software used in this project are OpenShot and gimp, all python related.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
The next image is the credit at the end of the video&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWFWv0bXWRirBEEYz5etTB3HUyDn3pM_hPzOuB_Eal1BXNzvFvjLsuE4EQfqQ6TEao1RFm4gMxXGYMsQC_k3PHsUr_XFm31rikwOARwNfFEULRF-GOkH-_QUCxsoUX6q4u8Dwkrerh-Fg/s1600/pyg_credit.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;360&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWFWv0bXWRirBEEYz5etTB3HUyDn3pM_hPzOuB_Eal1BXNzvFvjLsuE4EQfqQ6TEao1RFm4gMxXGYMsQC_k3PHsUr_XFm31rikwOARwNfFEULRF-GOkH-_QUCxsoUX6q4u8Dwkrerh-Fg/s640/pyg_credit.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
PyCon Taiwan 2013 is &lt;a href=&quot;http://tw.pycon.org/2013/speaker/&quot;&gt;Calling for proposals&lt;/a&gt;, you are welcome to submit your proposals.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://weijr-eng.blogspot.com/feeds/1126389232277001235/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://weijr-eng.blogspot.com/2013/03/the-life-of-py-girl-py-debut.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7712898164041001720/posts/default/1126389232277001235'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7712898164041001720/posts/default/1126389232277001235'/><link rel='alternate' type='text/html' href='http://weijr-eng.blogspot.com/2013/03/the-life-of-py-girl-py-debut.html' title='The Life of Py : Girl Py Debut'/><author><name>tjwei</name><uri>http://www.blogger.com/profile/13263392105910479364</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFDtE0o0FaSnh3iHyWm0RpaS8AhB2K9g1NVAmdKfN5Uka3Q3YDoQVRIA1gWWmkjluN2jKwnJA2IYTY9tjapBad5nNy-URJZWz4ixz6P23XSKDAo1oWYPiqFF2aDkICa1CS8JvLxgklxmY/s72-c/pygirl1.jpg" height="72" width="72"/><thr:total>0</thr:total></entry></feed>