RaspberryPi Stacks

Moderators: Klaus, FourthWorld, heatherlaine, robinmiller, kevinmiller

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2120
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: RaspberryPi Stacks

Post by [-hh] » Fri Feb 16, 2018 8:39 am

Raspberry Pi stacks collection #106 = beforeAfterImage.livecode

Before-After-Image = LC-Magick #12
version 1.0.0 of Feb 16, 2018

Before-After-Image shows an "original" image (image "before") and a selectable horizontal or vertical part of it visually replaced by the changed image (image "after").

A button (at bottom right) switches the order of "before" and "after" parts.
You select the proportions of the parts by sliders.

For use in your own stack you only have to provide *one* "before-image" and *one to many*
"after-images" -- as the demo shows.
  • Use LC 6.0.5 (or slower: 7.0.4) on Raspi.
  • Use LC 6.7.11 / 7.1.4 and 8.1.6/ 9.0.0 or later on Mac/Win/linux
The stack is too large for the forum. You can have it
  1. by opening an LC IDE, version as denoted above, then type in or copy-paste to msg:
    [EU] go stack url ("http://hyperhh.org/xstacks/beforeAfterI ... 0.livecode")
    [US] go stack url ("http://hh.on-rev.com/xstacks/beforeAfte ... 0.livecode")
    _or_
  2. by downloading in your browser
    [EU] http://hyperhh.org/xstacks/beforeAfterI ... vecode.zip
    [US] http://hh.on-rev.com/xstacks/beforeAfte ... vecode.zip
    Then open it in an LC IDE, version as denoted above.
Attachments
BeforeAfterV.png
Vertical "Before" and "After" (Dithered)
BeforeAfterV.png (151.66 KiB) Viewed 3790 times
beforeAfter.png
Horizontal "Before" and "After" (Dithered)
beforeAfter.png (151.46 KiB) Viewed 3795 times
shiftLock happens

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2120
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: RaspberryPi Stacks

Post by [-hh] » Thu Sep 20, 2018 9:19 am

Raspberry Pi stacks collection #107 = ControlHandles67

ControlHandles is a group of handles (polygon and graphics) that essentialy work, in browse mode, as the object handles in pointer mode.

It is all in one menu button by which you include/exclude which controls are selectable as target. The rest is done by the button.

controlhandles.png
controlhandles.png (3.74 KiB) Viewed 3422 times

This works for *ALL* LC controls:
CLICK ACTIONS
  • 1,3,5,7: Resize
    1,3,5,7 + Shift- or RightClick: Resize proportionally
  • 2,6: Height
  • 4,8: Width
  • 9,10,11,12: Grab
    9,10,11,12 + Cmd or RightClick: Hide Poly
    9,10,11,12 + Shift: Hide Control and Poly
While using the handles, width x height and the rect of the control are displayed.

Scripts are 'essentially' commented. For this stack
  • use LC 6.0.5 (or slower: 7.0.4) on Raspi.
  • use LC 6.7.11/ 7.1.4/ 8.1.9/ 9.0.0 on Mac/Win/linux
An identical version of this stack that contains widgets (requires LC 8/9) is available from "Sample Stacks"
or from http://livecodeshare.runrev.com/stack/902

## v1.0.4 Sep 20, 2018
 
Attachments
ControlHandles67_v104.livecode.zip
(228.81 KiB) Downloaded 148 times
controlhandles67.png
controlhandles67.png (13.12 KiB) Viewed 3422 times
shiftLock happens

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2120
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: RaspberryPi Stacks

Post by [-hh] » Thu Sep 20, 2018 9:44 am

I lost oversight, a table of contents may be also comfortable for you.

Table of contents (as of Sep 11, 2019)
Last edited by [-hh] on Tue Sep 10, 2019 11:17 pm, edited 4 times in total.
shiftLock happens

bogs
Posts: 3785
Joined: Sat Feb 25, 2017 10:45 pm

