Help coderanch get a
new server
by contributing to the fundraiser

Allasso Travesser

Ranch Hand
+ Follow
since Feb 06, 2010
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Allasso Travesser

All it takes is the right key words. Thanks, found a lot there. Apertium does just what I want and does it quite painlessly in Unix-like fashion:

$ echo 'Esta es Gloria, mi amiga argentina' | apertium es-en
This is Gloria, my Argentinian friend

Can also provide infile outfile arguments.

On Ubuntu, install with:

apt-get install apertium

Only thing which wasn't obvious to me is that you will also need to install the language pairs for the languages you wish to translate.

eg, for English <-> Spanish,

apt-get install apertium-en-es

list of language pairs:

I haven't checked if there is an Ubuntu package for every one of the pairs listed, but every one I've tried to install using the above example so far has worked.

If you get this error, it means that you don't have the language pair installed:

$ echo 'Esta es Gloria, mi amiga argentina' | apertium es-en
Error: Mode es-en does not exist. Try one of:
<list of installed language pairs, or "*" if none are installed>

See also man-page.

Thank you very much, Paul.
10 years ago
Yikes, I guess SO was not the place to ask.

It doesn't have to be Java per se, but it has to be open source, something I can extend to fit to my own implementation. I would be running it on an Ubuntu server. Java or Perl would be good choices for me because I am more familiar with them. But I am open to any other languages also.
10 years ago

Is there a Java API which will translate English to Spanish without requiring an internet connection?

(sorta cross-posted on Stack Overflow)

Thanks kindly, Allasso
10 years ago

Henry Wong wrote:

Allasso Travesser wrote:
It seems to have enough memory if I am running the command via ssh - but when I run same command, same user (whoami verifies), via PHP script, suddenly it doesn't have enough memory?

Running the PHP interpreter (along with the PHP scripts) takes more memory than running nothing. So, running PHP with JVM needs more memory than just running the JVM.

Regardless, it is your decision. The error is reporting that it doesn't have enough memory. You can choose to examine other possible factors first.


I suppose then it is a problem with the service provider not allocating enough memory?

[ Moderator edit - corrected the quote tags at Ranch time Nov 27, 2013 11:37:45. ]
10 years ago

Henry Wong wrote:Well, how much memory does this hosted machine have? It doesn't matter what you memory setting are -- if you don't actually have enough memory allocated to run the JVM.


It seems to have enough memory if I am running the command via ssh - but when I run same command, same user (whoami verifies), via PHP script, suddenly it doesn't have enough memory?
10 years ago

Campbell Ritchie wrote:That doesn't look correct. Look here; I think that is the Windows® version, but I don't think there are significant differences for other versions. I think it is
java -Xmx512M Foo
to run the Foo class' main method with a maximum space of 512MB.

-Xmx is for max size,
-Xms is for intitial size.
10 years ago
on the command line:

java -mx512m -version

also tried:

java -Xms512m -version

10 years ago

E Armitage wrote:what are your memory settings?

I don't know how to find that - I am using shared hosting
10 years ago

E Armitage wrote:Are you on a 32 bit VM or 64 bit and what are your memory settings?

Does it work if you start the java program with -mx256m or -mx512m?

Thanks for replying,

64 bit, and no it doesn't

java -version
java version "1.6.0_07"
Java(TM) SE Runtime Environment (build 1.6.0_07-b06)
Java HotSpot(TM) 64-Bit Server VM (build 10.0-b23, mixed mode)
10 years ago

I don't know if this is a Java problem, PHP problem, or server problem, but I thought I would start here:

On server, I can ssh and run command 'java -version' and outputs version okay.

Run shell_exec in PHP script and I get this error:

Error occurred during initialization of VM
Could not reserve enough space for object heap

Any ideas?

