Two Plus Two Older Archives  

Go Back   Two Plus Two Older Archives > Internet Gambling > Software
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 11-08-2005, 07:27 PM
DavidC DavidC is offline
Senior Member
 
Join Date: Aug 2004
Location: Ontario, Canada
Posts: 292
Default I am a programmer without a compiler, and a sh-tty one at that.

I like programming. I've used VB, java, perl, QBASIC (woot!), and that's about it.

However, my linux box is down, and I like the flexibility of programming using javascript, considering that windows seems to run it just fine with minimal effort on my part.

----------

So I'd like to know a few things about javascript programming.

1) Can they output to text files. *

2) Can they output to HTML files. *

3) How do I make arrays?

4) How do I gather user input and make a WHILE loop?

* easily, hopefully.

----------------------------------------------

link

The following shows some code with the alert and prompt statements, which is part of what I need. It also shows a function (though no function variables are used), and a for loop. It shows arrays being used.

So basically, I need to know the while loop and how to export to text.

This shows a while loop

---

Alright... so basically everything's been answered except the "how to output to text and html" thing... If I could get that, I'd be pretty happy. [img]/images/graemlins/smile.gif[/img]

---

Edit:

function with an argument
Reply With Quote
  #2  
Old 11-08-2005, 08:46 PM
RatFink RatFink is offline
Member
 
Join Date: Jan 2005
Location: Waiting for the Long Run
Posts: 35
Default Re: I am a programmer without a compiler, and a sh-tty one at that.

The javascript can produce text output as in:

document.write('hello world');

to make text into HTML just use HTML commands:

document.write('<h1>Hello World<h1>');

Not sure how you run your javascripts, but if you run them in your browser the output can be saved with a view-source save command. Or from a command line you can use the > operator after a command and give it a file to write the output to like: runme > output.txt
Reply With Quote
  #3  
Old 11-08-2005, 09:27 PM
StevieG StevieG is offline
Senior Member
 
Join Date: Jan 2003
Location: Baltimore, MD, USA
Posts: 157
Default Re: I am a programmer without a compiler, and a sh-tty one at that.

Out of curiosity, what did you find difficult about using Perl on Windows?

It would seem that for what you're looking for (quick text processing) Perl would be the thing.
Reply With Quote
  #4  
Old 11-09-2005, 05:22 AM
DavidC DavidC is offline
Senior Member
 
Join Date: Aug 2004
Location: Ontario, Canada
Posts: 292
Default Re: I am a programmer without a compiler, and a sh-tty one at that.

[ QUOTE ]
The javascript can produce text output as in:

document.write('hello world');

to make text into HTML just use HTML commands:

document.write('<h1>Hello World<h1>');

Not sure how you run your javascripts, but if you run them in your browser the output can be saved with a view-source save command. Or from a command line you can use the > operator after a command and give it a file to write the output to like: runme > output.txt

[/ QUOTE ]

document.write(string) seems cool... ooc, how do I specify what text file it's printing to?

Would I have to use weird java-esque file names: c://foldertowriteto/file.txt or would a standard DOS filepath be okay?

I'd prefer to execute the file by double-clicking on it on my desktop or somesuch, so . [img]/images/graemlins/smile.gif[/img]

FWIW, the stuff that I've found on the java document object model is very complex stuff. It's way more powerful than what I need to use it for (though it does appear to do what I need to use it for)...

Any idea where I could find a dummy's guide to this?

--Dave.
Reply With Quote
  #5  
Old 11-09-2005, 05:24 AM
DavidC DavidC is offline
Senior Member
 
Join Date: Aug 2004
Location: Ontario, Canada
Posts: 292
Default Re: I am a programmer without a compiler, and a sh-tty one at that.

[ QUOTE ]
Out of curiosity, what did you find difficult about using Perl on Windows?

It would seem that for what you're looking for (quick text processing) Perl would be the thing.

[/ QUOTE ]

This would be for iterative bet-size calculations. Java should do okay for this purpose. But yes, perl totally pwns for... well... everything actually. [img]/images/graemlins/cool.gif[/img]

I tried setting up perl on windows once and it was a huge hassle. On linux it was very easy (might have even been part of the core that I used).
Reply With Quote
  #6  
