My Periodical Playing with Perl

When I get my copy of ;login: from USENIX I page through looking to see if there is a tool that I can use. I pay more attention to the PERL Tools section as I want to learn more about PERL and add it to my tool belt. But I have yet to really wrap my clogged brain around learning a new language, (For those that talked with me at LISA’16 I raved about the Intro to R tutorial and have added that as a task to start looking into using it. but I digress). Most of my day is spent working on our legacy system which runs under SCO 5.0.6 (cue the moans). Sadly the version of PERL on that system is brutally not updated and adding modules is a chore. So I usually end up getting my data and moving it to a Ubuntu box if I want to get at it with PERL.

So my ability to add some new found tools to my system has not been fruitful but I have found some tools that I can use for my personal use. In this latest ;login: David Blank-Edelman wrote a neat article where he used the API from Darksky (http://darksky.net).  It was a little diddy that gave you the forecast for a certain location. That is fine as I figured I could use the code to make something for my football team to use during the season. I know there are apps for this but I am constantly bugged for weather forecasts game week and game day. I have to fumble on my phone, fire up the app, get the correct page, scroll to the map or forecast. When I say “It looks like we will get rain in the 4th quarter.” some other wise guy will say “My app doesn’t show that.” or “Well what about pre game.” There is always a wise guy around. But I figured I could set this up to run for me during game week at different times and I could get it a bit quicker.

To be truthful the last part of the article intrigued me as it showed the weather on each of his birthdays. I said wow, that is neat. Now I am a bit older than David, I have been referred to as older than dirt at times, but it looked neat to see what it was like 67 years ago in the dark ages of pre color TV, computers the size of small garages, $0.5 beers, $0.10 gallons of gas enter your own 1940’s comment).

I logged into one of my Ubuntu VMS at $WORK and proceeded to update the PERL environment and started copying the code to test it. Getting the account on Dark Sky wasn’t hard and the service is practically free for what I plan to do (play around). I think if I start getting billed I must have learned something.

The code worked great except for one thing. In David’s exam,ple his answer comes in the correct time zone. For whatever reason mine came out with some Timezone in Africa or somewhere. That is work on my part to see where I screwed up but before you start telling me to check my own Timezone setting I did that and I am set to America/New York.

So all of the examples worked just fine. I got to the Birthday version and found that most of the time my birthday will have a partly cloudy day, But if you see the donut and not the hole in the donut you can say my birthdays are mostly partly sunny. Here is the graph of the output:

 

:******
clear-day :**
fog :
partly-cloudy-day :****************************************
partly-cloudy-night :********
wind :

 

Yes on 8 of my birthdays there was no weather.

1951:1952:1953:1954:1955:1956:1971:1972:

I can’t speak for the 50’s but in ’71 & ’72 I can remember the sun shining and I was camping. But then it was the 70’s and a lot of us during that time were seeing a lot of things that may not have been there. 😉

 

All in all it is a neat app and I now have something to look at and see how PERL did it.

My thanks go out to David. I would post a link to his article but I am not sure if I am allowed as it is published by USENIX and I had to login to view my electronic copy.