Re: 200-600x slower Dlang performance with nested foreach loop

2021-01-30 Thread CraigDillabaugh via Digitalmars-d-learn

On Tuesday, 26 January 2021 at 23:57:43 UTC, methonash wrote:
clip
That nested loop is an O(n^2) algorithm. Meaning it will slow 
down *very* quickly as the size of the array n increases.  You 
might want to think about how to improve this algorithm.


Nice observation, and yes, this would typically be an O(n^2) 
approach.


However, due to subsetting the input dataset to unique strings 
and then sorting in descending length, one might notice that 
the inner foreach loop does not iterate over all of n, only on 
the iterator value i+1 through the end of the array.


Thus, I believe this would then become approximately O(n^2/2). 
More precisely, it should be O( ( n^2 + n ) / 2 ).




But that is still O(n^2), you've only changed the constant.


Re: Reflection on the book D web development.

2020-11-20 Thread CraigDillabaugh via Digitalmars-d-learn

On Friday, 20 November 2020 at 19:12:38 UTC, Alaindevos wrote:

I bought the book "D Web Development".
I understand only 20% of the book,the other 80% is way above my 
head.
Compare, I own a book on flask development, and I understand 
100% of it.
Which means I can use dlang for anything except QT and serious 
web development ...


Could you explain some of the things that you found particularly 
challenging about the book?   What level of D proficiency did you 
have before you started with the book?


What is up with Vibe-d

2020-07-09 Thread CraigDillabaugh via Digitalmars-d-learn
So is Vibe-d still being actively maintained?   I noticed there 
have been no new releases in a while, and the forums are a bit of 
a disaster (unless you love porn I suppose):


https://forum.rejectedsoftware.com/groups/rejectedsoftware.vibed/


Re: Looking for a Code Review of a Bioinformatics POC

2020-06-11 Thread CraigDillabaugh via Digitalmars-d-learn

On Thursday, 11 June 2020 at 16:13:34 UTC, duck_tape wrote:
Hi! I'm new to dlang but loving it so far! One of my favorite 
first things to implement in a new language is an interval 
library. In this case I want to submit to a benchmark repo: 
https://github.com/lh3/biofast


I also think there is room for improvement in the IO, as I'm 
just using the defaults.


Are you building with DMD or with LDC/GDC?



Re: Bug in std.json or my problem

2020-04-22 Thread CraigDillabaugh via Digitalmars-d-learn

On Wednesday, 22 April 2020 at 18:23:48 UTC, Anonymouse wrote:
On Wednesday, 22 April 2020 at 17:48:18 UTC, Craig Dillabaugh 
wrote:
The crash is caused because the 'income' field with value 0.0 
is
output as 0 (rather than 0.0) and when it is read this is 
interpreted

as an integer.

Shouldn't this work?


Yes, it's just buggy.

Giving it a value of an even 1.0 will make it throw the same 
exception (js["income"].type is JSONType.integer), but a value 
of 1.1 will make it pass (.type properly becomes 
JSONType.float_).


I don't know of a solution other than to check 
js["income"].type beforehand and use .floating or .integer as 
befits, or simply use an alternative JSON library (asdf?).


File an issue if you have the time, maybe it will get 
attention. Unreported bugs can only be fixed by accident.


I thought it might be worth filing a bug, but wanted to confirm 
if others thought this was actually a bug.  I had encountered an 
identical issue with vibe-d years ago.


Thanks for the feedback.


Re: benchmark on binary trees

2015-12-04 Thread CraigDillabaugh via Digitalmars-d-learn

On Friday, 4 December 2015 at 14:06:26 UTC, Alex wrote:

Hi everybody,
this is going to be a learning by doing a benchmark test - post.


clip


3. The compilation was done by:
dmd -O -release -boundscheck=off [filename.d]
Is there anything else to improve performance significantly?



If you have access to LDC or GDC they typically produce 
significantly faster code.





Re: looking for sdl2 based application skeleton

2015-11-05 Thread CraigDillabaugh via Digitalmars-d-learn

On Thursday, 5 November 2015 at 07:26:08 UTC, drug wrote:
It seems to me I saw somewhere the project like this. I don't 
want to make another one if there is something like that.


Where you thinking of Derelict?

https://github.com/DerelictOrg/DerelictSDL2

or perhaps Dgame:

https://github.com/Dgame/Dgame

Craig


Re: Speeding up text file parser (BLAST tabular format)

2015-09-14 Thread CraigDillabaugh via Digitalmars-d-learn
On Monday, 14 September 2015 at 12:30:21 UTC, Fredrik Boulund 
wrote:

Hi,

This is my first post on Dlang forums and I don't have a lot of 
experience with D (yet). I mainly code bioinformatics-stuff in 
Python on my day-to-day job, but I've been toying with D for a 
couple of years now. I had this idea that it'd be fun to write 
a parser for a text-based tabular data format I tend to read a 
lot of in my programs, but I was a bit stomped that the D 
implementation I created was slower than my Python-version. I 
tried running `dmd -profile` on it but didn't really understand 
what I can do to make it go faster. I guess there's some 
unnecessary dynamic array extensions being made but I can't 
figure out how to do without them, maybe someone can help me 
out? I tried making the examples as small as possible.


Here's the code D code: http://dpaste.com/2HP0ZVA
Here's my Python code for comparison: http://dpaste.com/0MPBK67

clip


I am going to go off the beaten path here.  If you really want 
speed

for a file like this one way of getting that is to read the file
in as a single large binary array of ubytes (or in blocks if its 
too big)
and parse the lines yourself. Should be fairly easy with D's 
array slicing.


I looked at the format and it appears that lines are quite simple 
and use
a limited subset of the ASCII chars.  If that is in fact true 
then you
should be able to speed up reading using this technique.  If you 
can have
UTF8 chars in there, or if the format can be more complex than 
that shown

in your example, then please ignore my suggestion.



Re: Dynamic memory

2015-07-28 Thread CraigDillabaugh via Digitalmars-d-learn

On Tuesday, 28 July 2015 at 17:26:39 UTC, Binarydepth wrote:
On Tuesday, 28 July 2015 at 17:07:47 UTC, Steven Schveighoffer 
wrote:

On 7/28/15 12:59 PM, Binarydepth wrote:


When indexing, it always goes out to in. So nam[0] is the 
first element of type int[2], and nam[0][0] is the first 
integer in that first element.



-Steve


I don't get what you mean here. In general I understood that in 
D multidimensional arrays are a group of arrays.


A bit off-topic.

I've done a lot of image processing work that deals with 2D 
arrays in particular.  I must admit that for the most part now I 
just use a 1D array for all my 2D arrays and do a bit of index 
arithmetic to figure the location in 2D.


To index I have to do something like (for row major order):

my2darray[row * COLS_PER_ROW + col] = blah;

But I find this has many advantages:

1. The tiny bit of arithmetic is more than offset by not having 
to deal with trying to remember the order of the indices.


2. You can chose if you want row or column major order.

3. It makes lots of operations much easier, ie. adding two images 
together if they are of the same dimensions, generating 
histograms, calculating the average value in a 2D array.


4. Easy to set size dynamically.

5. Consistent between pretty much every programming language (ie. 
my C and D code would look the same).


6. (IMHO) Code is actually more readable.  But then I find lots 
of brackets confusing ... so maybe its just me.









Re: Dynamic memory

2015-07-28 Thread CraigDillabaugh via Digitalmars-d-learn
On Tuesday, 28 July 2015 at 20:07:12 UTC, Steven Schveighoffer 
wrote:

On 7/28/15 3:33 PM, CraigDillabaugh wrote:

6. (IMHO) Code is actually more readable.  But then I find 
lots of

brackets confusing ... so maybe its just me.


Have you considered a wrapper that uses multi-dimensional 
access? i.e.:


my2darray[row, col] = blah;

-Steve


It has crossed my mind, but I've got so used to doing the 
position calculations I haven't yet tried it.  I guess you would 
simply need to put your array in a struct and overload the '[]' 
operator correct? (Plus the appropriate constructors, etc).


Re: Yes or No Options

2015-07-27 Thread CraigDillabaugh via Digitalmars-d-learn

On Monday, 27 July 2015 at 17:21:33 UTC, Anonymous wrote:

On Monday, 27 July 2015 at 16:48:00 UTC, Alex wrote:

Okay. By pure trying I found out what I did wrong:

Apparently by typing Y I entered the shift key. Could that 
have been the problem?
I changed it to a small y and it at least jumped back to the 
commandline instead of just being stuck.


And by changing:

writeln(Do you want to play again? Y/N?);
readln(yesno);
if (yesno == y) {
writeln(Yeah!);
}

to:

writeln(Do you want to play again? Y/N?);
readln(yesno);
if (yesno != y) {
writeln(Yeah!);
}

So instead of ==   I used  !=

Now it works. But I still do not know why..


Check out what is the length of yesno after you do your readln.

Ex. writeln(yesno.length)

std.string.chomp may help.


Also, notice in Namespace's answer above the use of:

 if (yesno.toLower() != y)

