Thursday, September 09, 2010

tmux and vim configuration

I’ve now been on tmux for quite a few months since migrating from screen.

aterm + tmux + zsh + vim makes a super command-line combination.

But there can be certain issues with the key bindings with vim. Since moving to tmux I’ve avoided using vim tabs since I couldn’t figure out the right key bindings to switch them using C-PgUp and C-PgDn when in tmux. But today with a little help on #tmux and kerneltrap I finally got things working. So here are my .tmux and .vimrc files for posterity.

# start a new session on tmux att if no existing session is running new  # screen prefix key set -g prefix C-a  # large history set-option -g history-limit 100000  # swap on C-a C-a bind-key C-a last-window bind-key k confirm-before kill-window bind-key r source-file ~/.tmux.conf bind-key v split-window -h #similar to vim's vsplit bind-key h split-window  set-option -g default-terminal "screen-256color"  # status bar customisation set-option -g status-bg default set-option -g status-fg green  # highlight status bar on activity set -g visual-activity on  # change foreground-background for the current window setw -g window-status-current-attr reverse setw -g monitor-activity on  # for vim setw -g xterm-keys on  # load average, battery, and date + time set -g status-right "#[fg=magenta] #(cat /proc/loadavg|awk '{print

$1 \“ \” $2 \“ \” $3}‘) #(acpi|awk ’{print $4;}‘) #[fg=cyan]%d-%m

[fg=green]%H:%M"

# put the programs to start by default here # one $SHELL is always started at 0  # todo/bugtracker http://yokadi.github.com/ neww -n yokadi -t 10 yokadi  # focus on first window select-window -t 0  set status-left-attr reverse

.vimrc

syntax enable filetype on filetype indent on filetype plugin on  " Fast editing of the .vimrc map e :e! ~/.vim_runtime/vimrc  " When vimrc is edited, reload it autocmd! bufwritepost .vimrc source ~/.vimrc  " indent related set backspace=indent,eol,start set smarttab set expandtab set sw=4 set tabstop=4 set softtabstop=4  " other view settings, some redundant set t_Co=256 set number set autoindent set smartindent set showcmd set showmatch set ruler set tw=0 set hlsearch set incsearch set magic  " I don't like swap files set noswapfile :highlight Pmenu ctermbg=238 ctermfg=white gui=bold  " for tmux set mouse=a set ttymouse=xterm  " following taken from http://items.sjbach.com/319/configuring-vim-right set hidden runtime macros/matchit.vim set wildmenu set wildmode=list:longest set title set visualbell  "mappings " fast saves " fast quit " and tag/tree toggling :nmap  :w :nmap  :wall :map  :qall :map  :TlistToggle :map  :NERDTreeToggle :map  :FuzzyFinderFile  :let NERDTreeQuitOnOpen = 1  " ignore case when searching :set ignorecase " but if any character is typed uppercase, respect the case :set smartcase  :set wildignore=*.o,*.pyc set completeopt=menuone,menu,longest,preview  :set scrolloff=8  :set wm=4  " use ack instead of grep for vimgrep :set grepprg=ack  " abbreviations " useful iab xauthor Nikhil Marathe <nsm.nikhil@gmail.com> iab xdate =strftime("%d/%m/%y %H:%M:%S")  let g:GetLatestVimScripts_allowautoinstall=1  " Tell vim to remember certain things when we exit "  '10 : marks will be remembered for up to 10 previously edited files "  "100 : will save up to 100 lines for each register "  :20 : up to 20 lines of command-line history will be remembered "  % : saves and restores the buffer list "  n... : where to save the viminfo files set viminfo='10,\"100,:20,%,n~/.viminfo  " when we reload, tell vim to restore the cursor to the saved position augroup JumpCursorOnEdit au! autocmd BufReadPost * \ if expand(":p:h") !=? $TEMP | \ if line("'\"") > 1 && line("'\"") <= line("$") | \ let JumpCursorOnEdit_foo = line("'\"") | \ let b:doopenfold = 1 | \ if (foldlevel(JumpCursorOnEdit_foo) >

foldlevel(JumpCursorOnEdit_foo – 1)) |

\ let JumpCursorOnEdit_foo = JumpCursorOnEdit_foo - 1 | \ let b:doopenfold = 2 | \ endif | \ exe JumpCursorOnEdit_foo | \ endif | \ endif " Need to postpone using "zv" until after reading the modelines. autocmd BufWinEnter * \ if exists("b:doopenfold") | \ exe "normal zv" | \ if(b:doopenfold > 1) | \ exe "+".1 | \ endif | \ unlet b:doopenfold | \ endif augroup END  :runtime! ftplugin/man.vim  vnoremap  * :call VisualSearch('f') vnoremap  # :call VisualSearch('b')  " Smart way to move btw. windows map  j map  k map  h map  l  " Allow Ctrl+PgUp/PgDn in tmux set t_kN=[6;*~ set t_kP=[5;*~  " reduce vi compatibility for more usefult stuff set nocp

Posted via email from nikhil's posterous

Sunday, August 29, 2010

Knocked out of Node Knockout

(This is one of those you-don’t-really-have-to-read-it kind of posts)

I was very excited about Node Knockout. I had a great idea for an IRC bouncer + websocket based client called Ircsome using node, qooxdoo and a couple of other things.

I knew that I would only get 24 hours since Sunday had higher priority events, but I believed I could get the basic app working in 24 hours. Until things went downhill from last week. First my brand new shoes tore, and since Adidas has an idiotic replacement policy (even in their centralised, computer based inventory systems) where-in you’ve to go to the same store you bought it from, I lost about 3 hours of my time at home ( although I managed to pick up Erlang Programming. Then in the train home, I rebooted my cell phone and my SIM card just gave, it refused to work. There went my internet connection, no frequent push-pulls. Still I managed to get the client and server atleast talking to each other and logging onto IRC when the user filled in the details in the browser. I pushed out the changes over my home connection, and the push to Joyent succeeded, yet my server didn’t seem to be running, atleast my home internet configuration couldn’t manage to connect to it on any of the expected ports (even though push to the same server worked). By this time I was really annoyed, and had to sleep to, so I stopped. Knockout!

I plan to continue on Ircsome though, so I can deploy my own home brewed bouncer on my (coming soon) VPS and access IRC and logs from anywhere. Qooxdoo is a pretty great toolkit, but lacking certain kinds of documentation and being very heavy in size. Its almost like Qt, though I dislike the Java getter naming convention.

Posted via email from nikhil's posterous

Saturday, August 21, 2010

Final Evaluations results processed for Amarok and KDE UPnP Integration

Hi Nikhil Marathe,

We have processed the evaluation for your project named Amarok and KDE UPnP Integration with KDE.

Congratulations, from our data it seems that you have successfully passed the Final Evaluations. Please contact your mentor to discuss >the results of your evaluation and to plan your goals and development plan for the rest of the program

Greetings, The Google Open Source Programs Team

Yay!

Posted via email from nikhil's posterous

Saturday, July 31, 2010

Whats up doc?

Pardon me for the excessively cliche title, I was short on time :P

Its been a week now since college began, and already I feel the
extreme busy-ness that occurs trying to squeeze every activity into 24
hours. The vacations were comparatively totally empty.

The UPnP collection support in Amarok is concluding pretty well. Today
I committed the fix that considerably shortens the amount of data
transfer required over the network for subsequent queries once the
local cache is relatively filled. With a relatively small share on
miniDLNA, I got near native performance, with the tracks being
populated as soon as I opened up a tree. The kioslave too has had some
additions that allow applications using it to bypass many of the
user-friendly features (required for browsing via Dolphin or
Konqueror) and get blazing fast results instead.

With another Amarok release coming up, I want to get some time to fix
bugs, but it has been hard to come by, even on a weekend.

My other pet KDE project has been Rekonq, more specifically Chrome
extension support. I can't remember the last time I blagged about it,
but just so it doesn't get buried as defunct project, let me give a
status update. Work is slow but not stalled. I have extension
installation working. I have figured out how to interface the C++ and
JS parts, although it is a bit hacky. The Chrome Tabs API is mostly
implemented, (localization and script injection and message passing
are not), including the captureVisibleTab() method. Now that I have
some experience, it should be much easier to implement the rest of the
APIs. I still have to figure out how to implement background pages
(most likely a WebTab not added to the UI), implement safe message
passing and so on. A nice UI to manage extensions would also be
required, and it would be great if others are interested in jumping in
to the project.
I would be glad to explain the architecture ( I have a IRC log lying
around, thanks to Rohan Garg :P )

I don't know about 1.0, but extension support will get there in the
end, so lets not remove my name from the Credits :)

Posted via email from nikhil's posterous

Saturday, July 17, 2010

UPnP Searching

I’ve been pretty quite about GSoC progress. But I had a great time at aKademy and forgot all about blog posts. So the current status is thus. If programming was just about getting things done, I am done! But its not, which means although everything I was supposed to do is done in a big picture way, the next few weeks will see bug fixes, optimization and ensuring that certain things can be done faster, more accurately or in a more user-friendly manner. I also have to port the code over to use Solid, now that fellow GSoCer Paulo Romulo has improved UPnP support in it.

Last time I gave a glimpse of the Browse based collection. UPnP MediaServers have two methods of accessing their content. Browse() is similar to going through your hard-disk directory by directory. As you can see, this can be quite inefficient for a Collection since it has to keep track of a large number of tracks. The other method is Search(), wherein users can query the MediaServer to give tracks/media matching certain criteria, such as belonging to a specific artist, or containing a certain pattern in the name. This is much more efficient because all the work is done by the server and we just need to handle the results.

That has been the crux of my work this past month. Due to the restricted format of the UPnP search standard, it required a bit of work to handle more complex queries. In addition, due to the way the Amarok Collection and QueryMaker code works, I have to always ask the server for tracks rather than telling it to return on Artists or Albums. It took quite a bit of experimenting to understand these two things. But two days ago the collection started working with actual searching for simple patterns.

Here is the Search based collection with no search.

Here it is with a search term.

I should point out that the code is intelligent. It will contact the server and ask it if it supports Searching, or only Browsing and use the appropriate collection.

Other than that there are several bug fixes in the slave and in Amarok and support for reference IDs to prevent duplicate items ( every FOSS software server I tried still doesn’t support refID properly though ).

By the way, I passed mid-term evaluations. Yay!

Posted via email from nikhil's posterous

Friday, July 16, 2010

Fogged goggles

It is my habit to go swimming daily in the summer. This is the time when I am home from college, but the poor Mumbai University chaps are trapped in exams. The swimming pool as an habitat is a fascinating picture. And with no distractions it proves to be an ideal ground to pay attention to the human species, not to mention overhear conversations. I’ve come to the conclusion that swimmers can be categorized and a taxonomy is not far off.

First up are Blubbers. Physical characteristics: men, past their prime, pot-bellies. It is undoubtedly easy to identify a Blubber. A lone Blubber is not so interesting. A tendency to not take effort leads him to float on his back. Since fat people float without effort, he can enter a state of quiet contemplation.

It is when Blubbers congregate that things can get interesting. If you ever have the opportunity to stand next to a Floogie ( a group of Blubbers ), watch them try to out do each other every time they talk. You will notice that all those ‘achievements’ are always in the past. Exploits of swims attempted in rivers in their youth, or nephews and sons who have reached heights come up often. But mostly it is the banter of how the country is going to hell and how every politician should be burnt and what they would have done in the same situation. I should mention that it is quite common for them to also plan the next drink-guzzling afternoon where-in each will try to increase his beer-belly more than others. Warning: It is dangerous to expose children to Floogies. Make sure you are strong minded and get far away at the first moment of light-headedness.

We now turn to Ladies. Their count is lower due to a lack of time or often devotion to other things. I should remark that swimming seems to bring their words-per-minute down by about 80%. Owing to the awkwardness involved in getting close to one, Ladies are quite an under-studied species. Some female readers might be interested in expanding upon this, the US military is always looking for ways to spend money on completely pointless things.

Kids. Don’t you wish you could be one. Kids are extremely easy to identify. They are small.

