Wednesday, September 07, 2011

Nassim Taleb on the lack of respect for those not doing steady and predictable work

Our society doesn't really understand work that doesn't deliver steady and predictable results.  People working away on this kind of work tend not to get much respect.  This is a real problem, because such work is essential to society.  In The Black Swan, Nassim Nicholas Taleb nicely describes what it's like for people having to deal with this lack of respect:

     Every morning you leave your cramped apartment in Manhattan's East Village to go to your laboratory at the Rockefeller University in the East Sixties. You return in the late evening, and people in your social network ask you if you had a good day, just to be polite. At the laboratory, people are more tactful. Of course you did not have a good day; you found nothing. You are not a watch repairman. Your finding nothing is very valuable, since it is part of the process of discovery—hey, you know where not to look. Other researchers, knowing your results, would avoid trying your special experiment, provided a journal is thoughtful enough to consider your "found nothing" as information and publish it. 
     Meanwhile your brother-in-law is a salesman for a Wall Street firm, and keeps getting large commissions—large and steady commissions. "He is doing very well," you hear, particularly from your father-in-law, with a small pensive nanosecond of silence after the utterance—which makes you realize that he just made a comparison. It was involuntary, but he made one. Holidays can be terrible. You run into your brother-in-law at family reunions and, invariably, detect unmistakable signs of frustration on the part of your wife, who, briefly, fears that she married a loser, before remembering the logic of your profession. But she has to fight her first im­pulse. Her sister will not stop talking about their renovations, their new wallpaper. Your wife will be a little more silent than usual on the drive home. This sulking will be made slightly worse because the car you are driving is rented, since you cannot afford to garage a car in Manhattan. What should you do? Move to Australia and thereby make family re­unions less frequent, or switch brothers-in-laws by marrying someone with a less "successful" brother? 
     Or should you dress like a hippie and become defiant? That may work for an artist, but not so easily for a scientist or a businessman. You are trapped. 
     You work on a project that does not deliver immediate or steady results; all the while, people around you work on projects that do. You are in trouble. Such is the lot of scientists, artists, and researchers lost in society rather than living in an insulated community or an artist colony.
(pg 86)


     Many people labor in life under the impression that they are doing something right, yet they may not show solid results for a long time. They need a capacity for continuously adjourned gratification to survive a steady diet of peer cruelty without becoming demoralized. They look like idiots to their cousins, they look like idiots to their peers, they need courage to continue. No confirmation comes to them, no validation, no fawning students, no Nobel, no Shnobel. "How was your year?" brings them a small but containable spasm of pain deep inside, since almost all of their years will seem wasted to someone looking at their life from the out­side. Then bang, the lumpy event comes that brings the grand vindication. Or it may never come. 
(pg 87)


This touches a nerve with me, as my research is definitely a long way from the steady and predictable, though I would say that I've been pretty fortunate in that I have had support and understanding from people.

Thursday, August 25, 2011

The sound of things just out of reach

#music. Songs that evoke a sense of things just out of reach, whether hazy childhood memories or something ethereal. All the songs here share a family resemblance that is best exemplified by Boards of Canada's music.



Memories of times past.


















The bittersweet beauty found in desolate isolation






Ethereal






Subtle Euphoria






Also somewhat similarly evocative



Sunday, July 17, 2011

iPhone app idea: "flow forms"

Some iPhone app ideas. Feel free to make use of them. If you do, an acknowledgement is all I'd ask. I'd play around with some of these ideas myself, but my PhD is what I need to focus on at the moment.

"Flow forms"

This idea is for a novel (at least as far as I know) type of UI for tasks like adding new expenses in an expenses app, where each time you do it you choose from the same set of options and you frequently perform the task.

The point of it is to make doing the task as fast and fluid as possible.

It aims at doing this by removing two sources of friction that you find in the existing form-like UIs normally used to perform these sorts of tasks.

How the normal UIs work. There's a screen for the form, showing the different fields. You tap a field to be taken to a screen for the various options for that field. After you've chosen a value for the field, you're returned back to the main screen for the form.

Friction 1: you have to complete a task before you can see the screen for the next task. A task is either tapping a field to select it, or tapping a value for the field. So you have to tap a field's name before you can see the screen for choosing the value for that field. So when you go to perform that next task you have to take a little bit of time to survey the layout of the screen and find the item you want. Even if you're familiar with the screen's layout and roughly where the item you want is located on it, it still takes a little bit of time to find that item.

Fiction 2: a lot of finger movement. You have to move your finger around a bit - to tap a field here, to tap a field-value there, and so on. This doesn't sound like adding friction, but I think it is something that can be reduced.

