London Perl Workshop: last call for talks - deadline this Friday!

The clocks go back this weekend and the deadline of Friday 27th October for your LPW talk submissions is fast approaching!

As you’ve probably seen from earlier posts, we already have some fantastic speakers and subjects lined up, but there’s room for a few more, so if you have an idea you’ve been musing on, now is the time to tell us about it at londonperlworkshop.org/newtalk

Done is Better Than Perfect. Your proposal doesn’t have to be polished - we are happy to provide guidance and suggestions even if it’s just an idea or an outline. Think MVP (that’s Minimum Viable Proposal ;-), get it in ahead of the weekend and we will help you refine it.

We are looking forward to seeing as many of us as possible sharing our experiences and contributing to our community on Saturday 25th November 2017.

Barcelona Perl & Friends: Saturday 4 Nov 2017

This came into my Inbox just now and looked too good to keep to myself ...

Barcelona Perl & Friends: Saturday 4 Nov 2017

friends.barcelona.pm/2017

A free one-day conference for Geeks and Friends

The computer industry is becoming a place where you are trapped in the feeling that you're missing out if you're not using last week's "hot thing" commented on Twitter, and that no one will be interested if you're not talking about the last functional programming lanaguage, new framework, etc.

The fact is that innovations and amazing things are going on in lots of our "out of sight" communities. Come to show us what you've done, how you like to work, what is working for you and what is not, without the feeling that you'll be frowned upon because you say jQuery, SQL Server, Ruby or Windows.

We're the Perl Community. We want to share with you our ideas and innovations, and want to see yours, no matter what technology you use, what gender you are or where you're from.

Some Moose Today

Its a good day for code but a bad one for posts here in the Moose-Pen

I started off today by adding in some 38 new tests to 40_joins.t in Driver::DBI and after one or two runs to get rid of some typos in my expected results they are all passing. So like the title says a good day for code but a bad one for posts as I have nothing to much to report on.

Undaunted I moved into 50_having.t and the first thing I did was rename it to 50_group_by.t as that is a little more SQLish.

After coming up with some 34 new tests and after a few runs to get rid of my usual typos in my expected SQL I still got two errors on the generated SQLthat where far from obvious.

In both cases

Semantic Web/Linked Data

Many of you who have been around computers for as long as I have remember the Semantic Web. It was touted in the late 1990’s and early 2000’s as a way to organise and reason over the Web. This was before the rise of Google and the modern web as we know it today. Mostly, the Semantic Web died because of the problem with Metacrap. However, the idea was resurrected in 2006 as Linked Data. The problem has since been relegated to academia, a few Government projects, like UK’s data.gov.uk, and, interestingly, bio-medical.

Automated testing on Windows with AppVeyor

AppVeyor is a continuous integration service similar to Travis CI, just on Windows. If you have a Perl module on GitHub, it's not that hard to have it run tests automatically on Windows; it's just not well documented.

