Ternary operators, conditionals in the middle

Submitted by gwolf on Wed, 03/02/2005 - 11:54
Daniel Silverstone asked on our opinions on ternary operators, and as it seems his blog doesn't like comments (boo!). I just love them. I really like being as concise as possible, without being cryptic - I find it awful to say [code="C"]if (condition) var = val1; else var = val2;[/code] Not only it hides the real intention of your statement (you want to assign a value to var, not just to check for a condition), but it is much more error prone (when I typed the line the first time I did an assignment to var and one to val. Daniel says someone suggested the use of functions... Well, yes, sometimes a function would be fine, as in the classical example - I agree that [code="C"]var = max(val1, val2);[/code] is better than [code="C"]var = val1 > val2 ? val1 : val2;[/code] ...But that's hardly the most common case. Now, I know we Perl guys are seen by the rest of the world as bizarre creatures with the strangest sense of code grokking abilities... But I love how Perl allows us to show where emphasis is in our statements. For example, [code="Perl"]$result = 0 unless $success;[/code] shows the reader the important part in this statement is the assignment (which only happens if $success is true), while [code="Perl"]$success or $result = 0;[/code] is semantically equivalent, but puts the reader's attention on the fact we are checking for $success, and the assignment happens as a consequence of that. There is more to programming than letting the computer understand your intentions. Although it is often seen as a write-only language by speakers of other tongues, this level of expresiveness helps reading code. A lot. I happen to like Python quite a bit, but this limits it puts on the programmer always put me off while deciding on using it for a new project. BTW, back to ternary operators: It seems not many Perl programmers use them as often as I do, as for Perl6 there will be a language redesign involving operator Huffman-encoding (this means, the shortest and easiest-to-type operators will be the most common ones)... And the current ternary operator ( ? and : ) will be replaced by a more visible, more lengthy ones ( ?? and :: ) :-(
( categories: )

Got my own office!

Submitted by gwolf on Mon, 02/28/2005 - 17:31
I formally started working at IIEc exactly two months ago (Jan 1 2005, although I have been showing up to work here since November 17), and finally today my workplace is no longer the lab - I have my very own seven square meters - a very strange office, 2x4 meters, with one square meter devoted to one of the building's pillars. I'll have to find a way to put my desk to be confortable (right now I am facing a corner). I have always admired the care my University gives to having nice, confortable places to work, with nice views - Well, this is the exception. I do get some natural light, although mostly obscured by my neighbour's stuff. But hey, I have some space of my own after exactly two years of being in a public place. It feels good. Update: Half an hour of Sokoban later, I feel this is good. There is still a dark spot in the usable square meter behind me, but anyway... I'll find a use for it sooner or later. Meanwhile, I have a much more ergonomic space than what I had in the morning. Joy! :)
( categories: )

Finishing CONSOL 2005

Submitted by gwolf on Fri, 02/25/2005 - 16:32
This is the last day of CONSOL, and I am quite happy with it. Tired as hell (have been spending my nights printing T-shirts for about a week), but happy. This is the fourth CONSOL, and it is the first time I am not at all involved in the organization, and... Well, it was smoother than ever. And it feels quite good not to be an organizer, to have time to enter any interesting talks, chat with my friends, to go out have a coffee, even go out in case something is needed back home. I don't have statistics for this year's CONSOL, but I heard there were somewhat less people than last year... I'll wait and see. I couldn't spend as much time as I wanted talking with people, as between finishing my presentation and printing T-shirts at night I lost lots of interaction time... But nothing too much, most of this was just good time. After many nights in a row sleeping 4 hours, I am falling asleep... And I am sure this post strongly lacks grammatical and style details - Forgive me :)
Wouter: Great graphs! Quite interesting and entertaining. Thanks!
( categories: )

PHP segfaults, incomplete laptops

