Re: Reversing a string

2019-01-11 Thread Mike James via Digitalmars-d-learn

On Friday, 11 January 2019 at 09:41:30 UTC, bauss wrote:

On Friday, 11 January 2019 at 08:25:41 UTC, Seb wrote:
On Friday, 11 January 2019 at 08:05:39 UTC, AndreasDavour 
wrote:

Hi.

I've just started to learn some D, so maybe this question is 
extremely stupid, but please bear with me.


[...]


Use .retro - it is also lazy and won't allocate:

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


What a terrible name.


Check out the origin :-)

https://forum.dlang.org/thread/hl8345$2b1q$1...@digitalmars.com?page=1


-=mike=-


Re: GtkD global font size

2018-01-15 Thread Mike James via Digitalmars-d-dwt

On Monday, 15 January 2018 at 08:21:16 UTC, Jacob Carlborg wrote:

On 2018-01-15 00:55, Sai wrote:
I am writing a small GUI application using GtkD3 Builder and 
Glade. On a HD monitor the default font size is too small. The 
adwaita theme is not great but I can live with it.


Is there any way to globally increase the font size in the 
GtkD?


I tried the settings.ini file, but that did not help with my 
GtkD3 app. On the other hand, it did increase the global font 
size of the Glade tool, just not my application. Is some how 
GtkD different from pure Gtk application?


This is the forum for the DWT library. I suggest you try the 
"learn" forum instead.


Considering the amount of traffic in this forum wouldn't it be 
better to relabel it as a GUI Forum?


Regards,

-=mike=-


Re: Problem building SWTSnippets with D 2.074.x

2017-11-27 Thread Mike James via Digitalmars-d-dwt

On Monday, 27 November 2017 at 19:21:52 UTC, Jacob Carlborg wrote:

On 2017-06-02 16:01, Jacob Carlborg wrote:

This is due to a regression in the compiler [1]. Please use 
2.073.x until this has been fixed.


[1] https://issues.dlang.org/show_bug.cgi?id=17371



The issue has now been fixed. We'll see in which release of the 
compiler it will show up.


Excellent. 2.077.1 I hope :-)

Regards, Mike.


Re: Problem building SWTSnippets with D 2.074.x

2017-11-23 Thread Mike James via Digitalmars-d-dwt

On Thursday, 16 November 2017 at 02:36:34 UTC, JamesD wrote:
On Wednesday, 15 November 2017 at 07:19:17 UTC, Mike Parker 
wrote:

On Tuesday, 14 November 2017 at 11:33:44 UTC, Mike James wrote:



Has there been any progress on this matter? The snippets 
still don't compile with the latest compiler...




https://github.com/dlang/dmd/pull/7315


Until the issue above is resolved, you can compile with dwtlib.
dwtlib is a work around that uses the *.d source files instead 
of the *.di files.


 dwtlib - DUB package for the D Widget Toolkit
 https://code.dlang.org/packages/dwtlib

Also try gdub, a gui to test individual snippets (see screen 
shot);


 GDUB is a DWT GUI front end for DUB, a D language build 
tool.

 https://code.dlang.org/packages/gdub


Hi James,

When I tried this I got...

Build_dwtlib working in  : 
C:\Users\mikej\AppData\Roaming\dub\packages\dwtlib-3.1.1\dwtlib\dwt

Build_dwtlib builiding   : Windows 64-bit
Build_dwtlib command line: rdmd build.d -m64 clean base swt
(in 
C:\Users\mikej\AppData\Roaming\dub\packages\dwtlib-3.1.1\dwtlib\dwt)

Cleaning
Building dwt-base
workdir=>C:\Users\mikej\AppData\Roaming\dub\packages\dwtlib-3.1.1\dwtlib\dwt\base\src
dmd.exe 
@C:\Users\mikej\AppData\Roaming\dub\packages\dwtlib-3.1.1\dwtlib\dwt\rsp
java\nonstandard\RuntimeTraits.d(61): Error: undefined identifier 
TypeInfo_Typedef


object.Exception@build.d(256): compile error

0x0040594A
0x00406E14
0x0041E56F
0x0041E533
0x0041E434
0x0041751F
0x75D78654 in BaseThreadInitThunk
0x77914A47 in RtlGetAppContainerNamedObjectPath
0x77914A17 in RtlGetAppContainerNamedObjectPath

object.Exception@tools\build_dwtlib.d(123): Build_dwtlib ERROR 
spawning cmd.


0x004029D0
0x00409ABF
0x00409A83
0x00409984
0x00406AE3
0x75D78654 in BaseThreadInitThunk
0x77914A47 in RtlGetAppContainerNamedObjectPath
0x77914A17 in RtlGetAppContainerNamedObjectPath
Press any key to continue . . .

Regards, Mike.


Re: DConf 2018 Call for Submissions

2017-11-16 Thread Mike James via Digitalmars-d-announce

On Thursday, 16 November 2017 at 00:45:58 UTC, codephantom wrote:
On Wednesday, 15 November 2017 at 23:53:40 UTC, Ali Çehreli 
wrote:


I would like to see Chuck Allison talk about the experiences of 
students approaching D. I think that would be really worthwhile 
- or even yourself for that matter, given your strong interest 
in this area. Technical stuff is good and helpful, but I like 
to know about peoples experiences too...that's what really 
interests me the most, and should be at the core of any 
language design. So somebody examining D from this perspective 
could be really insightful to those contributing to the 
language.


It's really critical that D remain accessible to newcomers, or 
its' replacement is just around the corner.


Chucks already done a talk like that - it was berry, berry good...

-=mike=-


Re: Problem building SWTSnippets with D 2.074.x

2017-11-14 Thread Mike James via Digitalmars-d-dwt

On Friday, 2 June 2017 at 14:01:35 UTC, Jacob Carlborg wrote:

On 2017-06-02 09:25, Mike James wrote:

Hi,

I get the following errors when trying to build the 
swtsnippets with the

latest SWT...


This is due to a regression in the compiler [1]. Please use 
2.073.x until this has been fixed.


[1] https://issues.dlang.org/show_bug.cgi?id=17371


Hi Jacob,

Has there been any progress on this matter? The snippets still 
don't compile with the latest compiler...


Regards, Mike


Problem building SWTSnippets with D 2.074.x

2017-06-02 Thread Mike James via Digitalmars-d-dwt

Hi,

I get the following errors when trying to build the swtsnippets 
with the latest SWT...


PS C:\d\gui\dwt> rdmd build swtsnippets
(in C:\d\gui\dwt)
Building swtsnippets[Snippet10]
dmd.exe @C:\d\gui\dwt\rsp
C:\d\gui\dwt\imp\org\eclipse\swt\ole\win32\OleClientSite.di(84): 
Error: basic type expected, not class
C:\d\gui\dwt\imp\org\eclipse\swt\ole\win32\OleClientSite.di(84): 
Error: { members } expected for anonymous class
C:\d\gui\dwt\imp\org\eclipse\swt\ole\win32\OleClientSite.di(84): 
Error: found 'class' when expecting ';' following state

ment
C:\d\gui\dwt\imp\org\eclipse\swt\ole\win32\OleClientSite.di(85): 
Error: found '{' when expecting ';' following statement
C:\d\gui\dwt\imp\org\eclipse\swt\ole\win32\OleClientSite.di(86): 
Error: found 'public' instead of statement
C:\d\gui\dwt\imp\org\eclipse\swt\ole\win32\OleClientSite.di(89): 
Error: function declaration without return type. (Note

that constructors are always named 'this')
C:\d\gui\dwt\imp\org\eclipse\swt\ole\win32\OleClientSite.di(89): 
Error: no identifier for declarator frame.addListener(S

WT.Resize, listener)
C:\d\gui\dwt\imp\org\eclipse\swt\ole\win32\OleClientSite.di(90): 
Error: function declaration without return type. (Note

that constructors are always named 'this')
C:\d\gui\dwt\imp\org\eclipse\swt\ole\win32\OleClientSite.di(90): 
Error: no identifier for declarator frame.addListener(S

WT.Move, listener)
C:\d\gui\dwt\imp\org\eclipse\swt\ole\win32\OleClientSite.di(91): 
Error: function declaration without return type. (Note

that constructors are always named 'this')
C:\d\gui\dwt\imp\org\eclipse\swt\ole\win32\OleClientSite.di(91): 
Error: no identifier for declarator addListener(SWT.Dis

pose, listener)
C:\d\gui\dwt\imp\org\eclipse\swt\ole\win32\OleClientSite.di(92): 
Error: function declaration without return type. (Note

that constructors are always named 'this')
C:\d\gui\dwt\imp\org\eclipse\swt\ole\win32\OleClientSite.di(92): 
Error: no identifier for declarator addListener(SWT.Foc

usIn, listener)
C:\d\gui\dwt\imp\org\eclipse\swt\ole\win32\OleClientSite.di(93): 
Error: function declaration without return type. (Note

that constructors are always named 'this')
C:\d\gui\dwt\imp\org\eclipse\swt\ole\win32\OleClientSite.di(93): 
Error: no identifier for declarator addListener(SWT.Foc

usOut, listener)
C:\d\gui\dwt\imp\org\eclipse\swt\ole\win32\OleClientSite.di(94): 
Error: function declaration without return type. (Note

that constructors are always named 'this')
C:\d\gui\dwt\imp\org\eclipse\swt\ole\win32\OleClientSite.di(94): 
Error: no identifier for declarator addListener(SWT.Pai

nt, listener)
C:\d\gui\dwt\imp\org\eclipse\swt\ole\win32\OleClientSite.di(95): 
Error: function declaration without return type. (Note

that constructors are always named 'this')
C:\d\gui\dwt\imp\org\eclipse\swt\ole\win32\OleClientSite.di(95): 
Error: no identifier for declarator addListener(SWT.Tra

verse, listener)
C:\d\gui\dwt\imp\org\eclipse\swt\ole\win32\OleClientSite.di(96): 
Error: function declaration without return type. (Note

that constructors are always named 'this')

object.Exception@build.d(375): compile error

0x00406C4F
0x004084CF
0x004049CC
0x004207E3
0x004207A7
0x004206A8
0x0041828B
0x74378744 in BaseThreadInitThunk
0x7773587D in RtlGetAppContainerNamedObjectPath
0x7773584D in RtlGetAppContainerNamedObjectPath
PS C:\d\gui\dwt> SampleNoiseMeasureSampleNoiseMeasure


Regards, Mike.


Re: DMD now has colorized syntax highlighting in error messages

2017-05-16 Thread Mike James via Digitalmars-d-announce

On Sunday, 14 May 2017 at 14:07:20 UTC, Walter Bright wrote:

https://github.com/dlang/dmd/pull/6777

It turned out to be unexpectedly easy to implement.

The only downside is now we have to rather tediously tweak the 
error message texts so they use backticks.


The next step is Color D...

https://github.com/narke/colorForth

-=mike=-


Re: Card on fire

2016-07-11 Thread Mike James via Digitalmars-d
On Sunday, 10 July 2016 at 02:43:42 UTC, Andrei Alexandrescu 
wrote:
Got a text from Walter - his famous fanless graphics card 
caught fire along with the motherboard. He'll be outta 
commission for a few days. -- Andrei


I hope he wasn't using it on the back of a camel in the desert...

http://forum.dlang.org/post/nl5hqu$1atc$1...@digitalmars.com



Re: DConf Videos

2016-07-01 Thread Mike James via Digitalmars-d

On Monday, 6 June 2016 at 16:22:18 UTC, Gary Willoughby wrote:

On Monday, 6 June 2016 at 10:40:01 UTC, sarn wrote:
What's the best source of DConf videos at the moment?  Are 
there are any edited versions released?


I'd like to share some of my favourite talks.


Also, where are the DConf 2016 videos? I was under the 
impression that they would be released on YouTube?