This ensures that whether the user typed 'Y' or 'y' then check 
works properly.  Which is likely what the user expects.


The 'Shift' key does not add any new symbols to the string (it 
only modifies what symbols are added).


Re: Accessing x86 Performance Counters

2015-05-13 Thread CraigDillabaugh via Digitalmars-d-learn

On Wednesday, 13 May 2015 at 09:26:40 UTC, Benjamin Thaut wrote:

On Wednesday, 13 May 2015 at 08:53:10 UTC, Kagamin wrote:
There was no word about windows, but process explorer shows 
page faults and cycles per process from unprivileged account, 
so I guess, this information is available through some API. 
Not sure is such system-wide statistics is available too.


He is talking about the performance counters build into intel 
x86 processors (at least thats what I understood) thats 
something completely different from page faults and cycles per 
process. And as it is processor specific there is _no_ general 
api for it.


That should be She is talking about ...  :o)


Re: Converting void* to D array

2015-04-15 Thread CraigDillabaugh via Digitalmars-d-learn
On Wednesday, 15 April 2015 at 11:18:03 UTC, Steven Schveighoffer 
wrote:

On 4/15/15 12:47 AM, Daniel Kozak wrote:
On Wednesday, 15 April 2015 at 04:43:39 UTC, Daniel Kozák 
wrote:


On Wed, 15 Apr 2015 04:24:20 +
Craig Dillabaugh via Digitalmars-d-learn
digitalmars-d-learn@puremagic.com wrote:


Hi.
I want to call a C library function that returns a data 
buffer as a
void*.  How do I convert the resulting void* into something 
I can

process in D?

//I have the following function from the GDAL C library.
extern(C) CPLErr GDALReadBlock( GDALRasterBandH, int, int, 
void* );



So I have (GByte is defined in the GDAL library):

void* buffer = malloc( GByte.sizeof * x_block_size * 
y_block_size );


I fill the buffer (and ignore any errors :o)

GDALReadBlock( AGDALRasterBandHInstance, xblock, yblock, 
buffer );



Now, how can I access the data in buffer?

Or you probably can do it like this:

auto buffer = new GByte[xblock*yblock];

GDALReadBlock( AGDALRasterBandHInstance, xblock, yblock,
(cast void*)buffer.ptr );
But in this case memory will be scan by GC. Which probably is 
not

something what you want.


Depends on what GByte is. If it doesn't contain pointers (I'm 
assuming its probably ubyte?), then it won't be scanned.


If you still want to use malloc, but in a safe way, you can do:

immutable blocksize = GByte.sizeof * x_block_size * 
y_block_size;

auto buffer = malloc(blocksize)[0..blocksize];

Also, you don't need to cast pointers to void *. Should be able 
to do:


GDALReadBlock(AGDALRasterBandHInstance, xblock, yblock, 
buffer.ptr);


-Steve


Thanks for the pointers (no pun intended!)

Just out of curiosity, what is the type of 'buffer'?  'malloc' 
returns a void* but using the .ptr suggests 'buffer' is an array. 
 Is the return of malloc automatically converted to an array?


Re: Converting void* to D array

2015-04-15 Thread CraigDillabaugh via Digitalmars-d-learn
On Wednesday, 15 April 2015 at 11:18:03 UTC, Steven Schveighoffer 
wrote:

clip
Depends on what GByte is. If it doesn't contain pointers (I'm 
assuming its probably ubyte?), then it won't be scanned.



clip

-Steve


Yes, GByte is an alias for ubyte.



Re: Converting void* to D array

2015-04-15 Thread CraigDillabaugh via Digitalmars-d-learn
On Wednesday, 15 April 2015 at 14:02:38 UTC, Steven Schveighoffer 
wrote:

On 4/15/15 8:35 AM, CraigDillabaugh wrote:
On Wednesday, 15 April 2015 at 11:18:03 UTC, Steven 
Schveighoffer wrote:


immutable blocksize = GByte.sizeof * x_block_size * 
y_block_size;

auto buffer = malloc(blocksize)[0..blocksize];

Also, you don't need to cast pointers to void *. Should be 
able to do:


GDALReadBlock(AGDALRasterBandHInstance, xblock, yblock, 
buffer.ptr);




Thanks for the pointers (no pun intended!)

Just out of curiosity, what is the type of 'buffer'?  'malloc' 
returns a
void* but using the .ptr suggests 'buffer' is an array.  Is 
the return

of malloc automatically converted to an array?


malloc returns void *, but I am applying the slice operator 
which turns a pointer into a slice. I'll split it up:


auto bufptr = malloc(blocksize);// typeof(bufptr) = void *
auto buffer = bufptr[0..blocksize]; // typeof(buffer) = void[]

-Steve
Nice.  Thanks.  I didn't realize you can slice a bare pointer 
like that.


Does druntime have any way of making sure that is safe, or are 
you on your own?


Re: Using C++ libraries in D

2015-03-17 Thread CraigDillabaugh via Digitalmars-d-learn

On Tuesday, 17 March 2015 at 13:22:13 UTC, kishore wrote:

Hi,

 I'm new to D language, I'm from Java, Scala family. D is 
interesting and better than C++ from my point of view. Can we 
able to use C++ external libraries in D language ?


For example I would like to use 
GraphLab(https://dato.com/products/create/open_source.html) 
library in my D programs is it possible ?


You may also be interested in Calypso:

http://forum.dlang.org/thread/nsjafpymezlqdknmn...@forum.dlang.org#post-m7abcp:242sf1:241:40digitalmars.com

I haven't used it myself, so I can't vouch for it, and it is 
likely very 'bleeding edge', but if you are adventurous it could 
be worth a try.


Craig


Re: Will D have a standard cross platform GUI toolkit?

2015-02-26 Thread CraigDillabaugh via Digitalmars-d-learn

On Thursday, 26 February 2015 at 18:20:12 UTC, Rinzler wrote:

Hello,

I was wondering if D will have a standard cross platform GUI 
toolkit.


I think that any modern language should provide a 
cross-platform GUI toolkit. I know that there are some GUI 
toolkits, but are there cross-platform? Are there serious 
works? That is, will them always be supported and evolve along 
with the D programming language?


I think that having bindings of a GUI toolkit for a programming 
languages can be useful, but they have to be well supported.


Will QT support D programming language? I really love the Qt 
framework (except from the fact it's not open source, as far as 
I know), even though I have not used it a lot.


I have to admit that I love D, even if I did not start 
programming with it. It seems it combines the most useful 
things of C++ and Java, which are my favourite programming 
languages.


Maybe there are other questions already in the forum, since I 
am new, I don't know, but a new question, more up to date, can 
also be useful.


Thanks!


You may want to check out DOtherSide, which is a set of bindings 
to QML:


https://github.com/filcuc/DOtherSide


Re: Will D have a standard cross platform GUI toolkit?

2015-02-26 Thread CraigDillabaugh via Digitalmars-d-learn

On Thursday, 26 February 2015 at 18:49:39 UTC, Rinzler wrote:
By the way, which, in your opinion, is the most performant and 
more stable?


I personally can't help you there, as I've never done any GUI 
programming in D.  Maybe you can test a few of them out and write 
a report :o)


Re: curl password issue

2015-02-23 Thread CraigDillabaugh via Digitalmars-d-learn

On Monday, 23 February 2015 at 17:47:54 UTC, Andre wrote:
Until now I didn't found out how to solve the issue excepting 
changing

the password;)
In case I find the solution I will make a pull request.

Kind regards
André

On Monday, 23 February 2015 at 16:58:16 UTC, Marc Schütz wrote:

On Monday, 23 February 2015 at 16:10:42 UTC, Andre wrote:

Hi,

Curl has some issues with passwords containing special 
characters