These might not sound like much, but if you're frequently using the same form these things start to feel tedious.


The basic idea of the proposed technique.

The form would be just one long page, which would continuously scroll up the screen. Below each field name would be one or more horizontal bands, each divided into equal-sized cells. Each of those cells would represent a different value for the field. To fill out the form the user just needs to slide their finger to the left or right as the form scrolled by.

Essentially the user only needs to move their finger along one dimension, thus simplifying the task. And all they need to do is select field values. They don't have to tap to go to the next field. And the hope is that if the next field is visible on the screen while they're entering the current one, they will have some sense of where the items of a field are located before they come to select them.


Here's some more specific details of one way it could work:


  • the line for selecting a field's value would be divided into N equally-sized segments, where N is the number of different options. (if there were too many options I'd be split up over multiple lines).

  • probably have these lines fairly thick - like 2.5 cm, so that the user has a fair bit of time to select the item as it scrolls past.

  • each segment would contain an icon (or short-description, if there is one) representing the particular value.

  • when the user has their finger on a segment, it would show a label describing the value.

  • the user could swipe their finger across a line to see the descriptions of all the items.

  • if the user made a mistake or missed entering a value for a field, they could scroll the screen back down just like they do in other applications.

  • perhaps they could also be a way to pause the scrolling.

  • perhaps the user could flick their finger up (just like they do in documents on the iPhone to scroll down) to quickly move down to the next field, once they've selected a value in the current field.

  • the user may not want to enter the values for all of the fields. if they've only entered a couple of fields and want to save the record, they could click a save button (or perhaps a two-finger sideways swipe).



Questions

  • how to handle the input of numbers? Would it just scroll a keypad into view and then pause the scrolling while you enter in the value? Or could number-entry also be handled in a similar fashion to the rest of the form entry?

    • it could show eleven choices across two rows: one for each of the ten digits and one for the decimal point.

    • if after you selected on of those you moved your finger over to a 'gutter' area on the side of the screen it would assume you'd finished entering in the numeric value.

    • but if you instead kept your finger within those gutters it would add another two rows for selecting another digit or decimal place.

    • the above process would continue on until you'd finished entering the number in.


    of course the question is whether this, or some alternative, would be convenient and fast enough.

  • similarly, how to handle the input of textual values (such as for a 'note' field for an expense item)? Would it just scroll up a keypad and a text area and pause the scrolling while you enter in the value? Or might there be useful way of entering it in a 'flowing' fashion, like I described concerning entering in numbers?



Notes

  • ideally it would show the fields in an order such that the most commonly used fields come first. I typically just enter two field values, and if these were the first two that came up I could just save the record after I'd selected values for them.

  • since the user is likely to buy the same item a number of times (e.g. I buy the same coffee everyday, or I might get a packet of chips every day) their muscle memory may be able to learn the path their finger traces out to enter the expense for that item.

  • to make entry even faster, you have an option to control the speed it scrolls at. As you got more familiar with it you could increase the speed. Perhaps there could be a speed-control slider that sat at the top of the screen next to the save button. It could even have a setting to automatically -- but gradually -- increase the speed over time. For example, it could get gradually faster every month.



Another question I have is: are there any other sorts of tasks or apps that this kind of UI technique might be useful for?

And finally, obviously it'd require a lot of experimentation to figure out how best to have the UI work. There's lots of different ways the basic idea could be done. Hopefully there would be one that is workable and which would make the task quicker and easier to perform.

iPhone app idea: "battlechat"

Some iPhone app ideas. Feel free to make use of them. If you do, an acknowledgement is all I'd ask. I'd play around with some of these ideas myself, but my PhD is what I need to focus on at the moment.

"battlechat"

An app for a kind of verbal battle amongst friends.

I'm thinking of like the verbal battles rappers do. I'm also drawing on my own experience when I used to be bored at work I used to have a lot of email conversations with a friend that basically came down to creative ways of insulting each other.

So this'd be an app that was like a mix between real-time (textual) chat between a bunch of friends, but with some competitive elements thrown in, to make it a bit game-like.

There'd be lots of different ways you could do this kind of thing, and getting it right would probably involve a lot of experimentation.

Here's one possibility.

The game is played in rounds. Each round lasts a set amount of time (e.g. 15 seconds). Players can type in whatever they want to say. And obviously they can make comments on what the others say.

At the end of the round, the players anonymously vote on who said the 'best' stuff.

The more 'votes' you get, the more "ammunition" you can use and you can choose who to expend it on. Players would start off with some amount of health and when they're 'fired on' they loose health. They get knocked out when their health reaches zero, and have to sit on the sidelines, so to speak.

