Re: Dynamically import() files

2017-10-23 Thread Igor via Digitalmars-d-learn

On Monday, 23 October 2017 at 12:15:17 UTC, Andre Pany wrote:

Hi,

I have a folder "i18n" which contains message bundle files. For 
now it contains only the message bundle file written by the 
developer: "messagebundle.properties".


[...]


Can't you just create all the files that you expect to have and 
leave them empty and then you import them all and process them 
differently if there is no content?


Re: DMD Callstacks

2017-10-23 Thread Nicholas Wilson via Digitalmars-d-learn

On Monday, 23 October 2017 at 12:41:09 UTC, Márcio Martins wrote:
What is everyone doing to get proper file name and line number 
info for callstacks with DMD?


addr2line just gives me ??:0


What OS, etc?


DMD Callstacks

2017-10-23 Thread Márcio Martins via Digitalmars-d-learn
What is everyone doing to get proper file name and line number 
info for callstacks with DMD?


addr2line just gives me ??:0



Re: Dynamically import() files

2017-10-23 Thread rikki cattermole via Digitalmars-d-learn
Don't be afraid to write a small script that is run before a build to 
generate a list of files which than can be imported.


Dynamically import() files

2017-10-23 Thread Andre Pany via Digitalmars-d-learn

Hi,

I have a folder "i18n" which contains message bundle files. For 
now it contains only the message bundle file written by the 
developer: "messagebundle.properties".


During the translation process additional message bundle files 
will be added to github:

messagebundle_en.properties
messagebundle_de.properties
...
Changing the github content will automatically triggering the 
compilation process.
My wish is, that every time a new message bundle file is added, 
these file is automatically included into the compilation process.



I doubt, but is there a possibility to check during compile time 
which files exists in the

i18n folder and import() these files?

I see currently only 1 chance: Create a list of all possible 
language code (max 7) and check whether the import works via 
__traits(compiles,...).


Something like:
alias languages = TypeTuple!("en", "de");
static foreach(lang; languages)
{
...
}

Kind regards
André


Re: DMD Callstacks

2017-10-23 Thread Márcio Martins via Digitalmars-d-learn

On Monday, 23 October 2017 at 12:54:33 UTC, Nicholas Wilson wrote:
On Monday, 23 October 2017 at 12:41:09 UTC, Márcio Martins 
wrote:
What is everyone doing to get proper file name and line number 
info for callstacks with DMD?


addr2line just gives me ??:0


What OS, etc?


Linux 64-bit (Ubuntu 16)
DMD64 2.076.1



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 the right thing here? Should I use a different format 
specifier?


[1] https://bitbucket.org/carun/biometrics-reports/src

Cheers,
Arun


Re: Dynamically import() files

2017-10-23 Thread Andre Pany via Digitalmars-d-learn

On Monday, 23 October 2017 at 20:13:20 UTC, Igor wrote:

On Monday, 23 October 2017 at 12:15:17 UTC, Andre Pany wrote:

Hi,

I have a folder "i18n" which contains message bundle files. 
For now it contains only the message bundle file written by 
the developer: "messagebundle.properties".


[...]


Can't you just create all the files that you expect to have and 
leave them empty and then you import them all and process them 
differently if there is no content?


Thanks for the hints. I have some concerns creating the files 
upfront, because the files should only be created by other 
colleagues in an official translation process.


I will check whether I can determine the files via script as 
proposed by Rikki.


Kind regards
André


Re: writeln double precision

2017-10-23 Thread Ali Çehreli via Digitalmars-d-learn

On 10/23/2017 07:22 AM, Arun Chandrasekaran wrote:
> void main() {
>  double a = 22/7.0;
>  import std.stdio: writeln, writefln;
>  writefln("%.51f", a);
> }

> But why does the compiler bring the C baggage for the integer
> division? Why do I need to `cast (double)` ?

I think you mean having to write 7.0 to bring a double into the expression.

> Can't the compiler figure
> it out?

Yes, it can but we don't want that. Otherwise, the code would be too 
slippery to keep under control. For example, introducing the following 
temporary variable would change the semantics:


  // Before:
  foo(22/7);

  // After
  double temp = 22/7;
  foo(temp);// Is this the same call with the same value?

Writing the above made me aware that function overloading would be too 
cumbersome as the compiler would find too many potential matches for the 
expressions. For example, should it convert 22/7 to float or double or 
long, etc.


The rule is that every expression has a type and 22/7 is int. The rules 
are carried from C and can be tricky. Both "Integer Promotions" and 
"Usual Arithmetic Conversion" are interesting here:


  https://dlang.org/spec/type.html#integer-promotions

Ali



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 the 
precision to the last 6 digits after decimal point.


Am I doing the right thing here? Should I use a different 
format specifier?


[1] https://bitbucket.org/carun/biometrics-reports/src

Cheers,
Arun


```
void main() {
double a = 22/7.0;
import std.stdio: writeln, writefln;
writefln("%.51f", a);
}
```

and it prints all the decimals. So I'm happy that I have not lost 
the precision. But why does the compiler bring the C baggage for 
the integer division? Why do I need to `cast (double)` ? Can't 
the compiler figure it out?


Re: Generating DDOX documentation

2017-10-23 Thread nama via Digitalmars-d-learn

On Friday, 20 October 2017 at 10:47:57 UTC, Andrew Edwards wrote:
Given a documented source file (eg. process.d), I can generate 
the DDOC version of the documentation with the -D switch of DMD 
as such:


$ dmd -Dfprocess.html process.d

What do I modify on that line to get the DDOX version of the 
same file?


Thanks,
Andrew


ok thank you https://perfect-review.com/;>perfect 
review