Sunday, August 15, 2010

Song: "Nuclear Fusion" by Mat Zo

The odd bit of trance music I'd heard in the past hadn't grabbed me that much, but I've been trying out a lot more of it recently and some tracks I really like.. like this one "Nuclear Fusion" by Mat Zo

nice smooth sound, and nicely layered beats and rhythms that really pump along.

Rex Mundi Remix:

Saturday, August 14, 2010

Songs with energy/intensity that keeps on building

I love it where songs have an energy or intensity that just keeps on building and building and building, like something is going to burst but doesn't. Here's my favourite examples:

Escape Velocity, The Chemical Brothers. Pretty much the whole song is like this.

FML, Deadmau5. Love the crazy rising intensity in the intro to this. [*edit: changed video to a version that sounds like album version]

Come with us, The Chemical Brothers. Pretty awesome for the first 1:15
mins or so, but falls a bit flat after that.

Thursday, June 24, 2010

The suggestion I sent to @TransLinkSEQ

#bnept. I sent the following suggestion to Translink regarding their tweets about service disruptions. Their @TransLinkSEQ account sends out tweets like:

Airport Line train service disruption. Visit for more.
To find out the details you have to go to,
find the bit with the link to more info. E.g. for that item, there's
a bit of info on the site
Passenger alert
Airport Line train service disruption from Wednesday 23 June
then you have to click the link on that alert which takes you to the page with
the actual details of it, which is located at

Things would be much more direct and simpler if the original tweet
just referred directly to that page, as in:
Airport Line train service disruption.
(or of course the URL could be shortened by a URL shortner like

Sunday, April 11, 2010

Promoting conversations to more heavyweight communication mediums

There's all these different communication mediums -- IM, twitter, email, wave etc -- each of which have their own place because they have different affordances making them suited to different sorts of purposes.

But I wonder whether we can have better integration between them.

One dimension on which these mediums differ is their 'weight' - Twitter is quite lightweight, wheras email is more heavyweight, and wave appears to be weightier still.

Sometimes it would be useful to 'promote' a conversation from a lighterweight medium to a heavierweight one. What might start out as a twitter conversation might end up being better served by a wave.

Perhaps communication tools could support this conversation 'promotion'. For example, by supporting a full history of the conversation, spanning any changes in medium. The tools could also have knowledge of peoples' different identities across the different mediums, so that if you went from an email to certain recipients to a wave, all those people could be automatically added to the wave.

(and along with the notion of 'promoting' conversations, you could also have the inverse - demoting conversations).

Monday, March 08, 2010

Mangalam's Sothy Recipe

Mangalam's Sothy Recipe

Soothy (pronouced like "soo-dy") is a South-Indian dish featuring coconut cream or milk and fenugreek that you can eat with rice or string hoppers (if you can get them).

The dish is quite liquidy from all the coconut milk. The idea is to drown the rice in it a bit, and the rice will soak up some of it.

oil, 1 tbsp
fenugreek, 1 tsp
brown onion, 1 medium, diced
yellow capsicum, 1, diced
curry leaves, 1 strand of (optional)
red chili, 1 (more if you want it spicy)
tumeric, 1/4 tsp
coconut milk, 100ml
water, 100ml
tomatoes, 2 medium
salt, for seasoning

Heat the oil in a pan in low heat. Fry the fenugreek until lightly brown.

Be careful not to burn - the fenugreek as it becomes bitter if it is burned.
Add the onion and fry until its soft.

Add the capsicum and saute for about 2 minutes.

Add the water, chili, tumeric, tomatoes, curry leaves (optional) and bring to boil.

Then add coconut milk and season with salt.

Remove from heat once it boils.

Tuesday, March 02, 2010

A goal for education: giving people confidence in their learning ability

Too many adults fear learning. They think they can't do it. I think a lot of this comes from their school experience.

I think education should have the explicit goal of preventing this fear. Of course, this shouldn't be the only goal of education, but I think it should be there to instill people with confidence that they actually can learn about things, so that they will feel able to learn new things on their own later in life.

This doesn't mean having some lame attempt to simply tell students they can learn things, nor does it mean just getting them to believe they can. (I'm thinking of the lame way that self-esteem seems to be taught - or at least how it was taught in my school). Just telling people how they should feel doesn't do anything.

People actually need to successfully learn things. Only then will be able to build confidence. Then they'll genuinely know that they can do it.

I'm not saying it's practical to do a perfect job at this, I'm just saying it is an area we should target and try and do better at. From my experience of schooling, I don't think this was a terribly high priority. It seemed to be more about grading people.

People also need to appreciate that learning things can be difficult, that there can be extended periods of pain with no apparent progress before finally getting over the hump. That's probably a separate matter, and perhaps one that is harder to get people to appreciate. It's one that is especially applicable to when people head out into the "real world".

Monday, February 22, 2010

My Vim setup