Submitted by gwolf on Wed, 02/16/2005 - 19:22
Shit. I hate losing time due to someone else's faults. Yesterday, a client of mine told me his Horde is not working. Ok, set myself in debug mode. What do I see? Nothing, just a stupid blank webpage. What does the Apache log say? Not much, nothing too informative, and what's worse, nothing I expect from a PHP application: [code=""][Tue Feb 15 09:54:26 2005] [notice] child pid 2421 exit signal Segmentation fault (11)[/code] Over and over. I set in paranoid mode, as I had just upgraded the system. New Horde2 and Imp3 versions had just made it in Sarge, so there was no doubt: I was the culprit. Besides, being tired made everything worse - Two hours checking and rechecking that no files were different from the files I had on a working server. Today I gave it a shot again... Started stracing the Apache processes - I saw the segfault shortly after opening /usr/share/php/Log.php, but couldn't explain it nor relate it to anything else: [code=""](...) open("/usr/share/php/Log.php", O_RDONLY) = 5 fstat64(5, {st_mode=S_IFREG|0644, st_size=8526, ...}) = 0 fstat64(5, {st_mode=S_IFREG|0644, st_size=8526, ...}) = 0 lseek(5, 0, SEEK_CUR) = 0 lseek(5, 0, SEEK_SET) = 0 close(5) = 0 --- SIGSEGV (Segmentation fault) @ 0 (0) ---[/code] Ok, I spent some extra time grokking this, until I checked in order what was being opened and in what order (BTW, that helps a lot understand program flow, specially while diving through frameworks such as Horde in languages you don't really enjoy reading, such as PHP ;-) ). First thing I noticed: Silly me. I was looking for the error messages in the Apache log, while Horde sends them to its own log file... Just opening the Horde logfile made me understand the problem right away: [code=""]Feb 16 10:43:56 HORDE [error] [imp] Error retrieving session data (id = faea99bff4f2b114cde7f26e81818f7f) [on line 119 of "/usr/share/horde2/lib/SessionHandler/mysql.php"] [/code] Well... The thing is, my client modified the Horde code (yes, the code, not the configuration) to fit another system he developed - and the session-related columns simply had a different name. Gah. Now, fixing this queries got Horde back running... But I am not sure what to think about it: If Horde cannot find the sessions, should it complain visibly at least? Why just letting it die? Even more: Why the hell does it segfault? I am not sure on whether to file a bug for this... But it does annoy me.
Yesterday I called a friend of mine to check if my laptop was finally fixed (I have been laptopless for about a month already)... He told me he finally had it at home, he helped me send it and follow through the repair process with a vendor he trusts (trusted?)... But he wanted me to go with the power supply and battery just to test it. - But I gave them to you together with the machine! - You did?! This guy says you didn't! - I did... Why would I keep it? - To spare me carrying extra weight? Well... I do believe you, but... Well, I'll have to check with that guy... So... No power, no battery... Sounds like I am still laptopless. Have been working at home from my trusty, old and annoyingly too very slow laptop-server (P120, 48MB RAM, 800x600). I _need_ my laptop soon. He said he'd drop by today - I hope he does with good news...
( categories: )


Submitted by gwolf on Tue, 02/15/2005 - 09:15
Life is like arriving late for a movie, having to figure out what was going on without bothering everybody with a lot of questions, and then being unexpectedly called away before you find out how it ends. - Joseph Campbell, mythologist
Seen on the January 2005 edition of Scientific American, on Steve Mirsky's Captive Audience article.
( categories: )

chaos at home / treasures of a forgotten era

Submitted by gwolf on Fri, 02/11/2005 - 13:39
My home is still in chaos. It is almost three weeks we are covered in dust, as we are changing most of the house's floor (after 50 years, it was really in bad shape). Terrible. Everything is dusty, everything feels uncomfortable, we cannot get good rest at any time... But well, today the workers began with the last (and largest) area, and it seems in one week it will finally be over. This, of course, has led me to bump into many things I didn't expect to find - This is, after all, a house where my mother lived before she went to Sweden, and we have years and years of stuff in every possible place. Yesterday I got really surprised when I found this certificate: The certificate for the first ever computer course I had, at IDESE, for three weeks in July 1985 (nine years old). And the best thing about it was not just finding it, but looking it was signed by the Mexican Perl guru Salvador Ortiz! :-D That put me into old-memory mode... Linking memories from little computer-enthusiast kids (and, of course, looking at Amaya's and Tolimar's comments on Elizabeth Garbee (Bdale's 13 year old daughter addressing a Linux developers conference) made me come to one of the greatest experiences I had, and that sadly does not happen anymore: One year after this course I mentioned, during summer of 1986, I took another set of computer courses in Fundación Arturo Rosenblueth's Centros Galileo. After the course, we were allowed to stay in their C64 lab. Some of the most interested students (me included) were invited to prepare a project to take part in a conference on computers and education - Kids from all over the country flew to Mexico City, showed off their programs (mostly games), played together, and I understand there was also adult-oriented conferences. Over the years, I have met at least two other people who took part in the conference - I am still in contact with one of them, good ol' perl hacker [friend]Amnesiac[/friend].
( categories: )

Music helps!

Submitted by gwolf on Wed, 02/02/2005 - 17:02
After many slow days at work during which I could not really focus on any given thing, I finally felt this day was worth it. I think it is strongly related to the fact that I finally brought my earphones - as I work in a public area, I have been asked to keep my music volume as low as possible. And today I feel much less stressed, and have been to work much better than other days. Good thing! I hope the trend continues and this theory proves valid.
( categories: )

On natural language processing

Submitted by gwolf on Tue, 01/25/2005 - 12:55
Wouter was wondering about natural language processing. I have got quite interested in that field, although I also lack any real knowledge on that except for a couple of quite simple articles I have read and talks I have attended. A great resource on this is Alexander Gelbukh - I saw him at his talk in the 30th CLEI conference in Arequipa, Perú. He has some quite interesting articles about NLP on his web site, although they are in Spanish (anyway, for anybody interested: Avances en análisis automático de textos and Tendencias recientes en el procesamiento de lenguaje natural) but browse around, there are still many good links. The basic idea from the two Spanish articles is that NLP goes through the same basic steps that a formal language compiler goes (i.e., lexing, parsing, semantic analysis) - The main difference is that any sentence in a natural language has many implicit relations with an universe of knowledge around it, so you cannot just build a parse tree for each of the sentences - You must have a universe of concepts and fit each of the sentence parse trees of the text you analyzed in it. Of course, in order to do so, you must also solve the ambiguities that are so common in spoken language, but that's another whole topic. Gelbukh's works are, AFAICT, driven towards data mining - performing automatical analysis of many texts and coming up with conclusions that are not explicitly stated in any of them, probably with mechanisms to trace back to which pieces of information led the system to each of them. As I told you, I really liked this topic, and I intend on diving deeper into it as soon as I get out of some obligations... But I'm sure Gelbukh's page will be a interesting reading. Another project I really enjoyed (and completely unrelated to what I wrote here, its realm lies much further to the bottom, near the lexical/grammatical analysis phases) is Snowball, a free language for stemming algorithms, which has implemented stemmers for many European languages. The Snowball site has also a very nice article regarding what is stemming, how it works, and how it has grown over the time.
( categories: )

I am complete! / Debconf stuff

Submitted by gwolf on Tue, 01/18/2005 - 10:37
Yesterday I got my X-ray results - I am fortunately complete, no apparent injuries to my bones or discs. I got some pretty simple advice from an aunt who is a Feldenkrais instructor, and yes, it still hurts and I still look funny when standing up/sitting down, but it is getting better. Sadly, I still haven't received the medical insurance papers from UNAM, so those MX$2300 for a complete set of X-rays were off my pocket. I'll see what can I do to pay some other things I have pending :-/ Anyway... I'll manage. [code="sh"]for i in seq 1 100 do echo "I should not inspire pity" done [/code]
Yesterday was a productive day. I did the finishing touches to allow for registration for Debconf using a branch off Comas - There are still details to fix, so the registration is still not in the official server, but I hope to have it soon. Why am I blogging about it and getting more people to whine on why isn't it ready yet? Because, at best, that will cause more pressure on me to have it ready soon ;-) Guys, see you in HEL! I also started yesterday asking my Debianmexico friends for suggestions on where to make Debconf6 - Oaxtepec looks like the winner, but there are many other possible choices (and many still unexplored). Strangely, most of them seem to be IMSS-owned. I hope to go to meet those places soon, I'll keep you posted.
Rodrigo, you should know that I take you as one of the prime examples of nerdiness in Mexico. I am amazed you think the same about me :)
Jesús: I don't understand how can you believe that Tlalnepantla is better than ${place}. I worked in Tlalnepantla for some four years - It is just like a little town inside Mexico City, but without the beauty. It is one of the places I'd gladly omit from my memory. Good look in Guadalajara!
( categories: )

Meme, meme, meme time! / My language of mine / Driving++

Submitted by gwolf on Mon, 01/17/2005 - 10:50
I am 87% loser. What about you? Click here to find out! I am nerdier than 94% of all people. Are you nerdier? Click here to find out! What is your weird quotient? Click to find out! So it turns out I am a big loser, a VERY big nerd and quite a weird guy. Does not really surprise me - Well, I feel happy about being that nerdy (and, yes, I answered with the truth) - How the hell did Steve, Alexander, Per-Arne and Martin make it? My hat off to you guys! (OTOH, it should not surprise me having that many über-nerds in Debian ;-) )
Isaac blogged about lack of a way of not using possessives in English, and he says that he thinks that Spanish has the same problem - In theory, yes. In practice, it is even greater. It is very common to hear people say, for example, su mamá de él (his mother of him) instead of simply su mamá (his mother), as there is ambiguity between formal-second-person and third person. Yes, that's a mistake and cannot be tolerated in educated circles - but nevertheless, it is very common.
My [term]coccyx[/term] still hurts badly since last Wednesday's fall. Yesterday I went to have some X-ray shots of my whole column (at US$200, they'd better be worth something!), I'll get them today to a doctor. But at least something good came out of it: I was not in shape to drive there, so Nadezhda took the car for the first time into the wilderness of Mexico City. Congratulations, Cosa! :-D She was so happy and confident she even gave a ride home afterwards to her sister and nieces, who dropped by to visit us.
[friend]ion[/friend]: You are insane - But your ideas rock!
( categories: )

Forget your keys

Submitted by gwolf on Fri, 01/14/2005 - 16:33
Amaya's post made me remember one of the most stupid, boring, frustrating days of my existence. Yours, at least, doesn't sound _that_ bad. About two years ago, one Saturday morning, the Debianmexico crowd scheduled its first meeting - 10AM, some 20 minutes away from my home. As the only DD in Mexico, it was my task to prepare the material for the meeting. What was I talking about? A simple introduction on making .debs. By then, we were renting the lower half of a small house in San Pedro de los Pinos. The house split was strange: We entered through the street door to a very little garden (about 4 square meters) and a little room (about 5 square meters); to the right there were the stairs to our neighbors' half, to the left there was our apartment door. About 8:30, Nadezhda left - I don't remember what she went to, some course about something... But at about 8:45 the doorbell rang - I thought it was her, forgetting something. I put on my pants and went to open the door. Just after I closed my apartment door, I realized the keys were on the table. And the person outside was not Nadezhda. It was just someone passing by. Well, to make things short, I was stuck. I managed to open the house's window, but there were security bars, and I could not get in. My keys were four meters away from my hands. I was shoeless, moneyless... A neighbor kindly tried to help, but with no luck. Darn... I would have easily traded my five cats for a single chimpanzee able to understand and give me the keys. I was late for my talk - no, wait, I didn't get there at all. And I told Nadezhda we'd meet at her office - She was waiting for me there until she got pissed. Around 18:00 she got home. I spent one of the most stupid, worthless days of my life waiting for her to appear, waiting for my cats to give me the keys.
( categories: )


Submitted by gwolf on Wed, 01/12/2005 - 10:37
On my way to work, I went upstairs to grab my glasses. As I was going down, Tin Tan was drinking water from his plate on the middle-step on the stairs (you know, that step that is wider and the direction of the stairs changes). I decided not to bother him, skipping that step. Next thing I know, Tin Tan is running upstairs, quite scared, and I am heading downstairs, quite faster than what I intended. I shouldn't skip over two steps while using my slippers - They _do_ slip. I have problems with every movement. What bothers me more is that sitting in front of a computer is almost as painful as not using a computer for a couple of days. I hope the pain just goes away soon.
I really liked Luciano's suggestion for my post (regarding John Goerzen's): You can even use Festival to read your day's to-do list out loud first thing in the morning!
( categories: )

Missing appliances

Submitted by gwolf on Tue, 01/11/2005 - 22:16
John Goerzen comments on his quest for a good alarm clock. You want a good, geeky alarm. Whenever I am away from home, I always count on [code="sh"]echo $LOUD_NOISE_CMD | at $WAKEUP_TIME[/code] It always works. Be it at a hotel room with my trusty old laptop, be it at home with your powerful server connected to the stereo system with your favorite punk rock music, it is guaranteed to work - and, as you request, with a nice form-factor for your computer, it is as geeky as it gets. ...But you got me thinking into this: I am quite frustrated. I wanted to buy a telephone answering machine. Nothing fancy, I just needed to replace the one I had for many years and which died some months ago. I cannot believe this: I went to at least five different stores which carry an electronics department. I went also to Radio Shack and Steren. I just cannot get any answering machine without a wireless phone built in. Why don't I want a wireless phone? Because I need a ~US$30 thing, not a ~US$100 one. And, sadly, I need a bit more equipment (and work) to get my computer to function as such machine than what I need for it to become an alarm clock.
( categories: )

Back to work / News that make you shout in anger

Submitted by gwolf on Fri, 01/07/2005 - 14:39
Ok, so -effective yesterday, January 6, as we were on vacations until that precise day- I am finally hired at IIEc-UNAM (Economics Research Institute at the Mexico National Autonomous University). Life looks rosy and beautiful. Being an academic worker of a big university makes you... ...Do paperwork. I spent two days preparing my workplan for this year. Then, my boss told me I used the wrong format, that I didn't need to include the justification, only the points I intend to cover. Ok... Well, it is done now - But, as I have already worked at UNAM, I know this is only the first of many, many papers I will move in the next years. Fortunately, I was able to do some real job as well. IIEc really surprised me - I was hired mainly as a sysadmin - But there are currently no services in the institute. The mail accounts are handled externally. Even the Web page is in an external server. Some groups have started setting up their servers - Well, the first point in my workplan is to restructure the Institute's severs - Provide here all the services that are currently provided in DGSCA, and consolidate the different services offered by different groups into the servers under my control. And just today I stumbled upon a group that was just requesting to buy a server for their database, explained them the benefits of having a single administration, convinced them to set up their services in my server... I hope this gets me at least some extra RAM or speed for the server _I_ want to buy ;-)
On a very different topic: I must express my regret and anger. Reading my favorite newspaper, I see (and in the back cover, no less!) that after 15 years of work, the Mexican Simpsons dubbing team will be fired because Grabaciones y Doblajes Internacionales, one of Mexico's main dubbing companies, refuses to hire people who have joined the ANDA (Asociación Nacional de Actores, National Actors Association) union. This is an illegal measure. And it will destroy one of the finest dubbing works that we have. I really fear the result. Yes, I am a Simpsons junkie. This problem really saddens me. Sue me.
( categories: )

The most transparent region

Submitted by gwolf on Sat, 01/01/2005 - 19:43
In 1917, Alfonso Reyes (more info in Spanish) started his most known poem, Visión de Anáhuac (WTF... Cannot find a single online copy of the poem?!) with the following words: Viajero: has llegado a la región más transparente del aire (Traveller: You have arrived to the most transparent region of the air). This poem, of course, refered to the breathtaking view of the Anáhuac Valley, on which Mexico City grew. Yesterday I went with Nadezhda to my father's house in Cuernavaca. This morning, as we came back (it feels quite strange to be on the road January 1st, 8AM :) ), we felt Mexico City was more polluted than normal. Much more. More even than in the worst 1989 days. We got home - It smelt like burnt wood or something like that. Nadezhda was scared, went quickly to check if the house was still complete - Fortunately, it was. But it turns out that so many people had firecrackers and lit bonfires to greet the new year that even the air inside my house was foggy. Yes, we had quite an obvious thermal inversion, as from the Southern hills the view of the Eastern and Northern hills was quite decent... But this was way over the line! People, specially Mexicans, specially [term]chilango[/term]s: Please, be more conscious! This was quite a frightening sight!
( categories: )
Syndicate content