<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>klog</title>
	<atom:link href="http://verens.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://verens.com</link>
	<description>php, linux, ajax, javascript, kae verens</description>
	<lastBuildDate>Sun, 14 Mar 2010 23:06:40 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>clavichord keyboard and soundbox</title>
		<link>http://verens.com/archives/2010/03/15/clavichord-keyboard-and-soundbox/</link>
		<comments>http://verens.com/archives/2010/03/15/clavichord-keyboard-and-soundbox/#comments</comments>
		<pubDate>Sun, 14 Mar 2010 23:06:40 +0000</pubDate>
		<dc:creator>Kae Verens</dc:creator>
				<category><![CDATA[music]]></category>

		<guid isPermaLink="false">http://verens.com/?p=993</guid>
		<description><![CDATA[<p>Over the weekend, I cut out the keyboard for the clavichord and built the soundbox.</p>
<p>How a clavichord works is that you have strings which are strung between hitch pins and tuning pegs, with a bridge in between. The strings are damped at both ends by cloth called &#8220;listing&#8221;.</p>
<p>When a key is pressed, a &#8220;tangent&#8221; is [...]]]></description>
			<content:encoded><![CDATA[<p>Over the weekend, I cut out the keyboard for the clavichord and built the soundbox.</p>
<p>How a clavichord works is that you have strings which are strung between hitch pins and tuning pegs, with a bridge in between. The strings are damped at both ends by cloth called &#8220;listing&#8221;.</p>
<p>When a key is pressed, a &#8220;tangent&#8221; is banged up against the string, creating a standing wave between the tangent and the bridge. When the key is released, the tangent loses contact with the string and the wave is then damped.</p>
<p>As I&#8217;m building all of this as cheaply as possible, I don&#8217;t have proper material, so I&#8217;m very interested to see how well it sounds when finished.</p>
<p>I couldn&#8217;t find any proper wood to act as a soundboard, so used the side of an old computer case, cut to size. I&#8217;ve never heard of a metal soundboard in a clavichord &#8211; but then, I&#8217;ve also never heard of a plywood clavichord.</p>
<p>My friend Sean dropped over yesterday and gave me a roll of high-tensile wire &#8211; the sort of stuff that&#8217;s usually used in industry when strength is needed. The wire is made of 15-20 individual wires, each twined to create a single whole.</p>
<p>I haven&#8217;t got the tuning pegs created yet, but was able to test the sound of the clavichord by unwrapping a single strand from the wire, and running it from a hitch pin to a screwdriver in one of the tuning peg holes, and tightening it as much as possible by hand, then levering a small piece of plywood under the wire to act as a bridge on the soundboard.</p>
<p>Plucking the string made a clear tone, but hammering and holding the hammer against the string it didn&#8217;t make much of a sound. That&#8217;s kind of to be expected, though. After all, it&#8217;s been said that the clavichord is &#8220;the one instrument that can be played by a person on one side of a double-bed without disturbing someone in the other side&#8221;.</p>
<p>It will probably sound much better when I&#8217;ve made a proper bridge and got proper tangents running.</p>
]]></content:encoded>
			<wfw:commentRss>http://verens.com/archives/2010/03/15/clavichord-keyboard-and-soundbox/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>plywood clavichord project</title>
		<link>http://verens.com/archives/2010/03/10/plywood-clavichord-project/</link>
		<comments>http://verens.com/archives/2010/03/10/plywood-clavichord-project/#comments</comments>
		<pubDate>Wed, 10 Mar 2010 21:04:48 +0000</pubDate>
		<dc:creator>Kae Verens</dc:creator>
				<category><![CDATA[music]]></category>
		<category><![CDATA[piano]]></category>

		<guid isPermaLink="false">http://verens.com/?p=978</guid>
		<description><![CDATA[<p>My piano is going out of tune.</p>
<p>The local tuner says it can&#8217;t be tuned. but, seeing as he&#8217;s also the owner of the local piano shop, I really don&#8217;t think I can trust his word on that &#8211; especially as another tuner (in Dublin) laughed immediately when that was said to him.</p>
<p>I&#8217;m certain that I [...]]]></description>
			<content:encoded><![CDATA[<p>My piano is going out of tune.</p>
<p>The local tuner says it can&#8217;t be tuned. but, seeing as he&#8217;s also the owner of the local piano shop, I really don&#8217;t think I can trust his word on that &#8211; especially as another tuner (in Dublin) laughed immediately when that was said to him.</p>
<p>I&#8217;m certain that I can tune the piano, but I&#8217;ve been told not to, by both the tuner in Dublin, and also by Bronwyn&#8217;s mum, who owns it &#8211; apparently the slightest mistake can be costly.</p>
<p>And so, I&#8217;m going to build my own keyboard, which I can tune if I want to.</p>
<p>Here&#8217;s a picture of the end-goal &#8211; a well-made clavichord:</p>
<p><a href="http://en.wikipedia.org/wiki/File:Hillclavichord.jpg"><img src="http://verens.com/wp-content/uploads/2010/03/250px-Hillclavichord.jpg" alt="" title="clavichord" class="aligncenter size-full wp-image-980" /></a></p>
<p>To buy a ready-built <a href="http://en.wikipedia.org/wiki/Clavichord">clavichord</a> would cost 8000 euro or <a href="http://keithhillharpsichords.com/clavichords.html">higher</a>. To get a kit version which you put together yourself would cost <a href="http://www.clavichords.com/kit_prices.htm">3500</a> or higher.</p>
<p>I feel that&#8217;s a little bit high, so I&#8217;m trying to make a simple clavichord, where the materials cost 50 euro or less. I&#8217;m not counting the cost of the tools.</p>
<p>So far, the materials have cost less than 25 euro &#8211; a sheet of 22mm plywood, and some wood glue.</p>
<p><a href="http://verens.com/wp-content/uploads/2010/03/IMG_2510.jpg"><img src="http://verens.com/wp-content/uploads/2010/03/IMG_2510-150x150.jpg" alt="" title="IMG_2510" width="150" height="150" class="aligncenter size-thumbnail wp-image-981" /></a></p>
<p>Today&#8217;s progress is that I have the basic shell of the thing created. It&#8217;s 100cm x 30cm in size, with internal walls of 10cm.</p>
<p><a href="http://verens.com/wp-content/uploads/2010/03/IMG_2514.jpg"><img src="http://verens.com/wp-content/uploads/2010/03/IMG_2514-150x150.jpg" alt="" title="IMG_2514" width="150" height="150" class="aligncenter size-thumbnail wp-image-982" /></a></p>
<p>The keyboard will be four-octaves in length. 49 keys, from C two octaves below middle.</p>
<p>I&#8217;ll start cutting the keyboard out tomorrow. Hopefully I&#8217;ll be able to finish off all the woodwork by then.</p>
<p>Then it&#8217;s time to start thinking about the strings.</p>
]]></content:encoded>
			<wfw:commentRss>http://verens.com/archives/2010/03/10/plywood-clavichord-project/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CMS Design with jQuery and PHP: postage and packaging prices</title>
		<link>http://verens.com/archives/2010/03/09/cms-design-with-jquery-and-php-postage-and-packaging-prices/</link>
		<comments>http://verens.com/archives/2010/03/09/cms-design-with-jquery-and-php-postage-and-packaging-prices/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 16:07:49 +0000</pubDate>
		<dc:creator>Kae Verens</dc:creator>
				<category><![CDATA[ajax]]></category>
		<category><![CDATA[book]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[packt]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[webme]]></category>

		<guid isPermaLink="false">http://verens.com/?p=971</guid>
		<description><![CDATA[<p>This article is based on work which will be expanded more fully in the book, when I get to that chapter.</p>
<p>Every time we do an online store here in webworks, the postage/packaging is different. In one case, for example, postage is free over €50 euro, in another, it depends on where it&#8217;s going, and in [...]]]></description>
			<content:encoded><![CDATA[<p><i>This article is based on work which will be expanded more fully in the book, when I get to that chapter.</i></p>
<p>Every time we do an online store here in <a href="http://webworks.ie/">webworks</a>, the postage/packaging is different. In one case, for example, postage is free over €50 euro, in another, it depends on where it&#8217;s going, and in the latest, it depends on a load of factors including where it&#8217;s going, what the weight of the products is, and what delivery option was chosen.</p>
<p>Up until now, hand-coded the postage rules. Everything else was handled by user-friendly parts of our CMS, but postage was such a random thing that we couldn&#8217;t find anything common enough that we could make a generic P&amp;P handler.</p>
<p>The finished product is more complex than this example, but I&#8217;ll describe a cut-down version of what we&#8217;ve done, with countries and parcel-types removed.</p>
<p><a href="/demos/postage-and-packaging/admin.php">admin demo</a> &#8211; demo of UI for generating P&amp;P rules</p>
<p>The first demo shows how the postage-and-packaging rule-set is created, using an &#8220;if-else&#8221; flow generator to build up the logic of the thing, and after each major action, convert the current state into a JSON string which can be saved.</p>
<p>The PHP is not really important in this one. The JavaScript handles everything. It translates a &#8220;seed&#8221; JSON string into a graphical representation of the rules, which can then be manipulated and finally translated back (automatically) into a JSON string to be saved in a DB (or session in this case). <a href="/demos/postage-and-packaging/admin.phps">source for the PHP</a>, <a href="/demos/postage-and-packaging/admin.js">source for the JS</a>.</p>
<p>The frontend does its work in the background:</p>
<p><a href="/demos/postage-and-packaging/frontend.php">frontend demo</a> &#8211; using those rules to evaluate P&amp;P (visit admin first).</p>
<p>In this case, we enter values &#8211; total, weight &#8211; and run through the rule-set to find out what the P&amp;P ends up as.</p>
<p>The source is suprisingly small, using a small recursive function to dig through the rules, no matter how deep and complex they go.</p>
<p>Here&#8217;s the recursive function (see <a href="/demos/postage-and-packaging/frontend.phps">source</a> for rest of file):</p>
<pre class="php">
function os_getPostageAndPackagingSubtotal($cstrs,$total,$weight){
  foreach($cstrs as $cstr){
    if($cstr-&gt;type=='total_weight_less_than_or_equal_to' &#038;&#038; $weight&lt;=$cstr-&gt;value)return os_getPostageAndPackagingSubtotal($cstr-&gt;constraints,$total,$weight);
    if($cstr-&gt;type=='total_weight_more_than_or_equal_to' &#038;&#038; $weight&gt;=$cstr-&gt;value)return os_getPostageAndPackagingSubtotal($cstr-&gt;constraints,$total,$weight);
    if($cstr-&gt;type=='total_less_than_or_equal_to' &#038;&#038; $total&lt;=$cstr-&gt;value)return os_getPostageAndPackagingSubtotal($cstr-&gt;constraints,$total,$weight);
    if($cstr-&gt;type=='total_more_than_or_equal_to' &#038;&#038; $total&gt;=$cstr-&gt;value)return os_getPostageAndPackagingSubtotal($cstr-&gt;constraints,$total,$weight);
  }
  $val=str_replace('weight',$weight,$cstr-&gt;value);
  $val=str_replace('total',$total,$val);
  $val=preg_replace('#[^0-9*/\-+.\(\)]#','',$val);
  if(preg_match('/[^0-9.]/',$val))eval('$val=('.$val.');');
  return (float)$val;
}
</pre>
<p>The <code>switch</code> block goes through the various &#8220;if&#8221; types that can exist in the flow model, handling each of them recursively and return their values to the caller.</p>
<p>If no &#8220;if&#8221;s are encountered, then the ruleset has found an answer, and we return that answer.</p>
<p>Before returning it, though, we parse the value of the answer. This is in case the answer is a math formula to do with the weight or total of the item.</p>
<p>For example, <a href="http://www.anpost.ie/">An Post</a> have definite prices for packets to Europe up to 2kg (which is 10.75), and beyond that, it&#8217;s 3 euro extra for every extra kg.</p>
<p>That translates to a load of definite &#8220;if&#8221; statements, and an end value of &#8220;(weight-2)*3+10.75&#8243; for the final &#8220;else&#8221;.</p>
<p>So, we convert recognisable words such as &#8220;weight&#8221; or &#8220;total&#8221; to numbers, make sure that we&#8217;re only left with parseable characters (and not something that can be used to hack), and <code>eval</code> it to produce the result.</p>
<p>Obviously, the full product is more complete than this, with safeguards against faulty formulas, extras to handle countries and envelope types (parcel/packet/envelope), but this example should give you a few ideas if you&#8217;re building your own P&amp;P handler.</p>
]]></content:encoded>
			<wfw:commentRss>http://verens.com/archives/2010/03/09/cms-design-with-jquery-and-php-postage-and-packaging-prices/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>new irish plans (a construction industry thing)</title>
		<link>http://verens.com/archives/2010/02/27/new-irish-plans-a-construction-industry-thing/</link>
		<comments>http://verens.com/archives/2010/02/27/new-irish-plans-a-construction-industry-thing/#comments</comments>
		<pubDate>Sat, 27 Feb 2010 17:48:23 +0000</pubDate>
		<dc:creator>Kae Verens</dc:creator>
				<category><![CDATA[ajax]]></category>
		<category><![CDATA[general]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://verens.com/?p=965</guid>
		<description><![CDATA[<p>We&#8217;ve just released newirishplans.com, a site for finding commencement notices. This is extremely useful for people in the construction industry, as I&#8217;ll explain.</p>
<p>Companies that work in construction need to be constantly on the lookout for new projects that are starting up. If you find a project just before it starts, you can call up and [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://webworks.ie/">We&#8217;ve</a> just released <a href="http://www.newirishplans.com/">newirishplans.com</a>, a site for finding commencement notices. This is extremely useful for people in the construction industry, as I&#8217;ll explain.</p>
<p>Companies that work in construction need to be constantly on the lookout for new projects that are starting up. If you find a project just before it starts, you can call up and advertise your business, instead of waiting for the project manager to get around to finding someone else when the time comes.</p>
<p>As an example, if you sell bricks, it is better to call the manager of a house-building project just before they start building the house, than to not call at all, and realised when the house is built that the manager found a different brick supplier and didn&#8217;t realise you even existed.</p>
<p>You need to time the call as well &#8211; if you call too late, it&#8217;s obviously too late, but if you call months before the project starts, then the manager may totally forget you exist by the time the build actually needs your wares.</p>
<p>One way to find these builds that are starting up is to go around to all the planning authorities in your area of interest, and inspect any &#8220;commencement notices&#8221; that have been submitted since the last time you visited. A &#8220;commencement notice&#8221; is notification that you are about to start work on your build. All planning applications have this as a requirement.</p>
<p>Obviously, this can take hours out of your working week (and therefore, money), and even after you have the notice, you need to match the notice to the application and see if you&#8217;re actually interested in it at all.</p>
<p>The <a href="http://www.newirishplans.com/">new irish plans</a> project does this all for you. At the moment, the project covers <a href="http://www.newirishplans.com/Commencements">about 17 counties</a>, but we are always adding to this. For example, I&#8217;m working on getting Fingal added to the mix at the moment.</p>
<p>An account on the site costs 35 euro a month, and with that, you get an email once a week telling you of any commencements that the system has uncovered during that week.</p>
<p>But anyway &#8211; €35 euro a month. Just over one euro a day, and it&#8217;s all emailed to you.</p>
<p><strong>If you know anyone in construction (does windows, landscapes, roofs, electrics, etc.) that is looking for work, tell them to go to <a href="http://www.newirishplans.com/">newirishplans.com</a> &#8211; the information is handed to you on a plate.</strong></p>
<p>On the programming side, we wanted to make the search engine stand out, so we used the <a href="http://code.google.com/p/inlinemultiselect/">inline multiselect</a> jQuery plugin (with a few small modifications) to help make selection of features and dates easier.</p>
<p>When I first came across that plugin, I was surprised and kinda proud to find that it&#8217;s based on <a href="http://verens.com/archives/2005/04/27/son-of-multiselect/">some of my own work</a> from 5 years ago! Open source is brilliant &#8211; you write a small piece of code and give it away, then 5 years later you find that someone has taken it and improved it vastly.</p>
<p>Commencements go through a &#8220;vetting&#8221; process. When a commencement is found, details about it are placed in a system where someone reads through the planning application, and marks down any interesting features about it. Those that have been vetted are then imported once a day into the main site itself, where you can search for them online, filtered by whatever interests you.</p>
<p>The system has been very long in the building, and has changed quite a bit over time. We&#8217;re very happy to finally make it public!</p>
<p>There&#8217;s still a few things that need to be completed on it (for example, we&#8217;re still organising WorldPay integration, but in the meantime we have PayPal), but on the whole, it&#8217;s ready for public use.</p>
]]></content:encoded>
			<wfw:commentRss>http://verens.com/archives/2010/02/27/new-irish-plans-a-construction-industry-thing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CMS Design using PHP and jQuery</title>
		<link>http://verens.com/archives/2010/02/01/cms-design-using-php-and-jquery/</link>
		<comments>http://verens.com/archives/2010/02/01/cms-design-using-php-and-jquery/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 10:55:10 +0000</pubDate>
		<dc:creator>Kae Verens</dc:creator>
				<category><![CDATA[book]]></category>
		<category><![CDATA[databases]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[packt]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[webme]]></category>

		<guid isPermaLink="false">http://verens.com/?p=960</guid>
		<description><![CDATA[<p>I&#8217;m happy this week. Last week, I spent some time and organised myself a bit more. In work, things are going smoothly &#8211; managed to get over a tricky piece of work and the rest is simply a list of small tasks.</p>
<p>For the last few weeks, I&#8217;ve been emailing and messaging Darshana at Packt Publishing, [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m happy this week. Last week, I spent some time and organised myself a bit more. In work, things are going smoothly &#8211; managed to get over a tricky piece of work and the rest is simply a list of small tasks.</p>
<p>For the last few weeks, I&#8217;ve been emailing and messaging Darshana at <a href="http://packtpub.com/">Packt Publishing</a>, about writing a second book (<a href="http://www.packtpub.com/jquery-1-3-with-php/book">jQuery 1.3 with PHP</a> is going very well &#8211; <a href="http://verens.com/archives/2009/12/13/jquery-1-3-with-php-buy-it/">list of reviews</a>).</p>
<p>I initially wanted to write about file management, to explain how <a href="http://kfm.verens.com/">KFM</a> works, and to help force me to improve on it. But there&#8217;s just not enough of an interested market in that &#8211; it&#8217;s too specialised.</p>
<p>So instead, I&#8217;ll be writing about CMS design using PHP and jQuery.</p>
<p><a href="http://webworks.ie/">We (webworks.ie)</a> have a CMS engine which we&#8217;ve written and improved for the last 6 or so years. We&#8217;ve open-sourced it a number of times, but never managed to generate much interest in it. We never had the time to spend on publicising it.</p>
<p>The book will not be specifically about that engine, but rather about the concepts that went into creating it &#8211; how a CMS works, how to manage plugins, administration, user management, and all the other little bits and pieces that every PHP developer needs to eventually address.</p>
<p>By way of explanation, I will be demonstrating various parts of our CMS, and explaining how and why it was built that way. I will be closely examining the other major CMSes as well, and giving alternative methods where good ones exist.</p>
<p>The proposed chapter list is:</p>
<ol>
<li>Introduction</li>
<li>CMS core design</li>
<li>User management and access control</li>
<li>Page creation and Navigation</li>
<li>Template Management</li>
<li>Plugins</li>
<li>Form creation</li>
<li>Image Gallery</li>
<li>Panels</li>
<li>Search and Polls</li>
<li>RSS and News</li>
<li>Online Store</li>
<li>Products</li>
</ol>
<p>I&#8217;m really excited about this project!</p>
]]></content:encoded>
			<wfw:commentRss>http://verens.com/archives/2010/02/01/cms-design-using-php-and-jquery/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>what&#8217;s up!</title>
		<link>http://verens.com/archives/2010/01/27/whats-up/</link>
		<comments>http://verens.com/archives/2010/01/27/whats-up/#comments</comments>
		<pubDate>Wed, 27 Jan 2010 09:35:53 +0000</pubDate>
		<dc:creator>Kae Verens</dc:creator>
				<category><![CDATA[ajax]]></category>
		<category><![CDATA[areyoumad]]></category>
		<category><![CDATA[book]]></category>
		<category><![CDATA[depression]]></category>
		<category><![CDATA[general]]></category>
		<category><![CDATA[kfm]]></category>
		<category><![CDATA[life]]></category>
		<category><![CDATA[music]]></category>
		<category><![CDATA[packt]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[piano]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://verens.com/?p=958</guid>
		<description><![CDATA[<p>Short run-down of what I&#8217;m doing lately: nothing.</p>
<p>Less short: I&#8217;m trying to get work out the door, get a good run at some personal projects, pass grade 2 piano, get organised, and generally improve my lot.</p>
<p>None of this is working. I think the &#8220;get organised&#8221; bit is the most important, as it will help the [...]]]></description>
			<content:encoded><![CDATA[<p>Short run-down of what I&#8217;m doing lately: nothing.</p>
<p>Less short: I&#8217;m trying to get work out the door, get a good run at some personal projects, pass grade 2 piano, get organised, and generally improve my lot.</p>
<p>None of this is working. I think the &#8220;get organised&#8221; bit is the most important, as it will help the rest of it fall into place.</p>
<p>I usually only post about web-development-related topics here, as that&#8217;s the only subject where I feel I can contribute something new and interesting, so I tend to not talk about other stuff. But sometimes, rattling off the current state of the head is good for clearing it.</p>
<p>In work, I can&#8217;t really complain &#8211; we have a number of largish projects which are slowly creeping towards completion. The hardest thing about them is getting information from the clients, and then a week or two later being told that half the information is not required. I guess my main complaint at work is the inexorably slow completion rate.</p>
<p>On the personal projects side:</p>
<p>There are still a number of small bugs in <a href="http://kfm.verens.com/">KFM 1.4</a>, and either I don&#8217;t have the time to get to them, or there is no enough information to recreate the bug and the submitter doesn&#8217;t give me access to their copy so I can&#8217;t see it from their side.</p>
<p>KFM 2 has been halted for a while &#8211; the idea is huge, but I simply don&#8217;t have the time, and no-one is clambering for it. I&#8217;ll get to it when I have time, but I might have to approach it by evolving KFM 1.x into meeting what I wanted, instead of the original goal of building KFM 2 from scratch.</p>
<p>I started a new project, <a href="http://www.oddjobs4locals.com/">OddJobs4Locals</a> two weeks back, and got a good two-day run at it, then time got ahead of me again. I think this will be a good one, when I can complete it. Useful for students, people with a little spare time, or simply people that just want to make a little extra cash. Not yet working, but it will be soon, I hope&#8230; This is doubly interesting to me, as it is done purely through AJAX, so it will be easy to do a smart-phone client or a desktop client when the time comes.</p>
<p>I&#8217;m in the back/forth stage of working with Packt publishing to see if they want me to do a second book (<a href="http://verens.com/archives/2009/12/13/jquery-1-3-with-php-buy-it/">the first one has no bad reviews at all</a>). We&#8217;ve mostly agreed on a table of contents, and I&#8217;m just trying to get the time to combine a few of the smaller chapters together.</p>
<p>On the piano, I&#8217;ve been ready for the grade 2 exam since November, and am still waiting to see if there will be an exam near me any time soon &#8211; I hate the effort that goes into travelling (I have a family, and no car). I was hoping to do a grade every 6 months. It looks like this might not be possible, despite me being ready for it&#8230; The tunes I&#8217;m doing for it are <a href="http://www.youtube.com/watch?v=ASdAX7ws_H8">Beethoven&#8217;s Sonatina in G Major</a>, <a href="http://www.youtube.com/watch?v=FQFRx-y2tJc">a waltz by Bela Bartok</a>, and Boys And Girls Come Out To Samba, by Terence Greaves &#8211; by the way, I don&#8217;t like those videos; there are no dynamics in any of them, and I can hear a number of mistakes as well. No video apparently of the Terence Greaves one.</p>
<p>As for organisation&#8230; well I guess I&#8217;d better start working with Mantis again.</p>
<p>My lot will have to wait &#8211; I&#8217;ve a load of work to get done before it <em>can</em> improve.</p>
<p>Meh. Depression taking hold again.</p>
]]></content:encoded>
			<wfw:commentRss>http://verens.com/archives/2010/01/27/whats-up/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>win a copy of jQuery 1.3 With PHP</title>
		<link>http://verens.com/archives/2010/01/07/win-a-copy-of-jquery-1-3-with-php/</link>
		<comments>http://verens.com/archives/2010/01/07/win-a-copy-of-jquery-1-3-with-php/#comments</comments>
		<pubDate>Thu, 07 Jan 2010 11:16:51 +0000</pubDate>
		<dc:creator>Kae Verens</dc:creator>
				<category><![CDATA[ajax]]></category>
		<category><![CDATA[book]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[packt]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[reviews]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://verens.com/?p=956</guid>
		<description><![CDATA[<p>I&#8217;ve just noticed that a site is running a competition to give away a copy of my book.</p>
<p>competition page</p>
<p>All you need to do is leave a comment explaining how you intend to use jQuery in your next project.</p>
<p>If you want to see reviews of the book, I&#8217;m maintaining a list of reviews here.</p>
]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve just noticed that a site is running a competition to give away a copy of my book.</p>
<p><a href="http://speckyboy.com/2010/01/06/jquery-1-3-with-php-free-book-giveaway-comment-to-win/">competition page</a></p>
<p>All you need to do is leave a comment explaining how you intend to use jQuery in your next project.</p>
<p>If you want to see reviews of the book, I&#8217;m maintaining <a href="http://verens.com/archives/2009/12/13/jquery-1-3-with-php-buy-it/">a list of reviews here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://verens.com/archives/2010/01/07/win-a-copy-of-jquery-1-3-with-php/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>blasphemy!</title>
		<link>http://verens.com/archives/2010/01/02/blasphemy/</link>
		<comments>http://verens.com/archives/2010/01/02/blasphemy/#comments</comments>
		<pubDate>Fri, 01 Jan 2010 23:27:21 +0000</pubDate>
		<dc:creator>Kae Verens</dc:creator>
				<category><![CDATA[areyoumad]]></category>
		<category><![CDATA[life]]></category>
		<category><![CDATA[philosophy]]></category>

		<guid isPermaLink="false">http://verens.com/?p=952</guid>
		<description><![CDATA[<p>&#8220;Jesus is the only son of God, and if you don&#8217;t follow him, you will not be getting through the gates into Heaven&#8221;.</p>
<p>Anything wrong with that? Yes &#8211; it&#8217;s blasphemous, to just about every religion on Earth which is not Christian.</p>
<p>And so, Dermot Ahern, in his infinite wisdom, has just made the central tenet of [...]]]></description>
			<content:encoded><![CDATA[<p>&#8220;Jesus is the only son of God, and if you don&#8217;t follow him, you will not be getting through the gates into Heaven&#8221;.</p>
<p>Anything wrong with that? Yes &#8211; it&#8217;s blasphemous, to just about every religion on Earth which is <em>not</em> Christian.</p>
<p>And so, Dermot Ahern, in his infinite wisdom, has <a href="http://blasphemy.ie/2010/01/01/atheist-ireland-publishes-25-blasphemous-quotes/">just made the central tenet of the religion of one third of the entire planet illegal</a>.</p>
<p>Well done, sir. Fucking genius idea, that.</p>
<p>How about this one then &#8211; &#8220;Jesus is <em>not</em> the son of God&#8221;. Now I&#8217;m blaspheming against Christianity.</p>
<p>There&#8217;s absolutely no way to win against this except to be completely silent and never discuss what you believe with anyone at all. And that means it wasn&#8217;t just Christianity that the idiot has made illegal to speak about, but <em>all</em> religions.</p>
<p>By the way, I&#8217;m an atheist. I believe in thinking about what is &#8220;true&#8221;, and in discussing it with people that are interested, and in not pushing my own beliefs on others.</p>
<p>I hear the door knocking &#8211; the thought police are here to take me away. Pray for me&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://verens.com/archives/2010/01/02/blasphemy/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>multiple file uploads using HTML5</title>
		<link>http://verens.com/archives/2009/12/28/multiple-file-uploads-using-html5/</link>
		<comments>http://verens.com/archives/2009/12/28/multiple-file-uploads-using-html5/#comments</comments>
		<pubDate>Mon, 28 Dec 2009 16:37:38 +0000</pubDate>
		<dc:creator>Kae Verens</dc:creator>
				<category><![CDATA[ajax]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[kfm]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://verens.com/?p=945</guid>
		<description><![CDATA[<p>As a response to a reported bug where Chrome was taking ages to load up a flash multiple-file uploader, I&#8217;ve updated KFM to use HTML5&#8217;s multiple-file input box where possible.</p>
<p>To do this, first create the element:</p>

  var input=document.createElement('input');
  input.type='file'; // use old-style JavaScript method to make sure all browsers respect it
  input.name='kfm_file';

<p>Notice [...]]]></description>
			<content:encoded><![CDATA[<p>As a response to a reported bug where <a href="http://code.google.com/p/kfm/issues/detail?id=37">Chrome was taking ages</a> to load up a flash multiple-file uploader, I&#8217;ve updated KFM to use HTML5&#8217;s multiple-file input box where possible.</p>
<p>To do this, first create the element:</p>
<pre class="javascript">
  var input=document.createElement('input');
  input.type='file'; // use old-style JavaScript method to make sure all browsers respect it
  input.name='kfm_file';
</pre>
<p>Notice that we&#8217;re not using <code>setAttribute</code> to set the type and name &#8211; that&#8217;s a DOM method which works in most browsers but not (of course&#8230;) in Internet Explorer 6, where it has bugs.</p>
<p>And now, we tell the input to use the multiple-upload method. We use <code>.setAttribute</code> in this case because we only expect newer browsers to succeed with it.</p>
<pre class="javascript">
  input.setAttribute('multiple','multiple');
  if(input.multiple)input.name='kfm_file[]';
</pre>
<p>In the second line, we check to see if the element is now marked as a multiple-uploader (most current browsers will not succeed in this), and if it does, then rename the input element by adding a <code>[]</code> to the end. If this is not done, then the server will only see the first file which is uploaded.</p>
<p>That&#8217;s the client-side done. This will only be visible in newer browsers such as Chrome, Safari 4, Firefox 3.6. I expect Internet Explorer will eventually catch up by 2020 or so.</p>
<p>If you&#8217;re doing this in pure HTML, then I suppose this would be good enough for you:</p>
<pre>
&lt;input type="file" multiple="multiple" name="file[]" /&gt;
</pre>
<p>In this case, you must put the <code>[]</code> in the name in all cases.</p>
<p>On the server-side, you need to write your upload receiver to expect either a single element, or an array.</p>
<p>For some really goddamned stupid reason, when multiple files are uploaded to PHP, the results are interlaced in a really crappy and awkward manner (I don&#8217;t like it).</p>
<p>Instead of something logical and easy to use, like this:</p>
<pre class="php">
array(
  [0] => array(
    'name' =&gt; 'file1.txt',
    'tmp_name' =&gt; '/tmp/abcdef'
    ....
  ),
  [1] => array(
    'name' =&gt; 'file2.txt',
    'tmp_name' =&gt; '/tmp/ghijkl'
    ....
  )
);
</pre>
<p>You get this&#8230;</p>
<pre>
array(
  'name' =&gt; array(
    [0] =&gt; 'file1.txt',
    [1] =&gt; 'file2.txt'
  ),
  'tmp_name' =&gt; array(
    [0] =&gt; '/tmp/abcdef',
    [1] =&gt; '/tmp/ghijkl'
  ),
  ...
);
</pre>
<p>While that looks at first glance to be easy to use, it&#8217;s not. You can&#8217;t do a simple &#8220;<code>foreach($_FILES['kfm_file'] as $file)</code>&#8221; and expect the above to be usable at all&#8230;</p>
<p>So, the first thing I do, is to check for the $_FILES['kfm_file'], and convert it into the first form above, which is very easy to work with:</p>
<pre class="php">
$files=array();
$fdata=$_FILES['kfm_file'];
if(is_array($fdata['name'])){
 for($i=0;$i&lt;count($fdata['name']);++$i){
  $files[]=array(
   'name'    =&gt;$fdata['name'][$i],
   'tmp_name'=&gt;$fdata['tmp_name'][$i],
  );
 }
}
else $files[]=$fdata;
</pre>
<p>In my own case, I&#8217;m only interested in the name and tmp_name variables, so that&#8217;s all I set up.</p>
<p>Now you can do a <code>foreach</code> on <code>$files</code> and treat them all individually.</p>
<pre class="php">
foreach($files as $file){
  // uploaded location of file is $file['tmp_name']
  // original filename of file is $file['file']
}
</pre>
<p>If you want to see this in KFM, have a look at the <a href="http://kfm.verens.com/demo/trunk/index.php?lang=en">nightly-updated demo</a> tomorrow, or <a href="http://code.google.com/p/kfm/source/checkout">download from SVN</a> right now.</p>
<p>oh &#8211; and <a href="http://www.amazon.co.uk/JQuery-1-3-PHP-Kae-Verens/dp/1847196985">buy my book!</a></p>
]]></content:encoded>
			<wfw:commentRss>http://verens.com/archives/2009/12/28/multiple-file-uploads-using-html5/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>novelrank</title>
		<link>http://verens.com/archives/2009/12/17/novelrank/</link>
		<comments>http://verens.com/archives/2009/12/17/novelrank/#comments</comments>
		<pubDate>Thu, 17 Dec 2009 14:00:59 +0000</pubDate>
		<dc:creator>Kae Verens</dc:creator>
				<category><![CDATA[ajax]]></category>
		<category><![CDATA[book]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[packt]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[reviews]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://verens.com/?p=942</guid>
		<description><![CDATA[<p>Because it&#8217;s difficult to know exactly how well my book is doing, I went looking for online apps that might be able to help.</p>
<p>I came across NovelRank a few weeks ago, which keeps track of your Amazon SalesRank and uses the fluctuations in the value to try figure out when a sale happens.</p>
<p>At first I [...]]]></description>
			<content:encoded><![CDATA[<p>Because it&#8217;s difficult to know exactly how well my book is doing, I went looking for online apps that might be able to help.</p>
<p>I came across <a href="http://www.novelrank.com/">NovelRank</a> a few weeks ago, which keeps track of your Amazon SalesRank and uses the fluctuations in the value to try figure out when a sale happens.</p>
<p>At first I was a bit disappointed, as my own ratings should not many sales going on, but I realised that this was because there were no reviews out there so people a) didn&#8217;t know about the book, and b) didn&#8217;t know if it was worth buying.</p>
<p>Since <a href="http://verens.com/archives/2009/12/13/jquery-1-3-with-php-buy-it/">the reviews have started coming in</a>, sales have picked up, as can be seen in the <a href="http://www.novelrank.com/asin/1847196985">NovelRank graph for my book</a>.</p>
<p>I like this application &#8211; it&#8217;s a simple idea, and the author has made it freely available (I assume he makes money from affiliate links).</p>
<p>Want to see it in action? Buy <a href="http://www.amazon.co.uk/gp/product/1847196985?ie=UTF8&#038;tag=klog-21&#038;linkCode=as2&#038;camp=1634&#038;creative=19450&#038;creativeASIN=1847196985">JQuery 1.3 with PHP</a><img src="http://www.assoc-amazon.co.uk/e/ir?t=klog-21&#038;l=as2&#038;o=2&#038;a=1847196985" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /> and then view <a href="http://www.novelrank.com/asin/1847196985">NovelRank graph for my book</a> the graph a few hours later to see your very own blip appear on it.</p>
<p>It&#8217;s interesting to see that the book is not selling <em>at all</em> in Canada. What&#8217;s wrong with you Canadians?? <img src='http://verens.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>On a very related note, I&#8217;m in talks with <a href="http://www.packtpub.com/">Packt</a> to produce another book. More on this later when details are more concrete.</p>
]]></content:encoded>
			<wfw:commentRss>http://verens.com/archives/2009/12/17/novelrank/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
