Is Apple LLVM 6 compatible with LDC

2014-10-28 Thread JJDuck via Digitalmars-d-learn
I'm trying to compile my D code using LDC and hopefully used by 
my iOS program in Xcode.


So I did some research
(correct me if I'm wrong)
If I compile my D code using LDC into static file and used by my 
iOS app and since they have the same compiler backend, are they 
binary compatible?


If it is binary compatible, should I still build some C header 
file so it can be called by iOS?


XCode's compiler seems to keep evolving into their next stage, so 
I'm not sure if I'm conceptually correct.


THanks


Fail to compile phobos

2014-09-25 Thread JJDuck via Digitalmars-d-learn
I tried to compile phobos according to the last paragraph in this 
page:

http://dlang.org/dmd-linux.html

but this is the error I have
fatal: Not a git repository (or any of the parent directories): 
.git



I dont know what happened, i have tried for a few days.

BTW, should I place my dmd2 folder at ~ or /usr/local/share. 
which will have less prblem in installing and maintaining?


Thanks


Re: httpS post fail at tango

2014-06-26 Thread JJDuck via Digitalmars-d-learn

On Thursday, 26 June 2014 at 16:33:57 UTC, JJDuck wrote:


I tried to use phobos , but there is no such function exists for 
posting to https too




httpS post fail at tango

2014-06-26 Thread JJDuck via Digitalmars-d-learn

I use Tango's example from
http://www.dsource.org/projects/tango/docs/stable/

// open a web-page for posting (see HttpGet for simple reading)
auto post = new HttpPost ("http://yourhost/yourpath";);

// send, retrieve and display response
Cout (cast(char[]) post.write("posted data", "text/plain"));


but it cannot post to a http's' address.

Can anyone advise me, i cannot find any other information online.

Thanks


Re: Tango Server Example

2014-06-19 Thread JJDuck via Digitalmars-d-learn

I solved it.

void main()
{
const int port = 8080;

auto server = new ServerSocket (new IPv4Address(port));
Cout("server started").flush;
while (true )
{
// wait for requests
auto request = server.accept;
// write a response
//


// start server in a separate thread, and wait for it to start
(new Thread (
{
// do lots of things here or add some functions for 
processing
request.output.write ("server replies 'hello'");
  
request.close;
})).start;


}
}


Re: Tango Server Example

2014-06-19 Thread JJDuck via Digitalmars-d-learn
I modify the server program as follow and it works ok. But how do 
I use thread to expedite the execution?


void main()
{
const int port = 8080;

auto server = new ServerSocket (new IPv4Address(port));
Cout("server started");
while (true )
{
// wait for requests
auto request = server.accept;
// write a response
request.output.write ("server replies 'hello'");  
request.close;
}
}


Tango Server Example

2014-06-19 Thread JJDuck via Digitalmars-d-learn

reference:
Tango Server:
http://www.dsource.org/projects/tango/wiki/SocketServerExample
Tango Client:
http://www.dsource.org/projects/tango/wiki/SocketHelloExample

I'm referring to these two examples.
In the server Example, I strip off the client part and it becomes 
as follow.


void main()
{
const int port = 8080;

// thread body for socket-listener
void run()
{
auto server = new ServerSocket (new IPv4Address(port));

// wait for requests
auto request = server.accept;

// write a response
request.output.write ("server replies 'hello'");  

}

Cout("server started");
while (true )
{
// start server in a separate thread, and wait for it to start  

(new Thread (&run)).start;
tango.core.Thread.thread_sleep (0.250);
}

}

Situation:

I have my server running and I open a client in another cmd 
console window and it replied alright. But if I try to connect it 
again second time, it freezes.


Why is that? I thought the server is constantly receiving 
messages and replying,  why would it freeze up and stop 
responding? what went wrong?


please advise.

Thanks


Example of filtering a Linked List that hold a custom class (Tango)

2014-06-05 Thread JJDuck via Digitalmars-d-learn
let say I have a Linked List(tango) that holds custom class and 
how do I filter the LinkedList to extract the items that I want 
according to a particular field (a integer field) from my custom 
class?


Is it easier to do it using phobos' Array?
If it does, care to have an example on Phobos too?

Thanks a lot


how to port to COM+ server on windows

2014-06-02 Thread JJDuck via Digitalmars-d-learn

Hello all,

Since D is COM compatible. How do I port my dll or lib or obj to 
Windows' COM+ Server? it will be great if it can be done.


Thanks


Re: installing Mango with DMD instead of ldc

2014-06-02 Thread JJDuck via Digitalmars-d-learn
I tried to compile it with dmd and there are some problem with D1 
code, so I will try to port it to D2. I will post the result if I 
can successfully port it.


Re: installing Mango with DMD instead of ldc

2014-05-26 Thread JJDuck via Digitalmars-d-learn

On Monday, 26 May 2014 at 15:41:03 UTC, bioinfornatics wrote:

On Monday, 26 May 2014 at 15:33:45 UTC, JJDuck wrote:




vibe.d is root an open-source project ? on about page is wrote 
is

licensed under MIT which are an open source license.

quote from http://vibed.org/about
"vibe.d is licensed under the terms of the MIT public license"


For the next 5-10 years, will it stay like that? it will be great 
if it will be...I'm just a bit concerned...


Re: installing Mango with DMD instead of ldc

2014-05-26 Thread JJDuck via Digitalmars-d-learn

On Monday, 26 May 2014 at 14:05:48 UTC, Rene Zwanenburg wrote:

On Monday, 26 May 2014 at 10:48:09 UTC, JJDuck wrote:

Vibe.d has support for ssl streams. You should be able to send 
and receive raw structs over such a stream, or if the server 
and client have a different arch you can use vibe's bson 
serialisation.


http://vibed.org/api/vibe.stream.ssl/


I definitely will research on that. It is indeed a good 
alternatives.


Thanks


Re: installing Mango with DMD instead of ldc

2014-05-26 Thread JJDuck via Digitalmars-d-learn

On Monday, 26 May 2014 at 14:05:48 UTC, Rene Zwanenburg wrote:


Vibe.d has support for ssl streams. You should be able to send 
and receive raw structs over such a stream, or if the server 
and client have a different arch you can use vibe's bson 
serialisation.


http://vibed.org/api/vibe.stream.ssl/


Vibe.d is graet, but my worry is that since it is not open-source 
and free, so it is kind of difficult for me to use it. Because 
Vibe.d might one day become a commercial product.
There is nothing wrong with that, but my current situation 
doesn't quite allow that, I'm restricted to use free software for 
now.


Re: installing Mango with DMD instead of ldc

2014-05-26 Thread JJDuck via Digitalmars-d-learn

On Monday, 26 May 2014 at 09:08:53 UTC, John Colvin wrote:


What are your requirements? There may be an alternative library 
you could use.


I need a secure private communication between clients and server.
I don't use other common tools as it is not "private" enough.
A good example is from 
http://svn.dsource.org/projects/mango/trunk/example/xml/rpc/


where I can pass my struct between client and server and I want 
to make encryption for the serialized data communication. I know 
there are a lot of tools like C# that can achieve that easily, 
but I want good performance and I like D.


Is it possible to modify Mango to be compatible with D2?



Re: installing Mango with DMD instead of ldc

2014-05-26 Thread JJDuck via Digitalmars-d-learn

On Monday, 26 May 2014 at 09:08:53 UTC, John Colvin wrote:



What are your requirements? There may be an alternative library 
you could use.


I did some research , D2 + phobos + tango + mango + encryption 
can give me what I want.


Re: installing Mango with DMD instead of ldc

2014-05-26 Thread JJDuck via Digitalmars-d-learn

On Sunday, 25 May 2014 at 18:39:18 UTC, John Colvin wrote:
That project hasn't been touched in 4 years. It will likely 
require a non-trivial amount of work to port it to modern D. It 
might be worth it, it might not, I don't know. If you did, you 
would want to use https://github.com/SiegeLord/Tango-D2 as 
mango depended on Tango in D1


dsource is dead, pretty much nothing there is maintained, 
code.dlang.org is your best bet for finding modern D projects.


Yes, I did try out the SiegeLord/Tango-D2 and it works great. And 
now I'm trying to integrate Mango as it is crucial for my current 
development.




installing Mango with DMD instead of ldc

2014-05-25 Thread JJDuck via Digitalmars-d-learn

Hello all,

I tried to install Mango and I found that it requires ldc. the 
makefile for Mango is from

http://svn.dsource.org/projects/mango/trunk/mango/build/ldc/makefile

I tried to install ldc on Windows but it doesn't go very smooth 
for the whole weekend, so I decide to try to install Mango with 
DMD.


I tried to change these two lines for start

DC=ldc   <--change to DMD
DFLAGS=-release -O -inline -oq -c