Re: Geolocation services: what's good, what's not?

2014-12-03 Thread James Laver

 On 3 Dec 2014, at 01:18, Peter Sergeant p...@clueball.com wrote:
 
 The first question I'd ask anyone considering using anything other than
 MaxMind's Geo2IP product is Why aren't you using MaxMind's Geo2IP product?

Seconded. Cheap (I expect you can get away with the free dataset for this 
purpose!), great quality and easy to integrate.

James


Re: windmill blades turning?

2014-10-17 Thread James Laver
On 17 Oct 2014, at 09:02, Nicholas Clark n...@ccl4.org wrote:

 Single Malt not Malt beer!
 
 I wasn't really aware of what malt beer is. Having now looked it up, most
 definately, malt whiske?y.

When I lived in Shepherd’s Bush, it was everywhere. I think I’ve only ever seen 
one person with a bottle, mind.

 Although a pint of scotch is always an option, in the right parts of the
 world.

I believe lathos described it as a london.pm drinking game called “have a shot 
every time you have a shot”.

James


Re: Getting the latest related record from a SQL DB

2014-10-10 Thread James Laver

On 9 Oct 2014, at 22:36, Abigail abig...@abigail.be wrote:

 This assumes no artist releases two albums at the same time.

Not really, it’s just that in that case it will only return one, which is 
probably acceptable behaviour.

But that’s why the declarative nature of sql is brilliant, I can tell you 
exactly what it will do without running it.

James


Re: Getting the latest related record from a SQL DB

2014-10-10 Thread James Laver
On 10 Oct 2014, at 16:37, Abigail abig...@abigail.be wrote:
 
 MySQL disagrees with your assessment:

Of course it does. Because otherwise I might have had a point.

While we’re at it, did I make any egregious spelling errors?

James


Re: Schwartzian transform

2014-08-13 Thread James Laver
On 13 Aug 2014, at 11:12, Alex Balhatchet ka...@slackwise.net wrote:

 D'oh. Thanks for schooling me on 'map EXPRESSION' gents. I do vaguely
 remember seeing that before, but I never use it so I completely forgot
 about it :-)

It’s amazing what you can fit into an expression (especially with parens), and 
the expression form runs a little faster. grep EXPR is also really useful for 
doing regex matches over a list and it becomes more obvious what it’s doing at 
first glance.

James


Re: [ANNOUNCE] London PM Leadership Change

2014-08-09 Thread James Laver

On 8 Aug 2014, at 23:53, Sue Spence virtually...@gmail.com wrote:

 Thank you.  I didn't quite follow the last sentence, though.  Daves and
 Women are fairly well understood collections of individuals with no
 observed overlap (so far).  The other two terms are generally understood to
 be roughly equivalent. :-)

I think he was asking how women stack up against Daves in the subset of 
“London.pm leaders”.

Daves have almost certainly got that one nailed, surely?

James


Re: [ANNOUNCE] London PM Leadership Change

2014-08-09 Thread James Laver
On 9 Aug 2014, at 09:31, Dave Cross d...@dave.org.uk wrote:

 It's one-all surely?

Are you seriously saying that you’re the only Leader we’ve had called Dave? 
That seems… implausible, given Dave distribution.

James


Re: Deploying perl code

2014-07-25 Thread James Laver

On 25 Jul 2014, at 08:52, Ben Tisdall b...@tisdall.de wrote:

 However, I would urge you to spend a day each investigating Ansible 
 SaltStack, the latter in salt-ssh mode if you want to make a direct
 comparison. Both of the aforementioned tools do ad-hoc remote
 execution, task orchestration and configuration management.

Ansible I do like for the most part, but there are a few sharp edges. I don’t 
think it was usable up until they put out 1.3 (was it 1.3? it’s been a while 
since i’ve written a playbook) which added a bunch of useful stuff in the 
standard library — I was running out of git master for ages. I don’t think it’s 
the right solution for this case, though.

Salt: just no. Really no. I’m really surprised to see a recommendation for it, 
because it’s a terrible piece of software.

James


Re: Deploying perl code

2014-07-25 Thread James Laver

On 25 Jul 2014, at 09:40, mascip mas...@gmail.com wrote:

 and the idempotence: you can run a playbook as many times as you like, it 
 should
 have just the same effect as running it once (true for most Ansible things).

That’s in stark contrast to my experiences. I found ansible requires you to 
think about the side effects of everything so that you can write idempotent 
code. Where the default puppet library and constraint resolution mode of 
thinking basically gives you the idempotence for free, ansible pushes the 
responsibility back to the developer. Chef is even worse at this.

Without idempotence for free, the only compelling reason to use it over a shell 
script is the reusable roles.

James


Re: Deploying perl code

2014-07-25 Thread James Laver

On 25 Jul 2014, at 11:54, Andrew Beverley a...@andybev.com wrote:

 The main problem is that it seems to be a victim of its own success:
 there is a huge backlog of merge requests. I'd like to provide some
 simple patches to a couple of modules to make them work better for me,
 but have little hope that they'd be merged this side of Christmas. I
 provided a really simple patch a while ago - it's not been touched and
 now no longer merges cleanly.

I won’t even try and submit a patch after my experience reporting a 
documentation bug. I was at the time regularly tweeting with their CTO, so I 
let him know on twitter. He then pointed me at the bug tracker, where I 
proceeded to file my bug. Immediately, ‘ansibot’ informed me that my bug would 
be closed in a few days if I didn’t reformat my bug to correspond with their 
designated format for bugs, which included such things as “steps to reproduce” 
(because you know, we all have difficulty reproducing documentation bugs). I 
think the only way I actually got that doc bug fixed was by complaining loudly 
and repetitively on twitter about how ridiculous their processes are, but they 
showed absolutely no willing to make it easier to contribute towards their 
projects, so I’m showing absolutely no willing to help them grow their company.

/j


Re: Deploying perl code

2014-07-24 Thread James Laver
On 24 Jul 2014, at 17:25, David Cantrell da...@cantrell.org.uk wrote:

 I'm looking for tools that will make it easy to go from a bunch of code
 in a release branch on github to an updated bunch of servers, with
 minimal downtime. If it matters we're using Debian.
 
 Is this the sort of thing that puppet and chef are for? If you've used
 them are they as awesome as the hype makes out, or will they just push
 me into the same murderous rage as our current bunch of incomplete shell
 scripts do?

Puppet/chef isn’t going to work terribly well for this model, imo. I suspect 
what you’re looking for is capistrano ( or Tak, the perl equivalent (and 
mst-ware!) ). Puppet is *shitty* if you’re wanting to deal with anything to do 
with versioning - it makes you go set up a repository server where you pin the 
versions by hand.

I’m always going to recommend you build an app-specific perl and deploy that 
via rpm/deb, but whether you should build an os package of your code, well, 
depends on your code. I’m thinking from the sound of this, capistrano would be 
a better fit.

And if your jenkins isn’t already singing the single-button deployment song, 
make it do so*.

James

* My company provides consultancy on such matters, if such a thing would 
interest you and your budget has increased since the last time we spoke about 
it ;)


Re: Deploying perl code

2014-07-24 Thread James Laver
On 24 Jul 2014, at 18:59, David Cantrell da...@cantrell.org.uk wrote:

 On Thu, Jul 24, 2014 at 06:34:08PM +0200, James Laver wrote:
 
 And if your jenkins isn?t already singing the single-button deployment song, 
 make it do so*.
 
 That does, of course, depend on our code being easily deployable. We're
 a long way from that at the moment. It's something to consider once
 I can type 'myappdeploy live' and be confident that it will Just Work.

Then I’ll double down on my capistrano/tak recommendation. If that’s what you 
want, it seems like the right tool for the job. Cap is ruby, so perhaps Tak may 
be more what you want. Or not. I don’t know.

James


Re: [ANNOUNCE] Reminder: Tech Meet this Thursday 7pm at Conway Hall

2014-07-23 Thread James Laver

On 23 Jul 2014, at 10:09, Vytautas D vyt...@gmail.com wrote:

 All the trafficparking aside, there are quite a few of us coming from
 southampton.pm, hence it's much cheaper option..
 

I would really consider driving to “much closer” and finishing the journey off 
with public transport. It will save congestion charge and dependent on where, 
probably parking as well.

James


Re: Interview - a Dancer in London:)

2014-06-26 Thread james . laver
‎Be careful of yaks. I went to write some blogging software and I've made 10 
modules releasable since, but still no blog.

James

Sent from my BlackBerry 10 smartphone.
2. From user requirement to open source project: the birth of a CPAN
module.

Andy





Re: Character encodings and databases

2014-06-19 Thread James Laver

On 19 Jun 2014, at 15:58, Andrew Hill london...@welikegoats.com wrote:

 1. Data is not being stored in the database as UTF8 - not sure how to check 
 when Perl is the only tool available to query it
 2. Conversion is occuring in the DBD driver

Yes. I don’t know the oracle version of it, but many DBD adapters provide a 
method to set the charset, or a magic SQL command you can execute.

James


Re: Evaluating user-defined conditions

2014-06-10 Thread James Laver

