Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Oct 20 22:59
    @dockimbel banned @SmackMacDougal
  • Dec 03 2017 05:53
    @PeterWAWood banned @matrixbot
  • Sep 28 2016 12:19
    @PeterWAWood banned @TimeSeriesLord
  • Aug 13 2016 03:23
    @PeterWAWood banned @Vexercizer
Vladimir Vasilyev
@9214
Okay, to put it another way: what call/input/output "sqlite3.exe" ".help" out: "" returns?
viayuve
@viayuve

@9214 >> call/input/output "sqlite3.exe" ".help" out: ""
== 0

out
== ""

Vladimir Vasilyev
@9214
0 means that command executed successfully.
Boleslav Březovský
@rebolek
It's Windows, maybe the output does not go to stdout?
viayuve
@viayuve
i know "? call" gave me that hint but want to see output
@rebolek this works call/input/output "cat" "hello world" s: ""
call/input is "sqlite3.exe" ".help" and call/output is out: "" right or call/input "sqlite3.exe" and call/output is ".help" out: "".
viayuve
@viayuve
/show => Force the display of system's shell window (Windows only). will this work?
it opens cmd and closes fast
amreus
@amreus
@viayuve call/output {sqlite3 "" ".help"} out: ""
sqlite3 is looking for a filename as it's first parameter.
viayuve
@viayuve
thanks @amreus now I know. Now. I can kill some queries. Also How viable solution is sqlite3.exe is for production.
I mean ODBC vs sqlite3.exe
amreus
@amreus
@viayuve Did you solve your CGI problem? How?
viayuve
@viayuve
CGI problem ??
amreus
@amreus
@viayuve Oh I misread it - it was not a CGI problem - it was not seeding the random number.
viayuve
@viayuve
what was not seeding random number @amreus can you comment on that. I was asking about "call" only today. and another thing was about this "how to do one task at a time execution. like resource locking something like that? when one user's task in execution, another user must not be able to execute another task. "
Semseddin Moldibi
@endo64
Easiet way is to check a temporary file when your script starts, if the file exists just quit, if not create that file and continue, just before exiting delete the file.
You can also write date into that file so when second time your script executed you can determine that how long the previous script running and decide do kill it etc.
amreus
@amreus

I'm reading a binary file in order to print a version number in its header. Lets say I have the version as a binary v: #{00310036002E0031002E003100340035003000}. In the gui console if I print to-string v I get "16.1.1450" but using the cli console I get spaces before each number: " 1 6 . 1 . 1 4 5 0". The actual string returned by to string! v is "^@1^@6^@.^@1^@.^@1^@4^@5^@0^@". Can I safely just replace/all those unwanted "^@", or what is the correct way to decode and print that binary? Thanks. (Windows 10 64-bit, Red 277a439)

Here's the whole script so far:

Red []
args: system/options/args
model: read/binary/part to-file args/1 60
v: copy/part pos: next find model "{" find pos "}"
print to string! v
nedzadarek
@nedzadarek
@endo64 then I would store PID (at least on the Windows, I am not sure how it is called on the other OSes) as well.
Gabriele Santilli
@giesse
@amreus that looks like UTF-16 or similar 2 byte encoding.
if you know for sure that you will never have anything but ASCII in there then just taking every second byte will work. Otherwise properly decoding it would be best.
Semseddin Moldibi
@endo64

@amreus v has those "unwanted" zero bytes, if you are are sure that it will always have them, as @giesse pointed out, you can remove them:

>> to string! trim/with copy v #"^@"
== "16.1.1450"

The difference between CLI and GUI console is, GUI console doesn't print/show the zero:

>> print "^(61)^(00)^(62)"
ab

But CLI shows it as a space, a b.

amreus
@amreus
Thank you @giesse and @endo64. I'm fairly sure the version number will only be dots and digits for the foreseeable future.
GiuseppeChillemi
@GiuseppeChillemi
I wish to have a window with a button and It I presa It, another windows is opened near the button with other faces. How should I do ?
*if I press It
( apologize, again on mobile)
nedzadarek
@nedzadarek
@GiuseppeChillemi something like this I guess:
p: layout [base "foo"]
view [button "new" [view p]]
GiuseppeChillemi
@GiuseppeChillemi
Is there a way to have It opened with an offset from the current position ?
And how not having drag bars , resize and close button ?
nedzadarek
@nedzadarek
@GiuseppeChillemi let me see docs for your first question. About 2nd I have no idea.
GiuseppeChillemi
@GiuseppeChillemi
I Need to open a sub panel with multiple buttons. Thats my goal.
nedzadarek
@nedzadarek
p: layout [base "foo"]
; p/offset: 50x50 
view [button "new" [p/offset: 50x50 view p ]]
I have tried with p/offset. I'm not sure why 2nd line won't work. To be honest I'm not sure if this is how we should do this. Use at your own risks.
@GiuseppeChillemi
GiuseppeChillemi
@GiuseppeChillemi
Thanks
Gregg Irwin
@greggirwin

@GiuseppeChillemi https://doc.red-lang.org/en/view.html#_window shows the various window flag options. You might also get some positioning ideas from https://gist.github.com/greggirwin/9cd640ca42bdfd56c5ff4432c4765d2c

@nedzadarek what OS? Both approaches work for me in Win10.

Toomas Vooglaid
@toomasv

@GiuseppeChillemi On W10:

p: layout [base "foo"]
view lay: layout [button "new" [p/offset: lay/offset + as-pair lay/size/x -25 view p ]]

Or, without lay:

view [button "new" [p/offset: face/parent/offset + as-pair face/parent/size/x -25 view p ]]
Toomas Vooglaid
@toomasv
Or, totally self-contained:
view [button "new" [
    par: face/parent 
    view/options [below base "foo" button "Close" [unview]] 
    compose [offset: (par/offset + as-pair par/size/x -25)]
]]
Toomas Vooglaid
@toomasv
Ah, yes, view/flags either no-button or no-border, depending on your needs.
nedzadarek
@nedzadarek

@greggirwin First, try to

  • press button
  • close p

few times. The new window should move down.

Secondly, Win 8.1 x64 tested on:

  • Red for Windows version 0.6.3 built 26-Mar-2018/1:14:22+02:00
  • Red 0.6.3 for Windows built 8-Nov-2018/8:26:02+01:00 commit #06ddce9
Gregg Irwin
@greggirwin

Thanks @nedzadarek. I get it now. The offset is updated based on window border metrics, because you're setting it for the layout (which is contained in a window).

>> p: layout [base "foo"]
== make object! [
    type: 'window
    offset: none
    size: 100x100
    text: none
    image: none
    color: none
    ...
>> p/offset: 50x50 
== 50x50
>> view [button "new" [print p/offset view p ]]
50x50
53x76
56x102
59x128

Seems deep in the system, so something we should doc, but probably not a quick change.

Gregg Irwin
@greggirwin
And it seems my recent change to privatize parse-func-spec broke its direct use. Ticket opened.
viayuve
@viayuve
virtual terminal inside app how ?
Boleslav Březovský
@rebolek
Inside GUI app?
viayuve
@viayuve
yes
or whole terminal may be
Boleslav Březovský
@rebolek
You need some area to enter text and some area to display results (they can be same area). Then you just do load input-textand put result into your output area. You also need to patch print and few other functions, so they will output to your area instead of console (same with input function).
viayuve
@viayuve
--cli what this does?
nedzadarek
@nedzadarek
@viayuve it runs the Red in the system console (text console, cmd in the Windows).
Boleslav Březovský
@rebolek
See the documentation for details https://github.com/red/red/