<?xml version="1.0" encoding="utf-8" ?>

<rss version="2.0" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/"
   xmlns:content="http://purl.org/rss/1.0/modules/content/"
   >
<channel>
    
    <title>Pet Pixels - Comments</title>
    <link>http://marcus.bointon.com/</link>
    <description>Pet Pixels - Skiing, Baking, Biking, PHP, Email, Music, in variable order</description>
    <dc:language>en</dc:language>
    <admin:errorReportsTo rdf:resource="mailto:marcusblog@bointon.com" />
    <generator>Serendipity 1.5.5 - http://www.s9y.org/</generator>
    <pubDate>Tue, 07 Feb 2012 16:23:31 GMT</pubDate>

    <image>
        <url>http://marcus.bointon.com/templates/default/img/s9y_banner_small.png</url>
        <title>RSS: Pet Pixels - Comments - Pet Pixels - Skiing, Baking, Biking, PHP, Email, Music, in variable order</title>
        <link>http://marcus.bointon.com/</link>
        <width>100</width>
        <height>21</height>
    </image>

<item>
    <title>Marcus Bointon: PHP Base-62 encoding</title>
    <link>http://marcus.bointon.com/archives/92-PHP-Base-62-encoding.html#c462</link>
            <category></category>
    
    <comments>http://marcus.bointon.com/archives/92-PHP-Base-62-encoding.html#comments</comments>
    <wfw:comment>http://marcus.bointon.com/wfwcomment.php?cid=92</wfw:comment>

    

    <author>marcus@bointon.com (Marcus Bointon)</author>
    <content:encoded>
    Yes, your approach is almost identical to my original posting on experts exchange (you might like to use my digit generator function).
I&#039;d say this type of encoding uses base conversions. For example I would have no trouble writing a base-32 encoder using gmp - it&#039;s possible to treat the input in chunks and get exactly the same result as if you had treated the whole thing as a single multiprecision number.
However, you can&#039;t do it sensibly with base 62 because it will never fit into an exact number of bits, so you have to pad and chunk for a practical encoder. 
    </content:encoded>

    <pubDate>Thu, 11 Aug 2011 18:50:41 +0100</pubDate>
    <guid isPermaLink="false">http://marcus.bointon.com/archives/92-guid.html#c462</guid>
    
</item>
<item>
    <title>ircmaxell: PHP Base-62 encoding</title>
    <link>http://marcus.bointon.com/archives/92-PHP-Base-62-encoding.html#c461</link>
            <category></category>
    
    <comments>http://marcus.bointon.com/archives/92-PHP-Base-62-encoding.html#comments</comments>
    <wfw:comment>http://marcus.bointon.com/wfwcomment.php?cid=92</wfw:comment>

    

    <author>ircmaxell@gmail.com (ircmaxell)</author>
    <content:encoded>
    It&#039;s not the fastest thing in the world.  I&#039;m working on updating that now to make it at least a little more efficient.  (so far, I&#039;ve reduced the runtime by a factor of 4).

Also, it is exponential (O(n^2)).  So doubling n increases runtime by 4.

There are 2 problems with using the gmp function you specify.  First, it&#039;s not an actual base62 *encode*.  It&#039;s a base conversion between 16 and 62.  That&#039;s a very different task.  Encoding is taking an arbitrary string and converting it to a destination base.  That&#039;s what my function does.  gmp is unable to do that at all.  

The second problem, is that gmp only supports bases between 2 and 62.  I need to convert to other bases (namely 256) often.  So using it is sadly off the table for my needs... 
    </content:encoded>

    <pubDate>Thu, 11 Aug 2011 18:35:31 +0100</pubDate>
    <guid isPermaLink="false">http://marcus.bointon.com/archives/92-guid.html#c461</guid>
    
</item>
<item>
    <title>Marcus Bointon: PHP Base-62 encoding</title>
    <link>http://marcus.bointon.com/archives/92-PHP-Base-62-encoding.html#c460</link>
            <category></category>
    
    <comments>http://marcus.bointon.com/archives/92-PHP-Base-62-encoding.html#comments</comments>
    <wfw:comment>http://marcus.bointon.com/wfwcomment.php?cid=92</wfw:comment>

    

    <author>marcus@bointon.com (Marcus Bointon)</author>
    <content:encoded>
    Yep, the page titles kept spilling out too. Picked another theme that&#039;s a bit more readable. Nobody seems to be doing decent themes for s9y any more. 
    </content:encoded>

    <pubDate>Thu, 11 Aug 2011 18:34:24 +0100</pubDate>
    <guid isPermaLink="false">http://marcus.bointon.com/archives/92-guid.html#c460</guid>
    
