Archives

Written by

Down and Dirty Timezone Migration

Our application at work is very dependent on users having their timezone set. We store all our event times in UTC/GMT and thus we need the user’s timezone to properly display it for them so it makes sense. Turns out we missed some spots where we weren’t setting timezone plus we had a fair amount of early accounts that never had it set cuz timezone came later.

So most all of our accounts have an address so i figured we could look up the timezone based on the address. I first looked at Google’s geocode api and we could use that to submit and get the timezone based on address but they only allow 25k requests per day for free. I had to convert some ~424K so i could do a few every day for several days of maybe not.

Next I thought well i already know the address and based on state you can figure out the basic timezone. I know time is hard in programing cuz of all the strange geography across the us, but i figured i could 90% covered by just doing the basics.

So i just used the following array to compare the state and then set the timezone based on the match. I still need to updated it for Canada provinces but this is working fine for now.

$tz_states = array(
'America/Los_Angeles' => array('CA', 'NV', 'OR', 'WA'),
    'America/New_York' => array('CT', 'DE', 'FL', 'GA', 'ME', 'MD', 'MA', 'NH', 'NJ', 'NY', 'NC', 'OH', 'PA', 'RI', 'SC', 'VT', 'VA', 'DC', 'WV'),
    'America/Anchorage'=>array('AK'),
    'Pacific/Honolulu'=>array('HI'),
    'America/Boise'=>array('ID'),
    'America/Chicago'=>array('AL', 'AR', 'IL', 'IA', 'KS', 'LA', 'MN', 'MS', 'MO', 'NE', 'OK', 'SD', 'TN', 'TX', 'WI'),
    'America/Denver'=>array('CO', 'MT', 'NM', 'UT', 'WY'),
    'America/Detroit'=>array('MI'),
    'America/Indiana/Indianapolis'=>array('IN'),
    'America/Kentucky/Louisville'=>array('KY'),
    'America/North_Dakota/Center'=>array('ND'),
    'America/Phoenix'=>array('AZ'),
);

full code can be found here

All city band. @SeattleReignFC halftime http://t.co/iD6TTqSXuB

Embed code not available


from Twitter http://ift.tt/V35tr2

August 06, 2014 at 08:08PM
via IFTTT

@SeattleReignFC 3-0. Go reign! http://t.co/GHCJbFbxYM

Embed code not available


from Twitter http://ift.tt/V35tr2

August 06, 2014 at 07:54PM
via IFTTT

Tangerine Sky by Blackbird Blackbird

The latest album I’ve discovered – Tangerine Sky by Blackbird Blackbird. Good music to code by 😉

What a drag it is getting old

or what a messed up spring i’m having… So it all started the middle of April when I started to feel bad on a Saturday. Fever and a slight cough. Things got worse over the weekend but then they started to get better the beginning of the week. Still had the fever and was living on Tylenol but felling better each day. the one thing that kept worrying me was the gurgling in my chest. Never had that before, so off to the doctor on Wed to find out I had pneumonia. He gave me a course of some powerful antibiotics. After taking my first pill, Robin read that one of the side effects was hallucinations. Well i never hallucinated but that first night things were a little strange. I spent the rest of that week on the couch trying to avoid coughing which was slowly developing a sharp pain in the right side of my lower back. I dreaded the cough as it would shoot sharp pains down my butt and outside of my right leg down to the outside of my calf. The following week I started back to work feeling much better, but still week and i was starting to develop sciatic pain. Nothing that was too bad and over the course of the morning that involved some stretching and hot shower and heated seats in the Passat, i could walk okay with out pain by late morning. Slowly but surely I started to get better but the sciatica continued and kind of started to get worse. Robin went away for the weekend to visit her dad and step mom in LA and next to my kidney stones, the morning walk for the dog was one of the most painful things I’ve felt. Still it would always seem to work it’s self out and get better. Finally after a couple of weeks of things not getting better, Robin convinced me to see our acupuncturist. She had helped me with a similar thing a couple of years prior. So I went on a Wednesday night and the treatment felt pretty good while i was on the table, but when I got up to leave things actually seemed a little worse. That evening I iced a little but still it was not better but not too much worse. Then came Thursday morning and the pain. I could not stand… I could not walk… I was in bad shape. Luckily I was able to get an appointment with my Doctor later that morning. I rested for a couple of hours and then the time came were i had to get to the car to get to the appointment. This was the start of 50 feet of pain and agony that I wouldn’t wish on my worst enemy as they say, but actually i probably would cuz it hurt like a mother fucker! I crawled and part of the way out of the bedroom then used the table and chairs and walls to slowly limp out the back door and the stairs to the patio. Robin pulled up behind the house and I some how got to the car. When we pulled up to the medical building and she was going to drop me at the elevator so she could park, I knew there was no way I could walk to the office so I had to ask her to see if they had a wheelchair I could use. She parked and went off in search and I was praying that she could bring something back cuz there was NO way i was going to make it. Thank the gods, cuz she came back with a wheelchair and I struggled to get out of the car and in the chair and then she wheeled me to the checkin. Luckily i could just go straight in and when the nurse asked if i could stand for a weight I said i’d prefer not especially since i was just in a week ago for my pneumonia check up. i couldn’t have changed that much. Then the diagnoses, bulging and/or herniated disk. In fact it was a classic L5 disk based on the way the pain went and how I couldn’t keep my big toe up on my right side when he pushed on it. I was starting to get a little worried because Robin’s dad had just gotten surgery for the same basic thing and I didn’t want to have surgery. Options that i had were course of prednisone, direct injection of something into my spine at the disc or surgery. The doctor recommended we start with the pred and go from there and we agreed. So they called in a prescription for the pred and also some Hydrocodone. With the time on my back I started to search the internets for help ;-). I actually found this guy, a chiropractor, Dr. Ron who’s side http://www.healyourbulgingdisc.com made a lot of sense. First I started with his advice on ice and that actually started to give me some relief. I also think the pred started to kick in and the Hydrocodon didn’t hurt either. So now after a few icing sessions I can get around the house with my “walker” (chair with wheels that i lean on). At least I can sometimes put the ice pack back in the freezer and get it out for my next session. I’ve now been sick for like 5 weeks and it is a drag on everyone especially Robin who has been great taking care of me. Thanks!

