<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xml:base="http://dikini.net" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
 <title>dikini.net - programming</title>
 <link>http://dikini.net/taxonomy/term/56/0</link>
 <description></description>
 <language>en</language>
<item>
 <title>He Sells Shell Scripts Not Just to Intersect Sets</title>
 <link>http://dikini.net/07.03.2008/he_sells_shell_scripts_not_just_to_intersect_sets</link>
 <description>&lt;p&gt;&lt;a href=&quot;http://wordaligned.org/articles/shell-script-sets&quot;&gt;He Sells Shell Scripts to Intersect Sets&lt;/a&gt; is a good read. Set and multiset operations from the command line or in .sh. Rather clean, straightforward shell magic.&lt;/p&gt;
</description>
 <comments>http://dikini.net/07.03.2008/he_sells_shell_scripts_not_just_to_intersect_sets#comment</comments>
 <category domain="http://dikini.net/tags/programming">programming</category>
 <category domain="http://dikini.net/tags/shell">shell</category>
 <category domain="http://dikini.net/tags/unix">unix</category>
 <pubDate>Fri, 07 Mar 2008 06:42:37 -0500</pubDate>
 <dc:creator>vlado</dc:creator>
 <guid isPermaLink="false">295 at http://dikini.net</guid>
</item>
<item>
 <title>Science paper of the month, IMHO</title>
 <link>http://dikini.net/10.08.2007/science_paper_of_the_month_imho</link>
 <description>&lt;blockquote&gt;&lt;p&gt;In this paper we will propose the first — to our knowledge — method that finds the global optimum of the TSP by reducing the NP complexity of the problem to N2 complexity. We achieve this by using white light interferometry&lt;br /&gt;
(WLI)[14]. From the mathematical point of view we unfortunately haven’t disapproved the commonly believed conjecture that NP 6= P (the Clay mathematics institute set out a price of 1.000.000 US-$ for doing that) but we apparently reduced the complexity by a trick, namely replacing operations by photons (and the physics of interference).&lt;/p&gt;
&lt;p&gt;In section 2 we introduce the method as a gedankenexperiment[thought experiment in friendly german]....&lt;br /&gt;
&lt;a href=&quot;/freelinking/An%252520Optical%252520Solution%252520For%252520The%252520Traveling%252520Salesman%252520Problem&quot;&gt;http://www.opticsexpress.org/abstract.cfm?id=140598&lt;/a&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Just cool. It reminds me of the often forgotten analogue computers. They are very rarely used in practice these days, although they could be used to solve predefined probles fast, furious and sparkling. &lt;/p&gt;
&lt;p&gt;With the introduction of uncertainty and loops you could get some very interesting results. Just think about the offspring of a theremin and a miniMoog on acid. Raving BEAM bots? Pacifist fighter drones?&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://dikini.net/10.08.2007/science_paper_of_the_month_imho&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</description>
 <comments>http://dikini.net/10.08.2007/science_paper_of_the_month_imho#comment</comments>
 <category domain="http://dikini.net/tags/programming">programming</category>
 <category domain="http://dikini.net/tags/random">random</category>
 <pubDate>Fri, 10 Aug 2007 09:06:00 -0400</pubDate>
 <dc:creator>vlado</dc:creator>
 <guid isPermaLink="false">268 at http://dikini.net</guid>
</item>
<item>
 <title>An exercise with continuations, prompts and scheme macros</title>
 <link>http://dikini.net/03.08.2007/an_exercise_with_continuations_prompts_and_scheme_macros</link>
 <description>&lt;p&gt;&lt;a href=&quot;http://blog.plt-scheme.org/2007/07/control-resumed.html&quot;&gt;control resumed&lt;/a&gt; inspired me to take a small exercise.
&lt;/p&gt;
&lt;p&gt;
&lt;em&gt;&quot;Code a minimal approximation of the python yield operator based generators&quot;&lt;/em&gt;
&lt;br /&gt; Here follow the results I managed to get with help from Matthias Felleisen, via the plt mailing list. You can see the non-edited exchange via the &lt;a href=&quot;http://list.cs.brown.edu/pipermail/plt-scheme/2007-August/019841.html&quot;&gt;mailing list archives&lt;/a&gt; and &lt;a href=&quot;http://blog.plt-scheme.org/2007/08/control-and-macros.html&quot;&gt;control and macors&lt;/a&gt;. All control&amp;prompt are forms specific to &lt;a href=&quot;http://www.plt-scheme.org&quot;&gt;plt scheme&lt;/a&gt;&#039;s &lt;em&gt;control.ss&lt;/em&gt; module. The first attempt looks something like this:
&lt;/p&gt;
&lt;code class=&quot;scheme&quot;&gt;(&lt;span class=&quot;keyword&quot;&gt;require&lt;/span&gt; (&lt;span class=&quot;variable&quot;&gt;lib&lt;/span&gt; &lt;span class=&quot;selfeval&quot;&gt;&quot;control.ss&quot;&lt;/span&gt;))

