May 27, 2021 Re: How to work around the infamous dual-context when using delegates together with std.parallelism | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ali Çehreli | On 5/27/21 9:19 AM, Ali Çehreli wrote:
> auto result = new string[users.length];
> users.enumerate.parallel.each!(en => result[en.index] = servers.doSomething(en.value));
> writeln(result);
I still like the foreach version more:
auto result = new string[users.length];
foreach (i, user; users.parallel) {
result[i] = servers.doSomething(user);
}
writeln(result);
Ali
|
May 27, 2021 Re: How to work around the infamous dual-context when using delegates together with std.parallelism | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ali Çehreli | On 2021-05-27 18:56, Ali Çehreli wrote:
> On 5/27/21 9:19 AM, Ali Çehreli wrote:
>
>> auto result = new string[users.length];
>> users.enumerate.parallel.each!(en => result[en.index] = servers.doSomething(en.value));
>> writeln(result);
>
> I still like the foreach version more:
>
> auto result = new string[users.length];
> foreach (i, user; users.parallel) {
> result[i] = servers.doSomething(user);
> }
> writeln(result);
>
> Ali
>
Hi Ali,
both of those variants do work for me, thanks a lot!
Still not sure which I prefer (almost too many options now :) ).
I am so happy that I asked in this forum, help is much appreciated!
Christian
|
May 31, 2021 Re: How to work around the infamous dual-context when using delegates together with std.parallelism | ||||
---|---|---|---|---|
| ||||
Posted in reply to Steven Schveighoffer | On Thursday, 27 May 2021 at 14:44:29 UTC, Steven Schveighoffer wrote: > On 5/27/21 10:13 AM, Christian Köstlin wrote: >> P.S.: I still do not get how to post formatted snippets with thunderbird to the newsgroup/forum :/ > > It's not possible currently. I no longer use thunderbird, but: - https://github.com/CyberShadow/DFeed/commit/2e60edab2aedd173c7ea3712cb9500d90d4b795d#diff-0ecfc518dcbf670fdac54985dd56663a16a0806fd57a05ac09bf40a933b851e5R338 - IIRC thunderbird allows changing headers: try adding "Content-Type" to the comma-separated list "mail.compose.other.header" - Then in the composition window make sure Content-Type is set to something like "text/plain; markup=markdown" |
May 31, 2021 Re: How to work around the infamous dual-context when using delegates together with std.parallelism | ||||
---|---|---|---|---|
| ||||
Posted in reply to CandG | On 2021-05-31 13:40, CandG wrote:
> On Thursday, 27 May 2021 at 14:44:29 UTC, Steven Schveighoffer wrote:
>> On 5/27/21 10:13 AM, Christian Köstlin wrote:
>>> P.S.: I still do not get how to post formatted snippets with thunderbird to the newsgroup/forum :/
>>
>> It's not possible currently.
>
> I no longer use thunderbird, but:
> - https://github.com/CyberShadow/DFeed/commit/2e60edab2aedd173c7ea3712cb9500d90d4b795d#diff-0ecfc518dcbf670fdac54985dd56663a16a0806fd57a05ac09bf40a933b851e5R338
>
> - IIRC thunderbird allows changing headers: try adding "Content-Type" to the comma-separated list "mail.compose.other.header"
> - Then in the composition window make sure Content-Type is set to something like "text/plain; markup=markdown"
Thanks for the tip, lets see if it works:
```D
void main(string[] args) {
writeln("Hello World");
}
```
Kind regards,
Christian
|
May 31, 2021 Re: How to work around the infamous dual-context when using delegates together with std.parallelism | ||||
---|---|---|---|---|
| ||||
Posted in reply to Christian Köstlin | On 2021-05-31 18:50, Christian Köstlin wrote:
> On 2021-05-31 13:40, CandG wrote:
>> On Thursday, 27 May 2021 at 14:44:29 UTC, Steven Schveighoffer wrote:
>>> On 5/27/21 10:13 AM, Christian Köstlin wrote:
>>>> P.S.: I still do not get how to post formatted snippets with thunderbird to the newsgroup/forum :/
>>>
>>> It's not possible currently.
>>
>> I no longer use thunderbird, but:
>> - https://github.com/CyberShadow/DFeed/commit/2e60edab2aedd173c7ea3712cb9500d90d4b795d#diff-0ecfc518dcbf670fdac54985dd56663a16a0806fd57a05ac09bf40a933b851e5R338
>>
>> - IIRC thunderbird allows changing headers: try adding "Content-Type" to the comma-separated list "mail.compose.other.header"
>> - Then in the composition window make sure Content-Type is set to something like "text/plain; markup=markdown"
> Thanks for the tip, lets see if it works:
>
> ```D
> void main(string[] args) {
> writeln("Hello World");
> }
> ```
>
> Kind regards,
> Christian
>
another try.
```D
void main(string[] args) {
writeln("Hello World");
}
```
|
May 31, 2021 Re: How to work around the infamous dual-context when using delegates together with std.parallelism | ||||
---|---|---|---|---|
| ||||
Posted in reply to Christian Köstlin | On 5/31/21 12:50 PM, Christian Köstlin wrote: > On 2021-05-31 13:40, CandG wrote: >> On Thursday, 27 May 2021 at 14:44:29 UTC, Steven Schveighoffer wrote: >>> On 5/27/21 10:13 AM, Christian Köstlin wrote: >>>> P.S.: I still do not get how to post formatted snippets with thunderbird to the newsgroup/forum :/ >>> >>> It's not possible currently. >> >> I no longer use thunderbird, but: >> - https://github.com/CyberShadow/DFeed/commit/2e60edab2aedd173c7ea3712cb9500d90d4b795d#diff-0ecfc518dcbf670fdac54985dd56663a16a0806fd57a05ac09bf40a933b851e5R338 That requires the "markup=markdown" to be in the Content-Type, which I (and several others) tried to modify, but Thunderbird doesn't allow it. > Thanks for the tip, lets see if it works: > > ```D > void main(string[] args) { > writeln("Hello World"); > } > ``` It doesn't work, thunderbird just wants to put its own Content-Type in there, and I don't think there's a way to change it. If we had a way to use a custom header to do it, that would work. In fact, I bet it's not too difficult, I might make a PR for it (thanks for identifying the function that can do it) -Steve |
Copyright © 1999-2021 by the D Language Foundation