Re: weekly news?

2020-01-23 Thread Russel Winder via Digitalmars-d-learn
On Thu, 2020-01-23 at 23:47 -0500, James Blachly via Digitalmars-d-
learn wrote:
> On 1/23/20 8:13 PM, Mike Parker wrote:
> > On Thursday, 23 January 2020 at 15:44:10 UTC, Adam D. Ruppe wrote:
> > 
> > > Or delete all that wordpress junk and make something in D :P
> > 
> > I intend to delete all that Wordpress junk and go completely
> > static 
> > eventually.
> 
> Mike, I know we're not a golang shop, but I highly recommend
> switching 
> to HUGO for the blog.

I currently use Nikola for the ACCU Conference website, but the
intention is to switch to HUGO as soon as we can – the ACCU website is
switching from an ancient CMS to HUGO and the conference website
switches with it..

> 
-- 
Russel.
===
Dr Russel Winder  t: +44 20 7585 2200
41 Buckmaster Roadm: +44 7770 465 077
London SW11 1EN, UK   w: www.russel.org.uk



signature.asc
Description: This is a digitally signed message part


Re: weekly news?

2020-01-23 Thread James Blachly via Digitalmars-d-learn

On 1/23/20 8:13 PM, Mike Parker wrote:

On Thursday, 23 January 2020 at 15:44:10 UTC, Adam D. Ruppe wrote:


Or delete all that wordpress junk and make something in D :P


I intend to delete all that Wordpress junk and go completely static 
eventually.


Mike, I know we're not a golang shop, but I highly recommend switching 
to HUGO for the blog.




Re: weekly news?

2020-01-23 Thread James Blachly via Digitalmars-d-learn

On 1/22/20 7:58 PM, Adam D. Ruppe wrote:

On Thursday, 23 January 2020 at 00:52:10 UTC, Mike Parker wrote:
Got any examples? No one has reported this to me before and I haven’t 
encountered a 404 in a while.


Almost all of them!

Hit F12 to open browser tools and notice the network tab:

https://dlang.org/blog/2020/01/08/recent-d-compiler-releases/
https://dlang.org/blog/2020/01/04/dconf-2020-double-decker-edition/

and more. The HTML is displayed, but it has the 404 code so according to 
the http spec you are actually displaying it all as error pages!


HOLY NEGATIVE SEO BATMAN

curl -v shows that it is returning 404 indeed.



Re: weekly news?

2020-01-23 Thread Mike Parker via Digitalmars-d-learn

On Thursday, 23 January 2020 at 15:44:10 UTC, Adam D. Ruppe wrote:


Or delete all that wordpress junk and make something in D :P


I intend to delete all that Wordpress junk and go completely 
static eventually.


Re: Defining an alias to an overloaded function

2020-01-23 Thread olvy via Digitalmars-d-learn

On Tuesday, 21 January 2020 at 04:44:43 UTC, Boris Carvajal wrote:

This seems to work:

...
struct RangeImpl(T) {
alias byKeyRetType = 
typeof(byKey!(int[T])((int[T]).init));

byKeyRetType keyRange;
this(ref int[T] d) {
keyRange = d.byKey;
}
bool empty() {
return keyRange.empty;
}
...
}

RangeImpl!T opSlice() {
return RangeImpl!T(_dict);
}
}

void main()
{
...
if (h[].all!(nn => nn < 5)) {
writeln("less than 5");
}


Thank you very much!  I have completely forgotten about typeof().

I see you also fixed my unnecessary (T) template parameter to 
opSlice, which also caused a compilation error in addition to the 
first mistake.  I think this is because it "shadows" the original 
T parameter from the struct itself, right?





Re: weekly news?

2020-01-23 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Jan 23, 2020 at 03:44:10PM +, Adam D. Ruppe via Digitalmars-d-learn 
wrote:
[...]
> Or delete all that wordpress junk and make something in D :P

+1. ;-)


T

-- 
The fact that anyone still uses AOL shows that even the presence of options 
doesn't stop some people from picking the pessimal one. - Mike Ellis


Re: list of all defined items in a D file

2020-01-23 Thread Anonymouse via Digitalmars-d-learn

On Thursday, 23 January 2020 at 17:10:29 UTC, berni44 wrote:
I'd like to get a list of all items (public, package, private) 
that are defined in a D file. Is there a simple way, to get 
them?


__traits(allMembers, mixin(__MODULE__))?

