June 2012 Archives

My full YAPC::NA 2012 materials

Now that the official YAPC::NA 2012 talks are making their way online I wanted to post links to all of the relevant material for each talk.

Thanks again to all of you who attended my talks and asked great questions. To those of you watching for the first time, please ask me questions, I will be happy to help (if I can) or discuss my methods/paradigms/simulations.

Baby XS to get you started

A primer for writing XS for people who know Perl and a least a little C.

Modeling Physical Systems Using Modern Object-Oriented Perl

In which I show off my object-oriented paradigms for simulating physical systems; forces and physical objects are just objects, interactions are mediated by coderefs. I also give a simple example and show off some of my real-world simulations.

Further, the source of these talks serve as a decent example of using LaTeX/Beamer for making presentations. So check that out too. :-)

Alien::Base Perl Foundation Grant Report Month 4

Well its that time again. Thankfully the news is getting better once more!

Much of my time which is earmarked for Perl went to preparing for my YAPC talks. I’m glad they went so well; thanks to all of you who attended. I did even get a question about Alien::Base during one of the Q&As; I’m glad to know that people are interested.

The news this month hopefully is that Windows is passing tests! Or it should once some windows tests show up. It passes on the only windows dev box that I have access to.

Also I have begun work on the fixes for the Mac problem I described last month. I still would like to figure out some way to ensure that the linker flag -header-pad_max_install_names is passed rather than ensuring a really long build path is used. Perhaps using the Makefile ENV => Variables trick? Of course that assumes your project uses make and doesn’t clobber variables but appends to them.

Future plan:

This Mac problem has stymied me for a while too long, and I think it might be time (now that windows passes) to move forward. Certainly if the Mac host has the library installed Alien::Base should be able to detect it, the problem is only on the installation side and its being looked at. I really need to start getting some real-world feedback. I have heard from several people that they have projects in mind; I think that assuming the windows build tests do pass, its time to move to alpha phase.

During alpha testing I will want people to start creating their own Alien::MyLibrary modules. I especially need to know where the configuration scheme is not general enough. I do also need to know what is confusing in the documentation/examples so I can clear those up too. Of course during alpha testing I am making no promises that the API wont change, so don’t release your dependent Alien:: modules to CPAN just yet, but please do inform me if you make a new github project or branch using Alien::Base, I definitely want to follow those.

I know I have said it before but the official call to arms should come very soon. The released version will be 0.001. Still if you want to get started now, you have my blessing.

Finally I want to mention that my original grant proposal had mentioned being done by now. Obviously this isn’t the case. However, seeing as I am not being paid by the month (or any other timeframe for that matter), I would hope that seeing that the project is still alive and well should be enough to keep my grant open.


Announcing Math::Mathematica

After coming home from YAPC::NA I have a renewed vigor for coding. Because of that, I decided to brush up one of my modules that I haven’t released, document it and release it to CPAN.

Schwern and others talked about how to bring new people into Perl. For many this means making sure to include women and minorities in events and projects. For science however, I think part of the problem is the inertia of commonly used software. People don’t want to use Perl, because Mathematica makes math easy. True, but it makes programming hard IMO.

So here it is, another in my line of Perl-for-Science modules: Math::Mathematica hopes to make doing science easier in Perl. It basically starts a command-line instance of Mathematica in a PTY and controls the IO to and from it. This allows for easy writing of scripts those people that want the power of Mathematica’s math engine with the power of Perl’s language (something that Mathematica distinctly lacks).

Here is a simple example.

use Math::Mathematica;
my $math = Math::Mathematica->new;
my $result = $math->evaluate('Integrate[Sin[x],{x,0,Pi}]');

returns 2, as expected.

Of course I would prefer that you scientists/mathematicians look into my PerlGSL modules or PDL, however if you need to make a slower transition from Mathematica to Perl, this should help ease you in.

For completeness, the equivalent PerlGSL code would be

use PerlGSL qw/:integration/;
my $pi = 4*atan2(1,1);
my $result = int_1d( sub{ sin(shift) }, 0, $pi );

Reflecting on YAPC::NA 2012

