Re: Where to go after "Programming in D"

2016-03-02 Thread David DeWitt via Digitalmars-d-learn

On Tuesday, 1 March 2016 at 17:21:16 UTC, David DeWitt wrote:

On Tuesday, 1 March 2016 at 16:50:12 UTC, karabuta wrote:
I am almost done with the "programming in D" book. Where will 
you suggest a go from there. My current focus is on network 
programming, database systems, data manipulation and software 
architectures for database related apps(mostly Linux platforms 
with D).


I am aiming to become a hardcore and better coder(quality 
code) than you :) Please suggest.





Forgot to add:

https://github.com/PhilippeSigaud/D-templates-tutorial




Re: Where to go after "Programming in D"

2016-03-02 Thread David DeWitt via Digitalmars-d-learn

On Tuesday, 1 March 2016 at 16:50:12 UTC, karabuta wrote:
I am almost done with the "programming in D" book. Where will 
you suggest a go from there. My current focus is on network 
programming, database systems, data manipulation and software 
architectures for database related apps(mostly Linux platforms 
with D).


I am aiming to become a hardcore and better coder(quality code) 
than you :) Please suggest.


I'd probably skim thru the Language Reference and Phobos.  After 
that I would practice using Ranges and get a better grasp on the 
functions in std.algorithms.  std.algorithm has some good stuff 
for dealing with data.  Since you want to do Network programming 
I would suggest Vibe.d and read thru the source of it.  Also 
whatever DB you normally use check out the projects for those 
drivers and maybe contribute as some need ppl.  Since you say you 
want to become "hardcore" I would suggest porting some popular 
libraries over to D.  After that maybe look to get involved in 
Phobos and/or the compiler of your choosing.


Re: vibe.d-example illustrating Dynamic Textual Web-Interface

2015-11-30 Thread David DeWitt via Digitalmars-d-learn
On Monday, 30 November 2015 at 20:05:42 UTC, Sebastiaan Koppe 
wrote:



Code can be found here: https://bitbucket.org/skoppe/mpc/src


Looks good.  Have you looked at Redux and Webpack?  I am working 
on a Redux example and we have switched to Webpack and Redux at 
work and it is nice.


Re: vibe.d-example illustrating Dynamic Textual Web-Interface

2015-11-30 Thread David DeWitt via Digitalmars-d-learn
On Monday, 30 November 2015 at 20:38:12 UTC, Sebastiaan Koppe 
wrote:

On Monday, 30 November 2015 at 20:23:48 UTC, David DeWitt wrote:
Have you looked at Redux and Webpack?  I am working on a Redux 
example and we have switched to Webpack and Redux at work and 
it is nice.


I know about both yes. Webpack would probably beat browserify, 
but I haven't gotten the time to migrate myself. Their hot code 
reloading looks good though.


Isn't redux the client side for GraphQL? I followed it a bit 
but it being so fresh, decided to wait.


A GraphQL interface generator for vibe.d would be nice.


Redux is luscious!!!  It is a flux-like implementation but you 
dont have to deal with individual stores as the app's state lives 
in a single object tree. Once you go thru it you'll like it.



https://github.com/rackt/redux

https://github.com/xgrommx/awesome-redux


Re: OT: why do people use python when it is slow?

2015-10-14 Thread David DeWitt via Digitalmars-d-learn

On Wednesday, 14 October 2015 at 14:48:22 UTC, John Colvin wrote:

On Wednesday, 14 October 2015 at 14:32:00 UTC, jmh530 wrote:
On Tuesday, 13 October 2015 at 23:26:14 UTC, Laeeth Isharc 
wrote:

https://www.quora.com/Why-is-Python-so-popular-despite-being-so-slow
Andrei suggested posting more widely.


I was just writing some R code yesterday after playing around 
with D for a couple weeks. I accomplished more in an afternoon 
of R coding than I think I had in like a month's worth of 
playing around with D. The same is true for python.


