Re: FastCGI binding or implementation?

2011-10-14 Thread Adam D. Ruppe
On Fri, Oct 14, 2011 at 09:14:19PM -0400, Jeremy Sandell wrote:
>Does anyone know if there's a D2 binding or implementation for fastcgi as
> of yet?

My cgi.d wraps the C library for fast cgi

https://github.com/adamdruppe/misc-stuff-including-D-programming-language-web-stuff

compile with -version=fastcgi



FastCGI binding or implementation?

2011-10-14 Thread Jeremy Sandell
Hello!

   Does anyone know if there's a D2 binding or implementation for fastcgi as
of yet?

Thanks!
Jeremy Sandell


Re: overload of array operations

2011-10-14 Thread Jonathan M Davis
On Friday, October 14, 2011 16:12 Jay Norwood wrote:
> Jonathan M Davis Wrote:
> > On Friday, October 14, 2011 15:29:17 Jay Norwood wrote:
> > > Jonathan M Davis Wrote:
> > > > On Friday, October 14, 2011 11:30:25 Jay Norwood wrote:
> > > > > Is it possible to overload array operations
> > > > 
> > > > Please be more specific. Are you asking whether a struct or class can
> > > > overload the indexing and slicing operators? If so, the answer is
> > > > yes.
> > > > 
> > > > http://d-programming-language.org/operatoroverloading.html
> > > > 
> > > > - Jonathan M Davis
> > > 
> > > to be more specific, I'm interested in overloading the vector
> > > operations on arrays described at this link, search for "vector
> > > operation"
> > > 
> > > http://www.digitalmars.com/d/2.0/arrays.html
> > 
> > You could probably do it if you're fancy, but there's no explicit way to
> > have a struct or class operate like that. If you really wanted to
> > though, you could overload opSlice on your struct to return a specific
> > type which then overloaded opBinary for + and then have that return a
> > new struct with the changed values. But that borders on overloaded
> > operator abuse.
> > 
> > Vector operations are really only intended for arrays.
> > 
> > - Jonathan M Davis
> 
> Yes, I intended to try to overload the array operations on an array of
> structures. I just want to use the simple syntax for the operations.
> 
> a[]= b[]+c[];
> a[] = b[] + 4;
> a[] *= 4;
> 
> where a, b, c are arrays of structures, and then overload the operations. 
> It seems to me that should require names for the array operations being
> overloaded.

So, you want to have use vector operations on arrays of structs rather than 
use vector operations on a struct or class? If that's what you want, then 
overload the arithmetic operations on the struct as normal, and then use 
vector operations on the array holding the structs. It may work. I don't know. 
If it doesn't, then you're out of luck and can't use the built in syntax. And 
if does, well then there you go.

- Jonathan M Davis


Re: overload of array operations

2011-10-14 Thread Jay Norwood
Jonathan M Davis Wrote:

> On Friday, October 14, 2011 15:29:17 Jay Norwood wrote:
> > Jonathan M Davis Wrote:
> > > On Friday, October 14, 2011 11:30:25 Jay Norwood wrote:
> > > > Is it possible to overload array operations
> > > 
> > > Please be more specific. Are you asking whether a struct or class can
> > > overload the indexing and slicing operators? If so, the answer is yes.
> > > 
> > > http://d-programming-language.org/operatoroverloading.html
> > > 
> > > - Jonathan M Davis
> > 
> > to be more specific, I'm interested in overloading the vector operations on
> > arrays described at this link, search for "vector operation"
> > 
> > http://www.digitalmars.com/d/2.0/arrays.html
> 
> You could probably do it if you're fancy, but there's no explicit way to have 
> a struct or class operate like that. If you really wanted to though, you 
> could 
> overload opSlice on your struct to return a specific type which then 
> overloaded 
> opBinary for + and then have that return a new struct with the changed 
> values. 
> But that borders on overloaded operator abuse.
> 
> Vector operations are really only intended for arrays.
> 
> - Jonathan M Davis


Yes, I intended to try to overload the array operations on an array of 
structures.  I just want to use the simple syntax for the operations.

a[]= b[]+c[];
a[] = b[] + 4;
a[] *= 4;

where a, b, c are arrays of structures, and then overload the operations.   It 
seems to me that should require names for the array operations being overloaded.





Re: Unable to get Phobos working on Ubuntu x64 (Oneiric)

2011-10-14 Thread Justin Whear
I tore my hair out over this before I examined the gcc line run by dmd, and 
found that -lphobos2 was being dropped in after -lrt. The simple fix is to 
modify your dmd.conf (build something with dmd -v to see where this is) such 
that "-L-lphobos2" is added BEFORE "-L-lrt".

Justin



Matt Soucy wrote:

> I know this is slightly old, but I didn't see a solution - I decided, in a
> fit of madness, to attempt a Day 1 upgrade from Natty to Oneiric.
> It...didn't exactly work, and I ended up with this same problem.
> It's apparently not a problem with x64, since I'm using x86 Ubuntu. (I
> grabbed the wrong disk before I installed...)
> I somehow have/had (I downgraded so I could work properly again) a
> /usr/lib64 folder. I'm not exactly an expert in Linux filesystems, or even
> anywhere near close, but it seems that I shouldn't have had that on a x86
> install. I had the files librt.a and librt.so in there, but even
> desperately symlinking them into the proper location didn't help.
> This problem is rather irritating - has anyone upgraded successfully, and
> actually had it work? I would definitely like to upgrade to 11.10, but I
> don't want to have to halt all code development when I do.
> Thank you,
> -Matt Soucy


Re: Unable to get Phobos working on Ubuntu x64 (Oneiric)

2011-10-14 Thread Matt Soucy
I know this is slightly old, but I didn't see a solution - I decided, in a fit 
of
madness, to attempt a Day 1 upgrade from Natty to Oneiric. It...didn't exactly
work, and I ended up with this same problem.
It's apparently not a problem with x64, since I'm using x86 Ubuntu. (I grabbed 
the
wrong disk before I installed...)
I somehow have/had (I downgraded so I could work properly again) a /usr/lib64
folder. I'm not exactly an expert in Linux filesystems, or even anywhere near
close, but it seems that I shouldn't have had that on a x86 install. I had the
files librt.a and librt.so in there, but even desperately symlinking them into 
the
proper location didn't help.
This problem is rather irritating - has anyone upgraded successfully, and 
actually
had it work? I would definitely like to upgrade to 11.10, but I don't want to 
have
to halt all code development when I do.
Thank you,
-Matt Soucy


Re: overload of array operations

2011-10-14 Thread Jonathan M Davis
On Friday, October 14, 2011 15:29:17 Jay Norwood wrote:
> Jonathan M Davis Wrote:
> > On Friday, October 14, 2011 11:30:25 Jay Norwood wrote:
> > > Is it possible to overload array operations
> > 
> > Please be more specific. Are you asking whether a struct or class can
> > overload the indexing and slicing operators? If so, the answer is yes.
> > 
> > http://d-programming-language.org/operatoroverloading.html
> > 
> > - Jonathan M Davis
> 
> to be more specific, I'm interested in overloading the vector operations on
> arrays described at this link, search for "vector operation"
> 
> http://www.digitalmars.com/d/2.0/arrays.html

You could probably do it if you're fancy, but there's no explicit way to have 
a struct or class operate like that. If you really wanted to though, you could 
overload opSlice on your struct to return a specific type which then overloaded 
opBinary for + and then have that return a new struct with the changed values. 
But that borders on overloaded operator abuse.

Vector operations are really only intended for arrays.

- Jonathan M Davis


Re: overload of array operations

2011-10-14 Thread Jay Norwood
Jonathan M Davis Wrote:

> On Friday, October 14, 2011 11:30:25 Jay Norwood wrote:
> > Is it possible to overload array operations
> 
> Please be more specific. Are you asking whether a struct or class can 
> overload 
> the indexing and slicing operators? If so, the answer is yes.
> 
> http://d-programming-language.org/operatoroverloading.html
> 
> - Jonathan M Davis


to be more specific, I'm interested in overloading the vector operations on 
arrays described at this link, search for "vector operation"

