List Info

Thread: Re: Reduce the Code please!!!!{does it possible to run batch file }




Re: Reduce the Code please!!!!{does it possible to run batch file }
country flaguser name
United States
2007-06-01 05:17:40

--- In JavaScript_Official%40yahoogroups.com">JavaScript_Officialyahoogroups.com, "David Smart";
<smartware.consulting...> wrote:
&gt;
> Can I assume, then, that you actually have pictures corresponding
to each
> day of the week (Monday, Tuesday, etc) rather than the actual
date? (I.e.
> seven pictures?)
>
> If so, you can grab the day of the week from a date and use that.
(But then
> you don't actually need the date, you can simply run a loop from 1
to 7, or
> 0 to 6, and display the pictures for each day.)
&gt;
> Or do you have 31 pictures and want to display the particular
picture
> relating to each day of the month?
&gt;
> If so, then some of the solutions that have been posted here simply
use the
> day part of the date to make up the image name directly. Those are
the ones
> you want. (Others have specifically handled 31 separately because
that
> looked like what you wanted. You can discard that bit.)
&gt;
> In future, please do not post code for analysis without also
posting a
> description of what it is actually supposed to do. As you can see,
simply
> reading the code leads to confusion.
>
> Regards, Dave S
>
> ----- Original Message -----
> From: "sri.vikram"; < no_reply%40yahoogroups.com">no_replyyahoogroups.com>
> To: < JavaScript_Official%40yahoogroups.com">JavaScript_Officialyahoogroups.com>
> Sent: Thursday, May 31, 2007 8:57 PM
> Subject: Re: [JavaScript] Reduce the Code please!!!!
>
>
> > --- In JavaScript_Official%40yahoogroups.com">JavaScript_Officialyahoogroups.com, "David Smart";
> > <smartware.consulting> wrote:
&gt; >>
> >> Why does 31 go to zero when the others go to a position in the
> > array equal
&gt; >> to the day's date?
&gt; >>
> >> Regards, Dave S
> >>
> >> ----- Original Message -----
> >> From: "sri.vikram"; < no_reply%40yahoogroups.com">no_replyyahoogroups.com>
> >> To: < JavaScript_Official%40yahoogroups.com">JavaScript_Officialyahoogroups.com>
> >> Sent: Thursday, May 31, 2007 4:48 AM
> >> Subject: [JavaScript] Reduce the Code please!!!!
> >>
> >>
> >> >
>; >> > Is there any code reducing technique available for this?
&gt; >> > please tell me how can i reduce this...???
> >> > B'cos i have to add still more days to get the result.
> >> > Which control statement is good for this?
&gt; >> > ---------------------------------------
> >> > // my code....
> >> > <Script Language=&quot;JavaScript">
> >> > var photos=new Array()
> >> > photos[0]="1.jpg"
&gt; >> > photos[1]="2.jpg"
&gt; >> > photos[2]="3.jpg"
&gt; >> > photos[3]="4.jpg"
&gt; >> > photos[4]="5.jpg"
&gt; >> >
>; >> > var now=new Date()
&gt; >> > if (now.getDate()==31) {
> >> > document.write('<img src="'+photos[0]+'&quot; name=";vikram&quot;
> > border=0&gt;')
> >> > }
> >> > if (now.getDate()==1) {
> >> > document.write('<img src="'+photos[1]+'&quot; name=";vikram&quot;
> > border=0&gt;')
> >> >
>; >> > }
> >> > if (now.getDate()==2) {
> >> > document.write('<img src="'+photos[2]+'&quot; name=";vikram&quot;
> > border=0&gt;')
> >> >
>; >> > }
> >> > if (now.getDate()==3) {
> >> > document.write('<img src="'+photos[3]+'&quot; name=";vikram&quot;
> > border=0&gt;')
> >> >
>; >> > }
> >> > if (now.getDate()==4) {
> >> > document.write('<img src="'+photos[4]+'&quot; name=";vikram&quot;
> > border=0&gt;')
> >> >
>; >> > }
> >> > if (now.getDate()==5) {
> >> > document.write('<img src="'+photos[5]+'&quot; name=";vikram&quot;
> > border=0&gt;')
> >> >
>; >> > }
> >> > if (now.getDate()==6) {
> >> > document.write('<img src="'+photos[6]+'&quot; name=";vikram&quot;
> > border=0&gt;')
> >> >
>; >> > }
> >> > </Script>
>; >> >
>; >> >
>; >> >
>; >> > Visit http://aiaiai.com for more groups to join
>; >> > Yahoo! Groups Links
&gt; >> >
>; >> >
>; >> >
>; >> >
>; > I'm just experimenting, as the yesterday is 31, just to display
which
> > photo it points to.. and checking for the accuaracy. (
> > Any how can i
> >
>; >
>; >
>; >
>; > Visit http://aiaiai.com for more groups to join
>; > Yahoo! Groups Links
&gt; >
>; >
>; >
>;
------------------------------------------------------
Thank you very much for discussing with me..

My intention is to display the image, as my desktop background {if i
select this as my (cycling the wallpaper with date
code) "desktop_wallpaper.html&quot; as backgound of my desktop. it will be
changing for each and every day} and i want to use that same piece of
code to my personal webpage also.

hereafter i will not post code to avoid confusion.
Now I got the soloution to do the same thing with the batch file
[.bat]. But my question is, does it possible to run the batch file on
the server using java script.
I use (document.reference) for the batch file , but it asking me to
download the batch file. That should self executed on the server
itself.

Though this a javascript i want to share my batch file with all of
you. please co-operate with me...
When the user clicks on the button ..Batch file should be executed
and displays according to the code..
---------------
batch file
ECHO OFF
REN a00.jpg axx.jpg
REN a01.jpg a00.jpg
REN a02.jpg a01.jpg
REN a03.jpg a02.jpg
REN a04.jpg a03.jpg
REN axx.jpg a04.jpg
EXIT

__._,_.___
.

__,_._,___
Re: Reduce the Code please!!!!{does it possible to run batch file }
country flaguser name
United States
2007-06-01 18:09:00

No, it is not possible to run this batch file on the server from JavaScript.
If you own the server, it would be possible to run the batch file on it in
the normal way, however,

Otherwise, look at the solutions that were posted. Apart from the confusion
caused by your 31, they will do the job. Simply remove the code that
handles the 31 and select the picture based solely on the day number.

Two further comments:

(1) I hope the pictures are small. People viewing your web site will not
appreciate having to wait for (and pay for) a large background image to
download.

(2) Please do not put your e-mail message at the bottom of a very long
quoted thread of messages. Put your message at the top, like everyone else
in the forum; or trim the quoted text to the bare minimum. (This thread is
getting too long to be quoted in full anyway, and should be trimmed.)

Regards, Dave S

----- Original Message -----
From: "sri.vikram"; < no_reply%40yahoogroups.com">no_replyyahoogroups.com>
To: < JavaScript_Official%40yahoogroups.com">JavaScript_Officialyahoogroups.com>
Sent: Friday, June 01, 2007 8:17 PM
Subject: Re: [JavaScript] Reduce the Code please!!!!{does it possible to run
batch file }

>; --- In JavaScript_Official%40yahoogroups.com">JavaScript_Officialyahoogroups.com, "David Smart";
> <smartware.consulting...> wrote:
&gt;>
&gt;> Can I assume, then, that you actually have pictures corresponding
> to each
>;> day of the week (Monday, Tuesday, etc) rather than the actual
&gt; date? (I.e.
&gt;> seven pictures?)
>>
>> If so, you can grab the day of the week from a date and use that.
&gt; (But then
>;> you don't actually need the date, you can simply run a loop from 1
> to 7, or
>&gt; 0 to 6, and display the pictures for each day.)
&gt;>
&gt;> Or do you have 31 pictures and want to display the particular
> picture
>> relating to each day of the month?
&gt;>
&gt;> If so, then some of the solutions that have been posted here simply
&gt; use the
>> day part of the date to make up the image name directly. Those are
> the ones
>;> you want. (Others have specifically handled 31 separately because
> that
>;> looked like what you wanted. You can discard that bit.)
&gt;>
&gt;> In future, please do not post code for analysis without also
>; posting a
>&gt; description of what it is actually supposed to do. As you can see,
>; simply
&gt;> reading the code leads to confusion.
>>
>> Regards, Dave S
>&gt;
>&gt; ----- Original Message -----
>>; From: "sri.vikram"; < no_reply%40yahoogroups.com">no_replyyahoogroups.com>
>> To: < JavaScript_Official%40yahoogroups.com">JavaScript_Officialyahoogroups.com>
>> Sent: Thursday, May 31, 2007 8:57 PM
>&gt; Subject: Re: [JavaScript] Reduce the Code please!!!!
>>
>>
>> > --- In JavaScript_Official%40yahoogroups.com">JavaScript_Officialyahoogroups.com, "David Smart";
>>; > <smartware.consulting> wrote:
&gt;> >>
>> >> Why does 31 go to zero when the others go to a position in the
>> > array equal
&gt;> >> to the day's date?
&gt;> >>
>> >> Regards, Dave S
>&gt; >>
>> >> ----- Original Message -----
>>; >> From: "sri.vikram"; < no_reply%40yahoogroups.com">no_replyyahoogroups.com>
>> >> To: < JavaScript_Official%40yahoogroups.com">JavaScript_Officialyahoogroups.com>
>> >> Sent: Thursday, May 31, 2007 4:48 AM
>&gt; >> Subject: [JavaScript] Reduce the Code please!!!!
>> >>
>> >>
>> >> >
>;> >> > Is there any code reducing technique available for this?
&gt;> >> > please tell me how can i reduce this...???
>> >> > B'cos i have to add still more days to get the result.
>> >> > Which control statement is good for this?
&gt;> >> > ---------------------------------------
>> >> > // my code....
>> >> > <Script Language=&quot;JavaScript">
>> >> > var photos=new Array()
>> >> > photos[0]="1.jpg"
&gt;> >> > photos[1]="2.jpg"
&gt;> >> > photos[2]="3.jpg"
&gt;> >> > photos[3]="4.jpg"
&gt;> >> > photos[4]="5.jpg"
&gt;> >> >
>;> >> > var now=new Date()
&gt;> >> > if (now.getDate()==31) {
>&gt; >> > document.write('<img src="'+photos[0]+'&quot; name=";vikram&quot;
>&gt; > border=0&gt;')
>> >> > }
>&gt; >> > if (now.getDate()==1) {
>&gt; >> > document.write('<img src="'+photos[1]+'&quot; name=";vikram&quot;
>&gt; > border=0&gt;')
>> >> >
>;> >> > }
>&gt; >> > if (now.getDate()==2) {
>&gt; >> > document.write('<img src="'+photos[2]+'&quot; name=";vikram&quot;
>&gt; > border=0&gt;')
>> >> >
>;> >> > }
>&gt; >> > if (now.getDate()==3) {
>&gt; >> > document.write('<img src="'+photos[3]+'&quot; name=";vikram&quot;
>&gt; > border=0&gt;')
>> >> >
>;> >> > }
>&gt; >> > if (now.getDate()==4) {
>&gt; >> > document.write('<img src="'+photos[4]+'&quot; name=";vikram&quot;
>&gt; > border=0&gt;')
>> >> >
>;> >> > }
>&gt; >> > if (now.getDate()==5) {
>&gt; >> > document.write('<img src="'+photos[5]+'&quot; name=";vikram&quot;
>&gt; > border=0&gt;')
>> >> >
>;> >> > }
>&gt; >> > if (now.getDate()==6) {
>&gt; >> > document.write('<img src="'+photos[6]+'&quot; name=";vikram&quot;
>&gt; > border=0&gt;')
>> >> >
>;> >> > }
>&gt; >> > </Script>
>;> >> >
>;> >> >
>;> >> >
>;> >> > Visit http://aiaiai.com for more groups to join
>;> >> > Yahoo! Groups Links
&gt;> >> >
>;> >> >
>;> >> >
>;> >> >
>;> > I'm just experimenting, as the yesterday is 31, just to display
> which
&gt;> > photo it points to.. and checking for the accuaracy. (
>&gt; > Any how can i
>&gt; >
>;> >
>;> >
>;> >
>;> > Visit http://aiaiai.com for more groups to join
>;> > Yahoo! Groups Links
&gt;> >
>;> >
>;> >
>;>
>; ------------------------------------------------------
>; Thank you very much for discussing with me..
>;
> My intention is to display the image, as my desktop background {if i
> select this as my (cycling the wallpaper with date
>; code) "desktop_wallpaper.html&quot; as backgound of my desktop. it will be
> changing for each and every day} and i want to use that same piece of
> code to my personal webpage also.
&gt;
> hereafter i will not post code to avoid confusion.
> Now I got the soloution to do the same thing with the batch file
>; [.bat]. But my question is, does it possible to run the batch file on
> the server using java script.
> I use (document.reference) for the batch file , but it asking me to
> download the batch file. That should self executed on the server
&gt; itself.
>
> Though this a javascript i want to share my batch file with all of
> you. please co-operate with me...
&gt; When the user clicks on the button ..Batch file should be executed
> and displays according to the code..
&gt; ---------------
&gt; batch file
>; ECHO OFF
> REN a00.jpg axx.jpg
> REN a01.jpg a00.jpg
> REN a02.jpg a01.jpg
> REN a03.jpg a02.jpg
> REN a04.jpg a03.jpg
> REN axx.jpg a04.jpg
> EXIT
>;
>
>
>
>
&gt; Visit http://aiaiai.com for more groups to join
>; Yahoo! Groups Links
&gt;
>
>

__._,_.___
.

__,_._,___
Re: Reduce the Code please!!!!{does it possible to run batch file }
country flaguser name
United States
2007-06-02 02:07:50

Dave.

I wholeheartedly agree. (Not a personal flame, but a comment in general).

How can people expect to write elegant code that works 100% when they can't pay attention to detail and get basic netiquette right?

Of course it's right and proper that folks should ask questions and it's even better that they learn by their mistakes, but some of the inane questions seen here, make me wonder if the writer/s actually thought about their problem or just want a quick fix at someone else's expense?

Regards,

Alan.

www.theatreorgans.co.uk
Admin: ConnArtistes, UKShopsmiths, 2nd Touch & A-P groups
Shopsmith 520 + bits
Flatulus Antiquitus

----- Original Message -----
From: David Smart
To: JavaScript_Official%40yahoogroups.com">JavaScript_Officialyahoogroups.com
Sent: Saturday, June 02, 2007 12:09 AM
Subject: Re: [JavaScript] Reduce the Code please!!!!{does it possible to run batch file }

..............................(2) Please do not put your e-mail message at the bottom of a very long
quoted thread of messages. Put your message at the top, like everyone else
in the forum; or trim the quoted text to the bare minimum. (This thread is
getting too long to be quoted in full anyway, and should be trimmed.)

Regards, Dave S

[Non-text portions of this message have been removed]

__._,_.___
.

__,_._,___
[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )