How great is community college?
&& [ astronomy ] && 0 comments
Pretty great.
I recently began taking classes at Cabrillo Community College in Santa Cruz California out of interest in astronomy. The college offers an AS that is pretty impressive: it requires an (expected) amount of physics classes but also includes many astronomy specific classes dealing with planetary science, cosmology and observational astronomy. I was surprised and impressed after I took a look at the catalog - it didn’t take me long to enroll.
I suppose I was expecting to be sharing classes with the stereotypical community college crowd.

But I was very, very wrong. Many, if not most, of the students seemed genuinely interested in being there. How could this be? Community college was supposed to be the place you went because you had to, not because you wanted to. I was expecting a class full of bored teenagers taught by a washed up high school teacher looking for a paycheck.
Instead I found a class full of (mostly) willing students taught by Dr. Rick Nolthenius, an accomplished, published astrophysicist. Instantly my perception of community colleges transformed from state mandated academic detention centers to bastions of democratic learning. Here was a place where one could educate themselves in a variety of subjects, with tons of flexibility, on a beautiful campus, all for less than the cost of a Netflix subscription.
Somewhere, sometime, I had gotten the wrong impression.
Now I’m not saying I regret getting my BS. But so far I am very impressed with the value I receive from this public institution as well as what it represents. I see it as something completely different from a university education. For many people receiving a standard degree from a four year university proves they can learn when they must, not because they want to. People will put themselves in obscene amounts of debt to receive a degree because the real world job market demands it. Employers want workers that have the ability to learn how to do a job quickly and effectively.
On the other hand those going to local colleges just for the sake of learning are receiving an education with no ulterior motives. Judging by academia a class at a community college has very little worth and actually this liberates the student to be educated. It means the value derived by the student is 100% intrinsic - the opposite of the perceived value of a prestigious university degree. In this way the student can focus on the content of what they are learning instead of attaining the certification of having done so (thinking critically instead of cramming for tests).
So obviously I am now a fan of community education. I really wish it was more popular, but I’m afraid the lack of involvement may come from people’s preoccupation with their day to day lives, or more likely their simple non-desire to continue educating themselves. But that’s OK. Smaller class sizes are great :)
Observations on observational astronomy
&& [ astronomy ] && 0 comments
Astronomy: So hot right now.
We have the a spacecraft rendezvousing with a comet right now for the first time in history and in a year we’ll get our first look at the has-been planet Pluto with the New Horizons spacecraft. In about 3 years, we’ll be treated to a total solar eclipse right here on the west coast.
I’ve been doing a bit of astronomy myself. While I’ve always had an interest, it never occurred to me that amateur astronomy could be a realistic hobby. I wrongly assumed even the cheapest telescopes would be thousands of dollars, ones powerful enough to see anything interesting at least. How wrong I was.

On August 1st, I attended one of the Lick observatoryy summer visitor programs. I got to observe the cats eye nebula through the 40 inch Nickel telescope (Nickel is a name, not the element) and a star cluster I can not remember the name of through the 120 year old 36 inch James Lick telescope. I left a changed man. Not only did my visit confirm my thoughts that, yea, astronomy is pretty rad - I met some very cool amateur astronomers that had great advice for any newbie interesting in exploring the cosmos. I went home that night seeing stars.
Fast forward all of 12 hours and I’m driving back over highway 17 again, this time with a freshly purchased amateur telescope in the back of my car. I’m not sure I’ve ever looked forward to nighttime before but I sure did that night.
First came the moon and her craters before it even got dark. Tycho forever became more than a band for me. Then came Saturn. I don’t know if I had ever seen Saturn through a telescope before that moment, but it felt like the first time. Those rings… I was hooked.
I tried my hand a public outreach too. A week or so later I attended a full moon event at Henry Cowell and let the public peer though my new scope. I showed many children and adults too their first look at both the moon up close and Saturn’s rings. Saturn in particular literally wow’d people. It felt fantastic.
Since then I’ve gone to a star party at Henry Coe, observed many more objects in the night sky (moving through the Messiers) and exchanged my telescope for a monster 10 inch Newtonian (it works much better for me).
What’s next? Learning, learning, more learning. Astronomy is really a hobby of the mind. And the best part about it is that I yet know Nothing about it.