</item>
<item>
    <title>M: PHP Base-62 encoding</title>
    <link>http://marcus.bointon.com/archives/92-PHP-Base-62-encoding.html#c456</link>
            <category></category>
    
    <comments>http://marcus.bointon.com/archives/92-PHP-Base-62-encoding.html#comments</comments>
    <wfw:comment>http://marcus.bointon.com/wfwcomment.php?cid=92</wfw:comment>

    

    <author>marcus@bointon.com (M)</author>
    <content:encoded>
    The coding colors u used in this website are terrible! use a white background vor the code pieces, my brains blow when i try to read this. 
    </content:encoded>

    <pubDate>Thu, 11 Aug 2011 17:48:38 +0100</pubDate>
    <guid isPermaLink="false">http://marcus.bointon.com/archives/92-guid.html#c456</guid>
    
</item>
<item>
    <title>Marcus Bointon: PHP Base-62 encoding</title>
    <link>http://marcus.bointon.com/archives/92-PHP-Base-62-encoding.html#c453</link>
            <category></category>
    
    <comments>http://marcus.bointon.com/archives/92-PHP-Base-62-encoding.html#comments</comments>
    <wfw:comment>http://marcus.bointon.com/wfwcomment.php?cid=92</wfw:comment>

    

    <author>marcus@bointon.com (Marcus Bointon)</author>
    <content:encoded>
    True, and that&#039;s mentioned on the PHP manual page. Doesn&#039;t affect me as you won&#039;t find me anywhere near either of those distros... :) 
    </content:encoded>

    <pubDate>Thu, 11 Aug 2011 12:16:03 +0100</pubDate>
    <guid isPermaLink="false">http://marcus.bointon.com/archives/92-guid.html#c453</guid>
    
</item>
<item>
    <title>Marcus Bointon: PHP Base-62 encoding</title>
    <link>http://marcus.bointon.com/archives/92-PHP-Base-62-encoding.html#c452</link>
            <category></category>
    
    <comments>http://marcus.bointon.com/archives/92-PHP-Base-62-encoding.html#comments</comments>
    <wfw:comment>http://marcus.bointon.com/wfwcomment.php?cid=92</wfw:comment>

    

    <author>marcus@bointon.com (Marcus Bointon)</author>
    <content:encoded>
    You&#039;re only the nth person to suggest that! There are no available base-64 encodings that are safe to use in all of URLs, domain names, pathnames and email addresses. Base-62 presents no opportunity for problems in any of those use cases (other than on a case-insensitive FS). This is why pretty much all of the url shorteners use base-62. 
    </content:encoded>

    <pubDate>Thu, 11 Aug 2011 12:13:42 +0100</pubDate>
    <guid isPermaLink="false">http://marcus.bointon.com/archives/92-guid.html#c452</guid>
    
</item>
<item>
    <title>Anonymous: PHP Base-62 encoding</title>
    <link>http://marcus.bointon.com/archives/92-PHP-Base-62-encoding.html#c451</link>
            <category></category>
    
    <comments>http://marcus.bointon.com/archives/92-PHP-Base-62-encoding.html#comments</comments>
    <wfw:comment>http://marcus.bointon.com/wfwcomment.php?cid=92</wfw:comment>

    

    <author>marcus@bointon.com ()</author>
    <content:encoded>
    Why not use base64-url encoding? 

Uses in - and _ insteaad of . and / respectively, and does away with = padding. 
    </content:encoded>

    <pubDate>Thu, 11 Aug 2011 11:26:07 +0100</pubDate>
    <guid isPermaLink="false">http://marcus.bointon.com/archives/92-guid.html#c451</guid>
    