(&lt;span class=&quot;keyword&quot;&gt;define&lt;/span&gt; (&lt;span class=&quot;variable&quot;&gt;make-step&lt;/span&gt;)
  (&lt;span class=&quot;keyword&quot;&gt;define&lt;/span&gt; (&lt;span class=&quot;variable&quot;&gt;control-state&lt;/span&gt;)
    (&lt;span class=&quot;variable&quot;&gt;yield&lt;/span&gt; &lt;span class=&quot;selfeval&quot;&gt;1&lt;/span&gt;)
    (&lt;span class=&quot;variable&quot;&gt;yield&lt;/span&gt; &lt;span class=&quot;selfeval&quot;&gt;2&lt;/span&gt;)
    (&lt;span class=&quot;variable&quot;&gt;yield&lt;/span&gt; &lt;span class=&quot;selfeval&quot;&gt;3&lt;/span&gt;)
    &lt;span class=&quot;keyword&quot;&gt;&#039;&lt;/span&gt;&lt;span class=&quot;variable&quot;&gt;finished&lt;/span&gt;)
  (&lt;span class=&quot;keyword&quot;&gt;define&lt;/span&gt; (&lt;span class=&quot;variable&quot;&gt;yield&lt;/span&gt; &lt;span class=&quot;variable&quot;&gt;value&lt;/span&gt;) (&lt;span class=&quot;variable&quot;&gt;control&lt;/span&gt; &lt;span class=&quot;variable&quot;&gt;resume-here&lt;/span&gt; (&lt;span class=&quot;keyword&quot;&gt;set!&lt;/span&gt; &lt;span class=&quot;variable&quot;&gt;control-state&lt;/span&gt; &lt;span class=&quot;variable&quot;&gt;resume-here&lt;/span&gt;) &lt;span class=&quot;variable&quot;&gt;value&lt;/span&gt;))
  (&lt;span class=&quot;keyword&quot;&gt;define&lt;/span&gt; (&lt;span class=&quot;variable&quot;&gt;generator&lt;/span&gt;) (&lt;span class=&quot;variable&quot;&gt;prompt&lt;/span&gt; (&lt;span class=&quot;variable&quot;&gt;control-state&lt;/span&gt;)))
  &lt;span class=&quot;variable&quot;&gt;generator&lt;/span&gt;)

(&lt;span class=&quot;keyword&quot;&gt;define&lt;/span&gt; &lt;span class=&quot;variable&quot;&gt;step&lt;/span&gt; (&lt;span class=&quot;variable&quot;&gt;make-step&lt;/span&gt;))

(&lt;span class=&quot;variable&quot;&gt;step&lt;/span&gt;) (&lt;span class=&quot;variable&quot;&gt;step&lt;/span&gt;) 
&lt;/code&gt;
&lt;p&gt;
It does the job. Kind of. For me the interesting bit is how the interplay of prompt and control achieve maintaining the current state of execution before the return and allowing to continue from that interruption. It can be done with call/cc but it looks a helluva a lot more complicated and is far more unreadable.
&lt;/p&gt;
&lt;p&gt;There is a problem with the code above though. As Matthias notes in his email:
&lt;blockquote&gt;LESSON: never &#039;test&#039; by running things at the top-level prompt. It IS a prompt. -- Matthias&lt;/blockquote&gt;

&lt;p&gt;So comes version 2:&lt;/p&gt;
&lt;code class=&quot;scheme&quot;&gt;(&lt;span class=&quot;keyword&quot;&gt;require&lt;/span&gt; (&lt;span class=&quot;variable&quot;&gt;lib&lt;/span&gt; &lt;span class=&quot;selfeval&quot;&gt;&quot;control.ss&quot;&lt;/span&gt;))

(&lt;span class=&quot;keyword&quot;&gt;define&lt;/span&gt; (&lt;span class=&quot;variable&quot;&gt;make-step&lt;/span&gt;)
  (&lt;span class=&quot;keyword&quot;&gt;define&lt;/span&gt; (&lt;span class=&quot;variable&quot;&gt;control-state&lt;/span&gt;)
    (&lt;span class=&quot;variable&quot;&gt;yield&lt;/span&gt; &lt;span class=&quot;selfeval&quot;&gt;1&lt;/span&gt;)
    (&lt;span class=&quot;variable&quot;&gt;yield&lt;/span&gt; &lt;span class=&quot;selfeval&quot;&gt;2&lt;/span&gt;)
    (&lt;span class=&quot;variable&quot;&gt;yield&lt;/span&gt; &lt;span class=&quot;selfeval&quot;&gt;3&lt;/span&gt;)
    &lt;span class=&quot;keyword&quot;&gt;&#039;&lt;/span&gt;&lt;span class=&quot;variable&quot;&gt;finished&lt;/span&gt;)
  (&lt;span class=&quot;keyword&quot;&gt;define&lt;/span&gt; (&lt;span class=&quot;variable&quot;&gt;yield&lt;/span&gt; &lt;span class=&quot;variable&quot;&gt;value&lt;/span&gt;) 
    (&lt;span class=&quot;variable&quot;&gt;control&lt;/span&gt; &lt;span class=&quot;variable&quot;&gt;resume-here&lt;/span&gt; 
             (&lt;span class=&quot;keyword&quot;&gt;set!&lt;/span&gt; &lt;span class=&quot;variable&quot;&gt;control-state&lt;/span&gt; 
                   (&lt;span class=&quot;keyword&quot;&gt;lambda&lt;/span&gt; () (&lt;span class=&quot;variable&quot;&gt;prompt&lt;/span&gt; (&lt;span class=&quot;variable&quot;&gt;resume-here&lt;/span&gt;)))) 
             &lt;span class=&quot;variable&quot;&gt;value&lt;/span&gt;))
  (&lt;span class=&quot;keyword&quot;&gt;define&lt;/span&gt; (&lt;span class=&quot;variable&quot;&gt;generator&lt;/span&gt;) (&lt;span class=&quot;variable&quot;&gt;prompt&lt;/span&gt; (&lt;span class=&quot;variable&quot;&gt;control-state&lt;/span&gt;)))
  &lt;span class=&quot;variable&quot;&gt;generator&lt;/span&gt;)

(&lt;span class=&quot;keyword&quot;&gt;define&lt;/span&gt; &lt;span class=&quot;variable&quot;&gt;step&lt;/span&gt; (&lt;span class=&quot;variable&quot;&gt;make-step&lt;/span&gt;))

(&lt;span class=&quot;builtin&quot;&gt;equal?&lt;/span&gt; &lt;span class=&quot;keyword&quot;&gt;&#039;&lt;/span&gt;(&lt;span class=&quot;selfeval&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;selfeval&quot;&gt;2&lt;/span&gt; &lt;span class=&quot;selfeval&quot;&gt;3&lt;/span&gt;) (&lt;span class=&quot;builtin&quot;&gt;list&lt;/span&gt; (&lt;span class=&quot;variable&quot;&gt;step&lt;/span&gt;) (&lt;span class=&quot;variable&quot;&gt;step&lt;/span&gt;) (&lt;span class=&quot;variable&quot;&gt;step&lt;/span&gt;)))
&lt;/code&gt;
&lt;p&gt;&lt;em&gt;control-state&lt;/em&gt; is a variable holding a reference to a function with no arguments, doing what the python function would do. &lt;em&gt;yield&lt;/em&gt; is a variable holding a reference to a function which does the interrupt magic. &lt;em&gt;generator&lt;/em&gt; is a variable holding a reference to a (sugary) function which does the initial step.
&lt;/p&gt;
&lt;p&gt;The logic of the above algorithm is roughly as follows - mark thy state, do what you need to do, when you encounter control stop, remember your state by wrapping it in a function (resume-here), remember where do you what to continue from ( the set! control-state ...). Notice that the value of control-state is replaced. This is possible since the  &lt;em&gt;resume-here&lt;/em&gt; continuation is a function and a first class value.&lt;/p&gt;
&lt;p&gt;So what next. Boilerplate code is tedious to write. And there is a lot of boilerplate code there. And every function, which needs to follow this recipe, will need to duplicate it.
&lt;/p&gt;
&lt;p&gt;So scheme macros to the rescue. It is not a trivial problem. A &#039;generator&#039; function can look something like this:
&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://dikini.net/03.08.2007/an_exercise_with_continuations_prompts_and_scheme_macros&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</description>
 <comments>http://dikini.net/03.08.2007/an_exercise_with_continuations_prompts_and_scheme_macros#comment</comments>
 <category domain="http://dikini.net/tags/code">code</category>
 <category domain="http://dikini.net/tags/plt">plt</category>
 <category domain="http://dikini.net/tags/programming">programming</category>
 <category domain="http://dikini.net/tags/scheme">scheme</category>
 <category domain="http://dikini.net/tags/scheming">scheming</category>
 <pubDate>Fri, 03 Aug 2007 12:21:39 -0400</pubDate>
 <dc:creator>vlado</dc:creator>
 <guid isPermaLink="false">267 at http://dikini.net</guid>
</item>
<item>
 <title>Drupal, computer science, random bits</title>
 <link>http://dikini.net/13.06.2007/drupal_computer_science_random_bits</link>
 <description>&lt;p&gt;There are quite a few interesting computer science artefacts in Drupal. I&#039;m going to try to highlight a few of them. Sorry, this is unfinished, and might not be finished ever, but I&#039;m just trying to capture a snapshot of confused meandering thoughts.&lt;/p&gt;
&lt;h3&gt;Very late, dynamic binding&lt;/h3&gt;
&lt;p&gt;Late binding came to popular life with the advent of object oriented languages. Essentially it means binding of values, for example functions, to names at object creation, as opposed to compile or link time. In drupal, this can happen at any time, more even, it is algorithmic - that is you can change at runtime what is to be executed at a specific control point. The hook system is one of the ways to do it.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://dikini.net/13.06.2007/drupal_computer_science_random_bits&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</description>
 <comments>http://dikini.net/13.06.2007/drupal_computer_science_random_bits#comment</comments>
 <category domain="http://dikini.net/tags/drupal">drupal</category>
 <category domain="http://dikini.net/tags/programming">programming</category>
 <category domain="http://dikini.net/taxonomy/term/105">shorts</category>
 <pubDate>Wed, 13 Jun 2007 04:50:48 -0400</pubDate>
 <dc:creator>vlado</dc:creator>
 <guid isPermaLink="false">257 at http://dikini.net</guid>
</item>
<item>
 <title>Models, records, databases, friends and foes</title>
 <link>http://dikini.net/models_records_databases_friends_and_foes</link>
 <description>&lt;p&gt;the beginnings of a &lt;em&gt;long&lt;/em&gt; on DB related pattern discussion.&lt;/p&gt;
</description>
 <comments>http://dikini.net/models_records_databases_friends_and_foes#comment</comments>
 <category domain="http://dikini.net/tags/design_patterns">design patterns</category>
 <category domain="http://dikini.net/tags/php">php</category>
 <category domain="http://dikini.net/tags/programming">programming</category>
 <pubDate>Fri, 27 Oct 2006 11:01:12 -0400</pubDate>
 <dc:creator>vlado</dc:creator>
 <guid isPermaLink="false">230 at http://dikini.net</guid>
</item>
<item>
 <title>First sketches</title>
 <link>http://dikini.net/first_sketches</link>
 <description>&lt;p&gt;Ok, Let&#039;s recap:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Relational database (SQL) tables are records. We can view them (in our heads) as record type definitions.&lt;/li&gt;
&lt;li&gt;JOINS define (some kind of) derived union types.&lt;/li&gt;
&lt;li&gt;SQL CROSS JOINS are full cartesian products, i.e. union types where no name folding/aliasing is done by the imaginary type system&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;How can we model that in php?&lt;/h3&gt;
&lt;p&gt;Classes (and objects) are records. Arrays are records too. Both are candidates for doing the job. We need to be able to somehow represent this (meta) type information and manipulate it. The aim is to have a &lt;strong&gt;natural&lt;/strong&gt; feeling/looking abstraction of the database in php. It should be flexible enough, for us to modify the relations at runtime, as we need. It should allow us in the long run to have a near optimal speed and not too much complications in the end code. That is a tough cookie.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://dikini.net/first_sketches&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</description>
 <comments>http://dikini.net/first_sketches#comment</comments>
 <category domain="http://dikini.net/tags/php">php</category>
 <category domain="http://dikini.net/tags/programming">programming</category>
 <category domain="http://dikini.net/tags/sql">sql</category>
 <pubDate>Fri, 27 Oct 2006 10:57:32 -0400</pubDate>
 <dc:creator>vlado</dc:creator>
 <guid isPermaLink="false">229 at http://dikini.net</guid>
</item>
<item>
 <title>Problems of active record and friends</title>
 <link>http://dikini.net/problems_of_active_record_and_friends</link>
 <description>&lt;p&gt;After a lot of silence caused by lot&#039;s of work (good, my bills are happy) and a continuous diversion into scheme, haskell, dylan and other interesting languages, I&#039;m back into php speaking land. Funny feeling that. So here comes the beginning of something I&#039;ve been continuously rubbing my (leftovers of) brains against.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;copout&lt;/strong&gt; This is not php specific, but since it discusses frequent problems occuring in php apps, I&#039;ve labeled it with as php related as well. Makes it easier maintaining the site you see.&lt;/p&gt;
&lt;p&gt;I have a problem with active record as a pattern. It is a logical one. Essentially it turn a (SQL) database row into an object. The class of the object represents the SQL table or view. Of course you can add behaviour to those classes and objects, i.e. activating those records.&lt;/p&gt;
&lt;p&gt;All that is nice and dandy, but when you start talking about relations and constructing &lt;em&gt;dynamically&lt;/em&gt; queries and corresponding objects, we start hitting the limitations of what I will call from now on &lt;em&gt;the  naive active record&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;The problem is not trivial at all. It boils down to how to make peace between the host language type system (for example classes) and the SQL&#039;s dynamic compound types - the relations expressed as SELECT variants for example. It gets even harder when we decide to reverse the direction, so that we actulally want to update the database. Yuk! As though somebody actually does that!&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://dikini.net/problems_of_active_record_and_friends&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</description>
 <comments>http://dikini.net/problems_of_active_record_and_friends#comment</comments>
 <category domain="http://dikini.net/tags/design_patterns">design patterns</category>
 <category domain="http://dikini.net/tags/php">php</category>
 <category domain="http://dikini.net/tags/programming">programming</category>
 <category domain="http://dikini.net/tags/series">series</category>
 <pubDate>Fri, 27 Oct 2006 06:25:45 -0400</pubDate>
 <dc:creator>vlado</dc:creator>
 <guid isPermaLink="false">228 at http://dikini.net</guid>
</item>
<item>
 <title>macro processor - initial notes</title>
 <link>http://dikini.net/30.08.2006/macro_processor_initial_notes</link>
 <description>&lt;p&gt;Most of my work on this is on paper, and some code sketeches. There quite a few non-trivial issues, and hard decisions to be made. Since I have the knack of loosing or recycling the various paper bits lying around, I decided to keep at least some of them in my diary, aka this blog.&lt;/p&gt;
&lt;h3&gt;initial requirements&lt;/h3&gt;
&lt;dl&gt;
&lt;dt&gt;convenient syntax and semantics&lt;/dt&gt;
&lt;dd&gt;convenience matters. The syntax should be obvious. The meaning of the syntax should be easy to grasp.&lt;/dd&gt;
&lt;dt&gt;minimal core&lt;/dt&gt;
&lt;dd&gt;the core of the macro processor should be minimal. This will help managing the code quality. The minimal core should be enriched using macros.&lt;/dd&gt;
&lt;dt&gt;retargetable/multi-targets&lt;/dt&gt;
&lt;dd&gt;using one and the same &#039;surface syntax&#039; to produce different target code. It should be possible to have a one to many code generation. Example application - one definition producing javascript, php and sql code. Alternative example: one definition - three code targets - debug, deployment + a set of autogenerated tests&lt;/dd&gt;
&lt;dt&gt;target and syntax agnostic&lt;/dt&gt;
&lt;dd&gt;no assumptions should be made (at least at top level) about the target or syntax. We should be able to accomodate any theoretically parsable syntax, within reason, of course. Subject to parsing strategy selection, etc...&lt;/dd&gt;
&lt;/dl&gt;
&lt;p&gt;&lt;a href=&quot;http://dikini.net/30.08.2006/macro_processor_initial_notes&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</description>
 <comments>http://dikini.net/30.08.2006/macro_processor_initial_notes#comment</comments>
 <category domain="http://dikini.net/tags/dylan">dylan</category>
 <category domain="http://dikini.net/tags/lisp">lisp</category>
 <category domain="http://dikini.net/tags/macros">macros</category>
 <category domain="http://dikini.net/tags/php">php</category>
 <category domain="http://dikini.net/tags/programming">programming</category>
 <category domain="http://dikini.net/tags/projects">projects</category>
 <category domain="http://dikini.net/tags/scheme">scheme</category>
 <category domain="http://dikini.net/tags/work_in_progress">work in progress</category>
 <pubDate>Wed, 30 Aug 2006 05:46:40 -0400</pubDate>
 <dc:creator>vlado</dc:creator>
 <guid isPermaLink="false">217 at http://dikini.net</guid>
</item>
<item>
 <title>macros, higher-order functions, datatypes and design patterns</title>
 <link>http://dikini.net/29.08.2006/macros_higher_order_functions_datatypes_and_design_patterns</link>
 <description>&lt;p&gt;While reading, researching and experimenting for my macros project the terms in the title get mixed a lot. I&#039;ll try to summarise what is my understanding of a lot of the above. To be fair, most of these words are heavily overloaded with sometimes contradictory and or ovelapping meanings, so this short is only about my personal summary, no pretence for a general study or lit review.&lt;/p&gt;
&lt;p&gt;Generic programming intuitevely corresponds to design patterns, or a tool to implement them. There should be a distinction between the functional or algorithmic side of the term and the structural or data (type) genericity.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://dikini.net/29.08.2006/macros_higher_order_functions_datatypes_and_design_patterns&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</description>
 <comments>http://dikini.net/29.08.2006/macros_higher_order_functions_datatypes_and_design_patterns#comment</comments>
 <category domain="http://dikini.net/tags/design_patterns">design patterns</category>
 <category domain="http://dikini.net/tags/dylan">dylan</category>
 <category domain="http://dikini.net/tags/haskell">haskell</category>
 <category domain="http://dikini.net/tags/macros">macros</category>
 <category domain="http://dikini.net/tags/php">php</category>
 <category domain="http://dikini.net/tags/programming">programming</category>
 <category domain="http://dikini.net/tags/scheme">scheme</category>
 <pubDate>Tue, 29 Aug 2006 10:09:21 -0400</pubDate>
 <dc:creator>vlado</dc:creator>
 <guid isPermaLink="false">215 at http://dikini.net</guid>
</item>
<item>
 <title>Rewriting macros - the peculiar case of php</title>
 <link>http://dikini.net/16.08.2006/rewriting_macros_the_peculiar_case_of_php</link>
 <description>&lt;p&gt;Without going into theoretical details, some of which are quite alien to me, I&#039;ll try to describe some of the challenges that pattern patching rewriting macros might pose for a language like php. After brief explanation what kind of a beast is this, I try to explore some of the finer points, which might cause problems. The intent of this post is to sketch a design and highlight some of the possible issues.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://dikini.net/16.08.2006/rewriting_macros_the_peculiar_case_of_php&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</description>
 <comments>http://dikini.net/16.08.2006/rewriting_macros_the_peculiar_case_of_php#comment</comments>
 <category domain="http://dikini.net/tags/ideas">ideas</category>
 <category domain="http://dikini.net/tags/macros">macros</category>
 <category domain="http://dikini.net/tags/php">php</category>
 <category domain="http://dikini.net/tags/programming">programming</category>
 <category domain="http://dikini.net/tags/projects">projects</category>
 <category domain="http://dikini.net/tags/work_in_progress">work in progress</category>
 <pubDate>Wed, 16 Aug 2006 08:29:03 -0400</pubDate>
 <dc:creator>vlado</dc:creator>
 <guid isPermaLink="false">211 at http://dikini.net</guid>
</item>
<item>
 <title>out of the (php) loop</title>
 <link>http://dikini.net/09.08.2006/out_of_the_php_loop</link>
 <description>&lt;p&gt;&lt;em&gt;&lt;a href=&quot;http://www.regdeveloper.co.uk/2006/08/08/cplusplus_loops/&quot; title=&quot;Out of the (C++) loop&quot; rel=&quot;nofollow&quot;&gt;inspired by Verity&lt;/a&gt;&lt;/em&gt; , my urge to display my writing talent and random buzz on the internet&lt;/p&gt;
&lt;p&gt;This conversation was (allegedly) overheard in a nursery, which won&#039;t be disclosed to avoid litigation &lt;/p&gt;
&lt;p&gt;&lt;em&gt;Write a standard php loop on the nursery blackboard&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Come on, can&#039;t be bothered. Are you joking?&lt;/strong&gt;&lt;br /&gt;
&lt;code&gt;foreach( $array as $key =&amp;gt; $value ) echo &quot;$key $value&quot;;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Wrong! Don&#039;t you ever learn proper language usage&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;What have I done NOW?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://dikini.net/09.08.2006/out_of_the_php_loop&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</description>
 <comments>http://dikini.net/09.08.2006/out_of_the_php_loop#comment</comments>
 <category domain="http://dikini.net/tags/php">php</category>
 <category domain="http://dikini.net/tags/programming">programming</category>
 <category domain="http://dikini.net/tags/scribbles">scribbles</category>
 <pubDate>Wed, 09 Aug 2006 12:32:03 -0400</pubDate>
 <dc:creator>vlado</dc:creator>
 <guid isPermaLink="false">209 at http://dikini.net</guid>
</item>
<item>
 <title>Poor man&#039;s macro programming in php (revisited)</title>
 <link>http://dikini.net/01.08.2006/poor_mans_macro_programming_in_php_revisited</link>
 <description>&lt;em&gt;How exactly can you do macros in php now?&lt;/em&gt;

&lt;p&gt;Macros have (let&#039;s say) two main responsibilities - adding syntactic sugar and abstraction of common patterns. The syntactic sugar bit is something which probably should happen at compile time, at least in a weakly typed language like php. So I&#039;ll skip them. The abstraction of computation, well this is wat codified design patterns are. This is what function, classes and the rest of the things we read about and use usually do. To abstract a function in php there are at least two different strategies, probably more, but these two are effective in diametrically different situations. The first one is a combination of the ideas of &lt;a href=&quot;http://dikini.net/generic_function&quot;&gt;generic functions (higher order functions)&lt;/a&gt; and &lt;a href=&quot;http://dikini.net/partial_evaluation&quot;&gt;partial evaluation&lt;/a&gt;. In code it can look something like:&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;http://dikini.net/01.08.2006/poor_mans_macro_programming_in_php_revisited&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</description>
 <comments>http://dikini.net/01.08.2006/poor_mans_macro_programming_in_php_revisited#comment</comments>
 <category domain="http://dikini.net/tags/design_patterns">design patterns</category>
 <category domain="http://dikini.net/tags/ideas">ideas</category>
 <category domain="http://dikini.net/tags/macros">macros</category>
 <category domain="http://dikini.net/tags/php">php</category>
 <category domain="http://dikini.net/tags/programming">programming</category>
 <pubDate>Tue, 01 Aug 2006 04:31:59 -0400</pubDate>
 <dc:creator>vlado</dc:creator>
 <guid isPermaLink="false">207 at http://dikini.net</guid>
</item>
<item>
 <title>Poor man&#039;s macro programming in php</title>
 <link>http://dikini.net/26.07.2006/poor_mans_macro_programming_in_php</link>
 <description>Jonnay&#039;s post I &lt;a href=&quot;http://dikini.net/26.07.2006/googles_summer_of_yawn&quot;&gt;mentioned before&lt;/a&gt; started me thinking - what do you need to have macros in php. What is the closest we can get to that without actually changing anything in php (poor man&#039;s version? What minimal sugar does php need to make it comfy? What is the natural syntax for macros in php?

I definitely don&#039;t know the answers to these questions but let&#039;s try:

&lt;code&gt;
  macro delay() {
     match { delay( $func, ... ) } : 
       { $varname = $func . random();
         $$varname = array(new promise( $func, ... ), &#039;evaluate&#039;); 
         return $varname;
       }
     match { $func( ... ) } :
       { return call_user_func($$varname, ... }; }
  }
&lt;/code&gt;
&lt;p&gt;This looks kind of allright, phpish. It has problems, but the above dream code demonstrates the idea enough - match the left-hand-side code and substitute it with the right hand side. The difference from C macros is that this macro is a program fragment/function/..., the result of which is substituted in the AST, as opposed to simple string pattern matching + substitution&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;http://dikini.net/26.07.2006/poor_mans_macro_programming_in_php&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</description>
 <comments>http://dikini.net/26.07.2006/poor_mans_macro_programming_in_php#comment</comments>
 <category domain="http://dikini.net/tags/macros">macros</category>
 <category domain="http://dikini.net/tags/php">php</category>
 <category domain="http://dikini.net/tags/programming">programming</category>
 <category domain="http://dikini.net/tags/scheme">scheme</category>
 <pubDate>Wed, 26 Jul 2006 11:43:44 -0400</pubDate>
 <dc:creator>vlado</dc:creator>
 <guid isPermaLink="false">203 at http://dikini.net</guid>
</item>
<item>
 <title>Updated design pattern collection</title>
 <link>http://dikini.net/26.07.2006/updated_design_pattern_collection</link>
 <description>&lt;p&gt;I guess I&#039;m on the down form my design pattern tantrum hit. I updated the collection so  it now has about 20 of them, not all can be considered &quot;officially&quot; design patterns, but to be honest I don&#039;t really care. I&#039;m very well aware that I ignore the existance of boundaries between design patterns, idioms, techniques, ... That is intentional. I like my rainbow coloured world and I want to keep it that way. If you disagree - just read the small script. My tanrum energy is over and I need to do work work. So the combing over the &lt;a href=&quot;http://dikini.net/php_design_patterns&quot;&gt;php design pattern collection&lt;/a&gt; will come later. For now enjoy, and have anger fits of your own.&lt;/p&gt;
&lt;p&gt;Oh yes. I&#039;m using a particular case of wishful thinking - using any php callable in $callable(...) expressions. The reality is a bit uglier. We need to use either call_user_func($callable,...); call_user_func_array($callable,...) How I wish php could do that out of the box, especially when it actually does it, just not in the short syntax. Anyone happy to hold my hand to do a php patch for that feature? I&#039;m very unfamiliar with the internals, sorry.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://dikini.net/26.07.2006/updated_design_pattern_collection&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</description>
 <comments>http://dikini.net/26.07.2006/updated_design_pattern_collection#comment</comments>
 <category domain="http://dikini.net/tags/design_patterns">design patterns</category>
 <category domain="http://dikini.net/tags/ideas">ideas</category>
 <category domain="http://dikini.net/tags/php">php</category>
 <category domain="http://dikini.net/tags/programming">programming</category>
 <pubDate>Wed, 26 Jul 2006 06:22:18 -0400</pubDate>
 <dc:creator>vlado</dc:creator>
 <guid isPermaLink="false">201 at http://dikini.net</guid>
</item>
<item>
 <title>Scoped php functions  or more ways to abuse php</title>
 <link>http://dikini.net/24.07.2006/scoped_php_functions_or_more_ways_to_abuse_php</link>
 <description>Here we go again. In this writeup I&#039;ll revisit the ideas of &lt;a href=&quot;http://dikini.net/24.01.2006/emulating_closures_in_php&quot;&gt;closures&lt;/a&gt;, &lt;a href=&quot;http://dikini.net/25.01.2006/some_ways_to_use_saved_state_with_closures_in_php&quot;&gt;state and closures&lt;/a&gt;, &lt;a href=&quot;http://dikini.net/03.07.2006/partial_evaluation_and_generics_in_php&quot;&gt;partial evaluation and generics&lt;/a&gt;.

&lt;h3&gt;Basics of &#039;functions as first class language objects&#039;&lt;/h3&gt;
Yep. PHP can assign functions to variables. In this sense functions are first class objects. Object and class methods are similar, you can, kind of, assign them to variables and later execute them. What does this change? Well, it improves our ability to abstract common patterns and idioms. There are examples of this in the above writeups as well as in the &lt;a href=&quot;http://dikini.net/14.06.2006/aspects_and_honey_in_php&quot;&gt;aspects&lt;/a&gt; one and quite a few of the rest of &lt;a href=&quot;http://dikini.net/node/add/tags/php&quot;&gt;php&lt;/a&gt; ones on this site. The basic concept is &lt;a href=&quot;http://uk.php.net/callback&quot;&gt;php callback&lt;/a&gt; for example:
&lt;code&gt;
call_user_func(&#039;a_callback_function&#039;);
call_user_func(array(&#039;AClass&#039;, &#039;aCallback&#039;));
call_user_func(array($obj, &#039;aCallback&#039;));

$callback = &#039;a_callback_function&#039;;
$callback();
$callback = array($obj, &#039;aCallback&#039;);
$callback();
&lt;/code&gt;
What can we use this for? The most obvious and straight forward this is a lightweight state pattern implementation - 
&lt;code&gt;$a_thing()&lt;/code&gt;
Will behave differently depending on the value of the $a_thing variable, it&#039;s state. Another way to look at php callbacks is as proxies for &#039;real&#039; functions, class or object methods.
 
Oh, let&#039;s not forget &lt;a href=&quot;http://uk.php.net/manual/en/function.is-callable.php&quot;&gt;is_callable&lt;/a&gt;, it&#039;s a very useful little number.

&lt;h3&gt;Objects and functions&lt;/h3&gt;
&lt;p&gt;The facility of PHP objects to encapsulate a state and us being able to access this state later can be used to turn them into functions. Let&#039;s consider:
&lt;code&gt;class aClass{
var $state;
function get() { return $state; }
function next() { $state=random; }
function callbacks() { return array( array($this,&#039;get&#039;), array($this, &#039;next&#039;));}
}
$obj = new aClass();
list( $random, $next_random ) = $obj-&gt;callbacks();
echo $random();
echo $next_random();
&lt;/code&gt;
&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;http://dikini.net/24.07.2006/scoped_php_functions_or_more_ways_to_abuse_php&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</description>
 <comments>http://dikini.net/24.07.2006/scoped_php_functions_or_more_ways_to_abuse_php#comment</comments>
 <category domain="http://dikini.net/tags/code">code</category>
 <category domain="http://dikini.net/tags/coding">coding</category>
 <category domain="http://dikini.net/tags/design_patterns">design patterns</category>
 <category domain="http://dikini.net/tags/php">php</category>
 <category domain="http://dikini.net/tags/programming">programming</category>
 <category domain="http://dikini.net/tags/scribbles">scribbles</category>
 <category domain="http://dikini.net/tags/work_in_progress">work in progress</category>
 <pubDate>Mon, 24 Jul 2006 06:09:03 -0400</pubDate>
 <dc:creator>vlado</dc:creator>
 <guid isPermaLink="false">177 at http://dikini.net</guid>
</item>
<item>
 <title>Does Visual Studio Rot the Mind?</title>
 <link>http://dikini.net/03.07.2006/does_visual_studio_rot_the_mind</link>
 <description>&lt;blockquote&gt;&lt;p&gt;This talk dissects the code generated by Visual Studio; analyzes the appalling programming practices it perpetuates; rhapsodizes about the joys, frustrations, and satisfactions of unassisted coding;&lt;br /&gt;
&lt;a href=&quot;http://www.charlespetzold.com/etc/DoesVisualStudioRotTheMind.html&quot; rel=&quot;nofollow&quot;&gt;Does visual studio rot the mind&lt;/a&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Nice. I like that article, not so much because it slags a Redmond born product, but that it goes to the core - bring back fun, in all it&#039;s forms, into programming. Just say no to ugly code.&lt;/p&gt;
&lt;p&gt;I really want elegant code back. Unfortunately there is too much of the quick fix hack smartly generated crap bloat.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://dikini.net/03.07.2006/does_visual_studio_rot_the_mind&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</description>
 <comments>http://dikini.net/03.07.2006/does_visual_studio_rot_the_mind#comment</comments>
 <category domain="http://dikini.net/tags/programming">programming</category>
 <category domain="http://dikini.net/tags/scribbles">scribbles</category>
 <pubDate>Mon, 03 Jul 2006 11:14:29 -0400</pubDate>
 <dc:creator>vlado</dc:creator>
 <guid isPermaLink="false">176 at http://dikini.net</guid>
</item>
<item>
 <title>Partial evaluation and generics in php</title>
 <link>http://dikini.net/03.07.2006/partial_evaluation_and_generics_in_php</link>
 <description>&lt;p&gt;This is a followup of a few of my previous posts (&lt;a href=&quot;/22.06.2006/lisp_like_programming_in_php&quot; rel=&quot;nofollow&quot;&gt;lisp-like programming&lt;/a&gt;, &lt;a href=&quot;/14.06.2006/aspects_and_honey_in_php&quot; rel=&quot;nofollow&quot;&gt;aspects and honey&lt;/a&gt;, &lt;a href=&quot;/20.01.2006/learning_lessons_from_lisp_or_patterns_and_languages_in_php&quot; rel=&quot;nofollow&quot;&gt;patterns &amp;amp; languages&lt;/a&gt;,  &lt;a href=&quot;/24.01.2006/emulating_closures_in_php&quot; rel=&quot;nofollow&quot;&gt;closures&lt;/a&gt;), which describe some programming idioms typical for lisp-like languages.&lt;/p&gt;
&lt;h3&gt;simple partial evaluation&lt;/h3&gt;
&lt;p&gt;Here I will add some very short examples for how to do partial evaluation in php. The most straight forward approach would be something like:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://dikini.net/03.07.2006/partial_evaluation_and_generics_in_php&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</description>
 <comments>http://dikini.net/03.07.2006/partial_evaluation_and_generics_in_php#comment</comments>
 <category domain="http://dikini.net/tags/php">php</category>
 <category domain="http://dikini.net/tags/programming">programming</category>
 <category domain="http://dikini.net/tags/scheming">scheming</category>
 <category domain="http://dikini.net/tags/very_shorts">very shorts</category>
 <pubDate>Mon, 03 Jul 2006 09:11:49 -0400</pubDate>
 <dc:creator>vlado</dc:creator>
 <guid isPermaLink="false">175 at http://dikini.net</guid>
</item>
<item>
 <title>aspects and honey in php</title>
 <link>http://dikini.net/14.06.2006/aspects_and_honey_in_php</link>
 <description>&lt;p&gt;The Drupal way in programming is 60% about hooks 10% about nodeapi and the rest is ingenuity. That&#039;s allright, but one fact has always troubled me. And that is - how much effort is spent on discovering which module implements the hook I need. Far enough, the old caching/memoizing trick does the job to ensure that the cpu time is not expensive. Yeah, but still it&#039;s outside simplicity might be, just might be implemented in a more elegant fashion.&lt;/p&gt;

&lt;p&gt;Drupal hooks implement a nearly Aspect Oriented API. The cross-cut is the point where the hook is invoked. aspect(cross-cut) === hook. The different aspects are declared as moduleName_&lt;em&gt;hook&lt;/em&gt;. The disatvantage is that these are indiscriminate. Hooks are always fired. Pros - simplicty, cons - wasted cpu cycles.&lt;/p&gt;

&lt;p&gt;I wonder. Is it possible to achieve a similarly simple syntax, but with the added advantage of not firing unnessesary hook calls.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://dikini.net/14.06.2006/aspects_and_honey_in_php&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</description>
 <comments>http://dikini.net/14.06.2006/aspects_and_honey_in_php#comment</comments>
 <category domain="http://dikini.net/tags/drupal">drupal</category>
 <category domain="http://dikini.net/tags/ideas">ideas</category>
 <category domain="http://dikini.net/tags/php">php</category>
 <category domain="http://dikini.net/tags/programming">programming</category>
 <enclosure url="http://dikini.net/files/aspect.php.txt" length="1750" type="text/plain" />
 <pubDate>Wed, 14 Jun 2006 11:06:18 -0400</pubDate>
 <dc:creator>vlado</dc:creator>
 <guid isPermaLink="false">164 at http://dikini.net</guid>
</item>
<item>
 <title>Lisp  without Parenthesis</title>
 <link>http://dikini.net/04.05.2006/lisp_without_parenthesis</link>
 <description>&lt;blockquote&gt;&lt;p&gt;Well itâ€™s impossible to remove all of the parentheses in Lisp, ..... One alternative to parentheses is being sensitive to white space, in a way that is reminiscent of Python. &lt;a href=&quot;http://pschombe.wordpress.com/2006/04/16/lisp-without-parentheses&quot;&gt;Lisp  without Parenthesis&lt;/a&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;A good post, which goes along the lines of what I&#039;m playing with as well.   He (Peter Schombert) suggests using \ as line continuation mark, which is in line with tradition. I would probably prefer it in the end, as opposed to the beginning of a line, but that&#039;s sugar.&lt;/p&gt;
&lt;p&gt;I wonder, how hard it would be to add such a language extention to mzscheme.&lt;/p&gt;
&lt;p&gt;Me being a noobie, I haven&#039;t had a clue that there is an SRFI, which implements that already.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://dikini.net/04.05.2006/lisp_without_parenthesis&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</description>
 <comments>http://dikini.net/04.05.2006/lisp_without_parenthesis#comment</comments>
 <category domain="http://dikini.net/tags/lisp">lisp</category>
 <category domain="http://dikini.net/tags/programming">programming</category>
 <category domain="http://dikini.net/tags/scheme">scheme</category>
 <pubDate>Thu, 04 May 2006 08:11:15 -0400</pubDate>
 <dc:creator>vlado</dc:creator>
 <guid isPermaLink="false">156 at http://dikini.net</guid>
</item>
<item>
 <title>Summer of Code applications</title>
 <link>http://dikini.net/04.05.2006/summer_of_code_applications</link>
 <description>&lt;p&gt;Funny things these summer of code applications. Some of them come a very well thought out projects, others are more like cloudy ideas.&lt;/p&gt;
&lt;p&gt;If you want to submit a proposal, and want to be successful, please put a little effort in spec-ing properly. Tangible goals are a very good thing. Good language, not really importnat, just put them in bullets if you fancy it that way.&lt;/p&gt;
&lt;p&gt;If unsure, get to #drupal on irc.freenet.org, and ask. Mention SOC and project proposal, and you&#039;ll get attention and tlc. That is if you are applying for a drupal project, for others, well don&#039;t expect much help in that channel.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://dikini.net/04.05.2006/summer_of_code_applications&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</description>
 <comments>http://dikini.net/04.05.2006/summer_of_code_applications#comment</comments>
 <category domain="http://dikini.net/tags/drupal">drupal</category>
 <category domain="http://dikini.net/tags/programming">programming</category>
 <pubDate>Thu, 04 May 2006 04:38:05 -0400</pubDate>
 <dc:creator>vlado</dc:creator>
 <guid isPermaLink="false">155 at http://dikini.net</guid>
</item>
<item>
 <title>SQL whining time</title>
 <link>http://dikini.net/03.05.2006/sql_whining_time</link>
 <description>&lt;p&gt;I must admit, I&#039;m doing it too. But why oh why, people thing that they must use an sql server, when writing a web application framework. It is beyond me.&lt;/p&gt;
&lt;p&gt;Some will say, &quot;Well my/pg/ms/any sql server is fast, it it there, it is ubiquous, flexible and everyone is doing itr, so you can find books about it.&lt;/p&gt;
&lt;p&gt;Let&#039;s tackle these pros one by one in our context. &lt;/p&gt;
&lt;h3&gt;Fast&lt;/h3&gt;
&lt;p&gt;Indeed, it can be. SQL server software is usually designed to work with vast amounts of data, stored on some secondary storage. &lt;em&gt;Relational&lt;/em&gt; data can be organised, searched, extracted fast. Sure. But. There is always one. A web application framework doesn&#039;t know the exact nature/model of the data. It usually builds a palette of primitive types, then does some magic to join those types per application type. You&#039;ll find object-relational mappings, sql synthesis algorithms, others, whend dealing with this problem.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://dikini.net/03.05.2006/sql_whining_time&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</description>
 <comments>http://dikini.net/03.05.2006/sql_whining_time#comment</comments>
 <category domain="http://dikini.net/tags/programmable_web">programmable web</category>
 <category domain="http://dikini.net/tags/programming">programming</category>
 <category domain="http://dikini.net/tags/sql">sql</category>
 <pubDate>Wed, 03 May 2006 03:50:37 -0400</pubDate>
 <dc:creator>vlado</dc:creator>
 <guid isPermaLink="false">154 at http://dikini.net</guid>
</item>
<item>
 <title>Programmable web</title>
 <link>http://dikini.net/programmable_web</link>
 <description>&lt;p&gt;These unfinished series or articles colloects some of my ideas about the programmeable web. I don&#039;t pretend them to be original, exclusive or useful to anyone but me. Although I hope so.&lt;/p&gt;
</description>
 <comments>http://dikini.net/programmable_web#comment</comments>
 <category domain="http://dikini.net/tags/programmable_web">programmable web</category>
 <category domain="http://dikini.net/tags/programming">programming</category>
 <category domain="http://dikini.net/tags/work_in_progress">work in progress</category>
 <pubDate>Fri, 28 Apr 2006 07:30:06 -0400</pubDate>
 <dc:creator>vlado</dc:creator>
 <guid isPermaLink="false">150 at http://dikini.net</guid>
</item>
<item>
 <title>x|s|p expressions mixing</title>
 <link>http://dikini.net/28.04.2006/x_s_p_expressions_mixing</link>
 <description>&lt;p&gt;To continue my &lt;a href=&quot;http://dikini.net/27.04.2006/random_thoughts_on_web_application_internals&quot; title=&quot;Random thoughts on web application internals&quot; rel=&quot;nofollow&quot;&gt;random ramblings&lt;/a&gt; on the programmable web let&#039;s get into the other side. Theming.&lt;/p&gt;
&lt;p&gt;These days it is a common place to have a theme engine available in almost any respectable web application. It&#039;s the result of the &lt;em&gt;spearation of concerns&lt;/em&gt; mantra and the desire to get designers and arty types off your back, give them the freedom to do almost anything they want, while not bothirng yourself (as a developr/admin) with too much unnessesary support requests. Theme engines and ideas how to build them are plenty. They differ a lot. But let&#039;s try and dissect what are they doing, or more likely what should they do.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://dikini.net/28.04.2006/x_s_p_expressions_mixing&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</description>
 <comments>http://dikini.net/28.04.2006/x_s_p_expressions_mixing#comment</comments>
 <category domain="http://dikini.net/tags/design">design</category>
 <category domain="http://dikini.net/tags/drupal">drupal</category>
 <category domain="http://dikini.net/tags/php">php</category>
 <category domain="http://dikini.net/tags/programmable_web">programmable web</category>
 <category domain="http://dikini.net/tags/programming">programming</category>
 <pubDate>Fri, 28 Apr 2006 03:16:08 -0400</pubDate>
 <dc:creator>vlado</dc:creator>
 <guid isPermaLink="false">149 at http://dikini.net</guid>
</item>
<item>
 <title>Random thoughts on web application internals</title>
 <link>http://dikini.net/27.04.2006/random_thoughts_on_web_application_internals</link>
 <description>&lt;p&gt;I&#039;ve been playing lately with a lot of different ideas. Part of it is to further my own education, part of it is looking for good software design tips. Although there exist quite a few good applications or frameworks, both open source and closed, I can&#039;t recommend any as really flexible. By really flexible, I mean easy ways to change its behaviour, how it reacts to the outside world. Most frameworks and applications excell at being themselves, and are rarely excelling at being really good citizens, they are inward looking, as far as their configuration and query is concerned. These are bold statements. They are quite subjective and probably useless. I&#039;ll try to explain what I really mean by &lt;em&gt;positive&lt;/em&gt; examples.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://dikini.net/27.04.2006/random_thoughts_on_web_application_internals&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</description>
 <comments>http://dikini.net/27.04.2006/random_thoughts_on_web_application_internals#comment</comments>
 <category domain="http://dikini.net/tags/drupal">drupal</category>
 <category domain="http://dikini.net/tags/php">php</category>
 <category domain="http://dikini.net/tags/programmable_web">programmable web</category>
 <category domain="http://dikini.net/tags/programming">programming</category>
 <category domain="http://dikini.net/tags/scheming">scheming</category>
 <pubDate>Thu, 27 Apr 2006 10:16:25 -0400</pubDate>
 <dc:creator>vlado</dc:creator>
 <guid isPermaLink="false">147 at http://dikini.net</guid>
</item>
<item>
 <title>da code, types of functions</title>
 <link>http://dikini.net/24.04.2006/da_code_types_of_functions</link>
 <description>&lt;p&gt;I&#039;ve been reviewing, scratching and descratching the idease for the language core, which for the time being I&#039;ll be calling da code.&lt;/p&gt;
&lt;p&gt;Everything revolves around a few fundamental questions about functions. What is a function? What is a function behaviour? What is the effect of one function&#039;s evaluation(behaviour) on the overall ecosystem of a program?&lt;/p&gt;
&lt;h3&gt;Function composition&lt;/h3&gt;
&lt;p&gt;In my head there are two fundamental kinds of function composition - sequential and parallel. It is true that they are redundant, since each of them can be expressed by the other, but in an attempt to provide a relatively brief and expressive language, I will consider both. This should help with intuitive application of different computational schematics.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://dikini.net/24.04.2006/da_code_types_of_functions&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</description>
 <comments>http://dikini.net/24.04.2006/da_code_types_of_functions#comment</comments>
 <category domain="http://dikini.net/tags/da_code">da code</category>
 <category domain="http://dikini.net/tags/programming">programming</category>
 <category domain="http://dikini.net/tags/scheming">scheming</category>
 <pubDate>Mon, 24 Apr 2006 08:33:55 -0400</pubDate>
 <dc:creator>vlado</dc:creator>
 <guid isPermaLink="false">144 at http://dikini.net</guid>
</item>
<item>
 <title>An alternative for multipage forms</title>
 <link>http://dikini.net/23.03.2006/an_alternative_for_multipage_forms</link>
 <description>&lt;p&gt;Both &lt;a href=&quot;http://dikini.net/22.03.2006/multi_page_forms_using_form_api&quot;&gt;yesterday&lt;/a&gt; and &lt;a href=&quot;http://dikini.net/14.02.2006/wizardy_druidy_wiz&quot;&gt;earlier&lt;/a&gt; I was writing about some ideas on how to handle multipage forms in drupal and php in general, while keeping consistent state. OK, here is another variation on the same theme. Code will speak for itself best in this case:&lt;br /&gt;
&lt;code&gt;.....&lt;br /&gt;
try {&lt;br /&gt;
  //this detects the nessesary form step and throws an appropriate exception&lt;br /&gt;
  init_form($request);&lt;br /&gt;
}&lt;br /&gt;
catch( FormStep1e $f ) {&lt;br /&gt;
  //do some specific handling&lt;br /&gt;
}&lt;br /&gt;
// ... other caught form steps&lt;br /&gt;
catch( FormStepNe $f ) {&lt;br /&gt;
    //do some specific handling&lt;br /&gt;
}&lt;br /&gt;
render_form($form)&lt;br /&gt;
....&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Advantages of this approach:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Natural program order, even for coding across requests&lt;/li&gt;
&lt;li&gt;obvious, switch-like semantics&lt;/li&gt;
&lt;li&gt;intuitive and explicit flow tracking&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Obviously this can be coded with switch() statements, but in my opinion this is a better approach, since combined with properly serialized state, we are able to significantly shorten the nessesary bootstrap process.&lt;/p&gt;
&lt;p&gt;On a further note, the same technique can be used to handle continuations-lite in php. The prerequisite is to be able to somehow save or serialise the runtime environment. Having that, we can do something like:&lt;br /&gt;
&lt;code&gt;try {&lt;br /&gt;
  process_request();&lt;br /&gt;
}&lt;br /&gt;
catch( ContExn $cont){&lt;br /&gt;
  $cont-&amp;gt;exec()&lt;br /&gt;
}&lt;br /&gt;
&lt;/code&gt;&lt;br /&gt;
process_request() restores the environment into the ContExn object and throws the exception.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://dikini.net/23.03.2006/an_alternative_for_multipage_forms&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</description>
 <comments>http://dikini.net/23.03.2006/an_alternative_for_multipage_forms#comment</comments>
 <category domain="http://dikini.net/tags/php">php</category>
 <category domain="http://dikini.net/tags/programming">programming</category>
 <pubDate>Thu, 23 Mar 2006 02:57:01 -0500</pubDate>
 <dc:creator>vlado</dc:creator>
 <guid isPermaLink="false">135 at http://dikini.net</guid>
</item>
<item>
 <title>Multi-page forms using form api</title>
 <link>http://dikini.net/22.03.2006/multi_page_forms_using_form_api</link>
 <description>&lt;blockquote&gt;&lt;p&gt;After months of work between hunmonk, myself, and chx, we&#039;ve finalized some substantial progress on multipart forms. A multipart form is a form that is spread across multiple pages (like a wizard), but doesn&#039;t truly &quot;submit&quot; until the final page.&lt;br /&gt;
Morbus Iff on the drupal development mailing list
&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;That is a cool functionality. While it shows the capability of the forms api to handle multi-page forms via the #pre_render function, which is good, the approach is only the beginning of multi-page form handling.&lt;/p&gt;
&lt;p&gt;Some time ago I was writing about a proposed &lt;a href=&quot;http://dikini.net/14.02.2006/wizardy_druidy_wiz&quot;&gt;method for resolving application state across multi-page forms&lt;/a&gt;. The sceme applies directly.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://dikini.net/22.03.2006/multi_page_forms_using_form_api&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</description>
 <comments>http://dikini.net/22.03.2006/multi_page_forms_using_form_api#comment</comments>
 <category domain="http://dikini.net/tags/drupal">drupal</category>
 <category domain="http://dikini.net/tags/programming">programming</category>
 <category domain="http://dikini.net/taxonomy/term/105">shorts</category>
 <pubDate>Wed, 22 Mar 2006 02:46:52 -0500</pubDate>
 <dc:creator>vlado</dc:creator>
 <guid isPermaLink="false">134 at http://dikini.net</guid>
</item>
<item>
 <title>Wizardy, druidy, wiz</title>
 <link>http://dikini.net/14.02.2006/wizardy_druidy_wiz</link>
 <description>&lt;p&gt;For a while I&#039;ve been looking at some interesting techniques for improved state tracking for web applications. &lt;a href=&quot;http://seaside.st&quot; title=&quot;smalltalk web application framework&quot; rel=&quot;nofollow&quot;&gt;Seaside&lt;/a&gt; and &lt;a href=&quot;/www.plt-scheme.org&quot; title=&quot;PLT Scheme&quot; rel=&quot;nofollow&quot;&gt;plt scheme webserver&lt;/a&gt; are using continuations to improve session handling, and have a nice clean code while at it. What does this mean? Continuations are a functional goto. They allow you to capture and save the state of an application, and possibly to return to it at any time. You could think of it as a snapshot of the current state of the application. Well, not exactly, but for the current discussion this will suffice.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://dikini.net/14.02.2006/wizardy_druidy_wiz&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</description>
 <comments>http://dikini.net/14.02.2006/wizardy_druidy_wiz#comment</comments>
 <category domain="http://dikini.net/tags/continuations">continuations</category>
 <category domain="http://dikini.net/tags/drupal">drupal</category>
 <category domain="http://dikini.net/tags/ideas">ideas</category>
 <category domain="http://dikini.net/tags/php">php</category>
 <category domain="http://dikini.net/tags/programming">programming</category>
 <category domain="http://dikini.net/taxonomy/term/105">shorts</category>
 <pubDate>Tue, 14 Feb 2006 10:59:44 -0500</pubDate>
 <dc:creator>vlado</dc:creator>
 <guid isPermaLink="false">130 at http://dikini.net</guid>
</item>
<item>
 <title>a sample testsuite for the (any/type) base types</title>
 <link>http://dikini.net/14.02.2006/a_sample_testsuite_for_the_any_type_base_types</link>
 <description>&lt;p&gt;Here comes a sample test suite (it is too long, so only the beginning features in here) for the any/types, I described earlier. I like the clenliness of the schemeunit library. It features a rich set of assertions, simple but powerful grouping and both text and gui result interfaces. In order to use it you need &lt;a href=&quot;http://www.plt-scheme.org&quot; title=&quot;PLT scheme&quot;&gt;plt scheme&lt;/a&gt;. Then you can grab the unit test suite from planet:
&lt;code&gt;(require (planet &quot;test.ss&quot; (&quot;schematics&quot; &quot;schemeunit.plt&quot; 1 2)))&lt;/code&gt;
&lt;/p&gt;
&lt;p&gt;The code here shows testing only the &lt;em&gt;any/text&lt;/em&gt; type and all relevant auxilary functions, using this datatatype. Looking at the code, it could be turned into a macro, so we could generate type tests automatically, rather than writing this long code..&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;http://dikini.net/14.02.2006/a_sample_testsuite_for_the_any_type_base_types&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</description>
 <comments>http://dikini.net/14.02.2006/a_sample_testsuite_for_the_any_type_base_types#comment</comments>
 <category domain="http://dikini.net/tags/code">code</category>
 <category domain="http://dikini.net/tags/programming">programming</category>
 <category domain="http://dikini.net/tags/scheme">scheme</category>
 <category domain="http://dikini.net/tags/work_in_progress">work in progress</category>
 <pubDate>Tue, 14 Feb 2006 08:25:32 -0500</pubDate>
 <dc:creator>vlado</dc:creator>
 <guid isPermaLink="false">128 at http://dikini.net</guid>
</item>
<item>
 <title>What language I would like to program net applications in?</title>
 <link>http://dikini.net/09.02.2006/what_language_i_would_like_to_program_net_applications_in</link>
 <description>&lt;p&gt;What should be the language for the web? Many people will swear it is php. It&#039;s best features are immediacy and the fact that it does not look scary, initially at least. Loads of libraries as well. Some will say ruby - not sure about that, never really used it. I - don&#039;t know.&lt;/p&gt;
&lt;p&gt;Programing the network should be seamless. This means that the hard things should have obvious solutions transparent in the language constructs. For example a web gnome druid like code snippet shouldn&#039;t look far harder than:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;druid (step1 step2 step3 step4)&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;
The webserver coming with plt is a good example for this style of implementation - here is a snippet:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://dikini.net/09.02.2006/what_language_i_would_like_to_program_net_applications_in&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</description>
 <comments>http://dikini.net/09.02.2006/what_language_i_would_like_to_program_net_applications_in#comment</comments>
 <category domain="http://dikini.net/tags/programming">programming</category>
 <category domain="http://dikini.net/tags/rants">rants</category>
 <pubDate>Thu, 09 Feb 2006 05:16:20 -0500</pubDate>
 <dc:creator>vlado</dc:creator>
 <guid isPermaLink="false">126 at http://dikini.net</guid>
</item>
</channel>
</rss>