I decided to craft some clickbait. What happened next will shock and disgust you
&& [ code ] && 0 comments
As evidenced by this website, every once and a while I’ll write something. Although my regular readership approaches nil when you take my mother, google bot, and myself out of the running I’ll still post a link to facebook and see if I can get some clicks. Usually I’ll get 10-20 visits (thanks guys!) and I’ll leave it at that.
Yesterday I was scrolling down my facebook news feed (something I try not to do anymore) and realized my feed was filled nearly completely with crap headlines like this:
“The 9 Most Epic Texting Pranks Of All Time. The 3rd One Killed Me…LOL!”
“The Scary Reason Illinois Just Banned Your Facewash”
“Obama Just Did What No Other President Before Him Has Done”
The first post is just dumb. That person is no longer on my friends list. The other two headlines could be about something important, but what’s up with the baity headlines? Just say what Obama did. Judging by the image they used he was the first president to order the extra spicey schezuan shrimp.
I wondered if I could play the game that sites like Buzzfeed, Upworthy and the Huffington Post have become so good at. And the result was this:

However, the link actually pointed to this page. I considered it a PSA, and thought I’d probably get the same amount of clicks that I usually do for a blog article I post.
Nope.
As of now, the page is up to 350 views. Thats 10x more than a “good article” I write ever gets. I didn’t even know I knew so many people that would click on something so obviously terrible. Yet there it is, in plain, cold truth.
Appealing to the lowest common denominator obviously works. Once I somehow regain my faith in humanity, I’ll think about possibly taking advantage of this fact.
And no, I’m not going to post this on facebook. Because screw you guys.
Getting the Time Right in Python
&& [ code ] && 9 comments
I hate time. I especially hate dates. There is not a single data type I hate working with more.
I think the problem boils down to the fact that they seem so arbitrary. The Gregorian calendar just doesn’t translate over well to binary systems. Ideally, there would be 100 seconds in every minute, 100 minutes in every hour, 100 hours in every day, etc. But no. We must deal with weird numbers like 60, 24 and 31 (but sometimes 28, or maybe 30) and all the inconsistencies they cause.
</rant>
I’m going to lay out some of the modules and function in Python relevant to working with time.
The time module
Documentation: https://docs.python.org/2/library/time.html
The time module is the most basic module when working with time in python.
time.time() returns the time in seconds since the unix epoch:
{{< highlight python >}} time.time() Out[1]: 1398882554.878436 {{< / highlight >}}
I’ve found that most operations dealing with time usually boil down to converting something into a unix timestamp and then perform operations on them. For example:
{{< highlight python >}} In [1]: a = time.time() In [2]: b = time.time()
The first command was executed before the second, so a’s second value is less than b’s.
In [3]: print a < b True {{< / highlight >}}
time.time() itself is pretty limited. We can’t easily deduce from a unix timestamp the human measurements of time, like minutes hours and days. The timestamp also doesn’t contain any timezone
information.
Oh god, timezones.
Timezones are a bitch. When doing anything with time, they must always be accounted for.
A computer in New York that runs time.time() at the same one as one in California will return
different values. No, it has nothing to do with a New York minute being any faster than a minute in California, it has everything to do with localtime.
Let’s take a look at two more methods, time.localtime() and the terribly named time.gmtime():
{{< highlight python >}}
In [1]: time.gmtime()
Out[1]: time.struct_time(tm_year=2014, tm_mon=4, tm_mday=30, tm_hour=18, tm_min=39, tm_sec=33, tm_wday=2, tm_yday=120, tm_isdst=0)
In [2]: time.localtime() Out[2]: time.struct_time(tm_year=2014, tm_mon=4, tm_mday=30, tm_hour=11, tm_min=39, tm_sec=45, tm_wday=2, tm_yday=120, tm_isdst=1) {{< / highlight >}}
time.localtime() returns a named struct for the localtime, whereas time.gmtime() returns the time in Coordinated Universal Time. Why the method is named gmtime and not utctime I have no idea,
but I can only assume ‘gm’ stands for Greenwich Mean time which should be avoided.
Take a look at tm_hour element.
{{< highlight python >}} In [1]: gmtime = time.gmtime()
In [2]: localtime = time.localtime()
In [3]: print gmtime.tm_hour - localtime.tm_hour 7 {{< / highlight >}}
You can see that the times differ by 7 hours. That’s because my computer in located in Santa Cruz, CA. Which as well as being the best place on earth, is located in the Pacific Time Zone, which is UTC - 8. But wait, why did we get 7 as the time difference?
Because daylight savings time, that’s why. Add another point to time’s suckiness score.
At least we can figure out if we are in daylight savings or not:
{{< highlight python >}} In [1]: time.daylight Out[1]: 1
Looks like we are in daylight saving time! I’m just having the best time ever!
{{< / highlight >}}
We’ll talk about timezones in python more a little later.
Additional Methods
time.mktime(t)
Takes a named struct like the ones returned by time.localtime() and time.gmtime() and converts it to a unix timestamp:
{{< highlight python >}} In [1]: time.mktime(time.gmtime()) Out[1]: 1398921105.0 {{< / highlight >}}
Not terribly useful in that context, but you’ll want to use it in conjunction with:
time.strptime(string[, format])
Takes a string and parses out a time in the format of a named struct, the same format that time.localtime() and time.gmtime() use. Format is built using directives which
can be found here:
{{< highlight python >}} In [1]: today = time.strptime(‘4/30/2014’, “%m/%d/%Y”) In [2]: time.mktime(today) Out[2]: 1398841200.0
{{< / highlight >}}
time.strftime(format[, t])
This method takes the time and prints it in a human readable format. Well, sort of. It formats a String From the Time. (StrFTime) so its up to the programmer if he wants to make it readable or not:
{{< highlight python >}} In [1]: time.strftime(‘%m/%d/%Y’) Out[1]: ‘04/30/2014’
In [2]: time.strftime(“‘Tis the %dth of %B which is the %wrd day of the %Wth week of the year %Y”) Out[2]: “‘Tis the 30th of April which is the 3rd day of the 17th week of the year 2014”
In [3]: time.strftime(“The time is %H:%M”) Out[3]: ‘The time is 13:55’
{{< / highlight >}}
The datetime module
You could do everything you wanted to do with the time module alone. But in most cases, you would
be insane to do so. the datetime module provides some high level functionality for working with dates. From the documentation:
While date and time arithmetic is supported, the focus of the implementation is on efficient attribute extraction for output formatting and manipulation.
Basically, we want to be able to do thing things like “add one week to this date and print the result” without going batshit insane.
One of the main gotchya’s with the datetime module is the concept of naive vs aware time objects.
Aware objects are “aware” of timezone and daylight savings time. So a datetime of 4:00am, 1st of April 2014 that is aware and set to PST, would represent 7:00am, 1st of April 2014 in EST.
“Naive” dates represent absolute values. The same object representing 4:00am, 1st of April, 2014 would still read 4:00am, 1st of April, 2014 in PST and EST.
Let’s check out an example using the pytz module to help with timezones:
{{< highlight python >}} import datetime import pytz
Set the timezones
In [1]: eastern = pytz.timezone(‘US/Eastern’) In [2]: pacific = pytz.timezone(‘US/Pacific’)
Make 2 dates using the same naive datetime, and localize them to the timezone.
In [3]: eastern_dt = eastern.localize(datetime.datetime(2013, 10, 1, 12, 0, 0)) In [4]: pacific_dt = pacific.localize(datetime.datetime(2013, 10, 1, 12, 0, 0))
subtact the time
In [5]: diff = pacific_dt - eastern_dt
In [6]: diff.seconds Out[6]: 10800 # 3 hours {{< / highlight >}}
Basically, working with timezones is a pain. It’s best just not to do it and always store time in UTC, converting to localtime for display purposes only using a method like datetime.datetime.fromtimestamp()
The datetime.date object
the datetime.date object is about as close as you can get to representing a “date” as most people understand them in code:
{{< highlight python >}} In [1]: today = datetime.date.today() In [2]: print today 2014-04-30
In [3]: print today.month 4
In [4]: tomorrow = datetime.date(2014, 5, 1) In [5]: print tomorrow.month 5
{{< / highlight >}}
You can convert the date into the format heavily used by the time module:
{{< highlight python >}} In [1]: first_of_this_month = datetime.date.today().replace(day=1)
In [2]: first_of_this_month Out[3]: datetime.date(2014, 4, 1)
In [4]: first_of_this_month.timetuple() Out[4]: time.struct_time(tm_year=2014, tm_mon=4, tm_mday=1, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=1, tm_yday=91, tm_isdst=-1)
In [5]: time.mktime(first_of_this_month.timetuple()) Out[5]: 1396335600.0
In [6]: datetime.date.fromtimestamp(1396335600.0) Out[6]: datetime.date(2014, 4, 1)
{{< / highlight >}}
The datetime.date object has other useful methods such as date.isoformat() which prints the date in ISO 8601 format (YYYY-MM-DD) and date.strftime() which functions the same as time.strftime() allowing you to print dates in whatever format you’d like.
The datetime.datetime object
datetime.datetime is the same as datetime.date except it includes time data as well.
{{< highlight python >}} In [1]: datetime.datetime.today() Out[2]: datetime.datetime(2014, 4, 30, 15, 20, 15, 86516) {{< / highlight >}}
Remember to watch out for TZ gotchyas.
The timedelta object
A timedelta object represents a duration - meaning the difference between two times. Thus it helps us set times in the future or past.
Lets try a simple use case. Print the time one week from today:
{{< highlight python >}} In [1]: today = datetime.datetime.today() In [2]: print today 2014-04-30 16:58:02.663769
In [3]: print today + datetime.timedelta(weeks=1) 2014-05-07 16:58:02.663769 {{< / highlight >}}
We can also obtain timedelta objects from performing arithmetic operations on datetime objects:
{{< highlight python >}} In [1]: today = datetime.datetime.today()
In [2]: print today 2014-04-30 17:02:00.378875
In [3]: future = datetime.datetime(2014, 11, 1)
In [4]: print future 2014-11-01 00:00:00
In [5]: print future - today 184 days, 6:57:59.621125
{{< / highlight >}}
Stuff to remember
- It’s a good idea to always store time in UTC. Convert to localtime as late as possible.
- Use the high level libraries as much as possible. You may think you can pull off using
time.time()when in reality, you’re forgetting in your calculations that this month has 31 days instead of 28. The higher level libraries are good at taking these inconsistencies into account. - Stay sane, go outside, hug your mother.
Shralping Shredona (The Weirdest Place to Ride in the World)
&& [ cycling ] && 0 comments
There are a few places in North American that, if you know a mountain biker, will probably hear about at least once. They are places where the riding is so legendary, so obscenely epic (we’re talking Sail by AWOL levels here) that they are worth traveling to the obscure corners of the country that they are usually located. Sedona, Arizona is one of those places.
What is unique about Sedona (besides the amazing riding, I don’t need to dwell on that here) is that the town itself is so strange. I mean the town is kinda… lame (sorry Adam). You look around and all you can see are pink jeeps lugging obese tourists around and trinket shops selling knockoff native American art. Crystals are bigger than Chuck Norris was in 2008. And apparently there are these “vortexes” all around the place. I don’t even know what those are but I think they have something to do with the crystals.
Basically if Walt Disney was into white person yoga and Carl Castaneda he would have invested heavily in “Uptown” Sedona instead of building Disney Land. I always get this strange look from people when I tell them I just got back from there: that look of “Sedona huh? You’re into that kind of thing?” It’s like when your friends come over for movie night and they find your roommate’s copy of Twilight in the DVD player… except more embarrassing.
Weirdness aside, the place really does have amazing riding. Good enough to have brought me back a second time. This time we had a larger crew and we let the cameras roll. Please enjoy the following “edit” I put together of the trip.
Photo Of the Day
&& [ code ] && 0 comments

