Search Results: "beh"

3 August 2007

John Goerzen: Haskell Fun

Bryan O'Sullivan noted over at the Real World Haskell blog that Haskell made quite the impact at OSCon. And I can attest to Simon Peyton-Jones having trouble leaving the building because of all the people that wanted to talk to him about Haskell. It was interesting to think about "why now" for Haskell's popularity. Bryan's post has links to the video of Simon's talks, which are great. (Sample quote: "Oh look, a whiteboard has appeared as if by magic! What joy!")

I followed Bryan's link to the Haskell/OSCon-related blog posts at Technorati. Here's an interesting one by chromatic, who gave some Perl talks at OSCon. Favorite quote:

I sat next to Nat Torkington at the tutorial. He kept rubbing his temples. At one point I leaned over and said, The interesting thing about Haskell is that its functions only take one argument. He turned green.

In all seriousness, well-factored Haskell code resembles well-factored Smalltalk code: if you have functions (or methods) longer than a handful of lines, you re probably doing too much. Lower level languages such as C rarely give the opportunity for composition and abstraction that you can get out of functional languages. The presence of pure functions functions which never change global state and which return the same output for the same input is also immensely important.

It s actually the combination of the two features which give these languages such power. When Haskell forces you to mark impure functions explicitly, it gives you tools to isolate behavior which can change global state in the smallest possible scopes, and prevents you from composing impure and pure code together accidentally. When Haskell lets you compose functions into larger functions, not only does it help you write code more concisely, but it provides well-defined units of behavior which work along well-defined and isolated boundaries.


So what is this business about Haskell functions taking only one argument? Let's look at a quick example. Say I wanted to write a function to multiply two numbers. I'd write:

mul a b = a * b

I could give the type of this function like this:

mul :: Int -> Int -> Int

You could read that as "mul takes two Ints and returns an Int". And you can think of it this way. But you could also write the type this way:

mul :: Int -> (Int -> Int)

It means the exact same thing and is valid to Haskell. To read it, you'd say "mul takes an Int and returns a function that takes an Int and returns an Int." And truly this is what Haskell functions that take multiple parameters are doing. Now, I can say:

fifteen = mul 3 5
mulByThree = mul 3
fifteen' = mulByThree 5
fifteen'' = (mul 3) 5


mulByThree has type Int -> Int; it's a function that we got by simply not applying "mul" to all its arguments. fifteen'' illustrates what is going on internally when you write "mul 3 5". It turns out that being able to call a function with multiple arguments is just some syntactic sugar to Haskell.

This is a tremendously useful feature. For instance:

filter (>= 10) [1..20]

I've applied >= to only one argument here. That's fine; it returns a function that's exactly what filter wants.

I've been watching the video of Simon's Taste of Haskell talk. I could *hear* when the audience grasped the utility of this because there was a collective "Oooooo!" from them.

By the way, Haskell has type inference, so I didn't have to give types at all. Oh, and you can also refer to the function itself by not giving any arguments.

mul = (*)

This is one small reason I like to say "Haskell manipulates functions with the same ease that Perl manipulates strings." Mind-bending, isn't it?

1 August 2007

Russell Coker: Advogato and Hateful/Divisive Posts

Firstly for the benefit of people who haven’t heard of it, the Advogato FAQ and the Wikipedia Page describe what Advogato does. Pete Zaitcev posted a strange article about me to Advogato. In it he accused me of “pumping hateful leftist propaganda into Advogato“, said propaganda being my regular blog posts. In an addendum he accused me of insanity, and said that my “attacks” were “divisive“. I considered writing an Advogato post in response but first read the Posting Guidelines which say: Both of those criteria rule out Pete’s post and any response that I might make would risk being in breach of such conditions - so I will use my blog as the Advogato admins recommend. Pete’s ad-hominem attack on me claiming that my posts are hateful is bizarre. Pete, for the benefit of all the interested onlookers could you please inform us which of my posts you consider hateful and why you have such an opinion? As a general rule you should always cite articles that you reference. When you make accusations without any evidence to back them up it makes you look bad and prevents any positive discussion of the acts in question. As for the accusation of being divisive, that only happens when people are forced to choose sides. For example when you encourage other people to rate me down on Advogato because of my political opinions that can divide the community (in a small way, neither you, nor me, nor Advogato is important enough to cause a serious problem in this regard). The idea that I was intentionally pumping anything into Advogato was also strange to me. When I entered the URL for my blog into the Advogato settings page I didn’t even realise that it was being syndicated until I reviewed my web logs some time later. It seems that Advogato only has a small number of readers, a recent post about strange ZCAV performance included a graph and judging by the referrer tags it seems that 412 people read the post from Advogato out of 10468 total (so Advogato gets less than 4% of my readers). Planet Debian seems to get more than 15x the number of readers of Advogato. Incidentally if you don’t currently include images in your blog the reader tracking ability is one reason for including an image in an occasional post. Another strange ad-hominem attack was the reference to “college indoctrination“. When I was in university I supported the Liberal party (the Australian equivalent of the Republican party in the US). The influence of Linux programmers (including some of Pete’s colleagues at Red Hat) had much more of an effect on my political opinions than that of my university experience. I am not criticising Pete for disagreeing with me in regard to politics (I don’t even know what he disagrees with). Here are my specific criticisms of Pete’s behaviour:
  1. Ad-hominem attacks

  2. Encouraging mis-use of Advogato trust metrics for political reasons (this one may not have been deliberate)

  3. Non-specific accusations which do not allow me to either defend myself against the accusations or change my actions if he turns out to have any reasonable points

  4. Hypocrisy - he breaks two of the posting guidelines for the purpose of criticising my blog posts which supposedly break some unwritten rule

  5. Not reading the Advogato FAQ - it has a specific section about political disagreements
