Re: Packaging and Distributing Dlang Applications with GtkD Dependency?

2019-09-28 Thread bachmeier via Digitalmars-d-learn
On Saturday, 28 September 2019 at 09:00:51 UTC, drug wrote: 28.09.2019 5:15, Hossain Adnan пишет: On Wednesday, 25 September 2019 at 11:46:04 UTC, Ron Tarrant wrote: Hi y'all, I've been Googling how to do this, but coming up with nothing definitive. Are there any articles for how to do this f

Re: Howto create bindings?

2019-09-28 Thread bachmeier via Digitalmars-d-learn
On Saturday, 28 September 2019 at 09:18:24 UTC, Martin Brezeln wrote: Hello everyone, i have a rather general question about how to approach the attempt to create a binding for a foreign system, for which bindings already exists for other languages than dlang. To be more concrete: There is t

Re: Learning delegates

2019-09-09 Thread bachmeier via Digitalmars-d-learn
On Sunday, 8 September 2019 at 10:04:57 UTC, Joel wrote: I'm trying to understand delegates. Is there any good ways I can get a better understanding of them? I think this chapter should give you some useful information: http://www.ddili.org/ders/d.en/lambda.html

Re: Is there has an pdf document for Phobos.

2019-09-04 Thread bachmeier via Digitalmars-d-learn
On Wednesday, 4 September 2019 at 12:24:47 UTC, lili wrote: On Wednesday, 4 September 2019 at 04:21:10 UTC, Mike Parker wrote: On Wednesday, 4 September 2019 at 03:07:18 UTC, lili wrote: Hi: For some reason it too slow that some times i visited dlang.org, Can admin make a pdf document for d

Re: Sort Associative Array by Key

2019-08-27 Thread bachmeier via Digitalmars-d-learn
On Tuesday, 27 August 2019 at 20:14:21 UTC, Machine Code wrote: It isn't really hard: It really is hard. foo.byPair.array.sort!((a, b) => a.key < b.key).map!(a => a.value); is a lot to digest for someone learning the language. There's a big difference between not being hard for someone that

Re: How should I sort a doubly linked list the D way?

2019-08-13 Thread bachmeier via Digitalmars-d-learn
On Tuesday, 13 August 2019 at 09:48:52 UTC, Mirjam Akkersdijk wrote: I would write my compare function and let qsort sort it out. I'm confused by this statement. Are you referring to the qsort in C's stdlib? I had never heard of using that to sort a linked list, so I searched, and it is not

Re: Help me decide D or C

2019-08-02 Thread bachmeier via Digitalmars-d-learn
On Thursday, 1 August 2019 at 22:36:06 UTC, Russel Winder wrote: On Thu, 2019-08-01 at 14:49 +, bachmeier via Digitalmars-d-learn wrote: […] There's nothing wrong with Haskell if you want to take a deep dive into pure functional programming. I personally find Haskell to be more

Re: Help me decide D or C

2019-08-02 Thread bachmeier via Digitalmars-d-learn
On Friday, 2 August 2019 at 13:57:44 UTC, Bastiaan Veelo wrote: On Thursday, 1 August 2019 at 20:02:08 UTC, Aurélien Plazzotta wrote: [...] But don't fool yourself, D is not for beginners. Ali Çehreli is a very skilled programmer, ergo, he can't reason like a new/starting programmer anymore, r

Re: Help me decide D or C

2019-08-01 Thread bachmeier via Digitalmars-d-learn
On Thursday, 1 August 2019 at 03:59:23 UTC, Bert wrote: But if you really want to learn to program I suggest you go with Haskell. You can do them all together too but Haskell is like learning Alien while D is learning German. There's nothing wrong with Haskell if you want to take a deep dive

Re: Help me decide D or C

2019-08-01 Thread bachmeier via Digitalmars-d-learn
On Wednesday, 31 July 2019 at 23:42:10 UTC, SashaGreat wrote: About Mike's book, you're talking about this one: https://www.amazon.com/Learning-D-Michael-Parker/dp/1783552484/ref=as_li_ss_tl?ie=UTF8&qid=1448974911&sr=8-1&keywords=learning+d&linkCode=sl1&tag=aldacron-20&linkId=d696b771c78030fc27

Re: Help me decide D or C

2019-07-31 Thread bachmeier via Digitalmars-d-learn
On Wednesday, 31 July 2019 at 22:49:10 UTC, SashaGreat wrote: On Wednesday, 31 July 2019 at 22:16:42 UTC, bachmeier wrote: What is your goal? In my opinion, learning C is a waste of time in 2019 unless you have something specific in mind related to a job. C is mostly "fun with segmentation faul

Re: Help me decide D or C

2019-07-31 Thread bachmeier via Digitalmars-d-learn
On Wednesday, 31 July 2019 at 18:38:02 UTC, Alexandre wrote: Hi everyone, I would like an honest opinion. I have a beginner level (able to do very small programs) in a few languages such as python, go, C, guile(scheme) and common lisp. I want to pick a language and go deep with it and focus