I was on a ride with my buddy Brent Davidson a few days ago when during a break he snapped a quick picture of me.
“Photo of the day.” he said.
“You mean for Pinkbike?” I asked.
“No, my instagram photo of the day.”
Brent takes one photo every day and posts it to his instagram account. He explained that it’s fun, he was taking at least that many pictures before anyway and that his grandma calls him if he misses a day.
I told him I was going to steal his idea. If you go into every day knowing that you’re going to take a picture of something, I bet you’ll come away with some interesting stuff. You go from being a passive photographer (that’s neat, I’ll take a picture) to being an active one. As in you’ll actively seek out photos to take if you have to at least take one a day.
Not to mention a cool history to look back on.
So I created a photoset on flickr and a javascript gallery that pulls from that here on this blog. As of this writing, my first POD is up. In the spirit of the internet, it’s a photo I took of a cat (the internet was made for cats).
Ride Slower Next Time
&& [ cycling ] && 0 comments

Sometimes it becomes far too easy to get caught up in the distractions of being heavily involved in a sport like Mountain Biking. There’s the constant guilt of staying in shape, the ever changing and evolving equipment industry, and of course the big question: “Am I fast enough?”
You know you’re in deep when you go on a ride with someone and it’s a complete sufferfest the entire time. When you aren’t hyperventilating the conversation always seems to be about parts, tires, grams, grams, grams. Is the fact that I notice this a sign of burnout? I don’t think so. I think I’ve just moved on.
It seems our attitude towards riding tends to come full circle after a while. You get started on bikes they get you stoked. Then once you start getting faster it becomes about continuing to get faster. Fancy equipment and training help you along your way. So riding becomes about that for a while. And then you come back.
When you return you remember the reasons why you started. For me it happened in summer ‘13 in Whistler. Tough riding where it was challenging enough to stay up right, much less go fast. It felt like learning to ride all over again - with all the crashing and walking I did. You could say I was riding slow but it was fun and I came away a better rider for it without really having to try.
I think everyone deserves a little time to just get stoked. Turn the Garmin off (or at least forget about it), slow down a bit. Take that line you’ve always been afraid of, or hit that jump you’ve always ridden around. Hell, take a moment to appreciate the wonderful natural world around you. Most people are not so lucky.
Photo by Josh Moberg
Now riding for team Lost Coast MTB
&& [ cycling ] && 0 comments
Thats right, I’m on a real bike team now. I’m not talking about a team like Team Dirtbag I’m talking about a full legit bike team with kits, sponsors and free stuff, bro.