But I’m not going to advocate voting him down on Advogato. He does write some interesting things on occasion. Check out his page on guns for example.

30 July 2007

Russell Coker: Hot Water

A response to a post I wrote about things to do for the environment suggested that there would be a health risk to lowering the temperature of a home hot-water system to save power. I have just been reading about so-called tankless hot-water systems. The concept is that instead of keeping a tank of water hot (which means that you lose some energy due to the insulation not being perfect) you heat water when you need it. The down-side to this is that you need a moderate amount of power to heat water as rapidly as it’s used. The GoTankless.com products use between 11KW and 27KW of electricity. The early implementations of this idea used gas - the occasional carbon-monoxide problem with gas appliances makes me inclined to avoid them so it’s good that there’s an electric option. One of the benefits of the tankless system is that it runs the water at a lower temperature than a regular hot water system. For a tank storing hot water you have to run it at a temperature that kills bacteria (or at least dramatically inhibits their growth) - which means greater than 50C, but for on-demand water it’s safer to have it run at something close to the desired temperature (probably not much above 40C) and not use the cold tap. Lower temperature water avoids the risk of scalding for children and the elderly and if the “hot tap” is running at a good temperature for a shower then you can just turn it on, wait 30 seconds for the pipes to warm up, and jump in! Incidentally it really sucks the way most showers have the taps under or behind the flow of water, so if the water becomes too hot before you get in then you end up getting minor burns in the process of turning on the cold tap. I still think that solar hot water is the way to go. It apparently combines something like a tankless system on water that comes out of a tank heated by the sun. So during winter it operates like a tankless system but in summer you get more hot water than you can use. This web site about Solar hot water systems indicates that they have a similar technology to “boost” solar hot water, so if the Sun doesn’t make the water hot enough then it can use electric or gas systems to further heat the water. It’s also interesting to note that they offer Heat Pump hot-water systems, it’s a pity that they apparently don’t support combining this with solar heating. Another interesting feature is what they call the Water Guardian that pumps cold water from the pipes back into the water tank and avoids wasting the water that you might otherwise run down the sink while waiting for it to get hot.

Andrew Stribblehill: Cappuccino milk

