NBN – iiNet – Speedtest

I quite clearly don’t have 25Mbps but have to go through the motions to prove that I can only get 11Mbps at most on my NBN connection.

There was no way I was going to do this by hand 3 times a day, for 3 days on two computers as requested (instructions here: https://iihelp.iinet.net.au/support/node/14495) so I wrote a little batch script to do most of the work for me. I am by no means a batch script expert so this is a bit quick and dirty. Feel free to create a PR against this script or fork it if you can do it better.

Hope this is useful for someone else, it’s saved me a bucket load of time: https://github.com/Kwozzie/nbn-speed-test-semi-automated-logger

Intellij Kubuntu Alt+Backquote VCS Operations Popup

An annoyance with Kubuntu and Intellij where they share the same key mappings disallowing you from opening the VCS Operations Popup. You could change Intellij’s key maps but if you’re working on different platforms at home and work, teaching yourself different key mappings for the same shortcut isn’t ideal.

On Kubuntu (14.04), to change the Alt+Backquote keymap go to System Settings > Window Management > Task Switcher and find the ‘Current application’ area. You choose, either create new mappings or do what I did and set to none. Wallah! Intellij Alt+Backquote now works.

Eco Surf Art

I’ve been a big fan of Scott Denholm’s art work for some time, so it gives me great pleasure to help promote his art work and new website Eco Surf Art, which showcases a number of Scotty’s eco friendly surf art, including originals, surfboards, giclee canvas and paper prints.

What is Eco Surf Art? In Scotty’s own words, “Eco art has many different forms from artist to artist. Basically it’s when the artist chooses to use eco friendly art materials over traditional art materials which can have a heavy impact on the environment and even the artist’s health.”

What’s more impressive is that Scotty doesn’t just look at the materials he’s using, his whole painting process has the environment in mind. He is most likely the only eco surf artist in the world that has a process like this.

I hope you enjoy browsing through his work and reading his story as much as I did.

Scott Denholm – Eco Surf Artist

Squid Proxy Editor for White/Black Lists (PHP/MySQL)

squid_proxy_list_editorA small project to help with familiarisation of Github and to assist the System Administrator with maintaining white/black lists for Squid3. Still in development/testing but should be helpful for someone else nonetheless.

This project makes use of session based login, HTML5 and jQuery and introduced me to the jQuery Chosen plugin for the first time for nice displays of select drop downs.

Fork the project at Github: https://github.com/Kwozzie/squid-proxy-list-editor

 

Mysqli Prepared Statements – Debugging/Echoing SQL Queries

Delving into prepared statements for Mysqli, I discovered the first shortcoming of using the ‘improved’ method… debugging your SQL statements. Whilst you can call up the error message that might occur, it’s not possible to echo the sql query with PHP to see what the query is with the bound parameters.

Solution: Turn on mysql query logging (not slow logs).

Here’s how: Locate your my.cnf file (I used the command ‘locate my.cnf’) and open it with your favourite editor. Scroll down to the area in your my.cnf file under the heading [mysqld], section *Logging and replication* (see snippet below).  Uncomment the line that says general_log_file. For added clarity, I changed the location of my log file to /var/log/mysql/query-debug.log rather than the combined /var/log/mysql/mysql.log that was set as my default. You’ll need to create  (touch) the query-debug.log file and change it’s ownership and permissions to match the mysql.log (you’ll need root access to do this).

1
2
3
4
5
6
7
8
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
general_log_file        = /var/log/mysql/query-debug.log
general_log             = 0

Restart mysql to apply this change in your my.cnf.
As I don’t want the logging to be on all the time, I left the general_log as 0 (zero). We can turn this off and on via your PHP script.

Now in your PHP script where you want to debug the SQL query, add the line

1
$mysqli->query("SET GLOBAL general_log = 'ON'");

where $mysqli is your mysql connection object.

Now you can less or tail that log file to see your queries.

I’m using Ubuntu 12.04, PHP v5.3.10 and MySQL v5.5.24 so I’m not sure if this applies directly to other MySQL versions or Linux distributions but it should give you a good idea.