Wednesday, August 26, 2015

Using websockets with wicket 7 and embedded jetty (9.2.X)

I had a hell of a time getting the new wicket websockets functionality to work with embedded jetty.
The information I found on the interwebs left tantalizing clues, but one piece of vital information was missing.  For those landing here, I'll cut to the chase:


WebAppContext webapp = new WebAppContext();
webapp.setServer(server);
webapp.setContextPath("/");
webapp.setWar("src/main/webapp");
server.setHandler(webapp);

ServerContainer wscontainer = WebSocketServerContainerInitializer.
    configureContext(webapp);
wscontainer.addEndpoint(
    new org.apache.wicket.protocol.ws.javax.WicketServerEndpointConfig() );


Adding the endpoint was the missing piece of the puzzle.

Monday, April 13, 2015

Using HTML5 date type with Wicket

Just a quick note to document the following gotcha using HTML5's date input type with Apache Wicket.

In HTML5, you can have an input field that browsers can render with a date picker:

<input type="date" wicket:id="startDate" />

add(new DateTextField("startDate", dateModel, "yyyy-MM-dd"));


The important thing to note is the date pattern "yyyy-MM-dd".  The date is rendered (at least in my locale) as MM/dd/yyyy, but the browser returns the date string as yyyy-MM-dd, and if you don't tell Wicket that, it won't be able to parse the return value as a string, and you'll get an error.

Wednesday, March 4, 2015

Obamacare on Trial

The arguments being made at the Supreme Court over the precise meaning of the ACA's wording remind me of so many arguments made by 5 year old children.  "When I said we could have ice cream tomorrow, I DID NOT MEAN EXACTLY AT MIDNIGHT".  The meaning of the law was clear at the time; no reasonable person would construe it to mean that subsidies applied only to state run exchanges, and not to the federal ones.  To argue otherwise is simple sophistry.   If the Supreme Court accepts these arguments, then they will have sunk to a new low.


Wednesday, February 25, 2015

Why Obama should support the Keystone XL pipeline

Keystone XL is a horrible project in many respects, and it has become of outsized importance to both sides of the political spectrum.  As much as I hate the environmental consequences of tar sands oil, I think that Obama should support the pipeline with certain conditions.  Much like buying carbon offsets, Keystone XL should be passed if and only if it is accompanied by other legislation that more than makes up for its environmental costs.  These could take the form of stricter limits on coal, higher fuel efficiency standards for cars and planes, carbon taxes, infrastructure spending on greener cities, etc.  If the Republicans really want Keystone, then they need to support something that will more than make up for its effects.  While passing Keystone would be a heavy symbolic loss for the left and gain for the right, if it were offset by even more impactful environmental legislation... well I'd be ok with that.  Lose the battle to win the war.

Sunday, February 22, 2015

What I want from a Smart Watch

I want a smart watch that can act as a key.  That is, I approach a locked door and the door unlocks.  I sit in my car, and push "start".  I surf the web (on my computer), and my passwords are automatically entered (because my computer is talking to my watch).

I want a smart watch that can be biometrically locked and unlocked.  Unlocked via finger print reader, retina scan, or via a sub-dural RFID or NFC chip.

I want a smart watch that is geo-location aware, and can serve up appropriate bar codes, like when I'm at the YMCA entrance counter.

Of course, I want to be able to buy things with it too.

I want a smart watch that can double as a bluetooth headset.  When I receive a call, I can pull off my watch.  The band snaps straight.  One end of the band has a speaker, the other a mic.  Or maybe it just has a speaker phone.

The primary input mechanism for this watch is speech.

In addition to a camera, the watch should have a little LED flash light.  I use my phone's all the time, and it would be great to use the watch instead.

A pico projector would be nice, but that might be asking for too much.

Wireless charging, of course.

Waterproof.

Bluetooth music streaming.