Replace with a full module name if not the current one. You'll 
only get their string names with that though, not aliases to the 
symbols themselves (as you would have with .tupleof). I imagine 
you could get those with __traits(getMember, moduleName, 
stringName).


list of all defined items in a D file

2020-01-23 Thread berni44 via Digitalmars-d-learn
I'd like to get a list of all items (public, package, private) 
that are defined in a D file. Is there a simple way, to get them?


Re: Blog Post #0099: A Special Request

2020-01-23 Thread Russel Winder via Digitalmars-d-learn
On Thu, 2020-01-23 at 15:12 +, Ron Tarrant via Digitalmars-d-learn
wrote:
> On Thursday, 23 January 2020 at 12:43:24 UTC, Antonio Corbi wrote:
> 
> > Yes, it uses 'sed' to get 'constants.d' from 'constants.d.in' 
> > at configuration time.
> > So you can write your own 'constants.d' with the appropiate 
> > values for UIDIR and DATADIR and delete/comment the the 
> > preBuildCommands in dub.sdl.
> 
> This is beginning to sound like it's beyond the scope of the blog.

Someone does a side tutorial referenced from your blog? With reverse
links obviously.


-- 
Russel.
===
Dr Russel Winder  t: +44 20 7585 2200
41 Buckmaster Roadm: +44 7770 465 077
London SW11 1EN, UK   w: www.russel.org.uk



signature.asc
Description: This is a digitally signed message part


Re: weekly news?

2020-01-23 Thread Adam D. Ruppe via Digitalmars-d-learn

On Thursday, 23 January 2020 at 06:23:14 UTC, Mike Parker wrote:
I'm not getting any 404s in the network tab in Chrome's dev 
tools.


I see it on all browsers, chrome, firefox, even curl -v.

Don't know why... I'd suggest making sure the index.php file 
looks normal (I've seen wordpress malware do lots of weird things 
before with UA sniffing to stealth googlebomb), check the 
.htaccess if you are on apache, maybe just a wrong setting on the 
rewrite rule, and otherwise maybe audit the plugins.


Or delete all that wordpress junk and make something in D :P


Re: Blog Post #0099: A Special Request

2020-01-23 Thread Ron Tarrant via Digitalmars-d-learn

On Thursday, 23 January 2020 at 12:43:24 UTC, Antonio Corbi wrote:

Yes, it uses 'sed' to get 'constants.d' from 'constants.d.in' 
at configuration time.


So you can write your own 'constants.d' with the appropiate 
values for UIDIR and DATADIR and delete/comment the the 
preBuildCommands in dub.sdl.


This is beginning to sound like it's beyond the scope of the blog.


Re: Blog Post #0099: A Special Request

2020-01-23 Thread Ron Tarrant via Digitalmars-d-learn
On Thursday, 23 January 2020 at 14:10:37 UTC, Ferhat Kurtulmuş 
wrote:



Actually I have just tried this with gtkd and working:

button1.bindProperty("sensitive", entry1, "sensitive", 
GBindingFlags.DEFAULT);


That's pretty cool, Ferhat. I'll add this to the todo list.



Re: Blog Post #0099: A Special Request

2020-01-23 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Thursday, 23 January 2020 at 13:41:34 UTC, Ferhat Kurtulmuş 
wrote:

On Thursday, 23 January 2020 at 12:32:57 UTC, Ron Tarrant wrote:

[...]


Yes, but what if you set sensitive properties of a bunch of the 
widgets in the same time. Each time you have to write and call 
setSensitive() for each widgets. If you bind their sensitivity 
property to one single widget, you can only switch one widget's 
property, and others will set automatically.


void doWhenDownloadIsComplete1(){// a lot of code pollution
but1.setSensitive(false);
but2.setSensitive(false);
.
.
entry2.setSensitive(false);
}

...

void doWhenDownloadIsComplete2(){ // nicer
but1.setSensitive(false);
// other widgets' sensitive properties are binded to of 
but1. No extra code needed.

}


Actually I have just tried this with gtkd and working:

button1.bindProperty("sensitive", entry1, "sensitive", 
GBindingFlags.DEFAULT);


Re: Blog Post #0099: A Special Request

2020-01-23 Thread Ferhat Kurtulmuş via Digitalmars-d-learn

On Thursday, 23 January 2020 at 12:32:57 UTC, Ron Tarrant wrote:
On Thursday, 23 January 2020 at 09:27:45 UTC, Ferhat Kurtulmuş 
wrote:


I want this button disabled so that user cannot spawn another 
thread while the first one is on duty.


This is actually the subject of an up-coming post which is 
scheduled to go live on Feb. 25, 2020. It uses setSensitive() 
rather than bindProperty(), but it has the same effect.


Yes, but what if you set sensitive properties of a bunch of the 
widgets in the same time. Each time you have to write and call 
setSensitive() for each widgets. If you bind their sensitivity 
property to one single widget, you can only switch one widget's 
property, and others will set automatically.


void doWhenDownloadIsComplete1(){// a lot of code pollution
but1.setSensitive(false);
but2.setSensitive(false);
.
.
entry2.setSensitive(false);
}

...

void doWhenDownloadIsComplete2(){ // nicer
but1.setSensitive(false);
// other widgets' sensitive properties are binded to of but1. 
No extra code needed.

}


Re: Blog Post #0099: A Special Request

2020-01-23 Thread Antonio Corbi via Digitalmars-d-learn

On Thursday, 23 January 2020 at 12:29:11 UTC, Ron Tarrant wrote:
On Thursday, 23 January 2020 at 08:33:39 UTC, Antonio Corbi 
wrote:



https://gitlab.com/amcorbi/dmaurerrose

I think this is somewhat related to what te OP was asking for.


I'm confused. I was the OP, so I'm not sure who you're 
referring to.


Ooops, sorry, my bad!



Assuming you are on GNU/Linux, a simple 'dub run' is all you 
have to do to make it compile and run.


On Windows, `dub run` yielded the following output:

Performing "debug" build using C:\D\dmd2\windows\bin\dmd.exe 
for x86_64.
gtk-d:gtkd 3.9.0: target for configuration "library" is up to 
date.
gtk-d:gstreamer 3.9.0: target for configuration "library" is up 
to date.
gtk-d:peas 3.9.0: target for configuration "library" is up to 
date.
gtk-d:sv 3.9.0: target for configuration "library" is up to 
date.
gtk-d:vte 3.9.0: target for configuration "library" is up to 
date.

maurerrose-d ~master: building configuration "application"...
Running pre-build commands...
source/constants.d.in was unexpected at this time.
Command failed with exit code 1: if [ source/constants.d.in -nt 
source/constants.d ]; then sed -e 
's#topdir#D:\temp\dmaurerrose-master#' source/constants.d.in > 
source/constants.d; fi



Yes, it uses 'sed' to get 'constants.d' from 'constants.d.in' at 
configuration time.


So you can write your own 'constants.d' with the appropiate 
values for UIDIR and DATADIR and delete/comment the the 
preBuildCommands in dub.sdl.


Hope this helps.
Antonio


Re: Blog Post #0099: A Special Request

2020-01-23 Thread Ron Tarrant via Digitalmars-d-learn
On Thursday, 23 January 2020 at 09:27:45 UTC, Ferhat Kurtulmuş 
wrote:


I want this button disabled so that user cannot spawn another 
thread while the first one is on duty.


This is actually the subject of an up-coming post which is 
scheduled to go live on Feb. 25, 2020. It uses setSensitive() 
rather than bindProperty(), but it has the same effect.


Re: Blog Post #0099: A Special Request

2020-01-23 Thread Ron Tarrant via Digitalmars-d-learn

On Thursday, 23 January 2020 at 08:33:39 UTC, Antonio Corbi wrote:


https://gitlab.com/amcorbi/dmaurerrose

I think this is somewhat related to what te OP was asking for.


I'm confused. I was the OP, so I'm not sure who you're referring 
to.


Assuming you are on GNU/Linux, a simple 'dub run' is all you 
have to do to make it compile and run.


On Windows, `dub run` yielded the following output:

Performing "debug" build using C:\D\dmd2\windows\bin\dmd.exe for 
x86_64.
gtk-d:gtkd 3.9.0: target for configuration "library" is up to 
date.
gtk-d:gstreamer 3.9.0: target for configuration "library" is up 
to date.
gtk-d:peas 3.9.0: target for configuration "library" is up to 
date.

gtk-d:sv 3.9.0: target for configuration "library" is up to date.
gtk-d:vte 3.9.0: target for configuration "library" is up to date.
maurerrose-d ~master: building configuration "application"...
Running pre-build commands...
source/constants.d.in was unexpected at this time.
Command failed with exit code 1: if [ source/constants.d.in -nt 
source/constants.d ]; then sed -e 
's#topdir#D:\temp\dmaurerrose-master#' source/constants.d.in > 
source/constants.d; fi




