Error: char 0x200b not allowed in identifier

2019-06-03 Thread zoujiaqing via Digitalmars-d-learn
Error for code: source/hunt/xml/Element.d(12,13): Error: char 0x200b not allowed in identifier source/hunt/xml/Element.d(12,23): Error: character 0x200b is not a valid token source/hunt/xml/Element.d(17,15): Error: char 0x200b not allowed in identifier source/hunt/xml/Element.d(17,26): Error:

Re: Error: char 0x200b not allowed in identifier

2019-06-03 Thread zoujiaqing via Digitalmars-d-learn
On Monday, 3 June 2019 at 14:41:18 UTC, ag0aep6g wrote: On 03.06.19 15:37, zoujiaqing wrote: Error for code: source/hunt/xml/Element.d(12,13): Error: char 0x200b not allowed in identifier U+200B is: ZERO WIDTH SPACE. Somehow you got that invisible character into your code. You have to get

How to use template Object in interface?

2019-06-25 Thread zoujiaqing via Digitalmars-d-learn
hunt-cache current version use template implemention adapter changes. I want use Interface to define Adapter, this master code unable to comple. How to do it? D programming language design flaws? ```bash git clone https://github.com/huntlabs/hunt-cache cd hunt-cache/example dub run -v ...

Re: How to convert array of structs to JSON

2019-06-25 Thread zoujiaqing via Digitalmars-d-learn
On Tuesday, 25 June 2019 at 05:33:57 UTC, mark wrote: I have the following array of structs: struct Person { string name; int age; }; Person people[]; Person p; Person p1 = { "Bob", 12 }; Person p2 = { "Bob", 12 }; people ~= p1; people ~= p2; I've read through the

Re: How to use template Object in interface?

2019-06-25 Thread zoujiaqing via Digitalmars-d-learn
On Tuesday, 25 June 2019 at 12:11:47 UTC, zoujiaqing wrote: hunt-cache current version use template implemention adapter changes. I want use Interface to define Adapter, this master code unable to comple. How to do it? D programming language design flaws? ```bash git clone

Re: is there any micro-service library in D?

2019-06-25 Thread zoujiaqing via Digitalmars-d-learn
On Wednesday, 19 June 2019 at 08:29:15 UTC, dangbinghoo wrote: hi there, Does anyone know the micro-service oriented design library or framework in D? thanks! binghoo dang You can try hunt-service: hunt-service is distributed RPC framework for DLang based on gRPC and neton.

Re: How to use template Object in interface?

