Posts Tagged ‘Programming’

JPA

Wednesday, October 14th, 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.

On this day…

  • 2007: Catch-up 1 — Let’s try to kill a few of these.

    Birthday Money
    I got something like $60-65 for my birthday. While it’s probably [...]

Thoughts of recent yesterdays

Wednesday, August 26th, 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

On this day…

  • 2007: Blog Frustration — I decided to write a post through the web interface to this blog. It was a longer post that [...]

Programming I’ve been up to

Friday, August 7th, 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.

On this day…

No other posts on this day.

Josephus’ Circle of Doom or “links of the day”

Thursday, July 30th, 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.

On this day…

  • 2008: The Shirt — I forgot to mention.  Saturday, after having already made one trip and frustratingly realizing the need for more trips, I [...]

Beer equilibrium and flow

Tuesday, May 12th, 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.

On this day…

  • 2005: Blogging ToDo List — Talk about poker night
    Latest after action report of my B-17 campaign
    Talk about the work wing-off I’m cooking in this weekend
    Talk [...]

Blog overload

Thursday, February 12th, 2009

I’m watching the Wings and reflecting on my past week.  It’s been busy but I’ve always had some time each evening to get on the laptop.  I always end up reading blog posts in Reader.  I always have this (beautiful goal from Hossa to Hudler just happened.  WOW!) plan to do a little programming and learning, but it never happens.  I’ve decided that I subscribe to far too many blogs.  They distract me from doing anything else.  I’ve seemed to have a drive this week to get my unread count low, but what I really should do is just start unsubscribing.  I don’t know from what though.  I subscribe to a range of different programming blogs, from Java to .Net to Groovy to pure architectural discussion blogs.  And I’m adding more all the time.

Most of the blogs are technical in nature, but I have boardgaming, hockey, and others that I’ve accumulated along the way.  I’ve starred so many posts that I want to come back to someday (learning Groovy for instance).  I’m paralyzed.

I think part of the problem is I don’t know how to go about learning Groovy.  I haven’t purchased a book yet and haven’t found something online that seems like it would be fun to follow.  The other problem is my age old problem.  I haven’t been inspired with a project idea that really excites me and holds my attention, even to just get something going in Java.  When time does present itself, I usually put myself in some other activity that keeps me from putting my attention to it.

Does anybody have any techniques they use for avoiding this form of procrastination and to focus and commit?

On this day…

  • 2009: Weekend flowed from crap to great — Last weekend started off quite crappy, but got significantly better.
    Friday was a double whammy.  It was finally discovered what the [...]

Leaves of Wonder

Monday, November 24th, 2008

So it would appear that those few Wolverine fans that frequent this blog from time to time were too embarrassed to even declare their allegiance. So this first installment of the FloydWing Big Game Fan Poll goes to the Buckeye Fans 2-0.  I’m bummed I didn’t even get to cast a tie breaking vote.

So I spent the weekend finally working on the last dump of leaves in the yard.  Rain, sickness, rain, and time change conspired to put me way behind.  I had been caught up before that.  I got a little over half of the back yard piled and had bagged 9 big bags of the stuff, hardly making a dent from the pile.  The rest of the backyard and front still waited to be piled up.  A neighbor stopped by and talked me into just having one of the local yard services come and pile and remove the leaves.  He had used to do it, but since decided it’s just not worth it anymore, and pretty much the rest of the neighborhood has converted to that also.  Hopefully, this late in the season, I can find a discount from someone looking for a little extra Christmas money.

I’m hoping to start some more posts in the same vein as my Part-Time Developer series over the next couple of months.  No, this doesn’t mean I’m looking for another job, it’s just that I’m starting to equip my laptop and desktop with the newest Java development tools.  I hope to start a new tinkering project and hope to be able to involve you readers with next to no time commitment.  I should go back over those old posts and see if I can properly format the code, especially since I just upgraded.

I don’t know if I should keep the same name or come up with something new.  I am a full time developer now, so perhaps the part time title could refer to my hobbyist pursuits.  If anybody has any thoughts, please post them.  Hopefully, in the next couple weeks I can make an initial post talking about the tools I’m going to use for my tinkering and take any suggestions of other good tools to play around with.

I’ve still found nothing about the “accented A” problem, so it’s looking like that will just be a crappy artifact.  I don’t think I’m keen to sit and manually edit every post.

Good news for Pit.  I have a copy of Visual Studio 2005 so I should be able to install that and work with the current codebase.  However, the bad news is I don’t know where my CDs are that I copied everything off to are.  I copied the Pit codebase, site backup, and everything to a CD or two and I don’t know where they are.  I believe I also have the important stuff on a USB key so disaster isn’t yet imminent.  As far as when season 8 will start, that’s still up in the air.  We’ll have a few things to sort out.  I’ll make a post here when it’s time to start paying attention to the forums.

