<?xml version="1.0" encoding="utf-8" ?>
<rss version="0.91">
<channel>
<title>sklar.com/blog</title>
<link>http://www.sklar.com/blog/</link>
<description>...composed of an indefinite, perhaps infinite number of hexagonal galleries...</description>
<language>en</language>
<image>
        <url>http://www.sklar.com/blog/templates/sklar-sm/img/s9y_banner_small.png</url>
        <title>RSS: sklar.com/blog - ...composed of an indefinite, perhaps infinite number of hexagonal galleries...</title>
        <link>http://www.sklar.com/blog/</link>
        <width>100</width>
        <height>21</height>
    </image>
<item>
    <title>Fast Multiple String Replacement in PHP</title>
    <link>http://www.sklar.com/blog/archives/122-Fast-Multiple-String-Replacement-in-PHP.html</link>
    <description>
        At work, we added a &lt;a href=&quot;http://www.sklar.com/blog/exit.php?url_id=433&amp;amp;entry_id=122&quot; title=&quot;http://blog.ning.com/2010/08/language-filter-live.html&quot; onmouseover=&quot;window.status='http://blog.ning.com/2010/08/language-filter-live.html';return true;&quot; onmouseout=&quot;window.status='';return true;&quot;&gt;language filter&lt;/a&gt; to Ning Pro last month. It lets Network Creators have naughty words (for the Network Creator's definition of &quot;naughty&quot;) replaced with * characters.&lt;br /&gt;
&lt;br /&gt;
A straightforward way to do this in PHP is to pass an array of words to look for and their replacements to a function like &lt;a href=&quot;http://www.sklar.com/blog/exit.php?url_id=434&amp;amp;entry_id=122&quot; title=&quot;http://php.net/str_replace&quot; onmouseover=&quot;window.status='http://php.net/str_replace';return true;&quot; onmouseout=&quot;window.status='';return true;&quot;&gt;str_replace()&lt;/a&gt; or &lt;a href=&quot;http://www.sklar.com/blog/exit.php?url_id=435&amp;amp;entry_id=122&quot; title=&quot;http://php.net/str_ireplace&quot; onmouseover=&quot;window.status='http://php.net/str_ireplace';return true;&quot; onmouseout=&quot;window.status='';return true;&quot;&gt;str_ireplace()&lt;/a&gt;. Or, similarly, use a regular expression that gloms the search terms together (and potentially checks word boundaries.) There are assorted &lt;a href=&quot;http://www.sklar.com/blog/exit.php?url_id=436&amp;amp;entry_id=122&quot; title=&quot;http://wordpress.org/extend/plugins/wp-content-filter&quot; onmouseover=&quot;window.status='http://wordpress.org/extend/plugins/wp-content-filter';return true;&quot; onmouseout=&quot;window.status='';return true;&quot;&gt;WordPress plugins&lt;/a&gt; that work like this.&lt;br /&gt;
&lt;br /&gt;
The problem with this approach is that it's really slow. Especially if you have a lot of words you're looking for. The amount of time it takes to do the search and replace grows in proportion to the number of words you're looking for. This is particularly unfortunate because usually, none of the words are ever found!&lt;br /&gt;
&lt;br /&gt;
For our language filter, we took a different approach. We've packaged it up into a PHP extension called &lt;a href=&quot;http://www.sklar.com/blog/exit.php?url_id=438&amp;amp;entry_id=122&quot; title=&quot;http://github.com/ning/boxwood&quot; onmouseover=&quot;window.status='http://github.com/ning/boxwood';return true;&quot; onmouseout=&quot;window.status='';return true;&quot;&gt;Boxwood&lt;/a&gt; and releasing it today as open source. (Find it on github: &lt;a href=&quot;http://www.sklar.com/blog/exit.php?url_id=438&amp;amp;entry_id=122&quot; title=&quot;http://github.com/ning/boxwood&quot; onmouseover=&quot;window.status='http://github.com/ning/boxwood';return true;&quot; onmouseout=&quot;window.status='';return true;&quot;&gt;http://github.com/ning/boxwood&lt;/a&gt;.)&lt;br /&gt;
&lt;br /&gt;
With Boxwood, you can have your list of search terms be as long as you like -- the search and replace algorithm doesn't get slower with more words on the list of words to look for. It works by building a &lt;a href=&quot;http://www.sklar.com/blog/exit.php?url_id=439&amp;amp;entry_id=122&quot; title=&quot;http://en.wikipedia.org/wiki/Trie&quot; onmouseover=&quot;window.status='http://en.wikipedia.org/wiki/Trie';return true;&quot; onmouseout=&quot;window.status='';return true;&quot;&gt;trie&lt;/a&gt; of all the search terms and then scans your subject text just once, walking down elements of the trie and comparing them to characters in your text. It supports US-ASCII and UTF-8, case-sensitive or insensitive matching, and has some English-centric word boundary checking logic.&lt;br /&gt;
&lt;br /&gt;
Take it for a drive and let us know what you think!    </description>
</item>
<item>
    <title>PHP Microbenchmarking</title>
    <link>http://www.sklar.com/blog/archives/121-PHP-Microbenchmarking.html</link>
    <description>
        I just posted on the &lt;a href=&quot;http://www.sklar.com/blog/exit.php?url_id=427&amp;amp;entry_id=121&quot; title=&quot;http://code.ning.com/2010/05/php-microbenchmarking/&quot; onmouseover=&quot;window.status='http://code.ning.com/2010/05/php-microbenchmarking/';return true;&quot; onmouseout=&quot;window.status='';return true;&quot;&gt;Ning code blog&lt;/a&gt; about the PHP microbenchmarking framework we released:&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;I'm pleased to announce the release of ub, a PHP microbenchmarking framework. You can download it from &lt;a href=&quot;http://www.sklar.com/blog/exit.php?url_id=428&amp;amp;entry_id=121&quot; title=&quot;http://github.com/ning/ub&quot; onmouseover=&quot;window.status='http://github.com/ning/ub';return true;&quot; onmouseout=&quot;window.status='';return true;&quot;&gt;http://github.com/ning/ub&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
