Last week I was working on a distribution which includes some XS and also uses Dist::Zilla. I needed to edit a single test, but didn't want to run the entire test suite after every edit. It wasn't immediately clear to me how to do this via "dzil test". I asked in #dzil and within a couple of minutes I got some excellent advice in the form of:
dzil run prove -lv t/my-test.t
If there is no XS in your distribution you can skip the build process and get an even faster test run:
This year I attended my third YAPC. As always, here are my thoughts.
General bits and bobs: I thought the venue was pretty decent. It’s definitely the best hotel showers I’ve ever had: excellent water pressure and never even a hint of running out of hot water. Perhaps they have on-demand heaters. I could have used more open plugs in the room, but that’s a minor complaint. The wifi was pretty awful, as usual—one person even did a lightning announcement suggesting we complain about it. I didn’t see the point, personally. Several hundred geeks, most with multiple devices, plus several dozen spouses, partners, and children,1 all descending on a single location for four days ... hell, that could break anybody’s router. And I don’t think it’s particularly reasonable to ask a place that can comfortably house all those people to maintain a super-network year-round that will only really get used once a year. Just point your laptop at your cell phone instead and move on with life, I say.
Well continuing along with my new chapter for XS Fun. Today I am just going to introduce the Oracle part of the equation and what one has do with OCI and Perl before
Oracle HA (High Availability) Events
A small part of Oracle's HA packages are notification that are sent out when an HA event takes place, This could be a server going down, one coming up one swapping out and a number of others.
Now to actually generate these events one need some specialized set up, first you need at least one Oracle RAC instance with at at least two Oracle Enterprise servers set up with and each mush have HA event notification enable. As well you OCI environment must be set up to allow OCI events and you have to have you system set up for threading.
One day, I decided to find out exactly how much code I was maintaining. Since
perltidy can strip comments and POD, and also normalize the source code to make
a fair measurement, it's a perfect tool for counting Source Lines of Code
(SLOC).
Here's a small shell script using ack, perltidy, xargs, and wc to count
the source lines of code in any number of directories.
ack -f lists the files that would be searched, and --perl searches Perl
files, so we get ack's heuristics for finding Perl files. xargs -L 1 invokes
the following command for every 1 line of input. The perltidy command strips
the pod and tightens up the whitespace and writes the result to stdout, which
wc -l will then count, line by line.
So, as an example, the current Statocles release
has 50% more test lines than source lines:
As communicated at the May round closure, we are accepting grant proposals all the time (Submission link). We evaluate them every two months and another evaluation month, July, is coming.
Here is the July schedule:
July 1: CFP reminder post
July 14: CFP closes for this round
July 15: Solicit public feedback
July 26: Voting
July 31: Announcement of the results
So you have a bit more than two weeks to be considered in the July round.
If you miss the deadline of July 15th, you can still send us your proposal later in July and it will be evaluated in the September round.
My Internet connection at home is not great: it's rather slow and flaky. When I ran minicpan to update my mini CPAN earlier today, the process always seemed to choke on this file: id/D/DG/DGINEV/Lingua-EN-SENNA-0.03.tar.gz: exit with Connection time-out error. The first run I thought it must be my connection and simply re-ran the script. After the second and third and being stuck in the same file, I got curious. Lo and behold, the file is 185MB big!
I then typed this to peek into my CPAN mirror:
% cd /cpan
% find -type f -size +10M
Turns out, there are quite a few files that are over 10M in size. Seeing that I (currently) don't see any need for any of the distributions listed above, I entered:
% find -type f -size +10M -exec rm {} \;
Not too bad, I shaved around 1 GB by doing this (from about 4210MB to 3119MB). This is on a miniscule-sized SSD, so more free space is always welcome.
Danger: Malware Ahead!
Google Chrome has blocked access to this page on perlsphere.net.
Content from www.toothpastefordinner.com, a known malware distributor, has been inserted into this web page. Visiting this page now is very likely to infect your computer with malware.
Malware is malicious software that causes things like identity theft, financial loss and permanent file deletion. [Link ->] Learn more
[2 buttons ->] Go back Advanced
I wasn't able to attend YAPC::NA this year. What a shame!
I still had an opportunity to meet the TPF president, Karen Pauley in person while she was in New York. One of the topics was the Grants Committee and here are my thoughts after the discussion.
The Grants Committee is doing well. The bi-monthly grant cycle got positive feedback and the rule change earlier this year is making good contribution.
One of the most important things we now have within the committee is participation. All of the voting members have been voting to select grants and both the grant managers are working hard. And the committee members have been discussing a lot.
We still have room for improvements with marketing. I am testing something new, which will get the grant program known more. This should go live in a couple of months.
I would like to add a few more enthusiastic volunteers in the committee. I will post an announcement to recruit new people. Stay tuned!
So I am keeping these XS posts in two places here and as a chapter here Hopefully once I am done it will be accepted my the current maintainers of that Github
Chapter 03 - Advanced XS Callback Patch For OCI
Introduction
Now we are going to jump off the deep end of XS programming and do a patch to DBD::Oracle.
Now DBD::Oracle is the poster child of early XSW programming. Starting out
way back in the stone ages starting with something called 'Oraperl.pm' back in 1994 that eventually
morphed into DBI and DBD::Oracle.
Now looking at the DBD::Oracle Code it is shall we say a little special as is not a straightforward call
out to a 'C' or 'C++' library, you are calling out to a very custom 'C' program and then to
a very obscure 'C' library called OCI (Oracle Call Interface).
The conference consists of two days of training (6th and 7th October)
and two days of presentations (8th and 9th October). See program for more
information.
It takes place again at the West Branch Resort in Hancock, NY
(http://www.westbranchresort.com/). If you need assistance to travel there, please let us know.
We are searching for attendees, speakers or trainers and sponsors.
Anyone who has contact to Perl newbies or students, please let me know.
One of the goal of the conference is to introduce new people into Perl, Dancer and Interchange.
Questions and feedback are welcome here or by email.
Still hacking around bash tab completion. Released some utilities like pmpath, podpath, pmless, pmedit (you can find them in App-PMUtils distribution). To use these utilities:
% cpanm App::PMUtils
% complete -C pmpath pmpath ; # this line can be added to your .bashrc
% pmpath [TAB]
% pmpath tex[TAB]
% pmpath text/ansi[TAB]
% complete -C pmless pmless; # do the same for the other utils
(and so on)
You'll notice that I use slash instead of double colon as it should be. And here goes the rant.
Here's the gist of how completion in bash works. For each command, you'll need to issue a 'complete' internal bash command to tell bash how to complete argument for that command. For example:
In my last article I introduced a design technique called Functional core and Imperative shell (let’s call it “FC&IS”). It enables to do isolated testing without using test doubles (mocks, stubs). It’s also said to produce better designs (I’ll let you judge of that).
My post was a bit abstract and introduced quite a bit of vocabulary. Now I’m going to make it a bit more real by showing some code. Writing this code also helps me re-arrange and crystallize my understanding. Here we go!
Well in my last post like almost all other XS post I started out by lamenting the sad truth that there was little in the way or resources for XS in 2010 and things haven't improved much since then.
Well I was wrong. While doing a little research for this post I stumbled onto XS-Fun up on github and was so surprised at what I found I decided to do a quick review on it for today's post.
Well it is new tutorial, less than an year old and a work in progress with three short chapters in POD format.
Well it is worth the read as they introduce the novel approach to drop 'h2xs' from the picture and dive right into actually using XS code with practical examples. So to use the authors own words
Eliminating the use of h2xs and bundling any C libraries we use (that we haven't wrote by ourselves) remove a lot of needless complexity.
I’m pleased to announce the release of Box::Calc 1.0, which is an algorithm we’ve been developing for a few years over at The Game Crafter for packing items into boxes. If you run a shipping / receiving operation, or a web store this module can help you determine which box or boxes to use to fit all the items ordered, how much each box will weigh, etc.
Originally we offered Box::Calc as a web service, but now we’re releasing the full module as open source on CPAN. Enjoy!
Honestly, I don't get it. It seems the organizers of YAPC::NA 2014 have decided to keep total radio silence, so no enemy will know about the event. No blog posts. Hardly any tweets. Even the mailing list was almost deserted.
Then a month before the conference there was a blog post asking YAPC::NA or not which I posted on twitter and to the YAPC::NA mailing list. Not surprisingly some people took offense of me echoing it or calling the whole thing silly. Instead of focusing on the actual issue. The lack of communication.
There was a response to that article in the form of a comment, but still no post on the YAPC::NA web site.
I understand how other things can interrupt the well meaning of people, but if it was an unfixed bug in a piece of open source code, someone could step up and fix it. At a conference, at the Perl conference in NA, I'd hope the organizers would mention they have a time or resource issue. I'd probably even expect the officials of The Perl Foundation to check if the organization of YAPC::NA goes well.
Well I think I will tackle a difficult subject for my next series and that is XS programming or how to add C to you Perl and learn to regret it.
XS programming is not for the faint of heart I will warn you know it is tedious, stressful, unrewarding, undocumented and hard to learn. However if you can get past the first few high hurdles it is well worth the effort.
Now XS programming is not rare you can find it all over CPAN and I can almost grantee if you have ever used Perl to log into a DB then you have used XS.
So it is there and in use every day, it just works and we are happy about that.
Here's another idea that just popped up in my head and can be considered silly, somewhat: autocorrect for tab completion.
bash already has cdspell shell option (enabled via shopt -s cdspell) which can correct directory names for you, so for example if you have a directory named "pictures" and you type "cd picture" or "cd pcitures" it will assume you meant "pictures" and cd to the corrected directory. To be honest I've never used this feature.
bash also has another option called dirspell which can correct spelling in directory name during completion. Try it out with shopt -s dirspell direxpand. So now if you type "ls /ect/pa" and press [TAB] bash will correct it into "ls /etc/pa". Pretty nifty. I'm only recently aware of this option and will turn the setting on for the next few weeks to find out if this is useful.
But the dirspell setting only works for directory/filename and it does not show suggested alternatives. I was thinking more like Google search autocomplete and typeahead suggestion.