Re: How to concat UUID into a SQL query string to MariaDB

2019-08-27 Thread Jani Hur via Digitalmars-d-learn
On Tuesday, 27 August 2019 at 08:08:05 UTC, Anders S wrote: Any ideas? + is not a string concatenation. Try ~ instead: auto x = "aa" ~ "bb" ~ "cc";

Re: How to concat UUID into a SQL query string to MariaDB

2019-08-27 Thread Anders S via Digitalmars-d-learn
On Tuesday, 27 August 2019 at 08:30:50 UTC, Jani Hur wrote: On Tuesday, 27 August 2019 at 08:08:05 UTC, Anders S wrote: Any ideas? + is not a string concatenation. Try ~ instead: auto x = "aa" ~ "bb" ~ "cc"; Hi thanks for answer, but didn't help. Got this error instead : Error: cannot

Re: Pro programmer

2019-08-27 Thread Dukc via Digitalmars-d-learn
On Sunday, 25 August 2019 at 21:30:10 UTC, GreatSam4sure wrote: I am wondering as to what is the starting point of being a pro programmer. If I want to be a pro programmer what language must I start with? Any general purpose language will do. Basically everything can be expressed in any

How to concat UUID into a SQL query string to MariaDB

2019-08-27 Thread Anders S via Digitalmars-d-learn
Hi guys, Using MariaDB to communicate between appz via FIFO pipe Now I stumbled on the next problem, how to extract UUID from database into an UPDATE query that is a string ( the sql variable ). Got in a loop: char [16][10] hash; for(i =0; i < count; i++){ auto hash1 = row[0]; hash[i] =

Re: How to concat UUID into a SQL query string to MariaDB

2019-08-27 Thread Anders S via Digitalmars-d-learn
On Tuesday, 27 August 2019 at 08:30:50 UTC, Jani Hur wrote: On Tuesday, 27 August 2019 at 08:08:05 UTC, Anders S wrote: Any ideas? + is not a string concatenation. Try ~ instead: auto x = "aa" ~ "bb" ~ "cc"; Hi again, the auto declaration worked as I expected my catenations should with

Blog Post #65 - TreeStore Basics

2019-08-27 Thread Ron Tarrant via Digitalmars-d-learn
Today we go back to finish off an earlier series on MVC and stores, this time looking at the TreeStore and how to populate a hierarchy of rows. You can find it here: https://gtkdcoding.com/2019/08/27/0065-mvc-x-treestore-basics.html

Re: How to concat UUID into a SQL query string to MariaDB

2019-08-27 Thread Jani Hur via Digitalmars-d-learn
On Tuesday, 27 August 2019 at 08:54:21 UTC, Anders S wrote: Hi again, the auto declaration worked as I expected my catenations should with the string Great to hear that ! Strings are a bit "different" in D. Please help yourself and read the following that IMO is the best introduction to the

Re: Pro programmer

2019-08-27 Thread GreatSam4sure via Digitalmars-d-learn
On Tuesday, 27 August 2019 at 08:09:40 UTC, Dukc wrote: On Sunday, 25 August 2019 at 21:30:10 UTC, GreatSam4sure wrote: [...] Any general purpose language will do. Basically everything can be expressed in any language, through some tasks are very cumbersome in tasks they are not designed

Re: Pro programmer

2019-08-27 Thread GreatSam4sure via Digitalmars-d-learn
On Tuesday, 27 August 2019 at 14:51:07 UTC, Ron Tarrant wrote: On Sunday, 25 August 2019 at 21:30:10 UTC, GreatSam4sure wrote: If I want to be a pro programmer what language must I start with? If it's deep understanding you want, start with assembly language. Knowing how things are done down

+= on associative arrays leads to surprising result

2019-08-27 Thread berni via Digitalmars-d-learn
import std.stdio; void main() { real[int] a; a[0] += 100; writeln(a); } results (independed of the used compiler) in [0:100] I was a little bit surprised, because a[0] += 100 should be the same as a[0] = a[0]+100, which leads to a range violation error. Furthermore, as we

Re: Sort Associative Array by Key

2019-08-27 Thread Samir via Digitalmars-d-learn
On Sunday, 25 August 2019 at 17:01:23 UTC, a11e99z wrote: auto foo = ["VXE":8, "BZP":5, "JLC":2]; foo.byPair.array.sort!"a[0] On Sunday, 25 August 2019 at 19:03:10 UTC, JN wrote: I think normal lambdas are better than these string ones: foo.byPair.array.sort!((a, b) => a[0] < b[0]).map!(a =>

Re: Pro programmer

2019-08-27 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Aug 27, 2019 at 04:01:03PM +, GreatSam4sure via Digitalmars-d-learn wrote: > On Tuesday, 27 August 2019 at 14:51:07 UTC, Ron Tarrant wrote: > > On Sunday, 25 August 2019 at 21:30:10 UTC, GreatSam4sure wrote: > > > If I want to be a pro programmer what language must I start with? > >

Re: stdin/stdout and flush

2019-08-27 Thread a11e99z via Digitalmars-d-learn
On Tuesday, 27 August 2019 at 21:28:05 UTC, a11e99z wrote: On Tuesday, 27 August 2019 at 21:01:58 UTC, Andre Pany wrote: On Tuesday, 27 August 2019 at 20:45:44 UTC, a11e99z wrote: On Tuesday, 27 August 2019 at 20:09:34 UTC, Andre Pany wrote: what result u expecting? then u send from "b"

Re: stdin/stdout and flush

2019-08-27 Thread a11e99z via Digitalmars-d-learn
On Tuesday, 27 August 2019 at 21:01:58 UTC, Andre Pany wrote: On Tuesday, 27 August 2019 at 20:45:44 UTC, a11e99z wrote: On Tuesday, 27 August 2019 at 20:09:34 UTC, Andre Pany wrote: what result u expecting? u send from "b": e1 10 e2 9 "a" read it. 1st loop finished. then u send from "b"

Re: Sort Associative Array by Key

2019-08-27 Thread Machine Code via Digitalmars-d-learn
On Tuesday, 27 August 2019 at 16:25:00 UTC, Samir wrote: On Sunday, 25 August 2019 at 17:01:23 UTC, a11e99z wrote: auto foo = ["VXE":8, "BZP":5, "JLC":2]; foo.byPair.array.sort!"a[0] On Sunday, 25 August 2019 at 19:03:10 UTC, JN wrote: I think normal lambdas are better than these string ones:

stdin/stdout and flush

2019-08-27 Thread Andre Pany via Digitalmars-d-learn
Hi, I have a small application like this: ---a.d import std; void main() { while(true) { string enemy1 = readln.strip; int dist1 = to!int(readln.strip); string enemy2 = readln.strip; int dist2 = to!int(readln.strip); writeln((dist1 < dist2) ?

Re: stdin/stdout and flush

2019-08-27 Thread Andre Pany via Digitalmars-d-learn
On Tuesday, 27 August 2019 at 20:45:44 UTC, a11e99z wrote: On Tuesday, 27 August 2019 at 20:09:34 UTC, Andre Pany wrote: This applications will be called by a second application: import std; void main() { auto p = pipeShell("a", Redirect.all); p.stdin.writeln("e1");

Re: stdin/stdout and flush

2019-08-27 Thread a11e99z via Digitalmars-d-learn
On Tuesday, 27 August 2019 at 21:01:58 UTC, Andre Pany wrote: On Tuesday, 27 August 2019 at 20:45:44 UTC, a11e99z wrote: On Tuesday, 27 August 2019 at 20:09:34 UTC, Andre Pany wrote: "b" should send data in loop too, then "a" will work ok. do u still hack CodinGame? :)

Dub importPath and sourcePath variables

2019-08-27 Thread Max via Digitalmars-d-learn
Hello, I am having a problem working with custom build types in Dub. For my project, when I perform a regular build, all of my source code is contained in ./source or ~/.dub/packages/. However, I want to specify a custom build type (called 'tests') that imports modules from the additional

Re: stdin/stdout and flush

2019-08-27 Thread a11e99z via Digitalmars-d-learn
On Tuesday, 27 August 2019 at 20:09:34 UTC, Andre Pany wrote: This applications will be called by a second application: import std; void main() { auto p = pipeShell("a", Redirect.all); p.stdin.writeln("e1"); p.stdin.writeln("10"); p.stdin.writeln("e2"); p.stdin.writeln("9");

Re: Sort Associative Array by Key

2019-08-27 Thread bachmeier via Digitalmars-d-learn
On Tuesday, 27 August 2019 at 20:14:21 UTC, Machine Code wrote: It isn't really hard: It really is hard. foo.byPair.array.sort!((a, b) => a.key < b.key).map!(a => a.value); is a lot to digest for someone learning the language. There's a big difference between not being hard for someone

Re: Input/Output multiple values from function

2019-08-27 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 28 August 2019 at 04:19:49 UTC, Jabari Zakiya wrote: I have a function (say func1) that takes 1 input value (an integer number) and outputs 4 values (2 integers and 2 arrays of integers). Then inside another function (say func2) I provide the 1 input to func1 and then want to

Re: stdin/stdout and flush

2019-08-27 Thread Andre Pany via Digitalmars-d-learn
On Tuesday, 27 August 2019 at 21:42:55 UTC, a11e99z wrote: On Tuesday, 27 August 2019 at 21:01:58 UTC, Andre Pany wrote: On Tuesday, 27 August 2019 at 20:45:44 UTC, a11e99z wrote: On Tuesday, 27 August 2019 at 20:09:34 UTC, Andre Pany wrote: "b" should send data in loop too, then "a" will

Re: Pro programmer

2019-08-27 Thread Jani Hur via Digitalmars-d-learn
On Tuesday, 27 August 2019 at 16:32:08 UTC, H. S. Teoh wrote: [..] you want to learn also a very high-level language that makes you think on a whole different level: I recommend Haskell or Lisp after you learn assembly language. For Lisp, Clojure (https://clojure.org/) is a strong candidate:

Re: Input/Output multiple values from function

2019-08-27 Thread Jabari Zakiya via Digitalmars-d-learn
On Wednesday, 28 August 2019 at 04:39:23 UTC, Mike Parker wrote: On Wednesday, 28 August 2019 at 04:19:49 UTC, Jabari Zakiya wrote: I have a function (say func1) that takes 1 input value (an integer number) and outputs 4 values (2 integers and 2 arrays of integers). Then inside another

Input/Output multiple values from function

2019-08-27 Thread Jabari Zakiya via Digitalmars-d-learn
I have a function (say func1) that takes 1 input value (an integer number) and outputs 4 values (2 integers and 2 arrays of integers). Then inside another function (say func2) I provide the 1 input to func1 and then want to assign its 4 output values to their appropriate final variables that

Re: += on associative arrays leads to surprising result

2019-08-27 Thread ag0aep6g via Digitalmars-d-learn
On 27.08.19 18:12, berni wrote: import std.stdio; void main() {     real[int] a;     a[0] += 100;     writeln(a); } results (independed of the used compiler) in [0:100] I was a little bit surprised, because a[0] += 100 should be the same as a[0] = a[0]+100, which leads to a range

Re: += on associative arrays leads to surprising result

2019-08-27 Thread berni via Digitalmars-d-learn
On Tuesday, 27 August 2019 at 16:45:53 UTC, Samir wrote: I never understood why the intial value of floats, doubles and reals was NaN. That's for detecting uninitialised variables. If the result of a calculation is NaN, it's likely, that you forgot to initialise the variable.

Re: += on associative arrays leads to surprising result

2019-08-27 Thread Samir via Digitalmars-d-learn
On Tuesday, 27 August 2019 at 16:12:07 UTC, berni wrote: What's your oppinion on this? As someone relatively new to programming in general and to D in particular, this behavior does, on the surface, seem inconsistent. Good to see that a bug exists for this, per ag0aep6g. I never

Re: Do I understand std.experimental.allocator composition correctly?

2019-08-27 Thread Eduard Staniloiu via Digitalmars-d-learn
On Monday, 26 August 2019 at 01:06:55 UTC, James Blachly wrote: The documentation for std.experimental.allocator is a little dense and I wanted to make sure I am understanding composition correctly. [...] Yes, you are correct. Edi

Re: Pro programmer

2019-08-27 Thread Ron Tarrant via Digitalmars-d-learn
On Sunday, 25 August 2019 at 21:30:10 UTC, GreatSam4sure wrote: If I want to be a pro programmer what language must I start with? If it's deep understanding you want, start with assembly language. Knowing how things are done down at that level—before all the layers of abstraction are