Written Exam

I wanted to write here that I passed my written exam for my Private Pilot’s license and am INCHES away from being a private pilot. I studied hardcore this week, and last weekend I went to a Seminar in Albany (ok.. Schenectady) and picked up what I have been forgetting from my Ground School.

The next steps are to meet with mt instructor and talk about what I did wrong on the written, practice some more with actual flying, and then take the practical. The main thing holding me back right now is wind. It’s been very windy and I haven’t flown a lot since January so my skills are rusty. I need to get over my fear of winds higher than 10kts and adapt my skills to the situation.

I was hoping to get my license before my birthday on March 3, but I don’t think that would be doable in the following two weekends.

HubSpot

I was invited to a Hackathon that one of our client’s client was throwing. Being that I love programming and learning, I decided I would go.

The event was in Cambridge, MA. I arrive early, (my friend said there would be a lot more traffic than there was at that time of day) so I got a tour of office. It’s situated in an old, what I believe to be, factory building. The coolest part of the office was that they had whiteboard paint on every wall surface, complete with markers of course.

The event started and people who were attending had tossed up ideas on the white board. A couple people wanted to integrate LinkedIN with HubSpot. Another person wanted to integrate Eventbrite with HubSpot, to get information to/from event goers after the event ends. I didn’t like any of those ideas and my only experience with HubSpot is their Leads API, so I stuck to what I know.

I had an idea for an app the second I walked in the door, it was like magic. My main hassle was that HubSpot’s Canvas integration REQUIRES HTTPS. Now, my web host is DreamHost and I am kind of cheap, so of course I don’t have any way to host a HTTPS site immediately. A big part of me wanted to bite the bullet and order a secure server from DreamHost, or setup another linode, but I felt that I’ve been spending a lot of money lately and that I would figure out a way. Adrian, my contact at HubSpot, of who I am working with on the PPC project(more on that later), walked by and saved me.

He asked if I had ever used GoogleAppEngine. Of course I hadn’t because I was under the belief that it cost money to use, but then I realized I was thinking of Amazon’s EC2. I sign up for GAE and within an hour I have a HelloWorld site setup. The slow part was installing Python2.5 so I could use the same version that GAE used and not have to fix a lot of backwards compatibility errors between 2.5->2.7.

After I had a site up that could do HTTPS I dove into programming for my HubSpot app. The app I am doing for work graphs leads per day combined with Google AdWords data per day. I decided to do something different. My app is still a graph, as graphs are fun and easy to understand by everyone.

This app graphs a set of leads and shows how many leads happened in a given hour for the previous day. Given extra time I would have added an interface to specify the day to graph leads, but last night my time was severely limited by the fact that I had to setup my environment for GoogleAppsEngine.

Improvements I can and want to do to this app are database, faster processing, and being able to select a date. I almost wanted to break down and learn NodeJS for this, because from my understanding of the event driven nature of NodeJS would be a lot easier to load data over a longer period of time, than to just load it all at once and timeout with HubSpot’s Jakarta Commons-HttpClient.

Vertical bars in Graphite

I am working with txStatsD and Graphite. I was having the hardest problem looking through the txStatsD code today finding how to graph something as an event, not a data point. I eventually went into every option on the graphite dashboard and found an option to make a bar.

This is the option that you must use when you want to mark events. For example we want to know “Server restarted”, we would use this technique, as it doesn’t make sense to aggregate “server restarted”. Using nonzero as infinite is a good way to show an event took place.

You can un-expire a GPG key.

Today we had a problem at work on a system. Without getting into too much detail as to give away secrets behind the verbal NDA I am behind, I will just say that it had to do with a GPG public key of mine that was expired on a dev machine, accidentally propagating during install to a production machine.

This key had a sub key as well, so figuring out this was tricky.

To start, you can list your gpg keys like so

gpg --list-keys

This will list keys such as
pub 4096R/01A53981 2011-11-09 [expires: 2016-11-07]
uid         Tyrel Anthony Souza (Five year key for email.)
sub 4096R/C482F56D 2011-11-09 [expires: 2016-11-07]

To make this not expire, (same steps to change expiration date to another time), you must first edit the key
gpg --edit-key 01A53981
You will then see a gpg prompt

gpg>

Type “expire” in and you will be prompted for how long to change it to
Changing expiration time for the primary key.
Please specify how long the key should be valid.
        0 = key does not expire
      <n> = key expires in n days
     <n>w = key expires in n weeks
     <n>m = key expires in n months
     <n>y = key expires in n years

You are then done setting the expiration on the primary key, if you have sub key, doing this is as easy as typing
key 1
and repeating the expiration step.

To finish and wrap things up, type save and you are done.

