• Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

AltME groups: search

Help · search scripts · search articles · search mailing list

results summary

worldhits
r4wp443
r3wp4402
total:4845

results window for this page: [start: 301 end: 400]

world-name: r4wp

Group: #Red ... Red language group [web-public]
PeterWood:
27-Mar-2013
There aren't any tests of refinements to append yet. I'll start an 
append-tests.red file for them inlcuding your 10 spaces test Gregg.
PeterWood:
27-Mar-2013
I've just checked the quick-test docs and see that I forgot to mention 
the log file. I'll certainly need to update the docs.
Pekr:
28-Mar-2013
floats for Red? Yes, why not ... but file, networking, ports, schemes, 
tasking schemes ... so that Graham can implement/port FTP, smtp, 
pop3 etc for us :-)
Kaj:
29-Mar-2013
Gregg, you can DO READ %file in console-pro, or DO READ "url"
Kaj:
29-Mar-2013
You can also give console-pro a file or URL to DO on the operating 
system command line
AdrianS:
3-Apr-2013
Bo, wrt crappy built-in searching, I highly recommend the Everything 
search utility from voidtools. Best file search for Windows. Lightweight 
(no need for service), small, and quick. I've been using this for 
quite a while and I thought that development had unfortunately stalled, 
but, since the new year, it looks like it's being actively worked 
on again. I'm so happy! Yes, it is that nice!

http://www.voidtools.com
Bo:
3-Apr-2013
AdrianS: Unfortunately, it won't work for me:

From their FAQ:
1.3 Does Everything search file contents?

No, "Everything" does not search file contents, only file and folder 
names.


I find that I search within file contents at least as much as for 
filenames.  It shouldn't be too hard to write a Rebol-based standalone 
exe that would do this.  I'll add it to my growing list of scripts 
to write.
AdrianS:
4-Apr-2013
The DrDobbs link led to this one - After XML, JSON: Then What?


http://www.drdobbs.com/web-development/after-xml-json-then-what/240151851


That article mentions that one of the "most interesting" new data 
formats being considered is TOML (this looks like the .ini file format)

https://github.com/mojombo/toml

Is this really what we can expect?
Gregg:
6-Apr-2013
If I do this in the console:


foreach word system/words [print [mold word tab mold type? get word]]

I get a long list of words, that end with this:
...
do-console      function!
red-prompt      unset!
mode    unset!
switch-mode     unset!
eval    unset!
code    unset!
result  unset!
cnt     unset!
mono    unset!
block   unset!
q       function!
red>>


Now, if I paste a bunch of code in the console and do it again, the 
newly added words all come back as type datatype!.  e.g.
...
block   unset!
q       function!
Title   datatype!
Author  datatype!
File    datatype!
Tabs    datatype!
any-function?   datatype!
...
Endo:
10-Apr-2013
Here you can compile your Red scripts online and then download the 
compile executable file:
http://bircomteknoloji.com:8181/
Endo:
10-Apr-2013
You can use it to test for compiling Red scripts and generated executable 
file.
DocKimbel:
10-Apr-2013
Also, when asking for the file to be downloaded, you should rename 
the file to something more human-friendly or ask the name from the 
user. You can use Content-Disposition HTTP field for doing that easily. 
Here's an example from one of CureCode's RSP:

        response/buffer: get-modes file 'full-path	

        response/set-header 'Content-Disposition  rejoin [{filename="} name 
        {"}]
Gregg:
10-Apr-2013
On the header, having it be Red may lead to the most false positives. 
If it's at the top of a file, it would normally be capitalized.
Kaj:
10-Apr-2013
It was my understanding that string/rs-head returns a UTF-8 cache 
of a string. How can I get this value?


I'm trying to get UTF-8 back that I fed in. The problem I'm having 
is the following:

write %syllable.org.html read "http://syllable.org"

This writes out just one character instead of the expected file.
DocKimbel:
11-Apr-2013
Just give me the AV software name first, then the source file name 
and compilation optons (if any).
Endo:
11-Apr-2013
Here is the link:

https://www.virustotal.com/en/file/2db471babe53dedbd6adf0c5c112976a6692ad000aea83dfa93890f6d1e1b43b/analysis/1365683598/
Gregg:
13-Apr-2013
That sounds great Doc. I collected your comments into a file in %Red/.
Arnold:
21-Apr-2013
Would be nice to be able to download the Red zip file and be able 
to compile scripts in another directory?
Kaj:
23-Apr-2013
You also need to give the full path to the source file
Arnold:
24-Apr-2013
@Kaj, The Yen sign has disappeared here! Congratulations! :)

