{"id":281,"date":"2020-01-15T22:15:48","date_gmt":"2020-01-15T20:15:48","guid":{"rendered":"https:\/\/arnoldvanhofwegen.com\/blog\/?p=281"},"modified":"2020-01-15T23:10:08","modified_gmt":"2020-01-15T21:10:08","slug":"fizzbuzz-in-ren-c-for-cgi-realized","status":"publish","type":"post","link":"https:\/\/arnoldvanhofwegen.com\/blog\/fizzbuzz-in-ren-c-for-cgi-realized\/","title":{"rendered":"FizzBuzz in REN-C for CGI realized!"},"content":{"rendered":"\n<figure class=\"wp-block-gallery columns-1 is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex\"><ul class=\"blocks-gallery-grid\"><li class=\"blocks-gallery-item\"><figure><img loading=\"lazy\" decoding=\"async\" width=\"771\" height=\"357\" src=\"https:\/\/arnoldvanhofwegen.com\/blog\/wp-content\/uploads\/2020\/01\/FizzBuzz.png\" alt=\"\" data-id=\"282\" data-full-url=\"https:\/\/arnoldvanhofwegen.com\/blog\/wp-content\/uploads\/2020\/01\/FizzBuzz.png\" data-link=\"https:\/\/arnoldvanhofwegen.com\/blog\/?attachment_id=282\" class=\"wp-image-282\" srcset=\"https:\/\/arnoldvanhofwegen.com\/blog\/wp-content\/uploads\/2020\/01\/FizzBuzz.png 771w, https:\/\/arnoldvanhofwegen.com\/blog\/wp-content\/uploads\/2020\/01\/FizzBuzz-300x139.png 300w, https:\/\/arnoldvanhofwegen.com\/blog\/wp-content\/uploads\/2020\/01\/FizzBuzz-768x356.png 768w\" sizes=\"(max-width: 771px) 100vw, 771px\" \/><\/figure><\/li><\/ul><figcaption class=\"blocks-gallery-caption\">The code for FizzBuzz in REN-C<\/figcaption><\/figure>\n\n\n\n<p>During the <a href=\"http:\/\/2019.reb4.me\/\">Philadelphia Rebol Conference<\/a> lead REN-C developer Brian &#8220;HostileFork&#8221; Dickens presented this REN-C version of the classic programming task of &#8220;Fizz Buzz&#8221;. <\/p>\n\n\n\n<p>I decided to use REN-C as a new means of producing CGI output on the site. After some trial and error I managed to get the cookie-warning-generating code on the PHP version of the site to work using this REN-C program. And to have some none trivial output I though about using this FizzBuzz example, also because the Rebol would not be able to process this code, proving it really would be the renc executable that processed the code.<\/p>\n\n\n\n<p>But working as a separate script did not go well. Even older Rebol scripts did not seem to be working. After some help from community member Chris Ross-Gill there was some progress, But only after putting a question out to my hosting provider regarding the settings and possible changes during the transfer to a new service, and after additional tinkering on my side things suddenly came to life again. So probably it was all not working due to my own doing in the end..  but there is a result to be shown.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">REN-C source code used<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/path-to\/cgi-bin\/renc\n\nREBOL &#91;Title: \"FizzBuzz for CGI in REN-C\"]\n\nprint \"Content-Type: text\/html; charset=utf-8^\/\"\n\ncount-up n 100 &#91;\n    print &#91; unspaced &#91;\n        if n mod 3 = 0 &#91;\"Fizz\"]\n        if n mod 5 = 0 &#91;\"B\u00fczz\"]\n    ] else &#91;n]]\n    print \"&lt;br \/>\"\n]<\/code><\/pre>\n\n\n\n<p>And what does it result in?<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>1\n2\nFizz\n4\nB\u00fczz\nFizz\n7\n8\nFizz\nB\u00fczz\n11\nFizz\n13\n14\nFizzB\u00fczz\n16\n17\nFizz\n19\nB\u00fczz\nFizz\n22\n23\nFizz\nB\u00fczz\n26\nFizz\n28\n29\nFizzB\u00fczz\n31\n32\nFizz\n34\nB\u00fczz\nFizz\n37\n38\nFizz\nB\u00fczz\n41\nFizz\n43\n44\nFizzB\u00fczz\n46\n47\nFizz\n49\nB\u00fczz\nFizz\n52\n53\nFizz\nB\u00fczz\n56\nFizz\n58\n59\nFizzB\u00fczz\n61\n62\nFizz\n64\nB\u00fczz\nFizz\n67\n68\nFizz\nB\u00fczz\n71\nFizz\n73\n74\nFizzB\u00fczz\n76\n77\nFizz\n79\nB\u00fczz\nFizz\n82\n83\nFizz\nB\u00fczz\n86\nFizz\n88\n89\nFizzB\u00fczz\n91\n92\nFizz\n94\nB\u00fczz\nFizz\n97\n98\nFizz\nB\u00fczz\n<\/code><\/pre>\n\n\n\n<p>For more about REN-C go to https:\/\/github.com\/metaeducation\/ren-c<\/p>\n\n\n\n<p>Next up is a course on how to produce long articles for your blog \ud83d\ude09<\/p>\n","protected":false},"excerpt":{"rendered":"<p>During the Philadelphia Rebol Conference lead REN-C developer Brian &#8220;HostileFork&#8221; Dickens presented this REN-C version of the classic programming task of &#8220;Fizz Buzz&#8221;. I decided to use REN-C as a new means of producing CGI output on the site. After &hellip; <a href=\"https:\/\/arnoldvanhofwegen.com\/blog\/fizzbuzz-in-ren-c-for-cgi-realized\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"gallery","meta":{"footnotes":""},"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/arnoldvanhofwegen.com\/blog\/wp-json\/wp\/v2\/posts\/281"}],"collection":[{"href":"https:\/\/arnoldvanhofwegen.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/arnoldvanhofwegen.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/arnoldvanhofwegen.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/arnoldvanhofwegen.com\/blog\/wp-json\/wp\/v2\/comments?post=281"}],"version-history":[{"count":5,"href":"https:\/\/arnoldvanhofwegen.com\/blog\/wp-json\/wp\/v2\/posts\/281\/revisions"}],"predecessor-version":[{"id":288,"href":"https:\/\/arnoldvanhofwegen.com\/blog\/wp-json\/wp\/v2\/posts\/281\/revisions\/288"}],"wp:attachment":[{"href":"https:\/\/arnoldvanhofwegen.com\/blog\/wp-json\/wp\/v2\/media?parent=281"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/arnoldvanhofwegen.com\/blog\/wp-json\/wp\/v2\/categories?post=281"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/arnoldvanhofwegen.com\/blog\/wp-json\/wp\/v2\/tags?post=281"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}