write multiple lines without "\n" with writeln

2014-11-20 Thread Suliman via Digitalmars-d-learn
In dco source code I have found: void ShowUsage() { writeln(" dco build tool " ~ strVersion ~ " written by FrankLIKE. Usage: dco [] for example: dco or: dco app.d build for dfl2: dco } I do not see here any "\n". Why this code is output all one by line, and not in single line? Why my co

Compiler error with slices, .dup and ref Parameter

2014-11-20 Thread anynomous via Digitalmars-d-learn
module a; void init (ref string[] argv) { } void main(string[] args) { init(args); //ok auto y = args[1..$]; init(y); //ok auto x = args.dup; init(x); //ok init(args[1..$]); // Error:

Re: Compiler error with slices, .dup and ref Parameter

2014-11-20 Thread Ali Çehreli via Digitalmars-d-learn
On 11/20/2014 12:37 AM, anynomous wrote: > module a; > > void init (ref string[] argv) { } > > void main(string[] args) { > init(args); //ok > auto y = args[1..$]; > init(y); //ok > auto x = args.dup; > init(x); //ok > init(args

Re: write multiple lines without "\n" with writeln

2014-11-20 Thread uri via Digitalmars-d-learn
On Thursday, 20 November 2014 at 08:28:11 UTC, Suliman wrote: In dco source code I have found: void ShowUsage() { writeln(" dco build tool " ~ strVersion ~ " written by FrankLIKE. Usage: dco [] for example: dco or: dco app.d build for dfl2: dco } I do not see here any "\n". Why this code

Re: write multiple lines without "\n" with writeln

2014-11-20 Thread bearophile via Digitalmars-d-learn
uri: It's by design And it's a nice handy design. Bye, bearophile

dco how to specify Jpath?

2014-11-20 Thread Suliman via Digitalmars-d-learn
I am playing with dco. And it's look very helpful for tiny projects. I can't understand is it's possible to add to dco.ini Jpath? I am talking about something like: dflags=-JD:\code\d\App1\source\ but when I am trying to compile code with dco it's can't find import. I looked at source code and

Re: Compiler error with slices, .dup and ref Parameter

2014-11-20 Thread bearophile via Digitalmars-d-learn
Ali Çehreli: > The error messages are strange anyway. Agreed. In the case of assignment to rvalue, dmd is better: a + b = 42; // Error: a + b is not an lvalue The error messages in the OP case can and should be improved. I suggest to take a look in Bugzilla to see if there's already an

Re: write multiple lines without "\n" with writeln

2014-11-20 Thread Suliman via Digitalmars-d-learn
I understand it. I expect what concatenation symbol will stay new line in new line and not append it's to current: writeln( "first string" "second" ~ "string" ); I expect: first string second" string" but not: first stringsecondstring

Re: help

2014-11-20 Thread Mike Parker via Digitalmars-d-learn
On 11/20/2014 3:38 PM, michael via Digitalmars-d-learn wrote: Hello All: when i am using std.net.curl to download a file that dosent exist on ftp sever,my code will get an execption like this " ‍std.net.curl.CurlException@std\net\curl.d(3605

Re: write multiple lines without "\n" with writeln

2014-11-20 Thread bearophile via Digitalmars-d-learn
Suliman: I understand it. I expect what concatenation symbol will stay new line in new line and not append it's to current: writeln( "first string" "second" ~ "string" ); I expect: first string second" string" but not: first stringsecondstring If

Re: write multiple lines without "\n" with writeln

2014-11-20 Thread uri via Digitalmars-d-learn
On Thursday, 20 November 2014 at 10:41:24 UTC, bearophile wrote: uri: It's by design And it's a nice handy design. Bye, bearophile For Wysiwyg strings I agree that it's great but I prefer C/C++/Python like behaviour for double quoted strings. I guess it's what I'm used to :) Cheers,

Re: Compiler error with slices, .dup and ref Parameter

2014-11-20 Thread anonymous via Digitalmars-d-learn
On Thursday, 20 November 2014 at 09:20:34 UTC, Ali Çehreli wrote: Judging from the name init(), I don't think you need ref anyway. thanks for the explanation. I can't remove the ref because it is Main.init in gtkd. A simple solution is init(args) I just tried to remove a non-GTK argument (a

Re: write multiple lines without "\n" with writeln

2014-11-20 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 20 November 2014 at 11:08:24 UTC, Suliman wrote: writeln( "first string" "second" ~ "string" ); I expect: first string second" string" There's no quoted newline there. You could do: writeln( "first string second string"); with the newlines

print yyyy-mm-dd

2014-11-20 Thread Suliman via Digitalmars-d-learn
I can't understand how to get date in format -MM-dd from Clock.currTime auto time = Clock.currTime; And what next? Could anybody give any examples?

Re: Compiler error with slices, .dup and ref Parameter

2014-11-20 Thread Steven Schveighoffer via Digitalmars-d-learn
On 11/20/14 7:28 AM, anonymous wrote: On Thursday, 20 November 2014 at 09:20:34 UTC, Ali Çehreli wrote: Judging from the name init(), I don't think you need ref anyway. thanks for the explanation. I can't remove the ref because it is Main.init in gtkd. A simple solution is init(args) I just tr

Re: TKd handling of custom events

2014-11-20 Thread univacc via Digitalmars-d-learn
On Wednesday, 19 November 2014 at 23:44:00 UTC, univacc wrote: Hello, I am using TKd to dray my linux/windows app which works very good! I would like to add a global Hotkey to my program via the Win32 API function RegisterGlobalHotkey. Is there a possibility to access Tk's event loop so that

Clock.currTime

2014-11-20 Thread Kent via Digitalmars-d-learn
I am reading the book 《D Cookbook》 In Page 36,this code can't be complied: auto filtered = filter!((a) => Clock.currTime() - a.timeLastModified >> 14.days)(sorted); "sorted"'s type is DirEntry[]. The errors : Error 1 Error: 'currTime(cast(immutable(TimeZone))opCall()).opBinary(a.timeLa

Re: Clock.currTime

2014-11-20 Thread bearophile via Digitalmars-d-learn
Kent: I am reading the book 《D Cookbook》 In Page 36,this code can't be complied: auto filtered = filter!((a) => Clock.currTime() - a.timeLastModified >> 14.days)(sorted); Perhaps: mySorted.filter!(a => Clock.currTime - a.timeLastModified > 14.days); Bye, bearophile

Re: Clock.currTime

2014-11-20 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 20 November 2014 at 15:33:37 UTC, Kent wrote: mySorted.filter!(a => Clock.currTime - a.timeLastModified > 14.days); Thank you for your reply. But it still doesn't work. Are you sure you saw the important difference? There was a >> in the first post and it should be >. There's

Re: Clock.currTime

2014-11-20 Thread Kent via Digitalmars-d-learn
On Thursday, 20 November 2014 at 15:31:28 UTC, bearophile wrote: Kent: I am reading the book 《D Cookbook》 In Page 36,this code can't be complied: auto filtered = filter!((a) => Clock.currTime() - a.timeLastModified >> 14.days)(sorted); Perhaps: mySorted.filter!(a => Clock.currTime - a.time

Re: Clock.currTime

2014-11-20 Thread Kent via Digitalmars-d-learn
On Thursday, 20 November 2014 at 15:38:10 UTC, Adam D. Ruppe wrote: On Thursday, 20 November 2014 at 15:33:37 UTC, Kent wrote: mySorted.filter!(a => Clock.currTime - a.timeLastModified > 14.days); Thank you for your reply. But it still doesn't work. Are you sure you saw the important differe

Re: Clock.currTime

2014-11-20 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 20 November 2014 at 15:45:55 UTC, Kent wrote: foreach(file; filtered.take!(10)) Oh, there shouldn't be a ! there either. Should be take(10), not take!(10). That's my mistake too... writeln(fiel.name); also file is misspelled.

Re: Clock.currTime

2014-11-20 Thread Kent via Digitalmars-d-learn
On Thursday, 20 November 2014 at 15:56:34 UTC, Adam D. Ruppe wrote: On Thursday, 20 November 2014 at 15:45:55 UTC, Kent wrote: foreach(file; filtered.take!(10)) Oh, there shouldn't be a ! there either. Should be take(10), not take!(10). That's my mistake too... writeln(fiel.name

Re: help

2014-11-20 Thread MachineCode via Digitalmars-d-learn
On Thursday, 20 November 2014 at 07:25:45 UTC, Suliman wrote: You need to check if remote file exist of server and only after it download шею is this software name written in russian language?

Re: write multiple lines without "\n" with writeln

2014-11-20 Thread Ary Borenszweig via Digitalmars-d-learn
On 11/20/14, 9:05 AM, uri wrote: On Thursday, 20 November 2014 at 10:41:24 UTC, bearophile wrote: uri: It's by design And it's a nice handy design. Bye, bearophile For Wysiwyg strings I agree that it's great but I prefer C/C++/Python like behaviour for double quoted strings. I guess it's

Re: TKd handling of custom events

2014-11-20 Thread Gary Willoughby via Digitalmars-d-learn
On Wednesday, 19 November 2014 at 23:44:00 UTC, univacc wrote: Hello, I am using TKd to dray my linux/windows app which works very good! I would like to add a global Hotkey to my program via the Win32 API function RegisterGlobalHotkey. Is there a possibility to access Tk's event loop so that

Re: Compiler error with slices, .dup and ref Parameter

2014-11-20 Thread Ali Çehreli via Digitalmars-d-learn
On 11/20/2014 02:49 AM, bearophile wrote: > in Bugzilla to see if there's already an ER Yep, existing ER: https://issues.dlang.org/show_bug.cgi?id=11529 Ali

Question about Vectors

2014-11-20 Thread Charles via Digitalmars-d-learn
So I was reading the documentation page: http://dlang.org/simd.html and noticed what appears to be a typo: int4 v; (cast(int*)&v)[3] = 2; // set 3rd element of the 4 int vector (cast(int[4])v)[3] = 2; // set 3rd element of the 4 int vector v.array[3] = 2; // set 3rd element of the 4

Re: help

2014-11-20 Thread MrSmith via Digitalmars-d-learn
On Thursday, 20 November 2014 at 16:48:29 UTC, MachineCode wrote: On Thursday, 20 November 2014 at 07:25:45 UTC, Suliman wrote: You need to check if remote file exist of server and only after it download шею is this software name written in russian language? "шею" means "it." on russian keyb

Re: print yyyy-mm-dd

2014-11-20 Thread MrSmith via Digitalmars-d-learn
On Thursday, 20 November 2014 at 13:50:49 UTC, Suliman wrote: I can't understand how to get date in format -MM-dd from Clock.currTime auto time = Clock.currTime; And what next? Could anybody give any examples? http://dpaste.dzfl.pl/73c0438f9d1e currTime returns SysTime; You can then cast

Re: Dub / Derelict confusion

2014-11-20 Thread Paul via Digitalmars-d-learn
On Wednesday, 19 November 2014 at 10:07:56 UTC, Mike Parker wrote: On 11/19/2014 6:12 PM, Paul wrote: I would like to create a simple program using SDL. I've read this page http://dblog.aldacron.net/derelict-help/using-derelict/ and this one http://code.dlang.org/about and decided that using 'd

Operator Overloading in an Abstract Base Class

2014-11-20 Thread Nordlöw
In my module symbolic.d at https://github.com/nordlow/justd/blob/master/symbolic.d is it somehow possible to overload binary operator ~ on pairs of instances SPatt? I'm asking because my current try at https://github.com/nordlow/justd/blob/master/symbolic.d#L332 is not called in the unittes

Re: Operator Overloading in an Abstract Base Class

2014-11-20 Thread Nordlöw
On Thursday, 20 November 2014 at 22:10:28 UTC, Nordlöw wrote: In my module symbolic.d at https://github.com/nordlow/justd/blob/master/symbolic.d is it somehow possible to overload binary operator ~ on pairs of instances SPatt? As usual I had done a couple of mistakes...which are solved know

Re: print yyyy-mm-dd

2014-11-20 Thread uri via Digitalmars-d-learn
On Thursday, 20 November 2014 at 20:38:08 UTC, MrSmith wrote: On Thursday, 20 November 2014 at 13:50:49 UTC, Suliman wrote: I can't understand how to get date in format -MM-dd from Clock.currTime auto time = Clock.currTime; And what next? Could anybody give any examples? http://dpaste.dz

Re: Operator Overloading in an Abstract Base Class

2014-11-20 Thread Ali Çehreli via Digitalmars-d-learn
On 11/20/2014 02:18 PM, "Nordlöw" wrote: On Thursday, 20 November 2014 at 22:10:28 UTC, Nordlöw wrote: In my module symbolic.d at https://github.com/nordlow/justd/blob/master/symbolic.d is it somehow possible to overload binary operator ~ on pairs of instances SPatt? As usual I had done a co

Re: Operator Overloading in an Abstract Base Class

2014-11-20 Thread IgorStepanov via Digitalmars-d-learn
On Thursday, 20 November 2014 at 22:10:28 UTC, Nordlöw wrote: In my module symbolic.d at https://github.com/nordlow/justd/blob/master/symbolic.d is it somehow possible to overload binary operator ~ on pairs of instances SPatt? I'm asking because my current try at https://github.com/nordlow/

Re: Dub / Derelict confusion

2014-11-20 Thread Mike Parker via Digitalmars-d-learn
On 11/21/2014 5:57 AM, Paul wrote: This is a tad off topic now but I'm struggling to get a window on screen as SDL_CreateWindow is failing, here's what I've got: try{ DerelictSDL2.load(); }catch(Exception e){ writeln("Failed to load DerelictSDL2 :( %s", e.msg); return; } Befor

Re: Dub / Derelict confusion

2014-11-20 Thread Mike Parker via Digitalmars-d-learn
On 11/21/2014 10:22 AM, Mike Parker wrote: You are adding anything You /aren't/