Archive for October, 2008

Ubuntu: Change Sensitivity of the Synaptics Touchpad

Tuesday, October 28th, 2008

I hardly ever use the touchpad on my laptop. At work, my morning routine is plugging in my external monitor, ethernet cable and the USB hub into the back of my machine. Yes, I could get a docking station but why bother? I have a little USB hub on my desk where I connect my mouse, keyboard, the external drive for backups and occasionally a flash drive or two. It is almost like a desktop replacement which it practically is. Dell Latitude 830 is a monster of a laptop. I love this machine but it is big and bulky and definitely designed to be stationary more than portable.

Today I had the crazy idea of walking around with it and using it as a normal person would use a laptop. Bad idea! It is nice to have that big wide screen when you work on this machine but it really was quite unwieldy when I was trying to carry it and a stack of papers around the building. Not to mention that the suspend to disk just does not work on that machine. Not that I’m surprised. I have never owned, nor seen a Linux laptop in which ACPI functions such as suspend or hibernate would work with any degree of reliability. If you have one, congratulations! I envy you. Perhaps Hardy will solve my issues once I finally upgrade to it. But I digress…

I took the laptop with me to the classroom without an external mouse and noticed two things. One, my keyboard was dusty showing how often I actually use this machine as a laptop. Two, my touchpad was sluggish. Quick glance at the KDE System Settings panel assured me that there was no such thing as touchpad settings applet. One was clear – I had to do something. I tried using the rubber nipple (yes this a technical term) located between my G and H keys but that thing is so inaccurate it is not even funny. It is like trying to mouse around with a Joystick – something that I actually did quite a few times back on Amiga when I was to lazy to plug in a mouse in between games. It will get things done, but it is neither pleasurable nor productive.

So I decided to fix this. Quick google told me that all I really needed to do was to add few short lines to xorg.conf. Look for the following section in your file:

Section "InputDevice"
    Identifier     "Synaptics Touchpad"
    Driver         "synaptics"
    Option         "SendCoreEvents" 	"true"
    Option         "Device" 		"/dev/psaux"
    Option         "Protocol" 		"auto-dev"
    Option         "HorizEdgeScroll" 	"0"
    Option	     "MinSpeed"		"1.0"
    Option	     "MaxSpeed"		"1.8"
    Option	     "AccelFactor"	"0.3"
    Option	     "MaxTapTime"	"0"
EndSection

This is how mine looks right now, which is after applying the changes. You see, I added the MinSpeed, MaxSpeed and AccelFactor options to this section. You might need to play around with the numbers but keep in mind that the higher the MaxSpeed the less control you have over the cursor. At 1.8 my touchpad is a bit jumpy but I can swipe it from corner to corner of my screen without picking up my finger which is what I wanted. I’d say that 1.5 would be a medium speed you’d want to aim for, and 2.0 is way to fast. I haven’t experimented with acceleration much because I got tired of restarting my X.

Here is the thing – why can’t I have an applet with adjustable sliders for all of this in my System Settings area in KDE? It would be much easier and more convenient than editing xorg.conf and restarting X, don’t you think?

In case you noticed the last option MaxTapTime being set to 0, that is me disabling the tap to click functionality. Why? Because it was just to sensitive. I was sitting in the class as my students were taking an exam and readig Terminally Incoherent comments. At one point I was trying to move my muse pointer and I inadvertently clicked on one of the google video ads that sometimes show up above or below the comment box and my laptop went:

“DUM DUM DUM DUM! THE ICREDIBLE HULK! CRAAAAASH! ROOOOAR! COMMING SOON ON DVD! BA DUM DUM DUM! WHOOSH! KABLOOM!”

By that time I of course scrolled up so I didn’t see the video playing. I was just like “WTF??? Who is watching videos during an exam”. Then I realized it was me. Fun times.

So yeah, tap to click is gonzo for now. I don’t really need it and it was more annoying than useful.

Vim Cheatsheet

Monday, October 27th, 2008

Today’s post is not really a post. It is an attempt to create a workable Vim cheat-sheet. I know that there hundreds vi/vim chat-sheets online, some better than other but naturally none of them is complete and includes all the commands that I care about.

By far the most popular sheet is probably this one which actually hangs over my desk. It is a very good one and I use it all the time to remind myself certain key-strokes. Still, it is not very comprehensive since you just can’t physically fit all the useful key-strokes in that format. I decided to organize mine into sections rather typographical groupings. The result is below.