Yeh - it's taking its time. I'm not expecting Lawrence of Arabia 
quality...


-=mike=-


Re: Always false float comparisons

2016-05-16 Thread Mike James via Digitalmars-d

On Monday, 16 May 2016 at 06:46:59 UTC, Walter Bright wrote:

On 5/15/2016 10:37 PM, Manu via Digitalmars-d wrote:

[...]


Because, as I explained, that results in a 2x or more speed 
degradation (along with the loss of accuracy).




[...]


I used to do numerics work professionally. Most of the troubles 
I had were catastrophic loss of precision. Accumulated roundoff 
errors when doing numerical integration or matrix inversion are 
major problems. 80 bits helps dramatically with that.




A classic example... :-)


http://www.stsci.edu/~lbradley/seminar/butterfly.html



Re: Please mark off-topic discussions with [OT]

2016-05-14 Thread Mike James via Digitalmars-d

On Saturday, 14 May 2016 at 14:41:06 UTC, ZombineDev wrote:

On Saturday, 14 May 2016 at 14:32:03 UTC, Mike James wrote:
On Saturday, 14 May 2016 at 13:07:56 UTC, Andrei Alexandrescu 
wrote:
The thread "Github names & avatars" is not related to the D 
language, and adds much traffic to the forum. Please place 
[OT] in title when posting anything that is not releated to 
the D language.


Thanks,

Andrei


A lot of message forums have an "Off Topic" section for non 
subject related discussion. Why not create such a section?


Regards,
-=mike=-


At first I also thought about that, but since this is a mailing 
list and not a forum, it is not possible to move threads to 
different sections/groups, AFAIK.


Maybe create a "bikeshed" forum so topics can begin and end 
there... :-)


Regards,
-=mike=-



Re: Please mark off-topic discussions with [OT]

2016-05-14 Thread Mike James via Digitalmars-d
On Saturday, 14 May 2016 at 13:07:56 UTC, Andrei Alexandrescu 
wrote:
The thread "Github names & avatars" is not related to the D 
language, and adds much traffic to the forum. Please place [OT] 
in title when posting anything that is not releated to the D 
language.


Thanks,

Andrei


A lot of message forums have an "Off Topic" section for non 
subject related discussion. Why not create such a section?


Regards,
-=mike=-



Re: DWT fails to build with DMD 2.069.1

2015-11-18 Thread Mike James via Digitalmars-d-dwt
On Tuesday, 17 November 2015 at 20:16:48 UTC, Jacob Carlborg 
wrote:

On 2015-11-17 14:57, Mike James wrote:


Thanks.

Libraries and snippets (apart from snippet 288 - std.stream
depreacation) build ok.


Sorry about that. I forgot to update the snippets submodule, 
please try now.


Thanks.

All OK now :-)

Regards,

-=mike=-


Re: DWT fails to build with DMD 2.069.1

2015-11-17 Thread Mike James via Digitalmars-d-dwt

On Monday, 16 November 2015 at 20:52:53 UTC, Jacob Carlborg wrote:

On 2015-11-11 17:17, Mike James wrote:

Hi.

Is there an updated release of DWT for 2.069? There seems to 
be a

deprecation problem...


Should be working now (at least on Windows).


Thanks.

Libraries and snippets (apart from snippet 288 - std.stream 
depreacation) build ok.


Regards,
-=mike=-


Re: 2.069.0 Installation problem with .exe for Windows

2015-11-11 Thread Mike James via Digitalmars-d-announce
On Wednesday, 11 November 2015 at 03:13:18 UTC, Martin Nowak 
wrote:

On Tuesday, 10 November 2015 at 14:17:28 UTC, Mike James wrote:

The x64 sub-directory does not exist on my system.


We found the bug and I build a new installer with the fix.
https://dlang.dawg.eu/downloads/dmd.2.069.0~fix15824/
As soon as someone confirms the fix, we'll make a new point 
release.


Hi Martin,

I can confirm it installs correctly on:

Windows 10 64-bit.
Windows Vista 32-bit.
Windows 7 64-bit.

Thanks.

Regards,

-=mike=-


Re: 2.069.0 Installation problem with .exe for Windows

2015-11-10 Thread Mike James via Digitalmars-d-announce

On Monday, 9 November 2015 at 13:44:59 UTC, Martin Nowak wrote:

On 11/09/2015 09:46 AM, Mike James wrote:


Hi Martin,

I've tried the new install with Windows Vista and Windows 7 
and the problem is the same as before.


Regards,
-=mike=-


Can you try again, I updated the installer and tried to revert 
the other part of the change (though I don't see why that would 
fix the problem). More details would help a lot at this point, 
e.g. what windows are open (also look whether the uninstaller 
hides any window) and what files are left in the install dir 
(C:\D by default) while the installation hangs.


And let's please continue this in Bugzilla. 
https://issues.dlang.org/show_bug.cgi?id=15284


Hi Martin,

I've not got a login for the bug tracking so here is part of the 
log file...


Call: 2674
Jump: 2691
Jump: 2708
Check previous dmd installation
Check dmd already installed
Remove dmd already installed
MessageBox: 33,"DMD v2.068.2 is installed on your system

Press 'OK' to replace by DMD 2.069.0"
Call: 2734
Jump: 2756
Exec: command="C:\D\uninstall.exe /IC False _?=C:\D"
Exec: success ("C:\D\uninstall.exe /IC False _?=C:\D")
Exec: command="C:\D\uninstall.exe /IC False /S"
Exec: success ("C:\D\uninstall.exe /IC False /S")
Uninstall done
DetectVSAndSDK
Call: 2564
Read VisualStudio\*\Setup\VC
detect ucrt
detect KitsRoot*
IfFileExists: file "C:\Program Files\Microsoft 
SDKs\Windows\v7.0A\Lib\x64\kernel32.lib" does not exist, jumping 0
IfFileExists: file "C:\Program Files\Microsoft 
SDKs\Windows\v6.0A\Lib\x64\kernel32.lib" does not exist, jumping 0

detect KitsRoot*
IfFileExists: file "C:\Program Files\Microsoft 
SDKs\Windows\v7.0A\Lib\x64\kernel32.lib" does not exist, jumping 0
IfFileExists: file "C:\Program Files\Microsoft 
SDKs\Windows\v6.0A\Lib\x64\kernel32.lib" does not exist, jumping 0

detect KitsRoot*

with the last 2 lines repeating...

The x64 sub-directory does not exist on my system.

Hope this helps.

Regards,
-=mike=-



Re: 2.069.0 Installation problem with .exe for Windows

2015-11-09 Thread Mike James via Digitalmars-d-announce

On Sunday, 8 November 2015 at 23:33:31 UTC, Martin Nowak wrote:

On 11/04/2015 10:05 AM, Mike James wrote:

Copied here for extra visibility...

Hi.

There seems to be an install problem with the .exe version for 
Windows. The installer removes the old DMD then doesn't 
install the 2.069.0 version. In the task manager it's still 
running at 50% CPU time. It fails on Windows Vista and Windows 
7.


Could some try and verify that this installer fixes the issue. 
I wasn't able to reproduce the issue myself. 
https://dlang.dawg.eu/downloads/dmd.2.069.0~fix15824/


Hi Martin,

I've tried the new install with Windows Vista and Windows 7 and 
the problem is the same as before.


Regards,
-=mike=-


2.069.0 Installation problem with .exe for Windows

2015-11-04 Thread Mike James via Digitalmars-d-announce

Copied here for extra visibility...

Hi.

There seems to be an install problem with the .exe version for
Windows. The installer removes the old DMD then doesn't install
the 2.069.0 version. In the task manager it's still running at
50% CPU time. It fails on Windows Vista and Windows 7.

Regards,
--


Re: Release D 2.069.0

2015-11-04 Thread Mike James via Digitalmars-d-announce

On Wednesday, 4 November 2015 at 01:50:38 UTC, Martin Nowak wrote:

Glad to announce D 2.069.0.

http://dlang.org/download.html 
http://downloads.dlang.org/releases/2.x/2.069.0/


This is the first release with a self-hosted dmd compiler and 
comes with even more rangified phobos functions, 
std.experimental.allocator, and many other improvements.


See the changelog for more details. 
http://dlang.org/changelog/2.069.0.html


-Martin


Hi.

There seems to be an install problem with the .exe version for 
Windows. The installer removes the old DMD then doesn't install 
the 2.069.0 version. In the task manager it's still running at 
50% CPU time. It fails on Windows Vista and Windows 7.


Regards,
--


Re: D ranked as #25 by IEEE spectrum

2015-09-25 Thread Mike James via Digitalmars-d
On Friday, 25 September 2015 at 09:17:46 UTC, Jonathan M Davis 
wrote:

On Friday, 25 September 2015 at 08:45:08 UTC, Kagamin wrote:

[...]


Well, gnome is written entirely in C AFAIK, so it's definitely 
possible to write full-scale desktop applications in C without 
C++. But off the top of my head, I don't know of any C GUI 
toolkits other than GTK. All the rest are C++. And honestly, I 
don't understand why anyone would write large applications in C 
instead of C++, but there are definitely folks that prefer to 
do that.


[...]


IUP is written in C...

Regards, --


Re: Hello World Example with Glade?

2015-09-11 Thread Mike James via Digitalmars-d-learn

On Friday, 11 September 2015 at 06:45:07 UTC, Mike McKee wrote:

On Friday, 11 September 2015 at 06:00:39 UTC, Mike McKee wrote:

[...]


I think the start of this probably looks like the following, 
but I'm not certain:


import gtk;
import gobject.Type;
import std.stdio;
import std.c.process;

int main (string[] args)
{
Main.init(args);
Builder b = new Builder();
b.addFromFile("test1.glade");
Window w = cast(Window)b.getObject("window1");
w.showAll();
Main.run();
return 0;
}


Hi Mike,

There's a Glade example in the demos/builder directory...

Regards, --



...so, this assumed that I had a test1.glade file, and that I 
had this line inside it:




So now I need to figure out how to get GtkD installed on Ubuntu 
Linux 14.04.




Re: Hello World Example with Glade?

2015-09-11 Thread Mike James via Digitalmars-d-learn

On Friday, 11 September 2015 at 07:13:22 UTC, Mike McKee wrote:

On Friday, 11 September 2015 at 06:53:07 UTC, Mike James wrote:

There's a Glade example in the demos/builder directory...


I'm having trouble installing GtkD on Ubuntu Linux 14.04. I did 
the apt steps from here:


http://d-apt.sourceforge.net/

$ sudo su
# wget 
http://master.dl.sourceforge.net/project/d-apt/files/d-apt.list 
-O /etc/apt/sources.list.d/d-apt.list
# apt-get update && apt-get -y --allow-unauthenticated install 
--reinstall d-apt-keyring && apt-get update

# apt-get install libgtkd3-dev libgtkd3-doc

I then run the following and it fails:

# dmd test1.d
test1.d(1): Error: module gtk is in file 'gtk.d' which cannot 
be read

import path[0] = /usr/include/dmd/phobos
import path[1] = /usr/include/dmd/druntime/import



It looks last keep you're missing an import path 
(-Ipath_to_source). Check out 
http://dlang.org/dmd-linux.html#switches


Regards, --


Re: Hello World Example with Glade?

2015-09-11 Thread Mike James via Digitalmars-d-learn

On Friday, 11 September 2015 at 07:29:23 UTC, Mike McKee wrote:

On Friday, 11 September 2015 at 07:20:57 UTC, Mike James wrote:
It looks last keep you're missing an import path 
(-Ipath_to_source). Check out 
http://dlang.org/dmd-linux.html#switches


I tried this just now:

# dmd test1.d -I/usr/include/dmd/gtkd3/gtkc
/usr/include/dmd/gtkd3/gtkc/gtk.d(28): Error: module gtktypes 
is in file 'gtkc/gtktypes.d' which cannot be read