On 10 Jun 2014, at 09:26, Andrew Beverley a...@andybev.com wrote:
 
 I'm happy to be restrictive to the user, and only allow straightforward
 strings in double quotes. So anything else is removed or not allowed,
 and the strings in quotes are checked as above.
 
 I would not be surprised if I've missed something though!
 
 Andy

I was sort of hoping that the not too subtle hints that using eval is a bad 
idea would pay off. Apparently not.

Perl is quite complicated. You’ll keep missing things until you’re sick of 
patching security holes. Don’t do it.

James


Re: Evaluating user-defined conditions

2014-06-09 Thread James Laver

On 9 Jun 2014, at 12:39, Abigail abig...@abigail.be wrote:

 In short, Safe.pm may be the answer, but depending on who your users are,
 it may be overkill, or still contain too many hooks for an attacker.

In short, if you trust the input, just eval() it, and if you don’t, you want a 
parser.

You might consider transforming it automatically into postfix notation and 
building a really simple stack machine if you just want basic arithmetic and 
placeholders. Otherwise, I can recommend Parse::RecDescent. Perhaps you can be 
cheeky and get them to write some yaml like this:

operation: +
with:
  - 1
  - operation: -
  - with:
- 2
- operation: *
- with: [3,4]

Not very user friendly, but very easy to work with. It depends how much effort 
you’re willing to put in and whether you trust the input.

James


Re: Module namespace for projects

2014-05-22 Thread James Laver
On 22 May 2014, at 09:59, Andrew Beverley a...@andybev.com wrote:

 Hi guys,
 
 I'm creating a Perl project that I hope to eventually release (a Postfix
 filter to add signatures to outgoing emails). My aim is to eventually
 release it as a Debian package.
 
 A stupid question, but I'm a bit unsure about how I should define the
 namespace for my project's modules. Do I need to slot any program
 modules into the CPAN namespace?
 
 So, for example, I'll have a module to manage all the database aspects.
 Let's say the program will be called emailsig and I use Emailsig::DB
 for the database queries. Presumably the module Emailsig::DB would
 eventually need to be installed under /usr/share, so should I actually
 be naming the module something like Email::Emailsig::DB?
 
 Following on from the above, should I then be uploading the modules to
 CPAN?
 
 Grateful for any advice!
 
 Andy

Hi Andy,

First thing I’d say is give your project a short-ish name so that if you do 
release it to the cpan, you won’t die of RSI.

Second thing is to pick a root Module name that doesn’t  clash with something 
in cpan. Other than that, don’t worry. So you’d still be able to have 
Emailsig::DB. Besides, I wouldn’t worry about eventually now, and when you do, 
I’d expect you’ll decide there are better approaches than what you describe.

If the modules are something you think would be useful to someone else, then 
please do upload them. Or at least make them easily available on github.

James


Re: emergency social meet June 11

