Programming

Reef wanted to broaden their audience with the use of social media to expand their brand awareness. Together, we created a quirky and cheeky Facebook application for users to share their desire to go to the Reef Life.

The Reef Life campaign is a summer campaign for Facebook users to express their desires to escape to the Reef Life. The application creates random sentences for users to share on their wall, their friends see the quirky wall posts and access the application to create their own.

The application has gained a lot of popularity with a lot of repetitive users.

Have you ever wanted to dig into your web pages on your mobile devices and don't have the capabilities to view source code or poke around? Snoopy is a bookmarklet for snooping on web pages. It's intended for use on mobile browsers like the iPod, iPhone, and iPad Mobile Safari where you can't view-source to poke around under the hood of sites to see how they're built.

Using the bookmarklet will give you an overlay that shows you information such as what Doctype the page has, what JS libraries are used in the page, what analytics, etc. It also gives you the ability to view the raw and/or generated source of the page.

Check the project out at http://snoopy.allmarkedup.com

As many know, I disagree with patents in general, and a software patent is one that really annoys me the most. Thankfully, a country is taking a step to reform the country's standards of patentability, the country being New Zealand.

One of the biggest changes in the proposed bill is patentability exclusion for software. If the bill is approved, it will eliminate conventional software patents in New Zealand.

The official summary of the bill acknowledges that software patents are detrimental to the open source software development model and have the potential to seriously halt innovation. A large number of submissions argued that there is no 'inventive step' in software development, new software has been built on existing software.

The only thing we hope to happen is other countries will follow New Zealand's approach.

Source: New Zealand patent reform bill says no to software patents

WordPress' Update Services allow you to let other people know you have updated your website. WordPress automatically notifies popular update services that you've updated your blog by sending an XML-RPC ping each time you create or update a post.

When WordPress contacts these updates services, they process the ping and update the indices (database) with your update. When people are using sites like Technorati or Sphere, people can see your most recent additions and changes.

Most people use Ping-o-Matic which, with just one "ping" from you, will let many other services know that you've updated.

Otherwise you can insert your own ping services in the Settings => Writing => Update Services in the admin panel of your WordPress installation. Below is a list of some of the popular update ping services on the Internet.

XML-RPC Ping Services
http://rpc.pingomatic.com http://api.feedster.com/ping http://api.moreover.com/RPC2 http://api.moreover.com/ping http://api.my.yahoo.com/RPC2 http://api.my.yahoo.com/rss/ping http://www.blogdigger.com/RPC2 http://www.blogshares.com/rpc.php http://www.blogsnow.com/ping http://www.blogstreet.com/xrbin/xmlrpc.cgi http://bulkfeeds.net/rpc http://www.newsisfree.com/xmlrpctest.php http://ping.blo.gs/ http://ping.feedburner.com http://ping.syndic8.com/xmlrpc.php http://ping.weblogalot.com/rpc.php http://rpc.blogrolling.com/pinger/ http://rpc.technorati.com/rpc/ping http://rpc.weblogs.com/RPC2 http://www.feedsubmitter.com http://blo.gs/ping.php http://www.pingerati.net http://www.pingmyblog.com http://geourl.org/ping http://ipings.com http://www.weblogalot.com/ping

Alternatives
* An alternative is Feed Shark (Blog and Ping), which pings over 60 services for free.
* Feedburner users can use the Feedburner Pingshot service, which will alert most popular ping services.
* If you're interested in manual configuration, have a look at the WordPress compressed ping list.
* Check Vladimir's WordPress Ping List, manually checked and updated
* The Smart Update Pinger (requires registration) and the MaxBlogPress Ping Optimizer plugins provide future post pings, logging, and avoid sending any ping notification when editing previously published posts. The Smart Update Pinger also provides correct extended ping request handling.

If you're wanting to fire an event when the enter key is pressed on a text field, then all you simply need to do is the following:

  1.  
  2. $('text-field-id').addEvent('keydown', function(event) {
  3. if(event.key == "enter") {
  4. alert("Enter Key Pressed");
  5. }
  6. });
  7.  

Nice and simple.

LESS is a easy to use markup language to extend CSS with variables, mixins, operations, and nested rules. Best of all it's easy to convert to LESS, you simply rename your CSS extensions to .less and you are ready to go.

Of course your existing CSS won't utilise the power of LESS, but it's an easy way to migrate. You could spend a day converting your CSS code to the structure/formatting LESS enables or simply modify as you code.

Variables
Variables allow you to specify widely used values in a single place, and then re-use them throughout the style sheet, making global changes as easy as changing one line of code.

  1.  
  2. @brand_color: #4D926F;
  3.  
  4. #header {
  5. color: @brand_color;
  6. }
  7.  
  8. h2 {
  9. color: @brand_color;
  10. }
  11.  

