Le 09/11/2011 14:15, Trass3r a écrit :
2. what is your opinion about public import ? In C++, "hidden" or
"implicit" #includes is a common source of compilation problems (order
of #includes), I tend to think it's a bad thing.
It can be quite useful. I use it often for C library wrappers. As soon
Hello,
what is the currently DB API considered usable today ?
http://prowiki.org/wiki4d/wiki.cgi?DatabaseBindings#ODBC
d-dbapi looked quite decent, but the source code is no longer available :(
Thank you
Dude
Le 09/11/2011 14:50, Jacob Carlborg a écrit :
2. what is your opinion about public import ? In C++, "hidden" or
"implicit" #includes is a common source of compilation problems (order
of #includes), I tend to think it's a bad thing.
Sometimes public imports are useful. It's possible to emulate
Speaking only for lighttpd, it didn't work too well for me when I tried
it (using FCGI). First off, it does not seem to support multiplexing. As
well as that, it had no way I could figure out for handling concurrent
requests.
So, the way every single request goes is:
Lighttpd opens a connectio
Le 09/11/2011 18:12, Dejan Lekic a écrit :
I would be satisfied with something like POSIX.1-2001 setrlimit() . Sure
nothing prevents me from using setrlimit() in my D app, but perhaps it is
something to think about a portable way of doing that.
One thing I like about my Java apps is that I can a
Somedude wrote:
> Hello,
>
> what is the currently DB API considered usable today ?
>
> http://prowiki.org/wiki4d/wiki.cgi?DatabaseBindings#ODBC
>
> d-dbapi looked quite decent, but the source code is no longer available :(
>
> Thank you
>
> Dude
Try this alternative - http://www.dsource.org
I'm creating a Checked!T struct for integral values. The version attached
works
for the most part, but some parts confuse me, namely that the following
operations do not set the overflow flag:
uint.max + 1
ulong.max + 1
int.min - 1
uint.min - 1
long.min - 1
ulong.min - 1
uint.max << 1
long.ma
On Thu, 10 Nov 2011 12:24:30 -0500, Simen Kjærås
wrote:
I'm creating a Checked!T struct for integral values. The version attached
works
for the most part, but some parts confuse me, namely that the following
operations do not set the overflow flag:
uint.max + 1
ulong.max + 1
int.min - 1
uin
On Thu, 10 Nov 2011 18:56:37 +0100, Steven Schveighoffer
wrote:
On Thu, 10 Nov 2011 12:24:30 -0500, Simen Kjærås
wrote:
I'm creating a Checked!T struct for integral values. The version
attached
works
for the most part, but some parts confuse me, namely that the following
operations do
On 11/10/2011 06:24 PM, Simen Kjærås wrote:
I'm creating a Checked!T struct for integral values. The version
attached works
for the most part, but some parts confuse me, namely that the following
operations do not set the overflow flag:
uint.max + 1
ulong.max + 1
int.min - 1
uint.min - 1
long.m
On 11/9/2011 5:12 PM, Jonathan M Davis wrote:
As far as I can tell, "assert(obj)" MEANS "test the invariant without
using the object". And I don't see the point of that.
It's occasionally useful when debugging code - particularly when called from
inside of the object rather than externally.
A
Hey guys,
I've got a problem - I've just written a few lines to approximate PI with the
Monte Carlo Method.
This is my code:
import std.stdio, std.conv, std.string, std.random;
void main()
{
string buf;
int n, hits;
float x, y, pi;
Random rnd;
rnd.seed(u
'hits' and 'n' are both integers and hits < n, therefore hits/n = 0
in integer arithmetic.
You need to convert at least one of them to a floating point type,
e.g., with 'cast(double)(hits)/n'.
On 10 November 2011 21:08, Fabian wrote:
> Hey guys,
>
> I've got a problem - I've just written a few li
Thank you - now it works :)
Hi folks,
I need to create thread and pass to it array of objects wich will no
longer use in main thread.
The problem is that spawn only accepts immutables and i have no idea
how to tell him that i transfer full ownership of the data to child
thread.
the code:
import std.concurrency
On 11/10/2011 01:06 PM, Ruslan Mullakhmetov wrote:
Hi folks,
I need to create thread and pass to it array of objects wich will no
longer use in main thread.
The problem is that spawn only accepts immutables and i have no idea how
to tell him that i transfer full ownership of the data to child t
On 11/10/2011 10:06 PM, Ruslan Mullakhmetov wrote:
Hi folks,
I need to create thread and pass to it array of objects wich will no
longer use in main thread.
The problem is that spawn only accepts immutables and i have no idea how
to tell him that i transfer full ownership of the data to child t
This is not related to your question. I just wanted to point out that it
is better to use the normal increment operator in the majority of cases.
(I avoid calling it pre-increment, because that name suggests a more
complicated semantics than there actually is.)
On 11/10/2011 12:08 PM, Fabian w
oh ... I see. Thank you ;)
Hey guys.
I just want to write a few console applications. Usualy I have to read numbers
to calculate some values. But what's the smartest way to read and convert the
input?
I've coded these lines:
import std.stdio, std.string, std.conv;
T readNumber(T)()
{
string buffer;
stdin.
import std.stdio;
T readNumber(T)()
{
T result;
stdin.readf("%s", &result);
return result;
}
Throws a ConvException if the input string wasn't in the right format.
On 10 November 2011 22:48, Fabian wrote:
> Hey guys.
>
> I just want to write a few console applications. Usualy I have
On 2011-11-11 01:21:09 +0400, Ali Çehreli said:
class Foo
{
}
void worker( shared(Foo)[] data )
{
//...
}
void main()
{
auto data = new shared(Foo)[10];
spawn( &worker, data );
}
Thanks. I tried to use the second version, a lttle bit modified it for
actual mutation and it i
On 2011-11-11 01:23:01 +0400, Timon Gehr said:
class Foo
{
}
void worker( shared(Foo[]) data_ )
{
Foo[] data = cast() data_; // this cast is valid because data_ is
never read from another thread after the cast
//...
}
void main()
{
{
auto data = new Foo[10];
This: https://github.com/he-the-great/JPDLibs/tree/cmdln/cmdln
The HTML docs explain how to use it. Not mine, but I think this would
be a sweet addition to Phobos imo.
Thanks a lot. That's exactly what I was searching for.
Andrej Mitrovic wrote:
> This: https://github.com/he-the-great/JPDLibs/tree/cmdln/cmdln
>
> The HTML docs explain how to use it. Not mine, but I think this would
> be a sweet addition to Phobos imo.
Thank you. :)
On Thursday, November 10, 2011 13:48 Fabian wrote:
> Hey guys.
>
> I just want to write a few console applications. Usualy I have to read
> numbers to calculate some values. But what's the smartest way to read and
> convert the input?
>
> I've coded these lines:
>
> import std.stdio, std.string,
On 11/10/2011 01:57 PM, Ruslan Mullakhmetov wrote:
On 2011-11-11 01:21:09 +0400, Ali Çehreli said:
class Foo
{
}
void worker( shared(Foo)[] data )
{
//...
}
void main()
{
auto data = new shared(Foo)[10];
spawn( &worker, data );
}
Thanks. I tried to use the second version, a lttle bit modi
I'm using linux too. I tried all IDEs for D, but all of them was
pretty lame, so I'm using Kate/Geany.
> I don't find an important feature: renaming variables/functions/etc.
BTW: It's called refactoring.
I don't get the exception on Linux after a new line, I have to wait
until EOF, which is typically the end of the program if reading from
STDIN. Not very useful.
import std.stdio;
T readNumber(T)()
{
T result;
stdin.readf("%s", &result);
return result;
}
void main()
{
try
{
On 11/10/2011 11:00 PM, Ruslan Mullakhmetov wrote:
On 2011-11-11 01:23:01 +0400, Timon Gehr said:
class Foo
{
}
void worker( shared(Foo[]) data_ )
{
Foo[] data = cast() data_; // this cast is valid because data_ is
never read from another thread after the cast
//...
}
void main()
{
{
auto da
Yes, you are right. You can make it work by changing to line buffering:
stdin.setvbuf(null, _IOLBF);
But at that point, another solution (like using std.conv.to) is
probably the better choice.
On 10 November 2011 23:40, Kai Meyer wrote:
> I don't get the exception on Linux after a new line, I h
On 11/10/2011 11:23 PM, Ali Çehreli wrote:
On 11/10/2011 01:57 PM, Ruslan Mullakhmetov wrote:
On 2011-11-11 01:21:09 +0400, Ali Çehreli said:
class Foo
{
}
void worker( shared(Foo)[] data )
{
//...
}
void main()
{
auto data = new shared(Foo)[10];
spawn( &worker, data );
}
Thanks. I tried
On 11/10/2011 10:45 PM, Fabian wrote:
oh ... I see. Thank you ;)
++i is unidiomatic, and if the result is unused it means the same thing
as i++. So, I'd actually go with i++. The only reason why one would use
++i is because it is less efficient for C++ iterators, but D does not
have that pro
size_t can easily bite you* in the ass:
import std.algorithm;
void main()
{
int[] a;
int val = max(0, a.length - 1);
assert(val > 0); // NG, woops!
}
* = me
That one is easy to catch, but in a complex expression you might have
ints and size_t and everything gets converted to unsig
Timon Gehr:
> Interesting, apparently cast() does not remove shared.
The semantics of cast() was never formalized, I think. People use this idiom,
so I think we have to formalize what cast() exactly does. This is meat for
Bugzilla or even for discussion topic in the main D newsgroup.
Generally
.sizeof on a struct works nicely since it's a POD, but this can't work
on classes since it just returns the pointer size.
I don't know whether this is useful all that much, but I'm curious how
large my classes are. Anyway, since I couldn't find anything in Phobos
I've got this working:
import std
On 11/11/11, Andrej Mitrovic wrote:
> foreach (type; RepresentationTypeTuple!Foo) {
Way to screw that up. Fix:
foreach (type; RepresentationTypeTuple!T) {
On 11/10/2011 05:44 PM, Andrej Mitrovic wrote:
.sizeof on a struct works nicely since it's a POD, but this can't work
on classes since it just returns the pointer size.
I don't know whether this is useful all that much, but I'm curious how
large my classes are. Anyway, since I couldn't find anyt
On 11/11/11, Ali Çehreli wrote:
> This is the standard way:
>
> __traits(classInstanceSize, Foo)
>
> Ali
>
Thanks! It's also more reliable it seems. :)
trying to build a .so file (actually, trying to resuscitate pyd) with gdc.
celerid is spitting out
gdc -fPIC -nostartfiles -shared -fdebug {lots of object files plus some
link directives}
which is spitting out
/usr/bin/ld: /usr/lib64/libgphobos2.a(object_.o): relocation
R_X86_64_32S against `_D
On 2011-11-11 02:48:52 +0400, Timon Gehr said:
On 11/10/2011 11:00 PM, Ruslan Mullakhmetov wrote:
On 2011-11-11 01:23:01 +0400, Timon Gehr said:
class Foo
{
}
void worker( shared(Foo[]) data_ )
{
Foo[] data = cast() data_; // this cast is valid because data_ is
never read from another threa
Ok - Good to know. Thank you ;)
43 matches
Mail list logo