Behdad Esfahbod's daily notes on GNOME, Pango, Fedora, Persian Computing, Bob Dylan, and Dan Bern!

My Photo
Name:
Location: Toronto, Ontario, Canada

Ask Google.

Contact info
Google
Hacker Emblem Become a Friend of GNOME I Power Blogger
follow me on Twitter
Archives
July 2003
August 2003
October 2003
November 2003
December 2003
March 2004
April 2004
May 2004
July 2004
August 2004
September 2004
November 2004
March 2005
April 2005
May 2005
June 2005
July 2005
August 2005
September 2005
October 2005
November 2005
December 2005
January 2006
February 2006
March 2006
April 2006
May 2006
June 2006
July 2006
August 2006
September 2006
October 2006
November 2006
December 2006
January 2007
February 2007
March 2007
April 2007
May 2007
June 2007
July 2007
August 2007
September 2007
October 2007
November 2007
December 2007
January 2008
February 2008
March 2008
April 2008
May 2008
June 2008
July 2008
August 2008
October 2008
November 2008
December 2008
January 2009
March 2009
April 2009
May 2009
June 2009
July 2009
August 2009
November 2009
December 2009
March 2010
April 2010
May 2010
June 2010
July 2010
October 2010
November 2010
April 2011
May 2011
August 2011
September 2011
October 2011
November 2011
November 2012
June 2013
January 2014
May 2015
Current Posts
McEs, A Hacker Life
Saturday, July 30, 2005
 char * const argv[]

For the past few days I've been poking around dasher, cairo, pango still. Suggested to them and now the dasher project finally has a URL that can be memorized: http://www.dasher.org.uk/. Cleaned up a few uninitialized memory problems and a few leaks in dasher, all reported by valgrind. Also helped Owen pin down a problem in cairo with font caching. Then turned to porting and updating the cairo-demo module to the latest cairo api. From Carl Worth's Makefile's I discovered a few good gcc warning options to add besides -Wall to catch more possible problems in the code. Now I get a ton of warnings compiling anything. Was trying to fix them in FriBidi where I got stuck:

One of the warnings I've requested for is the -Wwrite-strings, that warns when you assign an string literal to a char * instead of a const char *. Everything's fine with that, except for the getopt_long call:

int getopt_long_only(int argc, char * const argv[],
const char *optstring,
const struct option *longopts, int *longindex);


The manual has a note at the end:

CONFORMING TO
getopt():
POSIX.2, provided the environment variable POSIXLY_CORRECT is set.
Otherwise, the elements of argv aren’t really const, because we permute
them. We pretend they’re const in the prototype to be compatible with
other systems.


So my questions are:

And I get this all because I'm overriding argv[0] to fix my applications name before passing to getopt, and that thing happens to be an string literal, sigh...

One of the other new warnings that I like is the -Wfloat-equal. That one warns whenever you a floating-point number in an equality condition. That's briliant! If you have every programmed a computer graphics or (worse:) computational geometry algorithm, you know that no two floats ever match with equality...

For the curious in you, here is my complete gcc options:
-mcpu=pentium4 -march=pentium4 -g -O3 -Wall -Wextra -Wfloat-equal -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls -Wold-style-definition -Wmissing-noreturn -Wdeclaration-after-statement -Wshadow -Wendif-labels -Wlarger-than-4000 -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Winline"

[Ah, I really got to finish the cairo-demo thing and get to the Summer of Code project. It's getting too late...]

Wednesday, July 27, 2005
 DDC+OLS Syndrome

I'm still in the patch dasher, patch pango, patch cairo, repeat loop. Fixed a couple more issues in pango with Owen today, spent some time on IRC with dasher developers, and wrote an initial cairo_arc_to patch.

There are a couple more pango issues I want to fix, but since Owen released today, they can wait a couple weeks for the least. There is a performance problem in GtkSizeGroup that I like to look at tomorrow, though I know it would take a lot of time, but hey. callion suggested that I take a look at autoconfication of the Mozilla NSS stuff, a killer known only being next to OO.o!

Bought a new keyboard, which is much appreciated. More on that tomorrow.

Saturday, July 23, 2005
 OLS Finishup

It was a very productive and enjoying week for me. I hacked more than 10 hours/day the whole week. Yesterday I worked with Owen and fixed or otherwise closed a few bugs on pango. Then after Carl Worth's awesome tutorial on Cairo, I decided to add Cairo support to Dasher. It's all finished up and in CVS now :). Performance problems, yes. :( But looks good. In the way, I optimized the Gdk rendering code quite a bit, so we're faster without Cairo at least :).

Fedora BOF was quite good last night too. Met Jeremy Katz in person that was interesting. He asked me about my Summer of Code project too :).