Last person standing wins.

-

I can imagine the players being represented by their twitter or facebook picture, but with cartoon facial expressions and arms and legs attached to them (the facial expressions wouldn't have to be matched up with the face in the picture, or wouldn't even require a face in the picture, for the effect to work, I suspect... the idea is to do it for comic effect). Then when they're hit with some ammo, the cartoony facial expression shows an expression of pain, falls over, etc.



After thinking of this idea I came across Turntable.fm which while very different also works on the idea of adding game-like elements to more socially-oriented activities. That's a general area that could be explored.

iPhone app idea: 'ground control' side-scrolling car game

Some iPhone app ideas. Feel free to make use of them. If you do, an acknowledgement is all I'd ask. I'd play around with some of these ideas myself, but my PhD is what I need to focus on at the moment.

'ground control' 2D side-scrolling car game

In this game the player doesn't control the car, but the ground level. Sliding their finger up raises the height of the ground at that point, and also increases the slope of the ground leading up to that point. Sliding their finger down lowers the ground level.

The screen is constantly scrolling across with the car always moving forwards. The car might always sit about 1/3 in from the left of the screen.

Steeper uphill makes the car move slower. Steeper downhill makes it go faster. A small uphil can be used as a jump, making the car fly through the air.

These techniques could be used to make the car avoid static and moving obstacles, jump over crevices, etc.

---

update, 02 Aug 2011: I just heard about the game 'Bumpy Road' which works using this kind of mechanic (see the video on the linked page). It seems to use the mechanic in a different way, though. It seems it as effectively like an alternative to having a 'jump' button. I was thinking more of it as a way of changing the landscape ahead of the car, to speed it up or slow it down or to create ramp-like jumps.

update, 10 May 2012: The iOS game Contre Jour involves a mechanic where you raise and lower the ground-level.

Sunday, June 19, 2011

Chinese Steamed Sponge Cake

Chinese Steamed Sponge Cake

This simple cake is mildly sweet, and has a mild, slightly eggy flavour. It also has a somewhat unique texture.

My mum used to make it sometimes when I was growing up, and I've always liked it. I haven't seen it in Chinese restaurants or bakeries, so many people would probably have never seen it before.

I'm afraid I don't know what recipe book this recipe was originally from. I've just got a photocopied page of this recipe.

  • eggs, 4

  • sugar, 1 cup. brown sugar is probably better for this

  • oil, 6 dessertspoons

  • milk, 6 dessertspoons

  • plain flour, 1 ½ cups

  • baking powder, 1 tsp


  • Beat the eggs and sugar together until thick.

    Add the oil and milk.

  • Sift the flour and baking powder.

    Stir it into the egg mixture till smooth.

  • Pour this mixture into a 9 inch sponge tin

    • (or you multiple smaller containers, like small ramekins).

    Leave the tin uncovered.

  • Steam it for 25 minutes

    • e.g. put the tin into a large saucepan and let it stand on a small rack above the water.


It seems to be a bit tricky to steam the cake long enough that it is cooked inside (and not sticky) yet not too long and have it dry out too much. You might have to experiment a bit with the timing. Also, if you cook it in multiple smaller containers, like small ramekins, it obviously will cook the center of the cakes more quickly.

Other versions of this recipe

Monday, April 11, 2011

Making Vim copy all yanked text to the system clipboard

In addition to the usual cut and paste operations found in most other editors, Vim has a 'yank' command that can be followed by a motion operator.

So you can type yw to copy a word to the clipboard, or y3w to copy three words, or yip to copy the current paragraph to the clipboard, and so on.

Which is useful. But by default the text copied by the yank command is only accessible from within that same instance of Vim.

So if you've opened another instance of Vim in a new window[1] and you want to paste the text into that, or you want to paste it into another program, you can't.

An IMO problematic solution is to set 'unnamed' in the 'clipboard' option in your .vimrc / _vimrc, like so

set clipboard+=unnamed

this works but it has a downside - it also means all deleted text gets sent to the system clipboard.

Most of the time I delete text because I just want to get rid of it. When I tried setting this option I kept overwriting the clipboard contents (that I did want) with the deleted text that I didn't want.

And if you do actually want to delete text _and_ copy it to the clipboard you can use a cut command - i.e. C-x. So set clipboard+=unnamed doesn't seem like a good idea.

Here's a better solution, that just ensures yanked text is copied to the system clipboard. Just add the following line to your .vimrc / _vimrc:

nnoremap y "+y