Over the past few months I have been asymptotically approaching being able to make a good cappuccino or latte. (I'm way better than the glassy-eyed morons who are usually behind an espresso machine but nowhere near "good barista".) However, over the last few weeks I have noticed that sometimes I was not able to steam the milk properly. I get very little foam then when I bang out the biggest of the bubbles, it’s virtually flat. I had thought that I was just having a bad run, but then a colleague mentioned it too. It turns out that only some of the bottles have this characteristic, and we haven't determined, from analysis of the codes on the bottle tops, what determines this. Each was full-fat milk from the same dairy. If anyone who reads this knows the answer, please mention it in a comment.

28 July 2007

Patrick Winnertz: debian-edu 3.0 terra finally released

Hey folks, we released some minutes ago finally Debian-Edu/Skolelinux 3.0r0 ?Terra? which is based on Debian 4.0 with some modifications to work out-of-the box. Here are the releasenotes: Oslo - July 22., 2007 Skolelinux 3.0 is ready. This is an community release with comprehensive support from regional and national projects in Germany, Spain, France, Greece and Norway. The Skolelinux project is now a part of Debian under the name Debian-Edu. Several other projects have made additional functionality to Skolelinux tailored for national needs. Skolelinux now supports more than 50 countries. whats new in skolelinux 3.0: based on Debian 4.0 ?etch? and therefore compatible to LSB 3.1, using kernel 2.6.18 and KDE 3.5.5 Full support for networked Thin clients, ?LowFat (diskless) clients, Workstations and Laptops. With the ?LowFat clients users got full PC functionality with extremely low maintenance cost. The use of ?LowFat clients gives full support for sound, video, USB memory stick?s and DVDs without the need for a local installation. Skolelinux now got more than 80 applications selected for pedagogic uses, supporting more than 50 languages. Many new applications are introduced in addition to popular classic as GCompris, KDE-Edu, Iceweasel (unbranded version of Firefox) and ?OpenOffice.org. Installation is a breeze: Both the installation and source code for all software are now distributed on a single DVD now supporting three different processor platforms as i386, PowerPC and AMD64. This makes it more easy to choose hardware, and to study the recipes behind the software. Those interested can exercise their freedom to learn, participate and share knowledge more easily. Installation CDs are also available, but requires a working Internet connection for installation. about skolelinux Skolelinux is a complete tailored software solution for the needs of any educational institution or school. It is a ready computer system were the school does not need to piece together the components. Skolelinux is the result of the work of the Debian Edu project and Debian Edu is an official Debian subproject. It is installed in a great number of schools in Norway, Germany, France and other countries. Municipalities and Commercial Service Providers run Skolelinux across multiple schools, operated and maintained centrally. Service providers report that the ?lowfat clients? require half the maintenance cost of other desktop alternatives. The next milestone of Skolelinux development will be to merge the Debian-based ?LinEx distro into Debian Edu. Currently ?LinEx is used by more than 250,000 students and public employees in the region of Extremadura in Spain. in depth Lowfat clients is also known as Diskless workstations. They run applications locally on the client. All software comes from the server instead of locally from the client hard drive. Recommended minimum requirement for client machines is > 256 MB RAM and 800 MHz CPU. Skolelinux now got improved tools for system surveillance and maintenance. Roadmap for next merging of ?LinEx and Debian-Edu: * http://wiki.debian.org/DebianEdu/LinEx2DebianEdu-Roadmap Please note that the documentation for the 3.0 Terra release is only available in English at the moment and contains some rough edges. We have considered releasing before the end of the summer holidays more important and we will fix those rough edges in the coming weeks, when we also expect more translations to show up. Those fixes will be included in the upcoming 3.0 r1 release.

26 July 2007

MJ Ray: Bradley Wiggins Should Have Stayed in Race, According to UCI President

OK, this is probably my last Tour post for a while... back to business, software and the village after this, but I heard this on the radio over breakfast and I can't see much about it online. One of the most disappointing things for English Tour fans about Moreni's failed dope test [tdfblog] is the departure of his Cofidis team-mate Bradley Wiggins from the race, days before the last (and most Wiggins-winnable) of the individual time trials. In an interview this morning on BBC Radio 4's Today Programme at about 07:45 (in case you can Listen Again to it), there was the question:
"We've had whole teams withdrawing. It's not just the two who test positive. It's the sense that those are the tip of an iceberg, isn't it? The whole team pulls out and you don't really know how many others in that team are affected by the same behaviour."
and UCI president Pat McQuaid answered:
"Well, I mean, the fact that the whole team pulled out is something which the UCI is quite annoyed about, in actual fact, and it was that the organisers asked the teams to pull out. It wasn't the fact that the teams pulled out of their own accord. The organisers said to them, as a result of the positive, that they got the one person and they said they want the whole team out of it. That actually goes against the rules and it shouldn't have happened. Erm, so, from that point of view, you can't put anything on the other riders. You can't say that the other riders are up to anything just because they're not in the race. They were asked by the organisers to get out."
The interview continues to point out how there's much more testing in cycling now than ever before, and more than in any other sport (remember, Puerto implicated footballers and others too), but it's interesting how the whole-team-out approach is criticised for removing the other riders on a team from the race testing! Anyway, by the UCI president's reasoning, Bradley Wiggins should still be racing. Well done to UCI and the tour for catching Moreni and almost-well-done to Moreni for admitting it, but boo Cofidis for pulling the whole team out! (2007-07-26: +1 comment)

25 July 2007

John Goerzen: OSCon Wednesday

Nat Torkington, program chair, started off the day. He commented that one of the most interesting trends these days is the expansion of the Open Source ideals beyond software.

Tim O'Reilly commented about the FSF's four freedoms, and asked how we maintain them. We have to think about preserving freedoms -- questions such as Free Software that relies on proprietary services, data, or business processes. It's important to remember to pay attention to freedom and not just to the success of businesses. But businesses matter and have enormous power and will always be related.

Tim really pushed expanding the boundaries of Open Source and thinking ahead: wikipedia, OpenID, etc. He also asked: does Congress need a version control system?

He suggested there are four open source success factors: frictionless software distribution, collaborative development, freedom to build/adapt/extend, freedom to fork.

Hadoop is an interesting FLOSS project to build some infrastructure like Google has. Apparently Yahoo is very interested.

Back to Nat... hardware is cheap and everyone keeps buying more of it.

James Reinders from Intel talking about multi-core parallelism. Saying that parallelism is going to be more and more important. Intel released threading building blocks, a series of templates for C++, as GPL'd software at the conference this week. I'm not all that excited about a C++ project, though, since I think languages like Haskell have more promise here anyway.

The other Intel guy mentioned Intel's open source involvement: intellinuxgraphics.org, intellinuxwireless.org, linuxpowertop.org, kernel,org, moblin.org. Linux laptops have the longest runtimes compared to other laptops.

"It's amazing how many people you can make paranoid by showing up with a tie and a suit to do a keynote at OSCON." -- James Reinders

Simon Peyton-Jones is up now, and Nat says he will "stretch your brain until only tiny bits are left."

State of the art in parallelism is really 30 years old with locks and condition variables -- like building a skyscraper out of bananas.

Locks are difficult to do right and have "diabolical error recovery".

Let's do transactions against memory instead of against a database. Implementation can even be similar to databases. The idea is transactional memory, and it sounds very, very slick.

Mark Shuttleworth and Tim for an interview...

Mark was fine, but I wish Tim had more interesting questions for him.

I went up to the front a few minutes after the event to talk to Simon PJ. He was talking to someone, who saw my nametag, and said, "Hi John, nice to meet you." He looked familiar but I couldn't quite place him, so I asked who he was. "Mark Shuttleworth." Yep, I was sitting just far enough back from the stage that I wasn't behind one of the large TV screens and couldn't make out faces real well, and I didn't recognize him. Erg..

Russell Coker: If You Don t Know How to Fix It, Please Stop Breaking It

In 1992 Severn Cullis-Suzuki (David Suzuki’s daughter) who was 12 years old gave a talk to the UN’s Earth Summit in Rio on behalf of . She gave a really good talk, see the below Youtube video. The best quote is “If you don’t know how to fix it, please stop breaking it!”. Unfortunately they haven’t stopped breaking things yet. http://www.youtube.com/watch?v=uZsDliXzyAY. Here is some background information on Several Cullis-Suzuki.

24 July 2007

Adam Rosi-Kessel: Currently in the iRiver (7/2007)

Occasionally, I update my sidebar to reflect the current contents of my iRiver. Most people read this blog through the RSS feed, however, and never see the sidebar. So I thought I’d provide occasional snapshots here. Lately:

23 July 2007

Kartik Mistry: Firefox world tour and GLug meet

* Yesterday, we had meeting with Mozilla guys, Chris and Seth at HBCSE. I was touch with Seth from some days and made this announcement on ILUG-Bom mailing list. Nirav was backbone behind this meet. 42 people did RSVP for meet. * I reached there at around 9.30 AM, Ankit was already there and he came long way from Pune (and paid 500/- from Thane to HBCSE too!), we met after 2 years and I felt great after seeing him - our l10n hero. We chatted while, ate ‘Idali’ and Chris and Seth was there at 10 AM. Perfect. But, there was only 6 people. We waited till 11 and setup tshirts on stage, projector etc. People were coming like they are coming in marriage! * I gave 1 minute welcome speech. Seth started talk at 11 AM. People grab Tshirts, Pins, Mouse pads (wow!) and cool stickers. Chris joined presentation to talk about how Mozilla evolve. We had nice discussion and question/answers too. Lunch was good. We had presentations from different people, including Ankit’s step-by-step procedure to start new language process for localization in Mozilla-* packages. * Krishnakant Mane showed us, how Firefox is capable with accessibility. I also thanks him here for Gnome-orca package (I did ITP after his demonstration in Dec ‘06 Lug meet). Siji showed some issues and its solution with printing. Dr. Nagarjuna presented ‘gnowledge’ extension for Firefox. Shantanu also gave demo on transliteration extension for Indian languages. * Somehow, Official lug meet didn’t happen. Speaker was missing! I seated together with other IRCers of #linux-india in canteen and we talked about various things. It was real fun to hear Pradeepto after long time. BG came too late (too late to have nice stickers!) ;) * I officially hate Mumbai traffic, now. Many thanks to people who did RSVP and didn’t appear.

22 July 2007

Patrick Winnertz: Debian-Edu/Skolelinux 3.0r0 Terra finally released!!!

Hey folks, we released some minutes ago finally Debian-Edu/Skolelinux 3.0r0 “Terra” which is based on Debian 4.0 with some modifications to work out-of-the box. Here are the releasenotes: Oslo - July 22., 2007 Skolelinux 3.0 is ready. This is an community release with comprehensive support from regional and national projects in Germany, Spain, France, Greece and Norway. The Skolelinux project is now a part of Debian under the name Debian-Edu. Several other projects have made additional functionality to Skolelinux tailored for national needs. Skolelinux now supports more than 50 countries.

Whats new in Skolelinux 3.0:
  • based on Debian 4.0 “etch” and therefore compatible to LSB 3.1, using kernel 2.6.18 and KDE 3.5.5
  • Full support for networked Thin clients, LowFat (diskless) clients, Workstations and Laptops. With the LowFat clients users got full PC functionality with extremely low maintenance cost. The use of LowFat clients gives full support for sound, video, USB memory stick’s and DVDs without the need for a local installation.
  • Skolelinux now got more than 80 applications selected for pedagogic uses, supporting more than 50 languages. Many new applications are introduced in addition to popular classic as GCompris, KDE-Edu, Iceweasel (unbranded version of Firefox) and OpenOffice.org.
  • Installation is a breeze: Both the installation and source code for all software are now distributed on a single DVD now supporting three different processor platforms as i386, PowerPC and AMD64. This makes it more easy to choose hardware, and to study the recipes behind the software. Those interested can exercise their freedom to learn, participate and share knowledge more easily. Installation CDs are also available, but requires a working Internet connection for installation.

About Skolelinux Skolelinux is a complete tailored software solution for the needs of any educational institution or school. It is a ready computer system were the school does not need to piece together the components. Skolelinux is the result of the work of the Debian Edu project and Debian Edu is an official Debian subproject. It is installed in a great number of schools in Norway, Germany, France and other countries. Municipalities and Commercial Service Providers run Skolelinux across multiple schools, operated and maintained centrally. Service providers report that the “lowfat clients” require half the maintenance cost of other desktop alternatives. The next milestone of Skolelinux development will be to merge the Debian-based LinEx distro into Debian Edu. Currently LinEx is used by more than 250,000 students and public employees in the region of Extremadura in Spain.

In depth “Lowfat clients” is also known as Diskless workstations. They run applications locally on the client. All software comes from the server instead of locally from the client hard drive. Recommended minimum requirement for client machines is > 256 MB RAM and 800 MHz CPU. Skolelinux now got improved tools for system surveillance and maintenance. Roadmap for next merging of LinEx and Debian-Edu: * http://wiki.debian.org/DebianEdu/LinEx2DebianEdu-Roadmap Please note that the documentation for the 3.0 Terra release is only available in English at the moment and contains some rough edges. We have considered releasing before the end of the summer holidays more important and we will fix those rough edges in the coming weeks, when we also expect more translations to show up. Those fixes will be included in the upcoming 3.0 r1 release.

20 July 2007

Gerfried Fuchs: msgmerge --previous and poedit

Since quite a while gettext has support for a feature which I was waiting for since ages: --previous. It means that when a string gets marked fuzzy it adds the previous original string as a comment so one is able to see the difference which led to the fuzzy marking. This makes translation of po files much much more comfortable because one can easily find out now what has changed. Let me give you a reallife example:
#: data/core/help.cfg:331
#, fuzzy
#  msgid "race^Mechanical"
msgid "trait^Mechanical"
msgstr "Kriegsgerät"
With out the previous string (in the "# " line) you would propably be puzzled about what has changed because the string gets stripped off the everything before the ^ for displaying it in this case. Though, not all translation tools behave correctly. One of them is unfortunately poedit. It moves the previous string to a wrong place and thus breaks the parsing of the file. A bugreport has been filed about it—but unfortunately it also means that upstream projects that already support (like Wesnoth) it are considering disabling it again because of this. So I wrote quickly a perl script that is able to fix that for you: pofix.pl. It's quite simple, reads from stdin and writes to stdout.
Go and support --previous before your competitors do it and hijack all your translators! ;)