</item>
<item>
    <title>John Carter: PHP Base-62 encoding</title>
    <link>http://marcus.bointon.com/archives/92-PHP-Base-62-encoding.html#c450</link>
            <category></category>
    
    <comments>http://marcus.bointon.com/archives/92-PHP-Base-62-encoding.html#comments</comments>
    <wfw:comment>http://marcus.bointon.com/wfwcomment.php?cid=92</wfw:comment>

    

    <author>comment@johnandlouise.com (John Carter)</author>
    <content:encoded>
    Note this requires your PHP to be compiled against GMP 4.2.0 or above. If not you&#039;re limited to base 36 with this trick. For example RHEL/Centos 5 PHP is compiled against an older version. 
    </content:encoded>

    <pubDate>Thu, 11 Aug 2011 11:07:26 +0100</pubDate>
    <guid isPermaLink="false">http://marcus.bointon.com/archives/92-guid.html#c450</guid>
    
</item>
<item>
    <title>Marcus Bointon: PHP Base-62 encoding</title>
    <link>http://marcus.bointon.com/archives/92-PHP-Base-62-encoding.html#c445</link>
            <category></category>
    
    <comments>http://marcus.bointon.com/archives/92-PHP-Base-62-encoding.html#comments</comments>
    <wfw:comment>http://marcus.bointon.com/wfwcomment.php?cid=92</wfw:comment>

    

    <author>marcus@bointon.com (Marcus Bointon)</author>
    <content:encoded>
    Apologies for my blog&#039;s comment formatting being so awful!

Thanks for the pointer, I gave it a try. Your approach is similar to my old one, and for short strings like hashes, it&#039;s about 160x slower than using gmp for me, so I&#039;d say it&#039;s worth special casing your base converter to trap more efficient conversions when possible.

I suspect the time it takes is exponential - while a 1k string took 0.4 sec, 2k took 1.6sec, 4k 6.5 etc. I tried it on a 32k string and gave up waiting for a result after 10 mins! For long strings, you can&#039;t treat it as a single number, you need to step through it in small chunks. FWIW the internal base64encode function does 32k in 0.000005 sec :)

Incidentally I noticed while trying it out that the gmp internal bases use [0-9A-Za-z] as their char pattern rather than [0-9a-zA-Z], which I guess makes sense as they are in ASCII order. 
    </content:encoded>

    <pubDate>Wed, 10 Aug 2011 23:31:20 +0100</pubDate>
    <guid isPermaLink="false">http://marcus.bointon.com/archives/92-guid.html#c445</guid>
    
</item>
<item>
    <title>ircmaxell: PHP Base-62 encoding</title>
    <link>http://marcus.bointon.com/archives/92-PHP-Base-62-encoding.html#c443</link>
            <category></category>
    
    <comments>http://marcus.bointon.com/archives/92-PHP-Base-62-encoding.html#comments</comments>
    <wfw:comment>http://marcus.bointon.com/wfwcomment.php?cid=92</wfw:comment>

    

    <author>ircmaxell@gmail.com (ircmaxell)</author>
    <content:encoded>
    I&#039;ve actually implemented this functionality more generically in my own PHP library (PHP CryptLib).  

https://github.com/ircmaxell/PHP-CryptLib/blob/master/lib/CryptLib/Core/BaseConverter.php

So to do base62 encode/decode:

&lt;div class=&quot;php geshi&quot; style=&quot;text-align: left&quot;&gt;&lt;br /&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$characters&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;&#039;0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ&#039;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$encoded&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; BaseConverter&lt;span style=&quot;color: #339933;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #004000;&quot;&gt;convertFromBinary&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$data&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$characters&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$decoded&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; BaseConverter&lt;span style=&quot;color: #339933;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #004000;&quot;&gt;convertToBinary&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$encoded&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$characters&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&amp;#160;&lt;/div&gt;

It will accept any binary data (base 256) including straight text, and output the properly encoded string...

Basically, the $characters list is just a list of the identifiers for a specific position.  For hex, you&#039;d use 0123456789abcdef, for binary you&#039;d use 01.  For octal, 012345678.  

