Re: Help playing sounds using arsd.simpleaudio

2019-10-18 Thread Murilo via Digitalmars-d-learn

On Saturday, 19 October 2019 at 02:10:54 UTC, Adam D. Ruppe wrote:

On Saturday, 19 October 2019 at 01:48:57 UTC, Murilo wrote:

init: Operation not permitted


Your system probably uses PulseAudio which I don't like, so I 
don't support it in my code.


It *might* work to run `pasuspender -- ./your_program_here` but 
I don't know.


I can check more tomorrow.


That unfortunately didn't work. I would be very grateful if you 
could find out a way around it and tell me.


Re: Some questions about GC

2019-10-18 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, October 18, 2019 10:54:55 AM MDT Roland Hadinger via Digitalmars-
d-learn wrote:
> These questions probably need some context: I'm working on an
> interpreter that will manage memory via reference counted struct
> types. To deal with the problem of strong reference cycles
> retaining memory indefinitely, weak references or recursive
> teardowns have to be used where appropriate.
>
> To help detect memory leaks from within the interpreter, I'd also
> like to employ core.memory.GC in the following fashion:
>
> * keep core.memory.GC off (disabled) by default, but nonetheless
> allocate objects from GC memory
> * provide a function that can find (and reclaim) retained
> unreachable object graphs that contain strong reference cycles
> * the main purpose of this function is to find and report such
> instances, not to reclaim memory. Retained graphs should be
> reported as warnings on stderr, so that the program can be fixed
> manually, e.g. by weakening some refs in the proper places
> * the function will rely on GC.collect to find unreachable objects
> * the function will *always* be called implicitly when a program
> terminates
> * the function should also be explicitly callable from any point
> within a program.
>
> Now my questions:
>
> Is it safe to assume that a call to GC.collect will be handled
> synchronously (and won't return early)?

D's GC is a stop-the-world GC. Every thread managed by the GC is stopped
when a thread runs a collection.

> Is there a way to ensure that GC.collect will never run unless
> when called explicitly (even in out of memory situations)?

The GC only runs a collection either when you explicitly tell it to or when
you try to allocate memory using the GC, and it determines that it should
run a collection. Disabling the GC normally prevents a collection from
running, though per the documentation, it sounds like it may still run if
the GC actually runs out of memory. I had thought that it prevented
collections completely, but that's not what the documentation says. I don't
know what the current implementation does.

> Is it possible and is it OK to print to stderr while the GC is
> collecting (e.g. from @nogc code, using functions from
> core.stdc.stdio)?

No code in any thread managed by the GC is run while a collection is running
unless it's code that's triggered by the collection itself (e.g. a finalizer
being called on an object that's being collected - and even that isn't
supposed to access GC-allocated objects, because the GC might have already
destroyed them - e.g. in the case of cycle). If you want code to run at the
same time as a GC collection, it's going to have to be in a thread that is
not attached to the GC, and at that point, you shouldn't be accessing
_anything_ that's managed by the GC unless you have a guarantee that what
you're accessing won't be collected. And even then, you shouldn't be
mutating any of it.

Also, @nogc doesn't say anything about whether the code accesses
GC-allocated objects. It just means that it's not allowed to access most GC
functions, which usually just means that it doesn't allocate anything using
the GC and that it doesn't risk running a collection. So, just because a
function is @nogc doesn't necessarily mean that it's safe to run it from a
thread that isn't managed by the GC while a collection is running.

> Could I implement my function by introducing a shared global flag
> which is set prior to calling GC.collect and reset afterwards, so
> that any destructor can determine whether has been invoked by a
> "flagged" call to GC.collect and act accordingly?

You should be able to do that, but then the destructor can't be pure (though
as I understand it, there's currently a compiler bug with pure destructors
anyway which causes them to not be called), and when a destructor is run as
a finalizer, it shouldn't be accessing any other GC-allocated objects,
because the GC might have actually destroyed them already at that point.
Finalizers really aren't supposed to doh much of anything other than
managing what lives in an object directly or managing non-GC-allocated
resources. Regardless, anything that really should be operating as a
destructor rather than a finalizer has to live on the stack, since
finalizers won't be run until a collection occurs. If you're explicitly
running them yourself via your own reference counting, then you don't have
that problem, but if there's any chance that a destructor is going to be run
as a finalizer by the GC, then you have to write your destructors /
finalizers with the idea that that could happen.

> Alternatively: do I need to implement such a flag, or is there
> already a way in which a destructor can determine whether it has
> been invoked by the GC?
>
> Thanks for any help!

Honestly, the way things are set up, destructors aren't supposed to know or
care about whether they're being run by the GC as a finalizer. So, the GC
isn't going to provide that kind of functionality. What you're 

Re: Help playing sounds using arsd.simpleaudio

2019-10-18 Thread Adam D. Ruppe via Digitalmars-d-learn

On Saturday, 19 October 2019 at 01:48:57 UTC, Murilo wrote:

init: Operation not permitted


Your system probably uses PulseAudio which I don't like, so I 
don't support it in my code.


It *might* work to run `pasuspender -- ./your_program_here` but I 
don't know.


I can check more tomorrow.


Re: Any 3D Game or Engine with examples/demos which just work (compile) out of the box on linux ?

2019-10-18 Thread Mike Parker via Digitalmars-d-learn

On Saturday, 19 October 2019 at 00:57:48 UTC, Prokop Hapala wrote:
The dmech/demos also seems to be almost running just it somehow 
cannot find or use my libsdl.so library which it just compiled 
(it is in 'dmech/demos/lib')



derelict.util.exception.SharedLibLoadException@derelict/util/exception.d(43): 
Failed to load one or more shared libraries:
./lib/libsdl.so - ./lib/libsdl.so: wrong ELF class: ELFCLASS32



The problem is there in the error message. You have a 32-bit 
version of SDL, but you're compiling a 64-bit app. You need the 
64-bit SDL.


Re: Help playing sounds using arsd.simpleaudio

2019-10-18 Thread Murilo via Digitalmars-d-learn

but at the beginning of main() set it up with


auto audio = new AudioPcmOutThread();
audio.start();
scope(exit) {
audio.stop();
audio.join();
}


Thanks Adam. That worked on Windows, but now that I have switched 
to Linux Mint it is throwing this:
arsd.simpleaudio.AlsaException@arsd/simpleaudio.d(1170): params 
init: Operation not permitted


??:? arsd.simpleaudio.snd_pcm_t* 
arsd.simpleaudio.openAlsaPcm(arsd.simpleaudio.snd_pcm_stream_t) 
[0x55eab05a0f4a]
??:? ref arsd.simpleaudio.AudioOutput 
arsd.simpleaudio.AudioOutput.__ctor(int) [0x55eab059f7ec]
??:? void arsd.simpleaudio.AudioPcmOutThread.run() 
[0x55eab059f23d]

