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!

Good habits for password security

We all have it drummed into us to use different passwords for everything, but how many of us actually do? and how many of those use more than 2 or 3 passwords over and over again?

If you ask yourself why not, it’s probably because you can’t / don’t want to remember lots of different passwords & that you don’t want to put your trust in 3rd party password manager.

What you need is a system that lets you use the same password for everything but also changes it for everything. Simple, huh?

Sure it is. Without wanting to give too much away here is my system…
A password should be constructed of 3 parts.. One is the passphrase itself which never changes, one is obtained from the site you are logging in to and the third is to do with time. Without going in to too much detail of how I do it, you might…

  1. pick your passphrase. Something you will remember and something that ticks all the standard boxes of password selection. Not likely to be found in a word list (forwards or backwards), not your childs name or maiden name, 6-8 characters, contains uppercase letters, lower case letters, numbers etc. (EG Passw0rd – bad example but you get the idea)
  2. Add the first/last 4 letters of the site you are logging in to. Pick the end, or the start or somewhere in the middle. Maybe just pick 2 letters. Maybe reverse them. Anything as long as it’s the same each time. (EG ‘Passw0rdTwit’ for twitter, Passw0rdFace for facebook)
  3. Add the last two digits for your age. Or, for the financial quarter, or for the month, or the day of the week. Something you will be able to track. Personally, I like to use financial quarters because they are easy to track, repeat themselves over and over, help me to know if my passwords require a 3 monthly reset, and usually if I forget, there’s only a couple of possibilities if I can recall roughly when I set up the account. (EG Passw0rdTwit1, Passw0rdTwit2 etc…)

It seems convoluted and paranoid, but it’s pretty easy to remember once you get used to it. None of your passwords will ever be the same, and all you have to remember is the same phrase and whatever your personal system is.

Obviously there’s a 4th point – Don’t use the same system for your Banking or your master Email account. Either use a different system for really sensetive accounts, or don’t use a system for them at all. Just remember those ones!

I’ve been doing this for a while now and find it works quite well, but now I’ve shared with the world am going to have to change my system to something else!

Go Me…

Styling HTML elements in CSS without using classes / IDs

Something I came across for the first time recently is the practice of using HTML element attributes to apply CSS styles.

The mathematics can be found at http://www.w3.org/TR/CSS2/selector.html#attribute-selectors, but a basic example of where I use this technique is as follows…

starting with a basic form…

Demo Form



To lay the form out cleanly we might apply a few simple CSS styles to the input elements, as follows…

[css]
input {
display:block;
width:200px;
border:1px solid #CCC;
background-color:#FFF;
font: normal 12px/12px arial,sans-serif;
padding:0.5em;
}
[/css]

giving us the following…

Demo Form



All well and good, but the submit button is a little kooky because, being an input element, it picks up all the styling rules that we just applied. It’s easy to fix this by applying a few extra CSS styles to the submit button specifically – changing the background color, maybe a rollover effect, stuff like that – and I’ve generally done this by creating a new class specifically for the styling of form buttons .

While this works perfectly well, adding class=”button” to our HTML is completely unnecesary, because we can isolate all submit buttons via CSS attributes. The syntax follows the pattern…

[css]
element[attribute=value]{
css rules
}
[/css]

…and could work in the following manner:

[css]
input[type=submit] {
background-color:#039;
border-color: #000;
cursor:pointer;
color:#FFF;
width:auto;
margin:0.5em;
}
[/css]

giving us the following:

Demo Form



This can be used to isolate any HTML element you like – all forms with the method=”post” or all anchor tags with target=”_self” – anything really.

In fact now I type this out it occurs to me that the CSS selectors ‘.’ and ‘#’ (class and ID respectively) are just shorthand for the CSS attribute selectors element[class~=value] and element[id~=value] – more on the ‘~’ operator in another post.

The attribute selectors are a lot more powerful than demonstrated here, and I’ll write a bit about them soon but for the meantime you can read up for yourself at http://www.w3.org/TR/CSS2/selector.html#attribute-selectors.

Safe.
Neil