I will convert a Java program into D. The original Java code is
based on the class RandomeAccessFile which essentially defines a
set of methods for read/write Int/Long/Float/String etc. The
module std.stream seems to be a good fit for this job, but in its
documentation, it is marked deprecated.
On Saturday, 27 June 2015 at 18:32:10 UTC, Ali Çehreli wrote:
On 06/27/2015 10:43 AM, aki wrote:
You are rightly assuming that the loop counter is available for
all container types. Unfortunately, it is the case only for
arrays.
Now I know. Thanks for it.
aki.
hello. :-)
when i was using DerelictSFML2(
http://code.dlang.org/packages/derelict-sfml2 ), i got this
problem.
CSFML doc had 'setUnicodeString':
CSFML_GRAPHICS_API void sfText_setUnicodeString ( sfText * text,
On 06/27/2015 06:00 PM, Charles Hixson via Digitalmars-d-learn wrote:
I'm planning an application where a series of threads each need to be
aware of the Tids of all the others. The number won't be known at
compile time, but that doesn't seem to change the design.
All I've been able to come up w
I'm planning an application where a series of threads each need to be
aware of the Tids of all the others. The number won't be known at
compile time, but that doesn't seem to change the design.
All I've been able to come up with is a pair of loops, one to spawn the
threads, and collect their
On Saturday, 27 June 2015 at 22:20:40 UTC, ketmar wrote:
2. no.
Hmm... any reason why?
On Fri, 26 Jun 2015 22:00:51 +, Tofu Ninja wrote:
> Are static constructors guaranteed to run if the module is imported?
> Also are static constructors in templated types guaranteed to run for
> every instantiation? Even if the instantiation is never actually used
> outside of compile time cod
On Sat, 27 Jun 2015 16:28:40 +, BBaz wrote:
> I try to build a symbol table:
>
> ---
> module aveb;
>
> import std.stdio;
> import std.algorithm.searching;
> import std.ascii;
>
> void* [string] sig;
>
> void ana(alias mod)()
> {
> import std.traits; foreach(memb;__traits(allMembers,m
On Saturday, 27 June 2015 at 18:32:10 UTC, Ali Çehreli wrote:
Luckily, it is very easy to achieve it with std.range.enumerate:
FTFY
is it safe to call `GC.removeRange` in dtor? i believe it should be safe,
so one can perform various cleanups, but documentation says nothing about
guarantees.
signature.asc
Description: PGP signature
On 06/27/2015 11:54 AM, "Marc =?UTF-8?B?U2Now7x0eiI=?=
" wrote:
Also are static constructors in templated types guaranteed to run for
every instantiation? Even if the instantiation is never actually used
outside of compile time code, like in an alias or in a UDA?
Definitely not. Things insid
thanks, missed that!
On Sat, Jun 27, 2015 at 2:59 AM, via Digitalmars-d-learn <
digitalmars-d-learn@puremagic.com> wrote:
> On Saturday, 27 June 2015 at 03:17:49 UTC, Timothee Cour wrote:
>
>> is there a way to convert a string representing a time (without date) to a
>> time, eg:
>>
>> auto t = "
On 06/27/2015 10:43 AM, aki wrote:
> void pr(Array!int a) {
> foreach(i, v; a[]) {
You are rightly assuming that the loop counter is available for all
container types. Unfortunately, it is the case only for arrays.
Luckily, it is very easy to achieve it with std.algorithm.enumerate:
imp
On Saturday, 27 June 2015 at 17:43:13 UTC, aki wrote:
I want to print the contents of Array!int
import std.stdio;
import std.container;
void pr(Array!int a) {
foreach(i, v; a[]) {
writeln("%4s: %s\n", i, v);
}
}
But when I compile it by DMD 2.062 on Windows
it s
I want to print the contents of Array!int
import std.stdio;
import std.container;
void pr(Array!int a) {
foreach(i, v; a[]) {
writeln("%4s: %s\n", i, v);
}
}
But when I compile it by DMD 2.062 on Windows
it says:
testArray.d(5): Error: cannot infer argument type
I try to build a symbol table:
---
module aveb;
import std.stdio;
import std.algorithm.searching;
import std.ascii;
void* [string] sig;
void ana(alias mod)()
{
import std.traits;
foreach(memb;__traits(allMembers,mod))
static if
(canFind(["package","public"],__traits(getProtection,
On Saturday, 27 June 2015 at 12:17:31 UTC, Timon Gehr wrote:
This computes a²·a̅ instead of a·a̅.
What is the source code for residualPowerOf2?
Also is there any performance issues? can I make this faster?
Probably you should use
http://dlang.org/phobos/std_complex.html#.sqAbs instead. Y
On 06/27/2015 02:17 PM, Timon Gehr wrote:
You then also don't need the final map to extract the real part.
(This is actually not true, your inverseFFT presumably still returns
complex numbers.)
On Saturday, 27 June 2015 at 12:27:59 UTC, H. S. Teoh wrote:
On Sat, Jun 27, 2015 at 12:22:06PM +, Nicholas Wilson via
Digitalmars-d-learn wrote:
How do I iterate through an AA sorted by key?
I am unable to .dup the aa.byKeyValue().
Because it is a range, not an array.
To turn it into an
On Sat, Jun 27, 2015 at 12:22:06PM +, Nicholas Wilson via
Digitalmars-d-learn wrote:
> How do I iterate through an AA sorted by key?
>
> I am unable to .dup the aa.byKeyValue().
Because it is a range, not an array.
To turn it into an array, write:
aa.byKeyValue().array.sort!"a.key
How do I iterate through an AA sorted by key?
I am unable to .dup the aa.byKeyValue().
I have tried both
foreach(e; aa.byKeyValue().sort!"a.key < b.key")
{
//... use e. key && e.value
}
and
foreach(k,v; aa.byKeyValue().sort!"a.key < b.key")
{
}
i get :
template std.algorithm.sorting.sort
On 06/27/2015 12:29 PM, kerdemdemir wrote:
Hi
My question is more about Maths than D lang,
I am hoping, maybe somebody worked with AutoCorrelation function before.
auto autoCorrelation(R)(R range)
if (isRandomAccessRange!R)
{
auto residual = residualPowerOf2(range.length); // Fin
On Saturday, 27 June 2015 at 10:37:08 UTC, Rikki Cattermole wrote:
No idea about the maths behind it are but:
Thanks a lot for your answer anyway. I am hoping even not related
with D directly, this discussions may atract people from other
languages to D while looking for Domain information.
On 27/06/2015 10:29 p.m., kerdemdemir wrote:
Hi
My question is more about Maths than D lang,
I am hoping, maybe somebody worked with AutoCorrelation function before.
auto autoCorrelation(R)(R range)
if (isRandomAccessRange!R)
{
auto residual = residualPowerOf2(range.length); // F
Hi
My question is more about Maths than D lang,
I am hoping, maybe somebody worked with AutoCorrelation function
before.
auto autoCorrelation(R)(R range)
if (isRandomAccessRange!R)
{
auto residual = residualPowerOf2(range.length); // Find how
many zeros to add
auto fftResult
On Saturday, 27 June 2015 at 03:17:49 UTC, Timothee Cour wrote:
is there a way to convert a string representing a time (without
date) to a
time, eg:
auto t = "19:03:40.143656";
auto a=SysTime.fromTimeString(t); // doesn't exist
My current workaround is to append a dummy date before and then
On Friday, 26 June 2015 at 22:00:54 UTC, Tofu Ninja wrote:
Are static constructors guaranteed to run if the module is
imported?
AFAIK, yes.
Also are static constructors in templated types guaranteed to
run for every instantiation? Even if the instantiation is never
actually used outside of c
27 matches
Mail list logo