RaspberryPi Stacks
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: RaspberryPi Stacks
Raspberry Pi stacks collection #82 = fileSplitAndJoin2c.livecode
This is a file splitter and joiner.
You can split (the copy of) any file into parts of up to <splitSize> length or join such parts again.
Set input path for SPLITTING: drag a file's icon to the upper field or use btn "File to split...".
Set input paths for JOINING: drag numbered file's icons to the lower field or use btn "Files to join...".
Made especially for use with zip files for/of the LC forums (you can upload up to three files of size <= 250 KB). The upload (of parts) to the forums needs endings ".zip" (use check button). The downloader can then use this stack to join such parts again [tested with files of type .lce, .dmg, .zip, .tar and up to 2 GB length].
The stack runs on Mac/Win/Linux using LC 6/7/8/9, and on RaspberryPi using (the for Raspi available) LC 651 or LC 704.
This is a repost for version 2c.
(Through an oversight I had uploaded the 'Mac-only' first version, sorry.)
This is a file splitter and joiner.
You can split (the copy of) any file into parts of up to <splitSize> length or join such parts again.
Set input path for SPLITTING: drag a file's icon to the upper field or use btn "File to split...".
Set input paths for JOINING: drag numbered file's icons to the lower field or use btn "Files to join...".
Made especially for use with zip files for/of the LC forums (you can upload up to three files of size <= 250 KB). The upload (of parts) to the forums needs endings ".zip" (use check button). The downloader can then use this stack to join such parts again [tested with files of type .lce, .dmg, .zip, .tar and up to 2 GB length].
The stack runs on Mac/Win/Linux using LC 6/7/8/9, and on RaspberryPi using (the for Raspi available) LC 651 or LC 704.
This is a repost for version 2c.
(Through an oversight I had uploaded the 'Mac-only' first version, sorry.)
- Attachments
-
- fileSplitAndJoin2c.livecode.zip
- (6.25 KiB) Downloaded 723 times
shiftLock happens
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: RaspberryPi Stacks
Raspberry Pi stacks collection #83 = listUtility_100.livecode
ListUtility v1.0 are scripts for a list field, bundled in a self-contained group (just copy and paste it. Or use the scripts ...). I need that for lists with several hundred lines, this works here (also on Raspi) pretty fast.
The list field is set to have non-contigous multiple selection available.
Building contiguous or systematic ranges of numbers.
This is very simple, but (thanks LC) rather powerful.
Recall that for "step" in the repeat fractions (like 1/3, 7/8) and non-integers (like 0.25, 2.5) are also allowed!
The stack runs on Mac/Win/Linux using LC 6/7/8/9, and on RaspberryPi using (the for Raspi available) LC 651 or LC 704.
ListUtility v1.0 are scripts for a list field, bundled in a self-contained group (just copy and paste it. Or use the scripts ...). I need that for lists with several hundred lines, this works here (also on Raspi) pretty fast.
The list field is set to have non-contigous multiple selection available.
- Reorder the list by dragging one line or (may be non-contiguous) blocks of lines.
Reordering is either slow and repeating every second or fast by using shiftKey. - Reorder the list using buttons. Move one line or (may be non-contiguous) blocks of lines.
Reordering is either fast by using shiftKey or slow and repeating every second. - Populate the list with filePaths (default) or the contents of a file.
Use buttons for that or dragAndDrop to the field. - Remove duplicate entries from the list, choose case-sensitivity for that.
- Sort the list by several criteria (also by foundLines).
- From a search field search case-sensitive a string and highlite the found locations in the list. Search is triggered either by EnterKey/ReturnKey or after every keyUp.
Building contiguous or systematic ranges of numbers.
This is very simple, but (thanks LC) rather powerful.
Code: Select all
-- numbers from n1 to n2 step stp, delimited with (string) dlmtr
-- and prefix pfx and suffix sfx, numberformat as given in nbf
function uRange n1,n2,stp,dlmtr,nbf,pfx,sfx
if stp is empty then put 1 into stp
if 0 < (n1-n2)*stp then return empty
if dlmtr is empty then put cr into dlmtr #<-- cr
if nbf is not empty then set numberformat to nbf
repeat with i=n1 to n2-stp/2 step stp
put dlmtr & pfx & i & sfx after s
end repeat
return char 1+length(dlmtr) to -1 of s
end uRange
Code: Select all
-- short version for comma-delimited lists
function listRange n1,n2,stp
if stp is empty then put 1 into stp
if 0 < (n1-n2)*stp then return empty
repeat with i=n1 to n2-stp/2 step stp
put comma & i after s
end repeat
return char 2 to -1 of s
end listRange
- Attachments
-
- listUtility_100.livecode.zip
- Was erraneously a beta version. Is now latest version v1.0
- (12.51 KiB) Downloaded 746 times
shiftLock happens
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: RaspberryPi Stacks
Raspberry Pi stacks collection #84 = convexHull.livecode
The Convex hull of a set of points is the smallest convex set containing the set (non-math: A rubber band around all points, as tight as possible). For a finite set of points the hull is a polygon using a subset of the points.
The computation of such a polygon is non-trivial. There are several algorithms, see for a good overview
https://en.wikipedia.org/wiki/Convex_hull_algorithms .
This here is an implementation of Andrew's monotone chain algorithm, see link in the script of "ConvexHull".
Some hints.
The stack runs on Mac/Win/Linux using LC 6/7/8/9, and on RaspberryPi using (the for Raspi available) LC 651 or LC 704.
The Convex hull of a set of points is the smallest convex set containing the set (non-math: A rubber band around all points, as tight as possible). For a finite set of points the hull is a polygon using a subset of the points.
The computation of such a polygon is non-trivial. There are several algorithms, see for a good overview
https://en.wikipedia.org/wiki/Convex_hull_algorithms .
This here is an implementation of Andrew's monotone chain algorithm, see link in the script of "ConvexHull".
Some hints.
- You may use as input random points (check button at top left) or use by the button at top right a file containg lines of points.
- You may use the shiftKey (selects contiguous) or the cmd-/ctrlKey (selects non-contiguous) for choosing a subset of points in the input field (most right). If you then choose "Use selection" at bottom right, only this subset is used for computing the convex hull.
- If you use it for a set of controls then simply add all 'extremal points' of each objects to the list of points, e.g. topleft, topright, bottomright and bottomleft of a rectangle.
The stack runs on Mac/Win/Linux using LC 6/7/8/9, and on RaspberryPi using (the for Raspi available) LC 651 or LC 704.
- Attachments
-
- convexHull.livecode.zip
- stackfileversion of the zipped stack is 5.5
- (6.31 KiB) Downloaded 730 times
shiftLock happens
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: RaspberryPi Stacks
Raspberry Pi stacks collection #85 = perspective67.livecode
Update 2017-03-12 ... Improved speed by 20% (and new layout helpers for the distortion).
Update 2017-01-10 ... Added Bernd Niggemann's (bn) antialiasing technique. Thanks Bernd!
Perspective Image Distortion = LC-Magick #4
[Nov 2016] This is my early X-mas gift to the community (if you are not religious take it as new year's gift). It's a gift because I needed a few hours of concentrated work on several days for the final result, a lot of 'deep thoughts' wasted for that .
The main code is finally only at about 100 lines and is based on ideas presented on imageMagick's distortion page (thanks to Anthony Thyssen):
This is the LiveCode implementation of the (quadrilateral) perspective distortion technique.
For each new 'distortion' the algorithm has to build and solve a system of 8 linear equations for 8 parameters. These are then used to 'reverse lookup' for each target pixel appropriate pixels in the source image --- a technique that ensures that there are no 'missing' pixels in the target distortion.
The result is surprising. I never thought this could be made fast enough for the LC IDE. But:
Using LC 6 (which is up to 3 times faster than LC 7/8/9 with this technique) we have on RaspberryPi 2/3 computing times around 1 second for a medium sized (distorted) target image, acceptable as I find.
The stack has because of included "Test"-images a size that is not acceptable in the forum. So it is available : (sorry, currently not available)
The stack runs on Mac/Win/Linux using LC 6/7/8/9, and on RaspberryPi using (the for Raspi available) LC 651 or LC 704.
Update 2017-03-12 ... Improved speed by 20% (and new layout helpers for the distortion).
Update 2017-01-10 ... Added Bernd Niggemann's (bn) antialiasing technique. Thanks Bernd!
Perspective Image Distortion = LC-Magick #4
[Nov 2016] This is my early X-mas gift to the community (if you are not religious take it as new year's gift). It's a gift because I needed a few hours of concentrated work on several days for the final result, a lot of 'deep thoughts' wasted for that .
The main code is finally only at about 100 lines and is based on ideas presented on imageMagick's distortion page (thanks to Anthony Thyssen):
This is the LiveCode implementation of the (quadrilateral) perspective distortion technique.
For each new 'distortion' the algorithm has to build and solve a system of 8 linear equations for 8 parameters. These are then used to 'reverse lookup' for each target pixel appropriate pixels in the source image --- a technique that ensures that there are no 'missing' pixels in the target distortion.
The result is surprising. I never thought this could be made fast enough for the LC IDE. But:
Using LC 6 (which is up to 3 times faster than LC 7/8/9 with this technique) we have on RaspberryPi 2/3 computing times around 1 second for a medium sized (distorted) target image, acceptable as I find.
The stack has because of included "Test"-images a size that is not acceptable in the forum. So it is available : (sorry, currently not available)
The stack runs on Mac/Win/Linux using LC 6/7/8/9, and on RaspberryPi using (the for Raspi available) LC 651 or LC 704.
- Attachments
-
- Distorted 310x350 image, needs 450 ms on Mac mini 2.5GHz using LC 6.7.11.
Uses antialiased border. - antialiasedDistortion.png (108.13 KiB) Viewed 27820 times
- Distorted 310x350 image, needs 450 ms on Mac mini 2.5GHz using LC 6.7.11.
-
- Distorted 310x350 image, needs 280 ms on Mac mini 2.5GHz using LC 6.7.11.
- perspective.png (38.97 KiB) Viewed 28208 times
Last edited by [-hh] on Thu Dec 12, 2019 12:00 am, edited 7 times in total.
shiftLock happens
Re: RaspberryPi Stacks
Wow, that's another brilliant piece of work Hermann, vielen Dank!
Re: RaspberryPi Stacks
Amazing work, Hermann!
Many Thanks for sharing all these Math Gems.
How about this for a new challenge?
https://www.willmcgugan.com/blog/tech/p ... -and-html/
Alejandro
Many Thanks for sharing all these Math Gems.
How about this for a new challenge?
https://www.willmcgugan.com/blog/tech/p ... -and-html/
Alejandro
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: RaspberryPi Stacks
Raspberry Pi stacks collection #86 = jigsawPuzzle2d.livecode
(Updated on Dec 30, 2018 to JigsawPuzzle2d_v115)
Technique used: The pieces are polygon graphics of linear and cubic bezier curves. They are filled with backpattern-images from portions of the whole imagedata. Highlighting is done by setting the ink, shaping the pieces includes random parts: Top and left are adjusted to fit the upper and left neighbour, right and bottom have at random "in" or "out" connectors.
You may
** choose a built-in image or import one.
** choose the width of the basic square of all pieces. This determines the number of pieces. If the image has not appropriate size then it is cropped (the imagedata only).
** choose to allow rotation of the pieces
** choose to collect the 'border' pieces at card's bottomRight.
** choose to indicate a correct location by highlighting the currently dragged piece.
The stack has a size that is not acceptable in the forum. So it is available: (sorry, currently not available)
The stack runs on Mac/Win/Linux using LC 6/7/8/9, and on RaspberryPi using (the for Raspi available) LC 651 or LC 704.
As always the scripts are free for non-commercial use only.
(Updated on Dec 30, 2018 to JigsawPuzzle2d_v115)
Technique used: The pieces are polygon graphics of linear and cubic bezier curves. They are filled with backpattern-images from portions of the whole imagedata. Highlighting is done by setting the ink, shaping the pieces includes random parts: Top and left are adjusted to fit the upper and left neighbour, right and bottom have at random "in" or "out" connectors.
You may
** choose a built-in image or import one.
** choose the width of the basic square of all pieces. This determines the number of pieces. If the image has not appropriate size then it is cropped (the imagedata only).
** choose to allow rotation of the pieces
** choose to collect the 'border' pieces at card's bottomRight.
** choose to indicate a correct location by highlighting the currently dragged piece.
The stack has a size that is not acceptable in the forum. So it is available: (sorry, currently not available)
The stack runs on Mac/Win/Linux using LC 6/7/8/9, and on RaspberryPi using (the for Raspi available) LC 651 or LC 704.
As always the scripts are free for non-commercial use only.
- Attachments
-
- jigsawPuzzle.png (146.63 KiB) Viewed 27967 times
Last edited by [-hh] on Wed Dec 11, 2019 11:59 pm, edited 3 times in total.
shiftLock happens
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: RaspberryPi Stacks
Raspberry Pi stacks collection #87 = circularDistortionV300.livecode
Updated to v3.0.0 on 2017-01-20 ... Improved antialiasing, first common version
Circular (Polar) Image Distortion = LC-Magick #5 (Jan 2017)
By Hermann Hoch and Bernd Niggemann
This is the LiveCode implementation of the well known polar-plot-technique.
For each new 'distortion' the algorithm computes the polar coords of the target and looks up the pixel data at the corresponding cartesian coords of the source image.
The main code is only at about 80 lines and is once again based on ideas presented on imageMagick's distortion page (thanks to Anthony Thyssen).
You can have circular arcs up to a full circle, filled between an inner and outer radius. Optionally the imagedata can be flipped or mirrored at midth.
Once again, the result is surprisingly fast if the targeted object is not too large, say diameter < 500 px. I did several optimization loops for speed. Using LC 6 (which is 2-3 times faster than LC 7/8/9 with this technique) we have on RaspberryPi 2/3 computing times around 1-2 seconds for a medium sized (distorted) target image, acceptable for me.
The stack has a size that is not acceptable in the forum. So it is available: (sorry, currently not available)
The stack has help, the main script is commented.
You can import source images, export/copy target images or use a text field as input.
The stack runs on Mac/Win/Linux using LC 6/7/8/9, and on RaspberryPi using (the for Raspi available) LC 651 or LC 704. On Raspi use LC 651 for increasing speed!
Updated to v3.0.0 on 2017-01-20 ... Improved antialiasing, first common version
Circular (Polar) Image Distortion = LC-Magick #5 (Jan 2017)
By Hermann Hoch and Bernd Niggemann
This is the LiveCode implementation of the well known polar-plot-technique.
For each new 'distortion' the algorithm computes the polar coords of the target and looks up the pixel data at the corresponding cartesian coords of the source image.
The main code is only at about 80 lines and is once again based on ideas presented on imageMagick's distortion page (thanks to Anthony Thyssen).
You can have circular arcs up to a full circle, filled between an inner and outer radius. Optionally the imagedata can be flipped or mirrored at midth.
Once again, the result is surprisingly fast if the targeted object is not too large, say diameter < 500 px. I did several optimization loops for speed. Using LC 6 (which is 2-3 times faster than LC 7/8/9 with this technique) we have on RaspberryPi 2/3 computing times around 1-2 seconds for a medium sized (distorted) target image, acceptable for me.
The stack has a size that is not acceptable in the forum. So it is available: (sorry, currently not available)
The stack has help, the main script is commented.
You can import source images, export/copy target images or use a text field as input.
The stack runs on Mac/Win/Linux using LC 6/7/8/9, and on RaspberryPi using (the for Raspi available) LC 651 or LC 704. On Raspi use LC 651 for increasing speed!
- Attachments
Last edited by [-hh] on Wed Dec 11, 2019 11:58 pm, edited 2 times in total.
shiftLock happens
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: RaspberryPi Stacks
Raspberry Pi stacks collection #88 = recentStackFiles.livecode
This is a simple utility stack for managing the contents of the menu item
File / Open recent File
of LiveCode 6/7/8/9. You can
If one is working with different projects one can have by that easily a different menu of "recent files" for each project.
The stack runs on Mac/Win/Linux using LC 6/7/8/9, and on RaspberryPi using (the for Raspi available) LC 651 or LC 704.
This is a simple utility stack for managing the contents of the menu item
File / Open recent File
of LiveCode 6/7/8/9. You can
- delete or add all entries,
- delete or add single entries,
- export the current list to a text file,
- import a text file of stack paths and
add to or replace the current list of entries with it. - remove duplicate entries or at that path no longer-existing files,
- use the current work list as launcher for a stack by rightClicking a path line.
If one is working with different projects one can have by that easily a different menu of "recent files" for each project.
The stack runs on Mac/Win/Linux using LC 6/7/8/9, and on RaspberryPi using (the for Raspi available) LC 651 or LC 704.
- Attachments
-
- RecentStackFiles.livecode.zip
- (3.53 KiB) Downloaded 693 times
Last edited by [-hh] on Mon Jan 16, 2017 5:16 am, edited 1 time in total.
shiftLock happens
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: RaspberryPi Stacks
Raspberry Pi stacks collection #89 = SEhelper1b.livecode(*)
(May 16, 2917: Added "Theme switcher" part only as SELights.livecode)
This is a simple utility for helping to work with the script editor:
The theme is reset by LC itself to "Light" with every startup of it.
For optional use is also included
You can drag the window around by grabbing it near it's border.
You may use the stack as ordinary stack (as it is), use it as plugin or simply use the scripts.
The stack runs on Mac/Win/Linux using LC 6/7/8/9, and on RaspberryPi using (the for Raspi available) LC 651 or LC 704.
---
(*) Update to version 1b: Improved 'balanced' selection of content between pairs.
(May 16, 2917: Added "Theme switcher" part only as SELights.livecode)
This is a simple utility for helping to work with the script editor:
- A dark/light colour-theme switcher.
Of course, the scripteditor has to be open for this one-click solution to work.
This simply "inverts" your current settings from the preferences by setting the ink.
All tabs of one editor window have the same theme, different editor windows can have different ink.
LC resets to your (preferred) 'light theme' on every startup.
The script for this button only I posted here: http://forums.livecode.com/viewtopic.ph ... 26#p150426 - A marks menu, that jumps to special comments (marks).
A mark is a (possibly indented) line that starts with any of
'--:M ' or '--:M ' or '#:M '
that is: commentChar(s) &colon& "M" & space
You write marks into your script and it does nothing than commenting if not read only and evaluated by the "Marks" button.
This works also with "dirty" (i.e. unsaved) scripts.
The theme is reset by LC itself to "Light" with every startup of it.
For optional use is also included
- A "pairs"-balancer for the currently edited script, that searches for the next unmatched opening to the left and for the next unmatched closing part of the pair to the right. This works also with "dirty" (i.e. unsaved) scripts.
- A field for 'quoting/unquoting' several lines of code that may contain quotes.
You can drag the window around by grabbing it near it's border.
You may use the stack as ordinary stack (as it is), use it as plugin or simply use the scripts.
The stack runs on Mac/Win/Linux using LC 6/7/8/9, and on RaspberryPi using (the for Raspi available) LC 651 or LC 704.
---
(*) Update to version 1b: Improved 'balanced' selection of content between pairs.
- Attachments
-
- (upper part) The dark variant of the default colorization.
(lower part) The three size states of the helper. - SEHelper.png (24.33 KiB) Viewed 26671 times
- (upper part) The dark variant of the default colorization.
-
- SELights.livecode.zip
- Dark/Light-Theme switcher only (by setting blend modes)
Respects your preferences settings for the light theme. - (1.92 KiB) Downloaded 634 times
-
- SEhelper1b.livecode.zip
- The stack, v1b as of Jan 23, 2017
(replace there "notSrcCopy" by "blendDifference") - (5.36 KiB) Downloaded 700 times
Last edited by [-hh] on Tue May 16, 2017 3:56 pm, edited 4 times in total.
shiftLock happens
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: RaspberryPi Stacks
Raspberry Pi stacks collection #90 = BilinearPerspective141.livecode
[Version 1.4.1 of Feb 1, 2017 -- avoid now linux ink-bug]
Bilinear (quadrilateral) Image Distortion = LC-Magick #6
[By Hermann Hoch and Bernd Niggemann]
This is the LiveCode implementation of the well known bilinear distortion technique.
For each new 'distortion' the algorithm solves 8 linear equations and looks up the pixel data at the corresponding coords of the source image. The 'core' code is only at about 110 lines. Based on the description here: http://www.imagemagick.org/Usage/distorts/
* Drag the handles of the 'distortion-generating' polygon.
* Use the 'helper' buttons for flipping the image or mirroring the polygon
* Inflate or deflate the 'distortion-generating' polygon ('zoom').
* Antialias or and/or frame the distorted result.
* Copy the result or save it to a file.
* Use a text field for input, to generate distorted 'banners'.
* Use the images menu for testing with some examples.
* Import your own images into the example images menu.
The stack has help. Parts of the main scripts are commented.
Once again, the result is surprisingly fast if the targeted object is not too large. Using LC 6 (which is 2-3 times faster than LC 7/8/9 with this technique) we have on RaspberryPi 2/3 computing times around 1-2 seconds for a medium sized distorted target image, acceptable for me. (Antialiasing may double these times -- beauty has its price.)
The stack has a size that is not acceptable in the forum. So it is available: (sorry, currently not available)
The stack runs on Mac/Win/Linux using LC 6/7/8/9, and on RaspberryPi using (the for Raspi available) LC 651 or LC 704.
[Version 1.4.1 of Feb 1, 2017 -- avoid now linux ink-bug]
Bilinear (quadrilateral) Image Distortion = LC-Magick #6
[By Hermann Hoch and Bernd Niggemann]
This is the LiveCode implementation of the well known bilinear distortion technique.
For each new 'distortion' the algorithm solves 8 linear equations and looks up the pixel data at the corresponding coords of the source image. The 'core' code is only at about 110 lines. Based on the description here: http://www.imagemagick.org/Usage/distorts/
* Drag the handles of the 'distortion-generating' polygon.
* Use the 'helper' buttons for flipping the image or mirroring the polygon
* Inflate or deflate the 'distortion-generating' polygon ('zoom').
* Antialias or and/or frame the distorted result.
* Copy the result or save it to a file.
* Use a text field for input, to generate distorted 'banners'.
* Use the images menu for testing with some examples.
* Import your own images into the example images menu.
The stack has help. Parts of the main scripts are commented.
Once again, the result is surprisingly fast if the targeted object is not too large. Using LC 6 (which is 2-3 times faster than LC 7/8/9 with this technique) we have on RaspberryPi 2/3 computing times around 1-2 seconds for a medium sized distorted target image, acceptable for me. (Antialiasing may double these times -- beauty has its price.)
The stack has a size that is not acceptable in the forum. So it is available: (sorry, currently not available)
The stack runs on Mac/Win/Linux using LC 6/7/8/9, and on RaspberryPi using (the for Raspi available) LC 651 or LC 704.
- Attachments
Last edited by [-hh] on Wed Dec 11, 2019 11:58 pm, edited 1 time in total.
shiftLock happens
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: RaspberryPi Stacks
Raspberry Pi stacks collection #91 = BeautifyScriptInField_103.livecode
This is a simple utility for helping to work with script formatting.
'Beautify' formats any *text selection* of a field (or the whole filed) by calling handlers of LC's script editor. Thus the indentation and colorisation is the same as if you had done this, using your SE prefs, in the script editor and then copied as styled text to a field.
The stack is complementary to well known SE helper stacks of Max V. and Paul H.
(see 'Sample stacks' or livecodeshare.runrev.com).
The stack uses a switch for versions LC 6/7 and LC 8/9. It runs fine in LC 6/8/9, formatting is very slow in LC 7.
The script works on Mac/Win/Linux using LC 6/7/8/9, and on RaspberryPi using (the for Raspi available) LC 651 or LC 704.
Differences between v 1.0.3b and 1.0.3d are only in ink settings (needed for latest LC 9.0.0)
This is a simple utility for helping to work with script formatting.
'Beautify' formats any *text selection* of a field (or the whole filed) by calling handlers of LC's script editor. Thus the indentation and colorisation is the same as if you had done this, using your SE prefs, in the script editor and then copied as styled text to a field.
- Beautify
Indents and colorizes the current selection or, if nothing is selected, the whole field. If you choose to use your SE prefs, the result is identical to doing this 'manually' in SE. - Line Numbers
Add line numbers to a selection or, if nothing is selected, to the whole field (this is NOT a separate numbering, it inserts numbers). Vice versa remove all integers which are word 1 of a line (fragile, of course). - LightsOff
Uses a dark theme (reverses your SE clorization prefs) for the card.
The stack is complementary to well known SE helper stacks of Max V. and Paul H.
(see 'Sample stacks' or livecodeshare.runrev.com).
The stack uses a switch for versions LC 6/7 and LC 8/9. It runs fine in LC 6/8/9, formatting is very slow in LC 7.
The script works on Mac/Win/Linux using LC 6/7/8/9, and on RaspberryPi using (the for Raspi available) LC 651 or LC 704.
Differences between v 1.0.3b and 1.0.3d are only in ink settings (needed for latest LC 9.0.0)
- Attachments
-
- BeautifyScriptInField103d.livecode.zip
- Aug 16, 2017: Update for reduced ink set of LC 9
Usable with LC 6.7.11/7.1.4/8.1.2 and later/9.0.0 and later - (21.8 KiB) Downloaded 529 times
-
- BeautifyScriptInField_103b.livecode.zip
- (v103b works around a lock-cursor-bug)
Usable with LC 6/7/8 only - (8.37 KiB) Downloaded 660 times
-
- At bottom a selection in a field, in midth the 'beautified' selection,
at top added moreover line numbers. - beautify.png (17.81 KiB) Viewed 27446 times
- At bottom a selection in a field, in midth the 'beautified' selection,
Last edited by [-hh] on Mon Dec 31, 2018 12:24 pm, edited 2 times in total.
shiftLock happens
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: RaspberryPi Stacks
Raspberry Pi stacks collection #92 = FuzzySearch.livecode
(current version 1.0.6 as of Mar 10, 2017)
FUZZY SEARCH finds approximations to your search string in a given list of 'keywords'. You select the 'fuzziness' of the approximations. The demo lookup list of the stack are the 3233 keywords of LCScript (LC 8 dict).
Definition.
The _first_ char of your search string is optionally handled as _correct_ if button "first" is checked (increases speed).
Your search string (optionally past char one) will be changed in order to find matches to keywords by:
Examples.
_________
Hey Simon, now you can look up "teh" in the keywords of LCScript
http://forums.livecode.com/viewtopic.ph ... 93#p140093
____________________
v1.0.6 ... Mar 10, 2017
improved speed, removed a small bug, and (for Raspi) display of scrollbars.
(current version 1.0.6 as of Mar 10, 2017)
FUZZY SEARCH finds approximations to your search string in a given list of 'keywords'. You select the 'fuzziness' of the approximations. The demo lookup list of the stack are the 3233 keywords of LCScript (LC 8 dict).
Definition.
- 'Keyword' = word 1 of a line of your lookup string if the search string is one word.
- 'Keyword' = a line of your lookup string if the search string has more than one words.
The _first_ char of your search string is optionally handled as _correct_ if button "first" is checked (increases speed).
Your search string (optionally past char one) will be changed in order to find matches to keywords by:
- D = Deletion of one char,
- I = Insertion of one char,
- S = Substitution of one char,
- T = Transposition (Swap) of two adjacent chars.
Examples.
- A score of 0 is an exact match of the search string to word 1 of one of the keyword lines.
- search 'teh' has a minimal score of 1 compared to 'ten' (S) or to 'the' (T).
- search 'tehrr' has a minimal score of 2 compared to (word 1 of) 'there is a' (TS) or to (word 1 of) 'there is no' (TS).
- search 'frost' has a score of minimal 1 compared to 'front' (S) and of 2 compared to 'first' (ST) or 'font' (DS) or 'from' (SD).
- Absolute Fuzziness
limits the absolute score of penalty points. - Percentage Fuzziness
compares the percentage amount of fuzziness to the maximum of search string's length and keyword line's length. The slider sets an upper limit for that comparison.
- Choose a dark or light theme for the whole card (by setting the group's ink).
- Drag the stack window by grabbing an unused pixel near its border.
- Go to a path item of the full stack path (small square at top left).
- Type (fast) with the mouse over the the keywords field (so that it has focus) to select the first match to your typing.
_________
Hey Simon, now you can look up "teh" in the keywords of LCScript
http://forums.livecode.com/viewtopic.ph ... 93#p140093
____________________
v1.0.6 ... Mar 10, 2017
improved speed, removed a small bug, and (for Raspi) display of scrollbars.
- Attachments
-
- fuzzySearch106.livecode.zip
- (36.26 KiB) Downloaded 665 times
Last edited by [-hh] on Fri Mar 10, 2017 7:00 pm, edited 3 times in total.
shiftLock happens
-
- VIP Livecode Opensource Backer
- Posts: 3901
- Joined: Sat Mar 24, 2007 2:54 am
- Location: Palo Alto
Re: RaspberryPi Stacks
Thanks -hh
Simon
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: RaspberryPi Stacks
Raspberry Pi stacks collection #93 = DePerspective.livecode
(current version 1.0.1 of Mar 10, 2017)
DePerspective/Undistort (quadrilateral) distortion
This is the inverse operation of the (quadrilateral/fourpoint) perspective distortion. It removes such a distortion from an image (includes 'unskew' and 'unrotate'). More exactly: It tries to remove such a distortion using your manual guidance.
You choose EditMode and drag one of the four handles to indicate the distortion.
Actions to PREPARE the first result are
The stack runs on Mac/Win/Linux using LC 6/7/8/9, and on RaspberryPi using (the for Raspi available) LC 651 or LC 704.
(current version 1.0.1 of Mar 10, 2017)
DePerspective/Undistort (quadrilateral) distortion
This is the inverse operation of the (quadrilateral/fourpoint) perspective distortion. It removes such a distortion from an image (includes 'unskew' and 'unrotate'). More exactly: It tries to remove such a distortion using your manual guidance.
You choose EditMode and drag one of the four handles to indicate the distortion.
Actions to PREPARE the first result are
-
maxW or maxH
choose the length of the longer 'horizontal' side of the distortion as width or, respectively, the length of the longer 'vertical' side of the distortion as height of the 'undistorted' rectangle. - Origin
moves the origin of the polygon when selecting the distortion. You may use also the arrowkeys for that. - Source
shows the distorted input for comparison. - EditMode
shows/ hides the distortion selecting polygon - Images Menu
- Use the images menu for testing some examples. Use "IMPORT..." to import your own images or paste an image. Then use the menu again.
- CmdSelect or CtrlSelect an image name from the menu to delete the image (after a dialog).
- The relativePoints
of the distorting polygon are shown for "fine-tuning" the location of the four handles. Just edit a coordinate and hit Enter or use button "GO". - Memory Slots 1-6
ShiftClick "M" (at the left half of a button) to memorize the points of the selection polygon together with the image's name. The image's name is then shown as tooltip. Click at "R" (at the right half of a button) to recall the memory: Shows the image and the selection polygon. - GO
does the job, using the region selected by the polygin, with a result that you hopefully can use.
- Crop
crops inwards (removing pixels) or outwards (adding transparency) the result. - Width and Height
change the width and/or the height of the result, respecting a chosen relation. - LowerThreshold
sets the "black-limit"for the average color of a pixel. Below that limit the pixel becomes black. - UpperThreshold
sets the "white-limit"for the average color of a pixel. Above that limit the pixel becomes white. - Angle
rotates the result by multiples of 90 degrees. - Tesseract
If you have installed the open source OCR utility tesseract, then it is called with your result as input. See the script of the button for parameter settings for the 'SerialNumber'-example.
The stack runs on Mac/Win/Linux using LC 6/7/8/9, and on RaspberryPi using (the for Raspi available) LC 651 or LC 704.
- Attachments
-
- Step 4: Output from Tesseract on Mac.
Summary: Manual adjustments using trial and error -- NO AUTOMATIC. - serialNum_tess31_90.png (19.98 KiB) Viewed 27239 times
- Step 4: Output from Tesseract on Mac.
Last edited by [-hh] on Wed Dec 11, 2019 11:57 pm, edited 3 times in total.
shiftLock happens