ITNotes
22 Nov 2009 01:19 UTC 2009326+0119 UTC

080204

I'm trying to add some station photos so that all the stations will have a picture. However, when I try to copy the photos into the appropriate location, I get "Permission Denied" errors. How do I get the photos in there?

Since this directory is governed by CVS, copy the pictures into ~amostella/pharosdb/www/img/overview. Perform a 'cvs add' for each photo, then perform a 'cvs commit'. After the photos have been approved, they will be added to the working site.


072304

I'm having trouble following exactly what and how harman.cgi is doing what it's doing. I think I'm getting confused with $action=post, method=post, -action=post and action=~/amostella/blah/blah/blah... How does the program decide what method is being used when it is first summoned?

In the <form...> tag, the 'action=' parameter identifies the URL of the script that the form's data is to be sent to. In DNR scripts, the '-action=' query string parameter identifies the action to be performed by the script, such as 'post', 'list', 'edit', etc. Within a <form...> tag, this query string parameter is usually specified by <input type='hidden' name='-action' value='...'>. Then, in the script that receives the form's contents, we normally store the value of the -action= parameter in a variable called $action.


072004

In the following line from a cgi script, what is the $serlist++ portion doing?

foreach (split(/[,\s]+,$serlist)) { $serlist++; }

The keys of %serlist will be each of the series' listed as comma or whitespace separated things in the $serlist string. The values will be a count of how many times that series appears. The ++ (increment) operator is being applied to the $serlist entry of the hash. So, for instance, after this:

$serlist = "a b,c,a,d,b"; foreach(split (/[,\s]+/,$serlist)) { $serlist++; }

The %serlist hash will look like this:

a => 2 b => 2 c => 1 d => 1


071904

I am writing a bash script and need to execute a long/complicated command several times. How can I store the command in a variable and then later use that variable to execute the command at the appropriate times?

Create the variable with either quotes or double quotes, as such:

time='date +M:%S' or time="date +M:%S"

Don't use back quotes as this will tell the computer to execute the command immediately and store the results in the variable $time.

To execute, do one of the following:

echo "The time is now..." $time

This way, the shell will expand the variable $time, treating it as a command. To execute the command as part of a string:

echo "The time is now... $($time)"


071504

What exactly does PDB::SCRIPT do?

$PDB::SCRIPT is the content of the environment variable. In a CGI program, this will be something like '/~duff/pharosdb/cgi-bin/qc.cgi' if I were using a URL like

http://wip.cbi.tamucc.edu/~duff/pharosdb/cgi-bin/qc.cgi/001/today,-14d


070704

Ports of Interest

Jet Direct9100
Printer Port515
Internet Printing Protocol631
http80



062504

How do I do a search and replace in vi?

%s/pattern/replacement/g

The '%' means to perform this operation for all lines. '/g' means perform globally on the line. You can also use the '/c' option to confirm the substitution, like so:

%s/pattern/replacement/gc

If you only want to perform the substitution of a select few lines, you can use one of the following:

10,50s/pattern/replacement/gonly for lines 10 through 50
.,+10s/pattern/replacement/gfrom the current line to 10 lines later
/foo/,/bar/s/pattern/replacement/gfrom the line matching 'foo' to the line matching 'bar'



062404

What is a 'hash-slice' in Perl?

If you want to get a list of specific values from a hash based on specific keys, then you can take a slice of a hash like this:

($a, $b, $c) = @hash{$keya, $keyb, $keyc};


060804

How do you view environmental variables from the web?

Set $EnableDiag = 1 in config.php and then add '?action=diag' to the end of the URL.


060204

Where might I find info on using templates in PmWiki?

http://www.pmwiki.org/wiki/PmWiki/LayoutBasics http://www.pmwiki.org/wiki/PmWiki/PageLayout http://www.pmwiki.org/wiki/PmWiki/LayoutAdvanced http://www.pmwiki.org/wiki/Cookbook/Skins



Contact Information: amostella@lighthouse.tamucc.edu

Page last modified on September 29, 2005, at 09:28 PM