The OLS closing keynote address by Dave Jones was pretty interesting, about bugs and bugzilla in the kernel development, Fedora, and RHEL. Right after posting this, heading to hotel and then the final party... Again, had an awesome week. Next week back in Toronto working on preload, hacking all day long to the end of August, and writing it down on paper to the end of September. Should be pretty fun, specially now that I've got my hands quite warmed up.

Finally, got to really move away from blogger. My most productive posts that could enjoy a lot of feedback from GNOME people do not made it to p.g.o :(.

Thursday, July 21, 2005
 OLS Day 2 Hackfest

So I spent the second day at OLS mostly hacking. Attended Greg K-H's tutorial on writing a Linux kernel driver, which was cool. The kernel USB infrastructure is pretty damn neat.

Finished fixing warnings in dasher, here is the report and patch. Unfortunately I should have had started my work on the gnome-2-12 branch, not HEAD, but that doesn't mean I've totally wasted my time. Just that I still don't have a bleeding-edge dasher running. Got to apply my patches and fix the rest in the 2.12 branch tonight at the hotel.

Since it was a bug-day and Owen has been applying patches on pango too, I finally wrapped up the pango-no-freetype-internals patch by David Turner that needed a bit of testing. The patch was pretty solid, but I ended up fixing a leak in the opentype/ code, and a bunch of others in the examples/. Viva valgrind.

For tomorrow's hacking, I'm going to really get started on preload. There's not much left to the end of Summer by Google's definition.

Wednesday, July 20, 2005
 service stop DDC; service start OLS

[I'm dropped out from Planet GNOME again, for the same old reason. Seems like it's sensitive to conferences, last time it was on GUADEC 6's first day, this time DDC'05's first day.]

Random comments that I got during my talk: Keith Packard (keithp) noted that X contains a couple hundred kilobytes worth of locale data, parallel to glibc's, and that probably can be replaced by a central locale data library too. Daniel Veillard (DV) is seeking a lightweight (<30kb) way of having locale-aware collation in libxslt that supports ascending/descending and lower-first/upper-first/locale's-default options. So far he has only found that in ICU, but ICU is multiple times bigger than his whole library, so that's no option.

Anyway, DDC second day went pretty smooth. DV and I got together to find a solution for his problem, and I started hacking up a solution based on strcoll functionality of the libc. The main problem is supporting that ascending/descending and lower-first/upper-first/locale's-default thing. here is the part of the XSLT spec about sorting. Doing all these in a not-that-slow way was a torture that I managed to survive after a few hours of hacking. Good hacking for a day. The code is available here and is in public domain. The algorithm is described in the comment at the beginning of the file. I would like to hear from people whether what I'm doing makes sense, is there any easier way to do this, etc.

Later in the afternoon we headed out for dinner with David Schleef (ds), Chris Lahey (clahey), and a few other people. Caught Michael K. Johnson (mkj) in the elevator and had a long conversation about their packaging system and sitro. Then ran into Colin Charles of the Fedora Project fame. Ah, he recognized me as a Summer of Code student of them, but I still told him that I've not started the C code yet. So we all had a good dinner and left for the final party at Final Party at Vineyards Wine Bar & Bistro. This time we spotted H. Peter Anvin (hpa) wearing a cool t-shirt (got photos, will post later) and his wife Suzi. While talking standing still an hour later there, Dave Jones (djones) joined us and another half an hour passed before we left them and headed for the party.

The party was awesome. Lots of good drinks, chatted with Hubert Figuière again, and more with Jon Phillips (rejon) and Bryce Harrington, two InkScape developers. Also got photos of Colin Charles and David Zeuthen (davidz) taking photos of eachother! Will post them all really soon. Also met Soeren Sandmann, which was good. I finally figured out why planet is called planet (apart from the obvious reason): After hooking my weblog on p.g.o, all the planet knows that I work on Persian support, I didn't make it to 6UADEC, and even that I finally found a place to stay for DDC!

OLS started pretty good too. I was in bert hubert's talk about On faster application startup times: Cache stuffing, seek profiling, adaptive preloading (he mentioned me working on preload too) when DV wrote on IRC that he's looking at keithp's eye-candies. So I walked to the next room and got some of the eye candy at Keith's talk. I've been wondering whether is possible to do a decent desktop in say 32MB, and decided no, but this talk started changing my mind and thinking what should we do to get an order of magnitude (not really, but) smaller.

Got a chance to talk to Seth Vidal, the hero behind yum. Seems like latest yum is doing all items in my wish list. So for example you can say "yum install /usr/bin/mencoder" instead of the nasty "yum list *mencoder*" (in livna they have packaged it separately as mplayer-mencoder, girrrrrrr.) There's also a yum shell, yes! No more "yum list this"...takes 30sec..."yum list that"...takes 30sec... And they are aiming for transactions, so you can run the shell, say "remove sendmail", then "install postfix", and then "run"... Beautiful.

If I find some time tonight at the welcome reception, I would like to hack on dasher. They need some help with autotools, I will fix all that, and if time remains, work on fixing the cpu-usage problem. Currently dasher in a stopped state still eats ~40% of my 2.4GHz CPU! It should not. After that is to cache the language model so it doesn't eat 100% CPU for 10 seconds on startup. Way to go...

And finally, in a few minutes is the keysigning that has brought lots of signatures to my PGP public key.

Monday, July 18, 2005
 SQL

Murray: Like everybody else suggested, you alias the tables. A more readable approach is to actually put the optional "AS" keyword:

SELECT deliveries.departure_contact_id, depaturecontacts.name_last, deliveries.arrival_contact_id, arrivalcontacts.name_last FROM deliveries
LEFT OUTER JOIN contacts AS departurecontacts ON (deliveries.departure_contact_id = departurecontacts.contacts_id)
LEFT OUTER JOIN contacts AS arrivalcontacts ON (deliveries.arrival_contact_id = arrivalcontacts.contact_id);

 DDC'05

Arrived in Ottawa yesterday. Made it to the Linux in the Wild BBQ, where I found the biggest Iranian picnic going on in the same park, so I joined the Iranian guys afterwards and had a lot of fun. Settled in Carleton residence afterwards and slept a good twelve hours.

So to expect, my slides are not impressive at all and I think I couldn't motivate the work enough. Anyway, here are the slides, called Bloat of Data in the Unicode Era, just delivered the presentation an hour ago.

Met Keith Packard, Daniel Veillard, Hubert Figuiere, David Zeuthen, and there many more to meet. Quite a lot of fun so far. Photos to come later.

Saturday, July 16, 2005
 More Dasher

Roozbeh: It's not the corpus that has پروژه‌ی فارسی‌وب (FarsiWeb Project) in it, but dasher learning what I've been typing for a few times!

BTW, if you want to try the Persian dasher, you need to download the files in here and put them in /usr/share/dasher (or equivalent), and then run dasher, select Persian, right-to-left direction (if automatic doesn't work), and European/Asian colorset. That's all!

Friday, July 15, 2005
 Persian dasher!

Professor David MacKay and I spent three hours today and with the small corpus that I compiled last night, we made the most gorgeous alphabet support of dasher for Persian. The outcome is unbelievably handy and I'm indefinitely excited. Shots and shoots ahead:

dasher 1

dasher 2

dasher 3
(Free Software for a Free World)

dasher 4
(Part of the alphabet at the beginning of the sentence.)

dasher 5
(Peace and Freedom...)

dasher 6
(Red Cross [already selected] of Canada [predicted])

And the one shoot is here. Unfortunately the current version of dasher does a too heavy X I/O, so the shoot through VNC doesn't come out good, no matter what I set for the delays. But I've slowed down quite a lot so you can figure out what's going on.

Rock!

Thursday, July 14, 2005
 Dasher

Just came back from a cool talk about Dasher, presented by their lead researcher David MacKay who is visiting our department for a few days. I've got an appointment with him for tomorrow to get Persian support in Dasher! So I'm going to prepare a corpus tonight. I need some high-quality text. I'm thinking about the books I have typed, stuff I have translated, and archives of Ghasedak and Cappuccino online magazines, after some preprocessing. Very cool stuff in general. And soon after I've got to start compiling the slides for my talk on Monday.

Saturday, July 09, 2005
 The weirdest bug

This definitely is worth copying here:

Bastien Nocera wrote:

> We definitely need a way to have a poke at the screensaver so that it
> doesn't get enabled without resorting to the current fake key events
> hacks.

Ah...
And for two years I thought its the weirdest bug of all software that
when running xine and switching windows using alt+tab, I get my
keyboard language changed once in a while... And that after once
running gok, running xine brings up a "you pressed shift too many
times, do you need any help" dialog that I don't even know how to
turn off... And that running xine brings the Typing Break screen
lock up every 20 minutes even when I don't touch the mouse and
keyboard... What I didn't know is that it was all to free me
from turning off the screensaver when watching movies...that I do
anyway, since mplayer doesn't have this "feature" of sending fake
key events... sigh

Tuesday, July 05, 2005
 Google Summer of Code Updates

The SoCers now have a planet, and a hackergotchi gallery. So far everybody have been busy figuring out which tax forms to fill and returning back the agreement. Seems like no (international) student is going to get the initial $500 check sooner than the $4,000 final check. Thanks to the US tax laws, Google AdSense checks would be sent out as soon as you check the box that you are not a US citizen or resident, but you need an ITIN to get the SoC grant, or 30% will be withheld.

Sanctions: roozbeh: I'm still waiting for the Google lawyers to figure out how to deal with the situation, but almost surely it would be resolved. I cannot sign and send the current agreement form though. Anyway, to see how it really is for myself, I digged into the treas.gov and found that the cannonical document is Iranian Transactions Regulations (ITR). To quote the relevant parts:
...

S560.206 Prohibited trade-related transactions with Iran;
goods, technology, or services.

(a) Except as otherwise authorized pursuant to this part, and
notwithstanding any contract entered into or any license or
permit granted prior to May 7, 1995, no United States person,
wherever located, may engage in any transaction or dealing in or
related to:

(1) Goods or services of Iranian origin or owned or
controlled by the Govbernment of Iran; or

(2) Goods, technology, or services for exportation,
reexportation, sale, or supply, directly or indirectly, to Iran
or the Government of Iran.

(b) For purposes of paragraph (a) of this section, the term
/transaction or dealing/ includes but is not limited to
purchasing, selling, transportin, swapping, brokering, approving,
financing, faciliating, or guaranteeing.

...

S560.303 Iran; Iranian.

The term /Iran/ means the territory of Iran, and any other
territory or marin area, .... The term /Iranian/ means
pertainint to Iran as defined in this section.

...

S560.306 Iranian-origin goods or services; goods owned or
controlled by the Government of Iran.

...

(b) The terms /services of Iranian origin/ and /Iranian-origin
services/ include:
(1) Services performed in Iran or by an entity organized
under the laws of Iran, or a person residing in Iran; and

(2) Services performed outside Iran by a citizen, national or
permanent resident of Iran who is ordinarily resident in Iran, or
by an entity organized under the laws of Iran.

...

(d) The terms /services of Iranian-origin/, /Iranian-origin
services/, and /servicves owned or controlled by the Government
of Iran/ do not include:

...

(3) Services performed outside Iran by an Iranian citizen or
national who is resident in the United States or a third country,
provided such services are not performed by or on behalf of the
Government of Iran (other than diplomatic and consular services),
and entity organized under the laws of Iran, or a person located
in Iran.

...

To conclude, since I'm not ordinarily resident in Iran, I'm not to be included in services of Iranian origin or Iranian-origin services. It later clarifies this again in S560.306(d)(3): Since I am resident in a third country (Canada), and I am not coding on behalf of the Government of Iran, again, I'm not to be included in services of Iranian-origin and alike. I just need to wait (more.)

roozbeh again: ITR S560.509 is titled Certain transactions related to patents, trademarks and copyrights authorized. ;)