Re: How to setup D language with Apache httpd cgi?

2019-07-31 Thread bachmeier via Digitalmars-d-learn
On Wednesday, 31 July 2019 at 07:19:12 UTC, BoQsc wrote: There are some other bad news, I switched from rdmd to dub package manager since I need a package from Adam D. Ruppe. It is all good and well: this one works perfectly. #!/usr/bin/env dub /+ dub.sdl: name "hello" +/ impo

Re: How to contact people on the forum

2019-07-24 Thread bachmeier via Digitalmars-d-learn
On Wednesday, 24 July 2019 at 16:37:33 UTC, Greatsam4sure wrote: On Wednesday, 24 July 2019 at 15:56:43 UTC, drug wrote: 24.07.2019 18:51, Greatsam4sure пишет: Good day everyone. I am thinking,  if there is a  way to contact any person on dlang forums through mail or any other means. How do I

Re: Any full feature xml library available?

2019-05-01 Thread bachmeier via Digitalmars-d-learn
On Wednesday, 1 May 2019 at 13:54:08 UTC, Domain wrote: I need a xml library which support document entity or xinclude. The xml may like this: ]> http://www.w3.org/2001/XInclude";> &data; Have you looked at this? https://github.com/jmdavis/dxml

Re: Copyright for reworked Phobos code in Mir

2018-12-26 Thread bachmeier via Digitalmars-d-learn
On Wednesday, 26 December 2018 at 15:40:13 UTC, 9il wrote: std.numeric contains: Copyright: Copyright Andrei Alexandrescu 2008 - 2009. What copyright should contain mir.numeric? Disclaimer: I'm also not a lawyer. At least in the US, what matters is not the copyright but the license. You aut

Re: Doubt about this book: The D Programming Language

2018-12-16 Thread bachmeier via Digitalmars-d-learn
On Sunday, 16 December 2018 at 18:37:15 UTC, Marko wrote: On Amazon The D Programming Language has good reviews but it's 8 years old. So is this book still relevant today? Would you recommend another book? PS: I am already a programmer writing mainly in C and C#. Thanks, Marko. I can recom

Re: How do I install a library?

2018-11-11 Thread bachmeier via Digitalmars-d-learn
On Friday, 9 November 2018 at 17:38:18 UTC, Adam D. Ruppe wrote: But my libs are :P I'm aware. That's why I use your libraries but Dub not so much.

Re: How do I install a library?

2018-11-08 Thread bachmeier via Digitalmars-d-learn
On Friday, 9 November 2018 at 00:18:28 UTC, H. S. Teoh wrote: It's not true that you're stuck with dub. And I'm not among the people who think dub is the way to go (though it's true that that's a minority opinion around here). Where I have a choice, my own D projects do not use dub. I have

Re: How do I install a library?

2018-11-08 Thread bachmeier via Digitalmars-d-learn
On Thursday, 8 November 2018 at 23:43:38 UTC, Murilo wrote: It finally worked, but I can't just compile it normally, I have to use dub run, I wish it were something simple that I just download into the folder and then use an import statement and then compile it like any other program. I wish i

Re: module `socket` is in file 'std/c/linux/socket.d' which cannot be read

2018-08-03 Thread bachmeier via Digitalmars-d-learn
On Friday, 3 August 2018 at 17:09:37 UTC, Adam D. Ruppe wrote: On Friday, 3 August 2018 at 16:51:37 UTC, bachmeier wrote: I'm running Ubuntu 16.04. OK, I see it now, I had another .di file on my system than the stock one. Pushed a new version to git, it needs to also import a second module

Re: module `socket` is in file 'std/c/linux/socket.d' which cannot be read

2018-08-03 Thread bachmeier via Digitalmars-d-learn
On Friday, 3 August 2018 at 16:47:42 UTC, Adam D. Ruppe wrote: On Friday, 3 August 2018 at 16:41:09 UTC, bachmeier wrote: 2.081.1 huh, it works for me... you on Linux or some other system? The embedded_httpd_processes version is Linux specific, on other OSes it uses threads... I'm running

Re: module `socket` is in file 'std/c/linux/socket.d' which cannot be read

2018-08-03 Thread bachmeier via Digitalmars-d-learn
On Friday, 3 August 2018 at 16:19:15 UTC, Adam D. Ruppe wrote: On Friday, 3 August 2018 at 16:13:06 UTC, bachmeier wrote: Swapping the comment and changing to master both fix the original error, but then I get ugh, what dmd version you on? 2.081.1 I find it hard to not have all my computers

Re: module `socket` is in file 'std/c/linux/socket.d' which cannot be read

2018-08-03 Thread bachmeier via Digitalmars-d-learn
On Friday, 3 August 2018 at 15:42:53 UTC, Adam D. Ruppe wrote: On Friday, 3 August 2018 at 15:33:57 UTC, bachmeier wrote: Any suggestions? The line right next to it, commented, is the solution. Try grabbing the new one from git master, or swap the comment yourself. Older dmd versions used

