On Mon, 2002-08-05 at 21:00, Paul M Foster wrote:
> On Mon, Aug 05, 2002 at 12:24:05PM -0400, Derek Glidden wrote:
>
> <snip>
>
> > The good thing about Java though, particularly non-GUI Java apps,
>
> Umm, excuse some dumb questions. I've never coded in Java. I only know
> that it resembles C++ but does its own garbage collection. And that
> browsers can run Java apps if there's a Java runtime and the browser has
> Java enabled.
Browsers can run Java "Applets" in specific. There's a difference
between an "Applet" and an "Application" although only minor and has
more to do with what the runtime allows the app to do as opposed to
anything directly related to writing the program. (In fact, you can
write a GUI app that can also run as an applet from the same "binary"
file.)
> So based on your post, is it true that you can run a Java app outside a
> browser? Second question is: how is it that you can have a "non-GUI"
> java app? Like one that could run in a curses environment? Or when you
> say "non-GUI", you really mean "has to run in X, but doesn't need a
> mouse to work"?
Of course you can run Java apps outside the browser!
Java is a full-blown programming language, just like C or C++. It just
got its initial hype as a "browser plugin" language so that's what
everyone thinks of.
Applets are basically GUI Java applications that aren't allowed to do
certain things (read/write to filesystem, make network socket
connections) based on the security profile of the applet environment in
which they're running. "Full" GUI applications use AWT (sort of like
the "Xlib" of the Java world) or SWING (sort of like the "Motif" of the
Java world) to do GUI interfaces which you can run from the command-line
or convert into an applet by adding a couple of methods that applets
need.
Non-gui apps run just like any other console app:
public class Hello {
public static void main(String args[]) {
System.out.println("Hello, world!");
}
}
compile with "javac" and run from the command line with "java" and it'll
print out "Hello, world" on the console just like any other "Hello
world". Most people use "non-GUI" Java to write server-based apps in
place of "old-fashioned" CGI apps because:
* It's generally a lot "safer" than using C or C++ since Java manages
its own memory allocation, which means things like buffer overflows are
virtually non-existent, plus it has a built-in String class (unlike C
and C++ kind of does if you don't use STL) that makes dealing with text
very easy, and the exception-handling is extremely robust so even if
there is some sort of application error, you can almost always recover
from it without crashing the program.
* There's a huge amount of code on the net, as with Perl, for doing just
about anything you might want to do, but IMHO it's easier to write
maintainable code in Java than in Perl - or at least doesn't take the
same kind of commitment to NOT write UN-maintainable code like Perl
requires for any project over a couple hundred lines of code.
* Writing JSP/Servlet for web applications is almost always going to be
faster and more easily maintainable than PHP, although not necessarily
as quick to get out the door, but once you have your support classes
written, it's almost always faster to add new features. (I always tell
people when we write a Java-based web app, that for the first 75% of the
time, you won't see any progress at all because we're writing all the
foundation code, then for the last 25% you'll barely be able to keep up
with us.)
For quick one-off things, I still like Perl or PHP for web-apps, but if
it's going to be project of anything more than minor size, I'll push for
Java every time.
If you're used to C or C++, you should at least play around with Java -
it has some really good things going for it. (It also has some really
awful quirks that I can't stand - don't even get me started on 'String'
- but so does every other language...)
-- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- #!/usr/bin/perl -w $_='while(read+STDIN,$_,2048){$a=29;$b=73;$c=142;$t=255;@t=map {$_%16or$t^=$c^=($m=(11,10,116,100,11,122,20,100)[$_/16%8])&110; $t^=(72,@z=(64,72,$a^=12*($_%16-2?0:$m&17)),$b^=$_%64?12:0,@z) [$_%8]}(16..271);if((@a=unx"C*",$_)[20]&48){$h=5;$_=unxb24,join "",@b=map{xB8,unxb8,chr($_^$a[--$h+84])}@ARGV;s/...$/1$&/;$d= unxV,xb25,$_;$e=256|(ord$b[4])<<9|ord$b[3];$d=$d>>8^($f=$t&($d >>12^$d>>4^$d^$d/8))<<17,$e=$e>>8^($t&($g=($q=$e>>14&7^$e)^$q* 8^$q<<6))<<9,$_=$t[$_]^(($h>>=8)+=$f+(~$g&$t))for@a[128..$#a]} print+x"C*",@a}';s/x/pack+/g;evalusage: qrpff 153 2 8 105 225 < /mnt/dvd/VOB_FILENAME \ | extract_mpeg2 | mpeg2dec -
http://www.cs.cmu.edu/~dst/DeCSS/Gallery/ http://www.eff.org/ http://www.anti-dmca.org/
This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 15:58:24 EDT