Username/Email:  Password: 
TwitterFacebookFlickrRSS

Ross Larson

Ross Larson's picture

Profile

Ross Larson

Occupation: 
Software Developer
Open Source project(s) I'm involved with or passionate about: 
django-gradebook: http://bitbucket.org/zthompson47/django-gradebook/

Ross Larson is a Linux geek, President of NEWLUG (NorthEast Wisconsin Linux Users Group), and occasional contributor to the Linux Journal website.

He does volunteer Sysadmin and IT Consulting for two Wisconsin-based non-profits: Crossways Camps and Fox Valley Lutheran Homes.

When Ross has free time, he is a big fan of multi-platform games, such as Puzzle Pirates and The Battle for Wesnoth.

Individual associate member of the Linux Foundation.

He is eagerly awaiting the arrival of his Pandora handheld console!


Guestbook

Would you kindly add to your gnome wallpaper article this script modification?

Can't seem to comment

##

#!/bin/bash

# This script creates xml files that can act as dynamic wallpapers for
# Gnome by referring to multiple wallpapers

# Coded by David J Krajnik

# Modified to support blanks, improved error checking and different
# time settings by Martin Re

######################################################################
### CONFIGURATION VARIABLES ###
######################################################################

# Default value # KEEP
# set the default duration (29-30 minutes)
# duration="1795.0"
# transition="5"

# set the default duration # This one you can modify
duration="1795.0"
transition="5"

######################################################################
### VARIABLES ###
######################################################################

i=''
j=''
firstItem=''
xml=''
xmlfile=''
my_start=''
destination=''
firstFile=''
currFile=''
prevFile=''
currDir=''

######################################################################
### MAIN SCRIPT ###
######################################################################

if [[ "$@" = "" ]]
then
echo "This script creates xml files that can act as dynamic backgrounds
for Gnome by referring to multiple wallpapers"
echo
echo "Usage: mkwalppr.sh target-file.xml [duration] pic1 pic2 [pic3 .. picN]"
echo "[duration] can be specified like 20 or 20m or 20h for seconds, minutes, hours"
fi

unset filenames

i=0

for j in "$@"
do
filenames[${i}]="${j}"
i=$(( $i+1 ))
done

#Grab the name of the target xml file
xml="${filenames[0]}"

if [ "$( echo "$xml" | grep '\.xml$' )" = "" ]
then
echo "Your target file must be an XML file"
exit
fi

### Time Configuration

# We would like to use a nice case here but ...

firstItem=${filenames[1]}

if [ "$( echo "$firstItem" | grep '^[0-9]\+\.[0-9]\+$' )" != "" ]
then
echo "The duration must be an integer"
exit
fi

# Do not touch this variable

my_start=1

if [ "$( echo "$firstItem" | grep '^[0-9]\+$' )" != "" ]
then
# If the item is a number, then use it as the
# duration for each wallpaper image
duration="$(( $firstItem - $transition )).0"
my_start=2
fi

if [ "$( echo "$firstItem" | grep '^[0-9]\+h$' )" != "" ]
then
# If the item is a number, then use it as the
# duration for each wallpaper image
firstItem=${firstItem%h}
duration="$(( $firstItem * 3600 - $transition )).0"
my_start=2
fi

if [ "$( echo "$firstItem" | grep '^[0-9]\+m$' )" != "" ]
then
# If the item is a number, then use it as the
# duration for each wallpaper image
firstItem=${firstItem%m}
duration="$(( $firstItem * 60 - $transition )).0"
my_start=2
fi

###

echo $duration
echo "$my_start"

# This checks for at least two filenames. Which would be members of
# array number 2 and 3.

if [[ "${filenames[@]:$my_start:2}" = "" ]]
then
echo "You must enter image files to associate with the XML file";
else

i=$my_start
while [ $i -lt ${#filenames[@]} ]
do

if [ ! -f "${filenames[$i]}" ]
then
echo "${filenames[$i]} does not exist";
# we blank it to avoid parsing errors if it does not exist
unset filenames[$i]
elif [ "$( echo "${filenames[i]}" | sed 's/^.*\.\(jpg\|jpeg\|bmp\|png\|gif\|tif\|tiff\|jif\|jfif\|jp2\|jpx\|j2k\|j2c\)$//' )" != "" ]
then
#echo "${filenames[$i]} is not an image file"
# we blank it to avoid parsing errors if it does not exist
unset filenames[$i]
fi
i=$(($i+1))
done
fi

### XML constructuin

firstItem=${filenames[$my_start]}

## Grab destination directory

destination=$( dirname "$firstItem" )

xmlfile="$destination/$xml"
echo "$xmlfile"

###

currDir=$( pwd )
echo "" > "$xmlfile"
echo " \n 2009\n
08\n 04" >> "$xmlfile"
echo " 00\n 00\n 00\n " >> "$xmlfile"
echo " " >> "$xmlfile"

firstFile="${filenames[$my_start]}"
if [ "$( echo "$firstFile" | sed 's/\(.\).*/\1/' )" != "/" ]
then
# If the first character in the filename is not '/', then it is a relative
# path and must have the current directory's path appended
firstFile="$currDir/$firstFile";
fi

firstFile="$( echo "$firstFile" | sed 's/[^/]\+\/\.\.\/\?//g' )"
# Remove occurrences of ".." from the filepath

prevFile="$firstFile";

currFile="";

#TODO add absolute path to the filenames
#if $currFile =~ "^/.*" then the file needs to path appended

echo " \n $duration\n $firstFile\n " >> "$xmlfile";

i=$my_start
j=${filenames[$my_start]}
k=${#filenames[@]}

while [ "$i" -lt "$k" ]
do

if [ "$( echo "${filenames[$i]}" | sed 's/\(.\).*/\1/' )" != "/" ]
then
# If the first character in the filename is not '/', then it is
# a relative path and must have the current directory's path
# appended
filenames[$i]="$currDir/${filenames[$i]}";
fi

filenames[$i]="$( echo "${filenames[$i]}" | sed 's/[^/]\+\/\.\.\/\?//g' )"
# Remove occurrences of ".." from the filepath
echo " \n ${transition}.0\n "$prevFile"\n "${filenames[$i]}"\n " >> "$xmlfile"
echo " \n "$duration"\n "${filenames[$i]}"\n " >> "$xmlfile"
prevFile="${filenames[$i]}"
i=$(( $i+1 ))
done

echo " \n ${transition}.0\n ${filenames[$i]}\n "$firstFile"\n " >> "$xmlfile";
echo "" >> "$xmlfile";

##

I am trying to install the mininet vm on my laptop. i am trying to configure the VM for SSH, in doing so i am trying to type the following commands in the CMD....
$ VBoxManage setextradata "VM Name Here" \
"VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/Protocol" TCP
$ VBoxManage setextradata "VM Name Here" \
"VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/GuestPort" 22
$ VBoxManage setextradata "VM Name Here” \
"VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/HostPort" 2222

When i type these errors i am getting errors such as

syntax Errors: Too many parameters.......

Can u please guide me through this and help me install mininet.

I read u article on port forwarding in virtualbox but could not see how to add a comment or ask a question. I am using virtualbox 4.0.4 in fedora 14 (the host). I am running xp in virtualbox (the guest). I want to run emule in xp. I have set my router to port-forward to the static ip address in fedora. i tested emule on another computer running xp and the router port-forwarding is working.

Here is my big question? Do i use the same port number for the host and the guest operating system. If not then what port do i list in emule when setting the program if i am using 2 different port numbers? i really struggling to comprehend the situation. thanks