2019-06-26 Thread zoujiaqing via Digitalmars-d-learn
On Tuesday, 25 June 2019 at 12:11:47 UTC, zoujiaqing wrote: hunt-cache current version use template implemention adapter changes. I want use Interface to define Adapter, this master code unable to comple. How to do it? D programming language design flaws? ```bash git clone

Re: D on ARM laptops?

2019-07-04 Thread zoujiaqing via Digitalmars-d-learn
On Thursday, 4 July 2019 at 07:46:53 UTC, Paolo Invernizzi wrote: On Thursday, 4 July 2019 at 01:01:03 UTC, Nicholas Wilson wrote: On Wednesday, 3 July 2019 at 20:49:20 UTC, JN wrote: Does anyone know if and how well D works on ARM laptops (such as Chromebooks and similar)? For example this

Re: Dmd install to new Windows 10 system can't run app.d

2019-11-21 Thread zoujiaqing via Digitalmars-d-learn
On Thursday, 21 November 2019 at 08:42:39 UTC, Seb wrote: On Thursday, 21 November 2019 at 08:30:33 UTC, zoujiaqing wrote: 1. Download dmd.2.088.1.windows.7z 2. Unzip it to D:\Develop\dmd2 3. Add ENV D:\Develop\dmd2\windows\bin to System Path 4. Run `dub --version` and `dmd --version` in

Re: Dmd install to new Windows 10 system can't run app.d

2019-11-21 Thread zoujiaqing via Digitalmars-d-learn
On Thursday, 21 November 2019 at 08:42:39 UTC, Seb wrote: Note this line: Running .\myproject.exe Program exited with code -1073741515 Your compiled program is crashing. Could you run the compiled binary manually and obtain a stack trace? x86 is OK, but x64 bad. PS

Re: Dmd install to new Windows 10 system can't run app.d

2019-11-21 Thread zoujiaqing via Digitalmars-d-learn
On Thursday, 21 November 2019 at 08:42:39 UTC, Seb wrote: Note this line: Running .\myproject.exe Program exited with code -1073741515 Your compiled program is crashing. Could you run the compiled binary manually and obtain a stack trace? Install msvcr100.dll for x64 the question is

Re: How to get child class Type and members from parent class?

2019-11-21 Thread zoujiaqing via Digitalmars-d-learn
On Wednesday, 20 November 2019 at 22:26:17 UTC, Adam D. Ruppe wrote: On Wednesday, 20 November 2019 at 20:57:56 UTC, Matheus wrote: This is a different way of designing things, do people use this often? This is really only useful sometimes. It is important to notice that if you do class C :

Dmd install to new Windows 10 system can't run app.d

2019-11-21 Thread zoujiaqing via Digitalmars-d-learn
1. Download dmd.2.088.1.windows.7z 2. Unzip it to D:\Develop\dmd2 3. Add ENV D:\Develop\dmd2\windows\bin to System Path 4. Run `dub --version` and `dmd --version` in powershell is OK 5. dub ini myproject (no dependency) 6. Run `cd myproject` and `dub run` is error... Error Logging infomation:

Re: PHP to D Conversion

2019-10-21 Thread zoujiaqing via Digitalmars-d-learn
On Friday, 18 October 2019 at 06:22:33 UTC, Vino wrote: Hi All, Request your help in converting a PHP code to D equivalent code PHP Code: class avmtest { private $con; function __construct() { global $config; $this->con = new

Re: PHP to D Conversion

2019-10-21 Thread zoujiaqing via Digitalmars-d-learn
On Monday, 21 October 2019 at 15:36:25 UTC, Andre Pany wrote: On Monday, 21 October 2019 at 15:29:33 UTC, zoujiaqing wrote: On Friday, 18 October 2019 at 06:22:33 UTC, Vino wrote: [...] import hunt.database; class avmtest { private Database db; this() { db = new

Re: PHP to D Conversion

2019-10-21 Thread zoujiaqing via Digitalmars-d-learn
On Friday, 18 October 2019 at 06:22:33 UTC, Vino wrote: Hi All, Request your help in converting a PHP code to D equivalent code You can get one connection object and close it :) ```D import hunt.database; class AvmTest { private Database _db; this() { _db = new

How to get child class Type and members from parent class?

2019-11-20 Thread zoujiaqing via Digitalmars-d-learn
import std.stdio; class A { this(T)(T t) { } void write() { T _this = cast(T) this; writeln(this.v); } } class B : A { string v = "hello"; } void main() { auto b = new B; writeln(b.write()); // print hello }

Re: Dub - vibe.d - hunt framework ... problems

2020-02-06 Thread zoujiaqing via Digitalmars-d-learn
On Saturday, 1 February 2020 at 10:35:52 UTC, seany wrote: Hi I want to start a small server, that will be accessible form outside. Not a huge deal right? Not quite. My machine: 4.15.0-66-generic #75-Ubuntu SMP Tue Oct 1 05:24:09 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux DMD : DMD64 D

Re: Bind C++ class to DLang : undefined reference to `Canvas::Foo()'

2020-07-13 Thread zoujiaqing via Digitalmars-d-learn
I changed string to basic_string. /// source/main.d import std.stdio; import core.stdcpp.string; extern(C++) { class Canvas { @disable this(); static Canvas Create(); basic_string!ubyte Foo(); basic_string!ubyte Bar(); }; } void main() {

Re: Bind C++ class to DLang : undefined reference to `Canvas::Foo()'

2020-07-13 Thread zoujiaqing via Digitalmars-d-learn
On Monday, 13 July 2020 at 12:57:52 UTC, Adam D. Ruppe wrote: On Monday, 13 July 2020 at 09:34:35 UTC, zoujiaqing wrote: # dmd source/main.d Canvas.o -L-lstdc++ && ./main [1]49078 segmentation fault ./main On my computer I got this warning out of the compiler: libstdc++

Bind C++ class to DLang : undefined reference to `Canvas::Foo()'

2020-07-12 Thread zoujiaqing via Digitalmars-d-learn
/// Canvas.hpp #include ; class Canvas { static Canvas* Create(); std::string Foo(); std::string Bar(); }; /// Canvas.cpp #include "Canvas.hpp" #include Canvas* Canvas::Create() { return new Canvas(); } std::string Canvas::Foo() { return "Foo"; } std::string

Re: How to gets multi results using tuple in D?

2021-12-26 Thread zoujiaqing via Digitalmars-d-learn
On Thursday, 23 December 2021 at 08:56:36 UTC, WebFreak001 wrote: On Thursday, 23 December 2021 at 08:33:17 UTC, zoujiaqing wrote: C++ Code: ```cpp std::tuple DoIt() { return {false, 0, 0, "Hello"}; } auto [r1, r2, r3, r4] = DoIt(); if (r1 == false) ``` D Code: ```D Tuple!(bool, int,

How to gets multi results using tuple in D?

2021-12-23 Thread zoujiaqing via Digitalmars-d-learn
C++ Code: ```cpp std::tuple DoIt() { return {false, 0, 0, "Hello"}; } auto [r1, r2, r3, r4] = DoIt(); if (r1 == false) ``` D Code: ```D Tuple!(bool, int, int, string) DoIt() { return [false, 1, 1, "Hello"]; } auto result = DoIt(); auto r1= result[0]; auto r2= result[1]; auto r3=

How to define property type to Array!struct?

2021-12-14 Thread zoujiaqing via Digitalmars-d-learn
My code: ```D module http.HttpRequest; import std.container; import std.array : Appender; struct HttpRequest { struct Header() { Appender!string name; Appender!string value; } string method; string uri; int versionMajor = 0; int versionMinor = 0;

protobuf error: Tag value out of range

2023-10-16 Thread zoujiaqing via Digitalmars-d-learn
code: ```d auto req = new ApplyContact(); data.fromProtobuf!ApplyContact(req); ``` protobuf: ```d class ApplyContact { @Proto(1) string fromId = protoDefaultValue!string; @Proto(2) string toId = protoDefaultValue!string; @Proto(3) string message = protoDefaultValue!string;

Re: protobuf error: Tag value out of range

2023-10-16 Thread zoujiaqing via Digitalmars-d-learn
I was using a different version of dmd. Problem solved. thank you

I need to use delete as the method name. But now it's still a keyword, right?

2022-05-17 Thread zoujiaqing via Digitalmars-d-learn
https://dlang.org/changelog/2.100.0.html#deprecation_delete My code: ```D import std.stdio; class HttpClient { string get(string url) { return ""; } string delete(string url) { return ""; } } void main() {

Re: I need to use delete as the method name. But now it's still a keyword, right?

2022-05-18 Thread zoujiaqing via Digitalmars-d-learn
On Wednesday, 18 May 2022 at 15:33:09 UTC, Steven Schveighoffer wrote: On 5/18/22 2:13 AM, bauss wrote: On Wednesday, 18 May 2022 at 02:12:42 UTC, zoujiaqing wrote: https://dlang.org/changelog/2.100.0.html#deprecation_delete My code: ```D import std.stdio; class HttpClient { string

Re: I need to use delete as the method name. But now it's still a keyword, right?

2022-05-18 Thread zoujiaqing via Digitalmars-d-learn
On Wednesday, 18 May 2022 at 06:13:45 UTC, bauss wrote: Considering the deprecation period has ended then IMO it should be able to be used as an identifier. I would consider this a bug. I hope this is a bug ;)

Re: Does D programming language have work steal queue?

2022-05-22 Thread zoujiaqing via Digitalmars-d-learn
On Sunday, 22 May 2022 at 21:23:24 UTC, zoujiaqing wrote: On Sunday, 22 May 2022 at 21:07:19 UTC, zoujiaqing wrote: Does D language have task steal queue? The requirements are high-performance, lock-free, and thread-safe. I think the final usage scenario is similar to this C++ project:

Does D programming language have work steal queue?

2022-05-22 Thread zoujiaqing via Digitalmars-d-learn
Does D language have task steal queue? The requirements are high-performance, lock-free, and thread-safe.

Re: Does D programming language have work steal queue?

2022-05-22 Thread zoujiaqing via Digitalmars-d-learn
On Sunday, 22 May 2022 at 21:07:19 UTC, zoujiaqing wrote: Does D language have task steal queue? The requirements are high-performance, lock-free, and thread-safe. I think the final usage scenario is similar to this C++ project: https://github.com/ConorWilliams/Forkpool

Error: variable `impl` cannot be modified at compile time

2022-05-13 Thread zoujiaqing via Digitalmars-d-learn
```bash % git clone https://github.com/kerisy/archttp.git % cd archttp/ % dub build --compiler=dmd Performing "debug" build using dmd for x86_64. archttp 0.0.1+commit.3.g70d44ef: building configuration "library"... ../../.dub/packages/nbuff-0.1.14/nbuff/source/nbuff/buffer.d(74,25):

Re: Error: variable `impl` cannot be modified at compile time

2022-05-13 Thread zoujiaqing via Digitalmars-d-learn
On Friday, 13 May 2022 at 19:48:04 UTC, Steven Schveighoffer wrote: On 5/13/22 3:46 PM, Steven Schveighoffer wrote: What writeln? Your compile trace is missing the original call line, and I would say probably more. Looking at your last commit, I figured it out:

Re: Does D programming language have work steal queue?

2022-05-23 Thread zoujiaqing via Digitalmars-d-learn
On Sunday, 22 May 2022 at 22:37:43 UTC, Stefan Koch wrote: On Sunday, 22 May 2022 at 21:07:19 UTC, zoujiaqing wrote: Does D language have task steal queue? The requirements are high-performance, lock-free, and thread-safe. I have one called fluffy: https://github.com/UplinkCoder/fluffy I am

Re: Does D programming language have work steal queue?

2022-05-23 Thread zoujiaqing via Digitalmars-d-learn
On Sunday, 22 May 2022 at 23:34:19 UTC, mw wrote: On Sunday, 22 May 2022 at 21:07:19 UTC, zoujiaqing wrote: Does D language have task steal queue? The requirements are high-performance, lock-free, and thread-safe. I have a C's liblfds D wrapper: https://github.com/mw66/liblfdsd right now

Re: How to compiler dlang code on Apple M1?

2022-12-13 Thread zoujiaqing via Digitalmars-d-learn
On Saturday, 3 December 2022 at 20:33:59 UTC, Steven Schveighoffer wrote: The issue is dub. Make sure you are using the dub built for ARM. What Apple does is if any program in the same process group is x86 specific, then all the executed programs that are universal (including the linker)

How to compiler dlang code on Apple M1?

2022-12-03 Thread zoujiaqing via Digitalmars-d-learn
``` dub build --compiler=ldc2 --arch=arm64-apple-macos Starting Performing "debug" build using ldc2 for aarch64, arm_hardfloat. Building taggedalgebraic 0.11.22: building configuration [library] Building eventcore 0.9.20+commit.4.g6744ae7: building configuration [cfrunloop]

Datetime format?

2024-01-18 Thread zoujiaqing via Digitalmars-d-learn
```D import std.datetime : Clock, format; import std.stdio : writeln; void main() { auto currentTime = Clock.currTime; auto formattedTime = currentTime.format("%Y-%m-%d %H:%M:%S"); writeln("Formatted Time: ", formattedTime); } ```

Re: Datetime format?

2024-01-18 Thread zoujiaqing via Digitalmars-d-learn
On Thursday, 18 January 2024 at 23:43:13 UTC, Jonathan M Davis wrote: On Thursday, January 18, 2024 4:26:42 PM MST zoujiaqing via Digitalmars-d- learn wrote: ```D import std.datetime : Clock, format; import std.stdio : writeln; void main() { auto currentTime = Clock.currTime; auto

Re: Datetime format?

2024-01-18 Thread zoujiaqing via Digitalmars-d-learn
On Thursday, 18 January 2024 at 23:26:42 UTC, zoujiaqing wrote: ```D import std.datetime : Clock, format; import std.stdio : writeln; void main() { auto currentTime = Clock.currTime; auto formattedTime = currentTime.format("%Y-%m-%d %H:%M:%S"); writeln("Formatted Time: ",

How to hash SHA256 from string?

2023-12-02 Thread zoujiaqing via Digitalmars-d-learn
```D import std.stdio; import std.digest.sha; void main() { SHA256 sha256; sha256.start(); string appKey = "1"; ubyte[1024] data = cast(ubyte[])(appKey.dup[0..$]); sha256.put(data); ubyte[32] sign = sha256.finish();

Re: How to hash SHA256 from string?

2023-12-03 Thread zoujiaqing via Digitalmars-d-learn
Thank u every one ;) Use botan so easy: ```D import std.stdio; import botan; void main() { string appKey = "1"; auto sha256 = retrieveHash("SHA-256").clone(); sha256.update(appKey); string sign =

Re: Datetime format?

2024-01-20 Thread zoujiaqing via Digitalmars-d-learn
On Friday, 19 January 2024 at 00:22:48 UTC, H. S. Teoh wrote: On Thu, Jan 18, 2024 at 11:58:32PM +, zoujiaqing via Digitalmars-d-learn wrote: On Thursday, 18 January 2024 at 23:43:13 UTC, Jonathan M Davis wrote: > On Thursday, January 18, 2024 4:26:42 PM MST zoujiaqing via > Digital

Disable wrilten buf in docker

2024-03-12 Thread zoujiaqing via Digitalmars-d-learn
Hi, my application use writeln in docker don't display. Python add -u disable it. https://stackoverflow.com/questions/29663459/why-doesnt-python-app-print-anything-when-run-in-a-detached-docker-container

How to use eventcore write an echo server?

2024-03-11 Thread zoujiaqing via Digitalmars-d-learn
I use eventcore latest version write an echo server for test. some error of build. my D code: ```D import eventcore.core; import std.functional : toDelegate; import std.socket : InternetAddress; import std.exception : enforce; import core.time : Duration; import std.stdio : writeln; void

Re: Disable wrilten buf in docker

2024-03-12 Thread zoujiaqing via Digitalmars-d-learn
On Tuesday, 12 March 2024 at 06:39:40 UTC, Richard (Rikki) Andrew Cattermole wrote: On D's side you can use ``stdout.flush;`` to force it to flush. I don't think there is a way to force flushing via CLI. OK, thank you! Problem solved! Use code: ```D std.stdio.stdout.flush(); ```

The std.file rename method fails in the docker environment.

2024-03-13 Thread zoujiaqing via Digitalmars-d-learn
upload file to server in docker, but upload directory volume to host machine. Exception error: ``` Invalid cross-device link ``` Have other function like move(a, b) ? https://github.com/huntlabs/hunt-framework/blob/master/source/hunt/framework/file/File.d#L102

Re: Disable wrilten buf in docker

2024-03-13 Thread zoujiaqing via Digitalmars-d-learn
On Tuesday, 12 March 2024 at 15:44:08 UTC, Steven Schveighoffer wrote: On Tuesday, 12 March 2024 at 06:36:09 UTC, zoujiaqing wrote: Hi, my application use writeln in docker don't display. Python add -u disable it.

Re: The std.file rename method fails in the docker environment.

2024-03-13 Thread zoujiaqing via Digitalmars-d-learn
On Wednesday, 13 March 2024 at 22:16:13 UTC, Sergey wrote: On Wednesday, 13 March 2024 at 21:49:55 UTC, zoujiaqing wrote: this is bug in D. It seems like a bug in Hunt-framework. And Hunt - is an abandoned project. Hunt Framework call std.file rename function. but this function can't move

Re: The std.file rename method fails in the docker environment.

2024-03-13 Thread zoujiaqing via Digitalmars-d-learn
On Wednesday, 13 March 2024 at 21:21:21 UTC, Jonathan M Davis wrote: On Wednesday, March 13, 2024 3:03:30 PM MDT zoujiaqing via Digitalmars-d-learn wrote: upload file to server in docker, but upload directory volume to host machine. Exception error: ``` Invalid cross-device link ``` Have