The goal is to make it as easy as possible to compare the runtime of alternative approaches to the same problem, such as different regular expressions, or different methods for string or array manipulation.&lt;br /&gt;
&lt;br /&gt;
The source distribution contains a &lt;a href=&quot;http://www.sklar.com/blog/exit.php?url_id=429&amp;amp;entry_id=121&quot; title=&quot;http://github.com/ning/ub/blob/master/README&quot; onmouseover=&quot;window.status='http://github.com/ning/ub/blob/master/README';return true;&quot; onmouseout=&quot;window.status='';return true;&quot;&gt;README&lt;/a&gt; with some documentation and a bunch of &lt;a href=&quot;http://www.sklar.com/blog/exit.php?url_id=430&amp;amp;entry_id=121&quot; title=&quot;http://github.com/ning/ub/tree/master/b/&quot; onmouseover=&quot;window.status='http://github.com/ning/ub/tree/master/b/';return true;&quot; onmouseout=&quot;window.status='';return true;&quot;&gt;sample benchmarks&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
For normal use, it is rare that two similar, but different approaches produce appreciable differences in runtime. (Inefficient regexes and bloated call stacks aside.) The payoff from this kind of benchmarking is really on operations that happen hundreds or thousands of times in a request, or are happening on hundreds or thousands of servers. At that point, shaving off small amounts of runtime performance can really make a difference.&lt;br /&gt;
 &lt;br /&gt;
I am looking forward to beef up the set of included benchmarks -- contributions are welcome!&lt;/blockquote&gt;    </description>
</item>
<item>
    <title>ZendCon 2008: Static and Dynamic Analysis at Ning</title>
    <link>http://www.sklar.com/blog/archives/120-ZendCon-2008-Static-and-Dynamic-Analysis-at-Ning.html</link>
    <description>
        I presented my &lt;a href=&quot;http://www.sklar.com/blog/exit.php?url_id=425&amp;amp;entry_id=120&quot; title=&quot;http://www.zendcon.com/ZendCon08/public/schedule/detail/48&quot; onmouseover=&quot;window.status='http://www.zendcon.com/ZendCon08/public/schedule/detail/48';return true;&quot; onmouseout=&quot;window.status='';return true;&quot;&gt;Static and Dynamic Analysis at Ning&lt;/a&gt; talk today at the 2008 Zend/PHP Conference. The conference is much bigger this year than last, very exciting to see all the different things people are doing.&lt;br /&gt;
