Thursday, November 08, 2007

Switching to my MacBook Pro for fulltime use

Finally have time to setup my laptop (MacBook Pro) for development after upgrading to Leopard (OS X 10.5) this week.

Fink or Macports?
In setting up Postgresql, I found several helpful links on the web for installing it but I found some used fink and some used 'port' (macports). I'm pretty sure these two packaging systems provide the same functionality but is there a preference for one? Is one more up-to-date than the other?

Where the hell are my configuration files for postgresql? I'm trying to confirm what port (s/b 5432) it's running on and also make sure it's enabled for remote connections.

Leopard is great so far. I'm finding the Spaces (virtual desktop) extremely productive for grouping applications on different desktops. Even with my 24" lcd, having this is a lifesaver as it keeps each desktop less cluttered when I'm running everything under the sun (remote desktop to my XP box, vmware fusion for those must have apps, numerous terminals, iChat/adium, safari/firefox, etc).

I bought the Apple wireless keyboard (thanks Scotty G) and started using it last night. This thing is sexy but I'm not sure I like having it so small. Size does matter! Also, I really really wish it had a numeric keypad. I knew it didn't beforehand but figured I'd rather live without it then have to buy a Logitech wireless package.


Just need to bump my ram up to 4gb now and this thing will be rocking.

Wednesday, August 29, 2007

Suggestions for BT Keyboard/trackpad?

Finally got my MacBook Pro 15" last night (more about that later).

I'm looking for a Bluetooth keyboard+track pad that will work with all of my PC, MBP and PS3. Does anyone have any suggestions?

Monday, July 30, 2007

*This* close to buying my Macbook Pro

I've been waiting to buy my new laptop for a couple of months now as lately I've been wondering if I wanted the 17" or the 15".

The decision was hard as I wanted the 17" for the high resolution (1920x1200) but the backlit LED display of the 15" was also very tempting. My wait was mostly due to waiting, "ok, I'll just wait for the 17" to get updated with LED display".

So I found myself at the mall yesterday and I went to the Apple store to really compare the 17" vs 15" in size and see if the 17" was too big or not. Yeah it was a monster and heavier to boot.....but but...that sweet resolution. After alot of deliberation, I figured that I didn't need the high res when I was using it on my lap (in a mobile situation) and that if I was going to be in power use mode, I would probably be sitting at my desk and I would just attach it to my Dell 2407. Ok, done!! Decision made, 15"...flag down an Apple dude and ring up the order.

"So, how long does it take for you to build my machine if I want it with custom options?"
"Oh, only 10mins sir."
"WOW!!! Are you kidding? TEN MINUTES?!?! Great, let's do this *whipping out my debit card*"

After getting my name and email addr, he says, "ok, take this card to the tech and he'll get your new MBP"

"Wait, I didn't even pick my options yet. I want a faster hdd"

"Oh you can't do that here, we only upgrade ram"

"Doh!! Nooooooooooo....so I can't have my MBP today?"

"Sorry, if you want to upgrade the hdd, you'll have to order it online and they'll have it sent to you within 2 weeks".

So from ecstatic to despair, I walked out of the store with my head bowed down like my 3yr old son walking out of Toys R Us after I refused to buy him another Thomas the Train engine.


For you MBP owners. Is ram from Apple still overpriced? I did a quick look on Crucial and it seems alot cheaper but the sales associate said that Apple was competitive now. I'm looking to get 2x2gb

Secondly, is it possible for me to buy a 2.5" 7200rpm hdd myself and perform the upgrade? If so, then I'd probably be ahead as I'd have the orig hdd as spare which I can throw in an ext hdd enclosure. I'd also be able to head back to the store this week to pick the laptop up.

Oh and is it true that for people who will look at the screen for long periods of time, get the matte display and avoid the high gloss option?

Friday, May 18, 2007

Exception handling and clutter log files

Ran across this in a client's today

try {...}
catch (Exception ex) {
LOGGER.error("updateDropShipPriceOnImport()", ex);
throw ex;
}

Now, why would you log the error only to rethrow it? I'd assume that if you're rethrowing it, something else is/should catch this and handle/log it. So then isn't this just unnecessary logging?

Tuesday, May 08, 2007

So you want to boycott the gas stations?

I'm sure you've received the chain letters complaining about the high cost of gasoline, asking us to all band together and not buy gas on a certain day. This is supposed to put a dent in the gas companies pockets. Kind of a "show 'em we're pissed and aren't going to take this lying down" type of action.

*LOL* It's not going to work.