2014-05-20 Thread James Laver
On 20 May 2014, at 13:43, Randal L. Schwartz mer...@stonehenge.com wrote:

 And is this mic on?  Or am I drinking by myself? :(

Despite the fact you’re a supercite quoter (*g*, *fist shake*), I’m liable 
to be up for it if reminded much closer to the time.

James


Re: Finding the intersection between two regexes

2014-04-21 Thread James Laver

On 21 Apr 2014, at 09:45, Dirk Koopman d...@tobit.co.uk wrote:

 This may be related to the question I asked recently about turning (up to) a 
 few hundred REGEXes into one giant REGEX. The goal being to test all those 
 disparate REGEXes in the most efficient way possible on a string.

Sounds like an implementation detail.

My reading of the problem was this:

package Evil;
use Moose;
has regexen = (
  is = ‘ro’,
  default = sub { [] },
  traits = [‘Array’],
  handles = {
add_regex = ‘push’,
res = ‘elements’,
  },
);

sub go {
  my ($self, $datum) = @_;
  for my $r ($self-res) {
return 0 if $datum !~ $r;
  }
  1;
}  

__PACKAGE__-meta-make_immutable;
1;
__END__


Re: XP-Replacement for Parents

2014-03-28 Thread James Laver

On 27 Mar 2014, at 23:42, Wendy G.A. van Dijk nl...@wendy.org wrote:

 Scanners  I never had luck with scanner support on Windows XP, always 
 stupid errors.  This behaviour of idiots working on drivers at the scanner 
 manufacturers is continued for support in Ubuntu.  It just sucks always.  
 Almost none of the extended options promised, ever work for me.  Not back 
 than in XP, and not now in Ubuntu.  I just have to scan my shit to a USB 
 stick, and copy the files to my computer later.  Universal law of 
 conservation of suckdom.

(slightly OT…)

Scanners and printers are the source of most of my historical frustrations with 
computers.

I’ve finally achieved hardware peripheral nirvana by buying a Scansnap S220m 
(sheet-fed) and a cheap lexmark laser and plugging them into my mac, whereupon 
scanning becomes “launch scansnap software, hit button on front of scanner” and 
printing just works. Before this, I more or less gave up because I’ve never had 
much luck. The part where software has to touch the real world is where it all 
goes wrong.

James


Re: You make a lovely teddy bear

2014-03-28 Thread James Laver
On 28 Mar 2014, at 12:18, Mallory van Achterberg stommep...@stommepoes.nl 
wrote:

 On Thu, Mar 27, 2014 at 04:37:35PM +, David Cantrell wrote:
 So I'd like to thank you all for being my teddy bear:
  http://cm.bell-labs.com/cm/cs/tpop/debugging.html
 
 
 I thought it was called rubber duck, for some reason...

Also: cardboard man. I used to keep a rubber duck on my desk for this purpose, 
and a former boss used to make a great cardboard man despite knowing nothing 
about programming (he was smart, just lacked programming knowledge).

James


Re: XP-Replacement for Parents

2014-03-27 Thread James Laver
On 27 Mar 2014, at 12:07, Alex Balhatchet ka...@slackwise.net wrote:

 On another topic if you want something that looks like Windows XP but
 acts like Ubuntu I've read good things about Lubuntu[2].

In this vein, many Linuxes ship LXDE now. My old favourite foresight does, but 
there aren’t as many packages for it as there used to be, sadly.

James


Re: XP-Replacement for Parents

2014-03-27 Thread James Laver

On 27 Mar 2014, at 17:01, Smylers smyl...@stripey.com wrote:
 Yeah, if I end up doing this in person that'd be a sensible way to
 proceed.

Or even otherwise. Ubuntu has built in VNC support. If you can walk your mother 
through setting up reverse SSH tunnel*, you’d be able to do it for her, 
remotely.

James

* Well, it’s only one command. You’d need a bounce box though.


Re: Web scraping frameworks?

2014-03-04 Thread James Laver

On 4 Mar 2014, at 22:10, DAVID HODGKINSON daveh...@gmail.com wrote:

 For what I'm thinking, a way of relating named divs (and lists of) on
 a page to the hash elements needed for poking into DBIx::Class.
 
 As for Web::Scraper, it's Miyagawa-ware, so definitely worth looking
 at.

Sounds like what you actually want is a handful of app-specific lines of code 
around HTML::TreeBuilder. You can fetch with LWP (maybe LWP::Simple if your 
needs are small) or WWW::Mechanize for more complex stuff, or whatever else.

FWIW, last time I got involved in web scraping, this approach worked quite well 
and while it’s not immediately reusable, it’s pretty straightforward.

James


Re: Web scraping frameworks?

2014-03-04 Thread James Laver

On 4 Mar 2014, at 23:15, Hernan Lopes hernanlo...@gmail.com wrote:

 Another usual problem is data coersion, it can be done at the moment data
 is read. Or, it can be right before the moment data is written/saved. Of
 course the latter is probably the best option in most cases.
 
 The creaton of the crawler for each site must be as fast as possible and
 with the less hassle, ie, data coersion, encodings problems, parsing data
 according to content types if each crawler must implement all that, its not
 going to be fun. Its going to be a nightmare.
 
 The web scrapping frameworks exist to take care of all those parts and
 simply dispose objects your recipe can use to scrap each site already with
 the correct encoding and parsed module.
 
 Imagine if you read prices, and every time you read a price $ 20,000.00
 you must coerse it into 2.00 That operation can be done for each
 site/template which would not be fun. Better just grab $ 20,000.00 and
 before writing on database, coerce into 2.00. This is more reusable.
 and if needed it can evolve into better parsing methods.

S, $startup is importing data from an external webservice which is actually 
json (but it’s so shit it may as well be screenscraping). We elected to clean 
it up on entry. It really simplifies the massive amounts of other processing 
that happen down the line. In fact, I’d say it’s just not doable any other way.

James


Re: sub signatures coming

2014-02-25 Thread James Laver
On 25 Feb 2014, at 03:45, Paul Makepeace pa...@paulm.com wrote:

 On Mon, Feb 24, 2014 at 2:04 PM, Steve Mynott steve.myn...@gmail.com wrote:
 http://perltricks.com/article/72/2014/2/24/Perl-levels-up-with-native-subroutine-signatures
 
 Finally. But don't believe the python/perl comparison troll, as
 python, for once, actually outguns perl on a character chomping basis,
 
 sub pairwise_sum ($arg1, $arg2) {
return map { $arg1-[$_] + $arg2-[$_] } 0 .. $#$arg1;
 }
 
 def pairwise_sum(list1, list2):
return [i + j for i, j in zip(list1, list2)]
 
 Paul

But I probably already have List::MoreUtils imported (because Perl).

sub pairwise_sum ($a1, $a2) {
  zip @$a1, @$a2;
}

And lets ignore the fact that the perl version that was used in the article was 
buggy. If $arg2 is shorter than $arg1 it breaks. zip’s supposed defined 
behaviour is to stop when either list runs out of elements.

James


Re: sub signatures coming

2014-02-25 Thread James Laver

On 25 Feb 2014, at 11:18, James Laver james.la...@gmail.com wrote:
 
 But I probably already have List::MoreUtils imported (because Perl).
 
 sub pairwise_sum ($a1, $a2) {
  zip @$a1, @$a2;
 }
 
 And lets ignore the fact that the perl version that was used in the article 
 was buggy. If $arg2 is shorter than $arg1 it breaks. zip’s supposed defined 
 behaviour is to stop when either list runs out of elements.
 
 James

Oh, for bonus fun, I’d do it a different way in clojure (using a map):

(def pairwise-sum zipmap)

You might also have fun assuming clojure.zip[1] has anything to do with the 
zipmap function. If you actually figure out what a ‘zipper’ is, do please let 
me know because it’s been evading me for about a year.

James

1. http://clojuredocs.org/clojure_core/clojure.zip/zipper


Re: sub signatures coming

2014-02-25 Thread James Laver

On 25 Feb 2014, at 11:31, Matt Lawrence matt.lawre...@virgin.net wrote:

 On 25/02/14 11:18, James Laver wrote:
 
 But I probably already have List::MoreUtils imported (because Perl).
 
 sub pairwise_sum ($a1, $a2) {
   zip @$a1, @$a2;
 }
 
 And lets ignore the fact that the perl version that was used in the article 
 was buggy. If $arg2 is shorter than $arg1 it breaks. zip’s supposed defined 
 behaviour is to stop when either list runs out of elements.
 
 Whereas this one is buggy because it doesn't actually do what it says on the 
 tin. Where's the summation?
 
 Matt

Ah yes. I’d just woken up.

sub pairwise_sum($a2,$a2) {
  map {shift($_)+shift($_)} (zip @$a1, @$a2);
}

James


Re: consolidate regexes

2014-02-25 Thread James Laver
On 25 Feb 2014, at 16:45, Nicholas Clark n...@ccl4.org wrote:

 Vendor supplied perl is going to be slower than one you compile yourself.
 Or at least, it won't be faster.

Historically this wasn’t always the case*. When ubuntu first got going, their 
packages were a little faster to load than other distros because they were the 
first to use LDFLAGS=-O1

That, and that it does take a little bit of domain knowledge to know how to 
properly tune for what it is you’re doing. Many sysadmins do not have this 
experience.

James
* No, I’m not going to forget the Dead Rat bless/overload madness in a hurry, 
either.


Re: [ANNOUNCE] Damian Conway Speaking at London.pm: Monday, 10th March

2014-02-21 Thread james . laver


Sent from my BlackBerry 10 smartphone.
  Original Message  
From: Nicholas Clark



Of those, GIR 0AA breaks the pattern for postcodes, doesn't it?
No number in the out code.



GIR0AA breaks everything. It's non-geographic for a start. And i'm not sure the 
girobank exists any more.

James‎



Re: [ANNOUNCE] London Perl Mongers March Social - 2014-03-06 - The Antelope SW1W 8EZ

2014-02-19 Thread James Laver

On 19 Feb 2014, at 21:32, Ash Berlin ash_c...@firemirror.com wrote:

 Good pub that one - or it used to be when London.pm went there last time… 
 which was when Simon Wistow was not yet our Ex-Glourious Leader. Wow that 
 dates it.

Not quite true. We were there just before Ovid fled to Europe.

James


Re: smutty british expression?

2014-02-13 Thread James Laver

On 13 Feb 2014, at 09:46, Dominic Thoreau domi...@thoreau-online.net wrote:

 You'll generally get change from a fiver for *a* pint, but not two. Unless
 you're drinking really rubbish stuff, or inside a Sam Smiths' pub. (at
 least in London. Which Arthur's house wasn't.)

Sam Smiths pubs are no longer a cheap option. In fact, the last one I drank in 
wound me a pretty big bill come the end of the night.

On the other hand, their chocolate stout should make youngs embarrassed about 
their double chocolate stout.

James


Re: Recommended IDE...?

2014-01-17 Thread James Laver
On 17 Jan 2014, at 10:18, Andrew london...@unitedgames.co.uk wrote:

 Looking to try using an Integrated Development Environment.
 Is there an industry standard everyone uses and I should get familiar with,
 or will any do?
 
 My previous experience is with NotePad and TextWrangler.
 I've Windows98SE and OSX 10.5.8 [Leopard] ;-), and use both in tandem via a
 KVM switch, XD.

It’s rather a personal choice. If you’re writing Perl, I don’t think you need 
anything other than a text editor. Komodo IDE has a lovely interface for 
debugging though.

My emacs configuration is quite IDE-like in many respects. I expect many people 
have VIM configs that do more for you as well.

In terms of actual IDEs, the standard is eclipse, I prefer Komodo.

It really is intensely personal. Try a few.

James


Re: One off job helping with Linux partition

2014-01-09 Thread James Laver
On 9 Jan 2014, at 19:34, Guinevere Nell guinevere.n...@gmail.com wrote:

 Hi all,

Hi,

I’m having a little bit of difficulty following here.

 I am a latent perl programmer (was NY.pm in the day, YAPC 19100, etc) -
 it's been a few, um 5 or 6, years since i have coded regularly - and I've
 just tried installing Ubuntu on my windows 8 machine with no success - had
 no cd drive and it complained and then won't let me boot in -

Are you saying that you do not have a CD drive? How did you try and install 
umbongo without one - usb key? Or are you instead saying that you booted into 
umbongo, it told you you didn’t have a CD drive then kicked you out and now you 
can’t get back in to either OS?

If you’ve got a backup, how did you take it? Assuming everything you require is 
in that backup, I think you should be able to sort this out yourself without 
too much hassle. So the questions:
- How many partitions are currently on that disk?
- Are any of them bootable at all?
- How did you attempt the installation? USB key?
- Which image did you download and how did you write that to whatever 
installation medium?
- Do you have a CD drive?
- Does the backup have all of the files you need?

James


Re: [ANNOUNCE] London.pm Social - 2nd January 2014 - Gunmakers

2013-12-30 Thread James Laver
Should you be needing respite from a period of overindulgence, you’ll be out of 
luck at our January social. For the rest of us, we’ll be enjoying foamy beer, 
fruity ciders and fragrant wines and possibly a bit of food to cap it off with 
(not that this was in short supply recently for most of you I’ll wager).

We haven’t been to the Gunmakers in quite a long time now, but we’re going back 
in the only month of the year we have a chance of getting a social there.

As per usual, people who haven’t attended a social before will get a free (as 
in beer!) pint. Find us. We’ll be the ones that look like perlmongers. I’ll be 
there from about 6pm.

The Gunmakers,
13 Eyre St Hill,
Clerkenwell
EC1R 5ET
http://thegunmakers.co.uk/

James




Re: EMERGENCY SOCIAL . . .

2013-12-04 Thread James Laver
On 4 Dec 2013, at 16:03, Th. J. van Hoesel th.j.v.hoe...@gmail.com wrote:

 around 5.15 I will be at Victoria Station...
 
 let's meet anywhere uptown and drink and eat and chat
 
 and maybe you will end up at NLWP::2014
 
 Theo

Since noone else has stepped up to the plate, I nominate the Bag o’ Nails. Or 
rather Dave Cross nominates it and I’m announcing it. Meet you there around 
5:15. Everyone else can feel free to pop along as well.

http://www.beerintheevening.com/pubs/s/45/453/Bag_O_Nails/Victoria

James


Re: EMERGENCY SOCIAL . . .

2013-12-04 Thread James Laver
Arrived. Nice pub. Good choice Dave.

James

Dave Cross d...@dave.org.uk wrote:
Quoting James Laver james.la...@gmail.com:

 On 4 Dec 2013, at 16:03, Th. J. van Hoesel th.j.v.hoe...@gmail.com
wrote:

 around 5.15 I will be at Victoria Station...

 let's meet anywhere uptown and drink and eat and chat

 and maybe you will end up at NLWP::2014

 Theo

 Since noone else has stepped up to the plate, I nominate the Bag o’  
 Nails. Or rather Dave Cross nominates it and I’m announcing it. Meet 

 you there around 5:15. Everyone else can feel free to pop along as  
 well.

 http://www.beerintheevening.com/pubs/s/45/453/Bag_O_Nails/Victoria

I'm suggesting it as my default pub in the Victoria area. but I'm  
afraid I won't be able to be there this evening.

Theo - I'm still looking forward to your Number::Fraction patches :)

Dave...

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.


Re: Regex teaser

2013-12-03 Thread James Laver
On 3 Dec 2013, at 23:54, Paul Makepeace pa...@paulm.com wrote:

 What does this output?
 
 $ perl -le '($a = aabbb) =~ s/b*$/c/g; print $a’

You can tell you’ve been writing perl too long when you know what that’s going 
to do and why :(

Here’s your example modified to exhibit my favourite regex madness. Can you 
explain this one?

perl -le '($a = aabbb) =~ s/.*?/./g; print $a’

James





Re: I have a bikeshed, colour suggestions appreciated

2013-12-03 Thread James Laver

On 4 Dec 2013, at 01:17, Kent Fredric kentfred...@gmail.com wrote:

 On 4 December 2013 13:40, Yitzchak Scott-Thoennes sthoe...@gmail.com wrote:
 Is it spell correcting the domain names?  It should use
 
 And the colours we're providing simply aren't in our browsers dictionary.
 
 So ... its interpreting it as hex.
 
 And non hex characters as 0’s

I always wondered why ‘monkey’ was a bright blue. http://monkey.bikeshed.org/

James


Re: Best practices for database migrations

2013-11-18 Thread James Laver


Simon Wistow si...@thegestalt.org wrote:
Is there a current favourite for doing database migrations (i.e having
a 
programatic way for a database to upgraded to a new version by having a

series of sql commands run on it)?

There are quite a few ways of doing it. What database are you using? If 
postgres you can do this in pure DDL/SQL with transactions and a unique 
constraint on your migrations table (but up and down are different files).

If not postgres, I recommend ragtime (clojure) which manages the same interface 
for a jumber of databases from the command line through lein.

Ragtime: https://github.com/weavejester/ragtime

James
-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.


Re: Best practices for database migrations

2013-11-18 Thread James Laver
On Mon, Nov 18, 2013 at 2:13 PM, Edmund von der Burg
e...@ecclestoad.co.uk wrote:
 On 18 November 2013 02:01, Simon Wistow si...@thegestalt.org wrote:
 Is there a current favourite for doing database migrations (i.e having a
 programatic way for a database to upgraded to a new version by having a
 series of sql commands run on it)?
 However the Python/Django crowd do have
 http://south.readthedocs.org/en/latest/about.html which is probably
 90% of the solution for 99% of the likely scenarios. I suspect it is
 similar to the active record approach, and well worth a look by anyone
 proposing to create a database migration toolset, especially the easy
 rollback support.

South is mostly lovely, except when you have a MySQL database. I've
found in practice you need to squash migrations a lot to avoid
difficulties if you're working off MySQL (South helpfully warns that
it wouldn't be a problem if you got a real database).

The guy who wrote south has written the schema migrations stuff that's
now in core django in 1.7 and it seems to work very well. South is
quite hacky for reasons that will become obvious when you've used it
for a while.

Obvious downside here is that it requires you keep a copy of your
models in Python rather than SQL. There's also quite a lot you can't
do to your database in django's model system and muttley may want
that.

Oh, and I mistakenly trolled muttley early by linking to ragtime. I
was actually meaning drift, https://github.com/macourtney/drift , but
it looks like the joke about sexps came in quite by accident :)

James


Re: Database Design Advice

2013-11-08 Thread James Laver


Smylers smyl...@stripey.com wrote:
William Blunn writes:

 
 Instead of storing a version ID (e.g. 1, 2, 3, 4, 5, 6), you could
 store a SERIAL.
 
 So for one document ID, you might store versions 10, 11, 12, 50, 75,
87.

This was my immediate thought as well, but I'd probably cheat and declarr the 
document version numbers to be oureky decorative and thus the realm of 
userspace to turn them into 1,2,3,4,5 etc. -- one can, after all fix this with 
a single line of code.

Performance (and complexity) would be much better than triggers

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.


Re: Database Design Advice

2013-11-08 Thread James Laver


Mark Stringer m...@repixl.com wrote:

 From the OP: But version should start at 1 for each document and be 
consecutive.

I'll grant that I've assumed that was to be more friendly to the end user, but 
in that case, it really is just cunning use of the .. operator.

I'd guess that the date_created is being stored in the table, so could 
be used to order the records without the need for a serial, if ordering

is the only concern.

Personally I would opt for timestamps by preference, but that brings in a 
longer requirements chat. How does backdating revisions work? Do you need a 
separate key to order in that case? Etc.

James

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.


Re: Database Design Advice

2013-11-08 Thread James Laver
On Fri, Nov 8, 2013 at 10:06 AM, Smylers smyl...@stripey.com wrote:
 James Laver writes:

 This was my immediate thought as well, but I'd probably cheat and
 declarr the document version numbers to be oureky decorative
  ^^
 “purely”, I presume?

Yes. Phone keyboard, sorry.

 and thus the realm of userspace to turn them into 1,2,3,4,5 etc. --
 one can, after all fix this with a single line of code.

 True. I'm all for cheating.

 But reporting will be done by Crystal Reports connecting directly to the
 database (and there's a distinct possibility that there will end up
 being more than one code base (in different programming languages) using
 the database too), so I'd rather any serial-number-to-per-document-
 version-number conversion was handled in the database, so it's in just
 one place.

 That conversion could be abstracted by a view, so the complexity is
 hidden for somebody just doing a SELECT — but my attempts with the
 Rank() window function seem like too complex complexity to be worth it.

In this case, a view seems like the best solution. But if you're going
to materialise it for extra performance, then you're back in the world
of triggers (assuming eager materialisation), and back comes the
complexity :(

James



Re: Database Design Advice

2013-11-08 Thread James Laver
On Fri, Nov 8, 2013 at 11:43 AM, Smylers smyl...@stripey.com wrote:

 • Separate fields for discount_percentage and discount_amount. This has
   the disadvantage of needing to ensure that a record doesn't have both
   fields set.

   If the business concocts another discount type in future, this will
   require a field for each discount type.

I'd probably actually go for this and a trigger. The particular case
of discounts means it's unlikely they'll add another, and this seems
like the most straightforward way to deal with it.

Relational databases aren't always great for modelling things, so when
it's unclear what's the best solution, it's usually best to go for
simple.

James



Re: Database Design Advice

2013-11-08 Thread James Laver
On Fri, Nov 8, 2013 at 5:22 PM, Yitzchak Scott-Thoennes
sthoe...@gmail.com wrote:
 On Fri, Nov 8, 2013 at 12:38 AM, Mark Stringer m...@repixl.com wrote:
 I'd guess that the date_created is being stored in the table, so could be
 used to order the records without the need for a serial, if ordering is the
 only concern.

 Never use date/times as unique identifiers/sort keys.

I'll agree with the former, but what's the reasoning behind the latter?

James


Re: Multi argument open and STDERR

2013-10-03 Thread James Laver
On 3 Oct 2013, at 21:26, Paul Weaver paul.wea...@bbc.co.uk wrote:

 How can I capture STDERR?

You're looking for IPC::Open3, I suspect. Certainly it's the closest analogue 
to the way you're doing it that I can think of.

http://perldoc.perl.org/IPC/Open3.html

I also note that ffmpeg is a strange beast and has a fairly undocumented remote 
control mechanism. At least I think that was ffmpeg. That only requires 
STDIN/STDOUT.

James


Re: Could use some hotel/travel help

2013-09-26 Thread James Laver
On 26 Sep 2013, at 05:29, Kieren Diment dim...@gmail.com wrote:

 Mornington Crescent.
 
 (with apologies)

Surely only at the end of his trip?

Given he wants Euston, it's less silly than it sounds, but Camden is a bit 
gauche.

I'm rather fond of the Great Northern Hotel at King's Cross (or at least it's a 
favourite brunch spot), but it's definitely not a cheap option. Alternatively 
how about somewhere lovely in Somers Town (Euston)? Bloomsbury would also be 
convenient and is quite beautiful. Again, an easy walk into Euston. Fitzrovia 
would put you one stop away (Warren St) or a slightly longer walk and is also 
quite lovely with some great eating.

James


Re: Could use some hotel/travel help

2013-09-26 Thread James Laver
On Thu, Sep 26, 2013 at 11:05 AM, Kieren Diment dim...@gmail.com wrote:
 Yeah, but I already won. Ungetlemanly as my strategy was.

 --
 Sent from my phone, so please excuse spelling mistakes, top posting, brevity 
 etc.

You were in Nidd. Also, we were playing Mornington Croissant.*

James
* http://www.isihac.co.uk/games/mcvariations/mc-m.html


Re: Robot turtles

2013-09-23 Thread James Laver
On Mon, Sep 23, 2013 at 1:22 PM, Joel Bernstein j...@fysh.org wrote:

 I'm not aware of any 3-8 year olds in this group, am I missing the point?

A number of london.pm members are parents. It seems fairly likely
they'd want their kids to grow up knowing at least a little about
programming.

James


Re: Perl publishing and attracting new developers

2013-09-20 Thread James Laver
On 20 Sep 2013, at 07:46, gvim gvi...@gmail.com wrote:

 I doubt that, judging by the tone of your replies.

Welcome to London.pm, home of robust discussion.

 Oh well, I should have known better than to engage in discussion with someone 
 whose email address begins with abuse. Have a nice life.

Back in the day, using abuse@ emails cut down on spam massively.

If you genuinely believe you're trying to have an intelligent debate here, I'm 
amazed at the level of self delusion, because if you take trolling out of it it 
just comes off as a huge whine about the state of reality.

James



Re: Perl publishing and attracting new developers

2013-09-20 Thread James Laver
On Fri, Sep 20, 2013 at 4:19 PM, Adrian Howard adri...@quietstars.com wrote:

 Publishers are in the business of making money. They *vastly* prefer
 to sell to an existing market, rather than try to create one.
 Technical books are a trailing indicator of interest, not a leading
 one. I can't really think of any counter examples.

 We already *have* good general books for introducing the relative
 newbie to Perl. Programming Perl, Learning Perl, Modern Perl 
 Beginning Perl all spring to mind. I don't think adding more is going
 to produce more Perl devs.

The fact that they behave responsively doesn't mean they aren't part
of the causative loop. Knowing you want to program something and
finding a preponderence of ruby books in the shop means you're more
likely to pick one up and learn ruby.

James


Re: Perl publishing and attracting new developers

2013-09-19 Thread James Laver
On Thu, Sep 19, 2013 at 9:46 AM, Kent Fredric kentfred...@gmail.com wrote:
 On 19 September 2013 19:41, Philippe Bruhat (BooK)
 philippe.bru...@free.frwrote:

 That book needs a chapter about the secret operators. ;-)


 I disagree, I don't see much value in promoting esoteric ways to use Perl.

 We just need to promote things that are good, and things that are awesome,
 and things that make programming in Perl *better*, things that serve as
 compelling arguments to use a more modern Perl, things that serve to
 inspire people to use more *CPAN*

I'm actually inclined to write such a book. Anyone interested in
coauthoring please message offlist and we can see if there's any
mileage in it.

James


Re: return \@array or @array

2013-09-12 Thread James Laver
On Thu, Sep 12, 2013 at 5:05 PM, Jérôme Étévé jerome.et...@gmail.com wrote:

 I'm still not quite sure about the real benefit of return \@array though.

There isn't one. In fact, there are downsides to using it if you don't
need it, like accidentally modifying in two places where you only
wanted to modify in one. Python passes by reference by default and I
see a lot of code that makes a shallow copy to avoid such bugs. So
passing by value helps eliminate a whole category of programming bug.

In any case, it's an interpreted programming language. Write bits that
have greater performance requirements in XS. Or don't write them in
perl at all.

James



Re: return \@array or @array

2013-09-12 Thread James Laver
On 12 Sep 2013, at 20:23, Daniel de Oliveira Mantovani 
daniel.oliveira.mantov...@gmail.com wrote:

 My benchmark does show that. Look again.

Wrong. Copy-on-write semantics. Aside from the fact you're being odious in 
public again, arguing with Abigail is generally not likely to result in you 
being proven right.

James


London.pm Dim Sum, Leong's Legends, Thursday 12th September 13:00

2013-09-11 Thread James Laver
Motivated by the dual reasons of Jay Rayner having finally discovered their 
xiao long bao and writing about them in tones that made me crave them from when 
I used to do them regularly and a strong desire to avoid a particular client 
meeting I don't want to be in, let's have dim sum tomorrow - it's been ages!

(Opposite De Hems)
Leong's Legends,
4 Macclesfield st
W1D 6AX

James

Sent from my iPhone


Re: London.pm Dim Sum, Leong's Legends, Thursday 12th September 13:00

2013-09-11 Thread James Laver
13:00, as per subject? :)

