Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Oct 20 2019 22:59
    @dockimbel banned @SmackMacDougal
  • Dec 03 2017 05:53
    @PeterWAWood banned @matrixbot
  • Sep 28 2016 12:19
    @PeterWAWood banned @TimeSeriesLord
  • Aug 13 2016 03:23
    @PeterWAWood banned @Vexercizer
Incendi
@Incendi
Hi, is anyone using red 0.6.3 on Ubuntu 18.04?
Boleslav Březovský
@rebolek
@Incendi Hi, I do.
Incendi
@Incendi
Hi, I'm interested in trying a Red but have a libcurl3 dependency issue
I'm sure you had to overcome that?
Boleslav Březovský
@rebolek
@Incendi Yes (I'm on Manjaro now, I have Ubuntu on other computer that I can't access right now, so I have to help you from memory). Do you have 32bit libraries installed, right?
Incendi
@Incendi
No. I don't think so at least because when I try to apt-get install libcurl3:i386 it wants to Uninstall libcurl4 and everything that depends on that :(
Boleslav Březovský
@rebolek
IIRC, just ignore libcurl3 and install libcurl4:i386
Incendi
@Incendi
Doing it. One moment
Brilliant! The Red console is running. Just ran my first line of code in it
Boleslav Březovský
@rebolek
@Incendi :clap: Happy Reducing! If you have any questions feel free to ask!
Incendi
@Incendi
Thank you so much :)
Toomas Vooglaid
@toomasv
How to convert Windows crlf-s into Unix lf-s in a string?
Boleslav Březovský
@rebolek
you can do replace/all
on binary of course
because Red does the conversion automatically based on your platform
replace/all read/binary file crlf lf
Toomas Vooglaid
@toomasv
@rebolek Thanks! My problem is that area/selected seems not to take Win into account, so newlines are counted as two chars.
Boleslav Březovský
@rebolek
@toomasv interesting, I guess it should be reported.
BeardPower
@BeardPower
Ah, that nasty line-ending stuff. I wished there was finally some standard!
Boleslav Březovský
@rebolek
there is. and not only one, you can choose your favorite!
Boleslav Březovský
@rebolek
I don't even have to click on it :D
BeardPower
@BeardPower
Hehe ;-)
Toomas Vooglaid
@toomasv
image.png
nedzadarek
@nedzadarek

How do you deal with time-consuming computation in the gui?

make-random-image: has [img ] [
  img: make image! 200x200 
  forall img [img/1: random 255.255.255] 
  wait 2 img
]
view [i: image [i/image: make-random-image]]

Let's suppose that make-random-image just takes at least 2 seconds to compute. In those 2 seconds I'm left with unresponsive window. Is there anything I can do to make user experience better such in cases?
ps. I know about memoization and I'm not sure if I can translate this part of code to Red/System.

Boleslav Březovský
@rebolek
You can always run another process.
nedzadarek
@nedzadarek
@rebolek from within the Red? How?
Boleslav Březovský
@rebolek
@nedzadarek using call.
  1. start another process using call "red my-heavy-script.red" that will write result to some file
  2. start timer and in on-timecheck periodically if second process finished (result file exists, or something like that)
  3. if it does, stop timer, read the result and present it to the user
nedzadarek
@nedzadarek

if it does, stop timer, read the result and present it to the user

Like this: view [b: base rate 0:0:1 on-time [b/text: to-string now/time] on-up [b/rate: none]]