&lt;br /&gt;
The slides from my talk are available at &lt;a href=&quot;http://www.sklar.com/blog/exit.php?url_id=426&amp;amp;entry_id=120&quot; title=&quot;http://www.sklar.com/files/static-dynamic-analysis-zendcon-2008.pdf&quot; onmouseover=&quot;window.status='http://www.sklar.com/files/static-dynamic-analysis-zendcon-2008.pdf';return true;&quot; onmouseout=&quot;window.status='';return true;&quot;&gt;http://www.sklar.com/files/static-dynamic-analysis-zendcon-2008.pdf&lt;/a&gt; .    </description>
</item>
<item>
    <title>PHP + Emacs</title>
    <link>http://www.sklar.com/blog/archives/119-PHP-+-Emacs.html</link>
    <description>
        Here are some links that are related to the Editor/IDE panel I'm on today at the &lt;a href=&quot;http://www.sklar.com/blog/exit.php?url_id=423&amp;amp;entry_id=119&quot; title=&quot;http://www.dcphpconference.com/&quot; onmouseover=&quot;window.status='http://www.dcphpconference.com/';return true;&quot; onmouseout=&quot;window.status='';return true;&quot;&gt;2008 DC PHP Conference&lt;/a&gt;:&lt;br /&gt;
&lt;ul&gt;&lt;br /&gt;
&lt;li&gt;&lt;a href=&quot;http://www.sklar.com/blog/exit.php?url_id=424&amp;amp;entry_id=119&quot; title=&quot;http://trac.sakura.ne.jp/geben/&quot; onmouseover=&quot;window.status='http://trac.sakura.ne.jp/geben/';return true;&quot; onmouseout=&quot;window.status='';return true;&quot;&gt;GEBEN&lt;/a&gt; (interactive debugging)&lt;/li&gt;&lt;br /&gt;
&lt;li&gt;&lt;a href=&quot;http://www.sklar.com/blog/exit.php?url=aHR0cDovL3d3dy5lbWFjc3dpa2kub3JnL2NnaS1iaW4vd2lraS9OeGh0bWxNb2Rl&amp;amp;entry_id=119&quot; title=&quot;http://www.emacswiki.org/cgi-bin/wiki/NxhtmlMode&quot; onmouseover=&quot;window.status='http://www.emacswiki.org/cgi-bin/wiki/NxhtmlMode';return true;&quot; onmouseout=&quot;window.status='';return true;&quot;&gt;nxhtml-mode (php-mode, multiple major modes)&lt;/li&gt;&lt;br /&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;br /&gt;
    </description>
</item>
<item>
    <title>&quot;Little Bobby Tables&quot; vs. the US Government</title>
    <link>http://www.sklar.com/blog/archives/118-Little-Bobby-Tables-vs.-the-US-Government.html</link>
    <description>
        &lt;a href=&quot;http://www.sklar.com/blog/exit.php?url_id=419&amp;amp;entry_id=118&quot; title=&quot;http://shiflett.org&quot; onmouseover=&quot;window.status='http://shiflett.org';return true;&quot; onmouseout=&quot;window.status='';return true;&quot;&gt;Chris&lt;/a&gt; often cites &lt;a href=&quot;http://www.sklar.com/blog/exit.php?url_id=420&amp;amp;entry_id=118&quot; title=&quot;http://xkcd.com/327/&quot; onmouseover=&quot;window.status='http://xkcd.com/327/';return true;&quot; onmouseout=&quot;window.status='';return true;&quot;&gt;this xkcd&lt;/a&gt; cartoon in security talks, since it's a) funny and b) a good example of SQL Injection. &lt;br /&gt;
&lt;br /&gt;
I was curious to see what sorts of shenanigans one can get away with in a legal name. I'm still waiting to hear back from the &lt;a href=&quot;http://www.sklar.com/blog/exit.php?url_id=421&amp;amp;entry_id=118&quot; title=&quot;http://www.nyc.gov/html/doh/html/vr/vr.shtml&quot; onmouseover=&quot;window.status='http://www.nyc.gov/html/doh/html/vr/vr.shtml';return true;&quot; onmouseout=&quot;window.status='';return true;&quot;&gt;NYC agency that issues birth certificates&lt;/a&gt; but here's what the US Social Security Agency told me:&lt;br /&gt;
&lt;blockquote&gt;&lt;br /&gt;
The maximum number of characters to be shown on the Social Security number (SSN) card for the first and middle name is 26; the maximum number of characters for the last name is 26.  Full names will not be reduced to initials unless the combination of first and middle names exceeds 26 characters.  The only acceptable characters are alphas, hyphens, and apostrophes.  The SSN card will be printed as entered into the enumeration system, but the SSN record will not display the hyphens/apostrophes. &lt;br /&gt;
&lt;/blockquote&gt;&lt;br /&gt;
So with hyphens and apostrophes you might be able to get away with a little syntax error mischief, I suppose.&lt;br /&gt;
&lt;br /&gt;
Turns out the SSA has &lt;a href=&quot;http://www.sklar.com/blog/exit.php?url_id=422&amp;amp;entry_id=118&quot; title=&quot;https://secure.ssa.gov/apps10/poms.nsf/lnx/0100202105&quot; onmouseover=&quot;window.status='https://secure.ssa.gov/apps10/poms.nsf/lnx/0100202105';return true;&quot; onmouseout=&quot;window.status='';return true;&quot;&gt;really detailed public documentation&lt;/a&gt; of all their procedures.&lt;br /&gt;
    </description>
