Simultaneously assigning to all values in a tuple

2019-03-27 Thread Jamie via Digitalmars-d-learn
Is it possible to assign to all values in a tuple at once if they 
are the same type?

I.e.

Tuple!(double, "x", double, "y") t;
t[] = 1.0;



Re: How to decode UTF-8 text?

2019-03-27 Thread kdevel via Digitalmars-d-learn

On Wednesday, 27 March 2019 at 13:39:07 UTC, Andrey wrote:

I have got some text with UTF-8. For example this part:

Παράλληλη αναζήτηση


This looks like a UTF-8 sequence which has been UTF-8 encoded.


How to decode it to get this result?

Παράλληλη αναζήτηση


Undo the second UTF-8 encoding by transcoding the UTF-8 into an 
8-bit character set (latin1, windows-1252 etc.) which you have to 
guess.


I have tried functions like "decode", "byUTF", "to!wchar"... 
but no success.


Input string is correct - checked it with 
"https://www.browserling.com/tools/utf8-decode;.


```decode.d
import std.stdio;
import std.encoding;

void main ()
{
   string src = "Î\u00a0αράλληλη 
αναζήτηση";

   Latin1String ls;
   transcode (src, ls);
   string targ = cast (string) ls;
   targ.writeln;
}
```
$ ./decode
Παράλληλη αναζήτηση


Re: Request some GtkD Assistance

2019-03-27 Thread Mike Wey via Digitalmars-d-learn

On 27-03-2019 11:01, Andrew Edwards wrote:
This would is already included in dlang.conf no? Yes furnishing an 
explicit path works.

dmd -de -w -L/Users/edwarac/dlang/dmd-2.085.0/osx/lib/libgtkd-3.a nufsaid

But why do I need to do that if it's sitting right next to phobos and 
DMD is already searching that directory for libraries?



That because of the way the dmd and the linker interpret the arguments.

-L tell dmd to pass the command that follows to the linker.
To tell the linker to link with a library in a known location you would 
use the -l flag.


For the value passed to -l the linker will prefix `lib` and postfix 
`.so` `.a`.


