Month: January 2011

Browser test for media types

Using the modernizer script I’m testing media capabilities in the browser with the following script:

	<!--
          Video Test with Modernizr and diveintohtml5.org/detect.html-->
	<script type="text/javascript" src="tools/getscript.php?modernizr&jqueryui"></script>

<script  type="text/javascript">

		$(function() {
			var videotest = {
				webM : false,
				ogg : false,
				h264 : false,
			}
			if (Modernizr.video) {
				if (Modernizr.video.webm) {
					videotest.webM = true;
				} else if (Modernizr.video.ogg) {
					videotest.ogg = true;
				} else if (Modernizr.video.h264){
					videotest.h264 = true;
				}
			}

			var videoResult = 	"WebM : " + videotest.webM +
						"<br/> OGG  : " + videotest.ogg +
						"
 h264 : " + videotest.h264;

			$('span#videoResultsSpan').html(videoResult);

			if (console) { console.log(videoResult) }

		});
	</script>

Chrome 8.0.552.237:

WebM : true
OGG : false
h264 : false

Firefox Beta 4.0b9:

WebM : true
OGG : false
h264 : false

IE 7.0.6002 and 8.0.7006

WebM : false
OGG : false
h264 : false

TerpTracker

I think I have the start of an invoice tracker. The user may define clients and define actions (punch in/out, arrive, depart, etc). You track  events such as “I’ve arrived at client X” and “departing location on client X”. In the end, I hope to export a CSV (comma separated file) to the sd card which later could be imported to a spread sheet.

Holy mother buzzer

So I’ve added an audible alert to when the clock hits zero. This is controlled through the application’s preferences by a check box shown to the left here.

Coding was interesting for this because I throw most settings into the Session Storage scope, which as of now only saves information as strings. I struggled a bit with this thinking I was saving a boolean variable. But I digress.

For documentation, sharing, and my own learning process, I want to show significant code bits here. The first bit occurs early on during the init process. I bind the check box to the following function. The variable sessionStorage.buzzerPermitted takes the value of the box’s checked state. An important thing to note is that sessionStorage items, at the moment, store contain strings. The this.checked returns a boolean value. So that boolean (true or false) will be converted to string value.

// Bind check box to buzzer permission
	$('#checkbox-buzzer').bind('click', function(e) {
		console.log (this.checked);
		sessionStorage.buzzerPermitted = this.checked;
		$('#span-buzzerActive').html(sessionStorage.buzzerPermitted);
	})

The second piece follows as such. The function ttNotifications.buzz() is called as the clock restarting either manually or by the count down reaching zero. We first check to see if the notification ability exist and if the user has set that as a preference.

var ttNotifications = {
	buzz : function () {
		if (navigator.notification && (sessionStorage.buzzerPermitted == "true")) {
			navigator.notification.beep(1);
		} else {
			console.log('No buzzer permitted');
		}
	}
}

Finally, I have to clean up the lexicon here. As implemented now the buzzer doesn’t fire but the preset chime does. This is a work in progress. I will have to update this shortly.

TerpTimer in the Android Market

Although, in my last post favored, I argued for the open web. I still do favor this overall; though, to stretch myself a bit, I’ve coded a version on the TerpTimer for Android using PhoneGap and released it to the market. Though I do feel like I’m cheating, it does offer some advantages. If I decide to add the full build out of TerpTools to the mix, the code is closer to the hardware.

The problem I’m looking to solve  is alerting the interpreters of an impeding session change. The interpreter in the rest/support role should not have to look down at the phone. This is just distracting during a teamed assignment. Additionally, the screen should not stay on the entire time. That eats up the battery. So I’m looking bit better hardware control for the next few versions.

Install from: AppBrain or AndroidZoom