Friday, June 4, 2010

Ubuntu 10.4 upgrade and reset metacity bindings.

I've updated my laptop to Ubuntu 10.4. The upgrade went very smoothly, and I'm pretty happy with it. I needed to upgrade to thunderbird3 as thunderbird2 was having trouble sending mail to my work email server -- 50 seconds of single thread blocking doing the AUTH calculation on each send had made it impossible to work with.

The metacity window manager configuration has been changed considerably: the minimize, maximize, close buttons have been moved from the right to the left, and reordered. Rather than adjust to these new settings, I modified the configuration to put them back where they were before. This is a good reminder that I should go back to my own window manager and config. I'm not sure what will be best for the laptop, I am very happy with ion, at least with the ideas behind it, it's kind of a pain to configure. I still haven't duplicated my ion1 settings in ion3. Now that the developer gave up on it and switched to windows (sigh), I'm not sure if I should move on.

How to change the metacity button layout: Edit the gnome config for apps/metacity/general/button_layout, which is a string describing the button locations. I have changed mine to menu:maximize,minimize,close. Using the gconf-editor tool, navigate to apps/metacity/general, then find the button_layout option. Changes are immediate. Invalid button names are silently ignored, to future proof against updated button names in later configurations.

Thanks to lifehacker and how to geek for tips. Check out the howtogeek article if you need a walk through for gconf-editor.

Friday, May 28, 2010

The One Mile Solution! Get back on your bike.

An easy way to get back into biking/walking and save your soul (and our planet). Pick a one (1) mile trip, once a week, and bike or walk it instead of driving. Your car is least efficient on those short routes and you need the exercise anyways. win-win! What a great idea. As you get into the hang of it, you can add more trips via bike and extend to a few miles.

nearly half of all trips in the United States are three miles or less; more than a quarter are less than a mile.

--March/April issue of Sierra

Also, if you do the exercise and realize you have no destinations within 1 mile of home, why do you live there? move. seriously.

What if there was something you could do to improve your health and fitness, save money, reduce our dependence on foreign oil, improve air quality, and reduce your carbon footprint, all at the same time—would you do it?

Maybe that’s a bit of preaching to the choir here, but that’s the idea behind The 1-Mile Solution. As Andy Cline explains,

The idea is simple: Find your home on a map…Draw a circle with a 1-mile radius around your home. Try to replace one car trip per week within that circle by riding a bicycle or walking. At an easy riding pace you can travel one mile on a bicycle in about seven minutes. Walking takes about 20 minutes at an easy pace.


Read more: http://velonews.competitor.com/2008/12/news/legally-speaking-with-bob-mionske-the-1-mile-solution_86235#ixzz0p3YNvInf

The One Mile Solution at legally speaking

http://www.bicyclelaw.com/articles/a.cfm/legally-speaking-the-1-mile-solution

Wednesday, May 26, 2010

Volt DB

Another DB company from database guy Mike Stonebreaker (Postgres, Ingres, etc). Sounds fast and encourages the use of stored procedures and lets you write them in Java. Crazy. Anyone heard of this? tested it? using it?

Under the leadership of Postgres and Ingres co-founder, Mike Stonebraker, VoltDB has been developed as a next-generation, open-source DBMS that has been shown to process millions of transactions per second on inexpensive clusters of off-the-shelf servers. It has outperformed traditional OLTP database systems by a factor of 45 on a single server, and unlike NoSQL key-value stores, VoltDB can be accessed using SQL and ensures transactional data integrity (ACID). VoltDB is ideal for developers of ad serving, gaming, software as a service (SaaS), financial trading, on-line businesses and other systems with large, fast-growing transaction volumes because VoltDB scales out easily on low-cost servers while providing automatic high availability for 24x7 operation.

-- http://voltdb.com/voltdb-launches-next-generation-open-source-oltp-dbms

We had a lovely talk last month at LA Perl Mongers on Cassandra, a highly distributed, eventually correct key-value store with just a touch of metadata. This is just one of the current crop of key-value stores discussed as "NOSQL" (what a terrible moniker, but interesting ideas in the distributed key-value space).