[updated: 02.03.14; 11.4.10; 23.2.10; 17.1.10; 29.8.09; 31.8.09]
(UNIX/Mac: ~/.vimrc; Windows: $VIM/_vimrc)

" vim:fo-=a

set nocompatible

"== pathogen
call pathogen#runtime_append_all_bundles() 

filetype plugin indent on 

set autowriteall   " auto save the file on things like :next

set switchbuf=usetab,newtab

" Make shift-insert work like in Xterm

if version >= 500

  " highlight strings inside C comments
  let c_comment_strings=1

  " Switch on syntax highlighting if it wasn't on yet.
  if !exists("syntax_on")
    syntax on

  " Switch on search pattern highlighting.
  set hlsearch


set shiftwidth=4
set softtabstop=4
set expandtab

set linebreak      " dont linebreak inside words
set mousehide    " hide the mouse when typing text
set splitbelow

"== search related
set ignorecase smartcase
set incsearch
function! NoHLSearch(pat)
   call search(a:pat)
   set nohls
   set hls
" command -nargs=1 S :call NoHLSearch()
" F5 - toggle highlight search
map  :set hls!set hls?

" unicode - for hars pasted from web-pages, PDFs etc (see usr_45.txt)
set encoding=utf-8

" ** actualyl these sould be defined in vimrc and called in there to set
" the default that is set when vim is run.
function! NormalWritingModeLinesAndLinespace()
    set lines=36
    set linespace=4

function! DraftingWritingModeLinesAndLinespace()
    set lines=21
    set linespace=13

"== syntax/display
set columns=75
" set lines=38
" now setting it to less as i've increased linespace
" set lines=32
" set linespace=5
call NormalWritingModeLinesAndLinespace()
set ch=2  " Make command line two lines high
set laststatus=2   " so last remaining window always has a statusline
" make closed folds less visually prominent
highlight Folded guifg=LightBlue
function! MyFoldText()
    let leadingSpaces = "                                                                   "
    return leadingSpaces . "\\" . (v:foldend - v:foldstart)
