Deserializing JSON as an abstract type

2019-11-18 Thread Chris via Digitalmars-d-learn
So I'm trying to make a D wrapper for Telegram's JSON API using libtdjson. All results coming from the JSON API take the following structure: { "@type": "className", "foo": "bar", "baz" { "@type": "otherClass" } } where every object, including nested ones, has a "@type" field whic

Re: Pro programmer

2019-08-26 Thread Chris via Digitalmars-d-learn
On Monday, 26 August 2019 at 06:46:04 UTC, GreatSam4sure wrote: What is the path of becoming very good at programming? Which language will one start with. Often it's the language that best solves the problem at hand for you, but it really depends on what you want to achieve. For fast scrip

Re: [vibe.d/dub] Linker error

2018-03-12 Thread Chris via Digitalmars-d-learn
On Friday, 9 March 2018 at 13:46:33 UTC, Chris wrote: I got this error msg today (see below): DUB version 1.8.0, built on Mar 3 2018 vibe.d version 0.8.3 dmd 2.078.3 (the same with 2.079.0 and 2.077.0) .dub/build/server64_72_debug-debug-linux.posix-x86_64-dmd_2079-CAC4A12AC8FE4B4625A9511E4EFEB

[vibe.d/dub] Linker error

2018-03-09 Thread Chris via Digitalmars-d-learn
I got this error msg today (see below): DUB version 1.8.0, built on Mar 3 2018 vibe.d version 0.8.3 dmd 2.078.3 (the same with 2.079.0 and 2.077.0) .dub/build/server64_72_debug-debug-linux.posix-x86_64-dmd_2079-CAC4A12AC8FE4B4625A9511E4EFEB8F6/anscealai.o: In function `_D3std5range10primitive

Re: Undefined Reference to OpenSSL EVP functions

2018-01-15 Thread Chris via Digitalmars-d-learn
On Tuesday, 16 January 2018 at 00:52:09 UTC, Chris wrote: I am trying to hook up OpenSSL to a dlang project I'm working on, but I have hit a problem when trying to link. I currently get the following linking error: undefined reference to `EVP_CIPHER_CTX_init' I have made sure to include the

Undefined Reference to OpenSSL EVP functions

2018-01-15 Thread Chris via Digitalmars-d-learn
I am trying to hook up OpenSSL to a dlang project I'm working on, but I have hit a problem when trying to link. I currently get the following linking error: undefined reference to `EVP_CIPHER_CTX_init' I have made sure to include the module wrapping the c headers import deimos.openssl.evp;

Pass range to a function

2017-07-27 Thread Chris via Digitalmars-d-learn
I'm using regex `matchAll`, and mapping it to get a sequence of strings. I then want to pass that sequence to a function. What is the general "sequence of strings" type declaration I'd need to use? In C#, it'd be `IEnumerable`. I'd rather not do a to-array on the sequence, if possible. (e.g.

Re: Copying and moving directories

2017-02-17 Thread Chris via Digitalmars-d-learn
On Friday, 17 February 2017 at 11:40:35 UTC, Jonathan M Davis wrote: Well, there's a _long_ history of it being called rename on POSIX systems, and since the D function is a simple wrapper around rename, it makes sense that it's called rename, much as I agree that the name isn't the best for

Re: Copying and moving directories

2017-02-17 Thread Chris via Digitalmars-d-learn
On Thursday, 16 February 2017 at 17:06:30 UTC, Jonathan M Davis wrote: Well, there's zero difference between renaming the file or directory and moving it. It's simply a difference in name. rename actually comes from POSIX, where rename is used in C code, and mv is used in the shell. So, I gue

Re: Copying and moving directories

2017-02-16 Thread Chris via Digitalmars-d-learn
On Thursday, 16 February 2017 at 16:41:48 UTC, Adam D. Ruppe wrote: On Thursday, 16 February 2017 at 16:38:51 UTC, Chris wrote: In `std.file`, I haven't found a function that allows me to move or at least copy directories, as in `mv dir /toDir`. Do I have to go the awkward way over `rename` or

Copying and moving directories

2017-02-16 Thread Chris via Digitalmars-d-learn
In `std.file`, I haven't found a function that allows me to move or at least copy directories, as in `mv dir /toDir`. Do I have to go the awkward way over `rename` or something?

Re: Other libraries - web site link, and other thoughts

2016-12-16 Thread Chris via Digitalmars-d-learn
Forgive if I'm suggesting something which was already discussed and dismissed, but I too would love a way to leverage C++ stuff into D. Can't we go to C++? Meaning there's a C++ compiler coming from the same hands as D. Couldn't we try to get the C++ compiler to compile in such a manner that D

Re: [Semi-OT] I don't want to leave this language!

2016-12-08 Thread Chris via Digitalmars-d-learn
On Thursday, 8 December 2016 at 11:09:12 UTC, ketmar wrote: [...] what can be done, tho, is article (or series of articles) describing what exactly druntime is, how it is compared to libc and libc++, why it doesn't hurt at all, how to do "bare metal" with custom runtime, why GC is handy (and

Re: [Semi-OT] I don't want to leave this language!

