If you’ve appeared on this site after thinking you were loading another page at www.wekadesign.co.nz, do not fear – it was supposed to happen. I’m slowly moving the content from wekadesign.co.nz to mike.mcmurray.co.nz and will decommission the old site some time in 2012.
Published Desktop vs Virtual Desktop
I’ve recently been involved in a deeper look at the world of virtual desktops and what options suit different users groups. There are a few different ways to look at the whole desktop virtualisation and most of them depend on what software your business uses and how your users access it.
With the different types of virtualisation around these days it can be a little confusing about what fits where and how they interact. I’ll run through a quick overview of them here and the products that I’ve been testing with. (Be warned this is a bit of a ramble.) Continue reading
DRBD: Forcing a full re-sync in a split-brain situation
I have a DRBD setup similar to an old post that’s being used between two Ubuntu servers hosting MySQL. Every few months though the pair goes into a split-brain situation where the secondary can’t see the primary and refuses to reconnect. Users are unaffected as the primary is still working fine, but the HA is lost.
After trying a few different combinations of commands this is what seems to work best for me and cause the quickest recovery. I’m only dealing with a 10GB device so a full sync takes about 10min. If you’re using DRBD for a much larger device, make sure you consider the sync time before doing this.
On the secondary node:
drbdadm secondary all
drbdadm disconnect all (it's status goes to Secondary/Unknown)
drbdadm invalidate all
drbdadm connect all
On the functioning primary node:
drbdadm connect all (a full sync now starts)
Remember, it’s your data you’re dealing with so make sure you’re responsible before you run commands like this.
Easy, Beautiful Charts with Flot
I’ve been looking for a free, open source chart library for a while and was struggling to find something that was good enough (and handled time series and missing data points well). For a long time I’ve been using Fusion Charts (FC) and Open Flash Chart (OFC) in any in-house work and those products are very good. But they’re Flash, a little slow and not supported by some popular mobile devices. I’ve also used pChart for some testing but it was fairly stale in development and being images, had no interaction.
The Flot JS library was something I’d seen a while back, but before I became comfortable with JS and jQuery. It does almost exactly what I want, is farily light-weight, extensible and easy to use. In a few hours last week I swapped out the FC code I had written for Overview and put in something almost half the size with Flot that created (in my view) a better product.
So I thought I might let others know what a nice, easy option Flot is with a little example. Beware this is not a fully working, copy and paste sort of example, it’s really just a chunk of generic code I pulled out. Continue reading
DisplayPoint
DisplayPoint is a solution to meet the demands of displaying content as easily as possible on screens around your business or public space. All you need is a device that runs a modern web browser and you can centrally manage your dashboards and big screens from your desk.
Anyone can schedule and show images, movies, messages, websites or RSS feeds to a group of computers. Rather than buy some sort of application that you must install on all your computers or a server, just get a low-powered machine and a web browser.
Features
DisplayPoint is being extended regularly and I’m open to requests for features which fit the general use of the product. Some of the current features are,
- completely browser-based
- centrally managed by anyone with a web browser
- content can be displayed for any duration
- show images like a slide show
- view movies from your own network or stream from YouTube
- post messages to inform others of meetings, news, etc
- import and cache RSS feeds from news sites
- display web pages that automatically scroll down to show all content
- set content to expire at a certain date and time
- add multiple display devices to content groups e.g. marketing sees one content group and the engineering teams see another
Use it to cycle through the photos from the company BBQ with messages about the next team meeting mixed in. You can even use it in public areas to highlight videos and show messages specific to that area.
Debug PHP Function Calls
Logging errors can be very helpful as your code base becomes huge. But sometime it’s still difficult to find out what’s calling the function that’s giving the error. Wouldn’t it be nice if there was a way to see how you’d got to that function?
Well of course there’s a way in PHP – debug_backtrace. Just add something similar in a suitable place in your code and you’ll be able to find what functions were called.
$trace=debug_backtrace();
$caller = $trace[1]['function'];
// or just dump all the info
var_dump($trace);
Using SQL Management Studio in Windows 7
If you happen to be using SQL Management Studio in Windows 7 and need to connect to a SQL 2005 instance not running on the standard port of 1433, you might be having some problems connecting. For some reason this mix seems to require the SQL port to be manually defined when connecting to any named instance.
The fix is to specify the port in the server name used in the Connection prompt. So if your SQL instance was called SQL02 and running on port 3433, you’d use “MySql2005Server,3433 SQL02″.

If you don’t know the port that SQL server is running on (maybe you have an external vendor supporting SQL), you can connect to the server from a Windows XP machine and run,
netstat -a | find /i "mysqlserver"
This will show you the network connection from your machine to the SQL server and the port being used.
Beware the leading zero in Javascript parseInt()!
Exhibit A,
parseInt('01'); //equals 1
parseInt('02'); //equals 2
parseInt('03'); //equals 3
parseInt('04'); //equals 4
parseInt('05'); //equals 5
parseInt('06'); //equals 6
parseInt('07'); //equals 7
parseInt('08'); //equals 0 !!
parseInt('09'); //equals 0 !!
When Javascript encounters a leading zero it assumes an octal number. So when it sees 08 or 09 then there are problems.
The fix is to add the radix to the function call,
myInt = parseInt('08',10); //equals 8
Using PHP exec() with IIS6
There are a few work arounds I’ve found since having to use PHP under IIS6 and Windows 2003. Every now and again I come across something that just doesn’t work the same way with this variation of web server, OS and PHP.
I needed to double-check the DNS hostname being reported from users on an internal website. Our DNS is a little scratchy when it comes to scavenging and keeping itself tidy, so often a DNS lookup of the client IP will give an incorrect name. This happens especially for laptops that hop off and on wireless APs.
So to compare against DNS (and because it’s an internal site) I thought to query the machines NetBIOS name with,
exec("nbtstat.exe -A 123.123.123.123",$r);
and that quickly fails with an error about “failing to fork”. Essentially this means, PHP can’t do what you want.
It boils down to file permissions. you need to run cmd.exe and nbtstat.exe with that single command. Both those files are secured against non-system users – probably rightly so too.
To resolve, just allow your IUSR_SERVER user to have read and execute permissions on both those files. Your exec() command should now be working.
REMEMBER: You are responsible for the security of your server. If you really don’t need to let programs run on your web server, then don’t.
Dashboards and Displaying Business Data
From Monolith Software blog, “even the best dashboards are somewhat myopic, and badly designed dashboards can lead to complacency, poor communication and eventually overlooked issues, degradations or outages.”
This is something that comes up repeatedly when displaying data from one area to those from the wider business. Data in any form needs to come with the required info or education to provide clarity. The most basic chart can be mis-interpreted by those who make assumptions on the colours, format, numbers, etc before them. Admittedly, providing clear, functional, beautiful dashboards of a business’s data is difficult – and that’s one of the key reasons I enjoy doing it.