If I were the gas company, you know what I'd do? I'd jack the price of gas up another 20% the day after this boycott. Ha! Jokes on us now isn't it?

There really isn't much we can do about it. The only people who can change it are the governments and they are clearly being paid off by the oil companies to do nothing.

If the cost of gas is really getting to you, re-evaluate your lifestyle and change it so you don't require as much gas.

Monday, April 09, 2007

Amazing week of poker results

Played a bit of poker this weekend and had some excellent results. What's funny is I basically took a week hiatus from the tournaments to work on something, so when I played these 2 tournaments it was basically a "what the hell I haven't played in such a long time, let's treat myself to a tournament with higher entry fee (fewer ppl and bigger prizes)"

Full Tilt Poker $12.5k guarantee, placed 2nd.
Poker Stars Sunday Millions, placed 266th (out of over 6600 players)

Earlier in the week, I also crushed my boys in our weekly home game to cap off an extremely profitable week and an awesome start to the month. Essentially quintupled my bankroll.

Saturday, March 24, 2007

Redhat's head getting too big for it's own hat

Looks like Redhat is putting down it's foot and trying to impose trademark laws to stop people/companies from using it's licenced trademarks such as Hibernate, etc. in advertising their services.

Read Ted Neward's post on it for more details here

Most interesting is this quote:
Although you may offer object
oriented relational database mapping training, you may not use the Hibernate name to promote and advertise your products and services.


So I guess we need to remove any references to their products from our curriculum vitae.

Look like JBoss is having a bit of influence over at Redhat headquarters since the buyout.


I hope the entire open source and developer communities stand up and stop supporting any of Redhat's products. Stop recommending it your organizations, stop submitting patches for their software.

Tuesday, March 13, 2007

Comments on "How to use Java at a Startup"

Kurt Williams has done a very good writeup of things a startup company should considering when choosing development environments. You can read his blog here

I agree with most of what Kurt says but there is one thing that I would mention.

"Sure it's great for rapid Web development. But what about next year when you need to build a GUI?"

I find that a lot of overly complex solutions are designed/built on the basis of this argument. The counter-argument is that doing something in a quick time frame (ala RoR) and only concentrating on what you actually need now, provide immense benefits in time and cost. But more important is that it's hard to forecast your system's longterm needs so why invest time up front on features that may may never materialize? This may sound ignorant but I think that more often than not, we design/plan/develop to support things that we may need but never end up needing it. What's worse is when you've properly accounted for something but the business requirements have changed so much that you end up doing a major rewrite anyways.

For a startup, speed to market is of essence I imagine. Wouldn't it make sense to get your product out as quick as possible and when it takes off or you get that injection of VC, to then go back and revamp it properly?

I'm not a Ruby fan boy but I have been contemplating the choice of development environment for an upcoming project that Kurt's very post addresses.

Thursday, March 08, 2007

Custom content for Sony's PlayStation Home?

Yesterday at the GDC, Sony announced their PS3 killer-app called "PlayStation Home".

You can see the demo here

Anyone have any developer details about this project? I have some ideas for content within the Home universe and would like to get details on how open this environment is to 3rd party content providers.

Can someone point me to an appropriate place to look/ask?

Tuesday, January 02, 2007

Can you externalize Sitemesh layouts?

Let's say your organization has multiple web-apps running and they all currently share the same layout/style. Being the good little developer that you are, you are using CSS to separate the content from style and something like Sitemesh to aid in your layout.

But what if you decide you want to change the layout of all the company's applications? This would entail modifying each application's individual Sitemesh configuration (decorator) and redeploying. Wouldn't it be cool if the Sitemesh wasn't tightly coupled to your webapp and could be accessed from an external source? Wouldn't it be a godsend if you simply had to modify that one Sitemesh configuration and have all the referring applications pick up the changes dynamically (without even redeploying)?

Has anyone ever given any thought to this? Is it possible with the current implementation of Sitemesh?

What I'm shooting for is a global CSS stylesheet stored outside of the webapp's context to enforce a global style for the company's applications, and a "one Sitemesh to rule them all" configuration.

Suggestions/comments?

Tuesday, December 19, 2006

I'll trade you a nuke

Today North Korea proclaimed itself a nuclear power and
made demands that U.N. sanctions against it be lifted and
also that they be provided with a light water nuclear power
reactor.

If you're the U.N. or Washington, how can you give in to these
demands? You give them the reactor and they dismantle
their warheads. Next year, they'll restart the nuclear program
again and demand HBO and all the stray dogs in our pounds.