</item>
<item>
    <title>Prolific Name-Sources</title>
    <link>http://www.sklar.com/blog/archives/117-Prolific-Name-Sources.html</link>
    <description>
        I had never heard of &lt;a href=&quot;http://www.sklar.com/blog/exit.php?url_id=413&amp;amp;entry_id=117&quot; title=&quot;http://en.wikipedia.org/wiki/Haskell_Curry&quot; onmouseover=&quot;window.status='http://en.wikipedia.org/wiki/Haskell_Curry';return true;&quot; onmouseout=&quot;window.status='';return true;&quot;&gt;Haskell Curry&lt;/a&gt; before I read &lt;a href=&quot;http://www.sklar.com/blog/exit.php?url_id=414&amp;amp;entry_id=117&quot; title=&quot;http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-7.html&quot; onmouseover=&quot;window.status='http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-7.html';return true;&quot; onmouseout=&quot;window.status='';return true;&quot;&gt;the preface to SICP&lt;/a&gt; just now, but it occurs to me that his distinction of having each of his names (first and last) turned into a term used in the discipline he studied (&lt;a href=&quot;http://www.sklar.com/blog/exit.php?url_id=415&amp;amp;entry_id=117&quot; title=&quot;http://haskell.org/&quot; onmouseover=&quot;window.status='http://haskell.org/';return true;&quot; onmouseout=&quot;window.status='';return true;&quot;&gt;Haskell&lt;/a&gt; the programming language and &lt;a href=&quot;http://www.sklar.com/blog/exit.php?url_id=416&amp;amp;entry_id=117&quot; title=&quot;http://haskell.org/haskellwiki/Currying&quot; onmouseover=&quot;window.status='http://haskell.org/haskellwiki/Currying';return true;&quot; onmouseout=&quot;window.status='';return true;&quot;&gt;Curry&lt;/a&gt; the operation) is sort of like how &lt;a href=&quot;http://www.sklar.com/blog/exit.php?url_id=417&amp;amp;entry_id=117&quot; title=&quot;http://en.wikipedia.org/wiki/Glenn_T._Seaborg&quot; onmouseover=&quot;window.status='http://en.wikipedia.org/wiki/Glenn_T._Seaborg';return true;&quot; onmouseout=&quot;window.status='';return true;&quot;&gt;Glenn Seaborg&lt;/a&gt;, working at &lt;a href=&quot;http://www.sklar.com/blog/exit.php?url_id=418&amp;amp;entry_id=117&quot; title=&quot;http://www.lbl.gov&quot; onmouseover=&quot;window.status='http://www.lbl.gov';return true;&quot; onmouseout=&quot;window.status='';return true;&quot;&gt;LBL&lt;/a&gt;, could have a letter addressed to him using element names (seaborgium / lawrencium berkelium / californium / americium.)&lt;br /&gt;
&lt;br /&gt;
Who else can you think of that falls into this admittedly fuzzy-edged bucket?    </description>
</item>
<item>
    <title>Let a thousand string concatenations bloom</title>
    <link>http://www.sklar.com/blog/archives/116-Let-a-thousand-string-concatenations-bloom.html</link>
    <description>
        How many different ways (in PHP) are there to concatenate the string values in two variables and put the result in a third variable?&lt;br /&gt;
