Search Results: "spa"

20 October 2009

Patrick Schoenfeld: Cool PHP-Code.

Did you know that in PHP you can write something like that:

$test = "foobar";
$test = sTr_RePlace("bar", "baz", $test);
$x = sPrinTf("%s is strange.", $test);

pRint $x . "\n";
eCho "foo";
What makes me frighten is that this actually used, e.g. by this code snippet which exists (in a similar form) in an unnamed PHP-project:

echo sPrintF(_("Bla bla bla: %s"), $bla))

And yes, they do use echo to output the result of sprintf.

Update: So i got this great comment. The commentator wants to point out that the senseless use of "echo sprintf" is because of gettext. He says "That's simply the way you use gettext." But this is simply not true. The difference between printf and sprintf is that the first one outputs the string, while the second one returns it. That means that in the above example printf could be used (instead of sprintf) without a useless echo call in front of it. The reason for using sprintf (and eventually the reason because you find it in a lot of applications using gettext) is that you can use it to fill a variable with the translated string or to use the string in-place. A common use-case for this is to handle a translated string to a template engine, for example.

Benjamin Mako Hill: Updating the Ubuntu Code of Conduct

The Ubuntu Code of Conduct is one of the most surprisingly successful projects I've ever had the privilege of working on. On my first day working for the company that would become Canonical, I talked with Mark Shuttleworth about some ideas for community governance. Partially in reaction to some harsh behavior in other free software projects we'd worked on, Mark and I agreed that some sort of explicit standard for behavior in Ubuntu would be a good thing. Over lunch of what was my literally first day working on Ubuntu, I wrote a draft of code of conduct that was essentially the version that Ubuntu has used until today. Shuttleworth made a series of modification to my draft but I don't think either of us took it too seriously. We figured it would be easy to update it later. Over time, that code has become a central piece of the Ubuntu community. Every new Ubuntu member cryptographically signs the code. When conversation in any Ubuntu forums, channels, or lists becomes disrespectful, users almost instinctively remind each other of the code. Through this process, the code has become a sort of constitution of our community and a widely enforced standard. People treat the code as a reflection of what "ubuntu" --- both the concept and our project --- stands for. Over time, the original code has spawned a Leadership Code of Conduct (which I also worked to draft), and has been modified and employed by scores of free software projects and by many projects that have nothing to do with free software at all. This is all wonderful, but a side effect has been that updating the code has become a more a difficult process that we originally imagined. Despite it success, the code remains a text written in an afternoon in Mark's flat. At times, this fact shows. For example, the code contains some off-hand humor that now seems a little akward and the text was a bit too developer centric at points. And there was a lot that, quite simply, we would have done better if we had realized that the code would be so important. So this summer, Daniel Holbach and I spent another afternoon in Berlin discussing and crafting a new version of the code along with a detailed rationale document that describes all the things we'd changed and why. We believe that what we've created is fully in the spirit of the original code. We've made efforts to minimize the delta in terms of text as possible. Daniel and I realize that changing the code out from under our community is a dangerous game, and we've make exceptional efforts to make sure that the new code doesn't say anything substantively different than the old code --- but that it does say it better. So I'm thrilled that, after being posted since early June and after incorporating a series of revisions with members of the Ubuntu Community Council, the new draft was approved at a council meeting earlier today. Of course, we are continuing to think about how we might improve the text going forward. One important goal we've thrown around, for example, is the creation of a code that is no longer Ubuntu specific and that can be employed by a wide range of different groups and different free and open source software projects.

Adrian von Bidder: Debian Mecacorp ACME, Inc.

I've just read Vincent Sanders' Bits from the kernel team. First, a big thank you to him: this kind of detailed information about what the team intends to do, down to a very technical level, is needed much more often on d-d-a. Debian is about producing a distribution, which in the end comes down on how to make independently produced pieces of software work together, so getting all the fiddly bits right is the most important aspect of Debian's work. (And it is also where I think Debian still does better than all other distributions I've ever used.) What immediately sparked this article is (could it be otherwise? ;-) the part I didn't like too much about these Bits: ... was discussed ... ... was resolved ... ... further investigation ... would occur. and right at the top ... a member of the release team ... Of course the team should work together as a whole. Of course it isn't really relevant who of the release team was present. Of course, this information is contained in the minutes. But on the whole, these Bits read a bit like a press release of a large corporation where the spokesman reads a communique prepared for him by a marketing team responsible. I miss the personal touch that should in my opinion run in parallel with our promise of openness: it's not only that we don't hide bugs, it's also that we're not hiding behind a corporate identity , but that we're not afraid to name names (No, this is not in a foundation document as such. It's my interpretation of openness.) A start is simple use of active vs. passive: Why not we discussed/decided ... instead of it was discussed/resolved ? (It's used in a few places, I note.) I appreciate that naming names with each action item is probably better left in the minutes, but at least naming the release team member (he's not just a functionary...) and perhaps at the end a short paragraph about who was there would have improved the announcement. Also: none of the items has an ETA obviously Debian is famous for not having any ETA's but we're trying to change this, aren't we? So why not give at least a rough estimate which tasks would take a week, a month, half a year... to complete? I'm sure you discussed it (have yet to read the minutes), if only to guesstimate what is realistic within the timeframe of the squeeze release cycle. Debian not only is no company, but it's also, and I hope I'm not the only person who thinks this is important, a Linux distribution where no corporate body has the power to force changes on the community. The single person is important, because it's the single person who in the end decides to implement a thing this or that way. It may be the outcome of a team discussion and a team's decision, but the work is done by individual people and not by employees impementing a corporate policy.

Gunnar Wolf: Among the reasons that brought me to Debian...

