0x5065726c20726f636b7321

Hooah, I’ve nearly completed my little organizational pattern hehe.

~/stuff                            -> dumping ground for work load management
-------/bin -> binaries to help out (links to ~/sh)
------------/cgrep -> comma grepper for contacts file
------------/reminded -> reminder notifications daemon
-------/bookmarks -> links to pages I need to read
-------/contacts -> CSV file with why,method,id of people I need to contact
-------/delegates -> list of things I pawned off on other people (and need to follow up with)
-------/open-loops -> list of things I need to do; if it is here, it is a commitment
-------/reminders -> directory full of reminders
-----------------/YYYY-MM-DDTHH:MM -> send me this files contents on YYYY-MM-DD at HH:MM UTC
-------/hope-chest -> things I wish I had time for; deal with in future
-------/school -> reserved for future need
-------/projects -> tmp files for various projects.

On Sunday (2008-12-07), I started writing cgrep in Perl, and setting up the contacts & open-loops files. Finished the final touches yesterday, and finished reminded today (Aside from tweaks needed for WinXP; adjust $ENV vars). Not to bad, considering how little coding time I’ve had lately :

Terry@dixie$ ~/stuff/bin/cgrep -h   
/usr/home/Terry/stuff/bin/cgrep -- Grep for the contacts CSV file

Usage:
cgrep [IWhimvw] [-f file | --file file] regex [file ...]

Options:
-I, --id grep the 'id' column
-W, --why grep the "why" column
-V, --verbose display line for AWK
-h, --help print usage help info
-i, --ignore-case ignore case distinctions
-m, --method grep the "method" column
--man read manual page
-v, --invert-match select non-matching items
-w, --who grep the "who" column

Terry@dixie$ ~/stuff/bin/reminded -h
/usr/home/Terry/stuff/bin/reminded -- reminder notifications daemon

Usage:
reminded [-t seconds] [-n|-m addr] [-p program] [-d directory]

Options:
-D, --debug Debugging output
-d, --directory Directory to search
-m, --mail=address Remind by Mail to address
-h, --help print usage help info
-n, --notify Remind by notification popup
--man read manual page
-p, --program=string Execute string as the notifier
-t, --timer=secs Sleep secs between checks

Terry@dixie$

I’ll probably modify ~/init.sh to launch reminded during my sessions; maybe rsync files to Vectra, and run it in mailing mode.

Things in ~/stuff/open-loops are more or less sorted into a queue of tasks; which are to be done in mostly the order listed. Once they are done, they get deleted; and generate or nuke other entries IAW the resulting outcome. So far, it’s actually worked well enough; cgrep, reminded, and the structural are all done ahead of schedule. Now if I could just do something about controlling the amount of time available to work on crap!!! I once tried Personal Information Manager (PIM) software, but usually found the surveyed apps to lack the level of flexibility I need. And to hack it in, would take more time then using a few megs in sticky notes. ssh’ing to Vectra and mucking with a todo file ain’t so hot either, so here we go 🙂 It’s simple, it’s effective (as anything else), and no need to screw around with a big, overwait, memory hogging, overly mouse riddled program, just to manage things -> I can use my shell xD.

It’s amazing, how often I can throw perl at a problem, and see it work lol.

Then again, I can usually read my Perl scripts in six++ months… can’t always say the same for other peoples golf game.

Todo: Toolkit and Library madness

Examine for portability the following toolkits under these OSes: Windows NT, Mac OSX*, Unix-like.

*I sadly don’t have a Mac, although I would really love one. So a OSX binary of some form will have to pass.

GTK+ — C, C++, Perl, Python, Ruby, PHP, C#.NET (Java bindings also avail but seem to be gnome-centric)

