Wednesday, August 5, 2015

Batman Eternal Comic


Finished reading Batman Eternal vol 1 from the library.

It's pretty hectic with a ton of characters. For heroes, it has Red Robin, Red Hood, Batgirl, Batwoman, Batwing, Jim Corrigan, Batman of Japan and Argentina (no Nightwing or Robin). For villians, it has Penguin, Falcone, Professor Pyg, Cluemaster, Jokers Daughter, Hush. Sort of appearance by Joker. Also in more neutral/helpful roles, Killer Croc, Catwoman, Scarecrow, Alfred's daughter. And so many more.

Jim Gordon is arrested, city erupts with gang war, corrupt cops, nanobots, dark magic and severed limbs, dollotrons, killer whale, zombie/monsters, evil spirits.

And it's just getting started.

I don't love the changes in art style or story arcs, but I'm still looking forward to vol 2.

Saturday, February 14, 2015

Hibernate, In-clause, OutOfMemory

Using Hibernate 4.2 and MySQL in a project with an in-clause query such as:
select t from Thing t where t.id in (?)

Hibernate caches these parsed HQL queries.
Specifically the Hibernate SessionFactoryImpl has QueryPlanCache with queryPlanCache and parameterMetadataCache.
But this proved to be a problem when the number of parameters for the in-clause is large and varies.

These caches grow for every distinct query.
So this query with 6000 parameters is not the same as 6001.

The in-clause query is expanded to the number of parameters in the collection.
Metadata is included in the query plan for each parameter in the query, 
including a generated name like x10_, x11_ , etc.

Imagine 4000 different variations in the number of in-clause parameter counts, each of these with an average of 4000 parameters.
The query metadata for each parameter quickly adds up in memory, filling up the heap, since it can't be garbage collected.

This continues until all different variations in the query parameter count is cached or the JVM runs out of heap memory and starts throwing java.lang.OutOfMemoryError: Java heap space.

Avoiding in-clauses is an option, as well as using a fixed collection size for the parameter (or at least a smaller size).

UPDATE:

Check out this great post with more info.

For configuring the query plan cache max size, see the property 'hibernate.query.plan_cache_max_size', defaulting to 2048 (easily too large for queries with many parameters)

Wednesday, December 25, 2013

Chromecast X-mas

This was my big X-mas gift to myself this year: Chromecast.


I received it in the mail just two days before the holiday, after debating whether to get it.
In the end, I did because I had to pickup something else and Amazon had $5 off on it.

Now I'm not expecting a ton from Chromecast.
My main goal was having something easy and cheap for watching tv/movies without needing to hookup the laptop like I do now.
Yes, there are other options but at $35 (or $30 here), how could I not try it?
My minimal expectation was to be able to play Netflix on it using the iPhone app.

Setup was easy as expected. Plugged in HDMI on TV, plugged in USB/power cable, installed and ran setup app on laptop, (installed cast extension on laptop chrome).

After that I was able to verify it was working from the laptop chrome browser, casting a tab. This worked but it was laggy (tested Hulu non-plus). Now I didn't really expect this to be perfect, I know the Hulu plus app is ideal, but this proved it was setup and working.
(This was better after I turned the quality down to Standard in chrome cast Options, and this is on a laptop with i7 core and 16gb ram)

Next I installed the Netflix and Youtube apps on my iPhone. Of course I had to dump pics/video to free up space, and then dig up my Netflix login from KeePass.
The Netflix app worked as expected, easy TV icon to select playing on Chromecast and quality was great. (I did have the audio seem out of sync a couple times for Netflix, I paused it and then it resumed fine)
Youtube app worked similar, same TV icon to chose destination for playing, works just as easily.
Also tested the Netflix app across two different iPhones. Works for any connected on the same wifi local network.

My main comparison for the iPhone app control is the XBMC app, since both allow controlling TV content over the network. But of course XBMC allows almost any content both local and streaming (like with FreeCable plugin), but it also requires running the PC with XBMC connected to TV.

Content is really the main issue I have with Chromecast right now.
It works great with the apps (Netflix,Youtube), but there needs to be more. I've watched a ton on Netflix but content flows on and off the streaming availability (I don't get DVDs anymore). I have a few things in the Netflix queue, but more often I'm playing TV shows on Hulu or other places (on PC).

I've had Hulu Plus in the past (as a holiday gift for a few months) and it was great. I'm sure I'll get back on it at some point soon, and this would be my sweet spot for Chromecast. When TV shows are airing over normal seasons, I'm overloading my Hulu queue. Also there is Hulu Plus exclusive content like new Dr Who and other recently aired but not released shows.
But for anything not on Hulu (like CBS), I assume I'd need a specific app for that site that also supports Chromecast, which is a stretch. (if only CBS and Hulu would work together for more current airing shows - Big Bang, Elementary, Mentalist, etc).

