I'm working with https://github.com/robfig/revel
which uses the Play framework, a Java web framework.  I've never used any sort of webframework, so it's pretty new in all ways for me.  It's pretty early in revel's life too, but I'm benefiting from the Play Framework's documentation as well as the demo apps in revel.

Here's a data structure that I'm building right now for populating a side nav bar.

This prints:

{3 [{Category1 [link one link two]}]}

The Side nav bar is from Twitter Bootstrap's Fluid Layout example, here's the relevant section:


Using golang r60 template package to range over a slice of maps



Output is:

levels: [
    {bitrate:896, file:"small.mp4", width:480, height:272}
    {bitrate:1000, file:"medium.mp4", width:1280, height:720}
    {bitrate:2128, file:"large.mp4", width:1920, height:1080}
]

Wasn't very obvious to me that you access the keys with $h.bitrate.  I was trying $h[bitrate].



Another website about Go, and a great post on sorting. { openstache } - Go's Sort Package:

'via Blog this'
new favorite shortcuts in ubuntu - alt + left click to move a window and alt + middle click to resize the window.
and good reference page for shell commands:
https://help.ubuntu.com/11.04/serverguide/C/index.html
Started off this morning walking through the tutorials for Go App Engine.  I'm reading that I need Python 2.5 installed for App Engine to run.  I'm running Ubuntu 10.04 Lucid Lynx, and the system installed Python is: 2.6.5.  Initially I figured I'd need Python 2.5 installed, and that I'd just do the following:

Go to: http://www.python.org/download/releases/ and check for the latest 2.5 release, currently 2.5.6. Download the bzip2-compressed source code. Open a terminal and:
tar -xjvf Python-2.5.6.tar.bz2
cd Python-2.5.6
./configure
sudo make altinstall
make test
sudo install


but, then I'd have to invoke App Engine by invoking python 2.5 instead of the system default, or I could use virtualenv and pythonbrew.  
OR, let's just try and see if I can skip all of this and just run it with 2.6.5 instead, which is what I'm going to try first, because all of this is annoying.  Wait, this reminds me of why I like Go.

While reading through Gary Burd's oauth.go package I was confused about:



This is declaring an array, but why isn't it {'A':true, 'B':true,...'Z':true,...}
Thanks to Gary for explaining this. When initializing Go's composite literals
for array and slice literals the following rules apply:


Each element has an associated integer index marking its position in the array.
An element with a key uses the key as its index; the key must be a constant integer expression.
An element without a key uses the previous element's index plus one. If the first element has no key, its index is zero.


so, since the second true has no key it uses the previous element's index plus one, which in this case is 'B'. Pretty cool, and lots faster than writing everything out.
writer interface discussion
Reference links for some useful conversations about using go for web programming:

PHP's $_SESSION mechanism
https://groups.google.com/d/topic/golang-nuts/cZ8Pkz6fbtg/discussion

Nobody Cares - microblogging
http://code.google.com/p/nobodycares/

gopages - embed go in webpages
http://code.google.com/p/gopages/

+ [Codelab: Writing Web Applications](http://golang.org/doc/codelab/wiki/)

+ [Generic request/response handing](
http://www.tideland.biz/articles/coding-in-go/generic-request-response-handing)

+ [Make A Basic GO http Server](
http://go.hokapoka.com/go/make-a-basic-go-http-server/)

+ [Serve on multiple hosts / domains with Go](
http://go.hokapoka.com/go/serve-on-multiple-hosts-domains-with-go/)

+ [GO & web.go](http://go.hokapoka.com/go/go-web-go/)

+ [Web chat using WebSockets and Go](
http://gary.beagledreams.com/page/go-websocket-chat)

+ [Deploying Go web services behind Nginx under Debian or Ubuntu](
http://nf.id.au/deploying-go-web-services-behind-nginx-under)

If you're looking for a simple framework to build a website, check out
web.go:
http://github.com/hoisie/web.go

It supports standard fastcgi and scgi environments, which means it
will work behind Apache/lighty/nginx..

https://groups.google.com/d/topic/golang-nuts/GbaswguQ2Ak/discussion
https://github.com/nf/gowiki
http://go.hokapoka.com/go/use-gos-html-templates/#more-86
http://go.hokapoka.com/go/make-a-basic-go-http-server/#more-89
http://go.hokapoka.com/go/serve-on-multiple-hosts-domains-with-go/#more-88
http://go.hokapoka.com/go/embedding-or-nesting-go-templates/
Working on setting up an EC2 instance with boto, and after the initial boot, I'm going to ssh to the new instance and setup my environment. So, I can use Python or Go, so here's an example of using go to script shell commands from the golang-nuts group
package main
import (
"fmt"
"exec"
"bytes"
)
func main() {
cmd := "/bin/sh"
args := []string{cmd, "-c", "ls passwd"}
dir := "/etc"
p, err := exec.Run(cmd, args, nil, dir,
exec.DevNull, exec.Pipe, exec.PassThrough)
if err != nil {
return
}
var b bytes.Buffer
_, err = b.ReadFrom(p.Stdout)
if err != nil {
return
}
err = p.Close()
if err != nil {
return
}
fmt.Println(b.String())
}