I'm exciting to see an ACID compliant fast db. I do wonder what has been skipped to make it speedy. Can it persist to disk? snapshot to disk? Or do I just have to maintain enough of my live servers to keep the data up?

What project can I test this out with?
Postgres and Ingres father Michael Stonebraker is answering NoSQL with a variant of his relational baby for web-scale data — and it breaks some of the rules he helped pioneer.

On Tuesday, Stonebraker’s VoltDB company is due to release its eponymous open-source OLTP in-memory database. It ditches just enough DBMS staples to be faster than NoSQL while staying on the right side of the critical ACID database compliance benchmark for atomicity, consistency, isolation and durability of data.

http://www.theregister.co.uk/2010/05/25/voltdb_cloud_database_nosql/


Another question: how do I interact with the DB? I don't see a DBD::Volt namespace yet, and the db *really* wants to be called via stored procedures. From the FAQ:
3.4. Why doesn't VoltDB support ODBC/JDBC?

The primary interaction with a VoltDB database is through stored procedures, and the stored procedure interface (callProcedure) is easy to understand and interpret for those who are familiar with procedure calls through ODBC.

More importantly, although it is possible to perform occasional ad hoc queries on a live VoltDB database, you cannot modify the schema or perform other arbitrary actions through interactive SQL statements. Therefore a generic database connector is not useful when dealing with VoltDB.

Some comparisons also from the FAQ:
2.2. How does VoltDB differ from MySQL used with memcached?

Memcached is a distributed in-memory cache. It provides none of the reliability or consistency of an ACID-compliant SQL database. Memcached is often used as a cache in front of MySQL to improve performance of frequent transactions. But this requires the client application to manage the hash algorithms for both memcached and MySQL, as well as all of the transactional consistency and reliability between the two systems and across the cluster.

VoltDB automates all of these functions with none of the penalties, while providing similar or better performance. In addition, caching can help improve read performance for products such as MySQL, but does not help scale write performance. VoltDB scales linearly for both read and write performance.

2.3. How does VoltDB differ from a Key-Value Store (such as Cassandra)?

Key-Value stores are a mechanism for storing arbitrary data (i.e. values) based on individual keys. Distributing Key-Value stores is simple, since there is only one key. However, there is no structure within the data store and no transactional reliability provided by the system.

VoltDB provides the ability to store either structured or unstructured data, while at the same time providing full transactional consistency, reliability, and standard data access syntax through ANSI SQL. VoltDB can even define a transaction that includes reads and writes across multiple keys. Finally, VoltDB provides comparable or better performance in terms of throughput.

Thursday, May 20, 2010

Perl Survey is Live!

Perl: solving your problems since 1987
--me

From: Kieren Diment

The Perl Survey 2010 is now live. Its purpose is to better understand the demographics and opinions of the Perl community. You can complete the survey at http://survey.perlfoundation.org - it should take about 10 to 15 minutes.

Once you've done that, please let your relevant friends and colleagues know about the survey so they can complete it as well. My aim is to get a response of over 1000 individuals, and to run the survey (lightly adapted) every two or three years so we can see how the community changes over time. The official announcement of the survey is here:

http://news.perlfoundation.org/2010/05/grant-update-the-perl-survey-1.html


My notes:
  1. This is a well put together survey that looks like it has a good methodology, not just a survey-monkey one-off. It'll take a good 15-20 minutes.
  2. captcha required (boo)
  3. The survey is a bit clever with jscript/html and prevented me from filling it out on my iphone browser.

Tuesday, May 11, 2010

Perl, alive and kicking

Odds are, you didn't read about the 5.12 release outside of Ryan Paul's overview on Ars Technica. You see, Perl not being dead and just continuing business as usual doesn't make for compelling news. Also, let's admit, the Perl community has a great deal of competence in producing software, but couldn't market its way out of a soaking wet paper bag.

--Jeff Hobbs, Director of Engineering, ActiveState.

Interesting read over at ostatic.com, a guest piece by Jeff Hobbs. This topic is a proverbial discussion point in the perl community and has heated up quite a bit over the past year or two, "how to better market the awesomeness of perl?" It's hard to evangelize when we're busy getting stuff done. This article provides a nice collection of the arguments why 'perl is still relevant.'

