The Dangling Pointer

Sh*t my brain says and forgets about

How Evernote Won My Time Warner Battle

If you don’t know what Evernote is, I’ll quickly summarize it for you.  Evernote is a cloud-based service that is accessible through the means of a web site, mobile and computer application and various other APIs.  The point of Evernote is that if you ever find something you want to remember – a piece of text, web page, a PDF, an image, recipe, sound bite, anything, you put it into Evernote.  Their service indexes it to make it searchable and then you forget about it until you want to find it later in life.  It’s more than that but you have to discover how it’s useful to you.

Anyway, I’ve been slowly integrating Evernote into my life.  I’ve been scanning things in like extended warranty contracts for my cars and things that I normally keep in a filing cabinet at home but would need in a pinch when I’m not at home.  Those scanned PDFs in Evernote become very useful wherever I am and now are searchable even if they are handwritten documents.

Time Warner had me in a great package deal including their digital phone, digital cable, RoadRunner and a cable box for one price.  Because of a problem two years back I was actually at the same price for over three years.  That package expired 12/31 and my bill ended up jumping up nearly $60/month which I couldn’t justify since I never use the home phone service.  I ended up going in to the nearest Time Warner store and returning their cable box and remote, which they no longer include in any package, and exchanging the cable modem for one without phone service.  The price I was quoted by their retention department for the new package was reasonable and was for two years.  I was not told it would require signing a contract and the representative was a jerk about that in the store.

Long story short, he agreed to give a year at $5 a month more.  I didn’t quite trust the guy so I had him give me a screen print of what he did showing the prices.  When I got home, I scanned it into Evernote.  A couples weeks later I discovered my bill was wrong while I was at work.  When I called in, I popped open Evernote, read off a few screen codes to the rep and she believed my story and realized I had a screen print from their system.

Goes to show taking initiative getting the screen print and using Evernote to record that data makes life easier!

CDMA / Verizon iPhone

There has been quite a bit of press about the upcoming Verizon / CDMA iPhone.  I’m happy to hear that AT&T will finally lose the monopoly on the iPhone in the United States, but I’m disappointed that nothing has come out yet about T-Mobile carrying the GMS version of the phone.  AT&T needs the competition to spread out the massive amount of users onto another network because frankly, they can’t handle the amount of growth they’ve experienced.  The iPhone is a great device, and I’ve had nothing but a positive experience for the most part with AT&T.

I’ll probably never switch from AT&T over to Verizon for the simple fact that GSM provides SIM cards, whereas CDMA does not.  I like having the option available to me to swap my SIM into a different device, like when I go camping, so that I don’t risk damaging the $400+ device when I don’t need to.  Of course, the iPhone 4’s micro-SIM provides its own unique challenges, but a simple physical adapter allows it to be used in an older traditional SIM card holder.

CDMA phones, at least in the USA, require the phone provider to activate each device and you cannot swap on a whim.  Most people could care less.  I on the other hand like being able to switch around equipment when needed, and not having to pay the provider to do it.

Hibernate 3.6.0.Final + PostgreSQL + CLOBs

I recently upgraded a project I’m working on to Hibernate 3.6.0.Final from 3.5.6 and realized that one of my entities that had a CLOB (character large object) was pooping out.  I was getting an exception stack track similar to:

Caused by: org.postgresql.util.PSQLException: Bad value for type long : <table border="0" cellspacing="0" cellpadding="0" id="productDetailLineItems"><thead><tr><td rowspan="2"><input type="hidden" name="productGroupId" id="productGroupId" value="101111"/>Item Number</td><td rowspan="2">Motor HP</td><td rowspan="2">Price</td></tr></thead><tbody><tr><form method="post" id="4581000" name="4581000" action=""><td>4581000</td><td><span style="fraction"><sup>1</sup>/<sub>2</sub></span></td><td><input type="button" onclick="javascript:addToCart('4581000');" value="$prc4581000" /></td></form></tr></tbody></table>
at org.postgresql.jdbc2.AbstractJdbc2ResultSet.toLong(AbstractJdbc2ResultSet.java:2690) [:]
at org.postgresql.jdbc2.AbstractJdbc2ResultSet.getLong(AbstractJdbc2ResultSet.java:1995) [:]
at org.postgresql.jdbc3.Jdbc3ResultSet.getClob(Jdbc3ResultSet.java:44) [:]
at org.postgresql.jdbc2.AbstractJdbc2ResultSet.getClob(AbstractJdbc2ResultSet.java:373) [:]
at org.jboss.resource.adapter.jdbc.WrappedResultSet.getClob(WrappedResultSet.java:516) [:6.0.0.Final]
at org.hibernate.type.descriptor.sql.ClobTypeDescriptor$2.doExtract(ClobTypeDescriptor.java:70) [:3.6.0.Final]
at org.hibernate.type.descriptor.sql.BasicExtractor.extract(BasicExtractor.java:64) [:3.6.0.Final]
at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:253) [:3.6.0.Final]
at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:249) [:3.6.0.Final]
at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:229) [:3.6.0.Final]
at org.hibernate.type.AbstractStandardBasicType.hydrate(AbstractStandardBasicType.java:330) [:3.6.0.Final]
at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2265) [:3.6.0.Final]
at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1527) [:3.6.0.Final]
at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1455) [:3.6.0.Final]
at org.hibernate.loader.Loader.getRow(Loader.java:1355) [:3.6.0.Final]
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:611) [:3.6.0.Final]
at org.hibernate.loader.Loader.doQuery(Loader.java:829) [:3.6.0.Final]
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274) [:3.6.0.Final]
at org.hibernate.loader.Loader.loadEntity(Loader.java:2037) [:3.6.0.Final]
... 167 more

