Re: How to correct share data between threads?

2016-11-20 Thread Konstantin Kutsevalov via Digitalmars-d-learn
On Saturday, 19 November 2016 at 19:04:12 UTC, Nicolas Gurrola wrote: On Saturday, 19 November 2016 at 17:29:30 UTC, Konstantin Kutsevalov wrote: I need to receiving data in main thread and send its to other thread for processing. There is a simple (but wrong) code for example. What need I to

How to correct share data between threads?

2016-11-19 Thread Konstantin Kutsevalov via Digitalmars-d-learn
I need to receiving data in main thread and send its to other thread for processing. There is a simple (but wrong) code for example. What need I to change to make it correct? ``` import std.stdio, std.string, std.array, core.thread, std.datetime, std.conv; int main() { Pumpurum pp

Re: Correct way to create singleton?

2016-11-10 Thread Konstantin Kutsevalov via Digitalmars-d-learn
On Thursday, 10 November 2016 at 17:22:48 UTC, Anonymouse wrote: On Thursday, 10 November 2016 at 17:17:51 UTC, Konstantin Kutsevalov wrote: Hi, what is a correct (and simple) way to create an singleton? https://wiki.dlang.org/Low-Lock_Singleton_Pattern great!

Correct way to create singleton?

2016-11-10 Thread Konstantin Kutsevalov via Digitalmars-d-learn
Hi, what is a correct (and simple) way to create an singleton? This is how I see that now: ``` class ApMessageRouter { static ApMessageRouter instance = null; private this() { } // for disable constructor to use from outside

Re: Question about dsfml.system.err

2016-11-08 Thread Konstantin Kutsevalov via Digitalmars-d-learn
On Tuesday, 8 November 2016 at 19:00:15 UTC, Steven Schveighoffer wrote: On 11/8/16 11:48 AM, Konstantin Kutsevalov wrote: On Tuesday, 8 November 2016 at 16:34:04 UTC, Konstantin Kutsevalov wrote: ADD: I tried to open other stream in main() ``` ... import dsfml.system.err; int main(string[]

Re: Question about dsfml.system.err

2016-11-08 Thread Konstantin Kutsevalov via Digitalmars-d-learn
On Tuesday, 8 November 2016 at 16:34:04 UTC, Konstantin Kutsevalov wrote: ADD: I tried to open other stream in main() ``` ... import dsfml.system.err; int main(string[] args) { err.open("errors.log", "a"); err.write("test\n"); } ... ``` but as can I see, that hasn't

Re: Question about dsfml.system.err

2016-11-08 Thread Konstantin Kutsevalov via Digitalmars-d-learn
ADD: I tried to open other stream in main() ``` ... import dsfml.system.err; int main(string[] args) { err.open("errors.log", "a"); err.write("test\n"); } ... ``` but as can I see, that hasn't any effect for tcplistener module...

Question about dsfml.system.err

2016-11-08 Thread Konstantin Kutsevalov via Digitalmars-d-learn
I need to see errors from dsfml.system.err, but it doesn't write to terminal as I expected. The general problem is that I cannot listen any port by tcplistener. And listen method is: Status accept(TcpSocket socket) { import dsfml.system.string;

Re: Thread (spawn) for object's method

2016-11-08 Thread Konstantin Kutsevalov via Digitalmars-d-learn
On Tuesday, 8 November 2016 at 06:40:32 UTC, Basile B. wrote: On Monday, 7 November 2016 at 16:15:44 UTC, Konstantin Kutsevalov wrote: Is there a way to make new thread for class method? E.g. I have some class and I need to run one of them method in new thread. I found wxamples only with

Thread (spawn) for object's method

2016-11-07 Thread Konstantin Kutsevalov via Digitalmars-d-learn
Is there a way to make new thread for class method? E.g. I have some class and I need to run one of them method in new thread. I found wxamples only with function...

Re: system's "kill " signal

2016-11-07 Thread Konstantin Kutsevalov via Digitalmars-d-learn
On Saturday, 5 November 2016 at 06:17:51 UTC, Basile B. wrote: On Saturday, 5 November 2016 at 02:24:00 UTC, Konstantin Kutsevalov wrote: Hi, is there a way to catch system signal of "kill" command or "shutdown"? During the Run-time: You can register a signal callback,

Re: system's "kill " signal

2016-11-07 Thread Konstantin Kutsevalov via Digitalmars-d-learn
On Sunday, 6 November 2016 at 16:05:44 UTC, Konstantin Kutsevalov wrote: On Saturday, 5 November 2016 at 07:52:53 UTC, Basile B. wrote: On Saturday, 5 November 2016 at 06:17:51 UTC, Basile B. wrote: 3rd option, from my Windows times I remember that people tend to use launchers to handle the

Re: system's "kill " signal

2016-11-07 Thread Konstantin Kutsevalov via Digitalmars-d-learn
On Saturday, 5 November 2016 at 07:52:53 UTC, Basile B. wrote: On Saturday, 5 November 2016 at 06:17:51 UTC, Basile B. wrote: 3rd option, from my Windows times I remember that people tend to use launchers to handle the real application, i.e a process that launches the main process. Then the

Re: is there "this"?

2016-11-04 Thread Konstantin Kutsevalov via Digitalmars-d-learn
On Thursday, 3 November 2016 at 13:40:11 UTC, Steven Schveighoffer wrote: On 11/2/16 4:43 AM, Jonathan M Davis via Digitalmars-d-learn In the case of the original post, however, you *need* to use this.value, as the parameter masks the member of the same name. Using 'this' removes ambiguity.

system's "kill " signal

2016-11-04 Thread Konstantin Kutsevalov via Digitalmars-d-learn
Hi, is there a way to catch system signal of "kill" command or "shutdown"? PS: are there some other ways also to send signals to running a D application?

Re: is there "this"?

2016-11-01 Thread Konstantin Kutsevalov via Digitalmars-d-learn
On Wednesday, 2 November 2016 at 02:33:10 UTC, Konstantin Kutsevalov wrote: On Wednesday, 2 November 2016 at 02:20:43 UTC, rikki cattermole wrote: On 02/11/2016 3:17 PM, Konstantin Kutsevalov wrote: The question is simple. Is there something like "this" word for classes? For example: ```

Re: is there "this"?

2016-11-01 Thread Konstantin Kutsevalov via Digitalmars-d-learn
On Wednesday, 2 November 2016 at 02:20:43 UTC, rikki cattermole wrote: On 02/11/2016 3:17 PM, Konstantin Kutsevalov wrote: The question is simple. Is there something like "this" word for classes? For example: ``` class CLS { int numberValue; public this(numberValue) {

is there "this"?

2016-11-01 Thread Konstantin Kutsevalov via Digitalmars-d-learn
The question is simple. Is there something like "this" word for classes? For example: ``` class CLS { int numberValue; public this(numberValue) { // how can I put the local numberValue to class property? // in some prog language I can do like: //

Re: Easy sockets - don't exist yet?

2016-10-10 Thread Konstantin Kutsevalov via Digitalmars-d-learn
On Monday, 10 October 2016 at 07:37:48 UTC, Bauss wrote: Wrote some pretty simple sockets that you could use (Based on vibe.d though.) https://github.com/bausshf/cheetah Hi, Yes I saw it, but not sure. Does it make sense to use vibe.d only for sockets. I mean, it like a web framework with

Re: Easy sockets - don't exist yet?

2016-10-10 Thread Konstantin Kutsevalov via Digitalmars-d-learn
On Monday, 10 October 2016 at 02:54:09 UTC, Jonathan M Davis wrote: On Monday, October 10, 2016 01:43:54 Konstantin Kutsevalov via So, it's simply gone. But if someone wants to propose a replacement, they're certainly still free to do so. - Jonathan M Davis I see, thank you for answer

Re: Easy sockets - don't exist yet?

2016-10-09 Thread Konstantin Kutsevalov via Digitalmars-d-learn
On Monday, 26 September 2016 at 23:40:10 UTC, Vincent wrote: Hello, guys! I was very surprised that module 'socketstream' was deprecated. Usually if something become obsolete, there is some perfect replacement! But my digging in Inet and forums gave nothing, but "outdated" examples with

Re: How to get a screenshot?

2016-09-25 Thread Konstantin Kutsevalov via Digitalmars-d-learn
This is example: ``` import std.stdio; import gtk.Main; import gtk.MainWindow; import gtk.VBox, gtk.Label, gtk.Button; import gdk.Gdk; import gdk.Window; import gdk.Pixbuf; private import stdlib = core.stdc.stdlib : exit; int main(string[] args) { Main.init(args); new

Re: How to get a screenshot?

2016-09-25 Thread Konstantin Kutsevalov via Digitalmars-d-learn
On Thursday, 22 September 2016 at 16:09:23 UTC, Antonio Corbi wrote: Ok, took the time to translate it to D and created a github repo to clone. You can download and try it from: https://github.com/antoniocorbibellot/dsshot Hope It helps you. Antonio Hey! It really works!

Re: How to get a screenshot?

2016-09-22 Thread Konstantin Kutsevalov via Digitalmars-d-learn
On Thursday, 22 September 2016 at 16:09:23 UTC, Antonio Corbi wrote: On Thursday, 22 September 2016 at 07:50:07 UTC, Antonio Corbi wrote: Ok, took the time to translate it to D and created a github repo to clone. You can download and try it from: https://github.com/antoniocorbibellot/dsshot

Re: How to get a screenshot?

2016-09-21 Thread Konstantin Kutsevalov via Digitalmars-d-learn
On Wednesday, 21 September 2016 at 16:36:32 UTC, Adam D. Ruppe wrote: On Wednesday, 21 September 2016 at 16:33:58 UTC, Konstantin Kutsevalov wrote: do anybody know how to get screenshot (for now in Linux only)? May be some library , examples? simplest might be to just call out to

How to get a screenshot?

2016-09-21 Thread Konstantin Kutsevalov via Digitalmars-d-learn
Hello everyone, do anybody know how to get screenshot (for now in Linux only)? May be some library , examples?

Re: How to call one static method from another?

2016-06-14 Thread Konstantin Kutsevalov via Digitalmars-d-learn
On Tuesday, 14 June 2016 at 07:35:36 UTC, Andrea Fontana wrote: On Tuesday, 14 June 2016 at 07:20:47 UTC, Konstantin Kutsevalov wrote: May be my question was not enought clean... this is example of code: ``` class ClassName { public static void function method1() { // do

Re: How to call one static method from another?

2016-06-14 Thread Konstantin Kutsevalov via Digitalmars-d-learn
May be my question was not enought clean... this is example of code: ``` class ClassName { public static void function method1() { // do something // and now I need to call other static method ClassName.method2(); // What I can use insted of full class name?

How to call one static method from another?

2016-06-14 Thread Konstantin Kutsevalov via Digitalmars-d-learn
Hi, Just can't found information about "this" for static methods. Can anyone explain how to call current class from static methods? For example I have some class and I need to call some static method of current class from another static method. I don't like to use full class name for that,