Holger Levsen: great timing. not.
Yesterday I booked a ticket for going to C ceres in two days. Today I got ill. Guess I will stay in bed most of the next 24h.
Yesterday I booked a ticket for going to C ceres in two days. Today I got ill. Guess I will stay in bed most of the next 24h.
What seems like eons ago, I ordered one of those SheevaPlug Development Kits. After about six weeks, they got around to shipping it, and then, yesterday, after I assume a tortoise
had piloted it across the country on broken tricycle, it was finally delivered to me.
I booted it up, observed that there was some kind of Ubuntu thing on it, and set myself to correct that problem. Within an hour I
had managed to lock myself out.
Here is something I should have read beforehand.
Thanks to Martin Michlmayr, it is now running Debian
and allowing me to log in.
Here are some steps to follow if you would like to boot Debian off of a USB stick plugged into your Sheevaplug:
setenv mainlineLinux yes
setenv arcNumber 2097
saveenv
reset
setenv bootargs_root 'root=/dev/sda1 rootdelay=10'
setenv bootcmd_usb 'usb start; ext2load usb 0:1 0x0800000 /boot/uInitrd; ext2load usb 0:1 0x400000 /boot/uImage'
setenv bootcmd 'setenv bootargs $(console) $(bootargs_root); run bootcmd_usb; bootm 0x400000 0x0800000'
saveenv
run bootcmd
$ xvfb-run -a make testinstead of a plain
make test. That'll automatically create a fake
xserver, set up DISPLAY and run make test in that environment.
That works well for manually installing modules. When installing using
CPAN.pm you can make things easier by writing a distropref.
First, tell cpan where your distroprefs are. I use ~/.cpan/prefs:
$ cpan cpan[1]> o conf init prefs_dir [...] <prefs_dir> Directory where to store default options/environment/dialogs for building modules that need some customization? [] /home/rafl/.cpan/prefs cpan[3]> o conf commit commit: wrote '/home/rafl/.cpan/CPAN/MyConfig.pm'Now write a distropref for the modules that need an X server and put it into your prefs dir as
X11.yml
--- match: distribution: /(?x:Wx Gtk2 Gnome2 ... other modules requiring an X server )-\d test: commandline: "xvfb-run -a make test"Now the tests for Wx, Gtk2, Gnome2 and all other distributions you list in that regex will be executed with a fake X server. I have yet to figure out how to write a distropref that just prepends to the test commandline instead of replacing it so I won't need to have another pref for all modules using
Module::Build.
Last Thursday, I went to the Social Enterprise summit regional workshop that I mentioned. Apparently, SEC are hoping that ministers Mandelson, Purnell, Byrne and Blears will be at the summit, along with people from various famous co-ops.
I took along some email feedback I received on supporting new blood in social enterprise about needing help to bridge the gaps (financial, social, training) between taking on new members and them being productive enough to break even . Happily, that was echoed and reinforced by other delegates - I shared a table with people from Trinity Community Arts, AvonCDA, Sofa Project, Somerset Co-operative Services and Community Action.
Emboldened by that, I ranted about the Business Support Simplification Programme (which seems to mean that only BusinessLinkSW has any gov.uk money in our region and they re being really poor at co-op support) and I threw a couple of ideological-explosives into the consultation, suggesting that franchising has failed as a way of spreading social enterprise and we need to start offering General Public Licensing of our business models, because we re not franchising businesses and most of us don t want to be. I wonder if that idea will detonate somewhere helpful.
The Social Enterprise Coalition officers had some details of the support programmes that are already announced. One of them is a golden hello where the enterprise gets money when a new person joins. It s run by jobcentreplus. So yesterday, when I was at a Business Link Real help for business event, I asked the jobcentreplus officers there about it: apparently it s useless to TTLLP because all our workers are partners and not employees. I was expecting more support for co-ops from a Labour+Co-op government, but it shouldn t've been a surprise after the budget.
After that, I don t think it s worth posting details of the other SE assistance programmes mentioned: they ll probably turn out to be equally useless for co-ops and I don t want to waste your time. I ll rant about that and the BusinessLinkSW event another day or in another place. Ask me if you want details and I ll put them in a comment or email them.
And in that spirit, it s back to programming for me!
Now when there is already some content, it's time to announce planet
phpMyAdmin. You will find there posts from phpMyAdmin contributors
including Google Summer of Code students, so you might find there what
interesting ideas they have. Please note that this blog does not have
to contain only phpMyAdmin related posts, it's just for all what
contributors do (as usual on other planets).
It currently lives on http://pmaplanet.cihar.com/.
PS: If you think your blog is missing there, please drop me a note.
With everything
that
has been going on of late, I have yet to mention that Khanh Nguyen, a
Ph.D. student in Computer Science at U Mass / Boston, will be working with me
on RQuantLib
as part of the Google Summer of
Code program this year.
We had twenty-two applications to review for the
R project, including three for the
RQuantLib topic I had proposed. Khanh's application was clearly among the
best, and I look forward to helping him do cool stuff over the summer. He
already posted two short emails on the r-sig-finance
and the quantlib-user
lists soliciting suggestions and comments. So if you have comments regarding R
and QuantLib, please get in touch with him or me!
Quoting MSDN on the CSS "clip" property:
As of Internet Explorer 8, the required syntax of the clip attribute is identical to that specified in the Cascading Style Sheets (CSS), Level 2 Revision 1 (CSS2.1) specification; that is, commas are now required between the parameters of the rect() value.... and if you want to support both?I see a few options:
...
In Internet Explorer 7 and earlier (and in Internet Explorer 8 or later in IE7 mode, EmulateIE7 mode, or IE5 mode), the commas should be omitted.
my declarations that
includes a type name, like this:
my Str $x = 'foo';However, that didn't do anything useful, until Vincent Pit came along and wrote the excellent Lexical::Types module, which allows you to extend the semantics of typed lexicals and actually make them do something useful. For that, it simply invokes a callback for every
my declaration with a type in the scopes it is
loaded. Within that callback you get the variable that is being
declared as well as the name of the type used in the declaration.
We also have Moose type constraints and the great
MooseX::Types module,
that allows us to define our own type libraries and import the type
constraints into other modules.
Let's glue those modules together. Consider this code:
use MooseX::Types::Moose qw/Int/; use Lexical::Types; my Int $x = 42;The first problem is that the perl compiler expects a package with the name of the type used in
my to exist. If there's no such package
compilation will fail.
Creating top-level namespaces for all the types we want to use would
obviously suck. Luckily the compiler will also try to look for a
function with the name of the type in the current scope. If that
exists and is inlineable, it will call that function and use the
return value as a package name.
In the above code snippet an Int function already exists. We
imported that from MooseX::Types::Moose. Unfortunately it isn't
inlineable. Even if it were, compilation would still fail, because it
would return a Moose::Meta::TypeConstraint instead of a valid
package name.
To fix that, let's rewrite the code to this:
use MooseX::Types::Moose qw/Int/; use MooseX::Lexical::Types qw/Int/; my Int $x = 42;Let's also write a MooseX::Lexical::Types module that replaces existing imported type exports with something that can be inlined and returns an existing package name based on the type constraint's name.
package MooseX::Lexical::Types; use Class::MOP; use MooseX::Types::Util qw/has_available_type_export/; use namespace::autoclean; sub import my ($class, @args) = @_; my $caller = caller(); my $meta = Class::MOP::class_of($caller) Class::MOP::Class->initialize($caller); for my $type_name (@args) # get the type constraint by introspecting the caller my $type_constraint = has_available_type_export($caller, $type_name); my $package = 'MooseX::Lexical::Types::TYPE::' . $type_constraint->name; Class::MOP::Class->create($package); $meta->add_package_symbol('&'.$type_name => sub () $package ); Lexical::Types->import; # enable Lexical::Types for the caller 1;With that the example code now compiles. Unfortunately it breaks every other usecase of MooseX::Types. The export will still need to return a
Moose::Meta::TypeConstraint at run time so this will continue to
work:
has some_attribute => (is => 'ro', isa => Int);So instead of returning a plain package name from our exported function we will return an object that delegates all method calls to the actual type constraint, but evaluates to our special package name when used as a string:
my $decorator = MooseX::Lexical::Types::TypeDecorator->new($type_constraint); $meta->add_package_symbol('&'.$type_name => sub () $decorator );and:
package MooseX::Lexical::Types::TypeDecorator; use Moose; use namespace::autoclean; # MooseX::Types happens to already have a class that doesn't do much # more than delegating to a real type constraint! extends 'MooseX::Types::TypeDecorator'; use overload '""' => sub 'MooseX::Lexical::Types::TYPE::' . $_[0]->__type_constraint->name ; 1;Now we're able to use
Int as usual and have Lexical::Types invoke
its callback on MooseX::Lexical::Types::TYPE::Int. Within that
callback we will need the real type constraint again, but as it is
invoked as a class method with no good way to pass in additional
arguments, we will need to store the type constraint somewhere. I
choose to simply add a method to the type class we create when
constructing our export. After that, all we need is to implement our
Lexical::Types callback. We will put that in a class all our type
classes will inherit from:
Class::MOP::Class->create( $package => ( superclasses => ['MooseX::Lexical::Types::TypedScalar'], methods => get_type_constraint => sub $type_constraint , , ), );The Lexical::Types callback will now need to tie things together by modifying the declared variable so it will automatically validate values against the type constraint when being assigned to. There are several ways of doing this. Using
tie on the declared variable
would probable be the easiest thing to do. However, I decided to use
Variable::Magic
(also written by Vincent Pit - did I mention he's awesome?), because
it's mostly invisible at the perl level and also performs rather well
(not that it'd matter, given that validation itself is relatively
slow):
package MooseX::Lexical::Types::TypedScalar; use Carp qw/confess/; use Variable::Magic qw/wizard cast/; use namespace::autoclean; my $wiz = wizard # store the type constraint in the data attached to the magic data => sub $_[1]->get_type_constraint , # when assigning to the variable, fail if we can't validate the # new value ($_[0]) against the type constraint ($_[1]) set => sub if (defined (my $msg = $_[1]->validate($ $_[0] ))) confess $msg; (); ; sub TYPEDSCALAR # cast $wiz on the variable in $_[1]. pass the type package name # in $_[0] to the wizard's data construction callback. cast $_[1], $wiz, $_[0]; (); 1;With this, our example code now works. If someone wants to assign, say,
'foo' to the variable declared as my Int $x our magic
callback will be invoked, try to validate the value against the type
constraint and fail loudly. WIN!
The code for all this is available
github and should also
be on CPAN shortly.
You might notice warnings about mismatching prototypes. Those are
caused by Class::MOP and fixed in the git version of it, so they'll go
away with the next release.
There's still a couple of caveats, but please see the documentation
for that.
We have had a quite strange couple of days...
Everything was smooth as usual on Thursday. As I posted here, I cycled to Iztacala to give a talk and back, and basically had a good time. We had heard news some days earlier on the radio that the usual seasonal flu was still present by mid-April, while usually it disappeared by early March... But nothing more.
But Friday morning, as I listened to my usual news program, Aristegui repeated over and over that the Health ministry had ordered (in a press conference at 23:00 the previous day) schools of all levels not to hold activities... Quite unusual, but WTF... Got to work as usual, around 9 AM. The first thing I see in the Institute, our Academic Secretary telling us all to finish our most urgent business and head back home, do not pass go, do not collect $200.
And... During the morning it started sinking in. This is a very weird and somehow scary situation. We are facing -as you all must know by now- a previously unknown strain of flu virus (influenza porcina H1N1B, AFAICT). During the past couple of days, we have seen the scenes we wondered about during the past decade, mainly in South East Asia (with SARS and with bird flu): Everybody is scared, nobody really understands what they are scared of, people do stay at home. The streets are eerily quiet, and many people are seen with masks covering nose and mouth.
I must recognize our federal and local governments are acting very well coordinated (for the first time in probably over a decade, since they were from different parties for the first time). This has been clearly labeled as an epidemic (over 1600 sick people reported at hospitals, and over 100 deceased) and has spread to many of our country's states (as well as to other many countries, although it still seems to be controlled there - But we have got reports from the USA, Canada, France, Spain, Israel and New Zealand so far).
I will most probably spend the next full week at home, as my University (as well as all schools and universities in this city and at least the Mexico, Nuevo Le n and San Luis Potos states) will be closed until May 6th. Of course, sports and cultural activities are all suspended as well. Many (most?) bars and restaurants remain closed.
Today, my parents came from neighbouring Cuernavaca (where no alerts have yet been emitted, but will surely follow), and we went out for lunch (to a nice Yucatan food place, chosen partly as it had very little concurrence and because we could sit outdoors. Yes, I must specially thank them for being as imprudent as coming over here, given the generalized scare... I know there was nothing I could do to prevent them from doing so :-)
And... In this strange climate, I can only thank I am not a party-organizer or anything like that, as I'd have had my plans frustrated. Here I sit next to my laptop, in my halfway-re-windowed house, with a still shrink-wrapped book that looks beautiful (La bicicleta: Rito, t cnica y pasi n), eager to open it (Thanks, Nadezhda! :-* ).
Happy birthday to me. Take off the mask, blow 33 candles, put mask back on. Thankfully there is no cake to eat, as it could be messy with the mask on.
Can you hear the prayer of the childrenAnd when we get to the last phrase, there s a long rest after Can you hear . We sang it the phrase, and with perfect timing as we paused for the rest, was a loud clap of thunder. And after the last word of the song, total silence. Nobody moved for a few seconds, and then applause rang out. A couple of years ago, I was in the audience at a concert in the same building. Ominous weather lurked that day too. Before the concert started, the director said something like this, before giving information about evacuation procedures, should they be needed: We are plains people. We are privileged to see the awesome power and beauty of the weather and nature up close every day. If we should be a little too privileged today, here s what we ll do
on bended knee, in the shadow of an unknown room? Empty eyes with no more tears to cry,
turning heavenward to the light. Cryin Jesus, help me
to see the morning light of one more day. . . Can you hear the voice of the children
softly pleading for silence in their shattered world?. . . Angry guns preach a gospel full of hate
blood of the innocent on their hands. For when darkness clears, I know you re near,
brining peace again. Can you hear
the prayer of the children?
This is about two things that are not robust.
zomg, as of version 0.5.7, can
play libre.fm radio streams without modification.
It does not do this particularly well.
As of today a second type of libre.fm radio stream is available, so I
will give two illustrative examples:
It seems there are plenty of people who do take careful note of my
scribblings, even down to noticing the apparent directory I'm in when I SSH to
not-yet-existent SheevaPlug-based
serial console concentrators. For the record:
Next.