<?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>Stickblog</title>
	<atom:link href="http://the-stickman.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://the-stickman.com</link>
	<description>Random developer notes</description>
	<lastBuildDate>Tue, 13 Jul 2010 14:08:25 +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>On redirects, spiders and security</title>
		<link>http://the-stickman.com/web-development/on-redirects-spiders-and-security/</link>
		<comments>http://the-stickman.com/web-development/on-redirects-spiders-and-security/#comments</comments>
		<pubDate>Tue, 13 Jul 2010 14:07:57 +0000</pubDate>
		<dc:creator>Stickman</dc:creator>
				<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://the-stickman.com/?p=232</guid>
		<description><![CDATA[Recently I&#8217;ve been working with an agency that has its own simple PHP web site framework. During the course of working with them, a problem arose: pages were disappearing, apparently without human involvement.
With some detective work they had discovered that somehow the &#8217;secure&#8217; CMS part of the site &#8212; where the client can log in [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I&#8217;ve been working with an agency that has its own simple PHP web site framework. During the course of working with them, a problem arose: pages were disappearing, apparently without human involvement.</p>
<p>With some detective work they had discovered that somehow the &#8217;secure&#8217; CMS part of the site &#8212; where the client can log in to make changes &#8212; was being crawled by automated search engines. Part of the CMS is a list of all the site&#8217;s pages, each with links to the usual operations &#8212; edit, delete etc.  When the spider was indexing the pages, it also accessed the delete link, thereby deleting the page (much like <a href="http://thedailywtf.com/Articles/The_Spider_of_Doom.aspx">this DailyWTF story</a>).</p>
<p>Oops.</p>
<p>Anyway I took a look and while the security wasn&#8217;t great &#8212; it was based around cookies with no server-side validation &#8212; it still seemed odd that the spiders were able to access the pages. I implemented a slightly more robust system using sessions, added an entry to robots.txt, and marked it as solved.</p>
<p>And then it happened again.</p>
<p>I couldn&#8217;t work out what was going wrong, so to stop it happening I converted all the delete links to forms. But it was nagging at me &#8212; how was it that the search engines were reaching the pages at all? Why weren&#8217;t they being rejected when the security script checked for a cookie and session?</p>
<p>Finally, the penny dropped&#8230;</p>
<p>The security check worked by looking for a valid session, checking it for a &#8216;user is logged in&#8217; value, and if one wasn&#8217;t found then sending a redirect header pointing to the login page. Nothing unusual there. So what was going on?</p>
<p>When PHP sends a redirect header, the browser says &#8220;OK, I&#8217;ll go to this other page&#8221; and the user&#8217;s none the wiser. But just because the browser is no longer listening, that doesn&#8217;t mean the script automatically stops running. In fact, unless you tell it to stop it just continues as if nothing had happened. Thus, the spiders were simply ignoring the header and receiving the page as if there were no security in place at all.</p>
<p>The solution? Add an &#8216;exit;&#8217; after the redirect header. Simple!</p>
]]></content:encoded>
			<wfw:commentRss>http://the-stickman.com/web-development/on-redirects-spiders-and-security/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Web fonts: the time has come</title>
		<link>http://the-stickman.com/web-development/web-fonts-the-time-has-come/</link>
		<comments>http://the-stickman.com/web-development/web-fonts-the-time-has-come/#comments</comments>
		<pubDate>Fri, 28 May 2010 08:48:14 +0000</pubDate>
		<dc:creator>Stickman</dc:creator>
				<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://the-stickman.com/?p=226</guid>
		<description><![CDATA[A couple of weeks ago, I spotted a post on Slashdot about a company &#8211; fonts.com &#8211;  that was opening up its font library for use by web developers. I thought it was a pretty neat idea: it uses the new-ish @css-font functionality that works in most modern browsers &#8211; along with a bit of [...]]]></description>
			<content:encoded><![CDATA[<p>A couple of weeks ago, I spotted a post on Slashdot about a company &#8211; <a href="http://www.webfonts.fonts.com/">fonts.com</a> &#8211;  that was opening up its font library for use by web developers. I thought it was a pretty neat idea: it uses the new-ish @css-font functionality that works in most modern browsers &#8211; along with a bit of JavaScript magic &#8211; to allow you to, in effect, embed a font in a web page such that it can be used like any other standard font.</p>
<p>No more image replacement, or clunky <a href="http://www.mikeindustries.com/blog/sifr">sIFR</a> nonsense to get pages looking as your clients actually want them to!</p>
<p>After that, I became aware that there&#8217;s more than one web site out there offering similar service. So here&#8217;s a run-down of those I know of &#8212; feel free to add a comment if you know of any that I&#8217;ve missed:</p>
<ul>
<li><a href="http://www.webfonts.fonts.com/">WebFonts</a> &#8211; as mentioned above, over 2,000 fonts to choose from and more on the way.</li>
<li><a href="http://cufon.shoqolate.com/generate/">Cufon</a> &#8211; allows you to upload your own font files and then download them compiled for web use.</li>
<li><a href="http://www.fontsquirrel.com/fontface">FontFace</a> &#8211; download pre-packaged &#8216;kits&#8217; or roll your own.</li>
<li><a href="http://code.google.com/apis/webfonts/">Google Web Fonts</a> &#8211; yes, even the mighty Google is getting in on the act, although the choice is rather limited.</li>
</ul>
<p><strong>Update: </strong>From the comments (thanks!):</p>
<ul>
<li><a href="http://kernest.com/">Kernest</a></li>
<li><a href="http://www.fontslive.com">FontsLive</a></li>
<li><a href="http://www.typekit.com">TypeKit</a><a rel="nofollow" href="http://www.fontslive.com"></a></li>
<li><a href="http://www.typefront.com">TypeFront</a><a rel="nofollow" href="http://www.typekit.com"></a></li>
<li><a href="http://www.fontspring.com">FontSpring</a><a rel="nofollow" href="http://www.typefront.com"></a></li>
<li><a href="http://www.fontdeck.com">FontDeck</a> (closed beta as of this update)<a rel="nofollow" href="http://www.fontspring.com"></a></li>
</ul>
<p>Seems like it&#8217;s a technology whose time has arrived.</p>
]]></content:encoded>
			<wfw:commentRss>http://the-stickman.com/web-development/web-fonts-the-time-has-come/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>PayPal Error: Sorry, an Error Occurred After You Clicked the Last Link</title>
		<link>http://the-stickman.com/uncategorized/paypal-error-sorry-an-error-occurred-after-you-clicked-the-last-link/</link>
		<comments>http://the-stickman.com/uncategorized/paypal-error-sorry-an-error-occurred-after-you-clicked-the-last-link/#comments</comments>
		<pubDate>Wed, 10 Mar 2010 15:09:24 +0000</pubDate>
		<dc:creator>Stickman</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://the-stickman.com/uncategorized/paypal-error-sorry-an-error-occurred-after-you-clicked-the-last-link/</guid>
		<description><![CDATA[I&#8217;m just coming to the end of a project that required checkout via PayPal. The system is to be hosted in an iframe embedded in a third party site&#8217;s page, but when redirecting to PayPal the iframe &#8216;pops out&#8217; to take over the whole page (PayPal forces this behaviour).
All was working smoothly using the &#8216;PayPal [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m just coming to the end of a project that required checkout via PayPal. The system is to be hosted in an iframe embedded in a third party site&#8217;s page, but when redirecting to PayPal the iframe &#8216;pops out&#8217; to take over the whole page (PayPal forces this behaviour).</p>
<p>All was working smoothly using the &#8216;PayPal sandbox&#8217; testing domain, but when it came to testing a live transaction in Internet Explorer I received the following error:</p>
<p>&#8220;Sorry, an Error Occurred After You Clicked the Last Link&#8221;</p>
<p>&#8230;followed by a lengthy but rather unhelpful block of text suggesting various courses of action &#8212; none of which was any use at all.</p>
<p><a href="http://www.google.co.uk/search?q=paypal+%22Sorry,+an+error+occurred+after+you+clicked+the+last+link%22">Consulting Google</a>, it seems that this is far from an unusual occurrence but there&#8217;s little consensus as to the cause. In the end, I tried adding target=&#8221;_top&#8221; to the form that submits to PayPal (thus forcing the &#8216;pop-out&#8217; of the iframe), and presto, all is now fine again.</p>
]]></content:encoded>
			<wfw:commentRss>http://the-stickman.com/uncategorized/paypal-error-sorry-an-error-occurred-after-you-clicked-the-last-link/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS: Removing that dotted line around a link</title>
		<link>http://the-stickman.com/web-development/css-removing-that-dotted-line-around-a-link/</link>
		<comments>http://the-stickman.com/web-development/css-removing-that-dotted-line-around-a-link/#comments</comments>
		<pubDate>Fri, 04 Dec 2009 09:44:06 +0000</pubDate>
		<dc:creator>Stickman</dc:creator>
				<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://the-stickman.com/?p=219</guid>
		<description><![CDATA[Just a quick note to myself&#8230;
I&#8217;m working on a navigation system that uses CSS image replacement. To hide the text, CSS shifts it out of view by using the text-indent property and a big negative value. However, a side-effect of this is that when you click on a link, the dotted border that appears while [...]]]></description>
			<content:encoded><![CDATA[<p>Just a quick note to myself&#8230;</p>
<p>I&#8217;m working on a navigation system that uses CSS image replacement. To hide the text, CSS shifts it out of view by using the <em>text-indent</em> property and a big negative value. However, a side-effect of this is that when you click on a link, the dotted border that appears while you&#8217;re holding the mouse button down goes off the side of the page.</p>
<p>To get around this, I just wanted to disable it. After some searching I discovered the <em>outline</em> property &#8212; setting this to &#8216;none&#8217; gets rid of it entirely:</p>
<p><code>a{<br />
outline: none;<br />
}</code></p>
<p>Of course, the above will remove it for all links, it&#8217;s up to you to decide whether you want to make it more specific.</p>
]]></content:encoded>
			<wfw:commentRss>http://the-stickman.com/web-development/css-removing-that-dotted-line-around-a-link/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Converting latitude and longitude coordinates to map x and y values</title>
		<link>http://the-stickman.com/uncategorized/converting-latitude-and-longitude-coordinates-to-map-x-and-y-values/</link>
		<comments>http://the-stickman.com/uncategorized/converting-latitude-and-longitude-coordinates-to-map-x-and-y-values/#comments</comments>
		<pubDate>Tue, 19 May 2009 08:37:18 +0000</pubDate>
		<dc:creator>Stickman</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://the-stickman.com/?p=212</guid>
		<description><![CDATA[I&#8217;m currently working on a project to convert an existing Flash map, which uses location data that&#8217;s been manually entered and maintained, to use data that comes from a database and uses latitude and longitude values. The original data is stored in an XML file so updating it dynamically is not a problem but as [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m currently working on a project to convert an existing Flash map, which uses location data that&#8217;s been manually entered and maintained, to use data that comes from a database and uses latitude and longitude values. The original data is stored in an XML file so updating it dynamically is not a problem but as you&#8217;ll know if you&#8217;ve ever tried it, plotting latitude and longitude values on a map isn&#8217;t as simple as it might sound.</p>
<p>Briefly, the problem arises from the fact that the world is a sphere and representing it in two dimensions is not a straightforward task. There are various &#8216;projections&#8217; to choose from, each of which uses a different method for mapping points &#8212; you can find out more in <a href="http://en.wikipedia.org/wiki/Map_projection">this Wikipedia article</a>. The most common choice is the <a href="http://en.wikipedia.org/wiki/Mercator_projection">Mercator projection</a>, where lines of latitude are spaced equally, and fortunately for me it&#8217;s the type of map used in the project I&#8217;m working on.</p>
<p>So, being somewhat mathematically inept, I decided that Google would save me from a day&#8217;s head-scratching. That turned out not to be the case, as I tried a good half-dozen different suggestions before finally stumbling across one that actually produced accurate results. To save others from the same fate I decided to reproduce here the code I ended up with, which is based heavily on code found in <a href="http://groups.google.com/group/Google-Maps-API/browse_thread/thread/a45947d72c27cc73#d21b6238fae63a7c">this newsgroup post</a>. My implementation is PHP, but it shouldn&#8217;t be hard to convert it to another platform (see the original thread for a Javascript implementation). Apologies for the rubbish formatting, WordPress isn&#8217;t great at handling code:</p>
<pre>function LongitudeToX( $lat, $lon, $map_zoom, $scale_value, $x_offset = 0 )
{
  $offset=16777216;
  $radius=$offset / pi();
  return ( ( ($offset+$radius*$lon*pi()/180)&gt;&gt;$map_zoom ) * $scale_value ) + $x_offset;
}
function LatitudeToY( $lat, $lon, $map_zoom, $scale_value, $y_offset = 0 )
{
  $offset=16777216;
  $radius=$offset / pi();
  return ( ( ($offset-$radius*log((1+sin($lat*pi()/180))/(1-sin($lat*pi()/180)))/2)&gt;&gt;$map_zoom ) * $scale_value ) + $y_offset;
}</pre>
<p>A few notes about using these functions:</p>
<ul>
<li>From what I can tell, the above code is based on Google Maps and the $map_zoom relates in some way to the &#8216;zoom level&#8217; of the map. I set it at 15 and it seemed to work OK.</li>
<li>Because the dimensions of your own map might not exactly match the assumed dimensions of the map used in the calculation, the $scale_value parameter allows you to adjust the output to fit more precisely. I had to specify two decimal places of scaling to get an exact fit.</li>
<li>Finally, the calculation assumes that the &#8216;origin point&#8217; of the map (x=0, y=0) will be at the top, left-hand corner. This isn&#8217;t the case on the map I&#8217;m working on (the origin is at the centre) so I included $x_offset and $y_offset parameters so that I could adjust the output values accordingly.</li>
</ul>
<p>In order to find the best values for the above parameters, I manually placed three widely-spaced temporary markers on the Flash map marking points whose latitude and longitude I already knew. Then I had the code render these points and adjusted the various parameters until the position of the generated points exactly matched the manually-placed markers.</p>
<p>I hope this code helps someone avoid wasting the sort of time I did yesterday!</p>
]]></content:encoded>
			<wfw:commentRss>http://the-stickman.com/uncategorized/converting-latitude-and-longitude-coordinates-to-map-x-and-y-values/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Installing Ubuntu on Eee PC 1000</title>
		<link>http://the-stickman.com/general/installing-ubuntu-on-eee-pc-1000/</link>
		<comments>http://the-stickman.com/general/installing-ubuntu-on-eee-pc-1000/#comments</comments>
		<pubDate>Mon, 27 Apr 2009 08:39:40 +0000</pubDate>
		<dc:creator>Stickman</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://the-stickman.com/?p=203</guid>
		<description><![CDATA[I decided the other day that I wanted to try to install Ubuntu on my Eee PC 1000. I&#8217;d already replaced the default Xandros Linux that comes pre-installed with Windows XP (because my other half needed it) but recently I&#8217;ve become annoyed with its tendency to seize up every now and again for no apparent [...]]]></description>
			<content:encoded><![CDATA[<p>I decided the other day that I wanted to try to install Ubuntu on my Eee PC 1000. I&#8217;d already replaced the default Xandros Linux that comes pre-installed with Windows XP (because my other half needed it) but recently I&#8217;ve become annoyed with its tendency to seize up every now and again for no apparent reason.</p>
<p>So I downloaded the <a href="http://www.canonical.com/projects/ubuntu/unr">Ubuntu Netbook Remix</a>, and set about installing it as a dual-boot option. It was very simple, following <a href="https://wiki.ubuntu.com/UNR#The Easy (recommended) way">the instructions</a> took around 40 minutes for the entire process and it all seemed to be going fine. But when I came to reboot, there was no sign of Ubuntu.</p>
<p>Now, the Eee PC 1000 has a 40GB SSD (Solid State Drive) &#8212; which is in fact two drives, one of 8GB and one of 32GB. The 8GB is the &#8216;primary&#8217; drive, and that&#8217;s where Windows is installed, but there wasn&#8217;t space for me to install Ubuntu alongside it so I created a small partition for it on the &#8217;secondary&#8217; drive.</p>
<p>I guessed that the problem was probably related to this fact so I had a poke around to see what could be done. Checking the Eee&#8217;s BIOS, there&#8217;s no distinction between the two drives so you can&#8217;t choose to boot from the secondary drive. I was tempted to give up at this point (I didn&#8217;t seem to be able to find any useful info on the web), but since the install process is so quick I decided to have another go and see if I could spot anything along the way that might be of use.</p>
<p>Sure enough, right near the end of the setup process (after creating/assigning partitions) there&#8217;s a little button labelled &#8216;Advanced&#8217;. Clicking on it popped up a dialog window with a drop-down list that allowed me to assign the boot loader to the primary drive (/dev/sda) instead of the secondary drive (/dev/sdb) that it had defaulted to. So I let it go ahead and install, and one reboot later there it was: a list of boot options. Success!</p>
<p>So, is it any good? Well, it certainly <em>looks</em> good and I like the &#8216;remixed&#8217; desktop/interface which organises applications in a sensible and easy-to-find way. Boot time isn&#8217;t noticeably quicker than WinXP, which is disappointing but could be explained in part by the fact that it&#8217;s running on the slower secondary drive. From what I can tell after one day&#8217;s use, once started it runs very smoothly with apps launching very quickly and no unexplained &#8216;freezes&#8217;.</p>
<p>As far as compatibility is concerned the wireless, sound, touchpad, camera, display, USB and SD ports all worked out-of-the-box with no configuration required. I have my doubts that Bluetooth is working but haven&#8217;t had a chance to test it yet. The one serious gripe is the time it takes for the wireless to establish a connection &#8212; it suffers here even in comparison to Windows, which would (re)connect almost instantly where Ubuntu can take 40 seconds or more. I often use the netbook for a very short time (say, to do a quick web search) and then put it into hibernate, so a slow restart is a definite annoyance.</p>
<p>If you&#8217;re interested in checking out the Ubuntu Netbook Remix but don&#8217;t want to go to the trouble of installing it, then you can run it from a USB stick (1GB or bigger) without any installation. Startup is slow but once it&#8217;s going it&#8217;s fine and if you decide you do want to keep it, then you can install it from the same USB stick.</p>
]]></content:encoded>
			<wfw:commentRss>http://the-stickman.com/general/installing-ubuntu-on-eee-pc-1000/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL UPDATE with SELECT on the same table in the same query</title>
		<link>http://the-stickman.com/uncategorized/mysql-update-with-select-on-the-same-table-in-the-same-query/</link>
		<comments>http://the-stickman.com/uncategorized/mysql-update-with-select-on-the-same-table-in-the-same-query/#comments</comments>
		<pubDate>Thu, 29 Jan 2009 12:55:04 +0000</pubDate>
		<dc:creator>Stickman</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://the-stickman.com/?p=194</guid>
		<description><![CDATA[I&#8217;ve been having a week where there&#8217;s a ton of stuff to be done in a short time, yet everything seems to take much longer than it should and every task seems to present multiple unforseen obstacles. 
Yesterday, for example, I was working on something that had already taken several days of my time when I&#8217;d [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been having a week where there&#8217;s a ton of stuff to be done in a short time, yet everything seems to take much longer than it should and every task seems to present multiple unforseen obstacles. </p>
<p>Yesterday, for example, I was working on something that had already taken several days of my time when I&#8217;d hoped to get it done in hours. The final straw came when I found myself facing what appeared to be an intractable problem: a process that needed to insert multiple rows in a table, and increment a certain column in each row to get a unique value. I couldn&#8217;t use an auto-increment value in this case (there was one already), and using a separate query caused concurrency problems (resulting in non-unique values). I should just point out that this is a system that I&#8217;ve inherited, not one that I developed myself.</p>
<p>I started out with a simple update, like this:</p>
<p>UPDATE my_table SET some_value = ( MAX( some_value ) + 1 ) WHERE id = 123;</p>
<p>&#8230;which in hindsight was never going to work but anyway, it gave me this error:</p>
<p><code>#1111 - Invalid use of group function</code></p>
<p>So I thought about it a bit and then struck on this:</p>
<p> <code>UPDATE my_table SET some_value =<br />
(<br />
(<br />
SELECT MAX( some_value )<br />
FROM my_table<br />
) +1<br />
)<br />
WHERE id = 123</code><br />
&#8230;which gave me this error:</p>
<p><code>#1093 - You can't specify target table 'my_table' for update in FROM clause</code></p>
<p>&#8230;damn. I was starting to bang my head on the desk at this point, but Google came to my rescue by pointing me at <a href="http://www.xaprb.com/blog/2006/06/23/how-to-select-from-an-update-target-in-mysql/">this thread</a>, which suggested using a nested sub-select. The result was the following rather ugly query:</p>
<p><code>UPDATE my_table<br />
SET<br />
my_value =<br />
(<br />
(<br />
SELECT selected_value<br />
FROM<br />
(<br />
SELECT MAX( my_value ) AS selected_value<br />
FROM my_table<br />
)<br />
AS sub_selected_value<br />
)<br />
+ 1<br />
)<br />
WHERE id = 123</code></p>
<p>&#8230;which works. It&#8217;s not great  from a performance point of view since it uses a temporary table, but it does what it needs to. I hope in future that I will be given time to go back and rewrite this part of the system so as to entirely remove the issue.</p>
]]></content:encoded>
			<wfw:commentRss>http://the-stickman.com/uncategorized/mysql-update-with-select-on-the-same-table-in-the-same-query/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Enhanced (&#8216;encouraged&#8217;) blog commenting</title>
		<link>http://the-stickman.com/uncategorized/enhanced-encouraged-blog-commenting/</link>
		<comments>http://the-stickman.com/uncategorized/enhanced-encouraged-blog-commenting/#comments</comments>
		<pubDate>Mon, 12 Jan 2009 10:47:19 +0000</pubDate>
		<dc:creator>Stickman</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://the-stickman.com/?p=191</guid>
		<description><![CDATA[Here&#8217;s a great blog post discussing a technique to simplify and encourage commenting on a blog, in particular by quoting text snippets. I might well try to find the time to implement it here on StickBlog.
]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s <a title="Encouraged commentary" href="http://donttrustthisguy.com/2009/01/04/encouraged-commentary/">a great blog post</a> discussing a technique to simplify and encourage commenting on a blog, in particular by quoting text snippets. I might well try to find the time to implement it here on StickBlog.</p>
]]></content:encoded>
			<wfw:commentRss>http://the-stickman.com/uncategorized/enhanced-encouraged-blog-commenting/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Comparing changes to MySQL databases</title>
		<link>http://the-stickman.com/web-development/comparing-changes-to-mysql-databases/</link>
		<comments>http://the-stickman.com/web-development/comparing-changes-to-mysql-databases/#comments</comments>
		<pubDate>Wed, 10 Dec 2008 13:51:58 +0000</pubDate>
		<dc:creator>Stickman</dc:creator>
				<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://the-stickman.com/?p=187</guid>
		<description><![CDATA[One of my personal nightmares goes as follows: I&#8217;m working on an existing MySQL-based system, adding or changing something that involves altering existing database tables. I do what I need to, commit the code and then realise that I need to make the database changes too&#8230;only I&#8217;ve forgotten to keep track of the edits I&#8217;ve [...]]]></description>
			<content:encoded><![CDATA[<p>One of my personal nightmares goes as follows: I&#8217;m working on an existing MySQL-based system, adding or changing something that involves altering existing database tables. I do what I need to, commit the code and then realise that I need to make the database changes too&#8230;only I&#8217;ve forgotten to keep track of the edits I&#8217;ve made. Oops.</p>
<p>Now there are various things I <em>should</em> do to prevent this happening &#8212; at the very least keep a list of changes as I&#8217;m going along, which I do&#8230;when I remember to. But on those occasions when I don&#8217;t, I usually end up dumping the schemas and comparing them using a diff tool, which works just fine but can be rather laborious.</p>
<p>Today I stumbled (via <a title="DZone" href="http://dzone.com">DZone</a>) upon a piece of freeware called <a href="http://www.toadsoft.com/toadmysql/">Toad for MySQL</a>. It does <a href="http://www.toadsoft.com/toadmysql/Features.htm">a whole bunch of useful things</a>, but the feature that stood out for me was its &#8217;schema compare&#8217; tool. At first it looks like a dolled-up diff tool, but then you notice that in addition to showing you the differences between two databases, it also creates an SQL statement to convert between the two. Very handy.</p>
<p>For those of you who are allergic to MySQL, there are versions of Toad for <a href="http://www.toadsoft.com/toad_oracle.htm">Oracle</a>, <a href="http://www.toadsoft.com/toadsqlserver/toad_sqlserver.htm">SQL Server</a> and <a href="http://www.toadsoft.com/toaddb2/index.html">DB2</a> (although they&#8217;re not freeware).</p>
]]></content:encoded>
			<wfw:commentRss>http://the-stickman.com/web-development/comparing-changes-to-mysql-databases/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>jQuery: Dropping items from a draggable list to a sortable list</title>
		<link>http://the-stickman.com/web-development/javascript/jquery-dropping-items-from-a-draggable-list-to-a-sortable-list/</link>
		<comments>http://the-stickman.com/web-development/javascript/jquery-dropping-items-from-a-draggable-list-to-a-sortable-list/#comments</comments>
		<pubDate>Sat, 04 Oct 2008 16:09:25 +0000</pubDate>
		<dc:creator>Stickman</dc:creator>
				<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://the-stickman.com/uncategorized/jquery-dropping-items-from-a-draggable-list-to-a-sortable-list/</guid>
		<description><![CDATA[For reasons that I might outline in another post sometime, I recently decided to replace MooTools as the JavaScript library behind our company CMS (which I&#8217;m in the process of rewriting from scratch) with jQuery.
It&#8217;s been a few weeks now since I made the decision and I&#8217;m starting to become more comfortable with jQuery&#8217;s quite [...]]]></description>
			<content:encoded><![CDATA[<p>For reasons that I might outline in another post sometime, I recently decided to replace <a href="http://mootools.net">MooTools</a> as the JavaScript library behind our company CMS (which I&#8217;m in the process of rewriting from scratch) with <a href="http://jquery.com">jQuery</a>.</p>
<p>It&#8217;s been a few weeks now since I made the decision and I&#8217;m starting to become more comfortable with jQuery&#8217;s quite different approach. I&#8217;ve also begun working on some of the more complicated aspects of the new CMS, including adopting <a href="http://ui.jquery.com/">jQuery UI</a> to provide the interface widgets. One requirement of the system is to have a dialog where search results can be dragged and dropped onto a sortable list.</p>
<p>At first I looked at using two sortable lists and the built-in <a href="http://docs.jquery.com/UI/Sortables/sortable#toptions">&#8216;connectWith&#8217; option</a>, which enables you to link two or more sortable lists together. But then I realised that I didn&#8217;t really want the search results to be a sortable list. In fact, what I wanted was a static list whose items could be dragged and placed in the sortable list.</p>
<p>I tried a few experiments, and when those failed I decided to try looking at the code itself to see if I could hack together a solution without too much extra effort. While browsing the ui.draggables code, I stumbled across the intriguingly-named &#8216;connectToSortable&#8217; option. I was surprised to find it because there&#8217;s (currently) no mention of it in the documentation, and indeed it&#8217;s very hard to find any reference to it at all beyond the code itself (the only useful link I could find was <a href="http://groups.google.com.ph/group/jquery-ui/browse_thread/thread/ae1b7b79356bee12">this one</a>, but it rather over-complicates the issue).</p>
<p>It&#8217;s very simple to use: as with connectWith, just specify which sortable(s) you want to connect to with the connectToSortable property:</p>
<p><code>$('#myDraggable › li').draggable({helper:'clone',connectToSortable:'#mySortable'});</code></p>
<p><a href="http://the-stickman.com/files/jquery/draggable-sortable.html">Full example code here</a>.</p>
<p>The code for the example works just fine, but I found when using it in my own project, for some reason it was necessary to add a $(&#8216;mySortable&#8217;).sortable(&#8216;refresh&#8217;) call after defining the two lists, or the first drop operation would always fail.</p>
<p>By the way, when fiddling around with JavaScript experiments I find <a href="http://jsbin.com">JSBin</a> very useful &#8212; you can load up any of several JS libraries (jQuery, MooTools, dojo, prototype, YUI, script.aculo.us) and create both JavaScript and HTML to test in a &#8216;live&#8217; environment. Very handy.</p>
]]></content:encoded>
			<wfw:commentRss>http://the-stickman.com/web-development/javascript/jquery-dropping-items-from-a-draggable-list-to-a-sortable-list/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
	</channel>
</rss>
