FacebookTwitter
Hatrack River Forum   
my profile login | search | faq | forum home

  next oldest topic   next newest topic
» Hatrack River Forum » Active Forums » Books, Films, Food and Culture » Perl help [Now Java help, what a time to be alive] (Page 0)

  This topic comprises 2 pages: 1  2   
Author Topic: Perl help [Now Java help, what a time to be alive]
Hobbes
Member
Member # 433

 - posted      Profile for Hobbes   Email Hobbes         Edit/Delete Post 
OK, let's say I figure out this packaging thing, run my Java program just find, I've created a new file on the server (by the way, the returning file is binary, if that makes a difference, I assume not, but hey) and now I want to return it to the user. So questions ons that:

  • With the amount of data that is even capable of being sent over the web the program shouldn't take more than a couple seconds to run, but hey, with all this talk of preformance you never know, so it would be nice to tell the user we're working on it while the program runs. I realize that's probably not going to happen but... any way to do it?
  • Will the script just sit there and wait while the JAva program runs, and thus I can simply assume once it's run that everything is done now and I can move on to getting the file to the user? If not, how do I tell when it's done?
  • I have this file sitting on the server, I need to get it to the user and then delete it, how?
Hobbes [Smile]
Posts: 10602 | Registered: Oct 1999  |  IP: Logged | Report this post to a Moderator
Bokonon
Member
Member # 480

 - posted      Profile for Bokonon           Edit/Delete Post 
The reason there will be a performance hit is because everytime the java command is invoked, a whole new JVM is started.

Now, this isn't as bad as it used to be; the JVMs are a whole lot smarter about how much they start up before running your code. It used to be that a simple helloWorld app could take MBs of memory to run!

I honestly don't know of a way to send the Java data back to the script, particularly without knowing the use cases involved. In any event it is likely to be kludgy.

-Bok

EDIT: what you can expect in your perl script depends on how you invoke the java command. By default, using something like an exec() call, you cannot assume the program is done, since exec returns once it has spawned the requested command, not once the command completes (which is pretty hard for a program to figure out, and requires a bunch of error handling). If you want it to be synchronous (wait until java command completes before continuing), you need to think about what happens if a processing request takes longer than expected in the Java code, if there is a fatal error in the Java code, or hardest of all, if there is a non-fatal error (an exception) in the Java code, which means the java command completes and returns, but your data is in a bad state.

-Bok

[ July 13, 2004, 05:47 PM: Message edited by: Bokonon ]

Posts: 7021 | Registered: Nov 1999  |  IP: Logged | Report this post to a Moderator
Hobbes
Member
Member # 433

 - posted      Profile for Hobbes   Email Hobbes         Edit/Delete Post 
Yah, I'm not at all worried about preformance, but if something does happen it would be nice to tell the user something's being processed, instead of just making them wait. Like I said, in terms of cgi and running multiple apps, really no one has to worry about preformance, so don't this is just an ideal of warning users.

My two big questions are really if the script waits for the Java program to execute before moving on, and how do I get the file back to the user and then delete it?

Hobbes [Smile]

Posts: 10602 | Registered: Oct 1999  |  IP: Logged | Report this post to a Moderator
Bokonon
Member
Member # 480

 - posted      Profile for Bokonon           Edit/Delete Post 
Hobbes, read my edit above.

-Bok

Posts: 7021 | Registered: Nov 1999  |  IP: Logged | Report this post to a Moderator
Hobbes
Member
Member # 433

 - posted      Profile for Hobbes   Email Hobbes         Edit/Delete Post 
OK, so let's say I can handle all the none-fatal errors by putting a "try" "catch (Exception e)" around my whole main code. And it looks like you don't use the "exec ()" code. So does that mean that if I do it your orginal way, and don't worry about Exceptions (and don't mind returning a bad file to the user, I can deal with that part) then I can just assume that it'll wait for the program to finish? And then there's my file questions.

Hobbes [Smile]

Posts: 10602 | Registered: Oct 1999  |  IP: Logged | Report this post to a Moderator
Bokonon
Member
Member # 480

 - posted      Profile for Bokonon           Edit/Delete Post 
