Re: 'write' crashes without extra window

2014-10-08 Thread Joel via Digitalmars-d-learn
On Wednesday, 8 October 2014 at 03:33:38 UTC, Adam D. Ruppe wrote: On Tuesday, 7 October 2014 at 23:41:14 UTC, Joel wrote: it had been opening with a command prompt, so I got rid of the prompt and now it some times crashes. That's a feature - writing to a non-existent handle fails, so it

Re: function not callable using argument types - i disagree

2014-10-08 Thread Nimrod okoudcsharp via Digitalmars-d-learn
On Tuesday, 7 October 2014 at 19:15:31 UTC, Vlad Levenfeld wrote: Update: I just did a manual cast. Still getting there error. Here's the new argument lists: (void**, const(PaStreamParameters*), const(PaStreamParameters*), double, uint, uint, extern (C) int function(const(void)*, void*,

Re: generate unique variable names?

2014-10-08 Thread Nicolas F. via Digitalmars-d-learn
On Wednesday, 8 October 2014 at 02:53:08 UTC, K.K. wrote: On Wednesday, 8 October 2014 at 02:06:28 UTC, Brian Schott wrote: I'm 99% sure you actually want an array or associative array. Something like this maybe? ImageType[string] images; images[format(image%03d, i)] = new

Re: 'write' crashes without extra window

2014-10-08 Thread Gary Willoughby via Digitalmars-d-learn
On Wednesday, 8 October 2014 at 03:33:38 UTC, Adam D. Ruppe wrote: You could just wrap the write function in a try/catch to explicitly ignore the error. Or if the write function is there only for debug purposes you could wrap it in a debug/version block.

Re: 'write' crashes without extra window

2014-10-08 Thread Sag Academy via Digitalmars-d-learn
On Wednesday, 8 October 2014 at 09:17:01 UTC, Gary Willoughby wrote: On Wednesday, 8 October 2014 at 03:33:38 UTC, Adam D. Ruppe wrote: You could just wrap the write function in a try/catch to explicitly ignore the error. Or if the write function is there only for debug purposes you could

(this MyType) automatic deduction?