module `socket` is in file 'std/c/linux/socket.d' which cannot be read

2018-08-03 Thread bachmeier via Digitalmars-d-learn
I'm trying to use Adam's cgi.d. I'm trying to compile previously working code, but I get the following error: cgi.d(2711): Error: module `socket` is in file 'std/c/linux/socket.d' which cannot be read import path[0] = /usr/include/dmd/phobos import path[1] = /usr/include/dmd/druntime/import A

Re: Is it feasible to slowly rewrite a C++ codebase in D?

2018-07-20 Thread bachmeier via Digitalmars-d-learn
On Wednesday, 20 June 2018 at 18:47:10 UTC, Jordi Gutiérrez Hermoso wrote: Another possibility might be in dlopen'able functions. Currently Octave uses so-called oct functions, which are nothing more than C++ object code that is dynamically loaded by the interpreter at runtime. They are compi

Re: Trying to use the libclang Dub package

2018-07-20 Thread bachmeier via Digitalmars-d-learn
On Friday, 20 July 2018 at 10:31:44 UTC, Laurent Tréguier wrote: On Thursday, 19 July 2018 at 15:42:02 UTC, bachmeier wrote: Found the problem. The libclang package is looking for /usr/lib/llvm-3.9/lib/libclang.so. For some reason, Ubuntu has libclang.so.1. Creating a symlink in that directory

Re: Trying to use the libclang Dub package

