Archive for the ‘Programming’ Category

A post with a forgotten name

March 12, 2010

Don’t hold me up now,
I can stand my own ground,
I don’t need your help now,
You won’t let me down, down, down!

Rise Against – Prayer of the Refugee

I’ve been extremely unproductive of late and I really hate myself for it.  It seems like ever since I got the new job offer, I’ve not been able to find the time for the side project programming.  When time presents itself, I usually find an excuse to do something else.  It’s very distressing.  I need to just get started into something because then the drive will take over.  I want to get back into that flow when I was working on my Android conference app.  I found a way to work on that every night back when I was developing it.

I’m all about the Android phone development, but that would lock out my friends who don’t have one from playing anything I create.  I’ve got like 5 programming books laying around waiting to be read.  There’s about 2 that I’m actively reading in now and then, but their not technology specific.  One is career oriented and the other is interviews with a variety of IT professionals.

Just feeling a little sorry for myself right now, instead of doing some programming.  🙂

The posts are coming few and far between.  Facebook seems to be taking the few things I have to say of late.  I still need to figure out what’s up with not getting notified of comments.  If you post a comment, maybe send me an email to, so I know to check.  It’s supposed to let your comments show up if you’ve been approved before, but I found last week that that wasn’t working either.  Looks like I need to upgrade again.

Advertisements

Old Programmers

February 28, 2010

Holy crap!  I’m posting this so that I can read it in a few years.  I didn’t realize I’ll be considered an old programmer in less than a few years.

CodeMash 2010

January 11, 2010

Only one more day of work before I head to CodeMash.  I can’t wait.  It was painful not being able to go last year.  The problem always is trying to fit in all the great sessions that I want to go to.  Plus, I plan to keep an eye on the Open Spaces topics for Android topics or other things that catch my eye.  So session wise, it’s going to be tough.

This year they are even having a game room and a coding jam room.  Add in that the evenings are usually filled with something (opening night panel, cocktail party) and I doubt I’ll make it to the water park area again.  Just too much to do.  This is such a great conference for the price.  I hope I can continue to go every year.

JPA

October 14, 2009

Over the summer at work, one of my projects was creating an application to print a new Bill of Lading that showed an itemized record of each package.  This involved pulling data from a legacy system and using BIRT (Business Intelligence and Reporting Tool) from the Eclipse Foundation.  I’m not a huge fan of BIRT, mainly for the fact that I’m not a fan of report writing.  But I got the short straw and had to learn it for our main project.  So using it on this project made sense.

I decided to use JPA (Java Persistence API) for my data access.  It would give me an opportunity to learn something new, get a different perspective from Hibernate, and since the other members on my team had used it I had ready tech support.

The project was a success, though making the “Holy Grail” of Bill of Ladings seems a little like overkill it was a good learning experience and was my first project that I was a major part of to make into production.  We’ve had some peculiarities caused by the legacy system that we’ve had to accommodate for.

I did have one major mistake that I rectified this week after a swift kick to the head from a team member.  I’d been letting Spring inject an EntityManager into each one of my DAOs (Data Access Objects).  I’d found a great series of articles on using JPA and setting up a generic framework for your DAOs.  But I’d neglected to realize that the articles must not have been written for the web world and threading.  EntityManager’s  aren’t thread safe.  While this wasn’t seeming to cause us a problem, it was a good idea to rectify it.

EntityManagerFactory’s are thread safe, so it was a pretty easy change to switch over to injecting the correct entity factory and then creating an EntityManager as needed for every method that required one and then closing it.  Hopefully, this will circumvent one issue that was caused by our legacy database driver.  Fingers crossed.

I really like JPA.  I used EclipseLink as the JPA provider.  Annotations rule for all this ORM (object relational mapping) stuff.  So much nicer than the load of Hibernate XML files.  I believe Shindo told me this years ago, and I’m glad I finally had an opportunity to use it.  On our main project, we’ll be stuck in Hibernate XML hell forever, most likely.  I know Hibernate has it’s own annotations for this, as well as coming JPA support, but I really like the seemingly lightweight feel that EclipseLink gives me.

Thoughts of recent yesterdays

August 26, 2009

This week is seeing a variety of things arrive for me.  Yesterday, Beginning Google Web Toolkit arrived.   It’s a book on GWT which is one of the things I’ve been tinkering around with lately.  (Someday I’ll continue the what have I been programming lately posts.)  I got it for like $3 from one of Amazon’s partners.  This is very much a beginners book, there’s not much it offers me I haven’t already figured out.  I should have probably went for a more in depth book, but the price and the relative newness of it wouldn’t let me pass it up.  With GWT 1.7 release, things are moving toward a better event model handling approach, so nothing is new enough to address that yet, besides blogs and YouTube videos.

