Re: How to use listener.d example?

2018-09-11 Thread Marcin via Digitalmars-d-learn

On Friday, 7 September 2018 at 17:00:21 UTC, Marcin wrote:

I get it working in linux environment.

I don't know why vibe-d get linker errors on win10.


And I get it to work on windos
dub --build=release


Re: thread phobos and creating threads

2018-09-08 Thread Marcin via Digitalmars-d-learn

On Saturday, 8 September 2018 at 18:21:07 UTC, drug wrote:

On 08.09.2018 20:59, Marcin wrote:

void main()
{
snipped
}


This? https://run.dlang.io/is/SHyCXA


Thanks :)


Re: thread phobos and creating threads

2018-09-08 Thread Marcin via Digitalmars-d-learn

//Ten przyklad po prostu tworzy wątek w którym są trzy obiekty
import core.thread;
import std.stdio: write, writeln, writef, writefln;

class Sinus{
double a;
this(){writeln("No Args");}
this(double a){writeln("U give 1 argument"); 
writeln(sin(a));}
this(double[]a){writeln("U give an array"); 
foreach(double arg; a){writeln(sin(arg));}}
double sin(double argument){return 
core.stdc.math.sin(argument);}

}

void main()
{
new Thread({
auto jeden= new Sinus();
auto dwa= new Sinus(11);
auto trzy= new Sinus([1,2]);
// Codes to run in the newly created thread.
}).start();
}

Ok, Finally I've get it to work.


Re: thread phobos and creating threads

2018-09-08 Thread Marcin via Digitalmars-d-learn

https://run.dlang.io/is/PQkOfF

How to make it work?
void main()
{
import core.stdc.math : sin;
import core.thread;
import std.stdio : write, writeln, writef, writefln;

class DerivedThread : Thread
{
double d;
this()
{
super();
}

this(double a)
{
super();
this.d = sin(a);
writeln(d);
this.getD();
}

private:
void setD(double d)
{
this.d = d;
}

double getD()
{
writeln(d);
return d;
}

void run()
{
// Derived thread running.
}
}

// create and start instances of each type
auto derived = new DerivedThread(22).start().setD(11).getD();

}


Re: thread phobos and creating threads

2018-09-08 Thread Marcin via Digitalmars-d-learn

I made somthing else... it works at the moment.
https://run.dlang.io/is/KdOeRz

But i need somthing like this to work:
https://run.dlang.io/is/lGD5YQ


thread phobos and creating threads

2018-09-08 Thread Marcin via Digitalmars-d-learn

Ive got problem with https://run.dlang.io/is/4a4CJp

Why it prints 111 forever?


Re: How to use listener.d example?

2018-09-07 Thread Marcin via Digitalmars-d-learn

I get it working in linux environment.

I don't know why vibe-d get linker errors on win10.


Re: How to use listener.d example?

2018-09-04 Thread Marcin via Digitalmars-d-learn

https://drive.google.com/open?id=1Qo6BYIZjaoxL_Z0TS9-vAN4ZgbTepkcR

I've reinstalled in other location and rewrite whole example.
I still get optlink error 
http://www.digitalmars.com/ctg/optlink.html


Re: How to use listener.d example?

2018-09-04 Thread Marcin via Digitalmars-d-learn

https://drive.google.com/open?id=1hC5SZ3VWX0iQoUO7KN0S-743x6FG9ER5

I give up

Cant compile this vibe-d

Ill get back to phobos



Re: How to use listener.d example?

2018-09-04 Thread Marcin via Digitalmars-d-learn

""
Am i doing it right?

I've unpacked vibe.d-master to my "C:\D\dtwo\src"
commands in cmd:

cd C:\D\dtwo\windows\bin\
echo "vibe.d-master is a folder"
dmd -lib C:\D\dtwo\src\vibe.d-master\core\vibe\appmain.d 
C:\D\dtwo\src\vibe.d-master\http\vibe\http\server.d



no wai, Ill just paste the vibe.d-master to my code location and 
add more arguments.


dub fetch vibe-d
downloaded something
dub run vibe-d
runs something
dub test vibe-d

vibe-d:redis 0.8.4: building configuration "library"...
vibe-d:web 0.8.4: building configuration "library"...
vibe-d 0.8.4: building configuration "vibe-d-test-vibe-core"...
Linking...
Error: linker exited with status 1
C:\D\dtwo\windows\bin\dmd.exe failed with exit code 1.

still don't work



I love programming... after 37 h of tryin to force run compiler.




Re: How to use listener.d example?

2018-09-04 Thread Marcin via Digitalmars-d-learn

On Friday, 31 August 2018 at 07:38:54 UTC, Marcin wrote:

https://github.com/dlang/dmd/blob/master/samples/listener.d



Im using Notepad++ as my IDE cuz i dont have administrator 
privileges on PC

To import modules i use -I option
cmd /k  cd C:\D\dtwo\windows\bin\ & C:\D\dtwo\windows\bin\dmd.exe 
-I="$(CURRENT_DIRECTORY)" "$(FULL_CURRENT_PATH)" & 
C:\D\dtwo\windows\bin\$(NAME_PART).exe


C:\Users\wjelki\Desktop\d\aplikacja.d(2): Error: module `server` 
is in file 'vibe\http\server.d' which cannot be read

import path[0] = C:\Users\wjelki\Desktop\d\vibe.d\core
import path[1] = .\..\..\src\phobos
import path[2] = .\..\..\src\druntime\import

How to import other modules than Phobos?




How to use listener.d example?

2018-08-31 Thread Marcin via Digitalmars-d-learn

https://github.com/dlang/dmd/blob/master/samples/listener.d

Can some one add more comment to that example?

I need to make code that connects to local application, very 
similar to this.


Assumptions:
1. Create an application that listens to arguments.
2. Create an application that will send arguments to the 
application mentioned above.

3. The application will return the sine (argument) to the client.
4. All communication must be realized via console.

input:
1

1,2,3

4 5

44

Output:
"a =" 1 "sin (a) =" 0.84147

"a =" 1 "sin (a) =" 0.84147
"a =" 2 "sin (a) =" 0.9092
"a =" 3 "sin (a) =" 0.14112

"a =" 4 "sin (a) =" -0.756
"a =" 5 "sin (a) =" 0.9589

"a =" 44 "sin (a) =" 0.0177

Can some one help me write a server and client app?
I will use it to create more complicated application.