Re: [racket-users] Re: Boot To Racket

2017-07-11 Thread jukka . tuominen


I've been following this discussion with keen interest. Although my 
Liitin.org project is far from minimal in size (viable sized by design), 
it does have some common objectives. Racket is used as "the native 
language" that is meant to be able to control all areas of the 
cloud-based, native Linux environment. I'm very GUI-oriented myself, but 
will do my best to provide convenient command-line tools as well.


br, jukka


Lehi Toskin:
"I have this idea, this vision. I wish to create a small system that 
would more or less only be to turn on the machine (probably an RPi) and 
then you'd immediately be inside a Racket REPL..."


William G Hatch:
"I would love to see a Racket unikernel, and be able to essentially run 
a

modern Lisp machine..."

--
You received this message because you are subscribed to the Google Groups "Racket 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Order of argument conventions, or ... conventions of argument ordering

2016-04-22 Thread Jukka Tuominen
Not to give an excuse to design the argument order poorly... it would be great 
if DrRacket could display named place-holders for each argument dynamically. 
Then you wouldn't need to guess or try to remember illogical set of parameter 
orders. The argument name could be taken dynamically from the internal argument 
name. I hope you get the idea...

br, jukka

Sent from my iPhone

> On 22.4.2016, at 2.45, Eugene Wallingford  wrote:
> 
> 
>> Eugene Wallingford wrote on 04/21/2016 11:18 AM:
>>> This also reminds me fondly of Smalltalk's separable message
>>> names.  They always felt more natural to me than more typical
>>> keyword arguments.
>> 
>> On a tangent, Smalltalk-like names weren't hard to implement just now, with
>> `syntax-parse` and the modern `#lang` support:
> 
> Nice!  Thanks, Neil.  My students may appreciate this almost
> as much as I do.
> 
>  Eugene
> 
>> #lang rase
>> 
>> (define:: (displayLabel: label withValue: val)
>>  (display: label)
>>  (display: " = ")
>>  (display: val)
>>  (newline))
>> 
>> (displayLabel: "Puppies" withValue: (add: 3 to: 39))
>> ;;=output=> Puppies = 42
>> 
>> 
>> Neil V.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Custodian problems/ IoT service

2015-12-13 Thread jukka . tuominen


The previous code was messy all over the place. This one seems to work, 
although I'm not sure whether it can keep the services securely 
sandboxed as intented and won't run out of memory at some point.

Revised code:
-

