Giveaway winner

Sep. 23rd, 2017 03:29 pm
[syndicated profile] forgotten_bookmarks_feed
This week's giveaway winner was @Lovely_Lady_Bee, who entered on Twitter.

Thanks to all who entered, see you here next week.
james_davis_nicoll: (Default)
[personal profile] james_davis_nicoll
Which is creating the Amazon and Chapters links for the book being review, I know one particular book is $19.19 if you buy it from Kobo and $11.71 from Kindle....
[syndicated profile] rebol_questions_feed

Posted by rnso

I want to convert many decimal numbers available as strings to floats in one go. I am trying following code which combines these strings into a series and then convert them to floats. This works all right but fails if there is an error:

a: "1.5" 
b: ""
c: "3.7"
invars: [a b c]

print a
print type? a

set invars foreach x invars [append [] to-float reduce x]  ; code to convert string series to float series; 

print a
print type? a

The error is:

*** Script Error: cannot MAKE/TO float! from: ""
*** Where: to
*** Stack: to-float 

For error correction, I tried following code:

temp: []
foreach x invars [
    y: copy ""
    either error? [set [y] to-float reduce x]
        [append temp reduce x]         ; put original value if not convertable
        [append temp reduce y]  ]
print temp 
set invars temp
print a 
print type? a

But this is also not working. Where is the problem and how can this be corrected?

Comic for September 23, 2017

Sep. 23rd, 2017 11:59 pm
[syndicated profile] dilbert_feed
Dilbert readers - Please visit Dilbert.com to read this feature. Due to changes with our feeds, we are now making this RSS feed a link to Dilbert.com.
[syndicated profile] rebol_questions_feed

Posted by rnso

I want to alter a series of variables from a loop, but the following code is not working:

a: 10
b: 20
c: 30
print reduce [a b c]              ; output is 10 20 30 as expected

varnames: [a b c]                 ; make a series of variables
foreach i varnames [              ; loop to convert each to 0
    i: 0
]

print "After conversion loop: "
print reduce [a b c]              ; values are still 10 20 30 (expected 0 0 0)

After running this code, I'd expect the values of a, b, c to be changed, but they're not:

>> print reduce [a b c]   
10 20 30

Where is the problem?

andrewducker: (Default)
[personal profile] andrewducker
Jane and I went up to Nethy Bridge, near Aviemore, and stayed at the Lazy Duck in one of their Eco-Lodges. Which is a cabin built for two, with electricity, gas cooking, and (distant, wobbly) wifi, right next to a large duck pond full of a variety of different species of ducks.
Loads of photos and four videos )

Interesting Links for 22-09-2017

Sep. 22nd, 2017 12:00 pm
andrewducker: (Default)
[personal profile] andrewducker
[syndicated profile] rebol_questions_feed

Posted by rnso

I want to get values from 2 series into one but it is not working:

I have 2 series:

a: [1 2 3]
b: [4 5 6 7]

I want to get all values in one list, so that I can access them as allv/1, allv/2... allv/7.

Following is not working since it makes a series of series and not series of values:

allv:  [a b]
print allv     ; => prints all 6 values, but following do not work: 
print allv/1   ; => gives a  (desired is 1)
print allv/2   ; => gives b  (desired is 2)
print allv/3   ; => gives none (desired is 3)

I tried following function to combine values in one series:

mycombine: function [ll][
    temp: []
    foreach l ll [
        repeat i length? l [
            temp: append temp l/:i ] ]
    temp]

mycombine [a b]

But above gives error:

*** Script Error: length? does not allow word! for its series argument
*** Where: length?
*** Stack: rncombine 

The series has got converted into word and is not working.

How can I solve this?

Comic for September 22, 2017

Sep. 22nd, 2017 11:59 pm
[syndicated profile] dilbert_feed
Dilbert readers - Please visit Dilbert.com to read this feature. Due to changes with our feeds, we are now making this RSS feed a link to Dilbert.com.

iPods

Sep. 21st, 2017 10:53 pm
james_davis_nicoll: (Default)
[personal profile] james_davis_nicoll
Haven't been around long enough for an adult to reference the technology as something around when they were kids. That's just crazy talk -- 16 years ago, you say?
[syndicated profile] rebol_questions_feed

Posted by rnso

I have strings in a namelist, that correspond to variables as well as field names in the application.

The function should read strings from namelist, add an 'f' to get field_names, and then put variable values in corresponding fields.

I tried following code, that does not give any error, but also does not work:

namelist: ["var1" "var2"]
var1: 5
var2: 10

process: [
    repeat i length? namelist [
        (to-set-path compose rejoin [namelist/:i "f/text"] (to-word namelist/:i))
    ]
]

lay: layout [ 
    text "Values to appear here: "
    var1f: field "a"
    var2f: field "b"

    button "Click" [do process]
]

view lay

Locked

Sep. 21st, 2017 03:02 pm
[syndicated profile] forgotten_bookmarks_feed
Key.

Found in "The Path of Thunder" by Peter Abrahams. Published by Harper, 1948.


-Click to enlarge photos-

Comic for September 21, 2017

Sep. 21st, 2017 11:59 pm
[syndicated profile] dilbert_feed
Dilbert readers - Please visit Dilbert.com to read this feature. Due to changes with our feeds, we are now making this RSS feed a link to Dilbert.com.
[syndicated profile] rebol_questions_feed

Posted by rnso

I want to remove all characters in a string except:

  • - or _ or .
  • A thru Z
  • a thru z
  • 0 to 9
  • space

On linux command line, using sed I would do this:

$ echo "testing-#$% yes.no" | sed 's/[^-_.a-zA-Z0-9 ]//g'

Output:

testing- yes.no

How can I achieve the same effect in Red language with PARSE? I looked at:

However, I could not codify it. I tried:

>> parse "mystring%^&" [#a - #z #A - #Z #0 - #9]
== false
>> parse "mystring%^&" [#a-#z#A-#Z#0-#9]        
== false

Not Forgotten Part XIII

Sep. 20th, 2017 05:15 pm
[syndicated profile] forgotten_bookmarks_feed
Yet another installment! Here are parts one, twothreefourfivesix, seveneightnine, teneleven and twelve of this ongoing series where I feature some of the items I find that aren't quite good enough for their own post. Enjoy!






-Click to enlarge photos-
[syndicated profile] rebol_questions_feed

Posted by rnso

I am trying following code to read values from a list to be put into field elements which are also placed in another list:

Red [needs: view]

view [
    text "N1:"
    ff: field ""
    text "N2:"
    gg: field ""

    do [fldlist: [ff gg] 
        vv: 5  ww: 10
        varlist: [vv ww]   ]

    button "Click" [
        repeat i (length? varlist) 
            [to-set-path to-word fldlist/i/text:  varlist/:i]  ] ]

However, it is not working. The error is:

*** Script Error: path fldlist/i/text: is not valid for none! type
*** Where: set-path
*** Stack: view do-events do-actor do-safe to-set-path to-word 

I also tried :i (i) and (:i) instead of just i but it is not working. Where is the problem and how can it be solved? Thanks for your help.

Interesting Links for 20-09-2017

Sep. 20th, 2017 12:00 pm

Comic for September 20, 2017

Sep. 20th, 2017 11:59 pm
[syndicated profile] dilbert_feed
Dilbert readers - Please visit Dilbert.com to read this feature. Due to changes with our feeds, we are now making this RSS feed a link to Dilbert.com.

Interesting Links for 19-09-2017

Sep. 19th, 2017 12:00 pm

Comic for September 19, 2017

Sep. 19th, 2017 11:59 pm
[syndicated profile] dilbert_feed
Dilbert readers - Please visit Dilbert.com to read this feature. Due to changes with our feeds, we are now making this RSS feed a link to Dilbert.com.
[syndicated profile] rebol_questions_feed

Posted by rnso

I am trying to print out text from all GUI elements in following code:

  sentlist: ["A" "B" "C"]

  main: function [slist] [
      view collect [
          repeat i length? slist [
              keep compose [
                  text (slist/:i)
                  field "" 
                  return
              ]
          ]
          keep [button "Printall" [
              repeat i (2 * length? slist)[
                  print face/parent/pane/(i)/text
              ]
          ]
       ]
    ]
 ]

 (main sentlist) 

It runs all right without any error and text elements' text are properly printed out, but for fields, only last field's entry is printed out for each field. Where is the problem and how can it be corrected? Thanks for your help.

I will follow this advice

Sep. 18th, 2017 12:19 pm
james_davis_nicoll: (Default)
[personal profile] james_davis_nicoll
According to my brother, one should not bounce a chainsaw off one's knee as it is very hard on denim.

Portrait

Sep. 18th, 2017 02:47 pm
[syndicated profile] forgotten_bookmarks_feed



Small tintype photograph.

Found in "Twenty Minutes Late" by Pansy. Published by Lothrop, 1893.

-Click to enlarge photos-
[syndicated profile] rebol_questions_feed

Posted by rnso

I am trying to create a panel with dynamically created gui elements:

  sentlist: ["A" "B" "C"]
  main: function [slist] [
    view collect [
      keep [below]
      repeat i length? slist [
        keep[
            text slist/i    ; THIS STEP IS NOT WORKING
            field "" ]
      ] ] ]

  (main sentlist) 

A series of strings is sent to the function for putting text labels from it. The GUI window/panel is opening all right but text elements do not have any label on it. Where is the problem and how can it be solved? Thanks for your help.

[syndicated profile] rebol_questions_feed

Posted by rnso

I am using following code to find products of 2 series of numbers and then to find sum of these products:

  make-row: func [][
    compose [
        t1: text "N1:"
        f1: field 
        t2: text "N2: "
        f2: field
        t3: text "Product: "
        t4: text ""
        b: button "Get product" [
            x: face/extra/2/text          
            y: face/extra/4/text
            z: (to-integer x) * (to-integer y)
            face/extra/6/text: rejoin [z]]
        do [b/extra: reduce [t1 f1 t2 f2 t3 t4]] ]  ]

  view compose [
        (make-row) return 
        (make-row) return
    b: button "Calculate" [t2/text: "..to be given"]
    t1: text "Sum of products:"
    t2: text ""                       ; NEED TO GET SUM OF ALL PRODUCTS IN ABOVE ROWS. 
  ]  

The first part is working all right - The products are being calculated properly. But how can I access these individual products to find sum of products? I could not find any way since the rows are not really objects whose public variables or methods/functions I may be able to access. How can this be solved? Thanks for your help.

Comic for September 18, 2017

Sep. 18th, 2017 11:59 pm
[syndicated profile] dilbert_feed
Dilbert readers - Please visit Dilbert.com to read this feature. Due to changes with our feeds, we are now making this RSS feed a link to Dilbert.com.

Profile

birguslatro: Birgus Latro III icon (Default)
birguslatro

August 2017

S M T W T F S
  1 2345
6789 101112
13141516171819
20212223242526
2728293031  

Most Popular Tags

Page Summary

Style Credit

Expand Cut Tags

No cut tags