Wednesday, February 01, 2012

An authoritative source of current scientific opinion would be useful

[update: I've written a newer post that contextualises the kind of idea outlined here, as a way of helping truth spread in our 'information ecosystem']

I was talking to someone the other day who believed that Quantum Mechanics (QM) basically equated to the Copenhagen interpretation of it -- you know, the one where an observation collapses the quantum wave.

As far as I know, this interpretation is not very popular among working physicists. But I can't recall anymore where I got this detail from. No doubt it was from books I've read or things I've read in discussion forums, but I just can't remember.

I would have liked to have been able to point the person towards something online that showed that in fact most physicists don't believe the Copenhagen interpretation, but it's just not easy to find something that will tell you the current scientific opinion on a particular topic.

And if I can't reference some sort of reputable source, the person I'm talking to has no particular reason to believe what I'm saying.

Being able to easily find out, and link to, the current scientific opinion on topics would make it easier to address common misconceptions. A better informed public can on-the-whole only be a good thing, and surely this would also be helpful for matters of public policy where scientific opinion is relevant.

.

I'll explain what I mean by a source outlining current scientific opinion.

Imagine that a high status journal like Nature did a biannual survey of working scientists to gather their opinions about various topics, such as which interpretation of QM they believe. They could survey scientists in different fields, asking them about topics specific to their field. For example, Cosmologists could be asked whether they believe the big bang theory is true. Biologists could be asked whether they believe evolution is true. And so on.

Obviously a lot of thought would have to go into the questions they asked. Since the results of the survey would be for the general public, the media and the government to use, you'd want it to cover the sorts of questions these people might have a use for.

They could put the survey results up on a web-site that you could search and find answers such as (to make up a statistic) "99% of surveyed biologists believe in evolution".

.

The goal would be to have an authoritative source of such information. First, a reasonable proportion of practicing scientists would need to respond to the survey, so you know that the statistics it provides are representative. Hopefully scientists would be willing to respond to the survey, as a kind of public service.

Second, it would need to be a "brand" that was known to be reputable. So that if you presented a fact like "99% of surveyed biologists believe in evolution", linking to this source, the people seeing it would recognise that site and know what it's about and believe that it is reputable. (Obviously this is just an ideal. It couldn't just start out with that reputation, and it could never have that reputation for everyone in the population).

Saturday, January 28, 2012

There's learned philosophers but not philosophical experts

I posted the following to reddit/r/philosophy:


It seems to me that the notion of expertise can only apply to fields in which there is an established body of knowledge. By that I mean fields in which we have (empirical) grounds for believing our knowledge is at least an approximation or heading in the right direction. Physics or genetics or how to fix cars are examples of such fields. You can be an expert in physics.

Philosophy seems different. What makes philosophy interesting is that it's about things we don't understand well. In philosophy we're not even sure that existing approaches to problems are heading in the right direction.

Philosophy is pretty much by definition about things we don't understand well. Once a philosophical topic is understood it ceases to be part of philosophy, and becomes part of another field like physics, biology, economics, etc. (or alternatively, the problem may be dissolved and seen as a kind of misunderstanding.)

I would say the kind of knowledge that exists in the field of philosophy is more of ways of describing problems, or particular arguments for or against a view of problems. It's more like a discussion.

You can be an expert in the different positions about a philosophical problem, but I would distinguish this from the idea that someone can be an expert on a philosophical subject.

For example, someone can be an expert on the various problems and arguments associated with consciousness, but I don't think anyone can claim to be an expert on consciousness (at least the hard problem of consciousness) because we just don't understand it.

So rather than saying there are experts in philosophy I would say that there are people who are very learned in philosophy.

Why does this distinction matter?

When there isn't established knowledge, we're less certain that existing approaches are correct. The fact that an existing approach hasn't been able to solve a problem for long time may mean that it's the wrong approach. It is more likely in philosophy that someone who comes from outside of the field, who isn't well versed in the existing approaches, can add something of use to the table. The fact that they aren't familiar with existing arguments may even be a virtue.

If there aren't philosophical experts, then there aren't experts to challenge.

Yet it seems to me that philosophy seems to hold greater reverence for 'experts' than most other fields.

Friday, January 20, 2012