import path[0] = /usr/include/dmd/gtkd3/gtkc
import path[1] = /usr/include/dmd/phobos
import path[2] = /usr/include/dmd/druntime/import

It's saying that it can't read gtkc/gtktypes.d, but there is a 
file in path /usr/include/dmd/gtkd3/gtkc/gtktypes.d



try # dmd test1.d -I/usr/include/dmd/gtkd3

I'm using GtkD on Windows so there is a .../src directory with 
all the source files in.


regards, --


Re: Hello World Example with Glade?

2015-09-11 Thread Mike James via Digitalmars-d-learn

On Friday, 11 September 2015 at 07:47:15 UTC, Mike McKee wrote:

[...]


The undefined references mean you haven't provided a linker path 
to the GtkD libs.

Have you built the GtkD libraries?
Check out https://github.com/gtkd-developers/GtkD



Re: Interesting user mistake

2015-09-04 Thread Mike James via Digitalmars-d
On Friday, 4 September 2015 at 14:05:09 UTC, Jonathan M Davis 
wrote:
On Friday, 4 September 2015 at 13:55:03 UTC, Jonathan M Davis 
wrote:

[...]

[snip]

[...]


Isn't it called Maximal Munch...

https://en.wikipedia.org/wiki/Maximal_munch

Regards, --


Re: Current state of GUI's

2015-09-03 Thread Mike James via Digitalmars-d

On Thursday, 3 September 2015 at 12:19:25 UTC, motaito wrote:

Hi,

I haven't used D before and wanted to take a closer look at it. 
However, there are a few things that keep me from doing so. 
Most notably I am somewhat confused about the state of GUI's. I 
have looked at a couple projects and online resources, but the 
resources I found seam to be quite outdated. Sorry in advance, 
if I have missed some update on the topic. I wanted to ask, if 
there is something in the workings (or already done) to provide 
a standard way to create GUI's. Something supported by D, not 
an independent project. Independent projects tend to scare me 
away, as they almost always get abandoned at some point. I am 
looking for a cross platform (Windows, Linux, BSD) solution.


[...]


Have a look at GtkD and DWT - they are the most complete. I've 
written small apps using both and they work :-)
With GtkD you can use the Glade Builder to simplify design of the 
GUI elements.


Re: 1st Ever Artificial Consciousness to be Written in D Language

2015-09-03 Thread Mike James via Digitalmars-d-announce
On Wednesday, 2 September 2015 at 15:20:13 UTC, Rikki Cattermole 
wrote:

On 03/09/15 2:41 AM, GrandAxe wrote:

[...]


To save time maybe I should send my bank details right now... 
Western Union anyone?


--

[...]


That's quite a large set of features, considering the site 
still says 2014 for copyright I am sure it is worthy of being 
doubted.


I on the other hand hope it is indeed real and will succeed!
Would love to have my own digital personal assistant. Not that 
Cortana / Google Now really works for me.


Humpth maybe my evil bytecode dreams for D may be a good use 
case for it. After all, I'm sure being able to evaluate code 
could be quite useful.




Re: Reading and converting binary file 2 bits at a time

2015-08-29 Thread Mike James via Digitalmars-d-learn

On Saturday, 29 August 2015 at 20:15:53 UTC, Marc Schütz wrote:

Just cast to `Crumbs[]` directly:

import std.bitmanip;
import std.stdio;
import std.file;

struct Crumbs {
mixin(bitfields!(
ubyte, one,   2,
ubyte, two,   2,
ubyte, three, 2,
ubyte, four,  2
));
}

void main(string[] argv)
{
auto raw = read(binaryfile);
auto buffer = cast(Crumbs[]) raw;

foreach (cmb; buffer) {
writefln(Crumb one:   %s, cmb.one);
writefln(Crumb two:   %s, cmb.two);
writefln(Crumb three: %s, cmb.three);
writefln(Crumb four:  %s, cmb.four);
}
}


I like that :-)



Re: Reading and converting binary file 2 bits at a time

2015-08-27 Thread Mike James via Digitalmars-d-learn

On Thursday, 27 August 2015 at 09:00:02 UTC, Andrew Brown wrote:

Hi,

I need to read a binary file, and then process it two bits at a 
time. But I'm a little stuck on the first step. So far I have:


import std.file;
import std.stdio;

void main(){
  auto f = std.file.read(binaryfile);
  auto g = cast(bool[]) f;
  writeln(g);
}

but all the values of g then are just true, could you tell me 
what I'm doing wrong? I've also looked at the bitmanip module, 
I couldn't get it to help, but is that the direction I should 
be looking?


Thanks very much

Andrew


How about...

module main;

import std.bitmanip;
import std.stdio;

struct Crumbs {
@property ref ubyte whole() {
return m_whole;
}

union {
private ubyte m_whole;
mixin(bitfields!(
ubyte, one,   2,
ubyte, two,   2,
ubyte, three, 2,
ubyte, four,  2
));
}
}

void main(string[] argv)
{
ubyte[] buffer = [123, 12, 126, 244, 35];
Crumbs cmb;

foreach (octet; buffer) {
cmb.whole = octet;

writefln(Crumb:   %08b, octet);
writefln(Crumb one:   %s, cmb.one);
writefln(Crumb two:   %s, cmb.two);
writefln(Crumb three: %s, cmb.three);
writefln(Crumb four:  %s, cmb.four);
}
}


Regards, Mike.


Re: DWT fails to build with DMD 2.068.0

2015-08-25 Thread Mike James via Digitalmars-d-dwt

On Monday, 24 August 2015 at 12:55:50 UTC, Jacob Carlborg wrote:

On 2015-08-24 09:10, Mike James wrote:


Bump! :-)


Ah, sorry, completely forgot about this post. But the good news 
is that it's already merged :)


Hi Jacob,

when I try to build the latest I get this...


C:\D\gui\dwtrdmd build base swt
(in C:\D\gui\dwt)
Building dwt-base
workdir=C:\D\gui\dwt\base\src
dmd.exe @C:\D\gui\dwt\rsp
dmd.exe @C:\D\gui\dwt\rsp  C:\D\gui\dwt\olog.txt
Building org.eclipse.swt.win32.win32.x86
workdir=C:\D\gui\dwt\org.eclipse.swt.win32.win32.x86\src
dmd.exe @C:\D\gui\dwt\rsp
org\eclipse\swt\widgets\Table.d-mixin-125(125): Error: cannot 
cast expression WC_LISTVIEW of type const(wchar*) to 
const(wchar[])
org\eclipse\swt\widgets\Tree.d-mixin-139(139): Error: cannot cast 
expression WC_TREEVIEW of type const(wchar*) to const(wchar[])
org\eclipse\swt\widgets\Tree.d-mixin-141(141): Error: cannot cast 
expression WC_HEADER of type const(wchar*) to const(wchar[])
org\eclipse\swt\widgets\CoolBar.d-mixin-69(69): Error: cannot 
cast expression REBARCLASSNAME of type const(wchar*) to 
const(wchar[])
org\eclipse\swt\widgets\DateTime.d-mixin-67(67): Error: cannot 
cast expression DATETIMEPICK_CLASS of type const(wchar*) to 
const(wchar[])
org\eclipse\swt\widgets\DateTime.d-mixin-69(69): Error: cannot 
cast expression MONTHCAL_CLASS of type const(wchar*) to 
const(wchar[])
org\eclipse\swt\widgets\Link.d-mixin-80(80): Error: cannot cast 
expression WC_LINK of type const(wchar*) to const(wchar[])
org\eclipse\swt\widgets\ProgressBar.d(56): Error: cannot cast 
expression PROGRESS_CLASS of type const(wchar*) to const(wchar[])
org\eclipse\swt\widgets\Scale.d-mixin-59(59): Error: cannot cast 
expression TRACKBAR_CLASS of type const(wchar*) to const(wchar[])
org\eclipse\swt\widgets\Spinner.d-mixin-70(70): Error: cannot 
cast expression UPDOWN_CLASS of type const(wchar*) to 
const(wchar[])
org\eclipse\swt\widgets\TabFolder.d-mixin-72(72): Error: cannot 
cast expression WC_TABCONTROL of type const(wchar*) to 
const(wchar[])
org\eclipse\swt\widgets\ToolBar.d-mixin-71(71): Error: cannot 
cast expression TOOLBARCLASSNAME of type const(wchar*) to 
const(wchar[])

object.Exception@build.d(256): compile error

0x00404C46
0x004060B7
0x00403DD2
0x004182DA
0x004182AF
0x004181C3
0x00410AAB
0x771D3744 in BaseThreadInitThunk
0x77C9A064 in RtlSetCurrentTransaction
0x77C9A02F in RtlSetCurrentTransaction


Regards, Mike.


Re: DWT fails to build with DMD 2.068.0

2015-08-24 Thread Mike James via Digitalmars-d-dwt

On Tuesday, 11 August 2015 at 21:03:23 UTC, Jacob Carlborg wrote:

On 2015-08-11 10:23, Mike James wrote:

Is there an updated release for DWT - it fails to build with 
the latest

version of DMD - mainly casting errors...


There's an open pull request for adding support for 2.068.0. 
I'll take a look at it as soon as possible.


Bump! :-)


DWT fails to build with DMD 2.068.0

2015-08-11 Thread Mike James via Digitalmars-d-dwt

Hi,

Is there an updated release for DWT - it fails to build with the 
latest version of DMD - mainly casting errors...


Thanks.

Regards, Mike.


Converting Java code to D

2015-04-20 Thread Mike James via Digitalmars-d-learn

Here is a fragment of Java code from an SWT program...

public enum LineStyle {
NONE(None),
SOLID(Solid),
DASH(Dash),
DOT(Dot),
DASHDOT(Dash Dot),
DASHDOTDOT(Dash Dot Dot);

public final String label;

private LineStyle(String label) {
this.label = label;
}
}

What would be the best ('canonical') way of translating it to D?

Regards,

-=mike=-


Re: Converting Java code to D

2015-04-20 Thread Mike James via Digitalmars-d-learn

On Monday, 20 April 2015 at 17:28:27 UTC, John Colvin wrote:

On Monday, 20 April 2015 at 17:24:30 UTC, bearophile wrote:

John Colvin:


struct LineStyle
{
  enum NONE = None;
  enum SOLID = Solid;
  enum DASH = Dash;
  enum DOT = Dot;
  enum DASHDOT = Dash Dot;
  enum DASHDOTDOT = Dash Dot Dot;

  string label;

  private this(string label)
  {
  this.label = label;
  }
}


The constructor doesn't look very useful.

Perhaps a named enum is safer.

Bye,
bearophile


True, the constructor doesn't really add anything here.

To be honest, the combination of enumeration and runtime 
variables in the Java code seems like a rubbish design, but 
perhaps there's a good reason for it that I'm not aware of.


Maybe they extended enum to get over the lack of structs.

Looking at the spec for java enums it appears that you can return
an enumeration or the associated string using the original code.

Regards, -=mike=-


Re: DMD 2.067.0 Programming Language Specifications

2015-04-09 Thread Mike James via Digitalmars-d-announce

On Monday, 6 April 2015 at 12:04:40 UTC, Jordi Sayol wrote:
D Programming Language Specifications for dmd 2.067.0 in 
several formats, available at:

http://d-apt.sourceforge.net/


dlangspec-2.067.0.chm  --  (Microsoft Compiled HTML Help)

dlangspec-2.067.0.epub  --  (Electronic Publication for 
e-book readers)


dlangspec-2.067.0.mobi  --  (Mobipocket e-book for Kindle)

dlangspec-2.067.0.pdf  --  (Portable Document Format)


That's great.
Just a small observation - why does the kindle not remember the 
page when you close the mobile file then open it up again?


regards, -=mike=-


Re: DWT fails to build with DMD 2.067.0

