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 work ok.
do u still hack CodinGame? :)


Thanks for the answers. I currently try to make the Codingame 
puzzles available for D by writing a local application which has 
similar puzzles and runs the D source code.


Kind regards
Andre


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 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 will use them.


Conceptually I want to do below:

func2 { ...; (a, b, c, d) = func1(i) }

I tried using a struct but compiler keeps complaining.

Thanks for help in advance.


A struct should work just fine:

https://run.dlang.io/is/aMBGD0

import std.stdio;
struct Results {
int a, b;
int[] aa, ab;
}

Results func1() {
return Results(1, 2, [0, 1, 2, 3], [10, 11, 12]);
}

void main()
{
writeln(func1);
}

What is the compiler complaining about?


Inside func2 I create an input value for func1 and then assign 
func1's 4 outputs to named variable. That's where the problems 
arise. func1 does some math based on the input and generates 4 
outputs.


I can't do (a, b, c,d) = func1(i) directly.
What do I do to assign the output of func1 to the individual 
variables?




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:

https://blog.cleancoder.com/uncle-bob/2019/08/22/WhyClojure.html


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 assign its 4 output values to their 
appropriate final variables that will use them.


Conceptually I want to do below:

func2 { ...; (a, b, c, d) = func1(i) }

I tried using a struct but compiler keeps complaining.

Thanks for help in advance.


A struct should work just fine:

https://run.dlang.io/is/aMBGD0

import std.stdio;
struct Results {
int a, b;
int[] aa, ab;
}

Results func1() {
return Results(1, 2, [0, 1, 2, 3], [10, 11, 12]);
}

void main()
{
writeln(func1);
}

What is the compiler complaining about?


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 will use them.


Conceptually I want to do below:

func2 { ...; (a, b, c, d) = func1(i) }

I tried using a struct but compiler keeps complaining.

Thanks for help in advance.


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 directory ./tests.

Accordingly, my dub.json file is structured as follows:

{
"name": "q1dcfd",
"authors": [
"Tom Reddell", "Viv Bone"
],
	"description" : "Quasi One Dimensional Compressible Flow 
Dynamics",

"copyright"   : "Copyright © 2018, Tom Reddell",
"license" : "MIT",
"targetType"  : "executable",
	"sourceFiles" : ["$CPD/source/cpp_layer.o", 
"$CPD/source/libCoolProp.a"],

"excludedSourceFiles" : ["source/experimental/*"],
"dependencies": {
"mir"   : "~>3.2.0",
"mir-algorithm" : "~>3.4.14",
"lubeck": "~>1.1.2",
"coolprop"  : "*"
},
"buildTypes" : {
"tests" : {
"buildOptions": ["unittests", "debugMode"],
"importPaths" : ["tests/", "source/"],
"sourcePaths" : ["tests/", "source/"],
"excludedSourceFiles" : ["source/experimental/*"]
}
}
}

When I manually assign my "importPaths" and "sourcePaths" 
variables during a "tests" build, I overwrite the values in these 
variables that have been automatically added due to my 
dependencies, causing the build to fail.
Is there a way that I can append "tests" to importPaths and 
sourcePaths, rather than overwriting them completely?


Regards,

Viv



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? :)


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" p.stdout.readln(); that is read as 2nd


its not sent, "b" just read from pipe
pipe closed and null (no data) come to "a"




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" p.stdout.readln(); that is read as 2nd 
enemy1=null
and finally sleep and exit from b.main where pipe is closed and 
"a" read null again (no data)

dist1 = null.to!int => error




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");
p.stdin.writeln("10");
p.stdin.writeln("e2");
p.stdin.writeln("9");
p.stdin.flush();
p.stdout.readln();
}

In application a.d the first "while round" will succeed as 
expected. But in the second "while round" the readln does not 
wait until there is an input but gets an empty string. The 
to!int will therefore throw an exception.


Why does the readln returns an empty string in the second run 
and does not wait on an input?




probably cuz no second "send round" in b.d.
or u mean second half-round "e2,9"?


I mean the coding in the while loop is executed twice.

If I start application A in the console using ```dmd -run a.d``` 
the readln functions are waiting on stdin input in first and 
second execution of the while logic.


But if application A is called from application B then in the 
second execution of the while loop, the readln statements just 
return empty strings.


Do I have to clear some buffers?