18 July 2007

Fabio M. Di Nitto: More LDOM love

I finally decided to publish the few hacks I am using to run Linux on SUN's LDOM.
They are not pretty but they do the job done for me.
I take 0 responsibility for them so use them at your own risk.
Use this HOWTO only if you are dealing to mess with your system. Do *NOT* use for production systems if you do not understand what you are doing Step 1: read all the possible LDOM documentation that SUN made available for you. Step 2: understand that this is all experimental software. Step 3: repeat 1 and 2 a few times. LDOM server in Solaris allows to export 3 kind of block devices (file, partition/slice, entire disk) to the guest and those are seen as virtual disks.
The guest cannot really feel the difference but it is important to understand the way in which the LDOM software plays with them.
I did *not* test the export for partition/slice and my hacks do not know how to cope with it. You have been warned. The problem: LDOM virtual disk daemon mangles partition tables In an attempt to make sure that the partition tables exported to the guests are sane, the daemon ends up trashing valid ones because the check it forces to the devices is too strict and it behaves differently if the device is a file, a partition/slice or an entire disk.
The ldm bind operation is the dangerous one to perform and that can kill your partition table for good.
How ldm bind operation work: - for entire disks: * check device partition table
* fix device partition table if check fails
* lock device
* export device to guest
* store status of device once it is validated and do not check it ever again
- for files: * check device partition table
* fix device partition table if check fails
* export device to guest
Remember that I did *not* test export of a slice and that my hack does not take it into account. You have been warned twice. Limitations of the workaround First of all I assume that you installed LDOM 1.0 in the standard path (/opt/SUNWldm/) otherwise you might need to change the script manually to match an alternate path.
Each guest is using the same kind of devices. The workaround does not yet how to cope with exports of files and partitions to the same guest.
You know how to use dd and some other basic tools.
If you start playing with bind/unbind operations manually and things break, you keep all pieces.
How to This list of operation sounds extremely complex, but it is not and it is required only at the first install time and possibly to update your partition table backups if you decide to change them. The changes to the ldom init script will take to restore the last known to work partion table on each reboot. NOTE: if you fail to follow these instruction and do not use valid configuration entries or backup partitions, LDOM might not start anymore or even core dump. TAKE EXTREME CARE (and learn how to reboot into factory-defaults at SC/ALOM)

1 - get the few files from here. This html file is there too for your convenience.
2 - ldmd_start is the newly modified init script for LDOM. It should be placed in /opt/SUNWldm/bin and made executable. Note that if there is no configuration file or the configuration file is empty nothing will happen and you will be running the exact same script as the original. ldmd_start.orig and .diff are there for your convenience to check that I did not add a root kit ;).
3 - ldom.linux is an example configuration file that you want to place in /etc.
4 - mkdir /.ldom.linux , we will use this directory to store the backup partition tables.
5 - decide what kind of device you want to export.
Follow steps 6 and 7 if you decided to use a full disk as device and skip to 8 if you are using a file 6 - Use the format command from Solaris and make sure to label and format the disk.
7 - Take a copy of the clean partition table.
Example: dd if=/path/to/device of=/.ldom.linux/$guestname-$(basename /path/to/device).format count=1 bs=512
So let say that your guest is called foo1 and you are exporting /dev/rdsk/c1t1d0s2 you will issue the following command:
dd if=/dev/rdsk/c1t1d0s2 of=/.ldom.linux/foo1-c1t1d0s2.format count=1 bs=512
Continue from here if you are exporting a file 8 - Configure your LDOM guest following the LDOM administration guide.
9 - Netboot and install Linux in the guest.
10 - Before rebooting into the installation, halt the guest and unbind it. The unbind is required to unlock the exported device for read.
11 - Take a copy of the partition table that has been created by Linux.
Example: dd if=/path/to/device of=/.ldom.linux/$guestname-$(basename /path/to/device).backup
Following the above example: dd if=/dev/rdsk/c1t1d0s2 of=/.ldom.linux/foo1-c1t1d0s2.backup count=1 bs=512
or
dd if=/path/to/file of=/.ldom.linux/foo1-file.backup count=1 bs=512
12 - Edit the configuration file in /etc that you installed at step 3.
Each line contains:
guest_name disk1 disk2 ...
NOTE: you do not need to add entries for Solaris guests. Only Linux guests are required! Empty lines are skipped, no comments are allowed in the file.
Follow steps 13 to 19 if you are exporting a disk 13 - Restore Solaris partition table:
Example: dd conv=notrunc if=/.ldom.linux/$guest-$(basename /path/to/device).format of=/path/to/device bs=512 count=1
14 - Bind the guest
15 - Unbind the guest again. HINT: this is the most important step here because LDOM disk server now has validated the partition table and it will not check it again.
16 - Restore Linux partition table:
Example: dd conv=notrunc if=/.ldom.linux/$guest-$(basename /path/to/device).backup of=/path/to/device bs=512 count=1
17 - Bind the guest again.
18 - Start the guest.
19 - Enjoy.
Follow steps 20 to 23 if you are using a file 20 - Bind the guest
21 - Restore Linux partition table:
Example: dd conv=notrunc if=/.ldom.linux/$guest-$(basename /path/to/file).backup of=/path/to/file bs=512 count=1
22 - Start the guest.
23 - Enjoy.
This said, the script will allow you to reboot the controller without having to worry about Linux guests and it should ensure that LDOM will always start properly. LDOM stores the status of a guests in the Machine Description and we will use this status to restore the partition tables too. If the guest is in either bind or active status, we will take proper actions to stop/unbind/restore/bind/start. If the guest is in unbind state, we will do nothing because we do not know why is in that state. The script also is not error prone. Failing to stop or unbind the domain, to perform restore partition table operation, might cause LDOM to abort and can require manual fixing but the above information should be enough for any experienced user to recover. Have fun

17 July 2007

Matthew Palmer: The Trials of Browsers

Since I'm a member of the set of people "somebody better suited to explaining it" mentioned in Silvia Pfeiffer's "A Long Story of Logins", I suppose it falls to me to explain what the hell we actually did to make the thing work. A quick recap, for anyone who hasn't read Silvia's article: the Vquence website is a very AJAXy, Web 2.0 style video socialisation site. Since we want the site to be available to all as much as possible, we don't lock any part of the site away behind a "login required" page unless we absolutely have to. An unpleasant side effect of this is that, when it does does come time for you to login, pushing you off to a separate "please login" page is going to be, well, a pest. There's all sorts of state about what the user is up to (it's a web-based video mashup creator, after all) that we need to submit -- but only after the user has logged in. Enter the realm of the Web 2.0 Login. Instead of sending the user to a login page, getting them to login, and then redirecting them back to where they want to go, you just have some sort of popup form that, when submitted to, does a background request and logs the user in behind the scenes. This isn't a new concept by any means -- for example, try voting up or down a link on reddit when you're not logged in. However, most sites that implement this sort of thing (based on our brief informal survey around the office) don't protect the password information in any way -- it goes over the wire as a plaintext HTTP request. We don't like this, so we wanted to send the login form over HTTPS. And there began our problems. The trivial implementation of a Web 2.0 Login page is as you'd expect -- the AJAX stalwart, XmlHttpRequest, POSTing to a handler somewhere that validates the login, sets a session, and sends back some javascript to change the page layout a bit to show you're logged in. We had this working nicely, until we started testing on our staging environment, where HTTPS comes into play... You see, XmlHttpRequest doesn't like making a request to a domain other than the one that the main page comes from -- for security. It also thinks that the same hostname via a different protocol counts as a different domain, for the purposes of this security check. (I can see the theoretical reasoning for it, but it is a bit weird for HTTP to HTTPS transitions) So if you want to POST to https://www.vquence.com/something using XmlHttpRequest, you need to be doing it from a page which is retrieved from somewhere in https://www.vquence.com/ as well. We considered just turning on HTTPS across the board, but that would have all sorts of unpleasant ramifications, so we decided against that. But the problem remained, how do we get the user's credentials to our server in a secure manner with a minimum of unpleasantness? We came up with all sorts of options. This is where the infamy of "bug #93" started -- it's a monster of a bug log. Lots of it is me going "we could do this, but it'd suck, or we could do this, but it would suck". Finally, Silvia (I think) suggested we look at using an iframe. "Eeew" was the general response, but it might at least give us a way to set a part of the page to HTTPS, which we could use as a launching point for our XmlHttpRequest call. While researching how to make this all work (I had, to my great pride, never inflicted an iframe on the world before), I managed to come across a few articles on how you can use a hidden iframe to handle requests instead of using XmlHttpRequest. Basically, the trick is that you do a regular POST on your main page, but set the target of the form to a hidden iframe in your page. A general discussion of the principle is available At the Apple Developer site, and there's also a Rails plugin that implements the concept rather nicely. When I found these, I briefly danced for joy. My quest was over. POST to the iframe, the iframe get some JS back from the server, JS mangles the main page's layout to show the user is now logged in... aaaand profit. Like fun it was. My implementation was short and sweet -- a true work of genius (if I do say so myself). Everything worked like a charm. Until we got it back into staging. Then cross-domain security bit me again. Naturally, if you don't want XmlHttpRequest calls to perform cross-domain, you probably don't want iframes for different sites to be manipulating each other's content either. That's exactly what happened -- the iframe can't manipulate the main page's layout as we need it to. Why I didn't think of this before I charged mightily ahead I don't know. My only defence is that I've never claimed to be a web development guru. Sneaky tricks will defeat any security measure, though. For instance, we control both sites (http and https), so we can send the user back to the unsecured site after login and then that location (still in the hidden iframe) can manipulate the main page layout. Redirect to the rescue! That worked really well in Firefox, even with HTTPS in staging. We were saved. At least until IE came along. Bloody Microsoft, ruining all my cunning plans. IE complains when a HTTPS site redirects (using the Location HTTP header) to a HTTP site. You apparently can't turn this off. I was shocked that Microsoft cared so much about their user's data security -- it's certainly not the first thing I think of when I think "Microsoft". My faith in the world was restored when Silvia pointed me to a workaround for the problem -- if you send the redirect in a <meta http-equiv="refresh"> tag instead of a Location header, IE is more than happy to let it pass. Because obvously a chunk of HTML that says "HTTP equivalence" is completely different to a HTTP header. Sheesh. To snatch defeat from the jaws of victory, after all this brilliant hacking, I managed to make a newbie error with the contents of the http-equiv by setting the content to "0;http://www.vquence.com/blah" instead of "0;url=http://www.vquence.com/blah" (note the url=, because I sure didn't). IE complained by looping infinitely on the source URL, while Firefox just made sense of it and did the right thing. I managed to waste most of an hour of three of us over that little stuff-up. Go me! (Sorry about that guys, by the way) Feeling very chuffed, I went home for the evening. The next morning saw a browser compatibility defect in my queue -- Safari didn't like the new setup. Instead of doing the right thing, clicking on the login button would create a new tab instead of logging in. The fix? Changing the style of the hidden iframe from "display: none" to "width: 1px; height: 1px; border: 0" did the trick. Fark. So much for "hidden" iframes. What's particularly funny is that Apple's own tutorial on hidden iframes says to avoid "display: none" because NS6 doesn't like it, but doesn't mention it's own glaring deficiency in this area. So, what are the lessons learned?

Marc 'Zugschlus' Haber: From the personal Inbox of the exim4 maintainer

The DDs reading this might know the situation: You are subscribed to a gazillion of mailing lists, and spend quite some time answering questions of people using your packages. That’s fine, service to your users. Occasionally, users take great pains in finding out a personal mail address (for example, by googling, and finding the webmasteridiot mail address on my personal web page) to ask their question in private e-mail. This prevents the answers from showing up in mail archives and deprives the public of a possibility to find a solution to this question themselves in the future. Today, I had this happen to me twice. In the morning, I received a question about exim4 in private e-mail. In German. I investigated the user’s problem (which looked interesting enough), found two minor issues in the Debian exim4 packages and upstream exim behaving not as expected. I fixed the two issues in the package and reported the unexpected behavior of exim to the upstream mailing list. I then reported this - in German - back to the person who asked the question. Time from incoming message to outgoing report was like 80 minutes, most of which I spent with this user’s issue. On my personal time. A short while afterwards, I found out that this person has waited a mere eleven minutes before asking the same question on pkg-exim4-users, this time in English. Had I known before, I would have drafted my answer in English as well, to have the answer publicly visible. By doing this double post, the user has deprived the public of my answer. I’m probably going to stop answering questions asked in private mail. I might draft a boilerplate answer along the lines of “I don’t answer questions asked in private mail unless I am being paid to do so. You might be better off by asking one of the numerous mailing lists that are available on the Internet. I read a lot of them, might see your question, and you might get an answer from me. But otoh, there are many more knowledgeable people on these lists, and you’d want them to see your question as well.” Or I just might hit Delete on questions in my private inbox. The “Delete” approach has become more attractive this afternoon after I pulled the following (anonymized) from my personal Inbox:
Great job breaking exim4 on my system with no easy way to fix it.
$ /etc/init.d/exim4 start
Starting MTA:DEBCONFsomethingDEBCONF found in exim configuration. This
is most probably
caused by you upgrading to exim4 4.67-3 or later without accepting the
suggested conffile changes. Please read
/usr/share/doc/exim4-config/NEWS.Debian.gz for 4.67-2 and 4.67-4
2007-07-17 11:31:57 Exim configuration error in line 25 of
/var/lib/exim4/config.autogenerated.tmp:
  malformed macro definition
Invalid new configfile /var/lib/exim4/config.autogenerated.tmp, not
installing
/var/lib/exim4/config.autogenerated.tmp to
/var/lib/exim4/config.autogenerated
I’ve been running exim4 v4.63 for awhile now and only have you bugger
exim4-config it doesn’t work.
I mean, this user has Sorry, but: How stupid can people be? I think I’m going to stop being responsive to users. They’re not worth the blood pressure.

John Goerzen: Progress

While everyone else is excited about their iPhones and whatnot, technology isn't leaving us country dwellers behind. Consider these two recent events:

1) The weeds growing down the middle of the road were gone for a bit. That was surely evidence that the county road maintainer has been by.

