On 2015-04-01 at 16:52, John Colvin wrote:
On Wednesday, 1 April 2015 at 14:22:57 UTC, Laeeth Isharc wrote:
On Wednesday, 1 April 2015 at 10:35:05 UTC, John Colvin wrote:
On Wednesday, 1 April 2015 at 10:09:12 UTC, FG wrote:
On 2015-03-31 at 22:56, Laeeth Isharc wrote:
1mm allocations
2.066
On 2015-03-31 at 22:56, Laeeth Isharc wrote:
1mm allocations
2.066: 0.844s
2.067: 0.19s
That is great news, thanks!
OT: it's a nasty financier's habit to write 1M and 1MM instead of 1k and 1M. :P
On 2015-03-21 at 22:15, FG wrote:
On 2015-03-21 at 21:02, Dennis Ritchie wrote:
In what universe?! Which OS, compiler and architecture?
Windows 8.1 x64, dmd 2.066.1:
That's strange. I cannot recreate the problem on Win7 x64 with dmd 2.066.1,
neither when compiled for 32- nor 64-bit. I
On 2015-03-21 at 21:02, Dennis Ritchie wrote:
In what universe?! Which OS, compiler and architecture?
Windows 8.1 x64, dmd 2.066.1:
That's strange. I cannot recreate the problem on Win7 x64 with dmd 2.066.1,
neither when compiled for 32- nor 64-bit. I have saved the a's to a file and
use inp
On 2015-03-21 at 16:05, Ivan Kazmenko wrote:
Generate a 10-character string
[...]
Try to copy it with D scanf and printf:
-
import std.stdio;
void main () {
char [10] a;
scanf ("%s", a.ptr);
printf ("%s\n", a.ptr);
}
-
Only 32767 first characters of the string are
On 2015-03-11 at 18:27, Dennis Ritchie wrote:
The same without classes in Lisp:
[...]
And your point was...? I take it, "poor c++" is a hint.
Don't compare apples to oranges.
On 2015-03-11 at 17:42, Dennis Ritchie wrote:
On Wednesday, 11 March 2015 at 16:08:22 UTC, Kagamin wrote:
A hash table? See http://dlang.org/hash-map.html
That is, the input is a string and, depending on what word it contains, is
called one of the three methods of the class that this line han
On 2015-03-08 at 20:26, Meta wrote:
On Sunday, 8 March 2015 at 18:57:38 UTC, Kagamin wrote:
http://dpaste.dzfl.pl/2c8d4a7d9ef0 like this.
What in the world is that code doing? I'm having a hard time wrapping my head
around this.
It's a trick to reuse string internals to store an int.
A stri
On 2015-03-06 at 00:25, ketmar wrote:
unicode sux[1].
[1] http://file.bestmx.net/ee/articles/uni_vs_code.pdf
Great article. Thanks, Кетмар
⚠ ∑ ♫ ⚽ ☀ ☕ ☺ ≡ ♛
On 2015-03-05 at 15:18, Kagamin wrote:
On Thursday, 5 March 2015 at 13:57:45 UTC, FG wrote:
void main()
{
string s = "ąćęłńóśźż";
Try with string s = "ąc\u0301ęłńóśźż";
Yeah, I see your point: ą, ąc (missing diacritic), ąć, ąćę, ...
Damn those composite characters!
On 2015-03-05 at 10:42, Kagamin wrote:
string s;
char[] b = cast(char[])asArray();
b[0..s.length] = s[];
It's a bit more complicated than that if you include cutting string for buffers
with smaller capacity, doing so respecting UTF-8, and adding a '\0' sentinel,
since you may want to use the
// Assume bar is some associative array of type Foo[string]
Foo* value = key in bar;
if (!value) {
bar[key] = Foo.init;
value = &bar[key];
}
This seems sub-optimal, given that in involves three hashes (two lookups
and one insertion). Is there a more efficient or cleaner way to do so?
S
On 2015-02-17 at 03:35, Jonathan Marler wrote:
On Tuesday, 17 February 2015 at 00:00:54 UTC, FG wrote:
Yes, they would be in TLS. I know exceptions in general are a complex problem,
therefore I limited the comment only to errors, because forbidding the use of
`aa[key]` in @nogc seemed odd
On 2015-02-16 at 22:12, Jonathan Marler wrote:
On Monday, 16 February 2015 at 19:12:45 UTC, FG wrote:
Range violation is an Error, but never mind that. The real question is: given
all the work related to @nogc, wouldn't it be better for such common Errors to
be preallocated and only have
On 2015-02-16 at 18:58, Benjamin Thaut wrote:
Am 16.02.2015 um 18:55 schrieb Jonathan Marler:
Why is the 'in' operator nogc but the index operator is not?
void main() @nogc
{
int[int] a;
auto v = 0 in a; // OK
auto w = a[0]; // Error: indexing an associative
On 2015-02-15 at 19:43, bearophile wrote:
void foo(in float[] data, in float[] xs, in float[] ys) @safe {
iota(0, data.length, ys.length)
.map!(xBase => iota(xBase, xBase + ys.length - 1)
.map!(y => [y, y+ys.length, y+ys.length+1, y+1])
.joiner)
On 2015-02-11 at 01:56, bearophile wrote:
Alternative solution closer to the F# code:
import std.stdio, std.algorithm, std.typecons;
int f(T)(T t) if (isTuple!T) {
return t.predSwitch(
tuple(0, 0, 0), 0,
tuple(0, 1, 1), 0,
tuple(1, 0, 1), 0,
tuple(1, 1,
On 2015-02-10 at 01:41, bearophile wrote:
auto query = iota(2, 12)
.map!(c => Tuple!(int,"length", int,"height",
int,"hypotenuse")
(2 * c, c ^^ 2 - 1, c ^^ 2 + 1))
.map!(x => "%3d%4d%4d".format(x.height, x.hypotenuse,
Of course consuming it dchar by dchar also works:
string s = `\tabŁŃ\r\nx`;
assert(parseDchar(s) == '\t');
assert(parseDchar(s) == 'a');
assert(parseDchar(s) == 'b');
assert(parseDchar(s) == 'Ł');
assert(parseDchar(s) == 'Ń');
assert(parseDchar(s) == '\r');
assert(
On 2015-02-09 at 03:40, Timothee Cour via Digitalmars-d-learn wrote:
Is there a simple way to parse a string as a char?
eg:
unittest{
assert(parseChar(`a`)=='a');
assert(parseChar(`\n`)=='\n'); //NOTE: I'm looking at `\n` not "\n"
// should also work with other forms of characters, see
On 2015-02-08 at 19:15, safety0ff wrote:
On Sunday, 8 February 2015 at 16:23:44 UTC, FG wrote:
2. "auto buf = new byte[](1024*1024*100);"
now the gc can't free this buf.
can i free it by manual?
Yes. import core.memory; GC.free(buf.ptr); // and don't use b
On 2015-02-08 at 15:56, mzf wrote:
On Saturday, 7 February 2015 at 06:08:39 UTC, ketmar wrote:
On Sat, 07 Feb 2015 04:30:07 +, Safety0ff wrote:
False pointers, current GC is not precise.
not only that. constantly allocating big chunks of memory will inevitably
lead to OOM due to curr
On 2015-02-08 at 06:36, Mike Parker wrote:
On 2/8/2015 11:32 AM, FG wrote:
On 2015-02-08 at 01:20, Mike Parker wrote:
In your case, forget destructors and the destroy method. Just
implement a common method on all of your objects that need cleanup
(perhaps name it 'terminate') and
On 2015-02-08 at 01:20, Mike Parker wrote:
In your case, forget destructors and the destroy method. Just implement a
common method on all of your objects that need cleanup (perhaps name it
'terminate') and call that. This gives you the deterministic destruction that
you want (the same as calli
On 2015-02-07 at 13:47, Kadir Erdem Demir wrote:
auto sum = aArr.reduce!((a,b) => a.count + b.count);
The line above gives
C:\D\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(770): Error: cannot
implicitly convert expression (__lambda3(result, front(_param_1))) of type int
to A
C:\D\
On 2015-02-07 at 12:02, Andrey Derzhavin wrote:
If a "destroy" method is used together with GC inside of my app,it makes my app
unstable.
In this case I need to choose how to destroy my objects: 1) always manually by method
"destroy", but without GC; 2) or always automatically by GC, but withou
On 2015-02-06 at 18:09, Charles wrote:
readString(toBytes!char(['t','e','s','t']),0,4).writeln;
readString(toBytes!string("test"),0,4).writeln;// This is line 39
That second line makes no sense (you didn't provide an array of strings).
Why toBytes!string("test") and not to
On 2015-02-06 at 05:17, Gan wrote:
Oh sweet. Though if one message length is off by even 1 byte, then all future
messages get corrupted?
Yes, but you can easily detect that by adding a magic number and packet
checksum to the header.
On 2015-02-05 at 17:25, bearophile wrote:
It has to be a void function (or perhaps bettter it can return true/false if it
has removed the item, so it becomes @nogc and nothrow).
And it has to remove the first item equal to the given one.
You can then add a second function that removes at a given
On 2015-02-05 at 09:58, bearophile wrote:
zhmt:
Will arr.ptr change in the future?
As the array add more members , it need more memroy, then remalloc may be
called, the pointer maybe change, then the stored pointer will be invalid.
Will this happen?
Yes, it can happen.
Therefore, don't u
On 2015-02-04 at 01:56, Namespace wrote:
FILE* f = fopen(filename.ptr, "rb");
fseek(f, 0, SEEK_END);
immutable size_t fsize = ftell(f);
fseek(f, 0, SEEK_SET);
That's quite a smart way to get the size of the file.
I started with std.file.getSize (which obviously isn't mark
On 2015-02-04 at 00:07, Foo wrote:
How would I use decoding for that? Isn't there a way to read the file as utf8
or event better, as unicode?
Well, apparently the utf-8-aware foreach loop still works just fine.
This program shows the file size and the number of unicode glyps, or whatever
they
On 2015-02-03 at 20:50, Tobias Pankrath wrote:
Use std.utf.validate instead of decode. It will only allocate one exception if
necessary.
Looks to me like it uses decode internally...
But Foo, do you have to use @nogc? It still looks like it's work in progress,
and lack of it doesn't mean that
On 2015-02-03 at 19:53, Foo wrote:
How can I do that without any GC allocation? Nothing in std.file seems to be
marked with @nogc
I'm asking since it seems very complicated to do that with C++, maybe D is a
better choice, then we would probably move our whole project from C++ to D.
Looks lik
On 2015-02-02 at 14:40, irtcupc wrote:
On Monday, 2 February 2015 at 13:34:28 UTC, ketmar wrote:
struct _Disasm {
align(1):
the difference is that `align` before struct tells how structure should
be packed (i.e. when you have `_Disasm[2] arr`). and `align` *inside*
struct tells compiler how
On 2015-02-02 at 13:16, irtcupc wrote:
The manual section about interfacing from c states that "type[]" is
inter-compatible from C to D,
however, I face this strange case:
- C declaration:
char identifier[64];
- D declaration:
char[64] identifier;
- the result is only correct if i slice by (
Bloody Thunderbird has sent a reply to the OP and not to the NG.
On 2015-02-02 at 11:45, gedaiu wrote:
I don't think that the line of code is wrong. If use && the function will check
for neighbours only on diagonals. Having || allows the search on the vertical and
horizontal axis and diagonals
On 2015-02-02 at 12:23, FG wrote:
Cell(0,3) is not a neighbour bit fits the (diff1 == 1 || diff2 == 1) criterion.
s/bit/but/
On 2015-02-01 at 22:00, gedaiu wrote:
I implemented Conway's game of life in D.
I think you are playing a different game here.
/// Count cell neighbours
long neighbours(Cell myCell, CellList list) {
long cnt;
foreach(cell; list) {
auto diff1 = abs(myCell.x -
On 2015-02-01 at 16:04, Suliman wrote:
opCmp(in DateTime rhs);
what is rhs?
RHS is probably short of "right hand side", ie. the argument on the right side of
the operator in a binary operator expression. In `a < b` it would be b.
I am trying to do something like this:
if( DateTime.opCmp(dti
On 2015-01-30 at 18:42, FG wrote:
But you may wonder what the design choice behind that was that reverse doesn't
return the range itself while sort does (a SortedRange, specifically).
Although, after thinking about it, it makes sense. sort is used mostly to
enforce that something is s
On 2015-01-30 at 17:07, Paul wrote:
writeln("Sorted, reversed: ", reverse(myVals));
Gives me...
Error: template std.stdio.writeln cannot deduce function from argument types
!()(string, void)
As it should, because reverse returns nothing, void.
But you may wonder what the design choice behind
On 2015-01-30 at 12:08, Vladimir Panteleev wrote:
On Friday, 30 January 2015 at 11:04:47 UTC, FG wrote:
Bug or correct behaviour?
Bug: https://issues.dlang.org/show_bug.cgi?id=1238
https://github.com/D-Programming-Language/dmd/pull/3743
The fix is pretty much a one-liner.
Probably 2.067
On 2015-01-30 at 11:55, FG wrote:
Error: module app struct std.regex.Thread(DataIndex) is private
Did you import core.thread?
This is silly. Thread is internal to std.regex, yet when importing both
std.regex and core.thread, you still get an error:
src.d(10): Error: core.thread.Thread
Error: module app struct std.regex.Thread(DataIndex) is private
Did you import core.thread?
@property auto info() @safe @nothrow @pure @return const { return this; }
It is mesmerizing... (@ _ @)
On 2015-01-28 at 03:04, Vladimir Panteleev wrote:
What type is CircleShape?
If it is a class, or otherwise contains pointers, then this is probably the
source of your problem.
class CircleShape : Shape is defined in dsfml.graphics.circleshape, so there's
no going around this...
- Building y
On 2015-01-27 at 23:39, Gan wrote:
I commented out some stuff and it appears my massive memory consumption comes
from my tile.redraw function:
...
Would you know why this is using hundreds of mb of rams?
Looks OK, so probably it is not the cause by itself.
I would add a piece of code to SpaceB
On 2015-01-25 at 11:42, Tobias Pankrath wrote:
On Sunday, 25 January 2015 at 10:21:34 UTC, Suliman wrote:
But is it good practice to fail with exception during passing unknown
parameters? Maybe std.getopt.config.passThrough should be as default?
I really can't remember Apps that crush if pass
On 2015-01-10 at 21:58, bearophile wrote:
Needles is not an array type, it's a type tuple, so withOneOfThese doesn't
accept an array of strings. [...]
So if you really want to pack the strings in some kind of unity, you can do
this as workaround: [...]
I would suggest create a function that d
On 2013-03-11 16:11, Namespace wrote:
I've also done some benchmarks. And I wonder why my appender is much faster if I
enable memory reservation.
Probably just because D's Appender has a better growth scheme than yours and you
reallocate too often. Try to compare how often that happens.
I'm
On 2013-03-01 22:05, Sparsh Mittal wrote:
On Friday, 1 March 2013 at 20:28:19 UTC, FG wrote:
I suppose this:
immutable long DIM = 1024L*1024L *128L;
immutable(double)[] signal = new double[DIM+1];
static this() {
for (long i=0L; i< DIM+1; i++) {
signal[i] = (i+DIM)%7 + (i+DIM+1
I suppose this:
immutable long DIM = 1024L*1024L *128L;
immutable(double)[] signal = new double[DIM+1];
static this() {
for (long i=0L; i< DIM+1; i++) {
signal[i] = (i+DIM)%7 + (i+DIM+1)%5;
}
}
void main()
{ ... }
On 2013-02-27 12:47, FG wrote:
On 2013-02-26 15:10, bearophile wrote:
This third version is much simpler and it seems good enough for
Rosettacode:
http://codepad.org/YJjb1t91
Nice. Myself I'd add bits.reverse; after the N.iota.map..., because I'm more
used to a truth table wher
On 2013-02-26 15:10, bearophile wrote:
This third version is much simpler and it seems good enough for
Rosettacode:
http://codepad.org/YJjb1t91
Nice. Myself I'd add bits.reverse; after the N.iota.map..., because I'm more
used to a truth table where the left-most operands iterate the slowest.
On 2013-02-16 22:36, MrAppleseed wrote:
Perhaps try this: "[ 0-9a-zA-Z.*=+-;()\"\'\\[\\]<>,{}^#/\\]"
I made the changes you suggested above, and although it compiled fine, on the
first run I got a similar error:
std.regex.RegexException@/usr/include/dmd/phobos/std/regex.d(1942): unexpected
en
On 2013-02-16 21:22, MrAppleseed wrote:
auto reg = regex("[ 0-9a-zA-Z.*=+-;()\"\'\[\]<>,{}^#/\\]");
When I try to run the code above, I get:
parser.d(64): Error: undefined escape sequence \[
parser.d(64): Error: undefined escape sequence \]
When I remove the escaped characters (turning my regex
On 2013-02-14 01:09, Rob T wrote:
You can check if disabling the GC just before the insert process improves the
performance. You may see 3x performance improvement. Disabling is safe provided
you re-enable, this can be done reliably with scope(exit) or something similar.
How did you know? It wa
On 2013-02-13 18:39, monarch_dodra wrote:
In any case, I am now parsing the 6Gig packed into 1.5Gig in about 53 seconds
(down from 61). I also tried doing a dual-threaded approach (1 thread to unzip,
1 thread to parse), but again, the actual *parse* phase is so ridiculously fast,
that it changes
On 2013-02-13 16:26, Marco Leise wrote:
I'd still bet a dollar that with an array of values floats would
outperform doubles, when cache misses happen. (E.g. more or
less random memory access.)
I'll play it safe and only bet my opDollar. :)
Good point about choosing the right type of floating point numbers.
Conclusion: when there's enough space, always pick double over float.
Tested with GDC in win64. floats: 16.0s / doubles: 14.1s / reals: 11.2s.
I thought to myself: cool, I almost beat the 13.4s I got with C++, until I
changed the
On 2013-02-13 14:44, Joseph Rushton Wakeling wrote:
The docs for std.algorithm give an illustration of its use to calculate mean and
standard deviation in a single pass: [...]
However, this formula for standard deviation is one that is well known for being
subject to potentially fatal rounding er
On 2013-02-13 14:26, Marco Leise wrote:
template Julia(TReal)
{
struct ComplexStruct
{
float r;
float i;
...
Why aren't r and i of type TReal?
On 2013-02-13 00:06, Sparsh Mittal wrote:
I had a look, but first had to make juliaValue global, because g++ had
optimized all the calculations away.
Brilliant! Yes, that is why the time was coming out to be zero, regardless of
what value of DIM I put. Thank you very very much.
LOL. For a w
On 2013-02-12 21:39, Sparsh Mittal wrote:
I am finding C++ code is much faster than D code.
I had a look, but first had to make juliaValue global, because g++ had optimized
all the calculations away. :) Also changed DIM to 32 * 1024.
13.2s -- g++ -O3
16.0s -- g++ -O2
15.9s -- gdc -O3
15.9s
On 2013-02-12 17:45, monarch_dodra wrote:
A better approach would be to have 1 file reader that passes data to two
simultaneous parsers. This, however, would make things scary complicated, and
I'd doubt we'd even get much better results: I was not able to measure the
actual amount of time spent w
On 2013-02-12 17:28, bioinfornatics wrote:
about threaded version is possible to use get file size function to split it in
several thread.
Use fseek read end of section return it to detect end of split to used
Yes, but like already mentioned before, it only works well for SSD.
For normal hard d
On 2013-02-12 12:14, monarch_dodra wrote:
For one thing, "MessageBox" is private.
Unnecessarily hidden, because, from what I can see from a fast look at the
sources, there is no implicit requirement for there to be only one MessageBox
per thread. Maybe we're getting somewhere and this will be
On 2013-02-12 07:58, monarch_dodra wrote:
I think I didn't explain myself very well. I have my single "master" thread
which has a "thread-global" mailbox, but I have 3 different objects that are
sharing that mailbox.
OK, I finally get what you are saying.
You need to create a mailbox and a uniq
On 2013-02-11 22:37, monarch_dodra wrote:
Basically, I can't help but feel the thing has an hopelessly thread-global
"mailbox" approach to the problem. This is all fine and dandy if there is only a
single "canal" of communication between the master and the child/children.
What thread-global? Ev
On 2013-02-10 15:17, SaltySugar wrote:
how to make console invisible?
Seems to be a recurring question here. :)
Search archives. You probably want: dmd.exe -L/SUBSYSTEM:WINDOWS app.d
On 2013-02-10 02:22, Sparsh Mittal wrote:
The current reply answers my question, but I was just curious. Can we have a
method which divides the 2d region as follows: 8*12 divided into 4*6 to each of
4 threads.
Think again if you need that. Things start getting pretty ugly. :)
const uint pa
On 2013-02-09 23:32, Sparsh Mittal wrote:
I saw foreach and parallel commands on
http://dlang.org/phobos/std_parallelism.html
I have nested for-loops as follows:
for(int i=1; i< N; i++)
{
for(int j=1; j < M; j++)
{
func(i,j);
}
}
Here func(i,j) is such that there is no dep
clear that I am CPU-bound here on the Intel E6600 system. Compare:
7200rpm: MS 4m30s / FG 1m55s
SSD: MS 4m14s / FG 1m44s
Almost the same, but running the utility "wc -l" on the file renders:
7200rpm: 1m45s
SSD: 0m33s
In my case threads would be beneficial bu
On 2013-02-07 00:41, Lee Braiden wrote:
I wasn't going to mention this as I thought the CPU usage might be trivial, but
if both CPU and IO are factors, then it would probably be beneficial to have a
separate IO thread/task.
This wasn't an issue in my version of the program. It took 1m55s to pro
On 2013-02-06 21:43, monarch_dodra wrote:
On Wednesday, 6 February 2013 at 19:19:52 UTC, FG wrote:
I have processed the file SRR077487_1.filt.fastq from
ftp://ftp.1000genomes.ebi.ac.uk/vol1/ftp/data/HG00096/sequence_read/
and expect this syntax (no multiline sequences or whitespace).
File takes
On 2013-02-04 15:04, bioinfornatics wrote:
I am looking to parse efficiently huge file but i think D lacking for this
purpose.
To parse 12 Go i need 11 minutes wheras fastxtoolkit (written in c++ ) need 2
min.
Haven't compared to fastxtoolkit, but I have some code for you.
I have processed th
On 2013-02-05 20:48, SaltySugar wrote:
Can I use hbox.add(btn); instead of hbox.packStart (btn,false,false,5);
What difference between them?
Using add(btn) you would probably end up with a stretched button again. :)
hbox.packStart(child, expand, fill, padding)
It was explicitly said that ex
On 2013-02-04 15:04, bioinfornatics wrote:
I am looking to parse efficiently huge file but i think D lacking for this
purpose.
To parse 12 Go i need 11 minutes wheras fastxtoolkit (written in c++ ) need 2
min.
My code is maybe not easy as is not easy to parse a fastq file and is more
harder wh
On 2013-02-02 22:47, monarch_dodra wrote:
I suggest you read this:
http://dlang.org/d-array-article.html
It is a very interesting read, especially for those of us with C++ background.
Thank you for pointing me to that article.
I have read it months ago and forgotten the important parts.
Now it
On 2013-02-02 22:57, FG wrote:
On 2013-02-02 22:33, Steven Schveighoffer wrote:
Heap block sizes start at 16. One byte overhead is used to store the array
length, so the minimum size of ANY array allocation is 15 bytes.
How is the length stored because I see only strange numbers in that byte
On 2013-02-02 22:33, Steven Schveighoffer wrote:
Heap block sizes start at 16. One byte overhead is used to store the array
length, so the minimum size of ANY array allocation is 15 bytes.
How is the length stored because I see only strange numbers in that byte.
foreach (end; 2..31) {
On 2013-02-02 19:53, Namespace wrote:
Are you uncomfortable, because it may allocate twice as much space
as you need (for bigger color_data)?
Yes, that's the point.
Sorry, I cannot express myself very well in English.
You're right. It's surprising for anyone used to dealing with std::vector,
On 2013-02-02 19:01, Namespace wrote:
Example:
struct Color {
public:
ubyte[4] colors;
}
ubyte[] data = new ubyte[color_data.length * 4]; // enough storage
foreach (ref const Color col; color_data) {
data ~= col.colors;
}
Sorry, but what is the point of data having only 4 bytes rese
On 2013-02-02 17:36, Namespace wrote:
ubyte[] arr = new ubyte[4];
arr ~= 4; // desirable: [4, 0, 0, 0];
Why not arr[0] = 4? What is so special about having 4 elements?
As I looked at arr.length and arr.capacity for the first time I was schocked: I
want only space for 4 items, but I
On 2013-02-02 16:06, Namespace wrote:
string[string] ch_Description = [
"kill" : "kills a process",
"pause" : "pauses a process"
];
writeln(ch_Description); // does not work, but it should
Doesn't work in the current version? In DMD 2.060 it works.
On 2013-02-02 16:22, Josh wrote:
Maybe because of output buffering and you need to add flush?
How do I do that? I've never heard of flush before.
writeln("..."); stdout.flush();
C also has flush, in the form of fflush(stdout);
I've never come across Appenders before. Could you please e
On 2013-02-02 13:50, Era Scarecrow wrote:
On Saturday, 2 February 2013 at 11:33:07 UTC, Namespace wrote:
I'm was quite surprised as I had heard the first time of these 'appender'.
Therefore I'm asking me:
Why is the 'appender' method so much more efficient?
Because concatenation likely will
On 2013-02-02 07:49, Josh wrote:
But main's first writeln actually outputs after f.close().
Maybe because of output buffering and you need to add flush?
The program uses ~1GB of RAM overall, even though main.results is ~50MB
according to memSize.
Wrong comparison. You should have compared t
On 2013-02-01 20:33, Dmitry Olshansky wrote:
Mine reiteration on it, with a bit of help from std.parallelism.
std.parallelism uses thread pool thus it's somewhat faster then creating threads
anew.
Interestingly, threads+barrier here wasn't much slower than tasks:
14% slower for dmd32, only 5% f
On 2013-02-01 16:42, Sparsh Mittal wrote:
When I run it, and compare this parallel version with its serial version, I only
get speedup of nearly <1.3 for 2 threads. When I write same program in Go,
scaling is nearly 2.
Also, in D, on doing "top", I see the usage as only 130% CPU and not nearly 2
On 2013-02-01 16:37, Steven Schveighoffer wrote:
Actually, that's a different problem. File is a struct, and structs do NOT have
their destructor run by the GC. Only Objects do.
This is a GC limitation, since structs do not contain a pointer to their
typeinfo like classes do, and there is no p
On 2013-01-31 14:33, SaltySugar wrote:
I have two more questions;
First, how to remove an arrow on the window's bottom?
By making the window fixed-size, not scalable?
Second, when I run my program it runs together with console. I want to run only
window of application. How to do it?
This ha
On 2013-01-31 13:35, SaltySugar wrote:
Thanks, setBorderWidth() is working but button's size isn't changing.
I don't have a working gtk environment to test it, but try this:
(maybe hBox2 isn't even needed and you could vBox.add(algn1);)
import gtk.MainWindow;
import gtk.Label;
imp
On 2013-01-31 12:38, SaltySugar wrote:
HBox hBox = new HBox(false, 3);
HBox hBox1 = new HBox(false, 3);
VBox vBox = new VBox(false, 5);
Button btnLog = new Button("LOGIN --->");
Label lblNick = new Label("User: ");
Entry txtNick = new Entry(
On 2013-01-31 03:29, Sparsh Mittal wrote:
Thanks. I wrote this: [...]
It compiles but barrier does not get released. Can you please point out the
fault. Pardon my mistake. I searched whole web, there are almost no examples of
it online.
Barrier doesn't release because you've only called wait()
On 2013-01-31 10:47, Timon Gehr wrote:
The reason is that array literals have special conversion rules
It's because floating point literals are double by default.
In the first assignment float type can be deduced from v1.
To make the second one work, you can explicitly make them float:
flo
Thanks for showing me how to use tuples in this problem.
Just for the record, the sort comparison should be reversed: "a > b".
Let's say i have an array: int[string] wordCount.
How to print key:value pairs ordered by descending value?
Or generally how to to store wordCount in an array of structs or type tuples for
later sorting?
In Python I would use something like this:
sorted(wordCount.items(), key=lambda a: a[1], re
On 2013-01-30 04:27, Ali Çehreli wrote:
s = s[0..7] ~ s[8..$];
As with the other slicing approaches, it would be best to check first if
s.length >= i (with i = 8 in this case).
1 - 100 of 109 matches
Mail list logo