2016-12-08 Thread Chris via Digitalmars-d-learn
On Wednesday, 7 December 2016 at 16:43:54 UTC, bachmeier wrote: On Wednesday, 7 December 2016 at 16:15:32 UTC, Chris wrote: I don't understand this discussion at all. Why not have both? I don't need bare metal stuff at the moment but I might one day, and I perfectly understand that people may n

Re: [Semi-OT] I don't want to leave this language!

2016-12-07 Thread Chris via Digitalmars-d-learn
On Wednesday, 7 December 2016 at 15:17:21 UTC, Picaud Vincent wrote: On Wednesday, 7 December 2016 at 11:48:32 UTC, bachmeier wrote: [...] I understand and I do agree with these points, honestly. These points are also the reason why I will maybe try to use D for my own codes (D is really mu

Re: Switch ignores case (?)

2016-11-24 Thread Chris via Digitalmars-d-learn
On Thursday, 24 November 2016 at 10:12:40 UTC, ketmar wrote: thanks. tbh, i am surprised myself -- it is completely fubared, but nobody noticed. maybe that says something about real-world useability of dstring/wstring... ;-) Well, I came across it, because I wanted to work around autodecode

Re: Switch ignores case (?)

2016-11-24 Thread Chris via Digitalmars-d-learn
On Wednesday, 23 November 2016 at 22:13:38 UTC, ketmar wrote: On Wednesday, 23 November 2016 at 22:00:58 UTC, Steven Schveighoffer wrote: I can't see why you need to deal with the glue layer at all -- just tell the glue layer that it's a list of strings and not dstrings ;) 'cause that is how

Re: Switch ignores case (?)

