Monthly Archives: March 2010

Google presentations: Go, mobile optimisation

There were two short presentations by Google earlier today at my university. The first was on the Go programming language, the second on optimising the Google Maps API for mobile devices.

This post serves as rough notes for the things I learned. I’m not sure everything here is correct, considering these are stuff I’ve never researched before.

Go

  • Concurrent programming language. Déjà vu.
  • Weird type system: static typing, no inheritance, implicit interface declaration.
  • Composition = Ruby mixins?
  • Goroutines = coroutines = Erlang processes.
  • My guess is this will end up like D, Pike, Groovy, Nemerle, et al., but who knows. The syntax is certainly nicer than Erlang.

Google Maps optimisation

  • Situation
    • JavaScript parsing takes ages.
    • 3G is high latency but high bandwidth.
  • Solution
    • Static initial image (standard practice among UI people, but interesting application).
    • Less code (well duh).
    • MVC (not very clear how).
Advertisements

How to get a bug report ignored

Have 2,000 people spam it with “me too” comments.

This has sometimes happened (to a lesser degree) on various projects I’ve participated in, including Exaile. I used to volunteer as bug triager in another project, and this was the kind of thing that would wreck your mood for the rest of the day—even for someone whose role was not to fix bugs.

So don’t. Pinging developers on IRC every once in a while may be OK, especially if they’ve expressed some interest in the bug. Adding useless comments to a bug report is counter-productive, because it buries important information under junk.

Vim tips

While writing on Adam Olsen’s blog, I included some tips for Vim users on each post. None of the posts themselves are relevant today, but the Vim tips are still useful, so they’re reproduced here. In the future I may decide to edit this post and add more tips.

Note that I’m not actively using Vim for my day-to-day editing, although it’s still my text/code editor of choice while working on a terminal.

Indentation

Vim has a few settings you can use to configure the indentation of your code. expandtab (et) is a boolean setting that does what it says, it specifies whether to expand tabs into spaces; set noexpandtab (noet) to disable it. tabstop (ts) specifies how wide tab characters are displayed. softtabstop (sts) specifies the ‘virtual tabstop’, the tabstop that you feel when you press Tab or Backspace. shiftwidth (sw) specifies the indentation applied when using autoindent (e.g. the line after an if statement will get indented by this amount).

For example, while working with Exaile, you have to :set et sts=4 sw=4 because Exaile always uses four spaces for indentation (thus ts is not applicable). However, while editing a makefile you would normally set noet and use the same number for ts, sts, and sw.

Modelines

In Vim, you can set per-file options using modelines. (This has nothing to do with the term “mode line” in Emacs. Emacs has a similar feature, but I don’t know what it’s called there.) Basically they are special strings in the first or last few lines of a file that Vim interprets into options. They look like, for example, // vim: expandtab. The exact syntax is explained in detail in the modeline section of Vim’s help.

Colour schemes

Tired of looking at the same colours in Vim all the time? Use the :colorscheme (:colo) command. For example, try :colorscheme evening (if you want to revert, the default scheme is named default). The effects of colour schemes are more noticeable when you’re using GVim.

There are a few colour schemes included with Vim, normally located in /usr/share/vim/vimXX/colors/ (XX is 70 if you use Vim 7.0).

Wrapping text

Sometimes it’s useful to wrap text at a specified column. You can use Vim’s gq command and textwidth (tw) option to do this. Now, Vim has tons of options for wrapping lines (it can even autowrap text while you’re typing) and gq itself can be used in many different ways, but I normally use gq to wrap a block of comments after I finished writing it. Simply select the lines you want to format (in Visual mode) and hit gq. The wrapping column is determined by textwidth, e.g. :set tw=80 to wrap at column 80.