Setting dates

2014-07-10 Thread Joel via Digitalmars-d-learn
I've been trying to set a date for my program (a small struct): import std.datetime; auto date = cast(DateTime)Clock.currTime(); setDate(date.day, date.month, date.year); Problem is that day month are not integers. And date.day.to!int doesn't work either.

Re: Setting dates

2014-07-16 Thread Joel via Digitalmars-d-learn
On Monday, 14 July 2014 at 05:58:13 UTC, Jonathan M Davis via Digitalmars-d-learn wrote: On Friday, July 11, 2014 04:01:24 Joel via Digitalmars-d-learn wrote: I've been trying to set a date for my program (a small struct): import std.datetime; auto date = cast(DateTime)Clock.currTime

Question about 'this'

2014-09-02 Thread Joel via Digitalmars-d-learn
string getString2(in string input) { long start, end; while(start input.length input[start] != '') start++; start++; end = input.length - 1; while(end 0 input[end] != '')

Re: Question about 'this'

2014-09-02 Thread Joel via Digitalmars-d-learn
On Wednesday, 3 September 2014 at 04:00:30 UTC, Joel wrote: string getString2(in string input) { long start, end; while(start input.length input[start] != '') start++; start++; end = input.length -

ini library in OSX

2014-09-08 Thread Joel via Digitalmars-d-learn
Is there any ini library that works in OSX? I've tried the ones I found. I think they have the same issue. Joels-MacBook-Pro:ChrisMill joelcnz$ dmd ini -unittest ini.d(330): Error: cannot pass dynamic arrays to extern(C) vararg functions ini.d(387): Error: undefined identifier 'replace', did

Re: ini library in OSX

2014-09-09 Thread Joel via Digitalmars-d-learn
On Tuesday, 9 September 2014 at 08:57:30 UTC, Dejan Lekic wrote: Or this one: http://dpaste.dzfl.pl/1b29ef20# Thanks Dejan Lekic, I'll look them up.

Re: ini library in OSX

2014-09-09 Thread Joel via Digitalmars-d-learn
How do you use this ini file parser? - http://dpaste.dzfl.pl/1b29ef20 module rangeini; import std.stdio: File, writeln; import std.range; import std.algorithm: canFind; import std.string: strip, splitLines; import std.traits: Unqual; import std.conv: text; struct ConfigItem {

Re: ini library in OSX

2014-09-09 Thread Joel via Digitalmars-d-learn
Here's a failed attempt of mine - after the line. I would usually have stuff like the following (right next): Ini ini; ini=new Ini( cfg ); ini[section][key] = value; --- import ini; void main() { import std.conv; //load string data; int i;

multidimensional array

2014-09-28 Thread Joel via Digitalmars-d-learn
I'm trying to make a multidimensional array. I feel I've tried every thing. Is there a good guide explaining it? struct Spot { bool dot; } spots = new Spot[][](800,600); assert(spots[800-1][600-1].dot, Out of bounds);

Re: multidimensional array

2014-09-30 Thread Joel via Digitalmars-d-learn
Thanks JKPdouble. I was hoping for a clear way to work multidimensional arrays out.

'write' crashes without extra window

2014-10-07 Thread Joel via Digitalmars-d-learn
I have a program that runs at Windows 7 login, each time. But it had been opening with a command prompt, so I got rid of the prompt and now it some times crashes. I've noticed it before, using 'write' without the prompt.

Re: 'write' crashes without extra window

2014-10-08 Thread Joel via Digitalmars-d-learn
On Wednesday, 8 October 2014 at 03:33:38 UTC, Adam D. Ruppe wrote: On Tuesday, 7 October 2014 at 23:41:14 UTC, Joel wrote: it had been opening with a command prompt, so I got rid of the prompt and now it some times crashes. That's a feature - writing to a non-existent handle fails, so it

Re: What is a sink delegate?

2014-10-09 Thread Joel via Digitalmars-d-learn
On Tuesday, 30 September 2014 at 17:27:09 UTC, Adam D. Ruppe wrote: On Tuesday, 30 September 2014 at 17:22:44 UTC, Gary Willoughby wrote: What is a sink delegate? Instead of string toString() { return foo; } for example, you would use: void toString(void delegate(string) sink) { sink(foo);

Re: What is a sink delegate?

2014-10-10 Thread Joel via Digitalmars-d-learn
Thanks thedeemon. On Friday, 10 October 2014 at 04:42:04 UTC, thedeemon wrote: On Friday, 10 October 2014 at 03:06:33 UTC, Joel wrote: How do you use that toString? Maybe an example? void main() { Try t = Try(Joel, 35); t.toString(s = writeln(s)); }

Re: ini library in OSX

2014-10-11 Thread Joel via Digitalmars-d-learn
On Thursday, 11 September 2014 at 10:49:48 UTC, Robert burner Schadek wrote: some self promo: http://code.dlang.org/packages/inifiled I would like an example?

Any dub tips and tricks

2014-10-16 Thread Joel via Digitalmars-d-learn
Any way of using dub (on Windows or OSX). I've been trying it lately, but not much success. 1. (In the command prompt or Terminal), I create a new folder. 2. Run 'dub init' in the new folder 3. I copy the dependency from a lib/app into the dub.json file. 4. Then I just enter 'dub' In Windows I

Re: Any dub tips and tricks

2014-10-17 Thread Joel via Digitalmars-d-learn
On Friday, 17 October 2014 at 08:32:13 UTC, Atila Neves wrote: Are you sure your package/dub.json is valid JSON? You can check it here: http://jsonlint.com/ Atila On Thursday, 16 October 2014 at 22:22:14 UTC, Joel wrote: Any way of using dub (on Windows or OSX). I've been trying it lately,

Re: Any dub tips and tricks

2014-10-18 Thread Joel via Digitalmars-d-learn
There is a mistake in the dil package.json excludedSourceFiles should be an array of strings, not just a string. But I don't get those errors on my OSX.

Re: Sorting array of string arrays by an element in the string array

2014-10-21 Thread Joel via Digitalmars-d-learn
On Wednesday, 22 October 2014 at 00:36:22 UTC, Joel wrote: On Wednesday, 22 October 2014 at 00:32:56 UTC, neal wrote: Just curious if this is possible. I have some data on different countries that i have stored in a multidimensional array called data[][]. What I want to do is sort data[][] by

Re: Sorting array of string arrays by an element in the string array

2014-10-21 Thread Joel via Digitalmars-d-learn
On Wednesday, 22 October 2014 at 00:32:56 UTC, neal wrote: Just curious if this is possible. I have some data on different countries that i have stored in a multidimensional array called data[][]. What I want to do is sort data[][] by population which happens to be stored in data[i][4] where i

Derelict SDL2 library not loading on OS X

2014-12-17 Thread Joel via Digitalmars-d-learn
I've installed SDL2. Joels-MacBook-Pro:DerelictTest joelcnz$ cat test.d import derelict.sdl2.sdl; int main() { DerelictSDL2.load(); } Joels-MacBook-Pro:DerelictTest joelcnz$ dmd test libDerelictSDL2.a libDerelictUtil.a Joels-MacBook-Pro:DerelictTest joelcnz$ ./test

Re: Derelict SDL2 library not loading on OS X

2014-12-17 Thread Joel via Digitalmars-d-learn
Did you check if you installed SDL already on your machine? I followed the SDL2 instructions (on the SDL web site) for OS X before using Derelict. It had about copying to a curtain folder, which I did.

Re: Derelict SDL2 library not loading on OS X

2014-12-18 Thread Joel via Digitalmars-d-learn
[snip] Failed to load one or more shared libraries: After that last colon, you should be seeing a list of library names that failed to load. Did you somehow fail to copy/paste it or is it really missing? Yes, there was something wrong there, here's another go: Joels-MBP:test joelcnz$ dmd

Re: Derelict SDL2 library not loading on OS X

2014-12-19 Thread Joel via Digitalmars-d-learn
Now I get this: Joels-MacBook-Pro:dere joelcnz$ ./app derelict.util.exception.SymbolLoadException@source/derelict/util/exception.d(35): Failed to load symbol SDL_GameControllerAddMapping from shared library /usr/local/lib/libSDL2.dylib

Re: Derelict SDL2 library not loading on OS X

2014-12-19 Thread Joel via Digitalmars-d-learn
[snip] In this case, I used the online mercurial repo browser for SDL 2 [1]. I selected the release-2.0.0 tag, then clicked include, then clicked the file link for SDL_GameController.h. I used Ctrl-f in my web browser to search for SDL_GameControllerAddMapping and found it was there. I then

Re: ini library in OSX

2014-12-20 Thread Joel via Digitalmars-d-learn
On Monday, 13 October 2014 at 16:06:42 UTC, Robert burner Schadek wrote: On Saturday, 11 October 2014 at 22:38:20 UTC, Joel wrote: On Thursday, 11 September 2014 at 10:49:48 UTC, Robert burner Schadek wrote: some self promo: http://code.dlang.org/packages/inifiled I would like an example?

Re: ini library in OSX

2014-12-22 Thread Joel via Digitalmars-d-learn
On Monday, 22 December 2014 at 11:04:10 UTC, Robert burner Schadek wrote: On Saturday, 20 December 2014 at 08:09:06 UTC, Joel wrote: On Monday, 13 October 2014 at 16:06:42 UTC, Robert burner Schadek wrote: On Saturday, 11 October 2014 at 22:38:20 UTC, Joel wrote: On Thursday, 11 September 2014

Getting DAllegro 5 to work in Windows

2014-12-23 Thread Joel via Digitalmars-d-learn
I can't get implib.exe (http://ftp.digitalmars.com/bup.zip) to produce .lib files from dlls (https://www.allegro.cc/files/). I think it works for other people. Thanks for any help.

Re: Getting DAllegro 5 to work in Windows

2014-12-26 Thread Joel via Digitalmars-d-learn
On Wednesday, 24 December 2014 at 09:57:31 UTC, Kagamin wrote: Works for me on allegro-5.0.10-mt.dll, produced 391kb lib file. I think my Windows 7 on my Mac has system damage - I used a doggy flash drive. I plan to install Window 8.1, and hopefully that will fix the problem.

Allegro 5 in C - installing on OSX

2015-02-03 Thread Joel via Digitalmars-d-learn
How do you install Allegro 5 (OSX)? Like, using 'Home Brew'.

Re: Allegro 5 in C - installing on OSX

2015-02-03 Thread Joel via Digitalmars-d-learn
Ok, thanks Mike.

Using dub

2015-01-26 Thread Joel via Digitalmars-d-learn
I'm having trouble using dub. Nothing seems to work (-h works though). I would like an example or two of how to get an app going (stand alone for now). I'm using the Mac OS.

Re: Using dub

2015-01-27 Thread Joel via Digitalmars-d-learn
Oope, yeah, and it ran.

Re: Using dub

2015-01-26 Thread Joel via Digitalmars-d-learn
On Tuesday, 27 January 2015 at 07:25:18 UTC, Rikki Cattermole wrote: On 27/01/2015 8:03 p.m., Joel wrote: I'm having trouble using dub. Nothing seems to work (-h works though). I would like an example or two of how to get an app going (stand alone for now). I'm using the Mac OS. Lets use

Re: Using dub

2015-01-27 Thread Joel via Digitalmars-d-learn
On Tuesday, 27 January 2015 at 07:44:12 UTC, Rikki Cattermole wrote: On 27/01/2015 8:40 p.m., Joel wrote: On Tuesday, 27 January 2015 at 07:25:18 UTC, Rikki Cattermole wrote: On 27/01/2015 8:03 p.m., Joel wrote: I'm having trouble using dub. Nothing seems to work (-h works though). I would

Re: Using dub

2015-01-27 Thread Joel via Digitalmars-d-learn
On Tuesday, 27 January 2015 at 08:08:19 UTC, Joel wrote: Oope, yeah, and it ran. Thanks Rikki, I wiped off the dub installation. Now, no errors. The small program worked too. I don't now how to set up the dub executable to work with out doing stuff like this - '../dub' (Mac OS 10.10.1)

Re: Using dub

2015-01-27 Thread Joel via Digitalmars-d-learn
On Wednesday, 28 January 2015 at 00:34:13 UTC, Joel wrote: On Tuesday, 27 January 2015 at 08:08:19 UTC, Joel wrote: Oope, yeah, and it ran. Thanks Rikki, I wiped off the dub installation. Now, no errors. The small program worked too. Actually I got this with dlangui, (I followed the

Re: Using dub

2015-01-28 Thread Joel via Digitalmars-d-learn
On Wednesday, 28 January 2015 at 23:48:52 UTC, Rikki Cattermole wrote: On 29/01/2015 11:27 a.m., Joel wrote: When I setup dub/dmd on my OSX install, I used the OSX packages and it should already be on the PATH variable. What packages? I'm new to Mac OS. Ohh, I was meaning a dmg. But ugh

Re: Using dub

2015-01-28 Thread Joel via Digitalmars-d-learn
When I setup dub/dmd on my OSX install, I used the OSX packages and it should already be on the PATH variable. What packages? I'm new to Mac OS.

Re: Using dub

2015-01-28 Thread Joel via Digitalmars-d-learn
[0] http://brew.sh/ Do I just put 'brew dub'? First install brew then $ brew install dub From that it should just be dub to run. Don't forget to restart terminal afterwards or just rerun bash. If dub isn't found, PATH variable will need to be changed via .bashrc. But I'm doubting its

Re: Getting DAllegro 5 to work in Windows

2015-01-29 Thread Joel via Digitalmars-d-learn
On Friday, 26 December 2014 at 08:43:24 UTC, Joel wrote: On Wednesday, 24 December 2014 at 09:57:31 UTC, Kagamin wrote: Works for me on allegro-5.0.10-mt.dll, produced 391kb lib file. I think my Windows 7 on my Mac has system damage - I used a doggy flash drive. I plan to install Window 8.1,

Re: Getting DAllegro 5 to work in Windows

2015-01-30 Thread Joel via Digitalmars-d-learn
On Friday, 30 January 2015 at 07:53:12 UTC, Kagamin wrote: On Friday, 30 January 2015 at 06:16:21 UTC, Joel wrote: What happens is, that I run the script file (in DAllegro folder) and it is suppose to create lib files from the DLL ones. On my system, it says its done it but no lib files pop

Re: Getting DAllegro 5 to work in Windows

2015-01-30 Thread Joel via Digitalmars-d-learn
On Friday, 30 January 2015 at 07:34:53 UTC, Mike Parker wrote: On 1/30/2015 3:16 PM, Joel wrote: Update. What happens is, that I run the script file (in DAllegro folder) and it is suppose to create lib files from the DLL ones. On my system, it says its done it but no lib files pop up! It

A better way than foreach with this?

2015-08-24 Thread Joel via Digitalmars-d-learn
auto names = Alef Bet Gimel Dalet He Vav Zayen Het Tet Yod Final_Kaf Kaf Lamed Final_Mem Mem Final_Nun Nun Samekh Ayin Final_Pe Pe Final_Tsadi Tsadi Qof Resh Shin Tav.split; foreach (ref name; names)

Re: A better way than foreach with this?

2015-08-24 Thread Joel via Digitalmars-d-learn
On Monday, 24 August 2015 at 06:13:50 UTC, Jacob Carlborg wrote: On 2015-08-24 07:58, Joel wrote: auto names = Alef Bet Gimel Dalet He Vav Zayen Het Tet Yod Final_Kaf Kaf Lamed Final_Mem Mem Final_Nun Nun Samekh Ayin Final_Pe Pe Final_Tsadi Tsadi

Re: A better way than foreach with this?

2015-08-24 Thread Joel via Digitalmars-d-learn
On Monday, 24 August 2015 at 06:17:02 UTC, ted wrote: try: auto names1 = names.map!( a = replace(a, _, )); ...not sure how to do it in-place though. Joel wrote: auto names = Alef Bet Gimel Dalet He Vav Zayen Het Tet Yod Final_Kaf Kaf Lamed Final_Mem Mem Final_Nun Nun Samekh Ayin Final_Pe

User input parsing

2015-10-14 Thread Joel via Digitalmars-d-learn
Is there a fast way to get a number out of a text input? Like getting '1.5' out of 'sdaz1.5;['. Here's what I have at the moment: string processValue(string s) { string ns; foreach(c; s) {

Re: User input parsing

2015-10-14 Thread Joel via Digitalmars-d-learn
Thanks guys. I did think of regex, but I don't know how to learn it.

Re: OSX prompt limit

2015-09-08 Thread Joel via Digitalmars-d-learn
On Friday, 4 September 2015 at 03:31:40 UTC, Adam D. Ruppe wrote: 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

Re: OSX prompt limit

2015-09-08 Thread Joel via Digitalmars-d-learn
On Tuesday, 8 September 2015 at 13:20:20 UTC, Adam D. Ruppe wrote: On Tuesday, 8 September 2015 at 13:17:31 UTC, Ola Fosheim Grøstad wrote: Or just take it from the man page: https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man3/signal.3.html ah excellent. My

Re: OSX prompt limit

2015-09-08 Thread Joel via Digitalmars-d-learn
On Wednesday, 9 September 2015 at 00:44:57 UTC, via Digitalmars-d-learn wrote: On Wed, Sep 09, 2015 at 12:05:52AM +, Joel via Digitalmars-d-learn wrote: Now I get the error: What is your code calling the function? The prompt might just be too long. import terminal; void main

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: OSX prompt limit

2015-09-09 Thread Joel via Digitalmars-d-learn
On Wednesday, 9 September 2015 at 17:47:44 UTC, Adam D. Ruppe wrote: Maybe you can try gnu readline instead: extern(C) char* readline(const(char)* prompt); pragma(lib, "readline"); pragma(lib, "curses"); void main() { auto line = readline("your line: "); import std.stdio,

text wrap

2015-09-19 Thread Joel via Digitalmars-d-learn
What is simple way to wrap a string into strings? Eg from: I went for a walk and fell down a hole. To (6 max width): I went for a walk and fell down a hole.

Re: text wrap

2015-09-19 Thread Joel via Digitalmars-d-learn
On Sunday, 20 September 2015 at 00:22:17 UTC, Joel wrote: What is simple way to wrap a string into strings? Eg from: I went for a walk and fell down a hole. To (6 max width): I went for a walk and fell down a hole. Actually, I did a search and found this. import std.string.wrap;

broken program, silly error messages, dub

2015-09-18 Thread Joel via Digitalmars-d-learn
I accidentally wiped off a small source file. I've been trying to put it back together. Now I get unrelated errors. I've tried resetting dub. Joels-MacBook-Pro:DGuy joelcnz$ dub WARNING: A deprecated branch based version specification is used for the dependency dsfml:audio. Please use

Re: broken program, silly error messages, dub

2015-09-19 Thread Joel via Digitalmars-d-learn
On Saturday, 19 September 2015 at 07:24:01 UTC, ponce wrote: On Saturday, 19 September 2015 at 01:54:08 UTC, Joel wrote: I accidentally wiped off a small source file. I've been trying to put it back together. Now I get unrelated errors. I've tried resetting dub. To reset DUB state

Re: broken program, silly error messages, dub

2015-09-19 Thread Joel via Digitalmars-d-learn
On Saturday, 19 September 2015 at 08:33:05 UTC, Joel wrote: On Saturday, 19 September 2015 at 07:24:01 UTC, ponce wrote: On Saturday, 19 September 2015 at 01:54:08 UTC, Joel wrote: I accidentally wiped off a small source file. I've been trying to put it back together. Now I get unrelated

Re: text wrap

2015-09-19 Thread Joel via Digitalmars-d-learn
On Sunday, 20 September 2015 at 00:48:39 UTC, Doxin wrote: On Sunday, 20 September 2015 at 00:28:23 UTC, Doxin wrote: I'll get to work on some example code. here you go: http://dpaste.dzfl.pl/e6e715c54c1b do mind that this code has a couple issues, for example handing it a word longer than

Re: Installing DUB on OSX

2016-02-23 Thread Joel via Digitalmars-d-learn
On Saturday, 20 February 2016 at 12:01:04 UTC, Jacob Carlborg wrote: On 2016-02-20 04:21, Joel wrote: How do you do symbolic links? ln -s Replace and with the appropriate paths. I get this: Joels-MacBook-Pro:bin joelcnz$ ln -s /usr/local/bin/dub /usr/bin ln: /usr/bin/dub: Operation

Re: Installing DUB on OSX

2016-02-24 Thread Joel via Digitalmars-d-learn
On Wednesday, 24 February 2016 at 07:35:40 UTC, Jacob Carlborg wrote: On 2016-02-24 07:49, Joel wrote: I get this: Joels-MacBook-Pro:bin joelcnz$ ln -s /usr/local/bin/dub /usr/bin ln: /usr/bin/dub: Operation not permitted Joels-MacBook-Pro:bin joelcnz$ If you have OS X 10.10.x or lower

Re: Installing DUB on OSX

2016-02-24 Thread Joel via Digitalmars-d-learn
On Wednesday, 24 February 2016 at 15:16:17 UTC, Jacob Carlborg wrote: On 2016-02-24 09:09, Joel wrote: I have OS X version 10.11.3 What about adding another path to $PATH? I don't know how though. Open or create ~/.bash_profile. Add the following: export PATH=:$PATH Replace with the

Re: Installing DUB on OSX

2016-02-27 Thread Joel via Digitalmars-d-learn
On Friday, 26 February 2016 at 08:03:19 UTC, Jacob Carlborg wrote: On 2016-02-25 22:38, Joel wrote: .dub is grayed out on Finder, and isn't writable. I'm suspecting that you don't own that directory. You can see the owner by running this: ls -l -a ~/ | grep dub The third column is the

Re: Installing DUB on OSX

2016-02-28 Thread Joel via Digitalmars-d-learn
On Sunday, 28 February 2016 at 11:06:26 UTC, Jacob Carlborg wrote: On 2016-02-28 04:33, Joel wrote: Things just silently not work. Joels-MacBook-Pro:packages joelcnz$ ls -l -a ~/ | grep dub drwxr-xr-x4 joelcnz staff 136 26 Sep 12:47 .dub Joels-MacBook-Pro:packages joelcnz$ That

Re: Installing DUB on OSX

2016-02-25 Thread Joel via Digitalmars-d-learn
On Thursday, 25 February 2016 at 11:06:09 UTC, Jacob Carlborg wrote: On 2016-02-24 23:11, Joel wrote: Error: Error writing file '../../../.dub/packages/dsfml-2.1.0/libdsfml_system.a' Joels-MacBook-Pro:DGuy joelcnz$ Is the full path of ../../../.dub/packages/dsfml-2.1.0 writable? .dub is

Re: Installing DUB on OSX

2016-02-25 Thread Joel via Digitalmars-d-learn
On Thursday, 25 February 2016 at 11:06:09 UTC, Jacob Carlborg wrote: On 2016-02-24 23:11, Joel wrote: Error: Error writing file '../../../.dub/packages/dsfml-2.1.0/libdsfml_system.a' Joels-MacBook-Pro:DGuy joelcnz$ Is the full path of ../../../.dub/packages/dsfml-2.1.0 writable? It is

Installing DUB on OSX

2016-02-17 Thread Joel via Digitalmars-d-learn
I had dub installed in a folder that meant I had to put 'sudo dub' to run it. I've tried to fix the problem, but where do you put it (also I tried one place, but couldn't put it in that folder)?

Re: Installing DUB on OSX

2016-02-17 Thread Joel via Digitalmars-d-learn
On Thursday, 18 February 2016 at 07:11:23 UTC, Joel wrote: I had dub installed in a folder that meant I had to put 'sudo dub' to run it. I've tried to fix the problem, but where do you put it (also I tried one place, but couldn't put it in that folder)? I've now tried 'brew install dub' and

Re: Installing DUB on OSX

2016-02-18 Thread Joel via Digitalmars-d-learn
On Thursday, 18 February 2016 at 08:24:34 UTC, Jacob Carlborg wrote: On 2016-02-18 08:11, Joel wrote: I had dub installed in a folder that meant I had to put 'sudo dub' to run it. I've tried to fix the problem, but where do you put it (also I tried one place, but couldn't put it in that

Re: Installing DUB on OSX

2016-02-18 Thread Joel via Digitalmars-d-learn
On Thursday, 18 February 2016 at 16:33:51 UTC, John Colvin wrote: On Thursday, 18 February 2016 at 07:52:11 UTC, Joel wrote: On Thursday, 18 February 2016 at 07:11:23 UTC, Joel wrote: I had dub installed in a folder that meant I had to put 'sudo dub' to run it. I've tried to fix the problem,

Re: Installing DUB on OSX

2016-02-19 Thread Joel via Digitalmars-d-learn
On Friday, 19 February 2016 at 11:34:33 UTC, John Colvin wrote: On Thursday, 18 February 2016 at 23:28:43 UTC, Joel wrote: On Thursday, 18 February 2016 at 16:33:51 UTC, John Colvin wrote: [...] I don't think I put 'sudo brew' at any point (I can't remember). I hope I haven't broken my OSX!

Re: Installing DUB on OSX

2016-02-19 Thread Joel via Digitalmars-d-learn
On Thursday, 18 February 2016 at 08:18:20 UTC, Guillaume Piolat wrote: On Thursday, 18 February 2016 at 07:52:11 UTC, Joel wrote: On Thursday, 18 February 2016 at 07:11:23 UTC, Joel wrote: I had dub installed in a folder that meant I had to put 'sudo dub' to run it. I've tried to fix the

Re: Constructor - the both look the same

2016-03-12 Thread Joel via Digitalmars-d-learn
On Saturday, 12 March 2016 at 08:11:10 UTC, Iakh wrote: On Saturday, 12 March 2016 at 07:43:59 UTC, Joel wrote: Why does it come up with this? source/setup.d(40,16): Error: constructor inputjex.InputJex.this (Vector2!float pos, int fontSize, InputType type = cast(InputType)0) is not callable

Re: Constructor - the both look the same

2016-03-12 Thread Joel via Digitalmars-d-learn
On Saturday, 12 March 2016 at 23:43:33 UTC, Joel wrote: On Saturday, 12 March 2016 at 08:11:10 UTC, Iakh wrote: On Saturday, 12 March 2016 at 07:43:59 UTC, Joel wrote: Why does it come up with this? source/setup.d(40,16): Error: constructor inputjex.InputJex.this (Vector2!float pos, int

Constructor - the both look the same

2016-03-11 Thread Joel via Digitalmars-d-learn
Why does it come up with this? source/setup.d(40,16): Error: constructor inputjex.InputJex.this (Vector2!float pos, int fontSize, InputType type = cast(InputType)0) is not callable using argument types (Vector2!float, int, InputType) dmd failed with exit code 1.

Re: Installing DUB on OSX

2016-03-02 Thread Joel via Digitalmars-d-learn
On Sunday, 28 February 2016 at 11:06:26 UTC, Jacob Carlborg wrote: On 2016-02-28 04:33, Joel wrote: Things just silently not work. Joels-MacBook-Pro:packages joelcnz$ ls -l -a ~/ | grep dub drwxr-xr-x4 joelcnz staff 136 26 Sep 12:47 .dub Joels-MacBook-Pro:packages joelcnz$ That

Re: Installing DUB on OSX

2016-03-02 Thread Joel via Digitalmars-d-learn
On Wednesday, 2 March 2016 at 08:55:40 UTC, Jacob Carlborg wrote: On 2016-03-02 05:12, Joel wrote: Wait a minute, I get this: Build directory .dub/build/application-debug-posix.osx-x86_64-dmd_2070-2EBE4466CF46539CC1D524962E530835/ is not writable. Falling back to direct build in the system's

Re: Installing DUB on OSX

2016-03-03 Thread Joel via Digitalmars-d-learn
On Thursday, 3 March 2016 at 07:07:55 UTC, Jacob Carlborg wrote: On 2016-03-02 23:41, Joel wrote: I don't seem to have a folder 'build' there. It all seems writable. Hmm, that's really weird. I guess that's the folder it fails to write. Is it running as a different user. What if you change

Re: Print a triangle

2016-04-29 Thread Joel via Digitalmars-d-learn
On Friday, 29 April 2016 at 11:31:51 UTC, rikki cattermole wrote: Not entirely the goal I'm guessing output wise, but this works. import std.range : repeat; foreach(line; 1 .. 11) { writeln('#'.repeat(line)); } That is shorter than my foreach version, but I want one that doesn't use

Print a triangle

2016-04-29 Thread Joel via Digitalmars-d-learn
What is a quick way to print a triangle? I'm thinking without foreach, not like I have here. foreach(line; iota(1, 10 + 1)) { writeln("#".replicate(line)); } These don't work: iota(1, 10 + 1). tee!((a) => { writeln("#".replicate(a)); }); string result; iota(1, 10 + 1). tee!((a) =>

Re: Print a triangle

2016-04-29 Thread Joel via Digitalmars-d-learn
[snip] On Friday, 29 April 2016 at 13:20:47 UTC, Michael Coulombe wrote: Try this: iota(1,11).each!(a => writeln("#".replicate(a))) Yes, this is what I was looking for! It's my birthday today.

Setting a list of values

2016-04-30 Thread Joel via Digitalmars-d-learn
This has no effect: _bars.each!(a => { a._plots.fillColor = Color(255, 180, 0); }); I tried putting ..each!((ref a) =>.. with no difference This works: foreach(b; _bars) { b._plots.fillColor = Color(255, 180, 0); }

Re: How to split a string/array with multiple separators?

2016-05-14 Thread Joel via Digitalmars-d-learn
On Wednesday, 16 December 2015 at 15:27:22 UTC, Marc Schütz wrote: On Wednesday, 16 December 2015 at 14:47:26 UTC, Dragos Carp wrote: On Wednesday, 16 December 2015 at 14:18:28 UTC, Borislav Kosharov wrote: I want to split a string using multiple separators. In std.array the split function has

Re: Setting a list of values

2016-05-03 Thread Joel via Digitalmars-d-learn
On Sunday, 1 May 2016 at 05:42:00 UTC, Ali Çehreli wrote: On 04/30/2016 10:05 PM, Joel wrote: > This has no effect: > _bars.each!(a => { a._plots.fillColor = Color(255, 180, 0); }); This is a common issue especially for people who know lambdas from other languages. :) Your lambda does not do

Re: DUB and pragma lib - OSX

2016-04-20 Thread Joel via Digitalmars-d-learn
On Wednesday, 20 April 2016 at 06:16:35 UTC, rikki cattermole wrote: On 20/04/2016 5:53 PM, Joel wrote: [...] Dub does separate compilation and linking. Add them as "libs": ["readline", "curses"] for dub.json (sdl is a bit similar). Yay! Worked, thanks rikki cattermole!

DUB and pragma lib - OSX

2016-04-19 Thread Joel via Digitalmars-d-learn
How do I get this C stuff working with DUB? I tried putting the pragmas in the main source file. extern(C) char* readline(const(char)* prompt); extern(C) void add_history(const(char)* prompt); pragma(lib, "readline"); pragma(lib, "curses"); Linking... Undefined symbols for architecture

Virus detected

2016-08-15 Thread Joel via Digitalmars-d-learn
I can't install DMD, because Windows defender says the install file has a virus and wipes it off. I'm using a Windows 10 pro OS. DMD 2.071.1

Re: Virus detected

2016-08-15 Thread Joel via Digitalmars-d-learn
On Monday, 15 August 2016 at 06:28:54 UTC, rikki cattermole wrote: On 15/08/2016 6:20 PM, Joel wrote: I can't install DMD, because Windows defender says the install file has a virus and wipes it off. I'm using a Windows 10 pro OS. DMD 2.071.1 Windows Defender is fairly false positive heavy,

Calls `this(this)` extra with delegate stuff in the code

2017-01-21 Thread Joel via Digitalmars-d-learn
Compile this and see, (it's crazy!): import std.stdio; struct Widget { private int[] array; this(uint length) { array = new int[length]; } this(this) { writeln( "this(this) called" ); array = array.dup; }

Re: Get current date and time with std.datetime

2016-08-22 Thread Joel via Digitalmars-d-learn
On Friday, 1 July 2016 at 15:28:04 UTC, Zekereth wrote: On Thursday, 30 June 2016 at 21:18:22 UTC, Luke Picardo wrote: Why is it so hard to simply get the current date and time formatted properly in a string? There are no examples of this in your documentation yet this is probably one of

Re: Reinstalled Mac

2016-09-28 Thread Joel via Digitalmars-d-learn
On Wednesday, 28 September 2016 at 09:34:46 UTC, Jacob Carlborg wrote: On 2016-09-28 10:18, Joel wrote: I've got my Mac reinstalled. I haven't installed D (dmd) yet. I would like to hear what people think. I'm thinking using home brew. And install the latest Code X. You need Xcode and I

Reinstalled Mac

2016-09-28 Thread Joel via Digitalmars-d-learn
I've got my Mac reinstalled. I haven't installed D (dmd) yet. I would like to hear what people think. I'm thinking using home brew. And install the latest Code X.

Your connection is not private

2016-09-30 Thread Joel via Digitalmars-d-learn
I get this when I click Learn at the top of the screen in dlang. This is on Chrome Mac (Sierra 10.12).

pointer not aligned

2017-03-30 Thread Joel via Digitalmars-d-learn
Linking... ld: warning: pointer not aligned at address 0x10017A4C9 (_D30TypeInfo_AxS3std4file8DirEntry6__initZ + 16 from .dub/build/application-debug-posix.osx-x86_64-dmd_2072-EFDCDF4D45F944F7A9B1AEA5C32F81ED/spellit.o) ... and this goes on forever!

Re: D version of C# code

2017-04-16 Thread Joel via Digitalmars-d-learn
On Sunday, 16 April 2017 at 09:46:13 UTC, ag0aep6g wrote: On 04/16/2017 11:20 AM, Joel wrote: [...] void main() { // Arrange const string templateString = "My {pet} has {number} {ailment}."; auto pairs = [ "pet": "dog", "number": "5", "ailment": "fleas",

SFML gcc - MacOS

2017-04-15 Thread Joel via Digitalmars-d-learn
In getting DSFML (http://dsfml.com/) working. I found gcc takes for ever to install, is there some thing wrong? (I posted in https://github.com/Jebbs/DSFML, but no replies). Maybe just install Xcode CLT (some how), and uninstall gcc. I've had this problem for a while now. I would appreciate

D version of C# code

2017-04-16 Thread Joel via Digitalmars-d-learn
What would you put instead of this C# code, in D? ```C# // Arrange const string templateString = "My {pet} has {number} {ailment}."; var pairs = new { pet = "dog", number = 5, ailment = "fleas",

Re: SFML gcc - MacOS

2017-04-16 Thread Joel via Digitalmars-d-learn
On Sunday, 16 April 2017 at 07:53:49 UTC, Jacob Carlborg wrote: On 2017-04-16 03:52, Joel wrote: In getting DSFML (http://dsfml.com/) working. I found gcc takes for ever to install, is there some thing wrong? (I posted in https://github.com/Jebbs/DSFML, but no replies). Maybe just install

Re: SFML gcc - MacOS

2017-04-17 Thread Joel via Digitalmars-d-learn
On Monday, 17 April 2017 at 08:48:06 UTC, Jacob Carlborg wrote: On 2017-04-16 10:11, Joel wrote: I've got Xcode, do I enter `xcode-select --install` in the terminal? Yes. That will get you access to Clang, the linker and other tools on the command line. It will also create /usr/include

Re: 2D game physics, macOS

2017-07-12 Thread Joel via Digitalmars-d-learn
On Wednesday, 12 July 2017 at 12:05:33 UTC, Jacob Carlborg wrote: On 2017-07-12 12:18, Joel wrote: Is there a 2D physics library I can use on macOS, with D? I already use a multimedia library for graphics, sound and input. Box2D [1] perhaps. I think I've seen bindings for it, somewhere.

  1   2   3   >