I would still like the default output to be deposited in the working 
directory, instead of the builds directory

 I think I agree with this. In the ideal situation you could specify 
 these things, maybe in a settings file or in a preference in a compilation 
 assisting program. (Started one once)  

The integration of rsc.r within red.r sounds as a logical step. (rsc.r 
Red System Compilation, not so bad and a clear difference from red.r 
for Red scripts)
Endo:
24-Apr-2013
Doc: "did you encapped Red compiler?" Nope, RedCompiler.exe is just 
calling the rsc.r or red.r according to the extension of given script 
file. It should be placed in the red-master directory.

I tried to make a encapped Red compiler but there are some problems 
with #include or other compiler directives.
DocKimbel:
24-Apr-2013
Once we merge %red.r and %rsc.r, I will look into encapping the whole 
thing, so we'll be able to start distributing Red as a unique binary 
file.
Marco:
28-Apr-2013
I'd like to know what your development environment for Red/System 
is especially that used by Doc.
In the meantime...
	My development environment:
	OS: Windows 7
	Editor: Notepad++ v5.0.3
	  not the latest version but I prefer this one,

   using "Python" as the language for syntax highlithing and coloring

   (there is not a "REBOL" language) and used mainly for the folding 
   on indentation

   (I can not live without folding, and folding on indentation makes 
   life even easier)

   I have added a menu item with a keybord shortcut to run REBOL with 
   the currently shown file as argument.

   I have added also a menu item with a keybord shortcut to run my modified 
   version of REBOL-Word-Browser

 At the end of the r/s file I add these lines (mostly taken from Bruno 
 Anselme):
		#if OS = '???? [{
		REBOL []
		appname: "myprog"

  rs-dir: %../Red-master-0.3.2_Bruno/red-system                ; locate 
  here your red-system directory
		dest: rejoin [what-dir appname ]
		print [ "------ Compiling" appname "------" ]
		do/args rs-dir/rsc.r rejoin ["-o " dest " " dest %.reds ]

		print [ "Destination file:" dest ]
		call/wait/show/console dest
		halt
		;}]

 This way pressing the shortcut I can run REBOL that compiles the 
 program I am writing and than starts the program.
	Any suggestion is welcomed!
Pekr:
29-Apr-2013
Don't want to bother you with primitive questions, but - why in general, 
there is a need for shared library support, on mobile platforms? 
Can we just have - executables? IIRC, R/S code already worked under 
Droid? Well, I know that .apk is some other format (maybe a zip file 
with some files inside?). Is it that in order to have PROPER app 
support (e.g. via GooglePlay), we need to adhere to some rules, and 
one of those is, we need dynamic libraries?
Kaj:
8-May-2013
You wanted a direct file link
Kaj:
8-May-2013
I/O is currently text only, UTF-8. There are %file literals, but 
url! needs to be written as string! for now
Pekr:
9-May-2013
>> do/args %rsc.r "%bridges/java/JNIdemo.reds -o %bridges/java/JNIdemo"

-= Red/System Compiler =-
Compiling bridges/java/JNIdemo.reds ...

