<?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>Night Blue Fruit Development Blog</title>
	<atom:link href="http://www.nightbluefruit.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.nightbluefruit.com/blog</link>
	<description>Sharing what we learn</description>
	<lastBuildDate>Thu, 04 Mar 2010 21:58:58 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Copying an entire website with Httrack</title>
		<link>http://www.nightbluefruit.com/blog/2010/03/copying-an-entire-website-with-httrack/</link>
		<comments>http://www.nightbluefruit.com/blog/2010/03/copying-an-entire-website-with-httrack/#comments</comments>
		<pubDate>Thu, 04 Mar 2010 21:57:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[HTML]]></category>

		<guid isPermaLink="false">http://www.nightbluefruit.com/blog/?p=90</guid>
		<description><![CDATA[As a web developer, you often get asked to update and upgrade existing websites, and to fix issue with existing websites.
More often than not, its easier to do this on a local copy of the website than on a live remote server.
There are various ways to copy an entire website, but sometimes when a site [...]]]></description>
			<content:encoded><![CDATA[<p>As a web developer, you often get asked to update and upgrade existing websites, and to fix issue with existing websites.</p>
<p>More often than not, its easier to do this on a local copy of the website than on a live remote server.</p>
<p>There are various ways to copy an entire website, but sometimes when a site isn&#8217;t very well designed (eg with absolute rather than relative links) this can take quite a bit of sorting out.</p>
<p>This is where a tool called <a href="http://www.httrack.com/" target="_blank">Httrack</a> comes in every handy. It&#8217;ll download the website for you over http (so you don&#8217;t even need ftp login details) and convert all links to relative links.</p>
<p>Its available for both Windows and Linux, and is in the repositories for Ubuntu.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nightbluefruit.com/blog/2010/03/copying-an-entire-website-with-httrack/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Building a Video Library with FFMPEG</title>
		<link>http://www.nightbluefruit.com/blog/2010/01/building-a-video-library-with-ffmpeg-and-jwplayer/</link>
		<comments>http://www.nightbluefruit.com/blog/2010/01/building-a-video-library-with-ffmpeg-and-jwplayer/#comments</comments>
		<pubDate>Tue, 26 Jan 2010 15:39:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Widgets]]></category>

		<guid isPermaLink="false">http://www.nightbluefruit.com/blog/?p=61</guid>
		<description><![CDATA[
The video above is imported from http://www.centerforclinicalexcellence.com, for whom I&#8217;ve recently constructed a Buddypress Video Library using FFMPEG and the JW Player.
The owners of the site had originally wanted to use a third party like Vimeo or Twistage for this solution, but I persuaded them that they&#8217;d achieve a lot more flexibility and functionality if [...]]]></description>
			<content:encoded><![CDATA[<p><embed src="http://centerforclinicalexcellence.com/mplayer/player-viral.swf" width="320" height="264" allowscriptaccess="always" allowfullscreen="true" flashvars="file=http://centerforclinicalexcellence.com/video/1/pre-1-1u69o.flv&#038;backcolor=0xFFFFFF&#038;frontcolor=0xF7740A&#038;screencolor=0x000000&#038;image=http://centerforclinicalexcellence.com/video/1/1-1u69o-thumb.png&#038;autostart=false&#038;logo=http://centerforclinicalexcellence.com/images/pre-playermark.png&#038;logo.hide=false&#038;logo.link=http://centerforclinicalexcellence.com&#038;plugins=fbit-1,tweetit-1&#038;dock=true"/></p>
<p style="text-align: left;">The video above is imported from http://www.centerforclinicalexcellence.com, for whom I&#8217;ve recently constructed a Buddypress Video Library using <a href="http://ffmpeg.org/" target="_blank">FFMPEG</a> and the <a href="https://www.longtailvideo.com/" target="_blank">JW Player</a>.</p>
<p style="text-align: left;">The owners of the site had originally wanted to use a third party like <a href="http://www.vimeo.com" target="_blank">Vimeo</a> or <a href="http://www.twistage.com" target="_blank">Twistage</a> for this solution, but I persuaded them that they&#8217;d achieve a lot more flexibility and functionality if they went with a bespoke solution.</p>
<p style="text-align: left;">This would allow them to integrate seamlessly with their Buddypress User Database, which was not something that was going to happen very easily with a third party API.</p>
<p style="text-align: left;">I&#8217;m pretty happy with the finished product. Users can upload video, rate videos, comment on videos, embed videos in other sites, and linkback to videos through <a href="http://www.facebook.com" target="_blank">Facebook</a> and <a href="http://www.twitter.com" target="_blank">Twitter</a>.</p>
<p style="text-align: left;">FFMPEG isn&#8217;t for the faint hearted, however. It generally doesn&#8217;t come installed on hosting platforms, and has a long list of dependencies about which it is very particular when installing.</p>
<p style="text-align: left;">Normally, you can overcome this by installing through a package manager like <a href="http://sial.org/howto/yum/" target="_blank">yum</a> on CentOS, which I have used before, but the current version of FFMPEG uses a version of libmp3lame (3.98.2, which is used for encoding audio) that contains a nasty little bug that prevents the duration of a clip being embeded in Flash encoded videos.</p>
<p style="text-align: left;">This in turn plays havoc with Flash players, who don&#8217;t know who long the video they are playing will run.</p>
<p style="text-align: left;">Unfortunately, there is no easy way in yum to specify the version of dependencies you want to use, so you have to go through all of FFMPEG&#8217;s dependencies and install them manually, just so you can install a downgraded version of libmp3lame (3.97) which doesn&#8217;t contain the bug.</p>
<p style="text-align: left;">You then need to comile FFMPEG from source.</p>
<p style="text-align: left;">This is a tricky process, but thankfully I found <a href="http://www.ezlinuxadmin.com/2009/12/install-ffmpeg-from-source/" target="_blank">this article</a> which gives a pretty good summary of what you have to do (there are one or two typos in it, but you&#8217;ll catch them as you proceed; and install lame 3.97, not 3.982 as listed). You also need to pay close attention re. the linking of libraries as described, and be sure to run ldconfig.</p>
<p style="text-align: left;">You can also leave 1 or 2 of the slightly less common codecs if they are giving your errors. The ones you really need are lame, faad, faac and vorbis.</p>
<p style="text-align: left;">JW Player by comparison is a breeze to install. The license and FB and Twitter plugins were purchased for the very reasonable sum of €77. Its a great player, and I&#8217;d recommend it to anyone.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nightbluefruit.com/blog/2010/01/building-a-video-library-with-ffmpeg-and-jwplayer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Web Design In Leitrim</title>
		<link>http://www.nightbluefruit.com/blog/2010/01/web-design-in-leitrim/</link>
		<comments>http://www.nightbluefruit.com/blog/2010/01/web-design-in-leitrim/#comments</comments>
		<pubDate>Mon, 18 Jan 2010 22:23:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Search Engines]]></category>

		<guid isPermaLink="false">http://www.nightbluefruit.com/blog/?p=59</guid>
		<description><![CDATA[I&#8217;ve had an interesting time recently trying to up the SEO ranking for my site.
On initial investigation, I found that my website was appearing as result number 222 for the searches on &#8216;web design leitrim&#8217;, which was a bit of shock given that I&#8217;ve been working on websites in Co. Leitrim for 3 years. My [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve had an interesting time recently trying to up the SEO ranking for my site.</p>
<p>On initial investigation, I found that my website was appearing as result number 222 for the searches on &#8216;web design leitrim&#8217;, which was a bit of shock given that I&#8217;ve been working on websites in Co. Leitrim for 3 years. My PR function clearly needed a dusting down.</p>
<p>Setting to work, I found that one of my biggest problems was my use of a .com domain name in conjunction with a UK based ip address. This is a big no-no for Google when it comes to geo-targetting.</p>
<p>If your site is based in a different country to your customer base, and you are not using a TLD from the country of your customer base, Google will have difficulty in associating your site with your customer base, even if the text of your site contains lots of references to your own country.</p>
<p>To sort this, I moved my site to a server in Ireland, which brought my ranking up from 222 to 90. Still not great.</p>
<p>The next thing I looked at were the taglines in the sites I have created. There are 99 links to nightbluefruit.com in the Google index, which should be more than enough to get decent results, but this wasn&#8217;t happening.</p>
<p>To address this, I changed all the taglines in the sites I&#8217;ve built from &#8216;powered by nightbluefruit.com&#8217; to &#8216;web design by nightbluefruit.com&#8217;. Once these sites started being re-indexed by Google, I got another boost, up to about result 52.</p>
<p>This was still pretty useless, however, so more needed to be done.</p>
<p>At this point, I signed up for Google Webmaster Tools, and registered my site. The data that this gave back was reasonably useful, in that its diagnostics showed that I wasn&#8217;t doing anything untoward.</p>
<p>However, all of the data that it contained related to content on this blog, which is a separate Wordpress installation to my primary site. I thought it was strange that Google wasn&#8217;t picking up any of the content on my primary pages (or pages, as it is a single page site).</p>
<p>I looked into this and to my horror found that there was a typo in my HTML. I had no opening &#8216;BODY&#8217; tag in my HTML!!</p>
<p>As part of this fix, I also fine combed my HTML code to make sure all my alt tags and texts were very specific about &#8216;web design&#8217;.</p>
<p>More recently, I&#8217;ve also registered my business on the Google Maps Local Business Directory, which takes a couple of weeks to update.</p>
<p>I&#8217;m not sure yet to what degree these final view changes will improve my ranking, but it shows how my attention you need to give to these pursuits.</p>
<p>I&#8217;m also a bit worried about my use of a single page site for my content. Theoretically, it shouldn&#8217;t present a problem, but if fixing the BODY tag doesn&#8217;t improve my ranking, this may be something I have to come back to.</p>
<p>UPDATE!!!</p>
<p>As of Feb 01 2010, nightbluefruit.com is ranked No.14 on the SERPs for &#8216;Web Design Leitrim&#8217;.</p>
<p>Now for the assault on the summit!</p>
<p>UPDATE!!!</p>
<p>As of Mar 01 2010, nightbluefruit.com is ranked No.10 on the SERPs for &#8216;Web Design Leitrim&#8217;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nightbluefruit.com/blog/2010/01/web-design-in-leitrim/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The pain of Drupal</title>
		<link>http://www.nightbluefruit.com/blog/2009/12/the-pain-of-drupal/</link>
		<comments>http://www.nightbluefruit.com/blog/2009/12/the-pain-of-drupal/#comments</comments>
		<pubDate>Sat, 05 Dec 2009 11:14:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[The Internet]]></category>

		<guid isPermaLink="false">http://www.nightbluefruit.com/blog/?p=56</guid>
		<description><![CDATA[I&#8217;ve recently taken on a job that requires modification of a web site built on Drupal, and 3 days in, I feel like I need a 2 week holiday.
Drupal, and its counterpart, Joomla, are Open Source Content Management systems. The idea is that the allow people who don&#8217;t know anything about HTML, PHP, Javascript etc [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve recently taken on a job that requires modification of a web site built on Drupal, and 3 days in, I feel like I need a 2 week holiday.</p>
<p>Drupal, and its counterpart, Joomla, are Open Source Content Management systems. The idea is that the allow people who don&#8217;t know anything about HTML, PHP, Javascript etc etc to build complex, feature rich websites.</p>
<p>Their use on the web has exploded over recent years, as more and more would be &#8216;web designers&#8217; have started using them as their framework for building websites.</p>
<p>This in turn as led to the development of lots and lots of Drupal plugins and widgets, which add a futher layer of fudge and complexity to something that is already very fudgy and very complex.</p>
<p>Under the hood, its a morass.</p>
<p>Before starting work on the modifications I had to make, I took a look at the MySQL database on which is runs. It had <strong>288 </strong>tables (my own CMS has 12 tables, and even poor old Wordpress only has about 40 tables).</p>
<p>If that wasn&#8217;t bad enough, when I then tried to run a local copy of the website on my laptop, I started to get errors about PHP not having enough memory to run the Drupal scripts. PHP is normally allocated about 16MB of memory as part of its installation; to run Drupal, I had to up this to <strong>64MB!!</strong></p>
<p>Its gets worse. Looking at the raw HTML generated by Drupal, I saw that it was loading <strong>25 different CSS files, </strong>and <strong>14 different Javascript files!</strong> And when I examined the DOM via Firebug, I could see that certain elements were taking CSS properties from up to 4 different files!</p>
<p>All this was bad enough, but it was nothing comparred to actually using the management interface to build content. The admin menu in Drupal has 14 different options, and each of these has a plethora of sub options, all of which refer to vague concepts like Blocks, Views, Modules, Panels, Stories etc (they also refer to a Page, but its isn&#8217;t really clear what a Page is).</p>
<p>My first thought was that it would be actually easier to learn HTML, PHP and Javascript than try and unravel this crap.</p>
<p>I persevered anyway. I made a view changes to pages where I could figure how to make those changes, but none of them appeared on the actual website. This was most probably to do with caching I thought, but there was nothing in the Drupal interface that said &#8216;You should clear your cache to see these changes&#8217;. I also thought  it was quite odd that an app that generates links to 40 odd CSS and Javascript files should be worried about caching.</p>
<p>I looked around for somewhere I could clear the cache, but could find nothing. I eventually googled the subject and found that the clear cache was a sub sub option under the &#8216;Site Configuration&#8217; menu option.</p>
<p>On another occasion, I had to change some User Permissions. When I clicked on the Save button, my laptop started to grind to the extent that I thought it was going to shut itself down to prevent an explosion.</p>
<p>Perhaps my most stressful experience with Drupal was dealing with this <a href="http://drupal.org/node/284392" target="_blank">bug</a>. There are 300 posts on the Drupal Forum thread on this bug, and the upshot of it isn&#8217;t there isn&#8217;t a universal solution. You basically have to figure out what version of a few different modules you are using, and then apply a serious of patches which may or may not break other parts of your installation.</p>
<p>Lets try and use an analogy here.</p>
<p>Building a website with Joomla is like trying to build a house by joining together five or six mobile homes. Its cheap, it doesn&#8217;t take long to put together and it seems like a easy solution to a pressing problem.</p>
<p>What you get is something that is about the same size as a house, and that has certain features of house (eg windows and doors), but that also has 5 bathrooms, 5 kitchens, no corridors and no rooms of any useful size. You also need 5 different electricty meters, and in certain cases, if you want to walk from one room to another, you have to leave house and come in through another door.</p>
<p>Also, if you want to make even minor modifications to the look of your house  in future, you have to take the whole thing apart and stick it back together again.</p>
<p>Don&#8217;t get me wrong. Open source packages like Drupal are essential part of the Internet, but its becoming clear that the more an application tries to be a solution for everything, the more likely it is to become a solution for nothing.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nightbluefruit.com/blog/2009/12/the-pain-of-drupal/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>United We Stand: Bring Down IE6</title>
		<link>http://www.nightbluefruit.com/blog/2009/11/united-we-stand-bring-down-ie-6/</link>
		<comments>http://www.nightbluefruit.com/blog/2009/11/united-we-stand-bring-down-ie-6/#comments</comments>
		<pubDate>Tue, 10 Nov 2009 14:20:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[The Internet]]></category>

		<guid isPermaLink="false">http://www.nightbluefruit.com/blog/?p=51</guid>
		<description><![CDATA[
Unbelievably for a browser that was first launched in 2001, Internet Explorer 6 still commands up to 25% of the browser market.
This arises almost exclusively from business users, presumably in large organisations where the IT Department just can&#8217;t bring itself to upgrade Microsoft software on a large number of PCs. The fact that IE6 regularly [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.bringdownie6.com/"><img class="alignnone" src="http://www.netmag.co.uk/files/bd.png" alt="" width="117" height="120" /></a></p>
<p>Unbelievably for a browser that was first launched in 2001, Internet Explorer 6 still commands up to 25% of the browser market.</p>
<p>This arises almost exclusively from business users, presumably in large organisations where the IT Department just can&#8217;t bring itself to upgrade Microsoft software on a large number of PCs. The fact that IE6 regularly finds itself in the &#8220;Top 10 Worst Technologies of All Time&#8221; list doesn&#8217;t appear to be an issue.</p>
<p>IE6&#8217;s problems are manifold, but here&#8217;s a brief synopsis:</p>
<p>o It doesn&#8217;t entirely support CSS2, which means that styling that works in every other standards compliant browser doesn&#8217;t work in IE6</p>
<p>o It doesn&#8217;t entirely support Javascript, which means that functionality that works in every other standards compliant browser doesn&#8217;t work in IE6</p>
<p>o Its full of functionality bugs, and Microsoft has stopped fixing any new ones that it finds</p>
<p>o Its full of security bugs, which Microsoft will fix, but very begrudgingly</p>
<p>What this means for the developer is that web applications have to be bent into shape to work in IE6, which is a bit like screwing the doors of your car shut because you can&#8217;t get central locking to work.</p>
<p>This adds lots of time (cost) to the process of web development, and results in web applications that are no where near as efficient, pretty, secure or functional as they good be if they didn&#8217;t have to be warped to work in IE6.</p>
<p>Up until now, the web development community has been fairly patient about this, and have agreed to accommodate web site owners who want to ensure that their sites work in as many browsers as possible.</p>
<p>However, with the advent of IE8 (and IE7 prior to this), that patience is fast running out, because at this point, accommodating IE6 is actually have a serious impact on the evolution of web applications.</p>
<p>As such, a campaign has been started to encourage developers to refuse to develop for IE6, and to use the time that would normally have spent on this to include instructions in their sites to encourage users to upgrade to IE7 or to use a different browser.</p>
<p>This is a worthwhile initiative. IE7 has been available for 3 years now, and IE8 has already been available for a year.</p>
<p>The web development community can&#8217;t be expected to accommodate corporate IT departments ad infinitum, and must stand united in order that this terrible technology is purged from the system.</p>
<p>There it is then. Join the campaign, and stop developing for IE6.</p>
<p><a href="http://www.bringdownie6.com/">http://www.bringdownie6.com/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.nightbluefruit.com/blog/2009/11/united-we-stand-bring-down-ie-6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>wget, recursive ftp and exclude-directories</title>
		<link>http://www.nightbluefruit.com/blog/2009/09/wget-recursive-ftp-and-exclude-directories/</link>
		<comments>http://www.nightbluefruit.com/blog/2009/09/wget-recursive-ftp-and-exclude-directories/#comments</comments>
		<pubDate>Mon, 14 Sep 2009 23:23:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.nightbluefruit.com/blog/?p=46</guid>
		<description><![CDATA[Here&#8217;s the problem.
You don&#8217;t have shell access to a web server, but you need to download a dump of a web application.
You have ftp access, so you can use the recursive ftp option of wget, but the web root of the application contains all manner of directories which aren&#8217;t relevant to what you want to [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: left;">Here&#8217;s the problem.</p>
<p style="text-align: left;">You don&#8217;t have shell access to a web server, but you need to download a dump of a web application.</p>
<p style="text-align: left;">You have ftp access, so you can use the recursive ftp option of wget, but the web root of the application contains all manner of directories which aren&#8217;t relevant to what you want to do and which you don&#8217;t want to download.</p>
<p style="text-align: left;">Enter the &#8211;exclude-directories switch for wget, whereby you can specify a comma-separated lists of directories you don&#8217;t want to include in your download.</p>
<p style="text-align: left;">Except, of course, it doesn&#8217;t work.</p>
<p style="text-align: left;">Well actually, it does, but it just isn&#8217;t very intuitive. And it isn&#8217;t helped by the fact that there are lots of forum posts out there telling you that you need to specify the absolute path to the directory rather than the path relative to the web root. This isn&#8217;t the case.</p>
<p style="text-align: left;">Lets remember, we&#8217;re authenticating via ftp here, so all our wget client is going to know about is the directory structure below the home directory of the user we are authenticating as.</p>
<p style="text-align: left;">If you login in using a native ftp client, and issue a pwd command, you&#8217;re going to see all of the directory structure that wget sees, so that should tell you how to list the directories on the command line.</p>
<p style="text-align: left;">For example:</p>
<p style="text-align: left;">When I login to my server via FTP, and do a pwd, I see &#8220;/public_html&#8221;.</p>
<p style="text-align: left;">The directories I want to exclude are the &#8216;mp3files&#8217; and &#8216;videos&#8217; directories from my web root, because I don&#8217;t want to download 10GB of media.</p>
<p style="text-align: left;">The FTP path to these directories are &#8216;/public_html/mp3files&#8217; and &#8216;/public_html/videos&#8217;, so these are the directories I tell wget I don&#8217;t want to download:</p>
<p style="text-align: left;">wget -r <strong>-X /public_html/mp3files,/public_html/mp3files</strong> -nH &#8211;ftp-user=user@ftserver.com &#8211;ftp-password=ftppass ftp://www.ftpserver.com/public_html</p>
<p style="text-align: left;">This works.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nightbluefruit.com/blog/2009/09/wget-recursive-ftp-and-exclude-directories/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google Maps and Dynamic IFRAMEs</title>
		<link>http://www.nightbluefruit.com/blog/2009/07/google-maps-and-iframes/</link>
		<comments>http://www.nightbluefruit.com/blog/2009/07/google-maps-and-iframes/#comments</comments>
		<pubDate>Tue, 28 Jul 2009 23:25:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://local.nightbluefruit.com/blog/?p=37</guid>
		<description><![CDATA[I recently created an application that displayed a Google Map in an IFRAME in the main page.
The IFRAME itself was  created by running a small piece of javascript to populate innerHTML in a specific DIV container.
For some reason, several of the tiles were missing from the page when it first rendered.
After tricking around with [...]]]></description>
			<content:encoded><![CDATA[<p>I recently created an application that displayed a Google Map in an IFRAME in the main page.</p>
<p>The IFRAME itself was  created by running a small piece of javascript to populate innerHTML in a specific DIV container.</p>
<p>For some reason, several of the tiles were missing from the page when it first rendered.</p>
<p>After tricking around with this for ages, I eventually came up a solution.</p>
<p>When you insert a Google Map in a page, either in a standard page or in an IFRAME, the map will display according to the geometry of the page. For standard page, the geometry is straightforward, and you generally won&#8217;t encounter any problems.</p>
<p>In a page containing an IFRAME things are a little different, particularly when you create the IFRAME on the fly.</p>
<p>Consider this:</p>
<p>A page starts to render. Its a long page, and half way down, some javascript runs to create an IFRAME. This IFRAME then goes off and pulls down a Google Map, but this process starts before the parent page is fully rendered.</p>
<p>Result: Google Map is wonky.</p>
<p>So what&#8217;s the solution?</p>
<p>Basically, you just need to insert a little delay into your Javascript to allow the parent page fully render before the Google Map create begins:</p>
<p>eg</p>
<p><strong style="color: black; background-color: #99ff99;">setTimeout</strong>(js_viewGoogleMap,1000);</p>
<p>If you need to pass co-ords to your <strong style="color: black; background-color: #a0ffff;">map</strong> rendering function, just<br />
create an inner function in your primary function:</p>
<p>eg</p>
<p>function js_viewGoogleMap(x,y) {</p>
<p>function loadMap() {</p>
<p>load(x,y);</p>
<p>}</p>
<p><strong style="color: black; background-color: #99ff99;"> setTimeout</strong>(loadMap,1000);</p>
<p>}</p>
<p>Hope this helps.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nightbluefruit.com/blog/2009/07/google-maps-and-iframes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Run a cron job at multiple random times</title>
		<link>http://www.nightbluefruit.com/blog/2009/03/run-a-cron-job-at-multiple-random-times/</link>
		<comments>http://www.nightbluefruit.com/blog/2009/03/run-a-cron-job-at-multiple-random-times/#comments</comments>
		<pubDate>Mon, 30 Mar 2009 22:29:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.nightbluefruit.com/blog/?p=23</guid>
		<description><![CDATA[Say you want to run a cron job 10 times (or so) in a day at random times.
Here&#8217;s my solution:
1. Create a probability test that gives a 10% probability of the outcome you want
$p = mt_rand(1,10);
2. Add in a bit of extra randomness with a short sleep
$s = mt_rand(60,300);
sleep($s);
giving:
$p = mt_rand(1,10);
if ($p != 1) {
exit;
} [...]]]></description>
			<content:encoded><![CDATA[<p>Say you want to run a cron job 10 times (or so) in a day at random times.</p>
<p>Here&#8217;s my solution:</p>
<p>1. Create a probability test that gives a 10% probability of the outcome you want</p>
<p>$p = mt_rand(1,10);</p>
<p>2. Add in a bit of extra randomness with a short sleep</p>
<p>$s = mt_rand(60,300);<br />
sleep($s);</p>
<p>giving:</p>
<p>$p = mt_rand(1,10);</p>
<p>if ($p != 1) {</p>
<blockquote><p>exit;</p></blockquote>
<p>} else {</p>
<blockquote><p>$s = mt_rand(60,300);<br />
sleep($s);</p>
<p><em>Your stuff here&#8230;</em></p></blockquote>
<p>}</p>
<p>3. Run your cron job 4 times an hour, 24 hours a day</p>
<p>*/15 * * * * /usr/bin/php myscript.php</p>
<p>At this, your cron job will run 96 times per day, and execute 1 in 10 of those times, which gives you 9 to 10 executions per day at random times.</p>
<p>OK, its not <strong>totally </strong>random, and you can&#8217;t guarantee the number of executions, but if you have  fixed number of executions per day, that&#8217;s not really random, is it?</p>
<p>Nod, nod, wink, wink&#8230;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nightbluefruit.com/blog/2009/03/run-a-cron-job-at-multiple-random-times/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Variables in Javascript Nested Functions</title>
		<link>http://www.nightbluefruit.com/blog/2009/03/variables-in-javascript-nested-functions/</link>
		<comments>http://www.nightbluefruit.com/blog/2009/03/variables-in-javascript-nested-functions/#comments</comments>
		<pubDate>Thu, 19 Mar 2009 14:51:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://www.nightbluefruit.com/blog/?p=22</guid>
		<description><![CDATA[Like many programming/scripting languages, Javscript provides the ability to nest one function inside another function, a bit like this:
function outside () {
function inside() {

window.alert(&#8217;Hello World&#8217;);

}
}
This behaviour is most commonly seen when a developer needs to assign a function to an event that is created inside another function, for instance:
function outside () {
var menu =document.createElement(&#8217;SELECT&#8217;);
menu.onchange = [...]]]></description>
			<content:encoded><![CDATA[<p>Like many programming/scripting languages, Javscript provides the ability to nest one function inside another function, a bit like this:</p>
<p>function outside () {</p>
<blockquote><p>function inside() {</p></blockquote>
<blockquote>
<blockquote><p>window.alert(&#8217;Hello World&#8217;);</p></blockquote>
</blockquote>
<blockquote><p>}</p></blockquote>
<p>}</p>
<p>This behaviour is most commonly seen when a developer needs to assign a function to an event that is created inside another function, for instance:</p>
<p>function outside () {</p>
<blockquote><p>var menu =document.createElement(&#8217;SELECT&#8217;);</p></blockquote>
<blockquote><p>menu.onchange = function () {</p></blockquote>
<blockquote>
<blockquote><p>window.alert(&#8217;Hello World&#8217;);</p></blockquote>
</blockquote>
<blockquote><p>}</p></blockquote>
<p>}</p>
<p>One of the difficulties that can arise here is that quite often it is necessary to pass a variable to the inner function. Say for instance, you want to create a 3 SELECTs, each having an onChange event which displays an alert unique to that SELECT. Would this work?</p>
<p>function outside () {</p>
<blockquote><p>for (i=1;i&lt;4;i++) {</p></blockquote>
<blockquote>
<blockquote><p>var menu =document.createElement(&#8217;SELECT&#8217;);</p></blockquote>
</blockquote>
<blockquote>
<blockquote><p>menu.id = i;</p></blockquote>
</blockquote>
<blockquote>
<blockquote><p>menu.onchange = function (i) {</p></blockquote>
</blockquote>
<blockquote>
<blockquote>
<blockquote><p>window.alert(&#8217;Menu&#8217; + document.getElementById(i).id);</p></blockquote>
</blockquote>
</blockquote>
<blockquote>
<blockquote><p>}</p></blockquote>
<p>}</p></blockquote>
<p>}</p>
<p>The simple answer is that no, it won&#8217;t.</p>
<p>What this execution will do is run the inner function at the same time as the outer function and assign the return value of the inner function to the &#8216;onchange&#8217; property of the SELECT object, even if nothing is returned.</p>
<p>This isn&#8217;t what we want. What we want is for the inner function to be assigned to the onChange <em>event </em>of the SELECT.</p>
<p>There are couple of ways to do this, 3 of which are very well explained in <a href="http://www.howtocreate.co.uk/referencedvariables.html" target="_blank">this article</a>.</p>
<p>Here&#8217;s one of them. What we do in this case is create a new property for the SELECT object, to which we assign the necessary variables, which we can then reference with the <em>this </em>object reference.</p>
<p>function outside () {</p>
<blockquote><p>for (i=1;i&lt;4;i++) {</p></blockquote>
<blockquote>
<blockquote><p>var menu =document.createElement(&#8217;SELECT&#8217;);</p></blockquote>
</blockquote>
<blockquote>
<blockquote><p>menu.menuid = i;</p></blockquote>
</blockquote>
<blockquote>
<blockquote><p>menu.onchange = function () {</p></blockquote>
</blockquote>
<blockquote>
<blockquote>
<blockquote><p>window.alert(&#8217;Menu&#8217; + this.menuid);</p></blockquote>
<p>}</p></blockquote>
</blockquote>
<blockquote><p>}</p></blockquote>
<p>}</p>
<p>This method isn&#8217;t without its problems either, but it will work in the majority of cases. If you want the Gold Standard solution, check out the referenced article above, preferably from a quiet, well-aired room with a nice view of distant snow-capped mountains (ie its a little complicated&#8230;)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nightbluefruit.com/blog/2009/03/variables-in-javascript-nested-functions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Thoughts on Wordpress</title>
		<link>http://www.nightbluefruit.com/blog/2009/03/thoughts-on-wordpress/</link>
		<comments>http://www.nightbluefruit.com/blog/2009/03/thoughts-on-wordpress/#comments</comments>
		<pubDate>Wed, 11 Mar 2009 23:41:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[The Internet]]></category>

		<guid isPermaLink="false">http://www.nightbluefruit.com/blog/?p=21</guid>
		<description><![CDATA[Let&#8217;s be clear, Wordpress is great software. Its easy to install, its easy to use and it serves its purpose, blogging, very well.
However, the extent to which Wordpress is now being used to replace actual web development is getting ridiculous.
This really struck home to me recently when I saw an online shop based on Wordpress. [...]]]></description>
			<content:encoded><![CDATA[<p>Let&#8217;s be clear, Wordpress is great software. Its easy to install, its easy to use and it serves its purpose, blogging, very well.</p>
<p>However, the extent to which Wordpress is now being used to replace <em>actual </em>web development is getting ridiculous.</p>
<p>This really struck home to me recently when I saw an online shop based on Wordpress. It had a cart, a search function, a user database, the whole nine yards. I mean, come on, if you&#8217;re serious about selling stuff on the Internet, why on earth would you use blogging software as your shopping engine!!</p>
<p>A whole cottage industry also appears to have sprung up whereby so called Web Design companies and hacking free Wordpress templates and selling them on as bespoke brochure websites to unsuspecting customers.</p>
<p>This is pretty sharp practice. Wordpress templates are made available free by their designers to facilitate non-commercial use. Its never going to be possible to restrict their usage, but netiquette should dictate that these templates aren&#8217;t resold as bespoke designs.</p>
<p>Ultimately, growing user awareness will sort this out, which is always the Great Leveller on the Internet. At some stage, people are going to stop handing over good money to pay for something they can get for free on any number of community blogging sites.</p>
<p>And in the final analysis, bepsoke web development has never actually been easier. The availability of wonderful Javascript tools like the TinyMCE has brought CMS development well within the reach of even novice developers, so there should be no need to clutter up the web space with obsolete blogging functionality.</p>
<p>There it is then.</p>
<p>Wordpress for blogging, and that&#8217;s it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nightbluefruit.com/blog/2009/03/thoughts-on-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
