Re: GC memory fragmentation

2021-04-12 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Sunday, 11 April 2021 at 09:10:22 UTC, tchaloupka wrote: Hi, we're using vibe-d (on Linux) for a long running REST API server and have problem with constantly growing memory until system kills it with OOM killer. [...] But this is very bad for performance so we've prolonged the interval

Re: C++ or D?

2020-12-31 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Thursday, 31 December 2020 at 16:03:54 UTC, Ola Fosheim Grøstad wrote: On Thursday, 31 December 2020 at 14:56:37 UTC, Sebastiaan Koppe wrote: It could take a few years indeed, but what will D do in that same time window? What would you like to see? For shared to mean something. Stackless

Re: C++ or D?

2020-12-31 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Thursday, 31 December 2020 at 09:57:01 UTC, Imperatorn wrote: On Thursday, 31 December 2020 at 07:32:31 UTC, RSY wrote: Sorry for the spam, but this is because of people like him that people like me (i discovered D recently) that can't be aware of why D is a great language They diminish

Re: Writing a really fast lexer

2020-12-12 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Saturday, 12 December 2020 at 18:15:11 UTC, vnr wrote: Yes, I know Pegged, it's a really interesting parser generator engine, nevertheless, the grammar of what I would like to analyse is not a PEG. But I am also curious to know the performances of this tool for very large inputs. The

Re: Help on asdf json module

2020-10-25 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Sunday, 25 October 2020 at 06:05:27 UTC, Vino wrote: Hi All, Currently we are testing various json module such as "std.json, std_data_json, vibe.data.json and asdf", the below code works perfectely while use "std_data_json or vibe.data.json" but not working as expected when we use

Re: A scheduled control signal with fibers?

2020-09-25 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Friday, 25 September 2020 at 13:08:16 UTC, Sebastiaan Koppe wrote: On Friday, 25 September 2020 at 11:58:53 UTC, Ferhat Kurtulmuş How can I implement schedulePWMSignalToValve(pwmval, afterNmilliseconds ) using fibers? No need for fibers per se. Can also use

Re: A scheduled control signal with fibers?