Disclosure: ActiveState produces a professionally packaged perl for windows, so they are of course a bit biased into the pro-perl camp. (And they may be feeling some pressure from Vanilla perl now shipping a "normal" perl for windows).

Thursday, May 6, 2010

Unit Testing our Mental Models

Charlie Munger spoke for three hours at the Wesco financial meeting yesterday. Charlie is a wise old man. I played hooky from work yesterday to attend my third yearly meeting. The 1500 of us in the room don't get much in the way of money investment advice but instead lots of advice on time and wisdom investment. He is a big fan of mental models (of behavior) and checklists.

He speaks in frequent double-negatives. I believe this is a consequence of his mental patterns. Instead of "I do X," he'll say, "I avoid doing not-X." This is not insignificant. He has checklists in his head of behaviors to watch out for. These are his mental Unit Tests, he ticks through them to make ensure he's avoiding these (self-)destructive traps.

These checklists are based on years of watching people succeed and make mistakes. Mistakes are easier to notice and analyze and turn into rules of things to avoid, but only if looked at full on without sugar coating. These are the edges of the human veil of rationality, places where we still think we are rational but we are not. This is where damage and failure happen.

He watches for systemic failure of incentives: incentives that are misaligned with behavior that is good for society; systemic failures of the human rationality. Examples include selection bias, "I'm doing it so it's right", "I did well so I must have done the right thing", "it's tied to what I do for work, so it is ok."

You can see a great example of this in his interview this week with CNN Money and last week with CNBC about Lehman Brothers. When asked about why Lehman's Fuld was defective, he runs down a list of reasons. It's like he's reading off of a testing report. His first answer is so obvious to him, that he doesn't expand on it here. If your system is set to bring out the worst in people, you will get the worst in people, 100% of the time.

The system was all wrong. It wasn't that the people were so bad. The systems were all wrong. The systems brought out the worst in people instead of the best.


Q: What characteristic is it in Dick Fuld [...] that is defective?

A: Hard to name a defect he didn't have. [...] Yeah really.



http://money.cnn.com/video/news/2010/05/04/n_munger_lehman_fuld.cnnmoney/index.html

Dick Fuld would not be, for me, an exemplar of the best that can exist in investment banking.
[...]
Q: Worse than Bear Stearns?
A: Yes.
Q: Why?
A: Meglomania.
Envy Driven.
Poor Cognition.
Isolation.
And of course, its an interesting example of corporate governance. 'Cause You didn't have to be very wise to see that the place had the wrong leaders and they had a board that did exactly nothing to fix their problem.

Looking at this interview with an adware author (Thanks for the forward, J^K), I see that interviewee has learned one of these models, the power of gradualism. He inadvertently shows that he is unaware of another, the tendency to dehumanize the other end of a business transaction to make it easier emotionally to take advantage of them. It doesn't sound like he's aware that he's marginalizing his target: first they're less-savvy, then they're apathetic or ignorant. This first model is helpful to him to feel better about his reprehensible actions while the second helped him to take those actions. Which model and associated tests will be more effective in your mental toolbox?

It was funny. It really showed me the power of gradualism. It’s hard to get people to do something bad all in one big jump, but if you can cut it up into small enough pieces, you can get people to do almost anything.

Most adware targets Internet Explorer (IE) users because obviously they’re the biggest share of the market. In addition, they tend to be the less-savvy chunk of the market. If you’re using IE, then either you don’t care or you don’t know about all the vulnerabilities that IE has.

You'll hear echos of these sentiments from all of the bankers being interviewed on Capital Hill. They are too close to the problem to be aware of their model deficiencies. The brief period where our anger can trigger change is slipping away. How shall we find the root problems and re-engineer the incentive system to keep them from reoccurring?

Tuesday, April 27, 2010

Perl Mongers!

I'm looking forward to seeing y'all tomorrow at 7pm and
am excited for Aran's and Ralf's presentations.

--Andrew

                          Los Angeles Perl Mongers[1]
          The Perl Users Group of the Los Angeles Metropolitan Area
     __________________________________________________________________

