Archive

Archive for the ‘Web’ Category

MythTweet – Twitter MythTV recordings

March 9th, 2010 Ed No comments

In the move to put as much of my house onto twitter as possible, MythTV was the next victim. I’d previously made a PHP script that sent MSN alerts, but now I don’t use MSN, it needed a revamp.

MythTweet

I knocked up a small PHP script that grabs the backend status, finds what is being recorded or watched, compares with the previous run, and sends a message to twitter using wget.

To use it, grab the script, change the username/password variables, chmod +x it, and then add it to your “Startup Applications” or equivalent if you’re not using Ubuntu.

Categories: Web Tags: , , , , ,

Handwritten post-it notes generated from Google Calendar

February 25th, 2010 Ed No comments

Scouts I’ve recently created a new website for my scout group, Highfield Scouts, and have put up a google calendar. More out of a challenge than a real need, I’ve knocked up a script that uses the Google Data API for PHP to query my calendar feed, grab the next event, and make a fake handwritten postit note. The script runs every hour to keep the images up to date.

I’ve made a little markup system so that the whole postit can be a link, and the time and location can be overridden (child protection malarky – can’t just put a time and location for some things!)

It’s all written in PHP, using the GD graphics features to put the text on a background image. If you’re interested in the code, comment, and I’ll give it to you (if you link to me!)

Categories: Web Tags: , , , ,

Allowing Firefox to access local javascript files

February 2nd, 2010 Ed No comments

If you have HTML/javascript files sitting on your harddisk and you want to open them in firefox and actually use the javascript, you need to change one simple setting.

First, go to about:config (just type it in the address bar and hit enter)

Then filter for “origin”.

Change “security.fileuri.strict_origin_policy” to false.

You should now be able to use local javascript files.

Categories: Web Tags: ,

Improved Google mail number of unread emails script

January 27th, 2010 Ed No comments

Since writing “Get number of unread posts from google mail”, I realised that I didn’t care about a lot of emails that I get on a regular basis, things like ebuyer emails, stock-market alerts etc. I only want to be notified when I’ve got emails from real people.

By applying a “Newsletters” label on GMail to all automated messages by filtering messages, I can now see how many unread emails I have, then subtract the number of unread newsletters I have, and flash the ambient light that number of times.

Grab getGoogleMail.sh, change the usernames and passwords, and change “Newsletters” to whatever your google label is. Then use the $count variable to do whatever you want.

Categories: Web Tags: , , , , ,

Hampshire Twittering Traffic-Jams – SMS alerts – @hants_motorway

January 14th, 2010 Ed 4 comments

Something that drives me nuts is every so often there’ll be an accident on the M3 or M27 and the entire surrounding area will be flooded with people trying to avoid the deadlock, only to find they’re on a tiny road with thousands of other people. Yes, I could check the traffic websites each morning, or do some intelligent parsing of traffic RSS feeds, but the first option requires effort before 9am (not going to happen), and the second option is never going to be reliable enough – it’d be too hard to programmatically determine how bad the conditions on the road really are.

Twitter feed

Read more…

Categories: Web Tags: , ,

Web based photo galleries – the unusable and the reasonable

November 16th, 2009 Ed 1 comment

So, after yesterday’s Pinewood Derby with funky racing traffic lights, I looked for a simple, quick photo album tool to display the photos, and stumbled on Piwigo, which looked reasonable and the whole “Simple powerful” philosophy seemed to match what I wanted.  So, I downloaded the single php installer script, which automagically downloads the latest version and installs everything.  So far, so good.

Now to actually create an album.  Yes, pretty easy. Upload a file, not so easy, but doable.  Get that file to be shown – next to impossible.  This is the worlds most convoluted software I have ever seen!  To get a photo to be shown, you first have to syncronise, then go and create thumbnails – but wait, by default the synchronise does a dummy run, so go back and tick a tick-box.  Grr, really not usable.  So, I tried looking at the documentation (which goes against my beliefs of websites should never, ever, need any help – they should be usable) and even that is appauling!  It’s a wiki with a very poor navigation structure (if there is any structure), so impossible to find anything useful.  Turn to the forums to find others having the same problem, and being told to read the instructions…

Right, rant over, software uninstalled.

Plogger was the next on the list, the demo looked clean and simple – just what I needed (PHP/MySQL based).  Installed it in a couple of minutes, saw a test album had been created for me so uploaded a photo and job done – it was there!  Then spent the next hour cropping and adjusting the photos, uploaded them, and bob’s your uncle, I have a nice and simple photo gallery for the scouts!  The styling is very minimal, it’s designed to be part of a larger site, although there is one style that’s a little less minimal which I’ve gone for as there’s no “larger site” for this.

So steer clear of piwigo, and let me know if you have any recommendations…

Categories: Web Tags: , , ,

Get number of unread posts from google mail

November 1st, 2009 Ed No comments

Here’s a simple bash script that gets the number of unread messages, and runs a command that does something with that. In my case, a java program that puts a message on a MQTT topic, which indirectly flashes an ambient light.

#!/bin/bash
while (true)
do

rm atom
rm atom_process

wget https://gmail.google.com/gmail/feed/atom --user=XXXXX --password=XXXXX 2&>1  /dev/null

cat atom | grep fullcount > atom_process
count=`sed -n -e 's/.*>\(.*\)<.*/\1/p' atom_process`

java -jar /home/ed/rrd/MQTTRunner.jar mpc_google 3 $count
sleep 60

done

Categories: Web Tags: ,

How to tweet from your website with your own tinyurl URL shortening service

October 30th, 2009 Ed No comments

As this is my first post about Magic Hat, a little introduction. Magic Hat is a site for magicians to learn magic, with over 50 thousand users. I started it in 2004, and since then have gradually (or not so gradually) being changing it. We’re now at the 8th major redesign. It started as a good way to learn PHP/MySQL/HTML, so I didn’t touch any content management systems, and wrote the entire first 3 versions with linux’s best text editor, vim! I then treated myself to using Eclipse, which saves a lot of work – Ctrl + Space and your website’s done (I wish!). Then I chucked in a phpBB forum, modified it and my site so that they’re nicely integrated. Finally, I changed to using smarty templates, which has made changing the look of the site in the last few versions significantly easier – would highly recommend it.

So, you’ve probably gathered that I’ll happily reinvent the wheel many times over, but hopefully for a good result. Magic Hat is very dynamic and has lots of complicated features that I don’t think would have been feasible to get working in something like WordPress without having to learn and change most of WP.

I’ve setup the Magic Hat forums to tweet every time someone posts, but I didn’t really want to use tinyurl/bit.ly as I’d like to keep magichat.co.uk in the links.  So, here’s some code that creates the smallest possible hash.

Read more…

Categories: Web Tags: , ,