Re: Interactive graphics

2014-11-16 Thread Ruud H.G. van Tol


On 2014-11-16 12:02, Sue Spence wrote:

From: Roger Bell_West 



What are the cool kids using for interactive graphical stuff these
days (not just dialogues, but changing graphics), assuming the
underlying language is still Perl? I used to use Perl/Tk. Perl/Gtk?
Something that runs in a web browser? Or something else?


R


Also https://google-developers.appspot.com/chart/interactive/docs/

--
Ruud


Re: sub signatures coming

2014-02-25 Thread Ruud H.G. van Tol

On 2014-02-25 04:45, Paul Makepeace wrote:

On Mon, Feb 24, 2014 at 2:04 PM, Steve Mynott  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)]


Some Perl alternatives:

sub pairwise_sum ($list1, $list2) {
[pairwise {$a + $b} @$list1, @$list2];
}

sub pairwise_sum (\@\@) {
pairwise {$a + $b} @{$_[0]}, @{$_[1]};
}

--
Ruud



Re: Quarantining crap HTML?

2013-05-21 Thread Ruud H.G. van Tol

On 21/05/2013 13:31, Dave Hodgkinson wrote:


In keeping with the spirit of the list, this isn't directly a perl question
but it might be part of the solution.

I'm picking up HTML from another site, and that HTML is pretty crappy.

Is there any way of quarantining it so it doesn't bugger up the rest of the
page?


If plain text suffices, involve lynx/links in -dump mode.

--
Ruud



Re: Random Perl Content

2013-05-18 Thread Ruud H.G. van Tol

On 19/05/2013 02:26, Ruud H.G. van Tol wrote:

On 18/05/2013 23:29, Abigail wrote:

On Sat, May 18, 2013 at 01:53:33PM -0700, Randy J. Ray wrote:



(It's a pun, see, because I'm going to be asking about random number
generators... get it? Get it...?)

(Short, TL;DR summary: I'm looking for a pRNG that can have multiple
instances at once that don't affect each others' stream of numbers. Does
Math::Random::MT meet that criteria?)

I considered posing this to Perlmonks, but I just don't frequent that
site like I used to. And there are enough Large Perl Brains on this list
that I should get as good an answer, if not better.

I am looking for a pRNG (pseudo-Random Number Generator) module. But I
have an unusual requirement-- I need to be able to instantiate multiple
*independent* generators, that can take seeds for the sake of
reproducible results. Let me explain...

My current (paying) job is writing frameworks for automated QA of my
company's software (mainly the operating system that runs our storage
servers). We are working on a new approach to how we structure some of
our tests, and that happens to involve the potential of using some
randomization to select different paths over a directed graph. But, this
being QA-oriented, even if something runs with a degree of randomness to
it, it needs to be reproducible at a later time. So, no problem, just
create a seed for srand() and log that seed, and also provide users a
way to specify a seed at the start. Then you can just re-use the seed
and reproduce your results. Right? Well, not exactly...

Other libraries I use, developed by other teams within our company,
might also have some randomization in them (like generating random names
for disk volumes, randomizing data generation for traffic testing,
etc.). Not to mention that we use no small number of CPAN modules, some
of which might use rand() as well. I could seed Perl's RNG with a
specific seed, but if that run has to try twice to generate a unique
file name, instead of one or thrice, that will affect the random numbers
*my* code gets.

So my thought was that sure there's a RNG module out there that is OO,
and encapsulates the seed and all other internal elements of the
generation process. One that I can instantiate multiple instances of,
and have them generate streams of random numbers that are independent of
each other. The closest I've found is Math::Random::MT, which implements
the Mersenne Twister pRNG. But I can't immediately tell from the docs
whether the object instances it creates are truly independent of each
other or not.

So, is this something anyone else here has dealt with? Are there modules
I just haven't stumbled upon yet, that would do this for me? Any help
greatly appreciated, as always.


I'm not aware of any Perl modules that provide this functionality,
but on my Linux box, there are the C functions erand48, nrand48
and jrand48. It would be fairly trivial to call those functions
using a few simple lines of XS.


Math::Rand48 looks promising.


perl -Mstrict -MMath::Rand48=nrand48 -wle '
  sub mk_rand { my $seed = shift; return sub {nrand48($seed)} }
  my $rand1 = mk_rand();  # same as mk_rand(0)
  my $rand2 = mk_rand(42);
  print "1:", join ",", map $rand1->(), 1 .. $ARGV[0];
  print "2:", join ",", map $rand2->(), 1 .. $ARGV[1];
  print "1:", join ",", map $rand1->(), 1 .. $ARGV[2];
  print "2:", join ",", map $rand2->(), 1 .. $ARGV[3];
' 2 1 2 1
1:214532096,2062273046
2:222611822
1:586787367,1729346018
2:1419417079


perl -Mstrict -MMath::Rand48=nrand48 -wle '
...
' 1 2 1 2
1:214532096
2:222611822,1419417079
1:2062273046
2:327232521,342130822

--
Ruud



Re: Random Perl Content

2013-05-18 Thread Ruud H.G. van Tol

On 18/05/2013 23:29, Abigail wrote:

On Sat, May 18, 2013 at 01:53:33PM -0700, Randy J. Ray wrote:



(It's a pun, see, because I'm going to be asking about random number
generators... get it? Get it...?)

(Short, TL;DR summary: I'm looking for a pRNG that can have multiple
instances at once that don't affect each others' stream of numbers. Does
Math::Random::MT meet that criteria?)

I considered posing this to Perlmonks, but I just don't frequent that
site like I used to. And there are enough Large Perl Brains on this list
that I should get as good an answer, if not better.

I am looking for a pRNG (pseudo-Random Number Generator) module. But I
have an unusual requirement-- I need to be able to instantiate multiple
*independent* generators, that can take seeds for the sake of
reproducible results. Let me explain...

My current (paying) job is writing frameworks for automated QA of my
company's software (mainly the operating system that runs our storage
servers). We are working on a new approach to how we structure some of
our tests, and that happens to involve the potential of using some
randomization to select different paths over a directed graph. But, this
being QA-oriented, even if something runs with a degree of randomness to
it, it needs to be reproducible at a later time. So, no problem, just
create a seed for srand() and log that seed, and also provide users a
way to specify a seed at the start. Then you can just re-use the seed
and reproduce your results. Right? Well, not exactly...

Other libraries I use, developed by other teams within our company,
might also have some randomization in them (like generating random names
for disk volumes, randomizing data generation for traffic testing,
etc.). Not to mention that we use no small number of CPAN modules, some
of which might use rand() as well. I could seed Perl's RNG with a
specific seed, but if that run has to try twice to generate a unique
file name, instead of one or thrice, that will affect the random numbers
*my* code gets.

So my thought was that sure there's a RNG module out there that is OO,
and encapsulates the seed and all other internal elements of the
generation process. One that I can instantiate multiple instances of,
and have them generate streams of random numbers that are independent of
each other. The closest I've found is Math::Random::MT, which implements
the Mersenne Twister pRNG. But I can't immediately tell from the docs
whether the object instances it creates are truly independent of each
other or not.

So, is this something anyone else here has dealt with? Are there modules
I just haven't stumbled upon yet, that would do this for me? Any help
greatly appreciated, as always.


I'm not aware of any Perl modules that provide this functionality,
but on my Linux box, there are the C functions erand48, nrand48
and jrand48. It would be fairly trivial to call those functions
using a few simple lines of XS.


Math::Rand48 looks promising.

--
Ruud



Re: PDF creation?

2013-04-21 Thread Ruud H.G. van Tol

On 2013-04-21 15:11, Ruud H.G. van Tol wrote:

On 2013-04-21 13:43, Mark Fowler wrote:



In a few weeks I'm going to want to be creating PDFs from Perl,
something I
haven't done in a few years. What's the recommended approach these days?
[...]


We like wkhtml2pdf.


Oops, the name is 'wkhtmltopdf'.

We create many thousands of PDFs per day with it. The binary has a 
'--read-args-from-stdin' parameter, which is nice for bulk operations.