Improving 'use by' labelling on food

Here's a pretty basic suggestion for improving 'use by' labelling on food.

Even food that's properly packaged and uncontaminated can still go bad well before its use by date.

For example, once a tub of tomato paste has been opened it needs to be used within a few weeks at most, even if its use by date is still more than a year away.  And of course, it needs to be stored properly, in the fridge.

'use by' labelling unfortunately suggests that the food is ok to consume as long as that date hasn't passed, regardless of any other details.  (the same applies for 'best before' dates).


Here's my suggestion for how the labels could look:


    Use by:
    7 days after opening
    and before 31 Mar 2012
    Refrigerate after opening.

Packaging does often show 'time after opening' information and storage info, but they're usually in some fine-print separated from the (much more prominent) use by date. I think all this information should be shown right next to each other, as in the labelling suggested above.

With the way it currently is, you can easily just see the use by date by itself and draw the conclusion that if today's date is before then the food is ok.

.

You might think it'd be obvious how food needs to be stored, but people often put condiments that according to the labelling should be refrigerated in the pantry.

And even if you have stored it properly, the sight of the use by date being still months or years off can make it feel like the food must still be ok.  I've seen someone who has, for this reason, used tomato paste that's been put in the fridge but since gone mouldy (first scraping the mould off).

Of course labelling is never going to *stop* people from doing anything, but that's not the point.  It's to try and help reduce the chances of it happening, even if only by a relatively small amount.

Keep in mind, also, that it's not just about the one-off effects of eating unsafe foods, but whatever the cumulative effects of this may be.

.

Warning: the following is a bit rambly... where I try to think through some of the issues to do with human perception and psychology that underly labelling.

Labelling concerns human perception and psychology.  It's not a matter of what information is, strictly speaking, available.  It's about what information we'll notice and how we'll perceive it and how it can effect our actions.

The thing is that people aren't going to devote much time or effort to checking food safety info on labels.

The amount of time and effort and concentration we devote to a task tends to be proportional to how important it is to us at that point in time (and this is not usually the result of a conscious choice).

We don't fully consciously process the smaller things.  To some extent we're always handling certain tasks on automatic, rather than giving them full conscious deliberation.  We're creatures of habit, as they say.

While we're doing the little tasks we usually have our concentration focused more on the bigger tasks and concerns on our minds.

We're unlikely to ever devote that much time or effort or conscious thought to food labelling info.

As soon as a person finds something that seems like its telling them the whole story (the "use by" date) they're likely to stop their search.

.

Think what it'd actually take to actually find and process the other food safety information in addition to the use by date.

We'd have to think to look for it.  We'd have to find it on the packet, then take the effort to read it.  And then we'd have to reconcile that information with the use by date information.  The latter is harder than it sounds.  It took me a fair while to get clear how the use by date relates to the 'time after opening' info.

And we'd have to overcome our natural inclination to stop our search once we have found an answer (you can find a description of some research on this here.  I can't recall where I had first heard about this, but I do remember that Dan Airely describes it in his book Predictably Irrational).  We make swift, relatively sub-conscious judgements.

Where's the motivation in a normal situation to do these things?  There doesn't seem to be one.  There's always heaps of things you could be doing, but unless they're relevant to what you are doing or want to do they don't come to mind.

It may seem so "obvious" as something to focus upon because that's what we're doing right now in this bit of writing.  Which is the 'paradox' of discussing aspects of tasks that you wouldn't think of when you were actually doing the task - when you're discussing it you're making yourself to focus on it.

Thursday, December 22, 2011

Future scenario: personal AI drone cameraman

Here's a possible future scenario.

There's really cheap, light, compact drones (mini helicopter things) with good AI, an on-board camera, and really good battery life. They're quiet, too.

You and a friend go on a hike together, and take one of these with you.