I miss my MacBook Pro something fierce.  My old HP just isn’t doing it for me.  It seems so blocky, nothing like the sleekness of my Mac.  Development was such a joy, being able to drop to the command line at a moments notice.  I feel so hampered by Windows.  One of the biggest things I miss, is being able to have multiple desktop windows set up (I would have 4), and being able to put running apps in different ones.  So I could have my email and browser in one, Eclipse in another, command line access in a different one, and the fourth for whatever else.  Plus doing the cube rotation switch between them was always so elegant.  I figure it’s been a while since I gave Sixftunda something to razz me about, so this paragraph is dedicated to him.  :)

On this day…

Programming as a game

Tuesday, April 22nd, 2008

I think there’s been a few games in my time where the game consists of actually doing some sort of programming.  Most would involve combat in some way.  The first I probably encountered was on the MoleMan’s Atari ST called Omega.  You had to provide the logic for how your tank would behave.  You could make it as simple or as complicated as you wanted.  You could make a tank that randomly drove around and randomly fired it’s cannon.  Or you could have routines that would actively use it’s scanner to seek other tanks and how it would behave if it got hit.  You would then throw that tank at game provided tanks or tanks that your friends created.  I never made a tank of my own.  It sounded neat to me, but I couldn’t see taking the time.  I figured it would be a bit frustrating.  Kind of funny considering that’s what I used to do for a living and would like to get back to doing.

This blog post by Jeff Atwood is what reminded me of these types of games.  I’ve heard of Java Robots which is meant as programmer entertainment and as a learning tool for newer programmers.  I should take a look at it and see what it would be like for a total newb and maybe use it to teach my oldest programming.

I’ve often thought of creating some sort of game where the players would select predefined logic for their sport players or provide their own.  Just another one of those plethora of ideas that roll around in my head, making me what I am.

On this day…

No other posts on this day.

I get to go to a conference!

Friday, January 4th, 2008

CodeMash €“ I'll be there!

Next week I’ll be making the trek to Sandusky to attend CodeMash. I think it’s great that we have a convention this close with this caliber of speakers that this one does. These are the sort of technologies that I’ve wanted to be involved in during my daily work, but seem destined to continue to elude me. No matter what I try I’m still stuck in crap dark age technology. BUT, at least I’m getting to attend something like this. This is the first event like this that I’ll be attending that deals with newer software development practices and tools since I attended a Microsoft DevDays years ago, back at the time Biztalk was going to be such a huge thing but now you hardly hear about it.

CodeMash looks like a mixture .NET/Java, Microsoft/Open source, etc. I think the concept sounds really cool. We’re all developers with the same problems, so what can we learn from the other guy. I know I’m tired of hearing the .NET’ers bashing the Java and Open Source’ers and vice versa. Nothing turns me off more to a blog or podcast than when the people throw out a blatant slam against the other side of the fence. I like to think I’ve moved beyond that. While I’m not a Microsoft fan boy by any stretch of the imagination (they continue to annoy me with every new move they make), I can appreciate how easy they make things work together. And while I do see C# as the next logical step down the C++ road, Java is probably still my favorite language. I’ve gone back and forth through the years and have reached that happy medium where I just want things to work and be able to do it in an easy way.

Looking over the session schedule, I see I’m going to have to make some sacrifices. There are a lot of conflicts between things that sound interesting to me. Just looking at the speakers, I know I want to attend one of Dick Wall’s (I listen to him on the Java Posse podcast), and Bruce Eckel (he’s helped me with his Thinking in C++ and Thinking in Java books). I’m also excited about getting to see Scott Hanselman (I listen to him on the Hanselminutes podcast). I’ve been hearing such gushing about Scala on the Java Posse and everywhere I turn I hear Ruby and Rails mentioned that I’d like to make something on those. Then there’s all the different development methodologies that are the rave these days, I definitely want to make something on Agile Development. I’m a proponent of pair-programming, having found great productivity doing it in DEC Fortran (scary, I know) thought I haven’t gotten to do much of it since. I’m also interested in test driven development and mocking.

All that choice is good though. But it will cause me some sleepless nights trying to make sure I get a good sampling of everything. :) Here’s my tentative schedule, but this is subject to change at my whim or panic. Warning: this uses Silverlight so you may need to download something. I’m seeing I’m a little light on .NET, so I’d like to pick up one or two more .NET topics.

Also, hopefully I’ll be able to come out of my normal reserved shell a little and make some good contacts.  I’m a shy person at heart, so this will be a toughie.

On this day…

  • 2009: 2008: Year in review — This post and the eventual resolutions post are very boringly the normal posts that most blogs do.  But it does [...]
  • 2007: Old Books and such — In response to my recent post chronicaling my old role playing days, my buddy Sixftunda posted his rememberances of the [...]
  • 2005: Back At It — Inclement weather pep talk