2014-10-08 Thread andre via Digitalmars-d-learn
Hi, could you check whether it is correct, that second line in main failes with a compiler error? I think the compiler should be able to deduce the type without explicitly passing it to the method call. Kind regards André template ClassTemplate() { static auto deserialize(this MyType)() {

Re: Template Mixin Conflicts

2014-10-08 Thread Alice via Digitalmars-d-learn
Thanks for your help guys. The workarounds will do for now. The bug is here: https://issues.dlang.org/show_bug.cgi?id=13587

(this MyType) and interface: Symbol undefined

2014-10-08 Thread andre via Digitalmars-d-learn
Hi, please consider following example. I want to acces class B by interface I. Method work should print the actual class (B). The linker say: Error 42: Symbol Undefined _D3app1I17__T4workTC3app1IZ4workMFZv Is this is missing feature or even a bug? Is there any other way to get the actual

Re: function not callable using argument types - i disagree

2014-10-08 Thread Steven Schveighoffer via Digitalmars-d-learn
On 10/7/14 3:15 PM, Vlad Levenfeld wrote: Update: I just did a manual cast. Still getting there error. Here's the new argument lists: (void**, const(PaStreamParameters*), const(PaStreamParameters*), double, uint, uint, extern (C) int function(const(void)*, void*, uint,

Re: 'write' crashes without extra window

2014-10-08 Thread Kagamin via Digitalmars-d-learn
Or open nul device in place of stdout (windows equivalent of /dev/null).

Re: Search Engine

2014-10-08 Thread ANtlord via Digitalmars-d-learn
On Monday, 6 October 2014 at 18:54:53 UTC, yawniek wrote: On Monday, 6 October 2014 at 17:11:51 UTC, ANtlord wrote: Good day! I recenlty have tried create typical project on vibe.d. The web framework is not bad. And I can say, that it is better that something another web frameworks. But I have

The module declaration is being ignored

2014-10-08 Thread Diffuse via Digitalmars-d-learn
I have 2 files, main.d and file2.d. In file2.d I have written at the top module file2 And in main.d I have written import file2 Everything works fine. But things also compile if I declare file2's module to be module candyfloss while still importing file2 within main.d In fact it doesn't work

Re: The module declaration is being ignored

2014-10-08 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wed, Oct 08, 2014 at 06:39:26PM +, Diffuse via Digitalmars-d-learn wrote: Everything works fine. But things also compile if I declare file2's module to be module candyfloss while still importing file2 within main.d You should always import the same thing as the module, but you also need

How do I write __simd(void16*, void16) ?

2014-10-08 Thread Etienne via Digitalmars-d-learn
I can't seem to find this function anywhere: __simd(void16*, void16) The mangling seems to go through to dmd's glue.lib This is for SSE2 operations: MOVDQU = void _mm_storeu_si128 ( __m128i *p, __m128i a) MOVDQU = __m128i _mm_loadu_si128 ( __m128i *p) Would I have to write this with ASM?

Re: The module declaration is being ignored

2014-10-08 Thread Diffuse via Digitalmars-d-learn
On Wednesday, 8 October 2014 at 18:46:38 UTC, Adam D. Ruppe via Digitalmars-d-learn wrote: On Wed, Oct 08, 2014 at 06:39:26PM +, Diffuse via Digitalmars-d-learn wrote: In general, I recommend always passing all files to the compiler explicitly so it can build an accurate file to module

Re: How do I write __simd(void16*, void16) ?

2014-10-08 Thread Benjamin Thaut via Digitalmars-d-learn
Am 08.10.2014 20:56, schrieb Etienne: I can't seem to find this function anywhere: __simd(void16*, void16) The mangling seems to go through to dmd's glue.lib This is for SSE2 operations: MOVDQU = void _mm_storeu_si128 ( __m128i *p, __m128i a) MOVDQU = __m128i _mm_loadu_si128 ( __m128i *p)

Multithreading in D

2014-10-08 Thread Konstantin via Digitalmars-d-learn
Hello D-World, I've written a small terraingenerator in D based on the Hill-Algorithm. To generate a terrain I only need to call the method generateTerrain(...) which returns a float-Array containing the height of each pixel (2D Array mapped with a 1D array with length resolution^2).

Re: How do I write __simd(void16*, void16) ?

2014-10-08 Thread Etienne via Digitalmars-d-learn
On 2014-10-08 3:04 PM, Benjamin Thaut wrote: I strongly advise to not use core.simd at this point. It is in a horribly broken state and generates code that is far from efficient. If I think I'll have to re-write the xmmintrin.h functions I need as string mixins to inline the assembly. Is that

Re: Search Engine

2014-10-08 Thread Chris Williams via Digitalmars-d-learn
On Wednesday, 8 October 2014 at 18:15:08 UTC, ANtlord wrote: It would be stable? I mean program, that will use C++ extern interface. Trying to link to C++ code will cause some work to solve build issues, but there shouldn't be any stability impacts other than recognizing that C++ won't be

Re: (this MyType) and interface: Symbol undefined

2014-10-08 Thread anonymous via Digitalmars-d-learn
On Wednesday, 8 October 2014 at 13:00:56 UTC, andre wrote: Hi, please consider following example. I want to acces class B by interface I. Method work should print the actual class (B). The linker say: Error 42: Symbol Undefined _D3app1I17__T4workTC3app1IZ4workMFZv Is this is missing

Re: (this MyType) automatic deduction?

2014-10-08 Thread anonymous via Digitalmars-d-learn
On Wednesday, 8 October 2014 at 10:36:33 UTC, andre wrote: Hi, could you check whether it is correct, that second line in main failes with a compiler error? I think the compiler should be able to deduce the type without explicitly passing it to the method call. Kind regards André template

Advanced (HTML5/JS) client webpage connecting to vibe.d server backend

2014-10-08 Thread Nordlöw
I'm looking for a vibe.d sample application that shows a complete app including vibe.d server logic together with some html/js that together provides a modern dynamic web experience. I typically want a web form that updates parts of its page dynamically when, for example, a button is pressed.

Re: Multithreading in D

2014-10-08 Thread AsmMan via Digitalmars-d-learn
What I imagine as solution (I know it won't work this way, but to give you a better idea): for(int i = 0; i #threads; i++){ runInThread(generateTerrain(...)); } Are you looking for parallel? http://dlang.org/library/std/parallelism/parallel.html

Formatted output of range of tuples

2014-10-08 Thread antropod via Digitalmars-d-learn
Hello! Consider this code: +++ import std.stdio; import std.range; import std.algorithm; void printIndexedArray1(T, Range)(T[] source, Range indexes) { foreach(row; zip(indexes, source)) { foreach(col; row) { write(col, );

Re: Formatted output of range of tuples

2014-10-08 Thread bearophile via Digitalmars-d-learn
antropod: Looks fairly straightforward. But, the second function causes compilation error: std.format.FormatException@C:\D\dmd2\windows\bin\..\..\src\phobos\std\format.d(2 585): Expected '%s' format specifier for type 'Tuple!(uint, uint)' Can you help me with that? Currently the %(%s%)

Re: Formatted output of range of tuples

2014-10-08 Thread anonymous via Digitalmars-d-learn
On Wednesday, 8 October 2014 at 21:21:47 UTC, antropod wrote: Hello! Consider this code: +++ import std.stdio; import std.range; import std.algorithm; void printIndexedArray1(T, Range)(T[] source, Range indexes) { foreach(row; zip(indexes, source)) {

Re: Formatted output of range of tuples

2014-10-08 Thread Ali Çehreli via Digitalmars-d-learn
On 10/08/2014 02:34 PM, anonymous wrote: You can turn the tuples into ranges with `only`: writef(%(%(%s %)\n%), zip(indexes, source).map!(t = only(t.expand))); I haven't measured the performance but there is also the following automatic expansion of tuple members as slice elements:

Re: Formatted output of range of tuples

2014-10-08 Thread antropod via Digitalmars-d-learn
On Wednesday, 8 October 2014 at 21:34:54 UTC, anonymous wrote: You can turn the tuples into ranges with `only`: writef(%(%(%s %)\n%), zip(indexes, source).map!(t = only(t.expand))); That works for me, thanks. By the way my compiler is DMD 2.066.0

Re: The module declaration is being ignored

2014-10-08 Thread Diffuse via Digitalmars-d-learn
Okay I see what I'm doing wrong. While I can indeed declare a file's module to be whatever I like and in whatever package I like, this isn't going to work when that file is in a dub package that my program depends on because dub isn't sending those files to the compiler, they are only used for

Re: Formatted output of range of tuples

2014-10-08 Thread bearophile via Digitalmars-d-learn
anonymous: You can turn the tuples into ranges with `only`: writef(%(%(%s %)\n%), zip(indexes, source).map!(t = only(t.expand))); This is a nice idea. Expand can probably be replaced by a []. I presume this works only if the types inside the tuple are the same. Bye, bearophile

Re: Advanced (HTML5/JS) client webpage connecting to vibe.d server backend

2014-10-08 Thread Rikki Cattermole via Digitalmars-d-learn
On Wednesday, 8 October 2014 at 21:14:42 UTC, Nordlöw wrote: I'm looking for a vibe.d sample application that shows a complete app including vibe.d server logic together with some html/js that together provides a modern dynamic web experience. I typically want a web form that updates parts of

Re: (this MyType) automatic deduction?

2014-10-08 Thread andre via Digitalmars-d-learn
Thanks a lot for the helpful explanation. Kind regards André On Wednesday, 8 October 2014 at 21:10:02 UTC, anonymous wrote: On Wednesday, 8 October 2014 at 10:36:33 UTC, andre wrote: Hi, could you check whether it is correct, that second line in main failes with a compiler error? I think the