Re: About Dub capabilities

2017-07-04 Thread Martin Nowak via Digitalmars-d-learn
On Tuesday, 4 July 2017 at 20:46:33 UTC, Dukc wrote: Not that I have any need for that right now, I am just interested. preGenerate-/preBuildCommands are your friends to compile C++ code using dub. You'd invoke make or sth. and add the generated libs/objects to dub's sourceFiles. http://code

Re: Skynet 1M Fiber microbenchmark in D

2017-10-20 Thread Martin Nowak via Digitalmars-d-learn
On Wednesday, 18 October 2017 at 11:01:56 UTC, Per Nordlöw wrote: On Wednesday, 18 October 2017 at 09:01:30 UTC, Per Nordlöw wrote: Creates an actor (goroutine, whatever), which spawns 10 new actors, each of them spawns 10 more actors, etc. until one million actors are created on the final leve

Re: Skynet 1M Fiber microbenchmark in D

2017-10-20 Thread Martin Nowak via Digitalmars-d-learn
On Wednesday, 18 October 2017 at 12:32:31 UTC, Nordlöw wrote: Further, are we forced to use the GC for Fiber allocation or can a sub-class of Fibers implement its own allocation strategy? You could use std.typecons.scoped!Fiber, though it'll easily overflow your stack. Unfortunately Scoped do

Re: I want to transmit the class name and the member name in the method

2018-01-15 Thread Martin Nowak via Digitalmars-d-learn
On Friday, 5 January 2018 at 07:40:14 UTC, Brian wrote: auto db = new ORM; auto users = db.select(User).where(email.like("*@hotmail.com")).limit(10); Expression templates are a dead-end for any non-trivial queries. You have to embrace SQL to properly use RDMS, at the cost of beginners having

Re: Does it have an http2 server/client lib like in golang?

2018-01-15 Thread Martin Nowak via Digitalmars-d-learn
On Monday, 15 January 2018 at 18:07:24 UTC, Cergoo wrote: subj WIP but a bit stalled. https://github.com/vibe-d/vibe.d/tree/http2-botan-cleanup Unless you really need server-push of assets, HTTP/2 on a reverse proxy gets you the same performance benefits as well.

Re: I want to transmit the class name and the member name in the method