&lt;br /&gt;
Here are a few to start:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;&lt;code&gt;$alice = $bob . $charlie;&lt;/code&gt;&lt;/li&gt;&lt;li&gt;&lt;code&gt;$alice = &quot;$bob$charlie&quot;;&lt;/code&gt;&lt;/li&gt;&lt;li&gt;&lt;code&gt;$alice = sprintf('%s%s', $bob, $charlie);&lt;/code&gt;&lt;/li&gt;&lt;li&gt;&lt;code&gt;ob_start(); echo $bob, $charlie; $alice = ob_get_clean();&lt;/code&gt;&lt;/li&gt;&lt;li&gt;&lt;code&gt;$alice = implode('', array($bob,$charlie));&lt;/code&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;
I would say something like &quot;Of course, this entire exercise is just for fun and in practice is totally useless,&quot; but whenever I start out thinking that something actually productive eventually emerges. So perhaps this is totally useless, perhaps not!    </description>
</item>
<item>
    <title>DC PHP 2007 Slides</title>
    <link>http://www.sklar.com/blog/archives/115-DC-PHP-2007-Slides.html</link>
    <description>
        The slides from my &quot;API Design in PHP&quot; talk at the &lt;a href=&quot;http://www.sklar.com/blog/exit.php?url_id=411&amp;amp;entry_id=115&quot; title=&quot;http://www.dcphpconference.com/?q=node/262&amp;id=19&quot; onmouseover=&quot;window.status='http://www.dcphpconference.com/?q=node/262&amp;id=19';return true;&quot; onmouseout=&quot;window.status='';return true;&quot;&gt;2007 DC PHP Conference&lt;/a&gt; are up at &lt;a href=&quot;http://www.sklar.com/blog/exit.php?url_id=412&amp;amp;entry_id=115&quot; title=&quot;http://www.sklar.com/files/dcphp-2007-api-design.pdf&quot; onmouseover=&quot;window.status='http://www.sklar.com/files/dcphp-2007-api-design.pdf';return true;&quot; onmouseout=&quot;window.status='';return true;&quot;&gt;http://www.sklar.com/files/dcphp-2007-api-design.pdf&lt;/a&gt;. Enjoy!    </description>
</item>
<item>
    <title>Subversion Time Machine</title>
    <link>http://www.sklar.com/blog/archives/114-Subversion-Time-Machine.html</link>
    <description>
        &lt;a href=&quot;http://www.sklar.com/blog/exit.php?url_id=408&amp;amp;entry_id=114&quot; title=&quot;http://jonaquino.blogspot.com/&quot; onmouseover=&quot;window.status='http://jonaquino.blogspot.com/';return true;&quot; onmouseout=&quot;window.status='';return true;&quot;&gt;Jon Aquino&lt;/a&gt;, my &lt;a href=&quot;http://www.sklar.com/blog/exit.php?url_id=409&amp;amp;entry_id=114&quot; title=&quot;http://www.ning.com/about/team.html&quot; onmouseover=&quot;window.status='http://www.ning.com/about/team.html';return true;&quot; onmouseout=&quot;window.status='';return true;&quot;&gt;talented cow-orker&lt;/a&gt; built a &lt;a href=&quot;http://www.sklar.com/blog/exit.php?url_id=410&amp;amp;entry_id=114&quot; title=&quot;http://code.google.com/p/svn-time-lapse-view/&quot; onmouseover=&quot;window.status='http://code.google.com/p/svn-time-lapse-view/';return true;&quot; onmouseout=&quot;window.status='';return true;&quot;&gt;time-lapse view&lt;/a&gt; for Subversion. This is fantastic.&lt;br /&gt;
&lt;br /&gt;
We switched from Perforce to Subversion recently (at Ning), and one of the things that I miss about Perforce was its handy time-lapse-view feature. No longer!    </description>
</item>
<item>
    <title>API Design Talk Slides</title>
    <link>http://www.sklar.com/blog/archives/113-API-Design-Talk-Slides.html</link>
    <description>
        The &lt;a href=&quot;http://www.sklar.com/blog/exit.php?url_id=405&amp;amp;entry_id=113&quot; title=&quot;http://www.sklar.com/files/zendcon-2007-api-design.pdf&quot; onmouseover=&quot;window.status='http://www.sklar.com/files/zendcon-2007-api-design.pdf';return true;&quot; onmouseout=&quot;window.status='';return true;&quot;&gt;slides&lt;/a&gt; from my API design talk yesterday are available.&lt;br /&gt;