--
Ruud



Re: PDF creation?

2013-04-21 Thread Ruud H.G. van Tol

On 2013-04-21 13:43, Mark Fowler wrote:


In a few weeks I'm going to want to be creating PDFs from Perl, something I
haven't done in a few years. What's the recommended approach these days?

I know I'm going to want to create the document from scratch, not fill in a
template, and I'm probably going to want multi-line text and basic drawing
(a horizontal line or two)


We like wkhtml2pdf.

--
Ruud



Re: French invasion

2013-02-27 Thread Ruud H.G. van Tol

On 2013-02-27 11:40, Philippe Bruhat (BooK) wrote:

On Mon, Feb 25, 2013 at 09:21:55AM +0100, Philippe Bruhat (BooK) wrote:



This is tonight! We should be at the Gunmakers around 7pm.

See you there.


Having safely returned back to France, I'd like to thank everyone who
came to the Gunmakers; we spent a very nice evening. And extra thanks to
James for pointing us to Neal's Yard Dairy: we took back some cheese (in
addition to the beers we got at the Jerusalem Tavern), and you'll all be
very pleased to read that I'll never speak ill of English cheeses again.


Relevant: 
http://www.cultbox.co.uk/reviews/episodes/6106-dancing-on-the-edge-episode-3-review


--
Ruud



Re: Updating lots of database fields in a single row

2013-01-23 Thread Ruud H.G. van Tol

On 2013-01-23 10:27, William Blunn wrote:


my @fields_to_update = grep { $hash->{$_} } @fields;


Be aware that it skips any false value, like undef, '', '0', 0.

--
Ruud



Re: Perl threads and libwww wierdness

2011-12-18 Thread Ruud H.G. van Tol

On 2011-12-18 08:43, Dave Hodgkinson wrote:

On 18 Dec 2011, at 02:57, Yitzchak Scott-Thoennes wrote:



If all you need is to return results of a discrete bit of work to the
parent, Parallel::ForkManager makes it trivial.


And the best way to return those results...?


Unless the exit code is information enough:
I like to call it "merge results", and involve a database.

--
Ruud


Re: website maintenance gig available

2011-08-03 Thread Ruud H.G. van Tol

On 2011-08-01 19:11, Dave Hodgkinson wrote:


please let me know off list


Did you also mean that all who don't will not be considered?

--
Ruud


Re: Cool/useful short examples of Perl?

2011-06-08 Thread Ruud H.G. van Tol


On 30 May 2011 11:40, Leo Lapworth  wrote:


I'm working on http://learn.perl.org/ and I'd like to have a few rotating
example of what can be done with Perl on the home page.



# see also perlvar: $BASETIME
{ my $t0 = time; sub elapsed { time - $t0 } }

--
Ruud


Re: ActiveMQ

2011-05-25 Thread Ruud H.G. van Tol

On 2011-05-25 19:33, Daniel Pittman wrote:

On Wed, May 25, 2011 at 02:10, Ruud H.G. van Tol  wrote:

On 2011-05-25 09:19, James Laver wrote:

On 24 May 2011, at 06:31, Daniel Pittman wrote:



Anyone here who used Spread recently?


I made trivial use of it in both testing and production to serve as a
collector for Apache logs.  It was very little trouble, and did the
job, but was relatively painful to expand the network since it
required restarts of the service.  The Apache log collector handled
that gracefully, but IIRC you need to specifically support it.
Performance was reasonable, but then...

I was using the 3.1 release at the time, though, so I have no idea if
4.0 or 4.1 improve on that.


OK, that is presumably fixed in Spread v.4:
"dynamic configuration of sets of daemons without requiring a restart".



It is supposed to be faster, lower level, taking<  1% CPU.


...CPU load on the network was comparable to the load on ActiveMQ
systems under similar load.  Spread isn't really much different
otherwise in terms of either speed, or being "lower level" (in either
the sense of being better for, or worse for, that. ;)


I still expect it to be lighter, because it is rather message-bus than 
message-queue. I can see it shine in multi-data-center environments, and 
for example be used for data replication.




