Condiment Moose

It is catch up day here in the Moose-Pen.

I was just about to add in the next operator on my, the 'Like' command but before I did that I added a few more tests for the 'in' operator and with this test;

Perl 6 CaR TPF Grant: Monthly Report (June, 2018)

This document is the June, 2018 progress report for The Perl Foundation's Perl 6 Constant and Rationals Grant.


Tangibles

The bonus deliverable "Perl 6 Numerics" Language documentation page was merged to master. It describes all of the available Perl 6 numerics, their interactions, suitability, and hierarchy.

The bulk of work on constants also has been merged to post-release-2018.06 branch, which will be merged to master after this month's release. I wrote 200 spec tests, available in S04-declarations/constant-6.d.t spec file, and about 500 words of documentation to cover this work.

Rationals

Since my last report, I first continued working on Rationals, focusing on three pieces of work that currently reside in car-grant-unreduce branch

  1. Fixing the rare data race and doing some optimizations
  2. Fixing bad math in some ops with Zero-Denominator Rationals (ZDRs)
  3. Attempting a trial implementation where ZDRs are marked with a role, allowing us to improve performance of some operators.

"Marpa and procedural parsing"

The newest post on the "Ocean of Awareness" blog is "Marpa and procedural parsing" : Marpa's procedural parsing is more flexible and more powerful than recursive descent's.

More intelligent searches in Geo::Coder::Free - part 2

Being lazy, I thought to myself, "when using the web interface, why should I need to add my country to the query?". So, using CGI::Lingua which is already available via the VWF system used to build the site, you longer need to do that. From the US, try this:

curl 'https://geocode.nigelhorne.com/cgi-bin/page.fcgi?page=query&q=Rock+Bottom,+Bethesda,+MD'

With VWF it was a minor change:

$rc = $geocoder->geocode(location => $q);

if(!defined($rc)) {

if(my $country = $self->{_lingua}->country()) {

$rc = $geocoder->geocode(location => "$q, $country");

}

return '{}' if(!defined($rc));

}

In Moose

Its is in day here in the Moose-pen

Now that I have a few little API things worked out from yesterday's post I better carry on and do the next two 'operators' 'In' and 'Not In'

My original though was these two operators would now require a little parameter validation like I did for the 'Between' as most of us know the very common form of an SQL 'In' queries one like these two;

SELECT * FROM users WHERE id in (SELECT user_id FROM drivers) ;
SELECT * FROM users WHERE id in (109,100,22) ;
should just be handled by the present type and coercion code in the system but I just read that this form of SQL

SELECT * FROM users WHERE id in (SELECT user_id FROM drivers,22) ; 

Assert::Refute - a unified testing and assertion tool

Unit tests are great. They show that the code was actually designed to a given spec.

Runtime assertions are great. They show that the code is actually running the way it was designed when applied to real data.

Design by contract is a great concept, but it's a bit of an overkill for most projects.

However, sometimes I feel an urge to just rip several lines from a unit test and put them right into production code. Test::More doesn't help here much since my application isn't really meant to output TAP or run in a harness.

So I started out Assert::Refute to narrow the gap:

A Call to Action: Polish Perl 6 First Steps Experience

Read this article on Rakudo.Party

If you follow the updates on KickStarter, you may know the Learning Perl 6 book is nearing completion, with the author planning to submit final manuscript to O'Reilly on June 18th.

What this means is the July's Rakudo Star release will possibly be the release the first crop of readers of that book will be using (the next release after that is in October). I've seen several people say they're waiting for this book to get published before they give Perl 6 a try. Coupled with the marketing the author and O'Reilly will be doing for the book, I expect to see an influx of new users.

For that reason, I'm making a call to action, for everyone to polish the experience of the first steps those users will make in Perl 6.

How to Help?

There are several things you can help with, depending on your skillset. And before anyone protests, don't worry, there's one thing everyone is able to do…

Install Perl 6

A short video introduction to App::rs, the first reference counting CPAN client.

Youtube link.

Fix a Moose

It fix the API (yet again) day here in the Moose-Pen

So as we all know I have been playing with the extended operators over the last few posts and I just notices something in my code;

I can enter a mixed case operator like this 'BeETween' and things will still work. This is good but I think I left a part out on the Database::Deriver side of things and in Driver ::DBI I do this;

