Re: What is the alternative to the setlocale function of c in D? Thank you.

2019-01-26 Thread John Chapman via Digitalmars-d-learn

On Saturday, 26 January 2019 at 06:03:25 UTC, FrankLike wrote:

On Friday, 25 January 2019 at 15:05:50 UTC, John Chapman wrote:

On Friday, 25 January 2019 at 14:23:15 UTC, FrankLike wrote:
I need to set the font by the code now, because I need to do 
the installer, can't let this installer set the properties on 
each computer?


SetCurrentConsoleFontEx perhaps?

https://docs.microsoft.com/en-us/windows/console/setcurrentconsolefontex


That's so much code than next code.

///
extern(C) int setlocale(int,char*);

static this()
{
import core.stdc.wchar_;
import core.stdc.stdio;
fwide(core.stdc.stdio.stdout,1);
setlocale(0,cast(char*)"china");
}
///
But After D2.078.1,it's not work.
Why?
Thank you.


What has that code got to do with setting the console's font? So 
you need to add more code to accomplish that.


Re: Am I missing with ref in this code?

2019-01-26 Thread Jesse Phillips via Digitalmars-d-learn

On Thursday, 24 January 2019 at 15:28:19 UTC, Suliman wrote:
I am doing very small link-checker. Here is' code 
https://run.dlang.io/is/p8whrA


I am expecting that on line:
writefln("url: %s, status: %s", url.url, url.status);

I will print link and it's status. But I am getting only:
url: http://127.0.0.1:8081/hck, status:
url: http://127.0.0.1:8081/hck2, status:
url: http://127.0.0.1:8081/hck3, status:

It's seems that I missed something with refs? Could you help me 
find error?


You're writing asynchronous code and expecting it to process 
synchronized. Just make a synchronous call. If you need async use 
message passing with concurrency, probability on each call to the 
url so you can do the slow operations in parallel.


Re: code-d and serve-d fail to load after vs update

2019-01-26 Thread greatsam4sure via Digitalmars-d-learn

On Friday, 25 January 2019 at 22:19:01 UTC, WebFreak001 wrote:

On Friday, 25 January 2019 at 19:47:59 UTC, greatsam4sure wrote:

[...]


hi, can you check if you have write permissions to 
C:\Users\Greatsam\AppData\Local\dub\packages\dfmt-0.9.0\dfmt\bin ?


Are you using d.betaStream: true? If you set it to false again 
you will get precompiled binaries (though not the newest 
features, bugs and fixes)




setting d.betaStream to false finally work but how would one get 
the latest update.


Implement Interface Using Super

2019-01-26 Thread Jonathan Levi via Digitalmars-d-learn

This works in LDC but not DMD?

```
class A : B, I {
alias i = typeof(super).i;
}
class B {
void i() {
writeln("i");
}
}
interface I {
void i();
}
```

Is this a bug in DMD or in LDC?  How can I get this effect 
correctly?


Re: What is the alternative to the setlocale function of c in D? Thank you.

2019-01-26 Thread FrankLike via Digitalmars-d-learn

On Saturday, 26 January 2019 at 09:33:33 UTC, John Chapman wrote:

What has that code got to do with setting the console's font? 
So you need to add more code to accomplish that.


You don't need to set the font to achieve the goal, why not?