|
Post by vovchik on Aug 6, 2014 20:09:52 GMT 1
Dear all, Here are two litle scripts that make use of bcm to display world times - i.e. the current time in various places in the world. If either runs off your screen, delete or comment out with # some entries in the array that contains the locations. Have fun.... With kind regards, vovchik Attachments:worldtime.tar.gz (1.32 KB)
|
|
|
Post by basica on Aug 6, 2014 21:59:28 GMT 1
The popup utility is just great.
Here's some feedback from my experience. On Puppy Precise 5.7.1 the "Mint" compilation did not run, while on Debian Wheezy it did.
Compiled in Puppy Precise 5.7.1 after this change to "bcm.bac".
374 cairo_set_antialias(c, CAIRO_ANTIALIAS_DEFAULT)
The "cairo.h" file in Puppy did not have the "CAIRO_ANTIALIAS_BEST" enumeration.
Nice collection of examples and thanks for this attractive look.
|
|
|
Post by vovchik on Aug 6, 2014 22:25:16 GMT 1
Dear basica,
Thanks for the feedback and debugging. I think I will put a commented line in the source with your ANTIALIAS line and update the archive. I knew that that enum was only in newer cairo.h versions, but did not know when exactly they implemented it. And good thing the Mint stuff works in Puppy Debian Wheezy. When I was doing this, I thought mainly about Puppy, because there is no decent notifier without horrible dependencies (e.g dbus). I think micko had the same thoughts. And I think it looks pretty good. The main thing now is to think of little scripted apps that can make use of bcm. Incidentally, for Puppy purposes, you will want to strip the binary. I also UPX'd, getting the size down to about 14k.
With kind regards, vovchik
PS. The reason I am using Mint for development is that I am doing things with goo_canvas, wx_widgets, fltk, enlightenement, KDE, QT, etc., and it is just easier to get all the libs and headers installed. Otherwise, I think Puppy is great, and I have used it for years.
|
|
|
Post by vovchik on Aug 7, 2014 21:20:40 GMT 1
Dear all, This is one way to do stripes: #!/bin/bash b="<span bgcolor='#e1edfb'>" w="<span bgcolor='#ffffff'>" s="</span>" title="<span font='Mono 10'>" text="\ $b 0. Alice Cooper $s $w 1. John Doe $s $b 2. Mary Smith $s $w 3. Larry Higgins $s $b 4. Javier Bautista $s $w 5. Yi Yang $s $b 6. Molly Bloom $s $w 7. George Harris $s"
./bcm -g r:t -c "#e1edfbff" -b "#ffffffff" -t "$title$text</span>" -d 0 -i
With kind regards, vovchik Attachments:
|
|
|
Post by 01micko on Aug 8, 2014 22:39:55 GMT 1
Compiled in Puppy Precise 5.7.1 after this change to "bcm.bac". 374 cairo_set_antialias(c, CAIRO_ANTIALIAS_DEFAULT) The "cairo.h" file in Puppy did not have the "CAIRO_ANTIALIAS_BEST" enumeration. Nice collection of examples and thanks for this attractive look. Hello basica and vovchik I just checked cairo docs and CAIRO_ANTIALIAS_BEST has been since cairo-1.12 (source)You can check at runtime which cairo you have with this: IF (cairo_version() >= CAIRO_VERSION_ENCODE(1,12,0)) THEN cairo_set_antialias(c, CAIRO_ANTIALIAS_BEST) ELSE cairo_set_antialias(c, CAIRO_ANTIALIAS_DEFAULT) ENDIF (source)(at line 347) It would be great if you could test this basica in Precise Puppy. It works in Slacko 6.0 beta with cairo-1.12.16 Cheers
|
|
|
Post by vovchik on Aug 8, 2014 22:54:35 GMT 1
Dear micko, Thanks for that nice version check. Certainly better than having to edit the code. I have updated the archive accordingly. With kind regards, vovchik
|
|
|
Post by 01micko on Aug 8, 2014 23:01:38 GMT 1
Dear micko, Thanks for that nice version check. Certainly better than having to edit the code. I have updated the archive accordingly. With kind regards, vovchik You're most welcome. Let's hope there are no more of those little "new feature" bugs. It would also be possible (I suppose) to do a compile time check, but that makes the resulting binary less portable. Cheers EDIT: as I suspected, my fix is fine for runtime, but not for compile time. I just tested in an older Slacko with cairo-1.10.2; binary works fine but compiling fails. I'll do some reading and see if I can fix the issue. Of course we get an undeclared function error from gcc.
|
|
|
Post by 01micko on Aug 9, 2014 0:26:03 GMT 1
Hello vovchik and basica
Here is my solution to the compile time problem, however I needed "USEC". I did look for a native BaCon method but it did escape me. (edited: See below code block)
USEC #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 12, 0) if (cairo_version() >= CAIRO_VERSION_ENCODE(1,12,0)) { cairo_set_antialias(c, CAIRO_ANTIALIAS_BEST); } else { cairo_set_antialias(c, CAIRO_ANTIALIAS_DEFAULT); } #else cairo_set_antialias(c, CAIRO_ANTIALIAS_DEFAULT); #endif ENDUSEC @line 647 again
This will produce a working binary if cairo is older than 1.12 but if that binary is run in an OS with cairo >= 1.12 the cairo_set_antialias(c, CAIRO_ANTIALIAS_DEFAULT) will be used instead of cairo_set_antialias(c, CAIRO_ANTIALIAS_BEST). On the other hand, if you build it against cairo >= 1.12 the binary will run in any OS with cairo >=1.0 but if you have cairo >= 1.12 the cairo_set_antialias(c, CAIRO_ANTIALIAS_BEST) function will be used.
So how to we pass this to the preprocessor in native BaCon?
Cheers
LATER: the following seems to work for native BaCon (changed #if to #ifdef)
#ifdef CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1,12,0) IF (cairo_version() >= CAIRO_VERSION_ENCODE(1,12,0)) THEN cairo_set_antialias(c, CAIRO_ANTIALIAS_BEST) ELSE cairo_set_antialias(c, CAIRO_ANTIALIAS_DEFAULT) ENDIF #else cairo_set_antialias(c, CAIRO_ANTIALIAS_DEFAULT) #endif .. but to my way of thinking (dumb?) plain old #if should have worked. Is this a bug? Intriguing the using USEC did not require #ifdef (nor -j on the bacon command, but I suppose that is reasonable). On second thought, I don't think it's a bug, but perhaps the USEC way was buggy.
Also, of course needed the -j option to bacon to invoke the preprocessor using native BaCon.
|
|
|
Post by vovchik on Aug 9, 2014 9:50:36 GMT 1
Dear micko,
Thanks for that #ifdef. It works nicely, but users need to know that the -j compile option is needed. Another way to do that would be not to use the enum per se but to define an int var, say, AA, and assign it either a 0 (old) or 6 (new) depending on the cairo.h version:
cairo_set_antialias(c, AA)
Or use cairo_set_antialias(c, 0) for all versions, so that it is universal?
Still thinking....
With kind regards, vovchik
|
|
|
Post by bigbass on Aug 9, 2014 15:10:50 GMT 1
Hey guys
In bacon we can do something like this haven't tested using an older cairo but the idea is there
using
OPTION PARSE FALSE
I commented out the lines while testing
cairo_version$= (char *)cairo_version_string () PRINT "cairo_version string = " ,cairo_version$ cairo_ver=cairo_version() PRINT "cairo_ver = " ,cairo_ver CE=CAIRO_VERSION_ENCODE(1, 12, 0) PRINT CE
IF cairo_ver >= CE AND CE >0 THEN PRINT "You can use the new stuff with this cairo version" '---cairo_set_antialias(c, CAIRO_ANTIALIAS_BEST) ELSE PRINT " We fall back to the old cairo options" '---cairo_set_antialias(c, CAIRO_ANTIALIAS_DEFAULT) END IF
|
|
|
Post by vovchik on Aug 9, 2014 15:17:05 GMT 1
Dear Joe and guys,
What about this:
LOCAL AA TYPE int ' check for valid enum value - 6 is best and 0 is default, ' but 6 is only in later versions IF (cairo_version() >= CAIRO_VERSION_ENCODE(1,12,0)) THEN AA = 6 ELSE AA = 0 END IF ... cairo_set_antialias(c, AA)
I don't think that will generate a compile-time error and should run with new and old cairo.
Wth kind regards, vovchik
|
|
|
Post by basica on Aug 10, 2014 0:03:32 GMT 1
Dear Joe and guys, What about this: LOCAL AA TYPE int ' check for valid enum value - 6 is best and 0 is default, ' but 6 is only in later versions IF (cairo_version() >= CAIRO_VERSION_ENCODE(1,12,0)) THEN AA = 6 ELSE AA = 0 END IF ... cairo_set_antialias(c, AA)
I don't think that will generate a compile-time error and should run with new and old cairo. Wth kind regards, vovchik I can confirm that this compiles and runs in Puppy Precise 5.7.1. (changed LOCAL to DECLARE --wasn't sure of the scope) Weather, Global Time, and now Stripes. Quite a line up......
|
|
|
Post by vovchik on Aug 10, 2014 9:28:11 GMT 1
Dear basica and all,
Thanks for testing/compiling on Puppy Precise. I have updated the archive to include that cairo check and hope it now compiles on most anything...
With kind regards, vovchik
|
|
|
Post by vovchik on Aug 13, 2014 0:51:09 GMT 1
Dear all, I updated the archive just now and added DiskHog, CpuHog, MemHog, Dirlist, FreeMem and OS_Bits scripts. Have fun.... With kind regards, vovchik PS. I suppose we could also use a NetHog script, too, that will show what processes are using inet.
|
|
|
Post by 01micko on Aug 13, 2014 2:01:29 GMT 1
Hello vovchik
One suggestion, just to quieten down the terminal a bit.
@line 182 can you add EXIT SUB (or just EXIT) above LABEL HELP please?
TIA
Everything is working well, except the weather scripts, but I believe there is trouble with internet in the US today due to old equipment and router tables jamming the memory in said old equipment.
Cheers!
|
|