Simplified socket creation and handling

2012-05-18 Thread Jarl André
I am a Java developer who is tired of java.nio and similar complex socket libraries. In Java you got QuickServer, the ultimate protocol creation centered socket library. You don't have to write any channels and readers and what not. You just instantiate a server, configures the handlers

How to test for equality of types?

2012-05-18 Thread Matthias Walter
Hi, how do I test two types for equality? Suppose I have A and B aliasing some type(s), how do I find out if they are aliases the same thing? I tried the is(A == B) expression, but this does not always work (tell me if I shall give an example). On the other hand, according to the spec the

Re: How to test for equality of types?

2012-05-18 Thread bearophile
Matthias Walter: I tried the is(A == B) expression, but this does not always work (tell me if I shall give an example). Showing examples is great. Bye, bearophile

Distributed work load

2012-05-18 Thread Jacob Carlborg
I'm working on a tool which reads a an unknown number of files, does some processing on the content and writes out the result to new files on disk. The processing of the content is completely independent of any other processing, therefore I thought it might be a good idea to do this in

Re: How to test for equality of types?

2012-05-18 Thread Steven Schveighoffer
On Fri, 18 May 2012 06:06:45 -0400, Matthias Walter xa...@xammy.homelinux.net wrote: Hi, how do I test two types for equality? Suppose I have A and B aliasing some type(s), how do I find out if they are aliases the same thing? I tried the is(A == B) expression, but this does not always work

How do I view assembly?

2012-05-18 Thread Sandeep Datta
Hi, Is there a way by which I can see the assembly code generated by the D compiler similar to the -S etc switches on GCC? Regards, Sandeep Datta.

Re: How do I view assembly?

