Posted (Updated ) in Javascript

Despite a global shift towards touch-oriented devices on the internet and the existence of a relatively old bug report, Google has decided not to add support for mobile/touch to their ChartRangeFilter for Google Charts (as of the time of writing). See for yourself:

Demo | Source – Doesn’t work on mobile. Frustrating!

This is really annoying, especially if you are dealing with a significant chunk of data that could take advantage of this functionality by allowing users to ‘zoom in’ on specific areas.

 

A Workaround (For Now)

Although we can’t get the ChartRangeFilter working on mobile, we can display something else instead for mobile devices such as the handy jQRangeSlider. To do so we’ll need to hook into the methods provided by google.visualization.ControlWrapper (which sits around the ChartRangeFilter).

In the source we have:

var controlWrapper = new google.visualization.ControlWrapper({
	controlType: 'ChartRangeFilter',
	...
});

We can update the selection in the ChartRangeFilter by calling the following on its ControlWrapper:

controlWrapper.setState({
	range: {
		start: new Date(2004, 01, 01),
		end: new Date(2006, 01, 01)
	}
});
controlWrapper.draw();

Combine this with a mobile UA check (terrible I know, but you can’t really use browser  feature detection for this) and a DateRangeSlider (I’m using dates on my X axis) and you get the following:

var is_mobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent);
// ChartRangeFilter doesn't work on mobile. Use a dateRangeSlider to manipulate it
if ( is_mobile )
{
	$('#filter').hide();
	$('#filter_mobile').show();
 
	$( "#filter_mobile" ).dateRangeSlider({
		bounds: {
			min: new Date(2001, 1, 1),
			max: new Date(2013, 3, 1)
		},
		defaultValues: {
			min: new Date(2001, 1, 1),
			max: new Date(2013, 3, 1)
		},
		step: {
			months: 1
		},
		arrows: true,
		wheelMode: null
	}).bind('valuesChanged', function(e, data) {
		controlWrapper.setState({range: { start: data.values.min, end: data.values.max }});
		controlWrapper.draw();
	});
}

Demo

ChartRangeFilter workaround for mobile devices

ChartRangeFilter workaround for mobile devices

Try the demo below. View it on a mobile device (or use a mobile UA string). You get the standard Google Charts ChartRangeFilter for desktop and jQRangeSlider for mobile. Everything works nicely!

Demo | Source – Snazzy mobile-specific date range widget

Read More »

Posted (Updated ) in Uncategorized

A while back Samsung released a line of relatively cheap “EcoGreen” 2TB hard drives. Being the storage hungry IT nerd that I am, I picked up 2 of the things before finding out their firmware contains a known data write bug requiring a firmware patch best summed up with the following:

“It [the drive] will “forget” to write out its buffer if certan SMART commands are sent to the drive. This is the very definition of silent data corruption.”
source

Samsung has released a patch but it requires booting into DOS which is incredibly difficult to do on todays floppyless PCs. After a bit of googling I came across the following two solutions to get the job done:

Bootable ISO image

This is the easier solution of the two but it is also the one that didn’t work for me. Michael has created a FreeDOS image with the patch merged in. For the download and installation details, see this post.

Bootable USB image

After trying and failing the above, I settled for a bootable USB image instead. User ZDOS has written up a handy tutorial here which I’ve detailed a bit more in depth below:

  • Download the Windows 98 system files (at the top) and HP USB Disk Storage Format Tool from here and F4EG.exe from here.
  • Install the HP Format Tool and run it with administrator privileges (right click – Run as Administrator).
  • Extract the Windows 98 system files.
  • With the HP Format Tool, format your USB drive (quick format should be enough) as Fat32 making sure you use the Windows 98 system files where it offers.
  • Once done, copy F4EG.exe to your USB drive.
  • Shutdown and unplug all HDDs besides your unpatched Samsung drive
  • Boot your PC and enter the BIOS by pressing Delete during startup. Ensure that your HDDs are set to run in AHCI mode.
  • Reboot either ensuring USB-HDD is selected as your top boot device or press F12 during startup to visit the One Time Boot Device page (results may vary – check your motherboard documentation).
  • You should see a Windows 98 logo flash on the screen for a split second and then a command prompt. In the prompt type F4EG and press enter. Your drive should flash itself.

For plenty more useful information on this issue, I found this forum thread very helpful.

Read More »

Posted (Updated ) in Uncategorized

I installed firefox-4.0 (currently 4.0b8pre) on Ubuntu Maverick RC earlier today and all was going fine and dandy until I had to open a Google Docs spreadsheet. I’d receive a message stating:

The bad news is that Google Docs has just encountered an error.
The good news is that you've helped us find a bug, which we are now looking into.

We apologize for any inconvenience this has caused you.
In the meantime, if you'd like updates on this and other issues, try visiting the Google Docs Help Forum.

Sorry, and thanks for your help!
- The Google Docs Team

I checked documents and they seemed to be fine. It turns out this is an issue with Google not recognising FF4’s user agent string. The easiest way to solve this issue is to type about:config into the address bar and set

general.useragent.compatMode.firefox

to true.

Read More »