2018-07-19 Thread bachmeier via Digitalmars-d-learn
On Thursday, 19 July 2018 at 14:21:51 UTC, bachmeier wrote: [...] .dub/build/unittest-unittest-linux.posix-x86_64-dmd_2081-A8A607969A46E4CDF45479E7A30874E9/ut.o: In function `_D5parse3raw17__unittest_L64_C9FZ12__dgliteral1MFNaNbNiNfZk': /home/office/.dub/packages/libclang-0.0.6/libclang/tests/

Trying to use the libclang Dub package

2018-07-19 Thread bachmeier via Digitalmars-d-learn
I haven't been able to get dpp to build. I've discovered that the problem is with libclang. It installs, but when running the tests, I get the lengthy message below. Obviously I need to install something (running Ubuntu 16.04) but I've got numerous libclang related packages installed already an

Re: Is it feasible to slowly rewrite a C++ codebase in D?

2018-07-18 Thread bachmeier via Digitalmars-d-learn
On Tuesday, 17 July 2018 at 22:10:52 UTC, jmh530 wrote: On Tuesday, 17 July 2018 at 16:39:48 UTC, bachmeier wrote: On Tuesday, 17 July 2018 at 15:55:03 UTC, bachmeier wrote: On Tuesday, 17 July 2018 at 06:57:37 UTC, drug wrote: [...] I'm going to create an issue on Github. This is the output

Re: Is it feasible to slowly rewrite a C++ codebase in D?

2018-07-17 Thread bachmeier via Digitalmars-d-learn
On Tuesday, 17 July 2018 at 15:55:03 UTC, bachmeier wrote: On Tuesday, 17 July 2018 at 06:57:37 UTC, drug wrote: [...] I'm going to create an issue on Github. This is the output I get: [...] I solved that problem but now I have others. dpp is a good thing on paper but maybe not yet in pr

Re: Is it feasible to slowly rewrite a C++ codebase in D?

2018-07-17 Thread bachmeier via Digitalmars-d-learn
On Tuesday, 17 July 2018 at 06:57:37 UTC, drug wrote: I just build it using dub then do something like that(from memory): `d++ some_c_header.h --include-path path/to/other/c/header/files --keep-d-files` and it generates d file for the corresponding c header. Although dpp is intended to be used

Re: Is it feasible to slowly rewrite a C++ codebase in D?

2018-07-16 Thread bachmeier via Digitalmars-d-learn
On Friday, 13 July 2018 at 19:53:45 UTC, Laeeth Isharc wrote: On Wednesday, 20 June 2018 at 18:47:10 UTC, Jordi Gutiérrez Hermoso wrote: What are your ideas? If you would like to expose C function and type declarations to D, you could take a look at DPP, which allows you to just #include a

Re: Is it feasible to slowly rewrite a C++ codebase in D?

2018-06-20 Thread bachmeier via Digitalmars-d-learn
On Wednesday, 20 June 2018 at 18:47:10 UTC, Jordi Gutiérrez Hermoso wrote: I'm specifically thinking of the GNU Octave codebase: http://hg.savannah.gnu.org/hgweb/octave/file/@ It's a fairly old and complicated C++ codebase. I would like to see if I could slowly introduce some D in it, anywhere

Re: Is it feasible to slowly rewrite a C++ codebase in D?

2018-06-20 Thread bachmeier via Digitalmars-d-learn
On Wednesday, 20 June 2018 at 18:47:10 UTC, Jordi Gutiérrez Hermoso wrote: I'm specifically thinking of the GNU Octave codebase: http://hg.savannah.gnu.org/hgweb/octave/file/@ It's a fairly old and complicated C++ codebase. I would like to see if I could slowly introduce some D in it, anywhere

Re: Line breaks in JSON

2018-05-10 Thread bachmeier via Digitalmars-d-learn
On Thursday, 10 May 2018 at 17:59:26 UTC, jmh530 wrote: On Thursday, 10 May 2018 at 15:01:57 UTC, rikki cattermole wrote: [snip] You'll need to unescape them (which is pretty easy, a simple replacement here). For reference, this is invalid json[0]: ``` { "1 2 3 " } `

Re: Line breaks in JSON

2018-05-10 Thread bachmeier via Digitalmars-d-learn
On Thursday, 10 May 2018 at 15:01:57 UTC, rikki cattermole wrote: You'll need to unescape them (which is pretty easy, a simple replacement here). For reference, this is invalid json[0]: ``` { "1 2 3 " } ``` [0] https://jsonlint.com/ So I see the answer is that I don

Line breaks in JSON

2018-05-10 Thread bachmeier via Digitalmars-d-learn
I'm using std.json for the first time. I want to download the contents of a markdown file from a web server. When I do that, the line breaks are escaped, which I don't want. Here's an example: import std.conv, std.json, std.stdio; void main() { string data = "This is a paragraph with

Re: "Start a Minimal web server" example do not work.

2018-05-08 Thread bachmeier via Digitalmars-d-learn
On Tuesday, 8 May 2018 at 12:13:56 UTC, BoQsc wrote: This is the code example, that was presented on the https://dlang.org frontpage: Maybe that isn't the best choice of beginner example if even the D experts can't figure out how to get it to run.

Re: Parse .eml files

2018-04-11 Thread bachmeier via Digitalmars-d-learn
On Wednesday, 11 April 2018 at 15:20:08 UTC, Martin Tschierschke wrote: My question in the moment is, how do I invoke Thunderbird to display a certain single mail (or maildir) file? How do I use Thunderbird as the client, to show, to answer or to forward these mails. An alternative would be to

Re: Parse .eml files

2018-04-10 Thread bachmeier via Digitalmars-d-learn
On Monday, 9 April 2018 at 19:17:20 UTC, Adam D. Ruppe wrote: [...] I had a chance to try this out and it worked without a problem. I did have to download color.d in addition to the other dependencies you listed. In the event that Google brings someone here, this is a complete working program

Re: Parse .eml files

2018-04-09 Thread bachmeier via Digitalmars-d-learn
On Monday, 9 April 2018 at 19:17:20 UTC, Adam D. Ruppe wrote: My understanding is .eml is the same MIME format the email itself and mbox and maildir all use. Thanks. I didn't know that. I will try it using email.d.

Parse .eml files

2018-04-09 Thread bachmeier via Digitalmars-d-learn
I want to save all email messages related to a research project into a directory, call a D program to generate an index of all messages, and push it to the repo server. That way all coauthors have access to all email messages even if they joined a project after several years. My client is Thund

Re: complex arithmetic in D: multiple questions

2018-03-09 Thread bachmeier via Digitalmars-d-learn
On Friday, 9 March 2018 at 14:41:47 UTC, J-S Caux wrote: Going further, I'm really wondering what the plan is as far as Complex is concerned. Right now it just feels neglected (half-done/aborted transition from creal etc to Complex, lots of missing basic functions etc), and is one major blocki

Re: Speed of math function atan: comparison D and C++

2018-03-05 Thread bachmeier via Digitalmars-d-learn
On Monday, 5 March 2018 at 20:11:06 UTC, H. S. Teoh wrote: Walter has been adamant that we should always compute std.math.* functions with the `real` type, which on x86 maps to the non-IEEE 80-bit floats. However, 80-bit floats have been deprecated for a while now, and pretty much nobody care

Can someone help a Reddit user

2018-02-20 Thread bachmeier via Digitalmars-d-learn
Someone has posted a question on our subreddit. Would be nice if he could get an answer: https://www.reddit.com/r/d_language/comments/7yxwvm/why_do_my_threads_write_to_the_wrong_file/

Re: It makes me sick!

2017-07-28 Thread bachmeier via Digitalmars-d-learn
On Friday, 28 July 2017 at 12:48:37 UTC, Grander wrote: On Friday, 28 July 2017 at 12:40:27 UTC, rjframe wrote: On Fri, 28 Jul 2017 05:14:16 +, FoxyBrown wrote: You can make any claim you want like: "The end user should install in to a clean dir so that DMD doesn't get confused and load

Re: Remove instance from array

2017-07-05 Thread bachmeier via Digitalmars-d-learn
On Wednesday, 5 July 2017 at 16:04:16 UTC, Jolly James wrote: Here in D everything looks like climbing mount everest. When you ask how to use D's containers you are recommended to use dynamic arrays instead. When you look at the docs for std.algorithm, e.g. the .remove section, you get bombed

Re: Linking external *.lib files

2017-06-21 Thread bachmeier via Digitalmars-d-learn
On Wednesday, 21 June 2017 at 13:07:31 UTC, Jolly James wrote: *push* Have you asked on the Dub forum? http://forum.rejectedsoftware.com/groups/rejectedsoftware.dub/

Re: [Solved] Confusing error message

2017-06-07 Thread bachmeier via Digitalmars-d-learn
On Wednesday, 7 June 2017 at 21:13:37 UTC, H. S. Teoh wrote: On Wed, Jun 07, 2017 at 11:16:14PM +0300, drug via Digitalmars-d-learn wrote: 07.06.2017 22:40, bachmeier пишет: [...] > In any event, I made a second suggestion that would always > work. If it can't find a match, it asks if you're m

Re: [Solved] Confusing error message

2017-06-07 Thread bachmeier via Digitalmars-d-learn
On Wednesday, 7 June 2017 at 19:02:59 UTC, drug wrote: How do compiler know that you want use `std.conv.to` instead of _already imported_ `core.time.to`? In general it's impossible. There is no way for compiler to guess that you want some other symbol from out there. What if you've imported `s

