Is there a way to get CGI/Perl scripts to run on the hard drive of my computer? I'd like to see how they'd look and work when I finally get a ".com" for Fuzz Central.
TIA!
Phillip
Quote from: phillipIs there a way to get CGI/Perl scripts to run on the hard drive of my computer? I'd like to see how they'd look and work when I finally get a ".com" for Fuzz Central.
TIA!
Phillip
You need to be running a webserver that supports CGI/Perl.
Quote from: cdYou need to be running a webserver that supports CGI/Perl.
Do you know of a good one? I don't know if Apache supports Perl or not...I'm not very up to date on web server software.
Phillip
Yup, Apache supports Perl. What OS are you using? If you're on Mac OS X, you can change two characters in a text file and have a full Perl/CGI Apache up and running.
I'm using Win XP. So Apache can actually operate on my hard drive and let me simulate how Perl will look on an actual web server once uploaded?
Phillip
A local Apache server is a nice way to test your Perl/PHP/etc. scripts without uploading them to your webserver, you just save the script in the editor and refresh your browser window, that's pretty cool for debugging!
You can get Apache from here: http://httpd.apache.org/download.cgi
I'm not sure if Perl is included with Apache these days, but if not you can download it from here: http://www.activestate.com/Products/Download/Download.plex?id=ActivePerl
You might have to fiddle around with various config files so that perl files are recognized as CGI scripts, but hopefully the installer will take care of that...
How should I save it on my hard drive? Should it be save like any other program, in the "c:\program files" folder? I'm a bit new to the server stuff ;)
Phillip
Yes, you will install it to someplace like program files, and it will start up as a systems process, running in the background of your computer.
When it's active, it will listen in on port 80 (or whatever you configure, 80 is the standard). Your computer will have some IP address, 127.0.0.1 or localhost should work.
Apache has a directory (httpdocs or something, again this is easily modified) that you can put your pages in, and that becomes the root of your website. For instance, you might set the site_root to c:\mysite\site1, and you put "mypage.html" in that folder.
Then, you open up a browser and type in
http://(your computer's ip address)/mypage.html
or maybe http://localhost/mypage.html
Then apache will recognize there's an incoming connection on port 80 (default), see that you want mypage.html, grab it from your site's root folder on your hard drive, and feed it to your browser. With perl on, it will do its server-side CGI dance and then throw your browser the result.
a couple possible problems if something goes wrong:
-You have a firewall that needs to be modified.
-You're behind a router and are using the router's IP address.
Apache is very easy to set up; I have a copy running on my computer at school (which is in storage at the moment) and it took something like 5 minutes to get up and running.
Which version would I need to download? Keep in mind that I have no previous experience with Apache ;)
-Win32 Source
-Win32 Binary (MSI Installer)
Phillip
:arrow: Win32 Binary Installer version, you don't need the source code.
Apache supports Perl very well, but I wouldn't advise anybody to go the Perl way these days. PHP is just a TON better, easier to use, more supported, has a better user community, and is much much much better integrated with HTML for web applications. By comparison, Perl is a never-ending nightmare while PHP is a great dream.
Even Larry Wall (Perl's author) says that Perl stands for 'Pathologically Eclectic Rubbish Lister'. :D You can do great things with it, but it's old clunky technology now.
There are multiple packages that will install PHP, Apache, MySQL, and phpMyAdmin in one easy pass but you must be running windows 2000 or XP for most of these. I use a package from E_Novative in Germany called WAMP. If you saw the "Where are you" thread, that was running on WAMP. I also run a copy of the forum software here and a bunch of other little code snippits, some with SQL databases on the back end. WAMP just runs flawlessly. 8)
PHP is a fantastic language! :D :D :D
http://docbook.e-novative.de/en/software/wamp.php
BTW: This is one of the most painless installers ever. :D
Take care,
-Peter
Windows XP also comes with IIS. You can simply download the Active State PERL program and it will install itself to IIS. I love apache, but it may be easier for someone new to all of this to just use IIS.
Peter is right about PHP. It roxors. ;) There is also a PHP installer that should install itself automatically to IIS. PHP also seems to perform quite a bit better than PERL, and I find it far easier to program and read/understand other folks' code. The problem with PERL is that it is a combination of about 5 other languages. You can write the same functionality about 100 different ways in PERL. This is great if you only ever right original stuff, but 90% of the time, someone has already written something close to what you want and you might want to tweak it a bit. This is very hard to do for a beginner with PERL.
If you still want to go with Apache, I'm sure there are a few real good tutorials out there that can help you get it up and running. If you are somewhat technically minded then I would recommend Apache. It definitely has a cooler name and is known for stability. :)
Perl is a never-ending nightmare while PHP is a great dream.
OK, I'm tossing my PERL book and getting a PHP book.
Thanks!
Aron
Most of the stuff that I'd be using would be pre-written scripts like a Guestbook (which I already have running on Tripod), a polling script, and some SSI stuff that would allow me to insert a single footer (and maybe header) HTML file at the bottom of every page, so that I could easily customize it by editing one file, and the change would be reflected on all the pages of the site.
I'm wondering...can the footer thing be done with Java in any way?
Phillip
Quote from: phillip
I'm wondering...can the footer thing be done with Java in any way?
Phillip[/color]
It's trivial in PHP if you go that way. You have a file called something like footer.php and then in the middle of your HTML you just add
<?php
include 'footer.php';
?>
Quote from: phillipI'm wondering...can the footer thing be done with Java in any way?
Phillip
No.
Java and Flash are two technologies that operate totally on the client side. The web server in the case of these web extensions is only a file server. Neither Java nor flash are able to interact with the page building process directly on the server end. There is a version of Java that does run on the server, but after my dealings with Java's bugs in the past I'll never touch that language again. Yuck!
There is no denying that Java is the most flexible and fastest environment for writing client-side applications that run inside a rectangular box, but it can't do footers. ;)
As Bent Penguin showed, it's trivial to do in PHP. (
however you can't draw a fractal with PHP using the client's CPU)
For a serious heavy duty web technology based system, the combination of PHP and MySQL for a back-end, and Java or Flash for a front-end can yield some amazing results, but for most things PHP, HTML, and JavaScript get the job done with ease.
for some PHP references.....
http://www.php.net
http://www.phpbuilder.com
http://www.evilwalrus.com
for on-line help with commands...
http://php.net/print (or any other command name you want to look up)
The only file extension I use for web pages now is .php (
no .html, .asp, or .shtml anymore). Even if there is no need for php in the document
at that time... ;)
Take care,
-Peter
Just to avoid some confusion for those of you who's web skills are at the level of my pedal skills ;) Java and Javascript are 2 different things. Java is a programming language somewhat similar to C++ and Javascript is more of a library of commands that a brower understands, they used the name javascript to ride the java buzz, very lame marketing tool.
Sheesh Peter, you are knocking my bread and butter, man. ;) How long ago did you try Java, 1995? LOL It's very stable now. Applets still suck, but Server Side stuff is rock solid. JSP's even almost rival PHP for simplicity.
You may also do an include with JavaScript where you read a txt file off the server and do a document.write on it. SSI and PHP are both much easier/better ways of doing that.
For a bit of history for you guys that don't know the history, JavaScript was a partnership between Sun and Netscape at the height of the Browser wars and the height of Sun's battle with Microsoft. Hence the name JavaScript, as "Java" became a dirty word at Microsoft. To add insult to injury, Netscape sold the W3C (web standards board basically) on JavaScript as a standard, but they called it something else (can't remember right now) and Microsoft signed up not knowing it was "JavaScript". When they found out, they were pissed. LOL So they named their version JScript. HA HA HA. Evil bastards. ;)
Quote from: javacodySheesh Peter, you are knocking my bread and butter, man. ;) How long ago did you try Java, 1995? LOL It's very stable now. Applets still suck, but Server Side stuff is rock solid.
No offence Cody. :D I did a streaming video receiver in 1998 and a full featured point of sale system in 1999-2000 that connected to a backend written in Perl & SQL.
From the author of J-Track (http://science.nasa.gov/Realtime/jtrack/) at NASA in 1999, "
JAVA truly is the great equalizing software. It has reduced all computers to mediocrity and buggyness." From my experiences I couldn't agree more. Sorry. It left a bad enough taste in my mouth that I'm not going there again unless under duress. :D Hehehe.
Take care,
-Peter
Ahh, but that is ancient history in computerland, isn't it. :) We have computers that are 4 to 5 times faster, memory is cheaper and faster than ever, and Sun has improved Java significantly. I didn't learn Java for a long time because I'd heard similar opinions. But PHP is still an awesome language for web based stuff. :) In Java's defense, I've heard plenty of COBOL programmers knock C++ and OOP. LOL Everything has to learn how to crawl before it can run, especially infant programming languages.
I used to work in a web development company (chief art director 8) ), and two of our biggest/oldest clients were (and still are) Banks. All the software ran on the servers IS Java-based. (jacarta tomkat serving)
...so Java is, indeed, a very stable, secure, scalable, flexible and powerfull language. I can't script a line of it, but I completely understood what my engeneer partners wrote.
On the other end, I learnt php in about a week. I've forgotten now, 'cause I quit that job :shock: , but for the scripting needs a 'normal' web-freak like most of us have (besides checking this board 20 times a day), PHP is IMO, the way to go. Furthermore, using Flash+PHP+MySql can make cool cool cool things. So interaction server and client side IS possible.
I know about 20 different programming languages most of which are dead or too limited to be useful in modern time. Picking up when I learned C I moved on to C++ then Java. I've since moved back to C. Not to get into a OOP vs. procedural arrgument but both have good points.
Java was fun. I liked the updated language nominclature, the security concepts, and the *idea* of portabilty. The AWT/Swing was painful. I don't like what Sun is up to with it these days.
.NET is interesting too with some better and worse things when compared to Java. Its been three or four years since its come out. Has it taken over the market like M$ claim it would ? I haven't played with it but from my reading VB.NET just killed the few good things VB had going for it. I can't trust anything coming from M$ even with the Mono project around.
Nah I'll stick with C. I'm happy. :)
As for the web-based thing I'll throw my support behind PHP too.
Andrew
They all have their tradeoffs. Java is quite a bit different from where it was even 2 or 3 years ago; it's still not as easy as it could be to distribute a "click me and run" exe project, and because it tries to do everything you sacrifice a little bit of polish here and there, but it does what it tries to do very well now that it's been fleshed out.
In terms of design, Java is a very interesting language. I took a compiler class, and after our final projects were in (writing a compiler for a horrible language), we went over how it works on the inside - very interesting stuff. Java 1.5 (or Java 5? They're still deciding on the name) should add some pretty nice features. It's clean, not incredibly ambiguous, and the cross-platform aspects work moderately well.
As far as using it as a production language, I'd choose C++ most of the time. It's faster for speed-essential code, even though just-in-time stuff (Java, .NET) has its advangages. I programmed a project for a music class in C++ that used all the ASIO/VST SDKs, and for that sort of thing (and similar industry projects) you really have to use C++, both for use of existing APIs as well as speed.
Java has nicer error messages, though. It also seems a little more planned out in terms of having interfaces. Templates in C++ are both a useful tool and a design mess (i.e. compilation error with "vector<vector<int>>"). In an Operating Systems class we took, you have all quarter to put together a basic OS that does disk I/O, multitasking, interrupts, basic stuff. I can't tell you how many times one of us put a stray character at the top of a file and then gcc gave hundreds of error messages, none of which was in the right file.
Right now I'm a teaching assistant for an intro programming class, and using Java as an intro language is MUCH nicer than using C++ for reasons like these.
---
On the server side of things, I've done mostly PHP, but started out on ASP (very simple stuff) and had some quick Perl and Java/JSP assignments in college, just to get experience with the various technologies (networking class). PHP remains my favorite of these to use... it just seems fun, whereas Perl seems more of a chore :D
My summer job is at an internet company, and they use the .NET framework for all the server-side stuff. There are some things that Java Server Pages and ASP can do that PHP doesn't "quite get", and they seem better 'enterprise' languages, for when you need a web solution and will run it on your hardware, etc. This work is in C# (at first they used Visual Basic), and from what I've done with that language so far, it's pretty nice.
For personal or small-scale stuff (i.e. stuff that your boss isn't telling you has to be done in C# :)) I still prefer PHP. Well-designed, fast, efficient, portable, fun :)
Sorry for the really long off-topic post - I didn't intend to write that much :shock: