Entries Tagged 'tip' ↓
November 26th, 2008 — editors, programming, tip
Am I the only one to notice that there is a lot of vim love in the airwaves recently?
I saw the trend very clearly, spanning from reddit to news.yc and let me say that the material that came up recently is very good; those neat posts prompted me to improve my vimrc dramatically and I really like what I learned.
In this installment, instead than annotating my vimrc (another one? not that interesting, I’ll refrain) , I want to compile a roundup of the best vim articles I saw recently.
I’ll also add a few classics that changed me from a hater to a vim lover and will conclude with some minor tips out of my bag.
So here we go with the roundup.
Recent Vim Articles Roundup
Jamis Buck
Vim Follow Up
Coming Home To Vim
Jamis Buck switches back to vim from a period using TextMate and talks about his experience and his configuration. Many useful tips in there.
Stephen Bach
Configuring Vim Right
Sensible defaults for your vimrc, recommended.
Learnr dev blog
Configuring Vim Some More
Some additional configuration options that totally make sense and I incorporated in my config too.
Swaroop C H
A byte of vim
A new free e-book on vim, worth reading. Covers also advanced topics like writing your own plug-ins.
Effective Vim
This ends the recent vim trend spotting. But there are some older links that are worth sharing in my opinion.
Older Vim Gems
Jonathan McPherson
Efficient Editing With Vim
This is a true gem, an intermediate level tutorial that will convert you from a beginner vim user to a way more proficient one.
Jerry Wang
vi for smarties
Very good beginners guide to vim.
David Rayner
best of vim tips
Raw tips from a very long time vi/vim user
Vim is also great for Python development, 3 ideas…
vim omnicomplete awesomeness
How to make vim a modular Python IDE
How to replicate SLIME in vim
Finally a few tips from myself
vimperator: If you’re a heavy vim user you might want to checkout the great Firefox extension vimperator. You’ll find yourself browsing mouse-less with familiar vim keystrokes in a matter of minutes. I love it.
viPlugin for Eclipse: If you’re a Java developer (been there, done that) and you’re stuck with Eclipse, you definitely want to have viPlugin. It makes the Eclipse experience something much more pleasurable for one who has vi keystrokes embedded in the fingers.
cool color scheme: If you’ve seen “some” screen-casts and you have just a subterranean TextMate envy and you can’t stop thinking at that cool color-scheme, well think no more, you can use this one or my humbly tweaked version.
For delicious users here is the page of my bookmarks that made me notice the trend.
Ending note
For full disclosure I have to say that I have been – and still am sometimes – an Emacs user. One of the rebel ones daring enough to use Viper mode. So now you know.
November 18th, 2008 — programming, python, tip
In the first installment of this series I’ve spoken about a set of technologies that can speed up the time to market quite a bit. Read about it here if you missed it.
This time I want to talk about where to get the content for your niche web app – if you need a source of content, that is.
Leverage the Semantic Web
I apologize if you all know it and I am late to the news. But really, the semantic web is alive and here and I think one of its most promising incarnations is Freebase.
What is Freebase?
Take the whole of Wikipedia, in it’s unstructured – well I should say semi-structured – mass of data, structure it properly creating schemas on schemas of semantic relations amongst articles, and expose a clean API on top of it. Keep the openness part, allow anyone to create new domains (called bases) and to contribute structured content by hand or programmatically. That is freebase as I understand it. Beautiful.
How did I use it
So the secret is out, that’s exactly what I used to present cool thumbnails and basic movie data for my tiny tuttivisti – now at the second week of life (check it out by the way, the new release is out).
Let me go into deeper depth here because I realize the audience requires it.
The Freebase folks have extensive documentation on how to interact with their service. In addition to that they publish two very nice Python libraries, freebase-suggest and freebase-python. The first to add a cool, jquery based autocompletion dropdown to your forms, the second to query Freebase programmatically from a Python program.
freebase-suggest example
Using the freebase-suggest library is very easy. To achieve this:

I just had to add this jquery snippet to the bottom of the page:
<script type="text/javascript">
var options = {
soft: false,
ac_param: {
type: '/film/film',
category: 'instance',
disamb: '1',
limit: '10'
}
};
$('#searchbox')
.freebaseSuggest(options)
.bind('fb-select', function(e, data) {
$('#searchbox').val(data.name);
$('#freebase_id').val(data.id);
$('#freebase_image_id').val(data.image.id);
$('#search_movie_form').submit();
return false;
});
</script>
And mark the text input of the search with id=”searchbox”.
The freebase-python library is also very easy to use and I encourage you to take a look at the documentation, here.
So in conclusion, before your app gains traction and your content is produced by your users, leverage the Semantic Web if you can, use freebase!
November 12th, 2008 — linux, tip
Say something bad happened and your application sent emails that it shouldn’t have (ahem who? not me…) and you want to collect the emails to apologise. So you just copied the output of a log file in a text file (wrong.txt) like the following:
sending message 'Confirm email address for example.com' to email1@test1.com
sending message 'Confirm email address for example.com' to email2@test2.com
[...]
sending message 'Confirm email address for example.com' to email3@test3.com
Unix command line tools can make the job of extracting those emails and make them ready to be used in a To (or BCC) field a one liner:
cat wrong.txt | awk {'print $9'} | uniq | xargs -I{} echo -n "{},"
The result is:
email1@test1.com, email2@test2.com, [...], email3@test3.com
November 9th, 2008 — programming, tip
Quick one liner to list the ubuntu packages you recently installed on a machine. I needed this to copy the configuration of one of my production boxes onto a dev environment:
sudo cat /var/log/dpkg.log | grep \ installed | awk {'print $5'} | xargs
mysql-client-5.0 mysql-server-5.0 ... apache2
October 8th, 2008 — general, mac, tip
I had problems setting up postfix to run properly on my macbook pro.
Then I found this very clear, step by step how to. And now everything works like a charm.
The only drawback is that I can now basically only send email from my gmail account. Well that will do it for now.
October 1st, 2008 — apple, programming, tip
Beautiful tip to search and replace all occurrences of a string in a given folder.
I had to change it slightly to make it work under OSX so here it is for future reference:
find . -type f -exec sed -i -e ‘s/Old/New/g’ {} \;