Upcoming Events

  LA.pm's next meeting
   What:  Los Angeles Perl Mongers Meeting
   When:  7-9pm
   Date:  Wednesday, April 28, 2010
   Where: The Rubicon Project HQ - 1925 S. Bundy, 90025
   Theme: Perl!
   Food:  Pizza and beverages provided.
   RSVP:  Responses always appreciated.

    Presentations:

    1. Aran Deltac: Cassandra : A highly distributed, eventually
       consistent, distributed, structured, key-value store.
    2. [2]Ralf Pieper : Cloud Computing use Cases


Links:
   1. http://la.pm.org/
   2. http://r.mooo.com/

Powerpoint considered harmful

Enemy Lurks in War Briefings - PowerPoint - NYTimes.com
We Have Met the Enemy and He Is PowerPoint

Military commanders are concerned that computer-generated charts and bullet point lists stifle discussion, critical thinking and thoughtful decision-making, as well as take up too much time.
[...]
“It’s dangerous because it can create the illusion of understanding and the illusion of control,” General McMaster said in a telephone interview afterward. “Some problems in the world are not bullet-izable.”
[...]
Senior officers say the program does come in handy when the goal is not imparting information, as in briefings for reporters.

Source: http://www.nytimes.com/2010/04/27/world/27powerpoint.html



Death by Powerpoint blogpost expands on the comments at the end of the times article about the 2006 allegations that Tommy Franks sent battle plans by powerpoint. Would this slide help you plan for combat?

Grousing about the destructive nature of powerpoint on presentation skills is not new. Yet, I hadn't realized how much powerpoint style programs are being used outside of presentation space to replace technical documentation and scientific reports.


Edward Tufts has written two editions of The Cognitive Style of PowerPoint: Pitching Out Corrupts Within. In PowerPoint Does Rocket Science--and Better Techniques for Technical Reports he asks a difficult question, Did powerpoint make the Space Shuttle crash?. The comments on that article are of unusually high quality. I read through them all with a sense of building anticipation. This meme is riffed upon in a washington post article, PowerPoint: Killer app.

What to do?

Find a method of presentation that minimizes impedance mismatch with your audience and your data. Tuft recommends a one duplex 11x17 paper for a 3 hour talk. Find a way to present idea and defend it with data that works for you.

A commenter recommended The A3 Method of report generation (named for A3 sized paper (equivalent to US B sized 11 x 17 )) presentation style adapted from practices as Toyota.
In Tuft's workshops, [he] describes how to replace PowerPoint presentations with 11 x 17 sized reports, and provides many good arguments for why "engineering by PowerPoint" doesn't work very well.
Tuft replies warning that this may just be a BMF: Business Methodology Fad:
In the Beautiful Evidence chapter on corrupt techniques in evidence presentations, the section on over-reaching concludes with this: "When a precise, narrowly focused technical idea becomes metaphor and sprawls globally, its credibility must be earned afresh locally by means of specific evidence demonstrating the relevance and explanatory power of the idea in its new application." (p. 151)


Anytime you pare down your presentation to fewer words and fewer pictures, you have an opportunity to reduce fluff and focus on the primary point of the presentation. Practice examples include turning a 5 minute talk into a 30 second elevator pitch. What do you keep? Once you've pared it down to 30 seconds, expand it back to 5 minutes by including explanatory details. (Expanding it back will be even more difficult than slimming it down).

NEED 2-PAGE SHORT STORY TWO DAYS.

Mark Twain replied:
NO CAN DO 2 PAGES TWO DAYS. CAN DO 30 PAGES 2 DAYS. NEED 30 DAYS TO DO 2 PAGES.

If you're going to be trapped using powerpoint, you might as well learn to use it well via a book like Beyond Bullet Points
. Science daily has an article on how to report scientific research to a general audience
Extreme Presentation claims to be extreme. I have a couple more presentation books on my bookshelf, e.g.: Present Like a Pro: The Field Guide to Mastering the Art of Business, Professional, and Public Speaking

[...] factor that constitutes my own violent objection to its prevalent use, that being that increased reliance on PP and other visual aids in education, training, project and crisis management fundamentally undermines the active involvement and cognitive engagement of the target audience/students/team members by converting the desemination of information to a passive presentation.

