I just saw a firefly outside.

Here is some useful interesting info on fireflies.

Apparently the taillight contains two rare chemicals, luciferin and luciferase.

update: 2011Mar28: Oh noes, a broken link!! Here’s a shittier article about fireflies from the same domain as the initial good link. It has no picture, no pretty url and nothing about luciferin or luciferase. If this one ever breaks then I’ll just link to the Wikipedia article.

basic Perl log function

I believe any good Perl utility should have a log to which pertinent information should be written. I’m not even going to go over the merits of having a log file, but all good scripts should have one.

Setup – Define the Function and Log Filename

Here’s the log function which I use in my Perl scripts. This could easily be exported to a log module. Yes, I realize there are probably a lot of good logging modules out there already, I’m just offering this for the lazy sods who don’t currently log anything in their Perl scripts, but realize that it’s a good idea to start.

my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$mon  += 1; $wday += 1; $year += 1900;
my @months = qw { Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec };
unshift @months , '';

my $date = sprintf "%04d%03s%02d" , $year , $months[$mon] , $mday ;
my $logfile = "/tmp/$progname.$date.log";

open( LOGFILE , ">> $logfile" )
    or die "Can't open file '$logfile'. $!\n";
select((select(LOGFILE), $| = 1)[0]); # autoflush LOGFILE

sub logh() {
    my $msg = shift(@_);
    my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
    $mon  += 1; $wday += 1; $year += 1900;

    my @months = qw { Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec };
    my $dts;
    $dts = sprintf("%04d%3s%02d %02d:%02d:%02d",
    my $pid = $$;
    printf LOGFILE ("$dts:$pid: $msg\n" , @_);

I’ve actually included a bit more than just the log function – a few more lines to show how I set up the log filename. I like to create a daily log and assume the script I’m writing will eventually be run from a cron job or something.

Logging Strings – Calls to the logh() subroutine

This is the reason for all the setup — the actual log strings. Because of the way the arguments to the logh() function are utilized,
printf-style strings & arguments can be sent to the function. Here are some example calls to the logh function (pulled directly from a live production script):

I generally start out with the first line in the examples below (I always have a script global called “$progname”).

&logh("$progname started");
&logh("site '$store_nbr' not found in DB. adding site.");
&logh("all data matches for site '$store_nbr': nothing to do.");
&logh("adding site $store_nbr to db");
&logh("updating '$k' to '$v' for store $store_nbr in db");

Close It Out

Though it’s not really necessary these days, it’s good practice to actually close the file at the end of your script. I like to include the block below to close out the log file.

&logh("$progname ended");
my $line = '='x72;
close( LOGFILE );

How to be Physically Healthy

I don’t usually like list posts. I know, everyone adds that nowadays just before writing one. I just wrote it here because I’m really trying to like to be like everyone else. Anyway, here is the list:

  1. Stop eating animals. No meat, no dairy, no honey.
  2. Don’t eat out. This is probably quite difficult for most Americans, because we’ve styled our lives around being dependent on restaurants. Also, this means you’ll have to learn to cook.
  3. Eat healthy foods. Purchase & cook quinoa. Look up quinoa. (No, seriously, click the wikipedia link & check it out.) Eat raw brazil nuts (one daily is fine) and learn to cook steel cut oats. Look up steel cut oats so you know what they are. Also, buy & eat Ezekiel 4:9 cereal. It’s like Grape Nuts but better. (I know it’s like $6 a box, but your health is worth it. And you’re saving a ton of money by not eating out anyway.) These things can be purchased from Whole Foods or any good health food store.
  4. Daily physical activity. Also, you need to be doing stuff that makes you sweat at least 3-4 days a week, for at least 30 minutes each session.
  5. Get enough sleep.

Notice that the majority of these revolve around your diet, and most likely changing it if you’re not already hardcore. I am firmly convinced that nutrition, not physical activity, is the most important factor in being healthy and fit. If you don’t agree with this then you’re wrong.

photo credit

American Rendezvous 2k10

I just returned home yesterday afternoon from 3 days of intense Parkour training event in Columbus, Ohio. The event was American Rendezvous 2010, presented by the Parkour Horizons group.

The instructors came from both Parkour Generations and three of the Yamakasi, also current members of Majestic Force.

Just a side note, as a result, my DCI tracker will be missing entries for a few days, due to the fact that it was a bit difficult to get them in during the event.

Honestly, this is some of the best training one could possibly receive and I highly recommend to anyone interested in Parkour that they train with members of Parkour Generations and Majestic Force if possible.

More than just physical training, I feel like I now know how to train myself and understand much more about Parkour as an art form and a lifestyle as opposed to simply a sport.

currently listening to: El Corazón del Guerrero por Tierra Santa

a typical day in the life…

07:15 ish – wake up, check email/twitter/facebook, shower, check email/twitter/facebook
08:15 ish – eat one of the following:

  • Clif Builder’s Bar
  • Ezekiel 4:9 cereal or Nature’s Path granola with 1/2 cup soy or almond milk
  • oats, almonds, flax seeds & blueberries

08:25ish – go to work

09:30ish – go to Kennedy Coffee for a 16oz black coffee in a 20oz cup, and a splash of soy milk. it’s usually about 1/2 cup soy milk.

11:45 – home for lunch. check email/twitter/facebook, eat 1 Brazil nut & one of the following:

  • quinoa, onions & red beans, curried
  • steel cut oats, almonds & flax seeds
  • Clif Builder’s Bar
  • Ezekiel 4:9 cereal or Nature’s Path granola with 1/2 cup soy or almond milk
  • banana

12:45ish – check email/twitter/facebook & back to work.

16:45ish – home. check email/twitter/facebook

18:30 – 20:30 activity
depending on the day, either: weightlifting, Parkour class, or Salsa/Bachata lessons. when preparing to work out, I generally rock out to either El Corazón del Guerrero or Legendario, both by Spanish heavy metal band Tierra Santa.

19:30ish – 21:30ish
back home
check email/twitter/facebook
check email/twitter/facebook

21:00ish – usually starbucks

22:00 – back home. check email/twitter/facebook

22:05 – any combination of the below:

  • read
  • work on blog
  • review online business case studies
  • watch sweet Parkour vids on youtube
  • any outstanding work tasks

23:30ish – sleep.

repeat most weekdays.

for better or for awesome…

So, I initially started this as a personal blog about the things that interested me most:

1) technology,
b) languages,
and c) international travel.

