<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4859738021814147401</id><updated>2024-03-21T07:46:51.416-04:00</updated><category term="cpp"/><category term="ruby"/><category term="ubuntu"/><category term="java"/><category term="cygwin"/><category term="mysql"/><category term="encoding"/><category term="latex"/><category term="linux-dev"/><category term="mingw"/><category term="synthetic data generation"/><category term="activerecord"/><category term="blogger"/><category term="chart"/><category term="eclipse"/><category term="gnuplot"/><category term="mac"/><category term="meta data"/><category term="msys"/><category term="opensource"/><category term="persistent"/><category term="sublime2"/><category term="browser"/><category term="cluster"/><category term="compiler"/><category term="configuration"/><category term="daily life"/><category term="data mining"/><category term="data preprocess"/><category term="database"/><category term="db-extension"/><category term="debug"/><category term="er-diagram"/><category term="git"/><category term="github"/><category term="graph_algorithm"/><category term="gui"/><category term="hadoop"/><category term="javacc"/><category term="javassist"/><category term="knowledge base"/><category term="library"/><category term="markdown"/><category term="memory"/><category term="ml"/><category term="mpi"/><category term="octave"/><category term="poster"/><category term="postgresql"/><category term="query optimization"/><category term="rails"/><category term="regexp"/><category term="ria"/><category term="specification"/><category term="sql"/><category term="sqlite"/><category term="standard"/><category term="swig"/><category term="time series"/><category term="tomcat"/><category term="tool"/><category term="virtualbox"/><category term="web"/><category term="web-extraction"/><category term="xml"/><category term="yarn"/><title type='text'>Swimming in bits</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://swimminginbits.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4859738021814147401/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://swimminginbits.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/4859738021814147401/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>imoldcat</name><uri>http://www.blogger.com/profile/01007573997438480107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>71</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4859738021814147401.post-8211720245921797247</id><published>2015-12-22T15:29:00.002-05:00</published><updated>2015-12-22T15:30:36.088-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="configuration"/><category scheme="http://www.blogger.com/atom/ns#" term="memory"/><category scheme="http://www.blogger.com/atom/ns#" term="ruby"/><category scheme="http://www.blogger.com/atom/ns#" term="sqlite"/><title type='text'>Ruby SQLite3 memory tuning</title><content type='html'>&lt;h4&gt;
0. Motivation&lt;/h4&gt;
SQLite database is designed as an embedded db, the default settings of memory footprint, page size are biased to workload with moderate data sizes. In a recent project, &amp;nbsp;I used sqlite to implement some path generators on a graph dataset, in order to scale the program without worrying about out of memory issues, e.g. 3-hop paths in a 100K graph would go beyond 20G easily,&amp;nbsp;external memory algorithms need to be implemented, writing a SQL and writing my own c code basically will have similar performance. However, both ruby and sqlite are not supposed to do this type of work under the default settings. The post contains some settings one needs to do in order to have better performance.&lt;br /&gt;
&lt;h4&gt;
1. Ruby&lt;/h4&gt;
One should set the GC using the following VARs. (ruby 1.9+, 2.0)&lt;br /&gt;
&lt;br /&gt;
export RUBY_HEAP_MIN_SLOTS=8000000&lt;br /&gt;
export RUBY_FREE_MIN=327680&lt;br /&gt;
export RUBY_GC_MALLOC_LIMIT=512000000&lt;br /&gt;
&lt;br /&gt;
On details of Ruby GC, and the effect of these environment vars, see this page:&lt;br /&gt;
&lt;a href=&quot;http://tmm1.net/ruby21-rgengc/&quot;&gt;http://tmm1.net/ruby21-rgengc/&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Other useful links&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;reference setting in real world rails apps:&amp;nbsp;&lt;a href=&quot;https://gist.github.com/jjb/7389552&quot;&gt;https://gist.github.com/jjb/7389552&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;h4&gt;
2. SQLite&lt;/h4&gt;
to use more memory and avoid hitting disk, one should set the following PRAGMA&lt;br /&gt;
cache_size: basically the number of b-tree pages can be held in memory.&lt;br /&gt;
temp_store: temporary results in memory db or in file&lt;br /&gt;
&lt;br /&gt;
this post is nice in this topic:&lt;br /&gt;
&lt;a href=&quot;http://www.codificar.com.br/blog/sqlite-optimization-faq/&quot;&gt;http://www.codificar.com.br/blog/sqlite-optimization-faq/&lt;/a&gt;&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
My app is read-only on IDBs, so the synchronous PRAGMA is not useful. But even for R/W applications, be careful to set it.&lt;br /&gt;
&lt;br /&gt;
In Ruby SQLite3 binding, the PRAGMAs are included in the Database class.&lt;br /&gt;
After getting the db instance, one can just set:&lt;br /&gt;
&lt;br /&gt;
db.cache_size = 512000 &amp;nbsp; # 500M&lt;br /&gt;
db.temp_store = 2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;# memory&lt;br /&gt;
&lt;br /&gt;
Other useful links on this topic:&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;ruby sqlite3 doc:&amp;nbsp;&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.rubydoc.info/github/luislavena/sqlite3-ruby/SQLite3/Pragmas&quot;&gt;http://www.rubydoc.info/github/luislavena/sqlite3-ruby/SQLite3/Pragmas&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.rubydoc.info/github/luislavena/sqlite3-ruby/SQLite3/Database&quot;&gt;http://www.rubydoc.info/github/luislavena/sqlite3-ruby/SQLite3/Database&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;sqlite3 pragma doc:&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.sqlite.org/pragma.html&quot;&gt;https://www.sqlite.org/pragma.html&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://swimminginbits.blogspot.com/feeds/8211720245921797247/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4859738021814147401/8211720245921797247' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4859738021814147401/posts/default/8211720245921797247'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4859738021814147401/posts/default/8211720245921797247'/><link rel='alternate' type='text/html' href='http://swimminginbits.blogspot.com/2015/12/ruby-sqlite3-memory-tuning.html' title='Ruby SQLite3 memory tuning'/><author><name>imoldcat</name><uri>http://www.blogger.com/profile/01007573997438480107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4859738021814147401.post-7712355718678885530</id><published>2014-04-07T21:00:00.000-04:00</published><updated>2014-04-07T21:00:19.872-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="cpp"/><category scheme="http://www.blogger.com/atom/ns#" term="synthetic data generation"/><title type='text'>Generate zipf distribution in C++</title><content type='html'>Standard library &lt;random&gt; and Gnu scientific library GSL, do not provide a way to get the probability mass function of the zipf distribution directly. By looking around from wiki and stackoverflow &lt;a href=&quot;http://stackoverflow.com/questions/1366984/generate-random-numbers-distributed-by-zipf&quot;&gt;post&lt;/a&gt;, implemented a couple lines of code for zipf pmf:&lt;/random&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;line-pre&quot; style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; line-height: 16.799999237060547px; padding: 0px; width: 744px;&quot;&gt;&lt;div class=&quot;line&quot; id=&quot;file-zipf-cpp-LC2&quot; style=&quot;box-sizing: border-box;&quot;&gt;
&lt;span class=&quot;cp&quot; style=&quot;box-sizing: border-box; color: #999999; font-weight: bold;&quot;&gt;#include &lt;gsl gsl_sf_zeta.h=&quot;&quot;&gt;&lt;/gsl&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-zipf-cpp-LC3&quot; style=&quot;box-sizing: border-box;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-zipf-cpp-LC4&quot; style=&quot;box-sizing: border-box;&quot;&gt;
&lt;span class=&quot;c1&quot; style=&quot;box-sizing: border-box; color: #999988; font-style: italic;&quot;&gt;// when one doesn&#39;t know the population size&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-zipf-cpp-LC5&quot; style=&quot;box-sizing: border-box;&quot;&gt;
&lt;span class=&quot;c1&quot; style=&quot;box-sizing: border-box; color: #999988; font-style: italic;&quot;&gt;// assume the population is infinity&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-zipf-cpp-LC6&quot; style=&quot;box-sizing: border-box;&quot;&gt;
&lt;span class=&quot;c1&quot; style=&quot;box-sizing: border-box; color: #999988; font-style: italic;&quot;&gt;// then the generalized harmonic number&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-zipf-cpp-LC7&quot; style=&quot;box-sizing: border-box;&quot;&gt;
&lt;span class=&quot;c1&quot; style=&quot;box-sizing: border-box; color: #999988; font-style: italic;&quot;&gt;// can be approximated as zeta function&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-zipf-cpp-LC8&quot; style=&quot;box-sizing: border-box;&quot;&gt;
&lt;span class=&quot;kt&quot; style=&quot;box-sizing: border-box; color: #445588; font-weight: bold;&quot;&gt;double&lt;/span&gt; &lt;span class=&quot;nf&quot; style=&quot;box-sizing: border-box; color: #990000; font-weight: bold;&quot;&gt;get_pmf_zipf&lt;/span&gt;&lt;span class=&quot;p&quot; style=&quot;box-sizing: border-box;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot; style=&quot;box-sizing: border-box; color: #445588; font-weight: bold;&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot; style=&quot;box-sizing: border-box;&quot;&gt;rank&lt;/span&gt;&lt;span class=&quot;p&quot; style=&quot;box-sizing: border-box;&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot; style=&quot;box-sizing: border-box; color: #445588; font-weight: bold;&quot;&gt;double&lt;/span&gt; &lt;span class=&quot;n&quot; style=&quot;box-sizing: border-box;&quot;&gt;skew&lt;/span&gt;&lt;span class=&quot;p&quot; style=&quot;box-sizing: border-box;&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot; style=&quot;box-sizing: border-box;&quot;&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-zipf-cpp-LC9&quot; style=&quot;box-sizing: border-box;&quot;&gt;
 &lt;span class=&quot;c1&quot; style=&quot;box-sizing: border-box; color: #999988; font-style: italic;&quot;&gt;// use zeta function, one can approximate the zipf pmf&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-zipf-cpp-LC10&quot; style=&quot;box-sizing: border-box;&quot;&gt;
 &lt;span class=&quot;k&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot; style=&quot;box-sizing: border-box;&quot;&gt;pow&lt;/span&gt;&lt;span class=&quot;p&quot; style=&quot;box-sizing: border-box;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot; style=&quot;box-sizing: border-box;&quot;&gt;rank&lt;/span&gt;&lt;span class=&quot;p&quot; style=&quot;box-sizing: border-box;&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot; style=&quot;box-sizing: border-box; color: #009999;&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot; style=&quot;box-sizing: border-box;&quot;&gt;skew&lt;/span&gt;&lt;span class=&quot;p&quot; style=&quot;box-sizing: border-box;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot; style=&quot;box-sizing: border-box;&quot;&gt;gsl_sf_zeta&lt;/span&gt;&lt;span class=&quot;p&quot; style=&quot;box-sizing: border-box;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot; style=&quot;box-sizing: border-box;&quot;&gt;skew&lt;/span&gt;&lt;span class=&quot;p&quot; style=&quot;box-sizing: border-box;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-zipf-cpp-LC11&quot; style=&quot;box-sizing: border-box;&quot;&gt;
&lt;span class=&quot;p&quot; style=&quot;box-sizing: border-box;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-zipf-cpp-LC12&quot; style=&quot;box-sizing: border-box;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-zipf-cpp-LC13&quot; style=&quot;box-sizing: border-box;&quot;&gt;
&lt;span class=&quot;c1&quot; style=&quot;box-sizing: border-box; color: #999988; font-style: italic;&quot;&gt;// when one knows the population&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-zipf-cpp-LC14&quot; style=&quot;box-sizing: border-box;&quot;&gt;
&lt;span class=&quot;c1&quot; style=&quot;box-sizing: border-box; color: #999988; font-style: italic;&quot;&gt;// we can calculate the generalized harmonic number&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-zipf-cpp-LC15&quot; style=&quot;box-sizing: border-box;&quot;&gt;
&lt;span class=&quot;kt&quot; style=&quot;box-sizing: border-box; color: #445588; font-weight: bold;&quot;&gt;double&lt;/span&gt; &lt;span class=&quot;nf&quot; style=&quot;box-sizing: border-box; color: #990000; font-weight: bold;&quot;&gt;get_pmf_zipf&lt;/span&gt;&lt;span class=&quot;p&quot; style=&quot;box-sizing: border-box;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot; style=&quot;box-sizing: border-box; color: #445588; font-weight: bold;&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot; style=&quot;box-sizing: border-box;&quot;&gt;rank&lt;/span&gt;&lt;span class=&quot;p&quot; style=&quot;box-sizing: border-box;&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot; style=&quot;box-sizing: border-box; color: #445588; font-weight: bold;&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot; style=&quot;box-sizing: border-box;&quot;&gt;N&lt;/span&gt;&lt;span class=&quot;p&quot; style=&quot;box-sizing: border-box;&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot; style=&quot;box-sizing: border-box; color: #445588; font-weight: bold;&quot;&gt;double&lt;/span&gt; &lt;span class=&quot;n&quot; style=&quot;box-sizing: border-box;&quot;&gt;skew&lt;/span&gt;&lt;span class=&quot;p&quot; style=&quot;box-sizing: border-box;&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot; style=&quot;box-sizing: border-box;&quot;&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-zipf-cpp-LC16&quot; style=&quot;box-sizing: border-box;&quot;&gt;
 &lt;span class=&quot;kt&quot; style=&quot;box-sizing: border-box; color: #445588; font-weight: bold;&quot;&gt;double&lt;/span&gt; &lt;span class=&quot;n&quot; style=&quot;box-sizing: border-box;&quot;&gt;base&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot; style=&quot;box-sizing: border-box; color: #009999;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot; style=&quot;box-sizing: border-box;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-zipf-cpp-LC17&quot; style=&quot;box-sizing: border-box;&quot;&gt;
 &lt;span class=&quot;k&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;p&quot; style=&quot;box-sizing: border-box;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot; style=&quot;box-sizing: border-box; color: #445588; font-weight: bold;&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot; style=&quot;box-sizing: border-box;&quot;&gt;k&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot; style=&quot;box-sizing: border-box; color: #009999;&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot; style=&quot;box-sizing: border-box;&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot; style=&quot;box-sizing: border-box;&quot;&gt;k&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;&amp;lt;=&lt;/span&gt; &lt;span class=&quot;n&quot; style=&quot;box-sizing: border-box;&quot;&gt;N&lt;/span&gt;&lt;span class=&quot;p&quot; style=&quot;box-sizing: border-box;&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot; style=&quot;box-sizing: border-box;&quot;&gt;k&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;p&quot; style=&quot;box-sizing: border-box;&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;n&quot; style=&quot;box-sizing: border-box;&quot;&gt;base&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;n&quot; style=&quot;box-sizing: border-box;&quot;&gt;pow&lt;/span&gt;&lt;span class=&quot;p&quot; style=&quot;box-sizing: border-box;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot; style=&quot;box-sizing: border-box;&quot;&gt;k&lt;/span&gt;&lt;span class=&quot;p&quot; style=&quot;box-sizing: border-box;&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot; style=&quot;box-sizing: border-box; color: #009999;&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot; style=&quot;box-sizing: border-box;&quot;&gt;skew&lt;/span&gt;&lt;span class=&quot;p&quot; style=&quot;box-sizing: border-box;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-zipf-cpp-LC18&quot; style=&quot;box-sizing: border-box;&quot;&gt;
 &lt;span class=&quot;k&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot; style=&quot;box-sizing: border-box;&quot;&gt;pow&lt;/span&gt;&lt;span class=&quot;p&quot; style=&quot;box-sizing: border-box;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot; style=&quot;box-sizing: border-box;&quot;&gt;rank&lt;/span&gt;&lt;span class=&quot;p&quot; style=&quot;box-sizing: border-box;&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot; style=&quot;box-sizing: border-box; color: #009999;&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot; style=&quot;box-sizing: border-box;&quot;&gt;skew&lt;/span&gt;&lt;span class=&quot;p&quot; style=&quot;box-sizing: border-box;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;box-sizing: border-box; font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot; style=&quot;box-sizing: border-box;&quot;&gt;base&lt;/span&gt;&lt;span class=&quot;p&quot; style=&quot;box-sizing: border-box;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-zipf-cpp-LC19&quot; style=&quot;box-sizing: border-box;&quot;&gt;