Good morning Chicago. I’m back from a wonderful trip to YAPC::NA 2012 and while its nice to be home, I’m really sad that the conference is over. It was my first YAPC and I’m sure that it will not be my last.

Before I get to my reflections, I want to say that the job that JT Smith(blog post picked because I like it), the MadMongers and the many volunteers and UW-Madison folks who made it all happen. I was so well organized and run, I’m astonished.

Moving on.

I started out a little starstruck. I haven’t been a programmer for that long (my first Perl scripts are dated 2009). I haven’t been around to watch the community develop, so I learned the names of major Perl contributors/community members from the CPAN modules etc. In my mind they sprung from the earth as fully-formed Olympian gods of programmers. It took until about lunchtime before it struck me that they all were really down to earth people and I started talking to as many people as I could. Pretty soon I was having lunch with Andy Lester, Sinan Unur, and Gabor Szabo among other perhaps less well-known, but no less interesting Perl users. I love that this conference gave me these opportunities! SawyerX is totally awesome! MST is hilarious (though I didn’t talk to him in person) and Larry even stopped by our impromptu “Perl Scientists” gathering the first night. I’m sure I’m missing some names that I could drop, but I think you get the point: the big names were there and were as great of people as they are coders/contributors/teachers/etc.

I learned some great things too. I saw Devel::NYTProf in action for the first time and I think I might see if it could speed up some of my more, lets say, “interesting” scientific scripts. I am going to add Data::Printer “awareness” to some of my classes, and I’m going use the concept of a specially-named-semi-private-method-for-awareness the next time I think about the interoperability of different modules (if that doesn’t make sense, look into the _data_printer filter option). I think I have a better handle on when to use Moose Roles. I’m excited about new Perl features (__SUB__++).

I even have a new project; a tryruby-like web-based “Try PDL”, which might-or-might-not use vti’s showmetheshell and might-or-might-not be hosted on Stackato (and even if it isn’t I learned about LXC for sandboxing). Would more people use PDL/Perl for science if they could play with it before installing (the much improved, but still rather tricky to install) PDL module itself? I also need to make more websites for my modules (as mentioned in the last lightning talk session).

Finally, I gave two talks myself and was so excited about the attendance and reactions. The first was about my reseach, and more specifically the methodology that I use to make modeling easier both for the module-author (in this case: me) and the script-author/user (me and others). The room (235, the best room IMO) was full, probably about 30 or so people and they seemed very interested and engaged. Reini Urban even paid me a great complement in front of the whole room (!!!). The full model is available here.

Then I (immediately, though in another room) gave a how-to-get-started talk on XS. I’m glad I didn’t have more time to worry, because the room was bigger and full too, I don’t want to guess how many attendees there were, but it was a lot. I really hope people learned and will be able to use this knowledge as well. The feedback I got was very positive.

So thanks to all of you who attended my talks! You really made my conference even better! The links above contain the PDFs of my slides. If anyone has any questions or would like to hear more about my research, please contact me. (As an added bonus, the LaTeX-Beamer source used to make them is also there! The PGF/TikZ/Beamer modules have started a similar renaissance in the LaTeX world like Moose etc have started in Perl FYI.)

I guess this has become a really long post, but I had such a great time. I can’t wait to relive it, and get even more knowledge (!), once the the recorded talks are posted.


Helping those who allow themselves to be helped

I cannot decide if I was too harsh. I try not to let the usual drone of noobs on SO to get to me. My problem was that the OP is being both ignorant AND demanding. Read the post and let me know, I'm back and forth between being enraged and contrite.

Why full closure support makes Perl great for science

Part of the reason I love Perl is that it has full closures. It makes it really easy for my scientist brain to think of code references as equations. This is why I try to make my scientific software think this way too; PerlGSL is built on this concept. Its especially fun when this allows me to nest functionality to get even more complex behavior.

In this following example I find the Gaussian width needed so that the integral over it on a certain range has a particular value. Yes this is an easier example, but if the function f were more complex, this code would be no worse.

Hopefully this shows some of that power, and some of the reason I am working on PerlGSL.

I will be going into more detail on similar concepts at one of my talks at YAPC::NA later this month. See some of you there?

About Joel Berger

user-pic As I delve into the deeper Perl magic I like to share what I can.