I do local development on my MacBook Pro with PostgreSQL 9.0.2 and will point my machine at the client’s DB2 database once in a while for pushes to their development system.  When I point the system at their DB dev database, everything works fine.  Pointing back at my PostgreSQL, the entity craps out.  I tried going back to the old 8.0 driver like some people online suggested with no luck.  I hadn’t tried using this entity since I upgraded to Hibernate 3.6 because I also have been moving from OpenEJB to JBoss 6 so it could have been that as well.

Ultimately I found a simple solution.  PostgreSQL apparently doesn’t play well with Hibernate 3.6 and requires a specific Hibernate annotation on your entity (I’m using JPA entities by the way).  On your CLOB, in addition to the @Lob, add:

@Type(type="org.hibernate.type.StringClobType")

Redeploy your application and Hibernate should behave properly.

Installing MySQL 5.5.8 on Mac OS X Snow Leopard

Installing MySQL should be a no brainer on any operating system, especially with how mature of a product it is.  Apparently that assumption is incorrect.  I tried installing the most recent GA release of MySQL on my new Snow Leopard machine, and found I couldn’t start the blasted server.  I’ve become lazy the older I get – I don’t want to screw around with shell scripts, hacking this tweaking that.  If I’m provided a Mac-based installer I WANT IT TO WORK.  So, if you’re like me and are frustrated as all hell with not being able to get MySQL to start via System Preferences after installing the 64-bit version (maybe 32-bit as well), do the following:

  1. Drop into Terminal.app
  2. Type: sudo /Applications/TextEdit.app/Contents/MacOS/TextEdit /usr/local/mysql/support-files/mysql.server
  3. Find the line starting with basedir and datadir and replace with:
    basedir=/usr/local/mysql
    datadir=/usr/local/mysql/data
  4. Save the file
  5. Start MySQL using the System Preferences pane button.

I’m amazed this is the fix and that the MySQL team overlooked the configuration change in their packaging.  Very irritating.  Enjoy.

Flush THIS Hibernate!

I’ve been working with Hibernate 3.3.2 and Hibernate Search 3.1 for the past few months.  We finally got to a point in our project where we are sucking in mass amounts of data into our application from a large business application via JMS.  Suddenly, I’m getting the following errors during persistence:

org.hibernate.AssertionFailure: collection [ class name here ] was not processed by flush()

I tried changing the owning side of the collection, made a join table, and nothing helped.  The error started when I added an @IndexEmbedded annotation to the collection, and I discovered I was missing the @ContainedIn annotation in the collection entity.  That didn’t fix it.  After weeks of doing little tweaks, breaking, fixing, breaking, fixing, I finally discovered the problem.  I was using an older manual for Hibernate Search (3.0 specifically) and I had the following configuration parameter pushed into my SessionFactory:

hibernate.search.worker.batch_size = 1

As of Hibernate Search 3.1, that parameter has been deprecated.  It has been replaced by a number of other settings allowing finer-grained control over your batch processing in Hibernate Search.  Eventually we’re upgrading to Hibernate Search 3.2 which handles batches altogether differently/better.  Thought I’d share, because this one had me stumped.

Eclipse & Properties Files / ResourceBundles Editor

The current project I’m on is pretty heavy into internationalization aka i18n.  I found a pretty decent resource bundle editor for Eclipse that makes creating synchronized files across all languages much simpler.

http://sourceforge.net/projects/eclipse-rbe

It installs in a snap and provides a simple, yet powerful, interface for a bundle.

Mac Screen Sharing (VNC) & White Screen