??:? void core.thread.Thread.run() [0x55eab05c10d1]
??:? thread_entryPoint [0x55eab05d809b]
??:? [0x7fb40e4ff6da]

What should I do?


Re: Any 3D Game or Engine with examples/demos which just work (compile) out of the box on linux ?

2019-10-18 Thread Prokop Hapala via Digitalmars-d-learn
The dmech/demos also seems to be almost running just it somehow 
cannot find or use my libsdl.so library which it just compiled 
(it is in 'dmech/demos/lib')



(dmd-2.088.0)(dmd-2.088.0)prokop@prokop-Lenovo-ideapad-Y700-15ISK:~/git_SW/_Dlang/dmech/demos$
 dub
Performing "debug" build using 
/home/prokop/dlang/dmd-2.088.0/linux/bin64/dmd for x86_64.

dlib 0.16.0: target for configuration "library" is up to date.
demo ~master: target for configuration "pyramid" is up to date.
To force a rebuild of up-to-date targets, run again with --force.
Running ./pyramid
derelict.util.exception.SharedLibLoadException@derelict/util/exception.d(43): 
Failed to load one or more shared libraries:
./lib/libsdl.so - ./lib/libsdl.so: wrong ELF class: ELFCLASS32

derelict/util/exception.d:75 void 
derelict.util.exception.SharedLibLoadException.throwNew(const(char[][]), const(char[][])) [0x55ecce3ed712]
derelict/util/sharedlib.d:221 void 
derelict.util.sharedlib.SharedLib.load(immutable(char)[][]) 
[0x55ecce3edef3]
derelict/util/loader.d:91 void 
derelict.util.loader.SharedLibLoader.load(immutable(char)[][]) 
[0x55ecce3edb54]
derelict/util/loader.d:86 void 
derelict.util.loader.SharedLibLoader.load(immutable(char)[]) 
[0x55ecce3edb25]
dgl/core/application.d:185 void 
dgl.core.application.loadLibraries() [0x55ecce3f1127]

pyramid.d:385 _Dmain [0x55ecce406a68]
Program exited with code 1






Re: Any 3D Game or Engine with examples/demos which just work (compile) out of the box on linux ?

2019-10-18 Thread Prokop Hapala via Digitalmars-d-learn

The whole thing is like this:

prokop@prokop-Lenovo-ideapad-Y700-15ISK:~/git_SW/_Dlang/dagon-demo$ source 
~/dlang/dmd-2.088.0/activate
(dmd-2.088.0)prokop@prokop-Lenovo-ideapad-Y700-15ISK:~/git_SW/_Dlang/dagon-demo$
 dub
WARNING: A deprecated branch based version specification is used 
for the dependency dagon. Please use numbered versions instead. 
Also note that you can still use the dub.selections.json file to 
override a certain dependency to use a branch instead.
Invalid source/import path: 
/home/prokop/git_SW/_Dlang/dagon-demo/shaders
Performing "debug" build using 
/home/prokop/dlang/dmd-2.088.0/linux/bin64/dmd for x86_64.
bindbc-loader 0.1.1: target for configuration "noBC" is up to 
date.

bindbc-ft 0.1.0: target for configuration "library" is up to date.
bindbc-nuklear 0.1.0: target for configuration "dynamic" is up to 
date.
bindbc-opengl 0.4.0: target for configuration "dynamic" is up to 
date.
bindbc-sdl 0.4.1: target for configuration "dynamic" is up to 
date.

dlib 0.16.0: target for configuration "library" is up to date.
dagon ~dev_0.10: target for configuration "library" is up to date.
dagondemo 0.10.0+commit.6.gdf2dd63: target for configuration 
"application" is up to date.

To force a rebuild of up-to-date targets, run again with --force.
Copying files for dagon...
Invalid source/import path: 
/home/prokop/git_SW/_Dlang/dagon-demo/shaders

Running ./dagondemo




Re: Any 3D Game or Engine with examples/demos which just work (compile) out of the box on linux ?

2019-10-18 Thread Prokop Hapala via Digitalmars-d-learn

On Friday, 18 October 2019 at 20:09:47 UTC, Aldo wrote:
Try to move that libnuklear.so or rename it to nuklear.so. I 
checked bindbc code and saw :


version(Windows) {
const(char)[][1] libNames = ["nuklear.dll"];
}
else version(OSX) {
const(char)[][1] libNames = ["nuklear.dylib"];
}
else version(Posix) {
const(char)[][2] libNames = [
"nuklear.so",
"/usr/local/lib/nuklear.so",
];
}


Great! progress! ... It shown loading splash screen and moving 
loading bar, when it reach the end, it segfault


prokop@prokop-Lenovo-ideapad-Y700-15ISK:~/git_SW/_Dlang/dagon-demo$ ./dagondemo
Loading scene "TestScene"
Segmentation fault (core dumped)

possibly it it connected with the error I saw during compilation:
Copying files for dagon...
Invalid source/import path: 
/home/prokop/git_SW/_Dlang/dagon-demo/shaders


Re: Any 3D Game or Engine with examples/demos which just work (compile) out of the box on linux ?

2019-10-18 Thread Aldo via Digitalmars-d-learn

On Friday, 18 October 2019 at 19:20:04 UTC, Prokop Hapala wrote:
On Friday, 18 October 2019 at 06:24:38 UTC, Ferhat Kurtulmuş 
wrote:
On Friday, 18 October 2019 at 06:11:37 UTC, Ferhat Kurtulmuş 
wrote:
On Friday, 18 October 2019 at 05:52:19 UTC, Prokop Hapala 
wrote:
Already >1 year I consider to move from C++ to Dlang or to 
Rust in my hobby game development (mostly based on physical 
simulations 
https://github.com/ProkopHapala/SimpleSimulationEngine). I 
probably prefer Dlang because it compiles much faster, and I 
can copy C/C++ code to it without much changes.


[...]


I cannot make any comment for others. But Dagon should work. 
I wrote a very little demo game some time ago 
https://github.com/aferust/dagon-shooter. I didn't try to 
compile and run it on Linux.I think you need to have a 
nuklear.so in your path, since Bindbc loaders try to load 
dynamic libraries by default.


https://github.com/Timu5/bindbc-nuklear/blob/master/README.md

"This library contains prebuild windows dll for Nuklear, on 
different platforms you can easily build C source code from 
cmake configuration in c directory."


I did what you say (I guess), but Nuclear still cannot be found:

prokop@prokop-Lenovo-ideapad-Y700-15ISK:~/git_SW/_Dlang/dagon-demo$ echo 
$LD_LIBRARY_PATH
/home/prokop/git_SW/bindbc-nuklear/build:/home/prokop/torch/install/lib:

prokop@prokop-Lenovo-ideapad-Y700-15ISK:~/git_SW/_Dlang/dagon-demo$ ls
COPYINGdata  dub.selections.json   icon.ico  input.conf
  rcedit-x64.exe  README.md  src
dagondemo  dub.json  gamecontrollerdb.txt  icon.txt  
libnuklear.so  rcedit-x86.exe  settings.conf


prokop@prokop-Lenovo-ideapad-Y700-15ISK:~/git_SW/_Dlang/dagon-demo$ ./dagondemo
Error: Nuklear library is not found. Please, install Nuklear.


Try to move that libnuklear.so or rename it to nuklear.so. I 
checked bindbc code and saw :


version(Windows) {
const(char)[][1] libNames = ["nuklear.dll"];
}
else version(OSX) {
const(char)[][1] libNames = ["nuklear.dylib"];
}
else version(Posix) {
const(char)[][2] libNames = [
"nuklear.so",
"/usr/local/lib/nuklear.so",
];
}


Re: Any 3D Game or Engine with examples/demos which just work (compile) out of the box on linux ?

2019-10-18 Thread Prokop Hapala via Digitalmars-d-learn
On Friday, 18 October 2019 at 06:24:38 UTC, Ferhat Kurtulmuş 
wrote:
On Friday, 18 October 2019 at 06:11:37 UTC, Ferhat Kurtulmuş 
wrote:
On Friday, 18 October 2019 at 05:52:19 UTC, Prokop Hapala 
wrote:
Already >1 year I consider to move from C++ to Dlang or to 
Rust in my hobby game development (mostly based on physical 
simulations 
https://github.com/ProkopHapala/SimpleSimulationEngine). I 
probably prefer Dlang because it compiles much faster, and I 
can copy C/C++ code to it without much changes.


[...]


I cannot make any comment for others. But Dagon should work. I 
wrote a very little demo game some time ago 
https://github.com/aferust/dagon-shooter. I didn't try to 
compile and run it on Linux.I think you need to have a 
nuklear.so in your path, since Bindbc loaders try to load 
dynamic libraries by default.


https://github.com/Timu5/bindbc-nuklear/blob/master/README.md

"This library contains prebuild windows dll for Nuklear, on 
different platforms you can easily build C source code from 
cmake configuration in c directory."


I did what you say (I guess), but Nuclear still cannot be found:

prokop@prokop-Lenovo-ideapad-Y700-15ISK:~/git_SW/_Dlang/dagon-demo$ echo 
$LD_LIBRARY_PATH
/home/prokop/git_SW/bindbc-nuklear/build:/home/prokop/torch/install/lib:

prokop@prokop-Lenovo-ideapad-Y700-15ISK:~/git_SW/_Dlang/dagon-demo$ ls
COPYINGdata  dub.selections.json   icon.ico  input.conf   
  rcedit-x64.exe  README.md  src
dagondemo  dub.json  gamecontrollerdb.txt  icon.txt  
libnuklear.so  rcedit-x86.exe  settings.conf


prokop@prokop-Lenovo-ideapad-Y700-15ISK:~/git_SW/_Dlang/dagon-demo$ ./dagondemo
Error: Nuklear library is not found. Please, install Nuklear.






Some questions about GC

2019-10-18 Thread Roland Hadinger via Digitalmars-d-learn
These questions probably need some context: I'm working on an 
interpreter that will manage memory via reference counted struct 
types. To deal with the problem of strong reference cycles 
retaining memory indefinitely, weak references or recursive 
teardowns have to be used where appropriate.


To help detect memory leaks from within the interpreter, I'd also 
like to employ core.memory.GC in the following fashion:


* keep core.memory.GC off (disabled) by default, but nonetheless 
allocate objects from GC memory
* provide a function that can find (and reclaim) retained 
unreachable object graphs that contain strong reference cycles
* the main purpose of this function is to find and report such 
instances, not to reclaim memory. Retained graphs should be 
reported as warnings on stderr, so that the program can be fixed 
manually, e.g. by weakening some refs in the proper places

* the function will rely on GC.collect to find unreachable objects
* the function will *always* be called implicitly when a program 
terminates
* the function should also be explicitly callable from any point 
within a program.


Now my questions:

Is it safe to assume that a call to GC.collect will be handled 
synchronously (and won't return early)?


Is there a way to ensure that GC.collect will never run unless 
when called explicitly (even in out of memory situations)?


Is it possible and is it OK to print to stderr while the GC is 
collecting (e.g. from @nogc code, using functions from 
core.stdc.stdio)?


Could I implement my function by introducing a shared global flag 
which is set prior to calling GC.collect and reset afterwards, so 
that any destructor can determine whether has been invoked by a 
"flagged" call to GC.collect and act accordingly?


Alternatively: do I need to implement such a flag, or is there 
already a way in which a destructor can determine whether it has 
been invoked by the GC?


Thanks for any help!


Re: PHP to D Conversion

2019-10-18 Thread Andre Pany via Digitalmars-d-learn

On Friday, 18 October 2019 at 09:21:46 UTC, Vino wrote:

On Friday, 18 October 2019 at 09:17:24 UTC, Vino wrote:

On Friday, 18 October 2019 at 09:11:18 UTC, Vino wrote:

[...]


App.d

import vibe.vibe;
import avm.test;

void main()
{
auto settings = new HTTPServerSettings;
settings.port = 8080;
settings.bindAddresses = ["127.0.0.1"];
listenHTTP(settings, );

	logInfo("Please open http://127.0.0.1:8080/ in your 
browser.");

runApplication();
}

void hello(HTTPServerRequest req, HTTPServerResponse res)
{
test t = new avmtest();
res.writeBody(t.getHostname);
}


And now getting the error : Program exited with code -1073741819


Hi,

Maybe port 8080 is blocked, because there is an instance of your 
application running on the background. Just check by changing the 
port in the source code.


Kind regards
Andre


Re: Meta question - what about moving the D - Learn Forum to a seperate StackExchange platform?

2019-10-18 Thread bachmeier via Digitalmars-d-learn
On Friday, 18 October 2019 at 13:30:37 UTC, Martin Tschierschke 
wrote:

On Friday, 18 October 2019 at 12:51:35 UTC, bachmeier wrote:
On Friday, 18 October 2019 at 07:35:21 UTC, Martin 
Tschierschke wrote:
If I search for what ever, not related to D, I very often end 
with a solution
found on one of the StackExchange forums like StackOverflow 
or AskUbuntu etc.


The main advantage is, that all answers can be classified 
(up/down voted, moderated etc.)
This is much better than finding something in the D-Learn 
Forum where it is difficult to see,
if several answers are given are they still valid, especially 
if they are some years old.


I know that this was asked in the D survey and I think it 
should be on the table again.


If we unite for this idea, it should be possible to start an 
own "DExchange" sub platform.


Best regards mt.


You can already ask questions on SO. What you are proposing is 
to close this forum, require registration to ask a question, 
and let JavaScript developers close questions and treat new 
users rudely. That doesn't seem like a good idea. The fact 
that most questions get asked here rather than on SO now 
suggests that there isn't much demand for SO.


I am not for moving just to StackOverflow, but to make an own 
"DExchange" / "AskD" or what ever named learn platform with and 
inside the StackExchange [1] technology. This should keep D 
users together and would avoid mixing with other languages. But 
I am not sure if this is really achievable for us.


[1] https://stackexchange.com/sites#


But then users would have to register for a new site, even if 
they already have a SO account. That would greatly reduce the 
number willing to ask questions. I don't have a problem with 
doing that (and you certainly can do so without asking anyone) 
but I strongly oppose shutting down D.learn.


Re: Meta question - what about moving the D - Learn Forum to a seperate StackExchange platform?

2019-10-18 Thread Adam D. Ruppe via Digitalmars-d-learn

On Friday, 18 October 2019 at 13:38:11 UTC, Ron Tarrant wrote:
I have found that StackExchange does often have answers, but I 
can't say I like asking questions on there, especially if the 
question is almost-the-same-but-not-the-same as a question 
asked earlier. In cases like this, I've been told that the 
previous answer applies to my question, even when it doesn't.


Was that tagged D? Other tags tend to get obnoxious attention, 
but stuff tagged D  usually gets jumped on fairly quickly by 
people you'd recognize here and we're all pretty easy going and 
can push back if outside moderators get involved.


Though really since it is the same people, I don't see any real 
difference in asking here or SO on IRC. SO might be better for 
searching and I do often write a little more there for those 
searches and links, but I don't particularly mind duplicates 
anyway.




Re: Meta question - what about moving the D - Learn Forum to a seperate StackExchange platform?

2019-10-18 Thread Martin Tschierschke via Digitalmars-d-learn

On Friday, 18 October 2019 at 13:38:11 UTC, Ron Tarrant wrote:
On Friday, 18 October 2019 at 07:35:21 UTC, Martin Tschierschke 
wrote:
I very often end with a solution found on one of the 
StackExchange forums like > StackOverflow or AskUbuntu etc.


I have found that StackExchange does often have answers, but I 
can't say I like asking questions on there, especially if the 
question is almost-the-same-but-not-the-same as a question 
asked earlier. In cases like this, I've been told that the 
previous answer applies to my question, even when it doesn't.


In one instance, a moderator closed my question without reading 
the details in order to find out that, no, it's not the same 
question at all... and then refuse to reopen the question when 
I point this out.


So, although I'll continue to use StackExchange as an 
historical resource, I would rather not depend on it for 
getting answers to new questions.


This is why I am for an own D Learn Forum, the process is 
(partly) described here:

https://meta.stackexchange.com/questions/76974/how-can-i-propose-a-new-site

The moderators of this should come from this forum community, if 
this can not be achieved, I am against a move, too.


Re: Meta question - what about moving the D - Learn Forum to a seperate StackExchange platform?

2019-10-18 Thread Martin Tschierschke via Digitalmars-d-learn
On Friday, 18 October 2019 at 12:41:53 UTC, Paolo Invernizzi 
wrote:

On Friday, 18 October 2019 at 11:45:33 UTC, Seb wrote:
On Friday, 18 October 2019 at 10:55:59 UTC, Martin 
Tschierschke wrote:

[...]


In the state of the D survey, there were more people in favor 
of StackOverflow than D.learn, but to be fair the majority 
voted for "I don't care"


https://rawgit.com/wilzbach/state-of-d/master/report.html


Maybe it's possible to simply add an up/down vote functionality 
to the forum only, just keeping the compatibility with the 
newsgroup ...


It's a win/win solution!

+1
It may help in the DIP discussions, too!

You can just see if an argument for or against a change, is 
accepted by the majority of thread readers or not. And you can 
highlight those up-voted arguments to get an better impression 
about the outcome of the discussion in total.


Re: Meta question - what about moving the D - Learn Forum to a seperate StackExchange platform?

2019-10-18 Thread Ron Tarrant via Digitalmars-d-learn
On Friday, 18 October 2019 at 07:35:21 UTC, Martin Tschierschke 
wrote:
I very often end with a solution found on one of the 
StackExchange forums like > StackOverflow or AskUbuntu etc.


I have found that StackExchange does often have answers, but I 
can't say I like asking questions on there, especially if the 
question is almost-the-same-but-not-the-same as a question asked 
earlier. In cases like this, I've been told that the previous 
answer applies to my question, even when it doesn't.


In one instance, a moderator closed my question without reading 
the details in order to find out that, no, it's not the same 
question at all... and then refuse to reopen the question when I 
point this out.


So, although I'll continue to use StackExchange as an historical 
resource, I would rather not depend on it for getting answers to 
new questions.




Re: Meta question - what about moving the D - Learn Forum to a seperate StackExchange platform?

2019-10-18 Thread Martin Tschierschke via Digitalmars-d-learn

On Friday, 18 October 2019 at 12:51:35 UTC, bachmeier wrote:
On Friday, 18 October 2019 at 07:35:21 UTC, Martin Tschierschke 
wrote:
If I search for what ever, not related to D, I very often end 
with a solution
found on one of the StackExchange forums like StackOverflow or 
AskUbuntu etc.


The main advantage is, that all answers can be classified 
(up/down voted, moderated etc.)
This is much better than finding something in the D-Learn 
Forum where it is difficult to see,
if several answers are given are they still valid, especially 
if they are some years old.


I know that this was asked in the D survey and I think it 
should be on the table again.


If we unite for this idea, it should be possible to start an 
own "DExchange" sub platform.


Best regards mt.


You can already ask questions on SO. What you are proposing is 
to close this forum, require registration to ask a question, 
and let JavaScript developers close questions and treat new 
users rudely. That doesn't seem like a good idea. The fact that 
most questions get asked here rather than on SO now suggests 
that there isn't much demand for SO.


I am not for moving just to StackOverflow, but to make an own 
"DExchange" / "AskD" or what ever named learn platform with and 
inside the StackExchange [1] technology. This should keep D users 
together and would avoid mixing with other languages. But I am 
not sure if this is really achievable for us.


[1] https://stackexchange.com/sites#





Re: Meta question - what about moving the D - Learn Forum to a seperate StackExchange platform?

2019-10-18 Thread bachmeier via Digitalmars-d-learn
On Friday, 18 October 2019 at 07:35:21 UTC, Martin Tschierschke 
wrote:
If I search for what ever, not related to D, I very often end 
with a solution
found on one of the StackExchange forums like StackOverflow or 
AskUbuntu etc.


The main advantage is, that all answers can be classified 
(up/down voted, moderated etc.)
This is much better than finding something in the D-Learn Forum 
where it is difficult to see,
if several answers are given are they still valid, especially 
if they are some years old.


I know that this was asked in the D survey and I think it 
should be on the table again.


If we unite for this idea, it should be possible to start an 
own "DExchange" sub platform.


Best regards mt.


And on the issue of knowing which answers are still valid, that 
hasn't been the case for a long time on SO. I wasted a lot of 
time yesterday with not one but two accepted answers on regular 
expressions that were wrong (both did solve the specific problem, 
but neither did what was claimed).


Re: Meta question - what about moving the D - Learn Forum to a seperate StackExchange platform?

2019-10-18 Thread bachmeier via Digitalmars-d-learn
On Friday, 18 October 2019 at 07:35:21 UTC, Martin Tschierschke 
wrote:
If I search for what ever, not related to D, I very often end 
with a solution
found on one of the StackExchange forums like StackOverflow or 
AskUbuntu etc.


The main advantage is, that all answers can be classified 
(up/down voted, moderated etc.)
This is much better than finding something in the D-Learn Forum 
where it is difficult to see,
if several answers are given are they still valid, especially 
if they are some years old.


I know that this was asked in the D survey and I think it 
should be on the table again.


If we unite for this idea, it should be possible to start an 
own "DExchange" sub platform.


Best regards mt.


You can already ask questions on SO. What you are proposing is to 
close this forum, require registration to ask a question, and let 
JavaScript developers close questions and treat new users rudely. 
That doesn't seem like a good idea. The fact that most questions 
get asked here rather than on SO now suggests that there isn't 
much demand for SO.


Re: Meta question - what about moving the D - Learn Forum to a seperate StackExchange platform?

2019-10-18 Thread Paolo Invernizzi via Digitalmars-d-learn

On Friday, 18 October 2019 at 11:45:33 UTC, Seb wrote:
On Friday, 18 October 2019 at 10:55:59 UTC, Martin Tschierschke 
wrote:

[...]


In the state of the D survey, there were more people in favor 
of StackOverflow than D.learn, but to be fair the majority 
voted for "I don't care"


https://rawgit.com/wilzbach/state-of-d/master/report.html


Maybe it's possible to simply add an up/down vote functionality 
to the forum only, just keeping the compatibility with the 
newsgroup ...


It's a win/win solution!


Re: Meta question - what about moving the D - Learn Forum to a seperate StackExchange platform?

2019-10-18 Thread Andrea Fontana via Digitalmars-d-learn
On Friday, 18 October 2019 at 10:55:59 UTC, Martin Tschierschke 
wrote:
Yes, it works as it is, but it is not the best solution to 
share know how.


I agree. I think D.learn should be moved to stackoverflow and 
D.general should stay here.


Re: Meta question - what about moving the D - Learn Forum to a seperate StackExchange platform?

2019-10-18 Thread Seb via Digitalmars-d-learn
On Friday, 18 October 2019 at 10:55:59 UTC, Martin Tschierschke 
wrote:

On Friday, 18 October 2019 at 10:23:28 UTC, jmh530 wrote:
On Friday, 18 October 2019 at 07:35:21 UTC, Martin 
Tschierschke wrote:

[snip]


I think this is something that's been proposed before, but 
most people are happy with just asking a question here and 
usually people are pretty good about helping out with answers 
when possible.


Yes, it works as it is, but it is not the best solution to 
share know how.


And if I just think: Hey, your answer is good, in the 
mailinglist / forum / newsgroup setup it is impossible to 
easily vote for it and get a count of this votes.


I think it is possible to extended the web front end of the 
forum in this direction and automatically map an '+1' or '-1' 
comment (in a single line) to a counter which will be displayed 
beside the commented post. But this is reinventing the wheel...


I am just sad, that many very good questions and answers given 
in the forum are not so easy to find as they should.


In the state of the D survey, there were more people in favor of 
StackOverflow than D.learn, but to be fair the majority voted for 
"I don't care"


https://rawgit.com/wilzbach/state-of-d/master/report.html



Re: Meta question - what about moving the D - Learn Forum to a seperate StackExchange platform?

2019-10-18 Thread Martin Tschierschke via Digitalmars-d-learn

On Friday, 18 October 2019 at 10:23:28 UTC, jmh530 wrote:
On Friday, 18 October 2019 at 07:35:21 UTC, Martin Tschierschke 
wrote:

[snip]


I think this is something that's been proposed before, but most 
people are happy with just asking a question here and usually 
people are pretty good about helping out with answers when 
possible.


Yes, it works as it is, but it is not the best solution to share 
know how.


And if I just think: Hey, your answer is good, in the mailinglist 
/ forum / newsgroup setup it is impossible to easily vote for it 
and get a count of this votes.


I think it is possible to extended the web front end of the forum 
in this direction and automatically map an '+1' or '-1' comment 
(in a single line) to a counter which will be displayed beside 
the commented post. But this is reinventing the wheel...


I am just sad, that many very good questions and answers given in 
the forum are not so easy to find as they should.


Re: Meta question - what about moving the D - Learn Forum to a seperate StackExchange platform?

2019-10-18 Thread jmh530 via Digitalmars-d-learn
On Friday, 18 October 2019 at 07:35:21 UTC, Martin Tschierschke 
wrote:

[snip]


I think this is something that's been proposed before, but most 
people are happy with just asking a question here and usually 
people are pretty good about helping out with answers when 
possible.


Re: PHP to D Conversion

2019-10-18 Thread Vino via Digitalmars-d-learn

On Friday, 18 October 2019 at 09:17:24 UTC, Vino wrote:

On Friday, 18 October 2019 at 09:11:18 UTC, Vino wrote:

[...]


App.d

import vibe.vibe;
import avm.test;

void main()
{
auto settings = new HTTPServerSettings;
settings.port = 8080;
settings.bindAddresses = ["127.0.0.1"];
listenHTTP(settings, );

logInfo("Please open http://127.0.0.1:8080/ in your browser.");
runApplication();
}

void hello(HTTPServerRequest req, HTTPServerResponse res)
{
test t = new avmtest();
res.writeBody(t.getHostname);
}


And now getting the error : Program exited with code -1073741819


Re: PHP to D Conversion

2019-10-18 Thread Vino via Digitalmars-d-learn

On Friday, 18 October 2019 at 09:11:18 UTC, Vino wrote:
On Friday, 18 October 2019 at 08:54:40 UTC, Jacob Carlborg 
wrote:

On Friday, 18 October 2019 at 06:22:33 UTC, Vino wrote:

[...]


The instance variable in the D code, `conn`,  doesn't have a 
type. I guess the type should be `Connection`. In the D 
version of `avmconnect` you're declaring a local variable 
named `conn` instead of referring to the instance variable.


--
/Jacob Carlborg


Hi Jacob,

 Thank you, I have made the below changes, and rebuilt the 
application, now the application complied without any error, 
but when i try to access the URL from webpage it errors out 
with  "127.0.0.1 refused to connect"


private Connection conn; //added

scope(exit) conn.close(); //removed

From,
Vino.B


App.d

import vibe.vibe;
import avm.test;

void main()
{
auto settings = new HTTPServerSettings;
settings.port = 8080;
settings.bindAddresses = ["127.0.0.1"];
listenHTTP(settings, );

logInfo("Please open http://127.0.0.1:8080/ in your browser.");
runApplication();
}

void hello(HTTPServerRequest req, HTTPServerResponse res)
{
test t = new avmtest();
res.writeBody(t.getHostname);
}


Re: PHP to D Conversion

2019-10-18 Thread Vino via Digitalmars-d-learn

On Friday, 18 October 2019 at 08:54:40 UTC, Jacob Carlborg wrote:

On Friday, 18 October 2019 at 06:22:33 UTC, Vino wrote:

[...]


The instance variable in the D code, `conn`,  doesn't have a 
type. I guess the type should be `Connection`. In the D version 
of `avmconnect` you're declaring a local variable named `conn` 
instead of referring to the instance variable.


--
/Jacob Carlborg


Hi Jacob,

 Thank you, I have made the below changes, and rebuilt the 
application, now the application complied without any error, but 
when i try to access the URL from webpage it errors out with  
"127.0.0.1 refused to connect"


private Connection conn; //added

scope(exit) conn.close(); //removed

From,
Vino.B


Issue with --build=profile

2019-10-18 Thread drkameleon via Digitalmars-d-learn
I'm working on a rather big project which I'm compiling with 
DMD/LDC.


The thing is when I'm trying to profile it, using `dub build 
--build=profile`, weird issues keep popping up, coming from the 
project's dependencies... eg. "Warning: statement is not 
reachable" from the dyaml package. And then it crashes with 
"/Library/D/dmd/bin/dmd failed with exit code 1."


How could I deal with this?

(In case it matters, I could also point you to my project 
sources, although I don't think it has anything to do with my 
project per-se)


Re: Vibe.d Error

2019-10-18 Thread Boris Carvajal via Digitalmars-d-learn

On Friday, 18 October 2019 at 08:06:30 UTC, Vino wrote:
  I tried install vibe.d in SUSE linux 12 SP2 and facing the 
below error, tried the options as per the link 
https://github.com/vibe-d/vibe.d/issues/1748, still no luck and 
the lib's are installed in the server




Read the last section of the readme 
https://github.com/vibe-d/vibe.d/blob/master/README.md#switching-between-openssl-versions


SUSE 12 use openssl 1.0.x version but Vibe.d is trying to link to 
1.1, try putting in your dub file:


subConfiguration "vibe-d:tls" "openssl-1.0"


Re: PHP to D Conversion

2019-10-18 Thread Aldo via Digitalmars-d-learn

On Friday, 18 October 2019 at 06:22:33 UTC, Vino wrote:

class avmtest
{
private conn;



You need to specify the type of conn. private Connection conn;


auto avmconnect()
{
	auto connectionStr = 
"host=test.srv.com;port=3910;user=testusr;pwd=#;db=test";

Connection conn = new Connection(connectionStr);
scope(exit) conn.close();
}


You are using a new connection here, maybe you want to use 
this->conn instead of Connection conn;


By the way you are closing it everytime with scope(exit).


Re: PHP to D Conversion

2019-10-18 Thread Jacob Carlborg via Digitalmars-d-learn

On Friday, 18 October 2019 at 06:22:33 UTC, Vino wrote:

Hi All,

  Request your help in converting a PHP code to D equivalent 
code


PHP Code:
class avmtest {
private $con;

function __construct() {
global $config;
$this->con = new mysqli(test.srv.com:3910, 
testusr, #, test);
if($this->con->connect_errno) { die("Connection 
Failed.\n"); }

}

function getHostname() {
$qdata = $this->con->prepare("SELECT host_name 
FROM hosts_coll");

$qdata->execute();
$qdata->bind_result($host);
while($qdata->fetch()) {
$data[] = array("HostName" => $host);
}
$sdata->close();
return $data;
}
}

D Code:
module avm.test;

import mysql;
import std.array : array;
import std.conv;
import std.variant;

class avmtest
{
private conn;

auto avmconnect()
{
	auto connectionStr = 
"host=test.srv.com;port=3910;user=testusr;pwd=#;db=test";

Connection conn = new Connection(connectionStr);
scope(exit) conn.close();
}

auto getHostname()
{
	  ResultRange qdata = conn.query("SELECT host_name FROM 
`hosts_coll`");

  Row row = qdata.front;
  Variant h = row[0];
  qdata.close();
  return h.to!string;
}
}

Error: Error: no identifier for declarator conn


The instance variable in the D code, `conn`,  doesn't have a 
type. I guess the type should be `Connection`. In the D version 
of `avmconnect` you're declaring a local variable named `conn` 
instead of referring to the instance variable.


--
/Jacob Carlborg




Blog Post #80: Notebook, Part IV - Customized Tabs, Part II

2019-10-18 Thread Ron Tarrant via Digitalmars-d-learn
Here's the second instalment of the customized tabs discussion. 
May it bring you peace and joy. 
https://gtkdcoding.com/2019/10/18/0080-notebook-iv-custom-tabs-ii.html




Re: Vibe.d Error

2019-10-18 Thread Paolo Invernizzi via Digitalmars-d-learn

On Friday, 18 October 2019 at 08:06:30 UTC, Vino wrote:

On Thursday, 17 October 2019 at 19:02:14 UTC, Vino wrote:

[...]


Hi Andre,

  I tried install vibe.d in SUSE linux 12 SP2 and facing the 
below error, tried the options as per the link 
https://github.com/vibe-d/vibe.d/issues/1748, still no luck and 
the lib's are installed in the server


[...]


The same here on macOS Catilina ... I'm too interested in a 
solution for that


Re: Vibe.d Error

2019-10-18 Thread Vino via Digitalmars-d-learn

On Thursday, 17 October 2019 at 19:02:14 UTC, Vino wrote:

On Thursday, 17 October 2019 at 18:12:54 UTC, Andre Pany wrote:

On Thursday, 17 October 2019 at 10:58:20 UTC, Vino wrote:

Hi All,

  We are planning to migrate our website form Mysql/PHP to 
Mysql/D using vibe.d , as part of the plan we tried to 
install the vibe.d (vibe.d 0.8.6 release) and we are facing 
below issue, we have tried both the version of compiler (DMD 
2.088.1 DMD Beta 2.089.0-beta.1) the issue is same, and more 
over there are few deprecation thrown as below


[...]


Hi,

I have almost same setup like you and it was compiling today. 
Just a guess, do you have Visual Studio or Build Tools 
installed on your pc and are the environment variables set 
while running Dub?


This caused some similar issue on my side...

Kind regards
Andre


Hi Andre,

  Thank you very much, it resolved the issue.

From,
Vino.B


Hi Andre,

  I tried install vibe.d in SUSE linux 12 SP2 and facing the 
below error, tried the options as per the link 
https://github.com/vibe-d/vibe.d/issues/1748, still no luck and 
the lib's are installed in the server


ldd /usr/bin/openssl
linux-vdso.so.1 (0x7ffeec3c5000)
libssl.so.1.0.0 => /lib64/libssl.so.1.0.0 
(0x7f7b4f38c000)
libcrypto.so.1.0.0 => /lib64/libcrypto.so.1.0.0 
(0x7f7b4ef33000)

libc.so.6 => /lib64/libc.so.6 (0x7f7b4eb92000)
libdl.so.2 => /lib64/libdl.so.2 (0x7f7b4e98e000)
libz.so.1 => /lib64/libz.so.1 (0x7f7b4e778000)
/lib64/ld-linux-x86-64.so.2 (0x7f7b4f5f7000)


   "libs-posix": [
-   "ssl.so",
-   "crypto.so"
+   ":libssl.so.1.0.0",
+   ":libcrypto.so.1.0.0"


Error:
/root/.dub/packages/vibe-d-0.8.6/vibe-d/tls/.dub/build/openssl-debug-linux.posix-x86_64-dmd_2088-CB557B2E529F5E252DFC68A6174A315F/libvibe-d_tls.a(openssl_18b_659.o):
 In function `_D4vibe6stream7openssl16SSL_library_initFZi':
/root/.dub/packages/vibe-d-0.8.6/vibe-d/tls/vibe/stream/openssl.d:84: undefined 
reference to `OPENSSL_init_ssl'
/root/.dub/packages/vibe-d-0.8.6/vibe-d/tls/.dub/build/openssl-debug-linux.posix-x86_64-dmd_2088-CB557B2E529F5E252DFC68A6174A315F/libvibe-d_tls.a(openssl_193_4f0.o):
 In function 
`_D4vibe6stream7openssl13OpenSSLStream6__ctorMFNfSQBv8internal14interfaceproxy__T14InterfaceProxyTCQDs4coreQDv6StreamZQBlCQEpQEnQEj14OpenSSLContextEQFpQFn3tls14TLSStreamStateAyaSQGtQDb3net14NetworkAddressAQBfZCQHzQHxQHtQHo':
/root/.dub/packages/vibe-d-0.8.6/vibe-d/tls/vibe/stream/openssl.d:237: 
undefined reference to `BIO_set_init'
/root/.dub/packages/vibe-d-0.8.6/vibe-d/tls/vibe/stream/openssl.d:238: 
undefined reference to `BIO_set_data'
/root/.dub/packages/vibe-d-0.8.6/vibe-d/tls/vibe/stream/openssl.d:239: 
undefined reference to `BIO_set_shutdown'
/root/.dub/packages/vibe-d-0.8.6/vibe-d/tls/.dub/build/openssl-debug-linux.posix-x86_64-dmd_2088-CB557B2E529F5E252DFC68A6174A315F/libvibe-d_tls.a(openssl_196_569.o):
 In function 
`_D4vibe6stream7openssl14OpenSSLContext6__ctorMFNfEQBwQBu3tls14TLSContextKindEQCxQCvQBb10TLSVersionZ9__lambda3MFNeZv':
/root/.dub/packages/vibe-d-0.8.6/vibe-d/tls/vibe/stream/openssl.d:614: 
undefined reference to `TLS_client_method'
/root/.dub/packages/vibe-d-0.8.6/vibe-d/tls/vibe/stream/openssl.d:615: 
undefined reference to `TLS_client_method'
/root/.dub/packages/vibe-d-0.8.6/vibe-d/tls/vibe/stream/openssl.d:619: 
undefined reference to `TLS_client_method'
/root/.dub/packages/vibe-d-0.8.6/vibe-d/tls/vibe/stream/openssl.d:620: 
undefined reference to `TLS_client_method'
/root/.dub/packages/vibe-d-0.8.6/vibe-d/tls/vibe/stream/openssl.d:627: 
undefined reference to `TLS_server_method'
/root/.dub/packages/vibe-d-0.8.6/vibe-d/tls/vibe/stream/openssl.d:628: 
undefined reference to `TLS_server_method'
/root/.dub/packages/vibe-d-0.8.6/vibe-d/tls/vibe/stream/openssl.d:630: 
undefined reference to `TLS_server_method'
/root/.dub/packages/vibe-d-0.8.6/vibe-d/tls/vibe/stream/openssl.d:631: 
undefined reference to `TLS_server_method'
/root/.dub/packages/vibe-d-0.8.6/vibe-d/tls/.dub/build/openssl-debug-linux.posix-x86_64-dmd_2088-CB557B2E529F5E252DFC68A6174A315F/libvibe-d_tls.a(openssl_196_569.o):
 In function `_D4vibe6stream7openssl14OpenSSLContext11setDHParamsMFNeAyaZv':
/root/.dub/packages/vibe-d-0.8.6/vibe-d/tls/vibe/stream/openssl.d:893: 
undefined reference to `BN_get_rfc3526_prime_2048'
/root/.dub/packages/vibe-d-0.8.6/vibe-d/tls/.dub/build/openssl-debug-linux.posix-x86_64-dmd_2088-CB557B2E529F5E252DFC68A6174A315F/libvibe-d_tls.a(openssl_1a3_5a2.o):
 In function `_D4vibe6stream7openssl14initBioMethodsFNeZv':
/root/.dub/packages/vibe-d-0.8.6/vibe-d/tls/vibe/stream/openssl.d:1376: 
undefined reference to `BIO_get_new_index'
/root/.dub/packages/vibe-d-0.8.6/vibe-d/tls/vibe/stream/openssl.d:1376: 
undefined reference to `BIO_meth_new'
/root/.dub/packages/vibe-d-0.8.6/vibe-d/tls/vibe/stream/openssl.d:1378: 
undefined reference to `BIO_meth_set_write'

Meta question - what about moving the D - Learn Forum to a seperate StackExchange platform?

2019-10-18 Thread Martin Tschierschke via Digitalmars-d-learn
If I search for what ever, not related to D, I very often end 
with a solution
found on one of the StackExchange forums like StackOverflow or 
AskUbuntu etc.


The main advantage is, that all answers can be classified 
(up/down voted, moderated etc.)
This is much better than finding something in the D-Learn Forum 
where it is difficult to see,
if several answers are given are they still valid, especially if 
they are some years old.


I know that this was asked in the D survey and I think it should 
be on the table again.


If we unite for this idea, it should be possible to start an own 
"DExchange" sub platform.


Best regards mt.


Re: Any 3D Game or Engine with examples/demos which just work (compile) out of the box on linux ?

2019-10-18 Thread Prokop Hapala via Digitalmars-d-learn

On Friday, 18 October 2019 at 06:36:49 UTC, Elronnd wrote:
I guess I'm mostly confused as to what your roadblock is: once 
you've imported derelict.opengl, you have all the same opengl 
functions as you would have in c++; once you've imported 
derelict.sdl, you have all the same sdl functions as in c++.  
The only thing I can think of aside from that is math or gui 
libs--but in your c++ engine, it looks like you implemented 
those from scratch.


The point is, I would like first to try some existing Dlang-based 
game or engine, to evaluate if Dlang really gives me so much more 
advantage/convenience over C++ (or Rust). Depending on that I 
will decide if it is worth to invest the effort to migrate all my 
stuff to Dlang.


Also while in C/C++ I hacked most of functionality 
(math,GUI,renderer,physics-engine) from scratch, I would prefer 
to rely on some solid reliable standard libraries from Dlang. My 
stuff is usually kinda "The best you can make in one week". One 
reason why I re-implemented so much things (like GUI, which I 
really hate to do) is because I find it quite painful to 
install libraries in C/C++ (especially when versions 
changes). I hope that with Dlang's Dub or Rust's Cargo this will 
be much easier and I will use 3rd party libraries more.


Re: Any 3D Game or Engine with examples/demos which just work (compile) out of the box on linux ?

2019-10-18 Thread Elronnd via Digitalmars-d-learn
Up to now I was able to compile just "First Triangle example" 
https://www.dropbox.com/sh/myem3g69qjyo58v/AABZuvwuRDpnskhEC4AAK5AVa?dl=
Why not start with that, then, and expand it until it has 
everything you need?


If it helps, the basic gl startup code for my engine is at 
http://ix.io/1Z2X/d and http://ix.io/1Z2Y/d (engine is 
closed-source, but feel free to steal that part for w/e you 
want).  Obviously depends on a bunch of other infrastructure, but 
should be enough to get the idea.  In the second link, you 
probably only want the constructor; everything else is irrelevant 
windowing stuff or boilerplate.


I guess I'm mostly confused as to what your roadblock is: once 
you've imported derelict.opengl, you have all the same opengl 
functions as you would have in c++; once you've imported 
derelict.sdl, you have all the same sdl functions as in c++.  The 
only thing I can think of aside from that is math or gui 
libs--but in your c++ engine, it looks like you implemented those 
from scratch.


By the way, I recommend using bindbc (https://github.com/bindbc) 
wrappers over derelict ones, if available, because mike isn't 
really maintaining derelict anymore.  He was pretty much the sole 
maintainer.  I'm currently using a weird branch of derelictsdl 
for vulkan support, and a custom version of derelictassimp so it 
doesn't break.


PHP to D Conversion

2019-10-18 Thread Vino via Digitalmars-d-learn

Hi All,

  Request your help in converting a PHP code to D equivalent code

PHP Code:
class avmtest {
private $con;

function __construct() {
global $config;
$this->con = new mysqli(test.srv.com:3910, 
testusr, #, test);
if($this->con->connect_errno) { die("Connection 
Failed.\n"); }

}

function getHostname() {
$qdata = $this->con->prepare("SELECT host_name 
FROM hosts_coll");

$qdata->execute();
$qdata->bind_result($host);
while($qdata->fetch()) {
$data[] = array("HostName" => $host);
}
$sdata->close();
return $data;
}
}

D Code:
module avm.test;

import mysql;
import std.array : array;
import std.conv;
import std.variant;

class avmtest
{
private conn;

auto avmconnect()
{
	auto connectionStr = 
"host=test.srv.com;port=3910;user=testusr;pwd=#;db=test";

Connection conn = new Connection(connectionStr);
scope(exit) conn.close();
}

auto getHostname()
{
	  ResultRange qdata = conn.query("SELECT host_name FROM 
`hosts_coll`");

  Row row = qdata.front;
  Variant h = row[0];
  qdata.close();
  return h.to!string;
}
}

Error: Error: no identifier for declarator conn

From,
Vino.B


Re: Vibe/Mysql Testing

2019-10-18 Thread Vino via Digitalmars-d-learn

On Thursday, 17 October 2019 at 20:21:39 UTC, Andre Pany wrote:

On Thursday, 17 October 2019 at 19:05:44 UTC, Vino wrote:

[...]


Hi,

I assume you are using this mysql package 
http://code.dlang.org/packages/mysql-native.
(If not please check wheter the package you are using is vibe-d 
compliant.)


The mysql package uses Variant from Phobos for storing values. 
For your example, you could write 
```res.writeBody(row[0].toString());```


Kind regards
Andre


Hi Andre,

  Thanks it worked.

From,
Vino.B


Re: Any 3D Game or Engine with examples/demos which just work (compile) out of the box on linux ?

2019-10-18 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Friday, 18 October 2019 at 06:11:37 UTC, Ferhat Kurtulmuş 
wrote:

On Friday, 18 October 2019 at 05:52:19 UTC, Prokop Hapala wrote:
Already >1 year I consider to move from C++ to Dlang or to 
Rust in my hobby game development (mostly based on physical 
simulations 
https://github.com/ProkopHapala/SimpleSimulationEngine). I 
probably prefer Dlang because it compiles much faster, and I 
can copy C/C++ code to it without much changes.


[...]


I cannot make any comment for others. But Dagon should work. I 
wrote a very little demo game some time ago 
https://github.com/aferust/dagon-shooter. I didn't try to 
compile and run it on Linux.I think you need to have a 
nuklear.so in your path, since Bindbc loaders try to load 
dynamic libraries by default.


https://github.com/Timu5/bindbc-nuklear/blob/master/README.md

"This library contains prebuild windows dll for Nuklear, on 
different platforms you can easily build C source code from cmake 
configuration in c directory."





Re: Any 3D Game or Engine with examples/demos which just work (compile) out of the box on linux ?

2019-10-18 Thread Ferhat Kurtulmuş via Digitalmars-d-learn

On Friday, 18 October 2019 at 05:52:19 UTC, Prokop Hapala wrote:
Already >1 year I consider to move from C++ to Dlang or to Rust 
in my hobby game development (mostly based on physical 
simulations 
https://github.com/ProkopHapala/SimpleSimulationEngine). I 
probably prefer Dlang because it compiles much faster, and I 
can copy C/C++ code to it without much changes.


[...]


I cannot make any comment for others. But Dagon should work. I 
wrote a very little demo game some time ago 
https://github.com/aferust/dagon-shooter. I didn't try to compile 
and run it on Linux.I think you need to have a nuklear.so in your 
path, since Bindbc loaders try to load dynamic libraries by 
default.