Re: How to convert hex string to string or ubytes? Thanks.

2018-02-05 Thread FrankLike via Digitalmars-d-learn
On Monday, 5 February 2018 at 09:45:11 UTC, tetyys wrote: On Monday, 5 February 2018 at 08:41:43 UTC, FrankLike wrote: Casting unknown bytes to string or char is unsafe, and obviously some bytes can be invalid UTF8 sequences. Thank you.I got my error.

Re: How to convert hex string to string or ubytes? Thanks.

2018-02-05 Thread tetyys via Digitalmars-d-learn
On Monday, 5 February 2018 at 08:41:43 UTC, FrankLike wrote: On Monday, 5 February 2018 at 06:12:22 UTC, H. S. Teoh wrote: On Mon, Feb 05, 2018 at 05:48:00AM +, FrankLike via auto input = "48656c6c6f20776f726c6421"; auto str = input.chunks(2) .map!(digits

Re: How to convert hex string to string or ubytes? Thanks.

2018-02-05 Thread Seb via Digitalmars-d-learn
On Monday, 5 February 2018 at 08:41:43 UTC, FrankLike wrote: On Monday, 5 February 2018 at 06:12:22 UTC, H. S. Teoh wrote: On Mon, Feb 05, 2018 at 05:48:00AM +, FrankLike via auto input = "48656c6c6f20776f726c6421"; auto str = input.chunks(2) .map!(digits

Re: Interfacing with C++

2018-02-05 Thread Kagamin via Digitalmars-d-learn
On Sunday, 4 February 2018 at 08:33:20 UTC, Mike Parker wrote: Though, I'm curious why anyone would want to declare a callback in a C++ program as cdecl only on Windows and use the default C++ convention everywhere else. I suggest you dig into it and make sure that's what's intended. And good

Re: DLangUI Drag and Drop support?

2018-02-05 Thread Jacob Carlborg via Digitalmars-d-learn
On 2018-02-03 19:06, Andres Clari wrote: Hi, is there support for drag and drop in dlangui?? I haven't found anything on the docs, issues or forums. I'm building a project that requires support for dropping URLs from the browser into a ListWidget. Is this possible with dlangui at all? DWT

Re: How to convert hex string to string or ubytes? Thanks.

2018-02-05 Thread FrankLike via Digitalmars-d-learn
On Monday, 5 February 2018 at 10:04:10 UTC, Seb wrote: On Monday, 5 February 2018 at 08:41:43 UTC, FrankLike wrote: auto input = cast(string)hexString(hash); Use toHexString to get the string: Sorry,'hexString(hash)' is my clerical error. Thank you.I got the answer "no array".

Re: Getting compiler Segfault

2018-02-05 Thread Jacob Carlborg via Digitalmars-d-learn
On 2018-02-04 13:52, Ur@nuz wrote: Getting compiler stack overflow when building my project, but still do not know how to localize piece of code that triggers this bug. Maybe this bug is already registered in bugzilla or someone could give some advice where to dig into? Just runed building

Re: Can't cast from void*

2018-02-05 Thread Steven Schveighoffer via Digitalmars-d-learn
On 2/3/18 12:37 PM, Kagamin wrote: --- interface A{} void* a=cast(void*)5; A b=cast(A)a; //ok A c=cast(A)cast(void*)5; //error --- Last line gives Error: cannot cast `void*` to `A`. Is it intended? Superficially, it looks like it should work, given the previous 2 lines. But I don't know what

Re: GUI program on Mac OS in D?

2018-02-05 Thread mrphobby via Digitalmars-d-learn
On Thursday, 21 December 2017 at 17:56:54 UTC, mrphobby wrote: Thanks for sharing! Your solution is more complete for sure. I think I will borrow a few ideas here :) I've been playing around with this a bit and it works pretty well. One thing that bothers me is the handling of NSString. I

Re: Terminating multiple processes – SOLVED

2018-02-05 Thread Russel Winder via Digitalmars-d-learn
On Fri, 2018-02-02 at 20:14 +, David Nadlinger wrote: > […] > That sounds entirely sensible. Your original question was whether it > was > possible to terminate threads blocked in a syscall, though. Signals > allow you to do that on POSIX for many "slow" syscalls, by making it > return

Re: Strange things allowed in iasm

2018-02-05 Thread Basile B. via Digitalmars-d-learn
On Sunday, 4 February 2018 at 05:45:02 UTC, Basile B. wrote: 1/ void foo() { asm pure nothrow { naked; mov RAX, [0x10][0x20] R8; ret; } } generates ;--- SUB 00449468h --- 00449468h mov eax, 0030h 0044946Dh ret

Re: How to convert hex string to string or ubytes? Thanks.

2018-02-05 Thread FrankLike via Digitalmars-d-learn
On Monday, 5 February 2018 at 06:12:22 UTC, H. S. Teoh wrote: On Mon, Feb 05, 2018 at 05:48:00AM +, FrankLike via auto input = "48656c6c6f20776f726c6421"; auto str = input.chunks(2) .map!(digits => cast(char) digits.to!ubyte(16))

Re: Getting compiler Segfault

2018-02-05 Thread Ur@nuz via Digitalmars-d-learn
On Monday, 5 February 2018 at 12:20:05 UTC, Jacob Carlborg wrote: On 2018-02-04 13:52, Ur@nuz wrote: Getting compiler stack overflow when building my project, but still do not know how to localize piece of code that triggers this bug. Maybe this bug is already registered in bugzilla or

Re: Interactive Interpreter

2018-02-05 Thread Stefan Koch via Digitalmars-d-learn
On Monday, 5 February 2018 at 19:54:09 UTC, Jiyan wrote: Is there any work for an interactive interpreter for D -maybe just for ctfe-able expressions? It shouldnt be too hard to implement it regarding the fact, that ctfe is kinda doing what an interpreter should do i guess. There is

workspace-d dsymbol Visual Code macOS

2018-02-05 Thread Joel via Digitalmars-d-learn
I'm using a macOS (10.12.6) computer. workspace-d used to work, but now it says it's not installed, (I think since I quit out of Visual Code before shutting down the computer). I tried compiling with with the option, but got this: Installing into

String to binary conversation

2018-02-05 Thread Vino via Digitalmars-d-learn
Hi All, Request your help on how to convert a string to binary,eg "test" to 01110100 01100101 01110011 01110100. From, Vino.B

Re: Using file as input to stdin when compiling

2018-02-05 Thread Jamie via Digitalmars-d-learn
On Tuesday, 6 February 2018 at 06:10:30 UTC, Jamie wrote: Hi, I'm following through TDPL and am trying to import a txt file during compiling for the stdin.byLine() function to read. Currently I have #!/usr/bin/rdmd and would like it to analyse the supplied text file. Is this possible in the

Using file as input to stdin when compiling

2018-02-05 Thread Jamie via Digitalmars-d-learn
Hi, I'm following through TDPL and am trying to import a txt file during compiling for the stdin.byLine() function to read. Currently I have #!/usr/bin/rdmd and would like it to analyse the supplied text file. Is this possible in the way that I'm thinking, or is there another way? Thanks

Re: Interfacing with C++

2018-02-05 Thread Timothee Cour via Digitalmars-d-learn
https://github.com/opencv/opencv/issues/6585#issuecomment-221842441 snip: > "C-API" is not supported and should be removed totally (but we have a lack of > resources to port this legacy C code to C++, so some of this code still > exists right now). Also huge part of fresh OpenCV functionality

Re: GUI program on Mac OS in D?

2018-02-05 Thread Jacob Carlborg via Digitalmars-d-learn
On 2018-02-05 16:49, mrphobby wrote: I've been playing around with this a bit and it works pretty well. One thing that bothers me is the handling of NSString. I came up with the following class to handle strings and make sure they do not leak. But maybe there is a nicer way to handle this in

Re: String to binary conversation

2018-02-05 Thread Steven Schveighoffer via Digitalmars-d-learn
On 2/5/18 1:27 PM, Vino wrote: Hi All, Request your help on how to convert a string to binary,eg "test" to 01110100 01100101 01110011 01110100. import std.stdio, std.string; writefln("%(%b %)", "test".representation); -Steve

Re: String to binary conversation

2018-02-05 Thread Steven Schveighoffer via Digitalmars-d-learn
On 2/5/18 1:40 PM, Steven Schveighoffer wrote: On 2/5/18 1:27 PM, Vino wrote: Hi All, Request your help on how to convert a string to binary,eg "test" to 01110100 01100101 01110011 01110100. import std.stdio, std.string; writefln("%(%b %)", "test".representation); For leading 0s:

Interactive Interpreter

2018-02-05 Thread Jiyan via Digitalmars-d-learn
Is there any work for an interactive interpreter for D -maybe just for ctfe-able expressions? It shouldnt be too hard to implement it regarding the fact, that ctfe is kinda doing what an interpreter should do i guess.