Re: cURL alternative for enable javascript

2015-09-03 Thread Rikki Cattermole via Digitalmars-d-learn
On 04/09/15 2:09 AM, xky wrote: hello! :) Well.. yes. cURL couldn't enable javascript. How can i use other library alternative cURL for D ? regards, Curl is meant to transfer data and in this case, download files over http. It is not meant to render them via JavaScript. If you are wanting

Re: Casting away immutability

2015-09-03 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 3 September 2015 at 13:28:54 UTC, Sergei Degtiarev wrote: Agree, however, memory obtained with mmap(..., PROT_READ, ..); is essentially read-only and any attempt to write to it will cause immediate crash with segmentation violation. It would be very desirable in this case to

cURL alternative for enable javascript

2015-09-03 Thread xky via Digitalmars-d-learn
hello! :) Well.. yes. cURL couldn't enable javascript. How can i use other library alternative cURL for D ? regards,

Re: interprocess communication and sharing memory

2015-09-03 Thread Justin Whear via Digitalmars-d-learn
On Thu, 03 Sep 2015 01:27:14 +, j55 wrote: > I've read many posts about shared memory and interprocess communication > in D, but I didn't see any conclusive information about whether this > type of interprocess memory sharing will be convenient or practical in > D. If it doesn't work out, I

Working Windows GUI library?

2015-09-03 Thread Andre Polykanine via Digitalmars-d-learn
Hi everyone, Does anyone of you work with a Windows GUI library with native controls in order to write desktop apps in D? Here is why I'm asking: actually, there are quite a number of GUI libraries listed at wiki.dlang.org. However, I have one specific requirement: the resulting apps

Re: Casting away immutability

2015-09-03 Thread Sergei Degtiarev via Digitalmars-d-learn
On Thursday, 3 September 2015 at 14:36:12 UTC, Mike Parker wrote: immutable(T)[] getGetData(T)() { return cast(immutable(T)[])data; } Absolutely, instead of returning raw void[] and allow user to cast it, std.mmfile should implement template function to return desired type. This would

Re: Working Windows GUI library?

2015-09-03 Thread Andre Polykanine via Digitalmars-d-learn
Hello Adam, ADRvDdl> Easily usable by the blind or people with motor difficulties and ADRvDdl> other similar challenges. Exactly, thank you. I.e., the app should be usable without mouse and with a screen reader (to over-simplify the things). -- With best regards from Ukraine, Andre

Re: Why isn't int[] automatically convertible to long[]?

2015-09-03 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 3 September 2015 at 17:27:03 UTC, Jack Stouffer wrote: pragma(msg, is(int[] : long[])); false Why? Think of the memory layout... if you implicitly casted, either the contents would change or it would need to allocate a new array, neither of which is free. [0, 1] as

Why isn't int[] automatically convertible to long[]?

2015-09-03 Thread Jack Stouffer via Digitalmars-d-learn
pragma(msg, is(int[] : long[])); false Why?

Re: Can we get a video tutorial?

