Re: Abstract attribute ?

2016-05-17 Thread Lucien via Digitalmars-d-learn
On Tuesday, 17 May 2016 at 16:58:30 UTC, Adam D. Ruppe wrote: On Tuesday, 17 May 2016 at 16:52:01 UTC, Lucien wrote: Why a attribute cannot be abstract ? Because it cannot be virtual and cannot be overridden. This is different than Python, but in line with other C-style languages (and the

Abstract attribute ?

2016-05-17 Thread Lucien via Digitalmars-d-learn
Hello, Why a attribute cannot be abstract ? How can I force the redefinition of an attribute if the class inherits from abstract class ? Example: abstract class A { // Error: variable attr cannot be abstract protected abstract int attr; } class B : A { protected override

Re: Overriding a property ?

2016-04-14 Thread Lucien via Digitalmars-d-learn
On Thursday, 14 April 2016 at 20:39:50 UTC, Steven Schveighoffer wrote: On 4/14/16 4:21 PM, Lucien wrote: How can I override a property ? Test code: class A { @property bool foo { return false; } This isn't valid, you need parentheses for foo. This doesn't

Overriding a property ?

2016-04-14 Thread Lucien via Digitalmars-d-learn
How can I override a property ? Test code: class A { @property bool foo { return false; } void myFunc() { ... } } class B : A { override bool foo { return true; } // error override void myFunc() { ... } } Output error:

Re: Set cursor position in a file

2016-04-10 Thread Lucien via Digitalmars-d-learn
On Sunday, 10 April 2016 at 16:46:02 UTC, deed wrote: On Sunday, 10 April 2016 at 16:19:51 UTC, Lucien wrote: Hello, Is there the possibility to set the cursor position in a file ? Example: void main() { File myFile = File("myFile.txt"); showFile(myFile); // set

Set cursor position in a file

2016-04-10 Thread Lucien via Digitalmars-d-learn
Hello, Is there the possibility to set the cursor position in a file ? Example: void main() { File myFile = File("myFile.txt"); showFile(myFile); // set cursor pos to 0 showFile(myFile); } void showFile(File f) { while (!f.eof()) { write(f.readln()); }

Re: foreach of classes

2016-04-09 Thread Lucien via Digitalmars-d-learn
On Saturday, 9 April 2016 at 10:28:05 UTC, Basile B. wrote: On Saturday, 9 April 2016 at 10:10:19 UTC, Lucien wrote: Hello. When I do: - class MyClass{..} class YourClass{..} class OurClass{..} YourClass yc = new YourClass(); foreach (auto id; [ typeid(MyClass),

foreach of classes

2016-04-09 Thread Lucien via Digitalmars-d-learn
Hello. When I do: - class MyClass{..} class YourClass{..} class OurClass{..} YourClass yc = new YourClass(); foreach (auto id; [ typeid(MyClass), typeid(YourClass), typeid(OurClass) ]) { if (typeid(yc) == id) { writeln("It works !"); } } -

Re: Checking if a port is listening

2016-03-26 Thread Lucien via Digitalmars-d-learn
On Wednesday, 16 March 2016 at 20:44:12 UTC, Lucien wrote: Hello, I want to know if a port of an ip address is listening, actually, I've this : http://pastebin.com/pZhm0ujy (checking port 22/ssh) It works, but it took me ~10min to scan 30 addresses. How can reduce the expiration delay ?

Re: Checking if a port is listening

2016-03-24 Thread Lucien via Digitalmars-d-learn
On Thursday, 24 March 2016 at 12:17:35 UTC, Marc Schütz wrote: On Wednesday, 23 March 2016 at 21:37:09 UTC, Lucien wrote: When I remove the Thread.sleep, it doesn't find all adresses. Why ? Socket.select() will wait _at most_ 100 msecs. If a socket gets ready before that timeout, it will

Re: Checking if a port is listening

2016-03-23 Thread Lucien via Digitalmars-d-learn
On Saturday, 19 March 2016 at 18:24:38 UTC, Marc Schütz wrote: On Saturday, 19 March 2016 at 09:55:13 UTC, Lucien wrote: const int MAX = 64; Socket[] sockets = new Socket[MAX]; string ipb = "192.168.0."; for (int i = 1; i < MAX; i++) { Here's the reason for your SEGV: You

Re: Checking if a port is listening

2016-03-19 Thread Lucien via Digitalmars-d-learn
On Saturday, 19 March 2016 at 18:24:38 UTC, Marc Schütz wrote: On Saturday, 19 March 2016 at 09:55:13 UTC, Lucien wrote: const int MAX = 64; Socket[] sockets = new Socket[MAX]; string ipb = "192.168.0."; for (int i = 1; i < MAX; i++) { Here's the reason for your SEGV: You

Checking if a port is listening

2016-03-19 Thread Lucien via Digitalmars-d-learn
Hello, I want to know if a port of an ip address is listening, actually, I've this : http://pastebin.com/pZhm0ujy (checking port 22/ssh) It works, but it took me ~10min to scan 30 addresses. How can reduce the expiration delay ?

Re: Checking if a port is listening

2016-03-19 Thread Lucien via Digitalmars-d-learn
On Friday, 18 March 2016 at 09:50:12 UTC, Marc Schütz wrote: Looking at an strace of nmap, it seems it opens a bunch of sockets, puts them into non-blocking mode, calls connect on them (which will return EINPROGRESS), and then uses select(2) to wait for them (in a loop, until all have either

Re: Checking if a port is listening

2016-03-19 Thread Lucien via Digitalmars-d-learn
On Wednesday, 16 March 2016 at 22:22:15 UTC, Anonymouse wrote: On Wednesday, 16 March 2016 at 20:44:12 UTC, Lucien wrote: Hello, I want to know if a port of an ip address is listening, actually, I've this : http://pastebin.com/pZhm0ujy (checking port 22/ssh) It works, but it took me ~10min

Re: Derelict SFML2 - structs are forward referenced

2015-12-26 Thread Lucien via Digitalmars-d-learn
On Saturday, 26 December 2015 at 10:39:29 UTC, Rene Zwanenburg wrote: On Saturday, 26 December 2015 at 09:48:29 UTC, Lucien wrote: Hello. I want to use Derelict-SFML2 to create a simple window. But when I compile (linked with dub and derelict-util), I have the following error:

Derelict SFML2 - structs are forward referenced

2015-12-26 Thread Lucien via Digitalmars-d-learn
Hello. I want to use Derelict-SFML2 to create a simple window. But when I compile (linked with dub and derelict-util), I have the following error: src/app.d(30,20): Error: variable myproject.main.window no definition of struct sfRenderWindow

Re: Derelict SFML2 - structs are forward referenced

2015-12-26 Thread Lucien via Digitalmars-d-learn
On Saturday, 26 December 2015 at 12:47:51 UTC, drug wrote: You have old version of libcsfml that lacks of symbol sfJoystick_getIdentification. Try another version, may be build it from sources to have the newest one. Indeed, the sfml library in the ubuntu repository isn't up-to-date.

Re: Must I compile on the target architecture?

2015-12-25 Thread Lucien via Digitalmars-d-learn
On Friday, 25 December 2015 at 12:43:05 UTC, Jakob Jenkov wrote: Hi, just a quick question: If I write a program in D and I use Windows for development but want it to run on Linux, do I have to copy the source code to the target Linux machine and compile it there, to make an executable for

Re: [DerelictSDL] SDL_RenderCopy does not accept optional arguements when written in a file aside from main

2015-12-24 Thread Lucien via Digitalmars-d-learn
On Thursday, 24 December 2015 at 09:41:39 UTC, Jack wrote: So I have separated my texture rendering methods in another file and have run into a problem hence the title name. #main.d -- void render() { SDL_RenderClear(renderTarget); renderSprite(renderTarget);

Re: [DerelictSDL] SDL_RenderCopy does not accept optional arguements when written in a file aside from main

2015-12-24 Thread Lucien via Digitalmars-d-learn
On Thursday, 24 December 2015 at 11:32:24 UTC, Jack wrote: On Thursday, 24 December 2015 at 10:42:57 UTC, Lucien wrote: On Thursday, 24 December 2015 at 09:41:39 UTC, Jack wrote: [...] You need a pointer to renderTarget. #other_file.d - module my.sdl.project; import