/j

Sent from my iPhone

On 11 Sep 2013, at 20:44, Gordon Banner t...@gordonbanner.me.uk wrote:

 Any particular time?
 
 On 11/09/2013 06:52, James Laver wrote:
 Motivated by the dual reasons of Jay Rayner having finally discovered their 
 xiao long bao and writing about them in tones that made me crave them from 
 when I used to do them regularly and a strong desire to avoid a particular 
 client meeting I don't want to be in, let's have dim sum tomorrow - it's 
 been ages!
 
 (Opposite De Hems)
 Leong's Legends,
 4 Macclesfield st
 W1D 6AX
 
 James
 
 Sent from my iPhone
 



Re: Assigning Classes

2013-09-10 Thread James Laver


Sent from my iPhone

On 10 Sep 2013, at 08:50, Raphael Mankin r...@mankin.org.uk wrote:

 This approach has exponential complexity. Definitely infeasible. 

Not necessarily. How many courses are there Dave?

James


Re: Assigning Classes

2013-09-10 Thread James Laver
On Tue, Sep 10, 2013 at 9:19 AM, Dave Cross d...@dave.org.uk wrote:
 Not necessarily. How many courses are there Dave?


 About 30.

Sorry, that was in the original email. I meant to ask how many students.

James


Re: Assigning Classes