2015-09-03 Thread Stephen via Digitalmars-d-learn
On Wednesday, 2 September 2015 at 01:15:28 UTC, Mike Parker wrote: * What was previously said * Ok, so, I am running Windows 10, I have installed VS 2015, I have installed DMD 1 and 2 (I know I only need 2 but it shouldn't hurt to have both), I have installed VisualD, and I have installed

Re: Can we get a video tutorial?

2015-09-03 Thread wobbles via Digitalmars-d-learn
On Thursday, 3 September 2015 at 19:13:35 UTC, Stephen wrote: On Wednesday, 2 September 2015 at 01:15:28 UTC, Mike Parker wrote: * What was previously said * Ok, so, I am running Windows 10, I have installed VS 2015, I have installed DMD 1 and 2 (I know I only need 2 but it shouldn't hurt

spawn X different workers & wait for results from all of them

2015-09-03 Thread Robert M. Münch via Digitalmars-d-learn
Hi, I'm not sure how to best implement the following: 1. I have 4 different tasks to do. 2. All can run in parallel 3. Every task will return some result that I need Now how to best do it? When using receive() it fires on the first hit and the function continues. It's like a receive(OR), one

Digger 2.3 / Win32 / 'run' not found

2015-09-03 Thread Robert M. Münch via Digitalmars-d-learn
After getting Digger to work again on OSX now going for the Windows version: digger: Preparing DigitalMars C++ digger: DMC=Y:\Digger\dl\dm\bin digger: Preparing DMD digger: hostDC= digger: Running: "make" -f win32.mak ^"MODEL=32^" HOST_DC= dmd digger:

Re: Working Windows GUI library?

2015-09-03 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 3 September 2015 at 16:49:51 UTC, BBasile wrote: I don't know what you meant by 'accessible' Easily usable by the blind or people with motor difficulties and other similar challenges.

Re: Working Windows GUI library?

2015-09-03 Thread BBasile via Digitalmars-d-learn
On Thursday, 3 September 2015 at 15:46:28 UTC, Andre Polykanine wrote: [...] Hello, there this one: https://github.com/nomad-software/tkd [...] I don't know what you meant by 'accessible' but the two respective runtimes exist for windows.

Re: cURL alternative for enable javascript

2015-09-03 Thread Laeeth Isharc via Digitalmars-d-learn
On Thursday, 3 September 2015 at 14:17:28 UTC, Rikki Cattermole wrote: On 04/09/15 2:09 AM, xky wrote: hello! :) Well.. yes. cURL couldn't enable javascript. How can i use other library alternative cURL for D ? regards, Curl is meant to transfer data and in this case, download files over

Re: 2.068.0 std.process.executeShell how to set the shell?

2015-09-03 Thread albatroz via Digitalmars-d-learn
On Thursday, 3 September 2015 at 05:07:10 UTC, Jonathan M Davis wrote: key thing that you're missing is -c. - Jonathan M Davis Hi Jonathan, I would just like to say thank you for the time you took to help and clarify. Obrigado

Re: Working Windows GUI library?

2015-09-03 Thread jqb via Digitalmars-d-learn
On Thursday, 3 September 2015 at 16:49:51 UTC, BBasile wrote: [...] I don't know what you meant by 'accessible' [...] https://en.wikipedia.org/wiki/Computer_accessibility Accessibility is even more important than native language support.

Detecting premature end of spawned threads with std.concurrency

2015-09-03 Thread Matt Kline via Digitalmars-d-learn
TDPL suggests that calls to std.concurrency.send will fail with an "OwnedTerminated" or "OwnedFailed" exception if the destination thread has exited, but neither the docs nor the current Phobos implementation make any mention of such exceptions. Thinking the information was just outdated, I

Re: reading file byLine

2015-09-03 Thread Namal via Digitalmars-d-learn
On Wednesday, 2 September 2015 at 22:19:11 UTC, wobbles wrote: On Wednesday, 2 September 2015 at 21:53:20 UTC, Namal wrote: Thx guys, this helped alot. The next thing I want to do is read the file line by line and split the stream into words. I found this example of code that seems to do sort

Re: Prefer Signed or Unsigned in D?

2015-09-03 Thread John Carter via Digitalmars-d-learn
On Wednesday, 2 September 2015 at 21:43:17 UTC, ponce wrote: Additionally, I was said weeks ago on this NG that and signed overflow in D is not actually Undefined Behaviour. Interesting.. The reference is fairly terse on exactly what happens, is it more formally specified anywhere? In which

Re: interprocess communication and sharing memory

2015-09-03 Thread thedeemon via Digitalmars-d-learn
On Thursday, 3 September 2015 at 02:52:00 UTC, Laeeth Isharc wrote: On Thursday, 3 September 2015 at 01:27:15 UTC, j55 wrote: This is my first attempt at a project in D, so pardon me if I'm overlooking something obvious: I'm using libasync to create an eventloop, to set up something like a

How to test if a double has no fraction part

2015-09-03 Thread Namal via Digitalmars-d-learn
Hello, is there a modf function like in C++ or something similar which could help me find out if a double has a fractional part or not. Thx

Re: How to test if a double has no fraction part

2015-09-03 Thread rumbu via Digitalmars-d-learn
On Thursday, 3 September 2015 at 10:52:39 UTC, Namal wrote: Hello, is there a modf function like in C++ or something similar which could help me find out if a double has a fractional part or not. Thx http://dlang.org/phobos/std_math.html#.modf

Re: Access Violation while trying to use OpenGL

2015-09-03 Thread ponce via Digitalmars-d-learn
On Wednesday, 2 September 2015 at 18:31:32 UTC, spec00 wrote: On Wednesday, 2 September 2015 at 01:07:01 UTC, Mike Parker wrote: To compile 64-bit programs on Windows, DMD requires the Microsoft toolchain. The easiest thing to do is to install the Community Edition of Visual Studio 2013 (DMD

Call a function passed as template parameter.

2015-09-03 Thread moechofe via Digitalmars-d-learn
Hi, I would like to create a template that take a function as template parameter, create an arguments list for it, fill it with some data and call the function. void foo(uint a, string b) { // ... } void bar(long a, long b, string c) { // ... } call(alias F)(JSONValue j) { // create

Re: reading file byLine

2015-09-03 Thread Jordan Wilson via Digitalmars-d-learn
On Thursday, 3 September 2015 at 22:48:01 UTC, Jordan Wilson wrote: On Thursday, 3 September 2015 at 22:21:57 UTC, Namal wrote: ep18.d(10): Error: no property 'split' for type 'char[]' /usr/include/dmd/phobos/std/algorithm.d(427): instantiated from here: MapResult!(__lambda1,

Re: reading file byLine

2015-09-03 Thread Namal via Digitalmars-d-learn
Sorry, I didn't notice the "convert all the elements in it to integer" part. I think I saw reference to the to! before...that is one way to convert. auto words = file.byLine() // you've all lines in range .map!(a => a.split) .map!(a =>

Re: reading file byLine

2015-09-03 Thread Jordan Wilson via Digitalmars-d-learn
Actually, need an extra map I think: auto word = file.byLine() .map!(a => a.split) .map!(a => map!(a => to!int(a))(a)) .array();

Re: reading file byLine

2015-09-03 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Sep 04, 2015 at 12:18:14AM +, Namal via Digitalmars-d-learn wrote: [...] > That being said, when do I have to import std.array and std.string? > Every time I use std.array? I can obviously use arrays and strings > without those libs. Arrays and strings are built into the language; but

Re: reading file byLine

2015-09-03 Thread Namal via Digitalmars-d-learn
On Thursday, 3 September 2015 at 23:54:44 UTC, H. S. Teoh wrote: On Thu, Sep 03, 2015 at 11:38:54PM +, Namal via Digitalmars-d-learn wrote: On Thursday, 3 September 2015 at 23:31:27 UTC, Jordan Wilson wrote: >On Thursday, 3 September 2015 at 23:28:37 UTC, Namal wrote: >>On Thursday, 3

Re: Can we get a video tutorial?

2015-09-03 Thread Stephen via Digitalmars-d-learn
On Thursday, 3 September 2015 at 19:41:55 UTC, wobbles wrote: * What was previously said * So, can you show your project's dub.json? { "name": "test graphics and math", "description": "A minimal D application.", "copyright": "Copyright © 2015, Stephen",

Re: reading file byLine

2015-09-03 Thread Jordan Wilson via Digitalmars-d-learn
On Thursday, 3 September 2015 at 22:21:57 UTC, Namal wrote: ep18.d(10): Error: no property 'split' for type 'char[]' /usr/include/dmd/phobos/std/algorithm.d(427): instantiated from here: MapResult!(__lambda1, ByLine!(char, char)) ep18.d(10):instantiated from here:

Re: reading file byLine

2015-09-03 Thread Namal via Digitalmars-d-learn
On Thursday, 3 September 2015 at 23:31:27 UTC, Jordan Wilson wrote: On Thursday, 3 September 2015 at 23:28:37 UTC, Namal wrote: On Thursday, 3 September 2015 at 23:25:52 UTC, Jordan Wilson wrote: And also: import std.algorithm Sorry, I should have taken the time to answer properly and fully.

Re: reading file byLine

2015-09-03 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Sep 03, 2015 at 11:38:54PM +, Namal via Digitalmars-d-learn wrote: > On Thursday, 3 September 2015 at 23:31:27 UTC, Jordan Wilson wrote: > >On Thursday, 3 September 2015 at 23:28:37 UTC, Namal wrote: > >>On Thursday, 3 September 2015 at 23:25:52 UTC, Jordan Wilson wrote: > >>>And also:

Re: reading file byLine

2015-09-03 Thread Namal via Digitalmars-d-learn
ep18.d(10): Error: no property 'split' for type 'char[]' /usr/include/dmd/phobos/std/algorithm.d(427): instantiated from here: MapResult!(__lambda1, ByLine!(char, char)) ep18.d(10):instantiated from here: map!(ByLine!(char, char)) and then a long list to the end of my code

Re: reading file byLine

2015-09-03 Thread Namal via Digitalmars-d-learn
On Thursday, 3 September 2015 at 23:25:52 UTC, Jordan Wilson wrote: And also: import std.algorithm Sorry, I should have taken the time to answer properly and fully. import std.file, std.stdio, std.string, std.conv, std.algorithm; void main(){ auto file = File("text.txt");

Re: reading file byLine

2015-09-03 Thread Jordan Wilson via Digitalmars-d-learn
And also: import std.algorithm Sorry, I should have taken the time to answer properly and fully.

Re: reading file byLine

2015-09-03 Thread Jordan Wilson via Digitalmars-d-learn
On Thursday, 3 September 2015 at 23:28:37 UTC, Namal wrote: On Thursday, 3 September 2015 at 23:25:52 UTC, Jordan Wilson wrote: And also: import std.algorithm Sorry, I should have taken the time to answer properly and fully. import std.file, std.stdio, std.string, std.conv, std.algorithm;

Re: reading file byLine

2015-09-03 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Sep 03, 2015 at 11:22:09PM +, Namal via Digitalmars-d-learn wrote: > >Sorry, I didn't notice the "convert all the elements in it to integer" > >part. > >I think I saw reference to the to! before...that is one way to convert. > > > >auto words = file.byLine() // you've all

Re: reading file byLine

2015-09-03 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Sep 03, 2015 at 11:28:36PM +, Namal via Digitalmars-d-learn wrote: > On Thursday, 3 September 2015 at 23:25:52 UTC, Jordan Wilson wrote: > >And also: > >import std.algorithm > > > >Sorry, I should have taken the time to answer properly and fully. > > import std.file, std.stdio,

Re: reading file byLine

2015-09-03 Thread Jordan Wilson via Digitalmars-d-learn
On Friday, 4 September 2015 at 00:18:15 UTC, Namal wrote: On Thursday, 3 September 2015 at 23:54:44 UTC, H. S. Teoh wrote: [...] Thx Theo, this and the lack of foolproof tutorials were the reason why I gave up on D 2 years ago and went instead to C++. But I am not giving up this time. That

Arithmetic conversion -- warnings missing?

2015-09-03 Thread Q. Schroll via Digitalmars-d-learn
import std.stdio; void main() { short ss = -1; ushort us = 0; intsi = -1; uint ui = 0; if (ss < us) writeln("a"); else writeln("b"); if (si < ui) writeln("A"); else writeln("B"); } prints "aB" due to integral promotion

Re: reading file byLine

2015-09-03 Thread deed via Digitalmars-d-learn
On Friday, 4 September 2015 at 01:31:28 UTC, Namal wrote: How can I get just the maximum element? Do I need to give a range for it? Use max? http://dlang.org/phobos/std_algorithm_comparison.html#max

OSX prompt limit

2015-09-03 Thread Joel via Digitalmars-d-learn
In Mac OS, when typing with readln etc. I can't use the cursor keys. Works in Windows though.

Re: Call a function passed as template parameter.

2015-09-03 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 3 September 2015 at 11:31:22 UTC, moechofe wrote: I would like to create a template that take a function as template parameter, create an arguments list for it, fill it with some data and call the function. Check out the sample chapter to my book:

Re: Casting away immutability

2015-09-03 Thread Sergei Degtiarev via Digitalmars-d-learn
On Thursday, 3 September 2015 at 05:15:35 UTC, Jonathan M Davis wrote: On Wednesday, September 02, 2015 14:00:07 Sergei Degtiarev via Digitalmars-d-learn wrote: Well, that's how mmap works. You're just getting raw bytes as void*, and the D code converts that to void[], which is slightly safer.

Re: How to test if a double has no fraction part

2015-09-03 Thread Namal via Digitalmars-d-learn
Interesting, in contrary to C++ it saves the integral part in the dummy variable. Doing this I noticed if I try to write a double variable in the console it gives me only the integral part. I only did it with writeln so far. How can I print out a double variable with a precision of 2 for

Re: How to test if a double has no fraction part

2015-09-03 Thread wobbles via Digitalmars-d-learn
On Thursday, 3 September 2015 at 12:51:42 UTC, Namal wrote: Interesting, in contrary to C++ it saves the integral part in the dummy variable. Doing this I noticed if I try to write a double variable in the console it gives me only the integral part. I only did it with writeln so far. How can I

Re: Can we get a video tutorial?

2015-09-03 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 3 September 2015 at 19:13:35 UTC, Stephen wrote: On Wednesday, 2 September 2015 at 01:15:28 UTC, Mike Parker wrote: * What was previously said * Ok, so, I am running Windows 10, I have installed VS 2015, I have installed DMD 1 and 2 (I know I only need 2 but it shouldn't hurt

Re: OSX prompt limit

2015-09-03 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 4 September 2015 at 02:17:57 UTC, Joel wrote: In Mac OS, when typing with readln etc. I can't use the cursor keys. Works in Windows though. That's normal, line editing on Unix terminals is a kinda advanced library feature. The most common lib to do it, GNU readline, is actually a

Re: reading file byLine

2015-09-03 Thread Namal via Digitalmars-d-learn
Hope this helps. Yes, it does. I have a question about arrays. I can sort an array A by sort(A); How can I get just the maximum element? Do I need to give a range for it?