Java

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Message
Author
User avatar
Monsie
Posts: 631
Joined: Thu 01 Dec 2011, 07:37
Location: Kamloops BC Canada

Java

#31 Post by Monsie »

Hi jpeps,

Well, I did some more testing... I downloaded MyLibrary.jar and started playing with that, when it dawned on me that I had been tweaking the wrong script file for Java applications...:oops: I had been editing the application_x-jar script, when I should have been looking at the application_x-java-archive script. So, once I got that sorted out, I tested the tweak on your app and achieved a 41.5% reduction in memory usage with the minimum adjustment @ -Xmx2m :D

Then I tested my old, but favorite Java application. Unfortunately the tweak did not work... even at minimum setting. It was kind of weird in that the program would open, but all I got was the window, frame, a couple of buttons, but the rest of the interface was missing. I checked the MANIFEST file, and it turns out that it was created with Java-1.5. and not Java 1.4 like I thought originally. So then... I tested another Java app which did turn out to be version 1.4 and it worked with the tweak... --go figure.

At the very least, I now know that the tweak does not depend on a particular version of Java.... more likely it has to do with the quality of the code.

Monsie
My [u]username[/u] is pronounced: "mun-see". Derived from my surname, it was my nickname throughout high school.

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

Re: Java

#32 Post by jpeps »

Monsie wrote: At the very least, I now know that the tweak does not depend on a particular version of Java.... more likely it has to do with the quality of the code.

Monsie
I'm guessing that the app required more cache than you were allowing it.

User avatar
Monsie
Posts: 631
Joined: Thu 01 Dec 2011, 07:37
Location: Kamloops BC Canada

Re: Java

#33 Post by Monsie »

jpeps wrote:
Monsie wrote: At the very least, I now know that the tweak does not depend on a particular version of Java.... more likely it has to do with the quality of the code.

Monsie
I'm guessing that the app required more cache than you were allowing it.
Yes, well I did try several adjustments in 1 mb increments, but each time I got the same result.

For the record, the Java program I am talking about is Character Map which I find very useful in Puppy at times. You can download it at: http://www.psc-consulting.ca/fenske/

Monsie
My [u]username[/u] is pronounced: "mun-see". Derived from my surname, it was my nickname throughout high school.

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

Re: Java

#34 Post by jpeps »

Monsie wrote:[

Yes, well I did try several adjustments in 1 mb increments, but each time I got the same result.

For the record, the Java program I am talking about is Character Map which I find very useful in Puppy at times. You can download it at: http://www.psc-consulting.ca/fenske/

Monsie
CharMap ran with a 15M tweak at 140M, and at 379M without. I'm not sure why it's not working on your Wary distro. Did you run it from the terminal to see if anything else is going on?

There's another app, Acento, that does something similar:
http://java-apps.org/

User avatar
Monsie
Posts: 631
Joined: Thu 01 Dec 2011, 07:37
Location: Kamloops BC Canada

Re: Java

#35 Post by Monsie »

jpeps wrote:
Monsie wrote:[

Yes, well I did try several adjustments in 1 mb increments, but each time I got the same result.

For the record, the Java program I am talking about is Character Map which I find very useful in Puppy at times. You can download it at: http://www.psc-consulting.ca/fenske/

Monsie
CharMap ran with a 15M tweak at 140M, and at 379M without. I'm not sure why it's not working on your Wary distro. Did you run it from the terminal to see if anything else is going on?

There's another app, Acento, that does something similar:
http://java-apps.org/
It worked! First, I tried the 15M tweak, and found that it opened properly... but that it was still using the same amount of memory as if no adjustment had been made. Then I bumped it to 16M and saw a drop of 81 mb 8) Wow... thanks for all of your help. :)

PS It would be interesting and useful to know the parameters of the tweak... so as to have an idea as to which values to try first. This way, one might not give up too quickly, as I did after having tried 2m - 8m values initially.

Monsie
My [u]username[/u] is pronounced: "mun-see". Derived from my surname, it was my nickname throughout high school.

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