&lt;br /&gt;
If you missed Zendcon, come to the &lt;a href=&quot;http://www.sklar.com/blog/exit.php?url_id=406&amp;amp;entry_id=113&quot; title=&quot;http://www.dcphpconference.com/&quot; onmouseover=&quot;window.status='http://www.dcphpconference.com/';return true;&quot; onmouseout=&quot;window.status='';return true;&quot;&gt;DC PHP Conference&lt;/a&gt; in a few weeks. I'll be talking about API Design there on &lt;a href=&quot;http://www.sklar.com/blog/exit.php?url_id=407&amp;amp;entry_id=113&quot; title=&quot;http://www.dcphpconference.com/?q=node/87&quot; onmouseover=&quot;window.status='http://www.dcphpconference.com/?q=node/87';return true;&quot; onmouseout=&quot;window.status='';return true;&quot;&gt;November 8&lt;/a&gt;.    </description>
</item>
<item>
    <title>Ning Turns Two</title>
    <link>http://www.sklar.com/blog/archives/112-Ning-Turns-Two.html</link>
    <description>
        As &lt;a href=&quot;http://www.sklar.com/blog/exit.php?url_id=401&amp;amp;entry_id=112&quot; title=&quot;http://blog.diegodoval.com/2007/10/2_years_of_ning.html&quot; onmouseover=&quot;window.status='http://blog.diegodoval.com/2007/10/2_years_of_ning.html';return true;&quot; onmouseout=&quot;window.status='';return true;&quot;&gt;Diego&lt;/a&gt; and &lt;a href=&quot;http://www.sklar.com/blog/exit.php?url_id=402&amp;amp;entry_id=112&quot; title=&quot;http://blog.ning.com/2007/10/happy_2nd_birthday.html&quot; onmouseover=&quot;window.status='http://blog.ning.com/2007/10/happy_2nd_birthday.html';return true;&quot; onmouseout=&quot;window.status='';return true;&quot;&gt;Gina&lt;/a&gt; have pointed out, the Ning Platform has just celebrated its second birthday.&lt;br /&gt;
&lt;br /&gt;
The past &lt;a href=&quot;http://www.sklar.com/blog/exit.php?url_id=403&amp;amp;entry_id=112&quot; title=&quot;http://www.sklar.com/blog/archives/67-Ning!.html&quot; onmouseover=&quot;window.status='http://www.sklar.com/blog/archives/67-Ning!.html';return true;&quot; onmouseout=&quot;window.status='';return true;&quot;&gt;two years&lt;/a&gt; have been a lot of work and a lot of fun. It's been gratifying to see the crazy, heartwarming, innovative uses folks have come up with for the platform and also extremely rewarding to work with such &lt;a href=&quot;http://www.sklar.com/blog/exit.php?url_id=404&amp;amp;entry_id=112&quot; title=&quot;http://www.ning.com/about/team.html&quot; onmouseover=&quot;window.status='http://www.ning.com/about/team.html';return true;&quot; onmouseout=&quot;window.status='';return true;&quot;&gt;talented people&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
I wonder what I'll have to say in a blog post a year from now that links to this one?&lt;br /&gt;
    </description>
</item>
<item>
    <title>Zendcon 2007</title>
    <link>http://www.sklar.com/blog/archives/111-Zendcon-2007.html</link>
    <description>
        &lt;a href=&quot;http://www.sklar.com/blog/exit.php?url_id=399&amp;amp;entry_id=111&quot; title=&quot;http://www.zendcon.com/&quot; onmouseover=&quot;window.status='http://www.zendcon.com/';return true;&quot; onmouseout=&quot;window.status='';return true;&quot;&gt;Zendcon&lt;/a&gt; (aka &quot;The 2007 Zend/PHP Conference and Expo&quot;) draws near. I'll be there giving a talk about &lt;a href=&quot;http://www.sklar.com/blog/exit.php?url_id=400&amp;amp;entry_id=111&quot; title=&quot;http://www.sklar.com/blog/archives/109-API-Design-in-PHP-at-ZendCon-2007.html&quot; onmouseover=&quot;window.status='http://www.sklar.com/blog/archives/109-API-Design-in-PHP-at-ZendCon-2007.html';return true;&quot; onmouseout=&quot;window.status='';return true;&quot;&gt;API Design in PHP&lt;/a&gt; and undoubtedly getting sucked into various conversations about how PHP's disorganized ugliness is its greatest asset.&lt;br /&gt;
    </description>
