
<rss version="0.91">
  <channel>
  <copyright>Copyright 1997-2005 eden</copyright>
  <pubDate>Thu, 01 Jan 1970 01:33:28 +0100</pubDate>
  <description>Why bother? I mean, really, why?</description>
  <link>http://teethgrinder.co.uk/</link>
  <title>teethgrinder</title>

  <webMaster>rss&#064;teethgrinder.co.uk</webMaster>
  <managingEditor>rss&#064;teethgrinder.co.uk</managingEditor>
  <language>en-us</language>

<item><title>vista sucks :: life</title><link>http://teethgrinder.co.uk/perm.php?id=338</link><description>&lt;p&gt;OK, this is how utter turd Vista is. I have a folder that is in my Documents. I can&#039;t delete it.&lt;/p&gt;
&lt;p&gt;I right click -&amp;gt; delete. It asks am I sure. Then asks am I sure (again), then asks if I am sure (again!!) then says I need permission to delete a folder I only just created.&lt;/p&gt;
&lt;p&gt;FUCK OFF!!&lt;/p&gt;
&lt;p&gt;Vista - looks nice. Works like an arse.&lt;/p&gt;</description></item><item><title>PHP Closeures :: Programming</title><link>http://teethgrinder.co.uk/perm.php?id=337</link><description>&lt;p&gt;PHP 5.3 has closures in it! Finally we get some good stuff to play with: &lt;a href=&quot;http://www.toosweettobesour.com/2008/07/21/php-53-and-closures/&quot;&gt;PHP 5.3 and Closures&lt;/a&gt;. This is excellent news, even if the closures look weird -- look at the strange &lt;b&gt;use&lt;/b&gt; keyword.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Zend Framework DB Insert NOW :: Programming</title><link>http://teethgrinder.co.uk/perm.php?id=336</link><description>&lt;p&gt;Some keywords: SQL Insert Update Zend_Db_Table_Row NOW() now function Zend_Db_Table Zend_Db_Expr&lt;/p&gt;
&lt;p&gt;Use the SQL function NOW() in ZF:&lt;/p&gt;
&lt;p style=&quot;margin-left: 40px;&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 255);&quot;&gt;&lt;span style=&quot;font-family: Courier New;&quot;&gt;$k = new My_Table();&lt;br /&gt;
$row = $k-&amp;gt;createRow();&lt;br /&gt;
$row-&amp;gt;datetime&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; = new Zend_Db_Expr(&#039;&lt;span style=&quot;color: rgb(128, 0, 0);&quot;&gt;NOW()&lt;/span&gt;&#039;);&lt;br /&gt;
$row-&amp;gt;save();&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;This works because DB Expr doesn&#039;t escape the string &#039;NOW()&#039;. Yay.&lt;/p&gt;</description></item><item><title>Why LISP is better than me :: Programming</title><link>http://teethgrinder.co.uk/perm.php?id=335</link><description>&lt;p&gt;I wish I could do this in any of the languages I use: &lt;a href=&quot;http://blog.viridian-project.de/2008/07/07/porting-perls-qq-to-common-lisp/&quot;&gt;porting-perls-qq-to-common-lisp&lt;/a&gt;. A few simple lines of code and you have a new language operator qq. Ugh. This would be soooo cool.&lt;/p&gt;
&lt;p&gt;I had a problem the other day where I had an object with various members, some of which I wanted to have the extra attribute &#039;merge-able&#039; some how. This is how it looked:&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;color: rgb(0, 0, 255);&quot;&gt;&lt;span style=&quot;font-family: Courier New;&quot;&gt;class moo{&lt;br /&gt;
&amp;nbsp; private var colour:String;&lt;br /&gt;
&amp;nbsp; protected var depth:Number;&lt;br /&gt;
&amp;nbsp; public var height:Number;&lt;br /&gt;
&amp;nbsp; .....&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Then in a method inside moo:&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;color: rgb(0, 0, 255);&quot;&gt;&lt;span style=&quot;font-family: Courier New;&quot;&gt;foreach( prop in this )&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp; // this iterates over &#039;colour&#039;,&#039;depth&#039;,&#039;height&#039;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;and what I wanted was to somehow &#039;hide&#039; &lt;span style=&quot;color: rgb(0, 0, 255);&quot;&gt;&lt;span style=&quot;font-family: Courier New;&quot;&gt;height&lt;/span&gt;&lt;/span&gt; from the iterator... &lt;/p&gt;
&lt;p&gt;I guess there are two ways of doing this, first override the &#039;iterator&#039; or &#039;foreach&#039; operator. This is impossible in ActionScript. Or second add an attribute to each property, kinda like:&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;color: rgb(0, 0, 255);&quot;&gt;&lt;span style=&quot;font-family: Courier New;&quot;&gt;class moo{&lt;br /&gt;
&amp;nbsp; private var colour:String;&lt;br /&gt;
&amp;nbsp; protected var depth:Number;&lt;br /&gt;
&amp;nbsp; public &lt;b&gt;non-iterable&lt;/b&gt; var height:Number;&lt;br /&gt;
&amp;nbsp; .....&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;But there&#039;s no way to do this and no way to extend the language to make it work. It is most irritating.&lt;/p&gt;
&lt;p&gt;I have 40 or 50 objects and I iterate over all of them. And I have this problem in one or two of them.... argh! How annoying.&lt;/p&gt;
&lt;p&gt;The only thing I can think of is to have an iterable properties list, then:&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;color: rgb(0, 0, 255);&quot;&gt;&lt;span style=&quot;font-family: Courier New;&quot;&gt;foreach( prop in this.iterable_properties_list() )&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp; // only returns &#039;colour&#039; and &#039;depth&#039;&lt;br /&gt;
&amp;nbsp; this[prop] = ....&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;But this means keeping my object definition and iterable_properties_list method in sync (for over 40 different objects.) Filth.&lt;/p&gt;
&lt;p&gt;I guess I could hack it using PHPs naming scheme, anything that starts with an underscore is &#039;special&#039;. Then I could do:&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;color: rgb(0, 0, 255);&quot;&gt;&lt;span style=&quot;font-family: Courier New;&quot;&gt;foreach( prop in this )&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp; // this iterates over &#039;colour&#039;,&#039;depth&#039;,&#039;_height&#039;&lt;br /&gt;
&amp;nbsp; if( !prop.starts_with(&#039;_&#039;) )&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; // _height is magically hidden...&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; ....&lt;br type=&quot;_moz&quot; /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
But then I need to rename all my properties in all my objects. Bah. I want language macros! And I want them now!! :-)&lt;/p&gt;</description></item><item><title>Larrabee new Intel chip :: Programming</title><link>http://teethgrinder.co.uk/perm.php?id=334</link><description>&lt;p&gt;Shit! The new intel chip, Larrabee has &lt;a href=&quot;http://www.custompc.co.uk/news/602910/rumour-control-larrabee-based-on-32-original-pentium-cores.html&quot;&gt;32 cores&lt;/a&gt;! Core me up y&#039;all.&lt;/p&gt;</description></item><item><title>a better type of php :: Programming</title><link>http://teethgrinder.co.uk/perm.php?id=333</link><description>&lt;p&gt;Some interesting links about PHP. PHP 6 may use the &lt;a href=&quot;http://www.technetra.com/writings/archive/2004/01/09/interview-rasmus-lerdorf&quot;&gt;Parrot virtual machine&lt;/a&gt; to run. That would be very interesting, for example when the Perl guys port &lt;a href=&quot;http://search.cpan.org/~drolsky/Chart-OFC-0.07/&quot;&gt;CPAN&lt;/a&gt; to Parrot, PHP would have access to that vast, vast library of code.&lt;/p&gt;
&lt;p&gt;Compiling PHP to Parrot (or .NET or Java) would speed up the code, reduce the memory consumption and just make everything much more nicer. But until we get that, there are a few PHP &lt;a href=&quot;http://2bits.com/articles/php-op-code-caches-accelerators-a-must-for-a-large-site.html&quot;&gt;op-code cachers&lt;/a&gt; and &lt;a href=&quot;http://phpcompiler.org/&quot;&gt;PHC a PHP compiler&lt;/a&gt;. Sweet.&lt;/p&gt;</description></item><item><title>Python csv NULL BYTE fail re regex split :: Programming</title><link>http://teethgrinder.co.uk/perm.php?id=332</link><description>&lt;p&gt;My problem is that I have a csv file that Python can&#039;t read because it has NULL bytes in it. Python has a built in csv reader, but this chokes and dies :-(&amp;nbsp; (booo)&lt;/p&gt;
&lt;p&gt;Problem 2: line.split(&#039;,&#039;) also chokes because some lines look like this:&lt;/p&gt;
&lt;p&gt;1,2,&amp;quot;3,4,5&amp;quot;,6&lt;/p&gt;
&lt;p&gt;which have to split into 4 items. Ack. I thought I was going to have to write a little finite state machine (which I like doing) but my csv file is 18meg. So fsm may = slowness.&lt;/p&gt;
&lt;p&gt;After some searches I came across this funky bit of regex that I made into even funkier Python:&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: Courier New;&quot;&gt;&amp;gt;&amp;gt;&amp;gt; subject = &lt;span style=&quot;color: rgb(0, 0, 255);&quot;&gt;&amp;quot;&amp;quot;&amp;quot;1,2,3,&amp;quot;4444&amp;quot;,&amp;quot;55,55,,,,55&amp;quot;,99&amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; splitter = re.compile(r&lt;span style=&quot;color: rgb(0, 0, 255);&quot;&gt;&#039;,(?=(?:[^&amp;quot;]*&amp;quot;[^&amp;quot;]*&amp;quot;)*(?![^&amp;quot;]*&amp;quot;))&#039;&lt;/span&gt;)&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; splitter.split(subject)&lt;br /&gt;
[&lt;span style=&quot;color: rgb(0, 0, 255);&quot;&gt;&#039;1&#039;&lt;/span&gt;, &lt;span style=&quot;color: rgb(0, 0, 255);&quot;&gt;&#039;2&#039;&lt;/span&gt;, &lt;span style=&quot;color: rgb(0, 0, 255);&quot;&gt;&#039;3&#039;&lt;/span&gt;, &lt;span style=&quot;color: rgb(0, 0, 255);&quot;&gt;&#039;&amp;quot;4444&amp;quot;&#039;&lt;/span&gt;, &lt;span style=&quot;color: rgb(0, 0, 255);&quot;&gt;&#039;&amp;quot;55,55,,,,55&amp;quot;&#039;&lt;/span&gt;, &lt;span style=&quot;color: rgb(0, 0, 255);&quot;&gt;&#039;99&#039;&lt;/span&gt;]&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;:-)&lt;/p&gt;
&lt;p&gt;wtf? I&#039;m not sure what is going on, I got lost at &amp;quot;Assert that it is impossible to match the regex below starting at this point (negative lookahead)&amp;quot; hmmm. Yes. Magic.&lt;/p&gt;</description></item><item><title>Zend Framework Ajax :: Programming</title><link>http://teethgrinder.co.uk/perm.php?id=331</link><description>&lt;p&gt;You need to turn off the layout renderer and the view renderer:&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;color: rgb(0, 0, 255);&quot;&gt;&lt;span style=&quot;font-family: Courier New;&quot;&gt;public function busyAction()&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; //&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; // turn off the view helpers&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; //&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; $this-&amp;gt;_helper-&amp;gt;layout-&amp;gt;disableLayout();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; $this-&amp;gt;_helper-&amp;gt;viewRenderer-&amp;gt;setNoRender();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; //&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; //&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; //&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; $tmp = array( &#039;test&#039;=&amp;gt;&#039;value&#039; );&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; echo Zend_Json::encode($tmp);&lt;br /&gt;
}&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Then use Zend_Json to encode your values and output them.&lt;/p&gt;
&lt;p&gt;For the client side I suggest you grab jQuery or prototype to make things easier.&lt;/p&gt;</description></item><item><title>More Linux Tips :: Programming</title><link>http://teethgrinder.co.uk/perm.php?id=330</link><description>&lt;p&gt;&lt;a href=&quot;http://atoztoa.blogspot.com/2008/06/linux-commands-i-hardly-knew.html&quot;&gt;More shell commands&lt;/a&gt; that we all should know.&lt;/p&gt;
&lt;p&gt;Step 1 of becomming a better programmer is to look at your tools and find out 1 new thing that it/they can do. Then use that function.&lt;/p&gt;</description></item><item><title>OMeta :: Programming</title><link>http://teethgrinder.co.uk/perm.php?id=329</link><description>&lt;p&gt;Wanna see the future of programming? Check out &lt;a href=&quot;http://www.moserware.com/2008/06/ometa-who-what-when-where-why.html&quot;&gt;OMeta&lt;/a&gt;, it allows you to extend your language to include your own instructions. Neat.&lt;/p&gt;
&lt;p&gt;For example, in my code I am forever looping over dates. I may display every day this month, or every week this quater or every month this year. Wouldn&#039;t it be cool to extend the language to have this ability built into it?&lt;/p&gt;
&lt;p&gt;I&#039;d extend &lt;b&gt;foreach( $vars as $var )&lt;/b&gt; and make it &lt;b&gt;foreachmonth( $date_range as $month )&lt;/b&gt; it may not be that useful, but that tiny bit of syntatical help would be worth the effort of extending the language.&lt;/p&gt;
&lt;p&gt;The way python is able to loop through a list and do something with each element:&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-family: Courier New;&quot;&gt;tmp = [x*2 for x in list]&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;is so cool it needs to be built into PHP. Take a look at how macros are built in &lt;a href=&quot;http://nemerle.org/Macros_tutorial&quot;&gt;nemerle&lt;/a&gt;, scroll down to the &lt;b&gt;for&lt;/b&gt; loop. They add c style for loops to the compiler. I want to do this in PHP. Domain specific mini languages are the future.&lt;/p&gt;</description></item>
</channel>
</rss>