Mixins
Mixins allow you to embed all the properties of a class into another class by simply including the class name as one of its properties. It's just like variables, but for whole classes. Mixins can also behave like functions, and take arguments, as seen in the example bellow.

  1.  
  2. .rounded_corners (@radius: 5px) {
  3. -moz-border-radius: @radius;
  4. -webkit-border-radius: @radius;
  5. border-radius: @radius;
  6. }
  7.  
  8. #header {
  9. .rounded_corners;
  10. }
  11.  
  12. #footer {
  13. .rounded_corners(10px);
  14. }
  15.  

Nested Rules
Rather than constructing long selector names to specify inheritance, in Less you can simply nest selectors inside other selectors. This makes inheritance clear and style sheets shorter.

  1.  
  2. #header {
  3. color: red;
  4.  
  5. a {
  6. font-weight: bold;
  7. text-decoration: none;
  8. }
  9. }
  10.  

Operations
Are some elements in your style sheet proportional to other elements? Operations let you add, subtract, divide and multiply property values and colors, giving you the power to do create complex relationships between properties.

  1.  
  2. @the-border: 1px;
  3. @base-color: #111;
  4. #header {
  5. color: @base-color * 3;
  6. border-left: @the-border;
  7. border-right: @the-border * 2;
  8. }
  9.  
  10. #footer {
  11. color: (@base-color + #111) * 1.5;
  12. }
  13.  


The idea is simple, 12 random strangers board a bus in San Francisco and travel at 60 miles an hour to Austin. The journey will take over 48 hours, during this time they will conceive, build and launch 3 tech startups in time for a SXSW party in Austin. The experiment is called 'The Startup Bus'.

Sounds interesting and unfortunately I see it as a complete waste of time. Why? To create 1 tech startup in 48 hours wouldn't be sufficient, there isn't enough time to plan, discuss, experiment, build, and test in 48 hours with 12 developers - let alone 3 tech startups.

I've seen people waste their time many times over on their ideas and it generally comes down to one thing. As with any idea, you don't want others to know about it until you're ready, usually this is when you want to launch your idea. Unfortunately this causes a big issue, you need to research and discuss your ideas with others as your idea may not be everyone's cup of tea.

'The Startup Bus' are looking for sponsors and I wish them the best, it will be interesting to see what comes out of this experiment but I'm not expecting any of them to be the next YouTube or Facebook that's for sure. And hey, if they pay for my flights, food, and accommodation to San Francisco and Austin, I will surely like to participate.

I recently used a new WordPress plugin which crashed my whole site, couldn't do a thing and I definitely couldn't access the admin site to disable the new plugin. So to disable the plugin, you need to access your database.

Using a tool like phpMyAdmin or if you're an experienced user you can access the database directly. Go to the 'wp_options' table, find the row 'active_plugins', you will see something similar to the following, depending on the number and type of plugins you have installed: a:1:{i:0;s:19:"akismet/akismet.php";}

That value represents every active plugin on your site, so to quickly disable all your plugins, copy this string to a safe place for backup (just in case), clear the value completely and save. All your WordPress plugins are now deactivated, now you can reactivate all the plugins except the one that was causing you problems.

The Firebug team have released Firebug 1.5, with many bug fixes and new great features below:-

  • Mike Radcliffe’s Inspector. Firebug's key feature, now solid as a rock,
  • Jan ‘Honza’ Odvarko’s expanded and refined the Net panel, with more accurate timings,
  • Steve Roussey’s reworking of HTML editing and entity support,
  • Kevin Decker’s CSS and Style side panel improvements,
  • Support for dynamic, graphical breakpoints throughout Firebug.
  • It works with the soon-to-be-released Firefox 3.6

Most importantly, it is released before Firefox 3.6. The biggest problem is upgrading Firefox and finding Firebug no longer works.

Tobias Schneider has built an open source Flash runtime written in pure JavaScript and HTML5, quite impressive. Hosted on GitHub for everyone to download and use.

Works well in the latest versions of Firefox, Chrome, and Safari (and, yes, iPhone Safari). Very useful for desktop users as well, if the user doesn't have Flash installed you can call Gordon to run the Flash files instead (great for users who do not have privileges to install Flash on their computer).

Quick and Easy Installation Instructions

  1. Download Gordon
  2. Insert a script tag in the head of your HTML file to the Gordon javascript file
    1. <script type="text/javascript" src="../gordon.js"></script>
  3. Insert a div or span tag where you would like the Flash file to appear within the body of your HTML file
    1. <div id="stage"></div>
  4. Add a JavaScript onload event to insert the flash file within your div or span
    1. <body onload="new Gordon.Movie('flash-file.swf',
    2. {id: 'stage', width: 500, height: 400})">
  5. Enjoy !

A full list of countries in a CSV file.

Full Country List (CSV) - Zip Archive

Developing websites today requires interaction with users and 'something' to keep users coming back. Creating a website is no longer simply throwing up images, copy, and hope your site achieves everything you desire.

