Fork me on Github s

Automatically keep your local git repos clean

Most developers using git are probably aware of a command ‘git gc’ that has to be run from time to time when you notice your git commands are running a little slow. This command cleans up your git repo and makes sure everything is nice and tidy. If you have not run this command lately, you will notice a huge performance increase in your git commands after running. It’s a bit annoying to have to run this command when you notice that your git performance is suffering. The command also takes a while if you have not run it recently. With this in mind, I decided to create a method to automatically run this command from time to time. So I decided to overload cd similar to how rvm does. All you have to do is paste the method in your .profile file and it will run the command every time you enter a directory with a git repo.

Here it is in all it’s glory.

Tags:

No Comments

Java State Enum

I created a gist that contains a simple enum with all the States in it. Should be a good starting point for anyone that needs it.

No Comments

Spring Roo Database Reverse Engineer with Oracle

So you are trying to reverse engineer an Oracle database with roo?

Unfortunately, due to licensing restrictions with the Oracle JDBC Drivers, this is a little difficult. There are a few blog posts and forum threads that address the problem but I figured I would post what worked for me here.

First, you need to download the appropriate Oracle Drivers from Oracle. The required login, stringent password requirements, nosy registration form, and general system instability made this a pretty painful step for me. I’d also like to say that companies that have password requirements that don’t allow symbols (or any other non-standard requirement) have a special place in my heart. Having to recover my password every time I go to your site virtually guarantees I will only go there when I absolutely have to (not often). Anyways, once you have it downloaded you need to install is with maven:

mvn install:install-file -Dfile=~/Downloads/ojdbc6.jar -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0.3 -Dpackaging=jar -DgeneratePom=true

Here comes the fun part. You need to create an osgi wrapper for the driver to install it in roo. Otherwise, roo cannot see the driver. Create a new folder and put the contents of the oracle roo addon pom gist I created. Now build it with maven. You may want to change some of the artifact ids and dependencies for your particular situation.

mvn package

No open a roo shell and execute the following command:

osgi install --url file:///Users/me/my-osgi-project/target/the-jar-it-built.jar

Now run (in roo):

jpa setup --provider HIBERNATE --database ORACLE 
dependency remove --groupId com.oracle --artifactId ojdbc14 --version 10.2.0.2
dependency add --groupId com.oracle --artifactId ojdbc6 --version 11.2.0.3
database properties set --key database.driverClassName --value oracle.jdbc.OracleDriver
database properties set --key database.url --value jdbc:oracle:thin:@%YOUR_CONNECTION_INFO%
database properties set --key database.username --value %YOUR_USERNAME%
database properties set --key database.password --value %YOUR_PASSWORD%
database reverse engineer --schema %YOUR_SCHEMA% --package ~.domain

If you have any package loading exceptions when running the reverse engineer command you can uninstall the osgi bundle, set the package to optional in the osgi pom in the IncludedPackages tag (javax.some.package.*;resolution:=optional) rebuild, then reinstall in roo.

Tags: , , ,

4 Comments

My 2012 Professional Development Goals

Once again I am going to declare some professional goals for my upcoming year.

  1. Convert my blog to Jekyll hosted on github – I am tired of wordpress, tired of spam, and would like to try something new.  I have already started on this.  Just need to finish it up.
  2. Launch my GWT / Google App Engine application – I am currently developing a GWT application to be deployed to Google App Engine.
  3. Do another presentation at the user group – At least a few lightning talks.  I have a few ideas.
  4. Attend a tech conference – Dev Nexus is the likely target
  5. Post more often – I did 10 posts last year, would like to maybe double that next year (including this one)
  6. Attend a user group meeting outside of Nashville JUG – A rollover from last year, I will probably be regularly attend the Interactive Developers meeting
  7. Study another language – I have been thinking about looking in to Dart or perhaps Go
  8. Launch an Android app – Another holdover from last year I am thinking of doing a small app having to do with managing the silent state of the phone

Tags: , , , ,

3 Comments

2011 Tech Goal Review

A year ago I wrote a post listing my professional goals for 2011.  I thought I would review them and see how I did.

  1. Release an Android app to the marketplace – Didn’t do it.  In fact, haven’t really touched Android much since I wrote that.  I still have some ideas but am not sure if I will get around to it.
  2. Contribute free software to the community – I did do this.  I have been collaborating with others via github more lately.
  3. Regularly attend a user group meetings outside of Java – Did not do this.  Family life being what it is makes this not that much of a priority right now.
  4. Obtain the Oracle Certified Web Developer Certification – Did not do this.  This is not much of a priority to me any more.
  5. Learn scala – I am about 50/50 on this one.  I read a few scala books but did not write an actual application.
  6. Write an app using JSF – Did not do this.  Still interested.
  7. Present at a user group meeting – I did a Maven presentation at the Java user group.
  8. Use git more, and more effectively – Definitely did this.  Using it on a daily basis now.

Overall, I got about halfway on my goals.  It’s not too bad since I did do a few things that weren’t on my list.

  1. Learned to develop applications using GWT and deploy them to Google App Engine
  2. Converted one of my sites from PHP to Ruby / Sinatra (learning to use it in the process)
  3. Studied up on the HTML 5 features and did a lot of Javascript development

