<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <title>Kazuho at Work</title>
    <link rel="alternate" type="text/html" href="https://labs.cybozu.co.jp/blog/kazuhoatwork/" />
    <link rel="self" type="application/atom+xml" href="https://labs.cybozu.co.jp/blog/kazuhoatwork/atom.xml" />
   <id>tag:labs.cybozu.co.jp,2009:/blog/kazuhoatwork//1</id>
    <link rel="service.post" type="application/atom+xml" href="https://labs.cybozu.co.jp/cgi-bin/mt-admin-en/mt-atom.cgi/weblog/blog_id=1" title="Kazuho at Work" />
    <updated>2009-07-07T03:22:10Z</updated>
    <subtitle>Kazuho Oku&apos;s Blog in English (&amp;#26085;&amp;#26412;&amp;#35486;)</subtitle>
    <generator uri="http://www.sixapart.com/movabletype/">Movable Type 3.2</generator>
 
<entry>
    <title>Blog URL Changed</title>
    <link rel="alternate" type="text/html" href="https://labs.cybozu.co.jp/blog/kazuhoatwork/2009/07/blog_url_changed.php" />
    <link rel="service.edit" type="application/atom+xml" href="https://labs.cybozu.co.jp/cgi-bin/mt-admin-en/mt-atom.cgi/weblog/blog_id=1/entry_id=69" title="Blog URL Changed" />
    <id>tag:labs.cybozu.co.jp,2009:/blog/kazuhoatwork//1.69</id>
    
    <published>2009-07-07T03:20:08Z</published>
    <updated>2009-07-07T03:22:10Z</updated>
    
    <summary>Thank you for reading, the weblog has moved to developer.cybozu.co.jp/kazuho/in_english....</summary>
    <author>
        <name>kazuho</name>
        <uri>https://labs.cybozu.co.jp/blog/kazuhoatwork/</uri>
    </author>
            <category term="Miscellaneous" />
    
    <content type="html" xml:lang="en" xml:base="https://labs.cybozu.co.jp/blog/kazuhoatwork/">
        <![CDATA[Thank you for reading, the weblog has moved to <a href="http://developer.cybozu.co.jp/kazuho/in_english/">developer.cybozu.co.jp/kazuho/in_english</a>.]]>
        
    </content>
</entry>
<entry>
    <title>Running a Realtime Stats Service on MySQL (my slides at Percona Performance Conference)</title>
    <link rel="alternate" type="text/html" href="https://labs.cybozu.co.jp/blog/kazuhoatwork/2009/04/running_a_realtime_stats_servi.php" />
    <link rel="service.edit" type="application/atom+xml" href="https://labs.cybozu.co.jp/cgi-bin/mt-admin-en/mt-atom.cgi/weblog/blog_id=1/entry_id=68" title="Running a Realtime Stats Service on MySQL (my slides at Percona Performance Conference)" />
    <id>tag:labs.cybozu.co.jp,2009:/blog/kazuhoatwork//1.68</id>
    
    <published>2009-04-24T04:51:03Z</published>
    <updated>2009-04-24T05:03:29Z</updated>
    
    <summary>Today at Percona Performance Conference, I did my presentation on the optimizations / tweaks that I developed for running Pathtraq, one of Japan&apos;s largest web stats service. Thank you to people who listened, I hope you enjoyed my talk. And...</summary>
    <author>
        <name>kazuho</name>
        <uri>https://labs.cybozu.co.jp/blog/kazuhoatwork/</uri>
    </author>
            <category term="MySQL" />
            <category term="Q4M" />
    
    <content type="html" xml:lang="en" xml:base="https://labs.cybozu.co.jp/blog/kazuhoatwork/">
        <![CDATA[<p>Today at <a href="http://conferences.percona.com/">Percona Performance Conference</a>, I did my presentation on the optimizations / tweaks that I developed for running <a href="http://pathtraq.com/">Pathtraq</a>, one of Japan's largest web stats service.  Thank you to people who listened, I hope you enjoyed my talk.  And thank you to the people at Percona.  I have uploaded my slides to Slideshare.  So for more information, please refer to them.</p>]]>
        <![CDATA[<div style="width:425px;text-align:left" id="__ss_1335786"><a style="font:14px Helvetica,Arial,Sans-serif;display:block;margin:12px 0 3px 0;text-decoration:underline;" href="http://www.slideshare.net/kazuho/running-a-realtime-stats-service-on-mysql?type=presentation" title="Running a Realtime Stats Service on MySQL">Running a Realtime Stats Service on MySQL</a><object style="margin:0px" width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=pathtraq-mysqlcon09-2-090423235517-phpapp01&stripped_title=running-a-realtime-stats-service-on-mysql" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=pathtraq-mysqlcon09-2-090423235517-phpapp01&stripped_title=running-a-realtime-stats-service-on-mysql" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object><div style="font-size:11px;font-family:tahoma,arial;height:26px;padding-top:2px;">View more <a style="text-decoration:underline;" href="http://www.slideshare.net/">presentations</a> from <a style="text-decoration:underline;" href="http://www.slideshare.net/kazuho">kazuho</a>.</div></div>]]>
    </content>
</entry>
<entry>
    <title>Q4M Presentation Slides at MySQL Conference</title>
    <link rel="alternate" type="text/html" href="https://labs.cybozu.co.jp/blog/kazuhoatwork/2009/04/q4m_presentation_slides_at_mys.php" />
    <link rel="service.edit" type="application/atom+xml" href="https://labs.cybozu.co.jp/cgi-bin/mt-admin-en/mt-atom.cgi/weblog/blog_id=1/entry_id=67" title="Q4M Presentation Slides at MySQL Conference" />
    <id>tag:labs.cybozu.co.jp,2009:/blog/kazuhoatwork//1.67</id>
    
    <published>2009-04-23T02:45:03Z</published>
    <updated>2009-04-23T02:48:32Z</updated>
    
    <summary><![CDATA[Today at MySQL Conference &amp; Expro 2009, I did a presentation introducing / explaining Q4M. Thank you to people who came to listen. The presentation slides I used can be found on slideshare (slideshare)....]]></summary>
    <author>
        <name>kazuho</name>
        <uri>https://labs.cybozu.co.jp/blog/kazuhoatwork/</uri>
    </author>
            <category term="MySQL" />
            <category term="Q4M" />
    
    <content type="html" xml:lang="en" xml:base="https://labs.cybozu.co.jp/blog/kazuhoatwork/">
        <![CDATA[<p>Today at <a href="http://www.mysqlconf.com/mysql2009/">MySQL Conference &amp; Expro 2009</a>, I did a presentation introducing / explaining <a href="http://q4m.31tools.com/">Q4M</a>.  Thank you to people who came to listen.</p>

<p>The presentation slides I used can be found on slideshare (<a href="http://www.slideshare.net/kazuho/using-q4m-a-message-queue-storage-engine-for-mysql">slideshare</a>).</p>]]>
        <![CDATA[<div style="width:425px;text-align:left" id="__ss_1330398"><a style="font:14px Helvetica,Arial,Sans-serif;display:block;margin:12px 0 3px 0;text-decoration:underline;" href="http://www.slideshare.net/kazuho/using-q4m-a-message-queue-storage-engine-for-mysql?type=powerpoint" title="Using Q4M - a message queue storage engine for MySQL">Using Q4M - a message queue storage engine for MySQL</a><object style="margin:0px" width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=q4m-mysqlcon09-090422213727-phpapp01&stripped_title=using-q4m-a-message-queue-storage-engine-for-mysql" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=q4m-mysqlcon09-090422213727-phpapp01&stripped_title=using-q4m-a-message-queue-storage-engine-for-mysql" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object><div style="font-size:11px;font-family:tahoma,arial;height:26px;padding-top:2px;">View more <a style="text-decoration:underline;" href="http://www.slideshare.net/">presentations</a> from <a style="text-decoration:underline;" href="http://www.slideshare.net/kazuho">kazuho</a>.</div></div>

<p>Tomorrow (Apr 23) from 6:10pm, I will be doing another presentation at <a href="http://conferences.percona.com/percona-performance-conference-2009/">Percona Performance Conference</a>, held at the same location, to describe the techniques (mainly MySQL UDFs) used to squeeze maximum performance out from MySQL used in <a href="http://pathtraq.com/">Pathtraq</a>.  If you are interested, please come and see.</p>]]>
    </content>
</entry>
<entry>
    <title>Q4M (and Pathtraq) at MySQL Conference &amp; Expo 2009</title>
    <link rel="alternate" type="text/html" href="https://labs.cybozu.co.jp/blog/kazuhoatwork/2009/04/q4m_and_pathtraq_at_mysql_conf.php" />
    <link rel="service.edit" type="application/atom+xml" href="https://labs.cybozu.co.jp/cgi-bin/mt-admin-en/mt-atom.cgi/weblog/blog_id=1/entry_id=66" title="Q4M (and Pathtraq) at MySQL Conference &amp; Expo 2009" />
    <id>tag:labs.cybozu.co.jp,2009:/blog/kazuhoatwork//1.66</id>
    
    <published>2009-04-22T00:05:21Z</published>
    <updated>2009-04-22T00:09:55Z</updated>
    
    <summary>At MySQL Conference &amp; Expo 2009, I will be giving a presentation on Q4M tomorrow (Apr. 22) from 11:55am. If you are interested in using a simple, fast message queue as part of your system, please come to the session....</summary>
    <author>
        <name>kazuho</name>
        <uri>https://labs.cybozu.co.jp/blog/kazuhoatwork/</uri>
    </author>
            <category term="MySQL" />
            <category term="Q4M" />
    
    <content type="html" xml:lang="en" xml:base="https://labs.cybozu.co.jp/blog/kazuhoatwork/">
        <![CDATA[<p>At MySQL Conference & Expo 2009, I will be giving a presentation on <a href="http://q4m.31tools.com/">Q4M</a> tomorrow (Apr. 22) from 11:55am.  If you are interested in using a simple, fast message queue as part of your system, please come to the session.</p>

<p>Details: <a href="http://www.mysqlconf.com/mysql2009/public/schedule/detail/6839">Using Q4M: A Message Queue Storage Engine for MySQL</a></p>

<p>On the next day (Apr. 23), I will be doing another presentation at <a href="http://conferences.percona.com/">Percona Performance Conference</a>, held at the same location.  In the presentation, I will describe the techniques (mainly MySQL UDFs) used to squeeze maximum performance out from MySQL used in <a href="http://pathtraq.com/">Pathtraq</a>, one of the largest web access stats service in Japan.</p>

<p>Details: <a href="http://conferences.percona.com/percona-performance-conference-2009/schedule.html">Running a Realtime Stats Service on MySQL</a> (from 6:10pm)</p>

<p>I am looking forward to seeing you in the sessions.</p>]]>
        
    </content>
</entry>
<entry>
    <title>Q4M 0.8.5 released</title>
    <link rel="alternate" type="text/html" href="https://labs.cybozu.co.jp/blog/kazuhoatwork/2009/04/q4m_085_released.php" />
    <link rel="service.edit" type="application/atom+xml" href="https://labs.cybozu.co.jp/cgi-bin/mt-admin-en/mt-atom.cgi/weblog/blog_id=1/entry_id=65" title="Q4M 0.8.5 released" />
    <id>tag:labs.cybozu.co.jp,2009:/blog/kazuhoatwork//1.65</id>
    
    <published>2009-04-16T11:44:51Z</published>
    <updated>2009-04-16T11:46:21Z</updated>
    
    <summary>Q4M 0.8.5 is now downloadable from q4m.31tools.com. Prebuilt binaries for MySQL 5.1.33 running on linux (i386 or x86_64) and Mac OS X 10.5 (x86) are available as well. There are no bugfixes in this release. The only change from version...</summary>
    <author>
        <name>kazuho</name>
        <uri>https://labs.cybozu.co.jp/blog/kazuhoatwork/</uri>
    </author>
            <category term="MySQL" />
            <category term="Q4M" />
    
    <content type="html" xml:lang="en" xml:base="https://labs.cybozu.co.jp/blog/kazuhoatwork/">
        <![CDATA[<p>Q4M 0.8.5 is now downloadable from <a href="http://q4m.31tools.com/">q4m.31tools.com</a>. Prebuilt binaries for <a href="http://dev.mysql.com/">MySQL</a> 5.1.33 running on linux (i386 or x86_64) and Mac OS X 10.5 (x86) are available as well.</p>

<p>There are no bugfixes in this release.  The only change from version 0.8.4 is bundle of boost header files necessary for building Q4M.  The build process no more requires separate installation of the <a href="http://www.boost.org/">Boost C++ libraries</a>.</p>]]>
        
    </content>
</entry>
<entry>
    <title>Q4M 0.8.4 released (with prebuilt binaries for MySQL 5.1.31)</title>
    <link rel="alternate" type="text/html" href="https://labs.cybozu.co.jp/blog/kazuhoatwork/2009/02/q4m_084_released_with_prebuilt.php" />
    <link rel="service.edit" type="application/atom+xml" href="https://labs.cybozu.co.jp/cgi-bin/mt-admin-en/mt-atom.cgi/weblog/blog_id=1/entry_id=64" title="Q4M 0.8.4 released (with prebuilt binaries for MySQL 5.1.31)" />
    <id>tag:labs.cybozu.co.jp,2009:/blog/kazuhoatwork//1.64</id>
    
    <published>2009-02-09T11:38:53Z</published>
    <updated>2009-02-09T11:39:39Z</updated>
    
    <summary>Today I have uploaded Q4M 0.8.4 to q4m.31tools.com. Prebuilt binaries for MySQL 5.1.31 running on linux (i386 or x86_64) and Mac OS X (x86) are available as well. The release fixes crash on linux (i386) systems when a table becomes...</summary>
    <author>
        <name>kazuho</name>
        <uri>https://labs.cybozu.co.jp/blog/kazuhoatwork/</uri>
    </author>
            <category term="MySQL" />
            <category term="Q4M" />
    
    <content type="html" xml:lang="en" xml:base="https://labs.cybozu.co.jp/blog/kazuhoatwork/">
        <![CDATA[<p>Today I have uploaded <a href="http://q4m.31tools.com/">Q4M</a> 0.8.4 to <a href="http://q4m.31tools.com/">q4m.31tools.com</a>.  Prebuilt binaries for MySQL 5.1.31 running on linux (i386 or x86_64) and Mac OS X (x86) are available as well.</p>

<p>The release fixes crash on linux (i386) systems when a table becomes larger than 2GB.  There are no changes for other platforms.</p>]]>
        
    </content>
</entry>
<entry>
    <title>Using O_DIRECT on Mac OS X </title>
    <link rel="alternate" type="text/html" href="https://labs.cybozu.co.jp/blog/kazuhoatwork/2009/02/using_o_direct_on_mac_os_x.php" />
    <link rel="service.edit" type="application/atom+xml" href="https://labs.cybozu.co.jp/cgi-bin/mt-admin-en/mt-atom.cgi/weblog/blog_id=1/entry_id=63" title="Using O_DIRECT on Mac OS X " />
    <id>tag:labs.cybozu.co.jp,2009:/blog/kazuhoatwork//1.63</id>
    
    <published>2009-02-05T09:53:27Z</published>
    <updated>2009-02-05T11:20:27Z</updated>
    
    <summary>Is there any reason for not supporting innodb_flush_method=O_DIRECT on Mac OS X? Today I wrote a tiny patch to enable O_DIRECT on MySQL running on Mac OS X, and it seems to work fine. (mysql-5.1.30-osx-o_direct.patch) Although I do not think...</summary>
    <author>
        <name>kazuho</name>
        <uri>https://labs.cybozu.co.jp/blog/kazuhoatwork/</uri>
    </author>
            <category term="MySQL" />
    
    <content type="html" xml:lang="en" xml:base="https://labs.cybozu.co.jp/blog/kazuhoatwork/">
        <![CDATA[<p>Is there any reason for not supporting <a href="http://dev.mysql.com/doc/refman/5.1/en/innodb-parameters.html#sysvar_innodb_flush_method">innodb_flush_method=O_DIRECT</a> on Mac OS X?  Today I wrote a tiny patch to enable O_DIRECT on MySQL running on Mac OS X, and it seems to work fine. (<a href="https://labs.cybozu.co.jp/blog/kazuhoatwork/2009/02/mysql-5.1.30-osx-o_direct.patch">mysql-5.1.30-osx-o_direct.patch</a>)</p>

<p>Although I do not think it is a good idea to use Mac OS X as a database server (since it's I/O system calls are slow compared to other OSes, at least until Snow Leopard is released), having O_DIRECT support would be better than none in some cases.</p>]]>
        
    </content>
</entry>
<entry>
    <title>Using Top N Sort on MySQL </title>
    <link rel="alternate" type="text/html" href="https://labs.cybozu.co.jp/blog/kazuhoatwork/2008/12/using_top_n_sort_on_mysql.php" />
    <link rel="service.edit" type="application/atom+xml" href="https://labs.cybozu.co.jp/cgi-bin/mt-admin-en/mt-atom.cgi/weblog/blog_id=1/entry_id=62" title="Using Top N Sort on MySQL " />
    <id>tag:labs.cybozu.co.jp,2008:/blog/kazuhoatwork//1.62</id>
    
    <published>2008-12-12T09:25:24Z</published>
    <updated>2008-12-12T09:28:53Z</updated>
    
    <summary> One of the best practices on using MySQL is to avoid filesort. However there are cases where it is inevitable (e.g. ordering the result of fulltext search by modification date), and although in most cases we only the top...</summary>
    <author>
        <name>kazuho</name>
        <uri>https://labs.cybozu.co.jp/blog/kazuhoatwork/</uri>
    </author>
            <category term="MySQL" />
    
    <content type="html" xml:lang="en" xml:base="https://labs.cybozu.co.jp/blog/kazuhoatwork/">
        <![CDATA[<p>
One of the best practices on using MySQL is to avoid filesort.  However there are cases where it is inevitable (e.g. ordering the result of fulltext search by modification date), and although in most cases we only the top N rows of sorted resultset are needed, MySQL does not implement top N sort.
</p>

<p>
After wondering for couple of months if I should hack the MySQL core to implement top-N-sort, today I decided to write a UDF that performs top N sort, and see how well it performs.  And here it is: <a href="http://coderepos.org/share/browser/platform/mysql/top-n-sort/top-n-sort.c">top-n-sort.c</a>.
</p>

<p>
First the benchmark.  When performing <i>order by 〜 limit</i> on an unindexed column of a 100k row table, top N sort is more than two times faster than the internal sort algorithm.
</p>

<pre style="border: 1px solid gray; margin: 0; padding: 0.5em; background: #eee; overflow: auto;">
mysql> SELECT id,priority FROM testsort ORDER BY priority LIMIT 10;
(snip)
10 rows in set (0.11 sec)

mysql> SELECT topn_get(v) AS id,topn_get_value(v) AS priority FROM int_seq WHERE v<(SELECT topn_set(10,id,priority) FROM testsort);
(snip)
10 rows in set (0.05 sec)
</pre>

<p>
The top-n-sort UDF consists of three functions, <i>topn_set</i>, <i>topn_get</i>, <i>topn_get_value</i>.
</p>

<p>
<i>Topn_set</i> function takes three arguments, number of top columns to preserve, id of the column, and sort value.  It is an aggregate function that returns the number of rows that should be returned.
</p>

<p>
<i>Topn_get</i> function returns the n-th id of the sort result, while <i>Topn_get_value</i> function returns the n-th value.
</p>

<p>
So combining the results of the UDFs with a table (<i>int_seq</i>) that holds a sequence of integers starting from zero, it is possible to perform a top N sort within a single query using the UDF functions.  And it is fast.
</p>

<p>
Next question will be whether I should add top N sort to MySQL by myself, now that I have proved there would be performance benefit?  For myself the UDF version seems satisfactory althougth the syntax is a bit complicated.
</p>]]>
        
    </content>
</entry>
<entry>
    <title>Benchmarking SSD for MySQL</title>
    <link rel="alternate" type="text/html" href="https://labs.cybozu.co.jp/blog/kazuhoatwork/2008/10/benchmarking_ssd_for_mysql.php" />
    <link rel="service.edit" type="application/atom+xml" href="https://labs.cybozu.co.jp/cgi-bin/mt-admin-en/mt-atom.cgi/weblog/blog_id=1/entry_id=61" title="Benchmarking SSD for MySQL" />
    <id>tag:labs.cybozu.co.jp,2008:/blog/kazuhoatwork//1.61</id>
    
    <published>2008-10-29T10:32:27Z</published>
    <updated>2008-10-29T11:40:03Z</updated>
    
    <summary>Today I bought Intel X25-M, to test its performance and consider if we could replace a HDD used in our slave database of Pathtraq with a solid state disk. Connecting the drive to a test server, I have just run...</summary>
    <author>
        <name>kazuho</name>
        <uri>https://labs.cybozu.co.jp/blog/kazuhoatwork/</uri>
    </author>
            <category term="MySQL" />
    
    <content type="html" xml:lang="en" xml:base="https://labs.cybozu.co.jp/blog/kazuhoatwork/">
        <![CDATA[<p>Today I bought <a href="http://support.intel.com/support/flash/pssd/X25M/index.htm">Intel X25-M</a>, to test its performance and consider if we could replace a HDD used in our slave database of <a href="http://pathtraq.com/">Pathtraq</a> with a solid state disk.  Connecting the drive to a test server, <b>I have just run a synthetic benchmark to check its performance for 16KB random access with O_DIRECT flag set, which is pretty similar to the access pattern we see in our daily InnoDB use</b>.</p>

<center>
<table border="1" style="border-color: gray; border-collapse: collapse;">
<caption>16KB Random Access</caption>
<tr>
<th></th>
<th>HDD (Maxtor 7L250S0)</th>
<th>SSD (Intel X25-M)</th>
<th>Ratio</th>
</tr>
<th>Read (MB/sec)</th>
<td align="right">2.64</td>
<td align="right">38.0</td>
<td align="right">1440%</td>
</tr>
<tr>
<th>Write (MB/sec)</th>
<td align="right">12.0</td>
<td align="right">46.4</td>
<td align="right">385%</td>
</tr>
<tr>
<th>Write (MB/sec, hdparm -W 0)</th>
<td align="right">1.91</td>
<td align="right">11.2</td>
<td align="right">585%</td>
</tr>
</table>
</center>

<p>Looks very promising.  I will post further results as I continue my benchmarks.</p>

<p>PS. For the test, I wrote <a href="https://labs.cybozu.co.jp/blog/kazuhoatwork/2008/10/randombench.cc">randombench.cc</a> (requires <a href="https://labs.cybozu.co.jp/blog/kazuhoatwork/2006/02/c-0_05.php">this wrapper</a> to run), and ran it with options <i>-b 16 -c 1 -f 102400 -l 1000</i>.</p>

<p>PS2. I have also checked by opening the disk as a raw device with <i>-c 4</i> to check if performance increases under higher concurrency (due to NCQ, etc.), but there were no improvements at least on our system.  (unfortunately we did not have XFS installed)</p>]]>
        
    </content>
</entry>
<entry>
    <title>Q4M prebuilt binaries for MySQL 5.1.28-rc</title>
    <link rel="alternate" type="text/html" href="https://labs.cybozu.co.jp/blog/kazuhoatwork/2008/10/q4m_prebuilt_binaries_for_mysq.php" />
    <link rel="service.edit" type="application/atom+xml" href="https://labs.cybozu.co.jp/cgi-bin/mt-admin-en/mt-atom.cgi/weblog/blog_id=1/entry_id=60" title="Q4M prebuilt binaries for MySQL 5.1.28-rc" />
    <id>tag:labs.cybozu.co.jp,2008:/blog/kazuhoatwork//1.60</id>
    
    <published>2008-10-23T10:39:01Z</published>
    <updated>2008-10-23T10:41:50Z</updated>
    
    <summary>I have uploaded prebuilt binaries of Q4M for MySQL 5.1.28-rc to http://q4m.31tools.com/dist/. For installation instructions, please refer to http://q4m.31tools.com/install.php....</summary>
    <author>
        <name>kazuho</name>
        <uri>https://labs.cybozu.co.jp/blog/kazuhoatwork/</uri>
    </author>
            <category term="MySQL" />
            <category term="Q4M" />
    
    <content type="html" xml:lang="en" xml:base="https://labs.cybozu.co.jp/blog/kazuhoatwork/">
        <![CDATA[<p>I have uploaded prebuilt binaries of <a href="http://q4m.31tools.com/">Q4M</a> for MySQL 5.1.28-rc to <a href="http://q4m.31tools.com/dist/">http://q4m.31tools.com/dist/</a>.  For installation instructions, please refer to <a href="http://q4m.31tools.com/install.php">http://q4m.31tools.com/install.php</a>.</p>]]>
        
    </content>
</entry>
<entry>
    <title>Greasemetal version 0.2 released</title>
    <link rel="alternate" type="text/html" href="https://labs.cybozu.co.jp/blog/kazuhoatwork/2008/09/greasemetal_version_02_release.php" />
    <link rel="service.edit" type="application/atom+xml" href="https://labs.cybozu.co.jp/cgi-bin/mt-admin-en/mt-atom.cgi/weblog/blog_id=1/entry_id=59" title="Greasemetal version 0.2 released" />
    <id>tag:labs.cybozu.co.jp,2008:/blog/kazuhoatwork//1.59</id>
    
    <published>2008-09-13T04:57:48Z</published>
    <updated>2008-09-16T22:49:24Z</updated>
    
    <summary> I have just uploaded version 0.2 of Greasemetal to greasemetal.31tools.com. I originally intended to add management UI for userscripts in the second release, but hearing the users&apos; request for improved compatibility with Greasemonkey, I changed my mind. The main...</summary>
    <author>
        <name>kazuho</name>
        <uri>https://labs.cybozu.co.jp/blog/kazuhoatwork/</uri>
    </author>
            <category term="Greasemetal" />
    
    <content type="html" xml:lang="en" xml:base="https://labs.cybozu.co.jp/blog/kazuhoatwork/">
        <![CDATA[<p>
I have just uploaded version 0.2 of Greasemetal to <a href="http://greasemetal.31tools.com/">greasemetal.31tools.com</a>.  I originally intended to add management UI for userscripts in the second release, but hearing the users' request for improved compatibility with <a href="http://www.greasespot.net/">Greasemonkey</a>, I changed my mind.  <b>The main focus of the release is to improve compatibility with Greasemonkey</b>.  The changes from version 0.1 are as follows.</p>]]>
        <![CDATA[<h3>Improved Compatibility with Greamemonkey</h3>

<p>
After the initial release a number of users requested support for <i>GM_*</i> functions, to improve compatibily with many existing userscripts written for Greasemonkey.  So in version 0.2, we have implemented following functions:
<ul>
<li>GM_log</li>
<li>GM_addStyle</li>
<li>GM_openInTab</li>
<li>unsafewindow</li>
</ul>
<i>GM_registerMenuCommand</i> is also defined as an empty function, so that scripts calling the function would at least not fail by its inexistence.  <i>Unsafewindow</i> simply refers to the <i>window</i> object, since there is no support for Greasemonkey functions that require higher security (<i>GM_xmlHttpRequest</i>, <i>GM_setValue</i>, <i>GM_getValue</i>).
</p>

<p>The functions were written by my colleague <a href="http://d.hatena.ne.jp/amachang/">Amachang</a>.  He is the developer of a Javascript-based presentation tool <a href="http://asiajin.com/blog/2008/05/21/report-jui-javascript-user-interface-2008-conference-in-tokyo/">S6</a> (<a href="http://amachang.art-code.org/pr/">an example</a>) and <a href="http://coderepos.org/share/wiki/JavaScript-XPath">JavaScript-XPath</a>.</p>

<h3>Execution Log of Userscripts</h3>

<p>
Greasemetal will write execution log of userscripts to the inspection window (to open the window, right click anywhere in the browser window and select <i>Inspect</i>).  Greasemetal logs which userscripts are executed, and names the ones that failed and the reason why.  Unfortunately the line number at where the error occured cannot be logged, but still I hope it would be helpful for developers makeing their userscripts compatibile with Greasemetal.
</p>

<h3>Suppress Unnecessary Error Logs</h3>

<p>
The <i>debug.log</i> file is no more generated.  If you find one next to <i>Greasemetal.exe</i>, you are free to remove it.  Also you would no more see the error message "Uncaught TypeError: Cannot call method 'setAutomationId' of undefined" in the inspection window increasing forever (although you would see one message per tab, it's inevitable).
</p>

<h3>Passing Command Line Arguments to Google Chrome</h3>

<p>
Command line arguments following " - " are passed to <a href="http://www.google.com/chrome/">Google Chrome</a>.  For example, command below will start Google Chrome with Greasemetal but without displaying images.
<pre style="border: 1px solid gray; margin: 0; padding: 0.5em; background: #eee;">
> Greasemetal.exe - --disable-images
</pre>
</p>

<h3>Possibility of Supporting other <i>GM_*</i> Functions and Security Implications</h3>

<p>
<b>4:43pm added:</b> Now that we have added support for some <i>GM_*</i> functions, the left ones are: <i>GM_xmlHttpRequest</i>, <i>GM_getValue</i>, and <i>GM_setValue</i>.  The three functions require a different security model than that of ordinal web scripts (known as same domain policy).  Even if we dismissed the pontential danger of not supporting a non-<i>safeWindow</i>, the functions will require a secure channel from userscripts to the internal web server of Greasemetal (that malicious web sites cannot intervene), for storing and accessing persistent data, or performing cross-domain access through the web server.  However, since there is no way to enforce the order of JavaScript execution so that the script injected by Greasemetal is run before any scripts on a web page gets executed, it is difficult to create such a channel (a malicious web page might redefine necessary functions for communication, such as <i>document.createElement</i>).  In other words, it would be mandatory to implement an encrypted channel (with replay attack-resistency) between the injected JavaScript and the web server, however it would require some ammount of engineering.
</p>

<p>
This is our current understanding on the technical aspects of supporting the functions, and thus, until these situation changes, we have little (if not any) interest in implementing them.
</p>]]>
    </content>
</entry>
<entry>
    <title>Greasemetal - the next step</title>
    <link rel="alternate" type="text/html" href="https://labs.cybozu.co.jp/blog/kazuhoatwork/2008/09/greasemetal_the_next_step.php" />
    <link rel="service.edit" type="application/atom+xml" href="https://labs.cybozu.co.jp/cgi-bin/mt-admin-en/mt-atom.cgi/weblog/blog_id=1/entry_id=58" title="Greasemetal - the next step" />
    <id>tag:labs.cybozu.co.jp,2008:/blog/kazuhoatwork//1.58</id>
    
    <published>2008-09-11T06:13:03Z</published>
    <updated>2008-09-12T08:15:19Z</updated>
    
    <summary>Thank you to all, the release of Greasemetal seems to have been successful. Looking at the responses, I plan to do the following in the next release: eliminate generation of unnecessary log files and error messages (as much as possible)...</summary>
    <author>
        <name>kazuho</name>
        <uri>https://labs.cybozu.co.jp/blog/kazuhoatwork/</uri>
    </author>
            <category term="Greasemetal" />
    
    <content type="html" xml:lang="en" xml:base="https://labs.cybozu.co.jp/blog/kazuhoatwork/">
        <![CDATA[<p>Thank you to all, the release of <a href="http://greasemetal.31tools.com/">Greasemetal</a> seems to have been successful.  Looking at the responses, I plan to do the following in the next release:
<ul>
<li>eliminate generation of unnecessary log files and error messages (as much as possible)</li>
<li>add management UI for userscripts</li>
<li>add some kind of error logging for debugging userscripts</li>
</ul>
</p>

<p>I hope I can release it soon.</p>

<p><b>Sep 12 5:12pm:</b> We plan to add support for most <i>GM_*</i> functions, if not all of them (it might not be in the next release, though).</p>]]>
        
    </content>
</entry>
<entry>
    <title>Greasemetal - a userscript runtime for Google Chrome</title>
    <link rel="alternate" type="text/html" href="https://labs.cybozu.co.jp/blog/kazuhoatwork/2008/09/greasemetal.php" />
    <link rel="service.edit" type="application/atom+xml" href="https://labs.cybozu.co.jp/cgi-bin/mt-admin-en/mt-atom.cgi/weblog/blog_id=1/entry_id=57" title="Greasemetal - a userscript runtime for Google Chrome" />
    <id>tag:labs.cybozu.co.jp,2008:/blog/kazuhoatwork//1.57</id>
    
    <published>2008-09-10T02:48:31Z</published>
    <updated>2008-09-10T02:50:22Z</updated>
    
    <summary>For more than two years, I have been using Firefox. And Greasemonkey. Then, last week, came Google Chrome. It was at the moment I tried the new browser that I suddenly noticed I could no more live without userscripts (especially,...</summary>
    <author>
        <name>kazuho</name>
        <uri>https://labs.cybozu.co.jp/blog/kazuhoatwork/</uri>
    </author>
            <category term="Greasemetal" />
    
    <content type="html" xml:lang="en" xml:base="https://labs.cybozu.co.jp/blog/kazuhoatwork/">
        <![CDATA[<p>For more than two years, I have been using <a href="http://www.mozilla.com/">Firefox</a>.  And <a href="http://www.greasespot.net/">Greasemonkey</a>.  Then, last week, came <a href="http://www.google.com/chrome/">Google Chrome</a>.  It was at the moment I tried the new browser that I suddenly noticed I could no more live without userscripts (especially, AutoPagerize).  So I started looking into the source code of Google Chrome, and found out a way to implement a userscript runtime.  And that's Greasemetal.  It is now available from the link below.</p>

<div style="text-align: center; font-weight: bold;">
<a href="http://greasemetal.31tools.com/">http://greasemetal.31tools.com/</a>
</div>

<p>
Technically, Greasemetal executes userscripts in the following steps.
<ol>
<li>setup a local web server that sends userscripts to Google Chrome</li>
<li>launch Google Chrome specifying the browser to connect its <i>AutomationProxy</i> (an interprocess communication channel of the web browser implemented for automated UI tests) to Greasemetal</li>
<li>periodically execute JavaScript in each browser tab that inserts &lt;script&gt; tags to download necessary userscripts from the local web server</li>
</ol>
As can be seen, since the entire userscript is run at the browser level, there is no support for <i>GM_*</i> functions (they require userscripts to be executed under a previleged environment for security reasons).  In other word, some userscripts that rely on Greasemonkey-specific features would not work on Greasemetal.  Userscripts compatible with Safari (or Opera) would mostly work.
</p>

<p>
The userscripts I checked and found compatible are;
<ul>
<li><a href="http://mylingual.net/">Mylingual</a> and <a href="http://japanize.31tools.com/index.cgi/wiki?_name=User%20Javascript">Japanize</a> - a community-based web UI localization service</li>
<li><a href="http://d.hatena.ne.jp/os0x/20071202/oautopagerize">oAutoPagerize</a> - a port of <a href="http://userscripts.org/scripts/show/8551">AutoPagerize</a> (the Safari version seems to be compatible with Greasemetal)</li>
</ul>
</p>

<p>
This is the first release of Greasemetal, and it still lacks a number of features (especially the UI for managing userscripts).  I hope I can release the next version early (hopefully a code-signed version), but if you find any bugs or have any suggestions, please let me know (although I am afraid I might not be able to answer to compatibility problems of each userscripts).  Anyway, have fun!
</p>]]>
        
    </content>
</entry>
<entry>
    <title>Q4M becomes part of FreeBSD Ports Collection</title>
    <link rel="alternate" type="text/html" href="https://labs.cybozu.co.jp/blog/kazuhoatwork/2008/09/q4m_becomes_part_of_freebsd_po.php" />
    <link rel="service.edit" type="application/atom+xml" href="https://labs.cybozu.co.jp/cgi-bin/mt-admin-en/mt-atom.cgi/weblog/blog_id=1/entry_id=56" title="Q4M becomes part of FreeBSD Ports Collection" />
    <id>tag:labs.cybozu.co.jp,2008:/blog/kazuhoatwork//1.56</id>
    
    <published>2008-09-03T01:15:17Z</published>
    <updated>2008-09-03T01:20:22Z</updated>
    
    <summary>Thanks to Akinori MUSHA, Q4M has become part of the FreeBSD Ports Collection. If you are using FreeBSD, Q4M can be installed by following the steps below. # cd /usr/ports/databases/mysql-q4m # make install # echo &apos;mysql_enable=&quot;YES&quot;&apos; &gt;&gt; /etc/rc.conf # /usr/local/etc/rc.d/mysql-server...</summary>
    <author>
        <name>kazuho</name>
        <uri>https://labs.cybozu.co.jp/blog/kazuhoatwork/</uri>
    </author>
            <category term="MySQL" />
            <category term="Q4M" />
    
    <content type="html" xml:lang="en" xml:base="https://labs.cybozu.co.jp/blog/kazuhoatwork/">
        <![CDATA[<p>Thanks to <a href="http://twitter.com/knu">Akinori MUSHA</a>, <a href="http://q4m.31tools.com/">Q4M</a> has become part of <a href="http://www.freebsd.org/ports/">the FreeBSD Ports Collection</a>.</p>

<p>If you are using FreeBSD, Q4M can be installed by following the steps below.</p>

<pre style="border: 1px solid gray; margin: 0; padding: 0.5em; background: #eee;">
# cd /usr/ports/databases/mysql-q4m
# make install
# echo 'mysql_enable="YES"' >> /etc/rc.conf
# /usr/local/etc/rc.d/mysql-server start
# mysql -u root -f mysql < work/q4m-0.8.3/support-files/install.sql
</pre>

<p>Running either <i>cvsup</i> or <i>portsnap</i> might be necessary to update the installed ports collection to the newest state.  Since the port depends on <i>mysql51-server</i>, you should <i>make deinstall</i> if an older version of mysql is already installed via the ports collection.  If you want to test the installation, type:</p>

<pre style="border: 1px solid gray; margin: 0; padding: 0.5em; background: #eee;">
# chmod 755 work/q4m-0.8.3/support-files/q4m-forward
# make test
</pre>

<p>The <i>chmod</i> seems to be necessary due to the fact that the install script for non-executable files of the ports collection drops the execution bits.  Since there is no particular reason for keeping <i>q4m-forward</i> in the <i>support-files</i> directory, I plan to move it to somewhere else in the next release of Q4M.</p>]]>
        
    </content>
</entry>
<entry>
    <title>Release of Q4M 0.8.3 and support for FreeBSD</title>
    <link rel="alternate" type="text/html" href="https://labs.cybozu.co.jp/blog/kazuhoatwork/2008/09/q4m_0_8_3.php" />
    <link rel="service.edit" type="application/atom+xml" href="https://labs.cybozu.co.jp/cgi-bin/mt-admin-en/mt-atom.cgi/weblog/blog_id=1/entry_id=55" title="Release of Q4M 0.8.3 and support for FreeBSD" />
    <id>tag:labs.cybozu.co.jp,2008:/blog/kazuhoatwork//1.55</id>
    
    <published>2008-09-01T16:28:13Z</published>
    <updated>2008-09-01T16:56:06Z</updated>
    
    <summary> Q4M (Queue for MySQL) Version 0.8.3 has been released with following Changes. fix race condition error that might lead to deadlock on shutdown support for FreeBSD With support for FreeBSD added, prebuilt binaries are provided for the platforms below....</summary>
    <author>
        <name>kazuho</name>
        <uri>https://labs.cybozu.co.jp/blog/kazuhoatwork/</uri>
    </author>
            <category term="MySQL" />
            <category term="Q4M" />
    
    <content type="html" xml:lang="en" xml:base="https://labs.cybozu.co.jp/blog/kazuhoatwork/">
        <![CDATA[<p>
Q4M (Queue for MySQL) Version 0.8.3 has been released with following Changes.
<ul>
<li>fix race condition error that might lead to deadlock on shutdown</li>
<li>support for FreeBSD</li>
</ul>
With support for FreeBSD added, prebuilt binaries are provided for the platforms below.
<ul>
<li>linux (i386)</li>
<li>linux (x86_64)</li>
<li>freebsd-6 (i386) (should work on FreeBSD 7 as well with compat6x package installed)</li>
<li>Mac OS X 10.4 (x86)</li>
</ul>
</p>]]>
        
    </content>
</entry>

</feed> 

