HTML5 support and the latest browsers

I got an email update from Microsoft on their upgrading of Bing Rewards to "Microsoft Rewards", which includes using Microsoft Edge as another way to earn rewards. My first thought was that that wouldn't be too bad for web developers who use multiple browsers, anyway. But, of course, Edge is quite a bit more advanced than the Internet Explorer versions that people are still using.

So I was curious how each browser stacked up, and went to html5test to check on current compatibility.

Browser versions:

  • Chrome Version 51.0.2704.106 (64-bit)
  • Firefox 48.0
  • Safari Version 9.1.2 (10601.7.7)
  • Edge (Okay, I haven't figured out how to find version info on Edge yet)

HTML5Test overall scores (all features in categories are given pretty much equal weight)

  • Chrome: 492/555
  • Firefox: 461/555
  • Edge: 433/555
  • Safar: 370/555

While Firefox looks like number 2 overall, the form elements features in HTML5.

  • Chrome: 64/65, only missing Directory Upload support (no browser listed has it)
  • Edge: 58/65, missing an output element, input type=color.
  • Firefox: 44/65, but missing all the date type inputs, including type=date itself.
  • Safai 39/65<, with similar gaps + datalist element./li>

I also decided to run all four against Acid3:

  • Safari: 100/100, mostly smooth
  • Edge: 100/100, but pregnant pauses and artifacts in the intermediate stages.
  • Firefox: 99/100, completely smooth until it stopped.
  • Chrome: 97 - 99/100. One artifact in the upper left corner, inconsistent results.


There probably won't be much benefit in using Edge as far as uncovering problems traditionally associated with IE, but it is yet another browser that behaves "differently", yet not nearly as frustrating as old Microsoft browsers.

RailsSettings vs parallel_tests

RailsSetting stubbing problem

I have an area of functionality that is controlled by a Settings class that is a subclass of RailsSettings::CachedSettings (rails-settings-cached gem) and changing that setting for tests was interfering with the parallel_tests gem when I ran my rspec tests.

I tried namespacing the cache, making TTL 0, invalidating the cache, monkeypatching the lookup... Every convoluted solution possible... to try and get tests to play nicely together.

The humbling thing about programming is how simple actual solutions are compared the things the brain comes up with.

The solution? Wrap the access to the Setting in a layer of abstraction (which I had partially done already.)

class ThatFunctionality
  def self.enabled?
  def self.enabled=(value)

And then in tests:

before do
  allow(ThatFunctionality).to receive(:enabled?).and_return(true) # or false

Trying again to stub RailsSettings

The class method approach is explicit, but once a large set of settings is needed, it can get unwieldy. If you haven't found a better strategy for wrapping settings values, you can go back to stubbing the :[] method. The caveat is that you need to save the original Settings behavior for any settings that you want to leave unchanged. By stubbing the :[] first to passthrough to .and_call_original, you can add additional stubs on top.

Using an Arduino to keep a Seiki 4K Display On

I love my Seiki 4k Display for writing code on my Mac. The one downside is that it times out and goes to sleep after 2 or 4 hours of inactivity (from the remote, not the screen). I decided to fix this problem in a somewhat complicated way: With an Arduino Uno that I already had, and an IR control kit.

I used the IR receiver to find the Seiki "Volume Up" and "Volume Down" codes, which appear to be structured like NEC codes. Those are hardcoded because I haven't really bothered to refine the setup or code any more. The IRBlaster library uses digital out 3 for the IR sends, and I used digital 8, 9, and 10 for red, yellow, and green indicators to give some indication of where in the refresh cycle things are. The code as-is sends the volume up and volume down signals every hour or so, and the indicators start with a slow blink on red, a slightly faster blink on yellow, and a fast blink before remote send on green.

IR Blaster set up (with IR receiver partially wired in still)
IR Blaster set up (with IR receiver partially wired in still)

IRsend irsend;
int led = 13;
int red = 8;
int yellow = 9;
int green = 10;

void setup()
  pinMode(led, OUTPUT);
  pinMode(red, OUTPUT);
  pinMode(yellow, OUTPUT);

  pinMode(green, OUTPUT);

int choice(int i) {
  if(i > 1300) {
    return red;
  } else if (i > 900) {
    return yellow;
  return green;

void ledOn(int i) {
  digitalWrite(choice(i), HIGH);
void ledOff(int i) {
  digitalWrite(choice(i), LOW);

void loop() {
  while(true) {
    irsend.sendNEC(1086232679, 32); // seiki volume up
    irsend.sendNEC(1086206159, 32); // seiki volume down
    for(int i=1800; i >=0; i--) {

2015 in Review

Monthly Summary


  • Started work on a solo project at work that pretty much gave me lots of experience building something from end to end.
  • Working from home 2/3rds of the time to work out any kinks for a possible move to Florida.
  • Thank yous going out to people who helped fund Emily's medical mission to Kenya.


  • Emily is gone for 10 days on a trip to Africa.
  • I have to dress the kids by myself exactly one day of her absence.
  • ...because the kids were off school due to snow the entire following week.


  • The small solo project goes into "User Experience auditing" mode and I get help actually meeting the demands.
  • The kids were off school due to snow (for entire week?) again.


  • Painting, final prep for selling the house.
  • Spent a week with mostly no cell signal in St George Island


  • Broke news to parents officially that we were moving.
  • Sold the house then listed it. (At least that was the order the offer versus official listing happened in.)


  • Packed up the house, closed on the house, vacated the house, and flew off for the Philippines in a span of 5 days (with our 12th wedding anniversary in between.)
  • Last times accompanying at various churches in Louisville.
  • Went to the Daluyon resort on the island of Palawan in The Philippines.


  • Celebrated my grandmother's 100th birthday with the rest of the family in The Philippines.
  • Realized the madness that is flying to/from and traveling in a foreign country with very picky eaters as kids.
  • Flew back to the US, tried to adjust to jetlag in 2 days, drove our belongings not packed in a trailer to Florida in two cars (one with a broken A/C).
  • Scrambled to find a rental house that accepted a big dog in the school district we wanted, signed a lease, moved in (in a week from arriving in Florida)
  • Officially began my 100% remote work life.


  • Sister-in-law brought our dogs down.
  • Kids started at their new school.
  • I wilted on runs in the Florida sun and heat.
  • Transferred our licenses and cars to Florida officially.
  • Went to beaches


  • Emily waited around on callbacks from job applications.
  • Joined in with the Cathedral music program.
  • Went to beaches


  • Actually saw a decent amount of the area on foot--running.
  • Not so much with the beaches.
  • Emily started a new job!
  • Olivia made All County Chorus


  • Failed at Monkey (intentionally bailed at 11.5 miles, may have missed my bail out point a couple times.)
  • Drove back to Louisville, had good times, but way more hectic than expected.


  • Apparently the A/C can mostly not run in December in Florida.
  • Went back to Louisville for Christmas.



  • Quite a bit of Hamilton the Musical.
  • Surprisingly less music listened to at home office than on site. Strange.


  • 72 Books. Getting into Hamilton the Musical led me Chernow's biography of Hamilton. Excellent book, very dense read.
  • Childhood's End by Arthur C. Clarke and the Space Odyssey series were also exceptional (though I was a bit disappointed in 3001).
  • In following the post-apocalyptic/YA-ish series reads of past years, I got into the Extinction Point series by Paul Antony Jones
  • ...less impressive was the Defiance trilogy (CJ Redwine), probably due to the believability of an alien race doing astounding things versus ordinary humans accomplishing futuristic feats in a world thrown back to the Dark Ages.

Rails 4, phantom ArgumentError: wrong number of arguments (0 for 1) on UserSession.find for AuthLogic

This was a total pain to locate, as the exceptions being raised were pointed to UserSession.find in Authlogic::Session::Persistence.

gems in question:

  activerecord-session_store 0.1.1
  authlogic 3.4.6
  activerecord 4.2.3
  rails 4.2.3

I noticed that the only meaningful difference between the two environments was the following instance variable in Rails.application.config:

irb> pp Rails.application.config

Commenting out this initialization in the environment allowed the application to work again.

   config.logger ='name of log'))

Searching on "usersession syslog rails 4" results in the following issue as the third search result: Version 0.1.1 breaks Syslog::Logger setups There is a fix in master, but it doesn't seem to have been published. I had promoted activerecord-session_store to 0.1.1 because DEPRECATION WARNING: `#quietly` is deprecated in rails-4.2.0.beta4, but it looks like locking the gem at 0.1 will work otherwise except for noisy tests.

Pundit: NoMethodError (undefined method `verify_authorized' for [WhateversController])

Sometimes, having done things several times before can make you miss the OBVIOUS.

After adding

  after_action :verify_authorized

to my ApplicationController to verify that Pundit was being used for authorization, I got the following error in rspec:

  2) Jobs GET /jobs works! (now write some real specs)
     Failure/Error: get jobs_path
       undefined method `verify_authorized' for #
     # ./spec/requests/jobs_spec.rb:6:in `block (3 levels) in '

Maybe there's a problem with my RSpec? Nope:

Started GET "/" for at 2015-07-31 07:13:17 -0500
Processing by JobsController#index as HTML
  Job Load (0.1ms)  SELECT "jobs".* FROM "jobs"
  Rendered jobs/index.html.slim within layouts/application (0.5ms)
Completed 500 Internal Server Error in 8ms

NoMethodError (undefined method `verify_authorized' for #):

Okay, does ApplicationController have the method?!

irb(main):008:0> :verify_authorized
=> false

Ok, am I doing that wrong?

irb(main):010:0> :authenticate_user!
=> true

Sigh. *Rereads documentation.*

Screenshot 2015-07-31 07.25.24

What's missing? Oh yeah, a simple `include Pundit' in the ApplicationController

Bootstrap 3 radio-inline and checkbox-inline elements running together.

I was having issues with Bootstrap 3 radio buttons running together even though the labels had a "radio-inline" attribute.

After examining the layout of the html being generated, I realized that each individual label and radio button was being wrapped in its own containing element (in this case, a "td" element.)

The reason for this is the following CSS:

.radio-inline + .radio-inline, .checkbox-inline + .checkbox-inline {
  margin-top: 0;
  margin-left: 10px;

If the .radio-inline elements aren't adjacent to each other, the 'margin-left' value will not trigger.

Unfortunately, it took a little too long to track down the source of the issue, but now I know.

The "Satirical News" Sites Need to Stop

The Onion has always been entertaining because it either operated at a very generic level or a very absurd level. While The Onion could be mistaken for real news, it was often involving a person that didn't exist, a generic group of people, or things so absurd that no reasonable person could believe them to be real. Besides, The Onion was THE ONION.

However, now there's a proliferation of "satirical news sites".

The latest in the absurdity is Newslo, which is:

JUST ENOUGH NEWS… Newslo is the first hybrid News/Satire platform on the web. Readers come to us for a unique brand of entertainment and information that is enhanced by features like our fact-button, which allows readers to find what is fact and what is satire.

I'm trying out "SatiricAlert" to help me filter out this crap that has proliferated way too much to be entertaining anymore.

Hooking in an LDAP Test Server to Cucumber Tests

I managed to get a custom Devise strategy with LDAP working, but had no clear way of automating tests. I wanted to validate if I still had to keep the password fresh in the database, and needed to be able to write scenarios around that in case someone attempted to refactor out the code.

After trying to incorporate the spec strategy used in the development devise_ldap_authenticatable and failing, I found a ruby wrapper of ApacheDS called ladle that looked like it would serve my purposes.

I included in gem in my test group in my Gemfile:

  gem 'ladle'

At the top of my features/env.rb file for configuring cucumber, I turned off admin binding (wanted the connection as simple as possible):

::Devise.ldap_use_admin_to_bind = false

I then created an @ldap tag for my LDAP-dependent features than would start and stop the LDAP server in those instances. (Again, in my features/env.rb... probably need to clean that up.)

Around('@ldap') do |scenario, block|
  $ladle ||=
    :ldif => "spec/ldap/test_users.ldif",
    :domain => "dc=example,dc=org",
    :quiet => true

I then created an the spec/ldap/test_users.ldif (from following the example in the ladle project).

version: 1

dn: ou=people,dc=example,dc=org
objectClass: top
objectClass: organizationalUnit
ou: people

dn: uid=eadmin,ou=people,dc=example,dc=org
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: inetOrgPerson
cn: Example Admin
sn: Admin
givenName: Example
uid: eadmin
# Password is "b44b44bl@cksh33p!"
userpassword: {SHA}Aedq5WHQSxglvJSfpX0kgdGRdHk=

I generated the password with:

  slappasswd -h {SHA} -s b44b44bl@cksh33p!

One stupid mistake that I did in the process was kicking off two Ladle servers (with slightly different parameters). In one iteration, I couldn't bind to the user. Another, the server using the test file failed to start. Be aware that Ladle will run happily with default parameters, but that they won't be much use to you.

If you want to test your configuration file:

require 'net/ldap'
require 'ladle'

$ladle ||=
  :ldif => "spec/ldap/test_users.ldif",
  :domain => "dc=example,dc=org",
  :quiet => true

ldap = 'localhost',
    :port => 3897,
filter = Net::LDAP::Filter.eq('mail', '') # or ('uid', 'eadmin') => 'ou=people,dc=example,dc=org', :filter => filter) do |entry|
  ldap.auth(entry.dn, 'b44b44bl@cksh33p!') # or whatever your password is

  entry.each do |attribute, values|
    puts "   #{attribute}:"
    values.each do |value|
      puts "      --->#{value}"

Kentucky Lottery Pick 3 Expected Payout

The expected payouts for the Kentucky Lottery Pick 3 game have an interesting idiosyncrasy. Playing the special "Straight Box" play pays out better than a separate 50¢ straight and 50¢ box play.

All other plays average 60¢ per dollar played, but the straight box seems to be 65¢ and 70¢, depending on the numbers played. Maybe my spreadsheet is wrong somewhere in here:

Kentucky Lottery Pick 3 Payouts and Odds