Archive for September 2009

Mootools, Forms & MediaboxAdvanced

Thursday, September 24th, 2009 by Joyce Johnston

Here’s what I wanted to accomplish tonight:

  1. Submit a form
  2. Process the form data
  3. Display the results in a MediaboxAdvanced window

Getting the script to which the form submits to open in the box was a breeze; it was getting the post data from the form to the script, processing it, and then displaying the results in the box that had me stumped. I came up with a way to get the page to work the way I needed it to, but I’m not entirely happy with the method. If anyone out there has a better idea, please leave a comment!

View the demo

Read more »

Set your shell options to something useful

Monday, September 7th, 2009 by tburns

You can manipulate shell options to allow for more useful and intuitive function using the shopt command.

Copying Files:

In Fedora, by default, wildcard options with some file manipulation commands such as cp, mv, and rm will not copy the hidden files in the present working directory. This is because file globbing (pattern matching) is not set to expand hidden files. Suppose, for example, I wanted to copy the entire contents of this user’s directory to another location. The directory has a listing of files, both hidden and not hidden, as well as one subdirectory called documents/. Here is the output of a recursive listing showing all the files in the tree:

 [sshuser@localserver ~]$ ls -alR
.:
total 40
drwx------  3 sshuser sshuser 4096 2009-09-07 11:02 .
drwxr-xr-x 12 root    root    4096 2009-09-06 13:16 ..
-rw-------  1 sshuser sshuser  490 2009-07-29 12:20 .bash_history
-rw-r--r--  1 sshuser sshuser   18 2008-02-29 08:27 .bash_logout
-rw-r--r--  1 sshuser sshuser  176 2008-02-29 08:27 .bash_profile
-rw-r--r--  1 sshuser sshuser  124 2008-02-29 08:27 .bashrc
-rw-r--r--  1 sshuser sshuser 7023 2009-09-07 11:02 code-markup.php
drwxr-xr-x  2 sshuser sshuser 4096 2009-09-07 11:03 files
-rw-r--r--  1 sshuser sshuser  920 2009-09-07 11:02 traffic.dmp

./documents:
total 8
drwxr-xr-x 2 sshuser sshuser 4096 2009-09-07 11:03 .
drwx------ 3 sshuser sshuser 4096 2009-09-07 11:02 ..
-rw-r--r-- 1 sshuser sshuser    0 2009-09-07 11:02 .file-1.txt
-rw-r--r-- 1 sshuser sshuser    0 2009-09-07 11:03 resume.doc
[sshuser@localserver ~]$

Read more »

Renice 2: Even Nicer With Arrays

Tuesday, September 1st, 2009 by tburns

I put an entry out here that detailed how to find the process ID of a running process and then how to re-nice it from within a bash shell script. This first script referenced processes that could be identified by a single pid. But what about processes that spawn multiple pids, or multiple processes that are all named the same but are, in fact, separate instances?

Here is a small bash script segment that identifies process PIDs; puts them into an array; then uses that array to renice the processes. In this case, the processes are VoIP applications that use RTP (real time protocol), and, in particular SIP (Session Initiation Protocol) to put voice traffic on the wire and usually need immediate CPU access.

This script does many things before it gets to this point… we pick it up here at the renice process… Note that some of the variables you see here were instantiated early in the script. Also, to get the code to fit neatly on the page here, I took out a lot of the formatting of the echo statements that allows for clear logging…
Read more »