</item>
<item>
    <title>E-Mail Address Validation and Mission Creep</title>
    <link>http://www.sklar.com/blog/archives/110-E-Mail-Address-Validation-and-Mission-Creep.html</link>
    <description>
        +1 to &lt;a href=&quot;http://www.sklar.com/blog/exit.php?url_id=397&amp;amp;entry_id=110&quot; title=&quot;http://www.santosj.name/programming/php-related/php/stop-doing-email-validation-the-wrong-way/#comment-11900&quot; onmouseover=&quot;window.status='http://www.santosj.name/programming/php-related/php/stop-doing-email-validation-the-wrong-way/#comment-11900';return true;&quot; onmouseout=&quot;window.status='';return true;&quot;&gt;what ndg said&lt;/a&gt; in response to &lt;a href=&quot;http://www.sklar.com/blog/exit.php?url_id=398&amp;amp;entry_id=110&quot; title=&quot;http://www.santosj.name/programming/php-related/php/stop-doing-email-validation-the-wrong-way/&quot; onmouseover=&quot;window.status='http://www.santosj.name/programming/php-related/php/stop-doing-email-validation-the-wrong-way/';return true;&quot; onmouseout=&quot;window.status='';return true;&quot;&gt;Jacob's post about e-mail address validation&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
I think Jacob sort of touches on this in his post but too often it's not explicit what people are looking for under the vague and broad umbrella of &quot;e-mail validation&quot;.&lt;br /&gt;
&lt;br /&gt;
If it's &quot;Did the AOL user signing up for my site forget the '.com' part at the end of the address?&quot; then some pretty simplistic text-based matching will do.&lt;br /&gt;
&lt;br /&gt;
If it's &quot;Is the address supplied a valid mailbox that is controlled by the person who is supplying it to me?&quot; then all the string parsing in the world isn't going to save you. You'll need to roundtrip something out to the mailbox with confirmation instructions. And even then you're not out of the woods -- maybe the user's mailbox is full, or a transient DNS error is causing a problem.&lt;br /&gt;
&lt;br /&gt;
I think e-mail address validation tends to be a bit of a tarpit for nerds (myself included) because the delicious complexity of RFCs 822 and 2822 makes writing code to handle the grammars they describe a fun challenge. That makes it easy to forget what the point of the address validation in the real world actually is: handholding well-meaning users that may have made a careless mistake, or robust protection against malicious users, or bot protection (in which case you probably want to ban RFC-valid addresses that have known-suspicious domain names or components), etc.&lt;br /&gt;
    </description>
</item>
<item>
    <title>API Design in PHP at ZendCon 2007</title>
    <link>http://www.sklar.com/blog/archives/109-API-Design-in-PHP-at-ZendCon-2007.html</link>
    <description>
        I'm going to be giving a talk on &quot;API Design in PHP&quot; at &lt;a href=&quot;http://www.sklar.com/blog/exit.php?url_id=396&amp;amp;entry_id=109&quot; title=&quot;http://www.zendcon.com/speakers_list.php&quot; onmouseover=&quot;window.status='http://www.zendcon.com/speakers_list.php';return true;&quot; onmouseout=&quot;window.status='';return true;&quot;&gt;ZendCon 2007&lt;/a&gt; in October.&lt;br /&gt;
&lt;br /&gt;
Our PHP API at Ning is a little over two years old at this point. There are some things I love about it that I think we've done really well, some things that we have revised, some things we can do better, and some interesting things planned for the future.&lt;br /&gt;
&lt;br /&gt;
The talk is all about what we've learned developing, building, and supporting the API with both a ferocious devotion to backwards compatibility and a rapid new release cycle.&lt;br /&gt;
&lt;br /&gt;
See you in October!    </description>
</item>
<item>
    <title>Runkit, &quot;static&quot;, and inheritance</title>
    <link>http://www.sklar.com/blog/archives/108-Runkit,-static,-and-inheritance.html</link>
    <description>
        A PHP &lt;a href=&quot;http://www.sklar.com/blog/exit.php?url_id=391&amp;amp;entry_id=108&quot; title=&quot;http://devzone.zend.com/node/view/id/1483#Heading4&quot; onmouseover=&quot;window.status='http://devzone.zend.com/node/view/id/1483#Heading4';return true;&quot; onmouseout=&quot;window.status='';return true;&quot;&gt;issue&lt;/a&gt; that comes up &lt;a href=&quot;http://www.sklar.com/blog/exit.php?url_id=392&amp;amp;entry_id=108&quot; title=&quot;http://bugs.php.net/30934&quot; onmouseover=&quot;window.status='http://bugs.php.net/30934';return true;&quot; onmouseout=&quot;window.status='';return true;&quot;&gt;over&lt;/a&gt; and &lt;a href=&quot;http://www.sklar.com/blog/exit.php?url_id=393&amp;amp;entry_id=108&quot; title=&quot;http://bugs.php.net/30423&quot; onmouseover=&quot;window.status='http://bugs.php.net/30423';return true;&quot; onmouseout=&quot;window.status='';return true;&quot;&gt;over&lt;/a&gt; again is how the &lt;code&gt;static&lt;/code&gt; keyword doesn't know about inheritance. That is, code such as:&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;
class Masons {&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;static $where = &quot;World-wide&quot;;&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;static function show() {&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;print self::$where;&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class Stonecutters extends Masons {&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;static $where = &quot;Springfield&quot;;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Stonecutters::show();&lt;br /&gt;
&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
prints &lt;code&gt;World-wide&lt;/code&gt;, not &lt;code&gt;Springfield&lt;/code&gt; because the &lt;code&gt;self&lt;/code&gt; inside &lt;code&gt;Masons::show()&lt;/code&gt; is bound at compile time to the &lt;code&gt;Masons&lt;/code&gt; class. This is different than how &lt;code&gt;$this&lt;/code&gt; works in instances, so it can be unexpected.&lt;br /&gt;
&lt;br /&gt;
There are plenty of good reasons why PHP 5 works this way and it seems that in PHP 6 the &lt;code&gt;static&lt;/code&gt; keyword will be able to be used in place of &lt;code&gt;self&lt;/code&gt; to get the dynamic behavior a lot of folks are looking for (that is, &lt;code&gt;print static::$where;&lt;/code&gt; in &lt;code&gt;Masons::show()&lt;/code&gt; would cause &lt;code&gt;Stonecutters::show()&lt;/code&gt; to print &lt;code&gt;Springfield&lt;/code&gt;.&lt;br /&gt;
&lt;br /&gt;
All well and good once PHP 6 is done.&lt;br /&gt;
&lt;br /&gt;
In the meantime, I was noodling around with &lt;a href=&quot;http://www.sklar.com/blog/exit.php?url_id=394&amp;amp;entry_id=108&quot; title=&quot;http://pecl.php.net/package/runkit&quot; onmouseover=&quot;window.status='http://pecl.php.net/package/runkit';return true;&quot; onmouseout=&quot;window.status='';return true;&quot;&gt;runkit&lt;/a&gt; and came up with some glue that lets you do something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;
class Model {&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;public static function find($class, $filters) {&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;// This method would actually do an SQL query or &lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;// REST request to retrieve data&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;print &quot;I'm looking for a $class with &quot;;&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;$tmp = array();&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;foreach ($filters as $k =&gt; $v) { $tmp[] = &quot;$k=$v&quot;; }&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;print implode(', ', $tmp); &lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;print &quot;\n&quot;;&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;}&lt;br /&gt;
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;public static function findById($class, $id) {&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;return self::find($class, array('id' =&gt; $id));&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class Monkey extends Model { }&lt;br /&gt;
&lt;br /&gt;
class Elephant extends Model {&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;public static function findByTrunkColor($color) {&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;return self::find(array('color' =&gt; $color));&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;}&lt;br /&gt;
}&lt;br /&gt;
&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
And then after the mysterious (for a few seconds) glue:&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;
MethodHelper::fixStaticMethods('Model');&lt;br /&gt;
&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
you can do:&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;
Monkey::find(array('name' =&gt; 'George', 'is' =&gt; 'curious'));&lt;br /&gt;
// prints: I'm looking for a Monkey with name=George, is=curious&lt;br /&gt;
&lt;br /&gt;
Elephant::findById(1274);&lt;br /&gt;
// prints: I'm looking for a Elephant with id=1274&lt;br /&gt;
&lt;br /&gt;
Elephant::findByTrunkColor('grey');&lt;br /&gt;
// prints: I'm looking for a Elephant with color=grey&lt;br /&gt;
&lt;br /&gt;
Monkey::findById('abe');&lt;br /&gt;
// prints: I'm looking for a Monkey with id=abe&lt;br /&gt;
&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
(The innards of &lt;code&gt;MethodHelper&lt;/code&gt; after the jump...)&lt;br /&gt;&lt;a href=&quot;http://www.sklar.com/blog/archives/108-guid.html#extended&quot;&gt;Continue reading &quot;Runkit, &amp;quot;static&amp;quot;, and inheritance&quot;&lt;/a&gt;    </description>
</item>
</channel>
</rss>