The exec() would be in your perl, not java. The exec() "executes" the command given to it, normally in the form of a string.

Exec is an asynchronous call, meaning it creates a new process on the system that runs the command, and returns 1 if the program can't be run, and a 0 if the program started up without a fata error. Now if a fata or non-fatal error occurs at some point within the Java code itself, there is no clear way to tell the perl code what happened. The try{} code in Java will let you handle it on the Java side, but that won't help on the handoff.

Your best bet is to see if there is an option that can be given to perl's exec() equivalent that waits for the code to complete. Otherwise, you'd have to think of setting up a little ava server app that would get contacted by the perl script to be told that there is processing to be done, and it would spawn a java thread to process the file/metadata, and then give a return message to the perl script client, saying where the binary data is. That would be pretty complex though.

-Bok

Posts: 7021 | Registered: Nov 1999  |  IP: Logged | Report this post to a Moderator
Hobbes
Member
Member # 433

 - posted      Profile for Hobbes   Email Hobbes         Edit/Delete Post 
OK, I'm catching on. [Smile]

so this:

Have your perl execute: "java MyCode.class <arg1> <arg2> <etc...>"

means a Perl syntax like:

exec ("jave MyCode.class <arg1> <arg2> <so forth and so on>"); ?

I'll look into this.

Hobbes [Smile]

[ July 13, 2004, 06:03 PM: Message edited by: Hobbes ]

Posts: 10602 | Registered: Oct 1999  |  IP: Logged | Report this post to a Moderator
Bokonon
Member
Member # 480

 - posted      Profile for Bokonon           Edit/Delete Post 
Right. I actually know only rudimentary perl, so I don't know the exact method of doing the exec()... The exec() is more from my Unix programming days.

I can help you more on the java end.

-Bok

Posts: 7021 | Registered: Nov 1999  |  IP: Logged | Report this post to a Moderator
Hobbes
Member
Member # 433

 - posted      Profile for Hobbes   Email Hobbes         Edit/Delete Post 
I'll be sure to ask then. [Smile]

Fugu? Perl? Help? [Angst]

Hobbes [Smile]

Posts: 10602 | Registered: Oct 1999  |  IP: Logged | Report this post to a Moderator
fugu13
Member
Member # 2859

 - posted      Profile for fugu13   Email fugu13         Edit/Delete Post 
http://www-cgi.cs.cmu.edu/Web/People/rgs/pl-exp-sys.html

http://www.cotse.com/perl/exec.html

Posts: 15770 | Registered: Dec 2001  |  IP: Logged | Report this post to a Moderator
Hobbes
Member
Member # 433

 - posted      Profile for Hobbes   Email Hobbes         Edit/Delete Post 
So system function is the way to go then? It says it waits for copmletion and then continues, that looks good. Thanks. [Smile] I'll be back at some point about the file questions. [Smile]

Hobbes [Smile]

Posts: 10602 | Registered: Oct 1999  |  IP: Logged | Report this post to a Moderator
Hobbes
Member
Member # 433

 - posted      Profile for Hobbes   Email Hobbes         Edit/Delete Post 
All right, well now I'm back to java questions. I'm using Eclipse to write all this code and it has an export function that's supposed to create JARs pretty easily. Well I guess it does, but when I try to run the JAR (simple double click) it just gives an error. So unless someone here really knows what they're doing with Eclipse I guess I need to know how to create a clickable JAR file some other way.

Also, and this is of more immeadite concern, I'm having memory problems. The program is running out of memeory converting a file I really need to get converted, but I know the computer has at least an order of magnitude, and possibly two orders of magnitude more memory than is required. So obviously when I run the program through Eclipse (which doesn't create a JAR, it runs it itself) it's limiting the memory pool. So... yah, help?

Ohh, and if there's some other option in creating an executable other than a .JAR that's fine too.

Hobbes [Smile]

Posts: 10602 | Registered: Oct 1999  |  IP: Logged | Report this post to a Moderator
Farmgirl
Member
Member # 5567

 - posted      Profile for Farmgirl   Email Farmgirl         Edit/Delete Post 
