McEs, A Hacker Life
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
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:
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
So my questions are:
- getopt_long is not a POSIX function. Why should they lie in its prototype too?
- Why the hell is it
char * const argv and not
const char * const argv? Ok, I know why, because they do string surgery to return the option out form something like --foo=bar.
And I get this all because I'm overriding argv 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...]
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
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.
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
, 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 :).
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
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
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.
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
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);
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.
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!
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:
(Free Software for a Free World)
(Part of the alphabet at the beginning of the sentence.)
(Peace and Freedom...)
(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.
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
online magazines, after some preprocessing. Very cool stuff in general. And soon after I've got to start compiling the slides for my talk
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
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
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
(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
(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
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