<?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>PHP, Web and IT stuff</title>
	<atom:link href="http://www.webdigi.co.uk/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.webdigi.co.uk/blog</link>
	<description>Little words of wisdom</description>
	<lastBuildDate>Tue, 15 Feb 2011 14:22:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Build better facebook pages with iframe tabs</title>
		<link>http://www.webdigi.co.uk/blog/2011/build-better-facebook-pages-with-iframe-tabs/</link>
		<comments>http://www.webdigi.co.uk/blog/2011/build-better-facebook-pages-with-iframe-tabs/#comments</comments>
		<pubDate>Tue, 15 Feb 2011 14:22:34 +0000</pubDate>
		<dc:creator>iphp</dc:creator>
				<category><![CDATA[Facebook]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.webdigi.co.uk/blog/?p=800</guid>
		<description><![CDATA[There are two major changes announced for Facebook pages. The most prominent is the change to the the layout and fan page design (forced update due on March 10th 2011). The second is that Facebook pages now support iframes. This means that developers are free to use popular, simple and standards-based web programming model (HTML, [...]]]></description>
			<content:encoded><![CDATA[<p>There are two major changes announced for Facebook pages. The most prominent is the change to the the layout and fan page design (forced update due on March 10th 2011). The second is that Facebook pages now support iframes. This means that developers are free to use popular, simple and standards-based web programming model (HTML, JavaScript, and CSS) compared to highly restricted FBJS and FBML.  There are lots of reasons to be excited about this. Here are a few of our best:</p>
<p><strong>1) Google maps on pages</strong></p>
<p>You can now have fully functional Javascript based maps within Facebook pages. This makes it easier to display business location, location of stores, hotels, etc. To make things even more flexible, mapping services will now have access to your location if you use newer browsers.</p>
<div class="wp-caption aligncenter" style="width: 460px"><a href="http://www.facebook.com/webdigi?sk=app_163685236987027"><img class=" " title="Google maps with Location" src="http://www.webdigi.co.uk/fbframeblog/blogimages/LocationMaps.png" alt="Google maps with location on Facebook iframe tabs" width="450" height="372" /></a><p class="wp-caption-text">Google maps with Location</p></div>
<p>To see this functionality in action, go to the <a href="http://www.facebook.com/webdigi?sk=app_163685236987027">maps page</a>. You need to be logged in to Facebook to view the page. Please note that your location is not stored by us and used just to display a map for the demo purposes.</p>
<p><strong>2) Add youtube videos and other music players</strong></p>
<div class="wp-caption aligncenter" style="width: 460px"><a href="http://www.facebook.com/webdigi?sk=app_178775035499585&amp;app_data=video"><img class="   " title="Embed Youtube Videos on fan pages" src="http://www.webdigi.co.uk/fbframeblog/blogimages/Youtube.png" alt="Embed Youtube Videos on fan pages" width="450" height="331" /></a><p class="wp-caption-text">Embed Youtube Videos on fan pages</p></div>
<p>The iframe technique also make it much easier to embed youtube videos and other flash/HTML5 multimedia. This gives users access to related videos and more added functionality. This also includes the ability to view the video in full screen. Click on the image above to go to the <a href="http://www.facebook.com/webdigi?sk=app_178775035499585&amp;app_data=video">video demo page</a>.</p>
<p><strong>3) Embed slides and PDFs</strong></p>
<div class="wp-caption aligncenter" style="width: 460px"><a href="http://www.facebook.com/webdigi?sk=app_178775035499585&amp;app_data=docs"><img class=" " title="Embed external docs to your fan page" src="http://www.webdigi.co.uk/fbframeblog/blogimages/Docs.png" alt="Embed external docs to your fan page" width="450" height="322" /></a><p class="wp-caption-text">Embed external docs to your fan page</p></div>
<p>Like how a video is embedded, you can now embed slides, PDF, other documents using Slideshare or related apps. Here is a direct link to the <a href="http://www.facebook.com/webdigi?sk=app_178775035499585&amp;app_data=docs">docs demo page</a>.</p>
<p><strong>4) Create amazing landing pages</strong></p>
<p>Use any Javascript library of your choice: jQuery, ExtJS, mootools, etc. You can even use flash or HTML5 to create great landing pages. In short, the only limitation on design, layout and functionality is now your imagination and the restricted width of around 520px.</p>
<p><strong>5) Create your own top navigation menu</strong></p>
<div class="wp-caption aligncenter" style="width: 460px"><img title="Create your own top level menu" src="http://www.webdigi.co.uk/fbframeblog/blogimages/navigationalmenus.png" alt="Create your own top level menu" width="450" height="152" /><p class="wp-caption-text">Create your own top level menu</p></div>
<p>The previous Facebook page design had top level navigation tabs which have now moved to the left side of the page. This does free up some space and lets the developer create their own top level navigation tab. Including multi level level navigation.</p>
<p><strong>6) Add a like button within the page</strong></p>
<div class="wp-caption aligncenter" style="width: 470px"><a href="http://www.facebook.com/webdigi?sk=app_178775035499585&amp;app_data=code"><img class=" " title="No longer need a click above to Like" src="http://www.webdigi.co.uk/fbframeblog/blogimages/cocacola.png" alt="No longer need a click above to Like" width="460" height="146" /></a><p class="wp-caption-text">No longer need a click above to Like</p></div>
<p>There are thousands of Facebook pages including top brands like Coca cola which have the text like &#8220;Click on like button above&#8221;. This will no longer be required. You can now have the like button within the page. An example is what we have on <a href="http://www.facebook.com/webdigi?sk=app_178775035499585&amp;app_data=code">our page here</a>.</p>
<p><strong>7) Special content for Facebook page fans</strong></p>
<p>You can have a special page displayed for Facebook fans. This is possible because Facebook sends a signed request to your server each time your page loads. This request from Facebook has details like user language preferences, age restrictions and also information showing if an user is a page fan, page admin, etc. All the <a href="http://www.facebook.com/webdigi?sk=app_178775035499585&amp;app_data=code">source code for all the above pages</a> is available on this page.</p>
<p><strong>Notes:</strong></p>
<p>- Our page has been updated to the new version. This is a requisite for working on the new iframe enabled facebook pages.<br />
- All the code is free to use as usual and is intended to demo the features of iframes on Facebook tabs.<br />
- You seem to need to be logged in to Facebook to be able to view the demo pages in action!<br />
- For those beginners who are not sure how to create the iframe tabs, please visit the <a href="http://developers.facebook.com/docs/guides/canvas#tabs">Facebook guide on creating pages</a></p>
<p>What features or possibilities excite you the most?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.webdigi.co.uk/blog/2011/build-better-facebook-pages-with-iframe-tabs/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>Retain leading zero in CSV</title>
		<link>http://www.webdigi.co.uk/blog/2010/handling-leading-zero-in-csv/</link>
		<comments>http://www.webdigi.co.uk/blog/2010/handling-leading-zero-in-csv/#comments</comments>
		<pubDate>Thu, 30 Sep 2010 11:22:09 +0000</pubDate>
		<dc:creator>php-manual</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.webdigi.co.uk/blog/?p=764</guid>
		<description><![CDATA[Most web applications at some point will have some sort of an export data feature to get data out of the database in some csv or excel format. CSV is probably the simplest to generate on the fly from PHP and other server side scripting languages. However, I had a particular issue where leading zeros [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_770" class="wp-caption aligncenter" style="width: 370px"><a href="http://www.webdigi.co.uk/blog/wp-content/uploads/2010/09/Leading_Zeros_CSV.png" target="_blank"><img class="size-medium wp-image-770  " title="Leading Zeros in CSV shown in Excel" src="http://www.webdigi.co.uk/blog/wp-content/uploads/2010/09/Leading_Zeros_CSV-300x91.png" alt="Leading Zeros in Excel with CSV" width="360" height="109" /></a><p class="wp-caption-text">Leading Zeros shown in Excel when = is used (Row 3)</p></div>
<p>Most web applications at some point will have some sort of an export data feature to get data out of the database in some csv or excel format. CSV is probably the simplest to generate on the fly from PHP and other server side scripting languages. However, I had a particular issue where leading zeros were just not displaying when the csv file was opened with Excel. Look at the example csv below where when opened in Excel will not show leading zeros.</p>
<pre class="brush: jscript; title: ; notranslate">
&quot;Comment&quot;,&quot;Number&quot;,&quot;Zip&quot;
&quot;Leading Zeros will not be displayed&quot;,&quot;0003833&quot;,&quot;0596&quot;
</pre>
<p><span style="font-size: 13.3333px;">The best solution to work around this is just to add an = in front of the column to avoid Excel from formatting the column when displaying numeric value. So below works fine.</span></p>
<pre class="brush: jscript; title: ; notranslate">
&quot;Comment&quot;,&quot;Number&quot;,&quot;Zip&quot;
&quot;Leading Zeros shown in Excel&quot;,=&quot;0003833&quot;,=&quot;0596&quot;
</pre>
<p style="text-align: left;">Hope this simple trick helps you avoid Excel eating up leading zeros in csv! Any other CSV related suggestions and comments are welcome.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.webdigi.co.uk/blog/2010/handling-leading-zero-in-csv/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Tracking user engagement on Facebook fan pages</title>
		<link>http://www.webdigi.co.uk/blog/2010/tracking-user-engagement-on-facebook-fan-pages/</link>
		<comments>http://www.webdigi.co.uk/blog/2010/tracking-user-engagement-on-facebook-fan-pages/#comments</comments>
		<pubDate>Mon, 15 Mar 2010 12:51:13 +0000</pubDate>
		<dc:creator>iphp</dc:creator>
				<category><![CDATA[Facebook]]></category>
		<category><![CDATA[Facebook Pages]]></category>
		<category><![CDATA[Google Analytics]]></category>

		<guid isPermaLink="false">http://www.webdigi.co.uk/blog/?p=715</guid>
		<description><![CDATA[In our previous blog post we showed how to setup Google Analytics for Facebook fan pages. The article was very well received and highlighted the importance of improved analytics. Please review the older article for detailed instructions on how to setup Google Analytics. Here are a few interesting concepts which will help you build better Facebook [...]]]></description>
			<content:encoded><![CDATA[<p>In our previous blog post we showed how to setup <a href="http://www.webdigi.co.uk/blog/2010/google-analytics-for-facebook-fan-pages/">Google Analytics for Facebook fan pages</a>. The article was very well received and highlighted the importance of improved analytics. Please review the older article for detailed instructions on how to setup Google Analytics. Here are a few interesting concepts which will help you build better Facebook fan pages and also take your Analytics information one step further:</p>
<p><strong>Fans versus Non Fan activity</strong></p>
<p>An interesting way to look at your Facebook fan page activity is to split them with activity by your Fans and non fans. To do this, we need to use segments in Google Analytics to split activity into Fan and Non-Fan activity. You can create a segment based on pages visited by your user or specific event.</p>
<div id="attachment_721" class="wp-caption alignnone" style="width: 652px"><img class="size-full wp-image-721  " title="fans-vs-non-fans2" src="http://www.webdigi.co.uk/blog/wp-content/uploads/2010/03/fans-vs-non-fans2.png" alt="fans-vs-non-fans2" width="642" height="176" /><p class="wp-caption-text">Using segments to track Fan/Non Fan activity</p></div>
<p>We will need to use FBJS (Facebook Javascript) and the tag &lt;fb:visible-to-connection&gt;. The tag will allow us to display a section to Fans and another to Non-Fans. We have managed to use this to create a single action button but calling different FBJS functions depending on whether the user is a fan of the page or not. Once a Javascript function is activated, the appropriate tracking image has to be shown to log the visit correctly on Google Analytics. Displaying this tracking image causes a hit to be registered on Google Analytics and this can be used to segment traffic. Visit our <a href="http://www.facebook.com/webdigi?v=app_11007063052">tracking page to get the code and see this in action</a>.</p>
<p><strong>Tracking activity on forms and on your pages</strong></p>
<p>This is a good method to track user engagement with the Facebook page. Several users might visit your Facebook page but only a few might actually engage with the form. When your custom Facebook fan page loads, Facebook does not activate the Javascript you have written. This is only activated when a user performs an activity. Something like clicking on a button, clicking of your form, playing a video, entering some details onto the form, clicking on a button of your <a href="http://www.facebook.com/webdigi?v=app_4949752878">carousel</a>, etc. This is a good opportunity to track activity on your page. All you have to do is use a script tag like the one used in the <a href="http://www.facebook.com/webdigi?v=app_11007063052">Advanced tracking page</a>.</p>
<p><strong>Goal and Funnel Visualisation</strong></p>
<p>This can be a quite powerful tool, you can track for example how many users visit your contact page, how many then proceed to engage with the page and how many eventually click on the contact button. Here is an example of a funnel visualisation.</p>
<div id="attachment_732" class="wp-caption aligncenter" style="width: 521px"><img class="size-full wp-image-732" title="funnel" src="http://www.webdigi.co.uk/blog/wp-content/uploads/2010/03/funnel.png" alt="A simple funnel visualisation" width="511" height="344" /><p class="wp-caption-text">A simple two step funnel visualisation</p></div>
<p>The above two step funnel visualisation shows you how many users visited our contact page and how many proceeded to submit the form. This could have also been made into a three step funnel displaying how many visited the contact page, how many clicked around and how many actually clicked the contact button.</p>
<p><strong>Tracking Purchases or clicks on your fan page</strong></p>
<p>To track clicks which can be purchases, clicks on links, etc. We generate a tracking code for each action that we want to track using our trusted <a href="http://ga.webdigi.co.uk">Google Analytics code generator</a>. We then load this image location on click of a button, or link, etc using the usual onclick event handler.</p>
<p><strong>In conclusion</strong></p>
<p>These techniques require some knowledge of Javascript and a reasonable understanding of how the image technique lets you work around Facebook&#8217;s Javascript restriction. You can get the complete source code to how we segregate fan and non fan visits, etc <a href="http://www.facebook.com/webdigi?v=app_11007063052">here</a>. We are a <a href="http://www.webdigi.co.uk">web development company</a> and will be happy to help you out with your unique tracking needs on your Facebook page. Please share your thoughts, comments and ideas on how to track user behaviour in more depth.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.webdigi.co.uk/blog/2010/tracking-user-engagement-on-facebook-fan-pages/feed/</wfw:commentRss>
		<slash:comments>34</slash:comments>
		</item>
		<item>
		<title>Google Analytics for Facebook Fan Pages</title>
		<link>http://www.webdigi.co.uk/blog/2010/google-analytics-for-facebook-fan-pages/</link>
		<comments>http://www.webdigi.co.uk/blog/2010/google-analytics-for-facebook-fan-pages/#comments</comments>
		<pubDate>Mon, 22 Feb 2010 17:25:08 +0000</pubDate>
		<dc:creator>iphp</dc:creator>
				<category><![CDATA[Facebook]]></category>
		<category><![CDATA[PHP Development]]></category>
		<category><![CDATA[Project Management]]></category>
		<category><![CDATA[Facebook Pages]]></category>
		<category><![CDATA[google]]></category>

		<guid isPermaLink="false">http://www.webdigi.co.uk/blog/?p=639</guid>
		<description><![CDATA[We launched our Facebook fan page earlier this month and as with all Facebook pages only Facebook Insights program is available to page administrators. Facebook Insights shows demographic details and interactions on your pages BUT limited to show information of fans only. It is far less sophisticated and comprehensive when compared to the free Google Analytics. One of [...]]]></description>
			<content:encoded><![CDATA[<p>We launched our Facebook <a href="http://facebook.com/webdigi">fan page</a> earlier this month and as with all Facebook pages only Facebook Insights program is available to page administrators. Facebook Insights shows demographic details and interactions on your pages BUT limited to show information of fans only. It is far less sophisticated and comprehensive when compared to the free Google Analytics. One of the limitations of Facebook Fan pages is that you can only run limited Javascript on it and Google Analytics needs Javascript code included to correctly track visitors. We have successfully managed to get ALL functions of Google Analytics working on our Facebook fan page (including visitor statistics, traffic sources, visitor country, keyword searches with all other powerful reporting &amp; maps overlays etc).</p>
<div id="attachment_640" class="wp-caption aligncenter" style="width: 285px"><img class="size-medium wp-image-640  " title="analytics-example" src="http://www.webdigi.co.uk/blog/wp-content/uploads/2010/02/analytics-example-275x300.jpg" alt="Google Analytics Example" width="275" height="300" /><p class="wp-caption-text">Google Analytics Example</p></div>
<p style="text-align: center;"><strong> </strong></p>
<p style="text-align: center;"><strong> </strong></p>
<p style="text-align: center;"><strong> </strong></p>
<p><strong>How to setup Google Analytics on your Facebook fan pages</strong></p>
<p>The workaround we use in our code is to include Google Analytics as an image instead of setting the standard Javascript. This method tracks every visitor to the custom facebook pages on Google Analytics. It required a combination of server side cookie management and an additional &lt;img&gt; tag to the bottom of the facebook fan page. Here are the steps to get Google Analytics working on your facebook fan page.</p>
<p>1) Setup Google Analytics account. If you already have one, create a new website profile. You can name it facebook.com or facebook.com/your_page_name. You will finally get your tracking code which looks like this UA-3123123-2<br />
2) Create your custom img tag for <strong>each </strong>of your pages you like to track. EG: contact form, services, products etc. You can use our tool to create the <a href="http://ga.webdigi.co.uk">Google Analytics link generator for Facebook pages</a>.<br />
3) Add the entire custom image html tag from step 2 to the bottom of each Facebook fan page that you need to track.<br />
<strong> </strong></p>
<p>That is all there is to it! Google Analytics is not real-time, so you will need to give it some time. Approximately a day before you see the fruits of your &#8220;hard&#8221; work.</p>
<p><strong>For advanced users</strong></p>
<p>Use this method, if you don&#8217;t want to use our hosted link redirection as mentioned in the method above. You can download the entire source code which is just about three files to get this setup working on your own server (running PHP4.3 or above). The code is written in PHP and essentially creates the Google image tracking URL with the referrer, page information, ID, etc. The additional advantage of hosting this on your own server and domain is that visits from your website to your facebook fan page gets tracked, etc. You will also be able to customise further if you wish. Please do share any useful updates you apply to the tracking link code.</p>
<p><a href="http://www.webdigi.co.uk/blog/apps/fbgat-facebook-google-analytics-tracker/">Facebook &#8211; Google Analytics Tracker v1.1</a> (Updated 21st Feb, 2010).  For advanced method &#8211; Download this code to use on your server.</p>
<p>If you don&#8217;t have a Facebook fan page yet, visit our tutorial for code and help on <a href="http://www.webdigi.co.uk/blog/2010/creating-a-custom-facebook-page/">creating customised Facebook fan pages</a>.</p>
<p>PS: We could not find any other source / blog that described how to get Google Analytics on Facebook fan pages! There is support for canvas pages and applications but nothing for StaticFBML fan pages. Hope this helps and please leave your comments below.</p>
<p>UPDATE:<br />
1) A lot of users have asked how to track visits to the wall. Yes, this can be done. Please see the comments by iphp below.<br />
2) Here is a <a href="http://www.webdigi.co.uk/blog/wp-content/uploads/2009/06/adding-img-tag.png">screenshot to a staticFBML</a> where the code should be placed<br />
3) We have managed to <a href="http://www.webdigi.co.uk/blog/2010/tracking-user-engagement-on-facebook-fan-pages/">set up funnels, goals and segments to separate fan and non fan activity</a>.<br />
4) <strong>Video:</strong> Here is a link to the <a title="Webdigi UK on Youtube" href="http://www.youtube.com/UKwebdigi">Webdigi youtube channel</a> check our favourites to get step by step walkthrough!<br />
5) This blog and comments cover all aspects of setting up Google Analytics. If you still want help, we are available to offer paid support and installation of Analytics for your page. Please <a href="http://www.webdigi.co.uk/contact">contact us here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.webdigi.co.uk/blog/2010/google-analytics-for-facebook-fan-pages/feed/</wfw:commentRss>
		<slash:comments>392</slash:comments>
		</item>
		<item>
		<title>Creating a custom facebook fan page</title>
		<link>http://www.webdigi.co.uk/blog/2010/creating-a-custom-facebook-page/</link>
		<comments>http://www.webdigi.co.uk/blog/2010/creating-a-custom-facebook-page/#comments</comments>
		<pubDate>Mon, 11 Jan 2010 13:16:38 +0000</pubDate>
		<dc:creator>iphp</dc:creator>
				<category><![CDATA[Facebook]]></category>
		<category><![CDATA[Javascript Development]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Facebook Pages]]></category>
		<category><![CDATA[FBJS]]></category>

		<guid isPermaLink="false">http://www.webdigi.co.uk/blog/?p=553</guid>
		<description><![CDATA[A Facebook Page is a public Profile that enables information about business and products to be shared with Facebook users and the public. An user should be able to create one in a few minutes. This article explains how to add custom tabs to your Facebook page to make it do more. Here we explain [...]]]></description>
			<content:encoded><![CDATA[<p>A Facebook Page is a public Profile that enables information about business and products to be shared with Facebook users and the public. An user should be able to create one in a few minutes. This article explains how to add custom tabs to your Facebook page to make it do more. Here we explain how we built a carousel, navigation tabs, forms, etc on the <a title="Webdigi Facebook fan page" href="http://www.facebook.com/pages/London-United-Kingdom/Webdigi-Web-Development/257801797036">Webdigi Facebook fan page</a>.</p>
<div id="attachment_559" class="wp-caption aligncenter" style="width: 489px"><a href="http://www.facebook.com/pages/Nutella/24932281961"><img class="size-full wp-image-559   " title="nutella" src="http://www.webdigi.co.uk/blog/wp-content/uploads/2010/01/nutella.png" alt="Nutella Facebook fan page" width="479" height="370" /></a><p class="wp-caption-text">Nutella Facebook fan page</p></div>
<p><strong>What do you need to create custom Facebook fan pages?</strong></p>
<p>The only thing you need is <a href="http://www.facebook.com/apps/application.php?id=4949752878">Static FBML</a> created by Facebook, this is an application that you have to add to your page. You can add advanced functionality to your fan page using the Facebook Static FBML application. This application will add a tab to your Page in which you can render HTML or FBML (Facebook Markup Language) for enhanced Page customisation. You will be able to add more than one tab using this application. On our Facebook fan page, we have three pages created using this application: services, portfolio and contact.</p>
<p><strong>What are the restrictions on Facebook ?</strong></p>
<p>1) Facebook does not allow<strong> Javascript to run on load</strong>, an user action like a mouse click must be performed before Javascript can be run. You will notice this on the services tab of our Facebook fan page. The carousel mouse over works only after you click on one of the arrows.</p>
<p>2) You will need to use <strong>FBJS (Facebook Javascript)</strong>. This provides the functionality we need to develop custom facebook pages. This is also to protect other users privacy at the same time and restrict Javascript features that can be abused.</p>
<p>3) Use &lt;link href=&#8221;http://example.com/style.css&#8221; rel=&#8221;stylesheet&#8221; type=&#8221;text/css&#8221; /&gt; if you want to use CSS on your Facebook fan page. This is to get the page to work correctly on Internet Explorer. The other browsers support the &lt;style type=&#8221;text/css&#8221;&gt; tag.</p>
<p>4) AJAX requests have a short timeout and these requests are proxied via Facebook. There are also limits on length of JSON replies, etc.</p>
<p><strong>Creating tabs on the Facebook fan page using FBML and FBJS</strong></p>
<p><a href="http://wiki.developers.facebook.com/index.php/FBJS">FBJS </a>is Facebook&#8217;s solution for developers who want to use JavaScript in their Facebook applications. FBJS DOM objects implement most of the same methods regular JavaScript objects implement including: appendChild, insertBefore, removeChild, and cloneNode. Properties like parentNode, nextSibling, src, href (and many many others) have been redefined as a couplet of getters and setters (getStyle : setStyle, getValue : setValue, getClassName : setClassName). Here is an example of a tab on a Facebook page.</p>
<p style="text-align: center;"><a href="http://www.facebook.com/pages/London-United-Kingdom/Webdigi-Web-Development/257801797036?v=app_7146470109"><img class="aligncenter size-full wp-image-571" title="apptabs" src="http://www.webdigi.co.uk/blog/wp-content/uploads/2010/01/apptabs.png" alt="apptabs" width="732" height="157" /></a></p>
<p><strong>Creating a carousel on the fan page</strong></p>
<p>FBJS exposes a powerful<a href="http://wiki.developers.facebook.com/index.php/FBJS/Animation"> animation library</a> which gives developers an easy way to improve their user interface with a line of code or two. All animations are CSS based, so a working knowledge of CSS will really help you out here. One of Facebook&#8217;s security restrictions are that Javascript will not be allowed onload of the page. The user must perform an action like clicking on a button, etc to begin Javascript code execution. This would mean that automated carousels; a carousel that starts rolling images by itself cannot be built into a Facebook fan page. This restriction also applies to pages with video, etc.</p>
<p style="text-align: center;"><a href="http://www.facebook.com/pages/London-United-Kingdom/Webdigi-Web-Development/257801797036?v=app_4949752878"><img class="aligncenter size-full wp-image-576" title="portfolio" src="http://www.webdigi.co.uk/blog/wp-content/uploads/2010/01/portfolio.png" alt="portfolio" width="708" height="230" /></a></p>
<p><strong>Submitting a web form using AJAX</strong></p>
<p>Creating a form for a fan page can be done using HTML. The AJAX support from facebook is interesting. All AJAX requests to the server you have under your control goes through facebook. If you have a tool monitoring the AJAX request, you will see that the form is actually being sent through to fbjs_ajax_proxy.php which in turn POST or GET the request to your server. The AJAX request can be sent using FBML in 3 steps:</p>
<pre class="brush: jscript; title: ; notranslate">
var ajax = new Ajax();
ajax.responseType = Ajax.FBML;
ajax.post('http://example.com/ajax.php');
</pre>
<p><strong>Creating Dialog boxes on Facebook</strong></p>
<p style="text-align: center;"><a href="http://www.facebook.com/pages/London-United-Kingdom/Webdigi-Web-Development/257801797036?v=app_6009294086"><img class="aligncenter size-full wp-image-583" title="dialog" src="http://www.webdigi.co.uk/blog/wp-content/uploads/2010/01/dialog.png" alt="dialog" width="592" height="223" /></a></p>
<p>FBJS offers a variety of Dialog boxes: Confirmation boxes, Yes/No type, Dialog boxes with forms, Choice, etc. To create the above dialog, we just need the following one line of code</p>
<pre class="brush: jscript; title: ; notranslate">
new Dialog().showMessage('Confirmation', 'The contact form has been submitted.');
</pre>
<p><strong>Show me the code</strong></p>
<p>Here are all the three code files that are in use for each of the three tabs on Facebook.</p>
<p>Contact Us tab (Containing form, AJAX submit and Dialog boxes) <a href="http://www.webdigi.co.uk/apps/fbapp/contactus.fbml">code</a></p>
<p>Portfolio tab (Carousel using FBJS Animation features) <a href="http://www.webdigi.co.uk/apps/fbapp/portfolio.fbml">code</a></p>
<div>
<p>Services tab (Tabs within page, basic FBJS events) <a href="http://www.webdigi.co.uk/apps/fbapp/services.fbml">code</a></p>
<div>We hope this helps you cut short your search and gives you a head start in your quest to build custom tabs within Facebook pages. There are numerous resources out there that helped us understand FBJS and build this article. Do send us links to fan pages that you have built, looking forward to your comments.</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.webdigi.co.uk/blog/2010/creating-a-custom-facebook-page/feed/</wfw:commentRss>
		<slash:comments>175</slash:comments>
		</item>
		<item>
		<title>Stupidity versus Malice</title>
		<link>http://www.webdigi.co.uk/blog/2009/stupidity-versus-malice/</link>
		<comments>http://www.webdigi.co.uk/blog/2009/stupidity-versus-malice/#comments</comments>
		<pubDate>Wed, 30 Sep 2009 16:25:55 +0000</pubDate>
		<dc:creator>iphp</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[Disaster]]></category>

		<guid isPermaLink="false">http://www.webdigi.co.uk/blog/?p=531</guid>
		<description><![CDATA[As a web developer, I am required to build web applications and secure websites. One of the key requirement is to create a secure and well protected system to keep attackers at bay. Although securing the website from malice is important, it is also important to secure the web application from stupidity. Stupidity from the [...]]]></description>
			<content:encoded><![CDATA[<p>As a web developer, I am required to build web applications and secure websites. One of the key requirement is to create a secure and well protected system to keep attackers at bay. Although securing the website from malice is important, it is also important to secure the web application from stupidity. Stupidity from the privileged users, administrators, developers, etc. The cost of stupidity is often underestimated. By stupidity I mean lack of average intelligence assumed for a particular task or not thinking through atleast a few worst case scenarios prior to doing something.</p>
<p>Let me give you a few <strong>big</strong> examples from history and recent times.</p>
<p><strong>1) Data worth 2 billion dollars lost in courier</strong><br />
In 2007, 25 million child benefit records was sent from one government department to another and was lost by the courier company. The discs were sent by a junior staff member <strong>unencrypted and unregistered</strong>. The discs contained all kinds of personal data, names and ages of children, bank savings account numbers, partners details and even National Insurance Numbers (Equivalent to the Social Security Numbers).  The costs that this caused UK is not clear but it did involve high profile resignations, weeks and weeks of political debates, banks monitoring millions of accounts for fraudulent activity, etc. Some estimate the data alone could be worth over <a href="http://news.bbc.co.uk/1/hi/uk_politics/7117291.stm">$2 billion</a> in criminal hands.</p>
<p><strong>2) The Honda Point Disaster (Off California Coast)</strong></p>
<div id="attachment_533" class="wp-caption alignleft" style="width: 310px"><a href="http://www.webdigi.co.uk/blog/wp-content/uploads/2009/09/honda_point.gif"><img class="size-medium wp-image-533" title="honda_point" src="http://www.webdigi.co.uk/blog/wp-content/uploads/2009/09/honda_point-300x237.gif" alt="Aerial view showing all seven destroyers" width="300" height="237" /></a><p class="wp-caption-text">Aerial view showing all seven destroyers</p></div>
<p>This was the largest peacetime loss of U.S. Navy ships in which <strong>seven destroyers were lost</strong>. This tragedy was not caused by malice. Twenty-three sailors died in the mishap. Two other destroyers were slightly damaged. The navy court ruled it as a fault of the navigators and the captains of each ship. <strong>How did this happen? </strong>The flagship was equipped with a radio navigational receiver, but ignored the bearings, believing them to be erroneous. No effort was made to take soundings or depth measurements. These operations were not performed due to the <strong>need to slow the ships to take readings</strong>. The ships were performing an exercise that simulated wartime conditions, hence the decision not to slow down. In this case, the dead reckoning (method of estimating position) was wrong and the mistake fatal. The need to slow the ship might also reminds us of another disaster, the Titanic!</p>
<p><strong>3) Aviation Accidents<br />
<span style="font-weight: normal;"><a href="http://www.boeing.com/news/techissues/pdf/statsum.pdf">Boeing studied</a> commercial jet accidents (not including hijacking, test flights, etc) between 1959 to 2008. They determined the primary cause of Airline hull loss accidents (aircraft beyond repair) to be the following:<br />
</span></strong></p>
<li><strong>55%: Flight crew error</strong></li>
<li>17%: Airplane</li>
<li>13%: Weather</li>
<li>7%: Misc./Other</li>
<li><strong>5%: Air traffic control</strong></li>
<li>3%: Maintenance</li>
<p><strong><span> </span> </strong></p>
<p>Clearly a lot of these are preventable and a lot of lives could have been saved. Flight crew error and the Air traffic control accounts to about 60% of all hull loss accidents.</p>
<p><strong>In Conclusion<br />
</strong>Accidents do and will happen, I would recommend developers to think about stupidity and not just malice when building systems. I have two interesting quotes to leave you with.<br />
Albert Einstein - <em>Two things are infinite: the universe and human stupidity; and I&#8217;m not sure about the universe.</em><br />
Hanlon&#8217;s Razor<strong> </strong>- <em>Never attribute to malice that which can be adequately explained by stupidity.</em></p>
<p>Do share incidents that you have come across during your career.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.webdigi.co.uk/blog/2009/stupidity-versus-malice/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>How to get your side project launched</title>
		<link>http://www.webdigi.co.uk/blog/2009/how-to-get-your-side-project-launched/</link>
		<comments>http://www.webdigi.co.uk/blog/2009/how-to-get-your-side-project-launched/#comments</comments>
		<pubDate>Sun, 23 Aug 2009 12:30:22 +0000</pubDate>
		<dc:creator>iphp</dc:creator>
				<category><![CDATA[Development Technology]]></category>
		<category><![CDATA[Project Management]]></category>

		<guid isPermaLink="false">http://www.webdigi.co.uk/blog/?p=522</guid>
		<description><![CDATA[There are many people who have a lot of interesting ideas in mind but never get around to starting on their side/pet project. Some people start on their side project but never get to completion. These are the three steps which if followed before you start actual work on your project will help you get [...]]]></description>
			<content:encoded><![CDATA[<p>There are many people who have a lot of interesting ideas in mind but never get around to starting on their side/pet project. Some people start on their side project but never get to completion. These are the three steps which if followed before you start actual work on your project will help you get your pet project launched.</p>
<p><strong>1. </strong><strong>Think things through</strong><br />
- This is the most important step. If you do this well, consider your side project well begun and half done!<br />
- Visualize things after completion will it make you happy? Will it make you feel like you accomplished something? Will it make you feel successful?<br />
- Humans operate with pain-pleasure principle.  Will the completion of the project alleviate your pain or others pain? Will it bring some pleasure to the work and lives of others or yourself?<br />
- When the going gets tough with your pet project as it often does, these reasons will help you and give you the strength to complete the project.</p>
<p><strong>2. Set a deadline with detailed plans</strong><br />
- Start by identifying all the steps you need to complete and each stage.<br />
- When can you reasonably finish the project?<br />
- When do you want to launch? When do you want to get your product or service out to the public?<br />
- Make detailed and specific plans, not vague ones.<br />
- Also the most important rule, remember nothing is perfect. You will have to refine after launch and constantly learn from it. Take a look at the first version of <a href="http://web.archive.org/web/19981111183552/google.stanford.edu/">Google</a>. Your first launch is the beginning get ready to quickly make changes depending on user feedback.</p>
<p><strong>3. Make commitments</strong><br />
- Tell your friends and your family you are going to launch on the deadline.<br />
- If you had prospective customers enquiring about product, let them know that you are launching the product or service on the launch date.<br />
- Schedule banner ads, ppc ads, book presentations, print leaflets, etc as required to promote your project and get you to focus on the launch.<br />
- Get a mailing list of all people who you know that will be interested in the project.<br />
- The third point in my opinion is the one most often ignored and causes deadlines to slip. If  your family &amp; friends know that we are busy working on something they might understand not to bother you until your launch date!</p>
<p>The first point on thinking things through will energize you or show you that this project should never be done. The third point will commit you to the deadline and hopefully clear out distractions as your family and friends are now aware of what you are working on. Only once all the three steps above are complete you should start working on your project and in accordance with your plan.</p>
<p>If you are working on your pet project please do share your experience!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.webdigi.co.uk/blog/2009/how-to-get-your-side-project-launched/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Get your own cloud server running in 15 minutes</title>
		<link>http://www.webdigi.co.uk/blog/2009/get_your_own_cloud_server_running_in_15_minutes/</link>
		<comments>http://www.webdigi.co.uk/blog/2009/get_your_own_cloud_server_running_in_15_minutes/#comments</comments>
		<pubDate>Mon, 29 Jun 2009 08:17:57 +0000</pubDate>
		<dc:creator>iphp</dc:creator>
				<category><![CDATA[Server]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Amazon EC2]]></category>
		<category><![CDATA[AWS Management Console]]></category>
		<category><![CDATA[Cloud Computing]]></category>

		<guid isPermaLink="false">http://www.webdigi.co.uk/blog/?p=486</guid>
		<description><![CDATA[This article uses Amazon EC2 and does not require any additional software installed on your machine to get your own cloud instance running other than your browser. To further configure your instance once it is running you will need Putty or an RDP client depending on your server instance. Amazon EC2 (Elastic Compute Cloud) is [...]]]></description>
			<content:encoded><![CDATA[<p>This article uses Amazon EC2 and does not require any additional software installed on your machine to get your own cloud instance running other than your <strong>browser</strong>. To further configure your instance once it is running you will need Putty or an RDP client depending on your server instance.</p>
<p>Amazon EC2 (Elastic Compute Cloud) is a service by Amazon which lets anyone create, launch, and terminate server instances as needed, paying by the hour for active servers, hence the term &#8220;elastic&#8221;. The service starts as low as 0.11$ per hour. For this article an instance of LAMP server and a Windows Server 2003 was launched and cost about $<strong>0.25. </strong>This is very cheap for your on-demand server needs.</p>
<p><strong>Steps to Launch your server instance</strong></p>
<p>1) Signup for <a href="http://aws.amazon.com/ec2/">Amazon EC2 here</a> (If you already have an amazon account you can save 2 minutes!)<br />
2) Login to the <a href="https://console.aws.amazon.com/ec2/home#c=EC2&amp;s=Home">EC2 management console<br />
</a></p>
<div id="attachment_487" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.webdigi.co.uk/blog/wp-content/uploads/2009/06/management-console.png"><img class="size-medium wp-image-487  " title="ec2_management-console" src="http://www.webdigi.co.uk/blog/wp-content/uploads/2009/06/management-console-300x157.png" alt="AWS Management Console" width="300" height="157" /></a><p class="wp-caption-text">AWS Management Console (Click to enlarge)</p></div>
<p>3) On the management console, Click on <strong>Launch Instances</strong><br />
4) <strong>Select an AMI</strong> (Amazon Machine Image). You will get a huge list ranging from windows servers to LAMP servers, Ruby on Rails server, Ubuntu, Debian, Open Solaris etc. If you also look at the community supplied options you will have nearly 3000 AMIs.</p>
<div id="attachment_490" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.webdigi.co.uk/blog/wp-content/uploads/2009/06/ami-list.png"><img class="size-medium wp-image-490" title="List of Amazon Machine Images" src="http://www.webdigi.co.uk/blog/wp-content/uploads/2009/06/ami-list-300x180.png" alt="List of Amazon Machine Images" width="300" height="180" /></a><p class="wp-caption-text">List of Amazon Machine Images</p></div>
<p>5) <strong>Create a key pair</strong> by following on screen instructions. This is to help you to login to your AMI once it is ready.<br />
7) Configure <strong>firewall settings</strong> and limit access to the server (SSH, MySQL, Web, etc).</p>
<div id="attachment_492" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.webdigi.co.uk/blog/wp-content/uploads/2009/06/configure-firewall.png"><img class="size-medium wp-image-492" title="configure-firewall" src="http://www.webdigi.co.uk/blog/wp-content/uploads/2009/06/configure-firewall-300x179.png" alt="Authorise connection method" width="300" height="179" /></a><p class="wp-caption-text">Authorise connection method</p></div>
<p>8 ) You will now arrive at the<strong> final step</strong> of your wizard. Enter number of instances. Select an instance type Small, High CPU, etc. You will also have to select the key pair that was generated for you at Step 5. Click Launch once set.</p>
<div id="attachment_493" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.webdigi.co.uk/blog/wp-content/uploads/2009/06/launch-instance.png"><img class="size-medium wp-image-493" title="launch-instance" src="http://www.webdigi.co.uk/blog/wp-content/uploads/2009/06/launch-instance-300x169.png" alt="Set Number of Instances" width="300" height="169" /></a><p class="wp-caption-text">Set Number of Instances</p></div>
<p>9) <strong>Voila!</strong> your instance will be available in just a few minutes. Now you can pat yourselves on the back for all the hard work!</p>
<p>It is amazing how quickly you can get an instance running. Once your server is up and running how do you connect to this instance? Well, it is pretty simple if you are using windows you get to use RDP (Terminal Services). For non-windows instances you will have to use SSH to connect to the server.</p>
<p><strong>Advanced configuration of your Windows instance using RDP (optional)</strong><strong></strong></p>
<p>It is easy to connect to a windows amazon instance via RDP compared to SSH connection to a linux server. To retrieve the RDP password, you will have to right click your instance and retrieve connection information using the key pair you have been given.</p>
<div id="attachment_496" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.webdigi.co.uk/blog/wp-content/uploads/2009/06/rdp-connection.png"><img class="size-medium wp-image-496" title="rdp-connection" src="http://www.webdigi.co.uk/blog/wp-content/uploads/2009/06/rdp-connection-300x170.png" alt="Connecting via RDP " width="300" height="170" /></a><p class="wp-caption-text">Connecting via RDP </p></div>
<p>You will have to connect using Administrator as your username. You will find all other info you need on the management console.</p>
<p><strong>Advanced configuration of your Linux instance using SSH (optional)</strong></p>
<p>You will need putty to connect to your linux server via SSH on a windows machine. If you are on a linux machine you will be able to use the ssh command as shown on the management console. With putty you will also need an additional tool to create a PPK file from the PEM file that you are given from the management console. To do this you will have to download an additional tool called PuttyGen.exe. You have to load the PPK file under the SSH Auth section of the putty client.</p>
<div id="attachment_495" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.webdigi.co.uk/blog/wp-content/uploads/2009/06/ssh-connect.png"><img class="size-medium wp-image-495" title="Using SSH to connect" src="http://www.webdigi.co.uk/blog/wp-content/uploads/2009/06/ssh-connect-300x244.png" alt="SSH Connection to your instance" width="300" height="244" /></a><p class="wp-caption-text">SSH Connection to your instance</p></div>
<p>Once your instance is up and running you will be able to connect to the webserver, connect to the MySQL server, if it is enabled with the AMI. The last two sections are to help you further configure your instance further. There are so many AMIs available with a lot of features already built in. Technically you will have your services running after the first set of steps which can be complete in 15 minutes!</p>
<p>If you do not want to configure a server yourself take a look at the Windows Azure, Force.com or the Google App Engine which runs Java, Python and <a href="http://www.webdigi.co.uk/blog/2009/run-php-on-the-google-app-engine/">PHP using Quercus</a> for free (certain usage limits apply).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.webdigi.co.uk/blog/2009/get_your_own_cloud_server_running_in_15_minutes/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Rise of Javascript</title>
		<link>http://www.webdigi.co.uk/blog/2009/rise-of-javascript/</link>
		<comments>http://www.webdigi.co.uk/blog/2009/rise-of-javascript/#comments</comments>
		<pubDate>Tue, 16 Jun 2009 16:00:54 +0000</pubDate>
		<dc:creator>iphp</dc:creator>
				<category><![CDATA[Javascript Development]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.webdigi.co.uk/blog/?p=440</guid>
		<description><![CDATA[Since its birth in 1994, Javascript has come a long way. Today it is one of the most popular programming languages on the web. Javascript has been on the rise and is growing faster since AJAX based applications reignited professional developer interest. It is now possible to it to write applications on the server, the [...]]]></description>
			<content:encoded><![CDATA[<p>Since its birth in 1994, Javascript has come a long way. Today it is one of the most popular programming languages on the web. Javascript has been on the rise and is growing faster since AJAX based applications reignited professional developer interest. It is now possible to it to write applications on the server, the mobile devices, on the browsers (add ons and plugins),  inside PDF documents, even in some remote controls and many more to come.</p>
<p><strong>Javascript application development in Mobile devices </strong></p>
<div id="attachment_470" class="wp-caption alignright" style="width: 310px"><img class="size-medium wp-image-470" title="palm_webos_450" src="http://www.webdigi.co.uk/blog/wp-content/uploads/2009/06/palm_webos_450-300x216.jpg" alt="Build Native Applications using Javascript" width="300" height="216" /><p class="wp-caption-text">Build Native Applications using Javascript</p></div>
<p>Palm&#8217;s new OS is the first mobile platform to be built from the ground up to combine standard technology, innovation and integration. At its core, webOS leverages several industry-standard technologies, including web technologies such as CSS, XHTML and JavaScript. You can think of webOS applications as native applications, but built from the same standard HTML, CSS and JavaScript that you&#8217;d use to develop web applications. Palm has extended the standard web development environment through a JavaScript framework that gives standardized UI widgets, and access to selected device hardware and services.</p>
<p>Javascript can be used on the <strong>iphone</strong> too.  The HTML 5 specification provides a new mechanism for client-side data storage: JavaScript database support. This feature shipped originally with iPhone OS 2.1. When you use “Add to Home Screen” from the “+” button on Safari for iPhone, a web application with a manifest defined (per the HTML5 spec) will be saved with any cached resources.  It is also worth noting that these features have not been added to Safari on Mac OS X or Windows.</p>
<p><strong>Desktop Application development using Javascript</strong></p>
<p>Adobe AIR is a cross-platform desktop runtime created by Adobe that allows web developers to use web technologies to build and deploy Rich Internet Applications (RIAs) and web applications to the desktop. This means what you can write you application using Javascript and then let AIR to figure out how to run your code in Windows, Linux, Mac and future operating systems.</p>
<div id="attachment_453" class="wp-caption alignleft" style="width: 360px"><img class="size-medium wp-image-453 " title="airtotal2" src="http://www.webdigi.co.uk/blog/wp-content/uploads/2009/06/airtotal2-300x200.png" alt="airtotal2" width="350" height="233" /><p class="wp-caption-text">Desktop App using Javascript</p></div>
<p>The application shown in the pic is written using Javascript, HTML and CSS. It uses the ExtJS library. Javascript can be used to dock the application in the taskbar, delete and modify files on the hard drive, communicate to different server, use AJAX, etc. You can even use flash within your app to make the application look and feel much better. This gives the web developer good access to a desktop.</p>
<p><strong>Server side Scripts using Javascript</strong></p>
<p><strong> </strong></p>
<p><strong><span style="font-weight: normal;">Server side JavaScript has been around for a long time and potentially offers some unique and interesting advantages over other languages (like PHP, ASP, etc) because the same language is spoken by both client and server. There are<a rel="nofollow" href="http://en.wikipedia.org/wiki/Server-side_JavaScript"> numerous attempts</a> to bring server side javascript to the masses.  Server side Javascript has to do much more than what it has to do at the browser level with</span></strong> access to databases, files, and networking, as well as logging, process management, scalability, security, integration APIs, and extensibility. You can even use your own javascript libraries on the server jQuery, dojo, Ext JS, prototype, etc.</p>
<p><strong>Javascript in other places</strong></p>
<p>- Adobe reader (from v3.02) supports Javascript for forms and basic operations. SOAP support has also been included since version 7.0. There is also access to the entire 3D Javascript API. More details on using Javascript is <a rel="nofollow" href="http://www.adobe.com/devnet/acrobat/pdfs/js_developer_guide.pdf">available here</a><br />
- Open office application suite supports Javascript to <a rel="nofollow" href="http://framework.openoffice.org/scripting/release-0.2/javascript-devguide.html">write macros</a>. This move looks like a sensible addon given the usage of VBScript in MS Office suite.<br />
- Apple&#8217;s Dashboard Widgets, Microsoft&#8217;s Gadgets, Yahoo! Widgets, Google Desktop Gadgets are implemented using JavaScript.<br />
- The oddest one in this list will have to be the  <a rel="nofollow" href="http://www.amazon.com/Philips-TSU9400-Pronto-Universal-Control/dp/B000VV9ZJU">Philips Remote Control</a> which uses Javascript</p>
<p><strong>ECMAScript 4 (ECMAScript Harmony)</strong></p>
<p>Javascript has been relatively stable since the third edition of ECMAScript published in 1999. Features under discussion for a future edition originally ECMAScript 4 now ECMAScript Harmony include Classes, a module system, static typing and Optional type annotations, Generators, Iterators, Destructuring assignment, algebraic data types. Well if you think this is ambitious you should see the original ECMAScript 4 which had more semantic and syntactic innovation. Packages, namespaces and early binding from ECMAScript 4 are no longer included for planned releases with ECMAScript Harmony. The intent of these features is partly to better support &#8220;programming in the large&#8221;, and to let programmers sacrifice some of the script&#8217;s ability to be dynamic for performance.</p>
<p>So yes as a web developer who uses Javascript on a daily basis, I am excited to watch Javascript grow and be available in more places.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.webdigi.co.uk/blog/2009/rise-of-javascript/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Javascript Gotchas listed to help avoid mistakes</title>
		<link>http://www.webdigi.co.uk/blog/2009/javascript-gotchas-listed-to-help-avoid-mistakes/</link>
		<comments>http://www.webdigi.co.uk/blog/2009/javascript-gotchas-listed-to-help-avoid-mistakes/#comments</comments>
		<pubDate>Thu, 21 May 2009 15:53:17 +0000</pubDate>
		<dc:creator>iphp</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[gotchas]]></category>
		<category><![CDATA[Javascript Development]]></category>

		<guid isPermaLink="false">http://www.webdigi.co.uk/blog/?p=361</guid>
		<description><![CDATA[A gotcha in programming is something unexpected although a documented feature of a computer system and not a bug. These gotchas throw beginners off Javascript programming and send some people running and screaming. In my opinion, Javascript is one of the most widespread languages as it is available on all browsers but one of the least learned languages.  Let&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>A gotcha in programming is something unexpected although a documented feature of a computer system and not a bug. These gotchas throw beginners off Javascript programming and send some people running and screaming. In my opinion, Javascript is one of the most widespread languages as it is available on all browsers but one of the least learned languages.  Let&#8217;s start with basic ones.</p>
<p><strong>1. Floating point arithmetic</strong></p>
<p>This can be a major cause of frustration for people who are new to Javascript and are trying to perform some kind of mathematical computation.</p>
<pre class="brush: jscript; title: ; notranslate">&lt;br /&gt;&lt;br /&gt;
&lt;script&gt;&lt;br /&gt;&lt;br /&gt;
alert(0.02 / 0.1);  //0.19999999999999998 &lt;br /&gt;&lt;br /&gt;
alert(1.14 * 100);  //113.99999999999999    ;)&lt;br /&gt;&lt;br /&gt;
&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;
</pre>
<p>
This is where the Math.round() functions come in handy</p>
<p><span style="font-weight: bold;">2. Plus operator overloading </span></p>
<p>The plus operator stands for both arithmetic operations and also string concatenation. This is convenient if used correctly. Lets take a look</p>
<p>
<pre class="brush: jscript; title: ; notranslate">&lt;br /&gt;&lt;br /&gt;
&lt;script&gt;&lt;br /&gt;&lt;br /&gt;
var msg, one=&quot;1&quot;;&lt;br /&gt;&lt;br /&gt;
msg = 2 + &quot;1&quot;; // msg = &quot;21&quot;&lt;br /&gt;&lt;br /&gt;
msg = 2 + one; // msg = &quot;21&quot;&lt;br /&gt;&lt;br /&gt;
msg = 1 + 1 + 1 + &quot; musketeers&quot;; // msg = &quot;3 musketeers&quot;&lt;br /&gt;&lt;br /&gt;
msg = &quot;Bond &quot; + 0 + 0 + 7; //msg = &quot;Bond 007&quot;  &lt;br /&gt;&lt;br /&gt;
&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;
</pre>
<p> <br />
The above behaviour is because the operations are performed left to right. If we use parantheses the behaviour will change based on the order of the string or number in it.</p>
<p><span style="font-weight: bold;">3. Semicolon insertion at line feed</span></p>
<p>Javascript automatically inserts ; at a line feed. Lets see this in action with a simple example:</p>
<p>
<pre class="brush: jscript; title: ; notranslate">&lt;br /&gt;&lt;br /&gt;
&lt;script&gt;&lt;br /&gt;&lt;br /&gt;
function returnSame(a){&lt;br /&gt;&lt;br /&gt;
   return                 //Inserts semi-colon to convert to return;&lt;br /&gt;&lt;br /&gt;
   a                      //a becomes a; - Unreachable&lt;br /&gt;&lt;br /&gt;
}&lt;br /&gt;&lt;br /&gt;
alert(returnSame(2));  //Output is undefined&lt;br /&gt;&lt;br /&gt;
&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;
</pre>
<p>
The magical semicolon insertion can get things complicated while creating objects using object literals</p>
<p><strong>4. typeof operator</strong></p>
<p>typeof is a unary operator. The results are not one would normally expect. It suprisingly evaluates null to &#8221;object&#8221;. </p>
<p>
<pre class="brush: jscript; title: ; notranslate">&lt;br /&gt;&lt;br /&gt;
&lt;script&gt;&lt;br /&gt;&lt;br /&gt;
var obj={};  //object created using object literal&lt;br /&gt;&lt;br /&gt;
var arr=[];  //array created by array literal&lt;br /&gt;&lt;br /&gt;
alert(typeof(obj));   //object  - Good&lt;br /&gt;&lt;br /&gt;
alert(typeof(arr));   //object  - Bad&lt;br /&gt;&lt;br /&gt;
alert(typeof(null));  //object  - Ugly!  ;)&lt;br /&gt;&lt;br /&gt;
&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;
</pre>
<p> <br />
It should only be used to distingush objects from other primitive types.</p>
<p><span style="font-weight: bold; ">5. false, null, undefined, NaN, Infinity</span></p>
<p>They stand for different things although they might look similar or at times look redundant. Javascript uses three primitive datatypes numbers, strings and boolean. In addition it has two trivial datatypes undefined and null. Both null and undefined are equal according to the equality operator (==)</p>
<p>
<pre class="brush: jscript; title: ; notranslate"> &lt;br /&gt;&lt;br /&gt;
&lt;script&gt;&lt;br /&gt;&lt;br /&gt;
var a;&lt;br /&gt;&lt;br /&gt;
alert (a);    //undefined&lt;br /&gt;&lt;br /&gt;
alert (1/0);  //Infinity&lt;br /&gt;&lt;br /&gt;
alert (0/0);  //NaN&lt;br /&gt;&lt;br /&gt;
0/0 == 0/0;   //false - a NaN != NaN&lt;br /&gt;&lt;br /&gt;
alert (b);    //error&lt;br /&gt;&lt;br /&gt;
&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;
</pre>
<p> </p>
<p><span style="font-weight: bold;">6. String replace only replaces first occurence</span></p>
<p>Unlike PHP or other languages, string replace in Javascript only replaces the first occurence of a string by default.</p>
<p>
<pre class="brush: jscript; title: ; notranslate">&lt;br /&gt;&lt;br /&gt;
&lt;script&gt;&lt;br /&gt;&lt;br /&gt;
var nospace = &quot;I dont need spaces&quot;.replace(&quot; &quot;,&quot;_&quot;);&lt;br /&gt;&lt;br /&gt;
alert(nospace);    //I_dont need spaces   - Only first occurence&lt;br /&gt;&lt;br /&gt;
var nospace = &quot;I dont need spaces&quot;.replace(/ /g,&quot;_&quot;);&lt;br /&gt;&lt;br /&gt;
alert(nospace);    //I_dont_need_spaces&lt;br /&gt;&lt;br /&gt;
&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;
</pre>
<p> </p>
<p><span style="font-weight: bold;">7. ParseInt function</span></p>
<p>This is used to convert a string into an integer. The function does accept two arguments and the second argument specifies the radix. The radix here for decimal is10. If no radix argument is passed the parseInt function tries to guess the base and in this case because the string starts with 0, it is parsed as an <span style="text-decoration: underline;">octal </span>number.</p>
<pre class="brush: jscript; title: ; notranslate">&lt;br /&gt;&lt;br /&gt;
&lt;script&gt;&lt;br /&gt;&lt;br /&gt;
var str = &quot;017&quot;;&lt;br /&gt;&lt;br /&gt;
var strInt = parseInt(str);      //strInt = 15  ;)&lt;br /&gt;&lt;br /&gt;
var strInt = parseInt(str,10);   //strInt = 17&lt;br /&gt;&lt;br /&gt;
&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;
</pre>
</p>
<p><strong>Please share your Javascript Gotcha&#8217;s using the form below:<br />
<span style="font-weight: normal;">(note use &amp;lt; and &amp;gt;</span> </strong>to get past the comment filter for &lt; and &gt;)</p>
<p><strong><br />
</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.webdigi.co.uk/blog/2009/javascript-gotchas-listed-to-help-avoid-mistakes/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
	</channel>
</rss>