Hobbes,

Well my Java-junkie co-worker is at lunch right now, but I can tell you he is a moderator, and spends ALL his day, at this site answering Java questions for those learning that particular program. I would suggest you try going over to that forum for help.

Farmgirl

Posts: 9538 | Registered: Aug 2003  |  IP: Logged | Report this post to a Moderator
Hobbes
Member
Member # 433

 - posted      Profile for Hobbes   Email Hobbes         Edit/Delete Post 
Thanks Farmgirl! [Cool]

Hobbes [Smile]

Posts: 10602 | Registered: Oct 1999  |  IP: Logged | Report this post to a Moderator
Hobbes
Member
Member # 433

 - posted      Profile for Hobbes   Email Hobbes         Edit/Delete Post 
Actually, I got it, so no worries on creating a jar. But is ther any way to get the jar to have expanded memory when you double click it?

Hobbes [Smile]

Posts: 10602 | Registered: Oct 1999  |  IP: Logged | Report this post to a Moderator
Alcon
Member
Member # 6645

 - posted      Profile for Alcon   Email Alcon         Edit/Delete Post 
Hey Hobbes,
Didn't want to read through the entire thread becuase I've been dubugging kids C++ and html/javascript code all day and am kinda brain dead where code is concerned. But I did want to say: I can feel your pain trying to learn perl as a C/C++ coder. I'm having to do the same thing for the lab I'm working in. And it sucks. Trying to switch from C/C++ pure logic where you have to keep direct control of everything and every little bit of memory to perl where it just does everything for you and you're never quite sure WHATs going on is a real pain. And I officially despise regular expressions.

Just my 2 cents.

Posts: 3295 | Registered: Jun 2004  |  IP: Logged | Report this post to a Moderator
Hobbes
Member
Member # 433

 - posted      Profile for Hobbes   Email Hobbes         Edit/Delete Post 
You made my day. [Big Grin] [Group Hug]

Hobbes [Smile]

Posts: 10602 | Registered: Oct 1999  |  IP: Logged | Report this post to a Moderator
fugu13
Member
Member # 2859

 - posted      Profile for fugu13   Email fugu13         Edit/Delete Post 
http://www.omondo.com/faq/common/index.jsp

http://www.rgagnon.com/javadetails/java-0131.html

You should be able to make it use the arguments by just changing how windows runs the jar file, in the properties, I believe.

Posts: 15770 | Registered: Dec 2001  |  IP: Logged | Report this post to a Moderator
Hobbes
Member
Member # 433

 - posted      Profile for Hobbes   Email Hobbes         Edit/Delete Post 
OK, so I'm trying to create this jar file myself, I've put all my class into one directory, and I'm running the jar command on it. The command I run is this:

...jar cmvf add.txt Converter.jar Converter/*

add.txt contains this line (as a manifest file):
Main-Class: CFileProcessor.class

Converter.jar is the output jar file, and all the files are in Converter (the directory). The command runs, produces the jar file (and the verbose output tells me that all the required class files have been added). I then try to run the .jar file and it says it can not find the main class. Well the class is defaintly there (I've expanded it and checked, I've also tried labeling the path name as being outside and inside the directory Converter and checked spelling). When I expand the jar file the manifest file created does indded list the main class correctly, but that doesn't help the fact that it can't seem to find it. [Dont Know]

Hobbes [Smile]

Posts: 10602 | Registered: Oct 1999  |  IP: Logged | Report this post to a Moderator
Farmgirl
Member
Member # 5567

 - posted      Profile for Farmgirl   Email Farmgirl         Edit/Delete Post 
Remove the ".class" from the end of the class file, and then hit return (requires a new line)

Farmgirl (writing on behalf of my co-worker who knows this stuff)

Posts: 9538 | Registered: Aug 2003  |  IP: Logged | Report this post to a Moderator
Bokonon
Member
Member # 480

 - posted      Profile for Bokonon           Edit/Delete Post 
Yeah, to follow up FG, class files are generally not specified with their extension, while source files are, in Java.

Just a rule of thumb.

-Bok

Posts: 7021 | Registered: Nov 1999  |  IP: Logged | Report this post to a Moderator
Hobbes
Member
Member # 433

 - posted      Profile for Hobbes   Email Hobbes         Edit/Delete Post 
[Big Grin]

[Group Hug]

Thanks FarmWomen and co-worker. *Runs off to check*

[EDIT: and Bok [Smile] ]

Hobbes [Smile]

[ August 05, 2004, 04:09 PM: Message edited by: Hobbes ]

Posts: 10602 | Registered: Oct 1999  |  IP: Logged | Report this post to a Moderator
Farmgirl
Member
Member # 5567

 - posted      Profile for Farmgirl   Email Farmgirl         Edit/Delete Post 
[Angst] I've become plural now????

FG

Posts: 9538 | Registered: Aug 2003  |  IP: Logged | Report this post to a Moderator
Hobbes
Member
Member # 433

 - posted      Profile for Hobbes   Email Hobbes         Edit/Delete Post 
I have this problem, woman always becomes women when I type. I'm having it looked at. Or maybe it would be easier if you just went ahead and devloped multiple personalities...

By the way, it's still not working but I'm going to keep trying.

Hobbes [Smile]

Posts: 10602 | Registered: Oct 1999  |  IP: Logged | Report this post to a Moderator
Farmgirl
Member
Member # 5567

 - posted      Profile for Farmgirl   Email Farmgirl         Edit/Delete Post 
You put in the new line under the Main Class line? What error are you getting?

FG

Posts: 9538 | Registered: Aug 2003  |  IP: Logged | Report this post to a Moderator
Hobbes
Member
Member # 433

 - posted      Profile for Hobbes   Email Hobbes         Edit/Delete Post 
Yes I did, and the same error. I'm going to be more specific here.

In the base directory:
Converter (Folder)
Converter.jar (The jar file that's been created, and runs unsiccsefully)
add.txt (the data that's supposed to be added to the manifest file)

In Converter:
*.class (all the required class files, including the one with static void main (...) in it)
Various folders with other required files (my program has a dependency on another jar file called netcdf.jar, I've expanded it and put all the new files in this directory, with all of the class files)
.regconv (a file that my program requires, just some small ASCII data).

The exact line I'm using on Window's cmd:
D:\Hobbes\Java Source\Project 2>C:j2sdk1.4.2\bin\jar cmvf add.txt Converter.jar

This is followed by two possible options that I've tried:
Converter/
Converter/*
(and Converter alone as well)

add.txt has contained (always followed by a new line) the following lines (always it's only one line, but I've tried many options):
Main-Class: Converted/CFileProcessor
Main-Class: Converted\CFileProcessor
Main-Class: CFileProcessor

The error is:
Could not find the main class. Program will exit.

Hobbes [Smile]

Posts: 10602 | Registered: Oct 1999  |  IP: Logged | Report this post to a Moderator
Gregg
New Member
Member # 6752

 - posted      Profile for Gregg   Email Gregg         Edit/Delete Post 
Alrighty hobbes

If you place class files in folders and JAR those folders into the JAR file, your class file has to specify a package. Here is an example:

code:
package Converter;
public class hello
{
public static void main(String[] args)
{
System.out.println("Hello Hobbes");
}
}

Now, put that file in a folder call Converter and compile it.

Next, create a Manifest file like so:
code:
Main-Class: Converter/hello

And then do the JAR:

code:
C:\>"c:\Program Files\java\jdk1.5.0\bin\jar" -cmvf manifest.txt hello.jar Converter/*.class

HTH

P.S. I work with FarmGirl. [Smile]

Gregg Bolinger
Javaranch Sheriff | Weblog

[ August 05, 2004, 05:57 PM: Message edited by: Gregg ]

Posts: 2 | Registered: Aug 2004  |  IP: Logged | Report this post to a Moderator
kaioshin00
Member
Member # 3740

 - posted      Profile for kaioshin00   Email kaioshin00         Edit/Delete Post 
System.out.println("Java rules!");
Posts: 2756 | Registered: Jul 2002  |  IP: Logged | Report this post to a Moderator
Hobbes
Member
Member # 433

 - posted      Profile for Hobbes   Email Hobbes         Edit/Delete Post 
cout << "Java's lack of low-level control over the computer, and it's run-time compiling make it ideal for it's use as a multi-platform language, but when it comes down to power in a programming language nothing delivers that with felxibility and scalibilty like C++" << endl;

Hobbes [Smile]

Posts: 10602 | Registered: Oct 1999  |  IP: Logged | Report this post to a Moderator
Hobbes
Member
Member # 433

 - posted      Profile for Hobbes   Email Hobbes         Edit/Delete Post 
Big thanks to Gregg, I'll try that as soon as I get into work tomorrow. [Big Grin] [Group Hug]

Hobbes [Smile]

Posts: 10602 | Registered: Oct 1999  |  IP: Logged | Report this post to a Moderator
fugu13
Member
Member # 2859

 - posted      Profile for fugu13   Email fugu13         Edit/Delete Post 
Which is why Microsoft is moving to a very java-similar language, C#.

Plain and simple, if you want to develop high level software quickly, efficiently, and securely (in the general sense, there are always exceptions), you want a language less like C++ and more like Java (or even past Java for many purposes).

[ August 06, 2004, 12:27 AM: Message edited by: fugu13 ]

Posts: 15770 | Registered: Dec 2001  |  IP: Logged | Report this post to a Moderator
Hobbes
Member
Member # 433

 - posted      Profile for Hobbes   Email Hobbes         Edit/Delete Post 
Well I agree in general, but I don't think they have to take that route, through the use of standered libraries (like the STL) C++ can be turned into a high-level language just as easily as Java (in my opinion). I agree that if you're basically after quick programming and don't much care about speed a language like Java or C# will give you a much quicker return on your buck, but I'm of the opinion that taking the time to really develop standered libraries for C++ would allow people to use it as a high level language without giving up the functionality that accompanies a low-level language.

Now if you're after something as high level as say Perl, or PHP then C++ will be too far off the mark, but then again, so will Java.

Speaking of C#, has Microsoft finished writting their .NET platform for anything besides Windows? The last time I looked into this was years ago. [Embarrassed]

Hobbes [Smile]

Posts: 10602 | Registered: Oct 1999  |  IP: Logged | Report this post to a Moderator
fugu13
Member
Member # 2859

 - posted      Profile for fugu13   Email fugu13         Edit/Delete Post 
And unless you're using a JIT compiler (highly unlikely), there's no run time compiling in java . . . It uses java "machine" language bytecode instructions on the java virtual machine, just like you downloaded them off the internet or compiled them five minutes ago, no further compilation involved.
Posts: 15770 | Registered: Dec 2001  |  IP: Logged | Report this post to a Moderator
Hobbes
Member
Member # 433

 - posted      Profile for Hobbes   Email Hobbes         Edit/Delete Post 
You're right, compile is the wrong word, but I just strongly dislike the idea of having to run something on code that's already been compilied. [Dont Know]

Have you heard about the .NET?

Hobbes [Smile]

Posts: 10602 | Registered: Oct 1999  |  IP: Logged | Report this post to a Moderator
fugu13
Member
Member # 2859

 - posted      Profile for fugu13   Email fugu13         Edit/Delete Post 
Sorry Hobbes, but this one's one CS people have been looking at for a long time. Excepting speed, higher level languages have significant advantages over C++. Just the ability to dispense with the bookkeeping is a godsend, not to mention higher level abstractions. Average number of lines in a java project is something like half the lines in a C++ project doing the same thing, and that can be cut in half again or better by a higher level language. LOC improvements like that with better runtime security (from buffer overruns and such), better readability, and higher "paradigmicity" are very hard to argue with except when some overriding concern crops up.

Not only that, with many higher level languages you can write speed sensitive parts in C++ and still have most of the program in python or whatever.

And C# can run on pretty much any platform out there nowadays, even a lot of the winforms stuff. The server side stuff's been pretty much completely ported, in part by MS implementation (Rotor is their FreeBSD/OS X implementation, though its a little behind the times), and in part by open source projects (Mono and dotGNU, mainly the former).

Posts: 15770 | Registered: Dec 2001  |  IP: Logged | Report this post to a Moderator
fugu13
Member
Member # 2859

 - posted      Profile for fugu13   Email fugu13         Edit/Delete Post 
Hobbes, C++ code doesn't run on the metal exactly, either [Razz] . It has to go through the operating system for a lot of things (requesting memory, for instance [Smile] ).
Posts: 15770 | Registered: Dec 2001  |  IP: Logged | Report this post to a Moderator
Hobbes
Member
Member # 433

 - posted      Profile for Hobbes   Email Hobbes         Edit/Delete Post 
quote:
Sorry Hobbes, but this one's one CS people have been looking at for a long time. Excepting speed...
What are you sorry about? I prefer C++ for many reasons, one of which is that my mind works exactly like the way C++ is written (object oriented, but with no abstraction above hiding registry moves and the like). It's exactly as tedious as I like and incredibly powerful, and it is faster if you know what you're doing (which I do like to flatter myself that I do).

And I still think that if some real time and money was invested in good, high-level libraries C++ could really compete on that platform with languages like Java and C#, the reason it isn't competing is because no one wants to put in time and money. Which is acceptable, I wouldn't really want to use those libraries myself, and I wouldn't be surprised in the least if it wasn't really monetarily beneficial, I'm just saying if a company with some money really wanted to they could build C++ to compete on just about any level.

Hobbes [Smile]

Posts: 10602 | Registered: Oct 1999  |  IP: Logged | Report this post to a Moderator
Hobbes
Member
Member # 433

 - posted      Profile for Hobbes   Email Hobbes         Edit/Delete Post 
Fugu, going through the system for commands like file i/o and memory allocation is different then sotring all of it's commands in a byte format that can't directly run on the processor. [Razz] Java does all tha and has to be whatevered at run time.

Hobbes [Smile]

Posts: 10602 | Registered: Oct 1999  |  IP: Logged | Report this post to a Moderator
fugu13
Member
Member # 2859

 - posted      Profile for fugu13   Email fugu13         Edit/Delete Post 
Hobbes, more time has been invested in C++ than any other language, probably, and definitely in the past decade. I do assume you're using the Boost libraries, btw?

Yet even with all the time that's been invested in it, C++ still doesn't have nearly the development efficiency that higher level languages do.

And its not just calling some operating system functions, C++ has a (minimal) runtime environment. It does let the metal handle many of the calls, but its still very much there. Is Java significantly further from the metal? Sure, but C++ isn't right there on the metal.

Posts: 15770 | Registered: Dec 2001  |  IP: Logged | Report this post to a Moderator
fugu13
Member
Member # 2859

 - posted      Profile for fugu13   Email fugu13         Edit/Delete Post 
Actually, given the C++ was MS's big thing for at least a six or seven years but wasnt' able with their billions to mold it into what they needed for many purposes, I'm rather certain you're not quite correct with your assertion.
Posts: 15770 | Registered: Dec 2001  |  IP: Logged | Report this post to a Moderator
Hobbes
Member
Member # 433

 - posted      Profile for Hobbes   Email Hobbes         Edit/Delete Post 
[EDIT: Which assertion?]

I'm agreeing with on that Fugu, and I'm agreeing with you on the fact that turning it into a lnaguage that could high-level functionality is really just my own personal pipe-dream, I'm just saying it could be done. You're right though, I was reaching to far on that one.

Though I disagree that C++ is the most time-invested language, perhaps in the last century, but I'd be willing to bet dollars to donoughts (if I was willing to bet anything, which of course I'm not) that Fortran has a significantly larger amount of time invested in it.

What can I say, C++ will always be my favorite language, it's powerful, and for me it's not cluncky because I don't have to translate my thoughts to program in it, it's one of the reasons I so love programming. English is a language in which I speak like forienger, C++ is my native language of the mind. [Smile]

Hobbes [Smile]

[ August 06, 2004, 01:09 AM: Message edited by: Hobbes ]

Posts: 10602 | Registered: Oct 1999  |  IP: Logged | Report this post to a Moderator
fugu13
Member
Member # 2859

 - posted      Profile for fugu13   Email fugu13         Edit/Delete Post 
Fortran had more time spent programming in it, likely, but development on the language itself not so much as C++, I think.

Lisp is probably a better competitor, at least if you include the entire Lisp family, but possibly even just Common Lisp.

Posts: 15770 | Registered: Dec 2001  |  IP: Logged | Report this post to a Moderator
Hobbes
Member
Member # 433

 - posted      Profile for Hobbes   Email Hobbes         Edit/Delete Post 
I'm giving you the argument, I have no doubt that it's far more effective to program in Java for most companies (or C# or Lisp or some other at least kind of high-level language) especially with rapidly increasing processor speed (and most people using their 1.5GHZ to write letters and play solitare), the effeciency just isn't need like it's used to.

The one thing they did with Fortran was really write the compilies to the edge in efficiency, heck, until around 92 I believe it was, all C and C++ programs were first converted to Fortran and then compiled in Fortran because the compilers created faster code. High-level languages are going to give you a lot mroe devloping time though, since you have to write all those abstraction layers.

I think I'll go back to talking longingly of C++...or perhaps finishing the program I'm currently working on in C++. [Big Grin]

Hobbes [Smile]

Posts: 10602 | Registered: Oct 1999  |  IP: Logged | Report this post to a Moderator
fugu13
Member
Member # 2859

 - posted      Profile for fugu13   Email fugu13         Edit/Delete Post 
Nope [Smile] . C was C, and was compiled directly, first in a compiler written in assembly and then in a compiler written in C. You can read the abbreviated story in Kernighan and Ritchie, the standard book of C.

C++ was originally (when developed by our good friend Stroustrup) converted to C and then compiled (oddly enough, our other good friend SCO owns the rights to the descendants of this original compiler [Smile] ), but quickly became compiled directly.

I'm not sure what you mean about having to write all those abstraction layers . . . higher level languages are higher level because they make it easy to develop abstractions, and they cut down on development time, usually by large factors.

You might be interested in one of the few people out there I think is completely fluent in C++ : http://www.moderncppdesign.com/

Here's a few of his columns on the CUJ website:

[ April 13, 2019, 02:56 PM: Message edited by: Hatrack River ]

Posts: 15770 | Registered: Dec 2001  |  IP: Logged | Report this post to a Moderator
Hobbes
Member
Member # 433

 - posted      Profile for Hobbes   Email Hobbes         Edit/Delete Post 
I have this book with a title something akin to "Efficent C++ programming", and if I ever feel like everything that can be done has been done in terms of writting the most efficent code to do basic, everyday problems, I'll just read a few lines and remind myself that's just plain not true. [Smile]

quote:
I'm not sure what you mean about having to write all those abstraction layers . . . higher level languages are higher level because they make it easy to develop abstractions, and they cut down on development time, usually by large factors.
I mean that a high level language is one in which so much more code has to be written for the language itself, C++ has the abstraction that you don't have to worry about registry values and what not, but you have to deal with memory pretty directly (like arrays of charecters instead of String objects), every layer up you go in the language is a layer more you have to write into it. I was talking about the time making the language itself, not programming in it. [Smile]

Hobbes [Smile]

Posts: 10602 | Registered: Oct 1999  |  IP: Logged | Report this post to a Moderator
Hobbes
Member
Member # 433

 - posted      Profile for Hobbes   Email Hobbes         Edit/Delete Post 
It worked, thanks a lot everyone. [Big Grin]

Hobbes [Smile]

Posts: 10602 | Registered: Oct 1999  |  IP: Logged | Report this post to a Moderator
fugu13
Member
Member # 2859

 - posted      Profile for fugu13   Email fugu13         Edit/Delete Post 
Higher level language development isn't really all that hard, actually. Take a look at all the hobbyist-grown languages around, and you'll see that its pretty easy to develop a new language, particularly (say) a .NET CLR language.

And most of the development you're talking about in C++ is just writing those abstraction layers, anyways, because abstraction layers are what make programming more efficient, plain and simple [Smile] .

Posts: 15770 | Registered: Dec 2001  |  IP: Logged | Report this post to a Moderator
Hobbes
Member
Member # 433

 - posted      Profile for Hobbes   Email Hobbes         Edit/Delete Post 
If I was to explain how to run a .jar file on a Windows machine, and do so with a lot of of memory (like -Xmx512m type of memory) how would I do this? I would like to avoid using cmd if I can, though I wouldn't mind all that much making the user write a little batch file if I give them the skeleton (a one line batch file of course... well I guess it has to be two lines but not the point), but obviously I'd rather not do that. What's this you were talking about with properties for memory?

Hobbes [Smile]

Posts: 10602 | Registered: Oct 1999  |  IP: Logged | Report this post to a Moderator
fugu13
Member
Member # 2859

 - posted      Profile for fugu13   Email fugu13         Edit/Delete Post 
I was misremembering (or can't find what I was thinking of), the command is system wide (which we don't want)

http://forum.java.sun.com/thread.jsp?thread=517241&forum=22&message=2472461

So use that command in a batch file (with the memory expanding arg and the jar name filled in), and put the two in the same folder. Then name the batch file "Double Click to Launch AppName.bat" or something else really obvious.

Posts: 15770 | Registered: Dec 2001  |  IP: Logged | Report this post to a Moderator
Hobbes
Member
Member # 433

 - posted      Profile for Hobbes   Email Hobbes         Edit/Delete Post 
Here's what I wrote:

quote:

How to Run the Converter

The first step in running the file converter is unpacking it. In Linux or Unix you should be able to use the “unzip” command to do this. In Windows, right click on the file (Converter.zip) and then select “Extract All”.

No matter the operating system, you must have Java installed on your computer. You can download Java at Sun’s website. Once you’ve downloaded Java you have all the tools you need to run the file converter.

If you’re on Linux or Unix, then you can run the file converter with one line. Once you’re in the appropriate directory (within the Converter folder) the following line should run the program:

java -Xmx512m -jar Converter.jar

If you’re running Windows it is both easier and much more difficult. Double clicking on the file “Converter.jar” will run the program, but will do so with a very limited amount of memory. The file converter is very memory intensive, so it’s quite likely that it will hang if it runs this way. In the Windows version this program also comes with a MS-DOS batch file named “RunConverter.bat”. Double clicking this will run the program with the appropriate memory, if you installed Java in the default location, and if it’s the same release as was current when the converter was created. Failing that, try to find where your java files are (the normal is in C:\Program Files\Java\j2re1.4.2_04\bin\java, the "j2rel.1.4.2_04" will change when a new release of Java is made). Then open the batch file with a text editor like notepad or WordPad. The file should look like this:

“C:\Program Files\Java\j2re1.4.2_04\bin\java” -Xmx512m -jar Converter.jar

Change it so that it looks like this:

“Your_Java_Folder\bin\java” -Xmx512m -jar Converter.jar

Be sure to include the quotation marks and a new line at the end of the file. Save and exit, and then you should be able to run the file converter simply by double clicking the batch file.

How does that strike you?

Hobbes [Smile]

[ August 06, 2004, 10:54 AM: Message edited by: Hobbes ]

Posts: 10602 | Registered: Oct 1999  |  IP: Logged | Report this post to a Moderator
  This topic comprises 2 pages: 1  2   

   Close Topic   Feature Topic   Move Topic   Delete Topic next oldest topic   next newest topic
 - Printer-friendly view of this topic
Hop To:


Contact Us | Hatrack River Home Page

Copyright © 2008 Hatrack River Enterprises Inc. All rights reserved.
Reproduction in whole or in part without permission is prohibited.


Powered by Infopop Corporation
UBB.classic™ 6.7.2