Some tend to morbidly afraid of the water and will not go in until forced by a Moleskein guardian ( see below ). Once they take to the water they immerse in their own world, unaware that they are about to kick a swimmer. Groups of kids often avail of trivial pursuits like throwing a coin into the water and rushing to get it. This is encouraged, it is known to lead many to become Swimmers later. Interoperatability between the sexes is best at this point, after all ignorance is bliss. The ease of swimming is inversely proportional to the number of kids in the water, as normal traffic rules do not apply to them ( Lack of rules has also been observed in Blubbers ).

The author feels no qualms when he puts himself in the species called Swimmers. They are the alpha males of the pool, strong, lithe and confident of their ability in the water. Their aim is to exercise, to push themselves to do as many laps as possible. It is quite unfortunate then, that every other class conspires to block them, hit them and more generally just piss them off by mere presence. In densely populated pools, Swimmers have been known to demonstrate extreme reaction times. It is my inference that this is due to the need to grind to a halt when a Kid comes in the way.

Moleskeins. Mostly harmless.

A major cause of concern in my pool is the lack of a species called Beautiful Girls. Taxonomically perfectly named with the English word ‘beautiful’ denoting physical appearance and ‘girl’ meaning ‘young of female gender’. Extremely rare species in these parts of the world, swimologists have laboured to collect information about them. Your author has had the bad luck to observe only one in his 3 month sojourn. It is unfortunate that she could swim a bit. This immediately discounted the species Damsels in Distress. This is bad because it has led to my inability to be called “my hero” which is important for a Swimmer’s confidence.

The rarety can be comprehended by the fact that only once in this time was the BG close enough to attempt communication. Alas, I was checked in my attempt by the arrival of a Blubber who attempted to teach the BG the right stroke. Considering that Blubber’s are incapable of coming within 50 yards of the right stroke, I think he must have read it in a book. This has led to my lifelong hatred of that species. It is the wish of me and my colleagues that Beautiful Girls increase in number, and that is the reason why I’m all for feminism.

( this is meant to be an anecdote, my first attempt at writing one. I will not apologize for any Politically Incorrect behaviour. I do not believe in PC in jokes. Enjoy :) )

Posted via email from nikhil's posterous

Friday, July 09, 2010

Akademy Day 5/6

Day 5 of Akademy was spent hacking too. Then I had a great meal at Plevna), Tamperelainen, which was mashed potatoes + lingonberry jam + Tampere’s famous blood sausages. Well it lived up to its expectations, the sausages were definitely good, but different. It was kind of like sabudana vada.

Unfortunately Germany lost :( The final will still be a good watch though.

Once again, I would like to raise my fictional hat to COSS and all the volunteers for the excellent organisation of this year’s Akademy.

The day trip was spectacular.

We were treated to Finland’s natural beauty in abundance. Merunlahti Centre for Nature Tourism has this camp like area right next to lake Höytämöjärvi with canoeing, slacklining and other activities.

The first thing to do was to jump in the lake, which was pretty cold. I have never properly swum in fresh water before ( which says something about India’s screwed up Nature ) so it was great. And unlike the sea, a lake actually has a reachable ‘other side’. So I swam across and back about 150 m or so. Give a human a log in the water and he is transformed to a 5 year old. KDE developers spent half the time trying various things like standing on the log, getting everyone on without falling off and other stunts, which was really funny and great ‘community bonding’. Maybe day trips should be done at the beginning of Akademy :)

I tried my hand at a bit of darts, but I am bad at it. Archery was more my thing. Slacklining was not. Canoeing was great though. I got a feel of the boat immediately, although it was my first time ever, I think I’ll be trying it again when I get the opportunity.

The food was great too. We had bread and fruits and BBQed corn and potatoes, sausages we could cook ourselves over a fire and marshmallows!

Now a sauna isn’t really my thing, but they had a great sauna house and so I took a few spins. When in Finland, do what the Finnish do. Get out of the sauna and jump into the lake!

Tomorrow is the last day of Akademy, and I will miss this place and all the fascinating people. I wish I had a hackspace like Demola, fast internet, food, no disturbances. Kudos to the organizers again.

Posted via email from nikhil's posterous