Re: Docs generation example

2020-10-10 Thread Zekereth via Digitalmars-d-learn
On Saturday, 10 October 2020 at 02:07:02 UTC, Виталий Фадеев 
wrote:

Wanted!
Docs generation example.

I have dub project, sources/*.d.
I want html-index with all classes/functions.

Is exists simple, hi-level, one-line command line solution ?


The more official way is: dub build --build=docs
Alternatively to use ddox with: dub build --build=ddoc


Re: Blog Post #76: Nodes and Noodles, Part II

2019-10-06 Thread Zekereth via Digitalmars-d-learn

On Friday, 4 October 2019 at 11:36:52 UTC, Ron Tarrant wrote:
Here's the second instalment of the Nodes-n-noodles series 
wherein noodle drawing on a DrawingArea is now complete. You 
can find it here: 
http://localhost:4000/2019/10/04/0076-cairo-xi-noodles-and-mouse-clicks.html


Here's the correct URL 
https://gtkdcoding.com/2019/10/04/0076-app-01-iii-noodles-and-mouse-clicks.html


Great tutorial(s)! Thanks!


Re: Blog Post #69: TextView and TextBuffer Basics

2019-09-10 Thread Zekereth via Digitalmars-d-learn

On Tuesday, 10 September 2019 at 08:29:59 UTC, Ron Tarrant wrote:
This morning's discussion covers the basic workings and 
relationship between the TextView and TextBuffer widgets. 
Here's the link: 
https://gtkdcoding.com/2019/09/10/0069-textview-and-textbuffer.html


Yes, thank you very much. Your tutorials are a great help! Keep 
it up! Thanks again.


Re: How to learn Phobos,Phbos hard to used for me.

2019-08-30 Thread Zekereth via Digitalmars-d-learn

On Wednesday, 28 August 2019 at 11:34:27 UTC, lili wrote:

Hi:
Masters who can write a book for Phbos, the dlang doc not 
friendly to beginner.


Have you seen this? http://ddili.org/ders/d.en/index.html It 
helped me a lot in understanding ranges. Though there is nothing 
about containers there I don't think.


Re: How to pause terminal in D on Linux?

2016-07-23 Thread Zekereth via Digitalmars-d-learn

On Saturday, 23 July 2016 at 19:08:00 UTC, WhatMeWorry wrote:
What I thought would be trivial is becoming a nightmare. Can 
anybody set me straight.  Thanks in advance.


[...]


Use the getchar() function.

void pause(const string msg = "Press enter/return to continue...")
{
write(msg);
getchar();
}


Re: How can you call a stored function in an AA with proper number of arguments converted to the proper type?

2016-07-12 Thread Zekereth via Digitalmars-d-learn

On Tuesday, 12 July 2016 at 08:34:03 UTC, Kagamin wrote:

Store a wrapper instead of the actual function:
void wrapper(alias F)(string[] args)
{
  (convert args to F arguments) and invoke
}

cmd.func = !someFunc;

string[] args;
cmd.func(args);


Thanks that is clever. Never would have thought of that. Thanks a 
lot!


How can you call a stored function in an AA with proper number of arguments converted to the proper type?

2016-07-11 Thread Zekereth via Digitalmars-d-learn

Here's the basic code I'm playing with:

struct MyCmd
{
Variant func;
// Has other members.
}

MyCmd[string] functions_;

void addCommand(T)(const string name, T func)
{
MyCmd cmd;
cmd.func = Variant(func);

functions_[name] = cmd;
}

void process(string[] args) // args is only available at runtime.
{
const string name = args[0]; // Name of the command

if(name in functions_)
{
MyCmd cmd = functions_[name];
		cmd.func(/*Call with proper number of arguments converted to 
the proper type*/);

}
}

I initially got idea from the D Cookbook Chapter Reflection: 
Creating a command-line function caller. But the code has to 
reside in the same module as the functions it will use.


So I arrived at this code but can't figure out how to call the 
actual stored function.


Thanks!


Re: Get current date and time with std.datetime

2016-07-01 Thread Zekereth via Digitalmars-d-learn

On Thursday, 30 June 2016 at 21:18:22 UTC, Luke Picardo wrote:


Why is it so hard to simply get the current date and time 
formatted properly in a string?


There are no examples of this in your documentation yet this is 
probably one of the most used cases.


To get the current time, use Clock.currTime. It will return the 
current time as a SysTime. To print it, toString is sufficient, 
but if using toISOString, toISOExtString, or toSimpleString, use 
the corresponding fromISOString, fromISOExtString, or 
fromSimpleString to create a SysTime from the string.


auto currentTime = Clock.currTime();
auto timeString = currentTime.toISOExtString();
auto restoredTime = SysTime.fromISOExtString(timeString);


Re: Using -J with dub