I still love these things, but seem to have trouble coming up with good material (actually, I’ve got a lot of old stuff, but not much new). Hence the grand total of 3 blog posts in almost 2 months.

Health and fitness have surprisingly become a big part of my life now, as well vegetarian/vegan eating habits (I’ve been straight up vegan for about 2 months now), purchasing organic foods, a newly reinforced hatred for Wal-Mart and being more “green” overall. I’m basically turning into a hippie. Minus the tie-dye and herbal supplementation.

But seriously, I think becoming a vegan was probably one of the best decisions I’ve made in a long time. I feel great physically, never bloated or “full” like I did during my pre-vegan days. I’ve also lost about 25-30 lbs in the last 3-4 months and now have to purchase new clothes because both my shorts and pants are all falling off my waist. (A good problem to have!) Of course I’ve been hitting the gym about 4-5 times a week as well, so not all the fat loss can be attributed to the change in my diet. I say “fat loss” instead of “weight loss” because there’s a difference. But no need to get into semantics right now. Maybe in a later post. 😉

I’ve also dived into Parkour pretty hardcore lately, joining a local class and registering for a nationwide seminar in Ohio that will take place next weekend.

Basically, I’ve stated all this in order to say that, like life, the direction of this blog will probably change to feature more personal development type posts, just as I’ve changed my lifestyle quite a bit lately. And it’s not really that hard to change the direction of the blog, since it pretty much didn’t have any with which to begin.

I’ve also changed back to the default thesis design since the design up with which I had ended was pretty much crap (yes, I intentionally wrote the sentence that way in order to not end the phrase with a preposition). And I like the rotating photo box a lot more than a blank layout with no photos. And I really haven’t had the time to scour the net for CC Attribution License photos or free stock photos.

Oh, and though he probably won’t read this any time soon, I’d like to say a special “thank you” to Karol Gajda of Ridiculously Extraordinary. His writing on that blog inspired me to get off my ass and start making positive lifestyle changes, and was one of the biggest influences on my decision to become vegan. So check out his blog if you aren’t already familiar with it. I guarantee it’s worth your time (or your money back!).

Ok, bye.

dreaming of Andalusia… Oklahoma

On or about Nov 09, 2010 at 02:30 am I awoke from one of my most crazy-go-nuts dreams ever. The part I remembered wasn’t very long, but it was pretty intense. For whatever reason it must have spooked me enough to send me quite forcefully into the realm of consciousness, because I was coherently able to type all this into a text file on my Macbook at 2:30 am.

