Re: My friend can't install DMD 2.076.0 after he deleted contents of C:\D

2017-09-18 Thread Andre Kostur via Digitalmars-d-learn

On 2017-09-16 10:33 PM, rikki cattermole wrote:

On 17/09/2017 6:30 AM, Enjoys Math wrote:


Series of messages from installer:

DMD v2.076.0 is installed on your system
Press 'OK' to replace by DMD 2.076.0
An error occurred when removing DMD v2.076.0
Run 'dmd-2.076.0.exe /f to force install

And using the command line has no effect - it repeats the above.

He got into this situation by accidentally installing Visual Studio 
and / or Visual D to C:\D where I told him to install D to.


At one point I told him to delete everything in C:\D and start over. 
*That* was a mistake...


He's used a trial version of Revo-Uninstaller to remove contents of 
registry.  The issue remains.  How can we repair his system so that we 
can install D on it again?


Thanks.


Skip Revo-Uninstaller, no idea why you'd ever use such trial software.
Anyway what you want is CCleaner, standard software that all Windows 
installs should have on hand.


That should remove all references to VS quite happily. It does a lot 
more than just modify the registry too :)


Be sure to check the latest news on CCleaner... it's been reported as 
being compromised.  Be sure to get a clean version.  (I've not used it 
as I'm not on a Windows machine.)


Re: Express "Class argument may not be null" ?

2017-08-08 Thread Andre Kostur via Digitalmars-d-learn

On 2017-08-08 12:38 PM, Steven Schveighoffer wrote:

On 8/8/17 2:56 PM, ag0aep6g wrote:

On 08/08/2017 08:34 PM, Johan Engelen wrote:
   How would you express the function interface intent that a 
reference to a class may not be null?
For a function "void foo(Klass)", calling "foo(null)" is valid. How 
do I express that that is invalid? (let's leave erroring with a 
compile error aside for now)


Something equivalent to C++'s pass by reference: "void foo(Klass&)".

[snip]


But you can pass null in a ref parameter:


void f(ref int x) @safe {}
void main() @safe
{
 int* p = null;
 f(*p);
}



Note that C++ also can do this, so I'm not sure the & is accomplishing 
the correct goal:


void foo(Klass&);

int main()
{
Klass *k = NULL;
foo(*k);
}

However, the in contract does actually enforce the requirement.


To be fair: it cannot be done in C++ without first invoking Undefined 
Behaviour (such as dereferencing a nullptr).


Re: Trying to make a TCP server, client connects and disconnects immediately

2015-02-05 Thread Andre Kostur via Digitalmars-d-learn

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 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
first twelve bytes (and return 12) so you can slice it buffer[0 ..
returnedValue] to get the data.

If there's more available than the buffer will hold, that data will be
held on to until next time you call receive. If 5000 bytes come off
the network, it will return 4096 the first time, then next time
through the loop, it will return the remaining 904.


How can you distinguish between different packets that get sent? Won't
they all be merged to a giant blob of data?


You need to give each of your packets a header. At a minimum you'll
want a message ID and message length. When a message comes in, you use
the length field to determine where one packet ends and the next one
begins.


Oh sweet. Though if one message length is off by even 1 byte, then all
future messages get corrupted?


Yep.  You're using a reliable stream-based protocol.  If you want 
discrete messages, you can use UDP.  Though it is an unreliable 
packet-oriented protocol.  Don't foul up your message lengths


Re: Can't install dub on Debian

2014-11-12 Thread Andre Kostur via Digitalmars-d-learn

On 2014-11-12, 5:39 AM, Suliman wrote:

I did 2 steps from http://d-apt.sourceforge.net/



[snip]


The following packages have unmet dependencies:
  dub : Depends: dmd-bin but it is not going to be installed or
 dmd but it is not installable
PreDepends: multiarch-support but it is not installable
E: Broken packages


OK, what does it complain about if you try to apt-get install 
multiarch-support ?


Network programming

2014-05-24 Thread Andre Kostur via Digitalmars-d-learn
I'm finally making my first concerted foray into D programming.  Being a 
networking guy (and a good history in C and C++) I'm starting with some 
network code (and trying to use vibe.d as well).  However, I'm running 
into some holes that I'm not sure if I'm overlooking something or just 
that nobody has run into these themselves yet.  As a quick overview, I'm 
looking to talk to the netlink and tun interfaces on linux, as well as 
raw IP packets (below UDP and TCP).


First up is the D equivalent to htons/ntohs.  I've found 
core.bitop.bswap, but that only works on 32-bit values, and not 16.  And 
come to think of it, it would be blindly swapping the bytes.  What about 
platforms (hello, sparc) where host byte order is the same as network 
byte order?


Re: Network programming

2014-05-24 Thread Andre Kostur via Digitalmars-d-learn

On 2014-05-24, 11:18 AM, Andre Kostur wrote:

I'm finally making my first concerted foray into D programming.  Being a
networking guy (and a good history in C and C++) I'm starting with some
network code (and trying to use vibe.d as well).  However, I'm running
into some holes that I'm not sure if I'm overlooking something or just
that nobody has run into these themselves yet.  As a quick overview, I'm
looking to talk to the netlink and tun interfaces on linux, as well as
raw IP packets (below UDP and TCP).

First up is the D equivalent to htons/ntohs.  I've found
core.bitop.bswap, but that only works on 32-bit values, and not 16.  And
come to think of it, it would be blindly swapping the bytes.  What about
platforms (hello, sparc) where host byte order is the same as network
byte order?


Of course in fine tradition... minutes after posting one finds an 
answer.  I'm looking too low... std.bitmanip has what I'm looking for.