Futube Youtube player review

Futube(Fubra Video) is a tool provided by Fubra and it’s a perfect example of a company providing some code that isn’t fit for purpose and it strikes me the company has no means to maintain it. This is also a perfect example of why open source is so important.

“Futube is a free to use flv video player that simplifies the default user interface of YouTube videos.”

Some things Futube doesn’t do that it really needs to:
No animation or message displaying “loading” so users are under impression site isn’t working.
Full screen mode doesn’t remove the controls from the page.
No ability to change font face
No ability to easily access play time / position of a video
No ability to store video state. This is an issue if you need to momentarily hide the video for any reason, if you do hide it and bring it back the video will go into “stopped” state and when you show the video it will be back at the start.

Some things Futube does do really well:
Easy embed & color customization
Harder to click on youtube link
Simple UI

Hopefully the developer of Futube will fix the 3 issues I have before too long!

Dealing with parking fines & motoring offenses

PePiPoo is a fantastic on-line resource for this, their forum is great. Everything is free so if you ever feel like your council or district is bullying you into paying for something you feel like you shouldn’t pay then stand up for yourself and use the help from the guys/girls on PePiPoo.

Seriously, stand up for yourself.. Too many motorists just pay to avoid the headache and too many authorities are flexing their muscle thinking they are invincible.

Adding location awareness to Ushahidi

This post is for site admins who want to add location awareness to their ushahidi deployment. Location awareness allows ushahidi to know where the visitor is coming from and display them a map local to them. It requires the user to have an ip v4 address. It is not the best solution for this problem but for now it works…

First things first, visit your application/controllers/main.php and comment out these lines

$this->themes->js->latitude = Kohana::config('settings.default_lat');
$this->themes->js->longitude = Kohana::config('settings.default_lon');

Paste this below the lines you have commented out:

include_once 'DetectLocation.php'; // this isn't the best way but it works..
$this->themes->js->latitude = $lat;
$this->themes->js->longitude = $lng;

Next visit ipinfodb.com and grab their mysql database, extract it then import it into your mysql deployment, I used the database name ipinfo.

Create a new php file called DetectLocation.php in the root of your Ushahidi deployment.

Paste this into it

<?php
// Using data from http://ipinfodb.com/ -- this should be in the ipinfo database
// Code by John McLear, all free licenses attached.  Please re-use, modify & redistribute 

$dbuser = 'ipinfo';
// using a psuedo/differnet user because I'm cool like that.
$dbpass = '';
$dbhost = 'localhost';
$dbname = 'ipinfo';

$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die                      ('Error connecting to mysql');

mysql_select_db($dbname) or die('Could not select database');

$ipAddress = mysql_real_escape_string($_SERVER['REMOTE_ADDR']);
// Get IP Addr of visitor

$query = "SELECT * FROM `ip_group_city` " .
         "WHERE `ip_start` <= INET_ATON( '$ipAddress' ) " .
         "ORDER BY ip_start DESC " .
         "LIMIT 1";

$resultLocation = mysql_query($query);

while ($row = mysql_fetch_array($resultLocation))
{
        $lat = $row['latitude'];
        $lng = $row['longitude'];
}
?>

Test it by visiting your Ushahidi deployment, your map should be centred on your location.

So quick recap. We are using a local mysql database to lookup locations by IP. This is fast, fast is good. It isn’t perfect. Perfect would be better. Feel free to improve upon, change/correct..

Note: You probably also want to do the same changes on reports.php and alerts.php

Only display this months data in Ushahidi

This is a simple hack to make Ushahidi display only the current months worth of data. This is useful if you have a large dataset with no real need to display historical data to your users.

Modify application/controllers/main.php lines 327 onwards.

                /* Commented out by John McLear */
                // $first_month = 1;
                // $last_month = 12;

                /* Added by John McLear as to only show the current month of data */
                $first_month = date('m');
                $last_month = date('m');
                /* End of new code */

                $i = 0;

                foreach ($query as $data)
                {
                        $date = explode('-',$data->dates);

                        $year = $date[0];
                        $month = $date[1];

                        /* Added by John McLear */
                        // Only includes from the month we are in now, yes this sucks but it works
                        if ($month == $first_month){

                                // Set first year
                                if($i == 0)
                                {
                                        $first_year = $year;
                                        $first_month = $month;
                                }

                                // Set last dates
                                $last_year = $year;
                                $last_month = $month;
                        }

                        $i++;
                }