2018-01-15 Thread Martin Nowak via Digitalmars-d-learn
On Monday, 15 January 2018 at 15:28:19 UTC, Martin Nowak wrote: More concise stuff is possible with heavy compile-time trickery (https://dpaste.dzfl.pl/cd375ac594cf) without incurring dreaded 1+N queries or even any unnecessary SELECT fields. foreach (u; db.select!User.where!"NOT can_overdraw"

Re: Profiling after exit()

2018-03-06 Thread Martin Nowak via Digitalmars-d-learn
On Thursday, 27 July 2017 at 15:16:35 UTC, Eugene Wissner wrote: Are there profilers that work well with dmd? valgrind? OProfile? Yes, any sampling profiler works fine, e.g. perf on linux, Intel VTune/AMD CodeXL on Windows. Those directly monitor CPU performance counters and have a negligible

Re: Hooking into GC

2016-06-29 Thread Martin Nowak via Digitalmars-d-learn
On Wednesday, 29 June 2016 at 02:18:27 UTC, MMJones wrote: I read somewhere that one can modify the D files from phobos and runtime to supply a stub for the GC. I would like to add some logging features to the GC. Does this not require one to recompile phobos? I figured the source code was ju

Re: Hooking into GC

2016-06-29 Thread Martin Nowak via Digitalmars-d-learn
On Wednesday, 29 June 2016 at 14:41:48 UTC, MMJones wrote: On Wednesday, 29 June 2016 at 10:07:19 UTC, Martin Nowak wrote: How will this affect the trackallocs module? Will it break it, replace it? Essentially a merge of it? Should I hold off until 2.072 or go ahead and use the stub. I only nee

Re: Hooking into GC

2016-06-29 Thread Martin Nowak via Digitalmars-d-learn
On Thursday, 30 June 2016 at 03:03:16 UTC, MMJones wrote: I need to get more info than just the memory usage. Like what is using the memory. That's what -profile-gc is for, it tracks allocations. Give it a try, IIIRC it's missing explicit GC.malloc calls atm., but those should be rare anyhow a

Re: runtime loading D shared library as a standalone (with it's own GC etc)

2014-05-23 Thread Martin Nowak via Digitalmars-d-learn
Filed as https://issues.dlang.org/show_bug.cgi?id=12792.

Re: request assistance resolving curl related linker error

2014-08-18 Thread Martin Nowak via Digitalmars-d-learn
On Monday, 18 August 2014 at 14:24:54 UTC, Andrew Edwards wrote: import std.net.curl; void main(){} // Output: Undefined symbols for architecture x86_64: "_curl_easy_cleanup", referenced from: The problem here is that std.net.curl is based on libcurl, so you need to link your program agai

Re: request assistance resolving curl related linker error

2014-08-18 Thread Martin Nowak via Digitalmars-d-learn
On Monday, 18 August 2014 at 16:09:04 UTC, Martin Nowak wrote: The problem here is that std.net.curl is based on libcurl, so you need to link your program against it. Add '-L-lcurl' to your dmd invocation to do this. I also added an enhancement request to load curl at runtime. https://issues.d

Re: core.thread.Fiber --- runtime stack overflow unlike goroutines

2014-09-21 Thread Martin Nowak via Digitalmars-d-learn
Am I missing something? Is there a clean and simple way to get Fiber to no longer suffer a stack overflow when implementing D-routines? Simply choose a big enough stack size when creating your fibers. http://dlang.org/library/core/thread/Fiber.this.html It's fairly cheap to use a really big sta

Re: core.thread.Fiber --- runtime stack overflow unlike goroutines

2014-09-21 Thread Martin Nowak via Digitalmars-d-learn
On 08/15/2014 05:09 PM, Sean Kelly wrote: At least on OSX, it appears that mapping memory is constant time regardless of size, but there is some max total memory I'm allowed to map, presumably based on the size of a vmm lookup tabe. The max block size I can allocate is 1 GB, and I can allocate r

Re: vibe.d https_server example fails

2014-09-29 Thread Martin Nowak via Digitalmars-d-learn
On 09/29/2014 06:31 PM, "Nordlöw" wrote: What's wrong? Certificates? Use https instead of http :). https://localhost:8080/

Turn function into infinite range

2014-09-29 Thread Martin Nowak via Digitalmars-d-learn
Does anyone know a construct to turn a lambda into an infinite range. import std.random; unittest { Random gen; foreach(v; xxx!(() => uniform(0, 100, gen)).take(10)) writeln(v); } I though I've seen this around somewhere but can no longer find it.

Re: vibe.d https_server example fails

2014-09-29 Thread Martin Nowak via Digitalmars-d-learn
On 09/29/2014 08:20 PM, "Nordlöw" wrote: This however crashes the server program as Error executing command run: Program exited with code -11 Maybe I should use a vibe.d version other than master? Please report it https://github.com/rejectedsoftware/vibe.d/issues, there seems to be some issu

Re: vibe.d https_server example fails

2014-09-29 Thread Martin Nowak via Digitalmars-d-learn
On 09/29/2014 11:41 PM, Etienne wrote: Yes, the ssl_stream should be defined outside the if clause. The FreeLostRef refcount goes to 0 when it goes out of scope in http/server.d Well, how about a pull then? https://github.com/rejectedsoftware/vibe.d/issues/846

Re: A significant performance difference

2014-10-01 Thread Martin Nowak via Digitalmars-d-learn
You're comparing front removal on an ordered vs. an unordered container. Anyhow at least my C++ lib also caches the first used bucket.

Re: What is this ? Howw to solve it ?

2014-10-15 Thread Martin Nowak via Digitalmars-d-learn
On Wednesday, 15 October 2014 at 08:23:29 UTC, Marc Schütz wrote: Someone else already reported the same problem. I'll add a link to your post. Where, I didn't found any Bugzilla issue, so I opened one. https://issues.dlang.org/show_bug.cgi?id=13621

Re: Is this a bug when creating proxies in classes?

2014-10-16 Thread Martin Nowak via Digitalmars-d-learn
On Monday, 25 August 2014 at 18:10:33 UTC, Gary Willoughby wrote: class Foo { private int foo; mixin Proxy!(foo); this(int x) { this.foo = x; } } Apparently Proxy do

Re: Making plugin system with shared libraries. Upcast in shared lib

2014-10-20 Thread Martin Nowak via Digitalmars-d-learn
On 10/20/2014 12:32 AM, MrSmith wrote: Than any module can search for registered modules and try to cast them to concrete type (upcast). That can't work because the notion of types only exists during compilation. Therefor it's not possible to load new types at runtime and use them in code tha

Re: vibe.d problem

2014-11-18 Thread Martin Nowak via Digitalmars-d-learn
On Tuesday, 18 November 2014 at 13:37:54 UTC, Lázaro Armando via Digitalmars-d-learn wrote: this is very old. try git HEAD instead, it should help. How could I do that using dub? Running `dub upgrade` should be enough as a new version of vibe.d was just released.

Re: GC deadlocks on linux

2015-02-20 Thread Martin Nowak via Digitalmars-d-learn
On Wednesday, 18 February 2015 at 20:27:08 UTC, Byron Heads wrote: Adding core.memory.GC.disable; to main causes the application to work correctly (and quickly till it runs out of memory :D ) GC.disable shouldn't run OOM, BTW. http://dlang.org/phobos/core_memory.html#.GC.disable

Re: GC deadlocks on linux

2015-02-20 Thread Martin Nowak via Digitalmars-d-learn
On Wednesday, 18 February 2015 at 20:27:08 UTC, Byron Heads wrote: I have a medium size daemon application that uses several threads, libasync, and daemonize. On windows it runs correctly with GC enabled, but on linux the GC causes a deadlock while allocating memory. Can you reliably reproduce

Re: GC deadlocks on linux

2015-02-20 Thread Martin Nowak via Digitalmars-d-learn
On Wednesday, 18 February 2015 at 20:41:12 UTC, Dicebot wrote: Any chance you are using gdm-3.12.x? I was so mad when I have encountered this: https://issues.dlang.org/show_bug.cgi?id=4890 Indeed, maybe http://dlang.org/phobos-prerelease/core_thread.html#.thread_setGCSignals might help. We s

Re: GC deadlocks on linux

2015-02-20 Thread Martin Nowak via Digitalmars-d-learn
On 02/18/2015 09:35 PM, Byron Heads wrote: I am in the daemonize library https://github.com/NCrashed/daemonize Might want to try using libasync without multiple threads. http://www.linuxprogrammingblog.com/threads-and-fork-think-twice-before-using-them

Re: Is this a bug in dmd 2.067 for struct initializers?

2015-02-22 Thread Martin Nowak via Digitalmars-d-learn
On Thursday, 19 February 2015 at 22:07:55 UTC, stewarth wrote: I've gone with "static this()" approach and it works. You should use shared static this to initialize immutable variables.

Re: curl password issue

2015-02-23 Thread Martin Nowak via Digitalmars-d-learn
On Monday, 23 February 2015 at 16:10:42 UTC, Andre wrote: Curl has some issues with passwords containing special characters like the hash key (#). I don't found any reference for this issue in curl and the D wrapper hardly adds anything. You're sure it isn't an issue with your program or ho

Re: GC deadlocks on linux

2015-02-27 Thread Martin Nowak via Digitalmars-d-learn
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 02/18/2015 09:27 PM, Byron Heads wrote: > I have a medium size daemon application that uses several threads, > libasync, and daemonize. On windows it runs correctly with GC > enabled, but on linux the GC causes a deadlock while allocating > memory.

Re: Adding pointers to GC with destructers

2015-04-20 Thread Martin Nowak via Digitalmars-d-learn
On Sunday, 19 April 2015 at 23:38:49 UTC, Freddy wrote: C libraries have a pattern of HiddenType* getObj(); void freeObj(HiddenType*); Is there any way I can make the GC search for a "HiddenType*" and run "freeObj" when the pointer is not found. You can't turn an arbitrary pointer in

Re: Valgrind

2015-04-20 Thread Martin Nowak via Digitalmars-d-learn
On Monday, 20 April 2015 at 13:28:57 UTC, John Colvin wrote: The only special thing to take in to account is that valgrind will choke on DMD generated floating point code I actually fixed this problem a while ago. https://github.com/D-Programming-Language/dmd/pull/4368 An actual problem with v

Re: Structural exhaustive matching

2015-04-21 Thread Martin Nowak via Digitalmars-d-learn
On Tuesday, 21 April 2015 at 15:36:28 UTC, Jadbox wrote: What's the best equivalent to Rust's structural enum/pattern (match)ing? Is it also possible to enforce exhaustive matches? Basically, I'm curious on what the best way to do ADTs in D. If it needs to be really fast, use final switch on t

Re: Startup files for STM32F4xx

2015-04-24 Thread Martin Nowak via Digitalmars-d-learn
On Saturday, 25 April 2015 at 01:32:16 UTC, Jens Bauer wrote: This is most likely where the egg cracks open. i'm pretty sure we willl see people migrating to using D (at first a mixture between D and C, because of the libraries from the vendors), but later, there'll surely be projects which are

Re: Startup files for STM32F4xx

2015-04-25 Thread Martin Nowak via Digitalmars-d-learn
On Saturday, 25 April 2015 at 07:04:58 UTC, Jens Bauer wrote: Things that can be recycled would be carefully written drivers, such as LCD drivers that uses the SPI protocol. The SPI interface itself cannot be recycled, though, as each device has different SPI hardware and different GPIO hardwar

Re: Startup files for STM32F4xx

2015-04-25 Thread Martin Nowak via Digitalmars-d-learn
On Saturday, 25 April 2015 at 05:07:04 UTC, Jens Bauer wrote: I hope to find a good way to use import for microcontroller libraries, so it'll be easy for everyone. I'm thinking about something like ... import mcu.stm32f439.all I think that belongs in the makefile/dub.json as -version=STM32F

Re: Startup files for STM32F4xx

2015-04-25 Thread Martin Nowak via Digitalmars-d-learn
On Saturday, 25 April 2015 at 07:31:45 UTC, Jens Bauer wrote: I wonder if you can get e.g. interfaces and classes working. I hope I will. ;) I think classes are really a must. The only thing that I (currently) see that could perhaps block this from working, would be missing support for static

Re: Startup files for STM32F4xx

2015-04-25 Thread Martin Nowak via Digitalmars-d-learn
On Saturday, 25 April 2015 at 05:07:04 UTC, Jens Bauer wrote: While I remember it ... I had to nullify a number of imports in stdint. They simply do not belong in there. :) Eg. I do not want FILE* if I aks for stdint. But FILE* is forced upon me, because wchar_t includes it. What does a wchar_t

Re: Is it safe to reset HOLD fiber?

2015-05-03 Thread Martin Nowak via Digitalmars-d-learn
On Sunday, 3 May 2015 at 12:42:23 UTC, Dzugaru wrote: Just did another test and it seems its not safe at all. Reusing the fibers with reset without properly exiting the function leads to eventual stack overflow. It won't cleanup the old stack, so it may leak resources. It will properly reset

Re: Is it safe to reset HOLD fiber?

2015-05-03 Thread Martin Nowak via Digitalmars-d-learn
On Sunday, 3 May 2015 at 12:33:36 UTC, Dzugaru wrote: Documentation says "This fiber must be in state TERM." but in the core.thread I see In contract only on reset without parameters (bug maybe?) and with HOLD condition too: "assert( m_state == State.TERM || m_state == State.HOLD );" Does that

Re: Ada to D - an array for storing values of each of the six bits which are sufficient

2015-05-03 Thread Martin Nowak via Digitalmars-d-learn
On Friday, 1 May 2015 at 23:22:31 UTC, Dennis Ritchie wrote: Maybe someone will show a primitive packed array. I really can not imagine how to do it on D. Look at BitArray for an example https://github.com/D-Programming-Language/phobos/blob/12187d7be8b15b2f5f8ff6889cdb5ea3afb93dd1/std/bitmanip

Re: DUB Build Linker Library Search Path

2015-07-10 Thread Martin Nowak via Digitalmars-d-learn
On Friday, 10 July 2015 at 09:27:19 UTC, Nordlöw wrote: How do I tell `dub build` where to find libraries in non-standard directories? You're missing the development package libclang-dev, which should come with a pkg-config.

Re: GC stats

2015-07-25 Thread Martin Nowak via Digitalmars-d-learn
On Saturday, 25 July 2015 at 17:34:26 UTC, Márcio Martins wrote: What I want is a clean non-intrusive way to log when a collection happened, how long my threads were stopped, how much total memory and how many blocks were recovered. i.e. how much garbage was created in between collections. Are

Re: static linking

2015-07-25 Thread Martin Nowak via Digitalmars-d-learn
On Saturday, 25 July 2015 at 18:02:48 UTC, Laeeth Isharc wrote: I am trying to compile a D binary to run on AWS lambda. If I cannot link statically, which files should I include in the zip upload - libphobos2.so, libdruntime-linux64so.o ? I think dicebot who maitains the arch linux package ch

Re: static linking

2015-07-26 Thread Martin Nowak via Digitalmars-d-learn
On 07/26/2015 05:19 PM, Laeeth Isharc wrote: > > How do I do the same on gdc and ldc ? Since running times may be a > matter of seconds, speed and startup time counts especially for lambda. > Probably starting via nodejs is an unnecessary tax, but I guess they > will get rid of that requirement

Re: static linking

2015-07-26 Thread Martin Nowak via Digitalmars-d-learn
On 07/26/2015 05:19 PM, Laeeth Isharc wrote: > The former is trickier on arch in particular (not related to Dicebot's > choice) because they don't distributed static versions of library files > as a matter of policy. Yes, quite a few distributions no longer support fully static linking. Some, e.g.

Re: GC stats

2015-07-26 Thread Martin Nowak via Digitalmars-d-learn
On 07/26/2015 04:16 PM, Gary Willoughby wrote: > > I thought there is a recently added compiler option that profiles the GC > and creates a report now? That's an allocation profiler, the other one mentioned by me reports GC stats as requested by the OP.

Re: Subclasses in std.concurrency.receive pattern match

2015-07-31 Thread Martin Nowak via Digitalmars-d-learn
On Friday, 31 July 2015 at 07:35:47 UTC, Marek Janukowicz wrote: So patten matching only works on type of containing variable, not the type of the object itself. Is it possible to work around this? No, it would be very surprising if receive performed a dynamic downcast, and it's also somewhat

Re: Problem with dmd 2.068 Win 32

2015-08-11 Thread Martin Nowak via Digitalmars-d-learn
On Tuesday, 11 August 2015 at 15:04:29 UTC, MGW wrote: Hi! My project has an error link: Error 42: Symbol Undefined _D6object9Exception6__ctorMFNaNbNfAyaAyakC6object9ThrowableZC9Exception On dmd 2.067.* everything gathered without mistakes. Where to look for a mistake? Try ddemangle (part

Re: Trying to compile weather program

2015-08-25 Thread Martin Nowak via Digitalmars-d-learn
On Tuesday, 25 August 2015 at 05:27:16 UTC, Tony wrote: I happened to notice that among my libcurl*s libcurl-gnutls.so.3 libcurl-gnutls.so.4 libcurl-gnutls.so.4.3.0 libcurl.so.3 libcurl.so.4 libcurl.so.4.3.0 none were just libcurl.so. So I made a link for libcurl.so to the latest version and n

Re: Trying to compile weather program

2015-08-25 Thread Martin Nowak via Digitalmars-d-learn
On Sunday, 23 August 2015 at 09:54:37 UTC, Tony wrote: auto loc = getJSON("ipinfo.io/")["loc"] .str.split(","); BTW, the IP location doesn't work too reliably, if someone knows a better alternative...

Re: Is there a smart way to process a range of range by front ?

2015-09-23 Thread Martin Nowak via Digitalmars-d-learn
On Wednesday, 23 September 2015 at 21:30:37 UTC, BBasile wrote: auto interleave(RoR)(RoR r) { return r.transposed.join; If you use joiner it will even be lazy and avoid the allocation.

Re: Member not accessible in delegate body

2016-09-23 Thread Martin Nowak via Digitalmars-d-learn
On Friday, 23 September 2016 at 07:54:15 UTC, John C wrote: If I try to call the protected method of a superclass from inside the body of a delegate, the compiler won't allow it. void layoutTransaction(Control c, void delegate() action) { // do stuff action(); // do more stuff } class Co

Re: What exactly does the compiler switch -betterC do?

2016-10-05 Thread Martin Nowak via Digitalmars-d-learn
On Monday, 19 September 2016 at 21:09:39 UTC, Gary Willoughby wrote: On Monday, 20 June 2016 at 06:35:32 UTC, Jacob Carlborg wrote: On 2016-06-19 21:53, Gary Willoughby wrote: If compiled with -betterC, it contains these: T _main U _printf I get significantly

Re: What exactly does the compiler switch -betterC do?

2016-10-06 Thread Martin Nowak via Digitalmars-d-learn
On Wednesday, 5 October 2016 at 12:42:14 UTC On Wednesday, 5 October 2016 at 12:42:14 UTC, Jacob Carlborg wrote: No. There's a difference between DMD 2.070.0 and 2.071.0: OK, I'll retry on OSX, the bug report said Linux though. Seems like we're dragging in all of the _Dmain stuff. IIRC _Dmain

Re: How to debug (potential) GC bugs?

2016-10-07 Thread Martin Nowak via Digitalmars-d-learn
On Tuesday, 4 October 2016 at 08:14:37 UTC, Ilya Yaroshenko wrote: Probably related issue: https://issues.dlang.org/show_bug.cgi?id=15939 Crashes in a finalizer, likely not related to the dead-lock bug.

Re: How to debug (potential) GC bugs?

2016-10-07 Thread Martin Nowak via Digitalmars-d-learn
On Saturday, 1 October 2016 at 00:06:05 UTC, Matthias Klumpp wrote: So, this problem is: A) A compiler / DRuntime bug, or B) A bug in my code (not) triggered by a certain compiler / DRuntime We actually did change druntime recently to no longer fail when using GC.free from a finalizer (will

Re: Cannot link with libphobos2.a with GCC 6.2 on Ubuntu 16.10

2016-10-17 Thread Martin Nowak via Digitalmars-d-learn
On Thursday, 13 October 2016 at 18:35:43 UTC, Matthias Klumpp wrote: The new toolchains of Ubuntu (and Debian soon too) default to PIE code, so in order to link correctly, the project needs to be compiled with PIE/PIC to work. Please update the bug report. https://issues.dlang.org/show_bug.cgi

Re: Cannot link with libphobos2.a with GCC 6.2 on Ubuntu 16.10

2016-10-24 Thread Martin Nowak via Digitalmars-d-learn
On Monday, 17 October 2016 at 11:55:03 UTC, Martin Nowak wrote: Please update the bug report. https://issues.dlang.org/show_bug.cgi?id=5278 Updated, but do I seriously have to do everything? I'm not even an Ubuntu user.

Re: Auto recursive function

2017-01-11 Thread Martin Nowak via Digitalmars-d-learn
On Wednesday, 11 January 2017 at 19:23:10 UTC, Razvan Nitu wrote: auto makeMultidimensionalArray(T, Allocator)(auto ref Allocator alloc, size_t[] lengths) { if (lengths.length == 1) Looks like `static if` would fix your specific problem.

Re: Auto recursive function

2017-01-11 Thread Martin Nowak via Digitalmars-d-learn
On Wednesday, 11 January 2017 at 19:39:17 UTC, Ali Çehreli wrote: return choose(lengths.length == 1, one!T(alloc, lengths[0]), two!T(alloc, lengths)); Well, choose is the right tool when the choice can only be made at runtime. That would be uncommon for dimensionality. Anyhow mentioning