Kerry Parslow (email), February 9, 2007

It's easy to blame the tool ... but I think .ppt is just a symptom of something else. There are two sides: authentic presentation and authentic listening. We need both.

-- Dennis Allen, September 12, 2006
Don't forget your audience. You may utter as much as you'd like, but it isn't communication until your message is actively listened to by your audience. Until they've listened and you've agreed a plan for action and turned that into work items, it is at best good intentions.
"...it is the recipient who communicates. The so-called communicator, the person who emits the communication, does not communicate. He utters."

— Peter Drucker


Another approach is to free yourself completely from format by following the data. In this TED talk, Hans Rosling shows the best stats you've ever seen you'll find some amazing live visualization of world statistics. Find out more at his site Gapmind.org

Not to be outdone, The Gettysburg Address, power point edition.

Update:


Did I mention I write my perl mongers presentations in Vroom::Vroom, a perl + vim tool for presentations. It is very simplistic, I'd actually like to add some structured markup (markdown or similar) to give the slides a bit more clarity. (or do I just want some style and punch?). Presenting code in the my development environment means I'm not placing an unneccessary presentation layer between myself and my audience.
It doesn't just look like vi, it is vi.

"You look like you're presenting in vi or something," remarked a new attendee.
"Yeah, I'm presenting in VIM," I replied.

--Los Angeles Perl Mongers, March 2010 meeting.

I can interact live with the slides, run the code snippets, include external files and more: all with syntax highlighting. The presentations can be exported to the standard vim format or to a minimal web template. When displaying in gvim, you can even change the font!

Example slides in html or raw vroom formats.

Tuesday, April 20, 2010

Management Rewired

This morning I finished reading Management Rewired ( website ). I like both management books and brain/mental model books. This book is both. The brain analysis is slightly filtered as the book is written by a experienced management guy who has done reading of the research rather than directly from the researchers. This is more than compensated for by the management insight provided by his years of consulting.

Our conditioning towards Aristotelian logic traps our thinking to believe that we can rule by fear, intimidation and force, that aggression can be met by aggression. The brains ability to absorb dissonance and warp input to match expectations keeps us trapped. Only when confronted by a sufficiently large shift will this action of expectation matching be overwhelmed and then the process of finding a new model will begin.

We can force this shift by extreme changes in the rules of the game. The biblical command to "turn the other cheek," works in this regard. By refusing to escalate violence, we demonstrate the irrationality of escalation. From within the system, escalation seems like the only option. To allow other options, we must change the rules of the system. This book recognizes the dolphin experiment, we have Pavlo's later experiments on changing mental conditioning, we have the "hit bottom" approach of AA: all of these require extreme measures. Forcing the participant to the edge of their system so they have no choice but to reinvent.

We can also trigger the same reaction through story telling. This is easier to manage, simpler and less threatening. Here-in lies the difference between Leadership and Management, claims our author. In his view, the manager is interested in incremental changes through a process of reward and punishment. The leader is a story teller who sees a new and different outcome and rallies those around him to internalize the vision and lead themselves to the new outcome. This is not a trivial problem.

Our author does include a 5 step list of requirements for our game-changing story. More on that tonight when I update this article.

Friday, April 16, 2010

Today's morning research :Graph theory. also CPAN is awesome.

I spent the morning thinking about software interviewing. It's a been a couple of months and I have candidates to interview today and Monday. I was hoping to find a couple of nice topics for a non-trivial yet simple code project for an hour long pair session at the end of the day.

But then I stumbled across this thread, again. And I realized that while I've actually studied up on most of that stuff recently, Graph Theory is still sitting, waiting on some virtual shelf.

So now on the reading list we have MIT Discrete Math (Why do we still not have a Caltech Open Classware type thing?), Algorithm Design Manual, which I started browsing at googlebooks. 15-251 at CMU, check out the wiki perhaps? I already have Knuth's discrete math book in my queue, and the depth of my reading queue keeps increasing.

Jarkko Hietaniemi's Graph module is up to version 0.94. Does it really have the Graph-0.20 compat layer still? I read the manual and the source this morning. It's lovely code: clean object layout leads to tons of small functions that are self commenting. Sometimes I forget how awesomely easy it is to browse to the source of random cpan modules and to read through the tests or random files like this design doc. Do you ever forget how awesome it is to breathe? It's like that.