But despite these issues, Chromecast wins for price and ease of use.
It's way cheaper than building/buying another machine dedicated to playing shows. I already have a Netflix account, iPhone, and TV with HDMI, so it was a natural fit.
Hopefully the current limitations disappear over time with an official Chromecast SDK release and future apps. But even if they don't, at least I didn't have to invest much into it.

Friday, November 29, 2013

Card Game Building

Last night I decided to look into creating custom game cards,
specifically for a few games I had been playing at work.
My goal was to make a few themed sets for New Years.

The first game I had in mind was Love Letter. After looking at other themed versions (Firefly, Star Wars, etc), I decided I wanted to theme based on the Star Wars Old Republic comics. I started lining up the card types with characters, beginning with Jarael as the Princess.
Of course I searched the interwebs for hours finding different possible images and info to use.

 
I downloaded Magic Set Editor and gave it a try, using the VC card style. I found only a very limited set of templates, but it was super easy to use, just plug in text and images. Printed and laminated. Quality is ok and laminating makes them harder to see, cloudy. Printer messed up and wound up with 2 black lines on the back of Jarael. I tried to fix, would be ok with solid back sleeves to cover.

Here is the final set, not too bad:


The second game I looked into making cards for was Hanobi.
I decided to go with the Star Wars theme again, had the idea to line up the colors with symbols. I was lucky to stumble across the images almost immediately.

This time i went with a different program, NanDeck. This was almost perfect, no installer this time, just an exe. And instead of form input, it's writing code to create the cards, allowing any templates. Templates are easy to share as text (or zip with images). I started from a few of the example tutorial templates.


Printed and laminated, again more printer issues. I had to reprint at least half of the pages. Some cards still ended up with thin lines on them. I'm still happy with them as a first test, though the yellow numbers are bright and need an outline or darker gold color.

Wednesday, November 20, 2013

Part 1: Writing Websites

This is the first in a series (I imagine) about issues in creating websites today.
Just random observations or brain dumps of what I is going on.

And of course the big news at the moment is...
Heathcare.gov
It's been all of the news for a while now, since its launch at the beginning of last month.
So I've been laughing about it over all of that time, on news especially the Daily Show.

In summary, I don't think it's a big deal and I don't care a lot about the issues with the website. Well, other than entertainment.
Sure, I can see how these websites problems can be annoying and look bad, but to me it just looks like the news networks are bored and found some fresh meat to pounce on.
And with the latest comparisons of this website rollout to Katrina?! Stop. It's a website. Not a failed mission to start a space colony on Mars.

But in reality, my understanding is that 80% of the country doesn't need the website. I don't. My employer healthcare is good enough. Do I expect that the remainder of the country without health insurance (actual citizens looking for help) jumped on the website to sign up? Or do I expect that news network employees hammered the site?
Apparently there were long wait times on the rollout, it couldn't handle the load, slow at even 1K users but was expected to work for 50K and had up to 250K.

Sadly, I can tell you what I expect those numbers are not. They are not young people 20-30, especially those without a dependable job or one providing health insurance. Basically those the mandate is trying to push into having insurance. Those struggling with college debt and confused about this healthcare law. Sitting on the sidelines, waiting to be pushed or forced into action, waiting out the website storm in the news. The ones that really need a single payer health care system, because it means having to do nothing and higher taxes sound more positive than a tax penalty.
I'm just glad the mandate deadline to have health insurance has been extended farther into 2014.

Back to the site, I had a glance at it before, but tonight I was curious to see what I could gather at a longer look.
Well the page itself uses a bunch of fairly recent UI JS libraries like Bootstrap, JQuery, Backbone, Underscore. But it also loads almost 60 JS files including tons of JQuery plugins. Not that these are the cause of specific issues, I have no problem with them.
More interesting was the CreateSaml2 POST with a 200 Success but response text of "success: no". Awesome.
It gives two different feelings for the front end and back end, which makes sense given the history. Apparently these were contracted out to two different companies and then subcontracted.
I can imagine the mess involved with this project, and I'm sure it's worse than even that.
But the only lesson I get is that the government can't build websites. Should I be surprised?

I'm a dev, I know that bugs happen, so I am not at all surprised when they do.
I also have been staring at different HTTP error codes for years, since I began using the internet.
So websites are not a mystical beast.
But they can be complicated to develop, especially large scale.
Sounds like this project had changing requirements and no clear direction or project management.
And of course not enough testing, there can never be enough.

Demo Bug
With not enough testing, you can guarantee issues.
I sat through a horrible meeting today to demo work I've been loosely involved in.
And I had the pleasure of sitting through this uncomfortable and embrarrasing meeting,
seeing an error message in red up on the screen saying 500 NullPointerException.
Which just makes everyone involved look bad.
But that's how it goes sometimes. It shouldn't happen but it does.
Thankfully this isn't rolled out anywhere yet, and of course it wouldn't be like it is.