At the start of the hike you take it out and tell it to follow you. (it's got voice control, so you just tell it what to do).

You tell it to take shots every once in a while. Its AI is good enough to compose reasonable shots, ensuring it gets one or both of you in the frame.

Perhaps it can even spot things of interest on the side of the track (e.g a big mushroom nestled in a rotting log on the side of the track) you might have missed.

You come to nice waterfall beside the track so you ask the drone to fly out so it can get a shot of both of you with the waterfall in the background.

It flies out to where it thinks it might get a good shot. It's transmitting the image to your phone so you can see what it looks like. You want it to move more to the left and get a little lower so you tell it that.

At the end of the walk you sit down on a picnic blanket and have lunch together. You figure it'd be nice to get a shot of both of you having the picnic so you instruct the drone to take one.

(and of course that's just one of many possible scenarios, many no doubt with a sinister edge, that such technology might make possible).

Thursday, November 10, 2011

Reframing how digital content is sold

Perhaps we could change how digital content (e-books, MP3s etc) is offered for sale.  Instead of "buy a copy of this item", offer it as "pay for the effort that went into creating this item".

Buying a copy means buying some bits, and since bits sound insubstantial and making copies of bits is effortless, it doesn't sound like it should be worth much money.

But when you frame it as paying the content creator for their effort, that sounds (to me) like something that's worth more.

This is about changing how people view what it means to purchase digital content.  There's obviously a big question about how that could be achieved and I'm not sure of the answer.

One component of that is the user-interface in online-stores.  I wonder if you could replace the 'buy' button with something else?  Replace it with something that suggests you are giving money to pay for the effort that went into creating that content.

Perhaps it could be a 'pay' button, with hover-text saying "pay for the effort that went into creating this item".

Obviously you'd want it to be something pretty short and sweet.


--

update: I wonder if the visual "branding" used by Creative Commons might serve as a model for this.  There are a range of buttons that represent particular Creative Commons licences (see the image to the right of this paragraph for an example).  Perhaps you could have something analogous to this and by, instead of a 'buy' button, having a special button that represents this notion of paying for the creation of the content instead of for the content itself.

Saturday, September 10, 2011

Idea: hold-and-swipe touch-screen gesture

An idea for a type of touch-screen gesture for phones: the user places their left-thumb anywhere on the screen and keeps it in the same place, and at the same time they swipe across with their right-thumb.

You can think of the left-thumb as acting like a modifier, like the shift-key.  A left-handed person could keep their right thumb stationary and swipe their left thumb - it'd have the same effect.

Each different swipe direction (up, down, left or right) could be recognised as a distinct gesture with its own distinct meaning.

I don't know if anyone has used this type of gesture before, but the benefit of it is that it's quite easy to perform.  Which is one of the challenges with gestures: finding ones that are really quick and easy to do.


Wednesday, September 07, 2011

On distinctions made between 'data', 'information' and 'knowledge'

Someone recently asked me what I thought about the distinction between data, information and knowledge.  I emailed them a response, and I thought I might as well turn that response into a blog post.

I think that it's good to recognise that not all "information" is the same, and that there is a kind of spectrum between 'raw data' and 'deep knowledge'.

But I'm not that keen on all the arguments about how you distinguish between these three concepts.  I just don't think we have a clear enough picture of what *any* of them are to draw sharp lines between them.  I also doubt there are any *sharp* lines to be drawn along that spectrum.

But aren't these sorts of arguments what is required to get a clearer understanding of the concept?  I don't think so.  I think our current understanding of these concepts is a "pre-scientific" one, and that what these arguments are doing is trying to find some set of criteria within these concepts that sharply distinguishes each from the other.  

I think that task is doomed to failure.  Here's aanalogy: when philosophers had a "pre-scientific" understanding of matter, they could get into all sorts of arguments about what was the difference was between liquids, solids and gasses (this is a thought-experiment, I don't know the historical details well enough to know specifically what happened).  But they were never going to solve the problem just trying to find some criteria to sharply distinguish these concepts from each other.

We now know that what was required was to get an understanding that we'd now label with terms like 'chemistry' and 'physics' -- an understanding in terms of molecules, atoms, etc.  What was required was to go deeper than their phenomenal concepts of 'liquid', 'solid' and 'gas'.  To have an understanding of what each of those things actually are, rather than just how to distinguish between them.

So, in the case of data, information and knowledge we need to go beyond our phenomenal notions of them and get at their "underlying physics", so to speak.  And when we do so we may find that -- like with 'liquids', 'solids' and 'gasses' -- there is an underlying unity there.

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?