Re: [Solved] Confusing error message

2017-06-07 Thread bachmeier via Digitalmars-d-learn
On Wednesday, 7 June 2017 at 14:58:26 UTC, drug wrote: 07.06.2017 16:27, Wulfklaue пишет: Some of the dmd error messages need some tweaking. import std.datetime; auto t = Clock.currStdTime; writeln(to!string(t)); Result in: Error: template core.time.to cannot deduce function from argument

Re: [Solved] Confusing error message

2017-06-07 Thread bachmeier via Digitalmars-d-learn
On Wednesday, 7 June 2017 at 13:27:05 UTC, Wulfklaue wrote: Some of the dmd error messages need some tweaking. import std.datetime; auto t = Clock.currStdTime; writeln(to!string(t)); Result in: Error: template core.time.to cannot deduce function from argument types !(string)(long), candida

Re: site examples

2017-05-25 Thread bachmeier via Digitalmars-d-learn
On Thursday, 25 May 2017 at 15:41:47 UTC, crimaniak wrote: I tried to run an example from the site. Example from https://dlang.org/phobos/std_regex.html#replaceAllInto section. And this is problem number 0: I can't give a link to the example, only to section. The section can be long, there can

Re: Which editor to use for editing DDOCs?

2017-05-23 Thread bachmeier via Digitalmars-d-learn
On Tuesday, 23 May 2017 at 07:40:21 UTC, biocyberman wrote: Adding DDOC support for D Mode require some more work obviously. I will see if I can make some changes to that. For the time being, I would like to know which editors people are using. Or is it a plain black and white editor ? I use

Re: No tempFile() in std.file

2017-05-16 Thread bachmeier via Digitalmars-d-learn
On Tuesday, 16 May 2017 at 13:56:57 UTC, Jonathan M Davis wrote: std.file doesn't have anything to do with File. It only operates on entire files at a time, so it wouldn't make sense for a function in std.file to return a std.stdio.File. At most what would make sense to me would be to have a f

Re: No tempFile() in std.file

2017-05-16 Thread bachmeier via Digitalmars-d-learn
On Monday, 15 May 2017 at 22:38:15 UTC, Jonathan M Davis wrote: I suppose that we could add a tempFile that did what std.stdio.File.scratchFile did but create an empty file and return its path rather than returning a File, though that would be a bit annoying, since you'd then have to open it to

Re: Error writing file a *.obj

2017-05-09 Thread bachmeier via Digitalmars-d-learn
On Tuesday, 9 May 2017 at 02:33:06 UTC, dummy wrote: On Monday, 8 May 2017 at 12:29:27 UTC, bachmeier wrote: On Monday, 8 May 2017 at 11:56:10 UTC, dummy wrote: When i build some application with dub, i got this error: I'm not a Dub user, but it has its own forum, so you might want to try t

Re: Error writing file a *.obj

2017-05-08 Thread bachmeier via Digitalmars-d-learn
On Monday, 8 May 2017 at 11:56:10 UTC, dummy wrote: When i build some application with dub, i got this error: I'm not a Dub user, but it has its own forum, so you might want to try there: http://forum.rejectedsoftware.com/

Re: Looking for an equivalent to C++ std::getline in D

2017-05-07 Thread bachmeier via Digitalmars-d-learn
On Sunday, 7 May 2017 at 10:33:25 UTC, k-five wrote: Although I found D for being more better, nicer,and fun than C++ is, but there is a few questions on Stack-Over-Flow, videos on Youtube, and some other forums in my country. So, why D is not popular? If by popular you mean C++ or Java lev

Re: Porting Java code to D that uses << and >>> operators

2017-05-01 Thread bachmeier via Digitalmars-d-learn
On Monday, 1 May 2017 at 18:16:48 UTC, Era Scarecrow wrote: On Monday, 1 May 2017 at 15:53:41 UTC, Basile B. wrote: It's the same code in D. It extracts consecutive bits in x12 and x13 (and maskxx), put them at the beginning (right shift) and add them. Reminds me... was the unsigned shift >>