2016-11-23 Thread Chris via Digitalmars-d-learn
On Wednesday, 23 November 2016 at 19:30:01 UTC, ketmar wrote: On Wednesday, 23 November 2016 at 19:07:49 UTC, Chris wrote: It has something to do with the smart quote, e.g.: it is wrong binary search in `_d_switch_string()`. strings for switch are lexically sorted, and compiler calls `_d_swi

Re: Switch ignores case (?)

2016-11-23 Thread Chris via Digitalmars-d-learn
On Wednesday, 23 November 2016 at 18:34:28 UTC, Steven Schveighoffer wrote: Please file here: https://issues.dlang.org/enter_bug.cgi I think this has been there forever. Happens in 2.040 too (the earliest dmd I have on my system). -Steve Here it is: https://issues.dlang.org/show_bug.cgi

Re: Switch ignores case (?)

2016-11-23 Thread Chris via Digitalmars-d-learn
On Wednesday, 23 November 2016 at 17:33:04 UTC, Steven Schveighoffer wrote: I tested this locally with different ideas. This definitely looks like a codegen bug. I was able to reduce it to: void main() { switch("'"d) { case "'"d: writeln("a"); break; case "’

Switch ignores case (?)

2016-11-23 Thread Chris via Digitalmars-d-learn
Only one of the two cases is considered. What am I doing wrong? ` import std.array; import std.conv; import std.stdio; void main() { auto tokens = to!(dchar[][])(["D"d, "’"d, "Addario"d, "'"d]); // Or use this below: //~ dstring[] tokens = ["D"d, "’"d, "Addario"d, "'"d]; while (!tokens.e

Re: Best approach to handle accented letters

2016-10-28 Thread Chris via Digitalmars-d-learn
On Friday, 28 October 2016 at 14:31:47 UTC, Chris wrote: On Friday, 28 October 2016 at 13:50:24 UTC, Alfred Newman wrote: It boils down to something like: if (c in _accent) return _accent[c]; else return c; Just a normal lambda (condition true) ? yes : no; I'd recommend you to use Marc's

Re: Best approach to handle accented letters

2016-10-28 Thread Chris via Digitalmars-d-learn
On Friday, 28 October 2016 at 13:50:24 UTC, Alfred Newman wrote: On Friday, 28 October 2016 at 11:40:37 UTC, Chris wrote: [...] @Chris As a new guy in the D community, I am not sure, but I think the line below is something like a Python's lambda, right ? auto removed = to!string(str.map!(a

Re: Best approach to handle accented letters

2016-10-28 Thread Chris via Digitalmars-d-learn
On Friday, 28 October 2016 at 12:52:04 UTC, Marc Schütz wrote: On Friday, 28 October 2016 at 11:24:28 UTC, Alfred Newman wrote: [...] import std.stdio; import std.algorithm; import std.uni; import std.conv; void main() { auto str = "très élégant"; immutable accents = unicode.Diacritic

Re: Best approach to handle accented letters

2016-10-28 Thread Chris via Digitalmars-d-learn
On Friday, 28 October 2016 at 11:24:28 UTC, Alfred Newman wrote: Hello, I'm getting some troubles to replace the accented letters in a given string with their unaccented counterparts. Let's say I have the following input string "très élégant" and I need to create a function to return just "t

Re: vibe.d HTMLLogger

2016-10-12 Thread Chris via Digitalmars-d-learn
On Wednesday, 12 October 2016 at 14:19:36 UTC, Chris wrote: The answer is that `HTMLLogger` needs to be given the time in the `LogLine` struct, else it fails. The time stamp is not auto generated. I completely overlooked that. Here's the culprit: cf. m_logFile.writef(`%s`, msg.time.toISOE

Re: vibe.d HTMLLogger

2016-10-12 Thread Chris via Digitalmars-d-learn
On Wednesday, 12 October 2016 at 11:54:14 UTC, Chris wrote: Why does FileLogger work while HTMLLogger crashes on the same thing? I've had a look at the source code, but couldn't find anything. It happens with vibe.d `0.7.30-beta1` and `0.7.29` alike (haven't tested lower versions). [Test code

vibe.d HTMLLogger

2016-10-12 Thread Chris via Digitalmars-d-learn
Why does FileLogger work while HTMLLogger crashes on the same thing? I've had a look at the source code, but couldn't find anything. It happens with vibe.d `0.7.30-beta1` and `0.7.29` alike (haven't tested lower versions). [Test code] auto logLine = LogLine(); logLine.level = LogLevel.info; /

vibe.d Logger

2016-10-03 Thread Chris via Digitalmars-d-learn
Is this the preferred logging module for vibe.d: http://vibed.org/api/vibe.core.log/ There is also: http://vibed.org/api/vibe.http.log/ which is there for backwards compatibility?

Re: vibe.d maxRequestSize

2016-09-22 Thread Chris via Digitalmars-d-learn
On Monday, 19 September 2016 at 18:13:12 UTC, Chris wrote: On Monday, 19 September 2016 at 17:54:05 UTC, Steven Schveighoffer wrote: On 9/19/16 1:34 PM, Chris wrote: [...] Here is the culprit: https://github.com/rejectedsoftware/vibe.d/blob/0.7.29/source/vibe/http/server.d#L1861 And the def

Re: vibe.d maxRequestSize

2016-09-19 Thread Chris via Digitalmars-d-learn
On Monday, 19 September 2016 at 17:54:05 UTC, Steven Schveighoffer wrote: On 9/19/16 1:34 PM, Chris wrote: [...] Here is the culprit: https://github.com/rejectedsoftware/vibe.d/blob/0.7.29/source/vibe/http/server.d#L1861 And the definition of MaxHTTPHeaderLineLength is: https://github.com/r

Re: vibe.d maxRequestSize

2016-09-19 Thread Chris via Digitalmars-d-learn
On Monday, 19 September 2016 at 16:55:05 UTC, Steven Schveighoffer wrote: Hm... you don't get a full stack trace? Hard to tell what max_bytes should be, it defaults to ulong.max, so no way you are exhausting that. Without knowing where readUntilSmall is called, it's hard to diagnose. -St

Re: vibe.d maxRequestSize

2016-09-19 Thread Chris via Digitalmars-d-learn
On Thursday, 15 September 2016 at 13:26:48 UTC, Steven Schveighoffer wrote: On 9/15/16 9:11 AM, Chris wrote: On Wednesday, 14 September 2016 at 20:23:09 UTC, Steven Schveighoffer wrote: Hm.. I have adjusted this in my project, and it works (set to 50M). Needed it for uploading large images

Re: std.algorithm.iteration.each requires opApply to have ref elements?

2016-09-16 Thread Chris via Digitalmars-d-learn
On Thursday, 15 September 2016 at 18:23:14 UTC, Q. Schroll wrote: Why does it do that? And seemingly it does not require it for opApply with more than two arguments. Here's what the comment says: https://github.com/dlang/phobos/blob/master/std/algorithm/iteration.d#L929 // opApply with >2 pa

Re: vibe.d maxRequestSize

2016-09-16 Thread Chris via Digitalmars-d-learn
On Friday, 16 September 2016 at 00:35:25 UTC, sarn wrote: I hope this isn't too obvious, but I have to ask because it's such a common gotcha: Are you reverse proxying through a server like nginx by any chance? There are default request size limits there. (For nginx specifically, it's this o

Re: vibe.d maxRequestSize

2016-09-15 Thread Chris via Digitalmars-d-learn
On Thursday, 15 September 2016 at 13:26:48 UTC, Steven Schveighoffer wrote: On 9/15/16 9:11 AM, Chris wrote: On Wednesday, 14 September 2016 at 20:23:09 UTC, Steven Schveighoffer wrote: Hm.. I have adjusted this in my project, and it works (set to 50M). Needed it for uploading large images

Re: vibe.d maxRequestSize

2016-09-15 Thread Chris via Digitalmars-d-learn
On Wednesday, 14 September 2016 at 20:23:09 UTC, Steven Schveighoffer wrote: Hm.. I have adjusted this in my project, and it works (set to 50M). Needed it for uploading large images. Using version 0.7.29 -Steve It doesn't seem to make any difference in my case. I wonder what could be wr

vibe.d maxRequestSize

2016-09-14 Thread Chris via Digitalmars-d-learn
The vibe.d server rejects `XMLHttpRequest`s that are too long (in the eyes of the server). In the docs it says "maxRequestSize ulong Maximum number of transferred bytes per request after which the connection is closed with [sic!]" However, when you go to http://vibed.org/api/vibe.http.ser

Re: Linker error

2016-06-10 Thread Chris via Digitalmars-d-learn
On Friday, 10 June 2016 at 13:17:32 UTC, Steven Schveighoffer wrote: On 6/10/16 8:04 AM, Chris wrote: I get the error below with code like this: auto res = ['1', '2'].map!(a => a.to!string); dmd 2.071.0 What's wrong here? I import std.algorithm, std.range, std.array, std.conv in the module.

Re: Linker error

2016-06-10 Thread Chris via Digitalmars-d-learn
On Friday, 10 June 2016 at 13:00:23 UTC, ketmar wrote: On Friday, 10 June 2016 at 12:52:05 UTC, Chris wrote: I use dub and `dvm use 2.071.0`. hm. sorry, i can't help you with this. straight "dmd test.d" is ok, so it's probably something with dub/dvm interaction... It doesn't compile with `

Re: Linker error

2016-06-10 Thread Chris via Digitalmars-d-learn
On Friday, 10 June 2016 at 12:12:17 UTC, ketmar wrote: On Friday, 10 June 2016 at 12:04:50 UTC, Chris wrote: I get the error below with code like this: auto res = ['1', '2'].map!(a => a.to!string); dmd 2.071.0 What's wrong here? I import std.algorithm, std.range, std.array, std.conv in the m

Linker error

2016-06-10 Thread Chris via Digitalmars-d-learn
I get the error below with code like this: auto res = ['1', '2'].map!(a => a.to!string); dmd 2.071.0 What's wrong here? I import std.algorithm, std.range, std.array, std.conv in the module. (.data._D65TypeInfo_xC3std5range10interfaces18__T10InputRangeTiZ10InputRange6__initZ+0x10): undefined

Re: What's wrong with my usage of std.algorithm.map in this code example?

2016-05-26 Thread Chris via Digitalmars-d-learn
On Wednesday, 25 May 2016 at 19:07:32 UTC, Era Scarecrow wrote: On Wednesday, 25 May 2016 at 13:27:28 UTC, Chris wrote: Why can the tuple be iterated with foreach, as in my quick fix, and indexed with tuple[0..], but is not accepted as a range? What are the differences? Is there a way to rangif

Re: What's wrong with my usage of std.algorithm.map in this code example?

2016-05-25 Thread Chris via Digitalmars-d-learn
On Wednesday, 25 May 2016 at 14:48:14 UTC, ag0aep6g wrote: On 05/25/2016 04:39 PM, Chris wrote: I see. Maybe it would be worth adding a wrapper to typecons.Tuple or std.range that helps to rangify tuples. std.range.only is that wrapper. Duh! Of course! :-) I cannot think of any use case r

Re: What's wrong with my usage of std.algorithm.map in this code example?

2016-05-25 Thread Chris via Digitalmars-d-learn
On Wednesday, 25 May 2016 at 14:32:11 UTC, ag0aep6g wrote: On 05/25/2016 03:27 PM, Chris wrote: Why can the tuple be iterated with foreach, as in my quick fix, and indexed with tuple[0..], but is not accepted as a range? What are the differences? popFront doesn't make sense with a tuple (aka

Re: What's wrong with my usage of std.algorithm.map in this code example?

2016-05-25 Thread Chris via Digitalmars-d-learn
On Wednesday, 25 May 2016 at 13:27:28 UTC, Chris wrote: On Wednesday, 25 May 2016 at 12:08:20 UTC, Steven Schveighoffer wrote: On 5/25/16 6:24 AM, pineapple wrote: On Tuesday, 24 May 2016 at 20:18:34 UTC, Steven Schveighoffer wrote: Slice assignment from range to array is not supported. In yo

Re: What's wrong with my usage of std.algorithm.map in this code example?

2016-05-25 Thread Chris via Digitalmars-d-learn
On Wednesday, 25 May 2016 at 12:08:20 UTC, Steven Schveighoffer wrote: On 5/25/16 6:24 AM, pineapple wrote: On Tuesday, 24 May 2016 at 20:18:34 UTC, Steven Schveighoffer wrote: Slice assignment from range to array is not supported. In your example, I'm curious why the efforts to specify the t

Re: What's wrong with my usage of std.algorithm.map in this code example?

2016-05-25 Thread Chris via Digitalmars-d-learn
On Wednesday, 25 May 2016 at 11:14:26 UTC, FreeSlave wrote: Works with 'only', 'array' and static array slicing. import std.algorithm : map; import std.range : only; import std.conv : to; import std.stdio : writeln; import std.string : join; import std.array : array; string test(Args...)(in Ar

Re: What's wrong with my usage of std.algorithm.map in this code example?

2016-05-25 Thread Chris via Digitalmars-d-learn
On Wednesday, 25 May 2016 at 10:24:19 UTC, pineapple wrote: On Tuesday, 24 May 2016 at 20:18:34 UTC, Steven Schveighoffer wrote: Slice assignment from range to array is not supported. In your example, I'm curious why the efforts to specify the type? I think it would work with just saying auto

Re: DlangIDE Themes

2016-05-12 Thread Chris via Digitalmars-d-learn
On Thursday, 12 May 2016 at 15:29:17 UTC, Vadim Lopatin wrote: Hello, External themes support is planned. It is not a hard task. Btw, try to copy your resource files (res directory) to the same place dlangui executable (e.g. dlangide) is located. Resources from this directory must be accessi

Re: static import (v2.071.0)

2016-05-12 Thread Chris via Digitalmars-d-learn
On Thursday, 12 May 2016 at 12:45:38 UTC, Steven Schveighoffer wrote: On 5/11/16 10:11 AM, Chris wrote: No. static import just defines what symbols are accessible in what contexts. The (likely) reason you are getting this is because you are importing a module with a selective import: impor

Re: DlangIDE Themes

2016-05-12 Thread Chris via Digitalmars-d-learn
On Thursday, 12 May 2016 at 09:51:18 UTC, thedeemon wrote: On Thursday, 12 May 2016 at 09:17:24 UTC, Chris wrote: They shouldn't be hardwired. Best would be to load them dynamically with their respective names encoded in the xml file. In this way people could add their own themes as they see

Re: DlangIDE Themes

2016-05-12 Thread Chris via Digitalmars-d-learn
On Thursday, 12 May 2016 at 03:01:02 UTC, thedeemon wrote: On Wednesday, 11 May 2016 at 12:55:13 UTC, Chris wrote: Is there a way I can add my own themes? I've created a theme file and added it to views/resources.list However, it doesn't show up. "Default" and "Dark" seem to be hardwired some

Re: static import (v2.071.0)

2016-05-11 Thread Chris via Digitalmars-d-learn
On Wednesday, 11 May 2016 at 14:28:00 UTC, Vladimir Panteleev wrote: On Wednesday, 11 May 2016 at 14:26:37 UTC, Vladimir Panteleev wrote: To elaborate - this doesn't imply that the code of everything in that module will always be placed in the executable. The exact details depend on the imple

Re: static import (v2.071.0)

2016-05-11 Thread Chris via Digitalmars-d-learn
On Wednesday, 11 May 2016 at 14:34:15 UTC, Edwin van Leeuwen wrote: On Wednesday, 11 May 2016 at 14:24:03 UTC, Chris wrote: I was wondering if `static import std.file;` `if (exists(file))` will only import `std.file.exists` or the whole lot of `std.file`? I want to find out what the best str

Re: static import (v2.071.0)

2016-05-11 Thread Chris via Digitalmars-d-learn
On Wednesday, 11 May 2016 at 14:28:00 UTC, Vladimir Panteleev wrote: On Wednesday, 11 May 2016 at 14:26:37 UTC, Vladimir Panteleev wrote: On Wednesday, 11 May 2016 at 14:24:03 UTC, Chris wrote: I was wondering if `static import std.file;` `if (exists(file))` will only import `std.file.exists

Re: static import (v2.071.0)

2016-05-11 Thread Chris via Digitalmars-d-learn
On Wednesday, 11 May 2016 at 14:18:16 UTC, Vladimir Panteleev wrote: On Wednesday, 11 May 2016 at 14:11:46 UTC, Chris wrote: I'm updating my code to 2.071.0 at the moment. Naturally, I get a lot of warnings like `module std.uni is not accessible here, perhaps add 'static import std.uni;'`

static import (v2.071.0)

2016-05-11 Thread Chris via Digitalmars-d-learn
I'm updating my code to 2.071.0 at the moment. Naturally, I get a lot of warnings like `module std.uni is not accessible here, perhaps add 'static import std.uni;'` Will `static import` bloat my exe or simply access the members I use?

DlangIDE Themes

2016-05-11 Thread Chris via Digitalmars-d-learn
Is there a way I can add my own themes? I've created a theme file and added it to views/resources.list However, it doesn't show up. "Default" and "Dark" seem to be hardwired somewhere in the source code.

Re: Linker error for d.o: relocation R_X86_64_32 against `__dmd_personality_v0'

2016-04-22 Thread Chris via Digitalmars-d-learn
On Friday, 22 April 2016 at 09:49:02 UTC, Rene Zwanenburg wrote: On Thursday, 21 April 2016 at 16:29:14 UTC, rcorre wrote: - What happens when you compile a binary without phobos and druntime, and with a custom entry point? I've never done that myself and don't remember how to do that off the t

Re: Linker error for d.o: relocation R_X86_64_32 against `__dmd_personality_v0'

2016-04-21 Thread Chris via Digitalmars-d-learn
On Thursday, 21 April 2016 at 01:20:27 UTC, rcorre wrote: s/compile/link I _can_ compile a D library, but as soon as I try to link anything compiled with DMD it falls over. Sorry, I didn't see the code in your first post. I tried it myself (in only have 2.070.2) and it worked fine. Have y

Re: Linker error for d.o: relocation R_X86_64_32 against `__dmd_personality_v0'

2016-04-20 Thread Chris via Digitalmars-d-learn
On Wednesday, 20 April 2016 at 12:04:45 UTC, rcorre wrote: === $ dmd /tmp/d.d /usr/bin/ld: d.o: relocation R_X86_64_32 against `__dmd_personality_v0' can not be used when making a shared object; recompile with -fPIC d.o: error adding symbols: Bad value collect2: error: ld returned 1 exit statu

Re: DWT Cloning / Build fails

2016-04-15 Thread Chris via Digitalmars-d-learn
On Thursday, 14 April 2016 at 19:16:30 UTC, Jacob Carlborg wrote: On 2016-04-14 15:56, Chris wrote: I had to add ".a" to `-L-l:dwt-base` and `-L-l:org.eclipse.swt.gtk.linux.x86`, and add `-L-lgnomevfs-2` as well. I added `-L-lgnomevfs-2 to the example. I need to look into way the ".a" was n

Re: DWT Cloning / Build fails

2016-04-14 Thread Chris via Digitalmars-d-learn
For the record, on my Linux (Ubuntu 15), I had to tweak the command for the example: dmd main.d -I/imp -J/org.eclipse.swt.gtk.linux.x86/res -L-L/lib \ -L-l:org.eclipse.swt.gtk.linux.x86.a \ -L-l:dwt-base.a -L-lgtk-x11-2.0 -L-lgdk-x11-2.0 -L-latk-1.0 -L-lgdk_pixbuf-2.0 \ -L-lgthread-2.0

Re: DWT Cloning / Build fails

2016-04-14 Thread Chris via Digitalmars-d-learn
On Wednesday, 13 April 2016 at 18:50:22 UTC, Jacob Carlborg wrote: On 2016-04-13 17:23, Jesse Phillips wrote: Looks like your firewall is blocking the git protocol. Checkout dwt without --recursive Modify the .gitmodules file so that https:// urls are used instead of git Run the git submod

Re: Dynamic library

2016-04-13 Thread Chris via Digitalmars-d-learn
On Tuesday, 12 April 2016 at 10:11:27 UTC, Russel Winder wrote: Did you solve this problem? Does it go away using a newer JDK, e.g. 8_77? Have you tried the Oracle or Azul builds? If you have a small project you can send me that exhibits the problem for you, I can take a look at it. I coul

Re: DWT Cloning / Build fails

2016-04-13 Thread Chris via Digitalmars-d-learn
On Tuesday, 12 April 2016 at 19:20:44 UTC, Jacob Carlborg wrote: The error messages are below. If I do it step by step (without --recursive) and then "git submodule update --init", I get more or less the same error: Cloning into 'base'... fatal: unable to connect to github.com: github.com[0:

Re: Dynamic library

2016-04-12 Thread Chris via Digitalmars-d-learn
On Tuesday, 12 April 2016 at 10:11:27 UTC, Russel Winder wrote: On Mon, 2016-04-11 at 14:15 +, Chris via Digitalmars-d-learn wrote: I wanted to test, if I could use D with JNA (Java Native Access). I get this error message: # A fatal error has been detected by the Java Runtime

Re: djvm fails to build

2016-04-12 Thread Chris via Digitalmars-d-learn
On Tuesday, 12 April 2016 at 15:54:10 UTC, rikki cattermole wrote: I'll look into it tomorrow, but I suspect I'm gonna need to do some serious work to get it work with the new import rules. Also maybe best to take this to gitter[0] or github issue so that I get an alert. [0] https://gitter.i

DWT Cloning / Build fails

2016-04-12 Thread Chris via Digitalmars-d-learn
This doesn't work: $ git clone --recursive git://github.com/d-widget-toolkit/dwt.git $ git clone --recursive https://github.com/d-widget-toolkit/dwt.git (cf. https://github.com/d-widget-toolkit/dwt) If I just download the master or clone without `--recursive`, files are missing and I cannot

djvm fails to build

2016-04-12 Thread Chris via Digitalmars-d-learn
@Rikki I can't get djvm to build (dmd 2.069.1 and higher) https://github.com/rikkimax/djvm [Error Message] Performing "debug" build using dmd for x86_64. djvm ~master: building configuration "library"... String (Constructor!string, Constructor!(), Method!(char, "charAt", int), Method!(string,

Re: Dynamic library

2016-04-11 Thread Chris via Digitalmars-d-learn
I wanted to test, if I could use D with JNA (Java Native Access). I get this error message: # A fatal error has been detected by the Java Runtime Environment: # # SIGSEGV (0xb) at pc=0x7fd24ab66074, pid=15733, tid=140541714827008 # # JRE version: OpenJDK Runtime Environment (8.0_66-b17) (

Re: Dynamic library

2016-04-11 Thread Chris via Digitalmars-d-learn
On Monday, 11 April 2016 at 13:45:42 UTC, Adam D. Ruppe wrote: On Monday, 11 April 2016 at 13:40:14 UTC, Chris wrote: For the record, I fixed it by changing the contents of libphobos2.so from How did you do that btw? The file there should really just be a link to some binary file, maybe it go

Re: Dynamic library

2016-04-11 Thread Chris via Digitalmars-d-learn
On Monday, 11 April 2016 at 11:42:22 UTC, Chris wrote: I followed these steps: https://dlang.org/dll-linux.html#dso7 What I get is this error: libphobos2.so: file format not recognized; treating as linker script I don't know why it is not recognized. Any ideas? For the record, I fixed it

Dynamic library

2016-04-11 Thread Chris via Digitalmars-d-learn
I followed these steps: https://dlang.org/dll-linux.html#dso7 What I get is this error: libphobos2.so: file format not recognized; treating as linker script I don't know why it is not recognized. Any ideas?

Re: C.h to D conversion (structs)

2016-03-15 Thread Chris via Digitalmars-d-learn
On Tuesday, 15 March 2016 at 18:47:22 UTC, Adam D. Ruppe wrote: Like you would another D library. Now I get it! Yes, that works as expected. The problem isn't the struct itself, but the D initializer. Structs in C don't have initalizers but do in D: struct Foo { int a = 10; /* illegal

Re: C.h to D conversion (structs)

2016-03-15 Thread Chris via Digitalmars-d-learn
On Tuesday, 15 March 2016 at 17:10:03 UTC, Adam D. Ruppe wrote: On Tuesday, 15 March 2016 at 16:56:00 UTC, Chris wrote: Do you mean I need to void initialize them in the C code or in D? And if in D, how would I do that, with `static this`? in D, at the usage point with =void where you declare

Re: C.h to D conversion (structs)

2016-03-15 Thread Chris via Digitalmars-d-learn
On Tuesday, 15 March 2016 at 16:44:10 UTC, Adam D. Ruppe wrote: On Tuesday, 15 March 2016 at 16:32:56 UTC, Chris wrote: The error I get is something like undefined reference to `_D3test7testmodule13A6__initZ' undefined reference to `_D3test7testmodule13B6__initZ' You still need to compile/li

C.h to D conversion (structs)

2016-03-15 Thread Chris via Digitalmars-d-learn
I've converted a C.h file to D according to this guide: http://wiki.dlang.org/Converting_C_.h_Files_to_D_Modules and examples in deimos: https://github.com/D-Programming-Deimos/ However, I get an error when trying to use a struct that uses structs. struct A { size_t i; } struct B { siz

Re: Assoc Array for Concurrency

2016-03-02 Thread Chris via Digitalmars-d-learn
On Monday, 29 February 2016 at 17:38:11 UTC, ZombineDev wrote: On Monday, 29 February 2016 at 12:43:39 UTC, Chris wrote: [...] I'm almost sure that built-in AAs don't provide automatic synchronization (in my tests I hit a deadlock), but you can easily wrap the AA into a struct that does the

Assoc Array for Concurrency

2016-02-29 Thread Chris via Digitalmars-d-learn
What's the best way to make an assoc array fit for multi-threading? If this is not possible what would be the best alternative? Say, for example, `data` is used by a class that is globally accessible to all threads. E.g. like this: string[string] data; // defined somewhere public string ge

Re: What's wrong with my debugger?

2015-12-24 Thread Chris via Digitalmars-d-learn
On Thursday, 24 December 2015 at 09:30:24 UTC, Rainer Schuetze wrote: In the locals window, mago displays all instances of variables, but with the same value (which might be some uninitialized value of a different declaration than expected). The Visual Studio debug engine shows different values

What's wrong with my debugger?

2015-12-23 Thread Chris via Digitalmars-d-learn
Please see the linked screenshot: http://i.imgur.com/SpkXu5m.png As you can see, the inside, outside and collision arrays don't seem to work with the debugger. They show a bogus lenght and a bogus memory address. Extracting the lenghts to separate variables outl, insl and coll show that the ar

Re: Invalid foreach aggregate

2015-11-17 Thread Chris via Digitalmars-d-learn
On Tuesday, 17 November 2015 at 13:49:58 UTC, Marc Schütz wrote: On Tuesday, 17 November 2015 at 12:41:45 UTC, Chris wrote: On Tuesday, 17 November 2015 at 12:22:22 UTC, Marc Schütz wrote: In any case, I'd suggest you fix your opIndex(), except if there's a really good reason it is as it is.

Re: Invalid foreach aggregate

2015-11-17 Thread Chris via Digitalmars-d-learn
On Tuesday, 17 November 2015 at 12:22:22 UTC, Marc Schütz wrote: Ok, that's a strange implementation of opIndex(). Usually, a parameter-less opIndex() is supposed to return a slice into the full range, but yours returns a size_t, which of course can't be iterated over. The change that made

Re: Invalid foreach aggregate

2015-11-17 Thread Chris via Digitalmars-d-learn
On Tuesday, 17 November 2015 at 11:58:22 UTC, Chris wrote: Sorry that should be: @property void popFront() { r = r[1..$]; cnt++; }

Re: Invalid foreach aggregate

2015-11-17 Thread Chris via Digitalmars-d-learn
On Tuesday, 17 November 2015 at 11:26:19 UTC, Marc Schütz wrote: That really depends on the details, that's why I asked. It could be a regression, or it could be that the compiler now does stricter checking than before, and your implementation wasn't completely correct, or it could be a bug

Re: Invalid foreach aggregate

2015-11-17 Thread Chris via Digitalmars-d-learn
I've checked several options now and it doesn't work. Here (http://dlang.org/statement.html#foreach-with-ranges) it is stated that it suffices to have range primitives, if opApply doesn't exist. My code worked up to 2.068.0, with the introduction of 2.068.1 it failed. I wonder why that is. I

Re: Invalid foreach aggregate

2015-11-16 Thread Chris via Digitalmars-d-learn
On Monday, 16 November 2015 at 17:57:53 UTC, opla wrote: On Monday, 16 November 2015 at 16:55:29 UTC, Chris wrote: On Monday, 16 November 2015 at 16:49:19 UTC, Marc Schütz wrote: On Monday, 16 November 2015 at 16:44:27 UTC, Chris wrote: Updating my code from 2.067.1 to 2.069.1 (I skipped 2.068,

Re: Invalid foreach aggregate

2015-11-16 Thread Chris via Digitalmars-d-learn
On Monday, 16 November 2015 at 16:49:19 UTC, Marc Schütz wrote: On Monday, 16 November 2015 at 16:44:27 UTC, Chris wrote: Updating my code from 2.067.1 to 2.069.1 (I skipped 2.068, because I was too busy). I get this error: invalid foreach aggregate, define opApply(), range primitives, or us

Invalid foreach aggregate

2015-11-16 Thread Chris via Digitalmars-d-learn
Updating my code from 2.067.1 to 2.069.1 (I skipped 2.068, because I was too busy). I get this error: invalid foreach aggregate, define opApply(), range primitives, or use .tupleof for code like foreach (ref it; myArray.doSomething) {} Probably not the best idea anyway. What's the best fix

Re: bearophile is back! :) was: Re: conver BigInt to string

2015-11-05 Thread Chris via Digitalmars-d-learn
On Thursday, 5 November 2015 at 19:38:23 UTC, Ali Çehreli wrote: Good one! ;) I'm really happy that he is still around. Ali So am I! The more, the merrier!

Re: bearophile is back! :) was: Re: conver BigInt to string

2015-11-05 Thread Chris via Digitalmars-d-learn
On Thursday, 5 November 2015 at 19:30:02 UTC, Ali Çehreli wrote: On 11/05/2015 09:40 AM, bearophile wrote: Bye, bearophile Were you immersed in another language? Rust? Ali His D doesn't seem to be Rusty though!

Re: good reasons not to use D?

2015-11-03 Thread Chris via Digitalmars-d-learn
On Friday, 30 October 2015 at 10:35:03 UTC, Laeeth Isharc wrote: Interesting. Two points suggest that you should use D only for serious programming: "cases where you want to write quick one-off scripts that need to use a bunch of different libraries not yet available in D and where it doesn'

Re: LuaD: creating a flexible data filter system

2015-10-17 Thread Chris via Digitalmars-d-learn
On Saturday, 17 October 2015 at 02:02:16 UTC, Jakob Ovrum wrote: On Friday, 16 October 2015 at 10:45:52 UTC, Chris wrote: Later you call the function with the Lua C API like "lua_pcall(L, 0, 1, 0);". It's a bit tricky to move things around on the Lua stack, but you'll get there! ;) Or you cou

Re: LuaD: creating a flexible data filter system

2015-10-16 Thread Chris via Digitalmars-d-learn
On Friday, 16 October 2015 at 09:01:57 UTC, yawniek wrote: hi, i'm reading in a stream of data that is deserialized into individual frames. a frame is either of: a) a specific D datastructure ( struct with a few ulong,string,string[string] etc members), known at compile time b) json (prefer

Re: OT: why do people use python when it is slow?

2015-10-15 Thread Chris via Digitalmars-d-learn
On Thursday, 15 October 2015 at 09:47:56 UTC, Ola Fosheim Grøstad wrote: On Thursday, 15 October 2015 at 09:24:52 UTC, Chris wrote: Yep. This occurred to me too. Sorry Ola, but I think you don't know how sausages are made. I most certainly do. I am both doing backend programming and we have a

Re: OT: why do people use python when it is slow?

2015-10-15 Thread Chris via Digitalmars-d-learn
On Wednesday, 14 October 2015 at 18:17:29 UTC, Russel Winder wrote: The thing about Python is NumPy, SciPy, Pandas, Matplotlib, IPython, Jupyter, GNU Radio. The data science, bioinformatics, quant, signal provessing, etc. people do not give a sh!t which language they used, what they want is

Re: OT: why do people use python when it is slow?

2015-10-15 Thread Chris via Digitalmars-d-learn
On Wednesday, 14 October 2015 at 18:37:40 UTC, Mengu wrote: On Wednesday, 14 October 2015 at 05:42:12 UTC, Ola Fosheim Grøstad wrote: On Tuesday, 13 October 2015 at 23:26:14 UTC, Laeeth Isharc wrote: https://www.quora.com/Why-is-Python-so-popular-despite-being-so-slow Andrei suggested posting m

Re: Linker error with dmd

2015-10-06 Thread Chris via Digitalmars-d-learn
On Friday, 2 October 2015 at 14:03:08 UTC, John Colvin wrote: On Friday, 2 October 2015 at 09:43:54 UTC, Chris wrote: Why do I get this error msg with dmd 2.067.1 and 2.068.0 in release mode: $ dub --build=release (.data._D65TypeInfo_xC3std5range10interfaces18__T10InputRangeTiZ10InputRange6__

  1   2   3   >