&lt;span class=&quot;p&quot; style=&quot;box-sizing: border-box;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://swimminginbits.blogspot.com/feeds/7712355718678885530/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4859738021814147401/7712355718678885530' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4859738021814147401/posts/default/7712355718678885530'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4859738021814147401/posts/default/7712355718678885530'/><link rel='alternate' type='text/html' href='http://swimminginbits.blogspot.com/2014/04/generate-zipf-distribution-in-c.html' title='Generate zipf distribution in C++'/><author><name>imoldcat</name><uri>http://www.blogger.com/profile/01007573997438480107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4859738021814147401.post-6835896317327981557</id><published>2013-10-02T17:34:00.005-04:00</published><updated>2013-10-02T17:34:50.862-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="latex"/><title type='text'>bold math formula in latex</title><content type='html'>make it bold:&lt;br /&gt;
&lt;br /&gt;
from this url:&amp;nbsp;&lt;a href=&quot;http://tex.stackexchange.com/questions/25428/how-to-bold-math-mode-characters&quot;&gt;http://tex.stackexchange.com/questions/25428/how-to-bold-math-mode-characters&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: rgba(255, 255, 255, 0.529412); border: 0px; clear: both; color: #393318; font-family: &#39;Lucida Grande&#39;, &#39;Lucida Sans Unicode&#39;, &#39;Lucida Sans&#39;, Tahoma, sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 1em; padding: 0px; vertical-align: baseline; word-wrap: break-word;&quot;&gt;
Try the&amp;nbsp;&lt;a href=&quot;http://ctan.org/pkg/bm&quot; rel=&quot;nofollow&quot; style=&quot;border: 0px; color: #3989bb; cursor: pointer; margin: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot;&gt;bm&lt;/a&gt;&amp;nbsp;package:&lt;/div&gt;
&lt;pre class=&quot;lang-tex prettyprint prettyprinted&quot; style=&quot;background-color: #eeeeee; border: 0px; color: #393318; font-family: Consolas, Menlo, Monaco, &#39;Lucida Console&#39;, &#39;Liberation Mono&#39;, &#39;DejaVu Sans Mono&#39;, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, monospace, serif; font-size: 12px; line-height: 18px; margin-bottom: 10px; max-height: 600px; overflow: auto; padding: 5px; vertical-align: baseline; width: auto;&quot;&gt;&lt;code style=&quot;border: 0px; color: #222222; font-family: Consolas, Menlo, Monaco, &#39;Lucida Console&#39;, &#39;Liberation Mono&#39;, &#39;DejaVu Sans Mono&#39;, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, monospace, serif; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span class=&quot;kwd&quot; style=&quot;border: 0px; color: #8a4a0b; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;\documentclass&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; color: #145680; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; color: black; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;article&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; color: #145680; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; color: black; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;border: 0px; color: #8a4a0b; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;\usepackage&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; color: #145680; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; color: black; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;bm&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; color: #145680; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; color: black; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;border: 0px; color: #8a4a0b; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;\begin&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; color: #145680; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; color: black; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; color: #145680; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; color: black; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;border: 0px; color: #2b91af; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;border: 0px; color: #8a4a0b; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;\bm&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; color: #145680; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;border: 0px; color: #8a4a0b; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;\langle&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; color: black; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;border: 0px; color: #8a4a0b; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;\rangle&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; color: #145680; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;border: 0px; color: #2b91af; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; color: black; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;border: 0px; color: #8a4a0b; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;\end&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; color: #145680; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; color: black; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; color: #145680; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://swimminginbits.blogspot.com/feeds/6835896317327981557/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4859738021814147401/6835896317327981557' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4859738021814147401/posts/default/6835896317327981557'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4859738021814147401/posts/default/6835896317327981557'/><link rel='alternate' type='text/html' href='http://swimminginbits.blogspot.com/2013/10/bold-math-formula-in-latex.html' title='bold math formula in latex'/><author><name>imoldcat</name><uri>http://www.blogger.com/profile/01007573997438480107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4859738021814147401.post-5793650802433523210</id><published>2013-06-19T19:18:00.001-04:00</published><updated>2013-06-19T19:18:04.626-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="gnuplot"/><category scheme="http://www.blogger.com/atom/ns#" term="latex"/><title type='text'>remove margins of gnuplot, subfigures in latex</title><content type='html'>remove margin of gnuplot generated eps is useful when one wants to squeeze more figures in a subfigure block.&lt;br /&gt;
&lt;br /&gt;
here&#39;s how to do it:&lt;br /&gt;
&lt;br /&gt;
1. plot the eps using gnuplot, say x.eps&lt;br /&gt;
&lt;br /&gt;
2. use &lt;b&gt;eps2eps&lt;/b&gt;&amp;nbsp;: &amp;nbsp; &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;eps2eps x.eps x_compact.eps&lt;/span&gt;&lt;br /&gt;
see more here:&amp;nbsp;&lt;a href=&quot;http://webthreeoh.wordpress.com/2013/02/24/removing-margins-in-gnuplot/&quot;&gt;http://webthreeoh.wordpress.com/2013/02/24/removing-margins-in-gnuplot/&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
3. the quality of eps2eps may be not ideal because of the compression, to control it:&lt;br /&gt;
try: &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;eps2eps -r600 -dEPSCrop x.eps x_compact.eps&lt;/span&gt;&lt;br /&gt;
see more here:&amp;nbsp;&lt;a href=&quot;http://electron.mit.edu/~gsteele/pdf/&quot;&gt;http://electron.mit.edu/~gsteele/pdf/&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
4. you may want to automate it, in a gnuplot script, you can call system function as well,&lt;br /&gt;
try include this at the end of gnuplot script:&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;`eps2eps -r600 -dEPSCrop x.eps x_compact.eps`&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Times, &#39;Times New Roman&#39;, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Times, &#39;Times New Roman&#39;, serif;&quot;&gt;see more here:&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;http://stackoverflow.com/questions/12846717/using-awk-or-other-shell-command-inside-gnuplot-function&quot; style=&quot;font-family: Times, &#39;Times New Roman&#39;, serif;&quot;&gt;http://stackoverflow.com/questions/12846717/using-awk-or-other-shell-command-inside-gnuplot-function&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
5. finally use a subfigure, you may want to squeeze space:&lt;br /&gt;
try:&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;\begin{figure}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;\vspace{-15pt}&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;\subfigure[fig1]{&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;\includegraphics[totalheight=0.13\textheight]{fig1.eps}&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;\label{fig:label1}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;\subfigure[fig2]{&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;\includegraphics[totalheight=0.13 \textheight]{fig2.eps}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;\label{fig:label1}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;\label{fig:subfig1}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;\caption{Title here}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;\vspace{-15pt}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;\end{figure}&lt;/span&gt;&lt;br /&gt;
see more from subfigure package document.&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://swimminginbits.blogspot.com/feeds/5793650802433523210/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4859738021814147401/5793650802433523210' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4859738021814147401/posts/default/5793650802433523210'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4859738021814147401/posts/default/5793650802433523210'/><link rel='alternate' type='text/html' href='http://swimminginbits.blogspot.com/2013/06/remove-margins-of-gnuplot-subfigures-in.html' title='remove margins of gnuplot, subfigures in latex'/><author><name>imoldcat</name><uri>http://www.blogger.com/profile/01007573997438480107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4859738021814147401.post-5034459548996769788</id><published>2013-06-03T15:40:00.000-04:00</published><updated>2013-06-03T15:40:28.977-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="latex"/><category scheme="http://www.blogger.com/atom/ns#" term="poster"/><title type='text'>Links to make a conference poster, </title><content type='html'>Some useful links:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
using latex:&lt;br /&gt;
The LaTeX beamerposter package&lt;br /&gt;
&lt;a href=&quot;http://www-i6.informatik.rwth-aachen.de/~dreuw/latexbeamerposter.php&quot;&gt;http://www-i6.informatik.rwth-aachen.de/~dreuw/latexbeamerposter.php&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
using ppt:&lt;br /&gt;
&lt;a href=&quot;http://colinpurrington.com/tips/academic/posterdesign&quot;&gt;http://colinpurrington.com/tips/academic/posterdesign&lt;/a&gt;&lt;br /&gt;
&lt;br class=&quot;Apple-interchange-newline&quot; /&gt;
paper size:&lt;br /&gt;
&lt;a href=&quot;http://en.wikipedia.org/wiki/ISO_216&quot;&gt;http://en.wikipedia.org/wiki/ISO_216&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
some instructions:&lt;br /&gt;
&lt;a href=&quot;http://www.icde2011.org/node/103&quot;&gt;http://www.icde2011.org/node/103&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;trademarks:&lt;/span&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.trademarks.umd.edu/marks/inst.cfm&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;http://www.trademarks.umd.edu/marks/inst.cfm&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;linqs guides:&lt;/span&gt;&lt;br /&gt;
&lt;a href=&quot;https://wiki.umiacs.umd.edu/linqswiki/index.php/Research:poster:makeposter&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;https://wiki.umiacs.umd.edu/linqswiki/index.php/Research:poster:makeposter&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://swimminginbits.blogspot.com/feeds/5034459548996769788/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4859738021814147401/5034459548996769788' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4859738021814147401/posts/default/5034459548996769788'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4859738021814147401/posts/default/5034459548996769788'/><link rel='alternate' type='text/html' href='http://swimminginbits.blogspot.com/2013/06/links-to-make-conference-poster.html' title='Links to make a conference poster, '/><author><name>imoldcat</name><uri>http://www.blogger.com/profile/01007573997438480107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4859738021814147401.post-3988664239208855231</id><published>2013-04-21T21:46:00.002-04:00</published><updated>2013-04-21T21:46:51.089-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="er-diagram"/><category scheme="http://www.blogger.com/atom/ns#" term="mysql"/><category scheme="http://www.blogger.com/atom/ns#" term="tool"/><title type='text'>quite note: generate a er chart and schema with schemaSpy</title><content type='html'>working on some complicated legacy db recently. wants to generate the er diagram to get to know details.&lt;br /&gt;
&lt;br /&gt;
the mysql-workbench works very well, however it&#39;s slow in my setting. also the schema has little foreign key constrains as it is almost read-only db. the er reverse engineering feature in workbench is not that useful.&lt;br /&gt;
&lt;br /&gt;
did some google, found the tool: schemaspy, it&#39;s standalone jar and easy to use.&lt;br /&gt;
&lt;a href=&quot;http://schemaspy.sourceforge.net/&quot;&gt;http://schemaspy.sourceforge.net/&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
for mysql:&lt;br /&gt;
java -jar schemaSpy_5.0.0.jar -cp mysql-driver/mysql-connector-java-5.1.24-bin.jar -t mysql -host localhost -db dbname -u user -p pwd -o outputdir</content><link rel='replies' type='application/atom+xml' href='http://swimminginbits.blogspot.com/feeds/3988664239208855231/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4859738021814147401/3988664239208855231' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4859738021814147401/posts/default/3988664239208855231'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4859738021814147401/posts/default/3988664239208855231'/><link rel='alternate' type='text/html' href='http://swimminginbits.blogspot.com/2013/04/quite-note-generate-er-chart-and-schema.html' title='quite note: generate a er chart and schema with schemaSpy'/><author><name>imoldcat</name><uri>http://www.blogger.com/profile/01007573997438480107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4859738021814147401.post-2927370533918211817</id><published>2013-04-20T18:11:00.000-04:00</published><updated>2013-05-02T01:40:46.485-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="mpi"/><title type='text'>how to setup an mpi cluster (mpich2, and openmpi)</title><content type='html'>quick memo of some good posts:&lt;br /&gt;
&lt;br /&gt;
to set up the mpi cluster, follow these steps:&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;1.&lt;/b&gt; use keygen to configure the ssh environment in the cluster&lt;br /&gt;
&lt;a href=&quot;https://source.ggy.bris.ac.uk/wiki/Configure_ssh_for_MPI&quot;&gt;https://source.ggy.bris.ac.uk/wiki/Configure_ssh_for_MPI&lt;/a&gt;&lt;br /&gt;
if all machine shares the home directory, it will make life much easier.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;2.&lt;/b&gt; if one wants to use MPICH2, follow this link to compile and install&lt;br /&gt;
download, 1.4.1 should be fine:&amp;nbsp;&lt;a href=&quot;http://www.mpich.org/downloads/&quot;&gt;http://www.mpich.org/downloads/&lt;/a&gt;&lt;br /&gt;
(&lt;a href=&quot;http://www.mpich.org/static/tarballs/1.4.1/&quot;&gt;http://www.mpich.org/static/tarballs/1.4.1/&lt;/a&gt;)&lt;br /&gt;
&lt;a href=&quot;http://heather.cs.ucdavis.edu/~matloff/MPI/NotesMPICH.NM.html&quot;&gt;http://heather.cs.ucdavis.edu/~matloff/MPI/NotesMPICH.NM.html&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://source.ggy.bris.ac.uk/mediawiki/index.php?title=Install_and_configure_MPI&amp;amp;redirect=no&quot;&gt;http://source.ggy.bris.ac.uk/mediawiki/index.php?title=Install_and_configure_MPI&amp;amp;redirect=no&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;3.&lt;/b&gt; write a host file, and run it in the cluster with ease&lt;br /&gt;
(note, mpd is dropped, it uses hydra instead, which will be run using mpiexec)&lt;br /&gt;
for sophisticated host configuration, see this very nice post:&lt;br /&gt;
&lt;a href=&quot;http://wiki.mpich.org/mpich/index.php/Using_the_Hydra_Process_Manager&quot;&gt;http://wiki.mpich.org/mpich/index.php/Using_the_Hydra_Process_Manager&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;etc.&lt;/b&gt; if one don&#39;t have permissions to install things everywhere, but just local machine&lt;br /&gt;
try to install in local machine, and use .bash_profile / .bash_rc to compile mpi to one&#39;s shared directory. so remote machine can use with ease from shared directory without install it.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;etc. &lt;/b&gt;for debugging:&lt;br /&gt;
this one might be nice.&lt;br /&gt;
&lt;a href=&quot;http://heather.cs.ucdavis.edu/~matloff/pardebug.html&quot;&gt;http://heather.cs.ucdavis.edu/~matloff/pardebug.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For OpenMPI cluster, step 1,2 is the same, difference are:&lt;br /&gt;
&lt;b&gt;d1.&amp;nbsp;host file&lt;/b&gt;&lt;br /&gt;
hostfile format is different from mpich2:&lt;br /&gt;
instead of : machine_a:2&lt;br /&gt;
&lt;br /&gt;
it uses: machine_a slots=2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
here&#39;s some example&lt;br /&gt;
&lt;a href=&quot;https://wiki.thayer.dartmouth.edu/display/computing/Linux+MPI#LinuxMPI-HostFile&quot;&gt;https://wiki.thayer.dartmouth.edu/display/computing/Linux+MPI#LinuxMPI-HostFile&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;d2.&amp;nbsp;orted: command not found error&lt;/b&gt;&lt;br /&gt;
error message may occur if one try to run on remote machine&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;font-family: verdana, arial, helvetica; font-size: 12px;&quot;&gt;
sh: orted: command not found&lt;br /&gt;--------------------------------------------------------------------------&lt;br /&gt;A daemon (pid 6797) died unexpectedly with status 127 while attempting&lt;br /&gt;to launch so we are aborting.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: verdana, arial, helvetica; font-size: 12px;&quot;&gt;
There may be more information reported by the environment (see above).&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: verdana, arial, helvetica; font-size: 12px;&quot;&gt;
This may be because the daemon was unable to find all the needed shared&lt;br /&gt;libraries on the remote node. You may set your LD_LIBRARY_PATH to have the&lt;br /&gt;location of the shared libraries on the remote nodes and this will&lt;br /&gt;automatically be forwarded to the remote nodes.&lt;br /&gt;--------------------------------------------------------------------------&lt;br /&gt;--------------------------------------------------------------------------&lt;br /&gt;mpirun noticed that the job aborted, but has no info as to the process&lt;br /&gt;that caused that situation.&lt;br /&gt;--------------------------------------------------------------------------&lt;br /&gt;mpirun: clean termination accomplished&lt;/div&gt;
&lt;div style=&quot;font-family: verdana, arial, helvetica; font-size: 12px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
to solve it,&lt;br /&gt;
-&amp;gt; make sure, MPI_HOME/bin is in PATH, MPI_HOME/lib is in LD_LIBRARY_PATH&lt;br /&gt;
&lt;br /&gt;
and, make sure when run the mpirun / mpiexec, using absolute path to run it:&lt;br /&gt;
/path/to/mpirun -np 2 ...&lt;br /&gt;
see a thread here: &lt;a href=&quot;http://www.open-mpi.org/community/lists/users/2009/08/10462.php&quot;&gt;link&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
</content><link rel='replies' type='application/atom+xml' href='http://swimminginbits.blogspot.com/feeds/2927370533918211817/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4859738021814147401/2927370533918211817' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4859738021814147401/posts/default/2927370533918211817'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4859738021814147401/posts/default/2927370533918211817'/><link rel='alternate' type='text/html' href='http://swimminginbits.blogspot.com/2013/04/how-to-setup-mpi-cluster.html' title='how to setup an mpi cluster (mpich2, and openmpi)'/><author><name>imoldcat</name><uri>http://www.blogger.com/profile/01007573997438480107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4859738021814147401.post-2265380707678512630</id><published>2013-04-17T00:48:00.003-04:00</published><updated>2013-04-20T22:22:12.849-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="gnuplot"/><category scheme="http://www.blogger.com/atom/ns#" term="time series"/><title type='text'>plotting time series using gnuplot</title><content type='html'>This post by Ron Peterson&amp;nbsp; is really good. Thanks for the great code!&lt;br /&gt;
&lt;a href=&quot;http://linuxgazette.net/126/peterson.html&quot;&gt;http://linuxgazette.net/126/peterson.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;Also It&#39;s worth pointing out the time format definition follows the following rules:&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;a href=&quot;http://gnuplot.sourceforge.net/docs_4.2/node274.html&quot;&gt;http://gnuplot.sourceforge.net/docs_4.2/node274.html&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: verdana, arial, helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;table border=&quot;1&quot; cellpadding=&quot;3&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td align=&quot;CENTER&quot; colspan=&quot;2&quot;&gt;Time Series timedata Format Specifiers&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td align=&quot;CENTER&quot;&gt;Format&lt;/td&gt;&lt;td align=&quot;LEFT&quot;&gt;Explanation&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td align=&quot;CENTER&quot;&gt;&lt;code&gt;%d&lt;/code&gt;&lt;/td&gt;&lt;td align=&quot;LEFT&quot;&gt;day of the month, 1-31&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td align=&quot;CENTER&quot;&gt;&lt;code&gt;%m&lt;/code&gt;&lt;/td&gt;&lt;td align=&quot;LEFT&quot;&gt;month of the year, 1-12&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td align=&quot;CENTER&quot;&gt;&lt;code&gt;%y&lt;/code&gt;&lt;/td&gt;&lt;td align=&quot;LEFT&quot;&gt;year, 0-99&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td align=&quot;CENTER&quot;&gt;&lt;code&gt;%Y&lt;/code&gt;&lt;/td&gt;&lt;td align=&quot;LEFT&quot;&gt;year, 4-digit&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td align=&quot;CENTER&quot;&gt;&lt;code&gt;%j&lt;/code&gt;&lt;/td&gt;&lt;td align=&quot;LEFT&quot;&gt;day of the year, 1-365&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td align=&quot;CENTER&quot;&gt;&lt;code&gt;%H&lt;/code&gt;&lt;/td&gt;&lt;td align=&quot;LEFT&quot;&gt;hour, 0-24&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td align=&quot;CENTER&quot;&gt;&lt;code&gt;%M&lt;/code&gt;&lt;/td&gt;&lt;td align=&quot;LEFT&quot;&gt;minute, 0-60&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td align=&quot;CENTER&quot;&gt;&lt;code&gt;%s&lt;/code&gt;&lt;/td&gt;&lt;td align=&quot;LEFT&quot;&gt;seconds since the Unix epoch (1970-01-01 00:00 UTC)&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td align=&quot;CENTER&quot;&gt;&lt;code&gt;%S&lt;/code&gt;&lt;/td&gt;&lt;td align=&quot;LEFT&quot;&gt;second, 0-60&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td align=&quot;CENTER&quot;&gt;&lt;code&gt;%b&lt;/code&gt;&lt;/td&gt;&lt;td align=&quot;LEFT&quot;&gt;three-character abbreviation of the name of the month&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td align=&quot;CENTER&quot;&gt;&lt;code&gt;%B&lt;/code&gt;&lt;/td&gt;&lt;td align=&quot;LEFT&quot;&gt;name of the month&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;br /&gt;
change the separator / delimiter :&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; font-size: 12px; line-height: 18.421875px; padding: 0px;&quot;&gt;set datafile separator &quot;,&quot;&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Following text are all from original post by Ron Peterson:&lt;br /&gt;
&lt;br /&gt;
&lt;h1 style=&quot;font-family: verdana, arial, helvetica, sans-serif; font-size: 19px; text-align: center;&quot;&gt;
Plotting time series data with Gnuplot&lt;/h1&gt;
&lt;div id=&quot;by&quot; style=&quot;font-family: verdana, arial, helvetica, sans-serif; font-size: 12px; text-align: center;&quot;&gt;
&lt;b&gt;By&amp;nbsp;&lt;a href=&quot;http://linuxgazette.net/authors/peterson.html&quot; style=&quot;color: #551a8b;&quot;&gt;Ron Peterson&lt;/a&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: verdana, arial, helvetica, sans-serif; font-size: 12px;&quot;&gt;
&lt;/div&gt;
&lt;h3 style=&quot;font-family: verdana, arial, helvetica, sans-serif; font-size: 14px;&quot;&gt;
Introduction&lt;/h3&gt;
&lt;div style=&quot;font-family: verdana, arial, helvetica, sans-serif; font-size: 12px;&quot;&gt;
Good systems administrators log stuff. Lots of stuff. A lot of the information we collect consists of time series data: a set of numerical values assocated with a sequence of discrete time values.&lt;/div&gt;
&lt;div style=&quot;font-family: verdana, arial, helvetica, sans-serif; font-size: 12px;&quot;&gt;
There are any number of tools to help the diligent sysadmin monitor this data visually as it is collected. A good many of them are built using Tobias Oetiker&#39;s excellent&lt;a href=&quot;http://people.ee.ethz.ch/~oetiker/webtools/rrdtool/&quot; style=&quot;color: #551a8b;&quot;&gt;RRDTool&lt;/a&gt;. Some noteworthy examples include Cacti, Cricket, and Smokeping. There are many others.&lt;/div&gt;
&lt;div style=&quot;font-family: verdana, arial, helvetica, sans-serif; font-size: 12px;&quot;&gt;
That&#39;s all well and good as long as you know what you want to monitor. However, sometimes you&#39;d just like to do some quick ad hoc visualization. As you might surmise, most Linux systems provide a myriad of visualization tools (&lt;a href=&quot;http://plasma-gate.weizmann.ac.il/Grace/&quot; style=&quot;color: #551a8b;&quot;&gt;Grace&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href=&quot;http://gri.sourceforge.net/&quot; style=&quot;color: #551a8b;&quot;&gt;GRI&lt;/a&gt;&amp;nbsp;come to mind). In this article, I&#39;ll introduce you to&amp;nbsp;&lt;a href=&quot;http://www.gnuplot.info/&quot; style=&quot;color: #551a8b;&quot;&gt;Gnuplot&lt;/a&gt;, focusing specifically on how to plot time series data.&lt;/div&gt;
&lt;h3 style=&quot;font-family: verdana, arial, helvetica, sans-serif; font-size: 14px;&quot;&gt;
Prepare some data&lt;/h3&gt;
&lt;div style=&quot;font-family: verdana, arial, helvetica, sans-serif; font-size: 12px;&quot;&gt;
Gnuplot without data is like gravy without potatoes. So before we get to the gravy, let&#39;s make some potatoes. Let&#39;s say for the sake of argument, or at least for the purpose of giving the rest of the article something to talk about, I include the following line in my system&#39;s crontab file:&lt;/div&gt;
&lt;div style=&quot;font-family: verdana, arial, helvetica, sans-serif; font-size: 12px;&quot;&gt;
&lt;/div&gt;
&lt;pre class=&quot;code&quot; style=&quot;background-color: #f4f1bf; border: 1px solid black; font-size: 11px; overflow: auto; padding: 10px;&quot;&gt;*/1 * * * * root /bin/cat /proc/loadavg 2&amp;gt;&amp;amp;1 | /usr/bin/logger -p local3.info -t CRON-LOADAVG
&lt;/pre&gt;
&lt;div style=&quot;font-family: verdana, arial, helvetica, sans-serif; font-size: 12px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;font-family: verdana, arial, helvetica, sans-serif; font-size: 12px;&quot;&gt;
If you&#39;re like me, and have configured your system&#39;s syslog.conf as follows:&lt;/div&gt;
&lt;div style=&quot;font-family: verdana, arial, helvetica, sans-serif; font-size: 12px;&quot;&gt;
&lt;/div&gt;
&lt;pre class=&quot;code&quot; style=&quot;background-color: #f4f1bf; border: 1px solid black; font-size: 11px; overflow: auto; padding: 10px;&quot;&gt;local3.*  /var/log/cron.log
&lt;/pre&gt;
&lt;div style=&quot;font-family: verdana, arial, helvetica, sans-serif; font-size: 12px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;font-family: verdana, arial, helvetica, sans-serif; font-size: 12px;&quot;&gt;
...then you will&amp;nbsp;find all local3 facility messages in their own special file. Because we&#39;re telling &#39;logger&#39; to tag all of our load average data, it will be easy to extract this information from the rest of our logfile clutter. A simple &#39;grep CRON-LOADAVG /var/log/cron.log &amp;gt; load.dat.1&#39; should do nicely. This will give us a file that looks like so:&lt;/div&gt;
&lt;div style=&quot;font-family: verdana, arial, helvetica, sans-serif; font-size: 12px;&quot;&gt;
&lt;/div&gt;
&lt;pre class=&quot;code&quot; style=&quot;background-color: #f4f1bf; border: 1px solid black; font-size: 11px; overflow: auto; padding: 10px;&quot;&gt;Mar 19 00:30:02 ahost CRON-LOADAVG: 0.40 0.78 1.19 11/296 3690
Mar 19 00:31:01 ahost CRON-LOADAVG: 3.54 1.55 1.41 4/311 3997
Mar 19 00:32:01 ahost CRON-LOADAVG: 2.68 1.59 1.43 2/278 4142
...
&lt;/pre&gt;
&lt;div style=&quot;font-family: verdana, arial, helvetica, sans-serif; font-size: 12px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;font-family: verdana, arial, helvetica, sans-serif; font-size: 12px;&quot;&gt;
Now let&#39;s extract&amp;nbsp;just the data we want:&lt;/div&gt;
&lt;div style=&quot;font-family: verdana, arial, helvetica, sans-serif; font-size: 12px;&quot;&gt;
&lt;/div&gt;
&lt;pre class=&quot;code&quot; style=&quot;background-color: #f4f1bf; border: 1px solid black; font-size: 11px; overflow: auto; padding: 10px;&quot;&gt;cat load.dat.1 | tr -s &#39; &#39; &#39; &#39; | cut -d&#39; &#39; -f1,2,3,6 &amp;gt; load.dat.2
&lt;/pre&gt;
&lt;div style=&quot;font-family: verdana, arial, helvetica, sans-serif; font-size: 12px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;font-family: verdana, arial, helvetica, sans-serif; font-size: 12px;&quot;&gt;
The translate command &#39;tr&#39; squishes multiple spaces into a single space, so that we can expect more consistent behaviour from the &#39;cut&#39; command. In this case, the translate command &#39;tr&#39; is superfluous, but I think it&#39;s a good habit nonetheless. With any luck, our data now looks something like:&lt;/div&gt;
&lt;div style=&quot;font-family: verdana, arial, helvetica, sans-serif; font-size: 12px;&quot;&gt;
&lt;/div&gt;
&lt;pre class=&quot;code&quot; style=&quot;background-color: #f4f1bf; border: 1px solid black; font-size: 11px; overflow: auto; padding: 10px;&quot;&gt;Mar 19 00:30:02 0.40
Mar 19 00:31:01 3.54
Mar 19 00:32:01 2.68
...
&lt;/pre&gt;
&lt;div style=&quot;font-family: verdana, arial, helvetica, sans-serif; font-size: 12px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;font-family: verdana, arial, helvetica, sans-serif; font-size: 12px;&quot;&gt;
That&#39;s almost perfect. Unfortunately, our gnuplot example will expect two space delimited columns of input, so we need to replace the spaces delimiting our timestamp components with some other character, like a hyphen.&lt;/div&gt;
&lt;div style=&quot;font-family: verdana, arial, helvetica, sans-serif; font-size: 12px;&quot;&gt;
&lt;/div&gt;
&lt;pre class=&quot;code&quot; style=&quot;background-color: #f4f1bf; border: 1px solid black; font-size: 11px; overflow: auto; padding: 10px;&quot;&gt;perl -pe &#39;s/(.*?)\s(.*?)\s(.*)/$1-$2-$3/;&#39; load.dat.2 &amp;gt; load.dat.3
&lt;/pre&gt;
&lt;div style=&quot;font-family: verdana, arial, helvetica, sans-serif; font-size: 12px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;font-family: verdana, arial, helvetica, sans-serif; font-size: 12px;&quot;&gt;
This isn&#39;t a Perl article, so I won&#39;t bore you with the details of what this command is doing. In the interest of pedagogy though, I think it&#39;s helpful to illustrate how sausages are sometimes made; even if it does make me look like a butcher. Our data now looks like:&lt;/div&gt;
&lt;div style=&quot;font-family: verdana, arial, helvetica, sans-serif; font-size: 12px;&quot;&gt;
&lt;/div&gt;
&lt;pre class=&quot;code&quot; style=&quot;background-color: #f4f1bf; border: 1px solid black; font-size: 11px; overflow: auto; padding: 10px;&quot;&gt;Mar-19-00:30:02 0.40
Mar-19-00:31:01 3.54
Mar-19-00:32:01 2.68
...
&lt;/pre&gt;
&lt;div style=&quot;font-family: verdana, arial, helvetica, sans-serif; font-size: 12px;&quot;&gt;
&lt;/div&gt;
&lt;h3 style=&quot;font-family: verdana, arial, helvetica, sans-serif; font-size: 14px;&quot;&gt;
Plot it&lt;/h3&gt;
&lt;div style=&quot;font-family: verdana, arial, helvetica, sans-serif; font-size: 12px;&quot;&gt;
Now it&#39;s time for the gravy. First I&#39;ll give you a taste, and then I&#39;ll explain the recipe. Create a file with the following contents, excluding the line numbers. Call it &#39;plot-load.conf&#39;. Edit the date range on line six to include the extents of your data.&lt;/div&gt;
&lt;div style=&quot;font-family: verdana, arial, helvetica, sans-serif; font-size: 12px;&quot;&gt;
&lt;/div&gt;
&lt;pre class=&quot;code&quot; style=&quot;background-color: #f4f1bf; border: 1px solid black; font-size: 11px; overflow: auto; padding: 10px;&quot;&gt;1  set terminal png size 1200,800
2  set xdata time
3  set timefmt &quot;%b-%d-%H:%M:%S&quot;
4  set output &quot;load.png&quot;
5  # time range must be in same format as data file
6  set xrange [&quot;Mar-25-00:00:00&quot;:&quot;Mar-26-00:00:00&quot;]
7  set yrange [0:50]
8  set grid
9  set xlabel &quot;Date\\nTime&quot;
10 set ylabel &quot;Load&quot;
11 set title &quot;Load Averages&quot;
12 set key left box
13 plot &quot;load.dat.3&quot; using 1:2 index 0 title &quot;ahost&quot; with lines
&lt;/pre&gt;
&lt;div style=&quot;font-family: verdana, arial, helvetica, sans-serif; font-size: 12px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;font-family: verdana, arial, helvetica, sans-serif; font-size: 12px;&quot;&gt;
If you run the following command, you should end up with a file called &#39;load.png&#39;. Use your favorite image viewer to take a look. Hopefully nothing too alarming shows up.&lt;/div&gt;
&lt;div style=&quot;font-family: verdana, arial, helvetica, sans-serif; font-size: 12px;&quot;&gt;
&lt;/div&gt;
&lt;pre class=&quot;code&quot; style=&quot;background-color: #f4f1bf; border: 1px solid black; font-size: 11px; overflow: auto; padding: 10px;&quot;&gt;cat plot-load.conf | gnuplot
&lt;/pre&gt;
&lt;div style=&quot;font-family: verdana, arial, helvetica, sans-serif; font-size: 12px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;font-family: verdana, arial, helvetica, sans-serif; font-size: 12px;&quot;&gt;
The first line of our gnuplot command file says to create a PNG file, and gives its dimensions. PNG is only one of a myriad possible output formats. The second line says our X axis represents time data. The third line uses standard date format specification (see &#39;man date&#39;) to indicate what our data file&#39;s timestamp data looks like. We must use the same format in line six, where we indicate our graph&#39;s start time and end time. You can omit this, but I find it&#39;s useful to anchor the endpoints, particularly when plotting multiple data sources in a single graph. Line seven sets the plot limits of our Y axis.&lt;/div&gt;
&lt;div style=&quot;font-family: verdana, arial, helvetica, sans-serif; font-size: 12px;&quot;&gt;
Line 13 deserves a little bit of extra attention. The name of our data source comes first. The &#39;using 1:2&#39; bit means to extract data from columns one and two of our data source. The &#39;index 0&#39; bit means to use the first data set in the file. Data sets are delimited by pairs of blank records. Our file was simple. It only comprised col1 and col2 of data set zero in the following pseudo data file.&lt;/div&gt;
&lt;div style=&quot;font-family: verdana, arial, helvetica, sans-serif; font-size: 12px;&quot;&gt;
&lt;/div&gt;
&lt;pre class=&quot;code&quot; style=&quot;background-color: #f4f1bf; border: 1px solid black; font-size: 11px; overflow: auto; padding: 10px;&quot;&gt;# data set zero
col1 col2 col3 col4
col1 col2 col3 col4
col1 col2 col3 col4


# data set one
col1 col2 col3 col4
col1 col2 col3 col4
col1 col2 col3 col4
col1 col2 col3 col4


# data set two
col1 col2 col3 col4
col1 col2 col3 col4
col1 col2 col3 col4
&lt;/pre&gt;
&lt;div style=&quot;font-family: verdana, arial, helvetica, sans-serif; font-size: 12px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;font-family: verdana, arial, helvetica, sans-serif; font-size: 12px;&quot;&gt;
Asuuming we had multiple data sets in a single file (perhaps we want to compare load averages from multiple hosts), one way we could combine this data into a single graph would be to expand our line 13 as follows:&lt;/div&gt;
&lt;div style=&quot;font-family: verdana, arial, helvetica, sans-serif; font-size: 12px;&quot;&gt;
&lt;/div&gt;
&lt;pre class=&quot;code&quot; style=&quot;background-color: #f4f1bf; border: 1px solid black; font-size: 11px; overflow: auto; padding: 10px;&quot;&gt;plot &quot;load.dat.3&quot; using 1:2 index 0 title &quot;ahost&quot; with lines, \
plot &quot;load.dat.3&quot; using 1:2 index 1 title &quot;bhost&quot; with lines, \
plot &quot;load.dat.3&quot; using 1:2 index 2 title &quot;chost&quot; with lines
&lt;/pre&gt;
&lt;div style=&quot;font-family: verdana, arial, helvetica, sans-serif; font-size: 12px;&quot;&gt;
&lt;/div&gt;
&lt;h3 style=&quot;font-family: verdana, arial, helvetica, sans-serif; font-size: 14px;&quot;&gt;
Conclusion&lt;/h3&gt;
&lt;div style=&quot;font-family: verdana, arial, helvetica, sans-serif; font-size: 12px;&quot;&gt;
Potatoes are nice, but as Trotsky once noted, they are &quot;the classic symbol of poverty&quot;. Knowing how to quickly whip up some time series plots is useful, but Gnuplot is capable of far more than I&#39;ve even hinted at in this article. Hopefully I&#39;ve managed to whet your appetite to learn even more.&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;font-family: verdana, arial, helvetica, sans-serif; font-size: 12px;&quot;&gt;
Best.&lt;/div&gt;
&lt;div style=&quot;font-family: verdana, arial, helvetica, sans-serif; font-size: 12px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: verdana, arial, helvetica, sans-serif; font-size: 12px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://swimminginbits.blogspot.com/feeds/2265380707678512630/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4859738021814147401/2265380707678512630' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4859738021814147401/posts/default/2265380707678512630'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4859738021814147401/posts/default/2265380707678512630'/><link rel='alternate' type='text/html' href='http://swimminginbits.blogspot.com/2013/04/plotting-time-series-using-gnuplot.html' title='plotting time series using gnuplot'/><author><name>imoldcat</name><uri>http://www.blogger.com/profile/01007573997438480107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4859738021814147401.post-4718408389633421426</id><published>2013-04-14T23:26:00.001-04:00</published><updated>2013-04-14T23:27:02.713-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="knowledge base"/><title type='text'>freebase basics</title><content type='html'>Where to start:&lt;br /&gt;
Freebase wiki: &lt;a href=&quot;http://wiki.freebase.com/&quot;&gt;http://wiki.freebase.com/&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Terminologies:&lt;br /&gt;
&lt;br /&gt;
Conceptual level:&lt;br /&gt;
In freebase, ontology is called &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Schema&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Is A : &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Type&lt;/span&gt; / unary predicate / category / class&lt;/li&gt;
&lt;li&gt;Has A : &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Property&lt;/span&gt; &amp;nbsp;/ predicate / relation&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
Implementation/Physical level:&lt;/div&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;A&amp;nbsp;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Domain&lt;/span&gt;&amp;nbsp;is a collection of&amp;nbsp;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Types&lt;/span&gt;&amp;nbsp;(share a&amp;nbsp;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Namespace&lt;/span&gt;, /type/domain).&amp;nbsp;&lt;/li&gt;
&lt;li&gt;A&amp;nbsp;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Base&lt;/span&gt;&amp;nbsp;is a kind of&amp;nbsp;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;Domain&lt;/span&gt;&amp;nbsp;a way of grouping related types and their permissions.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;A &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Namespace&lt;/span&gt;&amp;nbsp;is a directory of uniquely named objects. Namespaces are organized in a&amp;nbsp;hierarchy (like a path). It is used to manage &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;keys&lt;/span&gt; and &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;ids&lt;/span&gt;. &amp;nbsp;It&#39;s more or like a table name of logical/physical database tables of freebase, e.g. namespace:&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;ul&gt;&lt;ul&gt;
&lt;li&gt;/type (primitive type, e.g. /type/object, /type/dated_integer),&amp;nbsp;&lt;/li&gt;
&lt;li&gt;/authority, (e.g. /authority/iata, /authority/gnis, /authority/musicbrainz, /authority/imdb ... like a datasource)&lt;/li&gt;
&lt;li&gt;Common top level domains, e.g. /common, /people, /business, /books&lt;/li&gt;
&lt;li&gt;/user, /base,&amp;nbsp;&lt;/li&gt;
&lt;li&gt;/guid,&amp;nbsp;/wikipedia/en_id,&amp;nbsp;/lang, /wikipedia, &amp;nbsp;/en (human readable ids),&amp;nbsp;/wikipedia/en&lt;/li&gt;
&lt;li&gt;internal: /freebase&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;br /&gt;
Misc:&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;a &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Domain&lt;/span&gt; has many administrators, who has the permission to add &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Property&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;br /&gt;
Data &amp;amp; Tool:&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Schemas: http://schemas.freebaseapps.com/&lt;/li&gt;
&lt;li&gt;Data:&amp;nbsp;https://developers.google.com/freebase/data&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://swimminginbits.blogspot.com/feeds/4718408389633421426/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4859738021814147401/4718408389633421426' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4859738021814147401/posts/default/4718408389633421426'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4859738021814147401/posts/default/4718408389633421426'/><link rel='alternate' type='text/html' href='http://swimminginbits.blogspot.com/2013/04/freebase-basics.html' title='freebase basics'/><author><name>imoldcat</name><uri>http://www.blogger.com/profile/01007573997438480107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4859738021814147401.post-2860951729111202823</id><published>2013-03-26T22:22:00.000-04:00</published><updated>2013-04-10T19:28:14.680-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="compiler"/><category scheme="http://www.blogger.com/atom/ns#" term="javacc"/><title type='text'>JavaCC to generate C++ code</title><content type='html'>JavaCC has a&amp;nbsp;developing&amp;nbsp;branch that is able to generate C++ code.&lt;br /&gt;
svn address:&amp;nbsp;&lt;span style=&quot;background-color: white;&quot;&gt;https://svn.java.net/svn/javacc~svn&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
There is little examples so far. Some useful links from the mailing list:&lt;br /&gt;
how to use, just set the following in the beginning:&lt;br /&gt;
-output_language=c++&lt;br /&gt;
and write&amp;nbsp;code fragments in jj file using c++&lt;br /&gt;
&lt;a href=&quot;http://java.net/projects/javacc/lists/users/archive/2011-03/message/0&quot;&gt;http://java.net/projects/javacc/lists/users/archive/2011-03/message/0&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
must read, most of it still true:&lt;br /&gt;
&lt;a href=&quot;http://java.net/projects/javacc/lists/users/archive/2011-02/message/10&quot;&gt;http://java.net/projects/javacc/lists/users/archive/2011-02/message/10&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
there&#39;s a example in the branch in the following directory&lt;br /&gt;
&lt;a href=&quot;http://www.blogger.com/#&quot;&gt;examples/JavaGrammars/cpp&lt;/a&gt;&lt;br /&gt;
the example parses java1.1 grammar&lt;br /&gt;
&lt;br /&gt;
An example for a simple Adder.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;line-pre&quot; style=&quot;background-color: white; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; line-height: 16px; padding: 0px; width: 744px; word-wrap: break-word;&quot;&gt;&lt;div class=&quot;line&quot; id=&quot;file-gistfile1-java-LC1&quot;&gt;
&lt;span class=&quot;c1&quot; style=&quot;color: #999988; font-style: italic;&quot;&gt;//99+42+0+15&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-gistfile1-java-LC2&quot;&gt;
&lt;span class=&quot;n&quot; style=&quot;color: #333333;&quot;&gt;options&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-gistfile1-java-LC3&quot;&gt;
&lt;span class=&quot;n&quot; style=&quot;color: #333333;&quot;&gt;JAVA_UNICODE_ESCAPE&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kc&quot; style=&quot;font-weight: bold;&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-gistfile1-java-LC4&quot;&gt;
&lt;span class=&quot;n&quot; style=&quot;color: #333333;&quot;&gt;OUTPUT_LANGUAGE&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;c++&quot;&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-gistfile1-java-LC5&quot;&gt;
&lt;span class=&quot;n&quot; style=&quot;color: #333333;&quot;&gt;NAMESPACE&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;adder_parser&quot;&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-gistfile1-java-LC6&quot;&gt;
&lt;span class=&quot;n&quot; style=&quot;color: #333333;&quot;&gt;OUTPUT_DIRECTORY&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;gen&quot;&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-gistfile1-java-LC7&quot;&gt;
&lt;span class=&quot;c1&quot; style=&quot;color: #999988; font-style: italic;&quot;&gt;//STATIC = false; // ignored by c++&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-gistfile1-java-LC8&quot;&gt;
&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-gistfile1-java-LC9&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-gistfile1-java-LC10&quot;&gt;
&lt;span class=&quot;c1&quot; style=&quot;color: #999988; font-style: italic;&quot;&gt;// ignored by c++ version&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-gistfile1-java-LC11&quot;&gt;
&lt;span class=&quot;n&quot; style=&quot;color: #333333;&quot;&gt;PARSER_BEGIN&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot; style=&quot;color: #333333;&quot;&gt;Adder&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-gistfile1-java-LC12&quot;&gt;
&lt;span class=&quot;n&quot; style=&quot;color: #333333;&quot;&gt;struct&lt;/span&gt; &lt;span class=&quot;n&quot; style=&quot;color: #333333;&quot;&gt;sampleCustomStruct&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-gistfile1-java-LC13&quot;&gt;
&lt;span class=&quot;kt&quot; style=&quot;color: #445588; font-weight: bold;&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot; style=&quot;color: #333333;&quot;&gt;left_operand&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-gistfile1-java-LC14&quot;&gt;
&lt;span class=&quot;kt&quot; style=&quot;color: #445588; font-weight: bold;&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot; style=&quot;color: #333333;&quot;&gt;right_operand&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-gistfile1-java-LC15&quot;&gt;
&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;};&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-gistfile1-java-LC16&quot;&gt;
&lt;span class=&quot;n&quot; style=&quot;color: #333333;&quot;&gt;PARSER_END&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot; style=&quot;color: #333333;&quot;&gt;Adder&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-gistfile1-java-LC17&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-gistfile1-java-LC18&quot;&gt;
&lt;span class=&quot;c1&quot; style=&quot;color: #999988; font-style: italic;&quot;&gt;// define the lexical analyzer&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-gistfile1-java-LC19&quot;&gt;
&lt;span class=&quot;n&quot; style=&quot;color: #333333;&quot;&gt;SKIP&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;s&quot; style=&quot;color: #dd1144;&quot;&gt;&quot; &quot;&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-gistfile1-java-LC20&quot;&gt;
&lt;span class=&quot;n&quot; style=&quot;color: #333333;&quot;&gt;SKIP&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;s&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;\n&quot;&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;s&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;\r&quot;&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;s&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;\r\n&quot;&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-gistfile1-java-LC21&quot;&gt;
&lt;span class=&quot;n&quot; style=&quot;color: #333333;&quot;&gt;TOKEN&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;n&quot; style=&quot;color: #333333;&quot;&gt;PLUS&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;+&quot;&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-gistfile1-java-LC22&quot;&gt;
&lt;span class=&quot;n&quot; style=&quot;color: #333333;&quot;&gt;TOKEN&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;n&quot; style=&quot;color: #333333;&quot;&gt;NUMBER&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;s&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;0&quot;&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;s&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;9&quot;&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;])+&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-gistfile1-java-LC23&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-gistfile1-java-LC24&quot;&gt;
&lt;span class=&quot;c1&quot; style=&quot;color: #999988; font-style: italic;&quot;&gt;// define the parser&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-gistfile1-java-LC25&quot;&gt;
&lt;span class=&quot;kt&quot; style=&quot;color: #445588; font-weight: bold;&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;nf&quot; style=&quot;color: #990000; font-weight: bold;&quot;&gt;eval&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;():&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-gistfile1-java-LC26&quot;&gt;
&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-gistfile1-java-LC27&quot;&gt;
&lt;span class=&quot;kt&quot; style=&quot;color: #445588; font-weight: bold;&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot; style=&quot;color: #333333;&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;;&lt;/span&gt; &lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-gistfile1-java-LC28&quot;&gt;
&lt;span class=&quot;kt&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;kt&quot; style=&quot;color: #445588; font-weight: bold;&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot; style=&quot;color: #333333;&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-gistfile1-java-LC29&quot;&gt;
&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-gistfile1-java-LC30&quot;&gt;
&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-gistfile1-java-LC31&quot;&gt;
&lt;span class=&quot;n&quot; style=&quot;color: #333333;&quot;&gt;value&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot; style=&quot;color: #333333;&quot;&gt;numberHanlder&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;()&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-gistfile1-java-LC32&quot;&gt;
&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;n&quot; style=&quot;color: #333333;&quot;&gt;printf&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;value = %d\n&quot;&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot; style=&quot;color: #333333;&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-gistfile1-java-LC33&quot;&gt;
&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;(&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-gistfile1-java-LC34&quot;&gt;
&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot; style=&quot;color: #333333;&quot;&gt;PLUS&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-gistfile1-java-LC35&quot;&gt;
&lt;span class=&quot;n&quot; style=&quot;color: #333333;&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot; style=&quot;color: #333333;&quot;&gt;numberHanlder&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;()&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-gistfile1-java-LC36&quot;&gt;
&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;n&quot; style=&quot;color: #333333;&quot;&gt;value&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;n&quot; style=&quot;color: #333333;&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-gistfile1-java-LC37&quot;&gt;
&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;n&quot; style=&quot;color: #333333;&quot;&gt;printf&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;value = %d\n&quot;&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot; style=&quot;color: #333333;&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-gistfile1-java-LC38&quot;&gt;
&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;)*&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot; style=&quot;color: #333333;&quot;&gt;EOF&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-gistfile1-java-LC39&quot;&gt;
&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;return&lt;/span&gt;  &lt;span class=&quot;n&quot; style=&quot;color: #333333;&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-gistfile1-java-LC40&quot;&gt;
&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-gistfile1-java-LC41&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-gistfile1-java-LC42&quot;&gt;
&lt;span class=&quot;c1&quot; style=&quot;color: #999988; font-style: italic;&quot;&gt;// a sub routine in the parser&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-gistfile1-java-LC43&quot;&gt;
&lt;span class=&quot;kt&quot; style=&quot;color: #445588; font-weight: bold;&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;nf&quot; style=&quot;color: #990000; font-weight: bold;&quot;&gt;numberHanlder&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;():&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-gistfile1-java-LC44&quot;&gt;
&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-gistfile1-java-LC45&quot;&gt;
&lt;span class=&quot;c1&quot; style=&quot;color: #999988; font-style: italic;&quot;&gt;// note it should be a pointer&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-gistfile1-java-LC46&quot;&gt;
&lt;span class=&quot;n&quot; style=&quot;color: #333333;&quot;&gt;Token&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot; style=&quot;color: #333333;&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-gistfile1-java-LC47&quot;&gt;
&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-gistfile1-java-LC48&quot;&gt;
&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-gistfile1-java-LC49&quot;&gt;
&lt;span class=&quot;n&quot; style=&quot;color: #333333;&quot;&gt;t&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot; style=&quot;color: #333333;&quot;&gt;NUMBER&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-gistfile1-java-LC50&quot;&gt;
&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot; style=&quot;color: #333333;&quot;&gt;atoi&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot; style=&quot;color: #333333;&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot; style=&quot;color: #333333;&quot;&gt;image&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot; style=&quot;color: teal;&quot;&gt;c_str&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;());&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;}&lt;/span&gt; &lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-gistfile1-java-LC51&quot;&gt;
&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
Several Notes:&lt;br /&gt;
1. PARSER_BEGIN &amp;nbsp;- PARSER_END&lt;br /&gt;
The code in this section will be copied directly into the Adder class.&lt;br /&gt;
So #include clause will cause error.&lt;br /&gt;
It&#39;s possible to use this section define nested class, which may be useful in some case.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Token -&amp;gt; Token*&lt;br /&gt;
All reference to Token in Java should be declared as Token* in c++.&lt;br /&gt;
The token.image is an instance of basic_string, which is subclass of std string.&lt;br /&gt;
&lt;br /&gt;
3. #include some external file or self-defined struct&lt;br /&gt;
use&amp;nbsp;PARSER_INCLUDES in options section.&lt;br /&gt;
In the .h file, one can include more other headers.&lt;br /&gt;
&lt;br /&gt;
4. Error Handling&lt;br /&gt;
Different from Java, no exception handling.&lt;br /&gt;
In the generated parser, one can do the following&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;line-pre&quot; style=&quot;background-color: white; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 12px; line-height: 16px; padding: 0px; width: 744px; word-wrap: break-word;&quot;&gt;&lt;div class=&quot;line&quot; id=&quot;file-main-cc-LC37&quot;&gt;
&lt;span class=&quot;n&quot; style=&quot;color: #333333;&quot;&gt;ErrorHandler&lt;/span&gt; &lt;span class=&quot;n&quot; style=&quot;color: #333333;&quot;&gt;errorHandler&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; id=&quot;file-main-cc-LC38&quot;&gt;
&lt;span class=&quot;n&quot; style=&quot;color: #333333;&quot;&gt;parser&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot; style=&quot;color: #333333;&quot;&gt;setErrorHandler&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;n&quot; style=&quot;color: #333333;&quot;&gt;errorHandler&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;/pre&gt;
&lt;br /&gt;
To set a error handler. It has two methods in ErrorHandler, one is parser error, another is lexical error. Inherit that class, can change its behavior.&lt;br /&gt;
</content><link rel='replies' type='application/atom+xml' href='http://swimminginbits.blogspot.com/feeds/2860951729111202823/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4859738021814147401/2860951729111202823' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4859738021814147401/posts/default/2860951729111202823'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4859738021814147401/posts/default/2860951729111202823'/><link rel='alternate' type='text/html' href='http://swimminginbits.blogspot.com/2013/03/javacc-to-generate-c-code.html' title='JavaCC to generate C++ code'/><author><name>imoldcat</name><uri>http://www.blogger.com/profile/01007573997438480107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4859738021814147401.post-4773745066586650403</id><published>2013-03-04T02:10:00.001-05:00</published><updated>2013-03-04T02:10:22.264-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="query optimization"/><category scheme="http://www.blogger.com/atom/ns#" term="sql"/><title type='text'>Notes about query plans</title><content type='html'>Left deep and right deep query plan tree are different for nested joins as well as hash joins:&lt;br /&gt;
&lt;br /&gt;
about the nested join:&lt;br /&gt;
&lt;br /&gt;
The classic paper mentioned it:&lt;br /&gt;
Goetz Graefe: Query Evaluation Techniques for Large Databases. ACM Comput. Surv. 25(2): 73-170 (1993), &lt;a href=&quot;http://dl.acm.org/citation.cfm?id=152611&amp;amp;coll=ACM&amp;amp;dl=ACM&quot;&gt;link&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
Figure 4 shows prototypical left-deep,&lt;br /&gt;right-deep, and bushy plans for a join of four inputs. Left-deep and right-deep plans are different&amp;nbsp;because join algorithms use their two inputs in different ways; for example, in the nested loops&amp;nbsp;join algorithm, the outer loop iterates over one input (usually drawn as left input) while the inner&amp;nbsp;loop iterates over the other input. The set of bushy plans is the most general as it includes the&amp;nbsp;sets of both left-deep and right-deep plans. These names are taken from [Graefe and DeWitt&amp;nbsp;1987]; left-deep plans are also called &quot;linear processing trees&quot; [Krishnamurthy, Boral, and&amp;nbsp;Zaniolo 1986] or &quot;plans with no composite inner&quot; [Ono and Lohman 1990].&lt;/blockquote&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
about the hash join:&lt;br /&gt;
&lt;br /&gt;
This is a really good post&lt;br /&gt;
&lt;a href=&quot;http://blogs.msdn.com/b/craigfr/archive/2006/08/10/687630.aspx&quot;&gt;http://blogs.msdn.com/b/craigfr/archive/2006/08/10/687630.aspx&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Quote it here for cache:&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
These terms refer to the shape of the query plan as illustrated by this figure:&lt;br /&gt;&lt;img border=&quot;0&quot; src=&quot;http://blogs.msdn.com/photos/craigfr/images/687609/original.aspx&quot; style=&quot;height: auto !important; max-width: 100%; overflow: hidden;&quot; /&gt;&lt;br /&gt;The shape of the join tree is particularly interesting for hash joins as it affects the memory consumption.&lt;br /&gt;In a left deep tree, the output of one hash join is the build input to the next hash join.&amp;nbsp; Because hash joins consume their entire build input before moving to the probe phase, in a left deep tree only adjacent pairs of hash joins are active at the same time.&amp;nbsp; For example, in the above picture, we begin by building the hash table for HJ1.&amp;nbsp; When HJ1 begins probing, we use the output of HJ1 to build the hash table for HJ2.&amp;nbsp; When HJ1 is done probing, we can release the memory used by its hash table.&amp;nbsp; Only then do we begin probing HJ2 and building the hash table for HJ3.&amp;nbsp; Thus, HJ1 and HJ3 are never active at the same time and can share the same memory grant.&amp;nbsp; The total amount of memory we need is max(HJ1 + HJ2, HJ2 + HJ3).&lt;br /&gt;In a right deep tree, the output of one hash join is the probe input to the next hash join.&amp;nbsp; All of the hash joins must build their complete hash tables before we can begin probing.&amp;nbsp; All of the hash joins are active at once and cannot share memory.&amp;nbsp; When we do begin probing, rows flow up the entire tree of hash joins without blocking.&amp;nbsp; Thus, the total amount of memory we need is HJ1 + HJ2 + HJ3.&lt;/blockquote&gt;
</content><link rel='replies' type='application/atom+xml' href='http://swimminginbits.blogspot.com/feeds/4773745066586650403/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4859738021814147401/4773745066586650403' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4859738021814147401/posts/default/4773745066586650403'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4859738021814147401/posts/default/4773745066586650403'/><link rel='alternate' type='text/html' href='http://swimminginbits.blogspot.com/2013/03/notes-about-query-plans.html' title='Notes about query plans'/><author><name>imoldcat</name><uri>http://www.blogger.com/profile/01007573997438480107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4859738021814147401.post-5752354078409108688</id><published>2013-02-14T01:55:00.000-05:00</published><updated>2013-02-14T01:55:03.597-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="regexp"/><category scheme="http://www.blogger.com/atom/ns#" term="ruby"/><title type='text'>Ruby Regexp links</title><content type='html'>a quite note to some articles:&lt;br /&gt;
&lt;br /&gt;
Regular Expressions in ruby has a very good summary&lt;br /&gt;
&lt;a href=&quot;http://strugglingwithruby.blogspot.com/2009/05/regular-expressions-in-ruby.html&quot;&gt;http://strugglingwithruby.blogspot.com/2009/05/regular-expressions-in-ruby.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;background-color: #e6e6e6; color: navy; font-family: monospace; font-size: 10px; line-height: 18.90625px; white-space: pre;&quot;&gt;.             any character except newline&lt;/span&gt;&lt;br style=&quot;background-color: #e6e6e6; color: navy; font-family: monospace; font-size: 10px; line-height: 18.90625px; white-space: pre;&quot; /&gt;&lt;span style=&quot;background-color: #e6e6e6; color: navy; font-family: monospace; font-size: 10px; line-height: 18.90625px; white-space: pre;&quot;&gt;[ ]           any single character of set&lt;/span&gt;&lt;br style=&quot;background-color: #e6e6e6; color: navy; font-family: monospace; font-size: 10px; line-height: 18.90625px; white-space: pre;&quot; /&gt;&lt;span style=&quot;background-color: #e6e6e6; color: navy; font-family: monospace; font-size: 10px; line-height: 18.90625px; white-space: pre;&quot;&gt;[^ ]          any single character NOT of set&lt;/span&gt;&lt;br style=&quot;background-color: #e6e6e6; color: navy; font-family: monospace; font-size: 10px; line-height: 18.90625px; white-space: pre;&quot; /&gt;&lt;span style=&quot;background-color: #e6e6e6; color: navy; font-family: monospace; font-size: 10px; line-height: 18.90625px; white-space: pre;&quot;&gt;*             0 or more previous regular expression&lt;/span&gt;&lt;br style=&quot;background-color: #e6e6e6; color: navy; font-family: monospace; font-size: 10px; line-height: 18.90625px; white-space: pre;&quot; /&gt;&lt;span style=&quot;background-color: #e6e6e6; color: navy; font-family: monospace; font-size: 10px; line-height: 18.90625px; white-space: pre;&quot;&gt;*?            0 or more previous regular expression (non-greedy)&lt;/span&gt;&lt;br style=&quot;background-color: #e6e6e6; color: navy; font-family: monospace; font-size: 10px; line-height: 18.90625px; white-space: pre;&quot; /&gt;&lt;span style=&quot;background-color: #e6e6e6; color: navy; font-family: monospace; font-size: 10px; line-height: 18.90625px; white-space: pre;&quot;&gt;+             1 or more previous regular expression&lt;/span&gt;&lt;br style=&quot;background-color: #e6e6e6; color: navy; font-family: monospace; font-size: 10px; line-height: 18.90625px; white-space: pre;&quot; /&gt;&lt;span style=&quot;background-color: #e6e6e6; color: navy; font-family: monospace; font-size: 10px; line-height: 18.90625px; white-space: pre;&quot;&gt;+?            1 or more previous regular expression (non-greedy)&lt;/span&gt;&lt;br style=&quot;background-color: #e6e6e6; color: navy; font-family: monospace; font-size: 10px; line-height: 18.90625px; white-space: pre;&quot; /&gt;&lt;span style=&quot;background-color: #e6e6e6; color: navy; font-family: monospace; font-size: 10px; line-height: 18.90625px; white-space: pre;&quot;&gt;?             0 or 1 previous regular expression&lt;/span&gt;&lt;br style=&quot;background-color: #e6e6e6; color: navy; font-family: monospace; font-size: 10px; line-height: 18.90625px; white-space: pre;&quot; /&gt;&lt;span style=&quot;background-color: #e6e6e6; color: navy; font-family: monospace; font-size: 10px; line-height: 18.90625px; white-space: pre;&quot;&gt;??&lt;/span&gt;&lt;br style=&quot;background-color: #e6e6e6; color: navy; font-family: monospace; font-size: 10px; line-height: 18.90625px; white-space: pre;&quot; /&gt;&lt;span style=&quot;background-color: #e6e6e6; color: navy; font-family: monospace; font-size: 10px; line-height: 18.90625px; white-space: pre;&quot;&gt;|             alternation&lt;/span&gt;&lt;br style=&quot;background-color: #e6e6e6; color: navy; font-family: monospace; font-size: 10px; line-height: 18.90625px; white-space: pre;&quot; /&gt;&lt;span style=&quot;background-color: #e6e6e6; color: navy; font-family: monospace; font-size: 10px; line-height: 18.90625px; white-space: pre;&quot;&gt;( )           grouping regular expressions&lt;/span&gt;&lt;br style=&quot;background-color: #e6e6e6; color: navy; font-family: monospace; font-size: 10px; line-height: 18.90625px; white-space: pre;&quot; /&gt;&lt;span style=&quot;background-color: #e6e6e6; color: navy; font-family: monospace; font-size: 10px; line-height: 18.90625px; white-space: pre;&quot;&gt;^             beginning of a line or string&lt;/span&gt;&lt;br style=&quot;background-color: #e6e6e6; color: navy; font-family: monospace; font-size: 10px; line-height: 18.90625px; white-space: pre;&quot; /&gt;&lt;span style=&quot;background-color: #e6e6e6; color: navy; font-family: monospace; font-size: 10px; line-height: 18.90625px; white-space: pre;&quot;&gt;$             end of a line or string&lt;/span&gt;&lt;br style=&quot;background-color: #e6e6e6; color: navy; font-family: monospace; font-size: 10px; line-height: 18.90625px; white-space: pre;&quot; /&gt;&lt;span style=&quot;background-color: #e6e6e6; color: navy; font-family: monospace; font-size: 10px; line-height: 18.90625px; white-space: pre;&quot;&gt;{m,n}        at least m but most n previous regular expression&lt;/span&gt;&lt;br style=&quot;background-color: #e6e6e6; color: navy; font-family: monospace; font-size: 10px; line-height: 18.90625px; white-space: pre;&quot; /&gt;&lt;span style=&quot;background-color: #e6e6e6; color: navy; font-family: monospace; font-size: 10px; line-height: 18.90625px; white-space: pre;&quot;&gt;{m,n}?       at least m but most n previous regular expression (non-greedy)&lt;/span&gt;&lt;br style=&quot;background-color: #e6e6e6; color: navy; font-family: monospace; font-size: 10px; line-height: 18.90625px; white-space: pre;&quot; /&gt;&lt;span style=&quot;background-color: #e6e6e6; color: navy; font-family: monospace; font-size: 10px; line-height: 18.90625px; white-space: pre;&quot;&gt;\1-9          nth previous captured group&lt;/span&gt;&lt;br style=&quot;background-color: #e6e6e6; color: navy; font-family: monospace; font-size: 10px; line-height: 18.90625px; white-space: pre;&quot; /&gt;&lt;span style=&quot;background-color: #e6e6e6; color: navy; font-family: monospace; font-size: 10px; line-height: 18.90625px; white-space: pre;&quot;&gt;\A            beginning of a string&lt;/span&gt;&lt;br style=&quot;background-color: #e6e6e6; color: navy; font-family: monospace; font-size: 10px; line-height: 18.90625px; white-space: pre;&quot; /&gt;&lt;span style=&quot;background-color: #e6e6e6; color: navy; font-family: monospace; font-size: 10px; line-height: 18.90625px; white-space: pre;&quot;&gt;\b            backspace(0x08)(inside[]only)&lt;/span&gt;&lt;br style=&quot;background-color: #e6e6e6; color: navy; font-family: monospace; font-size: 10px; line-height: 18.90625px; white-space: pre;&quot; /&gt;&lt;span style=&quot;background-color: #e6e6e6; color: navy; font-family: monospace; font-size: 10px; line-height: 18.90625px; white-space: pre;&quot;&gt;\b            word boundary(outside[]only)&lt;/span&gt;&lt;br style=&quot;background-color: #e6e6e6; color: navy; font-family: monospace; font-size: 10px; line-height: 18.90625px; white-space: pre;&quot; /&gt;&lt;span style=&quot;background-color: #e6e6e6; color: navy; font-family: monospace; font-size: 10px; line-height: 18.90625px; white-space: pre;&quot;&gt;\B            non-word boundary&lt;/span&gt;&lt;br style=&quot;background-color: #e6e6e6; color: navy; font-family: monospace; font-size: 10px; line-height: 18.90625px; white-space: pre;&quot; /&gt;&lt;span style=&quot;background-color: #e6e6e6; color: navy; font-family: monospace; font-size: 10px; line-height: 18.90625px; white-space: pre;&quot;&gt;\d            digit, same as[0-9]&lt;/span&gt;&lt;br style=&quot;background-color: #e6e6e6; color: navy; font-family: monospace; font-size: 10px; line-height: 18.90625px; white-space: pre;&quot; /&gt;&lt;span style=&quot;background-color: #e6e6e6; color: navy; font-family: monospace; font-size: 10px; line-height: 18.90625px; white-space: pre;&quot;&gt;\D            non-digit&lt;/span&gt;&lt;br style=&quot;background-color: #e6e6e6; color: navy; font-family: monospace; font-size: 10px; line-height: 18.90625px; white-space: pre;&quot; /&gt;&lt;span style=&quot;background-color: #e6e6e6; color: navy; font-family: monospace; font-size: 10px; line-height: 18.90625px; white-space: pre;&quot;&gt;\S            non-whitespace character&lt;/span&gt;&lt;br style=&quot;background-color: #e6e6e6; color: navy; font-family: monospace; font-size: 10px; line-height: 18.90625px; white-space: pre;&quot; /&gt;&lt;span style=&quot;background-color: #e6e6e6; color: navy; font-family: monospace; font-size: 10px; line-height: 18.90625px; white-space: pre;&quot;&gt;\s            whitespace character[ \t\n\r\f]&lt;/span&gt;&lt;br style=&quot;background-color: #e6e6e6; color: navy; font-family: monospace; font-size: 10px; line-height: 18.90625px; white-space: pre;&quot; /&gt;&lt;span style=&quot;background-color: #e6e6e6; color: navy; font-family: monospace; font-size: 10px; line-height: 18.90625px; white-space: pre;&quot;&gt;\W            non-word character&lt;/span&gt;&lt;br style=&quot;background-color: #e6e6e6; color: navy; font-family: monospace; font-size: 10px; line-height: 18.90625px; white-space: pre;&quot; /&gt;&lt;span style=&quot;background-color: #e6e6e6; color: navy; font-family: monospace; font-size: 10px; line-height: 18.90625px; white-space: pre;&quot;&gt;\w            word character[0-9A-Za-z_]&lt;/span&gt;&lt;br style=&quot;background-color: #e6e6e6; color: navy; font-family: monospace; font-size: 10px; line-height: 18.90625px; white-space: pre;&quot; /&gt;&lt;span style=&quot;background-color: #e6e6e6; color: navy; font-family: monospace; font-size: 10px; line-height: 18.90625px; white-space: pre;&quot;&gt;\z            end of a string&lt;/span&gt;&lt;br style=&quot;background-color: #e6e6e6; color: navy; font-family: monospace; font-size: 10px; line-height: 18.90625px; white-space: pre;&quot; /&gt;&lt;span style=&quot;background-color: #e6e6e6; color: navy; font-family: monospace; font-size: 10px; line-height: 18.90625px; white-space: pre;&quot;&gt;\Z            end of a string, or before newline at the end&lt;/span&gt;&lt;br style=&quot;background-color: #e6e6e6; color: navy; font-family: monospace; font-size: 10px; line-height: 18.90625px; white-space: pre;&quot; /&gt;&lt;span style=&quot;background-color: #e6e6e6; color: navy; font-family: monospace; font-size: 10px; line-height: 18.90625px; white-space: pre;&quot;&gt;\/            forward slash&lt;/span&gt;&lt;/blockquote&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: #e6e6e6; color: navy; font-family: monospace; font-size: 10px; line-height: 18.90625px; white-space: pre;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://swimminginbits.blogspot.com/feeds/5752354078409108688/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4859738021814147401/5752354078409108688' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4859738021814147401/posts/default/5752354078409108688'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4859738021814147401/posts/default/5752354078409108688'/><link rel='alternate' type='text/html' href='http://swimminginbits.blogspot.com/2013/02/ruby-regexp-links.html' title='Ruby Regexp links'/><author><name>imoldcat</name><uri>http://www.blogger.com/profile/01007573997438480107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4859738021814147401.post-1280950496323296247</id><published>2013-02-11T06:28:00.002-05:00</published><updated>2013-02-11T06:28:38.688-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="debug"/><category scheme="http://www.blogger.com/atom/ns#" term="hadoop"/><category scheme="http://www.blogger.com/atom/ns#" term="yarn"/><title type='text'>How to get YARN log</title><content type='html'>quick memo&lt;br /&gt;
&lt;br /&gt;
use cmd:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
yarn logs&lt;br /&gt;
&lt;br /&gt;
usage: general options are:&lt;br /&gt;
&amp;nbsp;-applicationId &lt;arg&gt; &amp;nbsp; ApplicationId&lt;/arg&gt;&lt;br /&gt;
&amp;nbsp;-appOwner &lt;arg&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;AppOwner&lt;/arg&gt;&lt;br /&gt;
&amp;nbsp;-containerId &lt;arg&gt; &amp;nbsp; &amp;nbsp; ContainerId&lt;/arg&gt;&lt;br /&gt;
&amp;nbsp;-nodeAddress &lt;arg&gt; &amp;nbsp; &amp;nbsp; NodeAddress&lt;/arg&gt;&lt;br /&gt;
</content><link rel='replies' type='application/atom+xml' href='http://swimminginbits.blogspot.com/feeds/1280950496323296247/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4859738021814147401/1280950496323296247' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4859738021814147401/posts/default/1280950496323296247'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4859738021814147401/posts/default/1280950496323296247'/><link rel='alternate' type='text/html' href='http://swimminginbits.blogspot.com/2013/02/how-to-get-yarn-log.html' title='How to get YARN log'/><author><name>imoldcat</name><uri>http://www.blogger.com/profile/01007573997438480107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4859738021814147401.post-3011183658485695432</id><published>2013-02-04T06:30:00.001-05:00</published><updated>2013-02-04T06:30:41.210-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="db-extension"/><category scheme="http://www.blogger.com/atom/ns#" term="postgresql"/><title type='text'>postgresql notes</title><content type='html'>Postgresql is famous for its high extensibility and nice performance.&lt;br /&gt;
&lt;br /&gt;
Quick memo:&lt;br /&gt;
&lt;br /&gt;
To define the functions, procedures, and triggers, the manual is the bible:&lt;br /&gt;
&lt;br /&gt;
Refer to Chp 39 for a overview of the language, other language is possible to use, though trickier&lt;br /&gt;
&lt;a href=&quot;http://www.postgresql.org/files/documentation/pdf/9.2/postgresql-9.2-US.pdf&quot;&gt;http://www.postgresql.org/files/documentation/pdf/9.2/postgresql-9.2-US.pdf&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Aggregation functions:&lt;br /&gt;
&lt;a href=&quot;http://www.postgresql.org/docs/8.4/static/functions-aggregate.html&quot;&gt;http://www.postgresql.org/docs/8.4/static/functions-aggregate.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
lots of ideas in db are coined several decades ago. Hive UDF/UDAF/UDTF vs. postgresql aggregation functions e.g. xmlagg, array_agg, &amp;nbsp;User defined types and functions, really little difference.&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://swimminginbits.blogspot.com/feeds/3011183658485695432/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4859738021814147401/3011183658485695432' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4859738021814147401/posts/default/3011183658485695432'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4859738021814147401/posts/default/3011183658485695432'/><link rel='alternate' type='text/html' href='http://swimminginbits.blogspot.com/2013/02/postgresql-notes.html' title='postgresql notes'/><author><name>imoldcat</name><uri>http://www.blogger.com/profile/01007573997438480107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4859738021814147401.post-628240946062026631</id><published>2013-02-02T16:42:00.001-05:00</published><updated>2013-02-02T16:42:40.275-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="graph_algorithm"/><category scheme="http://www.blogger.com/atom/ns#" term="library"/><title type='text'>metis, graph partitioning</title><content type='html'>METIS from UMN is a great library to do the graph partitioning (also mesh partition, and etc.)&lt;br /&gt;
It can do k-way or bisection very fast. (millions vertex graph in seconds)&lt;br /&gt;
&lt;a href=&quot;http://glaros.dtc.umn.edu/gkhome/metis/metis/overview&quot;&gt;http://glaros.dtc.umn.edu/gkhome/metis/metis/overview&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
quick notes to use:&lt;br /&gt;
&lt;br /&gt;
1. input file format&lt;br /&gt;
line 1: # of vertex, # of edges, mode_code&lt;br /&gt;
the mode_code, 001 means edge weight graph, 011 means edge vertex weight graph,&lt;br /&gt;
details, need to refer to manual:&amp;nbsp;&lt;a href=&quot;http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/manual.pdf&quot;&gt;http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/manual.pdf&lt;/a&gt;&lt;br /&gt;
NOTE: # of edges should be count as once between any pair of vertices.&lt;br /&gt;
&lt;br /&gt;
line 2: is the node 1 (don&#39;t need to specify node id 1 in the line)&lt;br /&gt;
just follow &amp;nbsp;adj_v_i &amp;nbsp; &amp;nbsp;edge_1_v_weight adj_v_i &amp;nbsp; &amp;nbsp; &amp;nbsp;adj_v_j &amp;nbsp; &amp;nbsp; edge_1_j_weight &amp;nbsp;...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
% started line is comments&lt;br /&gt;
&lt;br /&gt;
2. gpmetis -objtype=vol inputfile &amp;nbsp;#_of_partition&lt;br /&gt;
objective function type: vol is the total communication volume&amp;nbsp;minimization cut (in k-way)&lt;br /&gt;
another default option is &amp;nbsp;-objtype=cut, which is minimize # of edge cut.&lt;br /&gt;
&lt;br /&gt;
3. output file&lt;br /&gt;
each line_no indicates v_id, &amp;nbsp; line_content is the partition id.</content><link rel='replies' type='application/atom+xml' href='http://swimminginbits.blogspot.com/feeds/628240946062026631/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4859738021814147401/628240946062026631' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4859738021814147401/posts/default/628240946062026631'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4859738021814147401/posts/default/628240946062026631'/><link rel='alternate' type='text/html' href='http://swimminginbits.blogspot.com/2013/02/metis-graph-partitioning.html' title='metis, graph partitioning'/><author><name>imoldcat</name><uri>http://www.blogger.com/profile/01007573997438480107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4859738021814147401.post-1562841041057769000</id><published>2013-01-27T20:46:00.000-05:00</published><updated>2013-02-15T18:06:51.941-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="git"/><category scheme="http://www.blogger.com/atom/ns#" term="github"/><title type='text'>getting used to git, quick note from svn perspective</title><content type='html'>used git for years, but not everyday basis, understand the difference between distributed version control, but still had some gotcha when using it recently.&lt;br /&gt;
&lt;br /&gt;
Some good links about Git-Svn crash&lt;br /&gt;
&lt;a href=&quot;http://git.or.cz/course/svn.html&quot;&gt;http://git.or.cz/course/svn.html&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://stackoverflow.com/questions/10169328/git-your-branch-is-ahead-of-origin-master-by-1-commit&quot;&gt;http://stackoverflow.com/questions/10169328/git-your-branch-is-ahead-of-origin-master-by-1-commit&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
On Mac, the Github for mac is very handy.&lt;br /&gt;
&lt;a href=&quot;http://mac.github.com/&quot;&gt;http://mac.github.com/&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
This GIT BOOK rocks, of course, the github help&lt;br /&gt;
&lt;a href=&quot;http://git-scm.com/book&quot;&gt;http://git-scm.com/book&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;https://help.github.com/&quot;&gt;https://help.github.com&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here&#39;s another trick, if you want to go to previous commit, but keep all the changes:&lt;br /&gt;
&lt;a href=&quot;http://stackoverflow.com/questions/4114095/git-revert-to-previous-commit-how&quot;&gt;http://stackoverflow.com/questions/4114095/git-revert-to-previous-commit-how&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 0px; font-family: Consolas, Menlo, Monaco, &#39;Lucida Console&#39;, &#39;Liberation Mono&#39;, &#39;DejaVu Sans Mono&#39;, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, monospace, serif; font-size: 14px; line-height: 18px; margin-bottom: 10px; max-height: 600px; overflow: auto; padding: 5px; vertical-align: baseline; width: auto;&quot;&gt;&lt;code style=&quot;border: 0px; font-family: Consolas, Menlo, Monaco, &#39;Lucida Console&#39;, &#39;Liberation Mono&#39;, &#39;DejaVu Sans Mono&#39;, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, monospace, serif; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;# This will destroy any local modifications
# Don&#39;t do it if you have uncommitted work you want to keep
git reset --hard 0d1d7fc32

# Alternatively, if there&#39;s work to keep:
git stash
git reset --hard 0d1d7fc32
git stash pop
# This saves the modifications, then reapplies that patch after resetting.
# You could get merge conflicts, if you&#39;ve modified things which were
# changed since the commit you reset to&lt;/code&gt;&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://swimminginbits.blogspot.com/feeds/1562841041057769000/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4859738021814147401/1562841041057769000' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4859738021814147401/posts/default/1562841041057769000'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4859738021814147401/posts/default/1562841041057769000'/><link rel='alternate' type='text/html' href='http://swimminginbits.blogspot.com/2013/01/getting-used-to-git-quick-note-from-svn.html' title='getting used to git, quick note from svn perspective'/><author><name>imoldcat</name><uri>http://www.blogger.com/profile/01007573997438480107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4859738021814147401.post-4840616540686407861</id><published>2013-01-27T19:12:00.000-05:00</published><updated>2013-01-27T19:12:46.411-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="markdown"/><category scheme="http://www.blogger.com/atom/ns#" term="sublime2"/><title type='text'>Quicknote for Markdown Format</title><content type='html'>There might be many good tutorials, the following one is nice:&lt;br /&gt;
&lt;br /&gt;
markdown the basics&lt;br /&gt;
http://daringfireball.net/projects/markdown/basics&lt;br /&gt;
&lt;br /&gt;
and wysiwyg editor&lt;br /&gt;
http://markable.in/editor/&lt;br /&gt;
&lt;br /&gt;
And also the Sublime 2 has a plugin called &lt;a href=&quot;https://github.com/revolunet/sublimetext-markdown-preview&quot;&gt;Markdown Preview&lt;/a&gt;, which is kinda handy to format the styles.</content><link rel='replies' type='application/atom+xml' href='http://swimminginbits.blogspot.com/feeds/4840616540686407861/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4859738021814147401/4840616540686407861' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4859738021814147401/posts/default/4840616540686407861'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4859738021814147401/posts/default/4840616540686407861'/><link rel='alternate' type='text/html' href='http://swimminginbits.blogspot.com/2013/01/quicknote-for-markdown-format.html' title='Quicknote for Markdown Format'/><author><name>imoldcat</name><uri>http://www.blogger.com/profile/01007573997438480107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4859738021814147401.post-4894791727572941428</id><published>2013-01-27T16:50:00.000-05:00</published><updated>2013-01-27T16:50:12.404-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="mac"/><category scheme="http://www.blogger.com/atom/ns#" term="virtualbox"/><title type='text'>ssh into virtualbox from mac</title><content type='html'>just a quick note.&lt;br /&gt;
&lt;br /&gt;
there&#39;re several ways to ssh into the local virtualbox instance.&lt;br /&gt;
&lt;br /&gt;
1. is setting the Networking setting to Bridged other than NAT that is set as default. &amp;nbsp;By doing so, the Bridged network setting will let the virtual box instance act like a physical machine and allocate ip address from the current network. So a ifconfig you can get the ip address.&lt;br /&gt;
-&amp;gt; this video is good enough to set it up :&amp;nbsp;http://www.youtube.com/watch?v=5BsShkcweIs&lt;br /&gt;
&lt;br /&gt;
2. but the Bridged network setting is not always working, due to different network infra one is using. Another way to do it is to set another network adapter (Adapter 2, e.g.) to Host-only Adapter. By doing so, a local network will be built in the host machine, which is always available no matter the network infra. So I&#39;d like to recommend this setting.&lt;br /&gt;
-&amp;gt; this post is well written but somewhat out of date:&amp;nbsp;http://muffinresearch.co.uk/archives/2010/02/08/howto-ssh-into-virtualbox-3-linux-guests/&lt;br /&gt;
&lt;br /&gt;
One thing to be aware is the vboxnet0 may not exist if going into the vm setting directly. If so, one needs to set it in the virtual box setting itself, which can be accessed in Preference .. &amp;gt; network, and click the +.</content><link rel='replies' type='application/atom+xml' href='http://swimminginbits.blogspot.com/feeds/4894791727572941428/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4859738021814147401/4894791727572941428' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4859738021814147401/posts/default/4894791727572941428'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4859738021814147401/posts/default/4894791727572941428'/><link rel='alternate' type='text/html' href='http://swimminginbits.blogspot.com/2013/01/ssh-into-virtualbox-from-mac.html' title='ssh into virtualbox from mac'/><author><name>imoldcat</name><uri>http://www.blogger.com/profile/01007573997438480107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4859738021814147401.post-7622229890086415689</id><published>2013-01-25T15:54:00.000-05:00</published><updated>2013-01-25T15:54:32.423-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="sublime2"/><category scheme="http://www.blogger.com/atom/ns#" term="ubuntu"/><title type='text'>Sublime 2, Package Control problem on Ubuntu 12.04 LTS</title><content type='html'>First of all, Package Control, and Sublime 2 are awesome tools. I used them for everyday coding in Mac, and Ubuntu nowadays. Basically because the environment is&amp;nbsp;heterogeneous, e.g. ruby, txt, html, js, css, java, groovy, shell, c++. In one data analytics research project, normally I will use several of those tools to make life easier. So drop the eclipse for a while.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I encountered the problem when using Package Control of Sublime 2 in Ubuntu 12.04.&lt;br /&gt;
&lt;br /&gt;
The package control install sub pane/window just don&#39;t show up, after the installation. You can find it in the &amp;nbsp;Control+Shift+P pane, but run it, gives you nothing. If I open Ctrl+` &amp;nbsp;console, the error is /tmp/tempxyz is not there.&lt;br /&gt;
&lt;br /&gt;
In the beginning, I thought it was the permission problem, as the ubuntu I&#39;m running lack of sudo permission. But it is not, as I can create the tmp files without using sudo.&lt;br /&gt;
&lt;br /&gt;
Then, I check the Preference: Package Control Setting : Default, and change the repository url from https to http, according to some forum, and it worked to show up the list of packages. However, when I try to download some plugin, it fails again, the error is the same in Ctr+` output, saying that /tmp/tempxyz is not there. But this time, I cannot just fix https to http, not to mentioning doing so it will bring in the men in the middle problem to run&amp;nbsp;arbitrary&amp;nbsp;python code!&lt;br /&gt;
&lt;br /&gt;
(I tried, actually, but it failed again, replace the url formed in&amp;nbsp;~/.config/sublime-text-2/Packages/Package Control/Package\ Control.py &amp;nbsp; to http always didn&#39;t solve the problem)&lt;br /&gt;
&lt;br /&gt;
So I enable the debug mode in Package Control Setting, then the problem comes out. It is not the /tmp/ folder permission problem. But rather, the &#39;wget&#39; call caused error. The option:&amp;nbsp;--content-on-error &amp;nbsp;causes the wget cmd failed.&lt;br /&gt;
&lt;br /&gt;
To solve the problem, go to&lt;br /&gt;
~/.config/sublime-text-2/Packages/Package Control/Package\ Control.py&lt;br /&gt;
&lt;br /&gt;
Change the url construction part, drop that parameter. Everything works fine to install plugins.</content><link rel='replies' type='application/atom+xml' href='http://swimminginbits.blogspot.com/feeds/7622229890086415689/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4859738021814147401/7622229890086415689' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4859738021814147401/posts/default/7622229890086415689'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4859738021814147401/posts/default/7622229890086415689'/><link rel='alternate' type='text/html' href='http://swimminginbits.blogspot.com/2013/01/sublime-2-package-control-problem-on.html' title='Sublime 2, Package Control problem on Ubuntu 12.04 LTS'/><author><name>imoldcat</name><uri>http://www.blogger.com/profile/01007573997438480107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4859738021814147401.post-2348038695677703857</id><published>2012-08-09T01:10:00.000-04:00</published><updated>2012-08-09T01:10:05.092-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="mac"/><title type='text'>quick memo of mounting sftp in mac os x</title><content type='html'>get a easier management of remote files using sftp on mac:&lt;br /&gt;
&lt;br /&gt;
install macfuse:&amp;nbsp;http://www.tuxera.com/mac/macfuse-core-10.5-2.1.9.dmg&lt;br /&gt;
install macfusion app:&amp;nbsp;http://macfusionapp.org/&lt;br /&gt;
&lt;br /&gt;
if the first link is dead, using osxfuse:&amp;nbsp;http://osxfuse.github.com/ by clicking compliance with macfuse.&lt;br /&gt;
&lt;br /&gt;
open macfusion app, setup the details of ssh connection. and click mount. if error occurs, try to view the log.</content><link rel='replies' type='application/atom+xml' href='http://swimminginbits.blogspot.com/feeds/2348038695677703857/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4859738021814147401/2348038695677703857' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4859738021814147401/posts/default/2348038695677703857'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4859738021814147401/posts/default/2348038695677703857'/><link rel='alternate' type='text/html' href='http://swimminginbits.blogspot.com/2012/08/quick-memo-of-mounting-sftp-in-mac-os-x.html' title='quick memo of mounting sftp in mac os x'/><author><name>imoldcat</name><uri>http://www.blogger.com/profile/01007573997438480107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4859738021814147401.post-3813552291761572487</id><published>2012-03-21T08:24:00.002-04:00</published><updated>2012-03-21T08:25:29.854-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ml"/><category scheme="http://www.blogger.com/atom/ns#" term="octave"/><category scheme="http://www.blogger.com/atom/ns#" term="ubuntu"/><title type='text'>Get the newest Octave to run in ubuntu</title><content type='html'>&amp;nbsp;just for a reminder here,&lt;br /&gt;
&lt;br /&gt;
octave, a useful tool for quick prototyping ml algorithms. ubuntu10.04 32 official depository version is 3.2. to use the newest version 3.6.x since 2012:&lt;br /&gt;
&lt;br /&gt;
wget&amp;nbsp;http://ubuntuone.com/6WX6polYRNXeJuBqVsCZvi&lt;br /&gt;
sudo apt-get build-dep octave3.2&lt;br /&gt;
sudo dpkg -i octave_3.6.1-1_i386.deb&lt;br /&gt;
&lt;br /&gt;
try to use: octave&lt;br /&gt;
&lt;br /&gt;
find other linux distributions and built images&lt;br /&gt;
&lt;a href=&quot;http://www.octave.org/wiki/index.php?title=Octave_for_GNU_Linux:_Binary_Octave_packages_for_GNU_Linux#Debian_Development_Sources&quot;&gt;octave wiki&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://swimminginbits.blogspot.com/feeds/3813552291761572487/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4859738021814147401/3813552291761572487' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4859738021814147401/posts/default/3813552291761572487'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4859738021814147401/posts/default/3813552291761572487'/><link rel='alternate' type='text/html' href='http://swimminginbits.blogspot.com/2012/03/get-newest-octave-to-run-in-ubuntu.html' title='Get the newest Octave to run in ubuntu'/><author><name>imoldcat</name><uri>http://www.blogger.com/profile/01007573997438480107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4859738021814147401.post-3543927005651941033</id><published>2011-12-26T03:15:00.001-05:00</published><updated>2011-12-26T05:09:47.746-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="encoding"/><category scheme="http://www.blogger.com/atom/ns#" term="mysql"/><category scheme="http://www.blogger.com/atom/ns#" term="ruby"/><category scheme="http://www.blogger.com/atom/ns#" term="web-extraction"/><title type='text'>Nokogiri &amp; Char encodings</title><content type='html'>Personally, Nokogiri is the best library for ruby to look into html structures, especially css-selector support rocks. However, when dealing with i18n webpages, char encoding is always painful for beginners.&lt;br /&gt;
&lt;br /&gt;
for a reminder, mark this page:&lt;br /&gt;
&lt;a href=&quot;http://stackoverflow.com/questions/2572396/nokogiri-open-uri-and-unicode-characters&quot;&gt;http://stackoverflow.com/questions/2572396/nokogiri-open-uri-and-unicode-characters&lt;/a&gt;&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
the following one works&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
difference is, open-uri read first and then feed into Nokogiri,&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
if feed directly, will result in hard encoding pain&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;pre class=&quot;lang-rb prettyprint&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Consolas, Menlo, Monaco, &#39;Lucida Console&#39;, &#39;Liberation Mono&#39;, &#39;DejaVu Sans Mono&#39;, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, monospace, serif; font-size: 14px; line-height: 18px; margin-bottom: 10px; max-height: 600px; overflow-x: auto; overflow-y: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; text-align: left; vertical-align: baseline; width: auto;&quot;&gt;&lt;code style=&quot;background-attachment: initial; background-clip: initial; background-color: #eeeeee; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Consolas, Menlo, Monaco, &#39;Lucida Console&#39;, &#39;Liberation Mono&#39;, &#39;DejaVu Sans Mono&#39;, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, monospace, serif; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;&lt;span class=&quot;com&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: grey; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;# encoding: UTF-8&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;
require &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: maroon; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;&#39;nokogiri&#39;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;
require &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: maroon; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;&#39;open-uri&#39;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;

html &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt; open&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: maroon; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;&#39;http://www.biblegateway.com/passage/?search=Mateo1-2&amp;amp;version=NVI&#39;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;
doc &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #2b91af; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;Nokogiri&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;HTML&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;read&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;
doc&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;encoding &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: maroon; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;&#39;utf-8&#39;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;
h52 &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt; doc&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;css&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: maroon; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;&#39;h5&#39;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;)[&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: maroon; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;text
puts h52&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt; h52&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;encoding&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt; h52 &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;==&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: maroon; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;&quot;Genealogía de Jesucristo&quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: grey; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;#=&amp;gt; Genealogía de Jesucristo&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: grey; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;#=&amp;gt; UTF-8&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: grey; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;#=&amp;gt; true&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div&gt;
When inserting into mysql without going through rails, but mysql gem, set the UTF8&amp;nbsp;specifically&amp;nbsp;is mandatory:&lt;br /&gt;
&lt;br /&gt;
this page describes this in detail:&lt;br /&gt;
&lt;a href=&quot;http://wiki.a2hosting.com/index.php/UTF-8_MySQL_connections_with_Ruby&quot;&gt;http://wiki.a2hosting.com/index.php/UTF-8_MySQL_connections_with_Ruby&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white; border-bottom-color: rgb(47, 111, 171); border-bottom-style: dashed; border-bottom-width: 1px; border-left-color: rgb(47, 111, 171); border-left-style: dashed; border-left-width: 1px; border-right-color: rgb(47, 111, 171); border-right-style: dashed; border-right-width: 1px; border-top-color: rgb(47, 111, 171); border-top-style: dashed; border-top-width: 1px; line-height: 1.1em; padding-bottom: 1em; padding-left: 1em; padding-right: 1em; padding-top: 1em;&quot;&gt;db = Mysql.init
db.options(Mysql::SET_CHARSET_NAME, &#39;utf8&#39;)
db.real_connect(&#39;host&#39;, &#39;user&#39;, &#39;password&#39;, &#39;database&#39;, 3306, &#39;/usr/local/lib/mysql.sock&#39;)
db.query(&quot;SET NAMES utf8&quot;)&lt;/pre&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://swimminginbits.blogspot.com/feeds/3543927005651941033/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4859738021814147401/3543927005651941033' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4859738021814147401/posts/default/3543927005651941033'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4859738021814147401/posts/default/3543927005651941033'/><link rel='alternate' type='text/html' href='http://swimminginbits.blogspot.com/2011/12/nokogiri-char-encodings.html' title='Nokogiri &amp; Char encodings'/><author><name>imoldcat</name><uri>http://www.blogger.com/profile/01007573997438480107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4859738021814147401.post-882599329495400957</id><published>2011-11-07T21:00:00.000-05:00</published><updated>2011-11-07T21:00:26.301-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="java"/><title type='text'>java generic stuff memo</title><content type='html'>&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;b&gt;1. all generic derived classes share one static object&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
-&amp;gt; as jvm will not separately construct generic classes&lt;/div&gt;
&lt;div&gt;
e.g. Employee&lt;t&gt;, is the template&lt;/t&gt;&lt;/div&gt;
&lt;div&gt;
Employee&lt;developer&gt;, Employee&lt;designer&gt;, are the same class Employee in JVM&lt;/designer&gt;&lt;/developer&gt;&lt;/div&gt;
&lt;div&gt;
thus, assuming Employee&lt;t&gt; has a static field, say counter, &lt;/t&gt;&lt;/div&gt;
&lt;div&gt;
then increase the &lt;b&gt;&lt;i&gt;counter &lt;/i&gt;&lt;/b&gt;in Employee&lt;developer&gt;, then Employee&lt;designer&gt; will have the updated &lt;b&gt;&lt;i&gt;counter &lt;/i&gt;&lt;/b&gt;too. (actually, only one counter)&lt;/designer&gt;&lt;/developer&gt;&lt;/div&gt;
&lt;div&gt;
see: &lt;a href=&quot;http://www.angelikalanger.com/GenericsFAQ/FAQSections/TypeParameters.html#Is there one instances of a static field per instantiation of a parameterized type?&quot;&gt;http://www.angelikalanger.com/GenericsFAQ/FAQSections/TypeParameters.html#Is there one instances of a static field per instantiation of a parameterized type?&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium;&quot;&gt;&lt;b&gt;2. need tricks to get the runtime template class object&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
say Employee&lt;t&gt; has a function, Class&lt;t&gt; getEmployeeType(), &lt;/t&gt;&lt;/t&gt;&lt;/div&gt;
&lt;div&gt;
it&#39;s not trivial to implement the function, and get the Class&lt;t&gt;. &lt;/t&gt;&lt;/div&gt;
&lt;div&gt;
- one way to walk around is : Class&lt;t&gt; getEmployeeType(Class curr_class)&lt;/t&gt;&lt;/div&gt;
&lt;div&gt;
- another way: &lt;a href=&quot;http://www.artima.com/weblogs/viewpost.jsp?thread=208860&quot;&gt;http://www.artima.com/weblogs/viewpost.jsp?thread=208860&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://swimminginbits.blogspot.com/feeds/882599329495400957/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4859738021814147401/882599329495400957' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4859738021814147401/posts/default/882599329495400957'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4859738021814147401/posts/default/882599329495400957'/><link rel='alternate' type='text/html' href='http://swimminginbits.blogspot.com/2011/11/java-generic-stuff-memo.html' title='java generic stuff memo'/><author><name>imoldcat</name><uri>http://www.blogger.com/profile/01007573997438480107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4859738021814147401.post-6667134563726113348</id><published>2011-11-07T20:59:00.001-05:00</published><updated>2011-11-07T21:00:05.469-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="ruby"/><title type='text'>tricky modulo operator</title><content type='html'>&lt;br /&gt;
&lt;div&gt;
&lt;table border=&quot;1&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;br /&gt;
&lt;div&gt;
in Ruby: &lt;/div&gt;
&lt;div&gt;
197%5 = 2&lt;/div&gt;
&lt;div&gt;
-197%5 = 3&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/td&gt;&lt;td&gt;&lt;div&gt;
in Java:&lt;/div&gt;
&lt;div&gt;
197%5 = 2&lt;/div&gt;
&lt;div&gt;
-197%5 = &lt;b&gt;-2&lt;/b&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
... ... &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://swimminginbits.blogspot.com/feeds/6667134563726113348/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4859738021814147401/6667134563726113348' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4859738021814147401/posts/default/6667134563726113348'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4859738021814147401/posts/default/6667134563726113348'/><link rel='alternate' type='text/html' href='http://swimminginbits.blogspot.com/2011/11/tricky-modulo-operator.html' title='tricky modulo operator'/><author><name>imoldcat</name><uri>http://www.blogger.com/profile/01007573997438480107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4859738021814147401.post-824632749713607843</id><published>2010-04-15T23:20:00.005-04:00</published><updated>2010-04-18T11:03:36.934-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="cpp"/><category scheme="http://www.blogger.com/atom/ns#" term="mingw"/><title type='text'>compile uuid ossp to dll and used it in VS</title><content type='html'>&lt;div&gt;Project these days requires cross-platform feature (.Net 4.0, Android 2.1, in house Linux and etc ...). Thus the common used components, we plan to use standard C. Thanks to so many open source libraries, they save us a lot of work. However, compiling and using *nix libraries to windows is a kind of craftsmanship. &lt;/div&gt;  &lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In the project, we need a uuid library. The only free &amp;amp; open &amp;amp; reliable solution probably is &lt;a href=&quot;http://www.ossp.org/pkg/lib/uuid/&quot;&gt;OSSP UUID&lt;/a&gt;.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I started with the newest version&lt;a href=&quot;ftp://ftp.ossp.org/pkg/lib/uuid/uuid-1.6.2.tar.gz&quot;&gt; uuid-1.6.2.tar.gz&lt;/a&gt; with mingw @ a windows xp sp3 pc. I did not use cygwin, due to the license problem. &lt;/div&gt;  &lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;1. routine job &lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;, monospace;&quot;&gt;./configure&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;, monospace;&quot;&gt;make&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;, monospace;&quot;&gt;make check&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt; It does not generate any dynamic library, but a static one, libuuid.a &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;2. generate dll&lt;/b&gt;&lt;/div&gt;  &lt;div&gt;well, by reading the stdout make process, i tried&lt;/div&gt;&lt;div&gt;&lt;b&gt;2.1 get dll &amp;amp; def&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;/b&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;, monospace;&quot;&gt; gcc -shared -o uuid-ossp.dll uuid.o uuid_md5.o uuid_sha1.o uuid_prng.o uuid_mac.o uuid_time.o uuid_ui64.o uuid_ui128.o uuid_str.o -Wl,--output-def,uuid.dll.def&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;2.2 get lib&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;, monospace;&quot;&gt;dlltool -d uuid.dll.def --dllname uuid-ossp.dll --output-lib uuid-ossp.lib&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;  &lt;div&gt;&lt;b&gt;2.3 test it with the command line tool uuid_cli.c&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;, monospace;&quot;&gt;gcc -I . uuid_cli.c -o uuid.exe uuid_ossp.lib&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  everything works so well, the command line uuid.exe generated really works. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;3. decide how to use and what do we need&lt;/b&gt;&lt;/div&gt;&lt;div&gt;sadly, this library, i could not find related API documents. &lt;/div&gt;  &lt;div&gt;what i need is just to generate the uuid, by reading uuid_cli.c, i got some hint, here&#39;s a simple &lt;b&gt;example.c&lt;/b&gt;, after cropping the uuid_cli.c to generate a version 1 uuid. &lt;/div&gt;&lt;pre&gt;#include &quot;uuid.h&quot;&lt;br /&gt;#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;&lt;br /&gt;int main(int argc, char *argv[])&lt;br /&gt;{&lt;br /&gt;uuid_t *uuid;&lt;br /&gt;uuid_rc_t rc;&lt;br /&gt;char *vp;&lt;br /&gt;size_t n;&lt;br /&gt;unsigned int version;&lt;br /&gt;&lt;br /&gt;version = UUID_MAKE_V1;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;if ((rc = uuid_create(&amp;amp;uuid)) != UUID_RC_OK)&lt;br /&gt; printf(&quot;uuid_create error&quot;);&lt;br /&gt;&lt;br /&gt;if ((rc = uuid_make(uuid, version)) != UUID_RC_OK)&lt;br /&gt; printf(&quot;uuid_make error&quot;);&lt;br /&gt;&lt;br /&gt;vp = NULL;&lt;br /&gt;if ((rc = uuid_export(uuid, UUID_FMT_STR, &amp;amp;vp, &amp;amp;n)) != UUID_RC_OK)&lt;br /&gt; printf(&quot;uuid_export error&quot;);&lt;br /&gt;if (vp)&lt;br /&gt;printf(&quot;%s\n&quot;, vp);&lt;br /&gt;free(vp);&lt;br /&gt;&lt;br /&gt;if ((rc = uuid_destroy(uuid)) != UUID_RC_OK)&lt;br /&gt; printf(&quot;uuid_destroy error&quot;);&lt;br /&gt;&lt;br /&gt;return 0;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;div&gt;&lt;div&gt;The code works well, and can link to the dll well. The only header file we need it uuid.h, no aother uuid*.h needed&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;4. used in Visual Studio&lt;/b&gt;&lt;/div&gt;  &lt;div&gt;in the visual studio project, configure the project by using the uuid-ossp.lib, and include the uuid.h in the search path. copy the example.c into the project. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;compile and run, oops ...&lt;/div&gt;  &lt;div&gt;&lt;b&gt;4.1 uuid.h &lt;/b&gt;&lt;/div&gt;&lt;div&gt;the compiler complains the uuid.h include &amp;lt;unistd.h&amp;gt;, it can not find&lt;/div&gt;&lt;div&gt;sure, the file is in mingw include path. i tried, to include related mingw headers into the project. but i failed, with lots of compilation errors. &lt;/div&gt;  &lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;u&gt;&lt;b&gt;but you can safely delete this line from the uuid.h, i tried, everything works the same&lt;/b&gt;&lt;/u&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;4.2 heap error&lt;/b&gt;&lt;/div&gt;&lt;div&gt;cool, now, the compiler has no complain, but when run, the example.c get a runtime error, in the line&lt;/div&gt;  &lt;blockquote class=&quot;webkit-indent-blockquote&quot; style=&quot;margin: 0 0 0 40px; border: none; padding: 0px;&quot;&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;, monospace;&quot;&gt;free(vp);&lt;/span&gt;&lt;/div&gt;&lt;/blockquote&gt;I dig this for a while, and realized that , the vp is malloc-ed and free-ed by different memory malloc &amp;amp; free implementations. &lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;the workable program in mingw, should changed to the following, then, example.c can work fine now:&lt;/div&gt;&lt;div&gt;&lt;pre&gt;#include &quot;uuid.h&quot;&lt;br /&gt;#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;&lt;br /&gt;int main(int argc, char *argv[])&lt;br /&gt;{&lt;br /&gt;uuid_t *uuid;&lt;br /&gt;uuid_rc_t rc;&lt;br /&gt;char *vp;&lt;br /&gt;size_t n;&lt;br /&gt;unsigned int version;&lt;br /&gt;&lt;br /&gt;version = UUID_MAKE_V1;&lt;br /&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#FF0000;&quot;&gt;&lt;b&gt;n = 37;&lt;/b&gt;&lt;/span&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#FF0000;&quot;&gt;&lt;b&gt;vp = (char*)malloc(n);&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;if ((rc = uuid_create(&amp;amp;uuid)) != UUID_RC_OK)&lt;br /&gt;    printf(&quot;uuid_create error&quot;);&lt;br /&gt;&lt;br /&gt;if ((rc = uuid_make(uuid, version)) != UUID_RC_OK)&lt;br /&gt;    printf(&quot;uuid_make error&quot;);&lt;br /&gt;&lt;br /&gt;vp = NULL;&lt;br /&gt;if ((rc = uuid_export(uuid, UUID_FMT_STR, &amp;amp;vp, &amp;amp;n)) != UUID_RC_OK)&lt;br /&gt;    printf(&quot;uuid_export error&quot;);&lt;br /&gt;if (vp)&lt;br /&gt;  printf(&quot;%s\n&quot;, vp);&lt;br /&gt;free(vp);&lt;br /&gt;&lt;br /&gt;if ((rc = uuid_destroy(uuid)) != UUID_RC_OK)&lt;br /&gt;    printf(&quot;uuid_destroy error&quot;);&lt;br /&gt;&lt;br /&gt;return 0;&lt;br /&gt;}&lt;/pre&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;courier new&#39;, monospace;&quot;&gt;cool, everything works now. &lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://swimminginbits.blogspot.com/feeds/824632749713607843/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4859738021814147401/824632749713607843' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4859738021814147401/posts/default/824632749713607843'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4859738021814147401/posts/default/824632749713607843'/><link rel='alternate' type='text/html' href='http://swimminginbits.blogspot.com/2010/04/compile-uuid-ossp-to-dll-and-used-it-in.html' title='compile uuid ossp to dll and used it in VS'/><author><name>imoldcat</name><uri>http://www.blogger.com/profile/01007573997438480107</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry></feed>