Sponsored Content
Top Forums Shell Programming and Scripting how to select a value randomly Post 42152 by norsk hedensk on Wednesday 22nd of October 2003 05:33:21 PM
Old 10-22-2003
how to select a value randomly

on my desktop i am using the kde rotating desktop image option. this rotates images randomly every half hour. now, i would like to write an html file which will have an inline frame with some text, maybe system messages, or my friends live journal thati read alot, or unix.com! however, i dont want to give up my rotating desktop images.

my proposal:

define one variable that would equal a value from a given set of OTHER variables. say i have

String picture;

then i have

String picture1=picture1location;
String picture2=picture2location;

and so on, i have maybe 50 images.

how can i make the first string 'picture' randomly equal the value of picture1 or picture2 or picture3 etc etc.?

further more, after i sort that out, how can i then set the value of 'picture' to the html file's background image?

at first i was gonna use SSIs, but i realized that there is no server to interpret the SSIs because the file is going to reside on my desktop in the same directory as all of my image files. i think javascript would be good for this, or PHP?

ill have the page refresh every 30 minutes.
well if anyone can help thatd be great.

all i really need is a way to change a background image in an html page randomly at a given interval.

thanks again! Smilie
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Read line from file randomly

I have data file with customer.dat, and this contains the customer names >cat customer.dat FirstName1 LastName1 FistName2 LastName1 FistName3 MiddleName3 LastName3 This file can contain areoun 100 customer names. Regards, (1 Reply)
Discussion started by: McLan
1 Replies

2. Shell Programming and Scripting

Script exits with $? not 0 randomly, how can I see what command failed?

Hi! I have this situation with 3 shellscripts. One is a "startscript" that simply calls other scripts. This one is scheduled with cron to run at regular intervals. That script runs what I'll refer to as Script 1. Script 1 in turn runs script 2 (import_catalogs_buyer.sh) Sometimes, seemingly... (2 Replies)
Discussion started by: trailsmoke
2 Replies

3. UNIX for Dummies Questions & Answers

randomly renaming files

I have a directory of files that look like filename 001.ext, filename 002.ext, etc. I'd like to rename the files with unique random numbered names, so that the original filenames are stripped and the files are given a new, random number name. I'm not super new to UNIX, but I don't often use it for... (2 Replies)
Discussion started by: platz
2 Replies

4. Shell Programming and Scripting

Cron job randomly once a day

I want to create a cron job randomly once a day for my site's registration. The responsible file for registrations is a config file and I need to change the contents twice on day (on and off) I know the way for random cron job for example */n * * * * /usr/local/bin/php... (6 Replies)
Discussion started by: lucker
6 Replies

5. Programming

Java application dying randomly

Hi, (First post, please be gental!) I have a java app that I am running on unix (centos) But it keeps dying randomly. The times seem random from anything between 3 hours and 3 days. I have a cronjob running to restart it when ever it dies but I would rather this happened less often. ... (2 Replies)
Discussion started by: sm9ai
2 Replies

6. Shell Programming and Scripting

randomly shuffle two text files the same way

What I have are two text files that I need to shuffle randomly, but I need the two files to be randomly shuffled the same way. I have heard of shuf but I do not know how to use it for two files. Maybe there is also an easy/simple awk command I do not know about that could handle this problem. ... (3 Replies)
Discussion started by: adrunknarwhal
3 Replies

7. Shell Programming and Scripting

Get 20% of lines in File randomly

Hello, This is my code: nb_lignes=`wc -l $1 | cut -d " " -f1` for i in $(seq $nb_lignes) do m=`head $1 -n $i | tail -1` //command done Please how can i change it to get Get 20% of lines in File randomly to apply "command" on each line ? 20% or 40% or 60 % (it's a parameter) Thank you. (15 Replies)
Discussion started by: chercheur857
15 Replies

8. UNIX for Dummies Questions & Answers

How to randomly select lines from a text file

I have a text file with 1000 lines, I want to randomly select 200 lines from it and print them as output. How do I go about doing that? Thanks! (7 Replies)
Discussion started by: evelibertine
7 Replies

9. Shell Programming and Scripting

Randomly create time in UNIX

Hey, How can i create randomly create time N times. Suppose i want to create data for a particualr date 5 times... Mon Jan 19 11:42:50 Mon Jan 19 19:16:40 Mon Jan 19 12:12:33 Mon Jan 19 14:26:27 Mon Jan 19 12:29:53 Mon Jan 19 13:30:31 I want the script to create N times randome... (2 Replies)
Discussion started by: jaituteja
2 Replies

10. Shell Programming and Scripting

How to select lines randomly without replacement in UNIX?

Dear Folks I have one column of 15000 lines and want to select randomly 5000 of them in five different times without replacement. I am aware that command 'shuf' and 'sort -R' could select randomly those lines but I am not sure how could I avoid the replacement of selection line. Does anyone have... (10 Replies)
Discussion started by: sajmar
10 Replies
xscreensaver-getimage(1)					XScreenSaver manual					  xscreensaver-getimage(1)

NAME
xscreensaver-getimage - put some randomly-selected image on the root window SYNOPSIS
xscreensaver-getimage [-display host:display.screen] [--verbose] window-id [pixmap-id] DESCRIPTION
The xscreensaver-getimage program is a helper program for the xscreensaver hacks that manipulate images. This is not a user-level command. This program selects a random image, and puts it on the specified window or pixmap. This image might be a snapshot of the desktop; or a frame captured from the system's video input; or a randomly-selected image from disk. If only a window ID is specified, the image will be painted there. If both a window ID and a pixmap ID are specified, then the image will be painted on the pixmap; and the window may be modified as a side-effect. OPTIONS
xscreensaver-getimage reads the ~/.xscreensaver file for configuration information. It uses these settings: grabDesktopImages Whether it is acceptable to grab snapshots of the desktop. The security paranoid might want to turn this off, to avoid letting people see (but not touch!) your desktop while the screen is locked. grabVideoFrames Whether it is acceptable to grab frames of video from the system's video input. Grabbing of video is done by invoking the xscreen- saver-getimage-video(1) program. chooseRandomImages Whether it is acceptable to display random images found on disk. Selection and loading of images is done by invoking the xscreensaver- getimage-file(1) program. imageDirectory When loading images from disk, this is the directory to find them in. The directory will be searched recursively for images. It may also be the URL of an RSS or Atom feed, in which case a random image from that feed will be selected instead. The contents of the feed will be cached locally and refreshed periodically as needed. If none of the three options are set to True, then video colorbars will be displayed instead. BUGS
When grabbing desktop images, the window argument will be unmapped and have its contents modified, causing flicker. (This does not happen when loading image files or video frames.) SEE ALSO
X(1), xscreensaver(1) xscreensaver-demo(1) xscreensaver-getimage-file(1) xscreensaver-getimage-video(1) COPYRIGHT
Copyright (C) 2001-2011 by Jamie Zawinski. Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. No representations are made about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. AUTHOR
Jamie Zawinski <jwz@jwz.org>, 14-Apr-01 X Version 11 5.15 (28-Sep-2011) xscreensaver-getimage(1)
All times are GMT -4. The time now is 08:42 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy