small logo

melfneerg.com

 - 'cos life is like that


[Blog]  [Pictures]  [Links]  [About
About the Author
Tudor Davies

author Tudor is a techie turned manager who fights like mad to keep his tech skills honed and relevant. Everything from web hosting, networking, *nix and the like. Constantly developing and co-ordinating with others to make the web a better (and easier to use) place.

mySQL slow queries

Tuesday, 14th Feb 2012  Posted @ 23:05

So I was wondering how well my music database was performing, so I added a few entries to my /etc/my.cnf:

log_slow_queries=/var/log/mysqld.slow.log
long-query-time=1
log-long-format
log-queries-not-using-indexes
I then checked the mysqld.slow.log file to see what was going on, as it was now logging queries that take over a second and queries that are not using an index.
This identified several queries that need attention, so a quick EXPLAIN of the queries showed me what was going on.
Most of my tables had a PRIMARY KEY (based on the auto-incrementing ID field) but no indexes of the data itself. After a couple of
ALTER TABLE blah ADD INDEX blahcolumn (column)
commands I tested again. None of the queries were being logged and they were executing a damn sight faster. Cutting down the return of a 500 row table by 40% was a decent enough improvement :)

Now I need to do the same to the mySQL server in work and see if I can improve the responsiveness of our intranet applications...

[ no comments : Add ]

Tweet


Woah!

Monday, 16th Jan 2012  Posted @ 09:09

Not been updating here for a while and loads has happened.

First up - my son Hunter was born on 27th October 2011 by C-section. He and mum are doing well and he sleeps all night!

In other news - I have been doing loads of "more advanced for me" development work - PHP, Javascript, AJAXy stuff and on the whole its been working (although an uphill struggle at times).

Still havent finished my baby monitor (Arduino) project due to pressure of work, kids, etc :)

However, I will be posting some code snippets up here for reference later on.

[ no comments : Add ]

Tweet


Touchpad streaming

Tuesday, 27th Sep 2011  Posted @ 18:14

Tested out the capabilities of the webOS music player on my favourite online radio station Soma FM. 128k mp3 and below work fine (as expected) as does 32k aacplus - which is a bit of a result!
This kit just gets better and better :-)

[ no comments : Add ]

Tweet


HP Touchpad

Sunday, 11th Sep 2011  Posted @ 18:59

I was lucky enough to snag an HP Touchpad for £89 recently and it was delivered on Monday.

It didnt take me long to start playing around with it :)

First up was installing Preware - I followed the instructions from webOSbuzz.
Next up was installing patches from within Preware. I have the following installed:

Next up was a new kernel:Then, some application patches and applications:
Using UberKernel and Govnah means I am able to overclock the Touchpad to 1.5Ghz - making it more snappy that it already was. Several of the patches disable some of the effects and logging that slow webOS down a touch. The UberCalendar HD patch makes the calendar app even more usable and I cannot recommend it highly enough.
UberKernel also added CIFS support, so with a little editing of /etc/fstab, (through the use of Xecutah and XTerm) I am now able to mount shares from my file server and Kalemsoft Media Player can see them and play the AVI files directly :)
On the whole, it was a fantastic piece of kit for £89 and with a bit of fiddling (maybe 2 hours max) I now have a blisteringly fast tablet with a slew of extras that suit my way of working.

[ 2 comments : Add | Read ]

Tweet


TV

Monday, 5th Sep 2011  Posted @ 08:13

TV Series that I am looking forward to over the next couple of months:

September - New Seasons
Two and a Half Men - Sept 19th
Hawaii Five-O - Sept 19th
Modern Family - Sept 21st
CSI - Sept 21st
The Mentalist - Sept 22nd
Nikita - Sept 23rd
Fringe - Sept 23rd
Lost Girl - Sept 4th

September - New Series
Terra Nova - Sept 26th
Revenge - Sept 21st
Person Of Interest - Sept 22nd
Hart of Dixie - Sept 26th

October - New Season
The Walking Dead - Oct 16th

October - New Series
Grimm - Oct 21st
Homeland - Oct 2nd
American Horror Story - Oct 5th

November - New Season
Bones - Nov 3rd

[ no comments : Add ]

Tweet


Spybot

Friday, 2nd Sep 2011  Posted @ 07:06

For some inexplicable reason, I decided today was the day to update and run Spybot - Search & Destroy on my netbook this morning and I am glad I did.

It found 3 problems - Virtumonde, Win32.Inject.bw and Right Media. Fortunately, it (and a rerun after a reboot) sorted them out.

[ no comments : Add ]

Tweet


iPod Mini

Friday, 2nd Sep 2011  Posted @ 06:59

I have moved away from having CD decks for my DJing (there is a CD drive in the laptop if someone has something that needs to be played), so humping around the decks and the controller is no longer necessary. What I do need however is a backup music source to switch over to should the laptop play up at any point.

I have an aging 6Gb iPod Mini (2nd Generation) which has exhibited battery issues (a normal thing with these models). I used to use it on a daily basis but this has dropped off in the past 3 years or so. So it needed a new battery.

After watching various videos on Youtube, I decided that this was an easy enough thing to do and ordered a high capacity battery from China for £2.10 which included all the tools required.

Yesterday morning, it took me all of about 3 minutes start to finish (the 2 longest parts were getting the top plastic panel off and sliding it back in with the longer battery leads getting jammed). Turned it on and everything works beautifully.