2012-05-18 Thread Alex Rønne Petersen
On 18-05-2012 16:46, Sandeep Datta wrote: Hi, Is there a way by which I can see the assembly code generated by the D compiler similar to the -S etc switches on GCC? Regards, Sandeep Datta. Not with DMD. What you have to do is disassemble the file with objdump -D foo.o (add -M intel to

Re: How do I view assembly?

2012-05-18 Thread Sandeep Datta
Ok, I just saw this http://stackoverflow.com/questions/3592587/digital-mars-d-compiler-acquiring-asm-output But please do let me know if it is still relevant.

Re: How do I view assembly?

2012-05-18 Thread Sandeep Datta
On Friday, 18 May 2012 at 14:48:07 UTC, Alex Rønne Petersen wrote: On 18-05-2012 16:46, Sandeep Datta wrote: Hi, Is there a way by which I can see the assembly code generated by the D compiler similar to the -S etc switches on GCC? Regards, Sandeep Datta. Not with DMD. What you have to do

Re: Distributed work load

2012-05-18 Thread Dmitry Olshansky
On 18.05.2012 17:16, Jacob Carlborg wrote: I'm working on a tool which reads a an unknown number of files, does some processing on the content and writes out the result to new files on disk. The processing of the content is completely independent of any other processing, therefore I thought it

Re: Distributed work load

2012-05-18 Thread Jacob Carlborg
On 2012-05-18 16:56, Dmitry Olshansky wrote: Yes. Start with: foreach (file; parallel(files)) { ... } Aha, I was looking at task. Thanks. -- /Jacob Carlborg

Re: How do I view assembly?

2012-05-18 Thread bearophile
Alex Rønne Petersen: On Windows, there's a dump tool called dumpobj shipped with DMD IIRC. I think you refer to obj2asm, that's not shipped with DMD. (A -S (or -asm) switch for DMD would be quite nice and useful). Bye, bearophile

Re: How do I view assembly?

2012-05-18 Thread Alex Rønne Petersen
On 18-05-2012 17:18, bearophile wrote: Alex Rønne Petersen: On Windows, there's a dump tool called dumpobj shipped with DMD IIRC. I think you refer to obj2asm, that's not shipped with DMD. Hmm, I could've sworn there was a tool for this shipped with the DMD tool chain... odd. (A -S

Re: How do I view assembly?

2012-05-18 Thread Adam D. Ruppe
On Friday, 18 May 2012 at 15:25:53 UTC, Alex Rønne Petersen wrote: Hmm, I could've sworn there was a tool for this shipped with the DMD tool chain... odd. The Linux folder of dmd has obj2asm, but the Windows version is part of Walter's $15 extended utilities package.

Re: How do I view assembly?

2012-05-18 Thread Alex Rønne Petersen
On 18-05-2012 17:30, Adam D. Ruppe wrote: On Friday, 18 May 2012 at 15:25:53 UTC, Alex Rønne Petersen wrote: Hmm, I could've sworn there was a tool for this shipped with the DMD tool chain... odd. The Linux folder of dmd has obj2asm, but the Windows version is part of Walter's $15 extended

Re: moveAt vs opIndex

2012-05-18 Thread Jonathan M Davis
On Friday, May 18, 2012 14:21:23 maarten van damme wrote: I am trying to write a randomaccessinfinite range that returns primes using the sieve of aristotle. I am however having problems understanding the difference between moveAt and opIndex; according to dlang; ElementType opIndex(size_t

Re: moveAt vs opIndex

2012-05-18 Thread Chris Cain
In your case, I don't think you really need to define a moveAt. opIndex is what's required for a Random Access Range and it really doesn't make sense to define moveAt for your particular problem. On Friday, 18 May 2012 at 12:21:31 UTC, maarten van damme wrote: Whats the difference between

Re: Distributed work load

2012-05-18 Thread Ali Çehreli
On 05/18/2012 06:16 AM, Jacob Carlborg wrote: I'm working on a tool which reads a an unknown number of files, does some processing on the content and writes out the result to new files on disk. The processing of the content is completely independent of any other processing, therefore I thought

Re: moveAt vs opIndex

2012-05-18 Thread Jonathan M Davis
On Friday, May 18, 2012 14:50:31 Jonathan M Davis wrote: moveFront is used to move the front of a range for stuff like swap, when simply copying elements is too expensive. It's destructive in that the element isn't there anymore when you do that. I mean that the value isn't there. The ranges

Re: Distributed work load

2012-05-18 Thread Jacob Carlborg
On 2012-05-18 20:44, Ali Çehreli wrote: I have tried to summarize what parallel() and its sisters do here: http://ddili.org/ders/d.en/parallelism.html I hope at least the Summary section at the end is a useful cheat sheet. Ali I'lL have to take a look at that. -- /Jacob Carlborg

Re: How to test for equality of types?

2012-05-18 Thread Matthias Walter
On 2012-05-18 16:12, Steven Schveighoffer wrote: On Fri, 18 May 2012 06:06:45 -0400, Matthias Walter wrote: how do I test two types for equality? Suppose I have A and B aliasing some type(s), how do I find out if they are aliases the same thing? I tried the is(A == B) expression, but this

Re: How to test for equality of types?

2012-05-18 Thread Simen Kjaeraas
On Fri, 18 May 2012 23:06:00 +0200, Matthias Walter xa...@xammy.homelinux.net wrote: [snip] prints out false Because Wrapper!(AliasStruct).Wrap does not exist. And _error_ is not equal to any other type. true Indeed, they are the same. false And here I disagree. This prints true

Re: How to test for equality of types?

2012-05-18 Thread Artur Skawina
On 05/18/12 23:06, Matthias Walter wrote: = struct MyStruct { } struct Wrapper(Wrap) { Wrap _wrap; this(Wrap wrap) { _wrap = wrap; } } struct AliasStruct { public: alias MyStruct Alias; } int main(char[][] args) { auto w =

directory wildcard

2012-05-18 Thread Arne
According to: http://dlang.org/phobos/std_path.html#globMatch it is possible to use wildcards spanning multiple directories. assert (globMatch(`foo/foo\bar`, f*b*r)); But wildcards with dirEntries() seem less powerful. `c:\partial*\path\*.d` If I were to use: absolutePath + filter! +

Re: XML Parsing

2012-05-18 Thread Iain
On Tuesday, 20 March 2012 at 04:32:13 UTC, Adam D. Ruppe wrote: I know very little about std.xml (I looked at it and said 'meh' and wrote my own lib), but my lib makes this pretty simple. https://github.com/adamdruppe/misc-stuff-including-D-programming-language-web-stuff grab dom.d and

Re: XML Parsing

2012-05-18 Thread Adam D. Ruppe
On Friday, 18 May 2012 at 23:08:59 UTC, Iain wrote: If I try to compile the code you gave above, I get a pile of linking errors using D 2.059: You have to link in the modules too on the command line dmd.exe parseSpain arsd/dom.d arsd/characterencoding.d (or whatever the full path to the

Re: XML Parsing

2012-05-18 Thread Iain
On Friday, 18 May 2012 at 23:16:26 UTC, Adam D. Ruppe wrote: On Friday, 18 May 2012 at 23:08:59 UTC, Iain wrote: If I try to compile the code you gave above, I get a pile of linking errors using D 2.059: You have to link in the modules too on the command line dmd.exe parseSpain arsd/dom.d

Re: XML Parsing

2012-05-18 Thread Iain
On Friday, 18 May 2012 at 23:31:05 UTC, Iain wrote: Aah thank you! Finally, an XML parser that works in D!!! Adam, thanks for this! I guess you don't need much documentation for your code, as you can just look up the wealth of tutorials that have been written for Javascript's XML parser.

Re: XML Parsing

2012-05-18 Thread Adam D. Ruppe
On Saturday, 19 May 2012 at 00:00:50 UTC, Iain wrote: I guess you don't need much documentation for your code, as you can just look up the wealth of tutorials that have been written for Javascript's XML parser. Yeah, that's basically how I feel about it. I started writing some documentation

using deimos.portaudio

2012-05-18 Thread Samuele Carcagno
Hi, I'm try to use the deimos portaudio bindings https://github.com/D-Programming-Deimos/portaudio I've managed to compile and run the test demo provided with the module. It seems to work fine. However, when I add this statement: PaStreamParameters outputParameters; that I need to specify

Re: using deimos.portaudio

2012-05-18 Thread 1100110
On Fri, 18 May 2012 21:31:57 -0500, Samuele Carcagno sam.carca...@gmail.com wrote: Pa_OpenStream Does the result of calling Pa_GetVersionText() closely match the version of the library installed on your computer? I use Debian as well, and it's not exactly known for speedy updates... If

Re: using deimos.portaudio

2012-05-18 Thread Samuele Carcagno
On Saturday, 19 May 2012 at 02:54:22 UTC, 1100110 wrote: On Fri, 18 May 2012 21:31:57 -0500, Samuele Carcagno sam.carca...@gmail.com wrote: Pa_OpenStream Does the result of calling Pa_GetVersionText() closely match the version of the library installed on your computer? I use Debian as

Re: using deimos.portaudio

2012-05-18 Thread Samuele Carcagno
I get the same error on debian wheezy where the portaudio version is: PortAudio V19-devel (built Dec 7 2011 23:15:44) dmd pa_test2.d -L-lportaudio pa_test2.o: In function `_Dmain': pa_test2.d:(.text._Dmain+0x22): undefined reference to `_D6deimos9portaudio18PaStreamParameters6__initZ'

Re: directory wildcard

2012-05-18 Thread Jay Norwood
On Friday, 18 May 2012 at 22:10:36 UTC, Arne wrote: According to: http://dlang.org/phobos/std_path.html#globMatch it is possible to use wildcards spanning multiple directories. assert (globMatch(`foo/foo\bar`, f*b*r)); But wildcards with dirEntries() seem less powerful.