Re: DConf 2017 Videos

2020-04-24 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Saturday, 25 April 2020 at 04:11:02 UTC, Ali Çehreli wrote: On 4/24/20 2:11 PM, Steven Schveighoffer wrote:> On 4/24/20 4:24 PM, matheus wrote: > whomever controlled the sociomantic youtube account took down > all the videos. I think it's unintentional because the same thing happened to

Re: How to import & export modules

2019-11-10 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Monday, 11 November 2019 at 01:28:54 UTC, userTY wrote: On Sunday, 10 November 2019 at 23:53:22 UTC, Vinod K Chandran wrote: [...] You must use a module that has public imports. Public imports are visible from the module that contain them but most importantly from the module that imports

Re: How to use classes from another d files

2019-10-22 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Tuesday, 22 October 2019 at 17:34:51 UTC, Vinod K Chandran wrote: Hi all, I am new to D. But some fair experience with vb.net. I was playing with D classes. I wrote a class in a D file. The file name is "classFile.d" ```D class TestClass { [...] What you are seeing is a linker error.

Re: D for sciencetific scripting / rapid protoryping

2019-10-22 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Tuesday, 22 October 2019 at 07:51:16 UTC, Arun Chandrasekaran wrote: On Tuesday, 22 October 2019 at 07:40:01 UTC, Prokop Hapala wrote: [...] If you are building individual files, use ldc2 with --link-defaultlib-shared flag: arun@home-pc:/tmp$ cat a.d void main() { import std;

Re: D for sciencetific scripting / rapid protoryping

2019-10-22 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Tuesday, 22 October 2019 at 07:40:01 UTC, Prokop Hapala wrote: On Tuesday, 22 October 2019 at 07:23:46 UTC, Daniel Kozak wrote: On Tue, Oct 22, 2019 at 8:00 AM Prokop Hapala via Digitalmars-d-learn wrote: I'm examining the possibility to move from Python+C/C++ to D or Python+D. I read

Re: Setting process name

2019-05-02 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Wed, May 1, 2019 at 7:50 PM Anonymouse via Digitalmars-d-learn wrote: > > Is there a way of setting the process/thread name that's neater > than this? > > import core.sys.posix.pthread; > > extern(C) int pthread_setname_np(pthread_t, const char*); > > void main() > { > import std.string :

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

2019-05-01 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Wed, May 1, 2019 at 9:18 AM Arun Chandrasekaran wrote: > > On Wed, May 1, 2019 at 8:15 AM Guillaume Piolat via > Digitalmars-d-learn wrote: > > > > On Wednesday, 1 May 2019 at 09:51:01 UTC, Laeeth Isharc wrote: > > > > > > Second question. Lots of people these days start to program to > > >

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

2019-05-01 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Wed, May 1, 2019 at 8:15 AM Guillaume Piolat via Digitalmars-d-learn wrote: > > On Wednesday, 1 May 2019 at 09:51:01 UTC, Laeeth Isharc wrote: > > > > Second question. Lots of people these days start to program to > > solve their problems at work but they may never have been shown > > the

Re: Logging best practices

2019-04-29 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Sat, Apr 27, 2019 at 2:55 AM Andre Pany via Digitalmars-d-learn wrote: > > On Thursday, 25 April 2019 at 10:33:00 UTC, Vladimirs Nordholm > wrote: > > Hello. > > > > Is there a current "Best Practices" for logging in D? > > > > For the actual logging, I know of `std.experimental.logger`. > >

Re: alias fails to compile

2019-04-22 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Monday, 22 April 2019 at 19:57:11 UTC, aliak wrote: On Monday, 22 April 2019 at 08:02:06 UTC, Arun Chandrasekaran wrote: What am I doing wrong here? struct A { union B { int bb; } B b; alias aa = B.bb; } void main() { A a = A(); // a.b.bb = 4; // works

Re: How to do alias to a C struct member?

2019-04-22 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Monday, 22 April 2019 at 11:04:49 UTC, dangbinghoo wrote: hi all, as now we don't have the net/if.h binding, I need to do struct ifreq binding myself, here's my code: [...] Looks like we both were working on the same thing, few hours apart.

Re: alias fails to compile

2019-04-22 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Monday, 22 April 2019 at 14:07:11 UTC, Alex wrote: On Monday, 22 April 2019 at 08:02:06 UTC, Arun Chandrasekaran wrote: What am I doing wrong here? struct A { union B { int bb; } B b; alias aa = b.bb; } void main() { A a = A(); // a.b.bb = 4; // works

alias fails to compile

2019-04-22 Thread Arun Chandrasekaran via Digitalmars-d-learn
What am I doing wrong here? struct A { union B { int bb; } B b; alias aa = B.bb; } void main() { A a = A(); // a.b.bb = 4; // works a.aa = 4; // fails } https://run.dlang.io/is/kXaVy2

Re: Is it possible to modify shared struct array in a function.

2019-02-07 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Friday, 8 February 2019 at 04:51:08 UTC, Sudhi wrote: On Friday, 8 February 2019 at 04:30:23 UTC, Arun Chandrasekaran wrote: [...] My example code was wrong. Below is the right one. struct Company { string name; string location; } struct Racks { int number; int location;

Re: Is it possible to modify shared struct array in a function.

2019-02-07 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Friday, 8 February 2019 at 04:13:39 UTC, Sudhi wrote: I have a situation, where i want to modify a shared variable in a function. Something like below struct Company { string name; string location; } struct Racks { int number; int location; } struct Metadata { string

How to split strings into AA using phobos

2018-12-11 Thread Arun Chandrasekaran via Digitalmars-d-learn
A typical example would be to split the HTTP query string into an AA. vibe.d has req.queryString, but no convenient wrapper to access it as an AA. http://localhost/hello?name=abc=123 I've got this far. auto arr = req.queryString.splitter('&').map!(a => a.splitter('=')); Thanks

Re: How to get a function name (string) @ compile time

2018-12-09 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Sunday, 9 December 2018 at 03:29:27 UTC, Andrew Pennebaker wrote: On Monday, 3 November 2008 at 12:29:16 UTC, Simen Kjaeraas wrote: On Mon, 03 Nov 2008 12:33:05 +0100, Denis Koroskin <2kor...@gmail.com> wrote: [...] That's not the only error here. Your template function also calls foo

Re: std.algorithm.canFind behavior difference between arrays and elements

2018-12-07 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Friday, 7 December 2018 at 20:28:37 UTC, Seb wrote: On Friday, 7 December 2018 at 19:38:29 UTC, Arun Chandrasekaran wrote: On Friday, 7 December 2018 at 19:12:31 UTC, Seb wrote: On Friday, 7 December 2018 at 18:51:27 UTC, Arun Chandrasekaran wrote: [...] Alternatively to the answers

Re: std.algorithm.canFind behavior difference between arrays and elements

2018-12-07 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Friday, 7 December 2018 at 19:12:31 UTC, Seb wrote: On Friday, 7 December 2018 at 18:51:27 UTC, Arun Chandrasekaran wrote: I'm trying to find the needle in the hay that's an array of strings. So the second assert fails for some reason. Is this expected? https://run.dlang.io/is/7OrZTA ```

