Skip to main content

Posts

Showing posts from November, 2010

A Week with Go, Day 2

After dabbling a little bit on day 1, I dedicated some time on day 2 to skim through Go's language spec and standard libraries . A lot of it didn't have much relevance to me yet because I hadn't begun to play with those parts of the language. What caught my eye though was that Go supports the \v escape (obviously no one at Google has read Stop the Vertical Tab Madness ). Welcome to 1963, folks. In addition to tweaking how loops are written, Go has augmented the traditional syntax of if and switch statements too. I don't see the enhancement providing as much benefit as I do with for . It's almost as if someone decided to let people move the placement of if up a statement earlier just to be different, and it certainly doesn't read well. x := recover() if x != nil { ... } vs if x := recover(); x != nil { ... } The list of available packages is rather impressive considering Go has been available for a year. Some packages are pretty standard, like math and...

A Week with Go, Day 1

Go is a general purpose systems programming language developed at Google by Robert Griesemer, Rob Pike, and Ken Thompson. Go has been on my radar since it became publicly available a year ago as an open source project, and since then its documentation has been improving and a small community of users has been forming around the language. Last week I had some time off from work that coincided nicely with the Thanksgiving holiday and I thought it'd be fun to spend some of it looking at Go. Here's the first in a series of five posts that share my thoughts and experiences of spending a week with Go. My first Go programs were solutions to a couple Project Euler solutions. This was just to get a basic feel for its syntax. Problem 1 package main import fmt "fmt" func main() { sum := 0 for i := 0; i < 1000; i++ { if i%3 == 0 || i%5 == 0 { sum += i } } fmt.Printf("%d\n", sum) } There are a few oddities, but ove...

On Gartner's 2011 Top Technologies

A coworker stumbled across Gartner's top 10 technologies for 2011 and decided to share it with everyone in the office via email. Overlooking the need for a cluebat , and resisting the urge to similarly spam everyone with The Oatmeal's take on email etiquette , I think Gartner missed the mark on some things. Let's be honest for a moment. Cloud computing has been hyped since '08 when Eucalyptus and Amazon's EC2 Services came out. Social media has been on the radar since since blogs became popular (though admittedly Twitter and Facebook upped the ante). Mobile computing has been slowly making inroads but I think it's still too soon to claim "The PC era is over." All the technologies have been around for years in one form or another; they just happen to be "hot" right now... and by the time someone starts touting them they've probably peaked. In the next 12 months I predict there'll be a lot of potential for things like IPv4/6 netw...

"Inchworm on a Stick" in PHP

~- is known as the inchworm on a stick operator in Perl obfuscation circles. It isn't really an operator; it's a term coined to describe negating a value and then taking its compliment, the apparent effect of which is to decrement the value. (To understand why, you need to understand how negative numbers are represented in binary.) In Perl, ~- works for positive values: for ($i = 3; $i > -3; $i--) { print ~-$i . "\n"; } $ perl test.pl 2 1 0 4294967295 4294967294 4294967293 Interestingly enough, when the same is tried in PHP the results are slightly different... 2 1 0 -1 -2 -3 PHP treats the value as a signed integer where Perl treats it as an unsigned integer. I don't know which way is "better" or which is "more correct," but it is something I found interesting and I thought would be worth sharing.