Signup Nightmare
To the extreme of website issues,
What if the individual mandate for health insurance was only a day, or even less than a day?
What if the country only had a limit of 100K slots for health insurance on Oct 1 to signup and get it super cheap?
What would that have looked like? A complete mess, yes.
It would be all over the news, and on that day the website would be swamped and would go down.
This is basically what the PAX 2014 signup was like.
Registration, especially getting hotel rooms was an online battle, not just between people but also servers. It was insane. It was sold out in less than an hour. Systems were down, and of course everyone just kept trying F5 with errors and partial page loads and trying to call in but systems were not available there either.

So building dependable websites to handle large load can be hard. Bottlenecks happen.
Not that I know any of the intricate details of these systems (I'd love to),
But I would imagine that knowing an advertised live date and number of users, with (god I so hate the word) "cloud" servers and stateless designs the flexibility exists to handle a lot of load. With Amazon, Google, whatever, scale up a ton on that first day, monitor it and adjust. At least be prepared for the onslaught that you welcomed with open arms.

Monday, November 18, 2013

TV, Doctor Who

I finally started watching Doctor Who a couple months ago and I was hooked.
I've been watching it constantly on Netflix, the newer series from Eccleston to Tennant to Smith, Rose Tyler to Martha Jones to Amy Pond.
Sadly I've almost finished series 1-6 which are the only ones available on Netflix right now.
But thankfully there are more to watch.
At first I didn't like the transition between main characters, it was jarring. But then I found I enjoyed each set of characters almost more than the last. The writing definitely got more intense.
I really enjoyed a lot of the Futuristic episodes, more than the historical. But despite my apprehension, I was always pleasantry surprised with how each episode turned out.
So yes, I'm a total fan now.

I've also started watching some of the new seasons of shows, like getting caught up on Arrow and Walking Dead.
For Arrow, I always enjoy the mix of current and island flashbacks, almost enjoying the island scenes the most. After watching s02e01, I look forward to ditching the 'Hood' name and hopefully being called Green Arrow for once.
I'm also really looking forward to seeing more DC characters mixed in. I've really liked seeing DeathStroke, Deadshot, Black Arrow. And I'm looking forward to more, just as I did watching Smallville. I really hope Roy Harper becomes Red Arrow/Speedy. But having the League of Assassins involved could always lead to a Batman cameo. One can dream.

I'm almost caught up on Walking Dead. I really liked the horde/herd in s04e03, reminded me of comics 59-60, not being able to get through/away from the mass of zombies in a car.
The safety of the prison being called into question is interesting, with the infection spreading easily with people living in close quarters, and also being trapped when zombies/walkers have invaded.
So far so good.

For others, I'm always enjoying Supernatural. I have yet to watch the latest Misfits.
Checked out Tomorrow People and Almost Human, I prefer the later I think except for one issue. Saying such a futuristic show takes place 35 years in the future (2048). With bionic/synthetic body parts like leg, android cop partners (with tons of capabilities like xray, facial recognition, blood analysis, combat, etc), and flying cars. This just feels like too much for the proposed date, I'm sure these things can happen in the future, but we are not there yet. I would have believed 2148 or 2248 better (prove me wrong, so i can see it in my lifetime).
Now don't get me wrong, I love the type of story, it fits right in with Asamov's detective Elijah Bailey and robot Daneel Olivaw.

Sunday, November 3, 2013

Geek shirts

I've been searching for some new t-shirts, without spending too much money.
I found 6 dollar shirts but wasn't sure if it would be worth the money.
Sure they are cheap, but how would the quality be.
And I don't love all the designs on the site, only a handful really (Dr Who, techy).

After debating for a while, reading reviews, I went ahead and bought 5 medium shirts.
I was planning to buy 10 shirts for $50, but I was planning to pay with a $50 gift credit card and shipping put me over. So I ended up only being able to get 5 shirts, costing about $7.78 each with shipping. I did find a $10 off code, but it only ended up giving me $3 off for the number of shirts. 

I received them less than a week later. They are good quality and survived wash/dry. Only annoying thing is the tags bunch up after multiple washings, so just cut them off. The Heather color shirt is softer and feels a little bigger than the others (maybe because it's stretchier).
Altogether a good deal (especially mine were free).


Thursday, September 19, 2013

XBMC Free Cable CBS

As I've mentioned earlier, I like XBMC and the Free Cable plugin,
but it looks like the CBS python script is in a bad place right now.

It's the inevitable future of all HTML scraping code, to be broken.

Attempting to navigate to the CBS channel has a script error with:

File "...\XBMC\addons\plugin.video.free.cable\resources\lib\cbs.py", line 66, in rootlist
categories=menu.findAll('a')
AttributeError: 'NoneType' object has no attribute 'findAll'
The CBS script is looking for a specific element id (daypart_nav) for the menu to build the directory listing options using the 'a' elements under it.

But the cbs.com/video page now redirects to cbs.com/watch with a completely different layout.
So none of the expected elements are found and thus errors.

I looked back in the Wayback Machine archive, to see the original HTML matching the current script (from a month ago).
Since the page has completely changed, the CBS script seems like it needs a major rewrite.

Fall TV shows are starting up soon, so I spent a little time trying to get it working.
So far I did some HTML tree traversal hacking in the python script and got the initial menus.

UPDATE:
Listings of episodes are now working in this version of the script:
http://pastebin.com/xMiF1qV4

UPDATE 9/20:
Apparently I've missed the latest updates on the forum here.
The Free Cable scripts including cbs.py are being maintained and I was able to update to another working version.
At https://home.no/xbmc/shop.html, I grabbed repository.xbmcplus.xbmc-plugins-1.2.zip, under the link for repository.xbmcplus.xbmc-plugins.
Then I just needed to Install from Zip under System - Add-ons, and then update Free Cable (replacing older).

This version includes a loading dialog instead of just hanging while loading the episode list.
But what I don't like is the episode list itself.
For one of the newer CBS shows, I see all episodes listed even though most are not able to play. This same Full Episodes list contains clips (I removed these by checking type and duration starting with 0).
And the display names include 0x0 (I avoided adding if either is 0). Which is partly a problem of where the data is coming from (not from the JSON, but from page parsing). CBS removes videos from being playable (now only through third parties) and their urls redirect back to the show's homepage. Ideally the page parsing would determine if the video is actually playable before adding to listing.

UPDATE Mar 29 2014:
Free Cable is gone, as mentioned on the Free Cable forum, it is now the USTV VoD plugin. Go grab it.

UPDATE Sept 9 2014:
I was using an old version of the xbmcplus addon repository, causing USTV VoD plugin to not be updating (stuck at version 1.0.2).
To fix VoD, I upgraded to the latest xbmcplus repo version from here:
https://github.com/moneymaker365/repository.xbmcplus.xbmc-plugins/releases

Wednesday, July 31, 2013

Mobile gaming, Dead Space

I've gotten really into mobile gaming on my iPhone,
especially the free Dead Space game.

It's good and definitely impressive for a free mobile game. 
This is the type of game I would have expected only for platform or PC not that long ago.
Great graphics and story with cut-scenes, plenty of weapons and upgrades, surprisingly long and without prompts to upgrade to continue playing. Maybe I'm just jaded from the pay-to-play mobile gaming dominating today. All in all, this game is awesome.

At first I wasn't sure about it. I wasn't used to the controls and with a limited weapon I felt helpless.
Thankfully I was on easy mode and so my health was forgiving.

I finally finished the game recently. All went smooth until the last big boss.
I had no idea what to do and found online to hit the yellow spots. After a while of that, it was over, I had won (I guess, sort of).

But then it only got better.

The second time through I kept my weapons and items. I hadn't been able to get up to 200k the first time but easily did the second time through. At the first store I picked up the heavy pulse rifle after selling peng.
Shortly after I had enough to upgrade the suit (RIG). I thought I could take the 90k best, but instead I had to get the first two 30k and 60k upgrades first.
So I had to start saving up again and late in this second run I finally had enough to get the best suit/armor.

Early in the game:


First two suit upgrades (up to level 3) and heavy pulse rifle:



Cut-scene late in the game:




Final (level 4) suit upgrade:

Monday, July 29, 2013

Comic Lover App

I just installed the Comic Book Lover app on my iphone.
I don't have a tablet but this is one of the big reasons I could see getting one, as a convenient digital comic reader. But for now, this is better than sitting at a laptop or desktop.

I was planning to use Google Drive, but when I saw how easy the FTP appeared to be, I tried that first.
Under Transfer -> FTP I found the connection settings for my phone over my wireless router, as IP 192.168.1.2 and port 20000. I left the phone on this view.
In Filezilla, I connected to this IP/port and found an empty directory.
(If failing to connect, disabling and reenabling wireless on iphone seems to help)
I transferred over a test CBR file with drag/drop.
On the iphone, the "Add To Library" button was now enabled.
After clicking it, I saw the message "Finished, 1 comic added to library". Easy as that.

Under the Library, I found the comic listed as (Unknown Series). The metadata tag icon allows setting the title, series, issue #, etc.

The comic reader view looks ok, especially good in landscape view and zoomed in.
Although in this view, when turning the page, it zooms out and then back in on the next page. I don't really like the zoom out and back in, i'd rather have it stay zoomed in and just go to the top of the next page.
Otherwise, I'd say its a nice reader and definitely convenient for me.