Server is running Debian squeeze
10 years ago
I have observed that if I attempt to load the applet from a webserver, a different security prompt appears, giving the option to always accept content from the particular site, or if I go into advanced options, can choose to always accept content with the same signature. When I do this, it behaves as desired.

So it appears the problem only reveals itself when the applet is located on the local filesystem. I do not know why such a distinction should be made.

12 years ago
(This question was posted on OTN two days ago, and also a few Mac forums, but I have not received any helpful information to date.)


I have developed a website archive which is privately distributed as a stand alone archive to be run locally on the user's computer (no server). It uses Lucene search engine (Java) to search the archive; the search API/applet is packaged in a jar file and the jarfile/applet is self-signed.

In order to do the search, a self-signed certificate is created for the search applet, since the files in the archive it is searching are on the user's hard drive. After the initial installation of the archive, and upon the first search initiated, the security window pops up asking the user permission for the user to run the applet.

The problem lies here:

With Windows and all versions of Mac OS X prior to 10.7 (Lion), the user can check "always trust" (or similar), and from then on, subsequent searches are carried out without prompting the user to accept the certificate (even after restarting the browser application)

However, on Lion, the user can run the applet only once, and will continue to get a security prompt on every search afterwards, even though "always trust" is checked.

This behaviour occurs whether using Firefox or Safari, so it is apparent this is System related, not a browser issue.

I attempted to manually import the certificate both into the Keychain Access, and also into Authorities under Firefox's certificate manager (see This however was not successful.

Some possibilities I have considered are:

There is no publisher name for a self-signed cert. On previous versions of OS X, the security window states the signer's name, and the option to view the certificate. The user can check "Always trust these certificates". On Lion, the security window only states the publisher's name, which comes up as "UNKNOWN". The analogous "always" checkbox states, "Always trust content from this publisher". So it appears pre-Lion is allowing the option to always trust the particular certificate, whereas Lion is allowing the option to always trust the publisher.

Is there a way to create a publisher name when self-signing?

As far as importing the certificate, could it be that because the archive is local (url = file://) that it won't recognize it? Does anyone know why this doesn't work?

Does anyone know what is happening here, or can suggest a work-around for this (besides paying for a "trusted" CA). Everything worked just hunky-dory -- until Lion...

Thank you kindly,

Allasso Travesser
12 years ago
I updated my last post with some hopefully useful information...
13 years ago
I updated to Java 5, and that gave the Java Preferences app. According to the Apple tech notes, that app only came with the Java 5 update on Tiger.

You can open a terminal and run java -version to find out which java version you are running

That will only tell me which version I am using, it will not change it. There are some very >>limited<< options in Java Prefs to change the version applets use, but you cannot guarantee that apps will use a certain version. There are other options however; Google "change Java version mac" and get a plethora of (sometimes passionate) debate on the matter.

The simplest is to change the default JDK by changing the symlink in /System/Library/Frameworks/JavaVM.framework/Versions to point to the version you want (this is where the passion comes in)


cd /System/Library/Frameworks/JavaVM.framework/Versions
sudo ln -fhsv <directory_of_version_I_want_to_be_default> CurrentJDK

here is a nice little shell script that will do that for you (along with a lot of passionate debate following):

If you want to do it the "Apple" way, here are two good helps, and the reasons why changing the symlink may not be a good idea (which are worth considering):
(this one also gives a good primer on Java versioning on a Mac. Well laid out, IMO)


updated 2011-02-09
13 years ago

Recently I did an reinstall of Tiger (10.4) on my G5 iMac. I completed all the updates, and updated Java to 1.3 and 1.4. I did not want to update to Java 5 because I am developing some apps that have to work on older machines, and I want to be sure I am working in a 1.4 environment.

However, I have looked for the Java Preferences app, which according to all that I have researched, should be in Applications/Utilities, but it is not there.

sudo find / -name "Java Preferences" comes up with nothing also.

Does anyone have a suggestion as to how I can get Java Preferences on my machine?


13 years ago