Kind regards
Andre


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");
p.stdin.flush();
p.stdout.readln();
}

In application a.d the first "while round" will succeed as 
expected. But in the second "while round" the readln does not 
wait until there is an input but gets an empty string. The 
to!int will therefore throw an exception.


Why does the readln returns an empty string in the second run 
and does not wait on an input?




probably cuz no second "send round" in b.d.
or u mean second half-round "e2,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 that understands what each piece does and not 
being hard for someone new to D. At a minimum, it would help to 
write it


foo.byPair
 .array
 .sort!((a, b) => a.key < b.key)
 .map!(a => a.value);


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:

foo.byPair.array.sort!((a, b) => a[0] < b[0]).map!(a => 
a[1]).writeln;


On Sunday, 25 August 2019 at 21:13:05 UTC, Paul Backus wrote:

You can also use names instead of numeric indices:

foo.byPair.array.sort!((a, b) => a.key < b.key).map!(a => 
a.value);


a11e99z, JN, Paul:  Thank you all for your replies and help.  
As I've mentioned on the list before, I really struggle to 
understand how some of the std.algorithm functions such as 
`map` work when combined with things like `array`, `sort` and 
especially `zip` but really appreciate the support I find here 
on the forum.


Samir


It isn't really hard:
.array() turns the range into an array, so that sort() can work.
sort() takes "callback" function to test the elements while 
sorting and determine the proper position in the array.
map() select the property from each element, putting that 
requested property into an array.




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) ? enemy1 : enemy2);
stdout.flush();
}
}
---


This applications will be called by a second application:

---b.d
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");

p.stdin.flush();
p.stdout.readln();

import core.thread: Thread;
import core.time: seconds;

Thread.sleep(3.seconds);
}
---

I compile a.d using command ```dmd a.d``` and run b.d using 
command ```dmd -run b.d```


In application a.d the first "while round" will succeed as 
expected. But in the second "while round" the readln does not 
wait until there is an input but gets an empty string. The to!int 
will therefore throw an exception.


Why does the readln returns an empty string in the second run and 
does not wait on an input?


Kind regards
André



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: += 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 understood why the intial value of floats, doubles and 
reals was NaN.


Samir


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 violation error. Furthermore, as 
we work with real, I'd expected the result to be NaN...


Is this a bug? I ask, because it would be quite convenient to use it the 
way it works now.


For what it's worth, it's in Bugzilla:
https://issues.dlang.org/show_bug.cgi?id=4463


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?
> > 
> > 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 added—will give you an edge over 99% of current
> > coders.

To quote Knuth:

People who are more than casually interested in computers should
have at least some idea of what the underlying hardware is like.
Otherwise the programs they write will be pretty weird. -- D.
Knuth

Learning assembly language will give you an intrinsic understanding of
what actually happens at the machine level, which will guide your
high-level designs later.

But caveat emptor: you don't want to get stuck in the "rut" of thinking
in assembly language, because it can lead to missing the forest for the
trees sometimes.  So to balance that, 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.  They are
very different from "mainstream" imperative languages, but they really
strip away all the frills and lay bare the essentials of algorithms and
computation.  Even if you end up working mainly with an imperative
language later, the experience of learning a functional language like
Haskell or Lisp will help you think about algorithms in a much clearer
and deeper way. You'll be able to identify patterns where others lose
their way in details, and your code will be much better structured and
maintainable.


> > It's the same with basic computer use. Wanna be a true expert user?
> > Get any version of Linux or one of the BSDs and restrict yourself to
> > using just the terminal for about a month.
[...]

Only a month? :-D  I've been doing exactly this for the last 20 years,
and now I don't even dream of using a GUI anymore.  The Unix command
line is far more powerful and expressive, and I can get so much more
done without wasting time switching my hand between the rodent and the
keyboard.  It forces me to learn command-line utilities that don't
require ridiculous amounts of RAM and 40 seconds just to start up, and
that has accelerated my productivity by orders of magnitude.  On top of
that, command-line programs are scriptable, meaning once I know how to
use it, I don't ever have to use it again because I'd write a script to
do it for me.  No more aneurysm-inducing clicking through endless nested
menus and carpal tunnel syndrome; it's automation FTW!  Kill the rodent,
and long live the keyboard! :-P


T