2015-04-01 Thread Mike James via Digitalmars-d-dwt

On Tuesday, 31 March 2015 at 19:54:27 UTC, Jacob Carlborg wrote:

On 2015-03-31 21:09, Mike James wrote:

Hi,

When I run the build using dub I get the following errors...

java\lang\util.d(396): Deprecation: typedef is removed
java\lang\util.d(405): Deprecation: typedef is removed
java\nonstandard\Locale.d(66): Error: cannot append type 
string to type

wchar[]
java\nonstandard\Locale.d(89): Error: template instance
java.nonstandard.Locale.caltureNameI
error instantiating
object.Exception@build.d(251): compile error

0x00404C92
0x00405EA1
0x00403DD4
0x00417D32
0x00417D07
0x00417C1F
0x0041076F
0x751F7C04 in BaseThreadInitThunk
0x76F5B54F in RtlInitializeExceptionChain
0x76F5B51A in RtlInitializeExceptionChain


Is there an update for DWT using the latest D compiler?


Yes, should work now [1].

[1] 
https://github.com/d-widget-toolkit/dwt/commit/d43ce0cfec48c499cf43f4002e8916158b175847


Thanks.

Libs and snippets build no problem.

regards,
-=mike=-


extending 'import' using 'with'

2015-04-01 Thread Mike James via Digitalmars-d

Just a thought...

How about adding the keyword 'with' to 'import' to save on typing 
:-)


import  org.eclipse.swt.widgets.Canvas,
org.eclipse.swt.widgets.Composite,
org.eclipse.swt.events.DisposeListener,
org.eclipse.swt.events.DisposeEvent,
org.eclipse.swt.events.PaintListener,
org.eclipse.swt.events.PaintEvent;

import with (org.eclipse.swt) {
widgets.Canvas,
widgets.Composite,
events.DisposeListener,
events.DisposeEvent,
events.PaintListener,
events.PaintEvent;
}


Regards,

-=mike=-


Re: DlangUI

2015-03-26 Thread Mike James via Digitalmars-d-announce

On Tuesday, 20 May 2014 at 18:13:36 UTC, Vadim Lopatin wrote:

Hello!

I would like to announce my project, DlangUI library -

SNIP

Hi Vadim,

I have just installed the latest D 2.067.0, ran the git install 
and the build now fails. The errors are as follows:



C:\D\dmd2\gui\dlanguidub run dlangui:example1 --build=release
Building package dlangui:example1 in 
C:\D\dmd2\gui\dlangui\examples\example1\

Target gl3n 1.0.1 is up to date. Use --force to rebuild.
Building dlib ~master configuration library, build type release.
Running dmd...
..\..\..\..\Users\mikej\AppData\Roaming\dub\packages\dlib-master\dlib\image\io\jpeg.d(681): 
Warning: instead of C-style

syntax, use D-style syntax 'ubyte[64] dezigzag'
..\..\..\..\Users\mikej\AppData\Roaming\dub\packages\dlib-master\dlib\filesystem\windows\directory.d(77): 
Error: undefin

ed identifier wcslen
FAIL 
..\..\..\..\Users\mikej\AppData\Roaming\dub\packages\dlib-master\.dub\build\library-release-windows-x86-dmd_2067-17

3DBA1310DF90D85EA81F6AA09FBD95\ dlib staticLibrary
Error executing command run: dmd failed with exit code 1.


C:\D\dmd2\gui\dlangui

any clues?

Thanks.

Regards, Mike.


Re: DlangUI

2015-03-26 Thread Mike James via Digitalmars-d-announce

On Thursday, 26 March 2015 at 11:47:59 UTC, Vadim Lopatin wrote:

On Thursday, 26 March 2015 at 11:41:17 UTC, Mike James wrote:

On Tuesday, 20 May 2014 at 18:13:36 UTC, Vadim Lopatin wrote:

Hello!

I would like to announce my project, DlangUI library -

SNIP

Hi Vadim,

I have just installed the latest D 2.067.0, ran the git 
install and the build now fails. The errors are as follows:



C:\D\dmd2\gui\dlanguidub run dlangui:example1 --build=release
Building package dlangui:example1 in 
C:\D\dmd2\gui\dlangui\examples\example1\

Target gl3n 1.0.1 is up to date. Use --force to rebuild.
Building dlib ~master configuration library, build type 
release.

Running dmd...
..\..\..\..\Users\mikej\AppData\Roaming\dub\packages\dlib-master\dlib\image\io\jpeg.d(681): 
Warning: instead of C-style

syntax, use D-style syntax 'ubyte[64] dezigzag'
..\..\..\..\Users\mikej\AppData\Roaming\dub\packages\dlib-master\dlib\filesystem\windows\directory.d(77): 
Error: undefin

ed identifier wcslen
FAIL 
..\..\..\..\Users\mikej\AppData\Roaming\dub\packages\dlib-master\.dub\build\library-release-windows-x86-dmd_2067-17

3DBA1310DF90D85EA81F6AA09FBD95\ dlib staticLibrary
Error executing command run: dmd failed with exit code 1.


C:\D\dmd2\gui\dlangui

any clues?

Thanks.

Regards, Mike.


Try `dub upgrade --force-remove` followed by `dub build --force`


Thanks Vadim, That did the trick.

regards, -=mike=-


Re: A few notes on choosing between Go and D for a quick project

2015-03-24 Thread Mike James via Digitalmars-d

On Friday, 20 March 2015 at 20:34:36 UTC, Walter Bright wrote:

On 3/20/2015 8:25 AM, weaselcat wrote:
All of the content on rosettacode appears to be licensed under 
GNU FDL, I
believe it would just have to be released under the GNU FDL or 
a similar

copyleft license that fulfills the GNU FDL.


http://www.gnu.org/licenses/fdl-1.2.html

Sigh, looks like we can't use it.


Maybe bearophile can dual-licence them - he probably wrote most 
of them ;-)


-[=mike=-


Re: Would Lcl be better if it was in D?

2015-03-01 Thread Mike James via Digitalmars-d

On Sunday, 1 March 2015 at 20:41:30 UTC, Taylor Hillegeist wrote:
So I was using the Lazarus IDE the other day, and i thought to 
myself, what if i create an application with only a button in 
it. well it was easy enough to do. but behold I saw the 
executable and it was 14 MB, and I said 'well damn.' It seems 
to me that pascal does not do lazy inclusion when it comes to 
components of Lcl apart from pre-compiler directives.


I noticed some includes in d are inside of functions.

void foo() {
 import thingIneed:subfoo;
 subfoo();
}

would this allow people to use a large library like LCL but 
with much smaller executables?


Turn off the debug build - it's then only a few meg...

-Mike-


Re: DlangUI

2015-02-02 Thread Mike James via Digitalmars-d-announce

Hi Vadim,

When I follow the Build and Run Demo App using DUB I get the 
following...


C:\D\dmd2\srcgit clone https://github.com/buggins/dlangui.git
Cloning into 'dlangui'...
remote: Counting objects: 13291, done.
remote: Compressing objects: 100% (186/186), done.
remote: Total 13291 (delta 113), reused 0 (delta 0)
Receiving objects: 100% (13291/13291), 8.78 MiB | 538.00 KiB/s, 
done.

Resolving deltas: 100% (10144/10144), done.

C:\D\dmd2\srccd dlangui

C:\D\dmd2\src\dlanguidub run dlangui:example1 --build=release
Building package dlangui:example1 in 
C:\D\dmd2\src\dlangui\examples\example1\

Fetching derelict-util 1.9.1 (getting selected version)...
Placing derelict-util 1.9.1 to 
C:\Users\mikej\AppData\Roaming\dub\packages\...

Building dlib 0.4.1 configuration library, build type release.
Running dmd...
Building derelict-util 1.9.1 configuration library, build type 
release.

Running dmd...
Building derelict-ft 1.0.1 configuration library, build type 
release.

Running dmd...
Building derelict-sdl2 1.9.1 configuration library, build type 
release.

Running dmd...
Building derelict-gl3 1.0.12 configuration library, build type 
release.

Running dmd...
Building dlangui:dlanguilib 0.4.35+commit.4.gf902ceb 
configuration library, build type release.

Running dmd...
src\dlangui\graphics\resources.d(152): Error: file 
btn_background.xml\x0d cannot be found or not in a path 
specified with -J
src\dlangui\graphics\resources.d(153): Error: data.length cannot 
be evaluated at compile time
src\dlangui\graphics\resources.d(166): Error: template instance 
dlangui.graphics.resources.embedResource!res/btn_background.xml\x0d 
error instantiating src\dlangui\graphics\resources.d(173):


Is the setup missing extra directories?

Regards, -=mike=-


Re: NASA/JPL Rules for writing Critical Software

2015-01-09 Thread Mike James via Digitalmars-d
Walter Bright newshou...@digitalmars.com wrote in message 
news:m8n4c2$2ovq$1...@digitalmars.com...

http://pixelscommander.com/wp-content/uploads/2014/12/P10.pdf


Misra is also a good set of guidelines to follow...

http://www.misra.org.uk/

-=mike=- 



Re: DlangUI project update

2015-01-07 Thread Mike James via Digitalmars-d-announce

On Friday, 26 December 2014 at 12:33:04 UTC, Vadim Lopatin wrote:

Hello!

DlangUI project is alive and under active development.

https://github.com/buggins/dlangui

Recent changes:
- new controls: ScrollWidget, TreeView, ComboBox, ...
- new dialogs: FileOpenDialog, MessageBox
- a lot of bugfixes
- performance improvements in software renderer
- killer app: new example - Tetris game :)

Try Demos:
# download sources
git clone https://github.com/buggins/dlangui.git
cd dlangui
# example 1 - demo for most of widgets
dub run dlangui:example1 --build=release
# tetris - demo for game development
dub run dlangui:tetris --build=release

DlangUI is cross-platform GUI library written in D.
Main features:
- cross platform: uses SDL for linux/macos, Win32 API or SDL 
for Windows
- hardware acceleration: uses OpenGL for drawing when built 
with version USE_OPENGL
- easy to extend: since it's native D library, you can add your 
own widgets and extend functionality

- Unicode and internationalization support
- easy to customize UI - look and feel can be changed using 
themes and styles

- API is a bit similar to Android - two phase layout, styles

Screenshots (a bit outdated): 
http://buggins.github.io/dlangui/screenshots.html


See project page for details.

I would like to get any feedback.
Will be glad to see advises, bug reports, feature requests.

Best regards,
 Vadim


Hi Vadim,

When I follow the building and the running of the demo app using 
DUB I get the following error:


C:\D\dmd2\srcgit clone https://github.com/buggins/dlangui.git
Cloning into 'dlangui'...
remote: Counting objects: 5700, done.
remote: Compressing objects: 100% (56/56), done.
remote: Total 5700 (delta 21), reused 0 (delta 0)
Receiving objects: 100% (5700/5700), 5.33 MiB | 1.51 MiB/s, done.
Resolving deltas: 100% (/), done.

C:\D\dmd2\srccd dlangui

C:\D\dmd2\src\dlanguidub run dlangui:example1 --build=release
Building package dlangui:example1 in 
C:\D\dmd2\src\dlangui\examples\example1\
WARNING: A deprecated branch based version specification is used 
for the dependency derelict-ft. Please use numbered ver
sions instead. Also note that you can still use the 
dub.selections.json file to override a certain dependency to use 
a b

ranch instead.
WARNING: A deprecated branch based version specification is used 
for the dependency derelict-sdl2. Please use numbered v
ersions instead. Also note that you can still use the 
dub.selections.json file to override a certain dependency to use a

 branch instead.
WARNING: A deprecated branch based version specification is used 
for the dependency derelict-fi. Please use numbered ver
sions instead. Also note that you can still use the 
dub.selections.json file to override a certain dependency to use 
a b

