Skip to content

Instantly share code, notes, and snippets.

@GiuseppeChillemi
GiuseppeChillemi / sort-by-length
Last active August 19, 2022 19:19
Sort a series by the length of its elements, from smaller to bigger
;Red []
Rebol []
sort-by-length: func [
[catch]
"Sort a block by the length of its components from smaller to bigger"
data [block!] "Block of elements"
/safe "Elements type can be mixed"
/reverse "Reverse the order of sorting"
/local
@GiuseppeChillemi
GiuseppeChillemi / Test-DT-Position.r
Last active August 14, 2022 23:27
Test the difference of speed from having a datatype in a different position
;Red []
Rebol []
recycle/off
;This code is from Ashley Graham
platform?: case [
2 = system/version/1 ['Rebol]
not rebol ['Red]
system/product = 'atronix-view ['Atronix]
@GiuseppeChillemi
GiuseppeChillemi / test-getting.r
Last active August 15, 2022 00:09
Testing GETTIN Speeds (Now with 8 tests !!!)
;Red []
Rebol []
recycle/off
;This code is from Ashley Graham
platform?: case [
2 = system/version/1 ['Rebol]
not rebol ['Red]
system/product = 'atronix-view ['Atronix]
--== Red 0.6.4 ==--
Type HELP for starting information.
>> do %pp.r
actor/open: connection
init-odbc
OPEN-ENVIRONMENT [
SQLAllocHandle 0
henv/value = 2158376
SQLSetEnvAttr 0
@GiuseppeChillemi
GiuseppeChillemi / miniconsole.r
Last active July 11, 2022 23:32
Mini script to send a command to a server. It's COMMANDS object is used
do %../scripts/send-to.r
port-number: 55551
server-address: "localhost"
Forever [
prin "Insert a server command > " message: input
if message = "exit" [Print "!!! Exit Received, quitting !!!" break]
response: send-to server-address port-number message
print ""
@GiuseppeChillemi
GiuseppeChillemi / Test-Server.r
Last active July 11, 2022 23:34
An experimental server which waits and executes the Rebol commands it receives taking them from a command block
SERVER-DB: "myserver"
DB: "mydb"
port-number: 55551
server-address: "localhost"
;--- These are the commands we could execute
@GiuseppeChillemi
GiuseppeChillemi / send-to.r
Last active July 11, 2022 22:50
A function to send a command to a server
send-to: func [
"Send a message and returns the response. NONE if no response (TBD:)"
server-address "The address of the server"
port-number [integer!] "The remote port number"
message [String! block!] "The message to send"
/local
out-data ;"The return data"
connection
server
```
[25826 "FA " "A" 16 "C000925" none "C000925" "C" none none none "001" false 1 true 0 false true false true " 381 " 381 4-May-2010/0:00:00 "2010" "2010" "IT " " " " " "05010301001 " " " none 4-May-2010/0:00:00 "EUR" 2 3 1.0 "003" true false none none none "CASS" none "008" "900" none none " " deferred "01 " "01 " "01 " "SC " "04" none 5-May-2010/0:00:00 none none none none none 2 0.0 13.0 0.0 deferred 0.0 3 1 4 3 0 3 0.0 0.0 0.0 "0U00000000" "xxxxxmyserverxxxxxxx" "xxxxxmyserver2xxxxxxx" 27-Oct-2012/2:20:00 4-Apr-2018/17:59:00 #{000000000330ED82} deferred none none false 0 false false true none deferred false none none deferred none none none none false none none none deferred none none]
[25827 "FA " "A" 16 "C000907" none "C000907" "C" none none none "001" false 1 true 0 false true false true " 382 " 382 4-May-2010/0:00:00 "2010" "2010" "IT " " " " " "05010301
@GiuseppeChillemi
GiuseppeChillemi / gist:32f11f8f28496f911d26f505e7914695
Created April 11, 2022 00:08
if is missing its cond argument
]
]
about-connection
info: 0 max-driver-connections
info: 1 max-concurrent-activities
info: 2 data-source-name
info: 6 driver-name
info: 7 driver-ver
info: 10 odbc-ver
info: 11 row-updates
@GiuseppeChillemi
GiuseppeChillemi / gist:db00dced4d6cd547619efebce6369c89
Created April 10, 2022 21:28
all does not allow logic! for its conds argument
info: 130 create-domain
info: 131 create-schema
info: 132 create-table
info: 133 create-translation
info: 134 create-view
info: 136 drop-assertion
info: 137 drop-character-set
info: 138 drop-collation
info: 139 drop-domain
info: 140 drop-schema