Hello world!

Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis.

Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis.

Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis.

Office Skiffle & The Effervescing Elephant

Yet another video blog that has absolutely nothing to do with web programming.

I hope you enjoy it and actively encourage you to get involved in the office skiffle movement. I’m not sure if there’s anybody in the office skiffle movement other than me at the moment, but we’re definitely changing the musical landscape.

Instruments featuring in this video are:

  • Recycling Bin Bass
  • Keyboard Washboard
  • Stapler
  • 30cm Ruler
  • Rotary Pencil Sharpener
  • The ubiquitous Flying-V Ukulele

Safe.

Using variables in CSS

I’m working on a little PHP script to allow for variables and inheritance in CSS. I know there’s a ruby script that does this somewhere, but I fancy seeing if we can’t get a pure PHP version up & running between us. If you’re somebody that writes their own CSS and are willing to have a play with it to see what problems occur then I’d really appreciate it. If you want to tighten up my regular expressions a bit as well then it probably won’t go amiss, as I’ve only spent 5 minutes on them so far 😉

It’s fairly straightforward, and at the moment just runs some simple find & replace on a stylesheet, nothing too fancy, and it seems to hold it’s own on my dev server, but I’d be interested to see if it works in the hands of others. I don’t have much spare time but will be adding attribute inheritance next – which could be very cool.

you can grab the PHP here, and implement it by saving it as PCSS.php (or whatever you choose) and then linking to your stylesheet as follows:

[html]
css" media="screen" rel="stylesheet" />
[/html]

In case that isn’t clear – instead of linking to your stylesheet within the tag, you link to my PHP file and then tag a ‘?’ and the filename of your stylesheet onto the end.

once running you can declare variables in your stylesheet ‘thusly’, ensuring each begins with a $ and ends with a  line-break:

[css]
/*
$pie_blue = #443300
$pie_border = 1px solid #CCC
$pie_padding = 1em
*/

.class {
color: $pie_blue;
border: $pie_border;
}
[/css]

and so on…

Again, if anybody does pick this up and play with it, I really appreciate the time and help.

Germany government warns against Internet Explorer

You may have seen these stories in the news recently, relating to some attacks on Google, the German Government and Internewt Explorer.

The original news item
The subsequent reaction

I’ve tried as hard as I can to come up with something useful to say on the subject, but the only thing I keep coming up with is ‘use Firefox’.

So here we have it. Use Firefox.

Finding the RSS Feeds of your Facebook Status Updates

Edit:As of recent changes (7/2/2010) to FB, this is no longer working for me. You might have better luck. Why don’t facebook just make this stuff available?

Edit: This method has worked for my account and several others, but fails for some people. If you are greeted with the message “This feed URL is no longer valid. Visit this page to find the new URL, if you have access, http://www.facebook.com/minifeed.php?status&id=XXXXXX” or something similar then you are one of those unfortunate people. Currently looking into a solution for this problem… anyone found it?

I’m working on a ‘lifestream’ plugin for the next version of my website, and hit a little bit of a wall when trying to lay my grubby little paws on an RSS feed of my personal status updates on Facebook.

Although they don’t seem to publicise it on the site, there appear to be RSS feeds available by direct access of almost everything we post. It’s pretty obvious really. The only issue is finding the URL of the feeds.

For a personal page

The simplest way to do this that worked for me (although browsing around there appear to be some people experiencing difficulty) was as follows:

  1. Open up your notifications pop-up in the bottom right of your facebook window and choose ‘view all’
  2. Copy the link location of the ‘Subscribe to Notification > Via RSS’ option on the right of the page (something like – ‘http://www.facebook.com/feeds/notifications.php?id=123456789&viewer=1234567898&key=98765432a&format=rss20’
  3. Change it from http://www.facebook.com/feeds/notifications.php?id=123456789&viewer=1234567898&key=98765432a&format=rss20 to http://www.facebook.com/feeds/status.php?id=123456789&viewer=1234567898&key=98765432a&format=rss20 and paste into any RSS reader
  4. Check you privacy settings – The feed will only display status updates that are marked as being viewable by ‘Everyone’. ‘Friends Only’ status updates will not appear in the Feed. You can set this in your privacy settings, but also on each individual update as you post it.

There are other feeds accessible in a similar manner to this, but for my purposes I’ll not confuse the issue.

For a fan page

MUCH simpler:

  1. Paste the RSS url http://www.facebook.com/feeds/page.php?format=rss20&id=xxxxxxxxx (where ‘id=’  the ID of your facebook fan page – found in the address bar when you view your page) into any RSS reader
  2. If you’ve already set up your own vanity URL for your page, you can grab your page ID by logging in and clicking ‘Edit Page’. You’l find it tagged on to the url in the address bar.

And there you have it. From researching this, it appears Facebook have a habit of relocating the RSS Feeds without telling anyone – probably why they don’t publicise them too heavily – so you might find that these stop working in the future, but for now I’m all good to go in my project and hope I’ve helped you with yours.

Cheers,

Neil

Limiting the number of times a PHP loop will run using the break command

If you’re reading this page then you’re already likely familiar with the standard PHP for, while and foreach loops. If not, then may I suggest some background reading first – http://www.php.net/manual/en/language.control-structures.php.

That said, I added a new weapon to my PHP arsenal today in the form of a better understanding of the break command.

I’ve used the break command before of course – it sits inside switch statements to stop each case running into the next one as below:
[php]

switch ($i) {
case "apple":
echo "i is apple";
break;
case "bar":
echo "i is bar";
break;
case "cake":
echo "i is cake";
break;
}

[/php]
But I didn’t realise that it can be used within any loop to stop the cycle continuing there and then.

This came in handy today when needing to perform a particular loop 8 times only. Normally one would just use a for loop, as that is what they’re -um- ‘for’, but in this instance I wanted to iterate across an array 8 times only. In essence, I wanted a foreach loop to run 8 times and then stop, regardless of how many items it contained.

Usually I would have either used array_slice() to reduce the array to 8 elements only, or introduced a counter and an if statement to my foreach loop as follows:
[php]

$i = 0;
foreach($array as $value){
if($i < 8){
echo $value;
}
$i++;
}

[/php]
Whilst this would work, it’s not an ideal solution because the foreach statement needs to perform the logical test ‘if $i < 8' for every item in the array – of which there could potentially be thousands. Which is where break comes in. Changing my foreach loop to the following…
[php]

$i = 0;
foreach($array as $value){
if(++$i == 8) break; //edit suggested by CHris
echo $value;
}

[/php]
means that as soon as the loop hits the ninth iteration (when $i is equal to 8) the break command is executed and the loop stops. No unnecessary iterations, and in my opinion much tidier code – which is always a good thing in my book!