like the hash key (#).
The password will not be accepted although it is correctly
set with the method setAuthencication(user, pass1234#);

I know this is more a Curl issue than a DLang issue but it
is very frustrating and for unexperienced users very hard to
find out why the application is working for some users
and for some others not...

Could the documentation for setAuthentication could be 
enhanced?


Kind regards
André


Sure. You can make a pull request. The documentation in 
question is here:


https://github.com/D-Programming-Language/phobos/blob/master/std/net/curl.d#L1809
https://github.com/D-Programming-Language/phobos/blob/master/std/net/curl.d#L2411

Alternatively, you can suggest a text here, and I or some else 
will submit one.


The suggestion to make a pull request wasn't to provide a 
work-around for the undesired behavior, but rather to add a 
comment noting what the the behavior was (as a warning for 
users).  If this is a limitation of curl, there likely isn't 
anything D can do about it.


Re: Learning to XML with D

2015-02-06 Thread CraigDillabaugh via Digitalmars-d-learn

On Friday, 6 February 2015 at 11:39:32 UTC, Chris wrote:

On Friday, 6 February 2015 at 09:15:54 UTC, Derix wrote:
So, I set sails to transform a bunch of HTML files with D. 
This, of course, will happen with the std.xml library.


There is this nice example :
http://dlang.org/phobos/std_xml.html#.DocumentParser
that I put to some use already, however some of the basics 
seem to escape me, specially in lines like


   xml.onEndTag[author]   = (in Element e) { book.author
  = e.text(); };

OK, we're doing some event-base parsing, reacting with a 
lambda function on encountering so-and-do tag, à la SAX. (are 
we ?)


What I don't quite grab is the construct (in Element e) , 
especially the *in* part.


Is it *in* as in http://dlang.org/expression.html#InExpression 
? In which case I fail to see what associative array we're 
considering.


It's probably more a way to further qualify the argument e 
were passing to the  λ-function : could someone elaborate on 
that ?


Of course, it is entirely possible that I completely miss the 
point and that I'm overlooking some fundamentals, if so have 
mercy and help me find my way back to teh righteous path ;-)



Thxxx


The documentation says:

Warning: This module is considered out-dated and not up to 
Phobos' current standards. It will remain until we have a 
suitable replacement, but be aware that it will not remain long 
term.


My advice is not to use it. I used it a while back, but it 
slowed down my system (why I still don't know), and it is 
permanently soon-to-be deprecated.


If you wanna use D for XML parsing, see if you can find a solid 
3rd party library in D (have a look at Adam's github page: 
https://github.com/adamdruppe/, he has some DOM and HTML stuff 
up there).


There is a new xml module in the review queue, but nobody seems 
to care. I _think_ the reason why nobody really cares is that 
most people in the D community don't like XML.


I added XML to the GSOC idea's page (see Phobos section), but it 
still needs a mentor.  Are you busy this summer?


http://wiki.dlang.org/GSOC_2015_Ideas#Phobos:_D_Standard_Library



Re: Learning to XML with D

2015-02-06 Thread CraigDillabaugh via Digitalmars-d-learn

On Friday, 6 February 2015 at 14:09:51 UTC, CraigDillabaugh wrote:

On Friday, 6 February 2015 at 11:39:32 UTC, Chris wrote:

On Friday, 6 February 2015 at 09:15:54 UTC, Derix wrote:

clip



Thxxx


The documentation says:

Warning: This module is considered out-dated and not up to 
Phobos' current standards. It will remain until we have a 
suitable replacement, but be aware that it will not remain 
long term.


My advice is not to use it. I used it a while back, but it 
slowed down my system (why I still don't know), and it is 
permanently soon-to-be deprecated.


If you wanna use D for XML parsing, see if you can find a 
solid 3rd party library in D (have a look at Adam's github 
page: https://github.com/adamdruppe/, he has some DOM and HTML 
stuff up there).


There is a new xml module in the review queue, but nobody 
seems to care. I _think_ the reason why nobody really cares is 
that most people in the D community don't like XML.


I added XML to the GSOC idea's page (see Phobos section), but 
it still needs a mentor.  Are you busy this summer?


http://wiki.dlang.org/GSOC_2015_Ideas#Phobos:_D_Standard_Library


Just for the record, I hate XML too, but it is VERY widely used, 
so good XML support is essential ... like it or not!


Re: Learning to XML with D

2015-02-06 Thread CraigDillabaugh via Digitalmars-d-learn

On Friday, 6 February 2015 at 14:15:44 UTC, Chris wrote:
On Friday, 6 February 2015 at 14:11:19 UTC, CraigDillabaugh 
wrote:
On Friday, 6 February 2015 at 14:09:51 UTC, CraigDillabaugh 
wrote:

On Friday, 6 February 2015 at 11:39:32 UTC, Chris wrote:

On Friday, 6 February 2015 at 09:15:54 UTC, Derix wrote:

clip



Thxxx


The documentation says:

Warning: This module is considered out-dated and not up to 
Phobos' current standards. It will remain until we have a 
suitable replacement, but be aware that it will not remain 
long term.


My advice is not to use it. I used it a while back, but it 
slowed down my system (why I still don't know), and it is 
permanently soon-to-be deprecated.


If you wanna use D for XML parsing, see if you can find a 
solid 3rd party library in D (have a look at Adam's github 
page: https://github.com/adamdruppe/, he has some DOM and 
HTML stuff up there).


There is a new xml module in the review queue, but nobody 
seems to care. I _think_ the reason why nobody really cares 
is that most people in the D community don't like XML.


I added XML to the GSOC idea's page (see Phobos section), but 
it still needs a mentor.  Are you busy this summer?


http://wiki.dlang.org/GSOC_2015_Ideas#Phobos:_D_Standard_Library


Just for the record, I hate XML too, but it is VERY widely 
used, so good XML support is essential ... like it or not!


You're right of course. It is widely (and wildly) used. I for 
my part have changed my input files from XML to a simpler 
custom format.


PS I am busy this summer. But maybe Adam's dom.d can be used as 
a basis for a new module, unlike std.xml2 it's not abandoned.


Thanks for the tip.  I may add a reference there!


Re: Odd Error Message

2014-12-16 Thread CraigDillabaugh via Digitalmars-d-learn
On Monday, 15 December 2014 at 22:20:53 UTC, ketmar via 
Digitalmars-d-learn wrote:

On Mon, 15 Dec 2014 22:09:28 +
CraigDillabaugh via Digitalmars-d-learn
digitalmars-d-learn@puremagic.com wrote:


Given the following program:

import std.string;
import std.stdio;

void main()
{   
File file = File(blah.txt, r);

while( !(file.eof())  count  10 ) {  //line 8
//
}
}

I get the error message:

line(8): Error: void has no value

If I comment out the import std.string; then I get an error I 
would expect.


line(8): Error: undefined identifier count

There is no 'count' symbol that I can see in std.string.
there is public import from std.algorithm inside std.string, so 
what

you see is about std.algorithm.count.


Would this error message be considered a compiler bug?
i don't think so. compiler tries to instantiate 
std.algorithm.count and
failed doing that, so it tries to tell you about that failure. 
newer

compiler will tell you this:

z00.d(8): Error: void has no value
z00.d(8): Error: incompatible types for ((count(alias pred = a 
== b, Range, E)(Range haystack, E needle)

  if (isInputRange!Range  !isInfinite!Range 
  is(typeof(binaryFun!pred(haystack.front, needle)) : bool)))  
(10)): 'void' and 'int'


this is slightly better, albeit still cryptic. template 
instantiation
error messages are of the most noisy and hard to understand 
ones. alas.

but poor compiler at least tries to help you. ;-)


Thanks Ketmar and Bearophile.


Odd Error Message

2014-12-15 Thread CraigDillabaugh via Digitalmars-d-learn

Given the following program:

import std.string;
import std.stdio;

void main()
{   
File file = File(blah.txt, r);

while( !(file.eof())  count  10 ) {  //line 8
//
}
}

I get the error message:

line(8): Error: void has no value

If I comment out the import std.string; then I get an error I 
would expect.


line(8): Error: undefined identifier count

There is no 'count' symbol that I can see in std.string.

Would this error message be considered a compiler bug?

DMD32 D Compiler v2.066.1 (on Windows 7)



Re: Learning D for a non computer science background person : pre-requisite knowledge?

2014-12-02 Thread CraigDillabaugh via Digitalmars-d-learn

On Tuesday, 2 December 2014 at 16:38:34 UTC, Mayuresh Kathe wrote:
While I have been a programmer for close to 23 years, it's been 
mostly API level code cobbling work.


Would like to learn D, but am a bit intimidated by the fact 
that I don't have much of a grasp over the foundational stuff 
(discrete mathematics, machine organization, etc.) and hence am 
preparing for the same.


Would like to know if there be anything else I should work 
through before approaching D via Mr. Alexandrescu's book.


Thanks.


If you have been programming for 23 years there is absolutely no 
reason why you should struggle with D due to your lack of 
discrete math, machine organization knowledge, etc.  You 
certainly shouldn't have any trouble following Andrei's book, 
which is very easy to follow, although having some discrete math 
is helpful in keeping up with some of his forum posts :o)


Welcome to the D world!



Re: Learning D for a non computer science background person : pre-requisite knowledge?

2014-12-02 Thread CraigDillabaugh via Digitalmars-d-learn

On Tuesday, 2 December 2014 at 17:04:57 UTC, Mayuresh Kathe wrote:
On Tuesday, 2 December 2014 at 16:54:50 UTC, CraigDillabaugh 
wrote:
On Tuesday, 2 December 2014 at 16:38:34 UTC, Mayuresh Kathe 
wrote:

clip


Thanks for the welcome. :)

I think I'll just work through Discrete Mathematics and Machine 
Organization before approaching Mr. Alexandrescu's book, would 
take up only 6 ~ 8 months of my time, and would be really good 
for me in the long term.


I certainly wouldn't discourage from studying Discrete Mathematics
or Machine Organization, as they are very helpful, but they
are by no means per-requisites for Andrei's book - or D for that
matter.

Anyway, whatever course you decide to follow - have fun. S


Re: [dub] Size of executable

2014-11-27 Thread CraigDillabaugh via Digitalmars-d-learn

On Thursday, 27 November 2014 at 13:56:19 UTC, Chris wrote:
On Thursday, 27 November 2014 at 12:29:03 UTC, Gary Willoughby 
wrote:

On Thursday, 27 November 2014 at 09:33:49 UTC, Chris wrote:
I usually use dub to create and build projects. I built one 
of the projects with dub and then by hand with dmd[1] passing 
all the files etc. Turned out that the executable built with 
dub was 1.4 MB whereas the one built by hand was only 807 kB. 
Why is that?


dub compiles and links every file in the source folder whether 
it's used or not. Whereas with dmd or rdmd you only compile 
and link the files you actually use.


I compiled the exact same files. I excluded those I didn't need 
in the dub configuration like so:


excludedSourceFiles: [...]

But dub's executable is bigger.


When you build with dub it should print out (if I remember 
correctly, its been a little while) the command it uses to build 
your code.  Is there any difference between that command and your 
'by hand' version?


Re: [dub] Size of executable

2014-11-27 Thread CraigDillabaugh via Digitalmars-d-learn

On Thursday, 27 November 2014 at 14:14:50 UTC, Chris wrote:
On Thursday, 27 November 2014 at 13:59:23 UTC, CraigDillabaugh 
wrote:

On Thursday, 27 November 2014 at 13:56:19 UTC, Chris wrote:
On Thursday, 27 November 2014 at 12:29:03 UTC, Gary 
Willoughby wrote:

On Thursday, 27 November 2014 at 09:33:49 UTC, Chris wrote:
I usually use dub to create and build projects. I built one 
of the projects with dub and then by hand with dmd[1] 
passing all the files etc. Turned out that the executable 
built with dub was 1.4 MB whereas the one built by hand was 
only 807 kB. Why is that?


dub compiles and links every file in the source folder 
whether it's used or not. Whereas with dmd or rdmd you only 
compile and link the files you actually use.


I compiled the exact same files. I excluded those I didn't 
need in the dub configuration like so:


excludedSourceFiles: [...]

But dub's executable is bigger.


When you build with dub it should print out (if I remember 
correctly, its been a little while) the command it uses to 
build your code.  Is there any difference between that command 
and your 'by hand' version?


dub says:

Compiling using dmd...
Linking...

I have the exact same setting, I think. I don't build for 
release with either method.


dmd file1.d file2.d file3.d ...

(dub compiles the same files, no release build)


I am sure there is some way to get it to print out exactly what 
it is doing. I've done it before when trying to figure out some 
compilation issues ... unfortunately it was a while ago and the 
machine I am at now doesn't have dub (or D for that matter) 
installed.


Maybe you need to give the the dub -v (--verbose) option.  Type 
'dub help' to check - again I can't do that right here.


Re: vibe.d problem

2014-11-18 Thread CraigDillabaugh via Digitalmars-d-learn
On Tuesday, 18 November 2014 at 17:16:33 UTC, CraigDillabaugh 
wrote:
On Monday, 17 November 2014 at 22:02:13 UTC, låzaro via 
Digitalmars-d-learn wrote:

Error executing command run: dmd failed with exit code 1.


Not sure exactly what your issue is, and am a bit rusty on 
Vibe/dub, but you may have better luck getting answers here:


http://forum.rejectedsoftware.com/groups/rejectedsoftware.vibed/

What if you just type dub

instead of dub run.


Sorry for the noise - I see you got an answer in the 'other' 
version of this thread.


Re: vibe.d problem

2014-11-18 Thread CraigDillabaugh via Digitalmars-d-learn
On Monday, 17 November 2014 at 22:02:13 UTC, låzaro via 
Digitalmars-d-learn wrote:

Hi there folks, let me the fact talk for me


lazaro@leviatan:~$ dub init aplicacion vibe.d
Successfully created an empty project in 
'/home/lazaro/aplicacion'.

lazaro@leviatan:~$ cd aplicacion/
lazaro@leviatan:~/aplicacion$ dub run
Building vibe-d 0.7.20 configuration libevent, build type 
debug.

Running dmd...
../.dub/packages/vibe-d-0.7.20/source/vibe/templ/parsertools.d(12): 
Deprecation: module std.metastrings is deprecated - Please use 
std.string.format, std.conv.to or std.conv.parse instead
../.dub/packages/vibe-d-0.7.20/source/vibe/templ/diet.d(28): 
Deprecation: module std.metastrings is deprecated - Please use 
std.string.format, std.conv.to or std.conv.parse instead
../.dub/packages/vibe-d-0.7.20/source/vibe/core/drivers/libevent2.d(491): 
Deprecation: function core.time.Duration.fracSec is deprecated 
- Please use split instead.
../.dub/packages/vibe-d-0.7.20/source/vibe/core/drivers/libevent2_tcp.d(110): 
Deprecation: function core.time.Duration.fracSec is deprecated 
- Please use split instead.
../.dub/packages/vibe-d-0.7.20/source/vibe/core/drivers/libevent2_tcp.d(269): 
Deprecation: function core.time.Duration.fracSec is deprecated 
- Please use split instead.
../.dub/packages/vibe-d-0.7.20/source/vibe/core/task.d(203): 
Deprecation: alias object.clear is deprecated - Please use 
destroy instead.
../.dub/packages/vibe-d-0.7.20/source/vibe/core/task.d(204): 
Deprecation: alias object.clear is deprecated - Please use 
destroy instead.
../.dub/packages/vibe-d-0.7.20/source/vibe/inet/message.d(186): 
Deprecation: constructor std.datetime.SimpleTimeZone.this is 
deprecated - Please use the overload which takes a Duration.
../.dub/packages/vibe-d-0.7.20/source/vibe/inet/webform.d(53): 
Error: std.string.indexOfAny!(char, char).indexOfAny at 
/usr/include/dmd/phobos/std/string.d(1044) conflicts with 
vibe.utils.string.indexOfAny at 
../.dub/packages/vibe-d-0.7.20/source/vibe/utils/string.d(123)
../.dub/packages/vibe-d-0.7.20/source/vibe/inet/webform.d(63): 
Error: std.string.indexOfAny!(char, char).indexOfAny at 
/usr/include/dmd/phobos/std/string.d(1044) conflicts with 
vibe.utils.string.indexOfAny at 
../.dub/packages/vibe-d-0.7.20/source/vibe/utils/string.d(123)
../.dub/packages/vibe-d-0.7.20/source/vibe/utils/memory.d(124): 
Deprecation: Read-modify-write operations are not allowed for 
shared variables. Use core.atomic.atomicOp!+=(this.m_bytes, 
sz) instead.
../.dub/packages/vibe-d-0.7.20/source/vibe/utils/memory.d(140): 
Deprecation: Read-modify-write operations are not allowed for 
shared variables. Use core.atomic.atomicOp!-=(this.m_bytes, 
*pb) instead.
../.dub/packages/vibe-d-0.7.20/source/vibe/utils/memory.d(143): 
Deprecation: Read-modify-write operations are not allowed for 
shared variables. Use core.atomic.atomicOp!+=(this.m_bytes, 
new_size) instead.
../.dub/packages/vibe-d-0.7.20/source/vibe/utils/memory.d(152): 
Deprecation: Read-modify-write operations are not allowed for 
shared variables. Use core.atomic.atomicOp!-=(this.m_bytes, 
*pb) instead.
../.dub/packages/vibe-d-0.7.20/source/vibe/utils/memory.d(161): 
Warning: calling 
std.exception.enforceEx!(OutOfMemoryError).enforceEx!bool.enforceEx 
without side effects discards return value of type bool, 
prepend a cast(void) if intentional
../.dub/packages/vibe-d-0.7.20/source/vibe/utils/memory.d(466): 
Deprecation: Read-modify-write operations are not allowed for 
shared variables. Use core.atomic.atomicOp!-=(this.m_nfree, 
1) instead.
../.dub/packages/vibe-d-0.7.20/source/vibe/utils/memory.d(471): 
Deprecation: Read-modify-write operations are not allowed for 
shared variables. Use core.atomic.atomicOp!+=(this.m_nalloc, 
1) instead.
../.dub/packages/vibe-d-0.7.20/source/vibe/utils/memory.d(489): 
Deprecation: Read-modify-write operations are not allowed for 
shared variables. Use core.atomic.atomicOp!-=(this.m_nalloc, 
1) instead.
../.dub/packages/vibe-d-0.7.20/source/vibe/utils/memory.d(490): 
Deprecation: Read-modify-write operations are not allowed for 
shared variables. Use core.atomic.atomicOp!+=(this.m_nfree, 
1) instead.
FAIL 
../.dub/packages/vibe-d-0.7.20/.dub/build/libevent-debug-linux.posix-x86-dmd_2066-316CEFCAEB0F07469ED054933004D631/ 
vibe-d staticLibrary

Error executing command run: dmd failed with exit code 1.


Not sure exactly what your issue is, and am a bit rusty on 
Vibe/dub, but you may have better luck getting answers here:


http://forum.rejectedsoftware.com/groups/rejectedsoftware.vibed/

What if you just type dub

instead of dub run.