I’ve had problems connecting to my Ubuntu 9.10 server via Mac OS’ built-in VNC client, “Screen Sharing”.  Frequently when I connect, I get a white screen with no indication that the connection is working.  If I type characters or click the mouse, it does actually send those events to the remote side.  My only option was to use Chicken of the VNC (which sucks) to connect to my server.  Finally, I did some digging and found the solution/workaround.

  1. Open a new Finder window.
  2. Click “Go” and then “Go to Folder” (or hit Command-Shift-G).
  3. Type in “/System/Library/CoreServices” and hit enter.
  4. Find the “Screen Sharing” application, click once to highlight.
  5. Click “File” and then “Get Info” (or hit Command-I).
  6. Find the checkbox labeled “Open in 32-bit mode” and check it.
  7. Close the Info window and Finder folder window.

That’s it!  Apparently there is a bug in the application only when running in 64-bit mode.  I don’t really care why it fixes it, I’m just glad its fixed and I thought I’d share.

Thanks to the anonymous user on Mac OS X Hints!

Spring 3.0 + Hibernate 3.3.2 + JBoss Cache 2 + JTA = Fail

I’ve spent the past two days trying to get a distributed secondary Hibernate cache working with a Spring 3 application.  The application is web-based running on JBoss 5.1 so I figured the best approach would be to use JBoss Cache, since it’s automatically configured and available in JNDI when you use the “all” configuration.

Hibernate 3.3.2 is configured inside of Spring using the Annotation-based session factory bean.  Because I’m using JTA to manage transactions and Hibernate’s current session, I need to make sure that the secondary cache, whatever I choose, is aware of the transaction manager.  I originally had EHCache 2.0.1 hooked into Hibernate via Hibernate configuration parameters passed into Spring’s bean.  I was not setting the cache factory parameter on this bean.  Everything works fine in this configuration and it recognizes the JTA transactions.

This application needs to be clustered horizontally – ensuring each component of the solution is failover-ready.  JBoss Cache 2 is baked into JBoss AS 5.1 and a logical choice to pick.  Hibernate has an extension JAR and it’s a simple interface, especially when you’re pulling out the cache from JNDI.

The problem?  The JTA transaction manager that Spring proxies isn’t available to JBoss Cache.  JBoss Cache (on JBoss AS) runs at the container-level inside of a different classloader.  Spring holds onto the reference to the transaction manager proxy inside of a ThreadLocal variable which is NOT accessible to the container.  To get around this, I tried using Hibernate’s implementation of the JBoss Transaction Manager lookup class, thinking since it’s JTA it’ll work.

It didn’t.

When I tried bringing up the application, I ran into errors surrounding the current transaction.  At one point, the transaction was timing out during a cache pre-load process the application has.  In another configuration, the application loaded but after a few minutes the app exceptioned out with a stale JDBC connection to the database.  It was obvious to me that the JTA transaction surrounding the cache didn’t sync with the Spring JTA transaction.

I eventually gave up on JBoss Cache and am going with EHCache 2.0 using JGroups to synchronize each node.  The “all” configuration of JBoss AS 5.1 has both JGroups and JBoss Cache preconfigured.  I hooked into the synchronous JGroups UDP configuration, using the same JVM parameters the JBoss XML files use so that my app doesn’t need a special deployment for each server.  Theoretically, the configuration will work in a cluster without having to change anything around.

We’ll see how the clustering works later on but for now, single node in cluster mode is working just fine.

iPhone Migraine Diary

I may have mentioned it before, but I created a Migraine Diary application for the iPhone as my master’s captone/thesis project.  The school year finished out for me and I submitted the application to Apple on the 29th.  Two days – TWO DAYS – later they approved it and it’s listed in iTunes!

Head on over to Net Workz LLC to find the app.

I still have a lot of work left to do before I’m really happy with it.  Help screens, more graphing, and encryption are two things I really need to get out there.  Until then, enjoy!

Xcode WTF are you doing?!

I didn’t start developing in Xcode “for real” until this year but I’ve played around with Xcode for a number of years.  Over that time, I’ve screwed around with settings and changed defaults.  It got to the point where following screen shot examples weren’t matching up, #pramga marks in my code weren’t showing up correctly in the code editor method drop down list and on and on.  Perusing through Xcode Workspace Guide, I found this handy little suggestion from Apple:
To reset Xcode to its factory settings for the logged-in user, run these commands in Terminal:

> defaults delete com.apple.Xcode
> rm -rf ~/Library/Application Support/Xcode

After doing this, I had to re-add my Subversion repository, move my build folder to the /tmp directory, and pick my text editor color scheme again.  However, I now have a functioning Xcode and things seems happier again.  Yippy skippy!

Page 28 of 30

Powered by WordPress & Theme by Anders Norén