As someone who uses both D and Python every day, I find that - 
once you are proficient in both - initial productivity is 
higher in Python and then D starts to overtake as a project 
gets larger and/or has stricter requirements. I hope never to 
have to write anything longer than a thousand lines in Python 
ever again.


That's true until you need to connect to other systems.  There 
are countless clients built for other systems thats are used in 
real world applications.  With web development the Python code 
really just becomes glue nowadays and api's.  I understand D is 
faster until you have to build the clients for systems to 
connect.  We have an application that uses Postgres, 
ElasticSearch, Kafka, Redis, etc. This is plenty fast and the 
productivity of Python is more than D as the clients for 
Elasticsearch, Postgres and various other systems are unavailable 
or incomplete.  Sure D is faster but when you have other real 
world systems to connect to and time constraints on projects how 
can D be more productive or faster?  Our python code essentially 
becomes the API and usage of clients to other systems which 
handle a majority of the hardcore processing.  Once D gets 
established with those clients and they are battle tested then I 
will agree.  To me productivity is more than the language itself 
but also building real world applications in a reasonable 
time-frame.  D will get there but is nowhere near where Python is.


Re: OT: why do people use python when it is slow?

2015-10-14 Thread David DeWitt via Digitalmars-d-learn

On Wednesday, 14 October 2015 at 15:31:49 UTC, John Colvin wrote:
On Wednesday, 14 October 2015 at 15:25:22 UTC, David DeWitt 
wrote:
On Wednesday, 14 October 2015 at 14:48:22 UTC, John Colvin 
wrote:

On Wednesday, 14 October 2015 at 14:32:00 UTC, jmh530 wrote:
On Tuesday, 13 October 2015 at 23:26:14 UTC, Laeeth Isharc 
wrote:

https://www.quora.com/Why-is-Python-so-popular-despite-being-so-slow
Andrei suggested posting more widely.


I was just writing some R code yesterday after playing 
around with D for a couple weeks. I accomplished more in an 
afternoon of R coding than I think I had in like a month's 
worth of playing around with D. The same is true for python.


As someone who uses both D and Python every day, I find that 
- once you are proficient in both - initial productivity is 
higher in Python and then D starts to overtake as a project 
gets larger and/or has stricter requirements. I hope never to 
have to write anything longer than a thousand lines in Python 
ever again.


That's true until you need to connect to other systems.  There 
are countless clients built for other systems thats are used 
in real world applications.  With web development the Python 
code really just becomes glue nowadays and api's.  I 
understand D is faster until you have to build the clients for 
systems to connect.  We have an application that uses 
Postgres, ElasticSearch, Kafka, Redis, etc. This is plenty 
fast and the productivity of Python is more than D as the 
clients for Elasticsearch, Postgres and various other systems 
are unavailable or incomplete.  Sure D is faster but when you 
have other real world systems to connect to and time 
constraints on projects how can D be more productive or 
faster?  Our python code essentially becomes the API and usage 
of clients to other systems which handle a majority of the 
hardcore processing.  Once D gets established with those 
clients and they are battle tested then I will agree.  To me 
productivity is more than the language itself but also 
building real world applications in a reasonable time-frame.  
D will get there but is nowhere near where Python is.


Python is inherently quite good for glue and has great library 
support, so if that's the majority of your work then Python is 
a good choice. On the other hand, there's plenty of programming 
out there that isn't like that.


I agree but the quora question ask why it is popular despite 
being slow and this is the reason.  If you are doing tasks that 
are computationally expensive in Python then yes it will be slow 
but Python is popular largely because of their web frameworks and 
support.  Even something like Pandas is good enough for most 
peoples data sets.  But still I think most people use it as glue 
and if they need something done they can pass it off to something 
else to do the "real" work.  If this wasn't the case then Python 
would not be as popular.  You pick the right tool for the right 
job maybe D and maybe Python and this doesn't mean your results 
will be slow.


Re: Dangular - D Rest server + Angular frontend

