Konica Minolta Canvas

At the end of the month I will be going to On Demand in Philly. I will be going to support my companies products and even help showcase a few of them. This quickly reminded me of Vision 2009 and the fun myself and some co-workers had waiting around to talk to customers. Instead of playing tick-tac-toe or Solitaire we used a product which will be released soon by KMBS. Simply put, the product is awesome. It has a lot of potential for growth, but at the moment it serves two purposes:

  1. Define Workflows for Printgroove
  2. Draw Process Diagrams

A normal workflow might look like:

sales-to-shipping

You can also create cool diagrams – or in this case a Shipping Label:

shipping-labels1

However, with a little bit of creativity and boredom you can create some pretty crazy things:

invasion1

roar

ninja-n-private-island1

Please note, these drawings are not my sole creation. They are the result of a few people in my department having fun.

PMS2 – Coming Soon to an Interweb Near You

A long, long time myself and two friends were working on a college project where the entire goal as I saw it was to “create” stuff. Mono was a wee lad back in 2003, but I still preferred it to Java any day of the week. So myself, Phil Tricca, and Joseph Scaduto created a whole framework for creating what are now called “learning communities” in Mono/Gtk#/mod_mono.

One of the pieces we needed was a databases abstraction layer (we had grand ideas) so we first sought to flush out the ObjectSpaces API for Mono. Sadly, Microsoft couldn’t get their act together so we built our own. So in honor of Microsoft we called it Phil-And-Matt Spaces, shortened to PMS. After it’s original debut it sat on the selves for quite some time until I started working for Konica Minolta Business Solutions and was tasked with creating Printgroove. PMS hit the spot (man that sounds funny) – it was far from bad, but it certainly wasn’t awesome. At the point of its resurrection it needed a face lift, but never got one.

It’s now been years since Printgroove got started and PMS has continued to work well for it and numerous other projects – but I’ve got an itch that must be scratched. So while working on a small web service only project I’ve been adding in a couple dozen extra hours to mature PMS – or basically throw away it’s entire user facing API.

Here’s a sneak peak of whats to come:

// - Pull IDbConnection from pool based on unique name (from config file)
// - This is useful if you have multiple databases to chat with
// - Not specifying a name will load the one marked default or the first one found
using (DbBroker cxt = new DbBroker("name-mapping-to-config-connection-string")) {

    // SELECT member.* FROM member WHERE username LIKE '%a%' ORDER BY id
	// Enumerate through results without storing Member objects in container
	foreach (Member m in cxt.Query<Member>().Like("username", "%a%").OrderBy("id").Exec())
		Console.WriteLine(" : " + m);
    
	// Use raw SQL and ignore chainable methods for generation
	// Store results in List<Member> and then iterate through it
	string sql = "SELECT member.* FROM member where username LIKE '%a%' ORDER BY id";
	foreach (Member m in cxt.Exec<Member>().Objects<List<Member>>(sql))
		Console.WriteLine(" : " + m);

	// get first member
	Console.WriteLine("first: " + cxt.Query<Member>().Exec().First());

	// a short-cut to get the first member since we aren't filtering etc
	Console.WriteLine("first: " + cxt.Exec<Member>().First());

	// SELECT COUNT(member.*) FROM member WHERE id > 50000
	// Use generics to cast the output of ExecuteScalar to an Int32
	Console.WriteLine("count: " + cxt.Query<Member>().Filter("id > 50000").Exec().Count<int>());

	// Directly call ExecuteScalar but use generics to cast the output
    sql = "SELECT id FROM member WHERE username='mimetnet'";
	Console.WriteLine("scalar: " + cxt.Exec<Member>().Scalar<int>(sql));

	// Directly call ExecuteReader() with our generated SQL
	// SELECT id,username FROM member WHERE id > 68665
	using (IDataReader reader = cxt.Query<Member>()
									.GreaterThan("id", 68665)
									.SetColumns("id,username")
									.Exec()
									.Reader()) {
		while (reader.Read()) {
			Console.WriteLine("Member(id={0}, name='{1}')", reader[0], reader[1]);
		}
	}
}

Please send me your thoughts/concerns/nightmares.

Internet Explorer Quirks: 204

A long time ago when I first started doing a lot of REST + Ajax developement I hit a really strange issue. Apparently, if your server returns a HTTP Status code of 204 in response to a POST method IE partially blows up. Part of this has to do with IE requiring try/catch blocks around code that could be devastating – like XMLHttpRequest.send()? And part of it has to do with IE not parsing a 204 response.

Upon receipt of 204 IE appears to halt parsing as the XMLHttpRequest instance becomes corrupt and is no longer usable. Checking true/false against the instance works (and is false), but querying a method or variable from the instance produces an error.

var xhr = null;

try {
    // without try/catch IE throws error for no good reason
    xhr = new Ajax.Request(url, options);
} catch (exe) {
    /* will never fail on IE for 204 */
    console.error(exe);
}

// xhr is invalid for IE + POST + 204
if (xhr) {
    resp = xhr.transport;
} else if (/^post$/i.test(method) && this.isInternetExplorer()) {
    resp = this.FAKE_204_RESPONSE();
}

I vaguely remember reading on some site that IE fails on POST + 204 because it helps the browser short circuit and keep from redrawing the interface from a <form/> submission. This sort of makes sense because you can then upload/POST form data without having to redraw the page and still know if everything succeeded.

Either way, it is truly annoying. And the only reason I’m evening posting about this, other than education and helping myself remember, is that my original comments around the code above was vulgar. It happened to have been 3AM or so and my polite-o-meter wasn’t working well. It is now almost three years later and I believe some people have seen the original comments and didn’t find it appropriate – to which they are correct.

With that said – Internet Explorer has some weird quirks.

Silverlight vs. Flash

I’ve been a long time hater of Flash as a web-service consumer because of its inability to use any HTTP method other than GET or POST. People revert to stupid URL argument tricks like ?_method=DELETE and actually use a GET or POST, neither of which work if your service layer is actually … truly … RESTful.

Silverlight has the same damn issue. Apparently none of the blog posts I read a WHILE back (2+ yrs) mentioned the fact that Flash, and now Silverlight, use the lowest common denominator for their web request classes…. NPAPI (Gecko/Mozilla Plugin SDK). I’m sure there are good reasons for using the embedded ones, security, re-usability, performance too – but it’s rather annoying!

Why the NPAPI developers don’t augment the API, I have no idea. But at least Silverlight allows for a HTML event to trigger the OpenFileDialog.ShowDialog() without having to do fun invisible overlays.

Silverlight:
http://wilcob.com/Wilco/Silverlight/http-requests-in-silverlight.aspx

Flash:

http://www.adobe.com/devnet/flashplayer/articles/fplayer10_security_changes_02.html#head34

http://livedocs.adobe.com/flex/3/langref/flash/net/FileReference.html
http://theflashblog.com/?p=423