Tim's Blog

Author: TimothyRHuertas (page 2 of 5)

JNI + OSGI + Refactoring + Idiot = 2 wasted days.

I just wasted two days.  I am working on a desktop application in JAVA.  It needs to sniff web proxy settings from the Window’s registry (and some day other platform specific locations).  I decided to use JNI  to do this.  Everything worked like a charm in my sandbox JAVA application.  I then embarked on moving it to and OSGI bundle.  When I ran the thing I received a java.lang.UnsatisfiedLinkError.  WTF!!  WHY!! 

When I debugged my call to System.load(“somedll”) worked, but an exception was triggered when I invoked the native method.  I then thought well maybe its and OSGI thing.  After some Google-ing I found a few write ups on how to tweak the manifest to load the system specific library.  I tried effing with the manifes eight ways from Sunday, but still no workie.  I then came across a forum where someone had the same issue I did and they eventually discovered that that they had renamed their JAVA class, but did not regenerate the JNI lib.  It then dawned on me that I had refactored my JAVA class in to a new package, but did not update the generated .h file.  

The morale of the story is if your JNI call works outside of OSGI, but then stops working when you move it in to OSGI; ask yourself “did I refactor this thing when I moved it in to a bundle?” 

Happy Turkey Day

                             ,+*^^*+___+++_
                        ,*^^^^              )
                     _+*                     ^**+_
                   +^       _ _++*+_+++_,         )
       _+^^*+_    (     ,+*^ ^          \+_        )
      {       )  (    ,(    ,_+--+--,      ^)      ^\
     { (@)    } f   ,(  ,+-^ __*_*_  ^^\_   ^\       )
    {:;-/    (_+*-+^^^^^+*+*<_ _++_)_    )    )      /
   ( /  (    (        ,___    ^*+_+* )   <    <      \
    U _/     )    *--<  ) ^\-----++__)   )    )       )
     (      )  _(^)^^))  )  )\^^^^^))^*+/    /       /
   (      /  (_))_^)) )  )  ))^^^^^))^^^)__/     +^^
  (     ,/    (^))^))  )  ) ))^^^^^^^))^^)       _)
   *+__+*       (_))^)  ) ) ))^^^^^^))^^^^^)____*^
   \             \_)^)_)) ))^^^^^^^^^^))^^^^)
    (_             ^\__^^^^^^^^^^^^))^^^^^^^)
      ^\___            ^\__^^^^^^))^^^^^^^^)\\
           ^^^^^\uuu/^^\uuu/^^^^\^\^\^\^\^\^\^\
              ___) >____) >___   ^\_\_\_\_\_\_\)
             ^^^//\\_^^//\\_^       ^(\_\_\_\)
               ^^^ ^^ ^^^ ^^

Happy TURKEY Day!
*Image courtesy of http://home.comcast.net/~855ardmore/ascii-thanksgiving.html

Caltrain woes

Like most days I began my morning by riding Caltrain from San Francisco to Palo Alto.  About 10 minutes in I realized that I had forgotten my train pass.  I decided to do the “right thing” and inform the ticket attendant that of the situation. Here’s where it gets interesting.  He advised me that speaking with him was not helping me and that I should run up 2 cars and then hop off at the next stop and purchase a ticket.  I politely replied, “My bike is on the train.  You are giving me a 30 second window to do something that takes at least 2 minutes.”.  I mean even if I teleported to the machine I still have to put the money in the box and wait for the machine to spew out my ticket.  He then told me to get off at the next stop or be written up.  Okay so that’s when I decided to conduct an experiment.  The max fine for not having a ticket is $250.  I sneeze that.  Perhaps he gets off by striking fear in the hearts of most by treating them with a fine, but not me.  I had already decided to get off the train, but not before I tested his humanity.  I put on a sad face (the kind that looks like I’m fighting tears back) and pleaded, “I have a wife and 2 kids at home.  I have been unemployed for 6 months and am on my way to a big interview (monster lie).  I was honest with you about not having a ticket.  Please let me slide this once.”.  He told me to “that’s too bad”.  This whole experience left me with a few questions:

1.  Is this really Caltrain policy?  That is, I turned myself in.  Is their idea of customer service advising me to sprint for the machine?  If I was a 60 year old lady would they advise the same?

2.  How can some people be so not nice?  I mean why would you as a Caltrain attendant threaten to fine someone who willfully acknowledged the situation?

3.  Am I alone or does this happen often?  The Caltrain is used by thousands of hard working people everyday.  Certainly a percentage of which forget their ticket.  Do they get chucked from the train or did I just happen to catch the ticket checker when he was on his period?

The recession

My brother Anthony sent me this.  I think it illustrates just how bad the recession is/was.  However I should say that this is not the first time I have heard of people “making it hail”.

Tim

Did our parents really get down like this?

Stumbling upon this video made me ask myself “did my parents get down like that?” Anyway this video is nothing new, but I think its worth bringing back for a night. Happy Friday.

Fu*k getting older

My birthday is just around the corner.  As such I think it appropriate that I remind people just how much you physicllay change as you age.  I submit for evidence before and after videos of Billy Joel performing Just The Way You Are.

Before:

After:

As an aside.  This song gets interesting if you listen to it and imagine that he is singing it to himself.

Player

Just for the heck of it I typed “player” in to you tube and this was the first result that came back.

I prefer to use the word player as an adjective. For example, “that’s rather player”. Many people prefer to use it as a noun synonymous with the word “womanizer”. For example, “that fellow courts a lot of women. Perhaps he is a player”. The point is however you choose to use the word youtube got it right on this one.

Michael Jackson mediates 50 cent and game beef?

I ran across this video on youtube and thought it was very interesting.  Here is the summary that accompanied the video.

The Game has come forward to say he got a call from the King Of Pop during the height of his beef with 50 Cent. Game says that Jackson contacted him to be the mediator in his beef with the G-Unit general.

Motion Detection Revisited

About 2 years ago I did some experiments with ActionScript 3 and motion detection.  Looking back I had no idea what what the ActionScript I pieced together was doing.  I have since gained a better understanding of some of the low level bitmap data functions available in AS3.  I threw this together last night and am quite pleased with the result.  It is a virtual drum game.  The game works best if you get out of you chair and position yourself such that your hand is the same size as a drum.  I have separated the motion detection logic so that it can be reused on any DisplayObject.  Also it is not nearly as memory intensive as the first implementation.  I took the sounds from http://www.themaninblue.com/experiment/JS-909/ (thanks Cameron Adams).  Here is a demo.  Here is the source.  This is a proof of concept and certainly not the first AS3 web cam motion detection experiment.  I am curious to hear what you think of my implementation.

Olderposts Newerposts