Author Archives: Blaxter

Custom log levels for different components of samba

Lately I’ve been coding a little bit on openchange which runs inside samba. Until now has been a pain in the neck to look into samba.log file because of the noise.

I’ve just found out a way to customize the log verbosity per component, you can specify it (on your /etc/samba/smb.cnf file) with something like this:

log level = 5 tdb:0 ldb:0

With that we will get a log level configuration like this:

Current debug levels:
  all: 5
  tdb: 0
  printdrivers: 5
  lanman: 5
  smb: 5
  rpc_parse: 5
  rpc_srv: 5
  rpc_cli: 5
  passdb: 5
  sam: 5
  auth: 5
  winbind: 5
  vfs: 5
  idmap: 5
  quota: 5
  acls: 5
  locking: 5
  msdfs: 5
  dmapi: 5
  registry: 5
  scavenger: 5
  dns: 5
  ldb: 0

Personally now I’m using log level = 0 smb:5 because is what I’ve interested in and now I’m a bit happier than yesterday :).

Fix python path: eggs before PYTHONPATH environment variable

Easy install has a very awful feature, whenever you install something as an egg it will prepend that path to your sys.path on runtime so your PYTHONPATH variable will be after all those eggs (which normally or at least for my way to work is completely fuck up).

To fix this locate the easy-install.pth file of your python installation ($ sudo locate easy-install.pth, in my case it was /usr/local/lib/python2.7/dist-packages/easy-install.pth) and remove all lines with import sys. And there you go, fixed.

How to remove bluetooth icon on [k]ubuntu?

This is a silly customization thing but it’s my desktop and I’ll do whatever I want. In Kubuntu (I guess is the same on ubuntu, don’t really know because unity is too complex to use for my mind) you have a bluetooth icon. I’ve never used bluetooth in my entire life (true story) so I want to remove it.

You can accomplish this easily disabling the device. Something like this:

$ sudo rfkill list bluetooth
1: sony-bluetooth: Bluetooth
	Soft blocked: no
	Hard blocked: no
$ sudo rfkill block 1

Obviously you must change the ’1′ from the second command accordingly of the output from the first command. You could get bluetooth back executing rfkill unblock.

Kubuntu wiht ugly menus, buttons and weird look and feel?

This seems to be a popular problem in kde’s history, after an update your menus and general look & feel of your desktop is just weird (actually is just without any theme). Trying to set a theme again it won’t work. To fix this you just have to remove one file and regenerate the cache config with another command, just execute:

$ rm ~/.config/Trolltech.conf
$ kbuildsycoca4 --noincremental

Then restart your session (or close your apps and open them again) and there you go, pretty again!

error on super() method, TypeError: must be type, not classobj

If you have an error like:

    ...
    super(NuclearMissileHandler, self).__init__()
TypeError: must be type, not classobj

That means you have forgotten to inherit from object in the superclass/es.

Mental note: write something interesting in the fraking blog yo.

What you should know before walk into a job interview for a developer position

You could be an awesome developer or a really bad one, it doesn’t matter, a job interview is something different. It’s like doing a crossword for a writer or a drive license test for a f1 driver, they should do it just ok, but a bit of practice before won’t hurt.

Things I’d recommend:

  • To code something while other people are watching you (if you have a blackboard, the better): I don’t know about you, but I get really nervous if someone is looking at my screen, I start to do a lot of typos, even with really short shell commands and don’t even try to think and write logical stuff. One thing sort of work for me is to (try to) think out loud in those situations.
  • Remember basic data types: Nowadays we got into bad habits of using a lot of libraries so we forgot about really basic stuff, do you know how to write a basic “set” date type from zero? a list? a balanced tree? 10 years ago I knew it, right now probably it would take me much more time.
  • Algorithm’s costs: more of the same. It’s quite easy, but you should remember and take a look into this, again.
  • Learn name of things: once thing is to have an anonymous function without being bound to some identifier and another different thing is to have a lambda. It’s not the same to have a class that exposes the functionality that to have a façade. Well, in fact those things are the same, but it helps if we speak the same language.
  • Do not panic: it’s not about answer quickly, take it easy.

May the source be with you.