Missing Features in OSX 10.7 “Lion”

So, Apple have added 250 new functions to their new operating system, Lion. That’s great – well done. But what I FAIL to understand is why on earth they have got rid of some really handy functions. Apple have made a big fuss about the new functionality, but they have failed to mention what important features have been removed.  Below is a list of things that used to be in OSX 10.6.x – AKA “Snow Leopard” (I am listing as I find – so this list is far from exhaustive. Leave a comment if you’ve noticed anything).

  1. The “DigitalColor Meter” has lost all of it’s useful functionality (useful to me, anyway). You can no longer get a hex value for the colour that you have picked. A workaround (which shouldn’t be necessary) is to make an AppleScript file containing the line “choose color”.
  2. You can no longer zoom in within a finder window (with two fingers or otherwise). WHY would this be removed? I just dont understand it. I used to use it daily. I am not aware of any kind of workaround for this.
It’s not a huge list at the moment… but I have a feeling that it will grow.

DeIMGUR

I wrote a tool a couple of months ago, allowing you to view imgur images when your network firewall/filtering system doesn’t allow it. It’s not terribly advanced – but it does the job.

If you’re interested in using it – you can access it here: http://redfern.me/deimgur/.

Any comments would be welcomed – I’ve received an email about the possibility of a Greasemonkey script, which I will look into! It’s kinda rough around the edges at the moment… but it should do the job.

Customer Portal Development

So far, it’s been a pretty busy summer. I have spent some time transferring the Modern Glass website over from Drupal to WordPress – mostly for ease-of-use in terms of updating. Along with it have come some speed increases, and SEO optimisations.

This was not a major undertaking – however, the Customer Portal which came with it was getting close to being!

  

The system was created to allow customers to easily access  and comment on quotes. At Modern Glass, once a quote has been entered into the main computer system, it is saved as a PDF. The Customer Portal which I have created allows the PDF and design files to be uploaded to the site, where the files are turned into thumbnails. Once the quote and all of it’s attatchments are uploaded, the user will recieve an email to tell them that a quote has been added to their account. When they click on the link to view the quote, the time and date at which the quote was viewed is recorded and sent by email to Modern Glass. The customer has the option of adding a comment to the quote – this comment can be replied to by a member of staff.

There are other interesting projects going on this summer – including an automated booking system allowing customers to charter a yacht! I update this blog with my progress.

OS X Lion Battery Life Reduction

There seems to be some kind of conflict between the Wacom Tablet Driver and OSX Lion (10.7) – The Wacom Tablet Driver (listed as pentabletdriver in activity monitor) seems to be using up CPU cycles (or something). I was being estimated 3:40 hours on a full charge with no apps running – after “killing”, or ending the process for pentabletdriver, I am now being estimated 6:40 hours with a few applications open… back in business!

 

So, if you’re suffering from reduced battery life after having upgraded to Lion – try killing the pentabletdriver process!

Getting and Caching Artist MP3 URL’s with TheEchoNest API

I have written this PHP function which will do the following:

  • For the INITIAL request (i.e. the first search for that band, ever), the XML file for that artist will be downloaded from the EchoNest API server, parsed, and saved to MySQL DB table. The song URL will be retrieved from the database, ordered by random, and the first URL will be echoed to the user.
  • For subsequent requests (when there are database entries for the artist), the data will be selected directly from the database, and echoed to the user. This vastly reduces load times, as it removes the need for the local server to connect to the EchoNest’s API server (which can add seconds to the load time).

This is the PHP Code:

$db_server = "127.0.0.1"; //MySQL Server
$db_user = ""; //MySQL Username
$db_password = ""; //MySQL Password
$db_name = ""; //MySQL Database
$api_key = ""; //TheEchoNest API Key
$apinresults = 5; //Number of API Results to store in database. For initial queries, a larger value will increase load time (considerably). Default = 5

$conn = mysql_connect($db_server, $db_user, $db_password) OR DIE(mysql_error()); //connect to DB, or print error
mysql_select_db($db_name, $conn) OR DIE(mysql_error()); //select database, or print error

function getAudio($artistname){
GLOBAL $api_key;
GLOBAL $apinresults;
$artist = mysql_real_escape_string($artistname); //help to prevent sql injection
$artist = str_replace(" ", "+", $artist);
if($artist != ""){
$query = "SELECT url FROM audio WHERE artist = '".$artist."'"; //sql query to check number of rows for that artist
$query = mysql_query($query); //query to check number of rows
if(mysql_num_rows($query) == 0){ //if number of rows is 0, download fresh data from API
$url = "http://developer.echonest.com/api/v4/artist/audio?api_key=".$api_key."&name=".$artist."&format=xml&results=".$apinresults; //create API request URL
$xml = file_get_contents($url); //download XML document
$audios = new SimpleXMLElement($xml); //Parse XML Document

foreach($audios->audio->audio as $audio){ //go through XML Document, insert values into DB.
$query = "INSERT INTO `audio` (`aid` ,`title` ,`url` ,`artist` ,`date` ,`length` ,`link` ,`release` ,`id`)VALUES (NULL, '".mysql_real_escape_string($audio->title)."','".mysql_real_escape_string($audio->url)."','".$artist."','".mysql_real_escape_string($audio->date)."','".mysql_real_escape_string($audio->length)."','".mysql_real_escape_string($audio->link)."','".mysql_real_escape_string($audio->release)."','".mysql_real_escape_string($audio->id)."')";
mysql_query($query); //insert data into db
}
}
//AFTER having fetched data from API (if no entries in db table), select the URL from the table, order by random, and select a single value.
$query = mysql_query("SELECT `url` FROM `audio` WHERE `artist`='".$artist."' ORDER BY RAND() LIMIT 1");
$row = mysql_fetch_row($query);
echo $row[0]; //output URL to browser
}
}

I have tried to add as many comments as possible – but if there is anything you’d like to ask me about, then just add a comment.

This is the accompanying SQL file:

CREATE TABLE IF NOT EXISTS `audio` (
`aid` int(11) NOT NULL AUTO_INCREMENT,
`title` text NOT NULL,
`url` text NOT NULL,
`artist` text NOT NULL,
`date` text NOT NULL,
`length` text NOT NULL,
`link` text NOT NULL,
`release` text NOT NULL,
`id` text NOT NULL,
PRIMARY KEY (`aid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=18 ;

will also be needed. You might notice that I have included all of the data within the XML file – this is purely for future use, and so that the uploader of the song can be credited.

The script can be called as so:

getAudio("Wolfmother");

 

You can download a zip of the files here