Custom Django URLField

For work I had to write a custom url model field. This model field when setting up accepts a default protocol, and a list of other protocols.

When checking the protocol, the url is split by “://”. If the split has one or two parts, then the url is validly formed.
In the event of a single element split, there is no protocol specified. When there is no protocol, the url is prepended with the default protocol specified. If there is a protocol, it is checked to make sure it exists in a union of the default protocol and other protocols. If it is not, a ValidationError is raised letting the user know that the protocol is not accepted.

This can all be found at On my github.

I have a couple ways I could have done this better and probably will. Improvements would be just one parameter called parameters in which it is checked if there is at least one element. Passing this, when there is no protocol specified, the first element is the default one.
This would be a little cleaner.

this example would allow for http, https, ssh, spdy and mailto, anything else would error out.
facebook_page = URLField(default_protocol="http",
protocols=["https","ssh","spdy","mailto"])

The way I could improve this would be
facebook_page = URLField(protocols=["https","https","ssh","spdy","mailto"])

Python Progress Bar

I was looking for a nice progress bar today at work to show progress rather than just printing “Waiting 30 seconds…” and having the script do nothing, I wanted to have a progress bar show.

I found a progress bar from Corey Goldberg

I did make a couple changes, and have uploaded my changes to my GitHub account.

newPythonProgressBar

To use this progressbar, it is very easy.

# To Setup
from progress_bar import ProgressBar
import sys
import time
def updateBar(step):
    p.update_time(step)
    sys.stdout.write("%s\r" % p)
    sys.stdout.flush()
#
# to call
#
wait_time = 100 # seconds
p = ProgressBar(wait_time)
p.empty_char = "."
p.unit = "^"
for step in range(wait_time+1):
    updateBar(step)
    time.sleep(1)

It will look like this when you use it

[###...............7%..................] 7^/100^

World of Warcraft phishing scam analysis.

I haven’t played World of Warcraft since August of 2010. Thus being said I still receive spam because I bought 100gold once, oh the follies of noob players…

Some of this spam has hilarious urls that they try to phish you into clicking.

http://us.battle.net.account.support.survey.xml.zh-zxp.in/login.html?app=wam&ref=https://www.worldofwarcraft.com/account/&eor=0&app=bam/

Look at that. They use us.battle.net.account.suppot.survey.xml as a subdomain for zh-zxp.in

Reading quickly they would have people who don’t 100% know how a url is formatted read us.battle.net and click away.

I visited the aforementioned url, and the login page looks almost exactly like http://us.battle.net/

Not sure where I am going here, just wanted to laugh about the url.

Installing Fsharp on Linux [Ubuntu]

I have a friend DarkF (mentioned in previous post) who is making a programming language.

To use his language on linux, two things need to be installed and configured correctly. They are Fsharp and Mono/Mono-devel.

I did this last night on Arch Linux, but it was easily reproducible on Ubuntu 10.04LTS.

  1. First off install mono
    # apt-get install mono-devel
  2. Step two is to install FSharp. The easiest way to do this is do download the zip file from this page
    Microsoft FSharp download
    and extract the zip file to a location like
    /usr/local/src/
  3. When this is extracted, you might need the mono.snk file in the current directory (I did on Ubuntu but not on arch) so pull this file
    mono.snk
    and put it in the unzipped directory.
  4. When that is downloaded and in place, run sudo ./install-mono.sh (you might need to chmod +x install-mono.sh first)
  5. FSharp will now be installed in the current directory.
  6. At this point it would be useful to write an fsc and an fsi script to call the file, so you do not need to specify the absolute path with mono every time.
    • /usr/local/bin/fsharpc
      • #!/bin/bash
        exec /usr/bin/mono /usr/local/src/FSharp-1.9.9.9/bin/fsc.exe $@
    • /usr/local/bin/fsharpi
      • #!/bin/bash
        exec /usr/bin/mono /usr/local/src/FSharp-1.9.9.9/bin/fsi.exe $@

You now have an FSharp compiler installed on your system.

PHP on Arch Linux Apache

I was installing php last night and was pretty upset that I couldn’t get it working, EVERY SETTING was correct from the Apache wiki page from Arch.

I was doing and nothing was showing, what gives?

It turns out that Arch’s apache-php install by default turns short tags off.

I had to use

To fix this in /etc/php/php.ini change the line that says
short_open_tag = Off
to
short_open_tag = On

Thanks to <darkf> from irc.freenode.net for this bit of information.

No Shave November! (Novembeard)

This November I decided to try No Shave Novembeard. Not gonna look pretty by the end of the month as I have a patchy beard.

Final Product!

Individual days are in the read more section.
Continued reading >