ranch instead.
WARNING: A deprecated branch based version specification is used 
for the dependency dlangui:dlanguilib. Please use numbe
red versions instead. Also note that you can still use the 
dub.selections.json file to override a certain dependency to

use a branch instead.
WARNING: A deprecated branch based version specification is used 
for the dependency derelict-gl3. Please use numbered ve
rsions instead. Also note that you can still use the 
dub.selections.json file to override a certain dependency to use a

branch instead.
Target derelict-util 1.9.0 is up to date. Use --force to rebuild.
Target derelict-ft ~master is up to date. Use --force to rebuild.
Target derelict-sdl2 ~master is up to date. Use --force to 
rebuild.

Target derelict-fi ~master is up to date. Use --force to rebuild.
Target dlib ~master is up to date. Use --force to rebuild.
Target derelict-gl3 ~master is up to date. Use --force to rebuild.
Building dlangui:dlanguilib 0.2.2+commit.2.g15226e8 configuration 
library, build type release.

Running dmd...
Building dlangui:example1 0.2.2+commit.2.g15226e8 configuration 
application, build type release.

Compiling using dmd...
src\dlangui\core\files.d(114): Error: module windows is in file 
'win32\windows.d' which cannot be read

import path[0] = examples\example1\src
import path[1] = 
..\..\..\..\Users\mikej\AppData\Roaming\dub\packages\derelict-ft-master\source
import path[2] = 
..\..\..\..\Users\mikej\AppData\Roaming\dub\packages\derelict-util-1.9.0\source
import path[3] = 
..\..\..\..\Users\mikej\AppData\Roaming\dub\packages\derelict-sdl2-master\source
import path[4] = 
..\..\..\..\Users\mikej\AppData\Roaming\dub\packages\derelict-fi-master\source

import path[5] = src
import path[6] = 
..\..\..\..\Users\mikej\AppData\Roaming\dub\packages\dlib-master
import path[7] = 
..\..\..\..\Users\mikej\AppData\Roaming\dub\packages\derelict-gl3-master\source

import path[8] = C:\D\dmd2\windows\bin\..\..\src\phobos
import path[9] = C:\D\dmd2\windows\bin\..\..\src\druntime\import
FAIL 
examples\example1\.dub\build\application-release-windows-x86-dmd_2066-A150B7CA4D2F564C56024EE584D1E13A\ 
example1 ex

ecutable
Error executing command run: dmd failed 

Re: Beginner ?. Why does D suggest to learn java

2014-10-18 Thread Mike James via Digitalmars-d-learn

On Friday, 17 October 2014 at 08:44:00 UTC, Paulo  Pinto wrote:
On Friday, 17 October 2014 at 01:05:37 UTC, ketmar via 
Digitalmars-d-learn wrote:

On Fri, 17 Oct 2014 00:52:14 +
MachineCode via Digitalmars-d-learn 
digitalmars-d-learn@puremagic.com

wrote:

I don't understand. If at least it were C but java? why not D 
itself?
C is *awful* as beginner's language. never ever let people 
start with

C if you don't hate 'em.

as for D... current version of D can be used, but with some
precautions. we now have excellent book by Ali. (it's great, 
really! i
believe that it must be featured on the front dlang.org page!) 
but java

has alot more books and tutorials.

not that D is bad for beginners, it's just has a smaller 
userbase. and
all that things with classes are reference types and structs 
are not,
empty array is not empty array but is empty array and so on 
D may be
confusing a little. it's good to have some CS background to 
understood

that things.

just my cent and cent.



Better, go with FreePascal http://www.freepascal.org/ and 
discover all that those features that many C advocates spread 
as being close to the machine and other C only features, aren't 
exclusive of it.


Alongside support for real modules, OO and genericity.

Then with a head clean of bad C influences, jump into D.


--
Paulo


Don't tell him that - he may discover Freepascal/Lazarus is the 
holy grail of GUI programming and may never try D...  ;-)


-=mike=-


Re: Initialising multidimensional dynamic arrays

2014-10-01 Thread Mike James via Digitalmars-d-learn
On Tuesday, 30 September 2014 at 17:22:32 UTC, Steven 
Schveighoffer wrote:

On 9/30/14 12:40 PM, Mike James wrote:

On Tuesday, 30 September 2014 at 16:07:28 UTC, ketmar via
Digitalmars-d-learn wrote:



 auto a = new int[][](42, 69);


...



You'll notice that it's actually a dynamic array of structs 
containing

dynamic arrays - does this change your initializing?


That is what his code does.

-Steve


Hi Steve,

It's true that his code initialises an array of arrays - but my 
array is an array of structs containing a dynamic array.


Regards, -=mike=-


Re: Initialising multidimensional dynamic arrays

2014-10-01 Thread Mike James via Digitalmars-d-learn

On Tuesday, 30 September 2014 at 15:57:58 UTC, Mike James wrote:

Hi,

How do I initialise a dynamic array of dynamic arrays?

struct MyData {
  SysTime stamp;
  short[] data;

  this(size_t size) {
data = new short[size];
  }
}

MyDataArray mda;

how to initialise mda?

mda = new MyDataArray ?

Thanks.

Regards, -=mike=-


I think I've found a way...

struct MyData {
  SysTime stamp;
  short[] data;

  this(size_t size) {
data = new short[size];
  }
}

MyDataArray[] mda; --- sorry, missing the []s in the original 
question...


so in the constructor...

this(size_t x, size_t y) {
  mda = new MyDataArray[](x);
foreach(n, _; mda) mda[n].data.length = y;
}

Is there a simpler way?

Regards, -=mike=-


Re: Initialising multidimensional dynamic arrays

2014-10-01 Thread Mike James via Digitalmars-d-learn
On Wednesday, 1 October 2014 at 08:08:06 UTC, ketmar via 
Digitalmars-d-learn wrote:

On Wed, 01 Oct 2014 07:45:48 +
Mike James via Digitalmars-d-learn 
digitalmars-d-learn@puremagic.com

wrote:


so in the constructor...

this(size_t x, size_t y) {
   mda = new MyDataArray[](x);
 foreach(n, _; mda) mda[n].data.length = y;
}

Is there a simpler way?
sorry, but no. btw, if MyDataArray is struct, you should do 
this:


  foreach (ref m; mda) m.data.length = y;

or even this:

  foreach (ref m; mda = new MyDataArray[](x)) m.data.length = x;


the thing is that without 'ref' you operates on the local copy, 
not on

the real array element.


Thanks ketmar, that did the trick.

Regards, -=mike=-


D Language Specification corrupted.

2014-09-30 Thread Mike James via Digitalmars-d

Hi,

The PDF of the D Language Specification appears to be corrupted - 
it only contains the front index.


Regards, -=mike=-


Initialising multidimensional dynamic arrays

2014-09-30 Thread Mike James via Digitalmars-d-learn

Hi,

How do I initialise a dynamic array of dynamic arrays?

struct MyData {
  SysTime stamp;
  short[] data;

  this(size_t size) {
data = new short[size];
  }
}

MyDataArray mda;

how to initialise mda?

mda = new MyDataArray ?

Thanks.

Regards, -=mike=-


Re: Initialising multidimensional dynamic arrays

2014-09-30 Thread Mike James via Digitalmars-d-learn
On Tuesday, 30 September 2014 at 16:07:28 UTC, ketmar via 
Digitalmars-d-learn wrote:

On Tue, 30 Sep 2014 15:57:57 +
Mike James via Digitalmars-d-learn 
digitalmars-d-learn@puremagic.com

wrote:


How do I initialise a dynamic array of dynamic arrays?

do you mean something like this: `int[][] a`? if yes, do this:

  auto a = new int[][](42, 69);

and you'll get `int[42][69] a`.

heh, people again confused by `new Type[amount]` syntax. that is
concrete sign that this syntax will live forever.


Thanks ketmar,

You'll notice that it's actually a dynamic array of structs 
containing dynamic arrays - does this change your initializing?


Regards, -=mike=-


Re: What are the worst parts of D?

2014-09-26 Thread Mike James via Digitalmars-d
H. S. Teoh via Digitalmars-d digitalmars-d@puremagic.com wrote in 
message news:mailman.1690.1411686833.5783.digitalmar...@puremagic.com...
On Thu, Sep 25, 2014 at 10:56:55PM +, Sean Kelly via Digitalmars-d 
wrote:

..


Nah, they should be behead() and amputate().




Then the language would have to be called jihaDi... 



Re: Mono-D v2.4.9 - Parser fixes

2014-09-25 Thread Mike James via Digitalmars-d-announce
Alexander Bothe i...@alexanderbothe.com wrote in message 
news:clmyaoqgxizsicodj...@forum.dlang.org...

Hi everyone,

just wanted to announce a further small version bump of Mono-D. And yeah, 
despite my 2 week-break, development still continues!




Cheers,
Alex


Great. Any news of an integrated debugger... :-)

-=mike=- 



Re: dgui - Button continually repainting

2014-09-15 Thread Mike James via Digitalmars-d-learn

Hi Andre,

I've found a solution to the repainting problem. If you tick the 
Disable visual themes in the compatibility tab of the program 
properties (associated with the program icon) the button is only 
repainted when the mouse cursor enters and exits the button area.


Regards, -=mike=-

On Wednesday, 10 September 2014 at 19:46:06 UTC, andre wrote:

Hi,
Just noticed there is an event drawItem whichs is called on 
WM_DRAWITEM. Class core.controls.ownerdrawcontrol.d is very 
interesting.

This event seems more suitable.

Kind regards
André


On Wednesday, 10 September 2014 at 07:19:53 UTC, Mike James 
wrote:

//
Please file this issue also on the dgui

bibucket home page.

Kind regards
Andre


//

Done.

Regards, -=mike=-




Re: dgui - Button continually repainting

2014-09-10 Thread Mike James via Digitalmars-d-learn

//
Please file this issue also on the dgui

bibucket home page.

Kind regards
Andre


//

Done.

Regards, -=mike=-


dgui - Button continually repainting

2014-09-09 Thread Mike James via Digitalmars-d-learn

Hi.

I've created a graphic button as per this example on the dgui 
website:


import dgui.all;

class MyForm: Form
{
this()
{
text = An Exception was thrown...;
size = Size(130, 100);

// Or use `Bitmap.fromFile`:
auto img = new Bitmap(90, 15, SystemColors.yellow);
auto pen = SystemPens.blackPen;

with(new Button())
{
bounds = Rect(10, 10, 100, 25);
parent = this;
paint.attach((s, e)
{
e.canvas.drawImage(img, 5, 5);
e.canvas.drawLine(pen, 5, 10, 95, 10);
e.canvas.drawLine(pen, 10, 5, 10, 20);
});
}
}
}

int main()
{
return Application.run(new MyForm());
}

and added a writeln(paint) in the paint.attach to show when the 
button is repainting. When the form with the button is visible 
the button is being continually repainted. Is this a 'feature' of 
dgui or is there a flag to set to only re-paint when the button 
is invalidated?


Regards, -=mike=-.


DMD Compiler - lexer

2014-08-29 Thread Mike James via Digitalmars-d-learn

Hi,

Looking at the DMD Source Guide it says The lexer transforms the 
file into an array of tokens.


Why is this step taken instead of, say, just calling a function 
that returns the next token (or however many required for the 
look-ahead)?


Regards,
  -=mike=-


Re: Command Line Application in D

2014-08-05 Thread Mike James via Digitalmars-d-learn

On Monday, 4 August 2014 at 22:03:24 UTC, TJB wrote:
On Monday, 4 August 2014 at 21:58:09 UTC, maarten van damme via 
Digitalmars-d-learn wrote:

I am a little bit confused as to what you want.
There is a command line example at dlang.org, and there exists 
a program

(rdmd) that compiles several D files and runs them.
http://dlang.org/rdmd.html