2016-04-16 Thread Zekereth via Digitalmars-d-learn

On Saturday, 16 April 2016 at 20:57:10 UTC, Bauss wrote:
Is there a way to achieve using -J through dub, preferable 
through dub.json


I can't seem to find anything through the dub.json docs on how 
to pass regular dmd flags.


For just -J option use stringImportPaths "". For other 
commands use the dflags option.


Re: Why is Linux the only OS in version identifier list that has a lowercase name?

2016-04-11 Thread Zekereth via Digitalmars-d-learn

On Tuesday, 12 April 2016 at 01:32:02 UTC, Brian Schott wrote:

On Monday, 11 April 2016 at 23:01:08 UTC, marcpmichel wrote:

Is it because Linux is not an OS ? :p


I gnu somebody would bring that up.


/sigh so did I.


Re: Why is Linux the only OS in version identifier list that has a lowercase name?

2016-04-10 Thread Zekereth via Digitalmars-d-learn

On Monday, 11 April 2016 at 01:15:27 UTC, Ali Çehreli wrote:

As a workaround, you can set version to Linux yourself:

version (linux) {
version = Linux;
}

void main() {
version (Linux) {
import std.stdio;
writeln("Linux worked!");
}
}


That's interesting that will help. Thanks for that!


Re: Why is Linux the only OS in version identifier list that has a lowercase name?

2016-04-10 Thread Zekereth via Digitalmars-d-learn

On Monday, 11 April 2016 at 00:51:19 UTC, Mike Parker wrote:
It's an artifact of history. When this was first introduced, 
Walter's intent was to match the casing used in gcc 
preprocessor definitions. Since that time, we've standardized 
on capitalization for everything, but 'linux' lives on. I would 
like to see 'Linux' introduced for consistency and to avoid 
errors like yours (a bug lived in Phobos for a long time 
because of this) while maintaining 'linux' for backwards 
compatibility.


Thanks, that makes sense. It would be nice if Linux could be 
introduced. I'll just have to remember from now on. Thanks again!


Why is Linux the only OS in version identifier list that has a lowercase name?

2016-04-10 Thread Zekereth via Digitalmars-d-learn
So I was just testing some code and couldn't figure out why it 
wasn't working. My version block looked like this:


version(Linux)
{
...
}

Looking at the list(unless I'm missing something) Linux is the 
only OS that is lowercase. I'm guessing most people use Posix 
instead and never encounter this problem.


Regard,
Zekereth


Re: Duration at runtime

2016-02-18 Thread Zekereth via Digitalmars-d-learn

On Friday, 19 February 2016 at 04:21:43 UTC, Zekereth wrote:
On Friday, 19 February 2016 at 04:16:23 UTC, Adam D. Ruppe 
wrote:

On Friday, 19 February 2016 at 04:08:02 UTC, Zekereth wrote:
How is seconds able to be read at compile time but unitType 
cannot?


"seconds" is a literal value that the compiler knows about. 
unitType is a variable that might change between its 
declaration and use (it doesn't here, but the compiler doesn't 
check if it actually does, just if it *can*), so the compiler 
doesn't allow it.


Thanks a lot Adam!

So is there a way around this?. I want duration to be 
configurable at runtime.


Never mind I found a better solution to my problem by storing a 
Duration instead of the unitType. Works just fine.


Thanks a lot I appreciate your help!


Re: Duration at runtime

2016-02-18 Thread Zekereth via Digitalmars-d-learn

On Friday, 19 February 2016 at 04:16:23 UTC, Adam D. Ruppe wrote:

On Friday, 19 February 2016 at 04:08:02 UTC, Zekereth wrote:
How is seconds able to be read at compile time but unitType 
cannot?


"seconds" is a literal value that the compiler knows about. 
unitType is a variable that might change between its 
declaration and use (it doesn't here, but the compiler doesn't 
check if it actually does, just if it *can*), so the compiler 
doesn't allow it.


Thanks a lot Adam!

So is there a way around this?. I want duration to be 
configurable at runtime.


Duration at runtime

2016-02-18 Thread Zekereth via Digitalmars-d-learn

I'm confused by the following:

import std.stdio;
import std.datetime;

void main()
{
string unitType = "seconds";
auto seconds = 1;
//	auto myDur = dur!(unitType)(seconds); // Error unitType can't 
be read at compile time.

auto myDur = dur!("seconds")(seconds); // Compiles why?
}

How is seconds able to be read at compile time but unitType 
cannot?


Thanks!


Can you add a remote repository to DUB?

2015-07-17 Thread Zekereth via Digitalmars-d-learn

All I can find is add-local. Thanks!


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

2015-02-26 Thread Zekereth 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!
I can't believe no one has mentioned Dlangui 
https://github.com/buggins/dlangui.