Hmm, forced to get up early before work.

Interrupted while trying to get ‘work’ done before having to go to work

Shouted at it’s time to go once I finally get to sit down in peace >_>

What a way to start a work day, I love my family!!!

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:


I’ve almost finished Learning Perl with about 10 pages left, honestly it makes me itch to find a copy of the Alpaca book just to find out more lol.

It’s rare that I read about any given language beyond it’s documentation or tutorials but I’ve rather enjoyed this O’Riley, it’s understandable why the company has a good reputation (y). I even noticed a module in the appendix that might be handy for implementing a program I’ve always wanted but have never found one before.

Perl is a very fun language to put to work, I don’t think I’d want to do any thing lengthy in Perl (~1000s of lines) but for getting stuff done it’s quite handy. It also comes with a ****load of documentation hehe, not to mention I like the POD (Plain Old Documentation) style for doing things.

Melon Popping through BF2

Some recreation for the day hehe: found decent infantry only server of BF2 running my favorite city map. Rotated between weapons as I usually do when I’m not in a squad that is ‘serious’, eventually wound up as a Squad Leader going helmet popping with a Accuracy International.

I had a couple major runs, just found a nice covered spot and started sighting targets. After pushing the ammo counter to it’s limit I racked in a Veteran Sniper Combat badge +S. Normally I aim for centre of mass, some times the heart or lungs of a target specifically when sniping. But I usualyl go for a head shot when dealing with a threat, in BF2 I find them quite easy to manage on other snipers in particular.

It’s rare though that I usually stream though targets like that though, like 20 some rounds and almost as many kills later I’m still sniping lol. Given a good mark to shoot at, a secure firing position, I’ll usually be able to hit what ever I can see… Having to do that while every one and their dog is trying to shoot you, is a different story >_>

urxvt & utf-8

Found an interesting problemo tonight with using vim in rxvt-unicode. Since the German umlauts and the old double-S (ä ö ü ß) are a bit tricky for me to make without a copy/pasting then where needed I usually use the alternative (ue oe ue ss) where possible. Since vim 7 has spell checking, I’ve got spelllang set to handle US and British english plus German in the spell checker. Which really works very nice because my spelling is a bit of a hodge podge for those ‘differences’ in English spelling.

While I was working on the translation last night, I employed both Vims spell checker and a translator program to help me with the grammer. Vims spell checker has the lovely ability of being able to correct things, taking the form I can easily get out of a US QWERTY board and replacing with the proper characters (ä ö ü ß), I knew there was some thing I loved about vim xD

The only thing is, trying to open the file again with vim caused it to display weird, all of the umlauts replaced with strange characters. I checked Vims idea of the files encoding and it was UTF-8, just like my system locale settings should be saying.

Yet, (n)vi, cat, and other utilities were showing them fine. Setting the terminal encoding in vim or launching it with LANG=de_DE.ISO8859-1 got them to display properly but still senseless :. My ~/.zshrc sets LANG to en_US.UTF-8, why nothing seemed to work right i dunno. Forcing urxvt (rxvt-unicode) to run with the C locale set (LC_CTYPE=”en_US.UTF-8″) got it working fine.

I’m not familiar with that end of C++ but I wouldn’t be surprised if it relied on the same setlocale() routine as C apps tend to. The FreeBSD handbook said to set LANG and MM_CHARSET and not LC_* variables for the environment. I’ve fixed it so the system kicks urxvt off with the right locale settings so the problem is fixed.

still a little odd imho lol

Nothin ever stops all these thoughts n the pain attached to them
Sometimes I wonder why this is happenin
Its like nothin I can do would distract me when
I think of how I shot myself in the back again
cuz from the infinite words I can say i
Put all pain you gave to me on display
But didnt realize instead of settin it free i
Took what I hated and made it a part of me

It never goes away
It never goes away

And now
You’ve become a part of me
You’ll always be right here
You’ve become a part of me
You’ll always be my fear
I cant separate
Myself from what I’ve done
Giving up a part of me
I’ve let myself become you

Hearin your name the memories come back again
I remember when it started happenin
I see you n every thought I had and then
The thoughts slowly found words attached to them
And I knew as they escaped away
I was committin myself to em n everyday
I regret sayin those things cuz now I see that i
Took what I hated and made it a part of me

