[racket-users] Posting Events To Window Asynchronously From Different Thread?

2018-11-19 Thread Jason Stewart
In Windows, we have a SendMessage() function for dispatching a window event 
synchronously, and PostMessage() for asynchronously queuing an event to a 
specified window from any thread.

Is there a way to do PostMessage() from Racket's GUI library?

Eventspaces feels warm, but couldn't find what I was looking for in it:

https://docs.racket-lang.org/gui/windowing-overview.html?q=sleep#%28part._eventspaceinfo%29


-- 
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: Posting Events To Window Asynchronously From Different Thread?

2018-11-19 Thread Jason Stewart
I tried queue-callback this evening.  Just what I needed!  Thank you.

On Monday, November 19, 2018 at 6:31:04 PM UTC-6, Alex Harsanyi wrote:
>
> The `send-message-to-window` has a corresponding `on-message` method which 
> needs to be implemented in the target control for it to do something useful 
> so it is not a general replacement for `PostMessage`, but it can be used 
> for cases where PostMessage is called with WM_USER, messages.
>
> The Windows `PostMessage` function is used for posting any message, and 
> windows GUI uses messages for everything.  For example, to set the icon for 
> a toplevel window, one can send the WM_SETICON message as in:
>
> PostMessage(aWindow, WM_SETICON, ICON_SMALL, anIcon)
>
> The way to do hat in Racket is to call `set-icon`: 
>
> (send a-frame set-icon an-icon #f 'small)
>
> However, the above call will have unexpected results if called from a 
> thread that is not the event handling thread: the correct way to make the 
> call from another thread is to use `queue-callback` like so:
>
> (queue-callback (lambda () (send a-frame set-icon an-icon #f 'small))
>
> I am not sure which methods on GUI classes are safe to be called from a 
> non-event handling thread, but most of them are not, so I use 
> `queue-callback` for all such cases.  The PostMessage call works from any 
> thread, not just the event handling thread, so this problem does exist in 
> the Win32 API.
>
> Alex.
>
> On Tuesday, November 20, 2018 at 6:32:14 AM UTC+8, Philip McGrath wrote:
>>
>> There is a send-message-to-window function (
>> http://docs.racket-lang.org/gui/Windowing_Functions.html#%28def._%28%28lib._mred%2Fmain..rkt%29._send-message-to-window%29%29),
>>  
>> though I've never used it, and it sounds like it is different from what you 
>> describe.
>>
>> -Philip
>>
>>
>> On Mon, Nov 19, 2018 at 5:22 PM Alex Harsanyi  
>> wrote:
>>
>>>
>>>
>>> I think `queue-callback` is the closest "general" equivalent: it allows 
>>> invoking methods on GUI objects from outside the event handler thread.  It 
>>> can also be used to schedule some work to be done outside a GUI widget's 
>>> callback invocation.
>>>
>>> If you actually want to post specific messages to a window, you will 
>>> have to map "PostMessage" via FFI and you can find the target window handle 
>>> using `get-client-handle`. This will only work on the windows platform.
>>>
>>>
>>> https://docs.racket-lang.org/gui/Windowing_Functions.html?q=ququq-callback#%28def._%28%28lib._mred%2Fmain..rkt%29._queue-callback%29%29
>>>
>>> Alex.
>>>
>>> On Monday, November 19, 2018 at 7:42:12 PM UTC+8, Jason Stewart wrote:
>>>>
>>>> In Windows, we have a SendMessage() function for dispatching a window 
>>>> event synchronously, and PostMessage() for asynchronously queuing an event 
>>>> to a specified window from any thread.
>>>>
>>>> Is there a way to do PostMessage() from Racket's GUI library?
>>>>
>>>> Eventspaces feels warm, but couldn't find what I was looking for in it:
>>>>
>>>>
>>>> https://docs.racket-lang.org/gui/windowing-overview.html?q=sleep#%28part._eventspaceinfo%29
>>>>
>>>>
>>>> -- 
>>> 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...@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] Re: Posting Events To Window Asynchronously From Different Thread?

2018-11-19 Thread Jason Stewart
I tried queue-callback this evening.  Just what I needed!  Thank you.

-- 
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] Thanks to Alex

2018-11-28 Thread Jason Stewart
My first Racket program:

https://github.com/BourgeoisBear/stdinoscope

Thanks to Alex for help with my window messaging issue!

-- 
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: Thanks to Alex

2018-11-28 Thread Jason Stewart
Yep.  There was some Python script that used Gnuplot to do the same thing, 
but the refresh rate was fairly awful.  There's also the original Gnuplot 
hack of putting a reload and timeout in your plot instructions--leading to 
gnuplot whack-a-mole.

Didn't notice that Racket had an incredible plotting library until after I 
finished.  Not sure how efficient it would be at live streaming, but it 
would definitely look nicer than what I've hand-rolled.


On Wednesday, November 28, 2018 at 6:28:03 PM UTC-6, Alex Harsanyi wrote:
>
>
>
> On Wednesday, November 28, 2018 at 8:38:04 PM UTC+8, Jason Stewart wrote:
>>
>> My first Racket program:
>>
>> https://github.com/BourgeoisBear/stdinoscope
>>
>>
> This looks cool.  Is this program intended for displaying real time data 
> from some signal acquisition system?
>
> I'm also working on an application that will have to display several 
> real-time plots, and I am undecided over whether to use the existing racket 
> plot library or to write my own -- the plot library is mostly designed for 
> plotting static data and mathematical functions, although it can be used in 
> some creative ways.  So far however, I am working on the "data acquisition" 
> part and the data display will have to wait a bit longer...
>
> Cheers,
> Alex.
>
>

-- 
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: hackernews

2018-12-14 Thread Jason Stewart
Probably counterproductive.  I've still got a bad taste about Rust from all 
of their people bombing the C and embedded threads--everywhere.

Hard to top HN itself for Racket evangelism.  It's written in Arc, which is 
written in Racket.


On Thursday, December 13, 2018 at 5:53:41 PM UTC-6, Neil Van Dyke wrote:
>
> This might be a bad idea, and normally I disapprove of this sort of 
> thing, but... does anyone want to take on the job of RACKET EVANGELISM 
> STRIKE FORCE, among a concentration of startup-types and other software 
> practitioners? 
>
> Specifically, you'd participate regularly in Y Combinator's popular 
> "Hacker News" Web forum, "https://news.ycombinator.com/";, and, when the 
> not-unusual occasion to mention/show a strength of Racket presents 
> itself, do so. 
>
> I occasionally see Racket mentioned on HN, but not nearly as often as it 
> legitimately could be. 
>
> (There are also other strategic targets for the RACKET EVANGELISM STRIKE 
> FORCE operator or cell, and I recall Eli Barzilay and others active on a 
> lot of them years ago, but HN might be first priority right now.) 
>
>

-- 
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: hackernews

2018-12-15 Thread Jason Stewart

>
> RFB is a wonderful idea.  Aside from the main site, there is a lot of 
catching-up to do (quantity-wise anyway) compared to something like 
JavaScript or Ruby.

>
I'm not sure if HN even matters if there are enough good blog posts out 
there.  Search does a decent job of getting people to those sorts of post.

>
Biggest obstacles I see to filling the web with Racket articles would be 
the high quality of existing documentation, and the straight-forward nature 
of the language itself.  When it comes to things like C++, PHP, and 
JavaScript, there is so much room for comment because they are all so full 
of arbitrary / strange / questionable choices that demand further 
explanation, and once explained, open the field to debate over which 
(necessary) defensive strategies are best.

-- 
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] hackernews

2018-12-26 Thread Jason Stewart
Even for blue-sky projects without any legacy lock-in, I don't fancy our 
chances with the enterprise/MIS crowd.  They tend to favor straight-jacket 
languages, and for good reason!

For some guy running a two-man startup, something like Racket is a super 
weapon.  For a large organization--with any staff turnaround at 
all--metaprogramming is cancer.  They need a "paper trail" for the next guy 
to follow.


On Wednesday, December 26, 2018 at 3:51:03 PM UTC-6, spdegabrielle wrote:
>
> Hi Matthew, Neil,
>
> > the people who are persuadable.
> So who are the ‘persuadable’? And where to find them if not on hn? 
>
> I’m one of the ‘corporate MIS programmers’, but in the public 
> sector(health), and I get to interact with a variety of software vendors as 
> well as and build forms, worklists, reports and business logic on their 
> platforms. I certainly don’t get to choose.
>
> My role does put me in the lucky position to ask ISV’s what languages 
> their systems are written in;
> Example include (from older to newer)
> * COBOL 
> * VB.6 (two vendors)
> * ASP.net, C# & JavaScript (more recent vendor)
> * PHP w/Symfony & Python
> * Ruby on Rails 
> * Java
> * Perl 
> * Cache/MUMPS (two vendors - one is actually the customer of the other)
> [ these are all ‘single product vendors’ - I don’t know if that is unusual 
> in industry ]
>
> In all the cases it seems the language is determined by the founder, and 
> has not changed for the life of the product & company, in some cases for 
> many years (the cobol and VB products have been around for 20+ years)
>
> I’ve even met some of the founders - 3 out of 4 are specialty doctors.
>
> I will have to ask next time I meet a founder, but at this stage I don’t 
> think any ‘choosing a language’ was involved - I think the founders I have 
> met just chose whatever was available at the time. (if you a meet a 
> potential founder please say ‘have you looked at Racket?’)
>
> I had to type this to put it together in my head - maybe I shouldn’t have 
> sent it and bored you with my thought processes.
>
> So who are the ‘persuadable’? And where to find them? 
>
> Kind regards,
>
> Stephen
>
> PS in my workplace the biggest competitor isn’t other languages, it is the 
> spreadsheet; sometimes stand alone, sometimes linked or shared, but mostly 
> with no VBA.
>
> PPS I think the Jupyter enhanced REPL idea is worth pursuing and extending 
> as this might be a way generate interest in the Racket runtime and 
> associated languages.
>
>
>
>
> On Wed, 26 Dec 2018 at 18:50, Matthew Butterick  > wrote:
>
>> I agree that success stories are helpful. I'll go one better — I think it 
>> would be great to have a section of the main Racket website devoted to 
>> these stories that show who uses Racket and how / why (inside & outside 
>> academia). This could be done in an interview-style format, like Jesse 
>> Alama's recent book about language-making in Racket [1]. Photos also. I 
>> would be happy to contribute design & layout if a sufficiently motivated 
>> collaborator — you, Neil? — wanted to conduct the interviews & gather the 
>> material.
>>
>> I find the idea of doing language advocacy *on* Hacker News (or Stack 
>> Overflow, or Quora, etc.) to be weird. Not because I'm a curmudgeon. But 
>> rather because it's inherently low-leverage, and misses a lot of the people 
>> who are persuadable.
>>
>> [1] https://languagemakers.net/anthropology/
>>
>>
>>
>> On Dec 26, 2018, at 6:51 AM, Neil Van Dyke > > wrote:
>>
>> I want to see more people making a living working with/on Racket (outside 
>> of professorships, and grad student slave stipends), and I think that means 
>> a lot more companies using it for substantial projects, and I suspect the 
>> best bet is startups who can choose their tools (and are funded as 
>> gambles), and I suspect the best bet for that is getting HN startup success 
>> stories like: "we got to launch and ___ funding round, with Racket, because 
>> DSLs, and Racket is the best for that".  Then other HN people will see a 
>> success story, a couple might be inspired to think about DSLs for their own 
>> startup idea, and then somehow this becomes RACKET EXPONENTIAL EXPLOSION.  
>> Or at least more people making a living working with/on Racket.
>>
>>
>> -- 
>> 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...@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.