On Saturday, 9 December 2017 at 02:45:35 UTC, rjframe wrote:
On Sat, 09 Dec 2017 02:34:29 +, codephantom wrote:
Anyone got ideas on how to get sort() working in the *return*
statement?
//
ushort[] draw8Numbers()
{
import std.meta : aliasSeqOf;
import std.range : iota
On Saturday, 9 December 2017 at 03:24:52 UTC, codephantom wrote:
On Saturday, 9 December 2017 at 02:45:35 UTC, rjframe wrote:
`sort` returns a SortedRange of ushorts, not an array of
ushorts. Make it:
```
import std.array : array;
return sort(numbers.take(8)).array;
```
--Ryan
That's it!
On Saturday, 9 December 2017 at 04:31:33 UTC, SimonN wrote:
Yes, this works, and your algorithm would even accept arbitary
random-access ranges, not merely arrays.
Would be nice if I could do it all as a 'one liner':
//
int[] draw8Numbers()
{
import std.algorithm.sorting : sor
On Saturday, 9 December 2017 at 06:38:46 UTC, anonymous wrote:
On Saturday, 9 December 2017 at 06:15:16 UTC, Arun
Chandrasekaran wrote:
Is there a way to get the pointer or reference of an element
in Array(T)?
[...]
auto d2 = gallery[0];
auto d2 = &gallery[0];
Thanks. Just curious why
On Saturday, 9 December 2017 at 06:15:16 UTC, Arun Chandrasekaran
wrote:
Is there a way to get the pointer or reference of an element in
Array(T)?
[...]
auto d2 = gallery[0];
auto d2 = &gallery[0];
On Saturday, 9 December 2017 at 01:34:40 UTC, Arun Chandrasekaran
wrote:
So I tried the same on Haswell processor with LDC 1.6.0 and it
crashes
```
=== Starting D version ===
Took 1 sec, 107 ms, and 383 μs to load 100 items. Gonna
search in parallel...
*** Error in `./dmain-ldc': double fr
Is there a way to get the pointer or reference of an element in
Array(T)?
https://run.dlang.io/gist/70fd499afe8438d4877f57aec90c3091?compiler=dmd
The assertion seems to fail below. Value copy is not is intended
here.
module test;
void main()
{
struct Data
{
int id;
}
On Tuesday, 17 October 2017 at 19:00:38 UTC, Steven Schveighoffer
wrote:
In this case, an extra destructor call is made without a
corresponding postblit or constructor.
-Steve
https://issues.dlang.org/show_bug.cgi?id=18050
Thanks for the quick response. std.string.fromStringz did the
trick. I am not sure what was the deal with to!string.
On Saturday, 9 December 2017 at 05:55:21 UTC, Venkat wrote:
I am trying out the DJni library
(https://github.com/Monnoroch/DJni). For some reason
std.conv.to!string doesn't want to convert a char* to a
string.The lines below are taken from the log. I see that the
last frame is at gc_qalloc. I
I am trying out the DJni library
(https://github.com/Monnoroch/DJni). For some reason
std.conv.to!string doesn't want to convert a char* to a
string.The lines below are taken from the log. I see that the
last frame is at gc_qalloc. I am not sure why it failed there.
Can anybody elaborate on wh
On Saturday, 9 December 2017 at 03:24:52 UTC, codephantom wrote:
On Saturday, 9 December 2017 at 02:45:35 UTC, rjframe wrote:
`sort` returns a SortedRange of ushorts, not an array of
ushorts. Make it:
```
import std.array : array;
return sort(numbers.take(8)).array;
```
--Ryan
That's it!
On Saturday, 9 December 2017 at 02:45:35 UTC, rjframe wrote:
`sort` returns a SortedRange of ushorts, not an array of
ushorts. Make it:
```
import std.array : array;
return sort(numbers.take(8)).array;
```
--Ryan
That's it!
Thanks Ryan.
On Friday, 8 December 2017 at 19:13:20 UTC, vino wrote:
Hi,
The code is same just copy pasted the code form Windows 7 into
Windows 2003 and executed, in Windows 7 the log file is of size
0 where as in windows 2003 the log file is of size 2 byte where
the log file in both the server is empty.
On Sat, 09 Dec 2017 02:34:29 +, codephantom wrote:
> Anyone got ideas on how to get sort() working in the *return*
> statement?
>
> //
>
> ushort[] draw8Numbers()
> {
> import std.meta : aliasSeqOf;
> import std.range : iota;
> ushort[] numbers = [ aliasSeqOf!(iota
Anyone got ideas on how to get sort() working in the *return*
statement?
//
ushort[] draw8Numbers()
{
import std.meta : aliasSeqOf;
import std.range : iota;
ushort[] numbers = [ aliasSeqOf!(iota(1,46)) ];
import std.random : randomShuffle;
randomShuffle(numbers)
So I tried the same on Haswell processor with LDC 1.6.0 and it
crashes
```
=== Starting D version ===
Took 1 sec, 107 ms, and 383 μs to load 100 items. Gonna
search in parallel...
*** Error in `./dmain-ldc': double free or corruption (fasttop):
0x00edc6e0 ***
*** Error in `./dmain-
On 12/08/2017 01:05 PM, kerdemdemir wrote:
> Hi,
>
> I need to have the same result while using :
>
> openssl
Works for me as adapted from Phobos documentation:
import std.stdio;
import std.digest.hmac, std.digest.sha;
import std.string : representation;
void main() {
auto hmac = HMAC!SHA2
Hi,
I need to have the same result while using :
openssl dgst -sha256 -hmac "somestring"
But the server rejecting my generated hmac with the code below .
auto hmac = HMAC!SHA256("somestring".representation);
hmac.put(url.representation);
auto generatedHmac = hmac.finish();
string generatedHma
On 12/08/2017 12:10 PM, mrphobby wrote:
> I still think using the word "import" is confusing. Would rather have it
> called "load" or something. But at least I understand it now :)
We don't want any more keywords. :) (D's keywords are context-independent.)
An unfortunate example was the "body",
On Thursday, 7 December 2017 at 12:27:36 UTC, Guillaume Piolat
wrote:
On Thursday, 7 December 2017 at 12:18:21 UTC, Guillaume Piolat
wrote:
You can easily make a DUB frontend to do that, for example
https://github.com/AuburnSounds/Dplug/tree/master/tools/dplug-build
And it might be cleaner t
On Thursday, 7 December 2017 at 09:47:31 UTC, Jacob Carlborg
wrote:
On 2017-12-06 20:05, mrphobby wrote:
There are two kinds of language constructs that uses the
"import" keyword. One is the "Import Declaration" [1] which is
the most common one and is used to import other symbols. The
other la
On Thursday, 7 December 2017 at 09:39:45 UTC, Jacob Carlborg
wrote:
The latest DMD compiler only supports what's in the official
documentation, i.e. [1]. What's documented in DIP43 [2] (except
anything marked with "unimplemented") is what's been
implemented in one of my forks. I'm working on ad
On Thursday, 7 December 2017 at 12:19:00 UTC, Vino wrote:
On Thursday, 7 December 2017 at 09:04:19 UTC, Vino wrote:
[...]
Hi Andrea,
Was able to find a solution to the above issue by adding the
replace function as below, the the code is working as expected,
is there any chance of using par
On Friday, 8 December 2017 at 12:25:19 UTC, FreeSlave wrote:
On Friday, 8 December 2017 at 09:40:18 UTC, Vino wrote:
Hi All,
Request your help on how to check whether a given file is
empty, I tried the getSize from std.file but no luck as in
windows 7 is the file is empty the size of the fi
On 12/03/2017 12:42 AM, Johan Engelen wrote:
On Friday, 1 December 2017 at 18:33:09 UTC, Ali Çehreli wrote:
On 12/01/2017 07:21 AM, Steven Schveighoffer wrote:
> On 12/1/17 4:29 AM, Johan Engelen wrote:
>> (Also, I would expect "popFront" to return the element
popped, but it
>> doesn't, OK...
>
On Friday, 8 December 2017 at 09:40:18 UTC, Vino wrote:
Hi All,
Request your help on how to check whether a given file is
empty, I tried the getSize from std.file but no luck as in
windows 7 is the file is empty the size of the file is 0 bytes
but in Windows 2003 if the file is empty the si
Other functions that can be used for this are
GetFileInformationByHandle, GetFileSizeEx, SetFilePointerEx or
File.size in phobos.
On Friday, 8 December 2017 at 10:01:14 UTC, Kagamin wrote:
On Friday, 8 December 2017 at 07:34:53 UTC, Arun Chandrasekaran
wrote:
I was wondering if std.container.array.Array supports
threadsafe parallel reads similar to std::vector.
No, your code can also fail on a system with inconsistent ca
You should use size_t instead of ulong, but on 32bit you would have still
problem because you are trying assign 2^32 which is too big to hold in 32bit
On Thu, Dec 7, 2017 at 11:42 PM, kdevel via Digitalmars-d-learn <
digitalmars-d-learn@puremagic.com> wrote:
> On Tuesday, 19 September 2017 at 06:
On Friday, 8 December 2017 at 07:34:53 UTC, Arun Chandrasekaran
wrote:
I was wondering if std.container.array.Array supports
threadsafe parallel reads similar to std::vector.
No, your code can also fail on a system with inconsistent cache
because data written by writing thread can remain in it
On Friday, 8 December 2017 at 07:34:53 UTC, Arun Chandrasekaran
wrote:
I was wondering if std.container.array.Array supports
threadsafe parallel reads similar to std::vector. I've created
a small program for demonstration
https://github.com/carun/parallel-read-tester
It works fine with just c
Hi All,
Request your help on how to check whether a given file is
empty, I tried the getSize from std.file but no luck as in
windows 7 is the file is empty the size of the file is 0 bytes
but in Windows 2003 if the file is empty the size of the file
show as 2 bytes.
From,
Vino.B
On 2017-12-08 06:16, Fra Mecca wrote:
Is there a way to compile a project and deploying it as a single
statically linked binary?
My main target would be something like a self contained jar (like .war
files), but something that is in the style of go binaries and portable
to another Linux distr
On Friday, 8 December 2017 at 07:34:53 UTC, Arun Chandrasekaran
wrote:
2. I'm on an 8 CPU box and I don't seem to hit 800% CPU with D
version (max 720%). However I can get 800% CPU usage with the
C++ version.
Please ignore, this is because of the write.
On Friday, 8 December 2017 at 06:37:36 UTC, Adam D. Ruppe wrote:
On Friday, 8 December 2017 at 05:16:22 UTC, Fra Mecca wrote:
Is there a way to compile a project and deploying it as a
single statically linked binary?
A default build of a D program is *reasonably* compatible. All
its dependenc
On Saturday, 16 September 2017 at 13:15:54 UTC, Azi Hassan wrote:
On Saturday, 16 September 2017 at 03:30:51 UTC, Joseph wrote:
Are there any simple direct serialization libraries where I
can mark elements of a class or struct that I want serialized
with an attribute and it will take care of al
On Friday, 8 December 2017 at 06:37:36 UTC, Adam D. Ruppe wrote:
On Friday, 8 December 2017 at 05:16:22 UTC, Fra Mecca wrote:
Is there a way to compile a project and deploying it as a
single statically linked binary?
A default build of a D program is *reasonably* compatible. All
its dependenc
38 matches
Mail list logo