Flojdek

Subscribe to RSS feed

Vim block editing

Lately I've seen my friend doing block editing in Visual Studio, never did that in vim really, I was using regular expressions on selected bunch of rows, but sometimes it's really clumsy work smile

Block editing in vim is really easy, type Ctrl + q, moving as usual with h, j, k, l.

Constness

As a matter of practice, if you think a value shouldn’t change, you should make it a const. This not only provides insurance against inadvertent changes, it also allows the compiler to generate more efficient code by eliminating storage and memory reads.


- Bruce Eckel, Thinking in C++

Vim-like editing in Eclipse

Ahhh, how I hate Eclipse, it feels so heavy. The worst thing in Eclipse after working quite long with vim is its normal editing scheme eg. arrow left, arrow right... madness smile Probably it can be changed somehow without installing any plugins, but I found something that suits me very well... Vrapper! bigsmile

Vrapper is vim-like editing possiblity in Eclipse, I've tried to use also some plugins that exchange standard Eclipse editor window with gvim window but it sucked a lot, I just couldn't get used to it (it didn't feel like one application). Vrapper has very basic vim-editing-like support, but I'm very happy if I can move around, delete lines, exchange chars the vimmish way. Feels pretty like home wink

Why not use gvim you ask? Well if I want to write an Android app Eclipse can be quite usefull. I'll also try the command-line way, it's documented on Google's site, if I will have enough of Eclipse smile

Django, yay!

Huh, I have to make a web site, nice looking, clean with intuitive administration panel: adding news/articles, managing photo galleries and stuff. I've never tried Django before and I have to say I'm impressed. Doing all this stuff with help of Django Admin took me about 3 days, probably without the Admin app in Django it would take me more than a week. The best thing is that I've integrated tinyMCE with Django Admin textarea and works like a charm, and for galleries I'm using django-photologue which probably can't be easier to integrate and use... these 3 days of work were the happiest days of my web development experience wink

Manual images scaling

AFAIR when I was doing some site with loads of pictures (for example auction for my father) I was scaling images by hand with GIMP. Back then I didn't know about such convenient terminal tool as ImageMagick's 'convert', great stuff, really smile

So I've written simple tool in Python (probably not suitable for all situations, but it fits me), a wrapper script for 'convert' called scaleimgs:

[floyd@euler tools]$ scaleimgs 
Usage: scaleimgs <in_dir_with_images> <out_dir> <scale_factor_in_percent>


So if you have a directory with images then you're ready to go. Input factor is appended to scaled file name. Quick example:

[floyd@euler photo]$ ls
02.jpeg  09.jpg  image0  some_image  some_image2
[floyd@euler photo]$ scaleimgs . thumbnails 5
./02.jpeg
    thumbnails/02_5.jpeg
./09.jpg
    thumbnails/09_5.jpg
./image0
    thumbnails/image0_5
./some_image
    thumbnails/some_image_5
./some_image2
    thumbnails/some_image2_5
[floyd@euler photo]$ ls
02.jpeg  09.jpg  image0  some_image  some_image2  thumbnails
[floyd@euler photo]$ ls thumbnails/
02_5.jpeg  09_5.jpg  image0_5  some_image2_5  some_image_5


I think it can be usefull sometimes, especially when you want *only* to scale the images smile Source location github flojdek.

Update to Opera 11 at home

Finally I've updated my home Opera to the latest Opera 11 snapshot including extensions and new goodies! Yay smile

I've installed 'Turn Off The Lights', 'Fast search' and 'Inline Translator'... at least for now smile Personally I would love to see some extension using usefull information from my last.fm (flojdek) profile, e.g. show random band with additional info that is recommended to me or something like that.

Quick make in Vim

Writing a small project (quick compilation)? This can be usefull:

function! MakeAndWaitForInput()
	!make
	call input("")
endfunction
nmap <F5> :call MakeAndWaitForInput()<CR>


What it does? Hit F5 from vim/gvim, it will invoke make, and after that it will wait for input (so you can see the output).

Drawbacks? It blocks work with vim, and the output is forgotten when you hit key after make has completed, but I'm still using it when writing in for example TEX, instead going to terminal and typing make each time. Just like in Visual Studio bigsmile