A side note on queues, remember your basic theory: size of the queue is controlled by the flow rate in and the flow rate out. And the corollary: the average time through the queue ( average length * average outflow ) is also directly correlated to the inflow and outflow. If your queue is continually increasing in size or books are sitting on the table for too long, then you need to either increase the outflow or decrease the inflow to shrink the queue. So take the time you would spend adding new content to the queue and focus that time instead on pulling out of the queue. Consume Knowledge.

Yes Simba, I'll take you on a walk now. Sorry you had to wait for two+ hours while I read and blogged from 6:30 to 9, but these thing happen.

Thursday, April 15, 2010

On ideas, decisions and actions

Ideas are somewhat like babies--they are born small, immature, and shapeless. They are promise rather than fulfillment. In the innovative company executives do not say, "This is a damn-fool idea." Instead they ask, "What would be needed to make this embryonic, half-baked, foolish idea into something that makes sense, that is an opportunity for us?"
--- Peter Drucker
I really love this quote about ideas and the mandate to listen and take action. It's so easy to offhandedly dismiss an idea as foolish or lame. It takes a concerted effort to listen and look outside of our comfort zone and think "how can I take this idea, and improve it and turn it into an opportunity."

David Allen in Getting Things Done spends some time discussing how most companies go about so-called brain storming starting from "who's got a good idea." At that point, they're already behind. By applying a filter of "is this good" while fleshing out idea possibilities we lose "bad" ideas that could have lead to good ideas, and we stifle creativity. The subconscious is very fickle and will clam up if you don't appear to be ready to listen. His thesis is that we tend to do the correct 5 steps, but in a ineffectual reverse order.

Brainstorm first, then filter as a second pass. Over at manager tools they refer to this as the "peanut butter rule." During brainstorming, the facilitator writes down every idea suggested, with no regard for quality only quantity. "If you say 'peanut butter' I'm writing it down."

"In fact, no decision has been made unless carrying it out in specific steps has become someone's work assignment and responsibility. Until then there are only good intentions."
--- Peter Drucker
What do we do once we have these new ideas? We must turn them into action. Specific actionable goals, that are then added to someone's work queue and tracked. This is one of Peter's more eloquent quotes, I love the innuendo implied by good intentions.
le proverbe tiré de notre saint Bernard, ‘L'enfer est plein de bonnes volontés ou désirs’
The proverb from our Saint Bernard, "Hell is full of good intentions and desires"
---- St. Francis de sales, Letter lxxiv.

@ideas = brainstorm();
discuss(@ideas);
@actionable_ideas = grep { is_good($_) } map { extract_kernel( $_) } @ideas;
map { $work_queue->add($_), $work_tracking->add($_) } @actionable_ideas;

Now get out there and make some ideas! listen to some other ideas! Get those ideas out of your head and turn them into action plans. Then take action. Boom, change happens.

"Are you ever gonna run out of ideas?"

I run out of ideas every day. Each day I live in mortal fear that I've used up the last idea that will ever come to me.

If you don't want to run out of ideas, the best thing to do is not to execute them. You can tell yourself that you don't have the time or resources to do 'em right. Then they stay around in your head like BRAIN CRACK. No matter how bad things get, at least you still have those good ideas... that you'll get to later.

Some people get addicted to that brain crack. And the longer they wait the more they convince themselves of how perfectly that idea should be executed. They imagine it on a beautiful platter with glitter and rose petals. And everyone is clapping for them.

But the bummer is, most ideas kinda suck when you do 'em. And no matter how much you plan, you still have to do something for the first time. You're almost guaranteed the first time you do something, it'll blow. But someone who does something bad three times and fails, still has three times the experience of that other person who is still dreaming of all that applause.

When I get an idea, I try to get it out of my head and into the world as fast as possible, because I certainly don't want to be addicted to BRAIN CRACK.
--- Ze Frank 2006-July-11

Tuesday, April 13, 2010

To see the world with child-like wonder is not childish. It is enlightenment.
Andrew Grangaard - 2010-Apr-13

