Friday, December 18, 2009

Maemo DDP: a fly in the ointment

Last week I got my DDP's N900 and since I still have my Summit's device I haven't played with it much. I wish Marcin Juszkiewicz wrote his DDP device checklist earlier. I got this nasty bug 6823 "media player won't play any video files now (.avi) divx / xvid". I tried all files, even the default "Nokia N900" and "9". Since Mplayer plays all video files, this is a software fault, not hardware issue. But still it's frustrating and I'm waiting for any bug activity.

So my point is, all people who got their devices, please check for video playback in media player. And vote for the bug if necessary.

Thursday, October 8, 2009

Making your hard drive faster

Some manufacturers worry too much about their customers' comfort. For example, Apple disabled multitasking on their iPhones because too many running processes could slow down the system's responsiveness and everyone would say "iPhone is slow" rather than "you have too much stuff running, close something". In this case IMHO Apple worries more about themselves, but whatever.

In my case it's Dell/WD who worried too much about my comfort. My workhorse is Dell Precision T5400 with 2 quad-core Xeons. While running anything on it in 8 processes is fun, disk is always a bottleneck.

Let me introduce AAM(wikipedia: Automatic acoustic management). This option is used for decreasing the speed of disk rotation and head positioning. And for some people it's really necessary. But at work I have other people who, combined, produce much more noise. Thus, I don't need an additional care.

For my Linux PC 'hdparm' is a trusted tool:

# hdparm

-M  get/set acoustic management (0-254, 128: quiet, 254: fast)

Checking current setting:

# hdparm -M /dev/sda

acoustic      = 128 (128=quiet ... 254=fast)

And changed to max performance:

# hdparm -M 254 /dev/sda

Useful tool for testing the average random access time - seeker.c:

Benchmark results:

./seeker /dev/sda
Results: 58 seeks/second, 17.18 ms random access time

./seeker /dev/sda
Results: 76 seeks/second, 13.05 ms random access time

I think I already feel this 30% improvement. Or maybe it's the placebo effect :)

Thursday, September 17, 2009

First steps with Maemo 5 SDK - Stardict

It looks like there is a lot of hype about new N900. I don't think I'll be able to afford one for myself but there are still people who will need a dictionary program while they are offline.

4 hours spent to get the first working binary. And there is a huge amount of work to do:

  • read Maemo 5 HIG doc
  • change the layout of potentially everything as all the buttons are HUGE now and previous useful area got shrinked.
  • work around the bug "Xephyr crashes on clicking any editable area". Hate to have compiled/make_installed thing in my system.

And, of course, a screenshot:

Sunday, July 5, 2009

Look inside the process using /proc

That's what might be useful even for web-developers, not just sysadmins and geeky geeks.

Often there is a need to check what's some process doing right now. `top` is of course showing us 100% of CPU consumption but you need to have some sort of progress to decide if you can wait or you'll just kill the task and do it in a different way.

Let's take `grep` as an example of some task that may take hours on a big set of files:

user@host [/tmp/files] $ grep -e "$PATTERN" *.dat

So to use magic you don't need patch grep or to have knowledge of how to debug Linux kernel. I use `/proc` for this task:

  1. Find PID of the grep process, like this "ps axuww | grep grep" :)
  2. Exec "ls -al /proc/$PID/fd/"
  3. You'll get directory list as an output. One of these file descriptors the a process is grep's current file it's processing right now.

lrwx------ 1 user 64 2009-07-05 04:12 0 -> /dev/pts/2
lrwx------ 1 user 64 2009-07-05 04:12 1 -> /dev/pts/2
lrwx------ 1 user 64 2009-07-05 04:12 2 -> /dev/pts/2
lr-x------ 1 user 64 2009-07-05 04:12 3 -> /tmp/files/2009-07-01_4534545435.dat


For progress calculation you  can use "ls *.dat > list.txt" and then find which line you on right now.

Tuesday, May 19, 2009

Python surprises - scope of variables

Yesterday while debugging one place in some function I found one "surprise" in Python - language that I thought was designed to avoid surprises as much as possible(Principle of least astonishment).

if 1 == 1:
    print dir()
    found = True
    print dir()

print dir()
print "found:", found

['__builtins__', '__doc__', '__file__', '__name__', '__package__']
['__builtins__', '__doc__', '__file__', '__name__', '__package__', 'found']
['__builtins__', '__doc__', '__file__', '__name__', '__package__', 'found']
found: True

As you would have guessed coming from C++, here we had variable used out of its scope. But in Python variables live in special dictionaries - one is global where global variables and other stuff are stored and another one is local, for keeping local symbols inside the function. So all variables you create inside "for" loop or "if" scope will be stored in that local dictionary and will only be removed from there when Python's garbage collector decides.

That surprise cost me 30 minutes of wondering why some polygons on a map suddenly went nuts and lost their shapes :)

Monday, February 2, 2009

Amazon sells N810 almost for free!

Hi all,

Well, "free" in this case is actually $227, but anyway it means that those of us who can't wait until Maemo5-equipped device is released can have something right now.

I've been following the news about prices, but it was not available for non-US people. Amazon fixed this injustice :)