Tags: , , ,

No Comments

SubCut Scala Dependency Injection Framework

It’s no secret I am a fan of dependency injection.  So I was happy to hear that Dick Wall of the Java Posse recently released a dependency injection framework for scala.  Called SubCut, or Scala Uniquely Bound Classes Under Traits, the project is a ‘mix of service locator and dependency injection patterns designed to provide an idiomatic way of providing configured dependencies to scala applications’.

It’s hosted on github, so ‘git’ (rimshot) over there and try it out:

Dependency injection framework for Scala

Tags: ,

No Comments

iOS 5 New Features vs Android

Browsing through the iOS 5 features list, I can’t help but notice a lot of it is catch up. Having owned both an iPhone and an Android for a considerable amount of time, I figured I would jot down my opinions.

  • Notification Center – Completely ripped off from Android but looks good and is a much needed addition
  • iMessage – This is very interesting as most people who would think it’s cool, probably really wouldn’t understand the significance.  Basically, Apple is adding an IM application to iOS.  Now iPhone / iPad users can sit around messaging each other how cool it is like Crackberry users circa 2003.  I guess the only real improvement over MMS is that you can easily setup groups, see when each other are typing, and don’t incur text messaging charges; at the expense of leaving your non-iOS buddies out (who wants to talk to those losers anyways?).
  • Newstand – An app update and not an OS one (Apple typically doesn’t make distinctions).  It all seems like stuff my current Nook stuff will do.  Note: I did look to compare prices but it seems that information is not available without downloading iTunes.  lame.
  • Reminders – TODO lists are ho hum, but the ability to have reminders when you arrive or leave a position is pretty cool.
  • Twitter integration – The fact that the best Apple can come up with is ‘one at a timing’ online service integration is laughable at best.
  • Camera – Can control it from the lock screen.  Now you’ll have tons of pocket lint photos in your iCloud to go along with the wicked shot of that cheetah that just unexpectedly ran by your apartment.
  • Photos – Speaking of iCloud, all of your devices photos will be synced through it.  That’s cool I guess, not sure if Android will do the same.
  • Safari – What?  You haven’t been reading rss feeds on your device this whole time?  Something tells me you aren’t about to start.
  • PC Free – Finely Apple untethers the iPhone.  What took them so long?
  • Game Center – This should be an interesting service.  Attention Apple fanboys immediately forget how they are blatantly copying Microsoft achievements (at least rename them).
  • Wifi Sync – Just couldn’t cut the cord completely could they?  For what it’s worth, the Zune has been doing this for 5 years now.

All in all a pretty big update.  Mostly iCloud.  Mostly keeping up the mobile status quo.  As an Android user, I can’t say there is anything I am envious of.

Tags: , , ,

No Comments

I want to run an agile project

The plight of an agile project.

Tags: ,

1 Comment

Strict Pomodoro and other time management Chrome extensions

I have recently begun using the Pomodoro Technique to increase my productivity. However, I still find myself getting sucked in to the vortex of useless information that is the internet. With that in mind I began searching for a useful chrome extension to replace the Android Pomodoro app I have been using to manage my ‘doros. I even considered writing it myself. Luckily, I stumbled on one that had a similar featureset to what I was looking for.

Strict Pomodoro is an excellent Chrome extension for practicing Pomodoro. Though lacking a few key features, such as the ability to set the duration of your pomodoros and breaks, it still has a key feature that helps me stay on task. It blocks time sucking websites. You can set filter lists and it will keep you from accessing them during a Pomodoro. Effectively reminding you to stay on task. Also, the author readily admits that it was quickly put together and new features may be added down the road. For now, it is still an excellent option.

For those of you who do not practice Pomodoro but are trying to stay on task. The StayFocusd extension will effectively manage the amount of time you spend on useless (non-productive) sites. It also has a rich feature set that may be better for your work habits.

OK, breaks over. Time to get back to work. 25 minutes at a time.

Tags: , , ,

No Comments

Host your own private git repository via SSH

If you are like me you have tons of projects you would like to keep private but track with git, but do not want to pay a git host for a private plan. One of the problems is that most hosts scale their plans by project instead of users. Luckily, it is easy to host your own git repositories on any el cheapo host that provides ssh access.

In the interest of full disclosure, I learned this trick from this blog post. I decided to recreate it in case the source material vanishes for some reason.

To setup your host, login via ssh and run the following commands:

mkdir ~/git/yourprojectname.git
cd ~/git/yourprojectname.git
git --bare init

Then in your project directory (on your local machine):

# setup your user info
git config --global user.name "Firstname Lastname"
git config --global user.email "your_email@youremail.com"

# initialize the workspace
git init
git add .
git commit -m "initial commit"
git remote add origin ssh://youruser@yourhost.com/~/git/yourprojectname.git
git push origin master

It’s that easy!

To keep from entering your password every time add your public key to the server:

Generate your key with ‘ssh-keygen -t rsa‘ on your local machine.  Then add the contents of the generated file to ~/.ssh/authorized_keys on your server.

Tags: ,

4 Comments