...compilation time:     114 ms
...linking time:         4 ms
...output file size:     6656 bytes
...output file name:     bridges/java/JNIdemo.exe
Andreas:
9-May-2013
Someone can also send you the compiled .class file, but you'll at 
least need the JRE installed :)
DocKimbel:
9-May-2013
Andreas, you need to publish the events.class file too, or they won't 
be able to close the window. ;-)
Pekr:
9-May-2013
well, what is the .class file good for anyway, even if I have JRE?
Andreas:
9-May-2013
The .class file is Java's "exe".
Oldes:
13-May-2013
Hm.. I'm not sure this will help me. I have the rsrc data (parsed 
from valid file), just the section's adress is not correct.
DocKimbel:
13-May-2013
rsrc entries contain file offsets and memory addresses, if you plan 
to just insert a blob of data, it won't work.
DocKimbel:
13-May-2013
Gregg: no .res file, think .red file (or at least .ren). ;-)
Oldes:
13-May-2013
no.. my mistake.. was parsing valid file instead of the one build 
in red with rsrc.
DocKimbel:
14-May-2013
%version.r is a data file used by Red compiler, it's not for decoration. 
;-)
Pekr:
14-May-2013
btw - -= Red Compiler =-
Compiling /C/!rebol/!red/red/red/tests/hello.red ...

*** Compilation Error: comp-literal: unsupported type 14-May-2013/13:24:25+2:00
*** in file: %/C/!rebol/!red/red/red/tests/hello.red
*** near: [14-May-2013/13:24:25+2:00]
DocKimbel:
14-May-2013
Are you using a tool that messes up Red file headers?
DocKimbel:
14-May-2013
The only time when the switching fails is when a versioned file is 
locked by an app (like a code editor sometimes).
Pekr:
16-May-2013
I have some issues understanding Git again. There is apparently new 
help file for java bridge, as shown in above linke commit, but I 
can't see the changes reflected, when looking into file via files 
section, nor does it sync to my desktop ...
Marco:
25-May-2013
I have written a simple R/S program that simply writes a text file, 
and when I start it from Windows it always opens a shell even if 
there is no "print-ing". How can avoid it?
Geomol:
28-May-2013
When I have the GTK-browser file on my system, how to run it?
Kaj:
29-May-2013
DO READ %file
Pekr:
3-Jun-2013
Geomol - try to understand your example. Imagine html file for e.g. 
Your [to a | to b ...] is wrong ... imagine 'a is at the end of the 
file. Simply "to a" will find it, before "to b" is even given chance 
to be applied. What we want is - find what is first - 'a or 'b ....
DocKimbel:
12-Jun-2013
SYS: It seems that not much is required to add to the PE file itself, 
I see no additional sections needed. However, it requires a proper 
checksum in the header. That checksum is either calculated using 
Windows API or the algorithm could be implemented directly in Rebol. 
In the first case, it shouldn't take more than an hour to add support 
to it, in second case a day or two. The main issue would be to find 
a simple way to test it once generated? Any idea?
DocKimbel:
12-Jun-2013
Gerard, found the native crash dump info in your log file, thanks! 
We'll give it another try with the new bridge version once ready 
(this week).
Kaj:
12-Jun-2013
The driver I inherited is a simple file filter driver, so it fits 
in the existing Windows infrastructure and it could potentially be 
almost empty
DocKimbel:
12-Jun-2013
I'm not sure that you can just change a driver file "in place" after 
each recompilation. I'm wondering if you need to deinstall the old 
one and install the new one each time...
Arnold:
15-Jun-2013
Good to know it is not guaranteed. Trouble uploading .reds file stays 
Empty.
Arnold:
16-Jun-2013
Funny

: #define odd? (x) etc as Kaj suggested gives a compile error on 
line where it is used: 
*** Compilation Error: undefined symbol: odd? 

