Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Lecar_red (5694)

Lecar_red
  (email not shown publicly)

Journal of Lecar_red (5694)

Monday July 28, 2008
01:01 PM

Why can't you assign a value in ternary operation?

I'm sure there is a good reason why this works the way it does.

If I set a local variable inside a ternary operator like:

print ( my $foo = bar() ? $foo : "unknown" )

It works very closely to my expectations (which I'm sure are off). If bar returns any flavor of false, it will print the "unknown" value. And if bar return true it will call the correct part of the operation. But the local variable assignment will not be set so the output will be an empty string.

Anyone know why? Is this a scope thing?

P.S. Yes, I know there are other ways to do this with string printing. In my real world case, I have a much more delicate assignment and would like to cleanly assign and evaluate in one line. Plus I'm curious :)

Tuesday June 12, 2007
02:24 PM

Ominous cvs log message

CVS log message:

I think this adds everything for the XXX into the tree

Unfortunatly, the I thought incorrectly

Tuesday May 09, 2006
01:45 PM

Deliberate Practice and Perl

I was reading an interesting article in the NY Times in the continuing series of Freakonomics. This article was discussing how over 50% of successful soccer players (footballers) were born in the first three months in the year. In it they discussed some research about the effectiveness of "Deliberate Practice". I wasn't aware of it but delibrate practice involves more complex actions than just repeating according to the article it "entails setting specific goals, obtaining immediate feedback, and concentrating as much on technique as on outcome". Perl fits very well into the technique since it provides pretty instant feedback and often Perl coding involves focusing on technique along with results. I'm sure there are other ways as well.

It also strikes me as yet another good reason to code test cases. Quick feedback to help cement learning.

The article is well worth a read over on the Times site.

Monday January 30, 2006
12:05 PM

Determing the best tool for the job

The other day, a friend and I were having lunch and discussing programming languages and technology. I have been reading a few posts above language advocacy and the problems with any type of advocacy (it turns religous instead of being rational, it leads to the person advocating not being taken seriously, etc.). I have no problem with python (i kind of like the clean syntax), ruby (except the sudden vogue-ness of it), c, java, javascript, etc... I don't mind learning them and using them. But my problem is how to determine what the best tool, language, framework, etc... for the job actually is? Where is this information, CW or ? The experts seem to be in their own camps for their own purposes.

There doesn't seem to be any studies looking at solving the same problem with different tools. And if there were any studies, how would you determine the effectiveness of each one? Would it be lines of code, ability to scale, speed of development, simplicity to maintain, or ? It seems that we (coders, developers, engineers, ...) all want to use the most effective tool but we don't have access to information to help us make this choice (beyond folklore, our own experience or that of others, and other social not scientific evaluations).

How does Perl compare itself with java, python, prolog, etc... ? By language attributes (static typing vs. dynamic) but are these meaningful? By performance? By feature X or Y? Maybe 'compare' isn't the best word here... Maybe we should talk about what Perl is strongest at, or most effective at doing and what Java is most effective at. But what happens when you have three languages at all have the same effectiveness, does it turn to style then?

I would love to hear peoples thoughts about this. Or information about research projects going on. Or is it time to write a grant? (like I have any idea how to do that ;)

Peace

Wednesday November 30, 2005
05:15 PM

Irish search engine

My friend in Ireland pointed me at Doogle. A funny Irish search engine, it is worth a few minutes of your life.
Monday November 14, 2005
10:49 AM

Mac IE strikes again... This time select with optgroups.

Another very strange Mac IE rendering problem. I know, I know, I know stop supporting Mac IE already. Unfortunatly at $work nothing is quite that easy.

This time Mac IE's wonderful support (per half the blogs on the planet) for optgroup usage has bit me in the ass. It seems that when you use a multiple select with a size and style height: <select size="6" multiple style="height=6em;" > And then include a (or multiple) optgroups in that select. It cannot figure out what the correct option count to start displaying the scroll bar since it doesn't actually count the 'optgroup' element as a display element. An example:

<select size="6" multiple name="stuff" style="height: 6em;">
<optgroup label="Group 1">
   <option value="one"> One </option>
   <option value="two"> Two </option>
   <option value="three"> Three </option>
   <option value="four"> Four </option>
   <option value="five"> Five </option>
</optgroup>

According to Mac IE the size is '5' which is correct (in the javascript DOM) but it doesn't figure out that the display size is six (it seems to use 'select.length') so it never puts the scroll bar there causing the last element to be impossible to select. You have to pad it with blank options to the size of 'size'. Fun...

Monday October 31, 2005
11:51 AM

Loving outlook email

At $work, I need to use the evil that is outlook and all of its associated posse of tools. Today, I was looking for an email from a system and found that I now had a "Junk E-mail" folder. That does not catch the junk mail but only things from mailing lists and systems that create email. It is so good at catching the junk that is seems to catch the virus quarantine reports from the other system... Nice job Outlook!
Monday October 24, 2005
09:17 AM

J2EE, Mike Park and bad weeks

Ah, it was a lovely week. My mac's drive died badly and without warning. My boss indicated that the app I'm in charge of should "consider" (read into that) using JSEE and JSP (I'm a mason, perl, etc... person). And I am dumb enough that I hadn't backed up the mac in fair too long (for my $month = 0; $month

Perl needs a JSEE like system but it needs to be faster and well less JSEE like. But it needs to dress up like J2EE so managers and CTO and ? think it really is J2EE... I know POE is similar but how do we fight the Java hype? Maybe we don't... Paul Graham did have a nice point about Java in his Start Up ideas (that people get paid well for it being a dead end...) But is that just wishful thinking? I can do J2EE but do I want to do it?

I have been listening to Mike Park for the last few weeks. He was in Skankin Pickle back in the third wave ska days but now he is writing really good folk music from a new perspective. He is Korean and his music is very enlighting for those of us not Asian. He addresses concerns that I'm sure many young Asian kids have with their own culture in America (and other places in world) like having loves that are not the same race and not having or wanting the same things in life that their parents do (that sounds pretty universal...). It is nice to hear some different voices in the music world. Give him a listen, buy his CD, support someone doing something different.

Here is a lesson for me. BACKUP your machine!

Monday October 03, 2005
10:46 AM

resume writing

To start off, I'm not looking for a new job but that doesn't stop me from window shopping.

The other day, I did run across a cool one on jobs.perl.org which made me think. I want to send them a resume... unfortunately I haven't really kept it up in the last few (when does few turn into many?) years. So this weekend I started to create one. Well, let me tell you, I'm really out of practice with it. I'm trying to distill a big chuck of time into a few sentences. I can understand why you would pay someone. It is a disappointment to take 2+ years of design, coding and such and turn it into "built web application with HTML::Mason, Perl, mod_perl and Javascript".... the blood sweat and curse words are completely lost. The fights over badly complex UI design and crazy marketing ideas are gone. The nice part of it is that I've seen how much I've done in the last few years... that is quite cool and makes me feel warm and fuzzy. :)

Wednesday September 28, 2005
11:14 PM

finally a meaningful error message

Working tonight I received this error message:

[Wed Sep 28 23:06:52 2005] [error] Can't locate object method "apache_req" via package "shit" (perhaps you forgot to load "shit"?) at /Users/lcarmich/dev/orgwrangler/lib/OrgWrangler/WebApp.pm line 105.\n

a bunch of truth in that error message. This is just one time in a million that I forgot to load shit.

BTW, I mistyped shift....