Wednesday, December 29, 2010

Mercurial goes down in my list comparing to git

For a long time a valued Merurial not less, if not more, than git. Well, until I started to use it for more than just local tracking of files.

So, you have working copy changes, do hg pull/update which conflicts with them. You're told:

use 'hg resolve' to retry unresolved file merges

So you edit the file to resolve conflicts, then run

hg resolve hg.txt

Right? No, because you get very strange output:


merging foo.txt
warning: conflicts during merge.
merging foo.txt failed!


And see that all your careful edits are blown away and file is back to conflicted state. Now you read man, to find out that you need to use -m option to mark file as resolved.

The question is: how can someone design such a UI that not only requires additional option for the most common operation, but also by default silently clobber users changes, which may be result of an hour or so of work? They say that git's interface is not that good (I used to think that too). Just look around.

Thursday, December 16, 2010

Saturday, December 4, 2010

WebKitGtk vs QtWebKit

Comparing functionality and features of Qt (QtWebKit) and GTK+ (WebKitGtk) ports of WebKit.

Scrolling Performance

It seems that as of 1.2.5, WebKitGtk has one fairly big usability issue comparing to QtWebKit: it has very slow (and high CPU usage) scrolling on some pages/sites. All browsers based on WebKitGit are slow on those pages, while all browsers based on QtWebKit are OK there, so that's indeed a framework issue.

Midori FAQ has an entry on this ("Scrolling on website xyz is very slow").