Re: Java

#36 Post by jpeps »

Monsie wrote:
PS It would be interesting and useful to know the parameters of the tweak... so as to have an idea as to which values to try first. This way, one might not give up too quickly, as I did after having tried 2m - 8m values initially.

Monsie
I set mine by default in ROX at 20m. I'd rather have a little extra cache in case it's needed...less isn't always better unless you're running a very old, RAM starved computer.

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#37 Post by 01micko »

Attached is a great little java vnc viewer by hexabit. I had trouble accessing his site so I'll post it here.

BTW, modded the grabber script to get jre-1.7 update 15 and made an sfs beautifully, uploaded to pet_packages-slacko14 at your favourite puppy mirror.
Attachments
jvnc-1.3.9.pet
be sure to have your vnc server configured!
(160.44 KiB) Downloaded 487 times
capture17447.jpg
(37.49 KiB) Downloaded 763 times
Puppy Linux Blog - contact me for access

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

#38 Post by jpeps »

01micko wrote:Attached is a great little java vnc viewer by hexabit. I had trouble accessing his site so I'll post it here.
Very nice! I use VNC, so could test it out. One addition..change line 18 of the viewer to:

Code: Select all

java -Xmx20m -jar VncViewer.jar HOST $host PORT $port
Saves me 235M.

edit: scratch that idea; I needed the extra memory for most connections

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

#39 Post by jpeps »

Here's a small java app I wrote for zeroing out files. Run from the console as:

Code: Select all

     zero [file]
or put /usr/local/bin/zero on the desktop and simply drag the file onto it.

note: zeroing out files means overwriting all the characters with zeros so they can't be retrieved.

updated: load from current directory without path
Attachments
zero-1.1.pet
(2.16 KiB) Downloaded 458 times

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

#40 Post by jpeps »

Here's an interesting little Webpage Saver. Enter URL as an argument.

edit: Made it even smaller.
Attachments
WebSave.jar.tar.gz
(10.22 KiB) Downloaded 431 times

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

SQL Database Demo

#41 Post by jpeps »

MyLibrary-sql is an sql database demo that runs from the command line with a "books" puppy front end. I created a MyLibrary database with add, delete, print, and query functions, but once set up on Eclipse it takes only minutes to create whatever database and options that are desired, and runs on everything.

Usage should be clear in the png, and can be accessed by typing "books."
The query takes an author's name and returns the books/publishers.
When deleting a book with an apostrophe, it's necessary to escape with an additional apostrophe:

books -d "Eden''s Ladder"

updated: Author query works with first or last name only. (copy or rename your database before updating).



http://www.jpeters.net/apps/MyLibrary-sql-1.5.pet
Attachments
MyLibrary-sql.png
(17.7 KiB) Downloaded 620 times
Last edited by jpeps on Tue 26 Mar 2013, 06:09, edited 3 times in total.

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

#42 Post by jpeps »

Updated JRE build script to version 1.7.0_17

http://murga-linux.com/puppy/viewtopic. ... 060#682060


Updated sql database.

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

#43 Post by jpeps »

Here's a small color finder utility I built using slider bars to change values.
Attachments
ColorFinderJar.tar.gz
(3.43 KiB) Downloaded 403 times
ColorFinder.png
(5.21 KiB) Downloaded 486 times

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#44 Post by 01micko »

jpeps wrote:Updated JRE build script to version 1.7.0_17

http://murga-linux.com/puppy/viewtopic. ... 060#682060


Updated sql database.
Just one thing... when building I get..

Code: Select all

Number of uids 2
	root (0)
	unknown (500)
Number of gids 2
	root (0)
	users (500)
..note gids, uids

Code: Select all

echo "fixing ownership"
chown -R root:root ${jre}
Didn't try yet but should be ok. (yep, works, strange things can happen when strange users/groups are on the system)

Really, Oracle should know better. Don't reckon that sort of issue would have happened when Sun was around. :roll:
Puppy Linux Blog - contact me for access

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