If I had to pick a "does as little as possible" low level library, 0mq
looks like the best available choice, but it provides next to
*nothing* in terms of scaling; you have a toolkit for messaging and
get to build out the rest of the routing, scaling, persistence, etc
yourself.


Interesting indeed. For example the multicast-at-a-distance.
http://www.zeromq.org/area:whitepapers

--
Ruud


Re: ActiveMQ (was Re: Devel::Cover with Moose?)

2011-05-25 Thread Ruud H.G. van Tol

On 2011-05-25 09:19, James Laver wrote:

On 24 May 2011, at 06:31, Daniel Pittman wrote:



It is, presently, the best of the options out there in terms of scale


You mean apart from RabbitMQ? Rabbit is also the most full-featured of any of 
the free message queues I've come across.

My personal experience of using ActiveMQ is "don't: it'll cause you headache after 
headache". The same could be said of RabbitMQ, but we were doing some fairly 
tediously complicated stuff there (stuff that I believe would be impossible under 
ActiveMQ). Having watched people fight ActiveMQ trying to get it to do simple things, 
having watched people fighting Net::Stomp to find out why messages were being dropped at 
random sizes and having seen just how many times people wanted to go to the pub after 
dealing with ActiveMQ, I've already chosen RabbitMQ again for my current project.


Anyone here who used Spread recently?

It is supposed to be faster, lower level, taking < 1% CPU.

http://www.spread.org/

http://activemq.apache.org/how-does-activemq-compare-to-spread-toolkit.html

http://jeremy.zawodny.com/blog/archives/010511.html

--
Ruud


Re: YAPC Pisa

2010-07-08 Thread Ruud H.G. van Tol

Chris Jack wrote:


It's a long time since I sent credit card details by email and whilst I think 
it is obviously a very bad thing...


It is not even allowed by "the industry".
By fax is still OK, by email never was.

--
Ruud


Re: Lovefilm, yes or no?

2010-04-14 Thread Ruud H.G. van Tol

ian wrote:


I was once asked at an interview 'how many digits of PI do you know?'.


If phrased like that, I would ask "Decimal?" and then answer "ten", 0..9.

--
Ruud



Re: [ANNOUNCE] London Perl Mongers Technical Meeting 12th April 2010

2010-03-28 Thread Ruud H.G. van Tol

Luis Motta Campos wrote:

Dave Cross wrote:

On 03/27/2010 08:13 AM, Uri Guttman wrote:



and paul and i share the same birthday. not sure what that means.

I expect you'll find it's a coincidence :-)


As a mathematician I must say coincidences have really low probability
of happening...


So how odd is it to find a colloquial coincidence in a scientific statement?

--
Ruud


Re: On-topic: HTML/JS help please

2010-02-12 Thread Ruud H.G. van Tol

Ruud H.G. van Tol wrote:

David Cantrell wrote:



I'm going to be very rude to the next person to suggest something that
assumes I have a hierarchy of s instead of a .


No javascript:
http://www.xs4all.nl/~rvtol/DHTML/final_drop.html


More of that here:
http://www.cssplay.co.uk/menus/final_drop.html

--
Ruud


Re: On-topic: HTML/JS help please

2010-02-12 Thread Ruud H.G. van Tol

David Cantrell wrote:


I'm going to be very rude to the next person to suggest something that
assumes I have a hierarchy of s instead of a .


No javascript:
http://www.xs4all.nl/~rvtol/DHTML/final_drop.html

--
Ruud


Re: Brazilian PM looking for a job in London area

2010-01-11 Thread Ruud H.G. van Tol

Dave Cross wrote:

Chris Jack:

Solli:



[ Snip rather patronising English lesson ]


Chris


Yeah. That's _exactly_ the best way to make a non-native English speaker
feel welcome. Thanks for your input.


You are what you read. I liked it. But hey, I don't like softies.

--
Ruud

"don't like"? how soft!


Re: Perl Christmas Quiz 2009

2009-11-30 Thread Ruud H.G. van Tol