Old 11-09-2005, 05:41 AM
OrcaDK OrcaDK is offline
Member
 
Join Date: Nov 2004
Posts: 42
Default Re: I am a programmer without a compiler, and a sh-tty one at that.

Ok first of all we need to set things straight. Javascript is not an actual programming language, that's just scripting. Furthermore Javascript doesn't get compiled, and you'll not get Javascript to write files on your PC; it's simply just not made for taht purpose.

Why not use Java if you've used that before? Using Java you can make console apps if you want, and then you can get user input by making an infinite while loop.

Just download Java 1.5 from Sun's site, then just find your javac location, and you're set with a compiler and everything.
Reply With Quote
  #7  
Old 11-09-2005, 07:54 AM
Guest
 
Posts: n/a
Default Re: I am a programmer without a compiler, and a sh-tty one at that.

You may want to check out ActivePerl, a pretty good (from what I've heard, I don't do Perl) package with a Windows port. You might also want to consider Cygwin, which can be nice if you're familiar with Unix/Linux.
Reply With Quote
  #8  
Old 11-09-2005, 09:57 AM
Guest
 
Posts: n/a
Default Re: I am a programmer without a compiler, and a sh-tty one at that.

[ QUOTE ]
[ QUOTE ]
The javascript can produce text output as in:

document.write('hello world');

to make text into HTML just use HTML commands:

document.write('<h1>Hello World<h1>');

Not sure how you run your javascripts, but if you run them in your browser the output can be saved with a view-source save command. Or from a command line you can use the > operator after a command and give it a file to write the output to like: runme > output.txt

[/ QUOTE ]

document.write(string) seems cool... ooc, how do I specify what text file it's printing to?

Would I have to use weird java-esque file names: <a href="c://foldertowriteto/file.txt" target="_blank">c://foldertowriteto/file.txt</a> or would a standard DOS filepath be okay?

I'd prefer to execute the file by double-clicking on it on my desktop or somesuch, so . [img]/images/graemlins/smile.gif[/img]

FWIW, the stuff that I've found on the java document object model is very complex stuff. It's way more powerful than what I need to use it for (though it does appear to do what I need to use it for)...

Any idea where I could find a dummy's guide to this?

--Dave.

[/ QUOTE ]

The security around web browsers will prevent Javascript from writing directly to the hard drive. This is intended to prevent malicious code from affecting computers.

The best way to deal with a text file save is to write it to an html text field and then copy and paste the text into a new text file.

As for good JS resources, try javascript.internet.com. There are hundreds of scripts here that might point you in the right direction.
Reply With Quote
  #9  
Old 11-09-2005, 11:48 AM
RatFink RatFink is offline
Member
 
Join Date: Jan 2005
Location: Waiting for the Long Run
Posts: 35
Default Re: I am a programmer without a compiler, and a sh-tty one at that.

It can't write to a file. It can output to your browser which you can then save to a file. Or if you are somehow running it from the command line then you can "pipe" the output to a file using your operating system functions to redirect output to a file. But the language itself does not support any Input/Output commands.

I'm with the others, you will run into your boundaries soon with JavaScript. Perl or PHP isn't that huge of a leap to screw around with, but your upside capabilities to progress into more involved applications are significant.
Reply With Quote
  #10  
Old 11-09-2005, 12:19 PM
SheridanCat SheridanCat is offline
Member
 
Join Date: Sep 2002
Location: Chicago
Posts: 86
Default Re: I am a programmer without a compiler, and a sh-tty one at that.

[ QUOTE ]

I tried setting up perl on windows once and it was a huge hassle. On linux it was very easy (might have even been part of the core that I used).

[/ QUOTE ]

I will second Perl from ActiveState. It's prebuilt and comes with a nice installer which will also make the .pl file association for you.

While I could compile my own Perl on Windows, it's so much easier to use the ActiveState build. There is also a pretty comprehensive module repository, so you don't have to use CPAN directly (though you still can, if you wish). For information on that, look at Perl Package Manager aka "ppm" when you get the ActiveState installation done. If you don't have a compiler, that's the best way to install packages that aren't pure perl.

Regards,

T
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 03:54 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.