It never goes away
It never goes away

And now
You’ve become a part of me
You’ll always be right here
You’ve become a part of me
You’ll always be my fear
I can’t separate
Myself from what I’ve done
Giving up a part of me
I’ve let myself become you

It never goes away
It never goes away

Get away from me!
Give me my space back you gotta just Go!
Everything comes down the memories of You!
I kept it in without lettin you Know!
I let you go so get away from Me!
Give me my space back you gotta just Go!
Everything comes down the memories of You!
I kept it in without lettin you Know!
I let you go

And now
You’ve become a part of me
You’ll always be right here
You’ve become a part of me
You’ll always be my fear
I cant separate
Myself from what I’ve done
Giving up a part of me
I’ve let myself become you
I’ve let myself become you
I’ve let myself become lost inside these thoughts of you
Giving up a part of me
I’ve let myself become you

— Linkin Park, ‘Figure. 09’

Dropped off around 0630 last ngiht :

Spent msot of it hacking on the SOP Rewrites and chatting with friends. The room clearing section is quite difficult, it needs to be sufficantly normalized which is a sticky operation. Trying to balance between short and sweet with completeness makes managing its verbosity a tricky one to.

I also spent some time doing a little translation work. I quite like trying to translate small portions of text between English and German, because it gives me a chance to get a greater feel for the language. You’ve got to learn to think a different way when using another language, I generally try to be as accurate as I can but enjoy the ‘soft spots’ where the idea becomes clear but, trying to put express it in the other language is hard.

I would love some day, the opportunity to learn it in a lot more depth. I’m generally able to read well enough when I have a dictionary to help, but… Trying to express things well is a bit more challenging. It takes time and experience to learn a languages grammer. It’s not quite like learning a programming language… Given decent documentation I generally can pick up most common programming languages in an hour or two depending on it’s size, I especially love it when some kind of Backus–Naur Form (BNF) listing is available, makes learning a programming language much faster lol.

Conventional languages for people on the other hand, ain’t quite so simple :

I’ve had a special briefing to give, a Rct to train with, two SNCOs to join int he shoot house for a few things, a ban/unban issue, yukes live op that almost launched, finishing [most of] my auditing and tending to a few site matters, and setting up a reminder should any thing remaining slip my mind.

I’m finishing my report and the last of my work for the day if I’ve gotta lock myself in a closet to do it >_>

Hopefully this time I won’t be working on it at 0500Q lol.

The good news, I’ve got the first draft done on my report (yay!), the bad news is it is 0550Q and I’m less tired then I was at 1300Q loool. All that is less I guess is one or two more sections that I need to write.

One thing I really need to do is start organizing more of my common things into packages, I freaking love TeX :-).

Also good news is I’ve gotten auth for putting TeX Live PBI’s on their testing server so that means I can get cracking on field testing it here, then start trying to push it on to PBIDir.

With luck, tomorrow might be a SWAT4 Live Op so I’ll have time finish work on the site and get some more interesting work done too xD.

I was trained in Rvs, I took that route for the Selection Course and wouldn’t change that decision for any thing. But I do rather feel at home with SWAT4. I’ve been playing S4 since the beta and bought the game shortly after it came out. The thing I dislike about RvS is the door bugs, SWAT4.. Hey some suspects might draw faster then Jesse James but at least they eventually go down when you shoot them, can’t say the same for Raven Shields occasional super tangos dancing between bullets ^_^.

What pisses me off is I paid $50 for SWAT4, $30 for SWAT4:TSS and SWAT4:TSS although it is an expansion pack is implemented through the (very shitty compared to SWAT3s) mod system, which is probably the ONLY reason they ever released the SDK. Because the change in dev-teams meant a need for a quick way of hacking in the other 40% of the freaking game!

What a company…

Oy…

Set to work on preparing my report, down to the AFK again the second half a butt cheek is in the chair level of interruptions as normal 8=). Finally took a break for dinner, a nice double whammy of Whoppers

BK Whopper

Crashed on the couch for awhile until Coco finally succeeded in guilting me out of my spot, jeeze it’s only been _my_ spot for the last decade ^_^.

Dropped off to bed, never made it through most of Mission To Mars and woke up ~0300 in search of some Raspberry Danish.

May as well get back to work eh?

Some times I wonder if I ever sleep without being ready to drop :