Our main sponsors are Lost Coast Brewing and Marin Bikes - beer and bikes. What more can you ask for?
As part of my joining the team I volunteered to redesign and update the team website. So I set up a Wordpress install on my VPS, did ye’ old free theme search, and set up a few widgets. Importing comments from Blogger was pretty easy, as was making sure permalinks remained in the same format so no links out there were broken. On most days I’ll tell you that I hate Wordpress, but this is one of those perfect applications for it. Anyway, the result is here: www.teamlcb.org.
About an hour or so after switching the domain over I noticed something peculiar: the spam comment count increasing with every load of the admin console. Within just a few hours the amount of Spam comments caught by Akismet had surpassed 100. I took a look at the Blogger settings, le sigh, no comment moderation, no word verification and full access to anonymous users. Looks like I had just messed up a ton of spam bot’s days.
Interestingly, Blogger seems to count bots as visitors it’s blogs:

Whereas Wordpress does not. (The blog gets maybe 5-10 legit visits a day…) I’m assuming many of these bots are programmed specifically for Blogger blogs and are probably failing now. The good ones most likely detect Wordpress forms and are still able to submit comments. Load on the server has also visibly increased since the domain was switched.

But it is still pathetically low. Anyway, moral of the story is: comments suck. Also, I need to start training. Part of being on a team is knowing how to ride.
First Foray into Video Editing: Dusty Sweetness
&& [ cycling, featured ] && 0 comments
Thanks to my wonderul parents, I’m now the proud owner of a new GoPro. And thanks to theives in San Francisco, I’m also the proud owner of a new Ibis Mojo HDR which took the place of my lost Santa Cruz Blur LT.
I finally got the chance to use both over the weekend on a very dry, very warm, January day:
I really enjoyed the process of both filming and editing the video. Stay tuned for more.
Race Resume
&& [ cycling ] && 0 comments
I was recently asked to put together a race resume for a cycling team I am interested in joining. As a web developer, I thought I could have a little fun with it. Take a look