A bad date with Little League

A date dropdown only a developer can appreciate….

Little League has some strange rules regarding what division a child can play in. You’d think it’s based on age, and you’d be mostly right, except for the asterisk.

A child’s league age is dependent on what month they were born in. It also depends it they were born before or after Sep 1, 2005, which I think was done to “grandfather” some players in such that they wouldn’t have to move down a level.

This is summed up nicely on our Middletown, NJ little league site:

For boys born on or after September 1, 2005, your player’s Little League age for the 2017 spring season is your player’s age on August 31, 2017. Therefore, a boy born on July 5, 2007, would have a Little League age of 10 for 2017. And, a boy born on September 5, 2007, would have a Little League age of 9 for 2016. For boys born before September 1, 2005, your player’s Little League age for the 2017 spring season is your player’s age on April 30, 2017. Therefore, a boy born on April 8, 2005, would have a Little League age of 12 for the 2016 season. A boy born on May 5, 2005, would have a Little League age of 11 this season.

Sound confusing? It is. So much so that littleleague.org create a handy little calculator to help you determine your child’s league age. Functionally it delivers. What struck me as funny (and honestly slightly amateur, inept and embarrassing) was the order of the months in the drop down - see for yourself.

[caption id=”attachment_695” align=”aligncenter” width=”791”] January, October?, November?, December?, … what?[/caption]

For us (Javascript) developers, the problem is obvious. Javascript sorts alphabetically (not numerically) and since January is month 1, October is month 10, November 11 and December 12… these numbers actually come before 2 (February)! To make matters worse, Jan is actually 0 and Dec is 11. This is the kind of quirkiness developers put up with!

Here’s what sorting an array of strings that look like numbers looks like in Javascript

a = [‘8’, ‘1’, ‘10’, ‘2’, ‘11’, ‘3’, ‘12’]
a.sort();
[“1”, “10”, “11”, “12”, “2”, “3”, “8”]

It’s a really silly mistake to make and easy to correct.

After some further digging, the page uses an iframe that points to this address - http://74.120.127.52/db_browse/leagueage/index.asp. Which is weird that it’s not under the littleleague.org domain. It’s also running ASP which is likely where the bad code is written.

I wonder what else we can find under /db_browse/ …

OK that’s enough for this rabbit hole!

iPhone free space

I am constantly running out of space on my iPhone. I used to have 50+ updates waiting to be installed because every time I tried to install them, I got the “insufficient space available” message. I did the obvious things like deleting photos and videos, removing them from the “Recently Deleted” album, and deleting any apps I don’t really use (most are really small though). I cleared cache within Safari (which I never purposely open, I use Chrome), I closed all tabs in both Safari and Chrome. I was really reaching. I even went as far as deleting the iTunes app (don’t do that, we need it later), the Apple Maps* and the Watch app. No mercy!

This didn’t get me very far. I did notice that Messages was taking up the most space, so I started going into group chats and removing the pictures and giphys that I didn’t need anymore. This had a fairly significant impact, at least the first time I did it. I don’t use iCloud so I like to keep some threads alive, but I definitely didn’t need all the stupid giphys that were in them.

This still wasn’t enough. At this point I even restarted my phone thinking that it would clear out some temporary files or something. No change.

After some Googling and visiting a few shady looking sites, I found the answer. And I didn’t believe it when I did it, and you are just going to have to trust me. Here are the steps -

  1. First, let’s check how much free space you have now -> Settings, General, & Storage iCloud Usage and look at “Available”
  2. Open the iTunes Store on your phone (I had to reinstall it after deleting it to try to conserve space!)
  3. Search for ‘war and peace’
  4. Open the War and Peace movie
  5. Tap on ‘$3.99 RENT’
  6. iTunes will try to rent it, then fail because there isn’t enough space. YOU WILL NOT BE CHARGED. This is where the trust comes in. Trust me, I have done this 20 times already.
  7. Now go back to Settings and check your Available space
  8. Bask in the glory of all your free space!

Why this works - First, the most important thing, to avoid the $3.99 charge, you must is to find something that has no chance in hell fitting on your phone. The HD version of War and Peace weighs in at 8.8GB. My phone is only 16GB so I’m safe here. If you have a 64GB phone this may actually fit, in which case you will get charged $3.99. You’ve been warned!

The internet seems to think that this method works because this forces iOS to clean out any temporary files and empty some caches that you, as a lowly user and owner of your phone, are not allowed to do.

So, you might be thinking “If thousands of people start using this trick, will there be an investigation as to why War and Peace is so popular?” Yep, that’s probably true. Their conversion rate of “clicks on rent button” to “charged $3.99” will absolutely suck and someone will be up in arms!

* One annoying thing about deleting the Apple Maps app is that you can no longer open an address from another app, like Calendar. This is annoying because I have both Waze and Google Maps. This is a vendor lock-in that will eventually get enough attention, but for now it’s not that big a deal to me.