Monday, A Victory Denied arrived from MMP.  This is looking to be just as cool as A Victory Lost.  I’ve read through the section on combat so far.  So far, it’s very similiar to AVL rules-wise, but has enough differences to stay fresh.  Elite Russian units popping up in an attack should be enough to keep the German player holding their breath everytime the Russian rolls an attack.  The unit activation differs slightly from AVL also.  The activated HQ can activate other HQ’s within its command range which can then activate units.  Also the activation for Panzer Groups is a little different also.  I’ll try to do a “live” box opening sometime, though the contents are pretty close to what AVL had.  I’m looking forward to getting this on the table with #4 in the future.

Not exactly this week, but Thursday saw the arrival of a shiny new toy.  I eluded to this last week of something arriving to take up some space in our newly cleaned garage.  The story goes that our old Grand Caravan has slowly been degrading.  We were without air conditioning for going on 2 years now, not wanting to sink the money into it.  Then, it started flooding on the inside.  The van had been sitting outside for most of the spring and summer.  Over the last month, whenever I would drive it after it rained, I would be assaulted by water coming in from under the passenger side dash.

The final straw came when I went on a business trip and had to leave the van parked where we met.  When I came back, it seemed like near sink fulls of water were pouring in.  I had to pull over and open up the door.  I’m the first one to admit I can be somewhat dense, but this finally convinced me that with “cash for clunkers” going on, I’d be an idiot not to let the government help buy me a new car.  I sure wasn’t going to get that much trading it in on my own.

So we began our search.  We looked around the area.  I really wanted to buy an American car, especially after dealing with Taylor Kia.  But amazingly (just like when we ended up with the Rondo) there wasn’t any super good deals that knocked our socks off.  Then, the wifal-unit did some research into what cars were eligible.  One that was was a car that we had both always really liked but thought would be way too expensive.  She looked up the nearest dealer and found that the prices were at the same level as the other vehicles we were looking at.  So a little trip, a few test drives, a little bargaining, an amazing deal, and a whole lot of pain dealing with the Ohio BMV to get proof of my previous registration and we replaced our clunker.

Here it is:

Front view of our Clubman

Front view of our Clubman

Side View of our Clubman

Side View of our Clubman

Programming I've been up to

August 7, 2009

It’s been a while since I discussed anything programming related.  Believe it or not, I have been doing some tinkering.  First, let me talka little about what I’ve been working at on and off at work going back a few months.  If that doesn’t drag on too long, maybe I can talk about some cool non-work stuff I’ve been playing with.

One of my team was working on a side project that had a somewhat dynamic data aspect to it.  What I mean is depending on a certain type selection made by the user, there was some data for that selection that wasn’t needed for other selections.  This was a fairly large aspect of the application.  He had a data model worked out on how to set up for these special types, and getting them to and from the database.  Displaying it was the problem.

Very simplistically making this more concrete, let’s say that if the user picked selection A, he’d have to supply fields 1, 2, 3.  If selection B was picked, fields 4, 5, 6 would need supplied.  Given that future selections may need to be added that required other data, a flat model where each selection would just have all the fields didn’t make sense.  While each selection had a number static fields common across the selections, each selection had it’s own distinct data.

Initially he was thinking he was going to have to create a separate screen for each type of selection or at the least a separate panel unique to each selection.  I told him he shouldn’t have to do that.  We could make a special panel that would dynamically display the data depending on what was needed.  So I set about tinkering with it in my spare time.

This whole app is supposed to be a tempory hack to get the users through the next couple years.  So I wouldn’t say my solution is extreme enterprise quality.  I didn’t take the time to figure out how to get my controls binding to a data structure.  We’ve got some pretty slick (when it’s not causing troubles) binding in our Eclipse RCP app that automagically binds back and forth between controls and a data obect.  I haven’t dug into exactly how that works yet, but it’s on my list of todos.

I created two controls for displaying this dynamic unknown data: a dynamic grid table and a dynamic composite.  Both would add controls (Text, Combo, etc) based on what type of data was needed.  This was all backed by a list of property objects that described each required field, such things as the data type, value object, field title to display, etc.  The table would show a list of two columns, one for title and one for a control to hold the value.  The composite (which was used and subsequently more work put into) would layout a set of labels and controls as defined by the backing list.

The underlying database model stores everything as string so I added some convenience methods to load and extract the data from the underlying list as strings.  All in all it works pretty well and saved a lot of time that would have been stuck in making special panels for each selection type.  Not to mention the time that will be saved when a user requests some additional field to be added to a particular selection or a whole new selection added.  My co-worker made a pretty slick admin panel to handle the building of the dynamic data and additions.

