This is a really stupid (and kludgy) Stupid Lucene Trick: how do you search the full text of your document + metadata without the full text? Simple - you create a separate field (call it fulltext, for example), then populate it with the text of all of your other fields. Voilà! You can now search against "fulltext" for all of the text in your Lucene document without having to know whether, for example, "physical" is in the document body, the abstract, or only in the keywords.
Note that fulltext should be created dynamically from the fields for the particular document, rather than from a fixed set of named fields so you maximize the amount of text you can search against.
And yes, you are duplicating the text of the all of the other fields in this field :(.
As you might know I wrote the Perl Maven Tutorial along with most of the 800 other posts on the Perl Maven site during the past 6 years or so.
It became the most frequently read Perl Tutorial and the site is the 4th most visited Perl-related site after cpan.org, perl.org, and perlmonks.org.
I've received many comments on the individual articles that make up the Perl Tutorial. Some required and immediate fix or answer, but many included suggestions that need a lot more work to implement.
There are also a number of missing articles. Some can be seen as comments in the source of the Perl Tutorial page.
It is time to update the tutorial incorporating the comments made on the individual pages,
filling in holes where some topics have not been covered, and making the whole tutorial more like pages of a book.
I need your help in two ways:
Helping with the content (the source can be found on GitHub)
It appears that one of the more common uses for the CASE statement in SQL is in a 'GROUP BY' or at least a good 80% of the tutorials for SQL I have looked at have it as an example so let see how well the present Driver::DBI handles it.
To start I just add this test to the '60_order_by.t' test case;
I have a piece of Perl containing manifest constants that have the same value, but which signify different things. In my testing, I wanted to make sure I was getting the right one out of my code. That seems to mean changing code to test it, which is anathema to me.
It occurred to me today that if I held my tongue right I could change the values of the constants without touching the code they were defined in or exported from. Holy aspect-oriented programming, Batman!
The trick is based on the fact that what use constant really does is to define a constant subroutine with an empty prototype. Now, Perl will allow me to redefine a subroutine -- grumpily if use warnings qw{redefine} is in effect, and happily if not. So I thought all I had to do was load the module that exported the constant, hammer its symbol table, and voila!
We are delighted to announce The Swiss Perl Workshop 2018. This year the workshop will be held in Bern at Gewerblich-Industrielle Berufsschule, an industrial vocational school. The workshop will be held in English, although of course other languages are welcome.
The workshop will take place on Friday 7th and Saturday 8th of September 2018 and thanks to the generosity of the school the workshop will be free to attend. As the venue is a technical school we hope to attract students and teachers, so this year's workshop may be an ideal place to promote Perl to those who have not yet heard of or used the language.
Please spread the word, register, submit talks, and come enjoy a perl workshop in Switzerland's historic capital city. You will find more details over the coming weeks added to the official workshop site.
Expected--> SELECT CASE WHEN Price < ? THEN ? WHEN Price >= ? AND Price <= ? THEN ? WHEN Price > ? AND Price <= ? THEN ? ELSE ? END AS price_group FROM Products
Generated-> SELECT CASE WHEN Price < ? THEN ? WHEN Price >= ?andPrice <= ? THEN ? WHEN Price > ?andPrice <= ? THEN ? ELSE ? END price_group FROM Products
In the above I see at least fourt problems;
No space between my 'AND' conditionals
The conditional is in lower case it should be coming into the DAD in upper case and
There is no 'AS' between the 'END' and the 'Alias' 'price_group'
The first one should be no problem as this little patch fixes that
Encode is a well known core module in Perl with support for encoding and decoding text from almost any character encoding you can think of. But it's also an old module with a large amount of historical cruft.
With inspiration from #perl on freenode IRC, Encode::Simple is an attempt to at least improve on its interface and usability issues. Rather than an awkward and unintuitive bitmask and the option of clobbering the input data, Encode::Simple exports straightforward encode and decode functions that simply return the encoded or decoded result or throw an exception. For the cases where you want to allow invalid characters or byte sequences, encode_lax and decode_lax are provided.
Encode itself supports many more operations such as partial, mixed, and in-place encoding or decoding, where its options may make more sense, but these uncommon use cases are not supported by Encode::Simple.
As a final note, if you are working strictly with UTF-8, I suggest avoiding Encode entirely and using the excellent Unicode::UTF8, or the related filehandle layer :utf8_strict, for fast and correct encoding and decoding.
Somebody once said, that the power of a programming language is not what it lets you do, but what it lets you do easily. Might be Larry himself who said it, not sure, but I heard it at the London Perl Workshop. I started learning Perl from an old second hand book I found in a charity shop a few years ago. I can't say I am any good at it. While previously I could find lots of resources available, these are increasingly harder to find, more outdated, and less able to address modern use cases. Some folk even suggest it is terminal decline. It would be a pity. It is a powerful language, and using it for me has given me a daily discovery for some feature that I didn't know, and exposed me to a large number of clever folk who can bring a different angle to a problem you have struggling with. To my mind it reflects the versatility of a language that has more than one way to to anything.
Has it really been since August
15th
that I have been mucking about with Case? I guess after almost two weeks I am glad to finally get into the DBI::Driver part of things. As usual to start (well recap really) lets look at this SQL;
SELECT ProductName,
CASE WHEN Price < 10 THEN 'under 10$'
WHEN Price >=10 AND Price <= 30 THEN '10~30'
WHEN Price >30 and Price <= 100 THEN '30~100'
ELSE 'Over 100' END AS price_group
FROM Products
which will translate into this hash ref using my Database::Accessor model language;
Recently, I came across a somewhat-frantic comment on StackOverflow that describes a 2017.01 change to the type of return value of .sort:
"you just can't be sure what ~~ returns" Ouch. […] .list the result of a
sort is presumably an appropriate work around. But, still, ouch. I don't know
of a blog post or whatever that explains how P6 approaches changes to the
language; and to roast; and to Rakudo. Perhaps someone will write one that also
explains how this aspect of 2017.01 was conceived, considered and applied;
what was right about the change; what was wrong; etc.
Today, I decided to answer that call to write a blog post and reply to all of the
questions posed in the comment, as well as explain how it's possible that such an "ouch"
change made it in.
Every year we bring together the lead developers of the Perl and CPAN toolchain! This event was previously known as the QA Hackathon, but in 2016 it became the Perl Toolchain Summit (PTS) to more accurately reflect the scope and purpose.
This is an event where pressing issues around Perl’s toolchain, CPAN, testing infrastructure and much more are hacked on, fixed and improved, and where important issues are discussed and decided on. The focus is the continued support and development of the tools used every day by individuals, organisations, and companies that rely on Perl in Production.
Many improvements in the CPAN ecosystem can trace their roots to this event, including Test2 improvements, the “River of CPAN” analogy, numerous MetaCPAN additions, improvements to the Perl Authors Upload Server (PAUSE), policies on how to handle CPAN distribution adoption and takeover, work on the CPAN Testers service, several consensus documents and much, much, much, more!
Well it why stop a good thing day here in the Moose-Pen
I usually try once a week to do a full regression test on both Database::Accessor and Driver::DBI so I figure I might as well keep that going and have another testing postette again.
Looking at Database::Accessor I see that we had quite a few changes since my last full regression
So I don't forget this - my expanded version of something our Larry Wall once said:
"Looking at Perl code, it is easy to tell whether you are looking at the ravings of a lunatic. With Java, you can be several weeks into the project before you realize that you are dealing with the demented discourse of someone who should be trusted with nothing sharper than a spoon."
The most important addition is a new high-level sweep framework written with Moose. Check out the new tutorial Lab::Moose::Sweep::Tutorial!
Comparing with the older Lab::XPRESS framework, the main new feature is support for block data. This is needed when working with instruments like spectrum analyzers or vector network analyzers which return an array of data in each measurement.
Perl is a programming language created by Larry Wall in 1987. It gained popularity in the 1990’ and was also referred to as the “duct tape that holds the Internet together”. For esthetic and practical purposes I will be referring to Perl 5 in this article as Perl.
Last December it turned 30, an important milestone for every language, 30 years of Perl, 30 years of people and companies from all over the world using Perl.
And I do mean, all over the world, Perl developers are everywhere, from California to Japan, from the Netherlands to Romania. Actually, the most popular countries are United States, the United Kingdom, Germany, Spain, The Netherlands, Japan. Romania is also on the list, but that’s not the point here, the point is that the Perl bug is in Romania and has been for some time now.
Before diving into the local Perl scene there are a few things that should be pointed out about software development in Romania.