#45 Post by jpeps »

01micko wrote:
Just one thing... when building I get..

Code: Select all

Number of uids 2
	root (0)
	unknown (500)
Number of gids 2
	root (0)
	users (500)
..note gids, uids
I think that's just part of the filesytem report from mksquash (eg, your id #'s). The script has to be run with root permissions.

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

#46 Post by jpeps »

MyLibrary3 saves all data to a single (and small) xml file. This seems to be an economical way of creating a database ...with the advantage of being able to easily read (and edit) the file itself. I also included both author and title search buttons with "next" capability.


http://murga-linux.com/puppy/viewtopic. ... 898#673898

updated: smaller size

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

#47 Post by jpeps »

Another version of MyLibrary using serialized data, which takes it down to only 24K. Interestingly, you can still edit the MyLibrary.ser data file using a text editor (not geany). This puts a database app in the acceptable range for puppy.
Attachments
MyLibrary4.tar.gz
MyLibrary4.jar
(22.14 KiB) Downloaded 354 times

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

#48 Post by jpeps »

Updated MyLibrary4 to include File menu with a "Make Report" option. This produces a MyLibrary.txt file with all the books info; added mnemonics.
Attachments
MyLibrary4.png
(12.55 KiB) Downloaded 584 times

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#49 Post by 01micko »

Hi jpeps

I hope you don't mind but I soft coded your get jre script, with basic instructions in the comments. Added some basic error checks.

Code: Select all

#!/bin/sh

# http://javadl.sun.com/webapps/download/AutoDL?BundleId=78695 (example: for 1.7-u25)
# go to http://java.com/en/download/linux_manual.jsp?locale=en to find url similar to above
# get java tar.gz link to get the end number, 5 digits

# run with (example: name the script "get_jre")
#----------------------------
# get_jre jre1.7.0_25 78695
#----------------------------

jre="$1" #name it with "jre1_________" fill in the blank # eg: jre1.7.0_17
NUMBER="$2" #NEEDED it's the number on the end of the url
temp="${jre}_001"

mkdir -p "/tmp/${temp}/usr/local/bin"
mkdir -p "/usr/local/${jre}/bin"

##  GET PACKAGE
wget -O "/tmp/${jre}.tar.gz" http://javadl.sun.com/webapps/download/AutoDL?BundleId=${NUMBER}
[ $? != 0 ] && echo error && exit

## UNPACK AND MOVE TO NEW FOLDER
cd /tmp
tar -xvzf "/tmp/${jre}.tar.gz"
[ $? != 0 ] && echo error && exit
  mv  "${jre}"    "${temp}/usr/local"

## COPY JAVA FILES FOR LINKING

cd "${temp}/usr/local"
cp   "${jre}/bin/java"  "/usr/local/${jre}/bin"     

cd "/tmp/${temp}/usr/local/bin"
ln -sf "/usr/local/${jre}/bin/java" .


## CHANGE NAME FOR SFS BUILD
cd /tmp
mv "${temp}" "${jre}"

dir2sfs "$jre"

## Change name and CLEAN UP
 
name="$(ls | grep jre*sfs | grep -v "txt")"

mv "$name"  ${jre}.sfs

rm -r "/usr/local/${jre}"
rm -r "/tmp/${jre}"
rm  "/tmp/${jre}.tar.gz"
rm /tmp/jre*txt

echo  "${jre}.sfs is in /tmp"

Working 8)

Code: Select all

java -jar addstuff.jar
Enter your name 
Name : Mick
Enter your age 
Age : 150
Seriously Mick? You're either lying to me or you're a freakin' vampire!
..just some of my uni homework from the start of the course.
Attachments
addstuff.zip
java archive, the homework i did, simple stuff
(1.7 KiB) Downloaded 293 times
Puppy Linux Blog - contact me for access

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

#50 Post by jpeps »

01micko wrote:.just some of my uni homework from the start of the course.
Great to see the serious devs studying java. Keep up the good work!

Post Reply