2) Word from our letter carrier that we just *may* be able to have our mailbox at our driveway. Someone wants to build across the road near us, and asked about getting a mailbox there instead of almost a mile away where ours is. Apparently if both of us want our mailboxes closer (Terah said "YES", I'm sure), they just may consider it.

That's right, we may need to now have only a 1/2 mile round trip to get our mail.

Back to the iPhone: we do get a signal from Cingular at our place, but I can't help thinking "what's the point?" I don't really need an always-on Internet connection everywhere I go.

15 July 2007

Miriam Ruiz: Cultivation - a game about the interactions within a gardening community

Cultivation is a video game written by Jason Rohrer about a community of gardeners growing food for themselves in a shared space. Jason is also author of Transcend, a retro-style, abstract, 2D shooter already in Debian repositories. The game is cross-platform, and has been released in the Public Domain. Cultivation is quite different from most other games. It is a social simulation, and the primary form of conflict is over land and plant resources. There is no shooting, but there are plenty of angry looks. It is also an evolution simulation. Within the world of Cultivation, you can explore a virtually infinite spectrum of different plant and gardener varieties. All of the graphics, sounds, melodies,and other content in Cultivation are 100% procedurally generated at playtime. In other words, there are no hand-painted texture maps. Instead, each object has a uniquely “grown” appearance. Every time you play, Cultivation generates fresh visuals, music, and behaviors. Cultivation is certainly an unusual game, but that doesn’t necessarily mean it’s good, in Jason’s words. From experience, some people absolutely love it, while others absolutely hate it. It’s intended to be an “art game” after all, and mixed reactions go with that territory. When two sides are fighting, they often ruin the commons for everyone. The game is a metaphor about that kind of situation. Too much fighting destroys the island for everyone. I’ve already finished the packaging of this game, and I hope it gets into Debian repositories soon.

14 July 2007

Steve Kemp: And behold, a pale horse, and he who sat on it, his name was Deat

I've made some progress on the bootstrapping idea :) As a proof of concept I wrote a simple script which will download *all* the required RPM files for an installation of Fedora-Core 6. (i386) This downloads 348 .rpm files, which is about 700Mb. (I'm downloading way more files than I need, because I'm not using dependency-discovery yet....) However the proof of concept works. I can successfully chroot inside the unpackaged directory tree - so I think it is sufficient to persuade me that I can dynamically determine which RPM files need to be installed. This avoiding the problem which rpmstrap suffers from. (ie. having a static list of specific RPM version to fetch.) If you'd like to test my script, hardwired as it is, (did I mention ugly?), then feel free. In terms of requirements you'll need: Note: I'd expect this script to take in the order of 30-40 minutes to run. It is pretty noisy though, so you'll know it hasn't died! The script will live here for a day or two: PS. Don't run this as root. Please.

13 July 2007

Michael Prokop: Find out what users request

One of the coolest features of grml IMO is grml-tips. grml-tips is a collection of tips you can request via a keyword. For example if you want to know how to use grml-x just run ‘grml-tips grml-x’:
mika@meilenschwein ~ % grml-tips grml-x
Start X window system (XFree86 / Xorg / X.org):
% grml-x $WINDOWMANAGER
Usage examples:
% grml-x fluxbox
% grml-x -mode '1024x768' wmii
% grml-x -nosync wm-ng
--
mika@meilenschwein ~ %
So as soon as you invoke ‘grml-x $keyword’ and if the grml-tips collection includes something with $keyword inside you’ll get it. I use that on daily base because all the hard-to-remember command sequences or dangerous commands like mdadm, sfdisk,… are easy to use this way. :-) But how about keywords not being availble in grml-tips collection yet? What about keywords other users request but don’t get a match? Thanks to formorer we have a submit feature within grml-tips since version 0.4.1:
% grml-tips nfs
Sorry, could not find a tip for 'nfs'. :-( 
Do you want to submit the keyword 'nfs' to grml's keyword database?
The grml team will write tips for the most requested and useful keywords.
To use and contribute to this feature you'll need a working networking connection.
No personal data will be transmitted to the database.
Send "nfs" to grml's keyword database? [y N]
Keyword 'nfs' has been submitted to grml's keyword database.
Thanks.
%
Now being the maintainer of grml-tips I can check what users want to get through querying the sqlite database which stores the submitted keywords. Dear paranoid users: by default the keyword is not transfered to the database of course, you have to manually press ‘y’ to submit it. It’s not the default behaviour but an option. And there’s really no personal information stored inside the database, all I can query looks like the following:
$ID nfs grml 1.0-1 Release Codename Sonnenbrand [2007-07-13] 1184261151
Oh and thanks to Nico we also have our 24/7 support slave within the #grml channel:
19:37 <     mika > grml-tips: grml-x
19:37 < grml-tips> matches: http://www.grml.org/tips/index.html#23
And if our support guy does not work as expected:
19:38 <     mika > grml-tips: does-not-match
19:38 < grml-tips> Sorry, could not find a tip for 'does-not-match'.
If you want to submit a tip please mail it to tips (at) grml.org - thank you!
… and once a week I get a cronjob-triggered mail sending me all the keywords without a match. Cool, ey? ;-) All what’s missing now is a bot that writes all the missing tips on its own. 8-) Conclusion: make it easy for your users to submit information you might be interested in - to help your users.

12 July 2007

Uwe Hermann: Tracking GPLv3 projects

GPLv3 logo As you probably already heard, the GPL, version 3 has been released, together with the LGPL, version 3. I haven't yet read the licenses in detail, so I cannot say much about them, but more information is available in the (updated) GPL FAQ. The compatibility table from the GPLv3 Discussion Draft FAQ can be pretty helpful, too. There's a Why Upgrade to GPLv3? text and even a video of Richard Stallman (Ogg Theora, transcript available) introducing the GPLv3, the rationale behind it and some of the changes in this new version. (One nice advantage of the GPLv3 I like is that it's compatible with the Apache license now, btw.) Probably the most interesting GPLv3 resource at the moment is Palamida's list of projects which already switched to the GPLv3, which includes a number of GNU tools (sed, tar, ed, bison, texinfo, cpio, coreutils) and some other major projects such as Samba. Currently the page lists ca. 140 projects which switched. It'll be interesting to see how the adoption proceeeds. My guess is that in a few months it'll be hard to build distributions or embedded (GNU/Linux-based) hardware devices without GPLv3 code...

Next.

Previous.