Installing Perl Packages, debugging with Eclipse

I'll need a little more research, and I may have already installed some things, don't remember.

Ran the following command, and kept hitting enter for all responses, added all repositories.
# perl -MCPAN -e shell

Then ran the following command in CPAN
cpan> install PadWalker
cpan> exit

You need to install PadWalker prior to installing Epic inside Eclipse for Perl debugging.

Simple Time Difference

#!/usr/bin/perl
use Time::Local;

print &daysFromNow('20','NOV','08');

exit 0;

# timegm returns seconds from 1970
# its format is (0,0,0,day 1..31,month 0..11,year)
sub daysFromNow
{
my $date2checkDD = $_[ 0 ];
my $date2checkMMM = $_[ 1 ];
my $date2checkYY = $_[ 2 ];

my $check_day = $date2checkDD;
my $check_month;
if ( $date2checkMMM eq 'JAN' ) { $check_month = 0; }
elsif ( $date2checkMMM eq 'FEB' ) { $check_month = 1; }
elsif ( $date2checkMMM eq 'MAR' ) { $check_month = 2; }
elsif ( $date2checkMMM eq 'APR' ) { $check_month = 3; }
elsif ( $date2checkMMM eq 'MAY' ) { $check_month = 4; }
elsif ( $date2checkMMM eq 'JUN' ) { $check_month = 5; }
elsif ( $date2checkMMM eq 'JUL' ) { $check_month = 6; }
elsif ( $date2checkMMM eq 'AUG' ) { $check_month = 7; }
elsif ( $date2checkMMM eq 'SEP' ) { $check_month = 8; }
elsif ( $date2checkMMM eq 'OCT' ) { $check_month = 9; }
elsif ( $date2checkMMM eq 'NOV' ) { $check_month = 10; }
elsif ( $date2checkMMM eq 'DEC' ) { $check_month = 11; }
my $check_year = "20$date2checkYY";

my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime( time );
$time_1=timegm(0,0,0,$mday,$mon,$year);
$time_2=timegm(0,0,0,$check_day,$check_month,$check_year);

$seconds = $time_2 - $time_1;
$days = $seconds / 86400; # 60*60*24 = 86400
return $days;
}

Scanning for CR/LF, want valid bash script

Quick Conversion Command

find . -name "*" -type f -exec dos2unix {} \;

Sample Script

#!/bin/sh
# MAKE SURE TO ALWAYS SAVE THIS FILE AS UNIX FORMAT.</code>

# Date: Monday, November 17, 2008 8:30 AM
# Author: Maurice Ruckman
#
# Description: Scan scripts directory looking for CR/LF which indicates
# a script was not saved in UNIX format. This would cause the script
# to fail.

grep -l -r $'\r\n' /devl/scripts > scan_for_crlf.output.txt

if [ -s scan_for_crlf.output.txt ]; then
echo "FAILURE CR/LF DETECTED IN SCRIPTS FOLDER"
echo "Found CR/LF when scanning scripts folder" | mailx -s "FAILURE FAILURE FAILURE CR/LF DETECTED IN SCRIPTS FOLDER" mruckman@hollandamerica.com
else
echo "ALL OKAY"
echo "All scripts passed test scan." | mailx -s "Scripts Folder Passed Scan" mruckman@hollandamerica.com
fi
find "/home/jboss1/workspace/HAL" -type f -name "*.java" > list.txt

We can easily convert the code with dos2unix

and find the problem code with something like this:

grep -l -r $'\r\n' /home/jboss1/workspace/HAL

or just convert everything by scripting it, here's a start

find "/home/jboss1/workspace/HAL" -type f -name "*.java"

Page Flipping Animation

Use JavaScript to emulate a web booking where the user can flip the pages.

http://www.sitepoint.com/blogs/2007/07/20/javascript-sprite-animation-using-jquery/