It will handle arbitrary length data (I&#039;ve tested it out to about 5000 characters for the input, and all 256 possible bases)... 
    </content:encoded>

    <pubDate>Wed, 10 Aug 2011 22:26:36 +0100</pubDate>
    <guid isPermaLink="false">http://marcus.bointon.com/archives/92-guid.html#c443</guid>
    
</item>
<item>
    <title>Vadim (Percona): MySQL backups with Percona's XtraBackup</title>
    <link>http://marcus.bointon.com/archives/87-MySQL-backups-with-Perconas-XtraBackup.html#c427</link>
            <category></category>
    
    <comments>http://marcus.bointon.com/archives/87-MySQL-backups-with-Perconas-XtraBackup.html#comments</comments>
    <wfw:comment>http://marcus.bointon.com/wfwcomment.php?cid=87</wfw:comment>

    

    <author>vadim@percona.com (Vadim (Percona))</author>
    <content:encoded>
    And also I want to mention one more benefit over LVM.

With LVM you have to allocate 10-20% of total space for snapshot, but with xtrabackup you do not need that. On 500Gb-1TB sizes, 10-20% is good addition. 
    </content:encoded>

    <pubDate>Fri, 11 Sep 2009 19:49:53 +0100</pubDate>
    <guid isPermaLink="false">http://marcus.bointon.com/archives/87-guid.html#c427</guid>
    
</item>
<item>
    <title>Marcus Bointon: MySQL backups with Percona's XtraBackup</title>
    <link>http://marcus.bointon.com/archives/87-MySQL-backups-with-Perconas-XtraBackup.html#c426</link>
            <category></category>
    
    <comments>http://marcus.bointon.com/archives/87-MySQL-backups-with-Perconas-XtraBackup.html#comments</comments>
    <wfw:comment>http://marcus.bointon.com/wfwcomment.php?cid=87</wfw:comment>

    

    <author>marcus@bointon.com (Marcus Bointon)</author>
    <content:encoded>
    Thanks Vadim, I corrected it. 
    </content:encoded>

    <pubDate>Fri, 11 Sep 2009 18:51:48 +0100</pubDate>
    <guid isPermaLink="false">http://marcus.bointon.com/archives/87-guid.html#c426</guid>
    
</item>
<item>
    <title>Marcus Bointon: MySQL backups with Percona's XtraBackup</title>
    <link>http://marcus.bointon.com/archives/87-MySQL-backups-with-Perconas-XtraBackup.html#c425</link>
            <category></category>
    
    <comments>http://marcus.bointon.com/archives/87-MySQL-backups-with-Perconas-XtraBackup.html#comments</comments>
    <wfw:comment>http://marcus.bointon.com/wfwcomment.php?cid=87</wfw:comment>

    

    <author>marcus@bointon.com (Marcus Bointon)</author>
    <content:encoded>
    Thanks Peter! 
    </content:encoded>

    <pubDate>Fri, 11 Sep 2009 18:49:46 +0100</pubDate>
    <guid isPermaLink="false">http://marcus.bointon.com/archives/87-guid.html#c425</guid>
    
</item>
<item>
    <title>Vadim (Percona): MySQL backups with Percona's XtraBackup</title>
    <link>http://marcus.bointon.com/archives/87-MySQL-backups-with-Perconas-XtraBackup.html#c424</link>
            <category></category>
    
    <comments>http://marcus.bointon.com/archives/87-MySQL-backups-with-Perconas-XtraBackup.html#comments</comments>
    <wfw:comment>http://marcus.bointon.com/wfwcomment.php?cid=87</wfw:comment>

    

    <author>vadim@percona.com (Vadim (Percona))</author>
    <content:encoded>
    Thank you for great article and support of our tool!

I have small fix: about
&quot;2. Apply the current binary logs to them to bring into a consistent state at a known checkpoint&quot;

In real, the script does not work with binary logs, it applies innodb transactional logs.

Thanks again ! 
    </content:encoded>

    <pubDate>Fri, 11 Sep 2009 17:49:05 +0100</pubDate>
    <guid isPermaLink="false">http://marcus.bointon.com/archives/87-guid.html#c424</guid>
    
</item>
<item>
    <title>Peter Zaitsev: MySQL backups with Percona's XtraBackup</title>
    <link>http://marcus.bointon.com/archives/87-MySQL-backups-with-Perconas-XtraBackup.html#c423</link>
            <category></category>
    
    <comments>http://marcus.bointon.com/archives/87-MySQL-backups-with-Perconas-XtraBackup.html#comments</comments>
    <wfw:comment>http://marcus.bointon.com/wfwcomment.php?cid=87</wfw:comment>

    

    <author>pz@percona.com (Peter Zaitsev)</author>
    <content:encoded>
    Marcus,

Thank you for excellent article. 
    </content:encoded>

    <pubDate>Fri, 11 Sep 2009 17:24:49 +0100</pubDate>
    <guid isPermaLink="false">http://marcus.bointon.com/archives/87-guid.html#c423</guid>
    
</item>

</channel>
</rss>