Sorry. I wasn't very clear. Say I want to find all of the files 
that have a certain extension within a directory and process 
them somehow at the command line. How could I do that?


Have a look at the function dirEntries in std.file.

regards,

-mike-


Re: Case for std.experimental

2014-07-30 Thread Mike James via Digitalmars-d
Andrei Alexandrescu seewebsiteforem...@erdani.org wrote in message 
news:lr8r7a$j7v$1...@digitalmars.com...

On 7/29/14, 12:01 PM, Sean Kelly wrote:

Frankly, if Dub is bundled with D, I don't see any reason for
std.experimental to exist.  Those two ideas just seemed to
develop in parallel.


The way I see it:

* dub: a loose federation of libraries with no implied promise.

* std.experimental: 99% sure to make it in std, use at your risk but 
there's a high likelihood you'll just remove .experimental next release, 
fix whatever doesn't compile, and you're good to go.



Andrei


+1

-=mike=- 



Re: Offtopic: AMA (Was: Interview at Lang.NEXT)

2014-06-07 Thread Mike James via Digitalmars-d-announce

On Saturday, 7 June 2014 at 04:21:15 UTC, Craig Dillabaugh wrote:

On Friday, 6 June 2014 at 19:27:35 UTC, Ary Borenszweig wrote:

On 6/4/14, 3:19 AM, Andrei Alexandrescu wrote:

http://www.reddit.com/r/programming/comments/27911b/conversation_with_andrei_alexandrescu_all_things/


Andrei


This is offtopic, but why are people obsessed with writing 
English acronyms?


I always have to lookup the meaning and then I'm polluting my 
head with acronyms.


Is there any difference in time/convenience between writing 
Interviewee here. Ask me anything Between Interviewee. AMA?


:-(


Its all the fault of people texting on their cell phones and 
the like! Too much work to write proper English words.  Amirite?


You should see it in the rail industry - it's all TLAs.

-=mike=-


Re: DlangUI

2014-06-05 Thread Mike James via Digitalmars-d-announce
Vadim Lopatin coolreader@gmail.com wrote in message 
news:fylchhowgmwmqhkew...@forum.dlang.org...

Hello!

I would like to announce my project, DlangUI library - cross-platform GUI 
for D.

https://github.com/buggins/dlangui
License: Boost License 1.0

Native library written in D (not a wrapper to other GUI library) - easy to 
extend.
As a backend, uses SDL2 on any platform, Win32 API on Windows, XCB on 
Linux. Other backends can be added easy.

Tested on Windows and Linux.
Supports hardware acceleration - drawing using OpenGL when built with 
version=USE_OPENGL.

Unicode support.
Internationalization support.
Uses Win32 API fonts on Windows, and FreeType on other platforms.
Same look and feel can be achieved on all platforms.
Flexible look and feel - themes and styles.
API is a bit similar to Android UI.
Flexible layout, support of different screen DPI, scaling.
Uses two phase layout like in Android.
Supports drawable resources in .png and .jpeg, nine-patch pngs and state 
drawables like in Android.

Single threaded. Use other threads for performing slow tasks.
Mouse oriented.

Actually, it's a port (with major redesign) of my library used for 
cross-platform version of my application CoolReader from C++.



State of project: alpha. But, already can be used for simple 2D games and 
simple GUI apps.

I'm keeping in mind a goal to write D language IDE based on dlangui. :)
Adding support of 3D graphics is planned.


Currently implemented widgets:

TextWidget - simple static text (TODO: implement multiline formatting)
ImageWidget - static image
Button - simple button with text label
ImageButton - image only button
TextImageButton - button with icon and label
CheckBox - check button with label
RadioButton - radio button with label
EditLine - single line edit
EditBox - multiline editor
VSpacer - vertical spacer - just an empty widget with layoutHeight == 
FILL_PARENT, to fill vertical space in layouts
HSpacer - horizontal spacer - just an empty widget with layoutWidth == 
FILL_PARENT, to fill horizontal space in layouts

ScrollBar - scroll bar
TabControl - tabs widget, allows to select one of tabs
TabHost - container for pages controlled by TabControl
TabWidget - combination of TabControl and TabHost

Layouts - Similar to layouts in Android

LinearLayout - layout children horizontally or vertically depending on 
orientation

VerticalLayout - just a LinearLayout with vertical orientation
HorizontalLayout - just a LinearLayout with vertical orientation
FrameLayout - all children occupy the same place; usually onle one of them 
is visible

TableLayout - children are aligned into rows and columns of table

List Views - similar to lists in Android UI API.
ListWidget - layout dynamic items horizontally or vertically (one in 
row/column) with automatic scrollbar; can reuse widgets for similar items

ListAdapter - interface to provide data and widgets for ListWidget
WidgetListAdapter - simple implementation of ListAdapter interface - just 
a list of widgets (one per list item) to show



Sample project, example1 contains demo code for most of dlangui API.

Try it using DUB:

git clone https://github.com/buggins/dlangui.git
cd dlangui
dub run dlangui:example1

Fonts note: on Linux, several .TTFs are loaded from hardcoded paths 
(suitable for Ubuntu).

TODO: add fontconfig support to access all available system fonts.

Helloworld:

// main.d
import dlangui.all;
mixin DLANGUI_ENTRY_POINT;

/// entry point for dlangui based application
extern (C) int UIAppMain(string[] args) {
// resource directory search paths
string[] resourceDirs = [
appendPath(exePath, ../res/),   // for Visual D and DUB builds
appendPath(exePath, ../../res/) // for Mono-D builds
];

// setup resource directories - will use only existing directories
Platform.instance.resourceDirs = resourceDirs;
// select translation file - for english language
Platform.instance.uiLanguage = en;
// load theme from file theme_default.xml
Platform.instance.uiTheme = theme_default;

// create window
Window window = Platform.instance.createWindow(My Window, null);
// create some widget to show in window
window.mainWidget = (new Button()).text(Hello 
worldd).textColor(0xFF); // red text

// show window
window.show();
// run message loop
return Platform.instance.enterMessageLoop();
}

DDOC generated documentation can be found there: 
https://github.com/buggins/dlangui/tree/master/docs

For more info see readme and example1 code.

I would be glad to see any feedback.
Can this project be useful for someone? What features/widgets are must 
have for you?



Best regards,
 Vadim  coolreader@gmail.com



Hi Vadim,

I am evaluating GUIs for a project I have in mind and the DLangUI looks 
interesting...


First problem: you need to add gl3n to the git clone list for developing 
under Visual-D.


I am having problems running (debugging) the example1 program. When loading 

Re: DlangUI

2014-06-05 Thread Mike James via Digitalmars-d-announce

On Thursday, 5 June 2014 at 15:15:48 UTC, Casper Færgemand wrote:

On Thursday, 5 June 2014 at 14:22:46 UTC, Mike James wrote:
I am having problems running (debugging) the example1 program. 
When loading the resources it gets to tab_up_background.9.png 
(line 579 in file resources.d) and then fails with an 
exception:


Unhandled exception at 0x0044f932 in example1.exe: 
0xC005: Access violation reading location 0x.


Do you have any clues as to what the problem could be?


I didn't compile this, so take it with a grain of salt.

Access violation reading 0x is a null pointer 
dereference. Looking at the source:


_drawbuf = loadImage(_filename);
if (_filename.endsWith(.9.png))
_drawbuf.detectNinePatch();

I'm making a wild guess that loadImage returns a null if it 
can't find the file. Dereferencing thus throws. You probably 
lack the image or it's in the wrong place.


Hi Casper,

I checked the sub-directory the loading refers to and all the 
pngs seems to be there.


Regards,
-=mike=-


Re: Adam D. Ruppe's D Cookbook now available!

2014-05-30 Thread Mike James via Digitalmars-d-announce
Walter Bright newshou...@digitalmars.com wrote in message 
news:lm5924$7r8$1...@digitalmars.com...

http://www.packtpub.com/discover-advantages-of-programming-in-d-cookbook/book

http://www.amazon.com/D-Cookbook-Adam-D-Ruppe/dp/1783287217

http://www.reddit.com/r/programming/comments/26pn00/d_cookbook_officially_published_consists_of_d/

After watching Adam's most excellent presentation at Dconf, I'm sure the 
book will be great! My copy gets here on Friday.


Just got a copy - now I need the time to read it... :-)

-=mike=- 



Re: My D book is now officially coming soon

2014-05-28 Thread Mike James via Digitalmars-d-announce


On Tuesday, 27 May 2014 at 14:20:49 UTC, Adam D. Ruppe wrote:

On Tuesday, 27 May 2014 at 13:27:56 UTC, Szymon Gatner wrote:

Will epub version be available too?


Yeah, I think it is already on the packt website.


I'm looking at getting the ebook version - does that version 
include the errata described above?


-mike-


Re: My D book is now officially coming soon

2014-05-28 Thread Mike James via Digitalmars-d-announce

On Wednesday, 28 May 2014 at 09:06:12 UTC, Alix Pexton wrote:

On 28/05/2014 9:00 AM, Mike James wrote:


On Tuesday, 27 May 2014 at 14:20:49 UTC, Adam D. Ruppe wrote:

On Tuesday, 27 May 2014 at 13:27:56 UTC, Szymon Gatner wrote:

Will epub version be available too?


Yeah, I think it is already on the packt website.


I'm looking at getting the ebook version - does that version 
include the

errata described above?

-mike-
 I've not checked them side-by-side the whole way through but 
the ePub does have the same triple colons as the PDF.


the ePub uses colour instead of font weight for the keywords in 
the text and the notes and tips are styled differently, but as 
far as I've seen so far the content is the same.


A...


Thanks. As 'early adopters' do we get a chance to upgrade :-)

-mike-


Re: DFL can be used by D2.065

2014-03-28 Thread Mike James

On Wednesday, 26 March 2014 at 06:35:56 UTC, FrankLike wrote:

If you are programming on  win32,now,DFL can be used by D2.065.
Please git clone http://github.com/FrankLike/dfl
Open the folder w32 -dflexe  double click the 'makedflexe.bat'
file,after some seconds ,press the 'Enter key' ,after some
seconds,dfl.lib,dfl.exe are all in you  d install folders('lib'
and 'bin')  ,that's all ok.

Thanks Christopher E. Miller.



I've had a look at DFL and it looks quite good but, looking thru 
the API, I can't see anywhere to draw a filled ellipse - Am I 
missing something?


Regards,

-=mike=-


Re: DFL can be used by D2.065

2014-03-28 Thread Mike James
 FrankLike 1150015...@qq.com wrote in message 
news:btajmssaimcexmnvg...@forum.dlang.org...





I've had a look at DFL and it looks quite good but, looking thru the API, 
I can't see anywhere to draw a filled ellipse - Am I missing something?


Regards,

-=mike=-

https://github.com/FrankLIKE/dfl-examples-d2.git

paint.d will help you.

Seiji Fujita,thank you.


Hi,

I had a look at paint.d in the examples - this example deals with drawing an 
icon. I also looked at draw.d - this deals with drawing to the canvas - the 
only filled shapes are the rectangular ones (fillRectangle) - there is no 
equivalent fillEllipse.


Checking the drawing.d file shows no filled ellipse drawing functions. The 
ellipse functions are explicitely drawn without filling.


It might need a lib addition :-)

Regards,
-=mike=- 



DGUI: Using scroll bars

2014-03-25 Thread Mike James
I'm using DGUI (the one on bitbucket) and I can't work out how to 
use the scrollbars. I've got them enabled but I can't work out 
from the library files how to set the scale and read the 
position. Also is there a way of turning off the vertical 
scrollbar - the 'enable' turns them both on.


Any help would be appreciated...

regards,

-=mike=-


Re: Should we deprecate comma?

2014-03-23 Thread Mike James
On Sunday, 23 March 2014 at 20:56:45 UTC, Andrei Alexandrescu 
wrote:

