Author |
Message |
GatorDog

Joined: 12 Sep 2006 Posts: 136
|
Posted: Tue 01 Nov 2011, 21:01 Post subject:
November 1, 2011: BaCon 1.0 build 24 released |
|
.
Quote: | ________________________________________________
November 1, 2011: BaCon 1.0 build 24 released
________________________________________________
|
.
|
Back to top
|
|
 |
Lobster
Official Crustacean

Joined: 04 May 2005 Posts: 15238 Location: Paradox Realm
|
Posted: Thu 03 Nov 2011, 11:27 Post subject:
|
|
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/distr/puppylinux/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: | ' 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
_________________ YinYana AI Buddhism
Last edited by Lobster on Fri 04 Nov 2011, 02:36; edited 1 time in total
|
Back to top
|
|
 |
GatorDog

Joined: 12 Sep 2006 Posts: 136
|
Posted: Fri 04 Nov 2011, 02:01 Post subject:
|
|
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.
Description |
Great place for a "Sardine break*. |
Filesize |
47.3 KB |
Viewed |
1454 Time(s) |

|
Description |
hug.bac (v63) hub.so (v63) hug_imports.bac
|

Download |
Filename |
HUG_v63.tar.gz |
Filesize |
78.08 KB |
Downloaded |
328 Time(s) |
|
Back to top
|
|
 |
Lobster
Official Crustacean

Joined: 04 May 2005 Posts: 15238 Location: Paradox Realm
|
Posted: Fri 04 Nov 2011, 02:39 Post subject:
|
|
Many thanks GatorDog, have amended my previous post
to include [ [ [ [ [ HUG ] ] ] ] ]
_________________ YinYana AI Buddhism
|
Back to top
|
|
 |
Lobster
Official Crustacean

Joined: 04 May 2005 Posts: 15238 Location: Paradox Realm
|
Posted: Fri 04 Nov 2011, 12:15 Post subject:
|
|
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
_________________ YinYana AI Buddhism
|
Back to top
|
|
 |
GatorDog

Joined: 12 Sep 2006 Posts: 136
|
Posted: Fri 04 Nov 2011, 15:42 Post subject:
upx - file compressor |
|
Quote: | (note the size before and after) | ! WOW !
Quote: | anyone with the required skill (not me today) wants to add that compression option |
I have several irons in the fire right now. Maybe L18L or vovchik will have an idea.
Thanks Lobster, for sharing that little jewel (upx),
GatorDog
|
Back to top
|
|
 |
big_bass
Joined: 13 Aug 2007 Posts: 1742
|
Posted: Sat 05 Nov 2011, 00:45 Post subject:
|
|
Lobster
Quote: |
If GatorDog or anyone with the required skill (not me today) wants to add that compression option - Great! Hope you do. Cool
|
A big thanks
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.php?t=48901&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
|
Back to top
|
|
 |
PjotAwake

Joined: 03 Nov 2010 Posts: 34 Location: The Hague, The Netherlands
|
Posted: Sun 06 Nov 2011, 15:53 Post subject:
|
|
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:
Quote: |
bacon.bash -o -O2 -o -s bacon
|
...the resulting size is 341760 bytes (gain of approx. 16%).
After this the binary can be compressed even more using UPX.
Regards
Peter
|
Back to top
|
|
 |
big_bass
Joined: 13 Aug 2007 Posts: 1742
|
Posted: Sun 06 Nov 2011, 16:39 Post subject:
|
|
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
Code: | bacon -o -O2 -o -s bacon.bac |
*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.) Code: | upx --ultra-brute bacon | 54kb takes much longer to compress
===========================================
using tcc compiler instead of gcc
==========================================
Code: | bacon -c tcc bacon.bac | 468kb
so the binary is larger
Code: | upx --force-execve bacon | 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
|
Back to top
|
|
 |
GatorDog

Joined: 12 Sep 2006 Posts: 136
|
Posted: Mon 07 Nov 2011, 03:56 Post subject:
BaconGUI with "upx" support Subject description: Ultimate Package Compression |
|
.
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.
.
Description |
upx under TOOLS menu |
Filesize |
20.71 KB |
Viewed |
1072 Time(s) |

|
Description |
BaconGUI w/ upx support (uses upx --best compression)
|

Download |
Filename |
bacongui-upx.tar.gz |
Filesize |
54.45 KB |
Downloaded |
302 Time(s) |
|
Back to top
|
|
 |
Lobster
Official Crustacean

Joined: 04 May 2005 Posts: 15238 Location: Paradox Realm
|
Posted: Mon 07 Nov 2011, 08:10 Post subject:
|
|
Good job GatorDog. Gonna try it shortly. Thanks for letting me know
Gonna try a 'from scratch' program . . . not sure what yet . . .
_________________ YinYana AI Buddhism
|
Back to top
|
|
 |
Lobster
Official Crustacean

Joined: 04 May 2005 Posts: 15238 Location: Paradox Realm
|
Posted: Fri 11 Nov 2011, 01:36 Post subject:
WAM BAM SHEBANG Subject description: Thank you Mam |
|
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: | #!/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 |
Right at the top you will see
Code: | #!/usr/bin/bacon -b |
This means you do not have to compile the program to run it
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
--------
The program is command line only
I am running Slacko, so used the SYSTEM command to run mplayer
Code: | SYSTEM "mplayer omm.wav" |
One thing that got me - Python does this too
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
and then
means structured procedural programs are possible
(gosh - almost sound like I know what I am talking about)
_________________ YinYana AI Buddhism
|
Back to top
|
|
 |
GatorDog

Joined: 12 Sep 2006 Posts: 136
|
Posted: Fri 11 Nov 2011, 09:25 Post subject:
|
|
Hey Lobster,
Looks like a weiner
______________________________________________________________________________________________________________________
Quote: | You must have a blank line at the end of your program |
What bacon version are you running?
______________________________________________________________________________________________________________________
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 )
|
Back to top
|
|
 |
Lobster
Official Crustacean

Joined: 04 May 2005 Posts: 15238 Location: Paradox Realm
|
Posted: Fri 11 Nov 2011, 22:08 Post subject:
|
|
GatorDog wrote: | Hey Lobster,
Looks like a weiner |
We do not have this brand of hot dog sausage in the UK
. . . however I am aware of the idiom and sentiment.
Many thanks
Quote: | You must have a blank line at the end of your program
What bacon version are you running? |
November 1, 2011: BaCon 1.0 build 24
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
Quote: | (and what's up with this geany thing ) |
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.
Thanks for the encouragement.
Programming does not come easy to me
but I like to try . . .
_________________ YinYana AI Buddhism
|
Back to top
|
|
 |
|