(The following information was taken from https://blogs.perl.org/users/eserte/2016/04/testing-with-appveyor.html, the AppVeyor documentation, and random trial and error.)

First you need to sign in to AppVeyor with your GitHub account and let it access your repositories, as described on https://www.appveyor.com/docs/.

Then you need to add a .appveyor.yml file to your repository. Mine looks like this:

Cygwin interesting problems

According to this test my module JSON::Parse wasn't working on Cygwin. I have a Windows computer with Cygwin installed, so I thought I would try to compile the module myself. The first problem I encountered was that the cpan shell command didn't work. It would print odd-looking errors and hang up at the following prompt:

What approach do you want?  (Choose 'local::lib', 'sudo' or 'manual')

So I decided to download the module myself with wget and compile it. The next problem was that I hadn't got wget in my cygwin, so I had to install that. After downloading and untarring the file, I tried the usual

perl Makefile.PL

then "make", and got a rather baffling error

fatal error: EXTERN.h: No such file or directory

Tested Joined Moose

So it is little progress day here in the Moose-Pen

Carrying on from yesterday's post I decided to get 57_dad_elements in order so I added in a few more tests;

Lab::Measurement: New lightweight backends for VXI-11 and USB-TMC

The Lab::Measurement project provides Open Source control of Test & Measurement devices with Perl. This post introduces the new Test & Measurement back end modules Lab::VXI11 and USB::TMC. Both VXI-11 and USBTMC are open standards and are supported by most modern T & M devices. They were developed as alternatives to the legacy GPIB (General Purpose Interface Bus). The main purpose of GPIB is to transfer text messages between the measurement PC and an automated measurement device, such as a digital multimeter. Beyond that, it defines various control commands for device triggering, setting end-of-message characters, reading a status byte and much more. VXI-11 and USBTMC provide a high degree of backwards compatibility with these features.

The photo shows the rear panel of an Agilent 34410A digital multimeter. While it is a small and (relatively) cheap device, it supports four different automation standards (GPIB, USBTMC, VXI-11, raw TCP sockets). This is why I used it for most of my testing.

agilent-back-panel.jpg

Don't use until, unless...

In Perl 5, until is a negated version of while. Instead of writing this:

while (defined(my $i = $iter->next())) {
    say $i;
}

Using until allows you to write this:

until (!defined(my $i = $iter->next())) {
    say $i;
}

until is documented under the "Compound Statements" heading of the perlsyn document.

Practice and policy

The thoroughly excellent book Perl Best Practices by Damian Conway (DCONWAY), the Black Wizard of Perl, exhorts us not to use the until control structure at all. The core policy set from the similarly excellent Perl::Critic dutifully implements the book's recommendation by raising low-severity warnings if you use it as a block:

Application Metrics with Yertl

A time series database is a massively useful tool for system reporting and monitoring. By storing series of simple values attached to timestamps, an ops team can see how fast their application is processing data, how much traffic they're serving, and how many resources they're consuming. From this data they can determine how well their application is working, track down issues in the system, and plan for future resource needs.

There have been a lot of new databases and tools developed to create, store, and consume time series data, and existing databases are being enhanced to better support time series data.

With the new release of ETL::Yertl, we can easily translate SQL database queries into metrics for monitoring and reporting. I've been using these new features to monitor the CPAN Testers application.

Joined Moose

Its get on with it day here in the Moose-Pen

After putting on my thinking Moose-cap and reading though some of my notes (and looking at a number of my older posts) the best solution I could come up with was to leave the ability to add a 'JOIN' to an 'UPDATE', 'CREATE' or 'DELETE' statement in.

My reason for this simple if someone wants to use a JOIN is something other than a 'SELECT' and it is perfectly valid command why should my application stop them.

The original DataAccessor code it is written in such a way that you can only do a JOIN on a SELECT as the concept was to have a class that was for 'CUD' actions and one for 'Retrieve'. I would still like something like that and the way I can establish this is with this attribute;

Dancer2 0.205002 released; survey update

Dancer2 0.205002 has just been released and is on its way to your favorite CPAN mirror. Highlights include a number of documentation improvements (thank you, simbabque and ambs!) and the fixing of some lingering and pesky bugs (thanks to Nick Tonkin, Pierre Vigier, and our very own bigpresh, ambs, and veryrusty).

The full changelog is as follows:

vim, Ale, Syntastic and Perl::Critic

As a vim user, I've used Syntastic for a long time. It's a great tool for syntax checking. However, I was recently introduced to Ale . Ale does a lot of what Syntastic does, but it does it asynchronously. The practical benefits are
  • You should experience less lag when editing large files
  • Ale flags problematic lines containing errors and warnings in a gutter, making it easy to find problems
  • Detailed information about errors and warnings appear at the bottom of your buffer
I may actually be underselling it. Ale is almost a drop-in replacement for Syntastic. (At least it was for me). Try it out. I don't think you'll go back to Syntastic once you've tried Ale.

I'd like to point out a few configuration tweaks...

Read the full post at http://www.olafalders.com/2017/10/17/vim-ale-syntastic-and-perlcritic/

Bitcoin XS Modules

Summary

This is a library to allow users to write Bitcoin applications, including SPV nodes, in Perl. The library relies on a C library called picocoin . In order to get the library to work with Perl XS, some of the header files were modified and are located here . This set of Perl modules, the customized picocoin library, and all related dependencies have been compiled into debian packages.

This guide goes over setting up a simple HD Tree, drafting a P2SH transaction, and running an SPV client.

For instructions on how to install libcbitcoin-perl, see this page.

As for the Github page for libcbitcoin-perl, look here.

HD Trees

There are several ways to think about an HD Tree. Probably the simplest way is as a "Wallet".

Background

The Perl module CBitcoin::CBHD acts as an intuitive interface in handling BIP32 objects as described below:

Time to Put my Thinking Moose Cap On

It test postette day here in the Moose-Pen.

Today I was rerunning all my test cases to seen which ones where breaking and I got though all of the test on Database::Accessor and was most of the way though Driver::DBI and then I got stuck on '40_joins.t' with this error;


# Expected SQL--> SELECT people.first_name,
people.last_name, people.id, address.street FROM people LEFT JOIN address ON
people.id = address.user_id WHERE people.first_name = ?

# Generated SQL-> SELECT people.first_name, people.last_name, people.id,
address.street FROM people WHERE people.first_name = ?

Hmm, missing the complete JOIN clause there. Now I do not think I made such a basic error as forgetting to call the '_join_clause' sub in the Driver::DBI so the first place I looked was my test and fortunately the test hash was just a little out of date.

Now with the new test hash;

Perl 5 Porters Mailing List Summary: October 10th-15th

Hey everyone,

Following is the p5p (Perl 5 Porters) mailing list summary for the past week.

Enjoy!

graphql-perl - Mojolicious::Plugin::GraphQL - Mojolicious GraphQL endpoint

Having made a Dancer 2 plugin to easily make GraphQL endpoints, it only seemed fair to make a Mojolicious plugin to do the same thing. That has just been released to CPAN. There is also a sample applet for Mojolicious::Lite.

Sample code from the applet:

6lang Naming Proposal is Good

I think 6lang naming proposal is Good

6lang: The Naming Discussion Update

I'm Perl programmer, not Perl 6 programmer. People seem to think Perl 6 is successor of Current Perl at first time.

It is strange that Version Number is contained in Language Name. We should admit this idea is wrong.

Perl 5 vs Perl 6 never produce any values. Many misleading occur and it damage Marketing of both Perl 5 and Perl 6.

Both children are damaged for a long time.

In Perl 6

Perl 6 is new language, has new paradigm, features, for example Parallel processing.

But Perl name call in our heart that it is traditional and plain old. Perl is King of script language Backward Compatible. Perl 6 is never so.

New Things need New Name. If old name is used, the value of new things is hard to see from normal people.

In Perl 5

Perl 5 wait to upgrade Perl 7. Ruby became Ruby 2, Python became Python 3, PHP became PHP 7. But Perl is Perl 5 for a long time.

Reset is needed from both perspective of Perl 5 and Perl 6.

Perl 7.0 and 6lang 7.0

If both language start to walk at each way, it is good.

How about Announcement of Perl 7.0 and 6lang 7.0.

No Moose Change

Another test postette here in the Moos-Pen today.

To finish off the '30_where_basic.t' test case I decided to add one more test; the function from hell;
(abs((People.salary + .05) * 1.5))*People.overtime+(abs(People.salary+.05) *2)*People.doubletime)
I diligently set that test up and then when I ran it I got

# Expected SQL--> SELECT people.first_name, people.last_name, people.user_id FROM 
people WHERE ((abs(people.salary + ?) * ?) * people.overtime) + ((abs(people.salary + ?) * ?) * people.doubletime) != ?

# Generated SQL-> SELECT people.first_name First, people.last_name Last, people.user_id "User ID" FROM 
people WHERE ((abs(people.salary + ?) * ?) * people.overtime) + ((abs(people.salary + ?) * ?) * people.doubletime) != ?
the conditional part was correct but I was getting the elements left over from my last test. Opps!

proper planing (CP part IV)

After part one (main idea), two (prototypes) and three (sane boundaries of responsibility), I head toward the big picture. How does a project head coordinates planning under a "complete programming" (c) (tm) methodology.

There are many more details about planning in CP I left out for now, because it is already a lot to think about. In the next part I will write about the role of software tests in CP.

About blogs.perl.org

blogs.perl.org is a common blogging platform for the Perl community. Written in Perl with a graphic design donated by Six Apart, Ltd.