Have you entered the exclusive Late Late Gifts competition?
Click this advert for more information

Only a few days left to enter my free competition! Mix your favourite music directly from your phone or iPod! http://bit.ly/cjzenw #fb 2 days ago



Nov 08
21st

It’s a barcode Jim


Ahh, the new Star Trek movie. I’m really looking forward to what JJ Abrams makes of it. And the new trailer looks pretty damn good too…

Anyway, after thumbing through some still images from the film, I came across this one showing, I assume, the bridge of the Enterprise (that’s Chekov at the helm)…

But, hold on, look at the middle of the navigation console. Isn’t that a role of duct-tape surrounded by a couple of Symbol Cyclone scanners? Sad and geeky I know, but I work in Point of Sale, so I recognise these things.

So, here’s my take on converting your work desk to look like the bridge of the Enterprise (I didn’t have a thick role of duct-tape so I used an almost empty role of parcel tape)…

Pretty realistic I think you’ll find.


Share this on del.icio.us Digg this! Email this Share this on Facebook Share this on LinkedIn Send this page to Print Friendly Share this on Reddit Share it on StumbleUpon Tweet This!


Nov 08
21st

Belkin don’t wish to speak to you


So, I’m looking at buying a Belkin product but have a pre-sales question.

It’s not urgent so I send them an email using the form on their website. I don’t get a reply.

So I use their “live chat” service on the website… the person pretends not to receive my questions and then stops talking to me.

Finally, I use the old fashioned method of ringing… I got through all the menu options and – I’m met with silence. No further menu options, no ringing, no nothing. I try again and get the same thing.

I assume Belkin just isn’t interested in me as a customer.


Share this on del.icio.us Digg this! Email this Share this on Facebook Share this on LinkedIn Send this page to Print Friendly Share this on Reddit Share it on StumbleUpon Tweet This!


Nov 08
21st

Reading RSS with PHP


After using the JavaScript only and generally pretty poor facility within Feedburner to embed RSS feeds onto a website, I set about an alternative solutions.

Thankfully, there are a number available. However, many offer little embedding options and I wanted something that gave me full control. This narrowed it down to 2 free downloadable scripts. However, as much as I tried I couldn’t get them to work properly.

Everything went well until it came to a link in my item description – then the less than/greater than signs would mysteriously disappear. Bizarrely, if I used the option to run it from the authors script from their site, it worked. So I can only assume it’s a configuration on my server. However, I’ve not been able to work out what it is.

Now, PHP has built in XML parsing options and this is what these scripts were using – and I’m guessing the configuration option in question was to do with that. So I gave up and decided to write my own alternative. It doesn’t use XML parsing but simply reads the whole file in and extracts the details I need – in this case title, description and date. The code is below – pass the RSS feed into it by assigning it to the variable $rss_feed.

$array=file_get_contents($rss_feed);
$i=0;
while ($i!=1) {
$item_start=strpos($array,"<item>");
if ($item_start===false) {
$i=1;
} else {
$item_end=strpos($array,"</item>");
$item_length=$item_end+7-$item_start;
$item_strip=substr($array,$item_start,$item_length);
$title_start=strpos($item_strip,"<title>");
$title_end=strpos($item_strip,"</title>");
$title_length=$title_end+8-$title_start;
$title=substr($item_strip, $title_start+7, $title_length-15);
$pubdate_start=strpos($item_strip,"<pubDate>");
$pubdate_end=strpos($item_strip,"</pubDate>");
$pubdate_length=$pubdate_end+10-$pubdate_start;
$pubdate=date("jS F Y",strtotime(substr($item_strip,
$pubdate_start+9, $pubdate_length-19)));
$description_start=strpos($item_strip,"<description>");
$description_end=strpos($item_strip,"</description>");
$description_length=$description_end+14-$description_start;
$description=substr($item_strip, $description_start+13,
$description_length-27);
$array=substr($array,$item_end+7);
}
}

I’ve left some of the code expanded – for example there is no need for each field to be calculating and storing the end position as this could simply be placed within the length calculation. However, so you can see what I’m doing I’ve left it as it is.

So, during each iteration you will have 3 fields available for you to use, and probably display. They are $title, $pubdate and $description. $pubdate is converted into a more readable format using the date command, but the parameters can be easily changed to format it in another way.



Share this on del.icio.us Digg this! Email this Share this on Facebook Share this on LinkedIn Send this page to Print Friendly Share this on Reddit Share it on StumbleUpon Tweet This!
49 queries in 0.930 seconds.