Discuss: https://github.com/D-Programming-Language/dmd/pull/3399

Andrei


Yep. In the interests of clarity, kill the comma...


Re: My D book is now officially coming soon

2014-03-07 Thread Mike James
Iain Buclaw ibuc...@gdcproject.org wrote in message 
news:mailman.10.1394132086.25740.digitalmars-d-annou...@puremagic.com...

On 6 March 2014 14:17, Dejan Lekic dejan.le...@gmail.com wrote:

I've just pre-ordered it, on Amazon. ;)
Hurry up! :)



Cut the reviewers some lack! :)


Some lack of speed ;-) 



Re: Dynamically calling external libraries.

2014-02-26 Thread Mike James
On Wednesday, 26 February 2014 at 14:41:02 UTC, Adam D. Ruppe 
wrote:
You'd do it the same way you do in C. On Windows, call 
LoadLibrary, FreeLibrary, and GetProcAddress or the COM 
functions. On Linux, the family of functions is dlopen, dlsym, 
and dlclose.


Knowing the types to pass the functions is gonna be tricky and 
this needs to be right to avoid crashes. On Windows with 
scripting language, this is often done through COM automation: 
the IDispatch interface. With regular C functions, you really 
just have to know the prototypes ahead of time... it won't be 
fully dynamic, you load the library at run time but know how to 
use it at compile time.


That's the way I do it but I was wondering. Is it better to load 
all the functions from the DLL at the start of the program or 
load them when required and keep having to check if they're 
loaded before each use?


-Mike-


Re: So, You Want To Write Your Own Programming Language?

2014-01-24 Thread Mike James

On Thursday, 23 January 2014 at 10:24:23 UTC, Chris wrote:
On Wednesday, 22 January 2014 at 18:46:06 UTC, Walter Bright 
wrote:

On 1/22/2014 3:40 AM, Chris wrote:
Syntax is getting simplified due to the fact that the 
listener knows what we
mean, e.g. buy one get one free. I wonder to what extent 
languages will be

simplified one day. But this is a topic for a whole book ...


There was this article recently:

http://www.onthemedia.org/story/yesterday-internet-solved-20-year-old-mystery/

about how english is so redundant one can write sentences 
using just the first letter of each word, and it is actually 
understandable.


These examples are more about context than redundancy in the 
grammar. This is very interesting, because the burden is more 
and more on the listener and less on the speaker. The speaker 
can omit things relying on the listener's common sense or 
knowledge of the world (or you know what I mean skills). In 
the beginning, languages were quite complicated (8 or more 
cases, inflections), but over the centuries things have been 
simplified, probably due to the fact that humans are 
experienced enough and can now trust the interpreter in the 
listener's head.
A good example are headlines. A classic is Driver refused 
license. Now, everybody will assume that it was not the driver 
who refused the license (default assumption or the _unmarked 
case_). If it were in fact the driver who refused the license, 
the headline would have been different, some sort of linguistic 
flag would have been raised. This goes into the realms of 
pragmatics, a very interesting discipline. Some of the concepts 
found in natural languages can also be found in programming 
languages. I find it extremely interesting how the human mind 
(not just language) is reflected in programming languages.


Headlines are a good source. My favourites are from WW2...

MacArthur flies back to front.

British push bottles up Germans.

-mike-


Re: GuitarHero/RockBand fans... side project anyone?

2013-12-18 Thread Mike James
Jerry jlqu...@optonline.net wrote in message 
news:87r49bzawu@optonline.net...

Manu turkey...@gmail.com writes:

On 13 December 2013 19:31, John Colvin john.loughran.col...@gmail.com 
wrote:


I've experienced the same slowing effect I mentioned before in this 
context

too.
Have you ever trying playing with a delay AND an uncomfortably high 
latency?
Since you're playing with a delay, you're effectively playing against 
yourself
from a couple 100ms ago. If you play when you hear yourself, but there's 
an
effective latency on that note trigger, it will compound that latency, 
and

you'll drift towards a slower tempo as you play.
It's so weird when I feel myself do it, but it's awfully hard to control 
(I

don't have mates to play music with... I play a lot with a delay/looper).


One of the worst examples of this I've heard of was pipe organs in a
very large church.  The organist console sits at the opposite end of the
church from the pipes, perhaps 100 feet away from some pipes, leading to
extremely large delays.  I read one account where low notes had a 300ms
delay from pressing the pedal.

Jerry


Yeh - I had a friend who restored and played theatre organs. He said you had 
to play to the sheet music and completely ignore the sound.


-=mike=- 



String mixins with string arrays

2013-12-13 Thread Mike James

Hi,

Is it possible to pass a string array to a string mixin e.g

template GenSomething(string foo, string[] bar){
  some_kind_of_foreach(br: bar) {
const char[] foo ~ br ~ ;\n;
  }
}

and call:

mixin(GenSomething!(A, [B, C, D]));

would generate:

A.B;
A.C;
A.D;

Regards,

-=mike=-


Re: String mixins with string arrays

2013-12-13 Thread Mike James

On Friday, 13 December 2013 at 12:09:59 UTC, John Colvin wrote:

On Friday, 13 December 2013 at 11:40:35 UTC, Mike James wrote:

Hi,

Is it possible to pass a string array to a string mixin e.g

template GenSomething(string foo, string[] bar){
 some_kind_of_foreach(br: bar) {
   const char[] foo ~ br ~ ;\n;
 }
}

and call:

mixin(GenSomething!(A, [B, C, D]));

would generate:

A.B;
A.C;
A.D;

Regards,

-=mike=-


CTFE is your friend here.

string genSomething(string foo, string[] bar) {
  string result;
  foreach(br: bar) {
result ~= foo ~ '.' ~ br ~ ;\n;
  }
}

mixin(genSomething(A, [B, C, D]));


Thanks - that worked a treat (just needed a 'return result;').

Regards,

-=mike=-


Re: GUI libraries

2013-12-11 Thread Mike James

On Wednesday, 11 December 2013 at 20:25:43 UTC, Temtaime wrote:

GTK is too ugly.


css is good for prettifying it :-)

-=mike=-


Re: GUI libraries

2013-11-27 Thread Mike James

On Wednesday, 27 November 2013 at 17:07:07 UTC, DLang Beginner
wrote:

Hello.

I want to make GUI applications with D, but I don't know which 
are updated and ready to use, which are good and etc. Can you 
help me with choosing the right one, guys?


I tried to code in C++, but it was too much hard for me and I 
found D and I like it so much, but I don't know how is D good 
in creating GUI apps and 3D graphics like OpenGL.


Thank you for replies and sorry for my english.


GtkD and Glade works for me.

-mike-


Re: Gtkd-2

2013-11-14 Thread Mike James
Mike Wey mike-...@example.com wrote in message 
news:l60quj$1ace$1...@digitalmars.com...

On 11/13/2013 09:51 AM, Mike James wrote:

Steve Teale steve.te...@britseyeview.com wrote in message
news:sbthddptgdozwiivi...@forum.dlang.org...

I'd like to publicly thank and commend Mike Wey for his hard work and
perseverance on Gtkd.

It is now fully up-to-date with GTK3, and with it and D, writing GUI
programs has rarely if ever been easier.

If you have not been there recently - http://gtkd.org.

Thanks Mike.


+1

Is it about time to replace digitalmars.D.dwt forum with a
digitalmars.D.GtkD one and make it the official Gui for D?

-=mike=-


Well, don't jinx it ;)

--
Mike Wey


:-)

-=mike=- 



Re: Gtkd-2

2013-11-13 Thread Mike James
Steve Teale steve.te...@britseyeview.com wrote in message 
news:sbthddptgdozwiivi...@forum.dlang.org...
I'd like to publicly thank and commend Mike Wey for his hard work and 
perseverance on Gtkd.


It is now fully up-to-date with GTK3, and with it and D, writing GUI 
programs has rarely if ever been easier.


If you have not been there recently - http://gtkd.org.

Thanks Mike.


+1

Is it about time to replace digitalmars.D.dwt forum with a 
digitalmars.D.GtkD one and make it the official Gui for D?


-=mike=- 



Re: Overflow-safe use of unsigned integral types

2013-11-10 Thread mike james
On Sunday, 10 November 2013 at 12:05:45 UTC, Joseph Rushton 
Wakeling wrote:
One of the challenges when working with unsigned types is that 
automatic wraparound and implicit conversion can combine to 
unpleasant effect.


Consider e.g.:

void foo(ulong n)
{
writeln(n);
}

void main()
{
foo(-3);
}

... which will output: 18446744073709551613 (or, ulong.max + 1 
- 3).


Is there a recommended way to handle this kind of potential 
wraparound where it is absolutely unacceptable?  I've 
considered the following trick:


void bar(T : ulong)(T n)
{
static if (isSigned!T)
{
enforce(n = 0);// or assert, depending on your 
priorities

}
writeln(n);
}

... but it would be nice if there was some kind of syntax sugar 
in place that would avoid such a verbose solution.


I know that there have been requests for runtime overflow 
detection that is on by default (bearophile?), but it could be 
good to have some simple way to indicate really, no overflow 
even where by default it's not provided.


(Motivation: suppose that you have some kind of function that 
takes a size_t and uses that to determine an allocation.  If a 
negative number gets passed by accident, the function will thus 
try to allocate 2^64 - n elements, and your computer will have 
a very happy time...:-)


When writing software for embedded micros you can always check an 
overflow flag - is the no such mechanism on PC software?



-=mike=-


Re: D vs Go in real life

2013-11-07 Thread Mike James

Mmmm - that reminds me...

http://www.youtube.com/watch?v=VKHFZBUTA4k

-=mike=-


Russel Winder rus...@winder.org.uk wrote in message 
news:mailman.230.1383757333.9546.digitalmar...@puremagic.com...

On Wed, 2013-11-06 at 17:39 +0100, Bienlein wrote:
[…]

1976? Man, you are a teenager then ;-)


The year I went apesh!t when I found that the elliptic integral solver
routines in the NAG library were broken. I idled away the time by
creating idioms for writing abstract data type code in FORTRAN 66.
Bizarrely, analogous tricks appear to be essential in JavaScript.

It was also the third year of listening to Dark Side of the Moon and the
first year of Wish You Were Here which is much better.

But you didn't want to know this.

--
Russel.
=
Dr Russel Winder  t: +44 20 7585 2200   voip: 
sip:russel.win...@ekiga.net

41 Buckmaster Roadm: +44 7770 465 077   xmpp: rus...@winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder





Re: The interaction of encapsulation and properties in D

2013-07-11 Thread Mike James

On Thursday, 11 July 2013 at 07:50:38 UTC, Jonathan M Davis wrote:

On Thursday, July 11, 2013 09:37:56 Jacob Carlborg wrote:

[snip]


Also, if we could make it so that something like

@property int value;



+1

It would be a great timesaver and give a reason for @property to 
exist :-)


-=mike=-


Searching for D using Goolgle

2013-07-09 Thread Mike James
Hmmm. Every time I search for something using the search string 
dlang, Google asks me did I mean golang. Are Google getting 
worried about the success of D?


-=mike=-


Re: Current version of D.

2013-07-06 Thread mike james
The current release is 2.063.2, but it's the first time that 
we've actually
released point releases like that, so there are likely to be 
places saying

2.063 instead of 2.063.2.


Maybe it's time to make the odd-numbered releases the work in 
progress releases and the even-numbered releases the official 
releases?


-mike-


Re: Current version of D.

2013-07-06 Thread mike james

On Saturday, 6 July 2013 at 13:26:38 UTC, Dicebot wrote:

On Saturday, 6 July 2013 at 13:24:06 UTC, mike james wrote:
Maybe it's time to make the odd-numbered releases the work in 
progress releases and the even-numbered releases the official 
releases?


What is the point? All releases are official releases, work in 
progress == git master.