Wednesday, April 7, 2010

use libs $FindBin::Bin considered harmful

It's time to stop using FindBin::Bin to find the location of our perl programs, when we already have that in $0. If we aren't going to use FindBin::Bin to prime the libs directory, what should we be using to pull in relative directories?

The FindBin version:
Begin{ use FindBin::Bin; use lib "$FindBin::Bin/../lib"; }

A File::Basename + Cwd version:
use Cwd qw(abs_path);
use File::Basename qw(dirname);
use lib dirname(abs_path($0)) . '/../../../../lib/perl';

A File::Spec + File::Basename version:
use File::Basename qw(dirname);
use File::Spec;
use lib dirname(File::Spec->rel2abs( $0 )) . '../../../../lib/perl';

Quoting a chunk of Tye's post from the perlmonks discussion.

Well, I've complained about this particular module before because I think the perverse way in which it was implemented is quite unfortunate because it makes it nearly impossible to use it for lots of useful things like finding other programs that might be on your PATH. (After all, it is called FindBin and $0 is a script, not a binary.)

But when this question came up in chatterbox, I did some checking and it appears to me that the correct answer for the full path to the current script is simply: rel2abs( $0 ) as another answer mentions.

For those that don't know, the (perverse) FindBin module goes through some effort to search $ENV{PATH} trying to find your script. However, I can't come up with any situation in which the script would have been found on the $ENV{PATH} but that $0 would not contain the (full) path, so the module appears to be pretty useless.

-- Tye on perlmonks.org

Posting, since I can never seem to find this snippet when I need it.

I'm really only interested in the case of automatically pulling in my modules from my test directory, for work code. When writing modules, I use Dist::Zilla and dzil test to set the paths. When running random .t files, I use FindBin::libs to automatically pull in libs/ directories from farther up the path. (which uses FindBin, but is really handy). FindBin::libs source

Tuesday, March 30, 2010

March LA Mongers Recap

Another excellent mongers! Thanks to the MANY who showed up!

Tommy's talk on "git your ~" was interesting and detailed. It was interesting enough to pull Randall out of the woods to come debate. I wish I could have paid closer attention, but I was busy answering the door and dealing with the pizza dude and taking Simba(my new puppy) on an impromptu walk.

During the downtime/discussion time after git and pizza, I had enough time to make a lightning talk on Dist::Zilla. The CPAN authors in the crowd all seemed to have the same reaction of "awesome, that will make releasing modules so much more painless." I didn't even get to the point of showing git interaction or autopost-to-cpan plugins. We had some nice crowd participation (thanks Simba).

Excellent spirited discussion during the unstructured q&a / free chat portion. We are a fun group. Sorry I had to rush everyone out at 11, but Simba is not one to be kept waiting. See you again next month!

I'll update when we get the slides up.

Monday, March 22, 2010

Convert::Binary::C

I stumbled across a new module this morning, Convert::Binary::C. The premise is simple and clever: rather than manually maintaining pack/unpack statements to read/write data from C structs, use this module to parse the c header files and create the pack/unpack routines for you. Oh and it takes into account compiler settings too. For the Win!

I don't have anything to use this in right now. But when I do? Blammo!

DESCRIPTION ^

Convert::Binary::C is a preprocessor and parser for C type definitions. It is highly configurable and supports arbitrarily complex data structures. Its object-oriented interface has pack and unpack methods that act as replacements for Perl's pack and unpack and allow to use C types instead of a string representation of the data structure for conversion of binary data from and to Perl's complex data structures.

Actually, what Convert::Binary::C does is not very different from what a C compiler does, just that it doesn't compile the source code into an object file or executable, but only parses the code and allows Perl to use the enumerations, structs, unions and typedefs that have been defined within your C source for binary data conversion, similar to Perl's pack and unpack.

Beyond that, the module offers a lot of convenience methods to retrieve information about the C types that have been parsed.

March Los Angeles Perl Mongers

Are we really having a meeting on Wednesday?

I see I updated la.pm.org ot list Wed Mar 24. However I haven't planned anything yet. Need to listen to that voicemail from Tommy, hopefully it's him saying his presentation is ready.