The "+ tells Vim to yank into the + register, which is the system register.




[1] I know many people like to work within one Vim instance and use splits/buffers and tabs to arrange their files, and may want to suggest this as an alternative, but I find it very useful to work with multiple Vim instances. It's a long story, but I like to be able to spatially arrange the (OS)windows in a certain way that reflects the relationship between the files in them, and you can't achieve what I want with a single Vim instance.

Tuesday, February 15, 2011

idea: personal subject-lines for emails.

#gmail. Some emails you just read the once and never come back to them. Other emails contain information you'll want to reference in the future, which means you'll need to be able to find them again down the line.

There's lots of things that help in your search for an email - like knowing roughly when it was sent, so you can scroll down to that point in your inbox, or knowing terms mentioned in its body, so you can search on them. Sometimes you scan the subject-lines of the emails in your inbox or search results.

But sometimes those subject-lines are aren't very informative.

Some are just too generic (like "hi"). Or they may just not be specific enough for what you're looking for.

At the times when you know you'll want to find an email again later on, and it's obvious to you that the current subject-line isn't going to be that helpful, it'd be handy if you could stick a 'custom subject-line' over the top of the existing one.

After you'd added this custom subject-line in your inbox, that's the subject-line you'd see for that email, but it'd be clearly distinguished to show that it wasn't the original subject-line, and there'd be a way to find out what that original subject-line was.

As with any possible feature addition, the question is whether its benefits exceed its costs. This feature would be handy in some situations, but is the additional overhead in the UI and effort to come up with and type the new subject-lines worth it, for example? I doubt you could really tell if it's worth it for a feature like this unless you tried it out. You might get some idea from thinking through, in a lot of detail, scenarios of what the UI and usage-experience would be like if it existed.

Sunday, February 06, 2011

Idea: drag'n'drop merge of gmail conversations

#Gmail allows you to drag and drop the conversations in your inbox (for example, you can drag a conversation to a label, to apply that label to it). It'd be great if you could drop one conversation onto another in order to combine them.

Recently I've been planning a holiday with some friends and this planning, and the associated details, like confirmations of flight bookings, spans several separate email conversations.

If I could put them all together in one place it would make it so much easier to deal with the information. (I've submitted this idea as a feature suggestion to the gmail team).

(for interest's sake, the planning is for a trip to South Australia).

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
http://translink.com.au for more.
To find out the details you have to go to http://translink.com.au,
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
http://translink.com.au/servicechange.php?1277271606

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.
http://translink.com.au/servicechange.php?1277271606
(or of course the URL could be shortened by a URL shortner like bit.ly).

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]
vimrc
(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
map  
map!  

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
  endif

  " Switch on search pattern highlighting.
  set hlsearch

endif



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
endfunction
" 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
endfunction

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


"== 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)
endfunction
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
else
    colorscheme morning
endif



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):
" http://vim.1045645.n5.nabble.com/MacVim-and-PATH-td3388705.html
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
    execute(menuDef)
endfunction

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

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 
imap  
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 http://vim.wikia.com/wiki/Mapping_keys_in_Vim_-_Tutorial_(Part_2)
" 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
        else 
            call add(suffixes, 1)        
        endif
    endfor
    " 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  ??
    else
        let newFileName = newFileName . ".txt"
    endif
    exec "w " . newFileName
endfunction

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'"
endfunction
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)
    else
        let currLineNum = Next(currLineNum, a:direction)
    endif
    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)
            endif
        else
            break
        endif
    endwhile
endfunction

    "  ^ 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
        else
            return a:item + 1
        endif
    endfunction


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


    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)
        endwhile
        if !WithinDocument(newLineNum)
            return a:currLineNum
        else
            return newLineNum
        endif
    endfunction
     " *** should really put the regex for whitespace lines into a var!
    " testing map  :echo(GetNextWhiteSpaceLine(getpos(".")[1], 1))


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



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


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 http://vim.wikia.com/wiki/Fix_syntax_highlighting 
" 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


gvimrc
(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).
--langdef=txt
--langmap=txt:.txt
--txt-kinds=+h
--regex-txt=/^(:.*)$/\1/h,headings/

($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)


$VIM/vimfiles/syntax/txt.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
      tabs.
      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
      return
  • 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 Python 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 different 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.




notes

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 last.fm 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.  

Friday, December 04, 2009

"Re-thinking WYSIWYG editors for Web CMS"

Some thoughts from the Amaxus people on keyboard-only ways to add formatting and html links in rich-text editors or text-areas using just the keyboard.