This little side trip helped me learn a lot more about straight SWT.  I really enjoy being a developer of tools for other developers to use.  I have plans to add an easy builder way of creating the underlying list and being able to magically bind to and object.  But, there’s always new priorities so I may not be able to get back to it.  Perhaps I’ll someday find a need for such a thing in my own projects and can create a better version from the experience I’ve gathered.

Well, I didn’t get to the other side project at work that I detoured on involving JPA, so I’ll have to save that for another time.

Josephus' Circle of Doom or "links of the day"

July 30, 2009

No energy to really say anything intelligent, so I might as well pass along some links that caught my eye.

An interesting take on the recent announcement of Google’s Chrome OS.  Kind of long, but I must say it sounds reasonable.

A very surprising math technique for multiplication.  Good thing it wasn’t the peasants we were in the Cold War against.  Is there some kind of mathematical proof backing this?

An intriquing programming problem that wouldn’t seem to be too elusive but does tickle my curiosity to start up the old IDE.  I bet Josephus was always the last picked during recess.

Beer equilibrium and flow

May 12, 2009

Note: I’m not endorsing drinking in any way as a way of achieving a heightened sense of being.  As always, never drink and drive or set a bad example for your kids.  I don’t claim to have the G-variant gene.  This is only a post comparing what they found with some strange feelings I’ve encountered in my life.

I’ve known about this G-variant gene for years.  I always called it beer equilibrium and never knew there was an official study pertaining to it.  Amazing the things that universities spend money on.

Beer equilibrium is that place after drinking x number of beers where you achieve flow.  Flow does not require alcohol to be reached however.  Flow is very common in the programming world when a programmer becomes so engrossed in what he’s working on that the rest of the world around him ceases to exist.  There is only the problem, and all the intricate possibilities are clear.

I’ve achieved the programming flow sober and alcohol induced.  Most of Pit was coded by me sitting in a hotel room after a few beers.  Yeah, it may be crap code, but the bits flew from my fingers and everything was clear.

Flow is that feeling of playing Civilization until 3am and not being able to recall the last 4 hours going by.  There is only you and the problem at hand, the rest of the world dissolves away.

The other most prominent flows that I’ve achieved of the beer equilibrium (BE) flavor is while playing pool or golf.  A certain amount of beer consumed does something to relax me enough that the club becomes the extension that it’s supposed to be.  Drives, chips, everything just happen the way they’re supposed to.  The tricky part with BE, is maintaining it.  Consume too much and the golf game returns to the craptastic game it normally is.  It’s a fine line (as eluded to in the article) between being in the creative state and going over the edge to the tired side.

Flow is an awesome state of being, the sober version even more so than BE.  If I can ever get my ducks in a row here at home, I hope to achieve some programming flow on some personal projects.

Write in C

March 6, 2009

While I don’t know if I necessarily agree with the choice of language, I still recommend watching this quick before the record industry shuts it down with their greedy claws.

V-day and code tinkering

March 2, 2009

The year has been flying past so far.  Here’s some catchup.

We had a very nice Valentine’s Day here.  The amazing wifal unit had a pretty cool gift awaiting me on the table when I woke up.  In one of those clear plastic box like thingies that roses come, were six(!) bottles of Bell’s Hopslam lying ever so gently on a bed of peanuts.  There were six there, but there was another six hidden in the garage.  What an amazing women!

We had some shopping to do that day and ate an early supper at Applebee’s.  The FloydWing’s don’t normally partake of dessert when eating out but we decided to splurge given the day.  We let the girlywogs get an ice cream float and we got this triple chocolate thing that came with ice cream on the side.  This thing was to die for!  It was a brownie-like piece of cake (I don’t normally care for brownies), covered in a chocolate sauce, that had some other kind of chocolate caramel sauce hidden inside it.  And it was warm.  If anyone was watching us eat this thing, they probably thought something was going on under the table.  It was so good!  I’d recommend you save room the next time you’re at Applebee’s.

I took President’s Day off since the girlywogs were off.  It was a pretty good day.  I got up at my normal work time to get some personal development time in.  I played around with the Spring Integration tutorial that talked about in an earlier post.  I’m still trying to figure out how the heck step 10 worked.  I made the Gateway interface, referenced it in the config.  There was no class that implemented the interface, but somehow it still worked.  Blows my mind.  I’m gonna need some additional exploration with that.  I’ve found another tutorial that I hope to go through soon.

I also started some work on an idea I’ve had for years.  I’ll devote a whole post to that someday.  Needless to say I used part of the Google Collections Library to make reading a file as simple as stepping through a list.  This article shows how to use the AbstractIterator from the library to wrap a Reader and step through a file line by line.  Some pretty cool stuff.