set foldtext=MyFoldText()
" note that the following has a backslash followed by one space
set fillchars=fold:\ 
highlight statusline guibg=LightGray guifg=DarkGray gui=none
set statusline=
set statusline+=%{getline(search(\"^[:#]\",\ \"bnW\"))}   " show curr heading
set statusline+=%=                                     " show rest right justified.
set statusline+=\ \ %c\,\ %l\ (%L)                     " col, line (tot lines)
highlight CursorLine guibg=#D9D9D9
"colorscheme morning
"set background=light " dark   " for solarized
if has("gui_macvim")
    colorscheme solarized
    colorscheme morning

set backup          " turn on backup
set backupdir=/Temp/vimFileBackups    " dir for tilde files
set dir=/Temp/vimSwapFiles     " dir for swap files 
" mustn't have trailing slash. otherwise subsequent additions wont work 
set path+=~/Notes
set path+=~/PhD

set autoindent

set browsedir=current       " open file browser in current dir 

set selectmode=key

"== snipmate options
let g:snips_author = "James Cole" 

"== taglist options
let g:Tlist_Auto_Open=1
set updatetime=100
let Tlist_WinWidth = 40
let tlist_text_settings  = 'text;h:headings'
nnoremap   :TlistToggle
" To not display the Vim fold column in the taglist window
let g:Tlist_Enable_Fold_Column = 0
" only show contents of the current file in current tab
let g:Tlist_Show_One_File = 1

" weird, my computer crashed and after restarting it would no longer 
" generate the tags. it'd say 
" Taglist: Failed to generate tags for /my/path/to/file
"   ctags: illegal option -- -^@usage: ctags [-BFadtuwvx] [-f tagsfile] file ...
" Taglist FAQ says this is coz its not using the exuberant ctags file.
" if i type ctags in shell it gets exuberant one...
" but anyway i recently installed oh-my-zsh, which might be somehow the 
" problem.  setting the following var fixes the prob
" This seems to be about this problem (though I didn't it all):
let Tlist_Ctags_Cmd = '/usr/local/bin/ctags'

" assume it gets a valid filename and path 
function! GetMarkdownHtmlFilename()
    let b:htmlFileNameForMarkdownDoc = expand('%:t:r') . ".html"
    let dialogPrompt = "Name and location for HTML file"
    let b:htmlFileNameForMarkdownDoc = 
        \ inputdialog( dialogPrompt, expand('%:p:h') .  "/" .  b:htmlFileNameForMarkdownDoc) 
    let menuTypeAndLoc = "amenu 900.107 "
    let menuItemName = "&Personal.A&uto\\-generate\\ HTML\\ on\\ save"
    let menuCall = ":silent call GetMarkdownHtmlFilename()"
    let menuDef = menuTypeAndLoc . menuItemName . menuCall

" let markdownUtilName = "multimarkdown"
let markdownUtilName = "peg-markdown"
function! SaveFile()
    if exists("b:htmlFileNameForMarkdownDoc")
        execute("!" . g:markdownUtilName . " % > " . b:htmlFileNameForMarkdownDoc)

nnoremap   :silent call SaveFile()
inoremap   :silent call SaveFile()
vnoremap   :silent call SaveFile()gv

"== tabbar options
let g:tagbar_expand = 1
let g:tagbar_updateonsave_maxlines = 7000

"== scrolling 
set sidescroll=1   " smooth horizontal scrolling - 1 char at a time
set scrolloff=1

"== cut and paste
" set clipboard+=unnamed    " copy yanks and deletions to system clipboard 
" send all yanked text to the system clipboard
nnoremap y "+y
" a 'cut' operator that can be used with text-objects, where cut text
" is placed on the system clipboard.
nmap \u "+d

" F4 - show list of headings in document
map  :g/^:/

" F6 - change all the non-displayed chars to plain-text equivs
"    (note how have to escape pipes between commands, and
"     double escape pipes within replace commands)
map  :%s/—/--/ge \| %s/…/.../ge  \| %s/“\\|”/"/ge  \|  %s/‘\\|’/'/ge

" F7 - to condense selected lines
" very quick a dirty way to do it, should put all the words in a datastructure
" and handle words and their variants ending with s better
map   :s/\/\&/ge  \| '<,'>s/\/tt/ge \| '<,'>s/\/b\/ween/ge \| '<,'>s/\/w\//ge \| '<,'>s/\/info/ge \| '<,'>s/\/compu/ge \| '<,'>s/\/r/ge \| '<,'>s/\/pic/ge \| '<,'>s/\/2/ge \| '<,'>s/\/in2/ge \| '<,'>s/\/b/ge \| '<,'>s/\/defn'd/ge \| '<,'>s/\/4/ge \| '<,'>s/\/Howevr/ge \| '<,'>s/\/defn /ge \| '<,'>s/\/partic/ge \| '<,'>s/\/thng/ge \| '<,'>s/\/thngs/ge \| '<,'>s/\/whch/ge \| '<,'>s/\/prt/ge \| '<,'>s/\/arg/ge \| '<,'>s/\/u/ge\| '<,'>s/\/wnt/ge \| '<,'>s/\/othr/ge \| '<,'>s/\/corresp/ge \| '<,'>s/\/4/ge\| '<,'>s/\/reps/ge \| '<,'>s/\/abve/ge \| '<,'>s/\/char/ge \| '<,'>s/\/chars/ge \| '<,'>s/\/req'd/ge \| '<,'>s/\/undef'd/ge \| '<,'>s/\/replacemnt/ge \| '<,'>s/\/dest/ge \| '<,'>s/\/src/ge \| '<,'>s/\/ure/ge \| '<,'>s/\/langs/ge \| '<,'>s/\/frm/ge \| '<,'>s/\/orig/ge \| '<,'>s/\/abt/ge \| '<,'>s/\/prop/ge \| '<,'>s/\/attrib/ge \| '<,'>s/\/qu/ge \| '<,'>s/\/diff/ge \| '<,'>s/\/philos/ge \| '<,'>s/\/impl/ge \| '<,'>s/\/req'd/ge \| '<,'>s/\/elems/ge \| '<,'>s/\/elem/ge

" insert '.x' at the start of the line - i've got syntax highlighting so
" that this line is 'crossed off' (as a plain text equiv so strikethrough)
" i use it for my planning docs and the 'to do' sorts of items in it
map  I.x 

" pump out lines below the cursor 
" orig ver: nnoremap  ok
" newer ver that supports counts - see
" nnoremap  @='ok'

" execute the selected lines on the ex-line 
" e.g. if those lines contain a function you're coding, or a map
" so you don't have to copy those lines then type ':@"' 
vnoremap x "xy:@x

" note that we may have already deleted some of the files created today..... 
"   e.g. the files from today left might be 
"          100423.txt
"          100423--3.txt
"          100423--4.txt
" and we don't really want to just find the first available sequence num....
" but actually the first one after the current greatest sequence num
function! SaveNewPhdFile()    
    let today = strftime("%y%m%d") 
    let newFileName = today
    let theFileNames = glob(newFileName . "*.txt")
    let suffixes = []
    for fileName in split(theFileNames, "\n")
        let res = matchlist(fileName, "--\\(\\d\\+\\)")
        if res != []
            call add(suffixes, res[1]) 
        " assume it is the unsuffixed file for this date
            call add(suffixes, 1)        
    " note: max rets 0 on an empty list, which will be case when none of the files had suffixes
    let suffix = max(suffixes) + 1  
    if (suffix > 1)
        let newFileName = newFileName . "--" . suffix . ".txt"
        " ^ for some reason += isnt working  ??
        let newFileName = newFileName . ".txt"
    exec "w " . newFileName

command CreatePhdDocument :call SaveNewPhdFile()

" improvement: hmm, i think i could exec both of these in the one command... and
" whatever is used to separate two commands.. like an ampersand i
" think...thatd guarntee that one only happens after the other and that
" only a single window is used.
function! AddFileToGit()
    exec "silent !git add " . expand("%:p")
    exec "silent !git commit " . expand("%:p") . " -m 'added'"
command AddFileToGit :call AddFileToGit()

" @nextAvailable - if '1' attempt to delete the next block of whitespace lines
"   in the given direction, not just any immediately above current line
function! DeleteBlankLinesAboveOrBelow(direction, nextAvailable)
    let currLineNum = getpos(".")[1]
    if (a:nextAvailable == 1)
        let currLineNum = GetNextWhiteSpaceLine(currLineNum, a:direction)
        let currLineNum = Next(currLineNum, a:direction)
    while (WithinDocument(currLineNum))
        if getline(currLineNum) =~ "^\\s*$"
            exec currLineNum . "delete"
            " note that if we're deleting lines below (direction == 0)
            " then the line numbers below will be one less each time we
            " delete a line
            if (a:direction == 1)
                let currLineNum = Next(currLineNum, a:direction)

    "  ^ the problem i was having was coz i wasnt reading the documentation of
    "   delete closely enough. i thought you put the line number (or rather,
    "   range) /after/ the delete text. 

" the maps stand for 'delete blanks above/below' 
nmap  dba :call DeleteBlankLinesAboveOrBelow(1, 0)
nmap  dbA :call DeleteBlankLinesAboveOrBelow(1, 1)
nmap  dbb :call DeleteBlankLinesAboveOrBelow(0, 0)
nmap  dbB :call DeleteBlankLinesAboveOrBelow(0, 1)

" ^ hmm, if you have these maps as 
"       dsa     (delete space above, etc etc)
"       dsA
"       dsb
"       dsB
"   then for some unknonw reason when you 
"   type 'dd' it pauses before doing it, as if you could be typing 
"   some other thing after it - but none of these start with 'dd' ??
"   but then why can surround.vim not have this effect??

    " @direction:  1 - up, 0 - down
    function! Next(item, direction)
        if (a:direction == 1)
            return a:item - 1
            return a:item + 1

    function! WithinDocument(lineNum)
        return a:lineNum >= 1 && a:lineNum <= getpos("$")[1]

    function! GetNextWhiteSpaceLine(currLineNum, direction)
        " cases (just in the upwards direction)
        "     - 1. next line above *is* whitespace
        "     - 2. next line above isnt whitespace
        "         - 2.1 whitespace line is N lines above
        "         - 2.2 there are *no* lines of whitespace above
        "     - 1 & 2 r both handled coz it is passed the line the cursor was
        "       on when deletion command was called, and it just starts looking
        "       from that line 
        "     - the code in general handles 2.1
        "     - the uses of WithinDocument handle 2.2
        let newLineNum = Next(a:currLineNum, a:direction) 
        while ( getline(newLineNum) !~ "^\\s*$" && WithinDocument(newLineNum) )
            let newLineNum = Next(newLineNum, a:direction)
        if !WithinDocument(newLineNum)
            return a:currLineNum
            return newLineNum
     " *** should really put the regex for whitespace lines into a var!
    " testing map  :echo(GetNextWhiteSpaceLine(getpos(".")[1], 1))

function! FormatXml()
   % !xmllint.exe % --format
command FormatXml :call FormatXml()

function! SOnPlural(num)
    if a:num == 1 || a:num == -1
        return ""
        return "s"

cd ~/PhD/working/2013/

" show the 'cued-up' keys as you type them, eg as you type 3d
set showcmd

" Highlight from start of fileEdit
" most accurate but slowest 
" see 
" autocmd BufEnter * :syntax sync fromstart

set textwidth=9000
set formatoptions-=a

autocmd FileType text set textwidth=75
" auto-format as you insert text
autocmd FileType text set formatoptions+=a
" With this, a linebreak means a new para, unless trailing whitespace at 
" end of line.  It means that the 'a' option doesn't auto join lines 
" separated by a linebreak.
autocmd FileType text set formatoptions+=w

set hidden
set switchbuf=useopen,usetab

set tabpagemax=35

let g:gitgutter_enabled = 0

set foldmethod=manual

(UNIX/Mac: ~/.gvimrc; Windows: $VIM/_gvimrc)
" vim:fo-=a if has("win16") || has("win32") || has("win64")|| has("win95") " get normal ALT-SPACE behavior map :simalt ~ set gfn=Lucida_Sans_Typewriter:h18:cANSI elseif has("gui_macvim") set gfn=Menlo:h15 endif set cursorline " highlight line cursor is on set guioptions-=T " no toolbar " must be set in vimrc rather than vimrc - they're values are reset when " gvim starts set vb t_vb= function! SubsituteTildeForHomeDir(path) " " want the trailing slash to avoid case of a file in " parent of homedir starting with homedir's name " e.g. if homedir is /users/James " if there was a file called /users/JamesNotex.txt " let homeDir = expand("~") . "/" let newPath = substitute(a:path, "^" . homeDir, "~/", "") return newPath endfunction " sets window title that shows, in this order, these details: " - for unnamed files " - '[No Name]' " - a '+' if buffer has been modified " - current working directory " - vim server instance name " - for named files " - filename " - a '+' if buffer has been modified " - path " - if we're currently auto-generating HTML for this markup, " indicate name+path of that file " - vim server instance name " in any paths, a tilde is substituted for the home directory " function! JamesTitleString() " get list of nums of the buffers assoc'd w/ each window in curr tab page. let l:bufnrlist = tabpagebuflist() let fileNameAndPath = bufname(l:bufnrlist[tabpagewinnr(tabpagenr()) - 1]) " show only the filename (get rid of all the path details) let fileName = substitute(fileNameAndPath, ".*/", "", "") " 'escape' ampersands, so they 1) aren't hidden " & 2) make character following them underlined let fileName = substitute(fileName, "&", "&&", "g") if fileNameAndPath == "" let title = "[No Name]" else let title = fileName endif " Add '+' if the current buffer in the tab page is modified if getbufvar(l:bufnrlist[tabpagewinnr(tabpagenr()) - 1], "&modified") let title = title . ' +' endif if fileNameAndPath == "" let title = title . " (CWD: " . SubsituteTildeForHomeDir(getcwd()) . ")" endif if fileNameAndPath != "" let title = title . " (" let title = title . SubsituteTildeForHomeDir(expand("%:h")) let title = title . ")" endif " if we're currently auto-generating HTML for this markup, indicate name+path of that file if exists("b:htmlFileNameForMarkdownDoc") let title = title . " [->" . b:htmlFileNameForMarkdownDoc . "]" endif let title = title . " - " . v:servername return title endfunction set title set titlestring=%{JamesTitleString()} " max size of titlestring set titlelen=100 function! JamesTabLabel() let label = '' let bufnrlist = tabpagebuflist(v:lnum) " Add '+' if one of the buffers in the tab page is modified for bufnr in bufnrlist if getbufvar(bufnr, "&modified") let label = '+' break endif endfor " Append the number of windows in the tab page if more than one " let wincount = tabpagewinnr(v:lnum, '$') " if wincount > 1 " let label .= wincount " endif " if label != '' " let label .= ' ' " endif " ^ commented out because it includes taglist window in count " an enhancement would be to filter it out let fileName = bufname(bufnrlist[tabpagewinnr(v:lnum) - 1]) " show only the filename (get rid of all the path details) let fileName = substitute(fileName, ".*/", "", "") " 'escape' ampersands, so they 1) aren't hidden " & 2) make character following them underlined let fileName = substitute(fileName, "&", "&&", "g") " don't show '.txt' extensions let fileName = substitute(fileName, "\\.txt$", "", "") let label = label . fileName return label endfunction set guitablabel=%{JamesTabLabel()} function! OpenMyFiles() " note that for filepaths, must use forwards-slashes let notesDir = "~/Notes" let phdWorkingDir = "~/PhD/working" let dropBoxDir = "~/Dropbox" let fileList = [ \ notesDir . "/2014-plan.txt", \ notesDir . "/2014-days.txt", \ dropBoxDir . "/Apps/PlainText\\ 2/plan.txt", \ notesDir . "/vim.txt", \ notesDir . "/biograph.txt", \ notesDir . "/food&drinks.txt", \ notesDir . "/artsRelated.txt", \ phdWorkingDir . "/phdNotesInclSources.txt", \ notesDir . "/projectsToWorkOn.txt", \ notesDir . "/doAndGet-ideas.txt", \ notesDir . "/media-ideas.txt", \ notesDir . "/presents-ideas.txt" \ ] " \ notesDir . "/compu.txt", " \ notesDir . "/aiya,univData.txt", " \ notesDir . "/thinking&Knowl.txt", " \ notesDir . "/writing.txt", " \ notesDir . "/postQueue.txt", " \ notesDir . "/otherIdeas.txt", " \ notesDir . "/I-F&Games.txt", for fileName in fileList exec "e " . fileName exec "tabe" endfor exec "tabc" exec "tabdo :TlistToggle" " now, put the focus on the days file exec "normal! 2gt" set columns=135 endfunction " dev notes: " originally I didnt have the command there to join the lines, and it " didnt work properly. the reason was that you can't call exec like that " when there are a range of lines specified on the command line, as there " will be because there is a selection - and that sucks. the only " reasonable option would be if i could just put the 's' command there " without putting it as an arg to the exec...which i tried but it didnt " seem to work. if you use the substitute function, it only works on a " per-line basis, which'd be a pain. " could ask vim-use if there's a better way to do this. function! ConvertStringToFileName() normal! gv normal! J exec "s#\\<\\l#\\u&#ge" normal! gv exec "s/ //ge" exec "s/:/-/ge" endfunction " kinda silly way to impl this - I dont know how to define it as a string " and just insert that string. dont know how to encode the linebreaks. but " it works. function! InsertNotesFileFields() let oldFo = &fo set fo-=a normal! O normal! otitle= normal! oauthor= normal! otype= normal! oyear= normal! otopics= normal! oread= normal! o normal! o normal! o---------- normal! o let &fo = oldFo endfunction " requires the input text to be visual selection function! CleanTranslinkResult() let stringsToRemove = "Take Bus\\|\\t\\|(.\\{-})\\|daily timetable\\|trip timetable\\|Departing\\|Arriving\\|Zones travelled in:.*$\\|Fares for this journey.*$\\|Fare included in the next trip.*$" normal! gv exec "'<,'>s/" . stringsToRemove . "//ge" endfunction function! WrapAllLines() let oldTw = &tw let &tw = 9000 normal! gg normal! gqG let &tw = oldTw endfunction function! CloseTlistAndSetColumns() TlistClose set columns=76 endfunction function! GetLevel(theLine) if a:theLine =~ "^:" return 0 else return 1 endif endfunction function! FoldOnColonHeadings() setlocal foldmethod=expr " Make all the text within each section a fold " note that you dont call that func you just spec the func name setlocal setlocal foldexpr=GetLevel(getline(v:lnum)) " set columns=77 " setlocal foldcolumn=2 normal! zR endfunction "== menus function! OpenMyFiles_MenuItem() call OpenMyFiles() amenu disable &Personal.&Open\ Standard\ Files endfunction amenu 900.100 &Personal.&Open\ Standard\ Files :silent call OpenMyFiles_MenuItem() amenu 900.105 &Personal.C&lose\ Tlist\ and\ Set\ Columns :silent call CloseTlistAndSetColumns() amenu 900.107 &Personal.A&uto\-generate\ HTML\ on\ save :silent call GetMarkdownHtmlFilename() amenu 900.109 &Personal.Toggle\ GitGutter :GitGutterToggle amenu 900.110 &Personal.&Format\ XML :silent call FormatXml() amenu 900.120 &Personal.&Convert\ String\ To\ File\ Name :silent call ConvertStringToFileName() amenu 900.140 &Personal.Clean\ &Translink\ Result :silent call CleanTranslinkResult() amenu 900.150 &Personal.&Insert\ Notes\ File\ Fields :silent call InsertNotesFileFields() amenu 900.160 &Personal.&Wrap\ All\ Lines :silent call WrapAllLines() " eventually i want to put ticks next to the selected ones ✓ amenu 900.170 &Personal.W&riting\ Mode.&Normal :silent call NormalWritingModeLinesAndLinespace() amenu 900.180 &Personal.W&riting\ Mode.&Drafting :silent call DraftingWritingModeLinesAndLinespace() colorscheme solarized set background=light " for solarized " its set to dark in vimrc, as light is unreadable in terminal " make the highlighting of search terms less prominent " this is a lighter shade of brown " highlight Search guifg=#cbac4c highlight Search guifg=#dac47f

Autocommand for setting filetype of .txt files
(UNIX/MAC: ~/.vim/bundle/myadditions/ftdetect/txt.vim; Windows: $VIM/vimfiles/bundle/myadditions/ftdetect/txt.vim)
au BufNewFile,BufRead *.txt setf txt

$HOME/ctags.cnf (unix/mac: $HOME/.ctags. ctags website).

($HOME is an environment variable ctags uses; that's where it looks for the configuration file - I've set mine to same dir as $VIM)

syntax match lvl1Heading /^:[^:].*$/
syntax match lvl2Heading /^::[^:].*$/
syntax match lvl3Heading /^:::[^:].*$/
syntax match lvl4Heading /^::::[^:].*$/
syntax match lvl5Heading /^:::::.*$/

highlight lvl1Heading guifg=#0000FF
highlight lvl2Heading guifg=#0075FF
highlight lvl3Heading guifg=#0095FF
highlight lvl4Heading guifg=#60B9FF
highlight lvl5Heading guifg=#90DCFF

syntax match crossedOutLine /^\s*\.x.*$/
highlight crossedOutLine guifg=#AAAAAA

Add-on scripts
  • matchit
  • three related ones by Tim Pope
  • snipMate - TextMate-style snippets for Vim
    • though i haven't used this one much yet
  • taglist
    • for this i've installed ctags, and put it in my PATH environment variable (in my case in c:\programs\ctags58)
    • to get it to work properly with tabs (the 'tabs' for selecting different files, not the 'tabs' for indenting) apply the following patch
      --- plugin/taglist.vim 2008-08-13 19:04:48 +0000
      +++ plugin/taglist.vim 2008-08-27 19:24:49 +0000
      @@ -4097,6 +4097,12 @@
      " window. Used after entering a tab. If this is not done, then the folds
      " are not properly created for taglist windows displayed in multiple
      function! s:Tlist_Refresh_Folds()
      + " Not needed when one file is displayed.
      + if g:Tlist_Show_One_File
      + return
      + endif
      let winnum = bufwinnr(g:TagList_title)
      if winnum == -1
  • renamer - rename multiple files by editing a text document
    • Allows you to use the familiar editing techniques like regexs and using visual-block mode to rename multiple files, and also not have to deal with the escaping you have to do with a shell
    • I came across this in a discussion thread about the editor-agnostic massren util, which allows you to do a similar thing. I ended up using renamer as I couldn't get massren running properly on my system.

How I've dealt with Vim's temp files

Details here.

Thursday, January 28, 2010

Thought: virtual iPhone for cut and paste between phone and computer

I'd like a 'virtual iphone' program on my computer that would open when I connected my iPhone. The program would emulate my iphone, including all of the data and applications on it.

The virtual and actual phones would be synched in real time. If I did anything on either my virtual iPhone or my actual iPhone, the other one would act in exactly the same way. (to get the most out of some apps you'd need some way to emulate multi-touch).

Why? So when u copied text or images in the virtual iPhone it'd appear on the windows clipboard. And items in the windows clipboard would be pastable into the virtual iPhone and thus directly into my actual iPhone.

Say I had some text in my iPhone notes app that I wanted to put into a text file I'm editing on my computer - i think this cut and paste between the virtual iPhone and the text editor would be the most convenient way of doing it.

(and it'd be even better if the phone could _wirelessly_ connect up with the computer...)

Tuesday, January 19, 2010

On language documentation for experienced programmers

For someone familiar with programming it's pretty easy to get going with a new language.  The new language will likely contain many familiar concepts, just perhaps done a bit differently.  There are stylistic differences between languages, but I'm talking about the basics here. 

What is the most efficient way to present these programmers with what they need to know to get going with a new language?

I tend to find most documentation isn't that good for this task. What I find useful is concrete examples of the features, directly showing the syntax and the results you get for particular inputs. 

Like if I already know how to do regular expressions and want to see how they're done in Python, I just want to see what a call looks like in Phython and see things like what sort of value is returned if there is no match.   

So perhaps you could have documentation that was essentially a representative bunch of simple examples showing the exact inputs and exact outputs.

You'd have clusters of examples showing the different variations on a particular construct or function. Eg those showing the syntax for doing diffferent things with regular expressions. They'd come with brief descriptions of what is being illustrated. Eg 'non-greedy matches'. 

It'd be even better of you could edit the examples then and there to modify the input values and see how it effected the results.  

The idea would be to have the information in a format that is concise and easy to scan, to make it as quick as possible to lookup what you want to do.   

Amon Tobin's update about forthcoming album

Amon Tobin talks about progress towards his next album. This is the first time I've heard any mention of it

as far as a new album, well I know I've been quiet lately but hopefully it will be worth it. I've been building the studio and my own new tools (software) specifically for it which in itself takes time. I have something quite particular in mind but it requires allot of learning and preparation. necessary steps for evolution if you will.. I'm more impatient than anyone though, swear I feel like a kid when I think about it. but yes will be a while yet.. in the meantime please check the new site when it's up for updates and thank you all as always for your support and curiosity in this thing I love.

Monday, January 18, 2010

idea: using 'photo sequences' in photo viewing apps

Say you've got a bunch of pics in a directory or in your iPhone photo roll and amongst those there's a set of consecutive pics that form a grouping. You might have looked at a unit to rent and taken several pictures of the place - these photos would be in a consecutive sequence, bounded at both ends by photos taken at other times and places.

A photo viewing app might be able to automatically determine such groupings. It could use the photo metadata about when and where the photos were taken, and form groups of photos where each successive photo was not taken too far away from, and not too long after the one prior to it. Perhaps some AI techniques could help out as well (though I'm a bit doubtful of any of the existing techniques being good enough to do a sufficiently useful job).

It's hard to know how well these groupings could be automated without actually trying it. Lets consider the possibility that the software could do a reasonable job.

The iPhone photo roll is just a flat sequence of photos. Each photo you take gets appended to the end of it. As people have pointed out, the iPhone tends to eschew hierarchial storage of information within folders and sub-folders, instead using flat storage like this. Storing information in a flat structure in chronological order seems a reasonable solution that meshes reasonably well with human memory. One problem with it, though is that you can end up with a huge number of items -- in this case photos -- all lumped in together.

An app that could detect the photo groupings could have ways to browse the photos in terms of them.

Perhaps each grouping would be displayed as a line of thumbnails, with the groupings shown one after the other as you go down the screen. You'd scroll down to view more of the groupings. If there were more photos in a grouping than you could fit in a line of the screen (a likely possibility) it could continue the line off to the right - requiring a horizontal scroll to see them. Or maybe it would just only show as many as would fit on the screen, and use an icon to show there were more. You could click on that to view the first unshown photo.

I think it mightn't matter so much if you only see some of the photos in each group - hopefully the ones you would see would be enough to remind you of the subjectmatter of those photos and know if any one you were after was in that group or not. And since only a single line is shown for each group, it means that you could (i'd think) be able to scroll more quickly through all of your photos.

Of course it might not be as efficient if a lot of groupings only contained a one, two or a handful of photos.

There are other possibilities for displaying based on groupings. The screen could show one grouping at a time, where you swipe to the right to see the next group. And if too many photos in the group to display at once, scroll down to see the others (like how he iPhone photo roll works).

The general idea is that using photo groupings would be a way to give a lightweight, automatic structure to the sequence of photos -- without having hierarchies, thus preserving the benefits of 'flat' layouts iPhone uses.


When viewing the photos one by one and you got to the first image in a photo group, it could do the following. Instead of viewing that first photo, it could show thumbnails for all the photos in the group. You click on one of them to jump straight to it. Of if you just scrolled across to the next photo it would _then_ show you the first photo in the group.

Alternatively, when you hit the first photo in the group it could show it, but then underneath it show a line of thumbnails for the other photos in the group (and perhaps it would do the same when you were viewing any of the other photos in the group).

Regarding the automatic determining of the groups, perhaps the software could let you manually adjust its auto-groupings. It could also let you create your own groupings and give the groupings names. I suspect though that for a device like the iPhone, this'd be getting too complicated.

Sunday, January 03, 2010

A practical way to compensate musicians?

These days purchasing music is pretty much a voluntary act of charity.  The listener decides if they'll pay. 

I think a number of ppl would like to pay some amount to the artists but not the amount the music's sold for.  Which means they end up just pirating it for free.  

They might pay something if it was an  amount they were comfortable with and doing so was super low friction. 

Since they'd only pay what they're comfortable with they'd have to set the price. 

I'm not talking about how things should be in an ideal world. But trying to see what is the best that can be done in the world as it is. 

You could incorporate a new feature into music playing programs like WinAmp and iTunes. When they installed they'd ask the user if they want to make a monthly contribution amount that'd be distributed amongst the artists whose songs the person plays. The user could enter in an amount they were comfortable with - eg $5. Obviously this'd have to be connected with something like pay pal or a credit card.  

The user would of course be able to later change this amount or stop the payments all together. 

The programs can track which songs by which artists the person plays (like plugins for things like currently do - in fact the scheme I'm describing could alternatively be done via a site like that). 

It'd then divide the monthly amount appropriately between those artists. Obviously there'd need to be infrastructure to get all these paymets to them. That'd probably be the hard bit to do.

This seems pretty low friction  Once it's set up the user doesnt need to think about it or think about how the amount of music they're playing is going to cost them.  The amount they pay is known in advance and is a flat amount that's the same no matter how few or many songs they listen to in the month.
It could be set up so a verified display of their contribution amount could, if they wanted, be shown on their facebook profile or whatnot, which might apply a little social pressure to others to contribute.  

Making these contributions the default on music players could harness the power of defaults.

And of course there's the potential to apply such a model to other media such as movies or newspapers.

Saturday, January 02, 2010

The iPhone analogue of Vim-like editing?

What'd b the iPhone/touchscreen analogue of Vim-like editing?  

The most obvious thing would b to have modes.

This might not seem that useful. After all a lot of the benefit of having modes is being able to explicitly specify positions in the text or blocks of text, such as 'the end of this sentence' or 'this paragraph', whih is less of a benefit with a touchscreen coz u can directly point at and select things.  

Still I wouldn't be surprised if it turned out to b easier to specify certain text positions/ranges in a vim-like way.

Another benefit of modal editing is dealing with structure such as markup or code.  

Coz the iPhone has a virtual keyboard it could have different virtual keyboards for each mode. At least it'd be interesting to see if this made things better.
You could poss also use gestures (or maybe even phone movements) to specify certain commands. 

And I wonder if such an editor could help w/ coding on phone ala Y-Combinator's RFS 5: Development on Handhelds.  

Thought: iPhone 'slush pool' for making small payments practical

Just some quick notes. iPhone 'slush pool'
For small, fairly frequent payment amounts to work it needs to be low friction
No putting in ure iTunes password for each payment
The idea:
You have a 'slush pool'. A max amount put in at a time - a small amount like $5. You enter your password when u do this.
And you can use this to make small quick payments. Like paying 4 media content. 
Coz u don't enter password it's not as safe. Someone could grab your phone and buy stuff w/ it. But that's ok. The idea is tt this is a reasonable tradeoff of risk vs convenience.