Archive for the “Linux” Category

Last week when I was taking the bus in London, Ontario (not London, England), I noticed that my bus was seasonally painted and featured a big Tux (the Linux penguin) on the front hiding amongst other not nearly as cool penguins!

London Transit Linux Bux

Unfortunately, I didn’t have my camera with me at the time but someone from comp.os.linux.advocacy managed to snap a picture of it!

India Firefox Bus

I’m not sure as to the attributions required for using Tux in public advertising but I’m sure somebody is laughing quietly to themselves knowing bus drivers are unwittingly spreading OSS.

Perhaps a distant relative to the Firefox bus?

Original Flickr Photostream

Popularity: 6% [?]

Comments 28 Comments »

Control vs. Escape

Here is a quick tip on my favorite text editor, Vim. Vim is very efficient at what it does once you get the hang of it. However, one of the bottlenecks for efficient Vim coders is the use of the Esc key to get out of Insert or Visual mode.

After typing a chunk of code, you have to move your fingers out of position to hit the Esc key and in a single editing session, this happens many times. Keeping your fingers in position is highly efficient and is also why I prefer the IBM Trackpoint over trackpads.

Recently, I experimented with using other keys as an alternative to Esc for moving out of insert and visual editing mode.

Default Alternative
Ctrl-[ (Control + left bracket) performs (essentially) the same function as Esc by default and doesn’t require any configuration so if you can get used to this combination, you can use it on any machine.

Custom Alternatives
You can also map your own key to perform the same function as Esc. For example, a popular choice is Alt-Spacebar. I use this for Launchy though so I’m sticking with Ctrl-[ myself. Here’s the code required to map Alt-Space to the Esc key.

inoremap <M-Space> <Esc>

Anyone have their own favorite alternative to the Esc key in Vim?

Popularity: 7% [?]

Comments 20 Comments »

Hacking VimMaybe ultimate is the wrong word, but since my last post about a 256-color Vim colorscheme, I’ve gotten a few e-mails asking for a copy of my Vim configuration file (my .vimrc). I figure I might as well share it with everyone. I’ve added comments here and there so you’ll know what everything does. A lot of the settings are from the book Hacking Vim: A Cookbook to get the Most out of the Latest Vim Editor.

set nocompatible
set bs=2 “set backspace to be able to delete previous characters”Enable line numbering, taking up 6 spaces
set number

“Turn off word wrapping
set wrap!

“Turn on smart indent
set smartindent
set tabstop=4 “set tab character to 4 characters
set expandtab “turn tabs into whitespace
set shiftwidth=4 “indent width for autoindent
filetype indent on “indent depends on filetype

“Shortcut to auto indent entire file
nmap <F11> 1G=G
imap <F11> <ESC>1G=Ga

“Turn on incremental search with ignore case (except explicit caps)
set incsearch
set ignorecase
set smartcase

“Informative status line
set statusline=%F%m%r%h%w\ [TYPE=%Y\ %{&ff}]\ [%l/%L\ (%p%%)]

“Set color scheme
set t_Co=256
colorscheme desert256
syntax enable

“Enable indent folding
set foldenable
set fdm=indent

“Set space to toggle a fold
nnoremap <space> za

“Hide buffer when not in window (to prevent relogin with FTP edit)
set bufhidden=hide

“Have 3 lines of offset (or buffer) when scrolling
set scrolloff=3

The following apply only to gVim (GUI stuff). The script enables a little tooltip with spelling suggestions when you hover over a word with the mouse.

“Set the font and size
set guifont=Lucida\ Console”Hide toolbar
set guioptions-=T

“Enable balloon tooltips on spelling suggestions and folds
function! FoldSpellBalloon()
let foldStart = foldclosed(v:beval_lnum )
let foldEnd = foldclosedend(v:beval_lnum)
let lines = []
” Detect if we are in a fold
if foldStart < 0
” Detect if we are on a misspelled word
let lines = spellsuggest( spellbadword(v:beval_text)[ 0 ], 5, 0 )
else
” we are in a fold
let numLines = foldEnd – foldStart + 1
” if we have too many lines in fold, show only the first 14
” and the last 14 lines
if ( numLines > 31 )
let lines = getline( foldStart, foldStart + 14 )
let lines += [ '-- Snipped ' . ( numLines - 30 ) . ' lines --' ]
let lines += getline( foldEnd – 14, foldEnd )
else
“less than 30 lines, lets show all of them
let lines = getline( foldStart, foldEnd )
endif
endif
” return result
return join( lines, has( “balloon_multiline” ) ? “\n” : ” ” )
endfunction
set balloonexpr=FoldSpellBalloon()
set ballooneval

Some extra options available only on Vim version 7 and up so don’t use these on a system running anything lower or it’ll give annoying messages on load.

“Set line numbering to take up 5 spaces
set numberwidth=5″Highlight current line
set cursorline

“Turn on spell checking with English dictionary
set spell
set spelllang=en
set spellsuggest=9 “show only 9 suggestions for misspelled words

My custom .vimrc is by no means exhaustive, it’s always changing and growing. If you have any tips on customizing Vim I’d like to hear it!

Popularity: 13% [?]

Comments 15 Comments »

Vim is the editor I use most often in my day to day tasks from web development to coding to simple text editing. If you’re not familiar with Vim, you can take a look at this post featuring a video of its creator.

On my Windows machine, I can use GVim which offers a GUI-based version with full 32-bit color support. However, when I’m at a UNIX terminal or in an SSH session, support for only up to 256 colors is available.  This answers a question I’m sometimes asked:

“Why doesn’t my Vim color scheme work properly in UNIX?”

Vim Desert Colorscheme under 256 ColorsVim Desert ColorschemeMy favorite color scheme is ‘desert‘ which comes with the default installation of Vim and features a dark background with pastel colors. Unfortunately, it uses many colors outside of the 256 supported by a terminal window and thus makes all the colors appear distorted.

Vim Desert256 ColorschemeI went on a quest to find a color scheme that uses only the basic 256 colors and came across desert256 which is essentially the same color scheme but uses only 256 colors while maintaining the same sort of feel. I have since changed both GVim and Vim to use desert256 to maintain consistency.

You can get the .vim color scheme file here and place it in the colors/ directory of your Vim installation. If your Vim installation doesn’t support 256 colors properly, make sure that

  1. Your terminal session has 256 color support
  2. You have the following lines set in your .vimrc

    set t_Co=256 “enable 256 colors
    colorscheme desert256 “set colorscheme to desert256
    syntax enable “turn on syntax highlighting

If desert256 isn’t your cup of tea, here are two other 256-color Vim colorschemes: inkpot and gardener. And if you don’t care about 256 color support, here’s a page chalk full of Vim color schemes for you to choose from.

Popularity: 9% [?]

Comments 19 Comments »

The last part of this three part review will cover the task of web development on this little device. Make sure you’ve read the first and second part of the review beforehand.

One of the more popular posts on this blog is one talking about how to setup a portable web development platform on a USB drive. Although very portable, this method requires being around a computer with a USB port. Some may argue that carrying a laptop is also sufficient but it is not always possible to carry a laptop with you everywhere.

The Nokia N800 fits handily in a coat pocket and is a truly portable solution, but can you develop on it? I had purchased the device partly to explore this aspect and here are my findings.

Software
One of the biggest selling points of the N800 is the amount of software available for it. Unfortunately, not all applications have been ported to the latest version of the OS yet so some of the software mentioned may be for OS2007 and not work on OS2008.

The Web Server
The N800 can be setup to be a LAMP server (Linux, Apache, MySQL, PHP) which is typical for what most people need. Installation of Apache, MySQL and PHP are simple since they exist in the application repositories.

Editor
Vim on n800 FullscreenVim on n800 I don’t think a WYSIWYG editor currently exists on the N800 but I didn’t really feel a need for one since I much prefer hand coding with Vim. I installed Vim 7 on the N800 and it is perfect for my code editing. For such a small screen, Vim is perfect because it makes it easy to navigate and edit.

One problem is that you can’t use the full thumb keyboard because it messes up the input in Vim. Instead, you will have to use the stylus keyboard which makes typing a bit slower. Also, the key layout isn’t exactly designed for programming so a lot of special keys will require a few extra clicks to get to but the ability to create shortcut keys in xterm is a plus (i.e. the Esc key).

Testing in Browser
The built-in browser runs the Gecko engine (same as the one to be used in Firefox 3) so it is a very good representative of what a Mozilla browser will see a site as.  However, there is currently no way to emulate an Internet Explorer browser.

Web Frameworks
There is a Ruby package available for the N800 but I haven’t seen much in terms of Rails. You could always install it manually though.

Python is perhaps the main driving force of software behind the N800 and appropriately, one could use Django (a Python-based web framework) for their web development needs.

Conclusion
So web development on the N800 is entirely possible but it is not very convenient to code entire sites in it. I often use it to SSH into my server and to make minor update or changes. Occasionally, I try to do a mock-up of a site layout but its troublesome when typing too much text.

Click here to read part 1 of the review covering basic functionality of the Nokia N800 Internet Tablet.

Click here to read part 2 of the review covering third party applications on the Nokia N800 Internet Tablet!

Popularity: 7% [?]

Comments 33 Comments »