Iphone

This post is from my iPhone. I’ve only had my iPhone for a few days but this is pretty cool. Sitting in bed, writing a blog post! This just might inspire me to write more often. This along with ssh and of course Rhapsody and maps and kexp … The list goes on. Welcome to the modern world old man.

What you can get me for my birthday

It’s that time of the year when I update my “what you can get me for… ” post. It has been some time since my last one and things have changed a little but most of the items from my previous posts didn’t leave the list. So again this year I’ve found a few items that seem reasonable for my birthday list, so I thought i’d re-purpose the list again for xmas and add a few things. Here we go… The list will probably change so come back often and it still includes some big things. In no particular order:
  • David Vantage Pro2 Weather station.  check out Ambient Weather and Provantage. You must request a price quote via email – an automatic response is returned with a new link promptly. They are not allowed to post to the public their discounted prices.
  • cool new laptop backpack like this booqbag.
  • One of these cool shirts: http://www.thinkgeek.com/tshirts-apparel/interactive/ I particularly like the “Wi-Fi detector shirt” and the “T-Qualizer Shirt
  • An ATHF Mooninites patch. Either both Ignignokt and Err or either one of them alone. I desperately want to cover up my Real logo on my computer bag. I think I have one of these patches but can’t find it.
  • Beer Cozy for my Pabst cans!
  • Been reading more so good books. Nothing too heavy now. I like fast, easy, with short chapters
  • Washington State Liquor Gift Card – more info
  • Home Depot gift cards are nice and help offset house projects
  • I could use some more running shorts. I like the longer style, not the true runner’s shorts. Robin got me some Nikes called NikeFit and they are kind of longish like basketball shorts, but not too long, something above the knee but below the mid thigh. (can you say high maintenance?!) Oh and I like the polyester wicking fabric of course… no cotton. I’m a Medium or 33/34 waist.
  • Running shirts that are short sleeved, white or light color, like gray or light blue. I’m a large and again the sweet wicking fabric.
  • All-In-One clamp guide accessories. I recently got some great clamps at the Rockler T-Day sale and now it would be nice to have a couple of the accessories for them. Namely the Router Plate and Saw Plate for the clamps. Both can be found here.
  • the winning lottery ticket
  • The new MacBook Pro 15 inch
  • If you are already doing the MacBook, why not go a little further and also get me a Cinema Display
  • New Gas stove and range like the Dacor Epicure 48″ dual fuel. Along with that we need the Epicure Raised Vent also. We don’t want to have to put a traditional hood in.
  • I think I’ve fixed the leak in the car, so now i just need the new driver’s seat for my CRX
  • Maybe a new “CRX” like a diesel Jetta or Golf/Rabbit
  • Or Maybe just a scooter

What you can get me for X-Mas