2013-09-10 Thread James Laver
On Tue, Sep 10, 2013 at 11:27 AM, Philippe Bruhat (BooK)
philippe.bru...@free.fr wrote:

 OTOH, it might improve the network connectivity.

And valuable (IRL) social networking opportunities.

James


Re: Assigning Classes

2013-09-09 Thread James Laver
On Mon, Sep 9, 2013 at 2:57 PM, Paul Johnson p...@pjcj.net wrote:
 On Mon, Sep 09, 2013 at 01:30:00PM +, Dave Hodgkinson wrote:
 Prolog. Facts and rules then go solve.

 no

Actually, Prolog was my first thought too. The major limitation is
fallback behaviour.

James


Re: Assigning Classes

2013-09-09 Thread James Laver
On Mon, Sep 9, 2013 at 4:10 PM, Dave Cross d...@dave.org.uk wrote:

 I'm pretty sure that Paul wasn't actually dismissing Prolog. I think you'll
 find he was making a joke.

...which I should have gotten but I'm full of cold.

James


Re: Perl 5.16 vs Ruby 2.0 UTF-8 support

2013-08-23 Thread James Laver
On Fri, Aug 23, 2013 at 5:37 PM, Nic Gibson n...@corbas.co.uk wrote:

 If you are seeing this in your then your code is either a) not encoded as 
 ASCII (probably Latin-1 or UTF-8) or b) broken

If you're seeing this in client-provided CSV, I recommend running a mile.

Notes from the recent frontiers:
- Excel windows exports as wincp1252 with \r\n line endings
- Excel mac exports as macroman (yes, in 2013!) with \r line endings
- UTF-8 is a great interchange format. But it's quite annoying perl
doesn't have a flag to automatically en/decode to/from UTF-8 as
regards STDIN and STDOUT (and in the case of STDIN, probably anything
that  uses)
- iconv is awesome! Here are some handy aliases:
alias utf8tolatin1=iconv -f utf-8 -t iso-8859-1
alias win1252toutf8=iconv -f windows-1252 -t utf-8
alias utf8towin1252=iconv -f utf-8 -t windows-1252

(a rather grumpy) James (who is sat on a client site at this hour
thanks to aforementioned CSV)


Re: Perl 5.16 vs Ruby 2.0 UTF-8 support

2013-08-23 Thread James Laver
On Fri, Aug 23, 2013 at 8:01 PM, Matt Lawrence matt.lawre...@virgin.net wrote:

 Doesn't the -C switch count? Or indeed the PERL_UNICODE environment
 variable.

 Matt

I take it back.

Wish I'd known about this 2 days ago, of course.


Re: Using grep on undefined array

2013-08-14 Thread James Laver
On Wed, Aug 14, 2013 at 1:59 PM, Matt Lawrence matt.lawre...@virgin.net wrote:

 man perlglossary:

 autovivification

 A Graeco-Roman word meaning “to bring oneself to life”. In Perl, storage
 locations (lvalues) spontaneously generate themselves as needed, including
 the creation of any hard reference values to point to the next level of
 storage. The assignment $a[5][5][5][5][5] = quintet potentially creates
 five scalar storage locations, plus four references (in the first four
 scalar locations) pointing to four new anonymous arrays (to hold the last
 four scalar locations). But the point of autovivification is that you don’t
 have to worry about it.

perlglossary is wrong. It doesn't only occur as an lvalue but can
occur by access as well.

I'm actually surprised that noone has mentioned the 'autovivification'
pragma ('unpragma'?) by now in a fairly long thread.

use strict;
use warnings;
no autovivification;
my %foo;
my $bar = $foo{bar}[1];
die(fail 1) if %foo; # does not die because autovivification was suppress
use autovivification;
$bar = $foo{bar}[1];
die(fail 2) if %foo; # does die, we turned off suppression


James



Re: Assigning anonymous hash to a list

2013-07-30 Thread James Laver

On 30 Jul 2013, at 22:32, Joseph Werner telco...@gmail.com wrote:

 No, What you have done here is to assigned a list value to an array of
 assignable elements.
 
 I am talking about the example at the top of this thread, which was a
 scalar assignment to a list of elements.

You've seen what perl thinks of it (in the form of opcodes executed) and it 
isn't what you think it thinks. Please stop telling people it's raining when 
you're standing dry in the sunshine.

Abigail is…Abigail. He's usually right.

James


Re: Another Comparison Of Programming Languages

2013-07-11 Thread James Laver
On Thu, Jul 11, 2013 at 2:49 PM, Raphael Mankin r...@mankin.org.uk wrote:

 His analysis of English, his native tongue, is considerably worse than
 his comparison of programming languages. I wouldn't bother trying to fix
 the article.


Considering that aside from the perl entry being really quite wrong, the
methodology is serious flawed, I can't imagine anyone taking it seriously.

James


Re: New pet keeping rules in the Netherlands

2013-06-20 Thread James Laver
On 20 Jun 2013, at 22:50, Kieren Diment dim...@gmail.com wrote:

 I particularly like it when they have babies and there are hundreds of tiny 
 cute huntsman spiders all over the ceiling.  For a bonus, they eat 
 cockroaches.

There was an old lady who swallowed a fly.

Wait, what eats huntsmans again?

James


Re: New pet keeping rules in the Netherlands

2013-06-19 Thread James Laver
On 19 Jun 2013, at 22:14, Damian Conway dam...@conway.org wrote:

 Except that it's a species of Australian wildlife. And nocturnal.
 Which means that it will wait until you fall asleep before it kills you.

Skippy, skippy, skippy the bush kangaroo-oo

James


Re: Living with smart match breakage

2013-06-14 Thread James Laver
On 14 Jun 2013, at 10:26, Kieren Diment dim...@gmail.com wrote:

 [1] Not that I use many of the newer core features, occasionally I have to 
 account for some of my $work code having to work on 5.8.

I don't use smart match precisely because it doesn't feel intuitive and I have 
enough to worry about without having to memorise yet another table of results, 
some of which are surprising.

I suspect most people are in the same boat, but the darkpan argument always 
gets trotted out in these cases. The solution you present of a Perl release 
that fails compile would be nice though. Perhaps with a switch in a new release 
of Perl?

James


Re: Scope of variables in a function

2013-06-02 Thread James Laver
On 2 Jun 2013, at 12:42, Dave Mitchell da...@iabyn.com wrote:

 I'm not aware of any particular performance penalty:
 
$ time perl5180o -E'for (1..100_000_000) { my $x = 1 }' 
 
real   0m5.638s
 
$ time perl5180o -E'for (1..100_000_000) { my $x }'
 
real   0m4.012s
 
$ time perl5180o -E'for (1..100_000_000) { state $x = 1 }'
 
real   0m3.060s
 
$ time perl5180o -E'my $x; for (1..100_000_000) { $x }'
 
real   0m2.787s
 
 Yes technically its slightly slower than a bare '$x', but it's a lot
 faster than a bare 'my $x';

I stand corrected. I thought I'd seen a warning in the docs at some point but 
evidently I'm making it up.

/j


Re: Scope of variables in a function

2013-06-01 Thread James Laver
On 1 Jun 2013, at 18:23, Dirk Koopman d...@tobit.co.uk wrote:

 It is very annoying. The more so because this is an artefact that is 
 (apparently) relied on by a lot of legacy code.
 
 Quite a lot of other perl artefacts have been deprecated and then removed. 
 Why does this one persist? In what way is it useful or intuitive?

We did formalise an alternative, in the form of :state, but I don't know about 
how well it's used. It also incurs a performance penalty that people are 
presumably unhappy about (but then one assumes it's also incurred by the 
informal version too…)

/j


Re: npm, PyPi overtake CPAN

2013-05-24 Thread James Laver
On 24 May 2013, at 01:31, Paul Makepeace pa...@paulm.com wrote:

 I'm sure there's plenty of caveats etc but the gradients is probably what's
 most interesting here; CPAN is relatively static compared with, well, all
 the others.

How about the caveat of utility? Whilst npm has a reasonable SNR and gems has 
so many modules that there are enough useful ones hidden there, pypi is mostly 
full of crap and not useful when you want to achieve something.

That said, egg basket makes it remarkably easy to host your own mini-pypi 
server for darkpan you've generated


Re: Random Perl Content

2013-05-19 Thread James Laver
On 19 May 2013, at 07:29, Matthew Seaman m.sea...@infracaninophile.co.uk 
wrote:

 Why not just write each of your streams of random numbers to a file and
 then just re-read the file when you need to reuse that sequence?

That involves quite a lot more careful management.

The approach of logging seeds is quite widely used. In fact MySQL replication 
sends out the seed in each replica because they do it ass backwards and forgot 
someone night actually embed random() in their query.

James


Re: Alternative sources of Perl programmers

2013-05-17 Thread James Laver

On 17 May 2013, at 20:28, Duncan Garland duncan.garl...@ntlworld.com wrote:

 Do you want to come out to Thames Ditton? It's a bit of a hike, but if
 you're interested I'll see what I can do.

Historically, London.pm events outside of vaguely central london tend to have 
poor attendance ('vaguely' here means the BBC and Net-A-Porter are both easy to 
get to despite being in zone 2). I think Thames Ditton might be stretching the 
definition of 'vaguely central london' a little too far, but thanks for the 
offer.

James


Re: June social poll

2013-05-16 Thread James Laver
On 16 May 2013, at 17:07, Peter Corlett ab...@cabal.org.uk wrote:

 Hi,
 
 So, may I have your input into whether we should:
 
 a) do the beer festival at the Gunmakers;
 
 b) go to one of our other favourite haunts such as the Bridge House, Founders
   Arms, or the Edgar Wallace; or
 
 c) try somewhere entirely new?

Whilst option 'c' is entirely appealing, you forgot option 'awesome': have beer 
somewhere else followed by an ultra-heretical beer festival meet the following 
night.

/j




Re: Alternative sources of Perl programmers

2013-05-15 Thread James Laver

On 15 May 2013, at 23:04, Tom Hukins t...@eborcom.com wrote:

 I'm pleased that you enjoy your involvement in our community, but
 please don't spread the rumour that anything we used to do stopped
 happening.
 
 With a small group of volunteers and a large group of followers and
 mailing list subscribers, reality sometimes disrupts our aspirations.

Indeed, I've been volunteered to organise the next tech meet. Now if we could 
just find a venue…

James


Re: Number::Fraction

2013-05-06 Thread James Laver
On 6 May 2013, at 13:57, Th. J. van Hoesel th.j.v.hoe...@gmail.com wrote:
 
 What if people figured out that the method did accept 3 or more arguments 
 (why and how.. because they dug into the code ?). It would make no sensense 
 at all to call the method Number::Fraction-new( 1, 4, 6, 7, 2), but it would 
 produce by some magic allowance that it should return a Number::Fraction 
 object.

Okay, well first of all any constructor is going to take an arbitrary number of 
arguments. That's how argument passing in perl works. If they read the code 
they would see what it does, the only way they would otherwise see it taking 
more than two arguments is by attempting to pass them. And if they did that, 
they ought to have been reading the documentation more closely. Otherwise they 
did and they just decided to see what happens? I don't see that one myself.

 So, now we have some legacy code. And now extending the functionality in a 
 natural understandable manner, might cause old programs that did very odd 
 method calls to break.

I think you misunderstand here. How is what you propose a natural 
understandable manner? Positional parameters are by convention added to the end 
if you're creating more of them, not the front. See what messes libraries in 
other languages have gotten into by making that mistake (erlang springs to 
mind).

Furthermore, if programs are using the module aside from how it's documented, 
they deserve to be broken. They could have submitted a bug to make something 
official behaviour, but they didn't. And since we're talking about a simple 
fraction module here, I don't think we're going to find anyone doing something 
daft.

 Is my next approach acceptable:
 
 now:
 a quick patch that will issue a warning the moment the method is being called 
 with 3 or more arguments (only once per application run), letting users know 
 that they did some odd thing, but forgive them and continue.

Nondestructive. I don't think anyone would argue with this.

 next:
 implement a 3-argument methode that will only work properly when the modules 
 is being used as
 use Number::Fraction qw{:mixed}
 still issue a warning

Why don't you just create a new constructor that takes arguments differently? 
This would seem to be a good way around it. Seems to me you're way 
overcomplicating things. It's also a common perl pattern because we're blessed 
with the ability to have as many constructors as we want.

 next:
 let the module die with unintended 3-plus-argument calls
 use Number::Fraction qw{:mixed}

Again, you're overcomplicating.

 next:
 drop the requirement to use :mixed, make it default
 
 all in a time frame of one year ?

Why on earth are you overcomplicating this so?

 Someone really need to enlighten me as to why write method implementations 
 like this, that accept arbitrary arguments, rather than locking down the API

It's a dynamic language. We have documentation on how to do things. And extra 
arguments are ignored. This is fairly normal. I write a lot of code that does 
this too and i don't consider it broken. In fact, it's more or less a perl 
idiom and common to a lot of dynamic languages really (though in the majority 
of cases they just use named parameters because the language has native support 
for method signatures).

Ask yourself what you're achieving by changing the API like this. I think 
you've got the potential to break code and I don't think you're doing it for 
the right reasons. I don't like changing the order of positional parameters 
when you're adding new ones either because it confuses people.

Furthermore, I don't think what Dave is suggesting about the move to Moose is a 
daft one, but you'd do well to preserve the API as it currently stands. Perhaps 
a BUILDARGS method that checks if it's being called according to the old API 
(i.e. has two args, both of which are numeric) and fills in the keys for you if 
so? To get the new 'mixed' functionality, you'd just pass in the keys manually 
and it would do the right thing?

James


Re: Number::Fraction

2013-05-06 Thread James Laver
Jesus, I thought my mail was long…

Apols in advance...

On 6 May 2013, at 21:13, Th. J. van Hoesel th.j.v.hoe...@gmail.com wrote:

 After reading it three times, I have a slight feeling that I have bitten of 
 more then I can chew... and it was such a small bite already, couldn't find a 
 smaller module, so little code and such a elegant way of doing what it is 
 supposed to do - and I have some kind of affinity with as former math-teacher.

It is a fairly trivial module and I don't think wrong for your first chunk of 
real world perl to be honest, I just think perhaps a little guidance could help.

 And the documentation does say what parameters it takes, does not say 
 anything about what it does when passing in additional things.

Well then, it's undocumented behaviour, which should not be relied upon. I 
don't personally see any harm in being liberal in what you accept.

 I will admit, working with positional parameters is bad, and I do acknowledge 
 the danger in just adding other parameters and mess up the thing. Particular, 
 like stated before, Perl takes any number of parameters in function-calls, 
 and it would not be fun to have to reorder the parameters in the function 
 call anytime someone comes up with a new idea.

Well quite.

 But it doesn't --- or, I have not tested it, but the code does explain. It 
 happily keeps running, though it is not conform the documentation

Sorry, how does it not conform to the documentation exactly? My understanding 
here was that it didn't document what it did with extra params and thus a 
fairly reasonable response was to simply ignore them?

 So, I should fill in an official bug ?

I remain unconvinced there is a bug. Unless you've tickled one with some code 
you've got in production, I don't think a bug is worth filing.

 Adding
 if ( @_  2 ) warn fractions consist of a numerator and a denominator, found 
 more than 2 parameters\n;
 would be acceptable?

It seems like a reasonable position to me. A warning never hurts anyone who 
isn't doing stupid things with %SIG.

 Why don't you just create a new constructor that takes arguments 
 differently? This would seem to be a good way around it. Seems to me you're 
 way overcomplicating things. It's also a common perl pattern because we're 
 blessed with the ability to have as many constructors as we want.
 
 that could be an option.
 
 I'd like to keep the module as it is... but accept other arguments, atop of 
 what has already been implemented. The module accepts in one single method 3 
 different calls:
 
 passing a reference, which clones it to a new object.
 
 passing a string, which will be unraffled in a numerator and denominator.
 
 passing in 2 integers to construct the object.
 
 these are not 3 separate constructors.
 I would like expand the string handling and allow it to pass in a string in 
 the form off a b/c. That is not a great deal, just a bit off code. However, 
 I think it then looks a bit off to need an additional routine 
 Number::Fraction-new_from_integer_numerator_and_denominator( a, b, c ). 
 Therefor, I'd like to be able to use the same constructor that works with 2 
 AND 3 parameters, I think that would look better, building on top off the 
 overload features.

It's not my module, I've never used it before and I personally couldn't care 
less if you make it accept three params optionally and break code where people 
aren't following the docs. But don't shove the new argument on the front 
because it's a terrible thing to do. Also, I'd hardly see 

 
 next:
 let the module die with unintended 3-plus-argument calls
 use Number::Fraction qw{:mixed}
 
 Again, you're overcomplicating.
 
 May i quote:  Furthermore, if programs are using the module aside from how 
 it's documented, they deserve to be broken.

You've well over-engineered this. Break things for the right reason, not 
because you've got a batshit crazy way of solving a problem.

 I'm only trying to phase out the undocumented possibility that the method 
 could be called with to many parameters, that would potentially cause harm 
 the moment you would reorder the arguments in the call.
 
 I am aware of the danger now.
 
 Had it been caught since the early releases, there might not had been any 
 calling programs that would do ...new-( 2, 5, 7);

Why is this a problem? Why can't you just work around it like everyone else 
does?

Frankly have you considered making a subclass that handles three args? It might 
be a better fit.

 Doing Objective-C as well - which is not just a new kid in town either - that 
 does not use named parameters either, it does positional parameters to their 
 method calls. However, through some smart signature, it uses extreme long 
 function-calls that makes it all quite explicit and does do quite a lot of 
 parameter checking in the IDE. Guess the only way to do real named parameters 
 is through NSDictionary or what we in Perl have, called a hash, in which case 
 the order does not affect the result.


Re: Number::Fraction

2013-05-02 Thread James Laver
On 2 May 2013, at 18:50, Th. J. van Hoesel th.j.v.hoe...@gmail.com wrote:

 Back to your code, line 198:
 
  if (@_ = 2)
 
 Why not check for 
 
  if (@_ == 2)
 
 ?
 
 it should have only two arguments to construct a fraction from calling 
 Number::Fraction-new(1, 2);
 
 Why would you allow it to pass other arguments?

It looks like a combination of defensive programming and laziness. If you check 
for length of two, you have to handle both the case of too few args and too 
many args in addition to the case of two args. This is lazier and will it 
really harm it people pass more than 2 to silently ignore the extras?

James


Re: Best Practices for passing option hashes into XS

2013-04-28 Thread James Laver
On 28 Apr 2013, at 01:55, Simon Wistow si...@thegestalt.org wrote:
 and then pass the HV into some C code. But I dislike having Perl types 
 in otherwise Perl free code.
 snip
 So my second thought is to have a struct
 
 typedef struct {
  char* first_opt;
  char* second_opt;
 } foo_struct;

I think you've basically got a first question you haven't asked. Are you 
writing a C library that you want to interface with in perl or are you writing 
an XS library? If the former, you should probably translate them into a broader 
structure that includes all of the options you're looking for (or pass them as 
plain parameters into the remainder of the code). If the latter, you should 
stick with Perl datatypes.

James


Re: Best Practices for passing option hashes into XS

2013-04-28 Thread James Laver

On 28 Apr 2013, at 16:33, Simon Wistow si...@thegestalt.org wrote:

 Firstly, while technically the C code written for the module is never 
 used anywhere else. However I didn't write it originally - I'm merely 
 patching it - and it currently doesn't use any Perl datatypes anywhere 
 else so I'm loathe to add Perl datatypes for that reason.

That sounds awfully like a compatibility shim for perl. Where using Perl 
datatypes would be appropriate.

 Secondly, I have also, several times in the past, wanted to appropriate 
 C code I've written or observed in Perl modules (also Ruby, PHP and 
 Python extensions) and use them elsewhere and the use of Perl Datatypes 
 prevents that.

Ultimately you still need some sort of shim. Sounds like you're actually 
writing a reasonable amount of C and that it would be better off being a C 
library in and of itself.

 Lastly, an aesthetic choice. The language Perl is written in is 
 technically C but really, it's not. It is great for writing Perl but 
 it's not what you'd call pretty or easily accessible. 
 
 Moreover it *looks* different to 'regular' C. The code I'm modifying is 
 written in nice (to my eyes) lower_case C dialect. The code I'm adding 
 is OpenSSL Camel_case and the juxtaposition makes me wince. Adding in a 
 third style might be too much to bear.

But it has to go somewhere. You still need shim code somewhere.

 If I was going to add a fourth (less well thought out) reason it would 
 be that, like dates and string encodings, one should get ones data into 
 a canonical form as close to the 'edge' as possible. In this case all my 
 XS and Perl code is in the .xs file and all the C is in .c file and 
 never the twain shall meet. I suppose this is just the second point 
 again.

Again, I think it comes down to that question. It sounds like you're writing a 
C library and a perl shim in the same chunk of code. You should think about 
separating them.

James


Re: Raising Perl awareness on Tiobe + Wikipedia, etc.

2013-03-21 Thread James Laver
On 21 Mar 2013, at 08:08, Mallory van Achterberg stommep...@stommepoes.nl 
wrote:

 However Javascript, while starting out lacking a lot, today has filled
 in many of the gaps. It never fixed its basic retardation, but
 libraries exist to fix it.

JavaScript is an implementation detail of jQuery*. If something similar existed 
to make non-DOM JS less painful, perhaps I wouldn't despise node.js so much.

/j
* oh of course I have a list of rants about jQuery, glad you asked. Let's start 
with position:relative being assumed when you do .show(). Among *many* others. 
Wow, it really is like perl.


Re: jQuery

2013-03-21 Thread James Laver
On 21 Mar 2013, at 12:04, Ben Evans benjamin.john.ev...@gmail.com wrote:

 You should also get a copy of Javascript - The Good Parts by Douglas
 Crockford.

Yes and no. Crockford has some interesting opinions. Particularly when it comes 
to what makes good quality javascript (jslint is fundamentally broken IMO).

 My guys seem to like Angular.js as well.

AngularJS has the bizarre glory of daftest release names i've ever seen: 
https://en.wikipedia.org/wiki/AngularJS#Releases

/j


Re: Raising Perl awareness on Tiobe + Wikipedia, etc.

2013-03-20 Thread James Laver
On 20 Mar 2013, at 08:47, Greg McCarroll g...@mccarroll.org.uk wrote:

 Now throw in node.js and recently you could build another argument for the 
 importance of JS.

Someone didn't see my talk at LPW.* I think the hype will blow over eventually 
because people will figure out that cooperative multitasking makes things like 
bcrypt remarkably hard. Not to mention that it's very irritating to program 
node. And don't get me started again, I already gave them damn talk.

James

* The one where I didn't spend the entire time being heckled by people who've 
been programming perl since the 0.1 release. The one where I had the audience 
chanting web scale at me. Such fun.


Re: New perl features?