Re: Porting Java code to D that uses << and >>> operators

2017-05-01 Thread bachmeier via Digitalmars-d-learn
On Monday, 1 May 2017 at 19:06:36 UTC, Jacob Carlborg wrote: Not sure if this is still the case. But this [1] suggests that D doesn't have an evaluation order defined but Java does. [1] http://dsource.org/projects/dwt/wiki/Porting#Evaluationorder That's good to know but shouldn't be an issue

Re: Porting Java code to D that uses << and >>> operators

2017-05-01 Thread bachmeier via Digitalmars-d-learn
On Monday, 1 May 2017 at 15:53:41 UTC, Basile B. wrote: It's the same code in D. It extracts consecutive bits in x12 and x13 (and maskxx), put them at the beginning (right shift) and add them. Thanks.

Porting Java code to D that uses << and >>> operators

2017-05-01 Thread bachmeier via Digitalmars-d-learn
I'm porting a small piece of Java code into D, but I've run into this: int y1 = ((x12 & MASK12) << 22) + (x12 >>> 9) + ((x13 & MASK13) << 7) + (x13 >>> 24); I have a basic understanding of those operators in both languages, but I can't find a sufficiently detailed explanation to tell me how

Re: Persistent key-value-store for D?

2017-04-26 Thread bachmeier via Digitalmars-d-learn
On Wednesday, 26 April 2017 at 17:06:52 UTC, krylon wrote: If I understand what I have read so far correctly, it is possible to access libraries written in C or C++ from D - in that case, I could just use Tokyocabinet directly, but I have not found any pointers on how to do this. Is this a fea

Re: GNU Guile D language interop

2017-04-11 Thread bachmeier via Digitalmars-d-learn
On Monday, 10 April 2017 at 05:15:50 UTC, new2d wrote: Think you can share the code? I cannot find it at the moment. If I come upon it, I will post a link here. I remember now that Guile is less friendly than other Schemes, so I created a C library to handle the data passing between Guile an

Re: GNU Guile D language interop

2017-04-08 Thread bachmeier via Digitalmars-d-learn
On Saturday, 8 April 2017 at 21:29:58 UTC, new2d wrote: Can someone experienced in D port the GNU Guile embedding tutorial over? It would be great if Guile can be used to embed in D Thank you https://www.gnu.org/software/guile/docs/guile-tut/tutorial.html#Fundamentals I have embedded Guile

Re: Using packages: undefined reference to main

2017-03-17 Thread bachmeier via Digitalmars-d-learn
On Thursday, 16 March 2017 at 17:55:13 UTC, cloutiy wrote: I'd like to try making a simple web app using vibrant.d, however I don't think I'm using it correctly since I'm getting a linking error when compiling. Below is my SDL with added vibrant.d dependency: name "cvmaker" description "A sim

Re: code folding

2017-03-14 Thread bachmeier via Digitalmars-d-learn
On Tuesday, 14 March 2017 at 16:29:15 UTC, Mike Parker wrote: If it's something you feel strongly about, then the way to go about it is to put together a DIP. There was a time when you could open a forum post about a new feature and eventually see it added, but those days are long gone (for go

Re: code folding

2017-03-14 Thread bachmeier via Digitalmars-d-learn
On Tuesday, 14 March 2017 at 00:38:12 UTC, Vladimir Panteleev wrote: FYI: The "you must implement my feature request or D will never succeed" attitude is rather common and never helpful. Not to mention that such an argument would be demonstrably false: every popular language without the featu

Re: code folding

2017-03-13 Thread bachmeier via Digitalmars-d-learn
On Monday, 13 March 2017 at 19:51:59 UTC, Inquie wrote: This is wrong. It is a language feature. #region lets you specify a block of code that you can expand or collapse when using the outlining feature of the Visual Studio Code Editor. In longer code files, it is convenient to be able to co

Re: foreach for string[string]AA

2017-02-28 Thread bachmeier via Digitalmars-d-learn
On Tuesday, 28 February 2017 at 15:33:46 UTC, ikod wrote: AA implemented as hash table, so it doesn't preserve insertion order. You have to sort keys when you need: import std.algorithm; import std.stdio; void main() { auto aa = ["one":1, "two":2

Re: Hello, folks! Newbie to D, have some questions!

2017-02-19 Thread bachmeier via Digitalmars-d-learn
On Saturday, 18 February 2017 at 20:15:55 UTC, timmyjose wrote: 4. I have heard good reports of D's metaprogramming capabilities (ironically enough, primarily from a thread on the Rust user group), and coming from a Common Lisp (and some Racket) background, I am deeply interested in this aspect

Re: Array start index

2017-02-06 Thread bachmeier via Digitalmars-d-learn
On Monday, 6 February 2017 at 18:55:19 UTC, pineapple wrote: One reason for zero-based indexes that isn't "it's what we're all used to" is that if you used one-based indexes, you would be able to represent one fewer index than zero-based, since one of the representable values - zero - could no

