For a distribution that is built using Dist::Zilla, it is very easy to install all the dependencies:
dzil listdeps | cpanm
dzil listdeps will almost build the distribution so it can determine the prerequisites and then list them each on one line. This list can be passed directly to cpanm.
Just another day at the office moving databases into MySQL. 10 lines of DBIx::Class::Schema::Loader make_schema_at() and I'm done. :)
Usually.
Unfortunately today the table names "Order" and "Service-tier2" blow up:
Bad table or view 'Order', ignoring: DBIx::Class::Schema::Loader::make_schema_at(): DBI Exception: DBD::mysql::st execute failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Order WHERE ( 1 = 0 )' at line 1 [for Statement "SELECT * FROM Order WHERE ( 1 = 0 )"] at refresh_schema.pl line 9
Apparently "Order" is semi-reserved by MySQL, and dashes are trouble:
SELECT * FROM Order # syntax error
SELECT * FROM `Order` # works
SELECT * FROM Service-tier2 # syntax error
SELECT * FROM `Service-tier2` # works
Another point for irc.perl.org #dbix-class, as ilmari pointed me to quote_char as the cure for what ailed me.
In my last post, I explained how to get an AnyEvent->timer to work in a Dancer application.
There’s nothing wrong with timers, but if you are using AnyEvent, you usually have to deal with CondVars. There are two things you can do with a CondVar: Either you register a callback which will be called when the CondVar is triggered, or you call recv and it will block until the CondVar is triggered. In a route of your Dancer application, you probably want to block until you got all the data you want to display to your user.
Take the following (made-up) example which uses a CondVar:
Our 2011 January meeting will feature Greg Lindahl speaking about blekko. Location forthcoming.
blekko is a new Web-scale search engine, offering focused searching using "slashtags", which enable you to restrict search results to the specific sites of actual interest. We'll use some open-source slashtags as examples. The rest of the talk will focus our implementation of the search engine and the underlying NoSQL database using Perl+XS, Map/Reduce done better, tuning Linux for good performance, etc.
Greg Lindahl is CTO at blekko. He was previously a founder at PathScale, where he was the architect of the InfiniPath low-latency InfiniBand HCA, used to build tightly-coupled supercomputing clusters. Prior to PathScale's founding in 2001, Greg worked on commodity Linux clusters at HPTi, including the 1999 Forecast Systems Lab system, which was the first time a Linux cluster won a conventional supercomputing procurement. Greg first used Perl before the Camel Book was written. Perl: the swiss army chainsaw of programming languages!
As we began working on iCPAN, we became aware of how problematic it can be to figure just exactly what is in the CPAN. More importantly, we became aware of things we really wanted to do when interacting with CPAN. Last month, Dave Rolsky posted some comments on a next generation CPAN search . He has a fairly extensive list of things which a CPAN search could offer and I'm more than inclined to think that he's on the right track.
A CPAN search site should:
be available to the wider community to clone, fork, patch, pull etc
let you upvote/downvote modules
have tighter integration with reviews, dependency reports etc
allow for complex searches
There are really so many things it could be. The problem, as I see it, is that this is too big a job for just one person and that may be where projects have stalled in the past.
The recent discussions about yacc made me
feel a bit like Lee Van Cleef in an old
spaghetti Western.
Cast alongside Clint Eastwood, Van Cleef watched
with great concern as one attempt after another
was made on Eastwood's life.
Van Cleef didn't mind Eastwood getting killed --
he just wanted to be the one to do it.
In our Hackerspace RaumZeitLabor in Mannheim, Germany, we have a "Network Power Manager 2000" which is a device that has 8 power sockets and is able to turn these sockets on/off when told so via network. We use it to save some power when nobody is at our space.
That sounds quite nice, but we had to reverse-engineer the protocol. Afterwards, we noticed that only one (!) connection to that device is possible. So our first approach of using a little script to communicate with it was not optimal: It had timing problems because the NPM2000 took a little bit longer to close the TCP connection.
Therefore, I decided to write a little webapp using the excellent Dancer framework which talks to the NPM2000 and provides a nice API to the user(s). It also should keep one TCP connection open all the time to save the overhead of creating a new connection and waiting for old connections to close properly on both sides.
When talking about an affordances, it turns out that there are different definitions, but I like to think of an affordance as "an element of design which suggests the correct course of action", which seems to be pretty much what Donald Norman meant when he adopted the term. It's an elegant concept which, if applied properly, makes it easy to do the right thing and harder to do the wrong thing. However, sometimes you want to do the wrong thing, so an affordance which makes this impossible isn't the most useful in my book. I just want doing the wrong thing to be jarring enough that it would give anyone pause.
And this brings me to the following issue I often see in SQL:
SELECT count(*)
FROM employee
WHERE salary < 20000;
Suggestions are welcome in which widget toolkit is the easiest to learn and use to create a GUI program in Perl. Most people suggest using Java and Swing as the easiest and the most accomplished language and widget toolkit to use. Yes, I could use Java and Swing but I would prefer to use Perl.
Until recently, while I thought currying was kind of cool, I did not really understand what the use of it was. I call a function and I am done with it. It was not until I was cleaning up some code in my football predictor project that I started to understand how currying could make your life easier.
Let us say that you have a function that takes an input and based on that input does some calculations. Now, this is normal in Perl. For instance,
What an odd thing to write... I've been developing software in one way or another for about 30 years and Perl has been my primary language since around 1993. And yet I don't have a single CPAN module to my name and haven't really been involved in the community at all other than thanking the stars that it exists and produces such fantastic things.
So, I suppose, consider this my hello.
Interestingly, I find myself being pulled more and more strongly into the vortex because of my involvement as one of the core developers of Melody. As great as Movable Type has been (and as proud as I am that it's being used here on blogs.perl.org), it's a mess of years-on-years of internally-focused development. With Melody, we're trying to unwind the mess (without unwinding the features) so that we can continue to make it even better in a far more efficient and community-driven way.
To those bloggers that may have received a similar email, I have been told that it may have seemed spammy, and I apologize if so. I'm just very excited about this project and would like to see it help as many people as possible. –Michael
My name is Michael Schade, I'm a nineteen-year-old entrepreneur, student, and frequenter of the St. Louis Perl Mongers. I have been collaborating with Dr. Kevin Scannell on the free, open-source, and Perl-based Accentuate.us, a web service that is a new method of input for over 100 languages. It allows users to type text in plain ASCII and, using statistics, it will add the diacritics, which have special meaning in many languages, automatically. Improving computer input is crucial to saving endangered languages, and we have chosen Perl to aid us with this task.
Now, instead of returning a straight DBI connection handle (a DBI::db object), it returns a Dancer::Plugin::Database::Handle object, which is a subclass of DBI::db, but adding new quick_insert, quick_update and quick_delete methods, allowing you to do, for instance,:
# in your Dancer app:
database->quick_insert($tablename, \%data);
# Updating a record where id = 42:
database->quick_update($tablename, { id => 42 }, { foo => 'New value' });
So, let's say you want to handle a POST request containing a name of someone to add to your Christmas gifts list. It could be as simple as:
Padre 0.76 was uploaded to Pause on Wednesday night my time (.au), I didn't have it in me to write up the release announcement at the time, and somehow last night slipped by completely. So while I wait for my son's end of school year presentations to begin, I'll try to be a little more productive with my time.
0.76 once again sees a lot of work done by two main contributors, Ahmed Zawawi and Zeno Gantner.
It also sees a great response from the translators with a late call for translations by Zeno just prior to release.
I have so say that the most marked change I noticed when I fired up 0.76 for the first time was the changes to the Syntax Check tab done by Ahmed. This is a much needed improvement to one of my more used features of Padre. Great work Ahmed and thanks!
OK, so what's come through this development cycle:
Zeno made a number of changes, improvements and fixes:
Earlier I replied to Ovid’s post Perl101: Red to Green Gradient about how to create a gradient that is closer to being accurate. (Rafaël had pointed out that Ovid’s didn’t properly deal with hue and intensity.) The problem with the more accurate approach is that Ovid wanted one that shifted from red to yellow to green and my version did not do that.
So I give you a better (although still not 100% accurate) solution. It has not yet been optimized. It may have bugs. Your mileage may vary. Some conditions and limitations may apply. Yadda yadda yadda.
Note: the following technique is not friendly to the color-blind.
I sometimes find that I want to visual data with color. Specifically, I want to use red for "bad" and "green" for good, with a linear gradient in between. As I'm often building Web pages, that means I want:
Color code
Result
#FF0000
Bad
#FFFF00
Bad-Average
#FFFF00
Average
#7FFF00
Average-Good
#00FF00
Good
In other words, I want a smooth, linear gradient from red to green for any number in a range. I'm always hitting a search engine for an example, so I figured other people could use this, too.