I am looking for a JavaScript script that will run on a FreeBSD 5.4 OS with Perl 5.8.8 installed.\n\nI have a collection of images saved in a directory that I want to display one at a time on a daily basis on a webpage. I need a script that could sort the files in a given directory and display the first one in the web page I am creating. After 12 midnight the the script would move the previously displayed image to a new location and display the next image in the directory. \n\nThe directory structure for the stored images is:\n\n/usr/local/www/seibercom/htdocs/images\n\nI would like to store the displayed images under the 'image' directory.\n\nI am not sure if this can even be accomplished with Java, but I thought I would give it a try. The alternative would be to try and do something with Perl and run it from CRON perhaps.
130798
Hello \n\non my script - I can alter it if it is not exactly what you require. \nI wanted to post something here for you to peruse before you reply to my clarifications.\n\nIf you require the images still to be moved I can easily build this in to the script for you although I think it may not be necessary depending on your exact requirements and the number of images in the directory.\n\nYou should place the script below into the directory of images on your server (set the permissions of the script to chmod 755). \n\nWhen run the script will calculate the current day of the year (the number of days since January 1st) and the number of JPG images in the directory.  If there are more images in the directory than days in the year then the script will have to be altered.\n\nIf there have been more days in the year so far than there are number of images in the directory the script will simply begin displaying each image from the beginning again.  The script will loop through each image in the directory before displaying it twice.  The images\nare sorted alphabetically.\n\nThe script stores the name of each image file in an array and outputs the image depending on the day of the year.\n\nTo display an image simply use this in your HTML:\n<img src="location_of_your_perl_script.pl">\n\nIf any of this is unclear please take a close look at the script and ask for clarification.  I will try to respond as swiftly as possible.  Likewise if you do still require the images to be moved or anything else changing please ask for clarification.\n\n#!/usr/bin/perl\n\n# find out the day of the year\nmy $day_of_year = (localtime(time()))[7];\n\n# define the path where the images live "." is the current directory\n$path = ".";\n# read all the jpg filenames from the directory into an array\nopendir(DIR, $path);\n@files = grep { /&#92;.jpg$/i } readdir(DIR);\nclosedir(DIR);\n\n# sort the filenames alphabetically\n@files = sort( {lc $a cmp lc $b} @files);\n\n# count the number of images\n$no_of_images = scalar(@files);\n\n# Now the fun bit :)  We loop through the images once before\n# repeating them in the same order.  If we divide the current\n# number of day of the year by the number of images in the\n# directory we get the number of times have repeated the images.\n# We are interested in the remainder of this calculation (this\n# is calculated using the % operator).  Note - there must be\n# less than 365 images in the directory!  We need to subtract\n# one from this number because arrays start at zero not 1!\nif ( $no_of_images <= $day_of_year ) {\n  $image_to_use = ($day_of_year % $no_of_images)-1;\n}\nelse {\n  $image_to_use = $day_of_year-1;\n};\nprint "Location: $files[$image_to_use]&#92;n&#92;n";
23675
First of all, is it a browser based or a windows program? There are many different ways to do it with many different languages. \n\nIf it's browser based, you can create such program using JavaScript or any other Server-side scripting program. \n\nGive us more detail and we will let you know which language you can use.\n\nAdded on 01/20:\nOk, it might be a little late to answer this question, but you can do it by using JavaScript. If you don't know JS, then you can't do it in one night from scratch. \n\nGo buy a book and learn JS. Maybe it will help you next time. \n\nPS: Did you win?
161063
run4ever79 was right but thats very long to do. So, you can link your jscript with vbscript. That will be more easy.\n\n<script language=vbscript>\n<!--\nFunction getchar(code)\ngetchar = Chr(code)\nEnd Function\n-->\n</script>\n<script language=javascript>\n<!-- dont choke odd old browser\nvar i;\nfor(i=65;i<=90;i++){ // Code of A is 65 and Z is 90 in vbs\nvar current_char = getchar(i);\ndocument.write(current_char + "<br>");\n}\n//-->\n</script>\n\nThe above script will write A to Z in you document. You can also do a to z. For that, use for(i=97;i<=122;i++) because the code of "a" is 97 and that of "z" is 122. So, you need not waste time in declaring arrays.\n\nFor table list of character and its code, see the vbscript documentaion at:\nhttp://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/c60e2712-20e6-40f2-8fe2-cfb74ca6bca1.asp
625332
<SCRIPT>\nrnd.today=new Date();\nrnd.seed=rnd.today.getTime();\n\n    function rnd() {\n    rnd.seed = (rnd.seed*9301+49297) % 233280;\n    return rnd.seed/(233280.0);\n};\n\n\n    function rand(number) {\n    return Math.ceil(rnd()*number);\n};\n</SCRIPT>\n\nThis is alot more simple then using the IF statements. To create a random number between 1 and 10 use rand(10). To display an random image named banner1.gif to banner10.gif use: \n\n<SCRIPT LANGUAGE=JAVASCRIPT><!--\ndocument.write('<IMG SRC="banner' + rand(10) + '.gif" WIDTH="400" HEIGHT="40">');\n//--></SCRIPT>\n\nIf you have at least 10 or more banners... You shouldnt have a problem with dups. If it is essensial not to dup let me know and I'll update the code.
168094
Have you uploaded your images onto the web server you are using?  You may have to manually adjust the code that refers to the source of your images.\n\nAre you using a web design software or are you typing in the html?  For example, front page creates all your folders for you and all images and the code correspond, but all that info then as to be uploaded onto the internet in that order or your images won't be found.\n\nIf you are uploading all files manually, remember that the folder structure of your web page on the server has to be an exact copy of the folder structure of your web page on your hard drive, so you have to create folders on the server accordingly.
481426
lookup the man pages for "ls", "sort" and possibly "exec"\n\nthese commands can everything you're asking.  every answer is less than 100 characters on a single line.\n\n have fun!  welcome to unix
307296
Put this in an asp page and try it.I jus did it and it worked. \n\n<%@ Language=VBScript %>\n<HTML>\n<HEAD>\n<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">\n</HEAD>\n<BODY>\n<form name="frmTest" method="post">\n<img src="Bluebar.gif" ></img>\n<br>\n<LABEL id="lblclick" onclick="ShowList()">Click on this</LABEL>\n<P> </P>\n<br>\n<LABEL id="lblShow" ></LABEL>\n</form>\n</BODY>\n</HTML>\n<script language="javascript">\nfunction ShowList()\n  {\n   window.document.getElementById('lblShow').innerHTML = "Hey ! you just viewed and clicked me :)"\n  }\n</script>\n\nDude.....the window.document.getElementById will show as .... I tried all methods and yahoo still sucks...\nSo here I will explain.  getElementBytId() .In this bracket you need to give the Label which is displaying the text, its id , i.e in this case getElementBytId('lblShow'), and after the close parenthesis we give ".innerHTML" and then "=" what value we want to give.\nhave issues still then, send me a mail at nigeljd@gmail.com
33748
why write one when there are literally hundreds out there on the web that already do this?\n\nhttp://internet.javascript.com has a lot.
361661
1) javascript ain't java (to the previous answerer)\n\nOK, so remove all remnants of flash and install freshly! I can't guess what you did (or the evil program did) but it's not working...  \n\nI won't ask you to re-format your drive or install windows.....  give firefox  a try... at least for this!
45838
You can usually run the scripts locally without Tomcat, just using an JRE, read up at \n\njava.sun.com
154531
Hello,\nif it is a unix (or linux) server, you normaly will be able to run cgi-scripts or perl-scripts. Here is a solution (i think it´s simple to understand and customize for newbies too) that will meet your needs:\n\nhttp://www.hotscripts.com/Detailed/17542.html\n\nOtherwise (if it is linux/unix-based server), you will be able to run php-scripts. So have a look at hotscripts.com at php-section, topic : formmail, form-processor\n\nGood Luck, PeterT
385322
Hello. I tried it, and I was successfull, so I didnt get Permission Denied (Linux, Debian unstable).\nTry "echo $PWD" to see, which directory try to touch a file in.\nAlso try "set" to see all environment variables.\n\nAnd probably it could be a good ide to share your crontab with us.\n\n#!/bin/sh\nset
6174
Hi spaceman! :O)\n\nI've tried a few.  One I would reccomend to you would be at http://open-perl-ide.sourceforge.net/ . It's a free Perl IDE w/ highlighting :O)  You can also find a similiar editor at http://www.indigostar.com/perledit.html&e=912\n\nIf you are comfortable with the IDE from Visual Studio, it may be nice to check out http://www.activestate.com/Products/Visual_Perl/ - This does include a classes/objects/etc. tree too :O)\n\nhttp://user.bahnhof.se/~johanl/perl/Oasis/ is a program which will help you navigate through your classes/subroutines through a tree too. :O)\n\nI hope one of these can help you.. :O) Good luck!
129006
To run a perl program in windows using ActiveState Perl you have two choices.\n\nThe first is via the command line.  Personally I prefer this way, but you do need to be able to find your way about dos.  \n\nClick on Start then Run.  In the box that comes up type in cmd.  A new command window will open.  Navigate to where you saved your perl script and type in \nperl scriptname.pl\nThe advantage of doing it this way is that you can see on the command line exactly what your program is displaying.  It's quite handy for testing CGI files and other programs that just dump out information.\n\nThe other way to do is to right click on your perl program and click on Open With.  Click Choose Program and then Browse.  Navigate to the ActiveState folder (probably on your C drive rather than in Program Files) then go into Perl, then bin.  From here select perl.exe.  Your program will then run.\n\nAfter you do all this the first time Windows will remember that you used perl to do it, so it will stay on the Open With menu rather than you having to go and find it.\n\nRemember that if you do it this way, all you might see is a black box come up.  Your program ran or produced an error, but you'll need to be at the command line to see what it did properly.
9025
First you need an FTP software. Try this, it's free and full of features.\nhttp://filezilla.sourceforge.net/\n\nSecond setup your ftp account. Read this document if you don't know how to.\nhttp://filezilla.sourceforge.net/documentation/\n\nLast but not least, make sure you first page start witha  file name "index.html"\nIf you use server side scripting it would be something like: index.asp, index.php, etc.
83737
If you are using some known server software like a common bulletin board or forum application, or a common blogging site, etc., then you should mention what it is because there may be application specific ways of adding what you want.  The answer may also differ depending on whether you are hosting it yourself or it is running on a hosting service.\n\nIf you have your own server ... the earliest (back when dinosaurs ruled the earth and surfed the web) was probably specifying an...\n\nimg src="..." width="..." height="..." ...\n\n...tag where the src was a Perl cgi script that supplied the desired count as an odometer style image (Google for odometer font).\n\nDepending on your web server your page can mix static html with code that gets executed on the server and which you can use to fill in the counts.\n\nSo edit and/or re-ask with your setup, who hosts your site and what http server does it run on?\n\n\nReply to additional details\n===========================\n\nI am not familiar with zeebro or cpanel.\n\nIf you can't find an answer here you might want to try asking in one of the zeeblo forums at...\n\nhttp://zeeblo.com/forums/\n\n...perhaps under one of the categories\n\nHosting Helpline\nHelp In Community\nWebMaster Arena\nKnowledge Base
477930
There are lots of options.\nHere's just one\nhttp://www.nonags.com/nonags/fileren.html\n///