They consider these options: Automatic Markdown Conversion, and Inline Formatting (introduce a keyboard shortcut that initiates ‘inline formatting’ - basically shows what the shortcut keys are for different types of formatting and which gives you an easy way to set which text the formatting will apply to).

Also, some Hacker News comments on that post.




My interest in this is how we can have editors that can handle structure (the formatting and link information requires structured information. but also stuff like the structure of code and XML) in a fluid fashion. I think there's a lot of room for improvement there.

Wednesday, November 11, 2009

"Early-stage theories"

Trevor Blackwell of Y Combinator has a nice post on how start-up founders need to be like people developing early-stage theories. Kinda hard to explain, but it's quite good.

Sunday, November 01, 2009

'Simplicity is Complicated'

As I've mentioned before, I think most discussions of simplicity are, well, major oversimplifications.

When people say the problem with certain systems is 'complexity' and that the solution is 'simplicity' what they really mean is actually specific sorts of complexity are the problem, and specific sorts of simplicity are the solution. I don't even think the issue is really best understood as a matter of of 'complexity' or 'simplicity', but that's another matter.

In 'Simplicity is Complicated', Avdi Grimm tries to tease out various different sorts of simplicity. He also talks about the tradeoffs that can be involved in each type.

These are the types he talks about


  • Minimizing unnecessary effort.

  • Hiding complexity.

  • Avoiding difficult-to-understand features.

  • Avoiding formal architecture.

  • Elegance of design.

  • Staying close to the domain.

Sunday, October 25, 2009

An idea for a multi-touch rhythm game

Here's an idea for a rhythm game for the iPhone that exploits the phone's multi-touch capabilities. 

Most rhythm games involve pressing or tapping on one of a fixed set of positions.  In Guitar Hero those positions are button positions, in Dance-Dance Revolution they're floor tiles, and so on. 

Touch-screens let the taps be anywhere on the screen.  Like in Elite Beat Agents on the DS where circular markers pop up on the screen showing you where to tap.   The sequence of places to tap usually follow a spatial pattern - eg in a line or an arc.  Following these patterns around adds some interest to the game.  It's more dynamic. Rhythm and movement work well together.  

On a multi-touch screen you could have a different style of game.  It could have the user make multiple touches at once, where the had to simultaneously tap points in a particular spatial pattern.  It might get them to simultaneously tap three points arranged in a line, then simultaneously tap four points arranged like the end points of a cross. The focus would be on the progression of spatial configurations.     

And just like how Elite Beat Agents also sometimes made the player slide the stylus along a path, this game could make the use simultaneously slide fingers across multiple paths.  For example, where their fingers start out at like the four corners of a box and have to simultaneously slide towards the box's center. 

I'm imagining something where it's like the players fingers are performing a dance. Something a bit like twister for your fingers, but rhythm elements to it. Maybe you could call it Finger Dance.