Re: Learning resources

2017-01-24 Thread bachmeier via Digitalmars-d-learn
On Tuesday, 24 January 2017 at 20:15:38 UTC, Dlearner wrote: Hey all! I'm learning programming through D and having a really good time (much better than with C++ or Python). I'm aiming to make little games with it as a hobby so I've learned some OpenGL stuff. But, I feel like I'm learning mo

Re: Resources for using std.allocator

2017-01-05 Thread bachmeier via Digitalmars-d-learn
On Wednesday, 4 January 2017 at 04:50:55 UTC, xtreak wrote: I am newbie to D learning it for sometime using Ali's book. I came across std.experimental.allocator and read through http://dlang.org/library/std/experimental/allocator/building_blocks.html . Can someone explain me the actual benefits

Re: Explain the Modules to me but better...

2016-12-29 Thread bachmeier via Digitalmars-d-learn
On Thursday, 29 December 2016 at 18:20:22 UTC, Modules Confuse Me wrote: I'm really getting hung up on a simple thing, such as how to structure my program in the 'D' way. So correct me if I am wrong. In my packages, I should be using 'public' imports correct? So that the imports get forwarded

Re: Cryptic C function pointer for conversion

2016-12-17 Thread bachmeier via Digitalmars-d-learn
On Saturday, 17 December 2016 at 15:15:26 UTC, data pulverizer wrote: Does this mean that you can translate C code to D natively? I am currently only aware of the dstep package. It may not help you, but something I've done in the past is use Swig to create a Common Lisp interface. It transla

Re: arsd.cgi - maximum length of form post

2016-12-15 Thread bachmeier via Digitalmars-d-learn
On Thursday, 15 December 2016 at 16:52:54 UTC, Adam D. Ruppe wrote: On Tuesday, 13 December 2016 at 22:55:55 UTC, bachmeier wrote: Here is a minimal program that can replicate the problem. Compiled and run with OK, try the new git cgi.d version, looks like my popFront was buggy and some data

Re: arsd.cgi - maximum length of form post

2016-12-13 Thread bachmeier via Digitalmars-d-learn
On Tuesday, 13 December 2016 at 00:54:43 UTC, Adam D. Ruppe wrote: On Tuesday, 13 December 2016 at 00:48:44 UTC, bachmeier wrote: a range violation error core.exception.RangeError@test.d(109): Range violation What's that line of your code too? Here is a minimal program that can replicate the

arsd.cgi - maximum length of form post

2016-12-12 Thread bachmeier via Digitalmars-d-learn
I'm using arsd.cgi, and have a form set up to take input. I get a range violation error core.exception.RangeError@test.d(109): Range violation when using the embedded server. It appears to be because the input is too large (about 3900 characters). When I cut the input to 3000 characters, there

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

2016-12-07 Thread bachmeier via Digitalmars-d-learn
On Thursday, 8 December 2016 at 02:10:35 UTC, Jon Degenhardt wrote: A cycle I think is common is for a researcher (industry or academic) to write functionality in native R code, then when trying to scale it, finds native R code is too slow, and switches to C/C++ to create a library used in R. C

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

2016-12-07 Thread bachmeier via Digitalmars-d-learn
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 need it. At the same time, there are people who are happy with ru

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

2016-12-07 Thread bachmeier via Digitalmars-d-learn
On Wednesday, 7 December 2016 at 12:12:56 UTC, Ilya Yaroshenko wrote: R, Matlab, Python, Mathematica, Gauss, and Julia use C libs. --Ilya You can call into those same C libs using D. Only if you want a pure D solution do you need to be able to rewrite those libraries and get the same perfor

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

2016-12-07 Thread bachmeier via Digitalmars-d-learn
On Wednesday, 7 December 2016 at 06:17:17 UTC, Picaud Vincent wrote: Considering scientific/numerical applications, I do agree with Ilya: it is mandatory to have zero overhead and a straightforward/direct interoperability with C. I am impressed by the Mir lib results and I think "BetterC" is ve

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

2016-12-06 Thread bachmeier via Digitalmars-d-learn
On Wednesday, 7 December 2016 at 02:24:56 UTC, bpr wrote: If I really *want* to use a GC, say I'm writing a server and I believe that a well tuned GC will allow my server to stay alive much longer with less fragmentation, I'll probably skip D and pick Go or maybe (hmmm...) even Java because the

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

2016-12-06 Thread bachmeier via Digitalmars-d-learn
On Tuesday, 6 December 2016 at 22:13:54 UTC, bpr wrote: Those programmers who are comfortable working in a GC-ed language will likely eschew D because D's GC is really not that great. So someone working with Ruby is not going to want to work with D because of GC performance? I wonder what per

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

2016-12-06 Thread bachmeier via Digitalmars-d-learn
On Tuesday, 6 December 2016 at 20:01:38 UTC, Ilya Yaroshenko wrote: On Tuesday, 6 December 2016 at 17:00:35 UTC, Jonathan M Davis wrote: So, while there are certainly folks who would prefer using D as a better C without druntime or Phobos, I think that you're seriously overestimating how many f

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

