Main

April 21, 2007

Why MS Word is a bad HTML editor

  • Described a little bit about why MS Word is not a good HTML editor

Continue reading "Why MS Word is a bad HTML editor" »

Turning on HTML for Exchange/IMAP

  • Described how to configure Exchange's IMAP server to server out HTML

Continue reading "Turning on HTML for Exchange/IMAP" »

April 13, 2007

Deleting Site Domains

  • Implemented gpdb_deleteSiteDomain

Continue reading "Deleting Site Domains" »

April 10, 2007

testcc.pl

  • Created testcc.pl. This script creates a test vob, test view, makes elements, checks them in, out, modifies them, checks them in again and compares! Basic Clearcase sanity testing...

April 09, 2007

Convert Dallas/Licensing/Solaris 10 testing

  • Changed gpdb_convertuk.pl to open and use the new Dallas database
  • cclic_report.pl reporting everybody as "UNK". Tried to run this in debugger and it just worked! Hmmm... Is this a cron problem? Running again tonight
  • Rick got the Jackson filer to mount to dslabcc01 however while I can create the vob storage area I cannot mount the vob!

March 30, 2007

DLPActivity.pl/YELL

  • Rewrote DLPAcctivity.pl, a Clearquest reporting tool that emails DLP engineers about Clearquest defects
  • Look into YELL scripts

March 28, 2007

mkview_linked/GPDB Login

  • Finished work on mkview_linked for MySQL databasse
  • Implemented login for GPDB with cookies

March 21, 2007

GPDB Web Update/Oracle testing

  • Added menus to GPDB web
  • Tested and documented access of Oracle databases, such as GPDB, using standard Perl and standard Oracle libraries from various architectures

Continue reading "GPDB Web Update/Oracle testing" »

March 16, 2007

MySQL Client Libraries

  • Worked on solutions for MySQL client library problem

Continue reading "MySQL Client Libraries" »

March 13, 2007

Remote sites/mkview

  • Gained access to a few new remote sites. Updated GPDB. Alas there's no DesignSync info at these sites and none of the vobs have vobstorage paths that indicate a project!
  • Got access to cmmgr but was unable to publish new mysql from all architectures
  • Started incorporating the UK changes into mkview. Need to replicate these to mkview_linked (?)

March 08, 2007

Clearcase License Graphs

  • Worked on Clearcase License Graphs web page

Continue reading "Clearcase License Graphs" »

March 07, 2007

Building DBD::MySQL

  • Built DBD::MySQL for Solaris
  • Having problems building DBD::MySQL for Linux

Continue reading "Building DBD::MySQL" »

January 16, 2007

CC 7.0 Upgrades

  • Installed CC 7.0 on dslabcc03. This was done by first removing CC 6.0. The result was a loss of all registry entries. Brought back the registry from the saved area. Now all better
  • Did an install-over of CC 7.0 on top of CC 6.0 for dslabcc01. This worked even better
  • Performed install-over for dslabcc05

January 12, 2007

Clearcase 7.0

  • Set up vob server on dslabcc05
  • Set up Multisite synchronization between 1, 3 and 5
  • Installed MSHD on 1, 3 and 5

January 11, 2007

Clearcase 7.0

  • Set up lab servers to CC 6.0
  • Created some vobs and views in the 6.0 environment
  • Populated a vob using clearfsimport
  • Replicated vobs amongst the 6.0 servers

January 08, 2007

cclic_report year boundary problem

  • Documented problem with cclic_report and crossing of the new year's boundary

Continue reading "cclic_report year boundary problem" »

November 29, 2006

Perl Style

A little bit about Perl Style

By and large I feel that massively indented and thus multi level conditional statements are not handled well by most people. You see as your evaluating the code you have to "put on the mind stack" each condition and bear it in mind as you successively consider each of the nestings of code. As such I always "look for ways out" of the script/function/routine that I'm in. The idea is to avoid nesting by handling error conditions and other "if this happens then we're done" first, often die'ing, erroring out, returning the script/function or subroutine. The net effect is that the rest of the code, the code that normally executes, is shifted to the left a level or two. Additionally complicated, repeated or complex code can be written into a well named subroutine and called from the main or other functions when needed. To me this all makes the code a lot easier to read.

As an example, and again, I'm not trying to pick on your script specifically and I realize that this might not be the final version, but in reality it contains only a call to GetOptions and 2 if statements. The first if statement merely calls usage if -h is specified. BTW this could be re-written as:

GetOptions (
  'f=s',      \$facility,
  'p=i',      \$port,
  'a=s',      \$XAID,
  'w=s',      \$password,
  'n=s',      \$projName,
  'g=s',      \$unixGroup,
  's=s',      \$serverName,
  'c=s',      \$cachePath,
  'h',        sub { usage },
) || usage;

IOW rather than define an $h variable and then set it via GetOptions then test it afterwards only to call usage, define an anonymous subroutine can calls usage directly from GetOptions. Or, since anything other than the stated options displays usage (as per the "|| usage") simply drop the "h" line entirely. If the user specifies -h then it's unknown and usage is displayed. Then $h can be removed as well as the if test following GetOptions.

The next if statement tests that all of the above variables have been defined. If so then all real processing happens inside that if (and other nested if's therein). Otherwise usage is called. In following with the "looking for a reason to get out" philosophy how about:

usage unless (
  defined $password   &&
  defined $XAID       &&
  defined $projName   &&
  defined $serverName &&
  defined $unixGroup  &&
  defined $cachePath  &&
  defined $port       &&
  defined $facility
);

Basically this says, "if any of these are not defined call usage" and since usage doesn't return everything inside the old if statement can be shifted to the left. Other opportunities exist to continue to apply this philosophy of "getting out while you can" and reducing the nesting level of the program. For example, inside the old if statement you check to see if the login of GPDB successfully made you an administrator. If not you're gonna stop the script right there. So then how about something like:

my $login = gpdb_login ($XAID, $password);

error "$XAID is not an administrator", 1 if $login !~ /administrator/;

gpdb_login returns a string that will contain "administrator" if you were able to login as an administrator. Here I use error, a routine that I often use (in fact I'd like to publish it to TI as a common utility) that writes an error message to STDERR and optionally exits if the second parameter is not 0.

October 31, 2006

Cloning done

  • Implemented cloning procedure for DMD/CQ

Continue reading "Cloning done" »

October 26, 2006

cclic_report/gpdb_putDesignsync bug

  • Created cclic_report.pl and cclic_report.sh and checked them into Clearcase. Need to find out how to release this code and then create the necessary cronjob
  • Fix bug in gpdb_putDesignsync. Turns out it didn't even try to link the Project to Designsync if the Designsync record existed before. Again, need to figure out how to release this
  • Created subtasks tab for DMD. Default functionality for parent/child relationships is already pretty complete. May need to populate new subtasks via a hook

October 17, 2006

PerlDB Tips

The Perl debugger is one of those valuable tools that surprisingly it seems few Perl coders know well. Here are some quick tips on using the Perl debugger. First a few explanations about commands I tend to use:

s
Single step. Step to the next statement stepping into any subroutines (where the source file is known and accessible).
n
Step over - if the line contains a call to a subroutine then this will step over that subroutine.
r
Return from subroutine - if, say you accidentally stepped into a subroutine or if you just want to return,
R
Rerun - start your Perl script again in the debugger with all the parms you started with.
q
quit
p <variable or expression>
Will print the contents of a variable or expression. Expressions can be Perl expressions including calls to subroutines. You can, for example, do "p 'There are " . scalar @foo . ' lines in foo';
x <variable or expression>
Like p above however p will simply print out HASH for hashes whereas x will format them out. Also x will print out "undef" for things that are undefined yet p will print nothing for them.
l (ell)
List the next windowSize lines (see below). Use "l <n>" where <n> = a line number to list that line.
v <n>
View lines around <n>
V <package>
List exported subroutines and variables for <package> (e.g. V MyModule will is all stuff exported from MyModule).
f <filename>
File - switch to another file. (e.g. f MyModule) and the debugger switches to viewing MyModule.pm.
c <n>
Continue to line <n>. If n is not specified then just continue until the next break point or the end of the script. Continue is like setting a temporary break point that disappears when you hit the line.
b <n> <condition>
Breakpoint - set a break point (or b <n> $name eq "Donna" which will break at line <n> iff $name is "Donna" (evaluated when the debugger gets to line <n>))

Also, at the Perl db prompt you can type in any Perl. So, for example, I often work out regex's that way. I'll be debugging a Perl script and stepping up to something like:

     10==> if (/(\d*).*\s+/) {
     11      print "match!\n";
     12      $x = $1;
     13    }

Then I'll type in stuff like:

     DB<10> if (/(\d*).*\s+/) { print "1 = $1\n"; } else { print "No
     match!\n"; }
     No match!
     DB<11>

Then I can use the command history (with set -o emacs at the shell before executing perl db emacs key bindings work for me) to edit and enter that perl if statement changing the regex until it works correctly. This way I know I got the right regex. Copy and paste the new, tested, regex from the debugging session into my code then "R" to reload the debugger.

Or you can say call an arbitrary subroutine in your script:

       DB<2> b Rexec::ssh
       DB<3> p Rexec::ssh
Rexec::ssh(/view/cmdt_x0062320/vobs/cmtools/src/misc/GPDB/bin/../../../../lib/perl/Rexec.pm:60):
     60:         my $self = shift;
       DB<<4>>

The "p Rexec::ssh" says to print the results of the following expression. The expression is a function call in to the Rexec module for the subroutine ssh. Since we just set a break point there in the previous debug command we break at the start of that subroutine and can then debug it. Note you don't want to "c Rexec::ssh" because that would continue the actual execution of your script and only stop at Rexec::ssh if that routine was actually called. Viola, you just forcefully caused the Perl interpreter to branch to this routine!

Another thing I'll frequently do is set or change variables to see how the code would proceed if the variables were correct (or perhaps incorrect to test error conditions). So let's say a forced execution of the subroutine Log like the above:

42      sub Log {
43:==>    my $msg = shift;
44        print "$msg\n";

  DB<23> s
main::Log(EvilTwin.pl:45):       print "$msg\n";
  DB<24>$msg = "Now I set msg to something I want it to be"
  DB<25>s
Now I set msg to something I want it to be
main::Log(EvilTwin.pl:47):              return;
  DB<25>

There are all sorts of good reasons to examine (p $variable) and set ($variable = "new value") variables during debugging.

Finally put the following into ~/.perldb:

     parse_options ("windowSize=23");

This sets the window size to 23 so that 'l" lists the next 23 lines.

October 09, 2006

Rexec

  • Finished recording gpdb_add_project to call a central rexec function so that remote execution can use a different username. However right now all it does is rsh, which can use another username but rsh needs to have remote passwordless login set up in order to work
  • Created Rexec.pm Perl object that has the ability to use Expect and telnet to log in remotely to a machine and execute commands, returning output and the status of the command executed remotely. Need to integrate this with gpdb_add_project...

October 05, 2006

Rexec

  • Fixed bug in gpdb_add_project.pl
  • Met about MultiSite Hardening Daemon (MSHD)

Continue reading "Rexec" »

October 03, 2006

Redirecting on ErrorDocument

  • Looked into redirecting when ErrorDocument is called. Doesn't look like it'll work

Continue reading "Redirecting on ErrorDocument" »

September 29, 2006

Load Balancing Redirection

  • Implemented a load balancing redirection scheme for cqweb

Continue reading "Load Balancing Redirection" »

September 28, 2006

JVM Stack/Heap Sizes

  • Looked into JVM stack and heap sizes on dfls83-85

Continue reading "JVM Stack/Heap Sizes" »

September 27, 2006

OMAPS.pm bug

  • Tracked down and fixed minor bug in OMAPS

Continue reading "OMAPS.pm bug" »

September 26, 2006

CQ log files

  • Looked into yet another hang up with CQ web servers

Continue reading "CQ log files" »

September 21, 2006

CQ: DMD Date changes

  • Looked at DMD requests
  • Fixed problem where Needed_Date and Target_Date could not be set to Submit_Date

September 18, 2006

enable_ldaptk

  • Started coding a PerlTK version of enable_ldap
  • Solved problem with not being able to write to Samba mounted home drive. Seems one should not use smbntsec in $CYGWIN when the Samba Server is not in the domain

September 15, 2006

enable_ldap

  • Added LDAP calls to enable_ldap to check the parms as we go

Continue reading "enable_ldap" »

September 10, 2006

Clearquest Install

  • Looked into Clearquest install area

Continue reading "Clearquest Install" »