<?xml version="1.0" encoding="UTF-8"?> <rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
> <channel><title>Autarchy of the Private Cave</title> <atom:link href="http://bogdan.org.ua/feed" rel="self" type="application/rss+xml" /><link>http://bogdan.org.ua</link> <description>Tiny bits of bioinformatics, [web-]programming etc</description> <lastBuildDate>Tue, 15 May 2012 21:56:55 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.2</generator> <item><title>The genetics of orchids and dandelions</title><link>http://bogdan.org.ua/2012/05/01/the-genetics-of-orchids-and-dandelions.html</link> <comments>http://bogdan.org.ua/2012/05/01/the-genetics-of-orchids-and-dandelions.html#comments</comments> <pubDate>Tue, 01 May 2012 16:05:38 +0000</pubDate> <dc:creator>Bogdan</dc:creator> <category><![CDATA[Links]]></category> <category><![CDATA[Misc]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=1824</guid> <description><![CDATA[Quite an interesting article on the genetics of behavior.]]></description> <content:encoded><![CDATA[<p>Quite an interesting article on the <a
href="http://www.wired.com/wiredscience/2012/03/can-genes-send-you-high-or-low-the-orchid-hypothesis-a-bloom/">genetics of behavior</a>.</p><p><a
class="a2a_button_google_plusone addtoany_special_service" data-href="http://bogdan.org.ua/2012/05/01/the-genetics-of-orchids-and-dandelions.html"></a><a
class="a2a_button_facebook_like addtoany_special_service" data-href="http://bogdan.org.ua/2012/05/01/the-genetics-of-orchids-and-dandelions.html"></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbogdan.org.ua%2F2012%2F05%2F01%2Fthe-genetics-of-orchids-and-dandelions.html&amp;title=The%20genetics%20of%20orchids%20and%20dandelions" id="wpa2a_4"><img
src="http://bogdan.org.ua/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://bogdan.org.ua/2012/05/01/the-genetics-of-orchids-and-dandelions.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Beanstalkd and related tools for easy parallelizing and backgrounding</title><link>http://bogdan.org.ua/2012/02/18/beanstalkd-related-tools-for-easy-parallelizing-backgrounding.html</link> <comments>http://bogdan.org.ua/2012/02/18/beanstalkd-related-tools-for-easy-parallelizing-backgrounding.html#comments</comments> <pubDate>Sat, 18 Feb 2012 11:07:56 +0000</pubDate> <dc:creator>Bogdan</dc:creator> <category><![CDATA[Links]]></category> <category><![CDATA[Programming]]></category> <category><![CDATA[Python]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[beanstalk]]></category> <category><![CDATA[beanstalkd]]></category> <category><![CDATA[queue]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=1818</guid> <description><![CDATA[beanstalkd: a simple, fast work queue. Jack and the Beanstalkd: a web-app for basic work queue administration. beanstalkc: a simple beanstalkd client library for Python. queueit: a CLI interface tool which helps to integrate beanstalkd into shell scripts.]]></description> <content:encoded><![CDATA[<p><a
href="http://kr.github.com/beanstalkd/">beanstalkd</a>: a simple, fast work queue.<br
/> <a
href="https://github.com/andreisavu/django-jack">Jack and the Beanstalkd</a>: a web-app for basic work queue administration.<br
/> <a
href="https://github.com/earl/beanstalkc">beanstalkc</a>: a simple beanstalkd client library for Python.<br
/> <a
href="https://github.com/chexov/queueit">queueit</a>: a CLI interface tool which helps to integrate beanstalkd into shell scripts.</p><p><a
class="a2a_button_google_plusone addtoany_special_service" data-href="http://bogdan.org.ua/2012/02/18/beanstalkd-related-tools-for-easy-parallelizing-backgrounding.html"></a><a
class="a2a_button_facebook_like addtoany_special_service" data-href="http://bogdan.org.ua/2012/02/18/beanstalkd-related-tools-for-easy-parallelizing-backgrounding.html"></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbogdan.org.ua%2F2012%2F02%2F18%2Fbeanstalkd-related-tools-for-easy-parallelizing-backgrounding.html&amp;title=Beanstalkd%20and%20related%20tools%20for%20easy%20parallelizing%20and%20backgrounding" id="wpa2a_8"><img
src="http://bogdan.org.ua/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://bogdan.org.ua/2012/02/18/beanstalkd-related-tools-for-easy-parallelizing-backgrounding.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Megahack of Stratfor</title><link>http://bogdan.org.ua/2012/01/09/megahack-of-stratfor.html</link> <comments>http://bogdan.org.ua/2012/01/09/megahack-of-stratfor.html#comments</comments> <pubDate>Mon, 09 Jan 2012 02:25:41 +0000</pubDate> <dc:creator>Bogdan</dc:creator> <category><![CDATA[Links]]></category> <category><![CDATA[Misc]]></category> <category><![CDATA[Security]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[Web]]></category> <category><![CDATA[anonymous]]></category> <category><![CDATA[antisec]]></category> <category><![CDATA[drupal]]></category> <category><![CDATA[fourkitchens]]></category> <category><![CDATA[lulzsec]]></category> <category><![CDATA[stratfor]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=1801</guid> <description><![CDATA[If you haven&#8217;t heard yet &#8211; stratfor.com was hacked in December 2011, leaking full information about 75k credit cards (including owner&#8217;s addresses and CVV codes) and 860k (right, almost a million) user accounts. All Stratfor email archives were also reportedly stolen (around 160-200 GB of data), but those were not made publicly available on the [...]]]></description> <content:encoded><![CDATA[<p>If you haven&#8217;t heard yet &#8211; stratfor.com was hacked in December 2011, leaking full information about 75k credit cards (including owner&#8217;s addresses and CVV codes) and 860k (right, almost a million) user accounts. All Stratfor email archives were also reportedly stolen (around 160-200 GB of data), but those were not made publicly available on the internet &#8211; unlike the credit cards and user accounts information, which is still relatively easy to find and download.</p><p>I do not really recollect anything that large. Well, not counting dropbox&#8217;s 4-hour window of &#8220;any password fits all accounts&#8221;, but that was different.</p><p>Here are some of the news items about this seriously large hacking incident:</p><ul><li><a
href="http://www.nytimes.com/2011/12/26/technology/hackers-breach-the-web-site-of-stratfor-global-intelligence.html?_r=1">NYTimes (Dec. 25, 2011)</a></li><li><a
href="http://online.wsj.com/article/APf0a1519595c04b17ad9a84120d03cf1d.html" class="broken_link" rel="nofollow">WSJ (Dec. 25, 2011)</a></li><li><a
href="http://edition.cnn.com/2011/12/26/tech/web/anonymous-hack-stratfor/">CNN (Dec. 25, 2011)</a></li><li>relatively above-average write-up from <a
href="http://www.wired.com/threatlevel/2011/12/antisec-hits-private-intel-firm-million-of-docs-allegedly-lifted/">Wired (Dec. 26, 2011)</a></li><li><a
href="http://abcnews.go.com/US/hacking-group-anonymous-vows-hit/story?id=15234349">ABCNews (Dec. 26, 2011)</a></li><li><a
href="http://www.theregister.co.uk/2012/01/03/stratfor_mega_hack/">The Register (Jan. 3, 2012)</a></li></ul><p>Here come more technical reports:</p><ul><li>short <a
href="http://pastebin.com/f7jYf5Wd">pastebin document</a>, supposedly by the hackers</li><li><a
href="http://cryptome.org/0005/stratfor-hack.htm">cryptome</a> keeps track of the data being removed from the internet</li><li>a 1MB <a
href="http://bolt.thexfil.es/84e9h!t" class="broken_link" rel="nofollow">report by the hackers</a></li><li>TheTechGerald has <a
href="http://www.thetechherald.com/articles/Report-Analysis-of-the-Stratfor-Password-List">some analysis of the leaked stratfor passwords</a> (Jan. 2, 2012)</li></ul><p>TheTechGerald&#8217;s analysis linked to above got my attention. Unfortunately, a while ago I&#8217;ve subscribed to stratfor&#8217;s &#8220;free intelligence mailing list&#8221;, and was wondering if my account information is now publicly available. I was the most worried about the password I&#8217;ve used to subscribe, because of the risk of using the same password somewhere else.</p><p>Unlike TheTechGerald, I haven&#8217;t used any dictionaries &#8211; just the default configuration of a well-known tool for finding weak passwords. Within a single hour, ~100k passwords were decrypted (~12% of all). Till the end of the day, ~50k more passwords were decrypted (totalling 17.4% of 860k). At this point my password was still safe, and I&#8217;ve found a way to verify that it is not used anywhere else, so I&#8217;ve aborted further decryption.</p><p>There are a few simple conclusions:</p><ul><li><strong>anybody who had a stratfor account must verify that he/she isn&#8217;t using that password anywhere else</strong>, because if 1 PC can get 17% of all the passwords in less than a day, it is only a matter of short time until all the leaked passwords will be decrypted and made publicly available in various &#8220;md5 decryption databases&#8221;</li><li>system owners should run periodic screenings for weak passwords (and implement policies to prevent creating obviously weak passwords from the very beginning)</li><li>md5 is very fast to decrypt/bruteforce &#8211; a much slower hashing function wouldn&#8217;t hurt; also, using a more complex hashing approach, maybe even with a closed-source shared library, could help</li><li>single-factor authentication (password-based) is likely to get replaced with 2-factor authentication in the nearest future</li><li>one may enjoy increased personal data safety by using throw-away passwords in conjunction with antispam mailboxes like spam.la and mailinator.com (at least 1600 users &#8211; 0.186% &#8211; did use these services).</li></ul><p><span
id="more-1801"></span><br
/> Fortunately, the top 10 passwords (by their counts) were exclusively &#8220;throw-away&#8221;, and added up to ~10% of the decrypted passwords. (I&#8217;m not showing any, as that would unnecessarily simplify further decryption &#8211; maybe thetechgerald should have also been more vague about actual passwords.)</p><p>Sooner or later this significant-size corpus of real-life passwords will find its way (after decryption by those who would actually use leaked passwords to gain unauthorized access) into various wordlists and wordlist mutation rules, making it even easier to decrypt any future leaks. This is where 2-factor authentication will, hopefully, come in handy to protect against similar leaks.</p><p>I wonder if I should put up a page &#8220;Check if my password was among those 860k&#8221;, to help people easily identify if they should change theirs &#8211; not even necessarily being a Stratfor subscriber. Unless similar pages/services had already been put up by others.</p><p>It is also unclear what will the future of Stratfor be, taking into account that their website is still dysfunctional.</p><p>It is sad to see Drupal (stratfor.com&#8217;s CMS) involved here. However, I have no idea if their installation was up to date, and if their website was the point of entry. The hacklog suggests that attackers somehow obtained the password of one of the system administrators, and then used it for SSH access, which would save Drupal&#8217;s face (Drupal&#8217;s security record to date was pretty reassuring).</p><p><a
class="a2a_button_google_plusone addtoany_special_service" data-href="http://bogdan.org.ua/2012/01/09/megahack-of-stratfor.html"></a><a
class="a2a_button_facebook_like addtoany_special_service" data-href="http://bogdan.org.ua/2012/01/09/megahack-of-stratfor.html"></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbogdan.org.ua%2F2012%2F01%2F09%2Fmegahack-of-stratfor.html&amp;title=Megahack%20of%20Stratfor" id="wpa2a_12"><img
src="http://bogdan.org.ua/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://bogdan.org.ua/2012/01/09/megahack-of-stratfor.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Carol of the Bells is a thousand years old Ukrainian song</title><link>http://bogdan.org.ua/2011/12/24/carol-of-the-bells-is-a-thousand-years-old-ukrainian-song.html</link> <comments>http://bogdan.org.ua/2011/12/24/carol-of-the-bells-is-a-thousand-years-old-ukrainian-song.html#comments</comments> <pubDate>Sat, 24 Dec 2011 15:45:46 +0000</pubDate> <dc:creator>Bogdan</dc:creator> <category><![CDATA[Misc]]></category> <category><![CDATA[Ukraine]]></category> <category><![CDATA[carol]]></category> <category><![CDATA[carol of the bells]]></category> <category><![CDATA[shchedryk]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=1793</guid> <description><![CDATA[Arranged by the Ukrainian composer Mykola Leontovych between 1901 and 1919, and performed in 1921 at Carnegie Hall, Shchedryk (with a completely different text and now titled Carol of the bells) rapidly became popular in the US. The original Ukrainian text tells the tale of a swallow flying into a household to proclaim the plentiful [...]]]></description> <content:encoded><![CDATA[<p>Arranged by the Ukrainian composer Mykola Leontovych between 1901 and 1919, and performed in 1921 at Carnegie Hall, <em>Shchedryk</em> (with a completely different text and now titled <em>Carol of the bells</em>) rapidly became popular in the US.</p><p>The original Ukrainian text tells the tale of a swallow flying into a household to proclaim the plentiful and bountiful year that the family will have. The title <em>shchedryk</em> is derived from the Ukrainian word for &#8220;bountiful&#8221;. This follows a tradition of praising the hosts of festivities in the songs during those festivities, or when coming to get sweets, small money bills or presents in exchange for nice singing by a group of children.</p><p>English text was written separately, and is copyrighted.</p><p>All the derived music uses the original&#8217;s four-note pattern by Mykola Leontovych. Folk song/chant was the basis for Leontovych&#8217;s work on this piece. I believe the original song had a similar musical (vocal) pattern, and that &#8220;ostinato&#8221; figure of music was already present in the song, so Leontovych&#8217;s work was probably to smooth out any uneven moments, and formalize the music in notes. Citing <a
href="http://en.wikipedia.org/wiki/Shchedryk_(song)">wikipedia article</a>, &#8220;ostinato motif, a repeated four-note pattern within the range of a minor third is thought to be of prehistoric origins&#8221;.</p><p><a
class="a2a_button_google_plusone addtoany_special_service" data-href="http://bogdan.org.ua/2011/12/24/carol-of-the-bells-is-a-thousand-years-old-ukrainian-song.html"></a><a
class="a2a_button_facebook_like addtoany_special_service" data-href="http://bogdan.org.ua/2011/12/24/carol-of-the-bells-is-a-thousand-years-old-ukrainian-song.html"></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbogdan.org.ua%2F2011%2F12%2F24%2Fcarol-of-the-bells-is-a-thousand-years-old-ukrainian-song.html&amp;title=Carol%20of%20the%20Bells%20is%20a%20thousand%20years%20old%20Ukrainian%20song" id="wpa2a_16"><img
src="http://bogdan.org.ua/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://bogdan.org.ua/2011/12/24/carol-of-the-bells-is-a-thousand-years-old-ukrainian-song.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>tudu: a beautiful ncurses to-do list application</title><link>http://bogdan.org.ua/2011/10/11/tudu-a-beautiful-ncurses-to-do-list-application.html</link> <comments>http://bogdan.org.ua/2011/10/11/tudu-a-beautiful-ncurses-to-do-list-application.html#comments</comments> <pubDate>Tue, 11 Oct 2011 12:15:21 +0000</pubDate> <dc:creator>Bogdan</dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[ncurses]]></category> <category><![CDATA[tudu]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=1722</guid> <description><![CDATA[tudu is just what it says in the title, and is written in C. All the functions are mapped to keys. Extremely flexible: you can use it either as a simple to-do list, or utilize a bunch of optional features (priorities, schedules, deadlines, categories, tags, maybe something else). If you (like me) love ncurses &#8211; [...]]]></description> <content:encoded><![CDATA[<p><a
href="http://cauterized.net/~meskio/tudu/" class="broken_link" rel="nofollow">tudu</a> is just what it says in the title, and is written in C.<br
/> All the functions are mapped to keys. Extremely flexible: you can use it either as a simple to-do list, or utilize a bunch of optional features (priorities, schedules, deadlines, categories, tags, maybe something else).</p><p>If you (like me) love ncurses &#8211; you will love tudu <img
src='http://bogdan.org.ua/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> Just give it a try.</p><p><img
src="http://bogdan.org.ua/wp-content/uploads/2011/10/tudu.jpg" alt="" title="tudu" width="680" height="400" class="alignnone size-full wp-image-1724" /><br
/> Screenshot copyright: Ruben Pollan (tudu author).</p><p><a
class="a2a_button_google_plusone addtoany_special_service" data-href="http://bogdan.org.ua/2011/10/11/tudu-a-beautiful-ncurses-to-do-list-application.html"></a><a
class="a2a_button_facebook_like addtoany_special_service" data-href="http://bogdan.org.ua/2011/10/11/tudu-a-beautiful-ncurses-to-do-list-application.html"></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbogdan.org.ua%2F2011%2F10%2F11%2Ftudu-a-beautiful-ncurses-to-do-list-application.html&amp;title=tudu%3A%20a%20beautiful%20ncurses%20to-do%20list%20application" id="wpa2a_20"><img
src="http://bogdan.org.ua/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://bogdan.org.ua/2011/10/11/tudu-a-beautiful-ncurses-to-do-list-application.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>MyISAM vs InnoDB vs Postgres benchmark</title><link>http://bogdan.org.ua/2011/10/06/myisam-vs-innodb-vs-postgres-benchmark.html</link> <comments>http://bogdan.org.ua/2011/10/06/myisam-vs-innodb-vs-postgres-benchmark.html#comments</comments> <pubDate>Thu, 06 Oct 2011 11:08:13 +0000</pubDate> <dc:creator>Bogdan</dc:creator> <category><![CDATA[Notepad]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=1712</guid> <description><![CDATA[For some reason, I believed that MyISAM storage engine should be very fast - faster than InnoDB and Postgres. After all, MyISAM does not support transactions, has no logging, and is overall simpler than "true" storage engines/databases. I was surprised to find out that this isn't true, at least for the specific (simple!) query I'm [...]]]></description> <content:encoded><![CDATA[<p>For some reason, I believed that MyISAM storage engine should be very fast - faster than InnoDB and Postgres. After all, MyISAM does not support transactions, has no logging, and is overall simpler than "true" storage engines/databases.</p><p>I was surprised to find out that this isn't true, at least for the specific (simple!) query I'm interested in:</p><div
class="igBar"><span
id="lsql-2"><a
href="#" onclick="javascript:showPlainTxt('sql-2'); return false;">PLAIN TEXT</a></span></div><div
class="syntax_hilite"><span
class="langName">SQL:</span><div
id="sql-2"><div
class="sql"><ol><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span
style="color: #993333; font-weight: bold;">SELECT</span> primary_id <span
style="color: #993333; font-weight: bold;">FROM</span> tablename <span
style="color: #993333; font-weight: bold;">WHERE</span> indexed_varchar = %s <span
style="color: #993333; font-weight: bold;">AND</span> intcol1 &lt;= %d <span
style="color: #993333; font-weight: bold;">AND</span> intcol2&gt; %d</div></li></ol></div></div></div><p> <span
id="more-1712"></span><br
/> While at it, I also tested Postgres on that same database, using the same method. With only 1 thread, Postgres was somewhere between MyISAM and InnoDB in queries per second, while with more threads Postgres was getting way ahead. This was expected, because I've known that Postgres generally has much better multi-threading scalability than MySQL.</p><p><a
href="http://bogdan.org.ua/wp-content/uploads/2011/10/sql-speed.png"><img
src="http://bogdan.org.ua/wp-content/uploads/2011/10/sql-speed.png" alt="" title="SQL engines/databases speed with 1 query type" width="775" height="430" class="alignnone size-full wp-image-1718" /></a></p><p>I should have trusted the results posted back in 2007 on <a
href="http://www.mysqlperformanceblog.com/2007/01/08/innodb-vs-myisam-vs-falcon-benchmarks-part-1/">mysqlperformanceblog</a>.</p><p>Versions tested: MySQL 5.1.41, PostgreSQL 8.4.8. Postgres config was not modified, MySQL had key_buffer and query_buffer increased to values allowing to contain the whole table which was tested.</p><p>Note: be very careful when testing with different engines. Initially, I had completely different numbers for Postgres, because when manually porting MySQL schema to Postgres, indices for columns intcol1 and intcol2 were ported differently from MySQL version. That made Postgres results look terrible - 4k q/s at 8 threads.<br
/> Also note, that for MySQL the native mysqli PHP driver was used, while for Postgres I've used PDO.<br
/> Code for this benchmark is based on <a
href="http://www.mysqlperformanceblog.com/files/benchmarks/phptestsuite.stable.tar.gz">phptestsuite.stable.tar.gz</a>.<br
/> Hardware used: core i7 (4 cores + 4 HT "cores"), frequency steps within 1.6-4.6 GHz; 16 GB RAM.</p><p><a
class="a2a_button_google_plusone addtoany_special_service" data-href="http://bogdan.org.ua/2011/10/06/myisam-vs-innodb-vs-postgres-benchmark.html"></a><a
class="a2a_button_facebook_like addtoany_special_service" data-href="http://bogdan.org.ua/2011/10/06/myisam-vs-innodb-vs-postgres-benchmark.html"></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbogdan.org.ua%2F2011%2F10%2F06%2Fmyisam-vs-innodb-vs-postgres-benchmark.html&amp;title=MyISAM%20vs%20InnoDB%20vs%20Postgres%20benchmark" id="wpa2a_24"><img
src="http://bogdan.org.ua/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://bogdan.org.ua/2011/10/06/myisam-vs-innodb-vs-postgres-benchmark.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Good advice: /bin/false is not security</title><link>http://bogdan.org.ua/2011/10/01/good-advice-bin-false-is-not-security.html</link> <comments>http://bogdan.org.ua/2011/10/01/good-advice-bin-false-is-not-security.html#comments</comments> <pubDate>Sat, 01 Oct 2011 21:38:30 +0000</pubDate> <dc:creator>Bogdan</dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[Links]]></category> <category><![CDATA[Security]]></category> <category><![CDATA[false]]></category> <category><![CDATA[nologin]]></category> <category><![CDATA[port forwarding]]></category> <category><![CDATA[ssh]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=1706</guid> <description><![CDATA[SSH Security and You - /bin/false is *not* security.]]></description> <content:encoded><![CDATA[<p><a
href="http://www.semicomplete.com/articles/ssh-security/">SSH Security and You - /bin/false is *not* security</a>.</p><p><a
class="a2a_button_google_plusone addtoany_special_service" data-href="http://bogdan.org.ua/2011/10/01/good-advice-bin-false-is-not-security.html"></a><a
class="a2a_button_facebook_like addtoany_special_service" data-href="http://bogdan.org.ua/2011/10/01/good-advice-bin-false-is-not-security.html"></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbogdan.org.ua%2F2011%2F10%2F01%2Fgood-advice-bin-false-is-not-security.html&amp;title=Good%20advice%3A%20%2Fbin%2Ffalse%20is%20not%20security" id="wpa2a_28"><img
src="http://bogdan.org.ua/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://bogdan.org.ua/2011/10/01/good-advice-bin-false-is-not-security.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Python performance: set vs list</title><link>http://bogdan.org.ua/2011/08/15/python-performance-set-vs-list.html</link> <comments>http://bogdan.org.ua/2011/08/15/python-performance-set-vs-list.html#comments</comments> <pubDate>Mon, 15 Aug 2011 09:29:04 +0000</pubDate> <dc:creator>Bogdan</dc:creator> <category><![CDATA[Notepad]]></category> <category><![CDATA[Programming]]></category> <category><![CDATA[Python]]></category> <category><![CDATA[list]]></category> <category><![CDATA[membership]]></category> <category><![CDATA[performance]]></category> <category><![CDATA[set]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=1673</guid> <description><![CDATA[Sometimes there is a need to be sure that no identifier is processed twice - for example, when parsing a file into a database, with file potentially containing duplicate records. An obvious solution is to properly wrap the DB insertion code into try...except block, and process duplicate primary ID exceptions. Another, sometimes more desired solution [...]]]></description> <content:encoded><![CDATA[<p>Sometimes there is a need to be sure that no identifier is processed twice - for example, when parsing a file into a database, with file potentially containing duplicate records. An obvious solution is to properly wrap the DB insertion code into try...except block, and process <em>duplicate primary ID</em> exceptions. Another, sometimes more desired solution is to maintain a set/list of processed IDs internally, and check against that list prior to attempting the insertion of anything. So is it a set or a list?</p><p>There are already quite a few internet resources discussing "python set vs list", but probably the simplest while elegant way to test that is below.<br
/> <span
id="more-1673"></span><br
/> First, test the speed of adding/appending to a set or a list (here, I'm mimicking the real-life application, thus the test case has an optional loop):</p><div
class="igBar"><span
id="lcode-5"><a
href="#" onclick="javascript:showPlainTxt('code-5'); return false;">PLAIN TEXT</a></span></div><div
class="syntax_hilite"><span
class="langName">CODE:</span><div
id="code-5"><div
class="code"><ol><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$python -mtimeit -s <span
style="color:#CC0000;">'myset = set()'</span> <span
style="color:#CC0000;">'for x in xrange(1000): myset.add(x)'</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span
style="color:#800000;color:#800000;">10000</span> loops, best of <span
style="color:#800000;color:#800000;">3</span>: <span
style="color:#800000;color:#800000;">133</span> usec per loop</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$python -mtimeit -s <span
style="color:#CC0000;">'tmp = list()'</span> <span
style="color:#CC0000;">'for x in xrange(1000): tmp.append(x)'</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span
style="color:#800000;color:#800000;">10000</span> loops, best of <span
style="color:#800000;color:#800000;">3</span>: <span
style="color:#800000;color:#800000;">116</span> usec per loop</div></li></ol></div></div></div><p></p><p>As we can see, set and list are comparable in the speed of adding new items, with list being slightly (~12%) faster than set.</p><p>Now, the speed of membership testing: 'x in tmp'. For this test, I've deliberately chosen an imbalance of True (1%) and False (99%) results for the test - again, mimicking the real problem I have at hand:</p><div
class="igBar"><span
id="lcode-6"><a
href="#" onclick="javascript:showPlainTxt('code-6'); return false;">PLAIN TEXT</a></span></div><div
class="syntax_hilite"><span
class="langName">CODE:</span><div
id="code-6"><div
class="code"><ol><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$python -mtimeit -s <span
style="color:#CC0000;">'tmp = set()'</span> -s <span
style="color:#CC0000;">'for x in xrange(1000): tmp.add(x)'</span> <span
style="color:#CC0000;">'for x in xrange(100000): x in tmp'</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span
style="color:#800000;color:#800000;">100</span> loops, best of <span
style="color:#800000;color:#800000;">3</span>: <span
style="color:#800000;color:#800000;">7</span>.<span
style="color:#800000;color:#800000;">27</span> msec per loop</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$python -mtimeit -s <span
style="color:#CC0000;">'tmp = list()'</span> -s <span
style="color:#CC0000;">'for x in xrange(1000): tmp.append(x)'</span> <span
style="color:#CC0000;">'for x in xrange(100000): x in tmp'</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span
style="color:#800000;color:#800000;">10</span> loops, best of <span
style="color:#800000;color:#800000;">3</span>: <span
style="color:#800000;color:#800000;">2</span>.<span
style="color:#800000;color:#800000;">12</span> sec per loop</div></li></ol></div></div></div><p></p><p>List is much slower for membership testing, while <a
href="http://en.wikipedia.org/wiki/Collection_(computing)#Sets">sets were designed to be fast for doing just that</a>.</p><p><a
class="a2a_button_google_plusone addtoany_special_service" data-href="http://bogdan.org.ua/2011/08/15/python-performance-set-vs-list.html"></a><a
class="a2a_button_facebook_like addtoany_special_service" data-href="http://bogdan.org.ua/2011/08/15/python-performance-set-vs-list.html"></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbogdan.org.ua%2F2011%2F08%2F15%2Fpython-performance-set-vs-list.html&amp;title=Python%20performance%3A%20set%20vs%20list" id="wpa2a_32"><img
src="http://bogdan.org.ua/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://bogdan.org.ua/2011/08/15/python-performance-set-vs-list.html/feed</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Phusion Passenger Apache users guide</title><link>http://bogdan.org.ua/2011/08/14/phusion-passenger-apache-users-guide.html</link> <comments>http://bogdan.org.ua/2011/08/14/phusion-passenger-apache-users-guide.html#comments</comments> <pubDate>Sun, 14 Aug 2011 21:07:40 +0000</pubDate> <dc:creator>Bogdan</dc:creator> <category><![CDATA[Links]]></category> <category><![CDATA[Notepad]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[Apache]]></category> <category><![CDATA[passenger]]></category> <category><![CDATA[phusion]]></category> <category><![CDATA[rails]]></category> <category><![CDATA[ruby]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=1669</guid> <description><![CDATA[Phusion Passenger Apache users guide Also as a PDF.]]></description> <content:encoded><![CDATA[<p><a
href="http://www.modrails.com/documentation/Users%20guide%20Apache.html">Phusion Passenger Apache users guide</a></p><p>Also as a <a
href='http://bogdan.org.ua/wp-content/uploads/2011/08/passenger_apache_guide.pdf'>PDF</a>.</p><p><a
class="a2a_button_google_plusone addtoany_special_service" data-href="http://bogdan.org.ua/2011/08/14/phusion-passenger-apache-users-guide.html"></a><a
class="a2a_button_facebook_like addtoany_special_service" data-href="http://bogdan.org.ua/2011/08/14/phusion-passenger-apache-users-guide.html"></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbogdan.org.ua%2F2011%2F08%2F14%2Fphusion-passenger-apache-users-guide.html&amp;title=Phusion%20Passenger%20Apache%20users%20guide" id="wpa2a_36"><img
src="http://bogdan.org.ua/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://bogdan.org.ua/2011/08/14/phusion-passenger-apache-users-guide.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>HandBrake profile for Nokia E71 default player</title><link>http://bogdan.org.ua/2011/08/13/handbrake-profile-for-nokia-e71-default-player.html</link> <comments>http://bogdan.org.ua/2011/08/13/handbrake-profile-for-nokia-e71-default-player.html#comments</comments> <pubDate>Sat, 13 Aug 2011 14:41:24 +0000</pubDate> <dc:creator>Bogdan</dc:creator> <category><![CDATA[Links]]></category> <category><![CDATA[Misc]]></category> <category><![CDATA[Movies]]></category> <category><![CDATA[Notepad]]></category> <category><![CDATA[E71]]></category> <category><![CDATA[handbrake]]></category> <category><![CDATA[nokia]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=1661</guid> <description><![CDATA[Inspired by video encoding with handbrake. HandBrake is a very high-quality piece of software - next time you need recoding something into H.264/MPEG-4 (using MKV or MP4 containers) - try HandBrake. It easily saturated all my CPU cores - which I failed to achieve with ffmpeg, which even with threads=8 was only saturating 2 cores. [...]]]></description> <content:encoded><![CDATA[<p>Inspired by <a
href="http://nokia-e71-phone.blogspot.com/2009/03/video-encoding-aach264.html">video encoding with handbrake</a>.</p><p><a
href="http://handbrake.fr/">HandBrake</a> is a very high-quality piece of software - next time you need recoding something into H.264/MPEG-4 (using MKV or MP4 containers) - try HandBrake. It easily saturated all my CPU cores - which I failed to achieve with ffmpeg, which even with threads=8 was only saturating 2 cores.</p><p>Attached to this post are 2 profiles for recoding movies for Nokia E71. The "_best" profile has exhaustive motion detection, otherwise is identical to the base profile.<br
/> <a
href='http://bogdan.org.ua/wp-content/uploads/2011/08/E71.plist_.zip'>E71.plist</a><br
/> <a
href='http://bogdan.org.ua/wp-content/uploads/2011/08/E71_best.plist_.zip'>E71_best.plist</a></p><p>Related:</p><ul><li><a
href="https://sites.google.com/site/linuxencoding/x264-ffmpeg-mapping">x264 ffmpeg mapping and options guide</a></li><li><a
href="http://rodrigopolo.com/ffmpeg/cheats.html">ffmpeg audio/video encoding cheat sheet</a></li></ul><p><a
class="a2a_button_google_plusone addtoany_special_service" data-href="http://bogdan.org.ua/2011/08/13/handbrake-profile-for-nokia-e71-default-player.html"></a><a
class="a2a_button_facebook_like addtoany_special_service" data-href="http://bogdan.org.ua/2011/08/13/handbrake-profile-for-nokia-e71-default-player.html"></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbogdan.org.ua%2F2011%2F08%2F13%2Fhandbrake-profile-for-nokia-e71-default-player.html&amp;title=HandBrake%20profile%20for%20Nokia%20E71%20default%20player" id="wpa2a_40"><img
src="http://bogdan.org.ua/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://bogdan.org.ua/2011/08/13/handbrake-profile-for-nokia-e71-default-player.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>How to remotely convert live 1xHDD/LVM Linux server to 2xHDD RAID1/LVM (GRUB2, GPT)</title><link>http://bogdan.org.ua/2011/05/17/how-to-remotely-convert-live-hdd-lvm-linux-server-to-raid1-grub2-gpt.html</link> <comments>http://bogdan.org.ua/2011/05/17/how-to-remotely-convert-live-hdd-lvm-linux-server-to-raid1-grub2-gpt.html#comments</comments> <pubDate>Tue, 17 May 2011 13:23:05 +0000</pubDate> <dc:creator>Bogdan</dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[how-to]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[Debian]]></category> <category><![CDATA[GPT]]></category> <category><![CDATA[grub2]]></category> <category><![CDATA[LVM]]></category> <category><![CDATA[mdadm]]></category> <category><![CDATA[RAID]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=1593</guid> <description><![CDATA[Assumptions: current HDD is /dev/sda, it has a GPT (with bios_grub being /dev/sda1), separate /boot partition (/dev/sda2), and a physical LVM volume (/dev/sda3), where LVM holds all the remaining partitions (root, /home, /srv, ...); LVM is properly configured, and system reboots with no problems your new drive is /dev/sdb, it is identical to /dev/sda, and [...]]]></description> <content:encoded><![CDATA[<p>Assumptions:</p><ul><li>current HDD is /dev/sda, it has a GPT (with bios_grub being /dev/sda1), separate /boot partition (/dev/sda2), and a physical LVM volume (/dev/sda3), where LVM holds all the remaining partitions (root, /home, /srv, ...); LVM is properly configured, and system reboots with no problems</li><li>your new drive is /dev/sdb, it is identical to /dev/sda, and it comes empty from the manufacturer (this is important! wipe the drive if it is not empty, especially if it used to be a part of another RAID)</li><li>your system is Debian or Debian-based; in this exact example I've been using Ubuntu Server 10.04</li><li>your LVM volume group is named vg0</li><li>make sure you understand what each command does before executing it</li><li>you do have an external backup of all your important data, and you do understand that the following operations are potentially dangerous to your data integrity</li></ul><p>Inspired by: <a
href="http://www200.pair.com/mecham/raid/raid1-degraded-etch.html">Debian Etch RAID guide</a>, <a
href="http://serverfault.com/questions/267819/convert-1x2tb-hdd-with-lvm-into-2x2tb-hdd-with-raid1lvm-or-with-lvm-mirroring">serverfault question</a>.<br
/> <span
id="more-1593"></span></p><ol><li>Create the GPT on the new drive:<br
/> <strong>parted /dev/sdb mklabel gpt</strong></li><li>Get the list of partitions on /dev/sda:<br
/> <strong>parted -m /dev/sda print</strong></li><li>Create /dev/sdb partitions similarly to what you have on /dev/sda (my example numbers follow, use your numbers here):<br
/> <strong>parted /dev/sdb mkpart bios_grub 1049kB 2097kB</strong><br
/> <strong>parted /dev/sdb mkpart boot 2097kB 258MB</strong><br
/> <strong>parted /dev/sdb mkpart lvm 258MB 2000GB</strong></li><li>Set proper flags on partitions:<br
/> <strong>parted /dev/sdb set 1 bios_grub on</strong> (GPT doesn't have MBR, so you create a 1-MB partition instead to hold grub2's boot code)<br
/> <em>(possibly optional)</em> <strong>parted /dev/sdb set 2 raid on</strong><br
/> <em>(possibly optional)</em> <strong>parted /dev/sdb set 3 raid on</strong></li><li><em>(possibly optional)</em> To make sure /dev/sdb1 (the bios_grub) indeed contains grub's boot code, I did <strong>dd if=/dev/sda1 of=/dev/sdb1</strong></li><li><strong>apt-get install mdadm</strong></li><li>Note: at this point, older tutorials suggest adding a bunch of raid* kernel modules to /etc/modules and to grub's list of modules to load. I'm not sure this is really necessary, but do see the tutorials mentioned at the top for more information. If you do modify the lists of modules - don't forget to run <strong>update-initramfs -u</strong>.</li><li>Create two initially-degraded RAID1 devices (one for /boot, another for LVM):<br
/> <strong>mdadm &ndash;&ndash;create /dev/md0 &ndash;&ndash;level=1 &ndash;&ndash;raid-devices=2 /dev/sdb2 missing</strong><br
/> <strong>mdadm &ndash;&ndash;create /dev/md1 &ndash;&ndash;level=1 &ndash;&ndash;raid-devices=2 /dev/sdb3 missing</strong></li><li>Store the configuration of your RAID1 to the mdadm.conf file (important! this is not done automatically!)<br
/> <strong>mdadm -Es >> /etc/mdadm/mdadm.conf</strong></li><li>Verify the contents of your mdadm.conf:<br
/> <strong>cat /etc/mdadm/mdadm.conf</strong><br
/> <strong>dpkg-reconfigure mdadm</strong>, and enable booting in degraded mode</li><li>Copy your current /boot (/dev/sda2) to the new /dev/md0 /boot partition:<br
/> (one can use dd here as well, but for some reason my attempt at dd failed writing 1 last byte of data)<br
/> <strong>mkdir /mnt/md0</strong><br
/> <strong>mount /dev/md0 /mnt/md0</strong><br
/> <strong>cp -a /boot/* /mnt/md0/</strong><br
/> <strong>umount /dev/md0</strong><br
/> <strong>rmdir /mnt/md0</strong></li><li>Now extend your existing volume group to include the newly-created /dev/md1:<br
/> <strong>pvcreate /dev/md1</strong><br
/> <strong>vgextend vg0 /dev/md1</strong></li><li>Verify the list of logical volumes you curently have: enter <strong>lvm</strong> shell, and type <strong>lvs</strong>. Here's what I had:<br
/> LV   VG    Attr   LSize   Origin Snap%  Move Log Copy%  Convert<br
/> home vg0   -wi-ao   1.70t<br
/> logs vg0   -wi-ao   4.66g<br
/> root vg0   -wi-ao  10.24g<br
/> srv  vg0   -wc-ao 100.00g<br
/> swap vg0   -wi-ao   1.86g<br
/> tmp  vg0   -wi-ao   4.66g</li><li>Now, you can move all the logical volumes to new physical volume in one command: <strong>pvmove /dev/sda3 /dev/md1</strong>. Personally, remembering the problem I had with dd from /dev/sda2 to /dev/md0, I decided to move all logical volumes one-by-one; as this takes time, you may consider joining these operations with <strong>;</strong> or <strong>&#038;&</strong>, and putting the /tmp last (as the easiest one to re-create if it fails to move):<br
/> <strong>pvmove &ndash;&ndash;name home /dev/sda3 /dev/md1</strong><br
/> <strong>pvmove &ndash;&ndash;name srv /dev/sda3 /dev/md1</strong><br
/> <strong>pvmove &ndash;&ndash;name logs /dev/sda3 /dev/md1</strong><br
/> <strong>pvmove &ndash;&ndash;name swap /dev/sda3 /dev/md1</strong><br
/> <strong>pvmove &ndash;&ndash;name root /dev/sda3 /dev/md1</strong><br
/> <strong>pvmove &ndash;&ndash;name tmp /dev/sda3 /dev/md1</strong></li><li>To be safer, I ran FS check on a few volumes I could umount:<br
/> <strong>umount /dev/mapper/vg0-srv</strong><br
/> <strong>fsck -f /dev/mapper/vg0-srv</strong><br
/> <strong>mount /dev/mapper/vg0-srv</strong><br
/> <strong>umount /dev/mapper/vg0-tmp</strong><br
/> <strong>fsck -f /dev/mapper/vg0-tmp</strong><br
/> <strong>mount /dev/mapper/vg0-tmp</strong></li><li>Remove /dev/sda3 from the physical space available to your volume group:<br
/> <strong>vgreduce vg0 /dev/sda3</strong></li><li>Install grub2 to both drives, so as to make them both bootable in case of failure:<br
/> <strong>grub-install '(hd0)'</strong><br
/> <strong>grub-install '(hd1)'</strong></li><li>Edit <strong>/etc/fstab</strong>, pointing /boot to /dev/md0. You may use UUIDs here, but please do not use UUIDs from mdadm.conf - those are different from FS-UUIDs, instead do <strong>ls -l /dev/disk/by-uuid</strong> to find the UUID of /dev/md0. Personally, I had no problems just using /dev/md0.</li><li>Now is the time to add your original /dev/sda to the RAID1; be absolutely sure you have moved all the data off that drive, because these commands will destroy it:<br
/> <strong>mdadm &ndash;&ndash;manage &ndash;&ndash;add /dev/md0 /dev/sda2</strong><br
/> <strong>mdadm &ndash;&ndash;manage &ndash;&ndash;add /dev/md1 /dev/sda3</strong><br
/> Re-syncing array will take some time.</li><li>To be on the safe side, you may want to run again <strong>update-initramfs -u</strong> and <strong>update-grub</strong>; I have also edited /etc/grub.d/40_custom, adding there 2 more boot options: from /dev/sda2 and /dev/sdb2 (/boot on both drives) - have no idea if that will work, but having more boot options didn't hurt</li><li>Reboot into your new system. Actually, at this point reboot is only necessary to verify that your system is bootable - you may delay this reboot as long as you want to.</li><li>Many tutorials also suggest testing your RAID1 by manually "degrading" it, trying to boot, and then rebuilding it back. I haven't done that, but you may want to.</li></ol><p>Improvement suggestions, criticism and thank-you are welcome in the comments.</p><p><a
class="a2a_button_google_plusone addtoany_special_service" data-href="http://bogdan.org.ua/2011/05/17/how-to-remotely-convert-live-hdd-lvm-linux-server-to-raid1-grub2-gpt.html"></a><a
class="a2a_button_facebook_like addtoany_special_service" data-href="http://bogdan.org.ua/2011/05/17/how-to-remotely-convert-live-hdd-lvm-linux-server-to-raid1-grub2-gpt.html"></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbogdan.org.ua%2F2011%2F05%2F17%2Fhow-to-remotely-convert-live-hdd-lvm-linux-server-to-raid1-grub2-gpt.html&amp;title=How%20to%20remotely%20convert%20live%201xHDD%2FLVM%20Linux%20server%20to%202xHDD%20RAID1%2FLVM%20%28GRUB2%2C%20GPT%29" id="wpa2a_44"><img
src="http://bogdan.org.ua/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://bogdan.org.ua/2011/05/17/how-to-remotely-convert-live-hdd-lvm-linux-server-to-raid1-grub2-gpt.html/feed</wfw:commentRss> <slash:comments>4</slash:comments> </item> <item><title>Using Python in a Java project</title><link>http://bogdan.org.ua/2011/05/17/using-python-in-a-java-project.html</link> <comments>http://bogdan.org.ua/2011/05/17/using-python-in-a-java-project.html#comments</comments> <pubDate>Tue, 17 May 2011 11:33:52 +0000</pubDate> <dc:creator>Bogdan</dc:creator> <category><![CDATA[Links]]></category> <category><![CDATA[Movies]]></category> <category><![CDATA[Programming]]></category> <category><![CDATA[Python]]></category> <category><![CDATA[Groovy]]></category> <category><![CDATA[java]]></category> <category><![CDATA[Jython]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=1589</guid> <description><![CDATA[If you are a Python zealot, and Java doesn't feel right, but the project you are working on is a Java project - try Jython - Python for the Java platform, compile your python scripts into Java bytecode Groovy - not Python, but still a scripting language which compiles to jars]]></description> <content:encoded><![CDATA[<p>If you are a Python zealot, and Java <em>doesn't feel right</em>, but the project you are working on is a Java project - try</p><ul><li><a
href="http://www.jython.org/">Jython</a> - Python for the Java platform, compile your python scripts into Java bytecode</li><li><a
href="http://groovy.codehaus.org/">Groovy</a> - not Python, but still a scripting language which compiles to jars</li></ul><p><a
class="a2a_button_google_plusone addtoany_special_service" data-href="http://bogdan.org.ua/2011/05/17/using-python-in-a-java-project.html"></a><a
class="a2a_button_facebook_like addtoany_special_service" data-href="http://bogdan.org.ua/2011/05/17/using-python-in-a-java-project.html"></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbogdan.org.ua%2F2011%2F05%2F17%2Fusing-python-in-a-java-project.html&amp;title=Using%20Python%20in%20a%20Java%20project" id="wpa2a_48"><img
src="http://bogdan.org.ua/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://bogdan.org.ua/2011/05/17/using-python-in-a-java-project.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Academia or life?</title><link>http://bogdan.org.ua/2011/04/16/academia-or-life.html</link> <comments>http://bogdan.org.ua/2011/04/16/academia-or-life.html#comments</comments> <pubDate>Sat, 16 Apr 2011 10:56:42 +0000</pubDate> <dc:creator>Bogdan</dc:creator> <category><![CDATA[Links]]></category> <category><![CDATA[Science]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=1582</guid> <description><![CDATA[Worth reading: Goodbye academia, I get a life.]]></description> <content:encoded><![CDATA[<p>Worth reading: <a
href="http://blog.devicerandom.org/2011/02/18/getting-a-life/">Goodbye academia, I get a life</a>.</p><p><a
class="a2a_button_google_plusone addtoany_special_service" data-href="http://bogdan.org.ua/2011/04/16/academia-or-life.html"></a><a
class="a2a_button_facebook_like addtoany_special_service" data-href="http://bogdan.org.ua/2011/04/16/academia-or-life.html"></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbogdan.org.ua%2F2011%2F04%2F16%2Facademia-or-life.html&amp;title=Academia%20or%20life%3F" id="wpa2a_52"><img
src="http://bogdan.org.ua/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://bogdan.org.ua/2011/04/16/academia-or-life.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Fonts for programming</title><link>http://bogdan.org.ua/2011/04/13/fonts-for-programming.html</link> <comments>http://bogdan.org.ua/2011/04/13/fonts-for-programming.html#comments</comments> <pubDate>Wed, 13 Apr 2011 21:44:29 +0000</pubDate> <dc:creator>Bogdan</dc:creator> <category><![CDATA[Links]]></category> <category><![CDATA[DejaVu]]></category> <category><![CDATA[fonts]]></category> <category><![CDATA[mono]]></category> <category><![CDATA[Programming]]></category> <category><![CDATA[sans]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=1575</guid> <description><![CDATA[My personal favourite for the last 2-3 years had been DejaVu Sans Mono. Check this list of 10 programming fonts - you may find your love there.]]></description> <content:encoded><![CDATA[<p>My personal favourite for the last 2-3 years had been DejaVu Sans Mono.</p><p>Check this <a
href="http://hivelogic.com/articles/top-10-programming-fonts/">list of 10 programming fonts</a> - you may find your love there.</p><p><a
class="a2a_button_google_plusone addtoany_special_service" data-href="http://bogdan.org.ua/2011/04/13/fonts-for-programming.html"></a><a
class="a2a_button_facebook_like addtoany_special_service" data-href="http://bogdan.org.ua/2011/04/13/fonts-for-programming.html"></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbogdan.org.ua%2F2011%2F04%2F13%2Ffonts-for-programming.html&amp;title=Fonts%20for%20programming" id="wpa2a_56"><img
src="http://bogdan.org.ua/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://bogdan.org.ua/2011/04/13/fonts-for-programming.html/feed</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Generate .mood moodbar files for your whole music collection</title><link>http://bogdan.org.ua/2011/04/10/generate-mood-moodbar-files-for-your-whole-music-collection.html</link> <comments>http://bogdan.org.ua/2011/04/10/generate-mood-moodbar-files-for-your-whole-music-collection.html#comments</comments> <pubDate>Sun, 10 Apr 2011 20:21:46 +0000</pubDate> <dc:creator>Bogdan</dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[Links]]></category> <category><![CDATA[Notepad]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[amarok]]></category> <category><![CDATA[moodbar]]></category> <category><![CDATA[music]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=1561</guid> <description><![CDATA[Amarok moodbar wiki page has 2 nice scripts to generate .mood files for your whole music collection (to be displayed by amarok when playing). Both scripts should be started from the directory where you keep your music. The .mood files will be generated next to the source music files (in the same directories). You can [...]]]></description> <content:encoded><![CDATA[<p><a
href="http://amarok.kde.org/wiki/Moodbar">Amarok moodbar wiki</a> page has 2 nice scripts to generate .mood files for your whole music collection (to be displayed by amarok when playing).</p><p><span
id="more-1561"></span></p><p>Both scripts should be started from the directory where you keep your music. The .mood files will be generated next to the source music files (in the same directories). You can modify the scripts to have the moods stored to $HOME/.kde/share/apps/amarok/moods/, so as not to clutter your music directories.</p><p>Script for multicore CPUs (will not overwrite existing mood files):</p><div
class="igBar"><span
id="lcode-10"><a
href="#" onclick="javascript:showPlainTxt('code-10'); return false;">PLAIN TEXT</a></span></div><div
class="syntax_hilite"><span
class="langName">CODE:</span><div
id="code-10"><div
class="code"><ol><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#!/bin/bash</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">NUMCPU=<span
style="color:#CC0000;">"$(grep ^processor /proc/cpuinfo | wc -l)"</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">find . -type f -regextype posix-awk -iregex <span
style="color:#CC0000;">'.*<span
style="color:#000099; font-weight:bold;">\.</span>(mp3|ogg|flac|wma)'</span> | while read i ; do</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;while <span
style="color:#006600; font-weight:bold;">&#91;</span> `jobs -p | wc -l` -ge $NUMCPU <span
style="color:#006600; font-weight:bold;">&#93;</span> ; do</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sleep <span
style="color:#800000;color:#800000;">0</span>.<span
style="color:#800000;color:#800000;">1</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;done</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;TEMP=<span
style="color:#CC0000;">"${i%.*}.mood"</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;OUTF=`echo <span
style="color:#CC0000;">"$TEMP"</span> | sed <span
style="color:#CC0000;">'s#<span
style="color:#000099; font-weight:bold;">\(</span>.*<span
style="color:#000099; font-weight:bold;">\)</span>/<span
style="color:#000099; font-weight:bold;">\(</span>[^,]*<span
style="color:#000099; font-weight:bold;">\)</span>#<span
style="color:#000099; font-weight:bold;">\1</span>/.<span
style="color:#000099; font-weight:bold;">\2</span>#'</span>`</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;if <span
style="color:#006600; font-weight:bold;">&#91;</span> ! -e <span
style="color:#CC0000;">"$OUTF"</span> <span
style="color:#006600; font-weight:bold;">&#93;</span> ; then</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;moodbar -o <span
style="color:#CC0000;">"$OUTF"</span> <span
style="color:#CC0000;">"$i"</span> &amp;</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;fi</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">done</div></li></ol></div></div></div><p></p><p>Script for single-threaded moods generation (will only overwrite the last-generated mood file from a previous run):</p><div
class="igBar"><span
id="lcode-11"><a
href="#" onclick="javascript:showPlainTxt('code-11'); return false;">PLAIN TEXT</a></span></div><div
class="syntax_hilite"><span
class="langName">CODE:</span><div
id="code-11"><div
class="code"><ol><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#!/bin/bash</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">DIR=$<span
style="color:#006600; font-weight:bold;">&#123;</span><span
style="color:#800000;color:#800000;">1</span>:-.<span
style="color:#006600; font-weight:bold;">&#125;</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">LAST=.<span
style="">moodbar</span>-lastreadsong</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">C_RET=<span
style="color:#800000;color:#800000;">0</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">control_c<span
style="color:#006600; font-weight:bold;">&#40;</span><span
style="color:#006600; font-weight:bold;">&#41;</span>&nbsp; &nbsp; &nbsp; &nbsp; # run if user hits control-c</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span
style="color:#006600; font-weight:bold;">&#123;</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; echo <span
style="color:#CC0000;">"$1"</span>&gt; <span
style="color:#CC0000;">"$LAST"</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; echo <span
style="color:#CC0000;">"Exiting..."</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; exit</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span
style="color:#006600; font-weight:bold;">&#125;</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">if <span
style="color:#006600; font-weight:bold;">&#91;</span> -e <span
style="color:#CC0000;">"$LAST"</span> <span
style="color:#006600; font-weight:bold;">&#93;</span>; then</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; read filetodelete &lt;<span
style="color:#CC0000;">"$LAST"</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; rm <span
style="color:#CC0000;">"$filetodelete"</span> <span
style="color:#CC0000;">"$LAST"</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">fi</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">exec <span
style="color:#800000;color:#800000;">9</span>&lt;&lt;<span
style="color:#006600; font-weight:bold;">&#40;</span>find <span
style="color:#CC0000;">"$DIR"</span> -type f -regextype posix-awk -iregex <span
style="color:#CC0000;">'.*<span
style="color:#000099; font-weight:bold;">\.</span>(mp3|ogg|flac|wma)'</span><span
style="color:#006600; font-weight:bold;">&#41;</span> # you may need to add m4a and mp4</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">while read i</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">do</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; TEMP=<span
style="color:#CC0000;">"${i%.*}.mood"</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; OUTF=`echo <span
style="color:#CC0000;">"$TEMP"</span> | sed <span
style="color:#CC0000;">'s#<span
style="color:#000099; font-weight:bold;">\(</span>.*<span
style="color:#000099; font-weight:bold;">\)</span>/<span
style="color:#000099; font-weight:bold;">\(</span>[^,]*<span
style="color:#000099; font-weight:bold;">\)</span>#<span
style="color:#000099; font-weight:bold;">\1</span>/.<span
style="color:#000099; font-weight:bold;">\2</span>#'</span>`</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; trap <span
style="color:#CC0000;">'control_c &quot;$OUTF&quot;'</span> INT</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; if <span
style="color:#006600; font-weight:bold;">&#91;</span> ! -e <span
style="color:#CC0000;">"$OUTF"</span> <span
style="color:#006600; font-weight:bold;">&#93;</span> || <span
style="color:#006600; font-weight:bold;">&#91;</span> <span
style="color:#CC0000;">"$i"</span> -nt <span
style="color:#CC0000;">"$OUTF"</span> <span
style="color:#006600; font-weight:bold;">&#93;</span>; then</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; moodbar -o <span
style="color:#CC0000;">"$OUTF"</span> <span
style="color:#CC0000;">"$i"</span> || <span
style="color:#006600; font-weight:bold;">&#123;</span> C_RET=<span
style="color:#800000;color:#800000;">1</span>; echo <span
style="color:#CC0000;">"An error occurred!"</span>&gt;&amp;<span
style="color:#800000;color:#800000;">2</span>; <span
style="color:#006600; font-weight:bold;">&#125;</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; fi</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">done &lt;&amp;<span
style="color:#800000;color:#800000;">9</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">exec <span
style="color:#800000;color:#800000;">9</span>&lt;&amp;-</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">exit $C_RET</div></li></ol></div></div></div><p></p><p>That same page has a link to an older, somewhat more polished <a
href="http://forum.kde.org/viewtopic.php?f=119&#038;t=84811">ruby script</a> for the same task. It requires a running instance of Amarok, and uses it's media collection to find music files and create mood files for them. This script can potentially (after a little editing) store .mood files either with the music or to the $HOME/.kde/... path mentioned above. It is for an older version of Amarok, and thus is not likely to work with e.g. Amarok 2.4</p><div
class="igBar"><span
id="lruby-12"><a
href="#" onclick="javascript:showPlainTxt('ruby-12'); return false;">PLAIN TEXT</a></span></div><div
class="syntax_hilite"><span
class="langName">RUBY:</span><div
id="ruby-12"><div
class="ruby"><ol><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span
style="color:#008000; font-style:italic;">#!/usr/bin/ruby</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span
style="color:#008000; font-style:italic;"># Simple moodbar file management utility by Joe Rabinoff</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span
style="color:#008000; font-style:italic;"># This is also my first ever ruby script so bear with me</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$moodbar_folder = <span
style="color:#996600;">"#{ENV['HOME']}/.kde/share/apps/amarok/moods/"</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span
style="color:#9966CC; font-weight:bold;">def</span> usage<span
style="color:#006600; font-weight:bold;">&#40;</span><span
style="color:#006600; font-weight:bold;">&#41;</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span
style="color:#CC0066; font-weight:bold;">print</span> <span
style="color:#996600;">"This is the moodbar file management utility<span
style="color:#000099;">\n</span>"</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span
style="color:#CC0066; font-weight:bold;">print</span> <span
style="color:#996600;">"<span
style="color:#000099;">\n</span>"</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span
style="color:#CC0066; font-weight:bold;">print</span> <span
style="color:#996600;">"Usage is:<span
style="color:#000099;">\n</span>"</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span
style="color:#CC0066; font-weight:bold;">print</span> <span
style="color:#996600;">"&nbsp; &nbsp;moodbar_util.rb -rename&nbsp; &nbsp; Rename mood files"</span> \</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+ <span
style="color:#996600;">" from any old naming scheme to the current one<span
style="color:#000099;">\n</span>"</span> \</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; + <span
style="color:#996600;">"&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (not applicable when mood"</span> \</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+ <span
style="color:#996600;">" files are stored with music)<span
style="color:#000099;">\n</span>"</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span
style="color:#CC0066; font-weight:bold;">print</span> <span
style="color:#996600;">"&nbsp; &nbsp;moodbar_util.rb -calcall&nbsp; &nbsp;Calculate all un-calculated"</span> \</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; + <span
style="color:#996600;">" mood files<span
style="color:#000099;">\n</span>"</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span
style="color:#CC0066; font-weight:bold;">exit</span><span
style="color:#006600; font-weight:bold;">&#40;</span><span
style="color:#006666;color:#800000;">1</span><span
style="color:#006600; font-weight:bold;">&#41;</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span
style="color:#9966CC; font-weight:bold;">end</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span
style="color:#9966CC; font-weight:bold;">def</span> check_amarok_running<span
style="color:#006600; font-weight:bold;">&#40;</span><span
style="color:#006600; font-weight:bold;">&#41;</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; result = <span
style="color:#996600;">`dcop 'amarok*'`</span>.<span
style="color:#CC0066; font-weight:bold;">split</span><span
style="color:#006600; font-weight:bold;">&#40;</span><span
style="color:#996600;">"<span
style="color:#000099;">\n</span>"</span><span
style="color:#006600; font-weight:bold;">&#41;</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span
style="color:#0000FF; font-weight:bold;">return</span> <span
style="color:#006600; font-weight:bold;">&#40;</span>result.<span
style="color:#9900CC;">length</span>&gt; <span
style="color:#006666;color:#800000;">0</span><span
style="color:#006600; font-weight:bold;">&#41;</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span
style="color:#9966CC; font-weight:bold;">end</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span
style="color:#9966CC; font-weight:bold;">def</span> get_devices<span
style="color:#006600; font-weight:bold;">&#40;</span><span
style="color:#006600; font-weight:bold;">&#41;</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; result = <span
style="color:#996600;">`dcop amarok collection query 'SELECT id, lastmountpoint FROM devices;'`</span>.<span
style="color:#CC0066; font-weight:bold;">split</span><span
style="color:#006600; font-weight:bold;">&#40;</span><span
style="color:#996600;">"<span
style="color:#000099;">\n</span>"</span><span
style="color:#006600; font-weight:bold;">&#41;</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; ret = Hash.<span
style="color:#9900CC;">new</span><span
style="color:#006600; font-weight:bold;">&#40;</span><span
style="color:#006600; font-weight:bold;">&#41;</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; result.<span
style="color:#9900CC;">each_index</span> <span
style="color:#9966CC; font-weight:bold;">do</span> |i|</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; ret<span
style="color:#006600; font-weight:bold;">&#91;</span>result<span
style="color:#006600; font-weight:bold;">&#91;</span>i<span
style="color:#006600; font-weight:bold;">&#93;</span>.<span
style="color:#9900CC;">to_i</span><span
style="color:#006600; font-weight:bold;">&#93;</span> = result<span
style="color:#006600; font-weight:bold;">&#91;</span>i+<span
style="color:#006666;color:#800000;">1</span><span
style="color:#006600; font-weight:bold;">&#93;</span> <span
style="color:#9966CC; font-weight:bold;">if</span> i % <span
style="color:#006666;color:#800000;">2</span> == <span
style="color:#006666;color:#800000;">0</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span
style="color:#9966CC; font-weight:bold;">end</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span
style="color:#0000FF; font-weight:bold;">return</span> ret</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span
style="color:#9966CC; font-weight:bold;">end</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span
style="color:#9966CC; font-weight:bold;">def</span> mood_name<span
style="color:#006600; font-weight:bold;">&#40;</span>url, deviceid<span
style="color:#006600; font-weight:bold;">&#41;</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; ret = url.<span
style="color:#CC0066; font-weight:bold;">gsub</span><span
style="color:#006600; font-weight:bold;">&#40;</span>/\//, ','<span
style="color:#006600; font-weight:bold;">&#41;</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span
style="color:#0000FF; font-weight:bold;">return</span> deviceid.<span
style="color:#9900CC;">to_s</span> + <span
style="color:#996600;">","</span> + ret</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span
style="color:#9966CC; font-weight:bold;">end</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span
style="color:#9966CC; font-weight:bold;">def</span> rename<span
style="color:#006600; font-weight:bold;">&#40;</span><span
style="color:#006600; font-weight:bold;">&#41;</span>&nbsp; &nbsp;</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span
style="color:#CC0066; font-weight:bold;">print</span> <span
style="color:#996600;">"Renaming mood files from outdated naming schemes...<span
style="color:#000099;">\n</span>"</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span
style="color:#008000; font-style:italic;"># As far as I can tell, the best way to do this is just select all</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span
style="color:#008000; font-style:italic;"># tracks, check the old possible moodbar names, and rename them</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; tracks = <span
style="color:#996600;">`dcop amarok collection query 'SELECT url, deviceid FROM tags;'`</span>.<span
style="color:#CC0066; font-weight:bold;">split</span><span
style="color:#006600; font-weight:bold;">&#40;</span><span
style="color:#996600;">"<span
style="color:#000099;">\n</span>"</span><span
style="color:#006600; font-weight:bold;">&#41;</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; devices = get_devices</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span
style="color:#006666;color:#800000;">0</span>.<span
style="color:#9900CC;">step</span><span
style="color:#006600; font-weight:bold;">&#40;</span>tracks.<span
style="color:#9900CC;">length</span>-<span
style="color:#006666;color:#800000;">1</span>, <span
style="color:#006666;color:#800000;">2</span><span
style="color:#006600; font-weight:bold;">&#41;</span> <span
style="color:#9966CC; font-weight:bold;">do</span> |i|</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; url&nbsp; &nbsp; &nbsp; = tracks<span
style="color:#006600; font-weight:bold;">&#91;</span>i<span
style="color:#006600; font-weight:bold;">&#93;</span>.<span
style="color:#CC0066; font-weight:bold;">sub</span><span
style="color:#006600; font-weight:bold;">&#40;</span>/\.<span
style="color:#006600; font-weight:bold;">&#91;</span>^\.<span
style="color:#006600; font-weight:bold;">&#93;</span>*$/, '.<span
style="color:#9900CC;">mood</span>'<span
style="color:#006600; font-weight:bold;">&#41;</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; deviceid = tracks<span
style="color:#006600; font-weight:bold;">&#91;</span>i+<span
style="color:#006666;color:#800000;">1</span><span
style="color:#006600; font-weight:bold;">&#93;</span>.<span
style="color:#9900CC;">to_i</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; path = url.<span
style="color:#CC0066; font-weight:bold;">sub</span><span
style="color:#006600; font-weight:bold;">&#40;</span>/\./, ''<span
style="color:#006600; font-weight:bold;">&#41;</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span
style="color:#9966CC; font-weight:bold;">if</span> devices.<span
style="color:#9900CC;">has_key</span>?<span
style="color:#006600; font-weight:bold;">&#40;</span>deviceid<span
style="color:#006600; font-weight:bold;">&#41;</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;path = devices<span
style="color:#006600; font-weight:bold;">&#91;</span>deviceid<span
style="color:#006600; font-weight:bold;">&#93;</span> + path</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span
style="color:#9966CC; font-weight:bold;">end</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; moodfile&nbsp; = $moodbar_folder + mood_name<span
style="color:#006600; font-weight:bold;">&#40;</span>url, deviceid<span
style="color:#006600; font-weight:bold;">&#41;</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; moodfile1 = $moodbar_folder + path.<span
style="color:#CC0066; font-weight:bold;">gsub</span><span
style="color:#006600; font-weight:bold;">&#40;</span>/\//, ','<span
style="color:#006600; font-weight:bold;">&#41;</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span
style="color:#9966CC; font-weight:bold;">next</span> <span
style="color:#9966CC; font-weight:bold;">if</span> FileTest.<span
style="color:#9900CC;">exists</span>?<span
style="color:#006600; font-weight:bold;">&#40;</span>moodfile<span
style="color:#006600; font-weight:bold;">&#41;</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span
style="color:#9966CC; font-weight:bold;">if</span> FileTest.<span
style="color:#9900CC;">exists</span>?<span
style="color:#006600; font-weight:bold;">&#40;</span>moodfile1<span
style="color:#006600; font-weight:bold;">&#41;</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color:#CC0066; font-weight:bold;">system</span><span
style="color:#006600; font-weight:bold;">&#40;</span><span
style="color:#996600;">"mv"</span>, <span
style="color:#996600;">"-f"</span>, moodfile1, moodfile<span
style="color:#006600; font-weight:bold;">&#41;</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color:#CC0066; font-weight:bold;">print</span> <span
style="color:#996600;">"Moved "</span>, moodfile1, <span
style="color:#996600;">" to "</span>, moodfile, <span
style="color:#996600;">"<span
style="color:#000099;">\n</span>"</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span
style="color:#9966CC; font-weight:bold;">end</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span
style="color:#9966CC; font-weight:bold;">end</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span
style="color:#9966CC; font-weight:bold;">end</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span
style="color:#9966CC; font-weight:bold;">def</span> calcall<span
style="color:#006600; font-weight:bold;">&#40;</span><span
style="color:#006600; font-weight:bold;">&#41;</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span
style="color:#CC0066; font-weight:bold;">print</span> <span
style="color:#996600;">"Calculating all nonexisting moodbars...<span
style="color:#000099;">\n</span><span
style="color:#000099;">\n</span>"</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; tracks = <span
style="color:#996600;">`dcop amarok collection query 'SELECT url, deviceid FROM tags;'`</span>.<span
style="color:#CC0066; font-weight:bold;">split</span><span
style="color:#006600; font-weight:bold;">&#40;</span><span
style="color:#996600;">"<span
style="color:#000099;">\n</span>"</span><span
style="color:#006600; font-weight:bold;">&#41;</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; devices = get_devices</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; withMusic = <span
style="color:#006600; font-weight:bold;">&#40;</span><span
style="color:#996600;">`dcop amarok script readConfig MoodsWithMusic`</span>.<span
style="color:#CC0066; font-weight:bold;">chomp</span> == <span
style="color:#996600;">"true"</span><span
style="color:#006600; font-weight:bold;">&#41;</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span
style="color:#006666;color:#800000;">0</span>.<span
style="color:#9900CC;">step</span><span
style="color:#006600; font-weight:bold;">&#40;</span>tracks.<span
style="color:#9900CC;">length</span>-<span
style="color:#006666;color:#800000;">1</span>, <span
style="color:#006666;color:#800000;">2</span><span
style="color:#006600; font-weight:bold;">&#41;</span> <span
style="color:#9966CC; font-weight:bold;">do</span> |i|</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; url&nbsp; &nbsp; &nbsp; = tracks<span
style="color:#006600; font-weight:bold;">&#91;</span>i<span
style="color:#006600; font-weight:bold;">&#93;</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; deviceid = tracks<span
style="color:#006600; font-weight:bold;">&#91;</span>i+<span
style="color:#006666;color:#800000;">1</span><span
style="color:#006600; font-weight:bold;">&#93;</span>.<span
style="color:#9900CC;">to_i</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; moodfile = <span
style="color:#996600;">""</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; songpath = url.<span
style="color:#CC0066; font-weight:bold;">sub</span><span
style="color:#006600; font-weight:bold;">&#40;</span>/\./, ''<span
style="color:#006600; font-weight:bold;">&#41;</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span
style="color:#9966CC; font-weight:bold;">if</span> devices.<span
style="color:#9900CC;">has_key</span>?<span
style="color:#006600; font-weight:bold;">&#40;</span>deviceid<span
style="color:#006600; font-weight:bold;">&#41;</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; songpath = devices<span
style="color:#006600; font-weight:bold;">&#91;</span>deviceid<span
style="color:#006600; font-weight:bold;">&#93;</span> + songpath</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span
style="color:#9966CC; font-weight:bold;">end</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span
style="color:#9966CC; font-weight:bold;">if</span> withMusic</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; moodfile = songpath.<span
style="color:#CC0066; font-weight:bold;">sub</span><span
style="color:#006600; font-weight:bold;">&#40;</span>/\.<span
style="color:#006600; font-weight:bold;">&#91;</span>^\.<span
style="color:#006600; font-weight:bold;">&#93;</span>*$/, '.<span
style="color:#9900CC;">mood</span>'<span
style="color:#006600; font-weight:bold;">&#41;</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; moodfile = File.<span
style="color:#9900CC;">dirname</span><span
style="color:#006600; font-weight:bold;">&#40;</span>moodfile<span
style="color:#006600; font-weight:bold;">&#41;</span> + <span
style="color:#996600;">"/."</span> + File.<span
style="color:#9900CC;">basename</span><span
style="color:#006600; font-weight:bold;">&#40;</span>moodfile<span
style="color:#006600; font-weight:bold;">&#41;</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span
style="color:#9966CC; font-weight:bold;">else</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; moodfile = $moodbar_folder \</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; + mood_name<span
style="color:#006600; font-weight:bold;">&#40;</span>url.<span
style="color:#CC0066; font-weight:bold;">sub</span><span
style="color:#006600; font-weight:bold;">&#40;</span>/\.<span
style="color:#006600; font-weight:bold;">&#91;</span>^\.<span
style="color:#006600; font-weight:bold;">&#93;</span>*$/, '.<span
style="color:#9900CC;">mood</span>'<span
style="color:#006600; font-weight:bold;">&#41;</span>, deviceid<span
style="color:#006600; font-weight:bold;">&#41;</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span
style="color:#9966CC; font-weight:bold;">end</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span
style="color:#9966CC; font-weight:bold;">next</span> <span
style="color:#9966CC; font-weight:bold;">if</span> FileTest.<span
style="color:#9900CC;">exists</span>?<span
style="color:#006600; font-weight:bold;">&#40;</span>moodfile<span
style="color:#006600; font-weight:bold;">&#41;</span> &amp;&amp; FileTest.<span
style="color:#9900CC;">size</span><span
style="color:#006600; font-weight:bold;">&#40;</span>moodfile<span
style="color:#006600; font-weight:bold;">&#41;</span>&gt; <span
style="color:#006666;color:#800000;">0</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span
style="color:#9966CC; font-weight:bold;">next</span> <span
style="color:#9966CC; font-weight:bold;">unless</span> FileTest.<span
style="color:#9900CC;">exists</span>?<span
style="color:#006600; font-weight:bold;">&#40;</span>songpath<span
style="color:#006600; font-weight:bold;">&#41;</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span
style="color:#CC0066; font-weight:bold;">print</span> <span
style="color:#996600;">"Saving moodbar for "</span>, songpath, <span
style="color:#996600;">"<span
style="color:#000099;">\n</span>"</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span
style="color:#CC0066; font-weight:bold;">print</span> <span
style="color:#996600;">"&nbsp; &nbsp;to file "</span>, moodfile, <span
style="color:#996600;">"<span
style="color:#000099;">\n</span>"</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span
style="color:#CC0066; font-weight:bold;">system</span><span
style="color:#006600; font-weight:bold;">&#40;</span><span
style="color:#996600;">"moodbar"</span>, <span
style="color:#996600;">"-o"</span>, moodfile, songpath<span
style="color:#006600; font-weight:bold;">&#41;</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span
style="color:#CC0066; font-weight:bold;">print</span> <span
style="color:#996600;">"<span
style="color:#000099;">\n</span>"</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span
style="color:#9966CC; font-weight:bold;">end</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span
style="color:#9966CC; font-weight:bold;">end</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$mode = ARGV<span
style="color:#006600; font-weight:bold;">&#91;</span><span
style="color:#006666;color:#800000;">0</span><span
style="color:#006600; font-weight:bold;">&#93;</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span
style="color:#9966CC; font-weight:bold;">if</span> !check_amarok_running</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span
style="color:#CC0066; font-weight:bold;">print</span> <span
style="color:#996600;">"Amarok is not running!&nbsp; Please start Amarok and re-run "</span> \</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color:#996600;">"this script.<span
style="color:#000099;">\n</span>"</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span
style="color:#9966CC; font-weight:bold;">end</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span
style="color:#9966CC; font-weight:bold;">if</span> $mode == <span
style="color:#996600;">"-rename"</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; rename</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span
style="color:#9966CC; font-weight:bold;">elsif</span> $mode == <span
style="color:#996600;">"-calcall"</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; calcall</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span
style="color:#9966CC; font-weight:bold;">else</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; usage</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span
style="color:#9966CC; font-weight:bold;">end</span></div></li></ol></div></div></div><p></p><p><a
class="a2a_button_google_plusone addtoany_special_service" data-href="http://bogdan.org.ua/2011/04/10/generate-mood-moodbar-files-for-your-whole-music-collection.html"></a><a
class="a2a_button_facebook_like addtoany_special_service" data-href="http://bogdan.org.ua/2011/04/10/generate-mood-moodbar-files-for-your-whole-music-collection.html"></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbogdan.org.ua%2F2011%2F04%2F10%2Fgenerate-mood-moodbar-files-for-your-whole-music-collection.html&amp;title=Generate%20.mood%20moodbar%20files%20for%20your%20whole%20music%20collection" id="wpa2a_60"><img
src="http://bogdan.org.ua/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://bogdan.org.ua/2011/04/10/generate-mood-moodbar-files-for-your-whole-music-collection.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Debunking the widespread myth of 2^32=4GB being the architectural limit</title><link>http://bogdan.org.ua/2011/04/10/debunking-widespread-myth-of-2-32-4gb-architectural-limit.html</link> <comments>http://bogdan.org.ua/2011/04/10/debunking-widespread-myth-of-2-32-4gb-architectural-limit.html#comments</comments> <pubDate>Sun, 10 Apr 2011 13:10:54 +0000</pubDate> <dc:creator>Bogdan</dc:creator> <category><![CDATA[Hardware]]></category> <category><![CDATA[Links]]></category> <category><![CDATA[Misc]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[32bit]]></category> <category><![CDATA[4GB]]></category> <category><![CDATA[myth]]></category> <category><![CDATA[PAE]]></category> <category><![CDATA[windows]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=1555</guid> <description><![CDATA[Quite a number of people are aware of the PAE which can extend the addressable space from 32bit up to 36-48-52bit (depending on the implementation; as I understand, Windows PAE extends to 36 bits, or 64GB of addressable space). However, overwhelming numbers of internet pages continue insisting that a not-more-than-4GB limit for the 32bit Windows [...]]]></description> <content:encoded><![CDATA[<p>Quite a number of people are aware of the <abbr
title="Page Address Extension">PAE</abbr> which can extend the addressable space from 32bit up to 36-48-52bit (depending on the implementation; as I understand, Windows PAE extends to 36 bits, or 64GB of addressable space). However, overwhelming numbers of internet pages continue insisting that a not-more-than-4GB limit for the 32bit Windows is the consequence of <em>2^32 = 4GB architectural limit</em>.</p><p>There is an <a
href="http://www.geoffchappell.com/viewer.htm?doc=notes/windows/license/memory.htm">excellent, in-depth, well-argumented article by Geoff Chappell</a> on the issue. Highly recommended in its entirety to those who want a complete understanding (additional side-reading and facts verification might be necessary).</p><p>A single citation to get you started:</p><blockquote><p>There is already on the Internet and elsewhere an awful lot of rubbish to read about this question. Hardly any of it would be worth citing even if I didn’t want to spare the authors the embarrassment. A surprising number of people who claim some sort of attention as expert commentators would have you believe that using more than 4GB of memory is mathematically impossible for any 32-bit operating system because 2 to the power of 32 is 4G and a 32-bit register can’t form an address above 4GB. If nothing else, these experts don’t know enough history: 2 to the 16 is only 64K and yet the wealth of Microsoft is founded on a 16-bit operating system that from its very first version was designed to use 640KB of RAM plus other memory in a physical address space of 1MB. Some remember this history and add seemingly plausible qualifications that exceeding 4GB is possible only at the price of nasty hacks that require everyone—well, all programmers—to jump through hoops. Fortunately, Intel’s processors are a lot more advanced than the 8086 from all those years ago.</p></blockquote><p>P.S. Unfortunately, patching the kernel won't help make Windows XP see more than 4GB RAM: even though the kernel itself does support more RAM (with PAE), starting with SP2 the <abbr
title="Hardware Abstraction Layer">HAL</abbr> was modified in a way prohibiting access to any RAM beyond 4GB. Patching may only be suggested to devoted geeks with Vista's and 7's.</p><p><a
class="a2a_button_google_plusone addtoany_special_service" data-href="http://bogdan.org.ua/2011/04/10/debunking-widespread-myth-of-2-32-4gb-architectural-limit.html"></a><a
class="a2a_button_facebook_like addtoany_special_service" data-href="http://bogdan.org.ua/2011/04/10/debunking-widespread-myth-of-2-32-4gb-architectural-limit.html"></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbogdan.org.ua%2F2011%2F04%2F10%2Fdebunking-widespread-myth-of-2-32-4gb-architectural-limit.html&amp;title=Debunking%20the%20widespread%20myth%20of%202%5E32%3D4GB%20being%20the%20architectural%20limit" id="wpa2a_64"><img
src="http://bogdan.org.ua/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://bogdan.org.ua/2011/04/10/debunking-widespread-myth-of-2-32-4gb-architectural-limit.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>rtorrent-enhanced with ipfilter and GeoIP: Debian Squeeze amd64 package</title><link>http://bogdan.org.ua/2011/04/01/rtorrent-enhanced-with-ipfilter-and-geoip-debian-squeeze-amd64-package.html</link> <comments>http://bogdan.org.ua/2011/04/01/rtorrent-enhanced-with-ipfilter-and-geoip-debian-squeeze-amd64-package.html#comments</comments> <pubDate>Thu, 31 Mar 2011 23:15:49 +0000</pubDate> <dc:creator>Bogdan</dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[amd64]]></category> <category><![CDATA[Debian]]></category> <category><![CDATA[geoip]]></category> <category><![CDATA[ipfilter]]></category> <category><![CDATA[package]]></category> <category><![CDATA[rtorrent]]></category> <category><![CDATA[squeeze]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=1530</guid> <description><![CDATA[rtorrent is an excellent ncurses rtorrent client. There are a few highly-popular patches, which haven't yet made it into the Squeeze's rtorrent version 0.8.6. Note: ArchLinux already has an rtorrent-extended package, so you may want to look at that one (instead of my Debian package below). I might use Arch's patchset next time to generate [...]]]></description> <content:encoded><![CDATA[<p><img
src="http://bogdan.org.ua/wp-content/uploads/2011/03/shot.png" alt="rtorrent-eyecandy" title="rtorrent-eyecandy (from http://karabaja.pondi.hr/packages/rtorrent-mod/shot.png)" width="698" height="380" class="alignnone size-full wp-image-1533" /><br
/> rtorrent is an excellent ncurses <del
datetime="2011-03-31T21:25:09+00:00">r</del>torrent client.</p><p>There are a few highly-popular patches, which haven't yet made it into the Squeeze's rtorrent version 0.8.6.</p><p><strong>Note</strong>: ArchLinux already has an <a
href="http://aur.archlinux.org/packages.php?ID=33756">rtorrent-extended package</a>, so you may want to look at that one (instead of my Debian package below). I might use Arch's patchset next time to generate a truly extended rtorrent package.</p><p>I've incorporated 3 of such patches (<a
href="http://libtorrent.rakshasa.no/ticket/239">#239</a> ipfilter, <a
href="http://libtorrent.rakshasa.no/ticket/2064">#2064</a> GeoIP support, and <a
href="http://libtorrent.rakshasa.no/ticket/2171">#2171</a> colours/eyecandy), and built a <a
href="/wp-content/uploads/2011/04/rtorrent_0.8.6-1_amd64.deb">squeeze amd64 rtorrent-enhanced package</a>.</p><p><img
src="http://bogdan.org.ua/wp-content/uploads/2011/04/rtorrent-features.png" alt="" title="rtorrent-features" width="675" height="107" class="alignnone size-full wp-image-1537" /></p><p>A few excerpts to explain how these extra features are to be configured and used (all come from the above-mentioned trac tickets, some were edited/extended).</p><p><strong>ipfilter</strong></p><blockquote><p>ipfilter allows to selectively blacklist/whitelist peers - based on IP address range files (so-called ipfilter files). The ipfilter files may, for example, come from bluetack.co.uk. Each line of the file contains a record in this format: <strong>range_description:start_IP-end_IP</strong>, where <em>start_IP</em> should be less than or equal to <em>end_IP</em>. Multiple files can be used. Overlapping ranges are merged automatically. Both incoming and outgoing connections are checked against the filter. Exclusions are not supported, so connection to/from IPs in all the loaded ranges will be disallowed and dropped.</p></blockquote><blockquote><p>Include "ip_filter=<file,...>" directive in .rtorrent.rc. For example (paths are specified relative to user's home directory):<br
/> <strong>ip_filter=ipfilter/level1,ipfilter/level2</strong></p></blockquote><blockquote><p>It is probably a good idea to reload ipfilter files once in a while, so you can also include "reload_ip_filter" directive on schedule to refresh the filter. The same files named in "ip_filter" will be reloaded.</p><p><strong>schedule = filter,18:30:00,24:00:00,reload_ip_filter=</strong></p></blockquote><blockquote><p>To support the feature you may want to setup cron job to reload and unzip files from bluetack. Examples <a
href="http://libtorrent.rakshasa.no/ticket/239#comment:26">here</a> and <a
href="http://pastebin.com/jLqT3qxL">here</a>.</p></blockquote><p><strong>GeoIP</strong></p><blockquote><p>In the Peers view of each torrent a new column - CC, country code - is added, which shows peer's country code. When examining each peer, you will see more data from the GeoIP database (if you have the relevant files installed): AS num and city. At the very least, you need to have <strong>geoip-database</strong> installed. You can get free "lite" versions of <a
href="http://www.maxmind.com/app/geolitecity">city</a>/<a
href="http://geolite.maxmind.com/download/geoip/database/asnum/">AS</a>-databases, rename them (removing "lite") and put into an appropriate location to make rtorrent+geoip use them as well. Geop-isp data support isn't integrated into this rtorrent package.</p></blockquote><p><strong>Colours</strong></p><blockquote><p>This patch somewhat changes the way rtorrent shows torrents. Seeding torrents have bold titles, there are no half-displayed torrents at the top/bottom when scrolling, and you can configure colours for active/done torrents (ticket libtorrent.rakshasa.no/ticket/1382, which seems to be gone now). Source code and testing hint at these configurable colours: <em>done_fg_color, done_bg_color, active_fg_color, active_bg_color</em>, and at these possible values: 1 (red), 2 (green), 3 (yellow).</p></blockquote><p><strong>Geek's cellar</strong><br
/> A related (though not used in any way for the preparation of the package) resource is <a
href="https://calomel.org/rtorrent_mods.html">rtorrent mods page</a>.</p><p>Relatively schematically, applying patches and building the package was performed in these steps (starting within some newly-created directory):</p><ol><li>sudo aptitude install cdbs devscripts [and whatever else you find you're missing]</li><li>apt-get source rtorrent</li><li>dpkg-source -x rtorrent_0.8.6-1.dsc</li><li>cd rtorrent-0.8.6</li><li>cdbs-edit-patch 01-ipfilter.patch</li><li>patch -p1 < /path/to/patch/239</li><li>exit 0</li><li>cdbs-edit-patch 02-geoip.patch</li><li>patch -p1 < /path/to/patch/2064-after-ipfilter</li><li>exit 0</li><li>cdbs-edit-patch 03-eyecandy.patch</li><li>patch -p1 < /path/to/patch/2171-mod-with-canvas</li><li>exit 0 [you could do all 3 patches together, but I prefer cleaner and manageable approaches]</li><li>[some weird operation to be explained below]</li><li>dpkg-buildpackage</li></ol><p>Weird operation: I didn't know how to make dpkg-buildpackage run autorun.sh (which is required for one of the patches I've used) before configure (could someone enlighten me how to do that?), so I started a new patch with cdbs-edit-patch, then ran one by one `autoreconf -if`, `./autorun.sh`, `./configure`, exited with zero status and was done with that problem. The resulting "patch" was 2MB large <img
src='http://bogdan.org.ua/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p><p><a
class="a2a_button_google_plusone addtoany_special_service" data-href="http://bogdan.org.ua/2011/04/01/rtorrent-enhanced-with-ipfilter-and-geoip-debian-squeeze-amd64-package.html"></a><a
class="a2a_button_facebook_like addtoany_special_service" data-href="http://bogdan.org.ua/2011/04/01/rtorrent-enhanced-with-ipfilter-and-geoip-debian-squeeze-amd64-package.html"></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbogdan.org.ua%2F2011%2F04%2F01%2Frtorrent-enhanced-with-ipfilter-and-geoip-debian-squeeze-amd64-package.html&amp;title=rtorrent-enhanced%20with%20ipfilter%20and%20GeoIP%3A%20Debian%20Squeeze%20amd64%20package" id="wpa2a_68"><img
src="http://bogdan.org.ua/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://bogdan.org.ua/2011/04/01/rtorrent-enhanced-with-ipfilter-and-geoip-debian-squeeze-amd64-package.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>How to truncate git history (sample script included)</title><link>http://bogdan.org.ua/2011/03/28/how-to-truncate-git-history-sample-script-included.html</link> <comments>http://bogdan.org.ua/2011/03/28/how-to-truncate-git-history-sample-script-included.html#comments</comments> <pubDate>Mon, 28 Mar 2011 18:17:21 +0000</pubDate> <dc:creator>Bogdan</dc:creator> <category><![CDATA[how-to]]></category> <category><![CDATA[Notepad]]></category> <category><![CDATA[git]]></category> <category><![CDATA[history]]></category> <category><![CDATA[truncate]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=1481</guid> <description><![CDATA[Under a few assumptions (most importantly - you do not have any non-merged branches,), it is very easy to throw away git repository commits older than an arbitrarily-chosen commit. Here's a sample script (call it e.g. git-truncate and put into your ~/bin or whichever location you have in PATH). PLAIN TEXT CODE: #!/bin/bash git checkout [...]]]></description> <content:encoded><![CDATA[<p>Under a few assumptions (most importantly - you do not have any non-merged branches,), it is very easy to throw away git repository commits older than an arbitrarily-chosen commit.</p><p>Here's a sample script (call it e.g. <strong>git-truncate</strong> and put into your ~/bin or whichever location you have in PATH).</p><div
class="igBar"><span
id="lcode-14"><a
href="#" onclick="javascript:showPlainTxt('code-14'); return false;">PLAIN TEXT</a></span></div><div
class="syntax_hilite"><span
class="langName">CODE:</span><div
id="code-14"><div
class="code"><ol><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#!/bin/bash</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">git checkout --orphan temp $<span
style="color:#800000;color:#800000;">1</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">git commit -m <span
style="color:#CC0000;">"Truncated history"</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">git rebase --onto temp $<span
style="color:#800000;color:#800000;">1</span> master</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">git branch -D temp</div></li></ol></div></div></div><p></p><p>Invocation: cd to your repository, then <strong>git-truncate <em>refspec</em></strong>, where <em>refspec</em> is either a commit's SHA1 hash-id, or a tag.</p><p>Expected result: a git repository starting with "Truncated history" initial commit, and continuing to the tip of the branch you were on when calling the script.</p><p>If you truncate repositories often, then consider adding an optional 2nd argument (truncate-commit message) and also some safeguards against improper use - currently, even if refspec is wrong, the script will <strong>not</strong> abort after a failed checkout.</p><p>Thanks for posting any improvements you may have.</p><p>Source: <a
href="http://support.github.com/discussions/repos/5751-how-to-truncate-the-history-of-a-repository">Tekkub's post on github discussions</a>.<br
/> See also: <a
href="http://bogdan.org.ua/2009/02/13/git-how-to-remove-file-commit-from-history.html">how to remove a single file from all of git's commits</a>.</p><p><a
class="a2a_button_google_plusone addtoany_special_service" data-href="http://bogdan.org.ua/2011/03/28/how-to-truncate-git-history-sample-script-included.html"></a><a
class="a2a_button_facebook_like addtoany_special_service" data-href="http://bogdan.org.ua/2011/03/28/how-to-truncate-git-history-sample-script-included.html"></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbogdan.org.ua%2F2011%2F03%2F28%2Fhow-to-truncate-git-history-sample-script-included.html&amp;title=How%20to%20truncate%20git%20history%20%28sample%20script%20included%29" id="wpa2a_72"><img
src="http://bogdan.org.ua/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://bogdan.org.ua/2011/03/28/how-to-truncate-git-history-sample-script-included.html/feed</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>How to fix: Nokia Ovi Suite could not connect to the Nokia account server</title><link>http://bogdan.org.ua/2011/03/10/how-to-fix-nokia-ovi-suite-could-not-connect-nokia-account-server.html</link> <comments>http://bogdan.org.ua/2011/03/10/how-to-fix-nokia-ovi-suite-could-not-connect-nokia-account-server.html#comments</comments> <pubDate>Thu, 10 Mar 2011 19:18:05 +0000</pubDate> <dc:creator>Bogdan</dc:creator> <category><![CDATA[how-to]]></category> <category><![CDATA[Misc]]></category> <category><![CDATA[account]]></category> <category><![CDATA[nokia]]></category> <category><![CDATA[ovi]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=1470</guid> <description><![CDATA[I've been getting this message for a long while, when trying to log into Ovi from within my Ovi Suite: Nokia Ovi Suite could not connect to the Nokia account server. Make sure the internet connection is working properly and try again. However, both my internet connection, and logging into ovi.com using a browser work [...]]]></description> <content:encoded><![CDATA[<p>I've been getting this message for a long while, when trying to log into Ovi from within my Ovi Suite:</p><blockquote><p>Nokia Ovi Suite could not connect to the Nokia account server. Make sure the internet connection is working properly and try again.</p></blockquote><p>However, both my internet connection, and logging into ovi.com using a browser work fine. Even looking for updates from within Ovi Suite works fine!</p><p>Here's the solution (tested on Nokia Ovi Suite 3.0.0.290):<br
/> <span
id="more-1470"></span></p><p><strong>Important</strong>: before trying the solution below, try downloading and running <a
href="http://www.download.windowsupdate.com/msdownload/update/v3/static/trustedr/en/rootsupd.exe">root certificates update program from Microsoft</a>, then restarting Ovi Suite to see if the problem is gone. (Thanks <a
href="http://bogdan.org.ua/2011/03/10/how-to-fix-nokia-ovi-suite-could-not-connect-nokia-account-server.html#comment-134937">Finn</a> for sharing this one.)</p><ul><li>Navigate to <em>Start - Control panel - Internet options</em> (or: start Internet Explorer - <em>Tools - Internet options</em>). It doesn't matter that your default browser is not IE.</li><li>Select <em>Content</em> tab.<br
/> <img
src="http://bogdan.org.ua/wp-content/uploads/2011/03/content-tab.png" alt="" title="Content tab" width="413" height="528" class="size-full wp-image-1471" /></li><li>Click <em>Certificates</em>, select <em>Trusted root certification authorities</em> tab, and sort ascending by expiration date.<br
/> <img
src="http://bogdan.org.ua/wp-content/uploads/2011/03/root-certificates.png" alt="" title="root certificates" width="509" height="464" class="size-full wp-image-1472" /></li><li>Now delete all <em>GTE CyberTrust</em> certificates whose expiration date has passed.</li><li>Click <em>Close</em>, then <em>OK</em></li><li>Restart Ovi suite.</li></ul><p>If that didn't help: try removing <strong>all</strong> expired certificates:<br
/> <img
src="http://bogdan.org.ua/wp-content/uploads/2011/03/all-expired.png" alt="" title="all expired" width="509" height="464" class="size-full wp-image-1473" /></p><p><strong>A word of warning</strong></p><blockquote><p>Deleting all expired trusted root certs is not a good idea. You could end up with vital parts of the system not working, or unable to access some documents (especially if you have encryption turned on). Thing is, expired certs can still be valid for anything signed or encrypted before they expired.</p></blockquote><p>Sources used:</p><ul><li><a
href="http://discussions.europe.nokia.com/t5/Nokia-Ovi-Suite/NOKIA-OVI-Suite-could-not-connect-to-the-nokia-account-server/m-p/878427#M8356">http://discussions.europe.nokia.com/t5/Nokia-Ovi-Suite/NOKIA-OVI-Suite-could-not-connect-to-the-nokia-account-server/m-p/878427</a></li><li><a
href="http://betalabs.nokia.com/apps/nokia-ovi-suite-3-0-beta/bugreport/19143/ovi-sign-in-failed#comment-53041">http://betalabs.nokia.com/apps/nokia-ovi-suite-3-0-beta/bugreport/19143/ovi-sign-in-failed</a></li><li><a
href="http://betalabs.nokia.com/node/5251">http://betalabs.nokia.com/node/5251</a></li></ul><p><a
class="a2a_button_google_plusone addtoany_special_service" data-href="http://bogdan.org.ua/2011/03/10/how-to-fix-nokia-ovi-suite-could-not-connect-nokia-account-server.html"></a><a
class="a2a_button_facebook_like addtoany_special_service" data-href="http://bogdan.org.ua/2011/03/10/how-to-fix-nokia-ovi-suite-could-not-connect-nokia-account-server.html"></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbogdan.org.ua%2F2011%2F03%2F10%2Fhow-to-fix-nokia-ovi-suite-could-not-connect-nokia-account-server.html&amp;title=How%20to%20fix%3A%20Nokia%20Ovi%20Suite%20could%20not%20connect%20to%20the%20Nokia%20account%20server" id="wpa2a_76"><img
src="http://bogdan.org.ua/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://bogdan.org.ua/2011/03/10/how-to-fix-nokia-ovi-suite-could-not-connect-nokia-account-server.html/feed</wfw:commentRss> <slash:comments>18</slash:comments> </item> <item><title>Amazonia! 6462 human microarray datasets</title><link>http://bogdan.org.ua/2011/03/06/amazonia-6462-human-microarray-datasets.html</link> <comments>http://bogdan.org.ua/2011/03/06/amazonia-6462-human-microarray-datasets.html#comments</comments> <pubDate>Sun, 06 Mar 2011 19:18:51 +0000</pubDate> <dc:creator>Bogdan</dc:creator> <category><![CDATA[Bioinformatics]]></category> <category><![CDATA[Links]]></category> <category><![CDATA[Science]]></category> <category><![CDATA[amazonia]]></category> <category><![CDATA[data]]></category> <category><![CDATA[expression]]></category> <category><![CDATA[microarray]]></category> <category><![CDATA[stem cells]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=1460</guid> <description><![CDATA[Amazonia! - explore the jungle of microarray results Paradoxically, the tremendous downpour of microarray results prevents a simple use of expression data. Therefore, we propose a thematic entry to public transcriptomes: you may for instance query a gene on a "Stem Cells page", where you will see the expression of your favorite gene across selected [...]]]></description> <content:encoded><![CDATA[<p><a
href="http://amazonia.transcriptome.eu/"><img
src="http://bogdan.org.ua/wp-content/uploads/2011/03/AmaZoniaLogo.png" alt="Amazonia!" title="Amazonia!" width="357" height="100" class="alignleft size-full wp-image-1463" /></a><a
href="http://amazonia.transcriptome.eu/">Amazonia! - explore the jungle of microarray results</a></p><blockquote><p>Paradoxically, the tremendous downpour of microarray results prevents a simple use of expression data. Therefore, we propose a thematic entry to public transcriptomes: you may for instance query a gene on a "Stem Cells page", where you will see the expression of your favorite gene across selected microarray experiments related to stem cell biology. This selection of samples can be customized at will among the 6462 samples currently present in the database.</p></blockquote><blockquote><p>Every transcriptome study results in the identification of lists of genes relevant to a given biological condition. In order to include this valuable information in any new query in the Amazonia! database, we indicate for each gene in which lists it is included. This is a straightforward and efficient way to synthesize hundreds of microarray publications.</p><p>A special feature of Amazonia! is the field of human stem cells, notably embryonic stem cells.</p></blockquote><p><a
class="a2a_button_google_plusone addtoany_special_service" data-href="http://bogdan.org.ua/2011/03/06/amazonia-6462-human-microarray-datasets.html"></a><a
class="a2a_button_facebook_like addtoany_special_service" data-href="http://bogdan.org.ua/2011/03/06/amazonia-6462-human-microarray-datasets.html"></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbogdan.org.ua%2F2011%2F03%2F06%2Famazonia-6462-human-microarray-datasets.html&amp;title=Amazonia%21%206462%20human%20microarray%20datasets" id="wpa2a_80"><img
src="http://bogdan.org.ua/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://bogdan.org.ua/2011/03/06/amazonia-6462-human-microarray-datasets.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> </channel> </rss>