http://www.digitalmars.com/d/2.0/arrays.html



Re: overload of array operations

2011-10-14 Thread Jay Norwood
Jonathan M Davis Wrote:

> On Friday, October 14, 2011 11:30:25 Jay Norwood wrote:
> > Is it possible to overload array operations
> 
> Please be more specific. Are you asking whether a struct or class can 
> overload 
> the indexing and slicing operators? If so, the answer is yes.
> 
> http://d-programming-language.org/operatoroverloading.html
> 
> - Jonathan M Davis


I'm interested, for example,  in overloading the  + operation for arrays that 
is documented to generate a vector add operation.  I assume there would need to 
be a name for that operation in order to overload it.
Thanks,
Jay


Re: does "private import" means "static import" to other modules importing it?

2011-10-14 Thread Andrej Mitrovic
On 10/14/11, Jesse Phillips  wrote:
> On Thu, 13 Oct 2011 16:21:56 +0200, Andrej Mitrovic wrote:
>
>> You can always qualify the full name unless you're importing a specific
>> symbol, e.g.:
>
> No, I'm pretty sure it is just a bug, and one that was recently discussed
> too. Private imports should not expose their symbols to other modules
> even if you use a fully qualified name.
>

Woops, sorry for the slip-up.


Re: overload of array operations

2011-10-14 Thread Jonathan M Davis
On Friday, October 14, 2011 11:30:25 Jay Norwood wrote:
> Is it possible to overload array operations

Please be more specific. Are you asking whether a struct or class can overload 
the indexing and slicing operators? If so, the answer is yes.

http://d-programming-language.org/operatoroverloading.html

- Jonathan M Davis


overload of array operations

2011-10-14 Thread Jay Norwood
Is it possible to overload array operations


Re: Ranges help

2011-10-14 Thread Xinok
Thanks. I'll run a benchmark with swapRanges, see how it compares to my own 
code. But it would be better if I coded the merge function myself, since I can 
do it in-place using very little memory.


Re: Only one signal per object?

2011-10-14 Thread Johannes Pfau
Andrej Mitrovic wrote:
>Johannes Pfau made an updated version of std.signals, I think he's
>hosting it somewhere on his dropbox, you'll have to ask him.

http://dl.dropbox.com/u/24218791/d/src/signals.html
https://gist.github.com/1194497

It should work well as a replacement for the current std.signals but
compared to boost::signals2 it still misses some features. When I find
some time for it, I'll update it to support all boost:signals2
features and propose it for phobos.

Note:
This bug can cause issues with my std.signals implementation:
http://d.puremagic.com/issues/show_bug.cgi?id=5011

I should really file a pull request for that. 

-- 
Johannes Pfau



Re: Ranges help

2011-10-14 Thread Christophe
Xinok , dans le message (digitalmars.D.learn:30054), a écrit :
> This is in relation to my sorting algorithm. This is what I need to 
> accomplish with ranges in the most efficient way possible:
> 
> 1. Merge sort - This involves copying elements to a temporary buffer, 
> which can simply be an array, then merging the two lists together. The 
> important thing is that it may merge left to right, or right to left, 
> which requires a bidirectional range.
> 
> c[] = a[0..$/2];
> foreach(a; arr) if(!b.empty && !c.empty) if(b.front <= c.front){
>   a = b.front; b.popFront();
> } else{
>   a = c.front; c.popFront();
> }
> 
> 2. Range swap - First, I need to do a binary search, which requires a 
> random access range. Then I need to swap two ranges of elements.
> 
> while(!a.empty && !b.empty){
>   swap(a.front, b.front);
>   a.popFront(); b.popFront();
> }
> 
> 
> That's the best I can come up with. I'm wondering if there's a more 
> efficient way to accomplish what I have above.
> 
> I also need to figure out the template constraints. Would this be 
> correct? Or would this be too much?
> 
> isRandomAccessRange && !isFiniteRange && isBidirectionalRange && hasSlicing


You should look at:
std.algorithm.SetUnion
std.algorithm.swapRanges

-- 
Christophe