Qt4 — C++, Perl, Python, Ruby, Java (C#.NET and PHP bindings seem to be questionable and only C++/Python and possibly Java bindings can be depended on).

WxWidgets — C++, Perl, Python, Ruby, Java, C#.NET

Swing and SWT would be considered if they were available under more languages !!!

Evaluate portable standard/add-on libraries to each language for the following capabilities:

String handling (they all do well in the language standard)
Regular Expressions (Only Perl and Ruby get this great imho)
XML Processing
Network programming — both sockets based API and protocol support (IMAP, POP, HTTP/S, FTP)
Database handling — must support MySQL, SQLite, and some form of flat file.
Basic compression and archive format support (e.g. tar; zip; gz; bz2; lzma)
Inter-Process Communication (IPC) methods and related process control (e.g. fork(), exec(), signal(), kill() type routine-families).
Ease of use and deployment

Goals:

Build up a standard frame work of toolkits/libraries/etc that are portable across both my general operating environment and the various languages I use

Attempt to standardize myself on few languages rather then rubber banding between various programming languages + sh/awk/sed/friends

Ensure full development environments are available to me under FreeBSD 7 and Windows NT 5.1 (e.g. I can code from either machine and not change tools)

At least one language for scripting/prototyping and one for more efficient execution when implemented in that language (e.g. 1 interpreted + 1 compiled)

and try to stay sane along the way without writing a few libraries in the process >_>

Playing with perl

Ok, so I got bored and wound up with a new toy 😛

Hmm, now to hunt down some snacks…


1: #!/usr/bin/perl
2:
3: use strict;
4: use warnings;
5:
6: use Getopt::Long;
7: use Image::Size;
8: use Pod::Usage;
9:
10: =pod
11: =head1 NAME
12:
13: image-size.pl
14:
15: =head1 SYNOPSIS
16:
17: image-size.pl [options] [file ...]
18:
19: Options:
20: -f, --ask-file include output from file(1)
21: -h, --help print usage help info
22: --man read manual page
23: -s, --silent ignore errors
24: -v, --verbose more verbose output
25: -d, --die blow up on first error
26:
27: =head1 DESCRIPTION
28:
29: A quick perl script to do what I've always wanted, tell me the height and width
30: of an image file. Without having to open a graphical program (X11) just for the
31: sake of finding out! File formats supported are based on the Image::Size module
32: which is required for this script to function.
33:
34: Special thanks to the creators of the llama book for mentioning perls
35: Image::Size module and thanks to the creators of that module!
36:
37: =head1 OPTIONS
38:
39: =over 8
40:
41: =item B<-f, --ask-file>
42:
43: Politely ask the systems file utility about the files format. This option
44: requires the file program installed and accessible through your environments
45: PATH.
46:
47: =item B<-h, --help>
48:
49: Print out a summery of command line options and exit.
50:
51: =item B<--man>
52:
53: Displays this manual page using the provided Plain Old Documentation.
54:
55: =item B<-s, --silent>
56:
57: Ignore failed files and continue, combine with -v or --verbose to include the
58: file name but still skip printing error messages.
59:
60: =item B<-v, --verbose>
61:
62: Print the file name along with it's width, height, and type (if known). Each
63: field is also separated by a new line and ordered in a more elaborate format.
64:
65: =item B<-d, --die>
66:
67: Default behavior for image-size.pl is to print a simple warning message if any
68: specified file can not be operated on.
69:
70: When the the -d or --die switches are given, the program will halt execution
71: with an appropriate exit status instead of continuing.
72:
73: This is useful for when you do not wish to continue after an error when
74: processing a list of files
75:
76: Refer to the perl documentation for details about how the exit status is
77: affected.
78:
79: =back
80:
81: =head1 EXIT STATUS
82:
83: The image-size.pl utility exits 0 on success or returns via perls die() if -d or
84: --die was passed on the command line.
85:
86: =head1 SEE ALSO
87:
88: L<perl(1)>, L<perldoc(1)>, L<file(1)>
89:
90: =head1 LICENSE
91:
92: Copyright (c) CLASS=integer>2008, TerryP <snip>
93:
94: Permission to use, copy, modify, and distribute this software for any purpose
95: with or without fee is hereby granted, provided that the above copyright notice
96: and this permission notice appear in all copies.
97:
98: THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
99: REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
100: FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
101: INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
102: OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
103: TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
104: THIS SOFTWARE.
105:
106: =cut
107:
108:
109: # message for pod2usage()
110: my $usage_msg = "$0 -- figure out the height and width of image filesn";
111:
112: # message to display on error getting the image size
113: my $warn_msg = "File does not exist or cannot be opened: ";
114:
115: my ($deadly, $help, $verbose, $man, $silent, $ask) = undef;
116:
117: {
118: Getopt::Long::Configure('bundling');
119: GetOptions(
120: 'f|ask-file' => $ask,
121: 'h|help|?' => $help,
122: 'man' => $man,
123: 's|silent' => $silent,
124: 'v|verbose' => $verbose,
125: 'd|die' => $deadly,
126: ) or $help++;
127:
128: pod2usage(-msg => $usage_msg, -output => *STDOUT,
129: -exitval => 1, -verbose => 0 ) if $help;
130: pod2usage(-verbose => 2, -exitval => 1) if $man;
131:
132: exit 1 unless @ARGV;
133:
134: # check if we are reading file names off stdin
135: if ($ARGV[0] eq '-') {
136: while (<>) {
137: chomp;
138: &print_size(imgsize($_), $_)
139: if -f $_ or $silent ? next : &handle_error and next;
140: }
141: } else {
142: foreach (@ARGV) {
143: &print_size(imgsize($_), $_)
144: if -f $_ or $silent ? next : warn $warn_msg."$_n" and next;
145: }
146: }
147: }
148:
149: sub print_size() {
150: my ($x, $y, $type, $file) = @_;
151:
152: $x = 'unkown' unless $x;
153: $y = 'unkown' unless $y;
154:
155: # keep it simple stupid
156: my $std_msg = "width-x: $xtheight-y: $ytfile type: $typen";
157:
158: # unless asked to shoot off your mouth
159: my $verb_msg = "file name: $filen" .
160: "width-x: $xnheight-y: $yn" .
161: "file type: $typenn";
162:
163: $verbose ? print $verb_msg : print $std_msg;
164:
165: print "running file(1) ...nn",`file $_`,"n" if $ask;
166: }
167:
168: sub handle_error() {
169: $deadly ? die $! : warn $warn_msg."$_n";
170: }
171:


Been in my usually hyper-jumping multi-tasking state as usual.

I’ve had enough IM windows open simultaneously of late between friends, business, and other matters to be aiming for a new personal record. It’s a good thing I didn’t expect to get much done as Virtual WO1 on day 1 or day 2 looool.

Some times my systems load is light, at the least I usually will have a web browser, instant messenger, and a command prompt open some where (local or network). Other times even on my desktops 1600×1200 resolution screen space can be hard to get hehe.

That’s just the way I am though, I’m usually avail about 14-18 hours a day or more depending on working hours lol. Most people know, don’t call me, messenger me ! One thing I do love about IMs over phone calls is you don’t have to respond instantly, and you the message buffer handles incomings between AFK spikes… It’s sort of necessary with the way life at home is lol.

A few things on my agenda are already in the works… Most of which do to with things with the new AoR in [SAS] and the SOP Rewrites. You could say taking over a larger scope of things calls with it a bit of nose poking around hehe. With the SOPs I’ve been trying to get work done & keep the RSM informed.

Another thing I would like to do is find some time to learn Perls OO features. I’m no real fan of Object Oriented programming although I believe it is just a means of doing the right things a certain way. In this case it really is just the simple fact that I don’t know much about Perls Object Oriented syntax and I’m not interested in waiting for Perl6 to learn it lol.

For me Perl is getting to be kind of like an old friend in the tool chest, like a trusty hammer or a favorite screw driver. I often find my self using Python, Perl, and Ruby for scripting tasks or random programming that I either can’t use some thing else for or just don’t have time/energy for using another language for.

And for languages and tools I often put to work, I like to know them like a well read book 😉

What can I say but I love to learn!

I dunno why, but these past few weeks I’ve been having the strangest dreams =/

Extreme Sex and Perl programming…. Very strange combination for dreams lol.

What makes it all the more funky is Perl, is not a language I do much in. For the most part Ruby, C, and BourneShell make up most of the stuff I do. When I use Perl, it’s usually because I don’t know AWK and I’m to lazy to use any more |pipes in my command line.

I think odds are, if I had stuck with Perl when I had started learning it. It would’ve been my favorite language.