Since most of the items from my post on what you can get me for my birthday didn’t leave the list, I thought for x-mas, I’d just re-post and make a few additions. Just as with my birthday, year usually around ThanksGiving when the family gets together, I get the question “what do you want for Christmas?” and I always don’t know what to say. Partially because I immediately think of the big things I want or need and have trouble of thinking about smaller items. So again this year I’ve found a few items that seem reasonable for my birthday list, so I thought i’d re-purpose the list again for xmas and add a few things. Here we go… The list will probably change so come back often and it still includes some big things. In no particular order:
  • One of these cool shirts: http://www.thinkgeek.com/tshirts-apparel/interactive/ I particularly like the “Wi-Fi detector shirt” and the “T-Qualizer Shirt
  • An ATHF Mooninites patch. Either both Ignignokt and Err or either one of them alone. I desperately want to cover up my Real logo on my computer bag. I think I have one of these patches but can’t find it.
  • Beer Cozy for my Pabst cans!
  • David Vantage Pro2 Weather station.  check out Ambient Weather and Provantage. You must request a price quote via email – an automatic response is returned with a new link promptly. They are not allowed to post to the public their discounted prices.
  • Been reading more so good books. Nothing too heavy now. I like fast, easy, with short chapters
  • Washington State Liquor Gift Card – more info
  • Home Depot gift cards are nice and help offset house projects
  • I could use some more running shorts. I like the longer style, not the true runner’s shorts. Robin got me some Nikes called NikeFit and they are kind of longish like basketball shorts, but not too long, something above the knee but below the mid thigh. (can you say high maintenance?!) Oh and I like the polyester wicking fabric of course… no cotton. I’m a Medium or 33/34 waist.
  • Running shirts, white or light color, like gray or light blue. I’m a large and again the sweet wicking fabric.
  • My mighty mouse is starting to die. I’ve opened it and cleaned it twice now to prolong it’s life, but now it stutters and pauses every once in a while so I think it’s on it’s last legs. The good news is Apple has a cool new mouse – the Magic Mouse!
  • All-In-One clamp guide accessories. I recently got some great clamps at the Rockler T-Day sale and now it would be nice to have a couple of the accessories for them. Namely the Router Plate and Saw Plate for the clamps. Both can be found here.
  • the winning lottery ticket
  • The new MacBook Pro 15 inch
  • If you are already doing the MacBook, why not go a little further and also get me a Cinema Display
  • The new iphone 3GS. In my birthday list I also asked for 6 months of service, but I think I need the phone more now and I’ll figure out the service fees.
  • New Gas stove and range. One were the vent is attached and popus up from back. We don’t want to have to put a traditional hood in.
  • I think I’ve fixed the leak in the car, so now i just need the new driver’s seat for my CRX
  • Maybe a new “CRX” like a diesel Jetta or Golf/Rabbit
  • Or Maybe just a scooter

People and Their Trash

Why are people so protective of their trash? A couple of years back Robin and I were on a dog walk and after the dog took a shit, we picked it up in our plastic bag like good dog owners. We walked on a block or so and then I ran in to the next ally and dropped it into a trash can. Well, by the time we reached the middle of the next block a woman came running up with our bag of poop yelling at us. She did not appreciate us depositing our trash into her trash can. She also made a note that she didn’t have a dog. We apologized and gladly took the poop bag back continued on our walk. At first I could kind of understand were she was coming from but at the same time I couldn’t really understand the big deal. Doesn’t it all end up in the same place? I know that we all have to pay for our trash but it didn’t seem like this small item was going to push her over the edge and cost her an extra fee for too much in her container. Was she worried that my trash was going to react some how with hers? Was the garbage collector guy going to judge her some way for having a poop bag in her trash?… “That’s funny, Mrs. Smith usually doesn’t have poop in her trash. I wonder if something is wrong?”. Recently as I’ve taken my run and/or walked the dog on trash day or the day after, I’ve noticed that people will have their yard waste and recycling cans out in front of their house but not the trash. Personally we keep ours all together and couldn’t imagine having the trash can separate from the rest of the “waste”. So what is it with people? What is so private about our trash that we have to hide it away and keep it untainted by other’s trash? Is it a security thing? As far as the poop goes, we’ve recently purchased a in-ground dog waste digester from Dr. Foster Smith and I’m going to order some digester safe/Flushable poop bags. So from now on the poop won’t be going in yours or my trash and better yet it won’t be commingling at the dump.

Starting over

It has again been a while since my last post but this week I’ve essentially started over on my running. After hurting my right achilles, several weeks of Dr. mandated rest, I was finally okayed to start back this week very slowly. Today marked my third, as I like to call it, rehab run. The Dr. said start off slow with 2 miles and do more walk then run and then a day off and no hills. So Sunday I started with 1.5 mile walk with a 1/2 mile light run on the flat parts only. Then ice and rest. Tuesday was my next run and I was able to up the running a little did about 1.25 mile walk with the rest run, but again I walked the hills and only ran flats or down hill. Today I did about a mile running, again all flat and walked the hills. Things are feeling okay and I will slowly up the running each time out. I think if things go well all next week, I’ll start to ease back into a more regular training schedule, but probably will start my training program all over again. Starting with week one and 3 miles.
v.sg