Re: RaspberryPi Stacks

Post by bogs » Thu Sep 20, 2018 1:10 pm

Every time you post, I'm amazed -hh. Awesome stuff there.
Image

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2120
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: RaspberryPi Stacks

Post by [-hh] » Thu Sep 20, 2018 1:37 pm

So there is at least one user but me! Thanks bogs.
shiftLock happens

SparkOut
Posts: 2020
Joined: Sun Sep 23, 2007 4:58 pm

Re: RaspberryPi Stacks

Post by SparkOut » Thu Sep 20, 2018 8:09 pm

You know there is more than one who thinks [-hh] and all his work is awesome

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2120
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: RaspberryPi Stacks

Post by [-hh] » Thu Sep 20, 2018 9:53 pm

So there are at least two users but me! Thanks SparkOut.
shiftLock happens

Klaus
Posts: 11194
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: RaspberryPi Stacks

Post by Klaus » Thu Sep 20, 2018 9:57 pm

Count me in, folks! 8)

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2120
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: RaspberryPi Stacks

Post by [-hh] » Thu Sep 20, 2018 9:59 pm

So there are at least three users but me! Thanks Klaus.
shiftLock happens

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: RaspberryPi Stacks

Post by Simon » Thu Sep 20, 2018 11:56 pm

I'll come out of hiding to be counted.
Awesome work -hh
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2120
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: RaspberryPi Stacks

Post by [-hh] » Fri Sep 21, 2018 12:17 am

So there are at least four users but me! Thanks Simon.


____________
There are three kinds of mathematicians. One kind can count and the other can not count ...
shiftLock happens

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2120
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: RaspberryPi Stacks

Post by [-hh] » Thu Jan 31, 2019 1:41 am

Raspberry Pi stacks collection #108 = timeLapseCamera6789

Download TimelapseCamera from "Sample Stacks" or
http://livecodeshare.runrev.com/stack/928/

The stack works with all editions of LC 6/7/8/9 on Mac/Win/linux and on Raspi 2/3 (with LC 651 and 704)

TimelapseCamera lets you ...
  • select one of the (web-)cameras attached to your machine.
  • set an interval of 5 to 86400 seconds.
  • set an imageSize (set the width to scale proportional).
  • select to see a preview.
  • select to start the timelapse (saving the snapshots).
Of course you can have snapshots from different cameras at (roughly) the same time by running renamed copies of the stack in different folders.

Then the snapshots are made at the given time intervals and saved to a folder "CAM" in the stack's folder (if the stack is not yet saved it depends on the OS where "CAM" will be created...).
So, when loading from "Sample Stacks", first save the stack, then close and reopen it and you'll get no errors.

The 'core-job' is done by non-LC utilities. They could run in the temporary folder but I save them to the stack's folder so that they are easier to find for you.

NOTE. The stack is tested to run with LC 6 and LC 9 on all the above platforms. Any problems you encounter may result from a file path that contains spaces or single quotes (like "Joe's folder").
I leave it up to you to solve such problems.

License MIT (due to the utilities).
Attachments
timelapse.png
timelapse.png (29.61 KiB) Viewed 2607 times
shiftLock happens

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2120
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: RaspberryPi Stacks

Post by [-hh] » Sat Aug 10, 2019 5:59 pm

Raspberry Pi stacks collection #109 = PasswordRules

Often passwords should obey some rules, e.g.
contain at least a certain number of digits, lowercase chars, uppercase chars, xtra chars with an ascii number in range 32-127 or special local chars as "åáãçß". Or contain only some of these char groups.

Stack PasswordRules allows
  • to check whether a given password fulfils some "char group rules" or
  • to create a random password that fulfils these rules.