I dreamt that I was riding through Jerusalem on a white horse looking at all the Spanish architecture. Only for some reason, it looked exactly like the city park in Laverne, Oklahoma, the town in which I grew up (and haven’t visited for 12 years… no clue).

I had just reached up and taken a mango off a live mango tree in the park (easy to reach since I was on a horse) when I was attacked by another horse!! He was a crazed SOB, he kept charging me straight on. The only thing that saved me was my own horse, since he was loyal & stuff, and he didn’t fancy us being charged by Crazy Horse. CH kept trying to push us into the cactus (no clue as to why the Jerusalem landscape was so much like the american southwest), but my Faithful Horse kept kicking back, and I think mine was more powerful. Then I rested FH on a picnic table, and jumped onto the table to try and kick CH in the face myself, but he charged and I couldn’t get any good kicks in, so I re-mounted FH and about that time is when I woke up.

photo credit

Linux shared library error

Note: this was originally written on Apr 23, 2010, so that’s why the dates are from about a week and a half ago. Because I’m a lazy sod, I didn’t get around to publishing this until now.

After installing ntp on my Arch Linux server via pacman, I received this error message while trying to update my system time with ntpdate:

[root@ngmar01 ~]# ntpdate
ntpdate: error while loading shared libraries: cannot open shared object file: No such file or directory

At first I thought the error indicated that I was missing libcrypto, but then I checked and indeed I did have libcrypto installed on my system.

So then I checked the ntpdate executable itself. The ‘ldd’ utility lists dynamic dependencies of an executable (or, to put it another way, it lists the shared libraries on which the program is dependent).

[root@ngmar01 ~]# ldd $( which ntpdate ) => (0x00007fffdcae6000) => not found => /lib/ (0x00007fa1fef84000) => /lib/ (0x00007fa1fed80000) => /lib/ (0x00007fa1fea2a000) => /lib/ (0x00007fa1fe80e000) => /lib/ (0x00007fa1fe60a000)
/lib/ (0x00007fa1ff18c000)

So we found the culprit. It’s obviously trying to link to “”, which can’t be found anywhere in my shared lib path. Generally the error above is just a version problem and can be easily fixed with a symbolic link to the system version. A-like so:

[root@ngmar01 ~]# cd /usr/lib/
[root@ngmar01 lib]# ln -s

Now we no longer get a “not found” message when running ldd on the binary.
[root@ngmar01 lib]# ldd $( which ntpdate ) => (0x00007fff88fff000) => /usr/lib/ (0x00007f85f8ce2000) => /lib/ (0x00007f85f8ada000) => /lib/ (0x00007f85f88d6000) => /lib/ (0x00007f85f8580000) => /lib/ (0x00007f85f837c000) => /usr/lib/ (0x00007f85f8164000) => /lib/ (0x00007f85f7f48000) => /lib/ (0x00007f85f7d44000)
/lib/ (0x00007f85f9072000)

And now, to test that it’s working:

[root@ngmar01 lib]# ntpdate
23 Apr 22:48:24 ntpdate[20587]: no servers can be used, exiting

Note: the error above indicates that the binary is working, but I didn’t provide any command-line arguments. It’s beyond the scope of this post, but “ntpdate” should work.

my personal daily caloric intake tracker

Update {2010 Ago 10}: I am no longer updating the DCI Tracker. At the time, it was a good thing for me to do, it fit in with my life/lifestyle and it was also a great start with CakePHP. I still eat healthy, but don’t have time to update it. I also don’t feel the need to update it anymore. My life is taking on a new direction with me getting involved in Internet Marketing and also traveling to New Zealand. Those pursuits are now taking up most of my time. I will keep the tracker up for posterity’s sake.

About 6 days ago I started tracking every thing I eat and the number of calories contained within said food items.

I initially just put everything in a text file, but that got old quickly for 2 reasons:

1. I wanted to update my DCI from work, but couldn’t b/c the text file was on my laptop at home, and
2. I got tired of calculating {in my head} the total # of calories I consumed each day.

So I decided to write a web app to track it all and display nice, neat summaries for me. Incidentally, I learned a bit about CakePHP in the process.

Without further ado, here is the link to the mydci app:

It’s quite basic, with little more functionality than a text file, but it makes my day a bit easier. This will only show my own caloric intake, I haven’t expanded the functionality to include tracking multiple users, etc.

I’ve added some basic authentication so that the world can’t go mucking up my data.