Nicolás Brailovsky


A modern blog

Fuuuuuuuuuuuuuu (Opera)

author Posted by: nico on date Jul 23rd, 2010 | filed Filed under: Grumpy

I hate ubuntu, but I hate windows the most. I hate firefox, but internet explorer makes me want to vomit. I don’t like gnome, but kde is uglier. But I love Opera. Well, loved it, I guess version 10.60 will be my last version.

It’s been a loyal application which I’ve been using since its 6.x version. Always fast, with all the functionality I needed (some more too) and none of the bloated BS needed to make FF be a usable (though ugly) browser. It had it’s ussual screw-ups, everyone does, but after I updated to version 10.60 it has become unusable.

Its new features include random crashe, making gmail work really slow (or not at all: the fucking scrollbar won’t work anymore, and keyboard shortcuts in google reader (j & k, next & prev) are foobar’d. Scrolling on a large webpage eats 100% cpu, the upgrade fucked up my nice dark theme (and changed it back to a hellish abomination which seems to be a time-traveller from 1998), and it has random stupid bugs. And I mean STUPID, like, double click a word and the popup menu won’t go away.

I tried to insert this image through WP image uploader, but it doesn’t work anymore in Opera
Fuck. I always liked you Opera, but it seems it may be time to give chrome a chance.

Template metaprogramming XI: Hidden Agenda

author Posted by: nico on date Jul 20th, 2010 | filed Filed under: C++, Templates
Wow, number eleven already. We’re getting more chapters here than Final Fantasy games. I didn’t even imagine there was so much to write about such an esoteric language features like templates. I do wonder if anyone will actually read it, but that’s a completly different problem.

Enough meta-meta talk: what can we do with all the things we have learned? We can calculate pi and e, we already showed that as an example on one of the first chapters. This chapter I’m going to write about what motivated me to explore the bizarre underworld of template metaprogramming. Some time ago I had to work with a Berkeley DB researching the feasibility of developing a magic cache for (real) DB table. Leaving aside the discussion of whether this is a good idea (the project did have a good reason to be researched) I hit a major roadblock when trying to provide a façde for every table; something like this: See the problem? To do something like that we’d need a virtual template method, and you can’t have that. After seeing that I thought to myself “Hey, I’ll use templates!”. Then I had two problems, but the damage was done, I couldn’t go back. What kind of contorted device could we implement to make such a devious requirement work? I’ll leave you to think it, the answers I came up with next week.

Thanks for flying vim

author Posted by: nico on date Jul 15th, 2010 | filed Filed under: Vim Tips

Have you ever used Vim through ssh and saw your xterm title changes to “Thanks for flying vim”? It happens a lot to me, and I usualy notice about an hour later. I’m not sure what’s the use of this, I guess it’s related to Vim airlines (no, really, check vim-avia.com), but it can be turned off:

When using vim in an xterm it renames the title of that window to “Thanks for flying vim” on exit.

Q: How to turn off the message “Thanks for flying vim”?
A: :set notitle

http://www.vmunix.com/vim/answ.html

The truth about SNMP

author Posted by: nico on date Jul 13th, 2010 | filed Filed under: Grumpy

Seen @ http://wiki.wireshark.org/SNMP:

After years thinking and reading RFCs and various other documents, today, I finally understood. “Simple” refers to “Network” not to “Management Protocol”! So it is a Management Protocol for Simple Networks not a Simple Protocol for Management of Networks… That explains why it’s called “Simple”. It was that Simple but it took me years to understand it! — LuisOntanon

Thank you Luis. That explains a lot.

Opera borks gmail

author Posted by: nico on date Jul 8th, 2010 | filed Filed under: Grumpy

Ubuntu sucks, but less than windows. Gmail sucks, but less than hotmail. Opera rocks, but it tends to fuck up gmail every once in a while. After a lot of research and having found no help on the interweb I traced the problem to having a lot of tabs open for a lot of time (weeks, not hours).

In Firefox this shouldn’t be a problem as having a FF browser open for a week should hog all the memory on its host computer, forcing you to reboot. In Opera, being a little bit better behaved browser, this may actually be a problem.

Luckly the fix is simple: open a Vim editor or take out pencil and paper, make a list of all your open tabs, close opera and using your favourite console type “rm -rf ~/.opera/sessions” (i.e. delete the sessions folder in your .opera dir). Restart Opera and restore your tabs from your backup list. Problem should be gone.

Elvis is alive!

author Posted by: nico on date Jul 6th, 2010 | filed Filed under: Console, Linux

Unix trivia day: in the olden days of the 90’s there were a lot of Unix boxes out there named “elvis”. Nowdays it’s not uncommon to find one, either. Have you ever wondered why are there so many boxes called elvis?

This is related to Solaris’ ping command. When you ping $HOST it prints “$HOST is alive” (if it’s responding the pings), thus elvis is alive!

Vim tips: make things work again

author Posted by: nico on date Jun 29th, 2010 | filed Filed under: Vim Tips
Are you using :make within vim? If you are, then you probably noticed that getting lots of compiler errors is not uncommon, and that vim has a tendency of jumping to the first error found… but what happens if you want to see subsequent errors too, because you’re a really crappy programmer and need to find the 10 or 20 errors you just introduced with your single line edit?

Luckily Vim is always the anwser, just use cnext and cprev until you reach the error you are looking for.

There’s still hope

author Posted by: nico on date Jun 25th, 2010 | filed Filed under: Linux

A log time ago, in a galaxy far away, I posted a list of stuff I apt-get’d as soon as my Buguntu install was ready. Well, fast forward to KK and this is the new apt-get script:

  1. sudo apt-get install opera mocp unclutter build-essential gimp \
  2.         mmv gnome-do knetworkmanager xdiskusage iptraf sshfs \
  3.         shntool cuetools flac wavpack unrar vlc vim gvim vim-doc \
  4.         vim-full vim-gnome ddd devhelp doxygen doxygen-gui \
  5.         exuberant-ctags ctags  subversion ifstat antiword

Quite a progress I’d say, as these are mostly programs I use which don’t come in the default install (even though they should). You know, I even have hopes for the sound system in my notebook this time…

Nooooooooooo

author Posted by: nico on date Jun 23rd, 2010 | filed Filed under: Grumpy, Vim

(gvim:13664): Gdk-CRITICAL **: gdk_window_get_user_data: assertion `GDK_IS_WINDOW (window)’ failed
Vim: capté una señal de muerte SEGV
Vim: finalizado.

C++ pretty functions

author Posted by: nico on date Jun 22nd, 2010 | filed Filed under: C++

There are two well known macros from the preprocessor which every macro-sorcer must know. They are __FILE__ and __LINE__. You probably already know about them but anyway, __FILE__ will give you the current file and __LINE__ the current line. Easy, huh?

  1. int main() {
  2.    printf("%s : %i", __FILE__, __LINE__);
  3.    return 0;
  4. }
gccegg-65

The program above would give you “main.cpp : 3″ as a result. There is nothing going on at execution time, it’s all preprocesor wizardy. In fact with “g{++/cc} -E” you can even check what the “real” output is (-E means to return the preprocessor output. Keep in mind a lot of stuff will be included from the headers you use).

  1. int main() {
  2.    printf("%s : %i", "main.cpp", 3);
  3.    return 0;
  4. }

Well that’s nice and all, but g++ can top this easily:

  1. int main() {
  2.    std::cout << __PRETTY_FUNCTION__ << "\n";
  3.    return 0;
  4. }

There are a couple of notable things about this new “pretty function” thing:

  • 1. It will demangle a function’s name
  • 2. This time it isn’t a preprocessor secret thing but a real variable g++ will create.

You can easily use this for better logging functions now (with some macro wizardy, obviously).