Java

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Message
Author
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!

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

#51 Post by 01micko »

A very basic CLI game

http://01micko.com/packages/punchkickblock.zip ~28k

source and java archive included
Puppy Linux Blog - contact me for access

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

#52 Post by jpeps »

01micko wrote:A very basic CLI game

http://01micko.com/packages/punchkickblock.zip ~28k

source and java archive included
Graphics and sound...next quarter?

Just read an interesting article in slate

http://www.slate.com/articles/technolog ... most_viral


This is my nightmare vision—“everyone

User avatar
Insomniacno1
Posts: 188
Joined: Fri 24 Jul 2009, 22:43

#53 Post by Insomniacno1 »

Hi, I'm on Wary 5.5 and I have installed jre-8u45-i586.sfs (with SFSload 2.3). jre-8u45-i586.sfs do not work with Wary 5.5(thought it would), Java.com's own verifying tool starts but there is only a grey box and it ends up saying it can't verify my java version. http://javatester.org/version works fine after I added it to the list of approved sites in the java control panel.

But it would seem that I need to use the older version 7 of java, but how the heck do I uninstall a version 8 installed by sfs? Its not in puppy manager, and sfs load 2.3 dont list it.

Can someone help?

JBJ

User avatar
Keef
Posts: 987
Joined: Thu 20 Dec 2007, 22:12
Location: Staffordshire

#54 Post by Keef »

I assume you mean you started sfs_load from the menu?
Try right clicking on the actual .sfs, and select sfs_load from there - it should offer to unload it. We can always hope anyway,

Post Reply