*** in file: %/Users/Arnold/data/develop/red/testscripts/random.reds 
*** in function: ran_start
*** at line: 117 
*** near: [odd? ss [
Maxim:
17-Jun-2013
this would be an nice way for users to try red and progressively 
replace their binary code base, one source file at a time... instead 
of a whole project at once.
Arnold:
21-Jun-2013
Okay I mean you do an #include of a random library or other red(s) 
file, then declaration and init is done. Does the programmer need 
to call a random-free-memory function before ending his/her program?
Arnold:
22-Jun-2013
@Kaj, if I free the memory at the library funtion level then I lose 
the generator state all the time, I expect that not to be the best 
thing for the randomness of the produced numbers. Say I am a programmer 
and I #include the random functions file/lib. Do I need to call a 
random/free function at the end of my program yes or no?
Pekr:
25-Jun-2013
either I have mess again on my system, or there's a compilation error 
for me, when trying to do:


do/args %red.r "-dlib -v 0 %red/bridges/java/hello.red -o %../red/bridges/java/hello" 


Script: "Red/System IA-32 code emitter" (none)
*** Compilation Error: missing argument
*** in file: %structures.reds
*** in function: exec/~java-instantiate-abstract
*** at line: 166
*** near: [jni-env/jni/NewObject]
Kaj:
25-Jun-2013
There's a binary example in my 6502 emulator, where it loads a ROM 
file
Kaj:
25-Jun-2013
The file operation is in machine.reds under the ROM heading
Bo:
25-Jun-2013
I'm trying to convert your file reading code to a general purpose 
function.
Kaj:
25-Jun-2013
ANSI.reds now has read-file-binary
Kaj:
25-Jun-2013
Added write-file-binary for good measure
Kaj:
25-Jun-2013
Oops, I'm not returning the binary file length. Have to fix that 
oversight
Kaj:
25-Jun-2013
Added a parameter to make read-file-binary return the file size
Kaj:
26-Jun-2013
With my I/O bindings you can READ a file and then LOAD it, but only 
UTF-8 text
Kaj:
26-Jun-2013
I guess Red #include could be made to inspect the type of the file, 
and add an implicit #system-global [ ] if it's Red/System
Arnold:
26-Jun-2013
That would be a nice improvement indeed as the file extension is 
reds and the header is Red/System
Bo:
26-Jun-2013
I have this bit of Red/System code that I wrote, but for some reason, 
it just closes the console window.  So I don't know if there is an 
error, and if there was, how would I debug it?

#include %../C-library/ANSI.reds

img1: as-binary 0
size1: 0
img2: as-binary 0
size2: 0

img1: read-file-binary "img1.bin" :size1

print-line img1
print-line size1

print-line as integer! img1/1

img2: read-file-binary "img2.bin" :size2

print-line img2
print-line size2

img3: as-binary size1

i: 0
until [
	i: i + 1
	img3/i: img2/i - img1/i
	i = size1
]

write-file-binary "img3.bin" img3 size1

until [no]
Arnold:
27-Jun-2013
And or adding lines where you print information to the console

print [" before call to read-file-binary, size of size1: " size1 
lf]
Arnold:
27-Jun-2013
write-file-binary has a logic! return value
write-ok: write-file-binary "img3.bin" img3 size1
Arnold:
27-Jun-2013
And even try to initialize img3 by 
img3: read-file-binary "img2.bin" :size2

that way img3 can be subscripted like img1 and img2, not sure now 
about your as-binary from integer what you have now.
Arnold:
27-Jun-2013
I stumbled upon a possible bug with local variables.
flexfun-s: function [s [string!] return: [string!]][return s]
flexfun-i: function [i [integer!] return: [integer!] ][return i]

flexfun: function [n [integer! float! string!] return: [string! integer! 
logic!] /local rv uitstr uitint][
    rv: type? n

    either "string" = rv [uitstr: flexfun-s n][uitint: flexfun-i n]
]

When I do not declare the uitstr and uitint local variables, the 
compiler makes a ~local extra and notices double declaration:
Compiling to native code... 

Script: "Red/System IA-32 code emitter" (none)

*** Compilation Error: duplicate variable definition in function 
exec/f_flexfun  

*** in file: %/Users/Arnold/data/develop/red/testscripts/flextst1.red 
*** at line: 126 
*** near: [func [/local ~n ~local ~rv ~local ~uitstr ~uitint] [
        push ctx194/values
DocKimbel:
27-Jun-2013
We'll step by step abstract all those little details, so you'll be 
able to specify your whole app parameters from Red only without having 
to touch any Android XML file.
Kaj:
27-Jun-2013
and then you would have to check for a possible NULL result. Look 
inside the code of read-file-binary to see how that works
Kaj:
27-Jun-2013
You also need to check the return values of read-file-binary and 
write-file-binary, as Arnold already mentioned
Kaj:
27-Jun-2013
After you're done with img3, you should FREE the allocated memory. 
The same for img1 and img2 because the memory was allocated for you 
by read-file-binary
james_nak:
27-Jun-2013
I don't know if I am using it correctly but I attempted to run the 
build.r file (w/o any arguments...I think it builds the "eval.red"). 
I end up with:
Signing apk...
'jarsigner' is not recognized as an internal or external command,
operable program or batch file.
Aligning apk...
Unable to open 'builds\eval-signed.apk' as zip archive
james_nak:
27-Jun-2013
At this point I am stuck on the sun.security.tools.JarSigner file 
issue.
Bo:
27-Jun-2013
I am running this on Windows currently.  XP 32-bit.  Here's the complete 
code:

#include #../C-library/ANSI.reds

img1: as-binary 0
size1: 0

img1: read-file-binary "img1.bin" :size1

i: 0
r: 0
g: 0
b: 0
im1: 0
until [
	r: i + 2
	g: i + 3
	b: i + 4
	im1: as-integer ((img1/r / 3) + (img1/g / 3) + (img1/b / 3))

 print-line im1 ;as-integer ((img1/r / 3) + (img1/g / 3) + (img1/b 
 / 3))
	i: i + 4
	i >= size1
]
PeterWood:
27-Jun-2013
The calculation is okay.

Code:

Red/System []

red: as byte! 240
green: as byte! 120
blue: as byte!  60


greyscale: ((as integer! red) / 3) + (as integer! green) + (as integer! 
blue)

print [greyscale lf]

OUTPUT:
-= Red/System Compiler =- 
Compiling /Users/peter/VMShare/Code/Red-System/test.reds ...
Script: "Red/System IA-32 code emitter" (none)
Script: "Red/System Mach-O format emitter" (none)

...compilation time:     122 ms
...linking time:         10 ms
...output file size:     16384 bytes
...output file name:     builds/test
260
PeterWood:
27-Jun-2013
Oops, here's the proper code and correct answer:

Red/System []

red: as byte! 240
green: as byte! 120
blue: as byte!  60


greyscale: ((as integer! red) / 3) + ((as integer! green) / 3) + 
((as integer! blue) / 3)

print [greyscale lf]

OUTPUT
...compilation time:     133 ms
...linking time:         13 ms
...output file size:     16384 bytes
...output file name:     builds/test
140
james_nak:
27-Jun-2013
Kaj, I think there was something to the jarsigner being commented 
out in the file. I'll have to wait for Doc and Pekr to chime in.
DocKimbel:
28-Jun-2013
I'll check the sources.list file in 11.04 once I finish installing 
12.04.
DocKimbel:
28-Jun-2013
Synaptic wasn't updating the sources.list file correctly, changing 
it manually seems to have fix it. At least, I can now install a JDK 
package.
Kaj:
28-Jun-2013
Generating apk...
/bin/bash: builds/tools/aapt: Bestand of map bestaat niet
Signing apk...
jarsigner: unable to open jar file: builds/eval-unsigned.apk
Aligning apk...
/bin/bash: builds/tools/zipalign: Bestand of map bestaat niet
...all done!
Kaj:
28-Jun-2013
Bestand of map bestaat niet
 means the file doesn't exist
Bo:
1-Jul-2013
OK.  I have this snippet of Red/System code that is giving me an 
access violation.  I can't seem to find why:

dirs-file: as-c-string 64
dirs-file: "to-process/dirs.txt"
dirs: as-c-string 1024

dirs: read-file dirs-file	;'dirs now contains the contents of %to-process/dirs.txt
eol: as-c-string 1024
eol: find-char dirs #"^/"	;Finds the first end-of-line character
line-len: as-integer eol - dirs

print-line line-len	;In my example, this returns 24, which is correct

first-line: as-c-string (line-len + 1)	;An extra byte for #"^(00)" 
to be safe

copy-string-part first-line dirs as-integer eol - dirs	;Access violation. 
 Why?
Bo:
1-Jul-2013
In the above example, dirs.txt is a text file of size 524 bytes.
Kaj:
2-Jul-2013
There is no pure Red solution. When Doc will make an I/O framework, 
file I/O will still use a binding to the operating system underneath, 
which almost always means the standard C library
Bo:
2-Jul-2013
With the updated ANSI.reds, I get the following error when compiling 
now:


*** Compilation Error: argument type mismatch on calling: copy-string
*** expected: [integer!], found: [c-string!]
*** in file: %motion-detect.reds
*** at line: 47
*** near: [
    append-string file1 first-line
    file3: as c-string! allocate 128
]
Kaj:
2-Jul-2013
So you probably copied a Windows text file to Linux
Bo:
2-Jul-2013
Here's the troubling bit of code:

	dirs: make-c-string 1024
	dirs: read-file "to-process/dirs.txt"

	eol: make-c-string 1024
	eol: find-char dirs #"^/" ;Finds the first end-of-line character

 line-len: as-integer eol - dirs + 1 ;Add one byte for the end-of-string 
 character
	first-line: make-c-string line-len
	copy-string-part dirs first-line as-integer eol - dirs ;reversed
	first-line/line-len: #"^(00)"

Shouldn't 'find-char dirs #"^/" return the first newline byte?
Kaj:
2-Jul-2013
On Windows, the C library that executes the read-file converts DOS 
newlines to Unix LF format. I've had trouble with that before in 
the binding
Kaj:
2-Jul-2013
The C library on Unix just assumes it's a native file, so if there 
are extra CRs in there, it doesn't touch them
Bo:
2-Jul-2013
The dirs.txt file is being written to the Pi using Rebol on Windows.
Bo:
2-Jul-2013
So, I'd have to form the file in Rebol, convert it to binary (in 
Rebol) and remove the CRs from the binary, then use write/binary 
to write it out.
Kaj:
2-Jul-2013
I suppose it would be useful if I made read-file more like REBOL, 
like it already behaves on Windows. I'll look into that tomorrow
Bo:
2-Jul-2013
Another thing I've never tried in Red/System and can't seem to get 
to work:

	min-pixel-area-text: make-c-string 16

 min-pixel-area-text: read-file "config/motion-trigger-min-pixel-area.txt"
	print-line ["Minimum Pixel Area = " min-pixel-area-text]
	min-pixel-area: as-integer min-pixel-area-text
	print-line ["Minimum Pixel Area = " min-pixel-area]

Output:

	Minimum Pixel Area = 1
	Minimum Pixel Area = 3358672
XieQ:
2-Jul-2013
@Bo 'read-file' will call 'fread' in libc, so it will return the 
total amount of bytes read.  I think 'Minimum Pixel Area = 3358672' 
is the number of bytes read from your file, but I have no idea why 
it print a '1'  in the first output.
Bo:
2-Jul-2013
Thanks for the suggestion.   I had the number "40" in the file before, 
and it printed "40", but gave me the same long number in the second 
'print-line.  So I don't think that is it.
Kaj:
3-Jul-2013
Bo, your make-c-string leaks memory. read-file will allocate memory 
of the size to fit the file contents
Group: !REBOL3 ... General discussion about REBOL 3 [web-public]
Maxim:
2-Apr-2013
if it where a generic string handling function I'd agree with you... 
but its not... it has added meaning, it splits filesystem paths. 
 its not just a string.  if it where, I'd use parse or some tokenize 
func.

I see absolutely no merit in trying to make split-path act like a 
generic string handling func.  the point of the func is to separate 
folder and file into two parts.   to me it comes down to either you 
decide that when there is no data you invent a default, or use the 
internal one which is none, which works well with soooo many other 
funcs.  if there is no directory part in the path, do not try to 
find a suitable value for it... there is none... funny, even when 
trying to explain my point of view, the actual sentence reads almost 
like a line of rebol source.  :-)
Gregg:
2-Apr-2013
I understand your view Max, but that's not what I asked. It doesn't 
work the way you want today, but maybe there's a way to provide a 
solution that is better than what we have now. I'd love to see your 
custom version, so we can compare its results. And I'm asking about 
SPLIT-AT for a reason, separate from SPLIT-PATH. I'd love to get 
everyone's thoughts.


The funny thing is how much we can all care about the details of 
this func we (at least I) use a lot, and yet which none of us seem 
to like all that much. I think it points out that the normal case 
is the most important, where there is both a path and a file component. 
And maybe now is the time that we can make it just a little bit better, 
a little more consistent.
301 / 4845123[4] 56...4546474849