So the following should work properly:
`dmd -de -w -L-lgtkd-3 nufsaid'

--
Mike Wey


Re: Get this error running the D blog about containerizing D in Docker

2019-03-27 Thread Andre Pany via Digitalmars-d-learn

On Tuesday, 26 March 2019 at 21:58:49 UTC, WhatMeWorry wrote:

On Tuesday, 26 March 2019 at 21:20:06 UTC, Andre Pany wrote:

On Tuesday, 26 March 2019 at 17:36:15 UTC, WhatMeWorry wrote:

[...]


This error should not occur in recent versions of dub. Which 
dub version do you have (dub --version)?


Kind regards
Andre


Thanks,

I'm running Ubuntu 18.0. When I do a

sudo apt-get install dub
Reading package lists... Done
Building dependency tree
Reading state information... Done
dub is already the newest version (1.8.0-2).
0 upgraded, 0 newly installed, 0 to remove and 151 not upgraded.


but dub list returns 1.14.0

  dub 1.14.0: /home/generic/.dub/packages/dub-1.14.0/dub/

Do I have two versions of dub?  1.8.0-2 and 1.14.0?

Get the same error.


The old dub version is causing the issue. Use the install script 
from https://dlang.org/download.html to install a recent ldc / 
dmd.


Kind regards
Andre


How to decode UTF-8 text?

2019-03-27 Thread Andrey via Digitalmars-d-learn

Hello,
I have got some text with UTF-8. For example this part:

Παράλληλη αναζήτηση


How to decode it to get this result?

Παράλληλη αναζήτηση


I have tried functions like "decode", "byUTF", "to!wchar"... but 
no success.


Input string is correct - checked it with 
"https://www.browserling.com/tools/utf8-decode;.


Re: Request some GtkD Assistance

2019-03-27 Thread Andrew Edwards via Digitalmars-d-learn
On Wednesday, 27 March 2019 at 09:07:37 UTC, Nicholas Wilson 
wrote:
On Wednesday, 27 March 2019 at 06:55:53 UTC, Andrew Edwards 
wrote:



dmd -de -w -Llibgtkd-3.a nufsaid


try
dmd -de -w -lgtkd-3 nufsaid


No. That did not work.


dmd -de -w -L/path/to/lib nufsaid


This would is already included in dlang.conf no? Yes furnishing 
an explicit path works.
dmd -de -w -L/Users/edwarac/dlang/dmd-2.085.0/osx/lib/libgtkd-3.a 
nufsaid


But why do I need to do that if it's sitting right next to phobos 
and DMD is already searching that directory for libraries?



dlopen(libgdk-3.0.dylib, 258): image not found


it that a typo? gdk not gtk?


No. This i correct.

Regardless gtkD is bindings to gtk which are separate, make 
sure you have gtk installed and in your path.


gtk was the first think I installed, no issues there. I have 
found a solution to this. brew install gdk+3 does the trick.


Thank you.



Re: Request some GtkD Assistance

2019-03-27 Thread Nicholas Wilson via Digitalmars-d-learn

On Wednesday, 27 March 2019 at 06:55:53 UTC, Andrew Edwards wrote:

Good day all,

I've installed Gtk+ and GtkD on my MacBookPro which is running 
macOS Mojave but am having some issues linking to and using it. 
Any assistance to resolve this is appreciated.


Steps taken:

1. Install Gtk+

  brew install gtk+

2. Build and install GtkD-3.8.5

 unzip GtkD-3.8.5.zip
 copy gtkd folder to dmd/osx/src/
 make
 copy libgtkd-3.a to dmd/osx/lib/

3. Update dmd.conf

 add -I%@P%/../../src/gtkd to DFLAGS

Problems encountered:

1. Unable to find the lib

(dmd-2.085.0)BMP:model edwarac$ dmd -de -w -Llibgtkd-3.a nufsaid
ld: file not found: libgtkd-3.a
clang: error: linker command failed with exit code 1 (use -v to 
see invocation)

Error: linker exited with status 1

Not sure why I'm receiving this first error since the file is 
stored alongside the libphobos2.a which the linker doesn't have 
any issues locating. If copy the file to the local directory, 
linking completes without any further errors.


2. Unable to find libgtkd-3.dylib

 (dmd-2.085.0)Andrews-MBP:model edwarac$ ./nufsaid
 object.Exception@generated/gtkd/gtkd/Loader.d(125): 
Library load failed (libgdk-3.0.dylib): 
dlopen(libgdk-3.0.dylib, 258): image not found


Not sure what's going on here at all. This file was not created 
when I built GtkD. Where do I find it, or how do I create it?


--Andrew



dmd -de -w -Llibgtkd-3.a nufsaid


try
dmd -de -w -lgtkd-3 nufsaid
or
dmd -de -w -L/path/to/lib nufsaid


dlopen(libgdk-3.0.dylib, 258): image not found


it that a typo? gdk not gtk?

Regardless gtkD is bindings to gtk which are separate, make sure 
you have gtk installed and in your path.


Request some GtkD Assistance

2019-03-27 Thread Andrew Edwards via Digitalmars-d-learn

Good day all,

I've installed Gtk+ and GtkD on my MacBookPro which is running 
macOS Mojave but am having some issues linking to and using it. 
Any assistance to resolve this is appreciated.


Steps taken:

1. Install Gtk+

  brew install gtk+

2. Build and install GtkD-3.8.5

 unzip GtkD-3.8.5.zip
 copy gtkd folder to dmd/osx/src/
 make
 copy libgtkd-3.a to dmd/osx/lib/

3. Update dmd.conf

 add -I%@P%/../../src/gtkd to DFLAGS

Problems encountered:

1. Unable to find the lib

(dmd-2.085.0)BMP:model edwarac$ dmd -de -w -Llibgtkd-3.a nufsaid
ld: file not found: libgtkd-3.a
clang: error: linker command failed with exit code 1 (use -v to 
see invocation)

Error: linker exited with status 1

Not sure why I'm receiving this first error since the file is 
stored alongside the libphobos2.a which the linker doesn't have 
any issues locating. If copy the file to the local directory, 
linking completes without any further errors.


2. Unable to find libgtkd-3.dylib

 (dmd-2.085.0)Andrews-MBP:model edwarac$ ./nufsaid
 object.Exception@generated/gtkd/gtkd/Loader.d(125): Library 
load failed (libgdk-3.0.dylib): dlopen(libgdk-3.0.dylib, 258): 
image not found


Not sure what's going on here at all. This file was not created 
when I built GtkD. Where do I find it, or how do I create it?


--Andrew