2013-03-15 Thread James Laver
On 15 Mar 2013, at 13:04, DAVID HODGKINSON daveh...@gmail.com wrote:

 So, no then. In the sense of having a single page of good examples of
 using the new features.

With so many orgs stuck on ancient perls, it may not be a full solution. Sure 
it may attract newbies but if they get a job with an ancient perl they're going 
to be disappointed they can't use all that shiny.

James


London.pm Dim Sum, Canary Wharf, Thursday 14th March 1pm

2013-03-12 Thread James Laver
It's been a bloody long while since I summed dims, dimmed sums or ate delicious 
dumplings. Given that I spend far too much of my time around Canary Wharf, I 
miss most of the list-organised ones. Accordingly, it's time I stopped being 
lazy and organised one.

We did this one a very long time ago and I seem to recall we had a little 
difficulty getting seated, so if you know in advance you want to attend, please 
email off list; the fewer ransomers we have on the day, the higher our chances.

Royal China,
30 Westferry Circus,
London
E14 8RR

1PM. Be there or be hungry :)

Cheers,
James


Re: cpan you have to see

2012-12-12 Thread James Laver
On 12 Dec 2012, at 15:57, Uri Guttman u...@stemsystems.com wrote:

 On 12/12/2012 07:12 AM, Leon Brocard wrote:
 he still thinks his code is doing something useful

It is. I had to write something similar to his Boolean module when I inherited 
a fucked up database that had different standards for Boolean values in 
different parts of the code base. Everything was stored in a blob column for 
extra meta-database hate.

Just because you get to work with all of the nice clean code in the world 
doesn't mean some people aren't stuck with the mistakes of others. Then again, 
my primary income stream is writing code and yours is recruitment, so it's 
expected I'm more likely to have to clean up messes.

/j


Re: Agents part CCXXXIV

2012-12-03 Thread James Laver
On 3 Dec 2012, at 06:38, Uri Guttman u...@stemsystems.com wrote:

 one reason i ask my candidates where else they are being submitted is to 
 avoid those duplications.

Bullshit. You ask because you want to try and muscle in on those positions. If 
you really asked permission before submitting every time (as you claim later in 
your email) you'd never be in a position of double submission. Pimp standard 
trick #4.

/j


Re: Agents part CCXXXIV

2012-12-02 Thread James Laver
On 2 Dec 2012, at 20:32, Dave Hodgkinson daveh...@gmail.com wrote:

 If an agent sends your resume somewhere without telling you, is
 there any kind of redress?

Legally they broke the DPA. Good luck doing anything about it.

/j


Re: Perl outreach

2012-11-29 Thread James Laver
On 29 Nov 2012, at 12:33, gvim gvi...@gmail.com wrote:

 If we want to be Perl noticed again as a serious contender for new projects 
 I'd say our best bet is to finally get Perl 6 finished, or at least 
 production-ready. I know Perl 5 is excellent but Perl needs something new 
 to get noticed again. That something is Perl 6.

Perl == Perl 5. I fail to see how replacing it with another language helps  
the language being replaced.

Fact is noone really cares how supposedly amazing a language is if there isn't 
a huge collection of pre-written code you can use with it.

As anyone who saw my talk about other techs at LPW will know, I've been writing 
clojure of late. Unlike perl6, I can tap into a huge body of pre-written java 
code which goes some way to stopping me missing cpan. And don't even think 
cp6an is enough.

/j


Re: Perl outreach

2012-11-27 Thread James Laver
On 27 Nov 2012, at 12:51, Edmund von der Burg e...@ecclestoad.co.uk wrote:

 but I'm now a
 Node fan boy. The asynchronous approach tickles me. And npm is
 GLORIOUS. Does this mean that others will like Node - not at all. Try
 'em all!

And in one of my talks at LPW I went into length about why I can't stand 
node.js. Actually that's not true: I like synchronous node.js, just everything 
goes to pot if you want async.

Wanting to play with new things is how I wound up on clojure.

/j


Re: Perl outreach

2012-11-27 Thread James Laver
On 27 Nov 2012, at 13:10, Bob Walker b...@randomness.org.uk wrote:

 On Tue, 27 Nov 2012, Edmund von der Burg wrote:
 
 And npm is GLORIOUS.
 
 
 I cant quite decide if the fact that it installs a module's dependencies in 
 the directory of the module you're installing is insane or a very good idea.

I like this. I note that both sbt (scala) and leiningen (clojure) do this also. 
I presume it's a java standard thing. Normally it dumps a jar in there of 
course.

/j

--

Sent from my invisible pink unicorn


Re: Perl outreach

2012-11-27 Thread James Laver
On 27 Nov 2012, at 14:20, Edmund von der Burg e...@ecclestoad.co.uk wrote:
 To be sure there are some thing that async is awful at. I love it for
 APIs and responding to web requests. Anything short and sweet and
 potentially blocking or concurrent.

For building a moderately complex REST API I found it tedious in the extreme. 
I'm currently building it in Perl with a view to replacing it with clojure past 
the prototype stage. Frankly if it weren't for the fact some parts of it 
require functionality for which the perl libraries are shit, I would keep it in 
perl and I'm far too lazy to bite off even more projects than the ones I 
currently have going.

I do not believe there is a better prototype language than perl unless your 
vision happens to fit precisely into the typical app model of something like 
rails (and mine really does not). Not that perl is only capable of prototypes, 
merely that my app has special needs on the macro scale and I'm lazy.

Oh, on the topic of node, I like npm. Npm feels like a JavaScript port of 
something written in perl.

 For the sequential testing of clicking on a web interface it was
 painful to the extreme. To the extent that I threw away all that code
 and started again using watir (http://watirwebdriver.com/). Which is
 Ruby. Who cares, it works!

I would reach for cucumber/capybara in that situation. Watir is nice but 
cucumber grew on me after a while.

/j

--

Sent from my invisible pink unicorn



Re: London Perl Conference 2012 photos

2012-11-25 Thread James Laver
On 25 Nov 2012, at 16:04, Chris Jack (MSN) chris_j...@msn.com wrote:

 https://picasaweb.google.com/104598318166622233830/LondonPerlConference24112
 012?authuser=0feat=directlink

https://picasaweb.google.com/104598318166622233830/LondonPerlConference24112012?authuser=0feat=directlink#5814779230205261074

Not entirely flattering. You must have picked a hell of a moment.

/j


Re: 25 Years of Perl

2012-11-23 Thread James Laver
On 24 Nov 2012, at 00:36, Uri Guttman u...@stemsystems.com wrote:

 this thread reminds me of something we need to crow about more. so many 
 conventions, inventions, ideas have come from the perl community and then be 
 copied/stolen/absorbed by other langs, usually without much recognition.

We do of course do the same thing back when the ideas are worth stealing.

 TAP is used everywhere now. perl invented and spread it so it is universal in 
 the perl world.

TAP can be used certainly, but most languages have their own testing 
infrastructure. Most of it is pretty crap to be honest, but TAP is certainly 
not the only game in town. When dealing with Jenkins, for example, we have to 
use the JUnit harness because JUnit output is all that it understands.

 cpan is always being copied (poorly) by other langs. they just never get the 
 community feeling of uploading to cpan as a cred and for sharing.

The actual repository, yes. The clients, well personally I think Leiningen 
(clojure) does a better job. Now if they could work on reducing the output like 
Minicpan did...

 yapc has yet to be properly copied. no one else delivers more bang for the 
 buck and fun as well.
 
 mjd invented lightning talks and they are at many confs now, not just lang 
 ones. another perl invention with no credit given.

How are these perl inventions? They are community inventions.

/j


Re: 25 Years of Perl

2012-11-22 Thread James Laver
On 22 Nov 2012, at 12:19, Abigail abig...@abigail.be wrote:

 A community thing that hasn't been mentioned yet: conference auctions.
 (Isn't London.pm still suffering from the outcome of an auction in 2001?)

I consider it an interesting quirk. Interestingly the PHP and python meetups in 
london all pick the first thursday of the month, so if one were so inclined, 
one months where the first thursday after the first wednesday of the month 
comes out to mean the 8th, if one were to miss the orthodox social, one could 
attend the group for another language and the heretical social in one month.

I, of course choose to attend the orthodox social where possible.

/j


Re: 25 Years of Perl

2012-11-20 Thread James Laver
On 20 Nov 2012, at 09:09, Jacqui Caren jacqui.ca...@ntlworld.com wrote:

 I know Tim will not blow his own trumpet but ...
 One of the biggies was and is DBI.

We take it so much for granted that you could connect to any number of 
different database engines with the same perl binary these days, or with any 
other programming language too, but really perl led the world here. This was 
quietly revolutionary.

How many webhosts do we think would ship several perls for several different 
database engines?

/j


Re: I love git

2012-10-28 Thread James Laver
On Sun, Oct 28, 2012 at 12:06 PM, David Cantrell da...@cantrell.org.uk wrote:
 Lovely.

 Now, having deleted the branch on one machine, and pushed the delete to
 github, how do I make it disappear everywhere else that I've got a copy
 of the repo?

git push origin :branchname # note the significant colon

Assuming your remote for github is 'origin'. You can also specify
another branch to the left of the colon (e.g. foo:bar to push local
branch foo to remote branch bar)

/j


  1   2   3   4   >