Re: std.algorithm.canFind behavior difference between arrays and elements

2018-12-07 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Friday, 7 December 2018 at 19:12:31 UTC, Seb wrote: On Friday, 7 December 2018 at 18:51:27 UTC, Arun Chandrasekaran wrote: I'm trying to find the needle in the hay that's an array of strings. So the second assert fails for some reason. Is this expected? https://run.dlang.io/is/7OrZTA ```

Re: std.algorithm.canFind behavior difference between arrays and elements

2018-12-07 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Friday, 7 December 2018 at 19:08:05 UTC, Arun Chandrasekaran wrote: On Friday, 7 December 2018 at 18:57:48 UTC, Dennis wrote: On Friday, 7 December 2018 at 18:51:27 UTC, Arun Chandrasekaran wrote: Why is there a difference in the behavior? Your first assert expression is looking for a

Re: std.algorithm.canFind behavior difference between arrays and elements

2018-12-07 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Friday, 7 December 2018 at 18:57:48 UTC, Dennis wrote: On Friday, 7 December 2018 at 18:51:27 UTC, Arun Chandrasekaran wrote: Why is there a difference in the behavior? Your first assert expression is looking for a string in a larger string, your second expression looks for hay which is

std.algorithm.canFind behavior difference between arrays and elements

2018-12-07 Thread Arun Chandrasekaran via Digitalmars-d-learn
I'm trying to find the needle in the hay that's an array of strings. So the second assert fails for some reason. Is this expected? https://run.dlang.io/is/7OrZTA ``` #!/usr/bin/rdmd void main() { import std.experimental.all; string s1 = "aaa111aaa"; string s2 = "aaa222aaa";

Trying to get current function name results in compiler error with __traits

2018-12-06 Thread Arun Chandrasekaran via Digitalmars-d-learn
I'm trying to get the current function name and apparently the commented line errors out. What am I doing wrong? https://run.dlang.io/is/EGsRU2 ``` #!/usr/bin/rdmd void main() { import std.experimental.all; void foo() { // __traits(identifier, mixin(__FUNCTION__)).writeln; //

Re: file io

2018-09-06 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Thursday, 6 September 2018 at 16:13:42 UTC, hridyansh thakur wrote: how to read a file line by line in D std.stdio.File.byLine() Refer the doc here: https://dlang.org/library/std/stdio/file.by_line.html An example from the doc: ``` import std.algorithm, std.stdio, std.string; // Count

Re: Example of using C API from D?

2018-09-02 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Sunday, 2 September 2018 at 12:52:11 UTC, Russel Winder wrote: I am rewriting a C++ program in D, but need to access a C library that has no D binding: this is a GtkD based program which has a Pango binding, but Pango doesn't offer the information I need, that is hidden in the underlying

Re: Why The D Style constants are written in camelCase?

2018-05-09 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Wednesday, 9 May 2018 at 15:20:12 UTC, Jonathan M Davis wrote: On Wednesday, May 09, 2018 14:12:41 Dmitry Olshansky via Digitalmars-d-learn wrote: [...] To an extent that's true, but anyone providing a library for use by others in the D community should seriously consider following it

Re: How to curl!

2018-05-01 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Tuesday, 1 May 2018 at 21:57:22 UTC, IntegratedDimensions wrote: Trying to curl basic stuff but std.net.curl isn't cooperating: This is one of the reasons I hate D ;/ I've spent more time trying to get std.net.curl to do something that just works from the command line. std.net.curl is not

Warning on self assignment

2018-04-24 Thread Arun Chandrasekaran via Digitalmars-d-learn
So I was telling my colleague that D would warn on self assignment, but found that I was wrong. https://run.dlang.io/is/HLhtek ``` module a; import std.stdio; void main() { string a; a = a; // Can the compiler warn at this line that there is no effect? writeln(a);

Re: Benchmarking sigmoid function between C and D

2018-04-07 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Saturday, 7 April 2018 at 23:48:36 UTC, kinke wrote: On Saturday, 7 April 2018 at 20:33:13 UTC, Arun Chandrasekaran wrote: [...] As this appears to be benchmarking mostly the std.math.exp(float) performance - some/many basic algos in std.math, incl. exp(), are currently using the x87 FPU

Re: Benchmarking sigmoid function between C and D

2018-04-07 Thread Arun Chandrasekaran via Digitalmars-d-learn
c.math On Sat, Apr 7, 2018 at 8:53 PM, Arun Chandrasekaran via Digitalmars-d-learn <digitalmars-d-learn@puremagic.com> wrote: [...] Much better with mir.math.common, still a bit slower than C (even with larger loops): 10^7 iterations using sigmoid1: 168 ms 10^7 iterations using sig

Benchmarking sigmoid function between C and D

2018-04-07 Thread Arun Chandrasekaran via Digitalmars-d-learn
What am I doing wrong here that makes the D equivalent 2.5 times slower than it's C equivalent? Compilers used: LDC2: LDC - the LLVM D compiler (1.8.0) GCC: gcc (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609 11:36:39 ~/code/c/test2$ ldc2 sigmoid.d -O5 && ./sigmoid Max deviation is 0.001664

Re: how to make private class member private

2018-03-13 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Tuesday, 13 March 2018 at 13:59:00 UTC, Steven Schveighoffer wrote: On 3/12/18 10:06 PM, psychoticRabbit wrote: [...] OK, so I agree there are drawbacks. But these can be worked around. [...] Private members still have external linkage. Is there anyway to solve this?

Re: Access visibility and linkage

2018-02-15 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Thursday, 15 February 2018 at 06:52:15 UTC, Seb wrote: On Thursday, 15 February 2018 at 06:43:52 UTC, Arun Chandrasekaran wrote: I was reading through https://wiki.dlang.org/Access_specifiers_and_visibility#What_is_missing [...] DMD v2.077.1 exhibits the same behavior. Is this is

Access visibility and linkage

2018-02-14 Thread Arun Chandrasekaran via Digitalmars-d-learn
I was reading through https://wiki.dlang.org/Access_specifiers_and_visibility#What_is_missing There is currently no way in D to mark symbols for internal linkage, saying "this an implementation detail, you should not even know this one exists". This is an important module-level encapsulation

Re: parallelism

2018-01-28 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Sunday, 28 January 2018 at 04:44:23 UTC, thedeemon wrote: On Saturday, 27 January 2018 at 20:49:43 UTC, Arun Chandrasekaran wrote: But really I'm not sure why you want static foreach here I was just trying to see if static foreach can be used here, but well, you showed that it's not

Re: parallelism

2018-01-27 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Saturday, 27 January 2018 at 17:54:53 UTC, thedeemon wrote: On Saturday, 27 January 2018 at 11:19:37 UTC, Arun Chandrasekaran wrote: Simplified test case that still errors: You got really close here. Here's a working version: enum Operation { a, b } import std.traits, std.conv,

Re: parallelism

2018-01-27 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Saturday, 27 January 2018 at 10:49:45 UTC, Arun Chandrasekaran wrote: On Saturday, 27 January 2018 at 10:38:25 UTC, Nicholas Wilson wrote: ... [snip] Simplified test case that still errors: ``` enum Operation { a, b } import std.traits; import std.conv; void main(string[] args)

Re: parallelism

2018-01-27 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Saturday, 27 January 2018 at 10:38:25 UTC, Nicholas Wilson wrote: On Saturday, 27 January 2018 at 10:28:10 UTC, Arun Chandrasekaran wrote: ``` import std.parallelism; auto pool = new TaskPool(options.threadCount); foreach (_; 0 .. options.iterationCount) { switch

Re: parallelism

2018-01-27 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Saturday, 27 January 2018 at 10:28:10 UTC, Arun Chandrasekaran wrote: Hi All, Is there a way to rewrite this [...] Damn! The subject should've been something else.. naming is surely hard..

parallelism

2018-01-27 Thread Arun Chandrasekaran via Digitalmars-d-learn
Hi All, Is there a way to rewrite this ``` import std.parallelism; auto pool = new TaskPool(options.threadCount); foreach (_; 0 .. options.iterationCount) { switch (options.operation) { case Operation.a: pool.put(task!a(options)); break;

dub infinite loop

2018-01-22 Thread Arun Chandrasekaran via Digitalmars-d-learn
So dub gets into indefinite loop (let's not argue about infinite/indefinite). I've reported the issue a month back here http://forum.rejectedsoftware.com/groups/rejectedsoftware.dub/thread/16888/ and recently here https://github.com/dlang/dub/issues/1345 Does anyone face the same issue? How

Re: Get pointer or reference of an element in Array(struct)

2017-12-11 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Saturday, 9 December 2017 at 19:26:26 UTC, David Nadlinger wrote: but "free" references don't exist in the language. To the point! Thanks!

Re: Get pointer or reference of an element in Array(struct)

2017-12-08 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Saturday, 9 December 2017 at 06:38:46 UTC, anonymous wrote: On Saturday, 9 December 2017 at 06:15:16 UTC, Arun Chandrasekaran wrote: Is there a way to get the pointer or reference of an element in Array(T)? [...] auto d2 = gallery[0]; auto d2 = [0]; Thanks. Just curious why

Re: Parallel reads on std.container.array.Array

2017-12-08 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Saturday, 9 December 2017 at 01:34:40 UTC, Arun Chandrasekaran wrote: So I tried the same on Haswell processor with LDC 1.6.0 and it crashes ``` === Starting D version === Took 1 sec, 107 ms, and 383 μs to load 100 items. Gonna search in parallel... *** Error in `./dmain-ldc': double

Get pointer or reference of an element in Array(struct)

2017-12-08 Thread Arun Chandrasekaran via Digitalmars-d-learn
Is there a way to get the pointer or reference of an element in Array(T)? https://run.dlang.io/gist/70fd499afe8438d4877f57aec90c3091?compiler=dmd The assertion seems to fail below. Value copy is not is intended here. module test; void main() { struct Data { int id; }

Re: Parallel reads on std.container.array.Array

2017-12-08 Thread Arun Chandrasekaran via Digitalmars-d-learn
So I tried the same on Haswell processor with LDC 1.6.0 and it crashes ``` === Starting D version === Took 1 sec, 107 ms, and 383 μs to load 100 items. Gonna search in parallel... *** Error in `./dmain-ldc': double free or corruption (fasttop): 0x00edc6e0 *** *** Error in

Re: Parallel reads on std.container.array.Array

2017-12-08 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Friday, 8 December 2017 at 10:01:14 UTC, Kagamin wrote: On Friday, 8 December 2017 at 07:34:53 UTC, Arun Chandrasekaran wrote: I was wondering if std.container.array.Array supports threadsafe parallel reads similar to std::vector. No, your code can also fail on a system with inconsistent

Re: Parallel reads on std.container.array.Array

2017-12-08 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Friday, 8 December 2017 at 07:34:53 UTC, Arun Chandrasekaran wrote: I was wondering if std.container.array.Array supports threadsafe parallel reads similar to std::vector. I've created a small program for demonstration https://github.com/carun/parallel-read-tester It works fine with just

Re: Parallel reads on std.container.array.Array

2017-12-08 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Friday, 8 December 2017 at 07:34:53 UTC, Arun Chandrasekaran wrote: 2. I'm on an 8 CPU box and I don't seem to hit 800% CPU with D version (max 720%). However I can get 800% CPU usage with the C++ version. Please ignore, this is because of the write.

Re: Create D portable binary

2017-12-08 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Friday, 8 December 2017 at 06:37:36 UTC, Adam D. Ruppe wrote: On Friday, 8 December 2017 at 05:16:22 UTC, Fra Mecca wrote: Is there a way to compile a project and deploying it as a single statically linked binary? A default build of a D program is *reasonably* compatible. All its

Parallel reads on std.container.array.Array

2017-12-07 Thread Arun Chandrasekaran via Digitalmars-d-learn
I was wondering if std.container.array.Array supports threadsafe parallel reads similar to std::vector. I've created a small program for demonstration https://github.com/carun/parallel-read-tester It works fine with just couple of problems though: 1. D version takes way too long compared to

Re: git workflow for D

2017-12-05 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Monday, 4 December 2017 at 01:26:45 UTC, Arun Chandrasekaran wrote: On Sunday, 3 December 2017 at 23:39:49 UTC, Basile B. wrote: [...] If you still lose changes, you could try using Mercurial with hggit. It can be a bit slow, but not destructive as git itself. ;) I really wish

Re: git workflow for D

2017-12-03 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Sunday, 3 December 2017 at 23:39:49 UTC, Basile B. wrote: On Sunday, 3 December 2017 at 22:22:47 UTC, Arun Chandrasekaran wrote: Git CLI is arcane and esoteric. I've lost my commits before (yeah, my mistake). Who hasn't ;) Happened to me last time because i tried a command supposed to

Re: git workflow for D

2017-12-03 Thread Arun Chandrasekaran via Digitalmars-d-learn
Git CLI is arcane and esoteric. I've lost my commits before (yeah, my mistake). Since then I always access git via mercurial. In comparison Mercurial is far better a VCS tool.

Re: Andrei's "The D Programming Language" book. Up to date?

2017-11-29 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Wednesday, 29 November 2017 at 17:26:11 UTC, Nick Treleaven wrote: Here's a list of significant things - maybe incomplete: https://wiki.dlang.org/Differences_With_TDPL Multiple alias this You can only have one subtyping member currently. Shared Not all of shared's guarantees are

Re: CSV with empty values for integer fields

2017-10-30 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Sunday, 29 October 2017 at 15:45:23 UTC, Jesse Phillips wrote: Not really you'll need to parse it out as a string and do the conversion later. It probably would be good to support nullable!int pretty sure it doesn't currently. Should I raise a ticket on Bugzilla to address this?

CSV with empty values for integer fields

2017-10-28 Thread Arun Chandrasekaran via Digitalmars-d-learn
CSV with empty values for integer fields throws (Row: 1, Col: 3) Unexpected end of input when converting from type string to type int Code that parses the CSV: ``` import std.algorithm; import std.array; import std.csv; import std.stdio; import std.conv; import std.range; private struct

Re: writeln double precision

2017-10-24 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Tuesday, 24 October 2017 at 16:18:03 UTC, H. S. Teoh wrote: On Tue, Oct 24, 2017 at 10:02:11AM +, Arun Chandrasekaran via Digitalmars-d-learn wrote: On Monday, 23 October 2017 at 18:08:43 UTC, Ali Çehreli wrote: > On 10/23/2017 07:22 AM, Arun Chandrasekaran wrote: > > [...] &

Re: writeln double precision

2017-10-24 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Monday, 23 October 2017 at 18:08:43 UTC, Ali Çehreli wrote: On 10/23/2017 07:22 AM, Arun Chandrasekaran wrote: > [...] The rule is that every expression has a type and 22/7 is int. Thanks Ali. Is this for backward compatibility with C? Because, if there is a division, a

Re: writeln double precision

2017-10-23 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Monday, 23 October 2017 at 14:07:06 UTC, Arun Chandrasekaran wrote: I've written a simple tool [1] to find the DET and CMC specifically for biometrics performance measurement. When I generate the report, I expected to see high precision floating point numbers, but I see that writefln trims

writeln double precision

2017-10-23 Thread Arun Chandrasekaran via Digitalmars-d-learn
I've written a simple tool [1] to find the DET and CMC specifically for biometrics performance measurement. When I generate the report, I expected to see high precision floating point numbers, but I see that writefln trims the precision to the last 6 digits after decimal point. Am I doing

Re: Temporary objects as function parameters or when-is-this-shit-going-to-end?

2017-10-16 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Monday, 16 October 2017 at 03:49:18 UTC, ketmar wrote: Michael V. Franklin wrote: [...] judging from my several decades of expirience, bounties almost never works. there are alot of reasons for that, but the fact still stands: it is *almost* impossible to make something happen with

Re: What does ! mean?

2017-09-27 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Wednesday, 27 September 2017 at 14:34:06 UTC, Eugene Wissner wrote: On Wednesday, 27 September 2017 at 14:23:01 UTC, Ky-Anh Huynh wrote: See also the following chapter in Ali's book: http://ddili.org/ders/d.en/templates.html This chapter is what hooked me with D. Naming that chapter as

Re: task parallelize dirEntries

2017-08-11 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Friday, 11 August 2017 at 21:58:20 UTC, Johnson wrote: Just a thought, maybe the GC isn't cleaning up quick enough? You are allocating and md5 digest each iteration. Possibly, an opitimization is use use a collection of md5 hashes and reuse them. e.g., pre-allocate 100(you probably only

Re: task parallelize dirEntries

2017-08-11 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Friday, 11 August 2017 at 21:33:51 UTC, Arun Chandrasekaran wrote: I've modified the sample from tour.dlang.org to calculate the [...] RHEL 7.2 64 bit dmd v2.075.0 ldc 1.1.0

task parallelize dirEntries

2017-08-11 Thread Arun Chandrasekaran via Digitalmars-d-learn
I've modified the sample from tour.dlang.org to calculate the md5 digest of the files in a directory using std.parallelism. When I run this on a dir with huge number of files, I get: core.exception.OutOfMemoryError@src/core/exception.d(696): Memory allocation failed Since dirEntries returns

Re: RAII

2017-02-23 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Thursday, 23 February 2017 at 21:05:48 UTC, cym13 wrote: It reminds me of https://w0rp.com/blog/post/an-raii-constructor-by-another-name-is-just-as-sweet/ which isn't what you want but may be interesting anyway. It is interesting, indeed, thanks.

Re: RAII

2017-02-23 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Thursday, 23 February 2017 at 09:57:09 UTC, ketmar wrote: Arun Chandrasekaran wrote: I'm trying to write an RAII wrapper on Linux. I understand struct in D doesn't have default constructor (for .init reasons). I don't want to use `scope`. Is there an elegant way to achieve this in D?

RAII

2017-02-23 Thread Arun Chandrasekaran via Digitalmars-d-learn
I'm trying to write an RAII wrapper on Linux. I understand struct in D doesn't have default constructor (for .init reasons). I don't want to use `scope`. Is there an elegant way to achieve this in D? ``` import core.sys.posix.pthread; import core.sys.posix.sys.types; /// Makes

Concurrent containers

2017-01-27 Thread Arun Chandrasekaran via Digitalmars-d-learn
Does phobos offer concurrent containers? I couldn't find one at http://dlang.org/phobos/std_container.html Any other in the D land? Arun

Re: Thread will get garbage collected?

2017-01-17 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Tuesday, 17 January 2017 at 08:12:50 UTC, ketmar wrote: import core.thread; import core.time; import std.stdio; void threadStarter (string path) { new Thread({ for (;;) { writeln(path); Thread.sleep(1.seconds); } }).start(); } class A { ~this () { import

Re: vibe.d with explicit threads/threadpool instead of fibers

2016-10-25 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Tuesday, 25 October 2016 at 21:23:21 UTC, Arun Chandrasekaran wrote: I am looking for a RESTful framework in D, which can interact with an existing backend processes (C++) via ZeroMQ and shared memory. I thought vibe.d might be a viable option. But I discussed with someone on Freenode #d

vibe.d with explicit threads/threadpool instead of fibers

2016-10-25 Thread Arun Chandrasekaran via Digitalmars-d-learn
I am looking for a RESTful framework in D, which can interact with an existing backend processes (C++) via ZeroMQ and shared memory. I thought vibe.d might be a viable option. But I discussed with someone on Freenode #d and found that vibe.d doesn't support explicit threading [1]. Can

Setting native OS thread name (eg, via prctl)

2015-12-22 Thread Arun Chandrasekaran via Digitalmars-d-learn
I have this trivial code where the main thread clones a child thread. import std.stdio; import core.thread; import std.concurrency; class DerivedThread : Thread { this() { super(); } void quit() { _quit = true; } private: void setOSThreadName()

Re: Setting native OS thread name (eg, via prctl)

2015-12-22 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Tuesday, 22 December 2015 at 16:08:01 UTC, Dejan Lekic wrote: Arun, isn't that what the 'name' property is there for? Hi Dejan, Thanks for a quick reply. Setting the name property is not reflecting in the OS level. May be it is just used only at the object level? After setting the