2020-09-25 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Friday, 25 September 2020 at 11:58:53 UTC, Ferhat Kurtulmuş wrote: int main(){ ... while(true){ int pwmval = getFlameIntensityViaImageProcessing(); sendPWMSignalToValfe(pwmval); // I need this streamed ctrl signal to the valfe with a delayed time shift //

Re: SIGUSR1 in clock_nanosleep()? how to isolate this issue?

2020-08-21 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Thursday, 20 August 2020 at 18:58:43 UTC, mw wrote: Hi, I run into an issue: it's SIGUSR1 in clock_nanosleep() [...] Anyone has some suggestions on how to isolate this issue? Thanks. Try "handle SIGUSR1 nostop noprint" and "handle SIGUSR2 nostop noprint" in gdb.

Re: Vibe.d and NodeJs with Express

2020-07-12 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Sunday, 12 July 2020 at 10:01:54 UTC, greatsam4sure wrote: I am thinking of building an App with Vibe. D or NodeJS but my topmost priority is speed and ease of development due to third party libraries integration. How much speed do you need? I doubt you really need every last millisecond,

Re: Web Assembly, struct to JavaScript Object and back

2020-06-24 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Tuesday, 23 June 2020 at 18:15:25 UTC, tirithen wrote: Anyone that has something similar working with struct objects? Passing anything besides int/double/bool between JS and wasm is hard work. Currently the ABI generated by LDC is so that arguments besides int/double/bool (and

Re: called copy constructor in foreach with ref on Range

2020-06-23 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Tuesday, 23 June 2020 at 07:30:29 UTC, Stanislav Blinov wrote: On Tuesday, 23 June 2020 at 05:24:37 UTC, H. S. Teoh wrote: I'm also wondering what's the motivation behind supporting non-copyable ranges, and whether it's worth the effort and inevitable complications to support it if it's a

Re: how to achieve C's Token Pasting (##) Operator to generate variable name in D?

2020-05-31 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Saturday, 30 May 2020 at 23:39:31 UTC, mw wrote: Am I doing the right thing in D? any improvement you'd suggest? e.g. I don't quite like have to put the type and var name in the quotes as string: mixin(RW!("int", "x")); Is there a better way to achieve this? esp. for the type

Re: D and Async I/O

2020-05-18 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Thursday, 14 May 2020 at 09:36:33 UTC, Russel Winder wrote: Whilst C frameworks use callbacks and trampolines, high level languages seem to be basing things on futures – or things that are effectively isomorphic to futures. What I find most lacking is proper cancellation. Also, futures

Re: D and Async I/O

2020-05-12 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Tuesday, 12 May 2020 at 09:23:40 UTC, Russel Winder wrote: On Mon, 2020-05-11 at 19:34 +0200, Jacob Carlborg via Digitalmars-d-learn wrote: On 2020-05-11 16:44, Russel Winder wrote: > Crickey, a third option. This wil increase my dithering! ;-) Forth: Mecca [1] :) [1]

Re: Best way to learn 2d games with D?

2020-03-17 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Tuesday, 17 March 2020 at 18:55:08 UTC, Steven Schveighoffer wrote: He's done a lot of stuff in Scratch. I taught him and a whole group of other homeschoolers a class on javascript and this year (up until this whole virus thing) we were working in Roblox (lua). So far I try to make the

Re: Best way to learn 2d games with D?

2020-03-17 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Tuesday, 17 March 2020 at 15:38:55 UTC, Steven Schveighoffer wrote: It's not something I'm intending to create professionally, really the impetus is my son wanting to do more significant game coding. -Steve How old is he? I find something simple like gamemaker works well with 12-16

Re: Best way to learn 2d games with D?

2020-03-15 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Sunday, 15 March 2020 at 17:58:58 UTC, Steven Schveighoffer wrote: I want to try and learn how to write 2d games. I'd prefer to do it with D. No resources but I remember the serpent framework mentioned on this forum here recently. It looks pretty decent.

Re: Idiomatic way to express errors without resorting to exceptions

2020-03-07 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Saturday, 7 March 2020 at 15:44:38 UTC, Arine wrote: I feel as though that's it's greatest weakness. It makes the check whether there is or isn't a value hidden. The case when there isn't a value should be handled explicitly, not implicitly. Propogating a None value isn't useful and is

Re: Idiomatic way to express errors without resorting to exceptions

2020-02-29 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Saturday, 29 February 2020 at 13:40:11 UTC, Adnan wrote: On Saturday, 29 February 2020 at 13:03:21 UTC, Sebastiaan Koppe wrote: On Saturday, 29 February 2020 at 12:50:59 UTC, Adnan wrote: * Option!T from the optional package: Has even worse problem IMO. Not only it allows None + int but

Re: Idiomatic way to express errors without resorting to exceptions

2020-02-29 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Saturday, 29 February 2020 at 12:50:59 UTC, Adnan wrote: * Option!T from the optional package: Has even worse problem IMO. Not only it allows None + int but also it returns a `[]`. This API is not to my liking. You could say well Haskell has fmap for Optional etc, and I am aware of that, so

Re: Some impressions/notes from a new D programmer

2020-02-12 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Wednesday, 12 February 2020 at 18:39:36 UTC, Steven Schveighoffer wrote: On 2/12/20 10:52 AM, mark wrote: I also think you split into more HTML files which I prefer. FYI, dlang.org has a secondary version of the docs which splits the documents up more:

Re: Does D have an equvalent of: if (auto = expr; expr)

2020-02-07 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Friday, 7 February 2020 at 08:52:44 UTC, mark wrote: Some languages support this kind of thing: if ((var x = expression) > 50) print(x, " is > 50") Is there anything similar in D? Yes and no. It only works for bools or things that convert to bool. You might have seen: string[string]

Re: Mix struct types in the same array

2019-12-18 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Wednesday, 18 December 2019 at 22:00:20 UTC, tirithen wrote: I want to have a array/list/queue of instances of various struct types that represent events. How can I achieve that? With classes I would have interfaces I guess, but I want to use structs if possible as they seem less complex

Re: Troubleshooting DUB invocations

2019-11-19 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Tuesday, 19 November 2019 at 12:06:36 UTC, Dukc wrote: On Monday, 18 November 2019 at 19:35:13 UTC, Sebastiaan Koppe wrote: Well yes. But that is just the way things worked up until now, ldc and dub just pick the host machine. Luckily there is the new dub `--arch` argument that can take a

Re: Troubleshooting DUB invocations

2019-11-18 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Wednesday, 13 November 2019 at 18:10:15 UTC, Dukc wrote: On Wednesday, 13 November 2019 at 15:41:01 UTC, Sebastiaan Koppe wrote: It has been on the back of my mind since 1.18-beta came out. I am going to reserve a little time tomorrow to work on it. Regarding that, perhaps I can save you a

Re: Troubleshooting DUB invocations

2019-11-13 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Tuesday, 12 November 2019 at 16:44:06 UTC, Dukc wrote: When trying to compile a project including newest Spasm (DUB package) using the newest LDC via DUB, the result is: ``` lld: error: unknown argument: --no-as-needed ``` I then ran DUB with -v switch and it turned out the invocation

Re: Dub and gitsubmodules

2019-11-06 Thread Sebastiaan Koppe via Digitalmars-d-learn
Thanks for the replies!

Dub and gitsubmodules

2019-11-04 Thread Sebastiaan Koppe via Digitalmars-d-learn
Does anyone know a reliable way of having a dub package that contains git submodules and is to be used as a dependency? I am looking for a way to ensure the submodules are initialised before a build.

Re: Alternative to C++ macro in D

2019-11-03 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Sunday, 3 November 2019 at 16:55:36 UTC, Vinod K Chandran wrote: int main() { log("Trying to avoid the visual clutter aused by closing curly braces") ; string myStr = "Now, code looks more elegant" ; log(myStr) ; wait ; end How can i do this in D ? Especially the " #define

Re: Mixin and introspection ordering

2019-10-16 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Tuesday, 15 October 2019 at 19:50:33 UTC, Paul Backus wrote: On Tuesday, 15 October 2019 at 19:19:58 UTC, Sebastiaan Koppe wrote: You would expect 2 to print `tuple(a)` as well, but it doesn't. Don't know if it is a bug. Any time you use a construct that mutates the AST (template mixin,

Mixin and introspection ordering

2019-10-15 Thread Sebastiaan Koppe via Digitalmars-d-learn
Sometimes ordering is important when combining mixins and introspection, this is another such case: ``` import std.traits; enum myuda; mixin template Slot(string name) { mixin("@myuda int "~name~";"); } struct OuterOption { mixin Slot!"a"; } struct App { pragma(msg,

Re: How to use xargs to remove whitespaces (Dub executable path)

2019-09-04 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Wednesday, 4 September 2019 at 05:52:12 UTC, Andre Pany wrote: Hi, I try to get the executable path from a dub package using this command: dub describe dscanner --data=target-path,target-name --data-list | xargs But the output always contains a space between target-path and

Re: How should I sort a doubly linked list the D way?

2019-08-13 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Tuesday, 13 August 2019 at 18:28:35 UTC, Ali Çehreli wrote: On Tuesday, 13 August 2019 at 14:04:45 UTC, Sebastiaan Koppe > wrote: > Convert the nodes into an D array, sort the array with > nodes.sort!"a.x < b.x" and then iterate the array and repair > the next/prev pointers. If possible,

Re: How should I sort a doubly linked list the D way?

2019-08-13 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Tuesday, 13 August 2019 at 09:48:52 UTC, Mirjam Akkersdijk wrote: and I would like to sort based on Node.t, how should I tackle it, preferably without resorting to C libraries? Convert the nodes into an D array, sort the array with nodes.sort!"a.x < b.x" and then iterate the array and

Re: vibe / self contained standalone executable?

2019-07-28 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Sunday, 28 July 2019 at 14:42:48 UTC, Robert M. Münch wrote: On 2019-07-28 14:14:06 +, Sebastiaan Koppe said: I am using https://dlang.org/spec/expression.html#import_expressions for text files. Don't know if it works on binary files as well. And this works than good together with

Re: vibe / self contained standalone executable?

2019-07-28 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Sunday, 28 July 2019 at 13:45:50 UTC, Robert M. Münch wrote: Is it possible to pack a complete "web-app" (serving web-pages and providing REST API) into a single executable so that no other files need to be accessed and everything is servered from something like a "virtual filesystem" which

Re: can not find the error: Error: TypeInfo cannot be used with -betterC

2019-07-17 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Wednesday, 17 July 2019 at 15:52:39 UTC, Newbie2019 wrote: when build my project with -betterC, it throw this error: Error: TypeInfo cannot be used with -betterC There is no location information about it, how can I find what code cause this ? With ldc I often use -v to get the verbose

Re: Reading .pem files for secured

2019-06-06 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Thursday, 6 June 2019 at 11:08:18 UTC, Dukc wrote: We were both wrong :-). It turned out that the correct way to initialize a SecureD RSA private key is to feed contents of .pem in without ANY processing. Ah, they made it even easier :)

Re: Reading .pem files for secured

2019-05-31 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Friday, 31 May 2019 at 10:35:46 UTC, Dukc wrote: The key pair needs to be persistant between, so I made a 4096-bit private key with OpenSSL, stored in .pem file. Then I constructed a public key from the private one, again with OpenSSL. It seemed strange to me that I could generate a public

Re: OT - Git training Lon/HK and book recommendation on taste in programming

2019-05-01 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Wednesday, 1 May 2019 at 09:51:01 UTC, Laeeth Isharc wrote: Hi. First question - can anyone recommend git / Gitlab training providers in HK and London? Two distinct audiences - highly intelligent people that may or may not really program, and experienced developers with a finance

Re: Operator Overloading with multiple return types

2019-03-15 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Friday, 15 March 2019 at 21:35:12 UTC, eXodiquas wrote: Is there any way to achive this behaivour with D2? Yep. Just make the return type in the function declaration `auto`. You are then free to return a different type in each static branch.

Re: AliasSeq in UDA

2019-03-10 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Sunday, 10 March 2019 at 16:46:43 UTC, Basile B. wrote: Yes I see. I've refined a bit the test case and maybe I'll took a look this week. Cool. Is it normal to create a testcase that doesn't depend on phobos? I suppose it is needed for it to be included in dmd's testcases.

Re: AliasSeq in UDA

2019-03-10 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Sunday, 10 March 2019 at 13:41:32 UTC, Basile B. wrote: It looks like a bug, a "reject-valid" one. Try the same code with enum A = 0; and it work, despite of B being still opaque. The problem may be related to the fact the enum A in the orginal code is opaque and has not type.

AliasSeq in UDA

2019-03-10 Thread Sebastiaan Koppe via Digitalmars-d-learn
The compiler complains about `cannot form tuple of tuples` whenever I try to put an AliasSeq in a UDA and try to use it. You would expect the compiler to expand it. Is this a bug? --- import std.meta; enum A; enum B; @AliasSeq!(A,B) // <-- Error: cannot form tuple of tuples struct Foo {}

Re: Phobos in BetterC

2019-03-09 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Saturday, 9 March 2019 at 17:14:37 UTC, 9il wrote: It was fixed to be used in BetterC. If it still does not work you can open an issue and ping me (@9il). That is awesome. I suppose support for betterC is only from v3 upwards?

Re: Phobos in BetterC

2019-03-09 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Friday, 8 March 2019 at 09:24:25 UTC, Vasyl Teliman wrote: Also I would to know what parts of Phobos are available there (e.g. std.traits, std.typecons...). There is no clear rule on which phobos packages work and which don't. It all depends on what underlying features the phobos package

Re: pragma mangle on extern(C) in function body

2019-01-16 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Wednesday, 16 January 2019 at 19:59:02 UTC, Steven Schveighoffer wrote: I'm guessing it's a missed case in the compiler, and not intentionally omitted. -Steve The workaround is quite silly. Seems like a parser issue. --- pragma(mangle, "Foo") extern(C) void foo(); mixin template T()

Re: pragma mangle on extern(C) in function body

2019-01-16 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Wednesday, 16 January 2019 at 19:41:04 UTC, Sebastiaan Koppe wrote: While it is perfectly ok to define an extern(C) function in a function method, I can't seem to get pragma(mangle, "...") on it to work. --- pragma(mangle, "Foo")// Ok extern(C) void foo(); void main() {

pragma mangle on extern(C) in function body

2019-01-16 Thread Sebastiaan Koppe via Digitalmars-d-learn
While it is perfectly ok to define an extern(C) function in a function method, I can't seem to get pragma(mangle, "...") on it to work. --- pragma(mangle, "Foo")// Ok extern(C) void foo(); void main() { pragma(mangle, "Bar")// Error extern(C) void bar(); } --- Any idea

Re: Why does nobody seem to think that `null` is a serious problem in D?

2018-12-01 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Saturday, 1 December 2018 at 20:41:53 UTC, Sebastiaan Koppe wrote: Since the compiler can prove which branch is taken, the analyse has to assume both are. *can't*

Re: Why does nobody seem to think that `null` is a serious problem in D?

2018-12-01 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Saturday, 1 December 2018 at 19:02:54 UTC, H. S. Teoh wrote: But that's precisely the problem. It's not always possible to tell whether a variable has been initialized. E.g.: int func(int x) { int *p; if (solveRiemannHypothesis()) {

Re: How do I use null in a struct?

2018-11-10 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Saturday, 10 November 2018 at 19:42:47 UTC, Václav Kozák wrote: I'm making a Rest API with vibe.d and I have a struct User. Sometimes I need to return only a few of the fields. So for example: return User(1, null, "John", null, null, ...); If I do this, an error occurs: cannot implicitly

Re: Need help with calling a list of functions

2018-11-04 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Sunday, 4 November 2018 at 01:17:01 UTC, Luigi wrote: I need to call a function that can create a function from an array of functions and calls them in reverse order. I am learning D any help would be That sounds a lot like std.functional.compose

Re: Template/mixin ideas?

2018-10-05 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Thursday, 4 October 2018 at 01:12:04 UTC, Chris Katko wrote: The mixin part wouldn't be slowed by strings, right? So the "slowness" is the invokation part which changes strings and forces GC allocations, I guess? Yep, that is right. What's the alternative to using strings... for strings?

Re: Template/mixin ideas?

2018-10-03 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Wednesday, 3 October 2018 at 11:01:53 UTC, Chris Katko wrote: I've got this simple task but I'm trying to perfect it as best I can to learn something in the process. I have Linux terminal ASCII codes for coloring terminal output. string red(string) { /* ... */ } "Hello world".red =>

Re: Template return type?

2018-10-03 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Wednesday, 3 October 2018 at 10:01:02 UTC, Andrea Fontana wrote: On Wednesday, 3 October 2018 at 09:37:29 UTC, JN wrote: int i = returnDefault!int(); obviously works, but the point is I would like to skip the explicit type. See:

Re: vibe.d error

2018-09-28 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Thursday, 27 September 2018 at 17:37:43 UTC, hridyansh thakur wrote: [snip] What version of dmd do you use?

Re: tupleof function parameters?

2018-08-28 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Tuesday, 28 August 2018 at 06:11:35 UTC, Jon Degenhardt wrote: The goal is to write the argument list once and use it to create both the function and the Tuple alias. That way I could create a large number of these function / arglist tuple pairs with less brittleness. --Jon I would

Re: UDA on double nested struct

2018-08-20 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Monday, 20 August 2018 at 16:27:55 UTC, Basile B. wrote: Hello, it works fine here. Maybe there was another error that you removed when you have minimized the example. See https://run.dlang.io/is/ZrW7kI, that says that the example works since 2.068.2. Although that are are possibility that

UDA on double nested struct

2018-08-20 Thread Sebastiaan Koppe via Digitalmars-d-learn
Hey, I am trying to get UDAs from a doubly nested struct, to no avail: code --- import std.traits : hasUDA; enum hover; struct Style { struct Root { auto margin = "10px"; auto backgroundColor = "white"; @hover struct Hover { auto backgroundColor = "gray"; } } }

Re: ?? How to subscribe to Multicast Broadcasts ??

2018-08-18 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Monday, 13 August 2018 at 01:12:16 UTC, Joe wrote: Please Please Please Help, I am desperate! Many Thanks in Advance for your time & attention, -joe I implemented multicast support in vibe.d, I hope looking at the source can help you:

Re: Cannot make LDC use LTO when called via DUB

2017-09-25 Thread Sebastiaan Koppe via Digitalmars-d-learn
Neither dflags-dmd "-xxx" dflags-posix-dmd "-xxx" dflags-linux-dmd "-xxx" has any effect on my build (in dub.sdl). I didn't know dflags-* was a thing, and I can't find it in docs either. Maybe you are looking for dflags "..." platform="..."

Re: Is there any threadsafe queue?

2017-09-14 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Wednesday, 13 September 2017 at 22:54:06 UTC, Seb wrote: https://code.dlang.org/packages/lock-free That package has a single-reader single-writer queue, exactly what the OP asked for.

Re: How to make http requests to unix socket?

2017-08-12 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Friday, 11 August 2017 at 18:39:54 UTC, dvnguyen wrote: How to make http requests to unix socket? For example, in Docker engine api, curl --unix-socket /var/run/docker.sock http:/v1.24/containers/json I made a pull request a year ago or so to have vibe-d's requestHttp to support unix

Re: Idiomatic way of writing nested loops?

2017-07-17 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Monday, 17 July 2017 at 11:55:47 UTC, Anton Fediushin wrote: Thank you! I knew it is in the library! So, `parallel` will work just fine with this function, isn't it? Yes

Re: Idiomatic way of writing nested loops?

2017-07-17 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Monday, 17 July 2017 at 11:07:35 UTC, Anton Fediushin wrote: Hello! What is the best way of rewriting this code in idiomatic D manner? https://dlang.org/phobos/std_algorithm_setops.html#.cartesianProduct

Re: Need simple sound

2017-07-07 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Thursday, 6 July 2017 at 20:36:08 UTC, FoxyBrown wrote: Heres a better version that automatically generates a class wrapping the portaudio.dll. Need portaudio.di(possibly renamed to portaudio.d and imported). Still same problem as original though. While you are at it. Please also write

Re: Need simple sound

2017-07-06 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Thursday, 6 July 2017 at 13:28:26 UTC, FoxyBrown wrote: On Wednesday, 5 July 2017 at 07:21:45 UTC, Sebastiaan Koppe wrote: Sure, see http://code.dlang.org/packages/portaudio So, after a bit of work I can get port audio to work but the callback never seems to be called(no audio, never hits

Re: Need simple sound

2017-07-06 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Thursday, 6 July 2017 at 10:47:53 UTC, FoxyBrown wrote: On Wednesday, 5 July 2017 at 07:21:45 UTC, Sebastiaan Koppe wrote: On Wednesday, 5 July 2017 at 05:34:37 UTC, FoxyBrown wrote: On Tuesday, 4 July 2017 at 20:37:44 UTC, Sebastiaan Koppe wrote: Portaudio is simple as well. And nice

Re: unittest-cov - results?

2017-07-06 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Wednesday, 5 July 2017 at 19:01:06 UTC, Jonathan M Davis wrote: I ran into a bug in dub not all that long ago where the tests in the module with main in it weren't actually being run even though the other tests were. (which reminds me, I should verify that again and report it). - Jonathan

Re: Need simple sound

2017-07-05 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Wednesday, 5 July 2017 at 09:43:05 UTC, Martin Tschierschke wrote: On Wednesday, 5 July 2017 at 07:21:45 UTC, Sebastiaan Koppe wrote: On Wednesday, 5 July 2017 at 05:34:37 UTC, FoxyBrown wrote: On Tuesday, 4 July 2017 at 20:37:44 UTC, Sebastiaan Koppe wrote: Portaudio is simple as well.

Re: Need simple sound

2017-07-05 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Wednesday, 5 July 2017 at 05:34:37 UTC, FoxyBrown wrote: On Tuesday, 4 July 2017 at 20:37:44 UTC, Sebastiaan Koppe wrote: Portaudio is simple as well. And nice cross platform. are there any bindings? Sure, see http://code.dlang.org/packages/portaudio

Re: Need simple sound

2017-07-04 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Monday, 3 July 2017 at 08:55:20 UTC, Martin Tschierschke wrote: Hello for a simple game I would like to add some very simple sound, not much different than the beeps of "PAC Man". Is there anything I can use for this? Portaudio is simple as well. And nice cross platform.

Re: Deprecated std.c.*.socket and missing replacement

2017-06-27 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Tuesday, 27 June 2017 at 19:22:02 UTC, Steven Schveighoffer wrote: Just delete the duplicate symbol, and add public imports of the other module symbols. e.g.: public import core.sys.posix.netinet.in_: IP_ADD_MEMBERSHIP; -Steve Great. Will do.

Re: Deprecated std.c.*.socket and missing replacement

2017-06-27 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Tuesday, 27 June 2017 at 17:58:29 UTC, Jonathan M Davis wrote: Why would you need to remove anything from Phobos? The enum in question is in a deprecated module. All that should need to happen is that the enum be added to the appropriate module in druntime, and then any code that uses it

Re: Deprecated std.c.*.socket and missing replacement

2017-06-27 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Tuesday, 27 June 2017 at 11:16:17 UTC, Jonathan M Davis wrote: Create a PR to add it to druntime and/or define it in your own code. - Jonathan M Davis Creating a PR sounds reasonable. But I would have to create one PR to remove them from phobos and one PR to add them to druntime, right?

Deprecated std.c.*.socket and missing replacement

2017-06-27 Thread Sebastiaan Koppe via Digitalmars-d-learn
I am building a multicast application, and I am using the std.c.*.socket modules to provide the definition of the IP_ADD_MEMBERSHIP constant. These modules are marked as deprecated telling me to look in core.sys.posix.* instead. I grepped the complete sourcetree, but nowhere is the

Re: Dub and unit-threaded import problem

2016-03-05 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Saturday, 5 March 2016 at 15:05:50 UTC, Casey wrote: { "name": "unittest", "preBuildCommands": [ "dub run unit-threaded -c gen_ut_main -- -f bin/ut.d" ], "mainSourceFile": "bin/ut.d", "excludedSourceFiles": ["source/app.d"], "dependences": {

Re: Coverage

2016-02-16 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Tuesday, 16 February 2016 at 12:35:38 UTC, Leandro Motta Barros wrote: You probably already though of it, but: can't you create a unittest that calls your code as many times as desired, passing different input each time? That is a viable option yes. I will probably end up doing it like

Coverage

2016-02-16 Thread Sebastiaan Koppe via Digitalmars-d-learn
I currently run dmd's coverage on my unittests. But now I also want to execute my program with different inputs and then merge all that coverage info from each run. Any chance there is something for that?

Re: htod question

2016-01-23 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Friday, 22 January 2016 at 01:04:50 UTC, Dibyendu Majumdar wrote: On Friday, 22 January 2016 at 01:03:09 UTC, Dibyendu Majumdar wrote: On Friday, 22 January 2016 at 00:52:59 UTC, W.J. wrote: Counter question: What's so bad about the D std library ? I am trying to create bindings for

Re: Is this a feature?

2016-01-21 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Thursday, 21 January 2016 at 14:39:43 UTC, Adam D. Ruppe wrote: On Thursday, 21 January 2016 at 14:35:09 UTC, Sebastiaan Koppe wrote: static if (!is(SomethingUndefined!moreUndefined[0] : UndefinedThing)) Yes, the is expression returns false for undefined things because they aren't types.

Is this a feature?

2016-01-21 Thread Sebastiaan Koppe via Digitalmars-d-learn
module undefined; unittest { static if (!is(SomethingUndefined!moreUndefined[0] : UndefinedThing)) { pragma(msg,"This will compile just fine!"); } }

Re: Reset all Members of a Aggregate Instance

2015-12-03 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Thursday, 3 December 2015 at 21:13:59 UTC, Nordlöw wrote: Need to assert that not a function and mutability (std.traits.isMutable) Yeah you need to do that.

Re: Reset all Members of a Aggregate Instance

2015-12-03 Thread Sebastiaan Koppe via Digitalmars-d-learn
Haven't compiled but it should look something like this: foreach(member; __traits(allMembers, typeof(c))) __traits(getMember, c, member) = typeof(__traits(getMember, c, member)).init;

Re: vibe.d-example illustrating Dynamic Textual Web-Interface

2015-12-01 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Tuesday, 1 December 2015 at 07:04:25 UTC, Sönke Ludwig wrote: Am 30.11.2015 um 11:08 schrieb Nordlöw: Does anybody have a similar vibe.d-project to be inspired from, in this regard? This would be more targeted to the web interface generator (vibe.web.web), which is not affected by the

Re: Can't understand how to do server response with vibed

2015-11-30 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Sunday, 29 November 2015 at 07:37:56 UTC, Suliman wrote: On Saturday, 28 November 2015 at 23:21:21 UTC, Sebastiaan Koppe wrote: On Saturday, 28 November 2015 at 19:05:59 UTC, Suliman wrote: And also I can't understand difference between HTTPClientRequest and HTTPServerRequest If the

Re: vibe.d-example illustrating Dynamic Textual Web-Interface

2015-11-30 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Monday, 30 November 2015 at 10:08:17 UTC, Nordlöw wrote: Can somebody please show a enlightening example of, so called, "revamp of the REST interface generator" added to release 0.7.26 at: http://vibed.org/blog/posts/vibe-release-0.7.26 I want to use vibe.d to add a modern dynamic

Re: vibe.d-example illustrating Dynamic Textual Web-Interface

2015-11-30 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Monday, 30 November 2015 at 20:23:48 UTC, David DeWitt wrote: Have you looked at Redux and Webpack? I am working on a Redux example and we have switched to Webpack and Redux at work and it is nice. I know about both yes. Webpack would probably beat browserify, but I haven't gotten the

Re: Multithreaded HTTP Download

2015-11-28 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Saturday, 28 November 2015 at 10:46:11 UTC, tcak wrote: The only case that would make sense is if the server limits the upload speed of each TCP socket. Unless you are in this position, I do not expect to see any difference by opening multiple sockets and requesting different parts of same

Re: Multithreaded HTTP Download

2015-11-28 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Saturday, 28 November 2015 at 06:40:49 UTC, Mike McKee wrote: How could I achieve something like that in D? (Note, I'm using OSX.) I did it with vibe.d and http byte ranges. In general I'm trying to see if I can make a command line zip file downloader that downloads faster than Curl for

Re: Can't understand how to do server response with vibed

2015-11-28 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Saturday, 28 November 2015 at 19:05:59 UTC, Suliman wrote: And also I can't understand difference between HTTPClientRequest and HTTPServerRequest If the application (vibe.d) makes a request, it is the client. If the request is made to your application, it is the server. In your case your

Re: Can't understand how to do server response with vibed

2015-11-28 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Saturday, 28 November 2015 at 19:10:17 UTC, Suliman wrote: void action(HTTPServerRequest req, HTTPServerResponse res) { } Here is function what have two call-backs. When it's get request it's work as server, when it's send response it's work like client or I have wrong logic? Wrong

Re: Can't understand how to do server response with vibed

2015-11-28 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Saturday, 28 November 2015 at 18:51:57 UTC, Suliman wrote: Eghm, sorry. Not req, but res, but again errr: void action(HTTPServerRequest req, HTTPServerResponse res) { writeln(req.writeJsonBody); } What you want is `req.json`. Make sure that the call from angular sets the Content-Type

Re: Do users need to install VS runtime redistributable if linking with Microsoft linker?

2015-09-29 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Tuesday, 29 September 2015 at 09:15:29 UTC, ponce wrote: On Monday, 28 September 2015 at 16:01:54 UTC, Sebastiaan Koppe wrote: I could not find out which redistributable I had to install (what version of VS did you have installed / on what version of windows are you?). I decided to install

Re: Do users need to install VS runtime redistributable if linking with Microsoft linker?

2015-09-28 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Monday, 28 September 2015 at 15:10:25 UTC, ponce wrote: On Tuesday, 22 September 2015 at 09:38:12 UTC, thedeemon wrote: On Monday, 21 September 2015 at 15:00:24 UTC, ponce wrote: All in the title. DMD 64-bit links with the VS linker. Do users need to install the VS redistributable

Re: Dub package with C code

2015-09-25 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Friday, 25 September 2015 at 06:04:09 UTC, Laeeth Isharc wrote: Blog platform - I guess nothing wrong with wordpress etc. I am between platforms right now. I just don't want to deal with wordpress any more, and haven't yet picked something I like better. Something like Nikola and

Re: Dub package with C code

2015-09-24 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Thursday, 24 September 2015 at 08:35:40 UTC, Edwin van Leeuwen wrote: Alternatively you could use reggea to build both. I want to use dub. Simply because of code.dlang.org. Or can reggae also pull packages from there? You could try including the c source in your repo and add

Re: Maximum number of threads

2015-09-24 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Thursday, 24 September 2015 at 08:55:25 UTC, Alex wrote: - on my mac I can have 2048 threads spawned at the same time - on my linux machine the maximum number is 32192. The numbers are quite fixed, however there were some small fluctuations on the linux machine. I only know of `cat

Re: Dub package with C code

2015-09-24 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Thursday, 24 September 2015 at 06:00:50 UTC, Rikki Cattermole wrote: On 24/09/15 5:51 PM, Sebastiaan Koppe wrote: On Thursday, 24 September 2015 at 04:17:14 UTC, Rikki Cattermole wrote: Is libxlsxwriter available in the systems package manager? Pacman says no. Let e.g. Windows users

  1   2   >