2016-12-05 Thread bachmeier via Digitalmars-d-learn
On Monday, 5 December 2016 at 17:18:25 UTC, e-y-e wrote: Currently I have been learning D for about a year and a half. This may seem like a short time, but this is the longest I have stuck with any language. I have only been learning for 4 years and I am currently in university studying first y

Re: how to debug memory errors

2016-11-08 Thread bachmeier via Digitalmars-d-learn
On Tuesday, 8 November 2016 at 14:55:53 UTC, Steven Schveighoffer wrote: Indeed, you should not. I'm saying this type of error can explain the observed behavior. The original post I responded to said "I don't know if the double free problem is related to this." -Steve Okay. I thought may

Re: how to debug memory errors

2016-11-08 Thread bachmeier via Digitalmars-d-learn
On Tuesday, 8 November 2016 at 11:53:37 UTC, Era Scarecrow wrote: On Tuesday, 8 November 2016 at 11:26:55 UTC, bachmeier wrote: Is there a valid use case for something like this? Why would you want to do anything inside ~this with GC memory? If we assume it's a C++ attachment/library/object

Re: how to debug memory errors

2016-11-08 Thread bachmeier via Digitalmars-d-learn
On Monday, 7 November 2016 at 02:22:35 UTC, Steven Schveighoffer wrote: Imagine a resource wrapper like so: class Foo { int *mem; this() { mem = cast(int *)malloc(int.sizeof); } ~this() { .free(mem); } } Now, you have a problem if you do something like this: class Bar { Foo foo;

Re: strange -fPIC compilation error

2016-11-01 Thread bachmeier via Digitalmars-d-learn
On Tuesday, 1 November 2016 at 17:23:54 UTC, Charles Hixson wrote: On 11/01/2016 12:52 AM, Nordlöw via Digitalmars-d-learn wrote: On Tuesday, 1 November 2016 at 07:15:19 UTC, Mike Parker wrote: but dmd -defaultlib=libphobos2.so -fPIC test.d works. It shouldn't be required (as in the default /

Re: Neural Networks / ML Libraries for D

2016-10-25 Thread bachmeier via Digitalmars-d-learn
On Tuesday, 25 October 2016 at 13:58:33 UTC, Saurabh Das wrote: Oh that sounds pretty cool. While I probably won't use it right now, embedding R inside D would be a good learning opportunity. Is it available on code.dlang.org or on GitHub? Thanks Saurabh Installation amounts to installin

Re: Neural Networks / ML Libraries for D

2016-10-25 Thread bachmeier via Digitalmars-d-learn
On Tuesday, 25 October 2016 at 11:17:29 UTC, Saurabh Das wrote: Hello, Are there any good ML libraries for D? In particular, looking for a neural network library currently. Any leads would be appreciated. Thanks, Saurabh I have written a project to embed R inside D and vice versa for my r

Re: SQLite

2016-10-19 Thread bachmeier via Digitalmars-d-learn
On Wednesday, 19 October 2016 at 16:01:37 UTC, Alfred Newman wrote: Hello, I am trying to handle a SQLite3 table with D. During my researchs, I discovered the lib https://dlang.org/phobos/etc_c_sqlite3.html. [...] I've never used SQLite from D, but Adam Ruppe has an interface with an exam

Re: From Python to Dlang

2016-10-18 Thread bachmeier via Digitalmars-d-learn
On Tuesday, 18 October 2016 at 12:03:54 UTC, Alfred Newman wrote: Hello and greetings, I'm a brand new D developer coming from Python. I decided to move to D, mainly because it's a compiled language and has a great runtime speed (and I don't feel confortable at Cython environment at all). And

Re: Should I brush up on my C before plunging fully into D?

2016-10-15 Thread bachmeier via Digitalmars-d-learn
On Saturday, 15 October 2016 at 01:46:52 UTC, Chris Nelson wrote: I'm mainly a scripting language, .NET, and SQL programmer. I've been looking for a good programming language for Linux/BSD other than Python. I've surveyed the options and D appears to be a sane modern choice for me. (Thanks Ali

Re: Learning ddoc

2016-09-29 Thread bachmeier via Digitalmars-d-learn
On Thursday, 29 September 2016 at 09:35:56 UTC, Antonio Corbi wrote: Hi, I'm in the process of learning how ddoc works. I've successfully created docs for my code and recently learned how to generate it using dub. Related to this and after seeing the announcement of the new release of the em

Re: Iterate over two arguments at once

2016-09-19 Thread bachmeier via Digitalmars-d-learn
On Monday, 19 September 2016 at 18:10:22 UTC, bachmeier wrote: Suppose I want to iterate over two arrays at once: foreach(v1, v2; [1.5, 2.5, 3.5], [4.5, 5.5, 6.5]) { ... } I have seen a way to do this but cannot remember what it is and cannot find it. Thanks for the replies. This is what I

<    1   2   3   4   >