Abigail wrote:

On Mon, Nov 30, 2009 at 06:24:12PM +, Chris Jack wrote:



7) Write a one line program that takes a non-negative integer as an argument
and prints the square root when the answer's an integer.

Restrictions: the perl line should be a regular expression.


Just a regular expression? Regular expressions don't print, so that would
be impossible.


Though perl can print itself:

  echo 169 | perl -ple'$_="the square root"if/^\d+$/'

(this is not an answer)

--
Ruud


Re: Every other

2009-10-30 Thread Ruud H.G. van Tol

Dirk Koopman wrote:


Not certain why everyone avoids map and uses grep


grep returns aliasses, map copies.

--
Ruud


Re: Anyone hiring at the moment?

2009-09-23 Thread Ruud H.G. van Tol

Dominic Thoreau wrote:


At the moment head office for me is Amsterdam, and I work in small
outpost of three and a bit people.
I travel there several times a year - if anyone can get specific
recommendations about good places to eat in Amsterdam that charge on a
scale I can fit on my expense claims, that would be good.


www.iens.nl

Fine for me:
http://www.iens.nl/restaurant/1431/amsterdam-pakhuis-eetcafe-t
http://www.tripadvisor.com/Restaurant_Review-g188590-d753064-Reviews-T_Pakhuis-Amsterdam_Noord_Holland.html
(and plenty more like that one)

--
Ruud


Re: Anyone hiring at the moment?

2009-09-22 Thread Ruud H.G. van Tol

Richard Foley wrote:

What, relocate to Amsterdam, whatever for?  Without investigation, I'd be 
prepared to bet that booking.com does most of it's "booking" online, 
remotely.  So almost the entire client base is remote, all transactions 
completed online, it's entire business model is remote.  Except the 
workers...


Heh, I live a 3 minute walk from the booking.com Amsterdam office, so 
the work actually relocated to me when I joined about 3 years ago 
(though I ran my own businesses mostly from home in the 20+ years before).


The work done in Amsterdam (customer service, content, sales, IT, 
finance, HR, etc.) is central to all our operations. The people in the 
30 offices in cities everywhere else the world for example deal with the 
local hotels, and translate content (and some handle customer service 
when it is night in Amsterdam).


About two years ago it was decided to only hire developers that will 
work daily in the office in Amsterdam. Part of the IT work we do is of 
course closely related to the public website, but internal tools, 
interfaces, etc., are other significant parts. There is always more 
(development and upscaling) work coming up than we can do with the 
current group, so we keep hiring experienced developers at a steady rate.



At the moment, I'm living in Munich and working one week in Rotterdam and one 
week at home, working remotely via a very handy little SSH tunnel, you know, 
the sort which encrypts your data so companies don't have to be worried about 
leaking critical information when the defence minister leaves a folder of top 
secret documents about the invasion in the back of a taxi on his daily 
commute to work.  Mostly, I come in to work in Rotterdam every other week to 
show my face so that the project managers can see that I appear to be 
working.  I'm being a bit unfair to my current employer here, because I CAN 
work remotely half the time, but this doesn't excuse my still having to sit 
at my desk like a bozo the other half of the time.


The developers that don't work in the Amsterdam office (those that 
joined quite a while ago and don't live close) are in Amsterdam on 
average a day per week. Most of them work in (our variant of) Scrum 
teams, so they phone in to Amsterdam every morning while standing up 
anyway, but we still need them around frequently, for meetings and 
meetings and to talk about life and everything (like work) after work.



That the work is still 
completed, more efficiently and with milestones reached, when I am not in the 
office does not seem to register with most managers, as they appear to need 
to see head counts sitting at desks rather than having work completed on 
schedule.  It's not a results driven industry we're working in, it's a people 
counting and mini-empire building industry.  Sigh...


And we have always been short of a few more good heads.

--
Greetings, Ruud


Re: Measuring power

2009-04-30 Thread Ruud H.G. van Tol

Nick Cleaton wrote:


A computer is just a complicated heater, after all.


google search of the day: "human as a habitat"

--
Ruud