Ramiro Franco

TZ Tactics.

Written on Friday June 7, 2013 at 3:30 p.m.

Timezones. For the most part, I like and agree with their purpose. They help maximize the amount of time people spend awake during the day, keeping them less prone to seasonal affective disorder, and saving power for homes and businesses, in turn using less fossil fuels.

My issue with timezones lies in programming, where they are a minefield of problems waiting to happen, and yesterday my coworkers and I managed to blow up a few of them.

The first issue we stumbled on was relatively minor, everything just seemed to be an hour off when it involved daylight savings time. We seemed to have it fixed, until our app went into staging, where all of our times were now around ten hours off. What happened? Turned out in local development where all time was local, things behaved as expected, our staging environment are all running on utc, so whatever method we had in place was simply translating time to local machine time.

We did eventually stumble onto a clumsy solution that was astonishingly similar to what it was before. We used a little bit of javascript to trim off timezone data attached to date time objects on the front end, then on the back end, took the users choice of timezone, set that as the time zone in a before_save method, and just parsed a time object from the string sans-offset. It's not pretty at all .. but it works:

If anyone knows of a way to clean that up further, I'd love to hear it, but for the time being this seems to be the only way we can generate a Datetime object in the right time zone in Rails.

Educating Portland

Written on Thursday May 30, 2013 at 3:48 p.m.

Yesterday I ventured out for lunch with Dave and Kevin to meet a promising young man named (Jackson Gariety)[http://jacksongariety.com]. We had no real expectations or requests, just wanted an opportunity to pick his brain and maybe get his perspective on a couple of things.

We first talked about his ambitious and promising entrepreneurial goals, we talked about his educational goals, and then we talked about his experience teaching a programming class at his school, to a class of only eleven students even though one-hundred-and-fifty or so had applied, because those were all the computers the school could muster for the course.

That last snippet rejuvenated my concern for the Portland education system. I feel high school is an important part of education for most people, so that they have a good rounded introduction to several subjects ( and at least some grasp of world history ) before entering college. It seemed however, that what high school should be, is far from what it actually is at the moment.

I know I can't change things all by myself, but I can certainly help raise awareness of how bad things are. So I intend to.

I was also inspired to start up my own mentoring / beginner programming workshop oriented toward youth again. I have the space, it's just a matter of organizing it and making the time at this point.

Months Later.

Written on Tuesday January 22, 2013 at 12:49 a.m.

It's been roughly a million months since my last update, despite my repeated announcements that I would in fact, keep things up to date.

The main culprit behind it has been my work. I'm not complaining mind you, I enjoy what I do, I just haven't had any time to myself really in months, and what little I have had, I've tried to spend away from any computers.

I think I'm finally ready to spend some of my downtime on my sites and projects again though, I've even taken a couple of contracts back up.

I'm going to pick up a copy of Pikmin 2 for the Wii today, and I'm excited to replay that on the Wii U. I can't tell if it's true or not that upscaling applies, but it certainly seemed that way when I went through the first Pikmin title, and this will get me caught up and ready to enjoy the third.

Inline-block-parents Are Terrible.

Written on Wednesday August 22, 2012 at 9:41 p.m.

I recently ran into this strange "jitter" with elements animated by jQuery, and searching for the culprit I found that a parent element set to inline-block in order to auto-adjust the width to the content was the source of my problem.

Normally, I don't really see an issue with people using inline-blocks for parent elements ( despite the title), though I'm not particular for it when a block is not really meant to be displayed inline but as a document-container.

In this situation it was causing some visually jarring problems in animation, but we still needed the block to expand to the size of the content dynamically.

I of course turned to more jQuery / JavaScript (CoffeeScript) for a solution, and found a pretty simple one:

This does a fantastic thing where, we find out what the size of the block turns out to be for its particular instance, and we just set it manually before switching it to a block. No flicker, or fuss, just a super easy solution. If only that were the case more often.

Getting Friendly with Ubuntu VMs + OSX Hosts

Written on Tuesday August 7, 2012 at 5:47 a.m.

I can't tell you how many countless times I've setup Ubuntu VMs for development, but I've only for the last couple of years done so on a linux host. This whole time I've been setting up /etc/hosts (frequently) because I couldn't find a great way to get hostnames working between the two. Well, the following snippet will get you everything you need to get the two talking over Bonjour:

Simple enough right? You can test this out by typing trying:

Where guest is the hostname for your guest machine.