?
@rebolek
Boleslav Březovský
@rebolek
@nedzadarek yes, that's how you can start and stop the timer. You can put starting in on-up also.
nedzadarek
@nedzadarek
@rebolek I see, thank you.
Boleslav Březovský
@rebolek
you're welcome
Gregg Irwin
@greggirwin
On line endlings, it's tricky because using native controls likely means their data will need to be CRLF on Windows. If you just have LF, area likely won't render it correctly.
While Red is single threaded, blocking needs creative handling. For a wait of a couple seconds, I might just put up a window, like we did in the old days. I mean, how much work can the user do in 2 seconds, and how much effort or other issues might come up by letting them mess around during that time. This will hold true even once Red has concurrency.
nedzadarek
@nedzadarek
@greggirwin 2 seconds was just an example. I am creating an image. With bigger image and that that it is based on I need to compute more data.
lepinekong
@lepinekong_twitter
@toomasv I want to convert treeview to a 2-D view something like this:
https://i.imgur.com/37TOgyX.png
Is there something like collapsible panel instead of static group-box/panel ?
window: [
    title "Layout"
    size 800x800
    group-box "01-file-header" 780x50 [
        panel
    ]
    return
    group-box "02-bookmarks" 780x600 [
        panel [
            group-box "01.init-variables" 740x70 [
                panel [
                    text {.url-0: >url}
                ]
            ]
            return
            group-box "02.reload-favorites" 740x70 [
                panel [
                    text {.reload-favorites}
                ]
            ]
            return
            group-box "04.add-bookmark.sub-function" 740x70 [
                panel [
                    text {.add-readable favorites 'bookmarks reduce [>url]}
                ]
            ]
            return    
            group-box "05.either-block-url" 740x400 [
                panel [
                    group-box "true" 350x400 [
                        panel
                    ]
                    group-box "false" 350x400[
                        panel
                    ]                    
                ]
            ]                                
        ]
    ]    
]



view window
lepinekong
@lepinekong_twitter
Is there some limit in VID nested levels ? I get stackoverflow if I add an area inside the last nested groups:
https://i.imgur.com/fbFnbzk.png
Red [
    Title: ""
]

file-header: [

]

init-variables: [

]

bookmarks: [
    groupbox [
        panel init-variables
    ]
]

window: [
    title "Layout"
    size 1200x800
    group-box "01-file-header" 1000x50 [
        panel
    ]
    return
    group-box "02-bookmarks" 1150x600 [
        panel [
            group-box "01.init-variables" 740x80 [
                panel [
                    area 500x40 {.url-0: >url}
                ]
            ]
            return
            group-box "02.reload-favorites" 740x80 [
                panel [
                    area 500x40 {.reload-favorites}
                ]
            ]
            return
            group-box "04.add-bookmark.sub-function" 740x80 [
                panel [
                    area 500x40 {.add-readable favorites 'bookmarks reduce [>url]}
                ]
            ]
            return    
            group-box "05.either-block-url" 1100x400 [
                panel [
                    group-box "01.is-block.url.true" 800x400 [
                        panel [
                            group-box "01.is-category.first-word.true" 330x400 [
                                panel [
                                    area "stackoverflow !!!!!!"
                                ]
                            ]
                            group-box "01.is-category.first-word.false" 330x400 [
                                panel 
                            ]                            
                        ]
                    ]
                    group-box "01.is-block.url.false" 500x400 [
                        panel [
                            area {.add-readable favorites 'bookmarks (>url)} wrap
                        ]
                    ]                    
                ]
            ]                                
        ]
    ]    
]



view window
Gregg Irwin
@greggirwin

There is no collapsible panel style.

There is no intended limit to nesting, and I don't get the error on a local build under Win10.

lepinekong
@lepinekong_twitter
@greggirwin ok thanks, maybe it's because vscode points to this version of red, will have to change I guess:
console-2017-8-3-49893.exe Internal Error: stack overflow Where: srs Stack: view layout layout layout layout layout layout layout layout layout eval-set-path empty?
nedzadarek
@nedzadarek
@lepinekong_twitter 1) can you use tab-panel instead? 2) You can change the size / make it invisible and rearrange elements around it.
lepinekong
@lepinekong_twitter
@nedzadarek ok I didn't know tab-panel, I'll try thanks.
@greggirwin under October build, I can go further but it still crashes in the end :)
Red [
    Title: ""
]

window: [
    title "Layout"
    size 1200x800
    group-box "01-file-header" 1000x50 [
        panel
    ]
    return
    group-box "02-bookmarks" 1150x600 [
        panel [
            group-box "01.init-variables" 740x80 [
                panel [
                    area 500x40 {.url-0: >url}
                ]
            ]
            return
            group-box "02.reload-favorites" 740x80 [
                panel [
                    area 500x40 {.reload-favorites}
                ]
            ]
            return
            group-box "04.add-bookmark.sub-function" 740x80 [
                panel [
                    area 500x40 {.add-readable favorites 'bookmarks reduce [>url]}
                ]
            ]
            return    
            group-box "05.either-block-url" 1100x400 [
                panel [
                    group-box "01.is-block.url.true" 800x400 [
                        panel [
                            group-box "01.is-category.first-word.true" 430x400 [
                                panel [
                                    area wrap {favorite-bookmarks: favorites/bookmarks
existing-category: select (favorite-bookmarks) (category)}
                                    group-box "01"  [
                                        panel [
                                            area {crash under october build}
                                        ]
                                    ]
                                    group-box "02"  [

                                    ]                       
                                ]
                            ]
                            group-box "02.is-category.first-word.false" 230x400 [
                                panel [
                                    area wrap {.add-readable favorites 'bookmarks reduce [>url]}
                                ]
                            ]                            
                        ]
                    ]
                    group-box "02.is-block.url.false" 500x400 [
                        panel [
                            area wrap {.add-readable favorites 'bookmarks (>url)} wrap
                        ]
                    ]                    
                ]
            ]                                
        ]
    ]    
]



view window
lepinekong
@lepinekong_twitter
@nedzadarek I don't think tab-panel is suitable for my usecase because I want to be able to see ALL nested children at once if wanted ?
nedzadarek
@nedzadarek
@lepinekong_twitter then I guess 2), something like this:
view [
across
do [p-size: 200x100 ] 
p: panel 200x100 [base blue base red] return
t: text yellow "this should move" return
button "hide" [p/size/y: p-size/y * 20% t/offset/y: (p/offset/y + p/size/y + 10) probe t/offset] 
button "show" [p/size: p-size t/offset/y: probe ((probe p/offset/y) + p/size/y + 10) probe t/offset]
]
Gregg Irwin
@greggirwin
For usability, nesting too deep isn't good anyway. It's good to note these limits, but when you hit them, start thinking about other ways to tackle the problem.
lepinekong
@lepinekong_twitter
@greggirwin there's no usuability here it's the core purpose: this is about documenting code and see its nested children ;)
@nedzadarek thanks, interesting.