#lang racket
; tested in Linux
(define target-mode #f); #f/ "service-1"/ "service-2"

(define (service-switcher)
  (define current-mode #f)
  (define cust (make-custodian))
  (define (system/output command)
(define (system/exit-code+output command)
  (let* ([out (open-output-string)]
 [control (process/ports out #f #f command)]
 [p (list-ref control 4)])
(p 'wait)
(values (p 'exit-code)
(get-output-string out
(let-values ([(e out) (system/exit-code+output command)])
  out))
  (define (switch-mode)
(set! cust (make-custodian))
(parameterize ((current-custodian cust)
   (current-namespace (make-base-namespace)))
  (current-subprocess-custodian-mode 'kill)
  (subprocess-group-enabled #t)
  (cond ((equal? target-mode #f)
 (begin (custodian-shutdown-all cust)
(set! current-mode #f)
(newline)(display "Service disabled")(newline)))
((and (equal? target-mode "service-1"))
 (begin (set! current-mode "service-1")
(newline)(display "Service mode changed to 
Service-1")(newline)

(thread (lambda () (system/output "gedit")
((and (equal? target-mode "service-2"))
 (begin (newline)(display "Service mode changed to 
Service-2")(newline)

(set! current-mode "service-2")
(thread (lambda () (system/output 
"gcalctool"

  (define (loop)
(if (equal? current-mode target-mode)
(begin (display ".")
   (sleep 1)
   (loop))
(begin (custodian-shutdown-all cust)
   (switch-mode)
   (loop
   (thread (lambda () (loop)))
  (display "Service switcher started.")(newline))


;; TESTING

(service-switcher)

(define awhile 5)

(sleep awhile)
(set! target-mode "service-1")
(sleep awhile)
(set! target-mode #f)
(sleep awhile)
(set! target-mode "service-2")
(sleep awhile)
(set! target-mode "service-1")
(sleep awhile)
(set! target-mode #f)
(sleep awhile)
(newline)(display "Test finished (server still running on the 
background. Press CTRL+K to stop it)")(newline)


--


jukka.tuomi...@finndesign.fi kirjoitti 2015-12-12 11:40:

Hi all,

I want to make a custodian-protected, remotely-controlled service
switcher but there's something wrong with my code. The behaviour isn't
reliable and it leaves traces behind filling the memory eventually.
I've included the code below.

TBH, I may have a less optimal approach to it in the first place, so
I'd appreciate any better suggestions.
A little background: As part of Liitin (liitin.org) IoT development
and dog-fooding, I've decided to make my personal A.I. project running
on a remotely-controllable Liitin node as a "Iot Service". Any nodes
fired up will be automagically visible on my Liitin desktop. Any A.I.
node or the user node can be behind different firewalls without open
ports. Neither do they need to know each other's whereabouts. One A.I.
node is to work as an interactive service whereas the rest will take
part in incubating higher intelligence through genetic programming. I
have a simple IoT communication channel in place, but now I want a
reliable means to switch the service mode remotely. I don't want any
ill-behaved A.I. processes running wild either, so I want to make sure
I can shut down the processes remotely when I want to, so the services
will need to be sandboxed. Foremost this is an IoT dog-fooding
excercise, trying to make any Liitin SW or HW node as easy and secure
to use as possible for the basic users, now only taking it to one
extreme.

Finally to the switcher source code...

br, jukka

---


--
You received this message because you are subscribed to the Google Groups "Racket 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Custodian problems/ IoT service

2015-12-12 Thread jukka . tuominen


Hi all,

I want to make a custodian-protected, remotely-controlled service 
switcher but there's something wrong with my code. The behaviour isn't 
reliable and it leaves traces behind filling the memory eventually. I've 
included the code below.


TBH, I may have a less optimal approach to it in the first place, so I'd 
appreciate any better suggestions.
A little background: As part of Liitin (liitin.org) IoT development and 
dog-fooding, I've decided to make my personal A.I. project running on a 
remotely-controllable Liitin node as a "Iot Service". Any nodes fired up 
will be automagically visible on my Liitin desktop. Any A.I. node or the 
user node can be behind different firewalls without open ports. Neither 
do they need to know each other's whereabouts. One A.I. node is to work 
as an interactive service whereas the rest will take part in incubating 
higher intelligence through genetic programming. I have a simple IoT 
communication channel in place, but now I want a reliable means to 
switch the service mode remotely. I don't want any ill-behaved A.I. 
processes running wild either, so I want to make sure I can shut down 
the processes remotely when I want to, so the services will need to be 
sandboxed. Foremost this is an IoT dog-fooding excercise, trying to make 
any Liitin SW or HW node as easy and secure to use as possible for the 
basic users, now only taking it to one extreme.


Finally to the switcher source code...

br, jukka

---
;;; tested in linux. Otherwise the test program needs to be changed
#lang racket

;; The user only needs to change the target mode
(define target-mode #f); #f/ "service-1"/ "service-2"

(define (service-switcher)

  (define current-mode #f)
  (define reset-needed? #f); custodian-shutdown-all

  (define loop
(lambda ()
  (define cust (make-custodian))
  (parameterize ((current-custodian cust)
 (current-namespace (make-base-namespace)))
(thread (lambda ()
  (current-subprocess-custodian-mode 'kill)
  (subprocess-group-enabled #t)
  (display 1)
  (cond ((equal? current-mode target-mode)
 (begin (display 2)
(sleep 3)
(loop)))
((and (equal? current-mode #f)
  (equal? target-mode "service-1"))
 (begin (display 3)
(system "gedit")
(set! current-mode "service-1")
(sleep 5)
(loop)))
((and (equal? current-mode #f)
  (equal? target-mode "service-2"))
 (begin (display 4)
(system "gedit")
(set! current-mode "service-2")
(sleep 5)
(loop)))
  (display 5)
  (sleep 10)
  (when (not (equal? current-mode target-mode))
(begin (display 6)
   (custodian-shutdown-all cust)
   (sleep 5)
   (set! current-mode #f)
   (loop)))
  (display 7)(newline)
  (sleep 5)
  (loop)))

  (thread (lambda () (loop)))
  (display "Service switcher started")(newline))

;; testing

(service-switcher)

(sleep 10)
(set! target-mode "service-1")
(sleep 10)
(set! target-mode #f)
(sleep 10)
(set! target-mode "service-2")
(sleep 10)
(set! target-mode #f)

--
You received this message because you are subscribed to the Google Groups "Racket 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Anybody done some "Internet of Things" stuff with Racket?

2015-11-10 Thread Jukka Tuominen
I'm currently experimenting with Tony's racket/stomp package that you might 
want to check out, too. 

The idea is to provide more generic messaging services for liitin.org project, 
not just IoT but also between people, software services, cloud computing and 
such. Initial target is an easy-to-use higher lever pub/sub and RPC messaging, 
but eventually allowing developers to exploit more of the RabbitMQ's 
capabilities, including MQTT without needing to waste effort on the 
infrastructure, authentication and such. 

There's a lot to be done but advancing little by little :)

br, jukka

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Time-limited evaluation

2015-11-07 Thread jukka . tuominen


Hi all,

I'm probably doing something wrong here, but for some reason 
"custodian-shutdown-all" doesn't always interrupt the execution as the 
last test case below shows. It continues execution until finished.


Any ideas how to get this working?

br, jukka


---

#lang racket/load

(require math/number-theory)


(define (when-works-in-given-seconds time-limit thunk)
  (define start-time 0)
  (define output "initial-state")
  (define main-cust (make-custodian))
  (define thread:thunk "")
  (define (loop delay)
(cond ((not (equal? "initial-state" output))
   (begin (custodian-shutdown-all main-cust)
  output))
  ((> (- (current-seconds) start-time) time-limit)
   (begin (custodian-shutdown-all main-cust)
  "Time-limit exceeded!"))
  (else (begin (- (current-seconds) start-time)
   (sleep delay)
   (loop delay) 
  (set! start-time (current-seconds))
  (thread (lambda ()  (parameterize ((current-custodian main-cust))
(thread (lambda () (with-handlers ((exn:fail? 
(lambda (exn) (set! output "Execution failed!"  (set! output (eval 
thunk

  (loop 0.1))


;test cases

(print (when-works-in-given-seconds 2 '(/ 5 5)))
(newline)(sleep 2)

(print (when-works-in-given-seconds 2 '(/ 5 0)))
(newline)(sleep 2)

(print (when-works-in-given-seconds 2 '(sleep 10)))
(newline)(sleep 2)

(print (when-works-in-given-seconds 2 '(factorial 2)))


--
You received this message because you are subscribed to the Google Groups "Racket 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Time-limited evaluation

2015-11-07 Thread jukka . tuominen


Hehe, I think I need a faster computer, because that was the intention. 
Anyhow, I'm glad it's working.


I think what happened was that initially I didn't have it right and 
lowered the number to make debugging faster. Then tested with another 
function and got confused.


Thank you Matthew for the help once again.

br, jukka



Matthew Flatt kirjoitti 2015-11-08 02:48:

Did you mean to create a bigger computation than `(factorial 2)`?
It takes only about 5 msec on my machine, but adding a couple of extra
zeros makes it time out.

Converting the result of `(factorial 2)` to a string takes a bit
longer than the arithmetic, and printing out the result in DrRacket
takes much longer than 2 seconds --- due to scrolling while parts of
the number print out --- but all of that happens outside the sandbox.

At Sun, 08 Nov 2015 00:35:09 +0200, jukka.tuomi...@finndesign.fi wrote:


Hi all,

I'm probably doing something wrong here, but for some reason
"custodian-shutdown-all" doesn't always interrupt the execution as the
last test case below shows. It continues execution until finished.

Any ideas how to get this working?

br, jukka


---

#lang racket/load

(require math/number-theory)


(define (when-works-in-given-seconds time-limit thunk)
   (define start-time 0)
   (define output "initial-state")
   (define main-cust (make-custodian))
   (define thread:thunk "")
   (define (loop delay)
 (cond ((not (equal? "initial-state" output))
(begin (custodian-shutdown-all main-cust)
   output))
   ((> (- (current-seconds) start-time) time-limit)
(begin (custodian-shutdown-all main-cust)
   "Time-limit exceeded!"))
   (else (begin (- (current-seconds) start-time)
(sleep delay)
(loop delay) 
   (set! start-time (current-seconds))
   (thread (lambda ()  (parameterize ((current-custodian main-cust))
 (thread (lambda () (with-handlers ((exn:fail?
(lambda (exn) (set! output "Execution failed!"  (set! output (eval
thunk
   (loop 0.1))


;test cases

(print (when-works-in-given-seconds 2 '(/ 5 5)))
(newline)(sleep 2)

(print (when-works-in-given-seconds 2 '(/ 5 0)))
(newline)(sleep 2)

(print (when-works-in-given-seconds 2 '(sleep 10)))
(newline)(sleep 2)

(print (when-works-in-given-seconds 2 '(factorial 2)))


--
You received this message because you are subscribed to the Google 
Groups

"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send 
an

email to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "Racket 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] racket users fight for their right to colon keywords

2015-10-14 Thread Jukka Tuominen
Yoda like that would, but to me it looks backwards. How about...?
key: value

br, jukka
UX Manager :)

Sent from my iPhone

> On 14.10.2015, at 18.50, Neil Van Dyke  wrote:
> 
> We are conducting a highly scientific poll.
> 
> The question we want to answer is whether people would like for the Racket 
> standard languages to have symbols that begin with the colon character 
> (except for the symbol `:`) to read the same has keywords that begin with 
> pound-colon.
> 
> That is, when this glorious colon-keywords support is added, instead of 
> having to type and look at:
> 
>(foo #:abc 1 #:xyx 42)
> 
> you can choose to bask in the beauty of:
> 
>(foo :abc 1 :xyx 42)
> 
> Then you would be free to use the gorgeous colon-keywords everywhere in 
> Racket, including in quick one-line examples in email list posts.
> 
> All people of great aesthetic sense, intellect, and good moral fiber, who 
> would naturally like everyone to have the right to use either colon-keywords 
> or (eww) pound-colon keywords (in unity, and without unnecessary `#lang` 
> schisms!), should answer the quick poll:
> 
>http://goo.gl/forms/Kwl3uZVMsb
> 
> (When the poll question asks "Is it worth changing?", read it is as "You are 
> a good person, and you naturally think Racket should support both 
> colon-keywords and pound-colon keywords, right?")
> 
> I call upon all freedom-loving Racketeers to stand up and fight for the 
> righteous cause of colon-keywords.  The moment to answer this highly 
> scientific poll is now.
> 
> Neil V.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Racket education & activities in greater Helsinki area?

2015-10-14 Thread jukka . tuominen

Hi all racketeers in Helsinki or nearby,

I wonder if there are any Racket courses or other Racket-related 
activities available in Helsinki or the surrounding areas? I'm mainly 
interested in open university type-of CS lessons, or Internet of Things 
kind-of hobby activities, but anything really. Others around the area 
might be interested in hearing what's available too.


Also, programming will be part of the generic education in comprehensive 
schools in Finland, and higher levels thereafter, so I'm curious to hear 
if any schools will use Racket. I know Tampere is being active there, at 
least.


br, jukka


--
You received this message because you are subscribed to the Google Groups "Racket 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: Eval namespace revisited ...again

2015-09-26 Thread Jukka Tuominen

In case it should be of help to anyone, using #lang racket/load solved the
problems and things run smoothly now.

br, jukka


> Hi all,
>
> I'm working on a generic solution to distributed computing/ IoT/ M2M/
> scheduled task handling etc. basing on messaging. The emphasis is on
> usability so it is essential to allow running functions identically
> despite of where they are run. The obvious thing to expect is that when
> sending an expression like '(+ 1 2 3) to a remote computer, it will be
> evaluated something like (eval '(+ 1 2 3) custom-namespace) in the
> background and returns the expected "6".
>
> I've seen the numerous discussions warning about namespace conflicts, but
> as far as I understand it should be safe in Liitin environment, where I
> intend to use it ( liitin.org ). That is, the special environment is
> initiated always with identical start-up definitions. No new top-level
> definitions are allowed because of Liitin's own way of dealing with
> dynamic objects. Internal definitions, however, are allowed (say, internal
> define's within lambda expressions), but those should be safe, right?
>
> Instead of some standard base namespace, I need to use a custom one.
> I'v tried the following, but it doesn't seem to work:
>
> (define namespace (current-namespace))
> (parameterize ((current-namespace namespace))
>  ...
> (eval expression namespace))
>
> Any suggestions on how to make this work?
>
> br, jukka
>
>
>


-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Re: Eval namespace revisited ...again

2015-09-26 Thread Jukka Tuominen

Thank you Jens, that's a very helpful example.

br, jukka


> An alternative to racket/load if you need something easier to control:
>
> #lang racket
>
> ;; Make a new namespace
> (define custom-namespace (make-base-empty-namespace))
>
> ;; Fill it with relevant bindings
> (parameterize ([current-namespace custom-namespace])
>   (namespace-require ''#%kernel)
>   (namespace-require 'racket/base)
>   (namespace-require/copy 'racket/list))
>
> ;; Use it in eval
> (define (custom-eval expr)
>   (eval expr custom-namespace))
>
> ;; Test it
> (custom-eval '(+ 1 2 3))
>
>
> 2015-09-26 13:56 GMT+02:00 Jukka Tuominen <jukka.tuomi...@finndesign.fi>:
>
>>
>> In case it should be of help to anyone, using #lang racket/load solved
>> the
>> problems and things run smoothly now.
>>
>> br, jukka
>>
>>
>> > Hi all,
>> >
>> > I'm working on a generic solution to distributed computing/ IoT/ M2M/
>> > scheduled task handling etc. basing on messaging. The emphasis is on
>> > usability so it is essential to allow running functions identically
>> > despite of where they are run. The obvious thing to expect is that
>> when
>> > sending an expression like '(+ 1 2 3) to a remote computer, it will be
>> > evaluated something like (eval '(+ 1 2 3) custom-namespace) in the
>> > background and returns the expected "6".
>> >
>> > I've seen the numerous discussions warning about namespace conflicts,
>> but
>> > as far as I understand it should be safe in Liitin environment, where
>> I
>> > intend to use it ( liitin.org ). That is, the special environment is
>> > initiated always with identical start-up definitions. No new top-level
>> > definitions are allowed because of Liitin's own way of dealing with
>> > dynamic objects. Internal definitions, however, are allowed (say,
>> internal
>> > define's within lambda expressions), but those should be safe, right?
>> >
>> > Instead of some standard base namespace, I need to use a custom one.
>> > I'v tried the following, but it doesn't seem to work:
>> >
>> > (define namespace (current-namespace))
>> > (parameterize ((current-namespace namespace))
>> >  ...
>> > (eval expression namespace))
>> >
>> > Any suggestions on how to make this work?
>> >
>> > br, jukka
>> >
>> >
>> >
>>
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups
>> "Racket Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send
>> an
>> email to racket-users+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> --
> Jens Axel Søgaard
>


-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Eval namespace revisited ...again

2015-09-19 Thread Jukka Tuominen
Hi all,

I'm working on a generic solution to distributed computing/ IoT/ M2M/
scheduled task handling etc. basing on messaging. The emphasis is on
usability so it is essential to allow running functions identically
despite of where they are run. The obvious thing to expect is that when
sending an expression like '(+ 1 2 3) to a remote computer, it will be
evaluated something like (eval '(+ 1 2 3) custom-namespace) in the
background and returns the expected "6".

I've seen the numerous discussions warning about namespace conflicts, but
as far as I understand it should be safe in Liitin environment, where I
intend to use it ( liitin.org ). That is, the special environment is
initiated always with identical start-up definitions. No new top-level
definitions are allowed because of Liitin's own way of dealing with
dynamic objects. Internal definitions, however, are allowed (say, internal
define's within lambda expressions), but those should be safe, right?

Instead of some standard base namespace, I need to use a custom one.
I'v tried the following, but it doesn't seem to work:

(define namespace (current-namespace))
(parameterize ((current-namespace namespace))
 ...
(eval expression namespace))

Any suggestions on how to make this work?

br, jukka



-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] RCP over racket-stomp

2015-08-07 Thread Jukka Tuominen



 On 08/07/2015 12:43 PM, Jukka Tuominen wrote:
 Disconnected before receipt R14642 was received

 What shows up in the RabbitMQ logs around the time that the
 disconnection happens? Often a bunch of detail is logged that is not
 passed on to the connected client.

 Tony


I found this:

=INFO REPORT 7-Aug-2015::22:00:21 ===
accepting STOMP connection 0.5761.4 ([client-ip]:59326 -
[server-ip]:61613)

=ERROR REPORT 7-Aug-2015::22:00:25 ===
Channel error on connection 0.5764.4 ([client-ip]:59326 -
[server-ip]:61613, vhost: '/', user: 'device7'), channel 1:
{amqp_error,access_refused,
access to queue 'amq.gen--sUYfl-1_IbdAXhs8LwoUA' in vhost '/'
refused for user 'device7',
'basic.consume'}

=ERROR REPORT 7-Aug-2015::22:00:25 ===
STOMP error frame sent:
Message: access_refused
Detail: ACCESS_REFUSED - access to queue 'amq.gen--sUYfl-1_IbdAXhs8LwoUA'
in vhost '/' refused for user 'device7'\n
Server private detail: none

=INFO REPORT 7-Aug-2015::22:00:25 ===
closing STOMP connection 0.5761.4 ([client-ip]:59326 - [server-ip]:61613)



 PS. I tried to get RabbitMQ+STOMP running yesterday and failed to get it
 to go, full stop! Surprising permissions errors. Which was, uh,
 *unexpected*, considering. I'll have another try over the weekend, if I
 get a chance.


Hehe, comforting but scary at the same time to hear that it can happen to
you too :)

br, jukka

 --
 You received this message because you are subscribed to the Google Groups
 Racket Users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to racket-users+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.



-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] RCP over racket-stomp

2015-08-07 Thread Jukka Tuominen

For testing purposes, I changed the permissions to ^.* .* '* which
got rid of the error messages. However, there is still no reply eventhough
the message is received by the target computer. Hmmm, in this case both
SUB and PUB are device7 should it matter.

br, jukka


 On 08/07/2015 03:19 PM, Jukka Tuominen wrote:
 =ERROR REPORT 7-Aug-2015::22:00:25 ===
 Channel error on connection 0.5764.4 ([client-ip]:59326 -
 [server-ip]:61613, vhost: '/', user: 'device7'), channel 1:
 {amqp_error,access_refused,
 access to queue 'amq.gen--sUYfl-1_IbdAXhs8LwoUA' in vhost
 '/'
 refused for user 'device7',
 'basic.consume'}

 Based on this, I think a productive line of investigation would be to
 see if using the permissions-configuration stuff from rabbitmqctl might
 help. The server is claiming that user device7 is not permitted to
 read from queues with server-generated names.

 Since I haven't managed to get even basic STOMP messaging working
 myself, I'm not the best person to ask about exactly how to do this, of
 course :-) but https://www.rabbitmq.com/access-control.html might get
 you started...

 Tony

 --
 You received this message because you are subscribed to the Google Groups
 Racket Users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to racket-users+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.



-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] RCP over racket-stomp

2015-08-07 Thread Jukka Tuominen

Tony,

having experimented with your code to catch `exn:stomp` exception, this is
what I got first:

Disconnected before receipt R14642 was received

There are two sends in the code, and it is actually the second call that
causes the error. With a single send, no error is signalled but nothing is
retuned either. Taking away (receipt ,receipt) from send had no effect.

br, jukka


 On 08/06/2015 02:03 PM, Jukka Tuominen wrote:
 From a generic STOMP documentation I’ve understood that I should send a
 ”reply-to” header item with a temporary queue value, but I’m not sure
 about the format I should use in racket-stomp. I tried...
 #:headers `((receipt ,receipt)(persistent true)(reply-to
 /temp-queue/foo))
 ... which returned  ”Received ERROR” without further information.

 You need to catch the `exn:stomp` exception, which includes the error
 frame; untested example code:

   (with-handlers [(exn:stomp? (lambda (e)
  (log-error STOMP error ~v
 (exn:stomp-frame e]
 ...)

 Also, it is a good idea to check the logs of whichever broker you are
 using.

 Also, even though the target computer is able to receive the message,
 I’m
 not sure how to make it to respond with a value.

 Which broker are you using?

 Cheers,
   Tony



-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] RCP over racket-stomp

2015-08-06 Thread Jukka Tuominen

I have installed a RabbitMQ server for Liitin project (http://liitin.org)
to develop and test various messaging possibilities between users and
various devices and services (Internet of Things). So far I have a very
small toy program to publish and subscribe to dummy notifications.

Now I'd like to modify the code for cases when needing to make more direct
enquiries or remote controls with a feedback.

Here is what I have so far. Anybody is free to test it until I change the
password :)


; SUB XX
;;; Have this running in one DrRacket tab, before running the PUB in
another tab.
;;; Then switch back to SUB to see the incoming notifications

#lang racket

(require (planet main.rkt (tonyg stomp.plt 3 2)))
(require mzlib/string)

;;; DEVICE SUBSCRIPTION

(define (my-message-handler message)
  (define disarmed-message (read-from-string (bytes-string/utf-8
(stomp-frame-body message
  (define signer unknown); extract from signed (open-air) message
  (define timestamp unknown); extract when the package was wrapped
  (define interpreter car)
  (define arguments cdr)
  (when (list? disarmed-message); ignore others
(begin (display   You received a new message signed by ') (display
signer)(display ' dated ')(display timestamp)(display ': )(print
disarmed-message)(newline); Add signed by...
   (cond
 ((equal? 'store-photo (interpreter disarmed-message)) (thread
(lambda () (display This places a new photo to your
photo album)(newline)(newline; (eval
disarmed-message); Eval reguires Liitin environment
 ((equal? 'pull-request (interpreter disarmed-message))
(thread (lambda () (display This is a
pull-request)(newline)(newline; (eval
disarmed-message); Eval reguires Liitin environment
 ((equal? 'instant-notification (interpreter
disarmed-message)) (thread (lambda () (display This is
an instant notification)(newline)(newline; (eval
disarmed-message); Eval reguires Liitin environment
 ((equal? 'device-settings (interpreter disarmed-message))
(thread (lambda () (display These are the current
settings for the specified device)(newline)(newline;
(eval disarmed-message); Eval reguires Liitin
environment
 


(define (listen-to-my-messages)
  (define credientials (stomp-connect liitin.org #:login device7
#:passcode Guest313 #:virtual-host /)); #:headers, #:login,
#:passcode, #:port-number, #:request-versions, and #:virtual-host
  (stomp-subscribe credientials /queue/device7.default my-subscription
#:ack-mode 'auto #:headers '((persistent true))); verify format! Also,
prohibit listening others!
  (thread (lambda ()
(let loop ()
  (let ((open-air-message (stomp-next-message credientials
my-subscription))); I.e, this is seen outside world, so
secure it!
(my-message-handler open-air-message); filters out
anything else
(loop)
  (display Listening new messages...)(newline)(newline))


(listen-to-my-messages)


; PUB XX

#lang racket


(require (planet main.rkt (tonyg stomp.plt 3 2)))

;;; PUBLICATION


(define credientials (stomp-connect liitin.org #:login device7
#:passcode Guest313 #:virtual-host /))

(define (default-address recipient)
  (string-append /queue/ recipient .default))

(define (my-encrypt-signer data)
  data); place-holder only for now!

(define (wrap sender recipient-list encrypt-signer data)
  (list sender (current-seconds) recipient-list (encrypt-signer data)))


(define (send-default-message recipient secured-message)
  (call-with-receipt credientials
 (lambda (receipt)
   (stomp-send credientials (default-address
recipient) (string-bytes/utf-8 secured-message)
#:headers `((receipt ,receipt)(persistent
true)); verify format!
   ;(stomp-send credientials (default-address
recipient) (string-bytes/utf-8 secured-message)
#:headers `((receipt ,receipt)(persistent
true)(reply-to /temp-queue/foo)); verify
format!

;; TESTING

(define secured-message1 (store-photo photo from-device7)); place-holder
only for now. Sign and encrypt before placing open air.
(define secured-message2 (pull-request target-object replacement-object
description from-device7)); place-holder only for now. Sign and encrypt
also before placing open air.
(define secured-message3 (instant-notification notification-content
from-device7)); place-holder only for now. Sign and encrypt also before
placing open air.
(define secured-message4 (device-settings device-x from-device7));
place-holder only for now. Sign and encrypt also before placing open air.


(sleep 3)
(send-default-message device7 secured-message1);This goes open air - be
sure to secure the message before sending it!
(sleep 5)
(send-default-message device7 secured-message2)
(sleep 5)


(stomp-disconnect credientials)

;XX END XX


br, jukka


 On 08/06/2015 02:03 PM, Jukka Tuominen wrote:
 From a generic STOMP