Monday, 24 October 2011

Job offer

I found today this request:
I could use a REBOL programmer for my new startup. Must be in the Las Vegas area or willing to relocate. Send resume to Ryan@iOrderPOS.com
 Maybe he's looking for you!

Friday, 21 October 2011

Rebol obfuscated code

If you don't know what is the obfuscated code, read this page: http://en.wikipedia.org/wiki/Obfuscated_code
Now you are ready to start to know how is possible that both these two scripts produce the following output:

****************************************************************

N  O  W     P  E  R  L     U  S  E  R  S     W  O  N  '  T
 F  E  E  L     L  E  F  T     O  U  T

****************************************************************


Here the first source:

REBOL [
Title: "Alien Dialect"
Date: 10-Mar-1999
File: %alien.r
Purpose: "It came from outer space"
Comment: {
Rebol is not tied to any specific syntax, and
can even accommodate a program written entirely
in punctuation marks. This script is a good
example of which punctuation can be utilized
in words, as well as showing the flexibility of
dialects in REBOL.
Remember: many punctuation characters
are reserved for use by Rebol.
Challenge to the Rebol learner: Try to follow
what is going on in this script.
}
library: [
level: 'advanced
platform: none
type: none
domain: 'x-file
tested-under: none
support: none
license: none
see-also: none
]
Version: 1.0.0
Author: "Anonymous"
]
!: :do `=`~: char! __: " "
`-`: :make *!*: integer! `~-: 0
&: :func ``=: word! `~.: 1
_: :load !-.: :head `~..: 2
|: :if |-.: :tail `~...: 3
?: :loop |~.: :insert `~....: 4
|~: :print `!: :repeat `-: 5
|~|~: :prin `-`~: :copy `.: 6
`: :add _._: block! `..: 7
||: :any &~: :not `...: 8
`|: :foreach &!`~: "^/" `....: 9
`~`~: & [&&.] [`-` _._ &&.]
&|~&: `~`~ {
78 79 87 32 80 69 82 76
32 85 83 69 82 83 32 87
79 78 39 84 32 10 70 69
69 76 32 76 69 70 84 32
79 85 84
}
?||.: `-` `~- `~.... ** `~...; @% ^^/ \# $<>
&~|: & [] [
? ?||. [|~|~ `-` `=`~ (`.. * `.)]
]
&~| |~ &!`~
|~_: & [!!!] [
`| _! !!! [|~|~ [`-` `=`~ _! __]]
|~ `-` `=`~ 10
]
|~_ &|~&
&~| |~|~ `-` `=`~ ` `... `~..


and here the second source:
REBOL [
Title: "Alien Dialect Explanation"
Date: 10-Mar-1999
File: %alienexp.r
Purpose: "It came from outer space explained."
Comment: {
Rebol is not tied to any specific syntax, and
can even accommodate a program written entirely
in punctuation marks. The script %alien.r is a
good example of which punctuation can be
utilized in words, as well as showing the
flexibility of dialects in REBOL.
This file contains a more conventional
explanation of the code behind the %alien.r
script. It is a direct translation and
functions exactly as does its counterpart.
}
library: [
level: 'advanced
platform: none
type: none
domain: 'x-file
tested-under: none
support: none
license: none
see-also: none
]
Version: 1.0.0
Author: "Anonymous"
]
make-block: func [any-block] [make block! any-block]
num-block: make-block {
78 79 87 32 80 69 82 76
32 85 83 69 82 83 32 87
79 78 39 84 32 10 70 69
69 76 32 76 69 70 84 32
79 85 84 }
loop-size: make integer! 4 ** 3; example of bad characters
divide-text: func [] [
loop loop-size [prin make char! (7 * 6)]
]
divide-text print "^/"
make-msg: func [num-set] [
foreach num num-set [prin [make char! num " "]]
print make char! 10
]
make-msg num-block
divide-text prin make char! add 8 2

Wednesday, 19 October 2011

Amiga Demoscene Archive - Logo Viewer

Do you remember the fantastic Amiga Demo scene, now you can view it all with a simple click:

Here the source of the script:


REBOL [
file: %adalogo.r
title: "A.D.A. Logo Viewer"
author: "Semseddin (Endo) Moldibi"
version: 1.0.0
date: 2011-07-25
purpose: "Amiga Demoscene Archive - Logo Viewer"
Library: [
level: 'beginner
platform: 'all
type: 'one-liner
domain: 'graphics
tested-under: [view 2.7.8.3.1 on "WinXP Pro"]
support: none
license: 'public-domain
see-also: none
]
]
random/seed now
view layout [
text "Click!"
origin 0x0
img: image 320x256 [img/image: load rejoin [http://ada.untergrund.net/logos/logo_ random 134 %.png] show img]
]

Tuesday, 18 October 2011

Clock and alarm

This is a simple script for a clock and alarm, you can set the alarm just clicking on the clock:
You can use it also in a browser, installing the Rebol plugin (see http://rebol2.blogspot.com/2011/07/rebol-plugin.html )
Here the source:


rebol[
date: 19-sept-2004
file: %aclock-p.r
Title: "pluginable analog alarm clock"
Author: "Tom Conlin"
Purpose: "aproximate an analog clock and add alarm"
library: [
platform: [ all plugin ]
plugin: [size: 160x160 version: {http://www.rebol.com/plugin/rebolb4.cab#Version=0,5,0,0} ]
tested-under: [windows firefox]
see-also: "request-time.r"
type: [demo tool]
Level: 'intermediate
Domain: [gui sound]
Tested-under: [windows firefox ]
support: ["ask" ]
License: pd
]
]
do http://www.rebol.org/cgi-bin/cgiwrap/rebol/download-a-script.r?script-name=request-time.r
ring: load ring-url: http://www.cs.uoregon.edu/~tomc/Buzzer_2.wav
;;; Globals
RADIUS: 80x80 ; a pair for ovals
ALARM: 24:00:00 ; a time not reachable -- so is off
MAIN-CLOCK-FACE: make block! 180
SIN: make block! 61
COS: make block! 61
for i 6 360 6[
insert tail SIN reduce [sine i]
insert tail COS reduce [negate cosine i]
]
;;; set the "once per resize" elements
draw-face: func[rad [pair!]
/local clock-face ;;; big-hand-end lil-hand-end sec-hand-end tic
][
;system/script/title: to-string now/date ;;; try to change title each day
clock-face: make block! 180
big: make block! 64
lil: make block! 64
sec: make block! 64
edg: make block! 64
big-hand: RADIUS * .95
lil-hand: RADIUS * .66
tic: RADIUS - 3x3
for i 1 60 1[
insert tail big RADIUS + to pair! reduce[to integer! ((big-hand/1) * SIN/:i) to integer! ((big-hand/2) * COS/:i)]
insert tail lil RADIUS + to pair! reduce[to integer! ((lil-hand/1) * SIN/:i) to integer! ((lil-hand/2) * COS/:i)]
insert tail sec RADIUS + to pair! reduce[to integer! ((tic/1 ) * SIN/:i) to integer! ((tic/2 ) * COS/:i)]
insert tail edg RADIUS + to pair! reduce[to integer! ((radius/1 ) * SIN/:i) to integer! ((radius/2 ) * COS/:i)]
either zero? i // 5
[insert tail clock-face compose[circle (sec/:i) 2 ]]; hour marks
[insert tail clock-face compose[line (sec/:i) (edg/:i)]]; minute marks
]
clock-face
]
main-clock-face: draw-face RADIUS
;;; return a block of DRAW to display the hands
tock: func[t [time! none!] rad [pair!] /local result h m s][
result: compose [pen black fill-pen black]
if not t [t: now/time]
s: either zero? t/3 [60][t/3]
m: either zero? t/2 [60][t/2]
h: add multiply t/1 // 12 5 to integer! divide t/2 12.0
h: either zero? h [60][h]
either equal? rad RADIUS
[insert tail result main-clock-face]
[insert tail result copy draw-face rad]
insert tail result compose[ ; hands
pen red line (RADIUS) (lil/:h)
pen blue line (RADIUS) (big/:m)
pen yellow line (RADIUS) (sec/:s)
]
result
]
;;; user select sounds, images...
request-url: func [u [url!] /local ][
request u
]
aclock: [
origin 0x0
clk: box silver RADIUS * 2
rate 0:0:01
feel[
engage: func [face action event] [
face/effect: reduce ['draw tock none RADIUS show clk]
if action = 'down [ALARM: request-time ALARM]
if action = 'alt-down [ring: load ring-url: request-url ring-url]
if all[ greater? now/time ALARM lesser? now/time add ALARM 0:0:02][
wait 0
bell: open sound://
insert bell ring
wait bell
wait .1
close bell
;alert rejoin ["DING!" " " ALARM]
]; end alarm check
]
]
]
insert-event-func [
switch event/type [
resize [
clk/size: face/pane/1/size
RADIUS: clk/size / 2
main-clock-face: draw-face RADIUS
show clk
]
]
event
]
view/options layout aclock[resize no-border]

Monday, 17 October 2011

Simple 3D game

Here a very simple 3D game, just try to click as may time as possible the 3D Rebol logo. My record is 104:
Here the source code:

REBOL [
title: "Little 3D Game"
date: 29-Nov-2009
file: %3d-game.r
author: Nick Antonaccio
purpose: {
Try to click the bouncing REBOLs as many times as possible in 30 seconds.
The speed increases with each click! The 3D logic and calculations in this
script were taken directly from Gregory Pecheret's "ebuc-cube" script, at:
http://www.rebol.net/demos/download.html
This script can also be found in the tutorial at http://re-bol.com
}
]

beep-sound: load to-binary decompress 64#{
eJwBUQKu/VJJRkZJAgAAV0FWRWZtdCAQAAAAAQABABErAAARKwAAAQAIAGRhdGEl
AgAA0d3f1cGadFQ+T2Z9jn1lSjM8T2uNsM/j7Midc05PWGh4eXVrXE5DQEZumsTn
4M2yk3hiVU9fcX+GcFU8KkNmj7rR3+HYroJbPUpfdoqAbldBP0ZWbpW62OvRrohk
WlleaHB2dW9bRzo1WYWy3OHbyrKObVNCVGp/jXpgRC48Vnievtfm6MCUaUVLWW1/
fXNkUkdCRlN7ps3r3cSkgm1fWFhmdH2AaVA6LElwnMja4dzNpHtXPUxje45/aVA5
PUtif6TG3uvMpHtXU1lkcnd2cGVURT0+ZJC84+HUvaGCZ1NIWm6AinVaQCtAX4Wu
yt3k37aJYEBKXXOHf3FdSEJET2KJsdPr1reUcGJbW2FsdXl2YUs5MFF7qdPe3tO+
mHNUP1Bnfo59ZEkyPFFukbTR5OvGm3BMTVlpent1aVpMQ0FJcZ3I6uHMsJB2YlZR
YXJ/hW5UOypEaJK90+Dg1qyBWjxKYHeLgG1WPz9HWXKYvNnr0KyFYVhZX2pydnVu
Wkc7N1yHtN3h2sivjGxTRFZrgI15X0MtPVh7osHZ5ua+kmdES1tvgn5zY1BGQ0hW
fqjO69vBoX9rXllaaHV9fmhPOi1Lcp/K2+DayaF4Vj1NY3uNfmhONjxLZIKnyODr
yqJ4VFFYZHN3dm5iUUM9QGaTv+Th0rqdf2VTSltvgIl0WT4rQGCIssze5N60iF8/
Sl10h39vW0ZBRFFljLPU69W1kG1gWlxiYHkWb1ECAAA=
}
alert {
Try to click the bouncing REBOLs as many times as possible in
30 seconds. The speed increases with each click!
}
do game: [
speaker: open sound://
g: 12 i: 5 h: i * g j: negate h x: y: z: w: sc: 0 v2: v1: 1 o: now
img1: to-image layout [backcolor brown box red center logo.gif]
img2: to-image layout [backcolor aqua box yellow center logo.gif]
img3: to-image layout [backcolor green box tan center logo.gif]
cube: [[h h j][h h h][h j j][h j h][j h j][j h h][j j j][j j h]]
view center-face layout/tight [
f: box white 550x550 rate 15 feel [engage: func [f a e] [
if a = 'time [
b: copy [] x: x + 3 y: y + 3 ; z: z + 3
repeat n 8 [
if w > 500 [v1: 0] if w < 50 [v1: 1] either v1 = 1 [w: w + 1] [w: w - 1] if j > (g * i * 1.4) [v2: 0] if j < 1 [v2: 1] either v2 = 1 [h: h - 1] [h: h + 1] j: negate h p: reduce pick cube n zx: p/1 * cosine z - (p/2 * sine z) - p/1 zy: p/1 * sine z + (p/2 * cosine z) - p/2 yx: (p/1 + zx * cosine y) - (p/3 * sine y) - p/1 - zx yz: (p/1 + zx * sine y) + (p/3 * cosine y) - p/3 xy: (p/2 + zy * cosine x) - (p/3 + yz * sine x) - p/2 - zy append b as-pair (p/1 + yx + zx + w) (p/2 + zy + xy + w) ] f/effect: [draw [ image img1 b/6 b/2 b/4 b/8 image img2 b/6 b/5 b/1 b/2 image img3 b/1 b/5 b/7 b/3 ]] show f if now/time - o/time > :00:20 [
close speaker
either true = request [
join "Time's Up! Final Score: " sc "Again" "Quit"
] [do game] [quit]
]
]
if a = 'down [
xblock: copy [] yblock: copy []
repeat n 8 [
append xblock first pick b n
append yblock second pick b n
]
if all [
e/offset/1 >= first minimum-of xblock
e/offset/1 <= first maximum-of xblock e/offset/2 >= first minimum-of yblock
e/offset/2 <= first maximum-of yblock ][ insert speaker beep-sound wait speaker sc: sc + 1 t1/text: join "Score: " sc show t1 if (modulo sc 3) = 0 [f/rate: f/rate + 1] show f ] ] ]] at 200x0 t1: text brown "Click the bouncing REBOLs!" ] ]

Monday, 10 October 2011

Virtual Rubik cube

Here an interesting program taht could help people to solve Rubik cube, you can maniolate the cube and rotate it:




Wednesday, 5 October 2011

GUI builder

What a fantastic scrpt: a program to learn how to write a gui! It's very easy to use:
The program show you two windows:

  • the first with all standard GUI component
  • the second with the window result of your choices
You can select all component from the first window and add to the second window!
When you'll became expert, you'll be able to do more writing yourself the GUI, but it's an essential tool for beginners!

Tuesday, 4 October 2011

Rebol 3d: torus

Here there is a fantastic demo, recorded from a Linux laptop; but it works on any OS (like alle Rebol script!):
Source code: http://www.rebol.net/demos/54B49201E7AF1F76/torus.r