(this is the first time I've composed a post on my iPhone - nice use of a bus trip) 

Thursday, October 01, 2009

"Ten IT Concepts That Non-IT People Don’t Get"

update, 25.8.10: here is a related blog post by Andy Brice, "10 things non-technical users don’t understand about your software": 1. Copy and paste, 2. The difference between web and native applications, 3. Data storage, 4. The jargon you use, 5. Right click, 6. Concurrency, 7. What changes can be reversed, 8. The need for backups, 9. That they should read the documentation, 10. Problem exists between keyboard and chair" (discussion on Hacker News)




Stu Smith writes about Ten IT Concepts That Non-IT People Don’t Get.

It's easy to take things for granted when you're familiar with them. The ten items he describes are:

1. When to Click and When to Double-Click
2. Hierarchical Folders
3. Using Add/Remove Programs
4. Installing Bundled Software Hurts
5. That There Is A Choice Of Software
6. What Updates Do
7. Software Licensing
8. What Memory (RAM) Is For
9. How To Use Networking
10. The Display Is Not The Computer

Some additional ones from the comments:

"selecting vs highlighting"
"selecting vs highlighting": This one is really technical for the layperson because it isn’t what they first think. I often make the mistake of telling people to "select" a piece of text instead of "highlight" it. To them, "select" has to do with tangible objects on the screen like pictures whereas "highlight" has to do with text selection. I probably say "select" because on Mac OS X (the OS I use) text really does act like any other object. It can be dragged and manipulated like everything else, and this behaviour is much more obvious than on Windows. I might also say it because I understand some of the mechanics behind the way applications are made and, of course, the primary language of Mac apps is (Object)ive-C.
The scrollbar:
"Why do I pull it down to make the screen go up?"

being able to run multiple simultaneous tasks, and the relationship between opened-windows and the desktop:
Many users don’t understand that computers can run multiple simultaneous tasks. Users tend to see programs (from opening to use to closing them) as a linear process they must step through properly, forward and backward. i.e. Start > All Programs > Microsoft Office > Word > now I need to get "on the Internet" > Close ("X out of") Word > Start > All Programs > Internet Explorer. Rinse and repeat.

Many people don’t realize that programs are opened in a Window on top of their desktop. I can’t recount how many times I had a small web browser window open on a 30? display only to have people say "Wow your screen is very small," only to have them change to "WOW! That is a big screen!" once I’ve pressed the maximize button.<

I find both of these concepts tie nicely together in showing that users are somehow trained to have a sort of "tunnel vision" when using programs. I think the classic desktop GUI was originally centered around completing tasks in a modal or linear fashion, discouraging people from unlocking the true powers of multitasking. I find this helps to explain why multiple (physical) monitors/displays is a great way to improve efficiency in the workplace versus concepts like "spaces" on Mac not being as effective (in a mainstream sense) as they could be.

See also the discussion on that post on Hacker News.

I'd also add
– file extensions
– why you can only have certain characters in file names
(both of which are quite understandable)

The interesting question is: what are the best ways to teach these concepts to Non-IT people?

Wednesday, September 23, 2009

"Pesuade xor Discover"

Paul Graham considers the following issue: When writing, the plain truth (as you see it) will often be offensive to people. You can try and avoid this, but it doing so means being less concise, because you have to add disclaimers and write more indirectly. Is this worth it?

Maybe not. Maybe I'm excessively attached to conciseness. I write code the same way I write essays, making pass after pass looking for anything I can cut. But I have a legitimate reason for doing this. You don't know what the ideas are until you get them down to the fewest words. The danger of the second paragraph is not merely that it's longer. It's that you start to lie to yourself. The ideas start to get mixed together with the spin you've added to get them past the readers' misconceptions. [4]

That's not even the worst danger. I think the goal of an essay should be to discover surprising things. That's my goal, at least. And most surprising means most different from what people currently believe. So writing to persuade and writing to discover are diametrically opposed. The more your conclusions disagree with readers' present beliefs, the more effort you'll have to expend on selling your ideas rather than having them. As you accelerate, this drag increases, till eventually you reach a point where 100% of your energy is devoted to overcoming it and you can't go any faster.
(my emphasis).

I fully agree about the dangers there. I think it's important to treat writing as a means to figure out your view and that only at the very end should you be concerned with issues to do with communicating it to others. I think that to do otherwise is to limit yourself - a kind of premature optimisation, and from what I know of other's writing I think they most people get into those concerns far too early - either right at the start or early on in the process. This also seems to be the way writing is taught.

Wednesday, September 16, 2009

Don't purchase any music from Bleep.com

[update: 15.10.09: four and a half weeks after I originally purchased the music they finally managed to make the download available to me.]
[update: 4.10.09: over three weeks since I purchased the music and I still can't access it. I've had more correspondence with Bleep: twice they've wrongly said the problem was fixed when in fact nothing had changed. Then they said there was a bug in their system. They refunded me the money then. But since I still own the copy I purchased from them, it'd be throwing my money away to go purchase it elsewhere, so I'm still effectively prevented from being able to listen to the music until they get their act together. And refunding me the money doesn't address all the wasted time and frustration I've had to go through. It was a week ago when they told me about the bug in their system, and I haven't heard from them since. If they had any decent customer service, they could easily find an alternative way to get the music to me].




I was really keen to get the Autechre album "Draft 7.30" but I couldn't find it at the shops. When I got home and looked on the internet I discovered, through the music publisher's (Warp Records) site, that you could buy it online as MP3s at Bleep.com.

So I purchase it and went to download it. Because my internet connection at home is flaky, the download failed and failed four more times. Each time i was only able to get a tiny fragment of the entire file before it failed - the most it ever got on an attempt was 2.75MB. I went to try again and found that the download link was disabled. It didn't actually say why, but I presume this was an anti-piracy measure.

I didn't see any mention of a limit to the number of times you can download it. Maybe there was in the fine-print of the terms and conditions, but there was certainly nothing made obvious about it, and nothing mentioning it on the download page. I never saw anything there saying how many download attempts I had left, or saying that now I'd used up the number of attempts. The download button just stopped being clickable (I tried other browsers to see if it was some problem at my end, but it wasn't). There was no explanation at all.

If this is an anti-piracy measure, then it should stop people after five successful downloads. I wasn't able download the music once, I just had five quickly-failed attempts.

But then why is there a limit at all? If someone can download it once, then if they wanted to give copies to their friends they could still easily do that. If someone gave out or published their Bleep login details, so anyone could just log into the account and download the music, then this would also allow anyone to purchase more music on their credit card, so that's hardly going to happen.

So I don't see any point to a download limit anyway. All think it does is send out a message to a legitimate purchaser that Bleep.com does not trust them.

I then used their feedback form to send them a message explaining the situation. They say they'll try to get back to you within one working day. I bought the music on a Saturday, so that means I'd have to wait till around Tuesday morning (their time). I think this is pretty slack. Online stores are always open. If the store can take your money anytime, 24/7, then it seems a bit slack for them to only deal with customers' problems on week days.

The next day I sent them a rather more annoyed message. It's ridiculous that you can hand over money for something and be prevented from actually obtaining it. It's crazy that it is far easier to pirate music than to buy a legitimate copy.

It's now Wednesday -- four days after I purchase the music and sent them my first message explaining the problem -- and I still haven't gotten any response at all. After being screwed around like this, my advice is: don't buy music from Bleep.com. I certainly won't be.

Thursday, September 10, 2009

How long till we can buy everything with our phones?

When will we be able to pay for everything with our mobile phones?

I'd love to be able to do that. The store person would tell you the cost, that'd flash up on your phone's screen, you could accept it and it'd all be done. You'd get an electronic recipt, and you could automatically feed the purchase into whatever software you like to keep track of your expenses, which could streamline the process of budgeting.

The potential benefits are pretty obvious, and I know there must be a lot of people working on this kind of thing, so I'm wondering what sorts of barriers there are to getting it out there. It might involve technical issues, though I suspect it might have more to do with things like cost and business models. And given that, how long might it take until the technology is out there?

Monday, September 07, 2009

Three recent 'personal transportation' inventions

YikeBike

A compact electric bike that can be folded up quite small. Looks like they're intending to sell them in 2010. website here

Being ridden



Being folded up






The Enicycle

A Segway-like electric unicycle - and despite what that sounds like, it actually seems quite functional.








The Contortionist

Dominic Hargreave's concept bike that can be folded up so it's not much bigger than one of its wheels



(though the process of folding it up seems a bit involved).





Here's why stuff in this space is of interest to me. So much of how we live, or can live, whether in cities, the suburbs or the countryside, is defined by the transport options available to us.

I think in cities, in particular, it could be great to have a form of transport that was quick -- something more in the scale of buses, trains, cabs and bikes, than on the scale of walking -- yet was much more ad-hoc like walking, in that you could just pick up and go, when you wanted (no waiting for it, no having to go to the place to get it), and you can go pretty directly to where you want to go (unlike a train), and once you're there there's nothing to do (no having to lock up a bike) or no big thing to lug around.

I don't think any of these things here are idea in this regard, but they're heading in that direction.

Wednesday, September 02, 2009

.

Monday, August 31, 2009

Demnstrating the premises of an argument is more important than demonstrating their link to the conclusion

Quick sketching....

Here's a major criticism that I think can be applied to how most arguments are made. If we say the structure of the argument is like

if A, B and C then X
my criticism is that people primarily try to justify the argument by justifying the then part.

They may make some efforts to justify the if part - to justify A, B and C, but I think mostly this is more about giving the appearance of having checked that task off than a genuine attempt to ensure they're true.

Having taken A, B and C to be the case, they argue why X should follow, and try and back that up other reasons why we should take X to be true.

The problem with this is, I think, is that A, B and C actually being the case is far more important to X being true than the line of reasoning that allows you to go from A, B and C to X.

A, B and C define a terms of reference, a picture of the world. The arguments for then X are really along the lines of "in a world where it is such that you have A, B and C, it would follow that X". And I don't think it's that hard to have distorting simplifications in your terms of reference that allow you to derive X, even if X isn't actually true.

Justifying the if part is the major task in showing that the world actually has the certain properties, and works in the particular way that, when you work out the consequences, you see that X is the case.

.

I think we usually think of the premises of an argument as simply facts, but really the bulk of the premise is an outlook, a framing, a kind of model of the world and the kinds of ways you can reason from facts to conclusions. Kuhn's insight about paradigms is about this kind of thing.

.

This is a major reason why in most arguments the parties end up talking past each other. Of course the other person's view seems wrong - they're working from different sorts of premises. If you really want to get somewhere, examine the premises.

.

I can't think of a forum (the popular media, books, academic papers, discussion forums, etc) where it is really considered acceptable to really look into premises, or even to look into the premises behind other people's work. Philosophy is an area where you might expect to see it, though from the stuff that I've seen it doesn't seem to happen.

I suppose blogs are one medium where, in the first place, you can get it out there, and get away with it unscathed, though I kinda doubt anyone would be that interested in reading it.

Copy-editing marks and annotations

Signal vs Noise looks at why traditional copy-editing marks are more effective than how revision changes are shown in Word's Track Changes feature.

I think Track Changes is symptomatic of a more general shortcoming of all existing software: they’re hopeless when it comes to annotations.

Most software simply has no support for adding annotations to bits of your information (in your address book, your image files, your calendar, email, etc etc.). There might be a separate ‘note’ field, but that’s nothing like being able to add real annotations, like you can do on paper.

As the linked post points out, annotations should stand out as separate from what they are annotating, but I don’t know of any existing software that gets this aspect of annotations right.

Also, with hand-written annotations you can use subtle details, like the positioning of the annotation in relation to what it applies to or the size of the annotation text, to convey information, and software annotations are poor in this regard (though it'd definitely be worth investigating how to make it better). Certainly this is one area where pen input would be useful.

Sunday, August 09, 2009

The internet is good for Vim

I think Vim is a great text editor and one that's well worth learning. But it's certainly a bit of effort to learn all the commands and get used to working in different modes. A lot of people seem to be put off by that initial frustration.

You're editing a file and there'll be something, often fairly simple, that you want to do but don't know how. And while the Vim help is quite good it can be hard to find info on the specific thing you want to do, so it’s easy to get stuck. At least that was the situation 10-15 years ago. But these days you can just put details of what you’re trying to do into Google and you’ll likely get a good answer. And the net contains a number of Vim cheatsheets.

Of all the editors, Vim probably has the largest initial hump to get over before getting to proficiency, but also one of the largest payoffs for doing so, and the internet is making it a lot easier to get over that hump. And for that reason we might see a resurgence in its use.

Monday, August 03, 2009

Mangalam's Vegetarian Moussaka

Mangalam's Vegetarian Moussaka

Tastes very nice.

Ingredients

  • cooking oil, 5 tablespoons
  • eggplant, 1 medium
  • onions, medium, 1, peeled and sliced
  • potatoes, 2
  • medium tomatoes, 2
  • brown lentils, 400g can
  • tomato paste, 2 tablespoons
  • mixed herbs, 1 teaspoon
  • vegetable stock powder, 1 teaspoon
  • salt and pepper to taste
  • For the sauce
    • butter, 2 tablespoons
    • plain flour, 2 tablespoons
    • mozzarella, grated, 3 tablespoons
    • milk, 1½ cups

Method
  1. Peel and cook the potatoes

  2. Slice the eggplant and spread on a plate.
    Sprinkle eggplant with salt and leave for 15 minutes.
    Rinse and pat dry.

  3. Fry the eggplant in a little oil until brown on both sides and set aside.

  4. Heat the remaining oil and cook the onion until soft.
    Add the brown lentils (with the liquid from the can).
    Stir in the tomato paste, stock, herbs and seasonings.
    Bring to the boil.
    Cover and simmer for 5 minutes.

  5. Slice the cooked potatoes and tomatoes.

  6. Line the bottom of an oven proof dish with half the eggplant.
    Pour over half the lentil mixture and top with sliced tomatoes.

  7. Add the rest of the eggplant, lentil mixture and layer with the potatoes.

  8. Making and adding the sauce

    1. Melt the margarine, stir in the flour and gradually blend in the milk.
      Bring the sauce to the boil, stirring constantly.
      Beat in the cheese.

    2. Pour the sauce over the moussaka

  9. Bake in a moderate (180) oven for 45 minutes or until golden brown.

Thursday, July 23, 2009

How to backup Winamp song ratings and playcounts, and media library playlists

If you want to backup your Winamp song ratings and playcounts, as well as the playlists you create within the Media Library, this is how you can do it. You can back it up so you don't lose the information when you get a new computer and reinstall Winamp onto it.

I got this information from here and here

The files are in this directory:

%appdata%\Winamp\Plugins\ml
(On Win2k/XP, %appdata% is
    C:\Documents and Settings\(username)\Application Data\
On Vista, it is
    C:\Users\(username)\AppData\Roaming\)


The files are:
main.dat       # ratings and play counts
main.idx # ratings and play counts index file
recent.dat # play history
recent.idx # play history index file
*.m3u8 # playlists stored in the media library
playlists.xml # list of the playlists stored in the media library

The first of the source pages also suggests some alternative strategies for saving this information.