Archive for the 'Programming' Category

Pacifickid.com nearly complete

Saturday, November 17th, 2007

Pacific Kid Tot

Ok, I think I’ve nearly got the design complete for my personal site, Pacifickid.com. I hope to have the layout done this weekend and start slicing/dicin it up into CSS/html. I’ve also been working on my own site framework in Perl for this. Got some interesting classes for dbi handling, can’t wait to share.

Ciao


MMmmm What’s Cookin??

Wednesday, November 14th, 2007

Mom's CookinEveryone needs a hobby. I just have more geekier ones than most. So here’s what’s cooking in my oven, mmmmmmmm…

  • Orchardtech.com: This was my consulting/business site until I got employed with real jobs. I would really like to get this updated. Currently have some photoshop candidates, just need to make a decision and get this launched.
  • No more techy posts on loganandamy.com. After being disabled for a year I renewed pacifickid.com. Originally this site was a collaborated effort with a good friend , I think I’m going to convert it into my techy blog. I plan to write my own blogging software, either in Perl or Python (been slowly teaching myself Python).
  • Finish the latest version of my Picture Browser aka Blogan (Blog + Logan) . I think I’m going to ditch CGI::Application and write my own MVC with template toolkit. I have also grown in love with JQuery, plan to exploit that more. This subject deserves a post unto itself.
  • Redesign loganandamy.com. We just need to do a good spring cleaning on this design, it’s 2 years old!
  • Continue to learn guitar

Vim Tip #1 - Deleting Multiple Lines

Wednesday, September 19th, 2007

I know I have been very bad lately at posting on this site. I’m really not trying to neglect my dear old blog, but nothing inspiring as of yet has led me write anything useful. Well in the last couple of weeks I have discovered some interesting Vim tips, which I hope someone out there may find useful.

:g/^\(.*\)\(\r\?\n\1\)\+$/d

That’s it. A simple “:help :g” will reveal that this is an ex command in Vim, which performs a global match operation. How this command could become useful is when incorporated with the above regex.  Simply, what we’re doing is searching the entire buffer (default is 1,$) and looking for matches. The regex also has the special /d modifier which directs Vim that with any match found to delete that line. The regex broken down is basically looking for any character anchored to the beginning of the line, followed by an optional carriage return (\r - ), followed by a new line (\n), followed by another line that matches the first grouping (first line) and if exists 1 or more times (this is what the + sign is for). Whooo. Ok, have fun and until next time.

Cheers!

Pass the PHP please…

Friday, December 22nd, 2006

Interesting article. Sigh.. I wait patiently for Perl 6. In the end I predict it’ll be Python and Perl.

Squash those bugs!

Friday, December 15th, 2006

Perl has gained the reputation, rightfully, as a hacker’s language, which has both negative and positive connotations. The community of Perl programmers often pride themselves as artists in the many ways they represent the counter culture of software development. There appears to be a general ignorance of the powerful tools available with Perl, especially among new comers to the community. I hope in the weeks to come to unveil the power behind the Perl Debugger. Be prepared, it’s going to be an amazing journey.

Pedantic Perl

Wednesday, December 13th, 2006

I came across this article on Perl.com, probably one of the best articles to describe Big “O” Notation in very simpleton terms. Of course those astute in algorithmic design know this encompasses all areas of computer science, just a good refresher to optimize any program one has wrote in whatever language.

Obfuscated Perl

Monday, December 4th, 2006
s;;5776?12321=10609$d=9409:12100$xx;;s;(d*);push @_,$1;eg;
map{print chr(sqrt($_))."n"} @_;

Guess what it prints:
L
o
g
a
n
Well... I'm proud of it.  PerlMonks have shortened it.


Goals before end of the year

Tuesday, November 21st, 2006

Mt Ashland Bunny Hill1. Submit workable Gen Pix to CPAN. (More info to come.)
2. Finalize my domain manager.
3. Walk or run a mile every single day until Jan 1st .
4. Take a picture everyday.

Seems easy enough. Lets see how self-disciplined I am.

The beginning there was nothing…

Friday, August 25th, 2006

Until I got bored and decided to write my own picture engine. Right now it just displays random images for the front page of my new picture gallery. With a little Ajax magic and CSS 2.0 fun we should have a kickin picture party.

Perl Oopssss :)

#! /usr/local/bin/perl -w
use strict;
my $picture = new Picture();
print $picture->randomPicture;

package Picture;

sub new {
my $class = shift;
my $self = {
dir => ‘./slovakia’,
reg_exp => ‘.*THUMB.JPG’,
site_domain => ‘http://www.loganandamy.com’,
site_dir => ‘/slovakia’,
@_
};
bless $self, $class;
}

sub giveMePicture{
my $self = shift;
return “siteDomain.$self->siteDir.”/”.$self->randomPicture.”\”>”;
}

sub randomPicture{
my $self = shift;
if (ref(@_)){
$self->{rand_pic} = shift;
}else{
$self->{rand_pic} = ${$self->openDir}[int(rand(scalar(@{$self->openDir})))];
}
return $self->{rand_pic};
}

sub openDir{
my $self = shift;
my $altdir = shift;
if (ref($altdir)){
$self->dirCriteria($altdir);
}
my $reg_exp = $self->fileCriteria;
my $dir = $self->dirCriteria;
opendir DIR, $dir || die “unable to open dir:$!”;
@{$self->{dir_files}} = grep {/$reg_exp/ && -f “$dir/$_” } readdir(DIR);
closedir DIR;
return $self->{dir_files};
}

sub siteDir{
my $self = shift;
shift @_ ? $self->{site_dir} = shift : $self->{site_dir};
}

sub siteDomain{
my $self = shift;
shift @_ ? $self->{site_domain} = shift : $self->{site_domain};
}

sub fileCriteria{
my $self = shift;
shift @_ ? $self->{reg_exp} = shift : $self->{reg_exp};

}

sub dirCriteria{
my $self = shift;
shift @_ ? $self->{dir} = shift : $self->{dir};
}

Coldfusion is not cool.

Wednesday, July 26th, 2006

I don’t like coldfusion. Top reasons include the following:

1. Server must be rebooted at least once a day.
2. It’s an easy scripting language to learn, and a great one to develop really bad habits.
3. It’s proprietary.
4. I despise the cfscript tag, simply because it’s a half ass attempt to look like php/javascript. (Not really sure why it was created.)
5. I despise the cfquery tag, simply because it’s a half ass attempt at SQL and it’s not even SQL-92 compliant. Really what’s the point of a query within a query if you can’t utilize case, multiple inner joins, and left outer join statements.
6. There is no way to make a cfquery tag work within cfscript, hence what’s the point of cfscript (see #4).
7. Syntactically ugly.

Ok, can only think of seven right now…Disclaimer: Reason #1 may not be entirely accurate. It depends really how many large queries are being ran against the server. Also the “quad-xeon” server is running IIS.