<?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-5064621153219489953</id><updated>2024-11-01T21:53:23.045+09:00</updated><category term="python"/><category term="r-project"/><category term="javascript"/><category term="Japanese"/><category term="bookmark"/><category term="delicious"/><category term="bookmarklet"/><category term="centos"/><category term="chart"/><category term="circuit"/><category term="conversion"/><category term="default"/><category term="encoding"/><category term="excel"/><category term="logisim"/><category term="math"/><category term="mathml"/><category term="mongodb"/><category term="podcast"/><category term="rss"/><category term="ruby"/><category term="spreadsheet"/><category term="ssl"/><category term="syntax"/><category term="time"/><category term="tornado"/><category term="vector"/><title type='text'>ogura codes</title><subtitle type='html'>Incorrect, inadvertent coding.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://oguracodes.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5064621153219489953/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://oguracodes.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Unknown</name><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>20</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5064621153219489953.post-8880436836481957508</id><published>2016-04-22T14:44:00.000+09:00</published><updated>2016-04-22T14:44:22.163+09:00</updated><title type='text'>oguradio.com</title><content type='html'>I obtained a domain called oguradio.com and started a website on it.&lt;br /&gt;
&lt;a href=&quot;https://oguradio.com/&quot;&gt;https://oguradio.com/&lt;/a&gt;&lt;br /&gt;
Currently I&#39;m learning iOS programming and I will use this domain for bundle identifiers of iOS apps that I will make.&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://oguracodes.blogspot.com/feeds/8880436836481957508/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5064621153219489953/8880436836481957508' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5064621153219489953/posts/default/8880436836481957508'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5064621153219489953/posts/default/8880436836481957508'/><link rel='alternate' type='text/html' href='http://oguracodes.blogspot.com/2016/04/oguradiocom.html' title='oguradio.com'/><author><name>Unknown</name><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-5064621153219489953.post-7033198101203318483</id><published>2015-03-19T19:51:00.000+09:00</published><updated>2015-03-19T21:17:58.552+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="mongodb"/><category scheme="http://www.blogger.com/atom/ns#" term="podcast"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><category scheme="http://www.blogger.com/atom/ns#" term="tornado"/><title type='text'>TornadoとMongoDBによるポッドキャストサーバー、tornado-podcastを作っています。</title><content type='html'>最近Tornadoを勉強していまして、勉強のためにポッドキャストサーバーを作り始めました。&lt;br /&gt;
&lt;br /&gt;
きっかけは、TornadoとMongoDBを用いたセッション・認証管理のコードをGitHubで見つけたことでした。&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://github.com/bbqsrc/tornado-mongo-session&quot; target=&quot;_blank&quot;&gt;Session and authentication handling using MongoDB for Tornado&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
このコードを元にして、最初は簡単なCRUDアプリケーションを作り、簡単なブログサイトのようにしてから、音声ファイルのアップロード、RSSフィードの出力を付け加えていき、ポッドキャストに対応させた次第です。&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;
デモ動画&lt;/h4&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;iframe allowfullscreen=&quot;&quot; class=&quot;YOUTUBE-iframe-video&quot; data-thumbnail-src=&quot;https://i.ytimg.com/vi/_f_SJSr4GFo/0.jpg&quot; frameborder=&quot;0&quot; height=&quot;266&quot; src=&quot;http://www.youtube.com/embed/_f_SJSr4GFo?feature=player_embedded&quot; width=&quot;320&quot;&gt;&lt;/iframe&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;h4&gt;
ソース&lt;/h4&gt;
&lt;a href=&quot;https://github.com/ogra/tornado-podcast&quot; target=&quot;_blank&quot;&gt;GitHub&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;
ご注意&lt;/h4&gt;
まだ作りかけのため、正常に動作しない部分があります。本番環境にはまだ使えません。&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;
必要なもの&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;MongoDBが動作している必要があります。&lt;/li&gt;
&lt;li&gt;requirements.txtに書いてあるモジュールが必要です。&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;h4&gt;
使い方&lt;/h4&gt;
&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;MongoDBを起動します。&lt;/li&gt;
&lt;li&gt;python app.pyを実行します。&lt;/li&gt;
&lt;li&gt;ブラウザで&lt;a href=&quot;http://localhost:8888/podcast&quot;&gt;http://localhost:8888/podcast&lt;/a&gt;を開きます。&lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;
現時点（3月19日）での問題点&lt;/h4&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;誰でもユーザー登録できてしまい、ログインした人はすべて管理者扱いになってしまいます。（ユーザーを区別せず、ログインしているかどうかだけで管理者かどうか決めてしまっています。）&lt;/li&gt;
&lt;li&gt;ユーザーごとにポッドキャストを独立させていません。すべて単一のポッドキャストに収まるようになっています。&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://oguracodes.blogspot.com/feeds/7033198101203318483/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5064621153219489953/7033198101203318483' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5064621153219489953/posts/default/7033198101203318483'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5064621153219489953/posts/default/7033198101203318483'/><link rel='alternate' type='text/html' href='http://oguracodes.blogspot.com/2015/03/tornadomongodbtornado-podcast.html' title='TornadoとMongoDBによるポッドキャストサーバー、tornado-podcastを作っています。'/><author><name>Unknown</name><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/_f_SJSr4GFo/default.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5064621153219489953.post-4392645988377478373</id><published>2014-03-23T12:27:00.000+09:00</published><updated>2014-03-23T12:28:49.751+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="python"/><title type='text'>Crawling with Python 3 asyncio</title><content type='html'>I added some code to &lt;a href=&quot;https://github.com/ogra/aiohttp/blob/myexamples/examples/crawl.py&quot;&gt;crawl.py&lt;/a&gt; in the example code of &lt;a href=&quot;https://github.com/KeepSafe/aiohttp&quot;&gt;aiohttp&lt;/a&gt;(http client/server for asyncio) so that it crawls&amp;nbsp;&lt;a href=&quot;http://www.dmoz.org/&quot;&gt;ODP&lt;/a&gt; and saves scraped data into SQLite database.&lt;br /&gt;
I&#39;m not sure if I&#39;m handling SQLite correctly, but it seems to work.&lt;br /&gt;
Python 3, &lt;a href=&quot;http://docs.python.org/3.4/library/asyncio.html&quot;&gt;asyncio&lt;/a&gt;(New in Python 3.4. &lt;a href=&quot;https://pypi.python.org/pypi/asyncio&quot;&gt;PyPI&lt;/a&gt;), aiohttp and &lt;a href=&quot;http://lxml.de/&quot;&gt;lxml&lt;/a&gt; are required.&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://oguracodes.blogspot.com/feeds/4392645988377478373/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5064621153219489953/4392645988377478373' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5064621153219489953/posts/default/4392645988377478373'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5064621153219489953/posts/default/4392645988377478373'/><link rel='alternate' type='text/html' href='http://oguracodes.blogspot.com/2014/03/crawling-with-python-3-asyncio.html' title='Crawling with Python 3 asyncio'/><author><name>Unknown</name><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-5064621153219489953.post-6920669030946038352</id><published>2013-09-05T16:51:00.000+09:00</published><updated>2013-09-10T13:32:14.330+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="python"/><title type='text'>py3compat.py in IPython 1.0.0 (updated)</title><content type='html'>py3compat.py in IPython 1.0.0 has bad references to&amp;nbsp;str_to_unicode.&lt;br /&gt;
It is fixed on GitHub.&lt;br /&gt;
&lt;a href=&quot;https://github.com/ipython/ipython/commit/5d0152fce3cee0e5a3d07bb7eb8a78e0b180854e#IPython/utils/py3compat.py&quot;&gt;https://github.com/ipython/ipython/commit/5d0152fce3cee0e5a3d07bb7eb8a78e0b180854e#IPython/utils/py3compat.py&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
(UPDATE 2013-09-10 13:32 JST)&lt;br /&gt;
Fixed in release 1.1.0.&lt;br /&gt;
&lt;a href=&quot;https://github.com/ipython/ipython/blob/rel-1.1.0/IPython/utils/py3compat.py#L62-L70&quot;&gt;https://github.com/ipython/ipython/blob/rel-1.1.0/IPython/utils/py3compat.py#L62-L70&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://oguracodes.blogspot.com/feeds/6920669030946038352/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5064621153219489953/6920669030946038352' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5064621153219489953/posts/default/6920669030946038352'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5064621153219489953/posts/default/6920669030946038352'/><link rel='alternate' type='text/html' href='http://oguracodes.blogspot.com/2013/09/py3compatpy-in-ipython-100.html' title='py3compat.py in IPython 1.0.0 (updated)'/><author><name>Unknown</name><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-5064621153219489953.post-3508850896047236540</id><published>2013-04-15T21:14:00.000+09:00</published><updated>2013-04-16T22:50:11.981+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Japanese"/><category scheme="http://www.blogger.com/atom/ns#" term="r-project"/><title type='text'>subdivisionjp.R</title><content type='html'>I made an R version of the conversion tool for the names of principal subdivision in Japan.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://docs.google.com/file/d/0B9q7kolvmjdydUlwNW4yRUJqZlU/edit?usp=sharing&quot;&gt;subdivisionjp.zip (Download page at Google Drive)&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Documentation&lt;br /&gt;
&lt;a href=&quot;http://rpubs.com/ogura/5493&quot;&gt;http://rpubs.com/ogura/5493&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
(Update: 2013-04-16 22:50 JST)&lt;br /&gt;
I didn&#39;t know of package &lt;a href=&quot;http://cran.r-project.org/web/packages/Nippon/index.html&quot;&gt;Nippon&lt;/a&gt;, which includes prefectures table and many other useful features.&lt;br /&gt;
I wonder if you should have Unicode data in Unicode character codes like &quot;&amp;lt;U+6771&amp;gt;&amp;lt;U+4EAC&amp;gt;&amp;lt;U+90FD&amp;gt;&quot;&amp;nbsp;instead of &quot;東京都&quot;.&lt;br /&gt;
If you have original data in Unicode characters like &quot;&amp;lt;U+6771&amp;gt;&amp;lt;U+4EAC&amp;gt;&amp;lt;U+90FD&amp;gt;&quot;, R console outputs text in a readable way, but the original data itself is less human-readable.&lt;br /&gt;
If you have original data directly put like &quot;東京都&quot; (I don&#39;t know the name of representation), the original data is human-readable, but console outputs garbled text.&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://oguracodes.blogspot.com/feeds/3508850896047236540/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5064621153219489953/3508850896047236540' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5064621153219489953/posts/default/3508850896047236540'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5064621153219489953/posts/default/3508850896047236540'/><link rel='alternate' type='text/html' href='http://oguracodes.blogspot.com/2013/04/subdivisionjpr.html' title='subdivisionjp.R'/><author><name>Unknown</name><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-5064621153219489953.post-2450123031978806906</id><published>2013-04-15T01:34:00.000+09:00</published><updated>2013-04-25T01:00:05.966+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="conversion"/><category scheme="http://www.blogger.com/atom/ns#" term="Japanese"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript"/><title type='text'>Converting principal subdivision names in Japan</title><content type='html'>When handling data sets, Japanese characters are almost always a pain in the neck because of garbled text in data-processing software such as R.&lt;br /&gt;
Replacing Japanese characters with Roman notations manually is a very tedious task that many people may not want to do.&lt;br /&gt;
Commonly used names like principal subdivisions, or prefecture (the United States&#39; counterparts are states), among others, would be handy if you can get &lt;span class=&quot;GINGER_SOFATWARE_correct&quot; ginger_sofatware_markguid=&quot;a3b7ee71-74ae-4515-86e3-e6033172f2f3&quot; ginger_sofatware_uiphraseguid=&quot;256eeecd-31ae-40f5-ac7d-e763ed6f7939&quot; grcontextid=&quot;their:0&quot;&gt;their&lt;/span&gt; Roman notations quickly.&lt;br /&gt;
So I made a script to convert names of Japan&#39;s principal subdivisions between Japanese (Kanji) and Roman.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://script.google.com/d/1OLYUr0_nNcSJzRkh1Nm3bfOuoMTJDHdzWSWjnJsTRu7TUsqLl3sGDOb_/edit?usp=sharing&quot;&gt;iso3166-2jp&lt;/a&gt; (Google Apps Script. I don&#39;t know why, but Google sign-in is required to view the code though I&#39;m sharing it for anonymous access.)&lt;br /&gt;
&lt;br /&gt;
If you make a copy of the above script and include it as a library, you can use its functions in your Google Sheets.&lt;br /&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/AVvXsEgV-_2At9yVNNzEJwsCrT_49JgTlAF9O9WzGjm9TUIVVLXTKjwJcfgTWL2mNGu1Sbf_aSxAXkorIpTIN7GKZc-scK0TfNJwxIqN3n_xDboObI0p6KA-3FlP2jbrtoXBc9dO3uGfFHQQUOBy/s1600/iso3166-2jp_sheet_example.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/AVvXsEgV-_2At9yVNNzEJwsCrT_49JgTlAF9O9WzGjm9TUIVVLXTKjwJcfgTWL2mNGu1Sbf_aSxAXkorIpTIN7GKZc-scK0TfNJwxIqN3n_xDboObI0p6KA-3FlP2jbrtoXBc9dO3uGfFHQQUOBy/s1600/iso3166-2jp_sheet_example.png&quot; height=&quot;102&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Japan&#39;s principal subdivisions:&lt;br /&gt;
&lt;a href=&quot;http://en.wikipedia.org/wiki/ISO_3166-2:JP&quot;&gt;http://en.wikipedia.org/wiki/ISO_3166-2:JP&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://ja.wikipedia.org/wiki/ISO_3166-2:JP&quot;&gt;http://ja.wikipedia.org/wiki/ISO_3166-2:JP&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://oguracodes.blogspot.com/feeds/2450123031978806906/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5064621153219489953/2450123031978806906' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5064621153219489953/posts/default/2450123031978806906'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5064621153219489953/posts/default/2450123031978806906'/><link rel='alternate' type='text/html' href='http://oguracodes.blogspot.com/2013/04/converting-principal-subdivision-names.html' title='Converting principal subdivision names in Japan'/><author><name>Unknown</name><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/AVvXsEgV-_2At9yVNNzEJwsCrT_49JgTlAF9O9WzGjm9TUIVVLXTKjwJcfgTWL2mNGu1Sbf_aSxAXkorIpTIN7GKZc-scK0TfNJwxIqN3n_xDboObI0p6KA-3FlP2jbrtoXBc9dO3uGfFHQQUOBy/s72-c/iso3166-2jp_sheet_example.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5064621153219489953.post-6332125262775768322</id><published>2013-03-21T06:11:00.000+09:00</published><updated>2016-09-15T14:57:37.141+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="bookmarklet"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript"/><title type='text'>JavaScript: Feedly feeds extractor bookmarklet</title><content type='html'>(1st update, March 21, 2013, 15:20 JST: include feed names.)&lt;br /&gt;
(2nd update, March 21, 2013, 21:58 JST: bug fix and JSON/OPML option added.)&lt;br /&gt;
(3rd update, March 21, 2013, 22:17 JST: change names of some keys in JSON.)&lt;br /&gt;
&lt;br /&gt;
Feedly is a great feed reader, but it doesn&#39;t seem to have an export function.&lt;br /&gt;
&lt;br /&gt;
So I created a bookmarklet to extract URLs of your feed subscriptions and their categories and output them in JSON/OPML format.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;a href=&quot;javascript:(function(){if(window.location.href!=&amp;quot;http://www.feedly.com/home#index&amp;quot;){}else{function e(e,t,n,r){t=t?t:n?n.ownerDocument:document;r=r?r:null;n=n?n:t;var i=t.evaluate(e,n,r,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);var s=[];for(var o=0;o&amp;lt;i.snapshotLength;o++){s[o]=i.snapshotItem(o)}return s}function t(e){function n(e,n,r){var i=[];if(r){for(var s=0;s&amp;lt;r.length;s++){i.push(r[s][0]+&#39;=&amp;quot;&#39;+r[s][1]+&#39;&amp;quot;&#39;)}var o=&amp;quot;&amp;lt;&amp;quot;+e+&amp;quot; &amp;quot;+i.join(&amp;quot; &amp;quot;)}else{var o=&amp;quot;&amp;lt;&amp;quot;+e}if(n){if(n[0]==&amp;quot;&amp;lt;&amp;quot;){return o+&amp;quot;&amp;gt;&amp;quot;+t+n+&amp;quot;&amp;lt;/&amp;quot;+e+&amp;quot;&amp;gt;&amp;quot;+t}else{return o+&amp;quot;&amp;gt;&amp;quot;+n+&amp;quot;&amp;lt;/&amp;quot;+e+&amp;quot;&amp;gt;&amp;quot;+t}}else{return o+&amp;quot;/&amp;gt;&amp;quot;+t}}var t=&amp;quot;\n&amp;quot;;var r=[];for(var i=0;i&amp;lt;e.length;i++){var s=[];for(var o=0;o&amp;lt;e[i][&amp;quot;feeds&amp;quot;].length;o++){var u=n(&amp;quot;outline&amp;quot;,undefined,[[&amp;quot;text&amp;quot;,e[i][&amp;quot;feeds&amp;quot;][o][&amp;quot;title&amp;quot;]],[&amp;quot;title&amp;quot;,e[i][&amp;quot;feeds&amp;quot;][o][&amp;quot;title&amp;quot;]],[&amp;quot;type&amp;quot;,&amp;quot;rss&amp;quot;],[&amp;quot;xmlUrl&amp;quot;,e[i][&amp;quot;feeds&amp;quot;][o][&amp;quot;xmlUrl&amp;quot;]]]);s.push(u)}var a=n(&amp;quot;outline&amp;quot;,s.join(&amp;quot;&amp;quot;),[[&amp;quot;text&amp;quot;,e[i][&amp;quot;category&amp;quot;]],[&amp;quot;title&amp;quot;,e[i][&amp;quot;category&amp;quot;]]]);r.push(a)}var f=n(&amp;quot;title&amp;quot;,&amp;quot;My Feedly feeds&amp;quot;);var l=(new Date).toUTCString();var c=n(&amp;quot;dateCreated&amp;quot;,l);var h=n(&amp;quot;dateModified&amp;quot;,l);var p=n(&amp;quot;ownerName&amp;quot;,&amp;quot;My name&amp;quot;);var d=n(&amp;quot;ownerEmail&amp;quot;,&amp;quot;My email&amp;quot;);var v=n(&amp;quot;head&amp;quot;,f+c+h+p+d);var m=n(&amp;quot;body&amp;quot;,r.join(&amp;quot;&amp;quot;));var g=n(&amp;quot;opml&amp;quot;,v+m);var y=&#39;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&#39;+t;return y+g}var n=e(&amp;quot;//div[@id=&#39;mainArea&#39;]/div[starts-with(@class,&#39;cell&#39;)]&amp;quot;);var r=Array.prototype.slice.call(n[0].childNodes);for(var i=1;i&amp;lt;n.length;i++){var s=Array.prototype.slice.call(n[i].childNodes);r=r.concat(s)}var o=[];var u={};var a=[];for(var f=0;f&amp;lt;r.length;f++){if(r[f].nodeName==&amp;quot;H2&amp;quot;){if(u[&amp;quot;category&amp;quot;]==undefined){u[&amp;quot;category&amp;quot;]=r[f].innerHTML.replace(/^\s*/,&amp;quot;&amp;quot;).replace(/\s*$/,&amp;quot;&amp;quot;)}else{u[&amp;quot;feeds&amp;quot;]=a;o.push(u);u={};a=[];u[&amp;quot;category&amp;quot;]=r[f].innerHTML.replace(/^\s*/,&amp;quot;&amp;quot;).replace(/\s*$/,&amp;quot;&amp;quot;)}}else if(r[f].nodeName==&amp;quot;DIV&amp;quot;){var l={title:r[f].childNodes[2].nodeValue.replace(/^[\s\n]*/g,&amp;quot;&amp;quot;).replace(/[\s\n]*$/g,&amp;quot;&amp;quot;),xmlUrl:r[f].getAttribute(&amp;quot;data-uri&amp;quot;).replace(&amp;quot;subscription/feed/&amp;quot;,&amp;quot;&amp;quot;)};a.push(l)}}var c=document.createElement(&amp;quot;textarea&amp;quot;);c.setAttribute(&amp;quot;rows&amp;quot;,&amp;quot;10&amp;quot;);c.setAttribute(&amp;quot;cols&amp;quot;,&amp;quot;100%&amp;quot;);document.querySelector(&amp;quot;div#mainBar&amp;quot;).appendChild(c);var h=confirm(&amp;quot;Press OK to get JSON,\nCancel to get OPML&amp;quot;);if(h){c.value=JSON.stringify(o,undefined,2)}else{c.value=t(o)}}})();&quot;&gt;Feedly feeds extractor bookmarklet&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
This bookmarklet only works at your Feedly index page (http://www.feedly.com/home#index).
&lt;br /&gt;
&lt;br /&gt;
After running this code, a text area containing the JSON data will be created at the bottom of the page.&lt;br /&gt;
&lt;br /&gt;
Pretty-printed version:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;line-numbers&quot;&gt;&lt;code class=&quot;language-javascript&quot;&gt;// Feedly feeds extractor bookmarklet by Toshiyuki Ogura
// Run this code at http://www.feedly.com/home#index
// A text area containing your feed urls in JSON format will be created at the bottom of the page.

javascript:(function(){

    if (window.location.href != &#39;http://www.feedly.com/home#index&#39;) {
    } else {

        function docEvaluateArray (expr, doc, context, resolver) {
            doc = doc ? doc : (context ? context.ownerDocument : document);
            resolver = resolver ? resolver : null;
            context = context ? context : doc; 
            
            var result = doc.evaluate(expr, context, resolver, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
            var a = [];
            for(var i = 0; i &amp;lt; result.snapshotLength; i++) {
                a[i] = result.snapshotItem(i);
            }
            return a;
        }

        /*
        // This function doesn&#39;t work because of HTMLUnknownElement.
        function jsonToOPMLString (jsonObj) {
            var xmlDeclaration = &#39;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&amp;gt;&#39;;
            var opmlElement = document.createElement(&#39;opml&#39;);
            opmlElement.setAttribute(&#39;version&#39;, &#39;1.0&#39;);
            var headElement = opmlElement.createElement(&#39;head&#39;);
            headElement.createElement(&#39;title&#39;);
            headElement.createElement(&#39;dateCreated&#39;);
            headElement.createElement(&#39;dateModified&#39;);
            headElement.createElement(&#39;ownerName&#39;);
            headElement.createElement(&#39;ownerEmail&#39;);
            var bodyElement = opmlElement.createElement(&#39;body&#39;);
            for (var i = 0; i &amp;lt; jsonObj.length; i++) {
                var categoryOutline = bodyElement.createElement(&#39;outline&#39;);
                categoryOutline.setAttribute(&#39;text&#39;, jsonObj[i][&#39;categoryName&#39;]);
                for (var j = 0; j &amp;lt; jsonObj[i][&#39;feeds&#39;].length; j++) {
                    var feedObj = jsonObj[i][&#39;feeds&#39;][j];
                    var urlOutline = categoryOutline.createElement(&#39;outline&#39;);
                    urlOutline.setAttribute(&#39;text&#39;, feedObj[&#39;title&#39;]);
                    urlOutline.setAttribute(&#39;type&#39;, &#39;link&#39;);
                    urlOutline.setAttribute(&#39;xmlUrl&#39;, feedObj[&#39;xmlUrl&#39;]);
                }
            }
            return xmlDeclaration + opmlElement.innerHTML;
        }
        */

        function jsonToOPMLString (jsonObj) {
            var newLine = &#39;\n&#39;; // for pretty-printing
            function getTagString(tagName, text, attrArray) { // attrArray = [[&#39;attr1&#39;, &#39;val1&#39;], [&#39;attr2&#39;, &#39;val2&#39;]];
                var attrStringArray = [];
                if(attrArray) {
                    for (var i = 0; i &amp;lt; attrArray.length; i++) {
                        attrStringArray.push(attrArray[i][0] + &#39;=&quot;&#39; + attrArray[i][1] + &#39;&quot;&#39;);
                    }
                    var result = &#39;&amp;lt;&#39; + tagName + &#39; &#39; + attrStringArray.join(&#39; &#39;);
                } else {
                    var result = &#39;&amp;lt;&#39; + tagName;
                }
                if (text) {
                    if (text[0] == &#39;&amp;lt;&#39;) {
                        return result + &#39;&amp;gt;&#39; + newLine + text + &#39;&amp;lt;/&#39; + tagName + &#39;&amp;gt;&#39; + newLine;
                    } else {
                        return result + &#39;&amp;gt;&#39; + text + &#39;&amp;lt;/&#39; + tagName + &#39;&amp;gt;&#39; + newLine;
                    }
                } else {
                    return result + &#39;/&amp;gt;&#39; + newLine;
                }
            }

            var categoryArray = [];
            
            for (var i = 0; i &amp;lt; jsonObj.length; i++) {
                var feedsArray = [];
                for (var j = 0; j &amp;lt; jsonObj[i][&#39;feeds&#39;].length; j++) {
                    var outlineFeed = getTagString(&#39;outline&#39;, undefined,
                                                  [ [ &#39;text&#39;,   jsonObj[i][&#39;feeds&#39;][j][&#39;title&#39;] ],
                                                    [ &#39;title&#39;,  jsonObj[i][&#39;feeds&#39;][j][&#39;title&#39;] ],
                                                    [ &#39;type&#39;,   &#39;rss&#39;                              ],
                                                    [ &#39;xmlUrl&#39;, jsonObj[i][&#39;feeds&#39;][j][&#39;xmlUrl&#39;]   ] ]);
                    feedsArray.push(outlineFeed);
                }
                var outlineCategory = getTagString(&#39;outline&#39;, feedsArray.join(&#39;&#39;),
                                                   [ [ &#39;text&#39;,  jsonObj[i][&#39;category&#39;] ],
                                                     [ &#39;title&#39;, jsonObj[i][&#39;category&#39;] ] ]);
                categoryArray.push(outlineCategory);
            }
            var titleTag = getTagString(&#39;title&#39;, &#39;My Feedly feeds&#39;);
            var nowTimeString = new Date().toUTCString();
            var dateCreatedTag = getTagString(&#39;dateCreated&#39;, nowTimeString);
            var dateModifiedTag = getTagString(&#39;dateModified&#39;, nowTimeString);
            var ownerNameTag = getTagString(&#39;ownerName&#39;, &#39;My name&#39;);
            var ownerEmailTag = getTagString(&#39;ownerEmail&#39;, &#39;My email&#39;);
            var headTag = getTagString(&#39;head&#39;, titleTag + dateCreatedTag + dateModifiedTag + ownerNameTag + ownerEmailTag);
            var bodyTag = getTagString(&#39;body&#39;, categoryArray.join(&#39;&#39;));
            var opmlTag = getTagString(&#39;opml&#39;, headTag + bodyTag);
            var xmlDeclaration = &#39;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&amp;gt;&#39; + newLine;
            return xmlDeclaration + opmlTag;
        }

        var bulk = docEvaluateArray(&quot;//div[@id=&#39;mainArea&#39;]/div[starts-with(@class,&#39;cell&#39;)]&quot;);
        var items = Array.prototype.slice.call(bulk[0].childNodes);
        for (var i = 1; i &amp;lt; bulk.length; i++) {
            var arrayTemp = Array.prototype.slice.call(bulk[i].childNodes);
            items = items.concat(arrayTemp);
        }
        var groupsArray = [];
        var categoryObj = {};
        var feedsArray = [];
        for (var j = 0; j &amp;lt; items.length; j++) {
            if (items[j].nodeName == &#39;H2&#39;) {
                if (categoryObj[&#39;category&#39;] == undefined) {
                    categoryObj[&#39;category&#39;] = items[j].innerHTML.replace(/^\s*/, &#39;&#39;).replace(/\s*$/, &#39;&#39;);
                } else {
                    categoryObj[&#39;feeds&#39;] = feedsArray;
                    groupsArray.push(categoryObj);
                    categoryObj = {};
                    feedsArray = [];
                    categoryObj[&#39;category&#39;] = items[j].innerHTML.replace(/^\s*/, &#39;&#39;).replace(/\s*$/, &#39;&#39;);
                }
            } else if (items[j].nodeName == &#39;DIV&#39;) {
                var feedObj = {&#39;title&#39; : items[j].childNodes[2].nodeValue.replace(/^[\s\n]*/g, &#39;&#39;).replace(/[\s\n]*$/g, &#39;&#39;),
                               &#39;xmlUrl&#39; : items[j].getAttribute(&#39;data-uri&#39;).replace(&#39;subscription/feed/&#39;,&#39;&#39;) };
                feedsArray.push(feedObj);
            }
        }
        var result = document.createElement(&#39;textarea&#39;);
        result.setAttribute(&#39;rows&#39;, &#39;10&#39;);
        result.setAttribute(&#39;cols&#39;, &#39;100%&#39;);
        document.querySelector(&#39;div#mainBar&#39;).appendChild(result);

        var choice = confirm(&#39;Press OK to get JSON,\nCancel to get OPML&#39;);
        if (choice) {
            result.value = JSON.stringify(groupsArray, undefined, 2);
        } else {
            result.value = jsonToOPMLString(groupsArray);
        }

    }

})();
&lt;/code&gt;&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://oguracodes.blogspot.com/feeds/6332125262775768322/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5064621153219489953/6332125262775768322' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5064621153219489953/posts/default/6332125262775768322'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5064621153219489953/posts/default/6332125262775768322'/><link rel='alternate' type='text/html' href='http://oguracodes.blogspot.com/2013/03/javascript-feedly-feeds-extractor.html' title='JavaScript: Feedly feeds extractor bookmarklet'/><author><name>Unknown</name><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-5064621153219489953.post-3537849626171672383</id><published>2012-09-05T00:50:00.000+09:00</published><updated>2013-05-01T21:56:27.900+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="math"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><title type='text'>Divisors.</title><content type='html'>I&#39;ve been thinking about how to find divisors of an integer
&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;
  &lt;mi&gt;i&lt;/mi&gt;
&lt;/math&gt;
 (supposedly between 10 and 100 or so) manually and as effortlessly as possible.&lt;br /&gt;
I wrote the code below to check if the results are correct by comparison with a simple brute-force way.&lt;br /&gt;
In hand calculation, you have to find an integer 
&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;
  &lt;mi&gt;a&lt;/mi&gt;
&lt;/math&gt;
 that satisfies the condition
&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;
&lt;mrow&gt;
  &lt;msup&gt;
          &lt;mi&gt;a&lt;/mi&gt;
        &lt;mn&gt;2&lt;/mn&gt;
  &lt;/msup&gt;
  &lt;mo&gt;≤&lt;/mo&gt;
  &lt;mi&gt;i&lt;/mi&gt;
  &lt;mo&gt;&amp;lt;&lt;/mo&gt;
  &lt;msup&gt;
        &lt;mrow&gt;
          &lt;mfenced close=&quot;)&quot; open=&quot;(&quot; separators=&quot;,&quot;&gt;
            &lt;mrow&gt;
              &lt;mi&gt;a&lt;/mi&gt;
              &lt;mo&gt;+&lt;/mo&gt;
              &lt;mn&gt;1&lt;/mn&gt;
            &lt;/mrow&gt;
          &lt;/mfenced&gt;
        &lt;/mrow&gt;
        &lt;mn&gt;2&lt;/mn&gt;
  &lt;/msup&gt;
&lt;/mrow&gt;
&lt;/math&gt;
instead of math.sqrt(i).&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code class=&quot;language-python&quot;&gt;#!/usr/bin/env python
# -*- coding: utf-8 -*-
# divisors.py - returns list of divisors
import math, sys, traceback

def check1by1(int_num): # check all numbers from 1 to int_num.
    int_num = abs(int_num)
    if int_num == 0:
        return None
    else:
        div_list = []
        for i in range(1, int_num + 1):
            if int_num % i == 0:
                div_list.append(i)
        return div_list

def getdivisors(int_num): # avoid unnecessary calculation.
    &quot;&quot;&quot;Return list of divisors of int_num. (None if int_num == 0.)&quot;&quot;&quot;
    int_num = abs(int_num)
    if int_num == 1:
        return [1]
    elif int_num == 0:
        return None
    else:
        div_list = [1, int_num]
        start = 2
        step = 1
        if int_num % 2 != 0: # if int_num is odd, even divisors are excluded.
            start = 3
            step = 2
        for i in range(start, int(math.sqrt(int_num)) + 1, step):
            if int_num % i == 0:
                div_list.append(i)
                if i != int_num / i:
                    div_list.append(int_num / i)
        return sorted(div_list)

if __name__ == &#39;__main__&#39;:
    try:
        num = int(sys.argv[1])
    except IndexError:
        print(&#39;usage: python divisors.py integer&#39;)
        sys.exit(0)
    simple = check1by1(num)
    print(&#39;check1by1  &#39;, num, simple)
    shortcut = getdivisors(num)
    print(&#39;getdivisors&#39;, num, shortcut)
    if simple != shortcut: # Error checking.
        print(&#39;Error.&#39;)
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
Update, September 7, 11:43 p.m. JST: xrange() instead of range(), benchmark().&lt;br /&gt;
&lt;pre&gt;&lt;code class=&quot;language-python&quot;&gt;#!/usr/bin/env python
# -*- coding: utf-8 -*-
# divisors.py - returns list of divisors
import math, sys, time

def benchmark(int_num, fn):
    start_time = time.clock()
    result = fn(int_num)
    elapsed_time = time.clock() - start_time
    return result, elapsed_time

def check1by1(int_num): # check all numbers from 1 to int_num.
    int_num = abs(int_num)
    if int_num == 0:
        return None
    else:
        div_list = []
        for i in xrange(1, int_num + 1):
            if int_num % i == 0:
                div_list.append(i)
        return div_list

def getdivisors(int_num): # avoid unnecessary calculation.
    &quot;&quot;&quot;Return list of divisors of int_num. (None if int_num == 0.)&quot;&quot;&quot;
    int_num = abs(int_num)
    if int_num == 1:
        return [1]
    elif int_num == 0:
        return None
    else:
        div_list = [1, int_num]
        start = 2
        step = 1
        if int_num % 2 != 0: # if int_num is odd, even divisors are excluded.
            start = 3
            step = 2
        for i in xrange(start, int(math.sqrt(int_num)) + 1, step):
            if int_num % i == 0:
                div_list.append(i)
                div_result = int_num / i
                if i != div_result:
                    div_list.append(div_result)
        return sorted(div_list)

if __name__ == &#39;__main__&#39;:
    try:
        num = int(sys.argv[1])
    except IndexError:
        print(&#39;usage: python divisors.py integer&#39;)
        sys.exit(0)
    simple = benchmark(num, check1by1)
    shortcut = benchmark(num, getdivisors)
    if simple[0] != shortcut[0]: # Error checking.
        print(&#39;Error.&#39;)
    print(&#39;check1by1  &#39;, num, simple)
    print(&#39;getdivisors&#39;, num, shortcut)
    print(&#39;time difference: &#39; + str(simple[1] - shortcut[1]) + &#39; sec.&#39;)
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
</content><link rel='replies' type='application/atom+xml' href='http://oguracodes.blogspot.com/feeds/3537849626171672383/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5064621153219489953/3537849626171672383' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5064621153219489953/posts/default/3537849626171672383'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5064621153219489953/posts/default/3537849626171672383'/><link rel='alternate' type='text/html' href='http://oguracodes.blogspot.com/2012/09/divisors.html' title='Divisors.'/><author><name>Unknown</name><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-5064621153219489953.post-84559756903919009</id><published>2012-09-02T20:04:00.000+09:00</published><updated>2013-05-01T22:01:10.945+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="bookmark"/><category scheme="http://www.blogger.com/atom/ns#" term="delicious"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><title type='text'>Python: Filtering Delicious bookmarks by tags</title><content type='html'>&lt;a href=&quot;http://oguracodes.blogspot.com/2012/09/python-converting-delicious-bookmarks.html&quot;&gt;bmconv.py&lt;/a&gt; is required.&lt;br /&gt;
&lt;pre&gt;&lt;code class=&quot;language-python&quot;&gt;#!/usr/bin/env python
# -*- coding: utf-8 -*-
# bmfilter.py - Filter bookmarks by tags.
import bmconv

def tagfilter(tags_list):
    &quot;&quot;&quot;Return a list of bookmark dictionaries.&quot;&quot;&quot;
    return filter(lambda x: set(tags_list) &amp;lt;= set(x[&#39;tags&#39;]), bmconv.main())

if __name__ == &#39;__main__&#39;:
    print(tagfilter([&#39;book&#39;, &#39;history&#39;]))
&lt;/code&gt;&lt;/pre&gt;
The above example outputs only bookmarks that have both &#39;book&#39; and &#39;history&#39; tags.&lt;br /&gt;
&lt;br /&gt;
Update, September 2, 8:41 p.m. JST: AND/OR filters.&lt;br /&gt;
&lt;pre&gt;&lt;code class=&quot;language-python&quot;&gt;#!/usr/bin/env python
# -*- coding: utf-8 -*-
# bmfilter.py - Filter bookmarks by tags.
import bmconv

def andfilter(tags_list):
    &quot;&quot;&quot;Return a list of bookmarks that have all the tags in tags_list.&quot;&quot;&quot;
    return filter(lambda x: set(tags_list) &amp;lt;= set(x[&#39;tags&#39;]), bmconv.main())

def orfilter(tags_list):
    &quot;&quot;&quot;Return a list of bookmarks that have any of the tags in tags_list.&quot;&quot;&quot;
    return filter(lambda x: len(set(tags_list).intersection(set(x[&#39;tags&#39;]))) &amp;gt; 0, bmconv.main())

if __name__ == &#39;__main__&#39;:
#    print(andfilter([&#39;book&#39;, &#39;history&#39;]))
    print(orfilter([&#39;cd&#39;, &#39;dvd&#39;]))
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
Update, September 3, 6:59 p.m. JST: Changed function name and arguments. Added case sensitivity switch.&lt;br /&gt;
&lt;pre&gt;&lt;code class=&quot;language-python&quot;&gt;#!/usr/bin/env python
# -*- coding: utf-8 -*-
# bmfilter.py - Filter bookmarks by tags.
import bmconv

def tagfilter(tags_list, bookmarks_list, filter_type_and=True, ignore_case=True):
    &quot;&quot;&quot;Return a list of dictionaries of bookmarks filtered from bookmarks_list by tags in tags_list.&quot;&quot;&quot;
    
    def proc_case(str_list):
        if ignore_case:
            return map(lambda x: x.upper(), str_list)
        else: # case sensitive
            return str_list

    if filter_type_and: # AND
        return filter(lambda x: set(proc_case(tags_list)) &amp;lt;= set(proc_case(x[&#39;tags&#39;])), bookmarks_list)
    else: # OR
        return filter(lambda x: len(set(proc_case(tags_list)).intersection(set(proc_case(x[&#39;tags&#39;])))) &amp;gt; 0, bookmarks_list)

if __name__ == &#39;__main__&#39;:
    print(tagfilter([&#39;book&#39;, &#39;history&#39;], bmconv.main()))
##      bookmarks that have both tags &#39;book&#39; and &#39;history&#39;
##      (case insensitive. also matches &#39;Book&#39;, &#39;History&#39;, etc.)
    print(tagfilter([&#39;cd&#39;, &#39;dvd&#39;], bmconv.main(), False))
##      bookmarks that have any of tags &#39;cd&#39; and &#39;dvd&#39;
##      (case insensitive. also matches &#39;CD&#39;, &#39;Cd&#39;, &#39;DVD&#39;, &#39;Dvd&#39;, etc.)
    print(tagfilter([&#39;Apple&#39;], bmconv.main(), True, False))
##      doesn&#39;t match &#39;apple&#39;.
&lt;/code&gt;&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://oguracodes.blogspot.com/feeds/84559756903919009/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5064621153219489953/84559756903919009' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5064621153219489953/posts/default/84559756903919009'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5064621153219489953/posts/default/84559756903919009'/><link rel='alternate' type='text/html' href='http://oguracodes.blogspot.com/2012/09/python-filtering-delicious-bookmarks-by.html' title='Python: Filtering Delicious bookmarks by tags'/><author><name>Unknown</name><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-5064621153219489953.post-322671516380279251</id><published>2012-09-02T15:51:00.000+09:00</published><updated>2013-05-01T22:02:44.171+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="bookmark"/><category scheme="http://www.blogger.com/atom/ns#" term="delicious"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><title type='text'>Python: Converting Delicious bookmarks.</title><content type='html'>&lt;pre&gt;&lt;code class=&quot;language-python&quot;&gt;#!/usr/bin/env python
# -*- coding: utf-8 -*-
# bmconv.py - Read Delicious.com bookmark file and convert it into a list of dictionaries.
import re

bookmark_file = &#39;delicious.html&#39;

def main():
    &quot;&quot;&quot;Return a list of dictionaries of bookmarks.&quot;&quot;&quot;
    lines_list = []
    with open(bookmark_file, &#39;r&#39;) as f:
        lines_list = f.readlines()
    entries_list = []
    for idx, line in enumerate(lines_list):
        entry = {}
        if re.match(r&#39;^&amp;lt;DT&amp;gt;&#39;, line):
            entry[&#39;url&#39;] = re.match(r&#39;^.*HREF=\&quot;([^\&quot;]+)\&quot;&#39;, line).group(1)
            entry[&#39;add_date&#39;] = re.match(r&#39;^.*ADD_DATE=\&quot;([^\&quot;]+)\&quot;&#39;, line).group(1)
            entry[&#39;private&#39;] = re.match(r&#39;^.*PRIVATE=\&quot;([^\&quot;]*)\&quot;&#39;, line).group(1)
            entry[&#39;tags&#39;] = re.match(r&#39;^.*TAGS=\&quot;([^\&quot;]*)\&quot;&#39;, line).group(1).split(&#39;,&#39;)
            entry[&#39;title&#39;] = re.match(r&#39;^.*&amp;lt;A [^&amp;gt;]+&amp;gt;(.*)&amp;lt;/A&amp;gt;&#39;, line).group(1)
            if re.match(r&#39;^&amp;lt;DD&amp;gt;&#39;, lines_list[idx + 1]):
                dd_tmp = []
                increment = 1
                try:
                    while True:
                        if re.match(r&#39;^&amp;lt;DT&amp;gt;&#39;, lines_list[idx + increment]):
                            break
                        dd_tmp.append(re.match(r&#39;^(&amp;lt;DD&amp;gt;)?(.*)$&#39;, lines_list[idx + increment]).group(2))
                        increment += 1
                except:
                    pass
                entry[&#39;description&#39;] = &#39;\n&#39;.join(dd_tmp)
            entries_list.append(entry)
    return entries_list

if __name__ == &#39;__main__&#39;:
    print(main())
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;a href=&quot;https://docs.google.com/open?id=0B9q7kolvmjdySG1waWh5R2F0dGs&quot;&gt;Download bmconv.py from Google Drive&lt;/a&gt;
</content><link rel='replies' type='application/atom+xml' href='http://oguracodes.blogspot.com/feeds/322671516380279251/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5064621153219489953/322671516380279251' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5064621153219489953/posts/default/322671516380279251'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5064621153219489953/posts/default/322671516380279251'/><link rel='alternate' type='text/html' href='http://oguracodes.blogspot.com/2012/09/python-converting-delicious-bookmarks.html' title='Python: Converting Delicious bookmarks.'/><author><name>Unknown</name><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-5064621153219489953.post-4643783988319239698</id><published>2012-08-26T13:59:00.001+09:00</published><updated>2013-05-02T19:38:36.714+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="python"/><category scheme="http://www.blogger.com/atom/ns#" term="rss"/><category scheme="http://www.blogger.com/atom/ns#" term="time"/><title type='text'>Using PyRSS2Gen in time zones other than GMT</title><content type='html'>&lt;a href=&quot;http://pypi.python.org/pypi/PyRSS2Gen&quot;&gt;PyRSS2Gen&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code class=&quot;language-diff&quot;&gt;--- PyRSS2Gen.py.orig 2012-08-25 10:22:14.292968887 +0000
+++ PyRSS2Gen.py 2012-08-25 13:38:58.838836110 +0000
@@ -57,12 +57,13 @@
     # Isn&#39;t there a standard way to do this for Python?  The
     # rfc822 and email.Utils modules assume a timestamp.  The
     # following is based on the rfc822 module.
-    return &quot;%s, %02d %s %04d %02d:%02d:%02d GMT&quot; % (
+    return (&quot;%s, %02d %s %04d %02d:%02d:%02d %s&quot; % (
             [&quot;Mon&quot;, &quot;Tue&quot;, &quot;Wed&quot;, &quot;Thu&quot;, &quot;Fri&quot;, &quot;Sat&quot;, &quot;Sun&quot;][dt.weekday()],
             dt.day,
             [&quot;Jan&quot;, &quot;Feb&quot;, &quot;Mar&quot;, &quot;Apr&quot;, &quot;May&quot;, &quot;Jun&quot;,
              &quot;Jul&quot;, &quot;Aug&quot;, &quot;Sep&quot;, &quot;Oct&quot;, &quot;Nov&quot;, &quot;Dec&quot;][dt.month-1],
-            dt.year, dt.hour, dt.minute, dt.second)
+            dt.year, dt.hour, dt.minute, dt.second,
+            dt.strftime(&#39;%z&#39;))).strip()
 
         
 ##
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
Update, August 28, 2:07 p.m. JST: Output timezone in any case (&#39;GMT&#39; by default).&lt;br /&gt;
&lt;pre&gt;&lt;code class=&quot;language-diff&quot;&gt;--- PyRSS2Gen.py.orig 2012-08-25 10:22:14.292968887 +0000
+++ PyRSS2Gen.py 2012-08-28 04:31:25.535324750 +0000
@@ -57,12 +57,15 @@
     # Isn&#39;t there a standard way to do this for Python?  The
     # rfc822 and email.Utils modules assume a timestamp.  The
     # following is based on the rfc822 module.
-    return &quot;%s, %02d %s %04d %02d:%02d:%02d GMT&quot; % (
+    tz = &#39;GMT&#39; # default timezone
+    if dt.tzinfo:
+        tz = dt.strftime(&#39;%z&#39;)
+    return &quot;%s, %02d %s %04d %02d:%02d:%02d %s&quot; % (
             [&quot;Mon&quot;, &quot;Tue&quot;, &quot;Wed&quot;, &quot;Thu&quot;, &quot;Fri&quot;, &quot;Sat&quot;, &quot;Sun&quot;][dt.weekday()],
             dt.day,
             [&quot;Jan&quot;, &quot;Feb&quot;, &quot;Mar&quot;, &quot;Apr&quot;, &quot;May&quot;, &quot;Jun&quot;,
              &quot;Jul&quot;, &quot;Aug&quot;, &quot;Sep&quot;, &quot;Oct&quot;, &quot;Nov&quot;, &quot;Dec&quot;][dt.month-1],
-            dt.year, dt.hour, dt.minute, dt.second)
+            dt.year, dt.hour, dt.minute, dt.second, tz)
 
         
 ##
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
Update, September 1, 5:06 p.m. JST: Simplified the patch.&lt;br /&gt;
&lt;pre&gt;&lt;code class=&quot;language-diff&quot;&gt;--- PyRSS2Gen.py.orig 2012-08-25 10:22:14.292968887 +0000
+++ PyRSS2Gen.py 2012-09-01 07:16:36.291449545 +0000
@@ -57,12 +57,13 @@
     # Isn&#39;t there a standard way to do this for Python?  The
     # rfc822 and email.Utils modules assume a timestamp.  The
     # following is based on the rfc822 module.
-    return &quot;%s, %02d %s %04d %02d:%02d:%02d GMT&quot; % (
+    return &quot;%s, %02d %s %04d %02d:%02d:%02d %s&quot; % (
             [&quot;Mon&quot;, &quot;Tue&quot;, &quot;Wed&quot;, &quot;Thu&quot;, &quot;Fri&quot;, &quot;Sat&quot;, &quot;Sun&quot;][dt.weekday()],
             dt.day,
             [&quot;Jan&quot;, &quot;Feb&quot;, &quot;Mar&quot;, &quot;Apr&quot;, &quot;May&quot;, &quot;Jun&quot;,
              &quot;Jul&quot;, &quot;Aug&quot;, &quot;Sep&quot;, &quot;Oct&quot;, &quot;Nov&quot;, &quot;Dec&quot;][dt.month-1],
-            dt.year, dt.hour, dt.minute, dt.second)
+            dt.year, dt.hour, dt.minute, dt.second,
+            dt.strftime(&#39;%z&#39;) if dt.tzinfo else &#39;GMT&#39;) # default timezone is &#39;GMT&#39;
 
         
 ##
&lt;/code&gt;&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://oguracodes.blogspot.com/feeds/4643783988319239698/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5064621153219489953/4643783988319239698' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5064621153219489953/posts/default/4643783988319239698'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5064621153219489953/posts/default/4643783988319239698'/><link rel='alternate' type='text/html' href='http://oguracodes.blogspot.com/2012/08/using-pyrss2gen-in-time-zones-other.html' title='Using PyRSS2Gen in time zones other than GMT'/><author><name>Unknown</name><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-5064621153219489953.post-1971511747581141312</id><published>2012-08-05T21:05:00.000+09:00</published><updated>2013-05-02T14:05:21.775+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="encoding"/><category scheme="http://www.blogger.com/atom/ns#" term="ruby"/><title type='text'>Making ruby refe output without garble on UTF-8 terminal</title><content type='html'>Edit refe-1_9_3 as follows:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;#!/bin/sh
cd &quot;`dirname &quot;$0&quot;`&quot;
exec ruby -Ke -I bitclust/lib bitclust/bin/refe -d db-1_9_3 -e w &quot;$@&quot;&lt;/code&gt;&lt;/pre&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
(add &#39;&lt;b&gt;-e w&lt;/b&gt;&#39; as an option to refe)</content><link rel='replies' type='application/atom+xml' href='http://oguracodes.blogspot.com/feeds/1971511747581141312/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5064621153219489953/1971511747581141312' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5064621153219489953/posts/default/1971511747581141312'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5064621153219489953/posts/default/1971511747581141312'/><link rel='alternate' type='text/html' href='http://oguracodes.blogspot.com/2012/08/making-ruby-refe-output-without-garble.html' title='Making ruby refe output without garble on UTF-8 terminal'/><author><name>Unknown</name><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-5064621153219489953.post-316142518056005590</id><published>2012-01-03T17:09:00.000+09:00</published><updated>2013-05-02T19:39:54.879+09:00</updated><title type='text'>Patch for test_commands.py in Python 2.5.6</title><content type='html'>Something seems to be wrong with a test script in Python 2.5.6.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;Environment:&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;CentOS 6.2 x86_64 on VMware&lt;/li&gt;
&lt;li&gt;Python 2.5.6&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;Symptom:&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;make test&lt;/span&gt; fails.&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Helvetica Neue&#39;, Arial, Helvetica, sans-serif; font-size: large;&quot;&gt;Solution:&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Apply the patch available &lt;a href=&quot;http://bugs.python.org/file21827/bug_11946.patch&quot;&gt;here&lt;/a&gt;&amp;nbsp;on &lt;a href=&quot;http://bugs.python.org/issue11946&quot;&gt;this issue&lt;/a&gt;&amp;nbsp;or the following (&lt;a href=&quot;https://docs.google.com/open?id=0B9q7kolvmjdyMGU3MTllYmQtNWRkZC00ZThjLWI0YWItMzU5MmFjMmQ5Yjk1&quot;&gt;patch&lt;/a&gt; on my Google Docs) to&amp;nbsp;Lib/test/test_commands.py.&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code class=&quot;language-diff&quot;&gt;--- Lib/test/test_commands.py.orig 2006-06-29 04:10:08.000000000 +0000
+++ Lib/test/test_commands.py 2012-01-02 11:19:28.535171924 +0000
@@ -46,11 +46,7 @@
         #     drwxr-xr-x   15 Joe User My Group     4096 Aug 12 12:50 /
         # Note that the first case above has a space in the group name
         # while the second one has a space in both names.
-        pat = r&#39;&#39;&#39;d.........   # It is a directory.
-                  \+?          # It may have ACLs.
-                  \s+\d+       # It has some number of links.
-                  [^/]*        # Skip user, group, size, and date.
-                  /\.          # and end with the name of the file.
+        pat = r&#39;&#39;&#39;^.*(\/\.)[\ ]*[\n\r]*$
                &#39;&#39;&#39;
 
         self.assert_(re.match(pat, getstatus(&quot;/.&quot;), re.VERBOSE))

&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://oguracodes.blogspot.com/feeds/316142518056005590/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5064621153219489953/316142518056005590' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5064621153219489953/posts/default/316142518056005590'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5064621153219489953/posts/default/316142518056005590'/><link rel='alternate' type='text/html' href='http://oguracodes.blogspot.com/2012/01/patch-for-testcommandspy-in-python-256.html' title='Patch for test_commands.py in Python 2.5.6'/><author><name>Unknown</name><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-5064621153219489953.post-1437789142408876850</id><published>2012-01-03T02:03:00.001+09:00</published><updated>2013-05-02T19:59:54.185+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="centos"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><category scheme="http://www.blogger.com/atom/ns#" term="ssl"/><title type='text'>Tips for building Python 2.5.6 with SSL on CentOS 6.2 (x86_64)</title><content type='html'>You need to edit the following files because of the headers and libraries paths on 64bit CentOS.&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Modules/Setup.dist (Python 2.5.6)&lt;/li&gt;
&lt;li&gt;setup.py (&lt;a href=&quot;http://pypi.python.org/pypi/ssl/1.15&quot;&gt;ssl&lt;/a&gt;&amp;nbsp;package)&lt;/li&gt;
&lt;/ul&gt;
First, edit Modules/Setup.dist as follows (&lt;a href=&quot;https://docs.google.com/open?id=0B9q7kolvmjdyMzVlOGU2YzYtZTFjOC00YTY5LWFlNzUtNjVmNWQyNWU4MzQx&quot;&gt;patch file&lt;/a&gt;&amp;nbsp;on Google Docs page):&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code class=&quot;language-diff&quot;&gt;--- Modules/Setup.dist.orig 2006-08-06 07:26:21.000000000 +0000
+++ Modules/Setup.dist 2012-01-02 16:09:27.904863909 +0000
@@ -203,10 +203,10 @@
 
 # Socket module helper for SSL support; you must comment out the other
 # socket line above, and possibly edit the SSL variable:
-#SSL=/usr/local/ssl
-#_ssl _ssl.c \
-# -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
-# -L$(SSL)/lib -lssl -lcrypto
+SSL=/usr
+_ssl _ssl.c \
+ -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
+ -L$(SSL)/lib64 -lssl -lcrypto
 
 # The crypt module is now disabled by default because it breaks builds
 # on many systems (where -lcrypt is needed), e.g. Linux (I believe).
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
Then build Python 2.5.6 as usual.&lt;br /&gt;
&lt;br /&gt;
Next, you may need ssl package from pypi.&lt;br /&gt;
Edit setup.py as follows (&lt;a href=&quot;https://docs.google.com/open?id=0B9q7kolvmjdyNjQ5YjNiN2YtYjk3OC00NTIxLThlMzUtZTdjNWIyMzZmNGVi&quot;&gt;patch file&lt;/a&gt;&amp;nbsp;on Google Docs page):&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code class=&quot;language-diff&quot;&gt;--- setup.py.orig 2009-07-28 00:45:12.000000000 +0000
+++ setup.py 2012-01-02 16:40:09.447439694 +0000
@@ -130,7 +130,8 @@
             ssl_incs += krb5_h
 
     ssl_libs = find_library_file(compiler, &#39;ssl&#39;,
-                                 [&#39;/usr/lib&#39;],
+                                 [&#39;/usr/lib&#39;,
+                                  &#39;/usr/lib64&#39;],
                                  [&#39;/usr/local/lib&#39;,
                                   &#39;/usr/local/ssl/lib&#39;,
                                   &#39;/usr/contrib/ssl/lib/&#39;
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
Then, build the package with &lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;make&lt;/span&gt;.&lt;br /&gt;
&lt;br /&gt;
cf.&amp;nbsp;&lt;a href=&quot;http://paltman.com/2007/11/15/getting-ssl-support-in-python-251/&quot;&gt;Getting SSL Support in Python 2.5.1&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://oguracodes.blogspot.com/feeds/1437789142408876850/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5064621153219489953/1437789142408876850' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5064621153219489953/posts/default/1437789142408876850'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5064621153219489953/posts/default/1437789142408876850'/><link rel='alternate' type='text/html' href='http://oguracodes.blogspot.com/2012/01/tips-for-building-python-256-with-ssl.html' title='Tips for building Python 2.5.6 with SSL on CentOS 6.2 (x86_64)'/><author><name>Unknown</name><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-5064621153219489953.post-2760906663850121474</id><published>2011-09-19T00:20:00.000+09:00</published><updated>2013-05-02T14:16:47.131+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="r-project"/><category scheme="http://www.blogger.com/atom/ns#" term="syntax"/><title type='text'>R brush for SyntaxHighlighter</title><content type='html'>(Update, 2013-05-02 14:15 JST: This article is deprecated because I changed the template of this blog.)&lt;br /&gt;
&lt;br /&gt;
I&#39;m working on a custom brush to extend&amp;nbsp;&lt;a href=&quot;http://alexgorbatchev.com/SyntaxHighlighter/&quot;&gt;SyntaxHighlighter&lt;/a&gt;&amp;nbsp;to support the syntax of R.&lt;br /&gt;
The project is on &lt;a href=&quot;https://github.com/ogra/SyntaxHighlighter&quot;&gt;GitHub&lt;/a&gt;.&lt;br /&gt;
The brush file is &lt;a href=&quot;https://github.com/ogra/SyntaxHighlighter/blob/master/scripts/shBrushR.js&quot;&gt;SyntaxHighlighter/scripts/shBrushR.js&lt;/a&gt;.&lt;br /&gt;
Here&#39;s an example.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush: r&quot;&gt;resultframe &amp;lt;- sessionframe &amp;lt;- temp &amp;lt;- bpdata[1,]
transform(resultframe, morningbedtime=c(0))
resultframe &amp;lt;- resultframe[0,]
for (i in 2:length(bpdata$ID)) {
  tempnext &amp;lt;- bpdata[i,]
  if ((abs(difftime(temp$datetime, tempnext$datetime, units=&quot;mins&quot;)) &amp;gt; 10) || (i == length(bpdata$ID))) {
    if (i == length(bpdata$ID)) {
      sessionframe &amp;lt;- merge(sessionframe, tempnext, all=T)
      sessiondatetime &amp;lt;- strptime(tempnext$datetime, &quot;%Y-%m-%d %H:%M:%S&quot;)
    } else {
      sessiondatetime &amp;lt;- strptime(temp$datetime, &quot;%Y-%m-%d %H:%M:%S&quot;)
    }
    sessionmax &amp;lt;- mean(sessionframe$max)
    sessionmin &amp;lt;- mean(sessionframe$min)
    sessionbpm &amp;lt;- mean(sessionframe$bpm)
    
    if ((morningbegin &amp;lt;= sessiondatetime$hour) &amp;amp;&amp;amp; (sessiondatetime$hour &amp;lt; morningend)) {
      sessionmorningbedtime &amp;lt;- c(0)
    } else {
      sessionmorningbedtime &amp;lt;- c(1)
    }
    
    resultframe &amp;lt;- merge(resultframe, data.frame(datetime=sessiondatetime, max=sessionmax, min=sessionmin, bpm=sessionbpm, morningbedtime=sessionmorningbedtime), all=T)
    sessionframe &amp;lt;- temp &amp;lt;- tempnext
  } else {
    sessionframe &amp;lt;- merge(sessionframe, tempnext, all=T)
    temp &amp;lt;- tempnext
  }
}
&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://oguracodes.blogspot.com/feeds/2760906663850121474/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5064621153219489953/2760906663850121474' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5064621153219489953/posts/default/2760906663850121474'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5064621153219489953/posts/default/2760906663850121474'/><link rel='alternate' type='text/html' href='http://oguracodes.blogspot.com/2011/09/r-brush-for-syntaxhighlighter.html' title='R brush for SyntaxHighlighter'/><author><name>Unknown</name><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-5064621153219489953.post-8168816018051492643</id><published>2011-08-09T22:11:00.002+09:00</published><updated>2011-08-09T23:40:59.094+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="chart"/><category scheme="http://www.blogger.com/atom/ns#" term="default"/><category scheme="http://www.blogger.com/atom/ns#" term="excel"/><category scheme="http://www.blogger.com/atom/ns#" term="spreadsheet"/><title type='text'>Default settings for bar/column chart axes in major spreadsheet applications may lead to chart junk.</title><content type='html'>&lt;p&gt;Depending on data, Excel, OpenOffice.org Calc, Google Docs spreadsheet, which are the most popular spreadsheet applications, scale chart axes differently by default.&lt;/p&gt;
&lt;p&gt;Below are examples. (twitpic.com)&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://twitpic.com/639nsh&quot;&gt;Excel 2007&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://twitpic.com/639phs&quot;&gt;OpenOffice.org Calc 3.3.0&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://twitpic.com/63awov&quot;&gt;Google Docs spreadsheet&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Note that the vertical axes start from 0, 75, 80 depending on the values in the charts in Excel and OpenOffice.org Calc. Google Docs&#39; chart has its vertical axis from 80, not zero.&lt;/p&gt;
&lt;p&gt;The problem is that the mysterious feature may lead to chart junk because the axes don&#39;t start from zero and are misleading.&lt;/p&gt;
&lt;p&gt;I couldn&#39;t find how to fix this by changing default settings with these applications.&lt;/p&gt;
&lt;p&gt;So I&#39;m working on Excel macro which scans all the bar/column charts in the current book and make their axes start from zero.&lt;/p&gt;
&lt;p&gt;You can download &lt;a href=&quot;https://docs.google.com/leaf?id=0B9q7kolvmjdyMjRhOGMwZjUtYWJmYi00MjI0LTgxMWYtZTdiNTM2MzMwYjY2&amp;sort=name&amp;layout=list&amp;num=50&quot;&gt;Excel macro book file (FixChartAxes.xlsm)&lt;/a&gt; and &lt;a href=&quot;https://docs.google.com/leaf?id=0B9q7kolvmjdyNGQ3ODA4ZTgtZTQ2Ni00Mzg1LThmNWYtNTI0ZWI1Nzk2N2Ez&amp;sort=name&amp;layout=list&amp;num=50&quot;&gt;Excel addin file (FixChartAxes.xlam)&lt;/a&gt;. (both from Google Docs)&lt;/p&gt;
&lt;p&gt;You can see the source code of the macro at &lt;a href=&quot;https://gist.github.com/1133946&quot;&gt;Gist&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I think the best solution is that Microsoft fixes this problem, because it is the most influential company in the spreadsheet software industry.&lt;/p&gt;
&lt;p&gt;To Microsoft: Please make the default settings of bar/column chart axes start from zero by default.&lt;/p&gt;
</content><link rel='replies' type='application/atom+xml' href='http://oguracodes.blogspot.com/feeds/8168816018051492643/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5064621153219489953/8168816018051492643' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5064621153219489953/posts/default/8168816018051492643'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5064621153219489953/posts/default/8168816018051492643'/><link rel='alternate' type='text/html' href='http://oguracodes.blogspot.com/2011/08/default-settings-for-barcolumn-chart.html' title='Default settings for bar/column chart axes in major spreadsheet applications may lead to chart junk.'/><author><name>Unknown</name><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-5064621153219489953.post-7366479226748662569</id><published>2011-07-02T13:41:00.018+09:00</published><updated>2011-07-02T14:34:44.243+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="r-project"/><category scheme="http://www.blogger.com/atom/ns#" term="vector"/><title type='text'>R memo: elements&#39; positions in vector under conditions</title><content type='html'>First, make a vector.&lt;br /&gt;
&lt;pre&gt;
&amp;gt; x &amp;lt;- c(10,20,30)
&amp;gt; x
[1] 10 20 30
&lt;/pre&gt;
If you want to get positions of the elements in vector x which meet a condition, for example, x &amp;gt; 10, you can do like this:
&lt;pre&gt;
&amp;gt; (1:length(x))[x &amp;gt; 10]
[1] 2 3
&lt;/pre&gt;
The second and third elements meet the condition.&lt;br /&gt;
&lt;br /&gt;
The first part,
&lt;pre&gt;
&amp;gt; (1:length(x))
[1] 1 2 3
&lt;/pre&gt;
gives you a vector which counts from 1 up to the number of the elements in x.&lt;br /&gt;
&lt;br /&gt;
The last part,
&lt;pre&gt;
&amp;gt; x &amp;gt; 10
[1] FALSE  TRUE  TRUE
&lt;/pre&gt;
gives you a vector which shows if each element meets the condition (greater than 10).&lt;br /&gt;
&lt;br /&gt;
Then, you can get only the elements which correspond to TRUE by
&lt;pre&gt;&amp;gt; (1:length(x))[x &amp;gt; 10]
&lt;/pre&gt;
&lt;br /&gt;
c.f. &lt;a href=&quot;http://cse.naro.affrc.go.jp/takezawa/r-tips/r/13.html&quot;&gt;13. ベクトル要素へのアクセス&lt;/a&gt;&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://oguracodes.blogspot.com/feeds/7366479226748662569/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5064621153219489953/7366479226748662569' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5064621153219489953/posts/default/7366479226748662569'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5064621153219489953/posts/default/7366479226748662569'/><link rel='alternate' type='text/html' href='http://oguracodes.blogspot.com/2011/07/r-memo-elements-positions-in-vector.html' title='R memo: elements&#39; positions in vector under conditions'/><author><name>Unknown</name><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-5064621153219489953.post-8683994384019577824</id><published>2011-05-07T21:55:00.035+09:00</published><updated>2011-05-08T13:51:12.039+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="mathml"/><title type='text'>MathML test</title><content type='html'>&lt;p&gt;This post is for testing &lt;a href=&quot;http://www.mathjax.org/&quot;&gt;MathJax&lt;/a&gt; on Blogger.&lt;/p&gt;
&lt;p&gt;
&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;msup&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;x&lt;/mi&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mrow&gt;&lt;/msup&gt;&lt;mo&gt;-&lt;/mo&gt;&lt;msup&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;y&lt;/mi&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mrow&gt;&lt;/msup&gt;&lt;/math&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;mfenced separators=&quot;&quot;&gt;&lt;mtable&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;mtr&gt;&lt;mtd&gt;&lt;mn&gt;3&lt;/mn&gt;&lt;/mtd&gt;&lt;mtd&gt;&lt;mn&gt;4&lt;/mn&gt;&lt;/mtd&gt;&lt;/mtr&gt;&lt;/mtable&gt;&lt;/mfenced&gt;&lt;/math&gt;
&lt;/p&gt;
&lt;p&gt;The above examples are generated by Microsoft Mathematics.&lt;/p&gt;
&lt;p&gt;The following is from &lt;a href=&quot;http://www.mathjax.org/demos/mathml-samples/&quot;&gt;MathML Samples&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;
&lt;math display=&quot;block&quot;&gt;&lt;mrow&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mfrac&gt;&lt;mrow&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mi&gt;b&lt;/mi&gt;&lt;mo&gt;±&lt;/mo&gt;&lt;msqrt&gt;&lt;mrow&gt;&lt;msup&gt;&lt;mi&gt;b&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mn&gt;4&lt;/mn&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mi&gt;c&lt;/mi&gt;&lt;/mrow&gt;&lt;/msqrt&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;/mrow&gt;&lt;/mfrac&gt;&lt;/mrow&gt;&lt;/math&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;math display=&quot;block&quot;&gt;&lt;mrow&gt;&lt;mi&gt;f&lt;/mi&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;/mo&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mo&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;msub&gt;&lt;mo&gt;∮&lt;/mo&gt;&lt;mrow&gt;&lt;mi&gt;γ&lt;/mi&gt;&lt;/mrow&gt;&lt;/msub&gt;&lt;mfrac&gt;&lt;mrow&gt;&lt;mi&gt;f&lt;/mi&gt;&lt;mo&gt;(&lt;/mo&gt;&lt;mi&gt;z&lt;/mi&gt;&lt;mo&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mi&gt;z&lt;/mi&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;/mrow&gt;&lt;/mfrac&gt;&lt;mi&gt;d&lt;/mi&gt;&lt;mi&gt;z&lt;/mi&gt;&lt;/mrow&gt;&lt;/math&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;math display=&quot;block&quot;&gt;&lt;mrow&gt;&lt;mi&gt;cos&lt;/mi&gt;&lt;mo&gt;⁡&lt;/mo&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mi&gt;φ&lt;/mi&gt;&lt;mo&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mi&gt;cos&lt;/mi&gt;&lt;mo&gt;⁡&lt;/mo&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;mi&gt;cos&lt;/mi&gt;&lt;mo&gt;⁡&lt;/mo&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;/mo&gt;&lt;mi&gt;φ&lt;/mi&gt;&lt;mo&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mi&gt;sin&lt;/mi&gt;&lt;mo&gt;⁡&lt;/mo&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;/mo&gt;&lt;mi&gt;θ&lt;/mi&gt;&lt;mo&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;mi&gt;sin&lt;/mi&gt;&lt;mo&gt;⁡&lt;/mo&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;/mo&gt;&lt;mi&gt;φ&lt;/mi&gt;&lt;mo&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;/mrow&gt;&lt;/math&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;math display=&quot;block&quot;&gt;&lt;mrow&gt;&lt;mrow&gt;&lt;msub&gt;&lt;mo&gt;∫&lt;/mo&gt;&lt;mrow&gt;&lt;mi&gt;D&lt;/mi&gt;&lt;/mrow&gt;&lt;/msub&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;/mo&gt;&lt;mo&gt;∇⋅&lt;/mo&gt;&lt;mi&gt;F&lt;/mi&gt;&lt;mo&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;mi&gt;d&lt;/mi&gt;&lt;mrow&gt;&lt;mi&gt;V&lt;/mi&gt;&lt;/mrow&gt;&lt;/mrow&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mrow&gt;&lt;msub&gt;&lt;mo&gt;∫&lt;/mo&gt;&lt;mrow&gt;&lt;mo&gt;∂&lt;/mo&gt;&lt;mi&gt;D&lt;/mi&gt;&lt;/mrow&gt;&lt;/msub&gt;&lt;mrow&gt;&lt;mtext&gt; &lt;/mtext&gt;&lt;mi&gt;F&lt;/mi&gt;&lt;mo&gt;⋅&lt;/mo&gt;&lt;mi&gt;n&lt;/mi&gt;&lt;/mrow&gt;&lt;mi&gt;d&lt;/mi&gt;&lt;mi&gt;S&lt;/mi&gt;&lt;/mrow&gt;&lt;/mrow&gt;&lt;/math&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;math display=&quot;block&quot;&gt;&lt;mrow&gt;&lt;mover accent=&quot;true&quot;&gt;&lt;mrow&gt;&lt;mo&gt;∇&lt;/mo&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mo&gt;→&lt;/mo&gt;&lt;/mrow&gt;&lt;/mover&gt;&lt;mo&gt;×&lt;/mo&gt;&lt;mover accent=&quot;true&quot;&gt;&lt;mrow&gt;&lt;mi&gt;F&lt;/mi&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mo&gt;→&lt;/mo&gt;&lt;/mrow&gt;&lt;/mover&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;/mo&gt;&lt;mfrac&gt;&lt;mrow&gt;&lt;mo&gt;∂&lt;/mo&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi&gt;F&lt;/mi&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mi&gt;z&lt;/mi&gt;&lt;/mrow&gt;&lt;/msub&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mo&gt;∂&lt;/mo&gt;&lt;mi&gt;y&lt;/mi&gt;&lt;/mrow&gt;&lt;/mfrac&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mfrac&gt;&lt;mrow&gt;&lt;mo&gt;∂&lt;/mo&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi&gt;F&lt;/mi&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mi&gt;y&lt;/mi&gt;&lt;/mrow&gt;&lt;/msub&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mo&gt;∂&lt;/mo&gt;&lt;mi&gt;z&lt;/mi&gt;&lt;/mrow&gt;&lt;/mfrac&gt;&lt;mo&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;mstyle mathvariant=&quot;bold&quot; mathsize=&quot;normal&quot;&gt;&lt;mrow&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;/mrow&gt;&lt;/mstyle&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;/mo&gt;&lt;mfrac&gt;&lt;mrow&gt;&lt;mo&gt;∂&lt;/mo&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi&gt;F&lt;/mi&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;/mrow&gt;&lt;/msub&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mo&gt;∂&lt;/mo&gt;&lt;mi&gt;z&lt;/mi&gt;&lt;/mrow&gt;&lt;/mfrac&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mfrac&gt;&lt;mrow&gt;&lt;mo&gt;∂&lt;/mo&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi&gt;F&lt;/mi&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mi&gt;z&lt;/mi&gt;&lt;/mrow&gt;&lt;/msub&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mo&gt;∂&lt;/mo&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;/mrow&gt;&lt;/mfrac&gt;&lt;mo&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;mstyle mathvariant=&quot;bold&quot; mathsize=&quot;normal&quot;&gt;&lt;mrow&gt;&lt;mi&gt;j&lt;/mi&gt;&lt;/mrow&gt;&lt;/mstyle&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;/mo&gt;&lt;mfrac&gt;&lt;mrow&gt;&lt;mo&gt;∂&lt;/mo&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi&gt;F&lt;/mi&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mi&gt;y&lt;/mi&gt;&lt;/mrow&gt;&lt;/msub&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mo&gt;∂&lt;/mo&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;/mrow&gt;&lt;/mfrac&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mfrac&gt;&lt;mrow&gt;&lt;mo&gt;∂&lt;/mo&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi&gt;F&lt;/mi&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;/mrow&gt;&lt;/msub&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mo&gt;∂&lt;/mo&gt;&lt;mi&gt;y&lt;/mi&gt;&lt;/mrow&gt;&lt;/mfrac&gt;&lt;mo&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;mstyle mathvariant=&quot;bold&quot; mathsize=&quot;normal&quot;&gt;&lt;mrow&gt;&lt;mi&gt;k&lt;/mi&gt;&lt;/mrow&gt;&lt;/mstyle&gt;&lt;/mrow&gt;&lt;/math&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;math display=&quot;block&quot;&gt;&lt;mrow&gt;&lt;mi&gt;σ&lt;/mi&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;msqrt&gt;&lt;mrow&gt;&lt;mfrac&gt;&lt;mrow&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mi&gt;N&lt;/mi&gt;&lt;/mrow&gt;&lt;/mfrac&gt;&lt;mstyle displaystyle=&quot;true&quot;&gt;&lt;mrow&gt;&lt;munderover&gt;&lt;mrow&gt;&lt;mo&gt;∑&lt;/mo&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mi&gt;N&lt;/mi&gt;&lt;/mrow&gt;&lt;/munderover&gt;&lt;mrow&gt;&lt;msup&gt;&lt;mrow&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;/mrow&gt;&lt;/msub&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mi&gt;μ&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mrow&gt;&lt;/msup&gt;&lt;/mrow&gt;&lt;/mrow&gt;&lt;/mstyle&gt;&lt;/mrow&gt;&lt;/msqrt&gt;&lt;mo&gt;.&lt;/mo&gt;&lt;/mrow&gt;&lt;/math&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;math display=&quot;block&quot;&gt;&lt;mrow&gt;&lt;msup&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;/mo&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mo&gt;∇&lt;/mo&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mi&gt;X&lt;/mi&gt;&lt;/mrow&gt;&lt;/msub&gt;&lt;mi&gt;Y&lt;/mi&gt;&lt;mo&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mi&gt;k&lt;/mi&gt;&lt;/mrow&gt;&lt;/msup&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;msup&gt;&lt;mrow&gt;&lt;mi&gt;X&lt;/mi&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;/mrow&gt;&lt;/msup&gt;&lt;msup&gt;&lt;mrow&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;msub&gt;&lt;mrow&gt;&lt;mo&gt;∇&lt;/mo&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;/mrow&gt;&lt;/msub&gt;&lt;mi&gt;Y&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mi&gt;k&lt;/mi&gt;&lt;/mrow&gt;&lt;/msup&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;msup&gt;&lt;mrow&gt;&lt;mi&gt;X&lt;/mi&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;/mrow&gt;&lt;/msup&gt;&lt;mrow&gt;&lt;mo&gt;(&lt;/mo&gt;&lt;mfrac&gt;&lt;mrow&gt;&lt;mo&gt;∂&lt;/mo&gt;&lt;msup&gt;&lt;mrow&gt;&lt;mi&gt;Y&lt;/mi&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mi&gt;k&lt;/mi&gt;&lt;/mrow&gt;&lt;/msup&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mo&gt;∂&lt;/mo&gt;&lt;msup&gt;&lt;mrow&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;/mrow&gt;&lt;/msup&gt;&lt;/mrow&gt;&lt;/mfrac&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;msubsup&gt;&lt;mrow&gt;&lt;mi&gt;Γ&lt;/mi&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;mi&gt;m&lt;/mi&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mi&gt;k&lt;/mi&gt;&lt;/mrow&gt;&lt;/msubsup&gt;&lt;msup&gt;&lt;mrow&gt;&lt;mi&gt;Y&lt;/mi&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mi&gt;m&lt;/mi&gt;&lt;/mrow&gt;&lt;/msup&gt;&lt;mo&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;/mrow&gt;&lt;/math&gt;
&lt;/p&gt;
&lt;p&gt;The following is generated by  &lt;a href=&quot;http://code.google.com/p/formulator-mathml/&quot;&gt;formulator-mathml&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;
&lt;math display = &#39;block&#39;&gt;
  &lt;mrow&gt;
    &lt;mi&gt;y&lt;/mi&gt;
    &lt;mo&gt;=&lt;/mo&gt;
    &lt;msup&gt;
      &lt;mi&gt;ax&lt;/mi&gt;
      &lt;mn&gt;2&lt;/mn&gt;
    &lt;/msup&gt;
    &lt;mo&gt;+&lt;/mo&gt;
    &lt;mi&gt;bx&lt;/mi&gt;
    &lt;mo&gt;+&lt;/mo&gt;
    &lt;mi&gt;c&lt;/mi&gt;
  &lt;/mrow&gt;
&lt;/math&gt;
&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://oguracodes.blogspot.com/feeds/8683994384019577824/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5064621153219489953/8683994384019577824' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5064621153219489953/posts/default/8683994384019577824'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5064621153219489953/posts/default/8683994384019577824'/><link rel='alternate' type='text/html' href='http://oguracodes.blogspot.com/2011/05/mathml-test.html' title='MathML test'/><author><name>Unknown</name><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-5064621153219489953.post-8935751279797938871</id><published>2011-04-29T19:31:00.006+09:00</published><updated>2011-04-29T19:36:44.471+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="circuit"/><category scheme="http://www.blogger.com/atom/ns#" term="logisim"/><title type='text'>Full adder</title><content type='html'>&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgRfnVcttVYni0NdcSms7vXRfttTseJgpyqqzFj2y0h1Y50HttqPpRG7no_okadK79YS8XTgP3Cpu2TiGw2SyJDovgnnMbRhvpkB0G2erharVALN0aYt3y2Q0kTco6bh0-O0BTtjFwfV4w4/s1600/fulladder.png&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 255px; height: 320px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgRfnVcttVYni0NdcSms7vXRfttTseJgpyqqzFj2y0h1Y50HttqPpRG7no_okadK79YS8XTgP3Cpu2TiGw2SyJDovgnnMbRhvpkB0G2erharVALN0aYt3y2Q0kTco6bh0-O0BTtjFwfV4w4/s320/fulladder.png&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5600951819498728082&quot; /&gt;&lt;/a&gt;

&lt;a href=&quot;https://docs.google.com/leaf?id=0B9q7kolvmjdyZjNiZDlkMzctMzZiOS00OTMyLThkZjMtMThiZTA0YjVmYmRk&amp;hl=en&amp;authkey=CIy7gYwE&quot;&gt;download Logisim Project file from Google Docs&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://oguracodes.blogspot.com/feeds/8935751279797938871/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5064621153219489953/8935751279797938871' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5064621153219489953/posts/default/8935751279797938871'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5064621153219489953/posts/default/8935751279797938871'/><link rel='alternate' type='text/html' href='http://oguracodes.blogspot.com/2011/04/full-adder.html' title='Full adder'/><author><name>Unknown</name><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/AVvXsEgRfnVcttVYni0NdcSms7vXRfttTseJgpyqqzFj2y0h1Y50HttqPpRG7no_okadK79YS8XTgP3Cpu2TiGw2SyJDovgnnMbRhvpkB0G2erharVALN0aYt3y2Q0kTco6bh0-O0BTtjFwfV4w4/s72-c/fulladder.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5064621153219489953.post-5435674310045453340</id><published>2011-03-26T21:21:00.007+09:00</published><updated>2011-03-26T23:20:18.457+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="r-project"/><title type='text'>Ukraine&#39;s population pyramid with R</title><content type='html'>&lt;script src=&quot;https://gist.github.com/888232.js&quot;&gt; &lt;/script&gt;
&lt;a href=&quot;https://spreadsheets.google.com/pub?hl=en&amp;amp;hl=en&amp;amp;key=0Atq7kolvmjdydFFNNG1UU3BtdnBub0xTWnpEMUFjSFE&amp;amp;output=csv&quot;&gt;UNPop_ukraine_age_sex_1985-2010.csv&lt;/a&gt;&lt;br /&gt;
(via &lt;a href=&quot;http://esa.un.org/unpp/&quot;&gt;World Population Prospects:  The 2008 Revision Population Database&lt;/a&gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcTp8TOc6uQREfdctCr3i9HTnHZ9_GOkpDA_-LXfAf0-ctPav8zJcDGhtPA2lc9KM50pAukJ3dvC7LYq94mxjGZn4u_vTuGrhPHnEW4JTj9M1Q9l1YE_i9BNhqRtJ11phqdMWXiqq7dX1b/s1600/pyramid.png&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 200px; height: 200px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcTp8TOc6uQREfdctCr3i9HTnHZ9_GOkpDA_-LXfAf0-ctPav8zJcDGhtPA2lc9KM50pAukJ3dvC7LYq94mxjGZn4u_vTuGrhPHnEW4JTj9M1Q9l1YE_i9BNhqRtJ11phqdMWXiqq7dX1b/s200/pyramid.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5588385451420938706&quot; /&gt;&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://oguracodes.blogspot.com/feeds/5435674310045453340/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5064621153219489953/5435674310045453340' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5064621153219489953/posts/default/5435674310045453340'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5064621153219489953/posts/default/5435674310045453340'/><link rel='alternate' type='text/html' href='http://oguracodes.blogspot.com/2011/03/ukraines-population-pyramid-with-r.html' title='Ukraine&#39;s population pyramid with R'/><author><name>Unknown</name><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/AVvXsEgcTp8TOc6uQREfdctCr3i9HTnHZ9_GOkpDA_-LXfAf0-ctPav8zJcDGhtPA2lc9KM50pAukJ3dvC7LYq94mxjGZn4u_vTuGrhPHnEW4JTj9M1Q9l1YE_i9BNhqRtJ11phqdMWXiqq7dX1b/s72-c/pyramid.png" height="72" width="72"/><thr:total>0</thr:total></entry></feed>