September 21, 2008
I have a rather love/hate relationship with software. I got bit by the bug back in 1982 (might have 1981 - can’t remember now!) with a ZX81 kit (from the UK no less). Since then I’ve been writing software in a variety of languages: various BASICs, machine code (no, not assembler - straight POKEing HEX codes in to memory by hand), Pascal, Rexx, Perl, PHP, Javascript, CF, Java and lately Groovy, Actionscript and lately a dash of C#. One of the few lessons that’s stuck with me is that the act of writing software includes quite a lot of compromises - build vs buy, “cheap/fast/good” triangles, etc. I was recently hit with some compromises on a project and it really stuck in my craw (so to speak) so I felt like sharing it here.
I was asked to build a desktop video capture client. The original project was done as a VB6 project and had some problems, partially in the speed in which the original developer could meet deadlines (not really his fault) and some of the quirks of the system itself. This was a Windows-only app (obviously, being VB6), and I originally looked at recreating it with C#.NET. I’ve done a couple of small C# apps, mainly as tests for myself - things slightly above ‘hello world’, but nothing terribly practical. So, with that in mind, I was a little anxious about it, but gave it a whirl. After about a day of wrestling with C# Visual Studio Express, Windows Media Encoder SDK and Windows itself, I put it on a shelf. I’d not made much headway, and if I can’t make progress quickly, I tend to drop something (either to meditate on it, or look at other options, or whatever). In this case, I looked at building an AIR app.
In 10 hours I had a system that was *far* further along. It was about 70% of the functionality of the original system, with working video streaming, capture, playback, program scheduling and some other features. 10 hours! Just getting all the IDEs, SDKs and .NET runtime set up took an hour going the Windows-only route. Sure, my lack of .NET experience was shining through, but I had *never* built an AIR application before, and had limited Flex experience before that. To boot, the AIR streams could stream directly to a Red5 server - open source and free.
However, the big kick came in that the default Flash encoder algorithm is simply not that good. The specific project this is for has to do with live streams - there’s no time to give them to a different offline encoder for later playback. The default Flash encoder in the AIR system (and in regular browser-based Flash encoder systems) is single-pass only, and in short the client was simply not happy with the quality of the streams. To be fair much higher bit-rates were, imo, pretty close. Flash 450k stream quality was a bit better than a Windows Media 250k stream quality, but not much, and not in all circumstances (almost any signifiant motion - people walking - made it worse).
More investigation in to this uncovered a company called ‘On2′ which provides a plugin for the Flash player that would allow for multi-pass encoding, and the live streaming results are phenomenal. Seeing this software running on justin.tv made us consider Flash again. The AIR software system was further along, easier to install, cross platform, and pretty small. Why not use it? So we gave On2 a call for pricing. You know when you have to call for pricing it’s going to be bad. The price quoted was around $12k to get started. I can’t remember if that was a yearly license fee or a one-time fee. However, they wanted an extra 50 cents per minute of encoded video - $30 hour. This completely priced the product - the *only* one that can provide any sort of decent quality for live streaming Flash-based systems - out of consideration. And this meant we had no viable alternative except to go back to struggling with Windows/VS development.
Adobe seems to have wanted to open up the encoder space to allow for third parties to create their own encoder algorithms. I’ve seen two names mentioned over and over - on2 and sorenson. However, only on2 has anything that will run inside the Flash runtime to improve the quality directly in the capture process, rather than requiring external streaming systems. External systems seem to either preclude liveness, or customized/branded applications, or both.
Adobe’s business decision to do this seems to be really short sighted. Taking the one-pass quality out of the equation, building AIr or Flex apps to deal with video capture / streaming / manipulation is almost a no-brainer. Easy to develop for, cross-platform (linux, mac, windows), a growing community and other reasons all seem to make the decision easy. However, when you factor in the issue of quality, and the *cost* of obtaining that quality, it makes the platform unattractive, or at the very least most of the competitive edge is gone. *Most* developers out there don’t have millions in VC-backing to afford the latest and greatest toys. We have budgetary considerations, and from a “TCO” standpoint, right now Windows Media still seems to be the winner.
So, while we started off much further along going the Flash/Adobe route, their decisions to cripple the core encoding functionality for the sake of letting others make money in the encoder space ultimately is forcing me (and probably many others) back to the single-platform Windows world. Had Adobe put a stronger/better encoder in the core engine, there’d be *very* little (perhaps no?) reason to develop a Windows Media application, unless you were working solely on intranet applications ina Windows-only world. Instead, they’re sacrificing long-term dominance of this space for short-term profits (I have to assume they’re licensing some plug-in technology to on2 and whoever else wants to cough up). In the end, they will probably end up losing out in this space (live streaming capture), and Adobe’s Flash capabilities will be sidelined to a second-choice. Unless perhaps the encoder algorithm market gets some competitive jolt, or the money falls out of it and Adobe builds a quality one in to the base engine in the next year or so. However, Flash Player 10 is in beta, and an improved encoding algorithm is nowhere on their list of new features.
Argh… had to capture some of those thoughts down here. Perhaps I’ll come back and elaborate more in the future.
Posted in Uncategorized
No Comments »
September 17, 2008
So much keeps happening, and yet I can’t seem to find any time to write about it!
I got to hear (but not personally meet yet) Andy Hunt, who gave a very thought provoking talk at our local TriJUG the other day. I’m interested in learning the tech behind his ‘exocortex’ - he uses some external device to take notes (electronic) then svn syncs(?) to a main desktop, so things are always in sync. Was it an iphone? Does anyone know?
I have the rough content lined up for the first edition of GroovyMag - need to start getting the next few issues’ content lined up, and get the first set of content finalized from authors and layed out. I’m doing all this out of pocket to start with which is making it all a bit more challenging
Posted in Uncategorized
No Comments »
September 12, 2008
I perhaps have to watch my words a bit, because I’m going to start doing remote training for Zend in the next few weeks. Having said that…
I started trying to use Zend Framework the last week for a project. I’d started it in Grails for rapid prototyping, but there’s no hosting option for Grails that will fit the client needs, so I then looked at Symfony. I found that to be a bit overkill - it was harder for me to picture how this app would fit in.
So, I took a look at Zend Framework. The first few hours were nicer than I remembered. I’d used ZF pre 1.0 and again at 1.0 again, and there just wasn’t enough there to convince me to use it. Watching some of the Magento issues the last year or so convinced me I’d made the right decision to let ZF mature some more.
And then I hit something else this morning that made me slap my head again and say “what the heck? does anyone actually use this for real projects?” Now, you may think what I’m about to describe is ‘petty’ or ’stupid’ or whatever, but imo it’s indicative of framework authors’ lack of understanding of real world needs (not specifically ZF).
$formField = new Zend_Form_Element_Hidden(”type”);
$formField->setValue($type);
$form->addElement($formField);
When $form->render() is run, the hidden fields are rendered with the same <dd> and <dt> tags around them. This competely hoses up spacing - this creates extra empty spaces on the screen that I don’t want. HIDDEN means DO NOT DISPLAY. Yet the defaults for Zend’s Form system do not respect what I *want* to happen.
Could I store the data in a session instead of a hidden field? Sure. Could I write some sort of ‘view helper’ or ‘plugin’ or whatever to get around this? Probably. But should I have to?
Again, this is just an example of something I found that bugs/annoys me, and it happened to be ZF. This is something I’d have expected in a pre 1.0 release, not something that is regarded as a leading PHP framework with more than 2 years of development, and more than a year of post 1.0 behind it. When I hit these sorts of issues I really have to wonder how many major PHP framework authors actually do day to day development?
All that said, I mentioned my first few hours of using ZF were more pleasant than I expected. I was able to get some things done faster than I expected, but not necessarily faster than using any other framework (that I’ve used over the years).
Posted in PHP, Web
8 Comments »
September 11, 2008
So, I have an XP image that I wanted to use Eclipse on. I grab Eclipse (85 meg download version) and it tells me that it needs a JRE or a JDK. That’s slightly better than error messages I remember before, but I’ll still ask now - “WHAT THE HELL IS A JDK?”. It takes me to some Sun download site which asks what platform and language I want (can’t it guess that from the browser HTTP header info and at least prefill out the dropdown boxes?!). It then starts to download a 105 meg file that specifically has “nojdk” in the filename. What the hell is a JDK?
Sun doesn’t offer JDKs. They have “Java EE SDK” files. Perhaps just a little flag on Sun’s site that says “if you’re being told you need a JDK, you really need XXXX” and tell me what I need. Honestly, Sun/Java has some of the worst developer setup experiences I’ve ever had (and I’ve had many). Perhaps no one complains cause everyone’s already set up and there’s no new people coming in to this world? Who knows???
So, let’s try to download a “JRE” - the other option it says I could get away with. Where from? Java.com? No mention of a JRE there. When you download from the big blue button there’s something about JXPINSTALL.EXE being run. OK… what’s that? And why isn’t it labelled JRE? Try “java.sun.com” - which is aimed at developers. Popular downloads area lists “java ee, java se, java me (that’s ‘popular”?!) and a few others, none of which remotely resemble “JRE”. Three little letters that are a supposed core of Java, yet they’re nowhere to be found on either major Java site.
For the record, the “JXPINSTALL.EXE” file is now eventually installing a “Java Runtime Environment” and Eclipse now seems like it’ll run. What a PITA.
I’m on the record (again?) as saying that this is a wholly crappy experience. Getting a Java environment set up ranks up there with dealing with Gentoo build flags.
Posted in Uncategorized
5 Comments »
September 10, 2008
I knew it’s been a while since I’ve blogged, but 2 weeks! There’s been so much going on it’s been hard to keep up with life, much less a blog, but here’s a few highlights (mostly geeky):
* Wrote a small C# app for a client, and had to deal with all the lovely intricacies of ‘publishing’ an app. Really, I *just* want to generate a EXE and give it to someone to test, but the VSExpress wizards didn’t have that option. The auto-numbering version stuff was sort of neat, but everything assumed (of course) this would all be pushed out to an IIS/Windows server. How do I know? Cause the directory and file names it made were capitalized, but the HTML page generated to link to the files used all lower-case references. Windows servers aren’t case sensitive, but Unix/Linux are. Just one more small little thing to make it harder to deploy on non-MS tech (and completely avoidable).
* Got Zend certified. Bit of a long story to this one I won’t bore you with here, but I managed to get that done last week. Was nervous as heck (always am before tests) but it went OK.
* Had a good catchup with Fred and Shawn from our Java group over dinner last night. Nothing amazing in and of itself, but it was *great* to just sit and talk tech with some friends for a few hours. Very refreshing. While I don’t know Fred or Shawn terribly well yet (have met each just a few times before) both are very sharp, experienced, and tolerated my rants, so automatically I think they’re great!
* Am making some more progress on my Groovy Magazine project. I think we’ll be ready for a Nov 1 launch. Oct would be too soon I think, given current schedules.
* Signed up for devunity.com - looks suspiciously like a system I’ve tried twice (unsuccessfully) to write, and if it’s half as good as I’m expecting, it’ll be awesome.
* Have been bombarded with more project ideas than I care to have, but can perhaps implement one of these in November if things slow down.
So many things cross my mind over the course of a day, and yet I rarely have time to write them down here. I’ll try to post more regularly here!
Posted in General
No Comments »
August 27, 2008
Someone recently asked how to get a random element from an array. In PHP it’s pretty straightforward - array_rand($x) - but there’s not (AFAICT) a built-in way in Groovy to do this. So I wrote a little something which should hopefully demonstrate the power of the metaClass stuff to boot.
ArrayList.metaClass.getRand = { number ->
if(number==0) {
return delegate[new Random().nextInt(delegate.size)]
} else {
def tempList = []
def counter = 0
while(counter>number) {
tempList.add(delegate[new Random().nextInt(delegate.size)])
counter++
}
return tempList
}
}
def names = ['mike','matt','mark','lesley','jean','ron','jeff','martine']
println names.getRand()
println names.getRand(5)
The first call to getRand() on the names list will just return one name from the list. The second will return 5 random entries (and some could theoretically be repeated). I’ve added this getRand() method to the base ArrayList class at runtime, even though it’s likely declared ‘final’ in Java’s base libraries. This is one of the core powers of Groovy, and is pretty slick, imo.
Posted in Groovy, Java, Uncategorized
3 Comments »
August 27, 2008
I put together a small change to Grails’ scaffolding templates to help with one to many and many to many relationships. Grails (well, GORM really) will manage these relationships under the hood, but you were always left to do the interface on your own. This small set of file changes will give you better relationship management when you ‘generate all’ or ‘generate templates’ for you domains.
Here’s a small screenshot of what an editing screen looks like:

To use these, simply ‘grails install-templates’ in your project, replace the two files from the SVN repo (see link above) and generate away. This only deals with editing right now, not the ‘create’ step. That could be modified, I’m sure, I just didn’t do it (or did it but didn’t make it work right). If you’d like to contribute to this project, let me know.
Posted in Grails, Groovy, Java, Web
5 Comments »
August 18, 2008
I’ve recently had to look at Symfony, and, while OK, it’s made me realize how much I like Grails.
For example, in Symfony, you generate Model classes based on a schema file. You then generate Form objects for the Models, then tie them together in ‘CRUD’ screens. All of this is generatable pretty easily, once you know how to do this. This has changed (and been a bit more complicated since the 1.0 release I used last year).
Anyway, if there are relations (an Author has a Book, for example). the generated forms will complain that the generated Models need a __toString() method to be used in the Form/View. In grails, this is the case, but every domain (corresponding to a Symfony ‘model’) has an implicit toString() method already generated, which return the string “<domain>:<id>”. For most production work, you’ll want to override it with whatever you need the string to read, but for prototyping, it’s fine.
In Symfony’s case, I have to explicitly go add a toString() method before I can do anything else. So, I found the object builder in the symfony core and added this to the addClassClose() method (line 351)
$script .= ”
public function __toString() {
return \”".$this->getTable()->getPhpName().” : \”.\$this->id;
}
“;
The file I added this to is: /usr/share/php/symfony/plugins/sfPropelPlugin/lib/propel/builder/SfObjectBuilder.php
IMO something like this should be in the symfony core. Does anyone else agree? Or is this something already in the works for 1.2?
Posted in PHP
10 Comments »
August 12, 2008
I posted on twitter a bit ago asking for names/titles of female Beatles song characters. I was driving home last night and started to put together this list and thought it would make a great quiz. I’ve had a lot of excellent responses so far - too many to twitter about. Here’s the list so far, with who replied what…
davidjhinson @mgkimsal lovely rita, meter maid
TheProkrammer @mgkimsal Lady Madonna, Elenor Rigby, Mother Mary… that’s off the top of my head.. not counting “The Bird” that’s flown
TheProkrammer @mgkimsal Oh Polyethene Pam
BrianR @mgkimsal rita the lovely meter maid, polythene pam, Martha, Sadie, Lucy, Prudence
bigfleet @mgkimsal Uhh, Michelle?
ramsey @mgkimsal Penny Lane, Dizzy Miss Lizzie, Maggie Mae, Rita
lanerebel
@mgkimsal Does Martha count even though she was a dog?
ramsey @mgkimsal Polythene Pam, Her Majesty
tetriskeyring @mgkimsal Lady Madonna. Rita. Does Penny Lane count? My mom nearly named me Penny Lane. Wish she had. Long Tall Sally, Polythene Pam
_katertot
@mgkimsal yoko of course
Feel free to add more here too. Not sure about Yoko, but she did sing in Birthday. I hadn’t considered “Sally”, and no one yet posted “Anna”. I tweeted a few more but I won’t post them here yet. There are a few yet that no one has gotten, but this is a great list so far!
Posted in Music
15 Comments »
August 5, 2008
I’ve been cautiously exploring the idea of a Groovy and Grails magazine. I’ve got some interest from some well-known community members about writing articles, and I’ve got some leads on advertisers. The last missing piece of the equation is readers. Are you interested in a Groovy and Grails monthly magazine? I’m envisioning this as PDF to start with, with an eventual print component if the demand is there.
Why a monthly magazine? Specifically in the tech industry, it seems we don’t quite have enough time to digest things before the next big thing is arriving, and print is “out of date” before it gets printed. With breaking news stuff, I think that’s probably true. But with programming, there’s always more to it than first meets the eye.
There’s a lot of content out there in blogs, but the quality and depth just aren’t always sufficient to ge the point across. Books are great, but suffer greatly from the “out of date” issue I just mentioned. I just got a new Grails book a few days ago and it’s still referencing Grails 0.6 (not as gospel, but it was obviously the ‘current’ version when some or much of the book was written). In my mind, a well done magazine fills the void between blogs and books, balancing the depth and timeliness issues. The php|architect magazine series is a good example of this, and the MySQL magazine quarterly is another one. Both are chock full of good, useful content for people who need to dig deep in to issues but still stay abreast of current trends.
In any event, if you’re interested in learning more, contact me or post a comment here. You can also register your interest (let me know how many of you would be interested in a regular magazine effort) by going to http://groovymag.com and entering your email address (no you won’t get spammed or sold to!)
This isn’t quite a ‘done deal’ yet, but I’d like to know what the community interest in such a project is at this stage as I do more preparation and planning.
Thanks!
Posted in Grails, Groovy, Java, Web
17 Comments »