elsif (uc($predicate->operator) eq Database::Accessor::Driver::DBI::SQL::BETWEEN) {
I uc or upper case that operator and if I take it out

--elsif (uc($predicate->operator) eq Database::Accessor::Driver::DBI::SQL::BETWEEN) {
++elsif ($predicate->operato) eq Database::Accessor::Driver::DBI::SQL::BETWEEN) {
I will obvioulsy fail my test

More intelligent searches in Geo::Coder::Free

I'm keen to work on more "intuitive" searches for Geo::Coder::Free. It occurred to me, for example, when looking for a local favourite watering hole of mine, that I wouldn't be likely to search for "Rock Bottom Restaurant, Norfolk Ave, Bethesda, MD, USA". Instead, I'd be much more likely to search for "Rock Bottom, Bethesda, MD, USA'.

So I've added support for that. As a proof of concept, I only work on Restaurants, however the Whos On First data includes a (admittedly unsupported field) of sg:classifier which I should be able to use for a more wide support. What that means is that is if a business type is included in the name of the business, I can remove it and anything after that and add it to the database. In simple terms that allows "Foo Hairdressers and Barber's shop" to be indexed as "Foo". And because you don't always know the street name, it's indexed both with and without.

I'm sure there will be plenty of cases were the above scenario doesn't work - I'll monitor Apache logs - but as a start it works surprisingly well, as shown by

curl 'https://geocode.nigelhorne.com/cgi-bin/page.fcgi?page=query&q=Rock+Bottom,+Bethesda,+MD,+USA'

What does a modern blog dashboard look like?

Yesterday, I described how I had approached developing PearlBee by reworking the data models and writing tests. That worked fine until a point, where the pipeline of user interaction was fairly obvious.

For example, it’s easy to write tests for a “reset password” feature. The user is supposed to go to the login page, see a link to reset password, click that. They should then submit their email or username in a form, and get an email with a link to a reset password form. All pretty obvious, since we’ve all used that several times (at least until password managers became popular :) ).

When I moved into the admin section of the website, though, it became a lot more subjective how it was supposed to look like. Not even from a design perspective – from a test perspective. What am I actually testing for?

Dutch Perl Workshop, July 7th

It is me, or is it internet? When you are organizing events, people respond later and later every year. You buy a book on internet, and it is delivered next day. The washing machine dies, but you do not have to leave the house anymore. But meeting organizers can not deliver in a single day.

We need to see each other every once in a while. For me a must; meeting weird Perl people challenges my own ideas. I get so enthusiastic seeing the projects which other people undertake. It gives me energy to work on my own plans. To meet people for Perl, I visit the monthly meetings of the Amsterdam Perl Mongers (great!), all European Perl Conferences, and often the German Perl Workshops. Very cosy events, where I see my traveling family.

Well, in NL we also organize our own yearly Workshop. The best place to meet "local" Perl addicts. Melinda (Damnlie) and me (MarkOv) warmly invite you all. Read more at http://perlworkshop.nl

Not Null Moose

Its yet another operator day here in the Moos Pen

Hmm I could just copy and past yesterday's postette here and and in 'NOT' in the correct places to get today's 'Is Not Null' operator postette but I an not going to take the schlock path today.

As I implied it is the turn of the 'Is Not Null' operator today another very easy one for a postette ad I start with the same test as yesterday and just add Not where needed, no need for that here.

As for the Driver::DBI code I could just add in another 'else if' into that _predicate_sql' sub but I think I will take a little different approach and have one 'elsif' that covers both. Here is the patch

"Parsing with Pictures"

The newest entry in my Ocean of Awareness blog is about the paper "Parsing with Pictures" by Pingali and Bilardi. It describes a new, easier and more natural way to look at parsing. I try it out, looking at Marpa and the Might/Darais algorithm.

Revitalizing blogs.perl.org

About a year ago, I submitted a grant proposal to TPF to revitalize this platform, blogs.perl.org. It was supposed to have taken only a few months, but it's still not ready. In the meantime, I have been completely silent, at least publicly. What's going on? Is it ever going to be delivered?

Indeed, I should have started writing here months ago, with traditional timely updates on the developments on the grant. What discouraged me to do so was that these developments have been somewhat irregular. Some moments of uncertainty on the best course of action, and others of simply not being able to dedicate enough time to it. Still, I assure you, dear BPO reader, the project is alive and well!

In the interest of being more open, then, I'll make a series of posts this week saying all that I've been working on and what's my overall plan for blogs.perl.org and PearlBee.

Let’s start with the beginning.

Simple Linux Screenshot Application in Perl

Shutter, a powerful application for taking screenshots is possibly soon to be removed from Debian, taking with it the last desktop Perl application in that ubiquitous distro. That is a shame, but there is hope, I guess, some brave soul with take up the effort required to make it fit with GTK3s new APIs. That person is not going to be me. I don't have the skills or the time to do this. But hey, I am the author of the world's simplest GUI generator( probably). Surely it can't be that difficult to cobble together a few applications to make the world's simplest Screenshot tool? Does not need to be fancy, but needs to have a ton more features than the basic Screenshot application in Ubuntu, and be generally useful for day to day use even as a proof of concept.

Requirements

Null Moose

It is operator carry on day in the Moose-Pen

Just a quick postette on adding in another operator to Driver::DBI. Today I am adding the 'Is Null' operator. First of course a set of tests to add into '32_where_operators.t' along this vain;

DBD::Oracle Trial release.

tl;dr: If you care about DBD::Oracle at all please test this unauthorised trial
release
.

A very easy way to create XML

Back in 1999/2000 when I was first learning Perl, I read an article by a Perl advocate in which he said he believes Perl would become the best language to do XML with. Having been impressed by Perl’s power and ease-of-use (coming from C and Pascal) I imagined how great it would be if Perl’s strengths and ease of use were applied to XML-processing.

However years passed and I couldn’t find a module easy and intuitive enough for me for processing XML. So in 2006 I made my own pure-perl module for personal usage, called XML::MyXML.

It was so easy even I could use it. And I happily develop it until today.

Among other things (parse XML), it lets you treat XML as easily as JSON.

Here’s an example:

Building a Geo-Coding Database and Website

OK, so this is my first ever public blog, so be patient with me.

I've written a few Perl related Genealogy programs including gedcom (https://github.com/nigelhorne/gedcom) and ged2site (https://github.com/nigelhorne/ged2site). One of the things that these do is to check the validity of your family tree, and one of those tasks is to verify place-names. Of course places do change names and spelling becomes more consistent over the years, but the vast majority remain the same. Enough of a majority to computerise the verification. Unfortunately all of the on-line services have one problem or another - most either charge for large number of access, or throttle the number of look-ups. Even my modest tree, just over 2000 people, reaches those limits.

About blogs.perl.org

blogs.perl.org is a common blogging platform for the Perl community. Written in Perl and offering the modern features you’ve come to expect in blog platforms, the site is hosted by Dave Cross and Aaron Crane, with a design donated by Six Apart, Ltd.