On Friday, 6 February 2015 at 03:59:51 UTC, tcak wrote:
I am on 64-bit Linux.
I defined a struct that it 8 bytes in total.
align(1) struct MessageBase{
align(1):
ushort qc;
ushort wc;
ushort id;
ushort contentLength;
void[0] content;
}
I defined a
Is there a simple way of conversion? Something like:
uint length = to!uint(buffer[0 .. 4]);
Right now I have:
uint length = *cast(uint*)buffer[0 .. 4].ptr;
Which I'm not entirely sure is the correct way to do that.
On Friday, 6 February 2015 at 01:36:17 UTC, Mike Parker wrote:
On 2/6/2015 9:50 AM, Gan wrote:
On Friday, 6 February 2015 at 00:35:12 UTC, Adam D. Ruppe
wrote:
On Friday, 6 February 2015 at 00:31:37 UTC, Gan wrote:
Or am I misunderstanding the receive function? Does it send
whole
messages or
On Friday, 6 February 2015 at 04:10:08 UTC, tcak wrote:
On Friday, 6 February 2015 at 03:59:51 UTC, tcak wrote:
I am on 64-bit Linux.
I defined a struct that it 8 bytes in total.
align(1) struct MessageBase{
align(1):
ushort qc;
ushort wc;
ushort id;
ushort
On 2015-02-05, 8:17 PM, Gan wrote:
On Friday, 6 February 2015 at 01:36:17 UTC, Mike Parker wrote:
On 2/6/2015 9:50 AM, Gan wrote:
On Friday, 6 February 2015 at 00:35:12 UTC, Adam D. Ruppe wrote:
On Friday, 6 February 2015 at 00:31:37 UTC, Gan wrote:
Or am I misunderstanding the receive
I am on 64-bit Linux.
I defined a struct that it 8 bytes in total.
align(1) struct MessageBase{
align(1):
ushort qc;
ushort wc;
ushort id;
ushort contentLength;
void[0] content;
}
I defined a function in this struct that tries to set a pointer
to
On Friday, 6 February 2015 at 05:18:45 UTC, Gan wrote:
Is there a simple way of conversion? Something like:
uint length = to!uint(buffer[0 .. 4]);
Right now I have:
uint length = *cast(uint*)buffer[0 .. 4].ptr;
Which I'm not entirely sure is the correct way to do that.
Hi,
check out
ldc supports solaris/x86
but druntime/Phobos support will most likely be lacking what
does it's mean? It is not fully work or what?
On Thursday, 5 February 2015 at 13:25:37 UTC, FrankLike wrote:
Now I can remove element from a array:
module removeOne;
import std.stdio;
import std.array;
import std.algorithm;
void main()
{
int[] aa =[1,2,3,4,5];
aa = aa[0..2] ~aa[3..$];
writeln(aa); //ok
Now I can remove element from a array:
module removeOne;
import std.stdio;
import std.array;
import std.algorithm;
void main()
{
int[] aa =[1,2,3,4,5];
aa = aa[0..2] ~aa[3..$];
writeln(aa); //ok
remove(aa,1);
writeln(aa);//get error result
}
You
On Thursday, 5 February 2015 at 13:31:21 UTC, Nicholas Wilson
wrote:
On Thursday, 5 February 2015 at 12:31:31 UTC, Stéphane wrote:
Syntax for checking if an element exists in a list
Hello,
I would like to know if there is a better (easier to wite,
easier to read, easier to understand) way
On 2/5/2015 4:53 PM, Entity325 wrote:
On Thursday, 5 February 2015 at 07:23:15 UTC, drug wrote:
Look at this
https://github.com/drug007/geoviewer/blob/master/src/sdlapp.d
I used here SDL and OpenGL and it worked. Ctor of SDLApp creates SDL
window with OpenGL context, may be it helps.
Tested
On Thursday, 5 February 2015 at 13:55:59 UTC, FrankLike wrote:
On Thursday, 5 February 2015 at 13:29:30 UTC, Tobias Pankrath
wrote:
Works as designed:
http://dlang.org/phobos/std_algorithm.html#.remove
Thank you.
aa = remove(aa,1);//ok
but how to remove one item?
such as aa.remove(2) ?
I
import std.algorithm;
int main(string[] options)
{
// true if the first option given to this program is
either foo, bar, or baz.
if(options[1].canFind(foo, bar, baz))
return 0;
return 1;
}
On 2015-02-05 at 09:58, bearophile wrote:
zhmt:
Will arr.ptr change in the future?
As the array add more members , it need more memroy, then remalloc may be
called, the pointer maybe change, then the stored pointer will be invalid.
Will this happen?
Yes, it can happen.
Therefore, don't
On Thursday, 5 February 2015 at 12:31:31 UTC, Stéphane wrote:
Syntax for checking if an element exists in a list
Hello,
I would like to know if there is a better (easier to wite,
easier to read, easier to understand) way to check if an element
(string) is
in a list of strings.
Here are
On Thursday, 5 February 2015 at 13:29:30 UTC, Tobias Pankrath
wrote:
Works as designed:
http://dlang.org/phobos/std_algorithm.html#.remove
Thank you.
aa = remove(aa,1);//ok
but how to remove one item?
such as aa.remove(2) ?
Tobias Pankrath:
Works as designed:
http://dlang.org/phobos/std_algorithm.html#.remove
Unfortunately it's one of the worst designed functions of Phobos:
https://issues.dlang.org/show_bug.cgi?id=10959
Bye,
bearophile
On Thursday, 5 February 2015 at 12:35:03 UTC, Tobias Pankrath
wrote:
import std.algorithm;
if(options[1].canFind(foo, bar, baz))
This looks quite OK. Thank you, I did not know about that
possibility.
On Thursday, 5 February 2015 at 14:51:58 UTC, suliman wrote:
My next job will be related with prorgamming under Solaris. I
dont know version but suppose it will be something pretty out
of date.
Once i had seen topic about D and Solaris, but i want to ask if
D solaris version is ready for
On Thursday, 5 February 2015 at 14:09:10 UTC, bearophile wrote:
Tobias Pankrath:
Works as designed:
http://dlang.org/phobos/std_algorithm.html#.remove
Unfortunately it's one of the worst designed functions of
Phobos:
https://issues.dlang.org/show_bug.cgi?id=10959
Bye,
bearophile
It
The behavior of array is more or less unpredictable.
If it is always a reference like class , it will be more
predictable.
Sorry, I misunderstand the meaning of array pointer, it is not
equals to arr.ptr.
The array pointer meets my need perfectly .
Ignore my replies above, Sorry!!!
On 05.02.2015 10:53, Entity325 wrote:
On Thursday, 5 February 2015 at 07:23:15 UTC, drug wrote:
Look at this
https://github.com/drug007/geoviewer/blob/master/src/sdlapp.d
I used here SDL and OpenGL and it worked. Ctor of SDLApp creates SDL
window with OpenGL context, may be it helps.
Tested
Will arr.ptr change in the future?
As the array add more members , it need more memroy, then
remalloc may be called, the pointer maybe change, then the stored
pointer will be invalid.
Will this happen?
zhmt:
Will arr.ptr change in the future?
As the array add more members , it need more memroy, then
remalloc may be called, the pointer maybe change, then the
stored pointer will be invalid.
Will this happen?
Yes, it can happen.
Bye,
bearophile
My next job will be related with prorgamming under Solaris. I
dont know version but suppose it will be something pretty out of
date.
Once i had seen topic about D and Solaris, but i want to ask if D
solaris version is ready for production or it is alpha? Does
anybody have experience with it?
On Thursday, 5 February 2015 at 13:31:21 UTC, Nicholas Wilson
wrote:
Note that D does NOT have default fall through. i.e.
switch(myopt)
{
case opt1, opt2, opt3:
do_A();
break;
case opt4:
do_B();
break;
default:
do_C();
}
is equivalent to
On Thursday, 5 February 2015 at 14:09:10 UTC, bearophile wrote:
Tobias Pankrath:
Works as designed:
http://dlang.org/phobos/std_algorithm.html#.remove
Unfortunately it's one of the worst designed functions of
Phobos:
https://issues.dlang.org/show_bug.cgi?id=10959
Bye,
bearophile
On Thursday, 5 February 2015 at 14:09:10 UTC, bearophile wrote:
Yes,A.remove(item) or A.removeAt(index)
They are better than now.
On Thursday, 5 February 2015 at 13:31:21 UTC, Nicholas Wilson
wrote:
Note that D does NOT have default fall through. i.e.
Yes, but I thought I read that we always had to explicitely
specify one ending statement, as goto, continue... or
break; which, in many basic cases, means having to add
I'm expecting in this code http://dpaste.dzfl.pl/ee0d3cd31734
either line 8 should not compile, or lines 12 and 14 should have
a totally different output. What's going on?
On Thursday, February 05, 2015 23:08:13 Vlad Levenfeld via Digitalmars-d-learn
wrote:
I'm expecting in this code http://dpaste.dzfl.pl/ee0d3cd31734
either line 8 should not compile, or lines 12 and 14 should have
a totally different output. What's going on?
It looks like
alias b = that.obj;
I managed to get the client to connect but immediately on the
server side, this happens:
long length = player.playerSocket.receive(buf);
if (length == 0) { //No longer connected
player.playerSocket.shutdown(SocketShutdown.BOTH);
On Friday, 6 February 2015 at 00:24:54 UTC, Adam D. Ruppe wrote:
On Friday, 6 February 2015 at 00:15:15 UTC, Gan wrote:
ubyte[] buf = new ubyte[](0);
This is your problem: receive fills a preexisting buffer, and
you allocated zero bytes for it to fill, so it can't give you
On Friday, 6 February 2015 at 00:28:00 UTC, Gan wrote:
On Friday, 6 February 2015 at 00:24:54 UTC, Adam D. Ruppe wrote:
On Friday, 6 February 2015 at 00:15:15 UTC, Gan wrote:
ubyte[] buf = new ubyte[](0);
This is your problem: receive fills a preexisting buffer, and
you
On Friday, 6 February 2015 at 00:31:37 UTC, Gan wrote:
Or am I misunderstanding the receive function? Does it send
whole messages or just message chunks?
It sends as much as it can when you call it. So if there's only
12 bytes available when you send it with a 4096 buffer, it will
fill the
On Friday, 6 February 2015 at 00:15:15 UTC, Gan wrote:
ubyte[] buf = new ubyte[](0);
This is your problem: receive fills a preexisting buffer, and you
allocated zero bytes for it to fill, so it can't give you
anything.
Give it a bigger buffer, I like to use 4096, and it
bachmeier:
It seems your argument is that remove is poorly designed
because it's not destructive. Or am I missing your argument?
It has to be a void function (or perhaps bettter it can return
true/false if it has removed the item, so it becomes @nogc and
nothrow).
And it has to remove the
On Friday, 6 February 2015 at 00:50:43 UTC, Gan wrote:
How can you distinguish between different packets that get
sent? Won't they all be merged to a giant blob of data?
Yeah, that's normal in TCP though, because it is a stream
oriented protocol. You could add stuff to your data indicating
On Friday, 6 February 2015 at 00:35:12 UTC, Adam D. Ruppe wrote:
On Friday, 6 February 2015 at 00:31:37 UTC, Gan wrote:
Or am I misunderstanding the receive function? Does it send
whole messages or just message chunks?
It sends as much as it can when you call it. So if there's only
12 bytes
On 2/6/2015 9:50 AM, Gan wrote:
On Friday, 6 February 2015 at 00:35:12 UTC, Adam D. Ruppe wrote:
On Friday, 6 February 2015 at 00:31:37 UTC, Gan wrote:
Or am I misunderstanding the receive function? Does it send whole
messages or just message chunks?
It sends as much as it can when you call
On Thursday, 5 February 2015 at 08:58:47 UTC, bearophile wrote:
zhmt:
Will arr.ptr change in the future?
As the array add more members , it need more memroy, then
remalloc may be called, the pointer maybe change, then the
stored pointer will be invalid.
Will this happen?
Yes, it can
On Thursday, 5 February 2015 at 06:58:09 UTC, Ali Çehreli wrote:
On 02/04/2015 10:42 PM, zhmt wrote:
Here is a simple code snippet:
With this approach, the allocation of `arr` itself is often
clumsy and error-prone. In this case it is important to note that
`arr` is allocated on the stack
Ali Çehreli acehr...@yahoo.com schrieb im Newsbeitrag
news:mav4a1$l3a$1...@digitalmars.com...
On 02/04/2015 10:42 PM, zhmt wrote:
The following article is very informative:
http://dlang.org/d-array-article.html
Nice and important article.
But: How could I have looked this up this myself?
Syntax for checking if an element exists in a list
Hello,
I would like to know if there is a better (easier to wite,
easier to read, easier to understand) way to check if an element
(string) is
in a list of strings.
Here are the possibilities I see today, as someone who is new
to D:
1)
On Thursday, 5 February 2015 at 10:12:47 UTC, wrote:
On Thursday, 5 February 2015 at 06:58:09 UTC, Ali Çehreli wrote:
On 02/04/2015 10:42 PM, zhmt wrote:
Here is a simple code snippet:
With this approach, the allocation of `arr` itself is often
clumsy and error-prone. In this case it is
Aldacron and I have determined that I'm doing something weird
with the imports between gl.d and gl3.d, the functions I'm trying
to access are deprecated so the problem is less that they aren't
loading and more that I can see them at all.
On 2015-02-05 at 17:25, bearophile wrote:
It has to be a void function (or perhaps bettter it can return true/false if it
has removed the item, so it becomes @nogc and nothrow).
And it has to remove the first item equal to the given one.
You can then add a second function that removes at a
On 02/05/2015 01:49 AM, Christof Schardt wrote:
Ali Çehreli acehr...@yahoo.com schrieb im Newsbeitrag
news:mav4a1$l3a$1...@digitalmars.com...
On 02/04/2015 10:42 PM, zhmt wrote:
The following article is very informative:
http://dlang.org/d-array-article.html
Nice and important article.
50 matches
Mail list logo