I need to see if I can still reserve CTU and get approval for offsite people. We had an "incident" with some random people wandering around and now my event is in limbo. Annoying.

Thursday, March 18, 2010

POD is not literate programming

I frequently come across assertions that POD, Perl's documentation system, is an example of `Literate Programming'. [...] But POD is not literate programming.

Why is this important? POD is a really good idea. But literate programming is an even better idea. Perl has a long history of borrowing good ideas from elsewhere. If we go around thinking that POD is literate programming when it isn't, that'll lead us to disregard literate programming when we hear about it. ``Oh, I already know what that is,'' we'll say. But we don't know what it is, and since it's such an excellent idea, it would be a shame if we missed out on it just because we thought we already knew what it was.

--Mark-Jason Dominus, March 20, 2000.

MJD wrote this quick article for perl.com ten(10) years ago this week. Where have we come since?

We have some slightly more flexible POD systems. I'm using Pod::Weaver with Dist::Zilla (via Dist::Zilla::Plugin::PodWeaver )to post-process my modules to move the POD around.

This lets me write in pseudo POD with tags like =method which will then be gathered and turned into appropriate sorted =over, =item entries and all the POD put together after the __END__ block. Pod::Loom looks like a similar system, which also has a Dist::Zilla plugin.

This is a much more fun and interesting way to write my POD, but this is still not literate programming. I want a weaver that will stitch together a nice TeX output suitable for a journal. That would be HOT.

Friday, March 12, 2010

NYC! PAR::Packer!

For a city that never sleeps, morning sure rolls around early in Manhattan
--me
I'm spending a week back in NYC. James is getting married on Sunday! It's been too long since my last visit, I almost forgot the feeling of awesomatude.

Working out of the RubiconProject:NYC office is reinvigorating me. It's so small and full of energy. There are only like 11 desks (soon to be 13). Think particle in a box. Eating lunch around the big round table is very familial. 16th and 7th ave is a nice location with big windows and high ceilings. Last night I walked to Union SQ, the east village, and west village and meat packing district. Mike B keeps the office running smoothly and puts on a solid music mix. Len's got 5 client facing meetings today, it's great to see that kind of flow in the pipeline. zoom!

Waking up at 9am local (6am brain time) is taking an interesting toll on my ability to concentrate on code. Recognizing this I'm working on different problems like using pp to produce a self contained perl script to simplify pushing to the hadoop cluster. I eventually pushed through the biggest hurdle which was ... not verifying my initial conditions.

Turns out someone had some strange code in a standard location that conflicted with the local modules on the box I was using for the build. Private namespace collision 3 names deep? Really? That and DBD::mysql didn't get included into the PAR and/or .pl even with the -B flag to pp. I just forced a yum update install perl-DBD-mysql install on all the target boxes to bring in mysql, DBI and DBD:::mysql ( which is supposed to be in our base builds), and now it's working.

pp is in the PAR::Packer distribution. Give it a spin if you ever need to bundle up an app with all its modules as one bundle. Outputs any of PAR, self contained .pl, or self contained binary that doesn't require perl to be locally installed.

Thursday, March 4, 2010

perlmonks

You gained 7 experience points. Maybe you should blog about it.
--perlmonks.org
Hey, when was the last time you were at Perlmonks.org? Go answer some questions, it'll remind you why you love perl so much.

Here I answer a fun classic unix programming question: How do I change settings in my shell from a program?, with the general answer of "no." Has anyone actually gone through the windy path I mention of manually poking into the memory space of the parent shell to change settings? Totally Grody, yet it'd be awesome in its peversity.

Division by zero isn't impossible, it's just really really hard
-- old blacker hovse quote about the Division by Zero suit (tm).

OK GO at LACMA

IgniteLA was fun on Monday. The final presentation by Syynlabs (aka Mindshare.la) about their new Video for OK GO really stole the show.

On Friday, LACMA will be hosting the "West Coast Premiere" of the video. OK Go will be on hand and do a live acoustic set. It's a benefit for the LACMA Muse program. I'll be there, will you? Get your $22 tickets now.

PS. The next MindShare is Thursday March 18th. Buy your tix now!