The thing that puzzles me is, is it that much more difficult to
build a "nuclear power reactor" than it is to build a nuclear
weapon?

Thursday, December 14, 2006

Drip...drip...drip

Am I the only person who can't stand the fact that the cup/covers
used by Tim Horton's are horribly designed and have this drip
feature built in for the sole purpose of driving me insane?

Go buy a cup of Tim Horton's coffee. While carrying your cup
of coffee, if you've moved ever so slightly, the coffee will start
to drip somewhere beneath the lid. I wipe it off hoping it's just
an aberration but a few seconds later, there it is again.

Tim Horton's sells the most coffee in Canada. They are making
a fortune. Is it too much to ask that they get rid of those shitty
lids and use ones that don't drip all over my car's console or
all over my desk??

My guess is the problem is a combination of a poor lid design
and the curled lip of the cup itself. If you have sloshed the
coffee around in the cup, the coffee hits the lid and hangs there,
eventually finding it's way to the edge (it it hasn't dripped back
into the cup). Somehow the curled edge of the cup doesn't form
a very good seal with the lid and the coffee finds it way between
the lip and cup's edge, and you have your drip.

If you've experienced the drip, please add a comment and
hopefully we'll initiate some change.

Thursday, November 09, 2006

Need Macbook advice

My 1.25Ghz w/ 1Gb ram, G4 Powerbook is getting a bit long in the tooth.

More infuriating is how often the spinning beachball
halts my work. Quie often, I have nothing other than
Safari open with like 7 tabs and I'll get the beachball.

So I'm looking at upgrading to either a Macbook or Macbook Pro.

I have a few questions that maybe some of you developers can
help with.

1. What's the battery life comparison between these two? My
PB rarely gave me more than 2hrs. I recall the G4 iBooks were
alot better. Is the battery life better in either the MB or MBP?
Yes I know the specs say up to 6hrs for MB and up to 5hrs for
MBP, but in your real life experience, please let me know what
to expect.

2. For watching movies, DVD's and doing development work; I
probably don't need the 256Mb video card option do I? No
I won't play games on this and Photoshop work is minimal.

3. Is it true the current Core 2 Duo cpu's are crippled
somewhat because the chipset on the logic board only runs at
667Mhz. I hear the next chipset, Santa Rosa, should run at
800Mhz and be out early next year. How much performance
improvement can one expect from this.


I think I'm pretty much decided on getting the MBP if I do
decide to buy one now. Simply for the higher resolution. This
is one thing I've always hated on the Apple laptops, very
limited resolutions compared to PC laptops.

Thanks

Wednesday, November 08, 2006

Java code snippets

So I started a new contract recently and as I spent the first week reading documentation and going over the existing application's code, I saw something that wasn't wrong but it did catch my attention.

Do you see the difference between these two conditions?

String country = form.getCountry();
if (country.equals(Constants.USA)) {...}

and...

String country = form.getCountry();
if (Constants.USA.equals(country)) {...}


The first sample is safer as you do not run the risk of getting a NullPointerException.

It's always nice to have the time to simply read other people's code and pick up on these kind of small things. One reason why code reviews are so valuable when done correctly (unfortunately it's hard to justify the cost to the organization and most places don't provision for it).

Is the Software Piracy situation really that bad?

We read about it all the time in the media. We read about software piracy rings getting busted and then the claims from the BSA or software companies of how many hundreds of millions of dollars were lost.

I'm not going to get into the whole "well they would never have purchased it anyway" argument.

I simply want to ask a question that begs to be asked. We hear the companies scream and cry murder when it comes to the losses they experience from file-sharing, software piracy, etc but does anyone ever pause for one second to a good look at those companies and sympathize with them?

What I'm trying to say is, I don't see many of these companies going bankrupt. What I do see are ever increasing budgets (ever see how much it costs to develop a blockbuster videogame). You'd be hard pressed to convince me of their pity when it's obvious their revenues and profits are still excellent, all in light of the hundreds of millions (if not billions) of dollars lost to pirated software/music/movies.

It's like listening to the guy driving a Ferrari cry about the amount of taxes he pays. Pass me my violin and lend me a handkerchief please.

I don't advocate software piracy but it does bother me the way the media portrays the problem to the public. Even worse is the way the courts treat these offenders, sentencing them to prison terms that would make a murder/rapist/drug dealer thank their lucky stars.

I don't advocate it, but I sure as hell don't sympathize with their pleas.

Thursday, April 27, 2006

Thank god for Beverly Hills:90210

