Tuesday, March 8, 2011

Properly Mavenized Red5

Following a pattern shamelessly ripped from Antoni Jakubiak's jakubiak-red5 project, I've reduced building Red5 Server to exporting the source into the preferred Maven layout and preparing the dependencies. I will still be able to properly track changes against vendor code. Next step is to refactor the client tests to execute generically.

Wednesday, February 23, 2011

Looking for a better way to use guards in lambda expressions

Took a swing at using guards instead of if-then to do flow control in anonymous recursion. After some digging, the cleanest solution I could come up with invokes a single case, expressionless statement against any arbitrary argument.

Surely there's a better way to do this.

-- the Y-combinator
y f = f (y f)

-- factorial in lambda
fac :: Int -> Int
fac = y( \f n -> case () of
_ | n == 0 -> 1
| otherwise -> n*f(n-1) )

Saturday, February 19, 2011

History in ghci

Diving deeper into Haskell, but was frustrated for a day or so by the lack of documentation to enable the interactive console's obvious support for tracking input history. After discovering an issue tracker discussion hinting that history should write to ~/.ghc/ghci_history, I tried creating the hidden path for myself. 'Lo and behold, history is enabled.

Thursday, February 17, 2011

Reihan Salam nails it on the head

From the Corner:

Do all software engineers collectively create X amount of wealth, or do some create lots of wealth in teams embedded in particular firms? We have many examples of engineer-entrepreneurs who’ve made large fortunes. But one of the reasons we like entrepreneurship is that successful entrepreneurs rarely capture all of the value they create. They generate a great deal of consumer surplus — and we generally see this as a feature, not a bug. It would sound odd to our ears if someone argued that Marc Benioff should be capturing a much bigger slice of the value he’s created for thousands of businesses and consumers around the world. In a similar vein, many workers produce more value than they capture, and of course many workers benefit mightily from access to capital owned by others. It’s very hard to adjudicate who deserves what, which is why compensation is best left to a decentralized trial-and-error discovery process, e.g., a competitive marketplace.

Not all engineers are created equal. I largely write content automation software sit through boring, useless SCRUM meetings these days. Should I make as much as someone who codes calculus day in and day out?

Wednesday, February 16, 2011

Mavenizing Red5: Antrun Plugin saves a lot of time

Red5Load will have an obvious dependency on Red5 libraries. Fortunately, building from source packages exactly what I need in a convenient archive (red5.jar). Unfortunately, I chose to layout Red5Load as a Maven 2 project. The Red5 team stubbornly insists on distributing their source as an Ant project with Ivy for dependency management. Don't get me wrong, I've nothing against Ant. I've just been working with Maven for so long that the Ant way of doing things is almost alien to me.

If that's not enough, previous experience indicates I'll eventually hit a wall delegating to or extending Red5 classes and will have to resort to modifying the source. If I chose to fully mavenize the project, I'll drive myself crazy trying to keep the Red5 drop tracking well with the vendor source. What I need is a way to kick off the drop's Ant build and collect the resulting jar(s) as resolvable Maven artifacts.

Enter maven-antrun-plugin
. This convenient little tool allows me to bind appropriate Ant targets to phases in a Maven build's lifecycle. I've chosen to handle, obviously, clean, compile and package.


Each execution targets the same goal, antrun:run.




Cleaning is fairly trivial, requiring only executing ant against the target clean.



To compile, we simply call ant
with no specified target. The Red5 project defines a build.xml configuration that Ant automatically picks up, but we could easily provide our own and specify an antfile
attribute to the ant tag.



Packaging is a little more interesting. Since Maven isn't actually handling archiving, we have to coax Maven into injecting the resulting jar (or jars) from the Ant build under resolvable coordinates. This is where the attachartifact tag proves extremely useful.



You can read up on classifiers here, but for now the important thing to take away is that our complete POM will configure three artifacts in our local repository:

  1. red5-1.0.0-SNAPSHOT.pom
  2. red5-1.0.0-SNAPSHOT-server.jar
  3. red5-1.0.0-SNAPSHOT-boot.jar

Tuesday, February 15, 2011

Introducing Red5Load

Red5Load is an open source effort to mate the Grinder load tester with Red5, an open source implementation of an RTMP/S/T/E (Flash media) streaming media server.

1. Code between jobs.
2. Get familiar with Google Code source hosting (project link here).
3. Play with Mercurial.
4. Learn more about the suite of Flash media protocols.
5. Excuse to master Grinder's statistics libraries.

If I get the time, I want to tackle automating Grinder agent kick off and result collection on EC2.  IT-BJK rolled an AMI to do this, but they tweaked the source and have yet to distribute the changes.