It turns out that this can be result of multiple bugs:
WebKitGtk 1.3.7 status: Seems to be mostly fixed, all pages from below show good scrolling performance, though ones with image backgrounds show not as smooth scrolling (but that's yet another issue).

Examples:

Related:
  • http://blogs.igalia.com/alex/2010/09/17/rendering-shadows-and-tiles/
  • https://bbs.archlinux.org/viewtopic.php?pid=860692 

Image Scaling Quality

On the other hand, when scaling images, QtWebKit 4.6.3 appears to (by default?) use nearest neighbour filter, while WebKitGtk uses smooth bilinear filter. In Qt 4.7.1 it's the same.

But it seems to be fixed in the latest QtWebKit, this post tells:
[01 Sep 2010] Re: no interpolation after scale image to a larger size?

This was fixed here:
[Qt] Enable smooth pixmap transforms by default

The change was too late for Qt 4.7 but will be part of the upcoming
QtWebKit 2.1 release.

As of now, QtWebKit 2.1 is still not released.

Btw, according to the patch, nearest-neigh filter is used exactly by default, it can be changed by client. Need to try that in Arora. - Well, not in Qt 4.6.3, there GraphicsContext::setImageInterpolationQuality() is empty.

Thursday, December 2, 2010

Bash Braindeadness: Logical Connectives

UPDATE: As was pointed out on Ubuntuforums, "true -a false" on its own is running command "true" with parameters "-a" and "false", and "true" deliberately silently ignores its arguments. So again, "-a" & "-o" have logical connective semantics only as arguments to test/[. The below is stylistic feature ;-).

So I've been debugging a shellscript which didn't do what it should have been (not mine). Everyone likes using kewl idioms, so there was:

check val1 -a check val2 && do_something


Well, just gotta choose right language. Because in bash:

$ false -a false; echo $?
1
$ false -a true; echo $?
1
$ true -a false; echo $?
0
$ true -a true; echo $?
0


Wanna more? Easily:

$ false -o false; echo $?
1
$ false -o true; echo $?
1
$ true -o false; echo $?
0
$ true -o true; echo $?
0


So, from looks of these examples, in bash, both logical AND and OR have the same truth table, and semantics of "return first argument". Now, wazzup?

Googling surprisingly doesn't give good hits - obviously, because you have troubles searching for "-a", "-o", "and" or "or". Googling for "logical and in bash" gives one good hit on 1st page - http://ubuntuforums.org/showthread.php?t=754338. There, some guy wonders why both [ 0 -a 0 ] and [ 0 -a 1 ] are true, but not really being answered.

So, by reading man bash a really careful reader may notice that -a and -o (in a sense of binary logical connectives) are defined within description of test aka [ command. The description also says "Expressions are composed of the primaries described above under CONDITIONAL EXPRESSIONS." And CONDITIONAL EXPRESSIONS list only checks like -a and comparisons, and no thing like shell commands, integer or string literals, etc. So, careful deductive reader might pose hypothesis:

Logical -a, -o are defined only within scope of test aka [ command. And there, they must apply only to legitime boolean expressions - checks and comparisons. Usage of -a, -o in any other context silently produces undefined result.

Of course, any decent language would give error if some operator is used in wrong context. But Unix shell in general, and Bash in particular, have always been special. So, be it historically preserved bug, or GNU Bash own invention, the end result is the same - you don't need the Brainfuck language or other alike novelties to have some fun - with bash, you can get unexpected results right at your fingertips, at any Linux workstaion around the world.

USB gives a lesson in physics

With a recently bought mouse:


[176149.256699] hub 3-0:1.0: port 1 disabled by hub (EMI?), re-enabling...
[176149.256706] hub 3-0:1.0: over-current change on port 1
[176149.357643] usb 3-1: USB disconnect, address 3
[176149.569692] usb 3-1: new low speed USB device using uhci_hcd and address 4
[176149.734362] usb 3-1: New USB device found, idVendor=093a, idProduct=2510
[176149.734371] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[176149.734377] usb 3-1: Product: USB OPTICAL MOUSE


Googling shows affected are many, yet few good explanations are provided. This good post explains that it is indeed caused by an electrostatic discharge (ESD), which, kernel can be agreed with, may be seen as an extreme case of electo-magnetic interference (EMI).

Thursday, November 18, 2010

Quest for Ultimate Browser

Web browsing in one or another form is probably the largest share of activity performed on computers today. And yet it's far from being perfect or even largely comfortable. Actually, it wasn't like that all the time. Back in old good days, you can browse web equally comfortable with both Netscape Navigator 2 and Lynx. But the more advanced web standards become, the more dynamic and media-rich web sites become, the more overall browsing performance and comfort deteriorate. Note that I don't talk here about how sites look or how well they represent information - there's big progress in that no doubt. The talk is about how well browsing of hundreds and thousands of such cool sites is managed. There're two biggest problems with modern browsing: performance and stability.
[...]

Midori (0.2.9):
  • All windows block if there's a JS modal dialog
  • Has a setting to not load/render pages from restored session on restart, just show placeholders. - I miss this much in Arora.
  • Session recorded just for one (main) window. Tabs opened in other windows are lost over restart/crash. This is show-stopper bug, made me use Arora as a promary browser instead. 

Arora (0.11):
  • Always puts a new tab as the last, no setting for that.
  • Show KBs downloaded for the page.
  • After some usage it turned out that session management is not robust: after the crash, I regularly get situation that windows and tabs are "restored" in the same numbers they were before, but each tab opens file://$HOME (yes, the local home dir). Or, Arora just forgets that it should restore session and shows its home page.
VI-like galore: dwbjumanjisurfuzbl (still review more), luakit

Monday, November 15, 2010

Floating Posts

I'm going to maintain some "research" topics (posts) which are updated over time. Date of such topics may be reset to the current from time to time. Such topics are tagged as "floating".

Sunday, November 14, 2010

Blog reloaded

It seems that I need a blog, after all. There're so many interesting things around... And some of them I even do/tackle myself, so I don't want to forget what/how I did that while moving to other interesting things. I could write private notes, but I learn lot of interesting things by just reading the Internet and blogs in particular. But not all - again, some stuff I need to research in-depth or make myself. Then, I'd like to share it back.

I was thinking for some time if I should make a new blog or continue this one. But after re-reading old posts, now I'm sure I don't want to leave this little blog orphaned ;-).

The only issue, is that this blog was started as dedicated to Embedded Linux, and may be included in some thematic feed aggregators/blog planets. I still hope to write about Embedded Linux, but going to extend scope to other topics. It's still going to be IT- and technology-centered. So, if you're a planet admin and think that new format doesn't fit your resource, feel free to remove it. If you're a reader which started to get posts on unexpected topics, feel free to report to you aggregation service. (Either way, feel free to drop me a line too.)