Friday, April 21, 2017

NodeJS finally?

I'm way behind the times.  Node has been out seemingly forever in the programming world.   I'm definitely behind in learning about it, I'm learning by taking a class on Udemy.   Sheesh, this is not how I have learned in the past.  I'm normally a little faster to the game.

Too many years have been spent using the same technology.  The past 6 years have been spent with Websphere portal.   My skills feel diminished.   I used to be able to use work as the reason that I could learn new technology and use it in my projects.   Now work holds me back.   I'm not allowed to implement the new technologies.   I have to learn things on my own, for my own side projects.   Not projects that I'm able to sell or use for any kind of profit, just things that I can play with.

It's so hard to find time with 4 kids and band, choir, soccer, and dance to squeeze in learning in the evenings.  I can do a bit here and there, but I have an extremely hard time finding a few hours together that I can focus and get into the zone.  I don't learn well in 15 minute increments.  I need more immersion than that.

Maybe now I'll finally be able to learn a new technology that will stick.  

Thursday, February 25, 2016

I'm behind, but I try not to be.

Technology is changing so fast.  Even if you consider staying within a single lane like Java there are still constant changes occurring in the underlying code.   There are new libraries, new plugins, and changes to the base system.

All fields change, Doctors need to stay up to date on the newest techniques in order to be offering the best medicine and the newest surgery alternatives.

Teachers need to stay up to date to be able to offer potential new teaching methods.

Even Day care employees need to be aware of first aid and newer findings in child psychology and laws passed to ensure that they are caring for the kids in a legal manner.

However, technology changes faster than any other field. Every piece of the stack is constantly changing.  Today there are probably 2 new alternative javascript libraries that were introduced.  You don't want to change to a new one, that's cool, the one you used has a new beta version that just checked in to github with potential code breaking changes.   HTML, CSS, Javascript itself with ECMAScript, The browser and how it interacts with the HTML, a different mobile version of the browser, the backend, the database, the type of REST call, the method for generating JSON, the connection to the db, absolutely everything is changing all the time.

It is physically impossible to keep up to date on everything new.  There's just too much, it's like trying to drink from more than one fire hose at a time.

I am an information junkie, I love learning, reading, discovering and playing, but I cannot keep up with it all.   From a technology point of view I am so far behind the times that it's not funny, but I have picked several areas that I am interested in, and although I will never be up to date on them, I am hoping to get familiar enough with them to use the technologies when they are the right solution.  My solution is to essentially ignore lots and lots of technology and choose just a few to try and keep up on.  Even still I don't seem to have enough time to learn what I want to learn.

I'm behind, but I try not to be.

Wednesday, February 03, 2016


I haven't read an issue of PragPub in quite a while, but was intrigued to see a title of "Angular 2 and Testing" for this month's issue.  We have been using Angular on our projects at work for the past 18 months and I am trying to keep an eye on what is around the corner with Angular 2.

Sadly, when I went to download a copy of the current issue I found out that it is no longer free

I can't say how long Pragmatic Bookshelf has been charging for the content.  I know when I was reading it regularly that I was completely shocked at how much amazing content that they were producing and providing at absolutely no charge.  The articles were always good, even the ones that didn't apply to technology that I was using I would find interesting.   My job has been mostly with enterprise technology, so I am well behind leading edge topics, and that means that most of the content, while interesting to me, is not useful for applying at work.

At this point I am probably not going to subscribe to PragPub.  If you work in any web development that is not limited to Enterprise technology, you probably should though.   It's a great way to keep up to date on new technology and topics, and the authors of the articles are the same people who have written the great books that Pragmatic Bookshelf sells.

Friday, July 20, 2012

Gson vs Jackson - which library is faster?

I've been reading about how jackson is the fastest json parser.  And I wanted to know what exactly that meant.

I've used gson in the past and have never had a problem wth the speed of it, but I've never been in a situation where every bit of speed counts.  

I devised a simple test.  Using junit.

Test 1:
Serialize the same object 100 times with each gson and jackson and time how long it takes.

gson is between 150 and 200 ms for my object every time.
jackson is between 670 and 720 ms for my object every time.

Clearly here gson is the winner.  However, I wanted to make sure I didn't sell jackson short, maybe it excels in another area.

Test 2:
Serialize both with gson and jackson in the same unit test with gson first in case object creation matters.

gson is between 150 and 200 ms every time.
jackson is between 620 and 680 ms all but one time which was 901 ms.

Test 3:

Serialize both with gson and jackson in the same unit test with jackson first in case object creation matters.

gson is between 120and 170 ms every time.
jackson is between 589 and 700 ms every time.

Finally I decided if I'm using it in a web service I'll need to create POJOs from the JSON for processing if there is a post.  

Test 4:
Build POJO from JSON

gson is between 103 and 141 ms every time.
jackson is between 469 and 546 ms every time.

An interesting thing I found is that the object I was dealing with had a Calendar in it.  This serializes and deserializes just fine in jackson, but in gson it would create a nice output, but did not populate the POJO correctly.  When I changed it to a Date object both Jackson and gson worked correctly.

My final review is that clearly gson is faster than Jackson.  In it's worst case and Jackson's best case gson is still always twice as fast.   I had used gson, just because I found it easy to use, but now that I have run some benchmarks I know I happened to get lucky enough to find the faster library.

Thursday, June 28, 2012

Migrating to Graylog2 0.9.6 issues

We had a problem recently. We had been logging to Graylog2 using the gelf4j appender in a lot of applications. Our MongoDB was configured with a capped collection because we can quickly run our server out of space.

After we upgraded to Graylog2 0.9.6 we noticed a few things.
1. Our server quickly ran out of space
2. The dates were showing up in the year 44461.

Version 0.9.6 is much more responsive, due to the data being stored directly in ElasticSearch, however the capped collections no longer solve the problem of data size. It took some searching before finding that there is a 'settings' tab with a 'message retention time' tab that can be changed from 60 days worth of data to a smaller number.

This doesn't fully solve our data size problem. If a flood of errors occur it can still push the size beyond what the server can handle. Plus this deletion value uses the created_at date that is now passing the wrong data. All data is listed as being in the future and not getting cleaned up with setting.

It took a bit of tinkering, but I was able to finally come up with an ElasticSearch query that would allow me to delete all data dated in the future. This is not the best case scenario, but I can live with manually deleting data until the applications are updated.

To figure out what value to use for the date I used the unix date command to determine the value for 1/1/2013.

Fixing the problem with the dates was much easier.  A new version of gelf4j was available with the fix already implemented.   Simply replacing the previous version with the new version solved the date problem.

Dates with Graylog2 is an issue I saw mentioned several times.

Users complained that their servers are all over the world and the dates are showing local times.   So they want the ability to sort dates differently.

To me this could be solved by always passing through the UTC time instead of a local time.  Then all data would be in order by the time it was sent according to the sending server.

Some users want the graylog server to show dates in the order it receives them instead of by the date order that is stamped on them.

I think that this could be a useful feature, but I don't want it to be the default.  I want the time that the message occurred to be the sorting field.  Some servers could batch up messages and hold them for minutes before sending them.  I want to be able to find problems based on the time that they occur, not whenever Graylog happened to finally get it's copy of the data.    

I believe that if Graylog did add it's own timestamp for when a message was retrieved then deletions could be done against the internal date.  If that were the case Graylog could still hold messages for 2 days from when it received them, regardless of the date-time that the sending server happened to say it was.

Finally, I believe that Graylog2 0.9.6 is a good improvement to the previous version, the web browser is much more responsive, but the inability to cap the index size in ElasticSearch is a big issue that needs to be addressed as soon as possible.

Monday, April 23, 2012

Rotate content with jQuery.

After having a few times that I've had to rotate content I decided to simplify some javascript. There are several plugins out there, but they seem to all be much bigger than I think is needed to simply rotate some content. To start with I have a simple layout for the content. A wrapper element with child elements. The example uses divs with a class, however, an unordered list works just as well with a small tweak to the selectors. The javascript is simple. This is not in a plugin, so a only 1 per page is supported with this code, but it should be able to be converted to a plugin pretty simply. Finally the result is a simple item that fades in and out. The rotation doesn't take control of any of the layout of your page, it simple shows and hides the html. I have a few ideas to clean up the code, it could look for the next sibling and show it instead of keeping a counter, and then show the first on when the last one is hidden. I think the selectors for that would be more complicated though and I like the simplicity that this implementation offers.

Friday, September 30, 2011

Root Cause

I've picked up a fun nickname at work.  Root Cause.   I take it all in fun because I have been the root cause of a few problems, but I cause far less problems than I fix.

Today at work someone sent me a quote.

For every effect there is a root cause. Find and address the root cause rather than try to fix the effect, as there is no end to the latter.
-- Author Unknown

It's almost like there is a quote about me now.  That's lots of fun.