Adobe Flash used to be widely used to achieve a rich user experience with websites, but JavaScript has made a reappearance and taken charge of creating the desired user experiences. Once a website has been launched, you simply can't help it but enhance it - and don't be shamed, it's worth it. But often we add too much way too quickly and everyone may not have a super fast Internet connection like you do.

Whilst writing JavaScript or CSS, it's good practice to keep your files separate, but when a user downloads all your files, it's all the initial server requests for each file that are slowing down the page the most. You could develop all your JavaScript and CSS in two files, but you can easily go over 5000 lines before you know it - which makes it extremely difficult to develop more, test and debug.

Unfortunately, the more you add to a website the slower it becomes to download and view. Fortunately, there are a million methods or probably just 20 (I haven't counted) to enhance the speed of your website.

Firstly, install YSlow from Yahoo, it also requires Firebug. YSlow offers suggestions for improving the page's performance, summarises the page's components, displays statistics about the page, and provides tools for performance analysis, including Smush.itâ„¢ and JSLint.

Read through each suggestion YSlow supplies and you will find your site's download and viewing speeds increase with every change. As to speeding up the JavaScript and CSS files, I recommend Minify to combine the multiple CSS or Javascript files, remove unnecessary whitespace and comments, and serve them with gzip encoding and optimal client-side cache headers.

By using Minify, you can reduce the time taken to download your site by over 300% simply reducing the number of files to download.

If you're looking for some AJAX loading animations then use this AJAX Loading GIF Generator to create your own style. It has different animations to choose from, and color settings (foreground and background) to pick.

So you graphically challenged Web 2.0 geeks can have some cool personalised loading animations whilst you're loading content.

Some examples:-

Loading Animation

Loading Animation

Loading Animation

This is a frequent question for most IIS users on how to get permalinks to work in WordPress, it's fairly simple really once you know how of course. So the problems are, you're using IIS so using mod_rewrite won't work, you're on a shared server so installing a mod_rewrite alternative for IIS is not available either. You can have URLs with a index.php in them (for example http://www.yourdomain.com/index.php/2009/03/17/getting-permalinks-working-in-wordpress-on-iis) but they're pretty ugly looking and doesn't fit into the URL standards (in other words, it's just nasty).

WordPress Codex has a very useful page about working with permalinks, there's one solution that uses 404 error pages, however when you look at what it does it's very slow and again very nasty. The 404 error solution makes the server try to find the page, it doesn't exist so the server directs the user to the 404 error page, the 404 error page then does it's own working out to figure out where the user should be going, and then it would make it's own HTTP to the correct URL.

This example would work great if only it didn't make a HTTP, so what can we do with this example to make it more efficient.

  1. <?php
  2. $qs = $_SERVER['QUERY_STRING'];
  3. $pos = strrpos($qs, '://');
  4. $pos = strpos($qs, '/', $pos + 4);
  5. $_SERVER['REQUEST_URI'] = substr($qs, $pos);
  6. $_SERVER['PATH_INFO'] = $_SERVER['REQUEST_URI'];
  7. include('index.php');
  8. ?>

* Put the above 404 error script in the base of your WordPress directory.

* Set your site's 404 Error Page to the file above

* Setup your permalinks in WordPress -> Options -> Permalinks

Because it's including the index.php file into the script, it's utilising the functionality that is already present in WordPress.

Resources
* Pretty WordPress Permalinks on IIS
* WordPress Codex Permalinks
* 404 Error Solution

That's because "09" is an invalid number, in octal.

The parseInt() funciton acutally has 2 arguments that most people are not aware of, first is the string to parse and then a radix (which is optional). The radix value allows you to convert a binary (base 2), hexadecimal (base 16) or other base string to a decimal integer.

Example: parseInt("FF", 16); returns 255

The problem is that if you leave the radix argument off the function doesn't necessarily assume you want a decimal (base 10) conversion. Instead it checks the input string (the first argument) and if it starts with "0x" it assumes it's a hexadecimal value. If it starts with "0" - not followed by an "x" - it takes it as an octal value. This follows the JavaScript convention for numeric constants.

If you code

var x = 0x18;
alert(x);

it will display 24 which is the decimal equivalent of the hex number "18". Likewise,

var x = 014;
alert(x);

displays 12 which is the decimal value of the octal number "14".

Resource: FAQTs

Hexadecimal uses the numbers 0 to 9 and the letters A to F, 16 in all. You would normally see hexadecimal values used for colors (Orange: #FF9C00, White: #FFFFFF, or Red: #FF0000). Octal is base 8, so only the numbers 0-7 are valid. Hence, "09" is not a valid octal number and the function returns 0. Just as it would for "abc" in decimal ... it's not a valid number.

To avoid this, get into the habit of always adding the second argument, in this case ...

parseInt("09", 10);

returns 9 (decimal), as desired.

Resources
* FAQTs