.________________________________________________
November 1, 2011: BaCon 1.0 build 24 released
________________________________________________
November 1, 2011: BaCon 1.0 build 24 released
November 1, 2011: BaCon 1.0 build 24 released
.
- Lobster
- Official Crustacean
- Posts: 15522
- Joined: Wed 04 May 2005, 06:06
- Location: Paradox Realm
- Contact:
Must be time to pretend I can program in Slacko Puppy 5.3
1. In Slacko add devx SFS - if you can not get from Slickpet
http://ftp.nluug.nl/ftp/pub/os/Linux/di ... puppy-5.3/
2. Reboot computer after adding SFS with menu/system/bootup
3. Check SFS is running - I usually type python at console and ctrl + D to get out
4. Sardine break*
5. Download 'BaCon Bash version (requires BASH 3.2 or higher)'
actually just a text file/script
6. Save the script into bac24 - I will use this to compile
7. More sardines*
8. Save the below code as hi.bac (this is a modified test bacon script)
9. Add HUG (you need this see next post for details)
10. Run
./bac24 hi.bac
This runs the new Bacon bash script - compiling the file hi.bac
11. I iz coder . . .
Thanks guys
*sardine breaks are optional
1. In Slacko add devx SFS - if you can not get from Slickpet
http://ftp.nluug.nl/ftp/pub/os/Linux/di ... puppy-5.3/
2. Reboot computer after adding SFS with menu/system/bootup
3. Check SFS is running - I usually type python at console and ctrl + D to get out
4. Sardine break*
5. Download 'BaCon Bash version (requires BASH 3.2 or higher)'
actually just a text file/script
6. Save the script into bac24 - I will use this to compile
7. More sardines*
8. Save the below code as hi.bac (this is a modified test bacon script)
Code: Select all
' BaCon / HUG Hello World
INCLUDE "/usr/share/BaCon/hug_imports.bac"
INIT
Mainwin = WINDOW( "hi from Crusty", 250, 100 )
My_label = MARK( "Hello Sardines!", 150, 30 )
ATTACH( Mainwin, My_label, 50, 20 )
My_btn = BUTTON( "I'm done", 80, 25)
ATTACH( Mainwin, My_btn, 85, 60 )
CALLBACK( My_btn, QUIT)
My_chk = CHECK( "Nada", 50, 25 )
ATTACH( Mainwin, My_chk, 175, 60 )
DISPLAY
9. Add HUG (you need this see next post for details)
10. Run
./bac24 hi.bac
This runs the new Bacon bash script - compiling the file hi.bac
11. I iz coder . . .
Thanks guys
*sardine breaks are optional
Last edited by Lobster on Fri 04 Nov 2011, 06:36, edited 1 time in total.
Thanks Lobster for Slacko instructions.
_______________________________________________________________________________________
Along with the latest Bacon version you may want to make sure you have the current HUG files (GUI programing)
- "hug.bac" v .63
- "hug.so" shared object library (compiled hug.bac)
- hug_imports.bac
hug.bac and hug_imports.bac can go in /usr/share/BaCon/
and hug.so in /usr/lib/
_______________________________________________________________________________________
You can rename hug.so to libhug.so if you want, but you'll need to change the top line in hug_imports.bac to reflect
the name change.
_______________________________________________________________________________________
Along with the latest Bacon version you may want to make sure you have the current HUG files (GUI programing)
- "hug.bac" v .63
- "hug.so" shared object library (compiled hug.bac)
- hug_imports.bac
hug.bac and hug_imports.bac can go in /usr/share/BaCon/
and hug.so in /usr/lib/
_______________________________________________________________________________________
You can rename hug.so to libhug.so if you want, but you'll need to change the top line in hug_imports.bac to reflect
the name change.
- Attachments
-
- beach.jpg
- Great place for a "Sardine break*.
- (47.3 KiB) Downloaded 1588 times
-
- HUG_v63.tar.gz
- hug.bac (v63)
hub.so (v63)
hug_imports.bac - (78.08 KiB) Downloaded 473 times
- Lobster
- Official Crustacean
- Posts: 15522
- Joined: Wed 04 May 2005, 06:06
- Location: Paradox Realm
- Contact:
Well for my new found toy I thought I would add compression to compiled programs using UPX
Basically it makes the compiled code smaller . . .
http://en.wikipedia.org/wiki/UPX
However I only got as far as adding the menu option not executing it
See the enclosed file (it also contains the license for UPX in a compressed file)
Try UPX out on the ready compiled bgui2 (note the size before and after)
In 'bgui2' you will notice under 'tools' the compress option (but no execute option)
In the bgui2.bac code my few inserts are labeled 'LOB 1, 'LOB 2 etc
If GatorDog or anyone with the required skill (not me today) wants to add that compression option - Great! Hope you do.
I am going back to BASICS
Basically it makes the compiled code smaller . . .
http://en.wikipedia.org/wiki/UPX
However I only got as far as adding the menu option not executing it
See the enclosed file (it also contains the license for UPX in a compressed file)
Try UPX out on the ready compiled bgui2 (note the size before and after)
Code: Select all
./upx bgui2
In the bgui2.bac code my few inserts are labeled 'LOB 1, 'LOB 2 etc
If GatorDog or anyone with the required skill (not me today) wants to add that compression option - Great! Hope you do.
I am going back to BASICS
upx - file compressor
! WOW !(note the size before and after)
I have several irons in the fire right now. Maybe L18L or vovchik will have an idea.anyone with the required skill (not me today) wants to add that compression option
Thanks Lobster, for sharing that little jewel (upx),
GatorDog
Lobster
this is great news that the compiled BaCon bin can be compressed!
and the resulting bin is much smaller this will get more people writing apps in BaCon
updated more BaCon and Hug keywords and the upx compression option
http://murga-linux.com/puppy/viewtopic. ... &start=353
it is very easy to add this option to geany
note in geany I had to recycle the build button
so after you compile the app you click on build
which build now uses upx to compress your already compiled bin
Joe
A big thanksIf GatorDog or anyone with the required skill (not me today) wants to add that compression option - Great! Hope you do. Cool
this is great news that the compiled BaCon bin can be compressed!
and the resulting bin is much smaller this will get more people writing apps in BaCon
updated more BaCon and Hug keywords and the upx compression option
http://murga-linux.com/puppy/viewtopic. ... &start=353
it is very easy to add this option to geany
note in geany I had to recycle the build button
so after you compile the app you click on build
which build now uses upx to compress your already compiled bin
Joe
Folks,
The BaCon binary also can be created using specific C compiler options. On my 32-bit system with GCC 4.5.2, the default way of compiling binary delivers a size of 407994 bytes.
However, if compiled as follows:
After this the binary can be compressed even more using UPX.
Regards
Peter
The BaCon binary also can be created using specific C compiler options. On my 32-bit system with GCC 4.5.2, the default way of compiling binary delivers a size of 407994 bytes.
However, if compiled as follows:
...the resulting size is 341760 bytes (gain of approx. 16%).bacon.bash -o -O2 -o -s bacon
After this the binary can be compressed even more using UPX.
Regards
Peter
Thanks Peter @PjotAwake
P.S I am having a lot of fun with BaCon
1.)with no compiler options compile it
using bacon.bac in this example 387kb
2.)using the compile options PjotAwake posted above compile it
using bacon.bac in this example 283kb
*I already have bacon installed
3.)using upx compression on the already compiled bin 66kb
4.) with no compiler options used using the 387kb bin
then compress bacon with upx and the result is 59kb !
I dont know why but the numbers are the numbers
5.) 54kb takes much longer to compress
===========================================
using tcc compiler instead of gcc
==========================================
468kb
so the binary is larger
77kb
and to use upx you have to use the
--force-execve option or it wont compress the bin
please note that the size of the bacon bin is not a problem at all
it was only used to show the size reduction that can come from
using upx compression on all of your freshly compiled new BaCon apps
Joe
P.S I am having a lot of fun with BaCon
1.)with no compiler options compile it
using bacon.bac in this example 387kb
2.)using the compile options PjotAwake posted above compile it
using bacon.bac in this example 283kb
Code: Select all
bacon -o -O2 -o -s bacon.bac
3.)using upx compression on the already compiled bin 66kb
4.) with no compiler options used using the 387kb bin
then compress bacon with upx and the result is 59kb !
I dont know why but the numbers are the numbers
5.)
Code: Select all
upx --ultra-brute bacon
===========================================
using tcc compiler instead of gcc
==========================================
Code: Select all
bacon -c tcc bacon.bac
so the binary is larger
Code: Select all
upx --force-execve bacon
and to use upx you have to use the
--force-execve option or it wont compress the bin
please note that the size of the bacon bin is not a problem at all
it was only used to show the size reduction that can come from
using upx compression on all of your freshly compiled new BaCon apps
Joe
BaconGUI with "upx" support
.
BaconGUI v1.0.24 with "upx" support.
"upx" needs to be available in PATH.
Convert the program first, then "upx" it.
(Runs upx on the program in the currently active tab.)
Uses "--best" compression. (I'll check that --ultra-brute if there's interest.)
GatorDog
.
FWIW - If you grab the dashed line on the dropdown menu, you'll get an
undocked copy that you can move off to the side.
.
BaconGUI v1.0.24 with "upx" support.
"upx" needs to be available in PATH.
Convert the program first, then "upx" it.
(Runs upx on the program in the currently active tab.)
Uses "--best" compression. (I'll check that --ultra-brute if there's interest.)
GatorDog
.
FWIW - If you grab the dashed line on the dropdown menu, you'll get an
undocked copy that you can move off to the side.
.
- Attachments
-
- upx.png
- upx under TOOLS menu
- (20.71 KiB) Downloaded 1210 times
-
- bacongui-upx.tar.gz
- BaconGUI w/ upx support (uses upx --best compression)
- (54.45 KiB) Downloaded 429 times
- Lobster
- Official Crustacean
- Posts: 15522
- Joined: Wed 04 May 2005, 06:06
- Location: Paradox Realm
- Contact:
WAM BAM SHEBANG
I was so pleased to receive Gatordogs PM
about the new IDE with UPX . . .
. . . that I wrote the enclosed from scratch in Geany
(the enclosed zip file does not include a compiled version)
Here is the code for the fish to laugh at
Code: Select all
#!/usr/bin/bacon -b
' Command line Buddhist YinYana Mala
' Test Compiled on Puppy Linux 5.3 Slacko
' Nov 2011 Created by Lobster
'''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''
' Set Initial State
'''''''''''''''''''''''''''''''''''
COLOR RESET
CLEAR
SUB How_many
'''''''''''''''''''''''''''''''''''
' How many repetitions
'''''''''''''''''''''''''''''''''''
PRINT
COLOR FG TO WHITE
COLOR BG TO BLUE
CLEAR
PRINT
PRINT " -= How many repetitions would you like? =-"
PRINT
PRINT " Type in a number and press ENTER"
PRINT
PRINT " -= Press 0 and ENTER for Auto mode =-"
COLOR FG TO RED
INPUT repeats
CLEAR
END SUB
SUB InitialMenu
'''''''''''''''''''''''''''''''''''
' Select Style options
'''''''''''''''''''''''''''''''''''
COLOR FG TO BLUE
COLOR BG TO WHITE
CLEAR
COLOR FG TO WHITE
COLOR BG TO BLUE
PRINT "----------------------------------------"
PRINT " YinYana Mantra Practices "
PRINT "----------------------------------------"
COLOR FG TO BLUE
COLOR BG TO WHITE
PRINT
PRINT " Press 1 and ENTER for MANI's beginners"
PRINT " Press 2 and ENTER for GANESH mantra"
PRINT " Press 3 and ENTER for MEDICINE BUDDHA"
PRINT " Press 4 and ENTER for YINYANA mantra"
PRINT " Press 5 and ENTER for WRATHFUL Practice"
PRINT " Press 6 and ENTER for AMITABA Practice"
COLOR FG TO RED
INPUT mantra_choice$
'''''''''''''''
' Make choice
'''''''''''''''
IF mantra_choice$ = "1" THEN
COLOR FG TO RED
COLOR BG TO YELLOW
CLEAR
SYSTEM "mplayer omm.wav"
mantra$ = " OM MANI PEME HUM"
CLEAR
ENDIF
IF mantra_choice$ = "2" THEN
COLOR FG TO WHITE
COLOR BG TO GREEN
CLEAR
mantra$ = " OM GANAPATAYA NAMAHA"
SYSTEM "mplayer ganesh.mp3"
CLEAR
ENDIF
IF mantra_choice$ = "3" THEN
COLOR FG TO WHITE
COLOR BG TO BLUE
CLEAR
mantra$ = " OM BEKANZA BENKANZA RA ZA TSA MUN GATE SOHA"
CLEAR
ENDIF
IF mantra_choice$ = "4" THEN
COLOR BG TO WHITE
COLOR FG TO CYAN
CLEAR
mantra$ = " MAY TRE YA, OM TRE YA OM, YA OM MAY YA HUM"
CLEAR
ENDIF
IF mantra_choice$ = "5" THEN
COLOR BG TO WHITE
COLOR FG TO RED
CLEAR
mantra$ = " OM AH HUM VAJRAKILI KILAYA HUM PEY"
CLEAR
ENDIF
IF mantra_choice$ = "6" THEN
COLOR BG TO WHITE
COLOR FG TO RED
CLEAR
mantra$ = " AMITABA"
SYSTEM "mplayer amtb8.wav"
CLEAR
ENDIF
END SUB
SUB QueDisplay
''''''''''''''''''''''''''''''''
' Help Display
''''''''''''''''''''''''''''''''
COLOR FG TO WHITE
COLOR BG TO BLUE
CLEAR
PRINT
PRINT " ----------------------------------------"
PRINT " YinYana Virtual Mala - What it is? "
PRINT " ----------------------------------------"
PRINT
PRINT " For Vajrayana practitioners, common mantras"
PRINT " are repeated in 108 lots"
PRINT " It corresponds to the bead number"
PRINT " on a mala or Buddhist rosary"
PRINT
PRINT " The chanting generates a mind calming effect"
PRINT
PRINT " You will be given a selection of mantras to repeat"
PRINT " and prompted for the number of repetitions"
PRINT
COLOR FG TO BLUE
COLOR BG TO WHITE
PRINT " Ctrl + c to Quit, ENTER to continue"
INPUT return_to_menu$
END SUB
SUB DisplayAffirmations
''''''''''''''''''''''''''''''''
' Display Affirmations in terminal
''''''''''''''''''''''''''''''''
x=0
CURSOR <OFF>
REPEAT
x=x+1
PRINT " ",x," ",mantra$
IF repeats = 0 THEN SLEEP 5000
ELSE INPUT c$
UNTIL x = repeats
END SUB
'''''''''''''''''
' Run Program
'''''''''''''''''
CALL QueDisplay
CALL How_many
CALL InitialMenu
CALL DisplayAffirmations
CALL InitialMenu
''''' END Program
Code: Select all
#!/usr/bin/bacon -b
using something called a 'Shebang' (news to me as I have led a sheltered programming life)
You just run the program from the command line like so
Code: Select all
./chant1.bac
The program is command line only
I am running Slacko, so used the SYSTEM command to run mplayer
Code: Select all
SYSTEM "mplayer omm.wav"
You must have a blank line at the end of your program
- the error messages were very good
Been a while since I programmed in BASIC.
This page was helpful
http://www.basic-converter.org/documentation.html
In particular the ability to use
Code: Select all
SUB <name>
END SUB
Code: Select all
CALL SUB
(gosh - almost sound like I know what I am talking about)
Hey Lobster,
Looks like a weiner
______________________________________________________________________________________________________________________
______________________________________________________________________________________________________________________
You could use mhWaveEdit to convert audio files to nnn.au format.
I've been reducing sample rate to about 14000 and converting to mono.
Smaller than wav files.
Mplayer and aplay can play .au format.
Seems like aplay starts a little quicker.
And "aplay -q file.au" will suppress message output to the terminal.
Good going,
GatorDog
(and what's up with this geany thing )
Looks like a weiner
______________________________________________________________________________________________________________________
What bacon version are you running?You must have a blank line at the end of your program
______________________________________________________________________________________________________________________
You could use mhWaveEdit to convert audio files to nnn.au format.
I've been reducing sample rate to about 14000 and converting to mono.
Smaller than wav files.
Mplayer and aplay can play .au format.
Seems like aplay starts a little quicker.
And "aplay -q file.au" will suppress message output to the terminal.
Good going,
GatorDog
(and what's up with this geany thing )
- Lobster
- Official Crustacean
- Posts: 15522
- Joined: Wed 04 May 2005, 06:06
- Location: Paradox Realm
- Contact:
We do not have this brand of hot dog sausage in the UKGatorDog wrote:Hey Lobster,
Looks like a weiner
. . . however I am aware of the idiom and sentiment.
Many thanks
November 1, 2011: BaCon 1.0 build 24You must have a blank line at the end of your program
What bacon version are you running?
I think this may be a feature/bug/result of using the shebang method - compiling the program it probably does not matter . . .
However with Shebang you have to interpret a 'clear line'
Thanks for the audio tips
Ah yes - familiarity (I turn on the Basic coding highlight - we could do with one for BaCon) and known reliability and the ability to zoom into code with the mouse wheel.(and what's up with this geany thing )
Thanks for the encouragement.
Programming does not come easy to me
but I like to try . . .