I was wondering how you would do string encoding translation in Camomile (the Ocaml Unicode library). Why would you want to do this? Well, for instance, if you get a UTF-16 encoded string and you need to use PCRE on it, which only takes UTF-8 input. This means that you need to translate your string downward so you can match against it.
As Camomile uses functors extensively, you need to know how they work so you can follow the code example below. However, it is fairly straight forward once you get your head around it (it took me a while to figure this out which is why I am putting this here).
Welcome to Perl 5 Porters Weekly, a summary of the email traffic on the
perl5-porters email list. I was in San Francisco this past week at RICON
2012, a conference about distributed systems for developers. It was
organized by Basho who wrote and support the "NoSQL" Riak data
store. I was there mostly in my capacity as an Erlang developer, but
kept a finely tuned ear out for Perl. Unfortunately, there wasn't any
discussion of Perl (or Python for that matter.) Most of the developers there
work on Rails, Scala/Clojure, Erlang or node.js and it was a little
disappointing to my inner Perl nerd that there wasn't much consideration of
implementations outside of these 5 programming languages.
This month's project night focused on Joel Berger's Alien::Base module. The final bugs are either squashed or very close, and we got an introduction to how the whole thing works.
I learned some interesting things about DynaLoader that helped cement the idea that it's an interface on to the system's dynamic linker. I've never dealt with DynaLoader from the Perl side of things, except when it broke, and I would solve those problems in system-specific ways. I learned that DynaLoader could solve those problems in a cross-platform way.
I started writing my own Alien::Base module for libusb, but unfortunately ran out of time. We had some interesting side-discussion on human interface devices and augmented reality.
During a recent trip to Sydney I visited the
Camelot Lounge
. Nothing to do with small children, or arthurian legends, it contains much camel memorabilia. Being a very short train ride (two stops) from the
OSDC venue
, I thought it might be a good place to have a perl gathering as part of the conference. Apologies for poor quality of the the photos below, but you get thie idea. By the way their food is reasonably priced (pizza and pides), and tasty.
Created with Admarket'sflickrSLiDR.
This week we explored another two venues and went to a small vacations: one of the organisers is at his honeymoon and another one goes to YAPC::Brasil. So let's talk a bit about travelling and see the prices to Kiev from different European cities for mid-August 2013, in Euro.
I won't go into the horror stories of people getting yelled at for saying Mojo doesn't support dependencies. Instead, I'll give my opinion on the concept of no dependency, and you could decide for yourself if it relates to Mojolicious or not. I honestly don't care. Obviously, this is not a "don't use Mojolicious" post. In fact, I think it's a cool framework and you should try it out. This post is about my general opinion on the "no dependency" idea. Mojolicious is an example, DBI is another, and there are definitely others (Moose, anyone)?
The whole "NO DEPENDENCY HEAVEN!11" approach to me seems like the PHP "we embedded the code in your HTML!11" approach. Basically, doing something that tries to handle the current situation but in a way that actually ends up counter-productive when technology advances.
I have read several articles, and had several conversations about why people don’t like Mojolicious. I have been meaning to write an article about people’s dislike for Mojolicious for a while now, so I’m going to take this opportinity do so while responding to that article.
Mojolicious is Pro-CPAN
Some people don’t like it claiming that it is “anti-CPAN” and in fact this comes in two flavors. First, they believe that because a tool is available from CPAN that it should be used rather than reimplemented. Second, if one really can reimplement it better, this tool should be forked out of the project and uploaded to CPAN for everyone’s benefit.
While at the Italian Perl Workshop I was talking with a gentleman who does a lot of contract work (and gave me permission to anonymously share this story). Most of his contract work deals with the Web and he's fortunate enough to have worked with quite a few companies who are a bit more sophisticated than the old CGI.pm days. In fact, some of them use Mojolicious, an excellent Web framework that many developers are enjoying. Mojolicious is fast, flexible, robust, and has no CPAN dependencies.
This developer hates working for clients who use Mojolicious. I confess that I was surprised when I found out why. It's an exercise in "unintended consequences".
{
# ... something that needs to be done twice ...
if ( not state $first_iteration_done++ ) {
# ... something that must only happen after the first time ...
redo;
}
}
In general, some form of “if state $flag” can be used as a “have I been here?” idiom that avoids the need to mention the flag’s identifier anywhere else. Without state, one must repeat oneself some distance away at least to declare the flag in whichever outer scope has the appropriate lifetime.
Thank you! Thank you to all who took part in the survey. Your contribution has been greatly appreciated and will help understand better the experience of newcomers in the Perl community.
You can still participate
If you have not filled in the survey yet, there is still time to participate. The survey will be live until October 22 and can be completed by any Perl contributor who joined the Perl community within the last two years.
An older blog post provides some further details about the research project.
Some preliminary results
Here are some of the results drawn from the dataset collected during the first week of the survey.
Number of survey participants:
43 people took part in the survey so far (thank you again). 7 of the 43 people reported to have attended at least one Perl community event and 2 people went through some sort of mentoring while becoming contributors.
We had a bit of downtime on the CPAN Testers last month. Did you notice? I doubt it, as the guys at Bytemark did a wonderful job helping to get us back online. We had a disk failure and with minimal fuss they replaced the disk and had us back up and running within a few days of spotting the problem. Such a far cry from the fiasco of our previous hosting company. Many thanks to all the guys at Bytemark.
Sitting here in the Italian Perl Workshop and have been enjoying the talks and the excellent food. I was thinking about Matt Trout's Data::Query talk from yesterday. In a nutshell, Data::Query lets you write things like this:
SELECT { $_->cd->name }
FROM { $_->cds, AS 'cd' }
JOIN { $_->artists, AS 'artist' }
ON { $_->cd->artistid eq $_->artist->id }
WHERE { $_->artist->age > 25 }
This is very exciting, though it might not be immediately evident why.
One of my many rules of software engineering, born of more than a decade seeing things done the Wrong Way, is that serialization must occur only at the extreme edges of your program. At all other points you should, if possible, deal only with structured data. The lack of it in one crucial area of the Perl MongoDB driver is what made support for Perl 5.8 no longer possible.
This post introduces an HTML parser which is both liberal and configurable.
Currently available as a
part of a Marpa::R2 developer's release on CPAN,
the new Marpa::R2::HTML allows detailed
configuration of new tags
and respecification of the behavior of existing tags.
To show how a configurable HTML parser works,
I will start with a simple task.
Let's suppose we have a new tag, call it
<acme>.
The older, non-configurable version of Marpa, and most browsers,
would recognize this tag.
But they'd simply give it a default configuration,
one which is usually very liberal --
liberal meaning the tag is allowed to contain just about anything,
and to go just about anywhere.
A configurable parser allows us to specify the new tag's behavior
more explicitly and strictly.
I am happy to announce that Alien::Base (GitHub) has seen a beta release, version 0.001. It seems that my design change that I previously blogged about has indeed fixed (well avoided) the problems that I was having supporting Mac.
This is not to say that Alien::Base is quite completed. While I have released two testing modules which are an Alien:: module (Acme::Alien::DontPanic) and a dependent module (Acme::Ford::Prefect) these are very simple modules. To be sure that the API is flexible enough and that the loader mechanisms are robust enough Alien::Base needs to be used in the wild.
This week’s Chicago/WindyCity.pm meeting, our monthly Project Night, will feature (though not exclusively) creating these modules. I personally will work on porting Alien::GSL to the Alien::Base system. I hope that if you are in the area you will consider attending or if not please attempt to wrap your favorite C library using Alien::Base and let me know how it goes.
Computational Social Science lets you compute what a group of people will do given their various levels of motivations (self-interest, wanting to fit in, etc.) Correspondingly, given the outcome Computational Social Science can calculate the varied and sundry motivations that went into creating that outcome.
This is real, solid hard science, with variables and equations and everything -- science with mathematically verifiable results, not pages of dense, hard-to-read prose because we don't actually have the equations to express what we know about the subject in question.
Those of us who have braved the wilds of science fiction will recognize this by another name -- Isaac Asimov's fictional science of psychohistory. Computational Social Science is social science taking the first steps toward becoming a hard science -- and guess what? Hard sciences are where we make the fastest transition from pure science to everyday engineering.
In the first part
I showed some problems and possibilities of the B::C compiler and
B::CC optimizing compiler with an regexp example which was very bad to
optimize.
In the second part
I got 2 times faster run-times with the B::CC compiler with the
nbody benchmark, which does a lot of arithmetic.
In the third part
I got 4.5 times faster run-times with perl-level AELEMFAST optimizations, and discussed optimising array accesses via no autovivification or types.
Optimising array accesses showed the need for autovivification detection in B::CC and better stack handling for more ops and datatypes, esp. aelem and helem.
But first let's study more easier goals to accomplish. If we look at
the generated C source for a simple arithmetic function, like
pp_sub_offset_momentum we immediately detect more possibilities.
Just a brief night post about people that I successfully hired recently. I'd like to publish a screenshot from our corporate Yammer pages, which--if you don't know--is a kind of Facebook for using within a company. My method is much more trustful than the endorsement block recently launched on LinkedIn :-)