Re: Derelict3 object.Error@(0): Access Violation?

2015-11-27 Thread Mike Parker via Digitalmars-d-learn

On Friday, 27 November 2015 at 09:24:47 UTC, Alexander wrote:

On Friday, 27 November 2015 at 07:53:09 UTC, Rikki Cattermole




Ah ok!
so here's my updated code. I still get the object error. I am 
trying to get a  blank window to appear. I call the reload 
after I set the glfwcontext. I'm not sure what I'm missing here.


There's nothing obvious that jumps out. You really should not 
have been seeing an access violation with the first bit of code 
you posted if the problem were simply that no context were 
loaded. I suggest you try again with just a simple call to 
DerelictGL3.load and see if you still get the error. If so, see 
if you can run a hello world.


Re: Derelict3 object.Error@(0): Access Violation?

2015-11-27 Thread Mike Parker via Digitalmars-d-learn

On Friday, 27 November 2015 at 16:20:47 UTC, Mike Parker wrote:
On Friday, 27 November 2015 at 07:53:09 UTC, Rikki Cattermole 
wrote:




When you activate an OpenGL context you reload it. You do not 
do this when one is not activated.


Doing so shouldn't cause an access violation, though. It would 
be throwing a DerelictException saying that no context has been 
loaded yet.


I meant to say, failure to do so.


Re: Derelict3 object.Error@(0): Access Violation?

2015-11-27 Thread Alexander via Digitalmars-d-learn

On Friday, 27 November 2015 at 16:26:44 UTC, Mike Parker wrote:

On Friday, 27 November 2015 at 09:24:47 UTC, Alexander wrote:

On Friday, 27 November 2015 at 07:53:09 UTC, Rikki Cattermole




Ah ok!
so here's my updated code. I still get the object error. I am 
trying to get a  blank window to appear. I call the reload 
after I set the glfwcontext. I'm not sure what I'm missing 
here.


There's nothing obvious that jumps out. You really should not 
have been seeing an access violation with the first bit of code 
you posted if the problem were simply that no context were 
loaded. I suggest you try again with just a simple call to 
DerelictGL3.load and see if you still get the error. If so, see 
if you can run a hello world.


I managed to get it working. I couldn't do a writeln command 
because I was getting that same error. I created a new project 
and that fixed the problem. :) thanks for the help!


Re: Password Storage

2015-11-27 Thread BLM768 via Digitalmars-d-learn

On Friday, 27 November 2015 at 16:14:06 UTC, H. S. Teoh wrote:
True, so you'd store hash(password01) in the database, and 
compute

hash(X + hash(password)) during authentication.


T


Another option is SCRAM: 
https://en.wikipedia.org/wiki/Salted_Challenge_Response_Authentication_Mechanism


Re: [Dtiled] Unfamiliar terms and trouble using it for Dgame

2015-11-27 Thread Namespace via Digitalmars-d-learn

On Friday, 27 November 2015 at 13:00:16 UTC, Jack wrote:

Greetings!

I've been using Dgame for quite a while now and I have been 
learning quite a lot from using playing with it. Then I found 
Tiled that's a tool to draw tilemaps, and DTiled to implement 
it.


Link [ http://code.dlang.org/packages/dtiled]

I've spent about an hour in order to make it work in Dgame, 
basing my code in the examples, and I have a bit of trouble in 
using it, since I am just a newbie.


I've learned about templates, and all the other doodads, but I 
have trouble translating the tutorial code in loading the map 
to work with Dgame.


Can someone help me understand the code? I can't wrap my head 
around it.


What exactly causes you problems?



Re: The best way to store a structure by reference

2015-11-27 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Nov 27, 2015 at 11:38:28AM +0300, drug via Digitalmars-d-learn wrote:
> I need to store a struct like a reference type. Now I use pointer for
> this, is it the best D way? This pointer is private and access to it
> is safe, but it's just unusual for me to see pointers in D code.

There's nothing strange about pointers in D code. They're relatively
rare thanks to the various nice abstractions D offers, but you do still
see them from time to time (e.g., in expressions like `x in aa`).


T

-- 
He who laughs last thinks slowest.


Re: Password Storage

2015-11-27 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Nov 27, 2015 at 02:51:30PM +, Adam D. Ruppe via Digitalmars-d-learn 
wrote:
> On Friday, 27 November 2015 at 07:46:33 UTC, H. S. Teoh wrote:
> >1) The server stores password01 in the user database.
> 
> I still wouldn't actually store this, hash it anyway and use that as
> the new "password".

True, so you'd store hash(password01) in the database, and compute
hash(X + hash(password)) during authentication.


T

-- 
It is of the new things that men tire --- of fashions and proposals and 
improvements and change. It is the old things that startle and intoxicate. It 
is the old things that are young. -- G.K. Chesterton


Re: Derelict3 object.Error@(0): Access Violation?

2015-11-27 Thread Mike Parker via Digitalmars-d-learn
On Friday, 27 November 2015 at 07:53:09 UTC, Rikki Cattermole 
wrote:




When you activate an OpenGL context you reload it. You do not 
do this when one is not activated.


Doing so shouldn't cause an access violation, though. It would be 
throwing a DerelictException saying that no context has been 
loaded yet.


[Dtiled] Unfamiliar terms and trouble using it for Dgame

2015-11-27 Thread Jack via Digitalmars-d-learn

Greetings!

I've been using Dgame for quite a while now and I have been 
learning quite a lot from using playing with it. Then I found 
Tiled that's a tool to draw tilemaps, and DTiled to implement it.


Link [ http://code.dlang.org/packages/dtiled]

I've spent about an hour in order to make it work in Dgame, 
basing my code in the examples, and I have a bit of trouble in 
using it, since I am just a newbie.


I've learned about templates, and all the other doodads, but I 
have trouble translating the tutorial code in loading the map to 
work with Dgame.


Can someone help me understand the code? I can't wrap my head 
around it.


Re: EnumMemberNames

2015-11-27 Thread anonymous via Digitalmars-d-learn

On 27.11.2015 15:05, drug wrote:

I need to get names of enum members, is it possible? EnumMembers returns
the members itself, i.e.
```
enum Sqrts : real
 {
 one   = 1,
 two   = 1.41421,
 three = 1.73205,
 }

pragma(msg, [EnumMembers!Sqrts]);
```
returns

[1.0L, 1.41421L, 1.73205L]

but I need

[ "Sqrts.one", "Sqrts.two", "Sqrts.three" ] or [ "one", "two", "three" ]


You have a variety of options with subtle differences:

module test;

import std.algorithm: map;
import std.array: array;
import std.conv: to;
import std.meta: staticMap;
import std.range: only;
import std.traits: EnumMembers, fullyQualifiedName;

enum Sqrts : real
{
one   = 1,
two   = 1.41421,
three = 1.73205,
}

pragma(msg, only(EnumMembers!Sqrts).map!(to!string).array);
/* [['o', 'n', 'e'], ['t', 'w', 'o'], ['t', 'h', 'r', 'e', 'e']] */

enum toString(alias thing) = thing.to!string;
pragma(msg, staticMap!(toString, EnumMembers!Sqrts));
/* tuple(['o', 'n', 'e'], ['t', 'w', 'o'], ['t', 'h', 'r', 'e', 
'e']) */


pragma(msg, staticMap!(fullyQualifiedName, EnumMembers!Sqrts));
/* tuple("test.Sqrts.one", "test.Sqrts.two", "test.Sqrts.three") */

enum stringOf(alias thing) = thing.stringof;
pragma(msg, staticMap!(stringOf, EnumMembers!Sqrts));
/* tuple("one", "two", "three") */


std.conv.to is the first address for conversions between types. I'd say 
use that unless you have a reason not to.


If you're doing code generation, or otherwise need the fully qualified 
name, use std.traits.fullyQualifiedName.


I'm not sure if there would ever be a reason to use .stringof over the 
other ones, other than some quick debug printing.


There are probably more ways I didn't think of.


Re: EnumMemberNames

2015-11-27 Thread Adam D. Ruppe via Digitalmars-d-learn

On Friday, 27 November 2015 at 14:05:46 UTC, drug wrote:

pragma(msg, [EnumMembers!Sqrts]);


pragma(msg, __traits(allMembers, Sqrts));


Re: The best way to store a structure by reference

2015-11-27 Thread B.Basile via Digitalmars-d-learn

On Friday, 27 November 2015 at 08:38:29 UTC, drug wrote:
I need to store a struct like a reference type. Now I use 
pointer for this, is it the best D way? This pointer is private 
and access to it is safe, but it's just unusual for me to see 
pointers in D code.


One thing: take care when comparing pointer to struct, it'll only 
compare the memory address and never call a custom opEquals for 
example... You have to explicitly compare the dereferenced stuff.


Re: The best way to store a structure by reference

2015-11-27 Thread drug via Digitalmars-d-learn

On 27.11.2015 11:38, drug wrote:

I need to store a struct like a reference type. Now I use pointer for
this, is it the best D way? This pointer is private and access to it is
safe, but it's just unusual for me to see pointers in D code.


Thank to all for answer. I stay with pointers in my case.


EnumMemberNames

2015-11-27 Thread drug via Digitalmars-d-learn
I need to get names of enum members, is it possible? EnumMembers returns 
the members itself, i.e.

```
enum Sqrts : real
{
one   = 1,
two   = 1.41421,
three = 1.73205,
}

pragma(msg, [EnumMembers!Sqrts]);
```
returns

[1.0L, 1.41421L, 1.73205L]

but I need

[ "Sqrts.one", "Sqrts.two", "Sqrts.three" ] or [ "one", "two", "three" ]


Re: Derelict3 object.Error@(0): Access Violation?

2015-11-27 Thread Nicholas Wilson via Digitalmars-d-learn

On Friday, 27 November 2015 at 07:48:15 UTC, Alexander wrote:

import std.stdio;

import derelict.opengl3.gl3;

import derelict.sdl2.sdl;

pragma(lib, "DerelictUtil.lib");

pragma(lib, "DerelictGL3.lib");

pragma(lib, "derelictSDL2.lib");

void main(){

DerelictGL3.load();
DerelictGL3.reload();
 //DerelictSDL2.load();



 writeln("Fred is nigh on impossible to

configure");

}

this is all the code I have, and I get an object.Error@(0): 
Access Violation.
I have looked all over the internet and I am unable to find a 
fix for this.

Any ideas on how to fix this or what is the cause?


the Error@(0) is almost always a null pointer dereference. Why 
that would be occurring for just attempting to load the libs i'm 
not sure.


Re: No static fold in phobos ?

2015-11-27 Thread Ali Çehreli via Digitalmars-d-learn

On 11/27/2015 12:57 PM, userabcABC123 wrote:

That would work on an AliasSeq ?
I'm surprised not to find one:

eg:

~~~
enum seq = AliasSeq!("aa", "bb");
enum val = staticFold!((a,b)=>a~b, seq);
static assert(val == "aabb");
~~~

it works with foreach or a eponymous template that consumes the sequence
, but as said where is it in phobos ?


Thanks to CTFE, there is usually no need for static of anything in D. 
Your code works with a few changes:


import std.meta;
import std.algorithm;

void main() {
enum seq = AliasSeq!("aa", "bb");
enum val = [ seq ].reduce!((a, b) => a ~ b);
static assert(val == "aabb");
}

Ali



Re: No static fold in phobos ?

2015-11-27 Thread Meta via Digitalmars-d-learn

On Friday, 27 November 2015 at 20:57:44 UTC, userabcABC123 wrote:

That would work on an AliasSeq ?
I'm surprised not to find one:

eg:

~~~
enum seq = AliasSeq!("aa", "bb");
enum val = staticFold!((a,b)=>a~b, seq);
static assert(val == "aabb");
~~~

it works with foreach or a eponymous template that consumes the 
sequence , but as said where is it in phobos ?


There's not much sense in a staticFold template that takes a 
function literal, as you can use regular functions in D at 
compile time. However, you need to use template "functions" for 
some things, so here's a simple way to do that:


template staticFold(alias f, List...)
if (List.length > 1)
{
static if (List.length == 2)
{
alias staticFold = f!(List[0], List[1]);
}
else
{
		alias staticFold = staticFold!(f, f!(List[0], List[1]), 
List[2..$]);

}
}

enum cat(alias l, alias r) = l ~ r;

void main()
{
assert(staticFold!(cat, [0], [1]) == [0, 1]);
assert(staticFold!(cat, [0], [1], [2]) == [0, 1, 2]);
assert(staticFold!(cat, [0], [1], [2], [3]) == [0, 1, 2, 3]);
assert(staticFold!(cat, [0], 1, 2, 3, 4) == [0, 1, 2, 3, 4]);
}


Re: No static fold in phobos ?

2015-11-27 Thread userabcABC123 via Digitalmars-d-learn

On Friday, 27 November 2015 at 23:46:32 UTC, Ali Çehreli wrote:

On 11/27/2015 12:57 PM, userabcABC123 wrote:

That would work on an AliasSeq ?
I'm surprised not to find one:

eg:

~~~
enum seq = AliasSeq!("aa", "bb");
enum val = staticFold!((a,b)=>a~b, seq);
static assert(val == "aabb");
~~~

it works with foreach or a eponymous template that consumes 
the sequence

, but as said where is it in phobos ?


Thanks to CTFE, there is usually no need for static of anything 
in D. Your code works with a few changes:


import std.meta;
import std.algorithm;

void main() {
enum seq = AliasSeq!("aa", "bb");
enum val = [ seq ].reduce!((a, b) => a ~ b);
static assert(val == "aabb");
}

Ali


Thx, so the trick was to pack seq in something that's a range...


Re: Derelict GLFW3 glfw3.dll error

2015-11-27 Thread Mike Parker via Digitalmars-d-learn

On Friday, 27 November 2015 at 22:58:20 UTC, Alexander wrote:

ERROR: 
"derelict.util.exception.SharedLibLoadException@..\..\AppData\Roaming\dub\packages\derelict-util-2.0.4\source\derelict\util\exception.d(35): Failed to load one or more shared libraries:

glfw3.dll - The specified module could not be found."

Is there a way for me to link the glfw.dll so that derelictUtil 
can find the dll? Or am I going about this wrong?


No, none of the Derelict packages have a link-time dependency the 
libraries they bind. It's purely a runtime dependency. You need 
to make sure that the DLL is somewhere it can be found. GLFW3 is 
not a system library, so that generally means you need to make 
sure it is in the same directory as your executable.




Re: [Dtiled] Unfamiliar terms and trouble using it for Dgame

2015-11-27 Thread Jack via Digitalmars-d-learn

On Friday, 27 November 2015 at 19:22:50 UTC, Namespace wrote:

On Friday, 27 November 2015 at 13:00:16 UTC, Jack wrote:

Greetings!

I've been using Dgame for quite a while now and I have been 
learning quite a lot from using playing with it. Then I found 
Tiled that's a tool to draw tilemaps, and DTiled to implement 
it.


Link [ http://code.dlang.org/packages/dtiled]

I've spent about an hour in order to make it work in Dgame, 
basing my code in the examples, and I have a bit of trouble in 
using it, since I am just a newbie.


I've learned about templates, and all the other doodads, but I 
have trouble translating the tutorial code in loading the map 
to work with Dgame.


Can someone help me understand the code? I can't wrap my head 
around it.


What exactly causes you problems?


Well to start, I just copied the code for loading the map and 
tried to build it, substituting the variables like Rect and 
others.


Then it went crazy all of a sudden:

http://dpaste.com/2D59A2B

The whole thing went mad, and I was sure I had my imports correct:

import dtiled.data;
import dtiled.map;
import dtiled.grid;
import dtiled.algorithm;
import dtiled.coords;

import Dgame.Math.Rect;
import Dgame.Math.Vector2;
import Dgame.Math.Geometry;
import Dgame.Math.Vertex;

And that's where I was left dumbfounded. I use the latest D 
compiler, and the latest dub. Dmd v.2.069.1 and dub v.0.9.24


Derelict GLFW3 glfw3.dll error

2015-11-27 Thread Alexander via Digitalmars-d-learn

import std.stdio;

import derelict.opengl3.gl3;
import derelict.glfw3.glfw3;
pragma(lib, 
"C:\\Users\\Alexander\\AppData\\Roaming\\dub\\packages\\derelict-gl3-1.0.17\\lib\\DerelictGL3");
pragma(lib, 
"C:\\Users\\Alexander\\AppData\\Roaming\\dub\\packages\\derelict-glfw3-master\\lib\\DerelictGLFW3");
pragma(lib, 
"C:\\Users\\Alexander\\AppData\\Roaming\\dub\\packages\\derelict-util-2.0.4\\lib\\DerelictUtil");

pragma(lib,"lb");

int main()
{
DerelictGL3.load();
DerelictGLFW3.load();
GLFWwindow* window;


if (!glfwInit())
return -1;


window = glfwCreateWindow(640, 480, "Hello World", null, 
null);

if (!window)
{
glfwTerminate();
return -1;
}

/* Make the window's context current */
glfwMakeContextCurrent(window);
DerelictGL3.reload();


while (!glfwWindowShouldClose(window))
{



glfwSwapBuffers(window);


glfwPollEvents();
}

glfwTerminate();
return 0;
}


ERROR: 
"derelict.util.exception.SharedLibLoadException@..\..\AppData\Roaming\dub\packages\derelict-util-2.0.4\source\derelict\util\exception.d(35): Failed to load one or more shared libraries:

glfw3.dll - The specified module could not be found."

Is there a way for me to link the glfw.dll so that derelictUtil 
can find the dll? Or am I going about this wrong?


Re: Multithreaded HTTP Download

2015-11-27 Thread Mike McKee via Digitalmars-d-learn
Hey guys, as it turns out, someone on stackoverflow.com pointed 
out in a Perl version of this question that the Bash example that 
was given is really buggy and doesn't make sense. They say that 
trying to download a single file using two socket handles will 
not speed up the download. So, this may or may not be possible. 
Your thoughts?





Re: Password Storage

2015-11-27 Thread Chris Wright via Digitalmars-d-learn
On Fri, 27 Nov 2015 08:09:49 -0800, H. S. Teoh via Digitalmars-d-learn
wrote:

> On Fri, Nov 27, 2015 at 02:51:30PM +, Adam D. Ruppe via
> Digitalmars-d-learn wrote:
>> On Friday, 27 November 2015 at 07:46:33 UTC, H. S. Teoh wrote:
>> >1) The server stores password01 in the user database.
>> 
>> I still wouldn't actually store this, hash it anyway and use that as
>> the new "password".
> 
> True, so you'd store hash(password01) in the database, and compute
> hash(X + hash(password)) during authentication.
> 
> 
> T

Alternatively, you could do what's industry standard for non-sensitive 
sites:

* Always use TLS.
* Send passwords to the server. Memory regurgitation attacks can reveal 
these passwords, which allows attackers to reuse those credentials on 
other sites to impersonate people.
* Store salted hashes of passwords rather than the passwords themselves.
* Hope that your certificate authority is secure. Actually, hope that 
*every* certificate authority is secure. Otherwise, MITM attack.

Or you can take a slightly more paranoid approach:
* Use certificate pinning to prevent MITM attacks.
* The client sends a salted hash of their password. You store a salted 
hash of that. This saves users from their password reuse habits if 
someone finds an arbitrary code execution flaw or memory regurgitation 
attack in your server.

This approach is at least marginally more secure than yours (if your 
server randomly generates the same nonce twice for the same person, I can 
use a replay attack, for instance) and is better vetted.

Security is hard.


Multithreaded HTTP Download

2015-11-27 Thread Mike McKee via Digitalmars-d-learn
Looking at this example that's an all-Bash technique, someone has 
figured out on OSX (and Unix, Linux, FreeBSD, etc.) how to use 
/dev/tcp and download a zip file in a multithreaded way (they use 
only two threads, but you get the point):


http://www.linuxquestions.org/questions/programming-9/bash-and-netcat-stripping-http-header-758911-print/

(scroll down to Gnashley's post)

The technique is basically to establish 2 or more TCP socket 
handles to the remote web server. Then, using an HTTP 1.1 GET, 
pull from both simultaneously. But first, disregard the preamble 
bytes. Then, as you loop and collect bytes, the first byte that 
arrives, disregard the ones from the other handles.


How could I achieve something like that in D? (Note, I'm using 
OSX.)


In general I'm trying to see if I can make a command line zip 
file downloader that downloads faster than Curl for my Qt/C++ 
application installer script for OSX.




Re: Password Storage

2015-11-27 Thread Adam D. Ruppe via Digitalmars-d-learn

On Friday, 27 November 2015 at 07:46:33 UTC, H. S. Teoh wrote:

1) The server stores password01 in the user database.


I still wouldn't actually store this, hash it anyway and use that 
as the new "password".


Re: EnumMemberNames

2015-11-27 Thread drug via Digitalmars-d-learn

On 27.11.2015 17:49, Adam D. Ruppe wrote:

__traits(allMembers, Sqrts)


Thanks to all for answers!


No static fold in phobos ?

2015-11-27 Thread userabcABC123 via Digitalmars-d-learn

That would work on an AliasSeq ?
I'm surprised not to find one:

eg:

~~~
enum seq = AliasSeq!("aa", "bb");
enum val = staticFold!((a,b)=>a~b, seq);
static assert(val == "aabb");
~~~

it works with foreach or a eponymous template that consumes the 
sequence , but as said where is it in phobos ?


Re: Derelict GLFW3 glfw3.dll error

2015-11-27 Thread Mike Parker via Digitalmars-d-learn

On Friday, 27 November 2015 at 22:58:20 UTC, Alexander wrote:

import std.stdio;

import derelict.opengl3.gl3;
import derelict.glfw3.glfw3;
pragma(lib, 
"C:\\Users\\Alexander\\AppData\\Roaming\\dub\\packages\\derelict-gl3-1.0.17\\lib\\DerelictGL3");
pragma(lib, 
"C:\\Users\\Alexander\\AppData\\Roaming\\dub\\packages\\derelict-glfw3-master\\lib\\DerelictGLFW3");
pragma(lib, 
"C:\\Users\\Alexander\\AppData\\Roaming\\dub\\packages\\derelict-util-2.0.4\\lib\\DerelictUtil");

pragma(lib,"lb");



I should also point out that if you're using DUB to build your 
project, you do not need these pragmas. DUB will manage all of 
this for you.


Re: The best way to store a structure by reference

2015-11-27 Thread Ali Çehreli via Digitalmars-d-learn

On 11/27/2015 12:38 AM, drug wrote:

I need to store a struct like a reference type. Now I use pointer for
this, is it the best D way? This pointer is private and access to it is
safe, but it's just unusual for me to see pointers in D code.


Agreed but that's the only way.

Ali



Re: Multidimensional AA question

2015-11-27 Thread Jack Applegame via Digitalmars-d-learn

On Thursday, 26 November 2015 at 17:27:34 UTC, André wrote:
My question now is: is there some more elegant solution to 
achieve this? Something like in C++ when you have std::map's of 
std::map's and just access the elements and the entry is 
created implicitly?

No. But you can create a wrapper:
http://dpaste.dzfl.pl/80ad84e8f010


Re: Derelict3 object.Error@(0): Access Violation?

2015-11-27 Thread Alexander via Digitalmars-d-learn
On Friday, 27 November 2015 at 07:53:09 UTC, Rikki Cattermole 
wrote:

On 27/11/15 8:48 PM, Alexander wrote:

import std.stdio;

import derelict.opengl3.gl3;

import derelict.sdl2.sdl;

pragma(lib, "DerelictUtil.lib");

pragma(lib, "DerelictGL3.lib");

pragma(lib, "derelictSDL2.lib");

void main(){

  DerelictGL3.load();
 DerelictGL3.reload();
  //DerelictSDL2.load();



  writeln("Fred is nigh on impossible to

configure");

}

this is all the code I have, and I get an object.Error@(0): 
Access

Violation.
I have looked all over the internet and I am unable to find a 
fix for this.

Any ideas on how to fix this or what is the cause?


When you activate an OpenGL context you reload it. You do not 
do this when one is not activated.


import derelict.opengl3.gl3;
import derelict.glfw3.glfw3;

import buffer, shader;

pragma(lib, "DerelictGLFW3");
pragma(lib, "DerelictGL3");
pragma(lib, "DerelictUtil");
pragma(lib, "dl");

int main()
{
DerelictGL3.load();
DerelictGLFW3.load();
GLFWwindow* window;


if (!glfwInit())
return -1;


window = glfwCreateWindow(640, 480, "Hello World", null, 
null);

if (!window)
{
glfwTerminate();
return -1;
}

/* Make the window's context current */
glfwMakeContextCurrent(window);
DerelictGL3.reload();


while (!glfwWindowShouldClose(window))
{



glfwSwapBuffers(window);


glfwPollEvents();
}

glfwTerminate();
return 0;
}

Ah ok!
so here's my updated code. I still get the object error. I am 
trying to get a  blank window to appear. I call the reload after 
I set the glfwcontext. I'm not sure what I'm missing here.


Re: Multidimensional AA question

2015-11-27 Thread Jack Applegame via Digitalmars-d-learn
On Friday, 27 November 2015 at 04:21:41 UTC, Nicholas Wilson 
wrote:
AA are weird in that AFAIK you need to "initialise" them before 
you try to look suff up in them else they crash. i.e.

int[string] foo;
// auto e = "1" in foo; // crash AA not initialised
foo[ "blah"] = 0;
foo.remove("blah");
auto e = "1" in foo; //doesn't crash


It's not true.
"Not initalzed" AA s just empty AA.
http://dpaste.dzfl.pl/82b38a2ad504


The best way to store a structure by reference

2015-11-27 Thread drug via Digitalmars-d-learn
I need to store a struct like a reference type. Now I use pointer for 
this, is it the best D way? This pointer is private and access to it is 
safe, but it's just unusual for me to see pointers in D code.


Re: Password Storage

2015-11-27 Thread Brad Anderson via Digitalmars-d-learn

On Friday, 27 November 2015 at 00:17:34 UTC, brian wrote:

[snip]

Can the developers in the room confirm if this is the correct 
approach?

Are there examples of betters ways of doing this?

Regards
Brian


Botan has well thought out password hashing:

https://github.com/etcimon/botan/wiki/Password-Hashing


Re: The best way to store a structure by reference

2015-11-27 Thread Kagamin via Digitalmars-d-learn
I use this http://dpaste.dzfl.pl/b926ff181709 to simulate 
reference types.


Re: The best way to store a structure by reference

2015-11-27 Thread rsw0x via Digitalmars-d-learn

On Friday, 27 November 2015 at 08:38:29 UTC, drug wrote:
I need to store a struct like a reference type. Now I use 
pointer for this, is it the best D way? This pointer is private 
and access to it is safe, but it's just unusual for me to see 
pointers in D code.


if you own the resource, consider std.typecons.unique or 
std.typecons.refcounted

otherwise consider std.typecons.nullableref