-- 
Public parking: euphemism for paid parking. -- Flora


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 => 
a[1]).writeln;


On Sunday, 25 August 2019 at 21:13:05 UTC, Paul Backus wrote:

You can also use names instead of numeric indices:

foo.byPair.array.sort!((a, b) => a.key < b.key).map!(a => 
a.value);


a11e99z, JN, Paul:  Thank you all for your replies and help.  As 
I've mentioned on the list before, I really struggle to 
understand how some of the std.algorithm functions such as `map` 
work when combined with things like `array`, `sort` and 
especially `zip` but really appreciate the support I find here on 
the forum.


Samir




+= 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 work with real, I'd expected the result to be 
NaN...


Is this a bug? I ask, because it would be quite convenient to use 
it the way it works now.


An alternative I found, would be to use object.update. But there 
I've to declare the 100 twice which results in code duplication:



a.update(0,()=>100.0L,(ref real v)=>v+100.0L);


Hence, my best solution needs two lines:


if (0 !in a) a[0] = 0;
a[0] += 100;


What's your oppinion on this?


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 at that level—before 
all the layers of abstraction are added—will give you an edge 
over 99% of current coders.


It's the same with basic computer use. Wanna be a true expert 
user? Get any version of Linux or one of the BSDs and restrict 
yourself to using just the terminal for about a month. You'll 
be amazed at how much you'll learn. It'll also give you a great 
foundation for understanding coding.


And your typing skills will go through the roof.



Thanks a lot. I want to have a deep understanding of programming. 
I will look into your advice





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 for.


[...]



Thanks a lot, really appreciate


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 added—will give you an edge 
over 99% of current coders.


It's the same with basic computer use. Wanna be a true expert 
user? Get any version of Linux or one of the BSDs and restrict 
yourself to using just the terminal for about a month. You'll be 
amazed at how much you'll learn. It'll also give you a great 
foundation for understanding coding.


And your typing skills will go through the roof.


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 topic:


http://ddili.org/ders/d.en/strings.html

Also see http://ddili.org/ders/d.en/auto_and_typeof.html for auto 
keyword.




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 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 the string


So thanks




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 implicitly convert expression "UPDATE guirequest 
SET done_request = SYSDATE() WHERE request_id=" ~ 
cast(const(char)[])hash[cast(uint)i] ~ ";" of type char[] to 
string



Notice you use auto x  Am I better of using something like

auto sql_respons ="UPDATE guirequest SET done_request = SYSDATE() 
WHERE request_id=" ~ hash[i] ~ ";";


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: 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 language, through some tasks are very cumbersome 
in tasks they are not designed for.




Most pro programmer I have heard of are all C and C++ Guru. 
Most of the best guys on this D forum falls into that category.


C and C++ have steep learning curves, and tend to be better for 
professionals than amateurs. That does not mean C/C++ usage is 
what defines a pro. Even php, famous for being simple to learn 
but often hated by professionals, can be used professionally.




I really want to know programming to the core not just tied to 
a language or just at the level of drag and drop or use a 
framework or library.


Don't worry, learn to apply one language in practice and you'll 
usually figure out automatically how to apply any language you 
will learn. Well, sometimes when you transition to a new language 
you should learn new ways to do thing, because the new language 
is better suited for those than your old language.


Famous example is that C programmers that transitioned to C++ or 
Java in the 90's were encouraged to start to thinking in object 
oriented manner. They did not strictly have to, as C++ and Java 
can be used for same programming stye as C, and C can do sort-of 
object-oriented programming, but object-oriented designs were 
(and are) so much easier to implement in the newer languages that 
in practice, object design should be used a lot more now than in 
the 70's.


I will appreciate your help in this matter. I am ready to put 
in hard work. I ready know a little of java, actionscrip 3.0, 
kotlin, D but at the surface level but can use them to write 
app.


But I am concern with matter like how can I write a GUI toolkit 
from the ground up.


Basically, GUI libraries call the operating system API that is 
different for different operating systems.




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] = hash1.get!(string);

... do some FIFO Pipe work

sql = "UPDATE guirequest SET done_request = SYSDATE() WHERE 
request_id=" + hash[i] + ";";


Get this error :Error: invalid array operation "UPDATE guirequest 
SET done_request = SYSDATE() WHERE request_id=" + 
hash[cast(uint)i] (possible missing [])


Any ideas?

/a