I guess I was inspired by by Bradley Andersen's little perl mod 'ParseCron' do a little code writing in the same vain.
Like I mentioned in my last post there many aspects of sys-adm that boggle my little mind and on of the chief ones is how 'chmod' converts a slew of 3 digits into unix style file permissions.
I get the rwx or - part on the files system that is easy enough. It is how 756 does its majik that addles my brain. I know it is just a sum that add to 7 for full access and 0 for none but I never could remember much more than that. So I came up with this little mod (early days yet but might make it to CPAN in a few days)
It is called ParseCHMOD and you can find the first cut here not much to look at and just something I have thrown together in the lats half hour our so but a start.
After I posted my previous blog entry a couple of things were pointed out to me, to do with my fourth point about ignoring warnings.
It turns out that unreachable code doesn't necessarily produce warnings from Apple-ish compilers like I expected it to. It turns out that in gcc the -Wunreachable-code option doesn't do anything. It's only there because it used to do something but that functionality was removed because it didn't work very well. In Clang, -Wunreachable-code is functional, but isn't enabled under -Wall. All apparently doesn't mean all in Clang-land.
I consider both of these to be compiler bugs.
All the other points I made still hold though, especially the most important one about unit testing and code coverage in tests.
After having done a couple of projects with MongoDB and working on and off on a personal project, I found myself wanting something like Test::mysqld, but alas it did not exist on CPAN. So here it is Test::mongod. It's rough but will get you a throw away instance of MongoDB in a /tmp directory that will be cleaned up when the script ends. The code can also be found on GitHub.
use Test::mongod;
then....
my $mongod = Test::mongod->new; # get a temp db on a random port.
my $port = $mongod->port; # get the port to feed to your client app.
Be aware that depending on your hardware, this will block till the server is listening and ready to receive queries - which could be instant or take several seconds. To monitor startup get the db path and then tail the log file in another terminal.
diag $mongo->dbpath
Now to make some sort of fixture loader. Hmmm... what should it be call?
I am very proudly not a sys admin I am so bad in fact I can't even spell it correctly. This of course has its disadvantages in the perl world where it seems every perl knows what this does.
ls | perl -pe 's!([^_]+)_(.)(.*)!mv $1_$2$3 \u$2\E$3!gio'
and at a YAPC I was the only one in the room that did not laugh at this
Apple's most recent
iOS software update
which fixes a horrible security flaw has been all over the interwebs recently. This is yet another post about it.
Here's the buggy code:
Type::Tiny has been knocking around in some shape or another for almost a year now. It's certainly grown a lot since its first commit. The distribution probably no longer merits the "Tiny" name, though the lead module itself is still fairly lean. There are over 80 distributions that list it as a pre-requisite in some way or another, and more still that depend on those.
So I think it's time to begin planning to stabalize the API. Right now, my plan is:
Well here is a little store from the trenches today that oddly enough does has something to do with Moose and roles.
Well my very talented colleague of mine came up with a very nice little Moose class that nicely encapsulated connecting to and sending messages to and from a Amazon SQS server.
Well we already had a very good application that parsed and assembled messages (Emails, Faxes, PDFs and alike) so I though why not introduce Amazon SQS into the mix so we could send these sorts of messages as well.
Seemed simple enough all I did was change the original module a little
From this
package AmazonSQS;
use Amazon::SQS::Simple qw//;
use Moose;
Attention Speakers! You are invited to submit talks for the 2014 DC-Baltimore Perl Workshop, which will be held on Saturday May 3, 2014, in Silver Spring, MD.
As in previous years, by default talks are 20-25 minutes, which we've found is a sweet spot for most topics. We get a great variety -- enough to get a dose of newness and not overwhelm. We also welcome proposals for more tutorial-style talks of around 50 minutes. We'll take the talks and build out a two-track schedule.
Speakers of all levels are welcome! This regional meetup is great for getting your first taste of giving a community talk, sharing projects or topics that you have experience with, or even doing a first run for a talk you'll be presenting at a larger conference such as YAPC::NA 2014 in Orlando! All Perl-related topics are welcome -- from beginner to advanced, from technical to social.
I mentioned in my last post that I was hoping to be able to give a free public talk in London next month...and now I am happy to be able to confirm that's definitely going ahead.
The evening is being sponsored by Venda and the venue provided by Mozilla.
Special thanks to Tom Hukins, who herded the many cats required to make the
event possible.
Due to some family business this weekend, I haven’t had the opportunity to put my full attention into the next installment of my ever-growing series “Perl and Me”. And I don’t want to do a half-ass job. So we’ll return to our regularly-scheduled program next week.
In the meantime, if you’re interested in a rerun, I was just talking to a co-worker about my (much shorter) series on agile development over on my Other Blog. Might be worth checking out, if you’re into that sort of thing.
It seems that my never ending story of AD&D Moose posts are coming to an end. I have a good bunch of code written and things are working quite well. I did run into a slight problem. If you remember this post where I was adding in the available classes seems I let a cheat get in there.
If a user declares a class before adding in a race this is is possible to get race-character combinations that are not allowed, such as Dwarf Magic-User or Halfling Paladin.
Now I could go back and add in some more if then else logic in my BUILD but this is an easy way to add the required test with only a slight modification of my BUILD.
On my Class and Race attribute I can add in the 'predicate' method to both like this
I use R for data analysis. The power of perl is fascinating and I would ike to know if I can load the stata and csv datasets in perl and analyse them.
I have 64 bit 5.18.2 strawberry perl installed in my machine.
I created Constant::Export::Lazy a while ago to consolidate the main constant exporting module at work into something even better. I've just uploaded a major release which allows for adding all the features that I can reasonably think of being useful for a lazy constant exporting module.
It can now support something like Exporter.pm's %EXPORT_TAGS, along with numerous other improvements. I also toiled a bit at it with Devel::Cover and it has 100% test coverage now. In the progress of achieving that I found a few minor bugs that I fixed.
In implementing this module I tried to avoid adding narrow specific features (like %ENV overrides, or support for %EXPORT_TAGS), and instead added more general callbacks that make those features and others I haven't even thought of yet possible.
For why I needed to write the umpteenth constant creation module on the CPAN instead of using something that already exists see the rationale in the documentation.
This module's already been stable for a while and I see no reason why I'd introduce any breaking changes to it. If you'd like an easy-to-use constant defining module that you can use in multiple mutually incompatible environments give it a shot.
I have been a Mojo::head for a few years now and I have heard alot a good things and bad things over the years. One thing that has always sort of seemed funny to me was the cliam that it taks less than 1 min to install.
Of couse you need a good connection and a fast computer. The are a numbe of demos of this out there and Glen Hinkle even did it live during an intro to Mojo talk.
So my mission tonight was to see if it really does install in a min.
Well Glen was wrong, It took almost 6 mins on my box. But my box is a 6 year old laptop with 2meg and only a 4.5 meg line so by any mesure this was actully fast INHO.
Imagine this scenario: you ran a program to do some (potentially) long-running task. The program has a --verbose or --debug command-line option to print progress report to stdout and/or log file. This time you forgot to issue the command-line option and 10 minutes into it you wonder how the program is doing. You could start over by terminating the program and run it again. But it would be nice if we can get the running program to report its progress.
We can of course. One of the ways is to use Unix signals. We can use either SIGUSR1 or SIGUSR2, which are reserved for application purposes. Here's a sample program:
Sinan Ünür and I have started writing for O'Reilly Programming. I can't speak for Sinan, who has been doing more technically-oriented articles, but I'm taking suggestions for softer topics.
Good morning, this will be about GCL (my attempt to make WxPerl programming fun) and I want alsohear from you if its allright to talk about that at this stage of development on Perl Workshop (one month to go so a lot will change).