## Where communities thrive

• Join over 1.5M+ people
• Join over 100K+ communities
• Free without limits
##### 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
BeardPower
@BeardPower
@hiiamboris Red does not support floating point pairs at the moment. Changing it could affect other parts. To make sure there are no issues with floating pairs, the team needs to discuss on that first.
hiiamboris
@hiiamboris
I understand. And will be happy to participate in the discussion ☻
BeardPower
@BeardPower
Having the origin points at the center of the pixel would be actually correct, as a pixel is dimensionless and it also is a question of sub-pixel rendering,
hiiamboris
@hiiamboris
Pixel is not dimensionless. Or I didn't get your point.
BeardPower
@BeardPower
A pixel is dimensionless because it's just a basic unit. That's why there is DPI, which is the actually defines the size of a pixel.
Having the origin point at the top left corner of a pixel and rotating it would not only result in a rotation but also in a translation.
@9214

My point is that you don't need float-pairs for such things.

In such case, can you draw an equilateral triangle using 3 line commands for me, @nedzadarek ?

hiiamboris
@hiiamboris
@BeardPower prove it.
BeardPower
@BeardPower
@nedzadarek You need floating point units because of the center of the pixels.
@9214
And store your proof on blockchain.
hiiamboris
@hiiamboris
:D :D
BeardPower
@BeardPower
@hiiamboris First, you stated something first, so it's your turn ;-)
hiiamboris
@hiiamboris
@BeardPower I've proven my point above and in the ticket mentioned.
BeardPower
@BeardPower
Anyway: rotate a pixel with the origin at the top left corner -> the pixel will move.

@BeardPower > You need floating point units because of the center of the pixels.

But you said pixels are dimensionless :|

BeardPower
@BeardPower
Because there is only ONE pixel.
There is no half-pixel, quad-pixel or 2/3 pixel.
So what do you mean "center of the pixel".
BeardPower
@BeardPower
@nedzadarek Yes, but the center of the pixel is the coordinate of the pixel, not it's dimension.
@9214
Let's move it to /chit-chat perhaps, to keep @hiiamboris' proposal from floating away.
BeardPower
@BeardPower
Yeah.
@nedzadarek The coordinate of the pixel. It's sub-pixel coordinate.
@BeardPower I moved to chit-chat
BeardPower
@BeardPower
Ok.
BlairLW
@BlairLW

Hey guys, I must have missed the forest for the trees: I'm attempting to round to only two decimal places.

num1: 256
num2: 2897
num3: num1 / num2

I need num3 to be the shortened decimal places. probe round/to .. I must not understand it. Any direction or advice is appreciated. Thanks

Greg T
@gltewalt
Any idears why any github https page times out immediately for me? Win7
>> read https://github.com
*** Access Error: cannot connect: https://github.com reason: timeout
*** Stack:
BlairLW
@BlairLW
@gltewalt I'm getting an SSL error
Greg T
@gltewalt
Other https seems fine
>> read https://zipteye.imgur.com/all/
== {<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">^/<html lang="en" xmlns="htt...
Greg T
@gltewalt
>> round/to 256.0 / 2897.0 .01
== 0.09
@BlairLW You should be able to use this for round. Except for money values in the examples \$1.333. Remove dollar sign - money type isn't ready yet for Red
Gregg Irwin
@greggirwin
@BlairLW the /to help string should be pretty clear, but suggestions are welcome. It's not the number of decimal places, but more flexible.
>> n: 1234.56789
== 1234.56789
>> round/to n .001
== 1234.568
>> round/to n .01
== 1234.57
>> round/to n .02
== 1234.56
>> round/to n .125
== 1234.625
>> round/to n .25
== 1234.5
>> round/to n 2
== 1236
>> round/to n 5
== 1235
>> round/to n 10
== 1240
>> round/to n 25
== 1225
>> round/to n 100
== 1200
BlairLW
@BlairLW
for some reason I'm attempting to num3: num1 / num2 / 100 Trying different ways and coming up with weird stuff.
can't quite figure out how to convert round/to to form yet
form is giving me the problems I guess
Greg T
@gltewalt
form round/to 1234.567 .01
form converts your result to a string
Toomas Vooglaid
@toomasv
@BlairLW As / on integers is integer division, make sure to have at least one float in your formula, by e.g. 1.0 * num1 / num2
Rudolf Meijer
@meijeru
Is there interest in a division operation which always yields float?
PeterWAWood
@PeterWAWood
@meijeru It has been agreed, see #2433
BlairLW
@BlairLW
thanks for all the help so far. I have a crazy question this time. Instead of reading from top of file, can you do it from the bottom? Like a tail / head sort of thing but it loads the entire file, last line to first
Palaing
@Palaing

Trying to override the default behavior of text-list when a key is pressed, I've redefined on-key-down and on-key events:

view/tight [text-list data ["un" "deux" "trois"] on-change [] on-select [] on-key-down [print "key down"] on-key [print "key"] ]

But when I press some arrow key, the selected item still changes (and on-change and on-select get called too): which other event handler is called, and how can I stop it?

BlairLW
@BlairLW

This guy gives an example of a text editor, but I can't for the life of me get up and down arrows on the right hand side. Here is the example code, any ideas about up/down arrows?

view layout [ h1 "Text Editor:" f: field 600 "filename.txt" a: area 600x350 across btn "Load" [ f/text: request-file show f filename: to-file f/text a/text: read filename show a ] btn "Save" [ filename: to-file request-file/save/file f/text write filename a/text alert "Saved" ] ]

hiiamboris
@hiiamboris
@Palaing try adding on-detect ['stop] and setting system/view/capturing?: yes
Palaing
@Palaing
@hiiamboris Thanks. I'ts a step forward but now I can't process events anymore. What I need is would be to process them instead of (and not additionally to) the default handler that moves selection up/down when pressing arrow keys.
hiiamboris
@hiiamboris
@Palaing you can use the event and face in on-detect to do that
Palaing
@Palaing
@hiiamboris Thanks, it works with on-detect [if event/type == 'key ['stop]]. Still, I remain confused why/where there is a default handler that is not deactivated when I override the text-list's on-key: is there some kind of hidden pane in text-list, in which each item/line would have its own event handler(s) ?
hiiamboris
@hiiamboris
It's a native control. Maybe the OS does that? Can't say...