Moose Cracks Case!
It still stuck on Case here in the Moose-Pen
Same sort of story as my last post I as looking at my tests and just cleaning up a few typos and a little perl tidy and I notice the when I have a 'case' like this;It still stuck on Case here in the Moose-Pen
Same sort of story as my last post I as looking at my tests and just cleaning up a few typos and a little perl tidy and I notice the when I have a 'case' like this;Exploring the ecosystem outside Perl, I have found multiple examples of languages and frameworks that require you to implement your classes as an interface + an underlying engine class when you want to mock that class during testing. This is all fine and dandy if the interface can be used as part of multiple classes. However, if the only reason you have an interface is so you can mock this class during testing, then I would call that a language-runtime smell.
If you are never going to use the interface for anything other than mocking, then you are violating both DRY (Don't Repeat Yourself) and YAGNI (You Ain't Gonna Need It). Using interfaces requires synchronizing method signatures between the interface and its classes, thereby violating DRY. If the interface is only used for mocking that class, your are violating YAGNI. DRY and YAGNI reduce your code complexity, making it easier for you to understand your code later (and you always have to understand your code later).
It's been a year since the last stable DBD::SQLite was released. Actually, it's been a year and a half since the SQLite library bundled in the last stable DBD::SQLite was released by the upstream. A lot have happened there, and some here. It's time for you to test them all against your applications/modules, at last.
DBD::SQLite 1.55_07 (with SQLite 3.22.0) is a release candidate of the next stable DBD::SQLite. It has various query planner improvements, optimizations, performance enhancements, and bug fixes, especially on LEFT JOIN queries, IN and OR operators, and WITHOUT ROWID tables. It also supports "row values", that means now you can write a query like this:
UPDATE foo SET (id, text) = (SELECT id, text FROM bar WHERE id = 1);
Follow the links in http://www.sqlite.org/chronology.html, or each of the following links, to see full details.
The Lab::Measurement module stack will be featured with a poster at Europe's largest physics conference this year, the DPG Frühjahrstagung (Spring Meeting) of the Condensed Matter Section, Berlin, march 11. - 16. 2018.
So please come by on Monday, March 12, 2018, 15:00–19:00, Poster B, TT 29: Poster Session: Cryogenic Particle Detectors and Cyotechnique.
If you cannot wait until march, please consider the Perl in the Physics Lab presentation at FOSDEM by Andreas K. Hüttel, my supervisor, next weekend!
Its change my case yet again day here in the Moose-Pen
Yesterday as I had finishing off my tests for the Case class I was just about to move over and start writing up the code for Driver::DBI when I remember that I should have a test or two to ensure that Database::Accessor can use the new 'Case' class and that is passed it correctly down to the DAD.
I am using it right now as a field and I can test by just adding to the '31_elements.t' test case.
Frist I add in just a simple 'case' as I have already tested all the funny permutations in the '15_case.t' test case;Rakudo.js update - NFG, unicode collation and more bugfixes
Rakudo.js has been in bugfixing mode recently.
Rakudo.js now uses NFG (Normal Grapheme Form) semantics in some places.
This means some string operations treat strings as sequences of graphemes instead of unicode code points. Graphemes are "user-perceived characters" (See http://unicode.org/reports/tr29/). This isn't done everywhere yet but it allows us to pass a bunch of roast tests.
Because JavaScript doesn't use graphemes underneath in it's string implementation like MoarVM does using NFG semantics can be much more expensive.
As such in low level setting code we often want to use the native javascript semantics when they are good enough.
To make that a choice I added a bunch of NFG aware op variants like (nqp::charsnfg) so we can pay the price only when it's necessary.
Read this article on Rakudo.Party
Over the past month, I spent some time in Rakudo's QAST land writing a few optimizations, fixing bugs involving warnings, as well as squashing a monster hive of 10 thunk scoping bugs with a single commit. In today's article, we'll go over that last feat in detail, as well as learn what QAST is and how to work with it.
"QAST" stands for "Q" Abstract Syntax Tree. The "Q" is there because it's comes after letter "P", and "P" used to be in "PAST" to stand for "Parrot", the name of an earlier, experimental Perl 6 implementation (or rather, its virtual machine). Let's see what QAST is all about!
Every Rakudo Perl 6 program
compiles down to a tree of QAST nodes and you can dump that tree if you specify
--target=ast
or --target=optimize
command line option to perl6
when
compiling a program or a module:
Its back-fix code day here in the Moose-pen
In yesterday's post-ette I ranted on about how much of a smarty pants I was to use a 'param' in as the type for my 'message' part of a case statement. That was working fine until I blundered across this perfectly valid SQL
SELECT StockID, OnOrderQuantity,
CASE
WHEN Stock - OnOrderQuantity > 30 THEN 'Over Stocked'
WHEN Stock - OnOrderQuantity > 0 AND Stock-OnOrderQuantity <=30 THEN 'Stocked'
ELSE Stock - OnOrderQuantity
END
FROM Stock;
The 'else' in this case is an 'expression' and if I prototyped this out like this
Talk submissions for #TPCiSLC are currently being accepted! Round 1 closing/Round 2 opening Jan 28/29.
We will be accepting proposals for the following session types:
Short Talks (20 minutes)
Standard Talks (50 minutes)
Tutorial Sessions (80 or 110 minutes)
To submit proposals for a talk/presentation, please fill out this form: https://goo.gl/forms/2qxdfgtRsdc6lXBZ2.
We encourage you to submit your talk as early as possible. We will be choosing speakers in an ongoing process, with the final submissions to be accepted no later than March 18th, 2018.
Round 1: January 1st - January 28th, speakers notified by 2/7/18
Round 2: January 29th - February 25th, speakers notified by 3/7/18
Round 3: February 26th - March 18th, speakers notified by 3/28/18
Final Speaker Lineup Announced: April 1st, 2018
Apply at https://goo.gl/forms/2qxdfgtRsdc6lXBZ2
More information at https://perlconference.us/tpc-2018-slc/cfp/
I started down this particular rabbit hole when (a) I had to check for date range overlaps when worrying about scheduling appraisals; and (b) my attempts to use SQL BETWEEN resulted in complicated, hard-to-read SQL.
Now you would think that BETWEEN should give you easy-to-understand SQL for date ranges. Maybe in the hands of others BETWEEN does, but for me by the time I accounted for all of the cases the BETWEEN-based SQL date range overlap detection got more complicated than I thought it needed to be. So I drew up some diagrams, which eventually led me to the realization that this:
dateA.start <= dateB.end AND dateB.start <= dateA.end
is all that you need. No BETWEEN needed, simple to read, and should work in any useful dialect of SQL.
I just wrote a small post A Simple Telegram Bot in my blog... with a tiny introduction to Bot::ChatBots::Telegram. Comments more than welcome!
It's explain post-ette day there in the Moose-Pen
As I reviewing some of my code for 'Case' statements I had chanch to stop and think about why I was using a Param class for the message on a case. Right now I have something like this;
{
left => { name => 'Price', },
right => { value => '10' },
operator => '<',
message => { value => 'under 10$' }
},
Before I had that just as a simple string like this
message => 'under 10$'
Abusing Multiple Dispatch Creatively is avallable on my blog for perusal. Comments and questions welcome as always.
Hey everyone,
Following is the p5p (Perl 5 Porters) mailing list summary for the past week.
Enjoy!
This month, I was tasked with implementing FIDO/U2F support for two factor authentication for a client. U2F two factor authentication requires a FIDO/U2F hardware key that you insert into your devices USB port and press a button to complete two factor authentication. There are many different vendors that make these devices, such as Yubikey etc. Thanks to the excellent Authen::U2F module by CPAN author ROBN, and Google's u2f-api.js library, implementing support for this proved to be fairly straightforward, but the process for doing this is not the point of this blog post.
The point of this blog post is that, at the time, there was no easy way to write any kind of automated tests for this. As a result, I ended up writing Authen::U2F::Tester. Authen::U2F::Tester acts like a virtual hardware device to complete FIDO/U2F registration and authentication (known as signing in U2F terms) requests.
Its test post-ette day again here in the Moose-Pen
I guess I am following a very predictable pattern The weekend is here and I just do a post on test results. Well why spoil a good thing?
Since my last test round I have changed a good number of things about but I am fairly sure that Database::Accessor is in good shape though I am not looking forward to see what sort of state Driver ::DBI is in.
As I suspected there was only very minor problems with Database::Accessor;
Looks like you planned 2 tests but ran 6.
t/15_case.t ................. Dubious, test returned
I just have to update that test count and now I get
You probably have read a recent Open Letter to the Perl Community. The letter has generated a lot of response (173 reddit comments as I write this). Unfortunately, a lot of the responses are quite negative and do not match my understanding of the letter.
I figured I share my interpretation of the words and if that interpretation does not match the author's intent, I hope my interpretation captures the mood of the community on the matter.
The first thing the letter talks about is what it calls a "radical idea". The suggestion is for Perl 5 compiler to upgrade its backend. Instead of the current Perl VM the perl
compiler uses, it would be ported to NQP compiler toolkit and will support all of the backends NQP supports, which currently is MoarVM, as the leading option, with JVM and JavaScript backends at various stages of completion as alternatives.
We are pleased to FINALLY bring you the news everyone has been waiting for!
It is with great enthusiasm that we happily announce The Perl Conference in North America, 2018 will be held Sunday, June 17th through Friday, June 22nd at the Little America Hotel in Salt Lake City, Utah!
The main event will run from Monday, June 18th through Wednesday, June 20th. Master Classes, training, and other activities will be held on the 17th, 21st, and 22nd. We highly encourage you to attend all days, but especially look forward to seeing you at the Main Event.
This year’s website is already live and can be found at https://perlconference.us/tpc-2018-slc/.
Call for Participation is live at https://goo.gl/forms/PkYHWD3B4vUKZLrW2. Please consider submitting a talk!
Registration will also be live February 1st, so watch out for that!
Keep watching for additional announcements.
#TPCiSLC
During the ongoing development of graphql-perl, I have found it valuable to generate data structures, and to compare those with expected values. Often, these have been highly detailed rather than a subset, because I wanted to know when anything changed.
When, however, something does validly have to change, it might change quite a few "expected" outputs. If those all need updating manually, that is a lot of repetitive activity. What if the computer could do that instead? What if Perl had "snapshot testing" as used in JavaScript frontend development, most popularly in Jest?
use Test::Snapshot; my $got = function_generating_data(); is_deeply_snapshot $got, 'test description'; # could also be in a subtest
blogs.perl.org is a common blogging platform for the Perl community. Written in Perl with a graphic design donated by Six Apart, Ltd.