Ever come across a website that think's the United States of America is the only country in the world? You know the ones where they present a form with a zipcode field. I don't mind it the label "Zip Code", but it's the validation that bugs me. Some sites are kind enough to not validate the field and allow me to input my Canadian postal code, but then there those dweebs who write validation logic that applies to USA zip codes only.

Well thank the lord that I used to watch Brenda, Brandon, Kelly, Donna and Dylan on 90120. Without it, I'd never have a valid US zip code forged in my mind that I can use to fool those myopic websites.

Wednesday, March 29, 2006

Java based open source CMS portals

Spent a bit of time tonight looking at Java based CMS portals for an upcoming project. The ones I looked at briefly were

Jetnuke
Atleap
OpenCMS

We're basically looking for a CMS that we can customize and enhance through development. Our initial evaluations don't include any PHP based ones because PHP isn't our forte (yes you don't have to tell me that the CMS/Portal market is dominated by PHP products). In short our requirements include forums, news, blogs.


Jetnuke:
This is a port of PHP-Nuke done using Velocity. Jetnuke seems to have alot of of modules which is a big plus. Maybe I'm biased but I'm not really keen on taking on a Velocity project, Velocity seems to have lost it's steam and barely gets mention nowadays. Couldn't find any evidence that jetnuke supports skins/themes (hopefully using CSS) which is a requirement for us. Jetnuke does include a blog module.


Atleap:
This CMS intrigued me the most as it was developed using AppFuse and the technology stack is chock full of goodies: Struts, Spring, Hibernate, Acegi, Tiles, etc. I'm not excited about the Struts+Tiles usage but beggars can't be choosers right? There was a screenshot which I looked at and assuming my assumptions are correct, it does support themes/layouts in some sense. The site itself isn't very polished IMO but that can be worked on. Don't see any blog module though.


OpenCMS:
This project had no screenshots that I could find on their site so I had no choice but to download and install it for a quick look-see. The installation was easy enough, simply drop a war in Tomcat and follow a setup wizard. Not so fast. I chose a full installation and as it proceeded to deploy the CMS, I noticed it was unzipping alot of files. A quick look at the opencms.war file shows they embed ALOT of zip files for each module/subsytem of the CMS. No problem I say, so I let the installation run it's course. 10mins...15mins...20mins...now I start bitching. Yes it's on my laptop which is a 1.25Ghz G4 Powerbook w/ 1Gb ram (not exactly a sexy MacBook Pro) but taking this long to install anything is rediculous. I was patient and let it continue. the setup wizard was nice enough to inform me at completion that it took 1:01hr to install. ONE HOUR AND ONE MINUTE!!! Are you nuts? Now obviously that's only installation and simply starting the servlet container and deploying an already installed CMS site isn't going to take that long but if we're going to do multiple installations, that's unacceptable. A whole god damn hour for christ's sake, if I was one of those raving Ruby on Rails fanboys...I'd be raving at how I could have written a CMS in RoR in that hour ;)

OpenCMS doesn't seem to have any real usable modules, every module looks the same, simply a content pane in the middle displaying information. The "job module" shows jobs. The "news module" shows news items. Does anyone from OpenCMS want to explain to me how those modules are different? Where are the forums, blogs, galleries, etc?

The only positive thing I have to say about OpenCMS so far is that the installation, although long, was flawless. It's really rare in the open source world when you can install a product and run it and not see errors, warnings, problems. So while the 6.2 is beta, it does look somewhat stable.


So far no runaway winner. I'll keep looking and make notes here. If time were an issue and I had to pick, I'd probably pick Atleap simply based on what it's been implemented on. Hard to get excited about a new project when you don't like the current implementation (talking about jetnuke+velocity).

Wednesday, March 15, 2006

Tips for new Jetty users

Redeploying my application on Tomcat 5.5.15 on my 1.25Ghz G4 Powerbook 1GB ram was getting painstakingly slow so I decided to take a look at Jetty to see if it would help the cause.

Here are two things I came across in getting started and which I couldn't find much help on Mortbay's site/wiki/docs

1. If you use Log4J in your application and get this error:

Caused by: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: No suitable Log constructor [Ljava.lang.Class;@d1c778 for org.apache.commons.logging.impl.Log4JLogger (Caused by java.lang.NoClassDefFoundError: org/apache/log4j/Category) (Caused by org.apache.commons.logging.LogConfigurationException: No suitable Log constructor [Ljava.lang.Class;@d1c778 for org.apache.commons.logging.impl.Log4JLogger (Caused by java.lang.NoClassDefFoundError: org/apache/log4j/Category))

You simply need to grab the logj4 jar file your application uses and drop it in the jetty.home/ext directory. I don't know why this necessary when the jar file itself is deployed within the webapp's WEB-INF/lib directory but it works.


2. Debugging
I got used to Tomcat's startup scripts so obviously I looked for the Jetty equivalent of 'catalina.sh jpda start' but I couldn't find anything and nary a mention of it on Google or Jetty's docs.

Well it turns out that Jetty is a java application so you can simply start it's JVM with the following standard debug options and then connect your IDE to the JVM for debugging:

java -Djava.home=$JAVA_HOME -Xdebug -Xrunjdwp:transport=dt_socket, server=y, suspend=n, address=5005 -jar start.jar



Even with a 1Gb ram, the speed of my laptop is becoming unbearable. After only 2yrs, I'm having a hard time convincing myself that I should shell out the bucks and get a MacBookPro, especially considering I built myself a AMD64 workstation within those 2yrs. I guess I'll console myself and force myself to wait for the next revision of the MBP's.

*editted to include the debug settings

Friday, March 10, 2006

Do good with your idle computer

While I've always known about SETI, it simply never really caught my interest.

But this blog entry by Onno brought to my attention some other projects that might interest you.

By downloading and installing a small program on our computers, we can make use of our computer's idle processing power. Those of us who leave our computers turned on day and night are wasting alot of computer power that could be put to good use, for the benefit of science and mankind.

Visit Berkeley's site to see a list of projects that you can participate in.

For the technically challenged; by installing this program, as long as you're connected to the internet and the computer is idle (not doing anything demanding), the program will run scientific calculations using your computer and then send the results of those calculations back to Berkeley for collation. You can help further scientific research by donating those spare cpu cycles!!

Or maybe you just want to help find aliens by joining the SETI project ;)

Admit it, leaving your computer on 24/7 to download torrents isn't really that demanding on your cpu, why not help out a good cause?

Tuesday, February 21, 2006

Equinox to the rescue

I've been trying to restart work on an application that I've shelved for a year. Doing so inevitably meant updating the stack to the latest/greatest versions of each framework; in this case it was Tapestry/Hibernate/Spring. Lucky me as all 3 have come out with major version releases since :(

It never ceases to amaze me that framework developers simply refuse to ease the learning curve of their products for newbies. Don't take that as me being ungrateful for the amount of time they spend on these projects, that's further from the truth. However, trivial stuff such as blank applications (i.e. struts-blank.war) are rarely bundled with a framework, meaning the new user is expected to RTFM and understand the entire framework simply to get to that starting point where they can learn/develop in a more logical manner.

Yes, each framework comes with it's sample applications. The value of a 'blank' application is vastly greater IMO as it's something each user needs for the start of any project. For new users, it's great to start with a blank canvas where all the underlying pieces have been put together for you and you concentrate on learning the framework by adding piece by piece.

I can't imagine the framework authors don't have such a template application lying around where they simply copy and rename it to a new directory in order to start a new project. I simply ask that you bundle that with the dist. Oh that piece of crap you say? No it's not crap, it's really useful, trust me!!!

Late last night, as I pounded my desk in frustation, after experiencing endless hours of modifying XML files, googling, scouring mailing lists...I was about to give up. My situation was so dire that my mind wandered and in a moment of weakness, I wondered aloud "maybe I should take a look at Ruby on Rails". I was so desperate to *just* start developing my application and not have to deal with these startup pains. Before I could even google for 'ror' to take a look at what the excitement is about, I looked up from my desk and glanced at the door to hear someone approaching *grandoise theme music playing here* A glowing aura basks the room as I hear the gallop of what sounds like a horse. I rubbed my weary eyes in disbelief as in strode a white knight on a brilliant white stallion, across the knight's chest was emblazoned a logo...I squint to read it as the light had completely enveloped the room. The logo says "Equinox". "Equinox?" I repeat to myself.


Equinox, http://equinox.dev.java.net is an application that creates a skeleton of an application (views, model, dao's, service layer) for a multitude of frameworks including (goto site to see full list): Struts, WebWork, Tapestry, Spring, Hibernate, iBatis. This application goes way beyond my wish for a 'blank' application as Equinox integrates each framework for you. Amazing tool for anyone starting a new project.

For you *nix people, the order of steps is important.
1. cd $equinox_home
2. ant fixcrlf
3 (optional if you want to use a different MVC framework) cd extras/tapestry
3b ant install
4 cd ../..
5 ant new (Maven will download it's dependecies and then you will be prompted for a project name).