I now plan on getting another unit (secondhand obv.) replacing the battery and also swapping out the 4/6Gb Microdrive for a 16Gb Compact Flash drive. That will give me 2 units that technically I could actually DJ with at a push...

Anyway, when I had it plugged in and charging, I thought I would make a couple of more changes to it.

I already run Rockbox on it but its a hassle getting the system to boot between the 2 firmwares. I need to swap between the 2 because I have a Griffin iTrip that gives me crap sound under Rockbox but works perfectly under the Apple firmware. The answer to this issue? Install the ipodlinux bootloader menu. I followed the instuctions from here and a few seconds later I had a boot menu :)
I have an ipodloader.conf file in the root of FAT drive that looks like this:

# iPodLoader 2.6 config file
backlight = 1
timeout = 0
default = 1
# here come the menu choices:
iPod OS @ ramimg
Rockbox @ [win]/.rockbox/rockbox.ipod
Disk Mode @ diskmode
Reboot @ reboot
Power Off @ standby
The other piece of software I use is Sharepod which is a great little piece of software for managing the music files on the iPod (and iPhone now). I have it stored in a directory on the iPod itself, so that I can plug in anywhere and manage/play my music :)

[ no comments : Add ]

Tweet


ICAL generation

Monday, 22nd Aug 2011  Posted @ 11:17

I had a need to generate an ICAL (.ics) file to use on my iPhone so decided to create a PHP script to do it. The reason - planning my film watching at FrightFest 2011
I had the base information in a CSV file, that looked like this:

20110825,1730,MAIN,Dont Be Afraid Of The Dark,100
20110825,2015,MAIN,Final Destination 5 - 3D,95
20110825,2230,MAIN,The Theatre Bizarre,108
The information is date, start time (-1 hr for BST), screen being shown on, film title and length

Here is the code to take the csv files and output it as a CSV file. It is used by running php ical.php > ical.ics

// set the timezone so that date functions work without errors
date_default_timezone_set("Europe/London");

//specify the name of the CSV file and open it for read only access
$urlfile = "./ical.csv";
$handle = fopen($urlfile, "r");

//do the ICAL headers
echo "BEGIN:VCALENDAR";
echo "VERSION:2.0";
echo "CALSCALE:GREGORIAN";
echo "BEGIN:VTIMEZONE";
echo "TZID:Europe/London";
echo "X-LIC-LOCATION:Europe/London";
echo "BEGIN:DAYLIGHT";
echo "TZOFFSETFROM:+0000";
echo "TZOFFSETTO:+0100";
echo "TZNAME:BST";
echo "DTSTART:19700329T010000";
echo "RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU";
echo "END:DAYLIGHT";
echo "BEGIN:STANDARD";
echo "TZOFFSETFROM:+0100";
echo "TZOFFSETTO:+0000";
echo "TZNAME:GMT";
echo "DTSTART:19701025T020000";
echo "RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU";
echo "END:STANDARD";
echo "END:VTIMEZONE";

// read file line by line
// and process each one in a loop
while (! feof($handle))
{
$line = fgetcsv($handle, 128);
$dt = $line[0];
$start = $line[1];
$screen = $line[2];
$film = $line[3];
$length = $line[4];

// check if entry is empty
// if so, dont execute the script

if ($dt <> "") {

// start writing the event info out
echo "BEGIN:VEVENT";
echo "DTSTART:".$dt."T".$start."00Z";

// calculate the end time based on the start and length
$end = strtotime($start);
$end = $end + ($length * 60);
$finish = date("His", $end);
echo "DTEND:".$dt."T".$finish."Z";

echo "SUMMARY:".$screen." - ".$film."";
//echo $dt, $start, $film, $length;
echo "END:VEVENT";
}

}

// write the ICAL footer
echo "END:VCALENDAR";

// close the csv file
fclose($handle);
?>

All I did then was subscribe to the .ics on my iPhone and hey presto - all the information is there for me to browse through :)

[ no comments : Add ]

Tweet


Continuing...

Monday, 8th Aug 2011  Posted @ 07:22

In the continuing saga of the the Arduino and midi controllers, I got hold of 2 USB joypads (costing me about £10 delivered) that each provide:

2x joysticks
12x buttons
4 way HAT switch

Once fully dismantled, these will convert into:
8x analog (6x rotary pots, 2x slider pots)
32x buttons

Once of them has been dismantled and been solder sucked and once I have removed the joystick securing tabs, I will be soldering trailing wires ready to be connected elsewhere.

I have pictures to add of them in their various states of dismantlement(!) and will document the whole process and the GlovePIE code to make them run MixMeister.

I also purchased some cut 3mm perspex sheets which are 19" wide and 4U high (486mm x 177mm) for around £6 each, which will need a box to lay onto and some perspex posts to support them...

[ no comments : Add ]

Tweet


Ready For The Weekend

Monday, 18th Jul 2011  Posted @ 08:28

Over the last weekend I completed four pieces of work:

1 - Relocated my hodgepodge 74HC595 and LED setup onto a pair of small breadboards (the original breadboard I used didnt carry +5V and GND down the whole breadboard so had loads of jumper wires) including putting the 595 into a socket.

2 - Dismantled a USB MIDI adapter, rewired it to provide power to the Arduino and wrote a small sketch to detect a button press, light an LED and send a MIDI note to a software synthesizer.

3 - Sorted out button debounce code

4 - Used GlovePIE to map a Saitek P380 dual-analog joypad to control MixMeister using MIDI

Next up - building my joypad based MIDI controller!

[ no comments : Add ]

Tweet




layout and initial css based on the Qtractor page