Char groups are digits, lowercase a-z, uppercase A-Z, several extras (!"#$%&'()*+,-./ etc.) and an editable one.

The stack works with all editions of LC 6/7/8/9 on Mac/Win/linux and on Raspi 2/3 (with LC 651 and 704)

Download stack "PasswordRules" from "Sample Stacks" of the LC toolbar or from
http://livecodeshare.runrev.com/stack/941/
 
Attachments
passwordRules2.png
shiftLock happens

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2120
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: RaspberryPi Stacks

Post by [-hh] » Fri Aug 16, 2019 1:36 pm

Raspberry Pi stacks collection #110 = CountUpOrDown_v2b

You set a target date by dateItems that is then converted to internet date. Then
  • if the target date is in the future then the stack counts down to it from the current internet date,
  • if the target date is in the past then the stack counts up from it to the current internet date.
The count respects (by using the internet date) leap years and daylight savings and is displayed as
  • (approximate) years
  • (approximate) months
  • (exact) weeks
  • (exact) days
  • (exact) hours
  • (exact) minutes
  • (exact) seconds
Each of these is a display of its own, not to read additively.
So, if you give for example your exact birth date as (year, month, day, hour, minute) you can directly see your age in full years, full months, etc.

The aprroximation of years and months is good. The core function is

Code: Select all

function dateUnits s -- s is in seconds
  put s/31556952 into y
  -- 31556952=365.2425*86400 as approximation (hint of Craig)
  put format("%.3f",y) into year
  put format("%.2f",y*12) into month
  put format("%.1f",s/604800) into week
  put format("%.1f",s/86400) into day
  put format("%.1f",s/3600) into hour
  put format("%.1f",s/60) into minute
  return year,month,week,day,hour,minute,s
end dateUnits
You need a bold monospaced font for the display. Find attached the one I used.
The stack works with all editions of LC 6/7/8/9 on Mac/Win/linux and on Raspi 2/3 (with LC 651 and 704)
 
[Edit (Aug 17, 2019): Removed an error in an earlier version.]
 
Attachments
countUpOrDown2b.livecode.zip
(4.27 KiB) Downloaded 48 times
VeraMoBd.ttf.zip
The monospaced font I use in the stack.
(27.17 KiB) Downloaded 36 times
countUpOrDown.png
Example display.
countUpOrDown.png (44.75 KiB) Viewed 685 times
shiftLock happens

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2120
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: RaspberryPi Stacks

Post by [-hh] » Tue Sep 10, 2019 11:10 pm

Raspberry Pi stacks collection #111 = OSTimeInfo_v105

This is a project that challenged me.

The stack now works with LC 6/7/8/9 on Mac, Win 7/10, linux (Ubuntu 1904 flavours) and with LC 6.5.1/7.0.4 on Raspi 3/4 running Raspbian or Lubuntu.

The goal is simple:
  • Show the uptime (since last reboot) and
  • show last reboot, last shutdown and last uptime
We simply need three timestamps for that.
  • the last reboot
  • the last shutdown
  • the before-last reboot
All above systems except windows have "uptime" available (though I don't use it), so the uptime and last reboot are easy to get.
The last shutdown and before-last reboot are only on Mac an linux desktop simple easy to get.
On windows you have to dive deep into a huge log file using powershell and on Raspi you have to work around the fact that reboots are at a time when a clock isn't available (Raspi has no own clock, gets the time from internet).

Nevertheless, I found a solution.

The start lasts on Windows up to a few seconds, else the results are immediately available.
And there may be extreme scenarios where you get 'wrong' times.
For example if you use a virtual machine where the guest uses a different time zone than the host. Then you may get negative uptimes.
Or if you save the state of a VM, then the time until the reboot from such a saved state counts as uptime.

Sometimes it needs two restarts on Raspi until the wtmp log is established (which is used by "last -x"). After that it should work correctly.
Please report if you see any problem or error.

Have fun!
Attachments
OSTimeInfo_105.livecode.zip
(4.21 KiB) Downloaded 29 times
uptime.png
Uptime "xx:xx:xx days" means days:hours:minutes.
shiftLock happens

Post Reply

Return to “Raspberry Pi”