Re: Blog Post #0099: A Special Request

2020-01-23 Thread Ron Tarrant via Digitalmars-d-learn

On Thursday, 23 January 2020 at 08:33:39 UTC, Antonio Corbi wrote:


https://gitlab.com/amcorbi/dmaurerrose

I think this is somewhat related to what te OP was asking for.


I'm confused. I was the OP, so I'm not sure who you're referring 
to.


Assuming you are on GNU/Linux, a simple 'dub run' is all you 
have to do to make it compile and run.


On Windows, `dub run` yielded the following output:

Performing "debug" build using C:\D\dmd2\windows\bin\dmd.exe for 
x86_64.
gtk-d:gtkd 3.9.0: target for configuration "library" is up to 
date.
gtk-d:gstreamer 3.9.0: target for configuration "library" is up 
to date.
gtk-d:peas 3.9.0: target for configuration "library" is up to 
date.

gtk-d:sv 3.9.0: target for configuration "library" is up to date.
gtk-d:vte 3.9.0: target for configuration "library" is up to date.
maurerrose-d ~master: building configuration "application"...
Running pre-build commands...
source/constants.d.in was unexpected at this time.
Command failed with exit code 1: if [ source/constants.d.in -nt 
source/constants.d ]; then sed -e 
's#topdir#D:\temp\dmaurerrose-master#' source/constants.d.in > 
source/constants.d; fi




Re: Blog Post #0099: A Special Request

2020-01-23 Thread Ferhat Kurtulmuş via Digitalmars-d-learn

On Wednesday, 22 January 2020 at 21:26:40 UTC, Ron Tarrant wrote:
On Wednesday, 22 January 2020 at 09:18:51 UTC, Ferhat Kurtulmuş 
wrote:


Another useful tutorial would be something using bindProperty 
and/or bindPropertyWithClosures. Once I used bindProperty with 
vala, but I think there is no any example to do it with gtkd.


I found a bindProperty() function in gobject/ObjectG.d. Is this 
what you're referring to?


Yes that one. Let me define a use case. We have a button spawning 
a thread doing some time consuming job (we can use 
Thread.sleep(5.seconds)). I want this button disabled so that 
user cannot spawn another thread while the first one is on duty. 
In the same time, we show a spinner while job is running. After 
completion, we want to set button enabled and to make the spinner 
invisible. Instead of setting properties of button and spinner 
separately, we can bind disabled property of the button and 
visible property of the spinner each other. In vala, we can use 
something like (pseudo code):


"this" may refer to a self pointer to an instance of derived 
spinner class:


this.bind_property("customWorkingProperty", somebutton, 
"sensitive", BindingFlags.INVERT_BOOLEAN);


bool customWorkingProperty() will be responsible for showing and 
hiding the spinner.





Re: Blog Post #0099: A Special Request

2020-01-23 Thread Antonio Corbi via Digitalmars-d-learn

On Wednesday, 22 January 2020 at 21:22:57 UTC, Ron Tarrant wrote:
On Tuesday, 21 January 2020 at 22:12:10 UTC, Antonio Corbi 
wrote:

On Tuesday, 21 January 2020 at 22:06:30 UTC, Ron Tarrant wrote:



Do you still have the Maurer Rose example?


I had to look this up. I'd never heard of it before. That being 
said...



Do you think it could fit this kind of example?


When I say "demo" I'm talking about examples of how to do 
various GTK GUI stuff rather than mathematical exercises. 
Trying to do this mathematical/drawing exercise, I'd be 
waaay out of my element. The few simple math/draw examples 
I did in Cairo (posts #0057 to #0064) is about my limit as far 
as math goes.


However, I can point you at this repository of Java examples: 
https://github.com/iabin/Maurer-Rose/tree/master/src


Using the methods outlined in the posts I've listed, you should 
be able to port it over from Java to D. I'm not a 
mathematician, so I wouldn't be of much help.


I wish you the best of luck on this endeavour.


I was referring to this example I made some time ago:

https://gitlab.com/amcorbi/dmaurerrose

I think this is somewhat related to what te OP was asking for.

Assuming you are on GNU/Linux, a simple 'dub run' is all you have 
to do to make it compile and run.



Antonio