2015-07-19 Thread David DeWitt via Digitalmars-d-learn
On Sunday, 19 July 2015 at 19:54:31 UTC, Jarl André Hübenthal 
wrote:

Hi

I have created a personal project that aims to learn myself 
more about D/vibe.d and to create a simple and easy to grasp 
example on Mongo - Vibe - Angular.


[...]


Nice. I was thinking about doing one up in React but haven't had 
much time for D the past few weeks.  I quit Angular due to React 
and all the nonsense regarding 2.0.


Re: core.exception.InvalidMemoryOperationError@(0) on File Reading.

2015-06-24 Thread David DeWitt via Digitalmars-d-learn

On Tuesday, 23 June 2015 at 18:49:59 UTC, David DeWitt wrote:

On Monday, 22 June 2015 at 20:30:40 UTC, David DeWitt wrote:

I am getting an core.exception.InvalidMemoryOperationError@(0)

 auto recs = f  // Open for reading
   .byLineCopy();
   .array;  //Here is where is appears 
to be happening.


[...]


I have had a chance to try the new phobos.  Dealing with the 
errors related to:
http://forum.dlang.org/thread/mm1fdo$q5u$1...@digitalmars.com in 
debian.


Gonna mess with it some more when I have a chance.


I pulled down the latest version on Github and everything ran 
fine.


Filtering Associative Array Key-Values the D way

2015-06-24 Thread David DeWitt via Digitalmars-d-learn
I'm trying to understand filtering an Associative Array the D 
way.  I have the code below
(Using while readln cause problem failing on Debian using 
byLineCopy()).  When the byKeyValue().filter evaluates to reduce 
the number of Keys:Values to only the ones in the filtered 
header, what is the best way to transform the Pair back to an AA 
instead of having to run the foreach loop after?  Basically if 
the file has 300 columns and 300 in the full header but only 15 
in the filtered header I want the return of rec to only be the 15 
in an Associative Array.  Thanks :)



string line;
string[string][] records;
while ((line = f.readln()) !is null){
string[string] record;
auto rec = assocArray(zip(h1.fullHeader, 
splitter(line,',')))

.byKeyValue().filter!(a=h1.filteredHeader.canFind(a.key));


foreach(r;rec){
record[r.key] = r.value;
}
records ~= record;
}


Re: core.exception.InvalidMemoryOperationError@(0) on File Reading.

2015-06-23 Thread David DeWitt via Digitalmars-d-learn

On Monday, 22 June 2015 at 20:30:40 UTC, David DeWitt wrote:

I am getting an core.exception.InvalidMemoryOperationError@(0)

 auto recs = f  // Open for reading
   .byLineCopy();
   .array;  //Here is where is appears 
to be happening.


[...]


I have had a chance to try the new phobos.  Dealing with the 
errors related to:
http://forum.dlang.org/thread/mm1fdo$q5u$1...@digitalmars.com in 
debian.


Gonna mess with it some more when I have a chance.


core.exception.InvalidMemoryOperationError@(0) on File Reading.

2015-06-22 Thread David DeWitt via Digitalmars-d-learn

I am getting an core.exception.InvalidMemoryOperationError@(0)

 auto recs = f  // Open for reading
   .byLineCopy();
   .array;  //Here is where is appears to 
be happening.


I have narrowed it down to the .array.  I am wondering if there 
is some common issue I may be experiencing or if there is a 
better solution?


Here is what I am overall trying to achieve.

 auto recs = f  // Open for reading
   .byLineCopy;
   .array();
   .map!(a= 
assocArray(zip(h1.fullHeader, splitter(a,','

   .map!(a=a.byKeyValue()

.filter!(a=h1.filteredHeader.canFind(a.key)));


foreach(item;recs){
   auto item = Json.emptyObject;
   each!((k)= item[k.key] = 
k.value)(item);
   insert(item, dateIndex); 
//ElasticSearch

}

Also any suggestions on the code are greatly appreciated :)