Vanity Foul
Dedicated to the wanderings of an egotistical mind.


20090519
Tuesday May 19, 2009

Exploding Soup

Did you know ham can explode? I didn't. I heated a 1/2 can of Campbells Chunky Split Pea w/Ham for 1 minute. I then stuck in my spoon, expecting to stir the soup and heat some more. Instead, the bit of ham I touched exploded in my face (leaning into the microwave in order to stir). A big chunk hit my lower lip and burned a spot, but it isn't visibly damaged. Just glad it didn't hit an eye!

I cleaned up the interior of the microwave, heated another 15 seconds (originally planned for 45) without incident. Phew!
( May 19 2009, 12:42:59 PM ) News Permalink
Trackback: http://www.brainopolis.com/roller/trackback/lance/Weblog/exploding_soup



20090408
Wednesday April 08, 2009

Satellite Sheiks

Satellite Sheik n. A televangelist for Islam. These media-savvy religious leaders broadcast moderate Muslim beliefs on satellite TV and social networks, appealing to Arabs alienated by traditional imams.[Jargon Watch]

Isn't that the opposite of Christian televangelists?
( Apr 08 2009, 03:38:02 PM ) Politics Permalink
Trackback: http://www.brainopolis.com/roller/trackback/lance/Weblog/blockquote_p_i_satellite_sheik

The Daily Chuck

It's silly, but I look forward to the Daily Chuck, but not so much as before Chuck got a sister.
( Apr 08 2009, 02:32:36 PM ) Entertainment Permalink
Trackback: http://www.brainopolis.com/roller/trackback/lance/Weblog/the_daily_chuck

Groovy Markup Builder

Rather than post this to the Groovy User's mailing list and look like a fool, I thought I'd restrict my foolishes to a smaller audience.

My employer generates a lot of XML, some of which contains an element that looks something like this:
<updatetime day='2' mon='8' date='11' yr='2008' hr='4' hr24='4' tz='GMT' mer='am' min='1' sec='0'>04:01 AM GMT Monday, Aug 11</updatetime>

The perl for this was straightforward (blat out the xml as a string), but when I rewrote it in Java it got complicated, using a SimpleDateFormat to generate a string that I parsed to constituent bits and built a DOM Element. The parsing to bits is irrelevant here, what was "nice" was that in Java for each attribute I just called (in a loop):
updateTimeEl.setAttribute(nameVal[0], nameVal[1]);

Now, for a bit of R&D, I'm rewriting it in Groovy (along with the rest of the class) using the MarkupBuilder and I built a map of attributes. I wanted to do
builder.updatetime( attributes.each{key, value -> key:value}, sdf.format(updateTime) )
but that failed (groovy insists that key/value must be members of my class) and I resorted to:

builder.updatetime(
	// first the attributes
	day:attributes['day'],
	mon:attributes['mon'],
	date:attributes['date'],
	yr:attributes['yr'],
	hr:attributes['hr'],
	hr24:attributes['hr24'],
	tz:attributes['tz'],
	mer:attributes['mer'],
	min:attributes['min'],
	sec:attributes['sec'],
	// now the text value
	sdf.format(updateTime)
)

This works, but is certainly less elegant than I like.
( Apr 08 2009, 02:15:44 PM ) Groovy Permalink Comments [4]
Trackback: http://www.brainopolis.com/roller/trackback/lance/Weblog/groovy_markup_builder

ReadWriteWeb on iPredator

ReadWriteWeb has a great entry today about a new service from The Pirate Bay, iPREDator. In particular, the following quotes really hit the nail on the head:

This is where the copyright witch hunt has brought us: in order to access the content we want, we have to become anonymous and hide our identities. Because people just want to watch a TV show or see a movie, they have to play a ridiculous cat-and-mouse game with the authorities who somehow equate downloading a file with stealing a car.
...
Yet here we are, only a day away from the launch of a tool that is surely going to be used for much more than just torrenting.
[iPREDator]

I share the sentiments of Sarah Perez, the article's author.
( Apr 08 2009, 09:14:44 AM ) Politics Permalink [Link]
Trackback: http://www.brainopolis.com/roller/trackback/lance/Weblog/readwriteweb_on_ipredator



20090330
Monday March 30, 2009

Standalone GORM via Java

I spent some time re-jiggering the code, specifically getting Burt's GormHelper to load from the applicationContext.xml. I also pulled the use of domainclasses.txt and listed them directly (I'd rather make the code smarter and have it load anything with the @Entity annotation - but that's beyond the current exercise). Don't forget to change the base-package in the gorm:sessionFactory bean.

    <bean id="gormHelper" class="com.burtbeckwith.gorm.GormHelper">
	  <constructor-arg>
	  	<list>
	  		<value>com.brainopolis.GormAuthor</value>
	  		<value>com.brainopolis.GormBook</value>
	  	</list>
	  </constructor-arg>
	</bean>

I've got a simple GormProxy for a few dynamic GORM methods - save(), findBy() - but you'd probably want to build a proper Interface for the GORM classes to extend. I've built a small demonstration app, complete with new GormHelper, applicationContext.xml, and a couple Test Cases.
( Mar 30 2009, 01:07:25 PM ) Groovy Permalink
Trackback: http://www.brainopolis.com/roller/trackback/lance/Weblog/standalone_gorm_via_java



20090327
Friday March 27, 2009

Using GORM from Java

As the advocate of GORM, it fell to me to prove that it was possible to use GORM from within a Java application. I knew, theoritically, that is was possible, but it took me a couple days to prove it. The few related links I could find were all pre-Grails 1.1, and most were over a year old. Still, based on the shoulders of the giants who went before me, I was able to get it working.

Here is the list of Giants, and the pages the left behind to guide me:

  • The old Standalone GORM page told me it was possible, just not how.
  • Many links were found on this Swik page.
  • The Grails 1.1 Release Notes told me that something important had changed, and I couldn't just use what went before.
  • Anthony Caliendo was trying to do the opposite, but his struggles were still instructional.
  • Burt Beckwith's adventures were key, and without his GormHelper I wouldn't have succeeded. I've made changes based on Grails 1.1 GORM.
  • I'm going to buy Robert's GORM book, but I don't want a PDF and I don't have time to wait for it to come out in 'dead tree.'
  • Graeme answered my stupid and obvlivious question on the user-AT-grails.codehaus-DOT-org mailing list.
  • John Mclean provided many complicated posts that once I figure out will make my hack much more elegant.
  • Finally, the excellent API docs for Grails.

( Mar 27 2009, 01:27:54 PM ) Groovy Permalink
Trackback: http://www.brainopolis.com/roller/trackback/lance/Weblog/using_gorm_from_java



20090319
Thursday March 19, 2009

Parrot 1.0 It's been a long time coming, Parrot 1.0 is finally released. How far behind is Perl 6?
( Mar 19 2009, 06:27:10 AM ) Technology Permalink [Link]
Trackback: http://www.brainopolis.com/roller/trackback/lance/Weblog/parrot_1_0




archives
links