So you can keep track of the interim releases. Some people like 
to get their releases from the D website as an install and not 
from git-hub.


Re: about with statement

2013-06-09 Thread mike james

On Sunday, 9 June 2013 at 10:22:22 UTC, Jonathan M Davis wrote:

On Sunday, June 09, 2013 12:11:23 khurshid wrote:
D language have like Pascal/Delphi  with statement,  which 
very

useful for writing readable code.

http://dlang.org/statement.html#WithStatement

Maybe I'm wrong, but, I never saw  where using this statement 
in

phobos  source codes, what problem using this statement?


I'm not aware of any problems with it, but there's also rarely 
any reason to
use it. In most cases, it doesn't really add anything to the 
code, and I'd
argue that it would make code harder to read, because it hides 
where the
variables are coming from. I don't think that we'd really lose 
anything if we
didn't have it, but it's there if you want to use it, and it's 
not going away.


- Jonathan M Davis




Re: about with statement

2013-06-09 Thread mike james

On Sunday, 9 June 2013 at 10:22:22 UTC, Jonathan M Davis wrote:

On Sunday, June 09, 2013 12:11:23 khurshid wrote:
D language have like Pascal/Delphi  with statement,  which 
very

useful for writing readable code.

http://dlang.org/statement.html#WithStatement

Maybe I'm wrong, but, I never saw  where using this statement 
in

phobos  source codes, what problem using this statement?


I'm not aware of any problems with it, but there's also rarely 
any reason to
use it. In most cases, it doesn't really add anything to the 
code, and I'd
argue that it would make code harder to read, because it hides 
where the
variables are coming from. I don't think that we'd really lose 
anything if we
didn't have it, but it's there if you want to use it, and it's 
not going away.


- Jonathan M Davis


Even Wirth gave up on the with statement in his later languages 
design.


-mike-



Re: dmd 2.063 released with 260 bugfixes and enhancements

2013-05-31 Thread Mike James
Damn you D - I'm using up a large chunk of my free time reading the improved 
and very-readable Change Log.


A great update to D and Log.

-=mike=- 



Re: Ideal D GUI Toolkit

2013-05-21 Thread Mike James
eles e...@eles.com wrote in message 
news:ksirfxsiejlweyhom...@forum.dlang.org...

On Tuesday, 21 May 2013 at 06:41:24 UTC, Jacob Carlborg wrote:

On 2013-05-20 07:25, Tyler Jameson Little wrote:
Here we go again, yet another massive thread about GUI toolkits :)


Anyway, the thread is already started, I think the alternatives are:

1) pick up a major well-known GUI library, fork it and spend some 
important time to re-write in D. Choices: Qt, GTK, wxWindows etc.


2) pick up a lighter GUI library, while still cross-platform, and re-write 
it in D. Spent time is less. Choices: FLTK, FOX Toolkit


3) start from scratch and write something new, while still having to 
decide if will wrap OS widgets or no.


Just to be sure that you know about FOX Toolkit:

http://fox-toolkit.org/goals.html



There is also IUP...

http://www.tecgraf.puc-rio.br/iup/

-=mike=- 



Re: GtkD 2.2 released, GTK+ with D.

2013-05-16 Thread Mike James

Hi Mike,

I've installed GtkD 2.2.0 and Gtk+. When building the cairo clock app I get 
the following error...


Error 1 Error 42: Symbol Undefined 
_D7gobject7ObjectG7ObjectG11addOnNotifyMFDFC7gobject9ParamSpec9ParamSpecC7gobject7ObjectG7ObjectGZvE4gtkc12gobjecttypes13GConnectFlagsZv 
(void gobject.ObjectG.ObjectG.addOnNotify(void 
delegate(gobject.ParamSpec.ParamSpec, gobject.ObjectG.ObjectG), 
gtkc.gobjecttypes.GConnectFlags)) 
C:\D\dmd2\GtkD\demos\cairo\cairo_clock\clock\clock\


I've included all the libs built by the build.d app.
Am I missing a lib?

Regards, Mike.

...



Re: Tricky code with exceptions

2013-05-09 Thread Mike James


bearophile bearophileh...@lycos.com wrote in message 
news:pnwldlckpgrjvvuje...@forum.dlang.org...


SNIP


My D translation:

import std.stdio;

void main() {
foreach (i; 0 .. 6) {
writeln(Loop: , i);

try {
try {
if (i == 3)
break;
} finally {
if (i % 2 != 0)
throw new Exception();
}
} catch (Exception e) {
writeln(Caught);
}
}
}


It prints:

Loop: 0
Loop: 1
Caught
Loop: 2
Loop: 3

And then it crashes.

Bye,
bearophile


Strangely, if you replace the break instruction with continue (I know 
it's pointless code), it also crashes...


Regards, Mike. 



GtkD - Changing the default windows font

2013-05-03 Thread Mike James
Running on Windows 7, the default font is very thin and indistinct on my 
machine - is there a system setting to change the default font?


regards, Mike. 



Re: 1 matches bool, 2 matches long

2013-04-29 Thread Mike James

gdc:

bool x = false;
x++;

main.d:50: Error: operation not allowed on bool 'x'

why not? is just an integer after all. another special case?


If you are going to create a boolean then use it as a boolean - it's not an 
integer any more. Don't mix and match - there's nothing worse than trying to 
follow some code that uses a variable in one way then, out of lazyness, uses 
it in a different way.




this works:

int x = false;
x++; 




Re: goto (outer) case

2013-02-19 Thread Mike James

I'm feeling the wind from Edsger Dijkstra spinning in his grave...

-=mike=-

Nick Sabalausky seewebsitetocontac...@semitwist.com wrote in message 
news:20130218205937.0768@unknown...

Consider these nested switches:

---
enum Foo {a, b}
enum Bar {bar}

auto foo = Foo.a;
auto bar = Bar.bar;

final switch(foo)
{
case Foo.a:
   final switch(bar)
   {
   case Bar.bar:
   XX
   break;
   }
   break;

case Foo.b:
   break;
}
---

Without adding extra code anywhere else, is there anything I can stick
in for XX to get execution to jump to case Foo.b:?

Doing goto case Foo.b; doesn't work. It just gives a compile error
that a Foo can't be implicitly converted to Bar.

This ability isn't critical, of course, but it would help clean up some
code I have.





Re: Exceptional coding style

2013-01-18 Thread Mike James



Maybe I should invent a programming language in which color has semantic
value. And fonts. :-P


Sort of :-)

http://www.colorforth.com/primer.htm

-=mike=-


Re: GtkD 2.0 released, Gtk+ 3 with D.

2012-09-26 Thread Mike James

Mike Wey  wrote in message news:k2isv4$2r67$1...@digitalmars.com...
GtkD is a D binding and OO wrapper of Gtk+ and is released on the LGPL
license.

With 2.0 GtkD will wrap Gtk+ version 3, if you need Gtk+ 2 you can use the 
latest version from the Gtk2 branch, version 1.6.


GtkD 2.0 and 1.6 are now available on GitHub:
https://github.com/gtkd-developers/GtkD/downloads

--
Mike Wey



Hi,

I tried the install detailed on the github page and got the following error:


C:\D\dmd2\gtkD2\srcdgen
build\gtkD.d(612): Error: module SourceBuffer is in file 
'gsv\SourceBuffer.d' wh

ich cannot be read
import path[0] = C:\D\dmd2\windows\bin\..\..\src\phobos
import path[1] = C:\D\dmd2\windows\bin\..\..\src\druntime\import


Any clues as to the problem/solution?

Regards, Mike.



Visula D fails to build after Windows updates

2012-09-26 Thread Mike James

Hi,

After a recent Windows update cycle the Visual D projects now fail to 
build - it can't find the D source files - the output from compiler is 
below.


===

OPTLINK (R) for Win32  Release 8.00.12
Copyright (C) Digital Mars 1989-2010  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
OPTLINK : Error 118: Filename Expected
Path=C:\D\dmd2\windows\bin;C:\Program Files\Microsoft 
SDKs\Windows\v7.0\bin;C:\Program 
Files\GTK+-Runtime-3.4.2\bin;C:\D\dmd2\windows\bin;C:\D\dm\bin;c:\MinGW\;C:\Program 
Files\CVSNT\;C:\lazarus\fpc\2.4.0\bin\i386-Win32;c:\dmd2\windows\bin;c:\dm\bin;c:\opt\gtk\bin;c:\bud\bin;c:\program 
files\mercurial;c:\program files\cmake\bin;c:\d\dmd2\dsss\bin;C:\D\dmd2\gtkD


^
--- errorlevel 1
Building Debug\dgen.exe failed!



This has occured on 2 PCs, one Vista and one Win7 straight after recent 
updates. Has this occured to anybody else and whats the fix for it?


Thanks.

Regards, Mike. 



Visual D fails to build after Windows updates

2012-09-26 Thread Mike James

Hi,

After a recent Windows update cycle the Visual D projects now fail to
build - it can't find the D source files - the output from compiler is
below.

===

OPTLINK (R) for Win32  Release 8.00.12
Copyright (C) Digital Mars 1989-2010  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
OPTLINK : Error 118: Filename Expected
Path=C:\D\dmd2\windows\bin;C:\Program Files\Microsoft
SDKs\Windows\v7.0\bin;C:\Program
Files\GTK+-Runtime-3.4.2\bin;C:\D\dmd2\windows\bin;C:\D\dm\bin;c:\MinGW\;C:\Program
Files\CVSNT\;C:\lazarus\fpc\2.4.0\bin\i386-Win32;c:\dmd2\windows\bin;c:\dm\bin;c:\opt\gtk\bin;c:\bud\bin;c:\program
files\mercurial;c:\program files\cmake\bin;c:\d\dmd2\dsss\bin;C:\D\dmd2\gtkD

^
--- errorlevel 1
Building Debug\dgen.exe failed!



This has occured on 2 PCs, one Vista and one Win7 straight after recent
updates. Has this occured to anybody else and whats the fix for it?

Thanks.

Regards, Mike.



Re: Visual D fails to build after Windows updates

2012-09-26 Thread Mike James

Rainer Schuetze  wrote in message news:k3vfh2$1g0$1...@digitalmars.com...

On 26.09.2012 16:57, Mike James wrote:
 Hi,

 After a recent Windows update cycle the Visual D projects now fail to
 build - it can't find the D source files - the output from compiler is
 below.

 
===


 OPTLINK (R) for Win32  Release 8.00.12
 Copyright (C) Digital Mars 1989-2010  All rights reserved.
 http://www.digitalmars.com/ctg/optlink.html
 OPTLINK : Error 118: Filename Expected
 Path=C:\D\dmd2\windows\bin;C:\Program Files\Microsoft
 SDKs\Windows\v7.0\bin;C:\Program
 
Files\GTK+-Runtime-3.4.2\bin;C:\D\dmd2\windows\bin;C:\D\dm\bin;c:\MinGW\;C:\Program

 
Files\CVSNT\;C:\lazarus\fpc\2.4.0\bin\i386-Win32;c:\dmd2\windows\bin;c:\dm\bin;c:\opt\gtk\bin;c:\bud\bin;c:\program

 files\mercurial;c:\program
 files\cmake\bin;c:\d\dmd2\dsss\bin;C:\D\dmd2\gtkD

 ^
 --- errorlevel 1
 Building Debug\dgen.exe failed!

 



 This has occured on 2 PCs, one Vista and one Win7 straight after recent
 updates. Has this occured to anybody else and whats the fix for it?

 Thanks.

 Regards, Mike.


This is a linker problem caused by the '+' in your PATH environment 
variable:


http://d.puremagic.com/issues/show_bug.cgi?id=5860
http://d.puremagic.com/issues/show_bug.cgi?id=4831


Thanks. A re-install of GTK+ did the trick.

Regards, Mike.



  1   2   >