Please note that I skipped the obvious stuff like ‘hjkl’ and some of the advanced stuff like marking, folding, and register operations. That’s because I don’t really use these commands that often, and furthermore a lot of Vi emulators (like the one in Komodo Edit) do not support them.

Your mission, should you choose to accept it is to add your favorite commands and/or indispensable shortcuts which I have omitted. And yes, I omitted a lot here. There are just to many things to list – this is why I’m relying on you guys!

Movements

w – next word
W – next white space delimited word
b – previous word
B – previous space delimited word
e – end of word
E – end of white space delimited word
0 or ^ – to the physical beginning of the line
$ – to the physical end of the line (ie. the newline char)
g0 – to the beginning of the virtual screen line
gm – to the middle of virtual screen line
g$ – to the end of the virtual screen line
gk – up screen line
gj – down screen line
fchar – till the next occurrence of character ‘char’ (inclusive)
Fchar – till the previous occurrence of character ‘char’ (inclusive)
tchar – till the previous occurrence of character ‘char’ (exclusive)
Tchar – till the previous occurrence of character ‘char’ (exclusive)
G – end of file
gg – start of file
gd – go to the definition (first occurrence of the word under cursor)
{} – begging/end of paragraph
() – begging/end of sentence
[{ ]} – beginning/end of a code block
[[ ]] – beginning/end of a method
[* ]* – beginning/end of a comment block
% – find next open block char ({[ and jump to it's matching close char
'. - go to the line with the latest change
* - search to the next occurrence of the word under cursor
# - search to previous occurrence of the word under cursor
/pattern - search to next occurrence of "pattern"
?pattern - search to previous occurrence of "pattern"
n - repeat last search (*,#,/,?) forward
N - repeat last search (*,#,/,?) backward

In the examples below I indicate a movement specified above as mov

Entering Insertion Mode

i - insert at the cursor
I - insert at the beginning of the line
gI - insert in column 1 of the line
a - append after the cursor
A - append at the end of the line
o - open a blank line below cursor
O - open a blank line above cursor
r - replace character under cursor and exit insert mode
R - insert at the cursor in overstrike mode
cmov - delete (change) movement and enter insert mode
cc - replace entire line
C - delete (change) line and enter insert mode
s - delete character under cursor and enter insert mode
S - delete line under cursor and enter insert mode

Deleting

x - delete char under cursor
X - delete char before cursor
dmov - delete range of movement m
dd - delete current line (text moves up)
D - delete to the end of line
J - join the line below to the current
gJ - append the line below to the end of current line

Block Modifiers

When dealing with blocks of text delimited by parentheses (), brackets [], braces {} or <> you can apply the command to either the contents of the block or the whole thing by following it with:

iblk – inner block (everything inside braces, parenthesis etc..)
ablk – all (whole parenthesized block)

Where ‘blk’ is ), ], } or >

Copy/Paste

yy – copy current line
ymov – copy movement m
p – paste after cursor
P – paste before cursor
vipy – visual interior paragraph yank – copy the current paragraph

Visual Mode
v – enter visual mode highlighting 1 char at a time
V – enter visual mode highlighting 1 line at a time
Ctrl+V – enter visual block mode
aw – highlight word
as – highlight sentence
ap – highlight paragraph
ab – highlight a parenthesized block
aB – highlight a {} blocks
ib – highlight contents of a parenthesized block
iB – highlight contents of a {} block

Special

< > – indent left/right
. – repeat last command
u – undo last command
U – undo all changes on the current line
Ctrl+R – redo last undo
Ctrl+O – jump outwards (up-back) to the previous cursor position
Ctrl+I – jump inwards (down-forward) to the previous cursor position

Completion

Ctrl+X – enter completion mode
Ctrl+N – auto complete word in insert and completion mode
Ctrl+P – auto complete word in insert and completion mode
Ctrl+L – auto complete whole line in completion mode
Ctrl+K – dictionary completion in completion mode
Ctrl+F – filename completion in completion mode

Useful Tricks

g~mov – toggle uppercase/lowercase on the range of ‘mov’
gumov – lowercase the range of ‘mov’
guu – lowercase the current line
gUmov – uppercase the range of ‘mov’
gUU – upercase the whole line
g?mov – rot13 on the range of ‘mov’

Regexp Replace

:ranges/foo/bar/arg – replace foo with bar in ‘range’ with

Values of ‘range’:

% – whole file
number – that particular line
none – apply to current line only

Values of ‘arg’:

none – apply to first occurrence
g – global (all occurrences)
i – ignore case
I – don’t ignore case
c – confirm each substitution
p – print the last line containing substitution
e – ignore errors

Macros

qchar – start recording macro storing it in register ‘char’
q – end recording
@char – replay the macro stored in ‘char’

That’s all I have for now. I will update this page with any useful suggestions. If we have enough perhaps I will take this, re-format it nicely and generate some sort of nice looking single sheet PDF that you could hang in your cube or above your fireplace or whatnot.

World of Goo

Friday, October 24th, 2008

I don’t usually go for the casual games but I’m making an exception for World of Gooo. It is a terribly, terribly addictive puzzle game that will suck you in for hours. I totally blame Shamus for bringing it to my attention. I read about it on his page, watched the video, read a review someone linked in comments and was intrigued. So I went and downloaded the demo which is actually the whole Chapter 1 (out of 4) of the game. I grabbed it from FilePlanet but in retrospect it was terrible, terrible idea due to the long queues. Which, actually says something about the game. I downloaded stuff from FilePlanet before (Morrowind mods mostly) and I never had to wait in a queue.

World of Goo Wait time was over 40 minutes for me. I just opened the window and went to make myself some dinner. When I came back the thing downloaded. I launched the game and… Well, needless to say, next thing I knew was that it was 3AM in the morning and I needed to stop messing around with the goo-bals and go to sleep. Well, that and get the full game cause I like totally used up the demo in that time. Seriously.

wog_header.jpg

I highly recommend checking it out, but you will probably want to avoid FilePlanet and use one of the alternate download locations. Either that or just get the Demo via Steam. If I knew there was a Steam version I would never bother with the FilePlanet shit.

What is the object of this game? You build wobbly structures by connecting silly looking balls of goo to get to a hard to reach target. That could be a whole game in itself and it would probably keep you amused for hours. It is a blast just to sit there playing with the physics of connecting the balls and keeping these structures from keeling over. But the game constantly throws in new twists into the gameplay. For example, no two stages in Chapter 1 are alike. You start with simple stuff such as building towers. Then you graduate to building bridges over wide gaps of terrain. You learn how to wedge your structures between walls. You learn how to support them with helium balloons to make even longer, wobblier bridges. There is one level which is a hexagonal tumbler forcing you to build a structure that can be rolled over on it’s side or upside down and still work. Every time you start a new level you can expect to be surprised and challenged in a new, entertaining way.

goo1.png

Unlike many other puzzle games there is no one correct solution for each level. Many other games force you accomplish tasks in particular way, and their puzzles seem like a game of “figure out how the designers want me to do this”. World of Goo is different – the game play is entirely free-form and you never feel like you need to follow specific patterns to succeed. The game gives you hints along the way but it never really prods you or shows you how to do things. You are your own master, and whenever you figure out a way to complete a level while saving more goo-balls you feel immense sense of accomplishment.

All the extra balls you rescue in each level, go into the World of Goo Corporation area which is a sandbox where you can use them to build a tower. There is an online component to this which you can enable. Once you do you will see funky little clouds appear above and below your tower. These signify how tall are the towers created by the other players. So you can have a sort of competition going on with all the other World of Goo folks out there. It’s probably worth adding that you can go back and replay every level at any time you want to see if you can score better (and thus gain more goo-balls for your tower).

goo3.png

The game is visually stunning – the levels are designed astonishingly well, with great attention to detail. Strong art direction gives the game a unique look, which accompanied by the cute sound effects and a lot of humor make for an incredible experience. Not to mention that the game will run on just about anything ranging from a toaster to your high end gaming rig.

It is almost hard to believe that this incredibly polished, detailed and meticulously designed product is an indie game written from scratch by two guys working out of local coffe-shops. Yep, there was no huge dev-team behind this title. Just two dudes with their laptops. Which is all the more reason to give them some of your money right now. At $20 this game is a steal. You won’t regret buying it, unless of course you miss couple of deadlines due to it’s highly addictive nature. Hell, you will feel better about yourself when you buy it knowing that your hard earned cash helped to support two talented independent game developers.