Every now and then, people ask me why Debian? Why, among so many projects to choose from, I first liked, then got into, and finally I got committed into Debian, and not anything else? Of course, one of the main points back in 2000-2001 when I started using it, and still to this very day is a strong identification with the ideological side. Yes, I am a strong Free Software believer, and Debian is what best suites my ideology. Still, I did not only get into Debian because of this And I was reminded about this by an article in this month's Usenix ;login: magazine: An anecdotal piece by Thomas A. Limoncelli titled Hey! I have to install and maintain this crap too, ya know! (article requires ;login: subscription, but I'll be glad to share it with whoever requests it to me I have of course no permission to openly put it here in whole online. Yes, I am expressly sending a copy of this text to the author, I will update this if/when I hear from him) [update] The author has kindly allowed me to redistribute his article's PDF Download it here. Before anything else I'll go on a short digression: I am writing a bit regarding the Free Software participants' culture, and this is a trait I love about it: The lack of formality. Even though ;login: (and Usenix as a whole) is not exactly Free Software, it runs quite close to it), it is a well regarded magazine (and association) with an academic format and good (not deep or highly theoretical, but good) contents. Still, it is quite usual to see titles as informal and inviting as this one. And it happens not only here I have been fearing having to explain at work, over and over, why I have requesting permissions to go to Yet Another Perl Conference, Festival de Software Libre or DebCamp, tagging them as academic settings. Or why I am wasting our library's resources on buying cookbooks, recipes and similar material on the most strange-sounding subjects. Anyway, back on track This article I found refers to the lack of value given to the system administrator's time when selling or purchasing (or more in general, as it happens also in Free Software, when offering or adopting) a product. Quoting Thomas:
A person purchasing a product is focused on the features and benefits and the salesperson is focused on closing the deal. If the topic of installation does come up, a user thinks, Who cares! My sysadmin will install it for me! as if such services are free. Ironically, it is the same non-technical executive who dismisses installation and upkeep as if they are free who might complain that IT costs are too high and go on a quest to kill IT spending. But I digress. I can understand why a product might be difficult to install. It is hard enough to write software, and with the shortage of software developers it seems perfectly reasonable that the installation script becomes an afterthought, possibly given to a low-ranking developer. The person purchasing the product usually requires certain features, and ease of installation is not a consideration during the procurement process. However, my ability to install a product affects my willingness to purchase more of the product.
Thomas goes on to explain his experience with Silicon Graphics, how Irix was so great regarding install automation and how they blew it when switching to Windows NT; talks very briefly about IBM AIX's smit, a very nifty sysadmin aid which is basically a point-and-click interface to system administration with the very nice extra that allows you to view the commands smit executes to perform a given action (and then you can copy into a script and send over to your hundreds of AIX machines) Incidentally, by the time I started digging out of what became the RedHat mess of the late 1990s and passed briefly through OpenBSD on my way to Debian enlightenment, I was temporarily the sysadmin for an AIX machine And I too loved this Smit approach, having it as the ultimate pedagogical tool you could ever find. Anyway, I won't comment and paraphrase the full article. I'll just point out to the fact that this was what ultimately sold me into Debian. The fact that I could just install anything and (by far) most of the times it will be configured and ready to use. Debian made my life so much easier! As a sysadmin, I didn't have to download, browse documentation, scratch head, redo from start until I got a package working Just apt-get into it, and I'd be set. Of course, one of the bits I learnt back then was that Debian was for lazy people Everything works in a certain way. Policy is enforced throughout. So as a sysadmin, I should better get well acquinted with the Debian policy and know it by heart. In order to be able to enjoy my laziness, I should read it and study it. And so I did, and fell in love. And that is where my journey into becoming a Debian Developer started. Why am I talking so nostalgic here? Because I got this magazine on the mail just last weekend And coincidentally, I also got bug report #551258 I packaged and uploaded the Haml Ruby library (Gem, as the Rubyists would call it). Haml is a great, succint markup language which makes HTML generation less of a mess. It is even fun and amazing to write Haml, and the result is always nicely formatted, valid HTML! And well, one of Haml's components is haml-elisp, the Emacs Lisp major mode to do proper syntax highlighting in Haml files. Of course, I am an Emacs guy (and have been for over 25 years), so I had to package it. But I don't do Emacs Lisp! So I just stuffed the file in its (supposed) place, copying some stuff over from other Emacs packages. During DebConf, I got the very valuable help of Axel Beckert to fix a simple bug which prevented my package from properly being installed, and thought I was basically done with it. I was happy just to add this to my ~/.emacs and get over with it:
  1. (require 'haml-mode)
  2. (add-to-list 'auto-mode-alist '("\\.haml$" . haml-mode))
  3. (require 'sass-mode)
  4. (add-to-list 'auto-mode-alist '("\\.sass$" . sass-mode))
However As Mike Castleman points out: This requires manual intervention. So it is not the Debian Way! Reading Mike's bug report, and reading Thomas' article, made me realize I was dilluting something I held so dearly as to commit myself to the best Free Software-based distribution out there. And the solution, of course, was very simple: Debian allows us to be very lazy, not only as sysadmins, but as Debian packagers. Just drop this (simplified version) as $pkgroot/debian/haml-elisp.emacsen.startup and you are set!
  1. (let ((package-dir (concat "/usr/share/"
  2. (symbol-name flavor)
  3. "/site-lisp/haml-elisp")))
  4. ;; If package-dir does not exist, the haml-mode package must have
  5. ;; removed but not purged, and we should skip the setup.
  6. (when (file-directory-p package-dir)
  7. ;; Use debian-pkg-add-load-path-item per 9 of debian emacs subpolicy
  8. (debian-pkg-add-load-path-item package-dir )
  9. (autoload 'haml-mode "haml-mode"
  10. "Major mode for editing haml-mode files." t)
  11. (add-to-list 'auto-mode-alist '("\\.haml\\'" . haml-mode))
  12. ;; The same package provides HAML and SASS modes in the same
  13. ;; directory - So repeat only the last two instructions for sass
  14. (autoload 'sass-mode "sass-mode"
  15. "Major mode for editing sass-mode files." t)
  16. (add-to-list 'auto-mode-alist '("\\.sass\\'" . sass-mode))
  17. ))
This will make the package just work as soon as it is installed, with no manual intervention required from the user. And it does not, contrary to what I feared, bloat up Emacs Adding it to the auto-mode-alist leaves it as known to Emacs, but is not loaded or compiled unless it is required. Deepest thanks to both of you! (and of course, thanks also to Manoj, for pointing out at the right spells in emacs-land)
AttachmentSize
Thomas A. Limoncelli: Hey! I have to install and maintain this crap too, ya know! (Usenix's ;login: October 2009144.5 KB

19 October 2009

MJ Ray: Sharing git repositories

Our co-op uses the git revision control system pretty extensively, both directly and through etckeeper. With more workers, we re keeping more shared copies of our git repositories. So inevitably, we ran into permissions problems. Thanks a lot to Moser for pointing out the git repo-config core.sharedRepository true option. I ve also had a bit more of a look around git config (because repo-config is an alias for that) and wonder about the logAllRefUpdates and whitespace settings. Anyone have favourite values for these or other cooperative git tips?

Jaldhar Vyas: Sal Mubarak 2066

Best wishes to everyone in Debianland for a happy and prosperous Gujarati New Year (Vikram Samvat 2066, called Plava) This year the local mandirs continued their recent trend of coordinating their Diwali/new year plans and there was a big mela planned. Unfortunately the weather didn't really cooperate but the kids got to manhandle some explosives and after all isn't that the reason for the season? Presentwise, I got a DIY 4-shelf bookcase from Sears, the Catalyst Book plus a much-needed woolen hat. I've decided that I am going to quit my job. It's a soul-sucking dead end but in these tough economic times it pays bills so I've agonized about this for a long time. This was supposed to be the year we moved out of Jersey City but it has yet to happen. And it never will unless I take some sort of decisive action. So I'm going to do it. Wish me luck!

18 October 2009

Christian Perrier: 4621 potential "spams" left to review for me

A few of us are working on spam removal from Debian lists archives. The wiki page linked above explains how to report spam on Debian mailing lists. This is in short as easy as bouncing a mail to a specific address, from your favourite MUA. These "reported spams" then need to be reviewed. Once a given message has been identified as "spam" by enough DD's (there are many false positives in the candidates, particularly in non English-speaking mailing lists), it is removed from the archives. Many mails have already been removed and any help is welcomed. Since Frans Pop launched this for debian-boot, back in May, I use 1 or 2 hours every Sunday to this work. After working on debian-boot only, I gradually worked on reported spams in other lists. As of now, I only have 4 lists where I still have work to do: The Chinese and the Spanish ones are tricky because identifying spam there is much less easy (for Chinese, I'm quite conservative and only tag very obvious spam....for Spanish, I read enough of the language to be able to target spam). What about you? Will you be able to help the few of us who work on getting clean archives (noticeably, Sandro Tosi, Giacomo Catenazzi, Cord Beermann, Luk Claes, Frans Pop, Bastian Blank, Luca Falavigna, Michael Koch, Bernd Steinmetz, Thoomas Viehmann, Florian Ernst, Adam D. Barratt, to name thos ewho reviewed more than 1000 mails)? Working on lists in your own language might be a good idea (I'm particularly thinking about lists in German, Spanish, Chinese and French).

David Bremner: Counting symbols from a debian symbols file

I am currently making a shared library out of some existing C code, for eventual inclusion in Debian. Because the author wasn't thinking about things like ABIs and APIs, the code is not too careful about what symbols it exports, and I decided clean up some of the more obviously private symbols exported. I wrote the following simple script because I got tired of running grep by hand. If you run it with
 grep-symbols symbolfile  *.c
It will print the symbols sorted by how many times they occur in the other arguments.
#!/usr/bin/perl
use strict;
use File::Slurp;
my $symfile=shift(@ARGV);
open SYMBOLS, "<$symfile"   die "$!";
# "parse" the symbols file
my %count=();
# skip first line;
$_=<SYMBOLS>;
while(<SYMBOLS>) 
  chomp();
  s/^\s*([^\@]+)\@.*$/$1/;
  $count $_ =0;
 
# check the rest of the command line arguments for matches against symbols. Omega(n^2), sigh.
foreach my $file (@ARGV) 
  my $string=read_file($file);
  foreach my $sym (keys %count) 
    if ($string =~ m/\b$sym\b/) 
      $count $sym ++;
     
   
 
print "Symbol\t Count\n";
foreach my $sym (sort  $count $a  <=> $count $b  (keys %count)) 
  print "$sym\t$count $sym \n";
 

Russell Coker: Mobile Phones Are Computers

One thing I noticed when I got my new LG U990 Viewty [1] mobile phone is the way the core telephony functionality has suffered while features for web browsing etc have been added. It seems that the core phone functionality (making and receiving calls and maintaining a list of names and phone numbers) has generally decreased since about 2004 when I got my first camera-phone. The Nokia GSM phones that I used prior to getting a 3G phone seemed to have a combination of signal reception, voice quality, and basic telephony features that beat all the 3G phones I ve used. The only way the 3G phones were better for core telephony features is in managing the list of recently called numbers. In my past two LG phones I ve been able to easily call an alternate number of the person I last called this feature was dropped in the Viewty. Some of my relatives have camera-phones that have an extremely poor ability to get a signal, they can t get a GSM signal in places where my Viewty can get 3G! Obviously making a usable phone was not a design priority for those devices! Then there s the issue of battery life. Early mobile phones had NiCd batteries that lasted a week, later mobile phones had Li batteries that lasted a week as a standard feature. Nokia sold phones with replacement batteries, so if you wanted to make lots of phone calls while on the move you could have a second battery charged and ready for use. Now the latest BlackBerry [5] apparently has batteries that only last for one day I haven t investigated the options for storing a second battery but a casual glance indicates that changing a battery will be a lot more difficult than on an old Nokia phone. I ve been wondering, why don t they just sell some mobile phones that don t support making phone calls? Smart phones that aren t very good at telephony is really only going half way, do it properly and just rip out the phone functionality! Or they could use the word phone to apply to devices that already exist to do mobile stuff. You could have an Amazon Kindle phone [2] that allows you to read documents, and a Nokia N800 tablet phone [3] for general Internet access including web browsing and email really the only smart-phone feature that is missing from the Nokia is a camera. For that matter my EeePC 701 [4] is probably about twice as heavy as my first mobile phone, maybe it could be called a phone too. If you have two phones, one for making phone calls and the other for doing smart-phone stuff then it won t matter so much if the smart-phone (which can t make phone calls) has it s battery run out. One likely objection to the idea of selling phones that can t be used for making phone calls is that it might confuse the users. However the current situation is that there are significant differences in the signal reception ability of mobile phones, the people who sell them don t know what the difference is, and the rare reviews that analyse signal strength (as done by Choice [6]) are become outdated rapidly and never cover all phones on the market. So I think it would be a great improvement if the phone sales people could say don t buy phone A if you want to make phone calls because it can t do that because currently anyone who just wants to make phone calls has a matter of luck to determine whether they get a phone that works well. The really sad thing however, is that some people apparently have usage patterns that are similar to my satire above. I have heard of people having two phones, one for smart-phone functionality and another for making calls. What we need is to have manufacturers put more effort into making hardware that can receive week signals, from now on I will consult the Choice review of this before making any mobile phone purchase or recommendation. If only a few million other people would do the same then the manufacturers would improve their products. The next thing we need is to have better software to run the phones. The deficiencies in the software on my Viewty could easily be fixed if everyone had source code access. Benjamin Mako Hill writes about some of the problems with closed-source on mobile phones [7]. He mentions security (in terms of our trust in the phone manufacturers), and the general ideal of having control over your own device. One specific problem he doesn t mention are the ways that mobile phones are deliberately crippled by the manufacturers, 3G phones have precious main menu space occupied by the services that are most profitable to the telephone company without regard to what the users desire. Another problem for people who desire free software is file format support. Camera-phones that save video to AVI format instead of OGG reduce our ability to use free software in other places as a general rule every time you transcode a video you either lose some quality or increase the file size so the format that the phone uses will be carried through many other computers and devices. Smart-phones generally have the ability to view a range of data types, the ability to view MS file formats is common (which excludes free competitors). My Viewty has an entire menu section dedicated to Google services (Gmail, blogger, youtube, etc). That s nice for Google who presumably paid well for that, but not so good for me as I don t use any of the Google features on my phone. Now a menu that had a caching IMAP client, an RSS feed reader, a Wordpress API client, a Jabber client, and a caching Wikipedia client would be really useful. My current phone is just under a year old, so I won t be buying a new phone until January 2011 (unless I break or lose my Viewty). Hopefully then there will be some better options. Before anyone suggests that I buy another phone to help with the coding, my current free software coding projects are all behind schedule http://mako.cc/copyrighteous/20091017-00

17 October 2009

Russell Coker: Links October 2009

Garik Israelian gave an interesting TED talk about spectrography of stars and SETI [1]. He assumes that tectonic activity is a pre-requisite for the evolution of life (when discussing the search for elements that are needed for life) and that life which is based on solar energy will have a similar spectrographic signature to the chlorophyl based plants that we are familiar with. I doubt both those assumptions, but I still found the talk very interesting and I learned a lot. Julian Dibbell wrote an interesting Wired article about an ongoing battle between the Cult of Scientology and 4chan [2]. I don t often barrack for 4chan, but they seem to be doing some good things here but of course they do it in their own unique manner. The article also links to a hilarious video of Tom Cruise being insane, among other things he claims that Scientologists are only ones who can help at an accident site. Has Tom Cruise ever provided assistance at a car crash? The Independent has an article by Robert Fisk about the impending shift away from the US dollar for the oil trade [3]. This is expected to cause a significant loss in the value of the US dollar. Robin Marantz Henig wrote an interesting article for the NY Times about the causes of anxiety [4]. It focusses on Jerome Kagan s longitudal studies of babies and young people. One thing that I found particularly interesting were the research issues of recognising the difference between brain states, internal emotional state, and the symptoms of emotions that people display (including their own description of their emotions which may be misleading or false). The tests on teenage social interactions that involved fake myspace pages and an MRI were also interesting. Juan Cole wrote an insightful Salon article titled The top ten things you didn t know about Iran [5]. The Iranian government doesn t seem to be a threat to anyone outside their country. Clay Shirky wrote an insightful post about TV being a heat-sink for excess spare time and considers the number of projects of the scale of Wikipedia could be created with a small portion of that time [6]. It seems that the trend in society is to spend less time watching TV and more time doing creative things. In a related note Dan Meyer has an interesting blog post about trolls who say You Have No Life [7]. The Making Light blog post about Barack Obama s Nobel Peace Prize has some insightful comments [8]. I doubted that he had achieved enough to deserve it, but the commentators provide evidence that he has achieved a lot. I wonder if he will receive a second Peace Prize sometime in the next 10 years. The Making Light blog post about bullies and online disputes predictably got diverted to discussion school bullying [9]. The comments are interesting. Making Light has a mind-boggling post about homosexuality and porn [10]. US Senator Tom Coburn s (R-OK) chief of staff Michael Schwartz made the case against pornography. All pornography is homosexual pornography , said Schwartz, quoting an ex-gay friend of his. Among other things there are many good puns in the comments. Cubicle Jungle is an amusing satire of the computer industry [11]. It s shocking how long it goes before it gets to the part that s obviously fiction. The WikiReader is an interesting new device [12]. It costs $99US and has a copy of Wikipedia on an SD card, they have a subscription service that involves posting you a new SD card every 6 months, or you can download an image from their server. They state that they have a filtered version of Wikipedia for children, I wonder how they manage that, I also wonder whether they have an unfiltered version for adults. The device runs on two AAA batteries and is designed to be cheap and easy. Naturally it doesn t support editing, but most of the time that you need Wikipedia you don t need edit access or access to content that is less than 6 months old. Exetel are scum, customers who complain are cut off [13]. Making Light has an interesting post about a New Age scumbag who killed at least two of the victims who paid $10,000 for a sweat-lodge workshop (others are in hospital and may die in the near future) [14]. The NY Times has an interesting article about Jamie Oliver and his latest project [15]. He is trying to reform the eating habits of the unhealthiest area in the US. The 15 pound burger sounds interesting though, I wouldn t mind sharing one of those with 14 friends

16 October 2009

Uwe Hermann: coreboot on the cover of the Linux Journal

coreboot on Linux Journal Nice coreboot news the Free Software x86 firmware ("BIOS") is featured on the cover of issue 186 of the Linux Journal. Anton Borisov's article Coreboot at Your Service! explains the basic ideas behind coreboot, how to build an image for your board, which payloads are available and how they are used, e.g. GRUB2, SeaBIOS if you need legacy BIOS callbacks (e.g. for booting Windows), Etherboot/GPXE, or more fun stuff such as space invaders or tint (a tetris clone) in your flash ROM chip... If you read the article and think the build process is a bit complicated and ugly, do not despair! We're currently in the process of converting the whole coreboot code base to use kconfig (the widely-known configuration tool used by the Linux kernel, busybox, and other projects), so in the very near future the whole process for building a coreboot image will work like this:
  $ make menuconfig
  $ make
coreboot menuconfig Flashing the image can then be done using an EEPROM programmer and/or via the user-space utility flashrom (available for Linux, Mac OS X, FreeBSD, etc.)... It's nice to see that coreboot is getting more and more coverage in "mainstream" media and is growing both in number of deployments and in number of supported chipsets and boards. We are desperately in need of more developers though, there are just way too many chipsets, boards, and datasheets out there; we're happy about every patch and every new tester or developer who likes to mess with code that runs in the very first few (micro)seconds after power-on. If you think kernel hacking and related low-level development is nice, you might also be interested in writing code where there's no RAM yet (as coreboot has to initialize it), there's no serial port for debugging (coreboot has to initialize it), no PCI devices have been set up, most of your auxiliary hardware is not yet up (ethernet NIC, parallel port, audio, IDE, SATA, USB, you name it). It's a fun environment to work in and you'll learn a lot about PC hardware, even if you (so far) thought you knew everything there is to know. Feel free to join us on the mailing list or on IRC in #coreboot on Freenode.

Robert Millan: The Pirate Bay and Youtube


Like many other people, it used to bother me that The Pirate Bay was being sued for distributing hashes of copyright-restricted material whereas Youtube could distribute the material itself without fear of punishment. Like many other people, it used to bother me that there was no way to download music from The Pirate Bay (which in the Spanish kingdom is a legal activity) directly into a music player without the hassle of manually browsing the website, launching a bittorrent client, etc. Then I found rhythmbox-youtube.

Gunnar Wolf: Getting closer to the fifth EDUSOL Encounter

This is the fifth year we hold an EDUSOL, and we are closing in on it. EDUSOL is an online encounter whose topics are Education and Free Software Actually, this year we are widening our scope, and we will include Free Culture as well as a base area. Now, besides those three general areas, each year we have had a base topic around which we invite the speakers to talk about (although it is a lax requirement). This year, the base topic is social networks No, not in the Twitter/Facebook/blah sense, but as a wider phenomenon, studying interaction between people, the forming of communities. And for our particular areas, the forming of knowledge-based communities. Anyway I agreed with the organizers to provide the English translation of the participation invitation. I will skip the call for papers, as we are basically at the proposal deadline (October 17), but if you have anything you want to propose, please tell us so! Leaving that aside... Please excuse the quality of my translation, it is late and I'm tired. We will work on it :) Videoconference reception EDUSOL spans several participation categories. The closest category to a traditional, face to face conference. Each year, we invite a group of speakers to talk about a topic related to our main discoursive line. Among the speakers that have confirmed so far, we have: We invite you to be active participants in the videoconference cycle. You can invite your social or user group to be part of the Encounter. There are three ways to do it:
  1. Using the videoconference facilities in your University network
  2. Connecting from a personal computer with broadband access, by using Ekiga or any other H.323 client
  3. Following the .ogg stream and participating back via IRC
In any case (specially in the first two, which require more coordination), please contact us. For further information, visit http://edusol.info/es/e2009/convocatorias/videoconfrencias November 6: Free Education and Free Culture day We invite social and user groups to host talks regarding Free Education and Free Culture. This is not a call to promote Free Software, as there are many other spaces devoted to it. We should start with the idea that freedom resides in us, not in the software. Some of the topics our community recommends are: Further details at http://edusol.info/es/e2009/convocatorias/dialternativo We need some help in this area to generate contents with slides, making it easier for proposed scripts for the talks. If you want to collaborate, please write to our academic support list, http://lists.edusol.info/listinfo.cgi/soporte-academico-edusol.info Want to collaborate? Further questions or comments? We are holding on-line meetings for this group of topics on Thursday 22:00 GMT-5, in the #edusol channel in OFTC (irc.debian.org); you can enter the IRC channel using the Web client at http://irc.bine.org.mx or http://edusol.info/irc About EDUSOL EDUSOL started as a proposal seeking to provide a space so that people interested in education could discuss and analize the good and bad points about Free Culture and Free Software, with no geographic restrictions. Year after year, freedom-loving educators of all Latin America and Spain gather for our annual party. EDUSOL's core language is Spanish, although participation in English is allowed and encouraged (although understanding Spanish will be a strong aid). We invite you to participate and contribute in this collective effort using and commenting on our blogs, or adding your personal blog to our planet: http://edusol.info/es/node/add/blog
http://edusol.info/es/node/add/feedapi-node You can follow us by identi.ca or RSS: http://identi.ca/group/edusol
http://edusol.info/rss.xml

15 October 2009

Enrico Zini: Building a web-based API with Turbogears2

Building a web-based API with Turbogears2 I am using TurboGears2 to export a python API over the web. Every API method is wrapper by a controller method that validates the parameters and returns the results encoded in JSON. The basic idea is this:
@expose("json")
def list_colours(self, filter=None, productID=None, maxResults=100, **kw):
    # Call API
    res = self.engine.list_colours(filter, productID, maxResults)
    # Return result
    return res
To validate the parameters we can use forms, it's their job after all:
class ListColoursForm(TableForm):
    fields = [
            # One field per parameter
            twf.TextField("filter", help_text="Please enter the string to use as a filter"),
            twf.TextField("productID", help_text="Please enter the product ID"),
            twf.TextField("maxResults", validator=twfv.Int(min=0), default=200, size=5, help_text="Please enter the maximum number of results"),
    ]
list_colours_form=ListColoursForm()
#...
    @expose("json")
    @validate(list_colours_form, error_handler=list_colours_validation_error)
    def list_colours(self, filter=None, productID=None, maxResults=100, **kw):
        # Parameter validation is done by the form
        # Call API
        res = self.engine.list_colours(filter, productID, maxResults)
        # Return result
        return res
All straightforward so far. However, this means that we need two exposed methods for every API call: one for the API call and one error handler. For every API call, we have to type the name several times, which is error prone and risks to get things mixed up. We can however have a single error handler for all methonds:
def get_method():
    '''
    The method name is the first url component after the controller name that
    does not start with 'test'
    '''
    found_controller = False
    for name in pylons.c.url.split("/"):
        if not found_controller and name == "controllername":
            found_controller = True
            continue
        if name.startswith("test"):
            continue
        if found_controller:
            return name
    return None
class ValidatorDispatcher:
    '''
    Validate using the right form according to the value of the "method" field
    '''
    def validate(self, args, state):
        method = args.get("method", None)
    # Extract the method from the URL if it is missing
        if method is None:
            method = get_method()
            args["method"] = method
        return forms[method].validate(args, state)
validator_dispatcher = ValidatorDispatcher()
This validator will try to find the method name, either as a form field or by parsing the URL. It will then use the method name to find the form to use for validation, and pass control to the validate method of that form. We then need to add an extra "method" field to our forms, and arrange the forms inside a dictionary:
class ListColoursForm(TableForm):
    fields = [
            # One hidden field to have a place for the method name
            twf.HiddenField("method")
            # One field per parameter
            twf.TextField("filter", help_text="Please enter the string to use as a filter"),
    #...
forms["list_colours"] = ListColoursForm()
And now our methods become much nicer to write:
    @expose("json")
    def api_validation_error(self, **kw):
        pylons.response.status = "400 Error"
        return dict(form_errors=pylons.c.form_errors)
    @expose("json")
    @validate(validator_dispatcher, error_handler=api_validation_error)
    def list_colours(self, filter=None, productID=None, maxResults=100, **kw):
        # Parameter validation is done by the form
        # Call API
        res = self.engine.list_colours(filter, productID, maxResults)
        # Return result
        return res
api_validation_error is interesting: it returns a proper HTTP error status, and a JSON body with the details of the error, taken straight from the form validators. It took me a while to find out that the form errors are in pylons.c.form_errors (and for reference, the form values are in pylons.c.form_values). pylons.response is a WebOb Response that we can play with. So now our client side is able to call the API methods, and get a proper error if it calls them wrong. But now that we have the forms ready, it doesn't take much to display them in web pages as well:
def _describe(self, method):
    "Return a dict describing an API method"
    ldesc = getattr(self.engine, method).__doc__.strip()
    sdesc = ldesc.split("\n")[0]
    return dict(name=method, sdesc = sdesc, ldesc = ldesc)
@expose("myappserver.templates.myappapi")
def index(self):
    '''
    Show an index of exported API methods
    '''
    methods = dict()
    for m in forms.keys():
        methods[m] = self._describe(m)
    return dict(methods=methods)
@expose('myappserver.templates.testform')
def testform(self, method, **kw):
    '''
    Show a form with the parameters of an API method
    '''
    kw["method"] = method
    return dict(method=method, action="/myapp/test/"+method, value=kw, info=self._describe(method), form=forms[method])
@expose(content_type="text/plain")
@validate(validator_dispatcher, error_handler=testform)
def test(self, method, **kw):
    '''
    Run an API method and show its prettyprinted result
    '''
    res = getattr(self, str(method))(**kw)
    return pprint.pformat(res)
In a few lines, we have all we need: an index of the API methods (including their documentation taken from the docstrings!), and for each method a form to invoke it and a page to see the results. Make the forms children of AjaxForm, and you can even see the results together with the form.

14 October 2009

Patrick Schoenfeld: PHP and the great "===" operator

Lets suppose you've got an array with numeric indices:
[0] => 'bla'
[1] => 'blub'
Now you want to do something if the element 'bla' is found in that array.
Well, you know that PHP has a function array_search, which returns the key(s) of the found values. Lets say, you write something like this:
if(array_search($array, 'bla')) do_something

Would you expect that do_something would actually do something?
If yes: You are wrong.
If no: Great, you've understand some parts of PHP - insanitygoodness..

Actually, if 'bla' wouldn't have the index 0 it would work, because 1, 2, 3, 4, etc. is TRUE. But unfortunately PHP has some sort of implicit casting, which makes 0 behave like a FALSE, depending on the context. So following this, the if() works for all elements except 0.

You might be tempted to write
if(array_search... != FALSE)
But this wouldn't help you, because 0 would still evaluate to FALSE, leading to if(FALSE != FALSE) which is (hopefully obviously) never true.

A PHP beginner (or even an intermediate, if he never stumbled across this case) might ask:
Whats the solution for this dilemma?

Luckily the PHP documentation is great. It tells you about this. And additionally PHP has got this great operator (===), which causes people to ask "WTF?" when they hear about it for the first time. Additionaly to comparing the values to each other, they also check the type of the variable. This leads to the wanted result because 0 is an integer, while FALSE is Boolean. So the solution for our problem looks like this:
if (array_search($array, 'bar') !== FALSE)
Isn't this great?

Robert McQueen: Telepathy Q&A from the Boston GNOME Summit

The first Telepathy session session on Saturday evening at the Boston GNOME Summit was very much of a Q&A where myself and Will answered various technical and roadmap issues from a handful of developers and downstream distributors. It showed me that there s a fair amount of roadmap information we should do better at communicating outside of the Telepathy project, so in the hope its useful to others, read on MC5 Ted Gould was wondering why Mission Control 4 had an API for getting/setting presence for all of your accounts whereas MC5 does not. MC5 has a per-account management of desired/current presence which is more powerful, but loses the convenience of setting presence in one place. Strictly speaking, doing things like deciding which presence to fall back on (a common example being if you have asked for invisible but the connection doesn t support it) is a UI-level policy which MC should not take care of, but in practice there aren t many different policies which make sense, and the key thing is that MC should tell the presence UI when the desired presence isn t available so it could make a per-account choice if that was preferable. As a related side point, Telepathy should implement more of the invisibility mechanisms in XMPP so it s more reliably available, and then we could more meaningfully tell users which presence values were available before connecting, allowing signing on as invisible. Since MC5 gained support for gnome-keyring, its not possible to initialise Empathy s account manager object without MC5 prompting the user for their keyring password un-necessarily (especially if the client is Ubuntu s session presence applet and the user isn t using Empathy in the current session but has some accounts configured). Currently the accounts D-Bus API requires that all properties including the password are presented to the client to edit. A short-term fix might be to tweak the spec so that accounts don t have to provide their password property unless it s explicitly queried, but this might break the ABI of tp-glib. Ultimately, passwords being stored and passed around in this way should go away when we write an authentication interface which will pass authentication challenges up to the Telepathy client to deal with, enabling a unified interface for OAuth/Google/etc web token, Kerberos or SIP intermediate proxy authentication, and answering password requests from the keyring lazily or user on demand. Stability & Security Jonathan Blandford was concerned about the churn level of Telepathy, from the perspective of distributions with long-term support commitments, and how well compatibility will be maintained. Generally the D-Bus API and the tp-glib library APIs are maintained to the GNOME standards of making only additive changes and leaving all existing methods/signals working even if they are deprecated and superseded by newer interfaces. A lot of new interfaces have been added over the past year or so, many of which replace existing functionality with a more flexible or more efficient interface. However, over the next 4-6 months we hope to finalise the new world interfaces (such as multi-person media calls, roster, authentication, certificate verification, more accurate offline protocol information, chat room property/role management), and make a D-Bus API break to remove the duplicated cruft. Telepathy-glib would undergo an ABI revision in this case to also remove those symbols, possibly synchronised with a move from dbus-glib to GVariant/etc, but in many cases clients which only use modern interfaces and client helper classes should not need much more than a rebuild. Relatedly there was a query about the security of Telepathy, and how much it had been through the mill on security issues compared to Pidgin. In the case of closed IM protocols (except MSN where we have our own implementation) then we re-use the code from libpurple, so the same risks apply, although the architecture of Telepathy means its possible to subject the backend processes to more stringent lockdowns using SElinux or other security isolation such as UIDs, limiting the impact of compromises. Other network code in Telepathy is based on more widely-used libraries with a less chequered security history thus far. OTR The next topic was about support for OTR in Telepathy. Architecturally, it s hard for us to support the same kind of message-mangling plugins as Pidgin allows because there is no one point in Telepathy that messages go through. There are multiple backends depending on the protocol, multiple UIs can be involved in saving (eg a headless logger) or displaying messages (consider GNOME Shell integration which previews messages before passing conversations on to Empathy), and the only other centralised component (Mission Control 5) does not act as an intermediary for messages. Historically, we ve always claimed OTR to be less appealing than native protocol-level end-to-end encryption support, such as the proposals for Jingle + peer to peer XMPP + TLS which are favoured by the XMPP community, mostly because if people can switch to an unofficial 3rd party client to get encryption, they could switch to a decent protocol too, and because protocol-level support can encrypt other traffic like SRTP call set-up, presence, etc. However, there is an existing deployed OTR user base, including the likes of Adium users on the Mac, who might often end up using end to end encryption without being aware of it, who we would be doing a disservice by Telepathy not supporting OTR conversations with these people. This is a compelling argument which was also made to me by representatives from the EFF, and the only one to date which actually held some merit with me compared to just implementing XMPP E2E encryption. Later in the summit we went on to discuss how we might achieve it in Telepathy, and how our planned work towards XMPP encryption could also help. Tubes We also had a bit of discussion about Tubes, such as how the handlers are invoked. Since the introduction of MC5, clients can register interest in certain channel types (tubes or any other) by implementing the client interface and making filters for the channels they are interested in. MC5 will first invoke all matching observers for all channels (incoming and outgoing) until all of them have responded or timed out (eg to let a logger daemon hook up signal callbacks before channel handling proceeds), all matching approvers for incoming channels until one of them replies (eg to notify the user of the new channel before launching the full UI), and then sending it to the handler with the most specific filter (eg Tomboy could register for file transfers with the right MIME type and receive those in favour to Empathy whose filter has no type on it). Tubes can be shared with chat rooms, either as a stream tube where one member shares a socket for others to connect to (allowing re-sharing an existing service implementation), or a D-Bus tube where every member s application is one endpoint on a simulated D-Bus bus, and Telepathy provides a mapping between the D-Bus names and the members of the room. In terms of Tube applications, now we ve got working A/V calling in Empathy, as well as desktop sharing, and an R&D project on multi-user calls, our next priority is on performance and Tube-enabling some more apps such as collaborative editing (Gobby, AbiWord, GEdit, Tomboy ?). There was a question about whether Tube handlers can be installed on demand when one of your contacts initiates that application with you. It d be possible to simulate this by finding out (eg from the archive) which handlers are available, and dynamically registering a handler for all of those channel types, so that MC5 will advertise those capabilities, but also register as an approver. When an incoming channel actually arrives at the approval stage, prompt the user to install the required application and then tell MC5 to invoke it as the handler. Colin Walters asked about how Telepathy did NAT traversal. Currently, Telepathy makes use of libnice to do ICE (like STUN between every possible pair of addresses both parties have, works in over 90% of cases) for the UDP packets involved in calls signalled over XMPP, either the Google Talk variant which can benefit from Google s relay servers if one or other party has a Google account, so is more reliable, or the latest IETF draft which can theoretically use TURN relays but its not really hooked up in Telepathy and few people have access to them. XMPP file transfers and one-to-one tube connections use TCP which is great if you have IPv6, but otherwise impossible to NAT traverse reliably, so often ends up using strictly rate-limited SOCKS5 -ish XMPP proxies, or worse, in-band base64 in the XML stream. We hope to incorporate (and standardise in XMPP) a reliability layer which will allow us to use Jingle and ICE-UDP for file transfers and tubes too, allowing peer to peer connections and higher-bandwidth relays to enhance throughput significantly. Future Ted Gould had some good questions about the future of Telepathy
Should Empathy just disappear on the desktop as things like presence applets or GNOME Shell take over parts of its function? Maybe, yes. In some ways its goal is just to bring Telepathy to end users and the desktop so that its worth other things integrating into Telepathy, but Telepathy allows us to do a lot better than a conventional IM client. Maemo and Sugar on the OLPC use Telepathy but totally integrates it into the device experience rather than having any single distinct IM client, and although Moblin uses Empathy currently it has its own presence chooser and people panel, and may go on to replace other parts of the user experience too. GNOME Shell looks set to move in this direction too and use Telepathy to integrate communications with the desktop workflow. Should Telepathy take care of talking to social networking sites such as Facebook, Twitter, etc? There s no hard and fast rule Telepathy only makes sense for real-time communications, so it s good for exposing and integrating the Facebook chat, but pretty lame for dealing with wall posts, event invitations and the like. Similarly on the N900, Telepathy is used for the parts of the cellular stack that overlap with real-time communications like calling and SMS, but there is no sense pushing unrelated stuff like configuration messages through it. For Twitter, the main question is whether you actually want tweets to appear in the same UI, logging and notification framework as other messages. Probably not anything but the 1-to-1 tweets, meaning something like Moblin s Mojito probably makes more sense for that. Later in the summit I took a look at Google Latitude APIs, which seem like something which Telepathy can expose via its contact location interface, but probably not usefully until we have support for metacontacts in the desktop. Can/will Telepathy support IAX2? It can, although we d have to do a local demultiplexer for the RTP streams involved in separate calls. It s not been a priority of ours so far, but we can help people get started (or Collabora can chat to people who have a commercial need for it). Similarly nobody has looked at implementing iChat-compatible calling because our primary interest lies with open protocols, but if people were interested we could give pointers its probably just SIP and RTP after you dig through a layer of obfuscation or two.
If you want to know more about Telepathy feel free to comment with some follow-up questions, talk to us in #telepathy on Freenode, or post to the mailing list.

Christian Perrier: Virtualization (take 2)

Thanks to everybody who went through the pain of my blog (which doesn't allow comments because I don't want to bother with blog spam) and still cooked up a private reply to me. It's very much appreciated. So, Patrick, Dan, Dirk and No l, you just won a free beer for your wise advice.....except the two marathoners among you guys who shouldn't drink beer (though it would help you slowing down enough to be able to run along with me). In short, all this can be summarized to "Christian, you're going the wrong way with Xen, use KVM". One of the advices was using VirtualBox OSE, which is certainly a wise advice as well...but not what I want to experiment (I already use VB for the few D-I work I'm still doing and that would not be a new experiment for me). I'll go your proposed way and will let you know. Still, I'd love being able to figure out Xen stuff as this is what we're more and more using at ONERA.

13 October 2009

Sha Liu: Let s stay in touch on LinkedIn


LinkedIn Sandyleo26 s, I d like to add you to my professional network on LinkedIn. - Sha Confirm that you know Sha Liu Every day, millions of professionals like Sha Liu use LinkedIn to connect with colleagues, find experts, and explore opportunities. 2009, LinkedIn Corporation

David Pashley: Tarballs explained

This entry was originally posted in slightly different form to Server Fault If you're coming from a Windows world, you're used to using tools like zip or rar, which compress collections of files. In the typical Unix tradition of doing one thing and doing one thing well, you tend to have two different utilities; a compression tool and a archive format. People then use these two tools together to give the same functionality that zip or rar provide. There are numerous different compression formats; the common ones used on Linux these days are gzip (sometimes known as zlib) and the newer, higher performing bzip2. Unfortunately bzip2 uses more CPU and memory to provide the higher rates of compression. You can use these tools to compress any file and by convention files compressed by either of these formats is .gz and .bz2. You can use gzip and bzip2 to compress and gunzip and bunzip2 to decompress these formats. There are also several different types of archive formats available, including cpio, ar and tar, but people tend to only use tar. These allow you to take a number of files and pack them into a single file. They can also include path and permission information. You can create and unpack a tar file using the tar command. You might hear these operations referred to as "tarring" and "untarring". (The name of the command comes from a shortening of Tape ARchive. Tar was an improvement on the ar format in that you could use it to span multiple physical tapes for backups).
# tar -cf archive.tar list of files to include
This will create (-c) and archive into a file -f called archive.tar. (.tar is the convention extention for tar archives). You should now have a single file that contains five files ("list", "of", "files", "to" and "include"). If you give tar a directory, it will recurse into that directory and store everything inside it.
# tar -xf archive.tar
# tar -xf archive.tar list of files
This will extract (-x) the previously created archive.tar. You can extract just the files you want from the archive by listing them on the end of the command line. In our example, the second line would extract "list", "of", "file", but not "to" and "include". You can also use
# tar -tf archive.tar
to get a list of the contents before you extract them. So now you can combine these two tools to replication the functionality of zip:
# tar -cf archive.tar directory
# gzip archive.tar
You'll now have an archive.tar.gz file. You can extract it using:
# gunzip archive.tar.gz
# tar -xf archive.tar
We can use pipes to save us having an intermediate archive.tar:
# tar -cf - directory   gzip > archive.tar.gz
# gunzip < archive.tar.gz   tar -xf -
You can use - with the -f option to specify stdin or stdout (tar knows which one based on context). We can do slightly better, because, in a slight apparent breaking of the "one job well" idea, tar has the ability to compress its output and decompress its input by using the -z argument (I say apparent, because it still uses the gzip and gunzip commandline behind the scenes)
# tar -czf archive.tar.gz directory
# tar -xzf archive.tar.gz
To use bzip2 instead of gzip, use bzip2, bunzip2 and -j instead of gzip, gunzip and -z respectively (tar -cjf archive.tar.bz2). Some versions of tar can detect a bzip2 file archive with you use -z and do the right thing, but it is probably worth getting in the habit of being explicit. More info:
Read Comments (8)

12 October 2009

Florian Maier: New openmoko accessories arrived

8 GB of storage will more than suffice for a nice and clean Debian installation ;-) If you live in germany, i absolutely recommend http://www.pulster.de/ for all free phone accessories!
openmoko stuff arrived

Next.

Previous.