Re: Slow start up time of runtime (correction: Windows real-time protection)

2018-03-21 Thread HeiHon via Digitalmars-d-learn

On Tuesday, 20 March 2018 at 16:56:59 UTC, Dennis wrote:

On Tuesday, 20 March 2018 at 12:18:16 UTC, Adam D. Ruppe wrote:

On Tuesday, 20 March 2018 at 09:44:41 UTC, Dennis wrote:
This now leaves the question what's the best way to mitigate 
this, because I would gladly get rid of the second of delay any 
time I invoke dmd, ldc or dub as well as my own applications.


In Windows Security Center Settings (where you can disable 
realtime scan) there is also an entry "Exclusions" (in german 
windows "Ausschlüsse").
I added exclusions for the folder, where I installed dmd and ldc 
and I added an exclusion for the folder, where I compile my D 
programs. Now startup of dmd and freshly compiled programs is 
fast again.




Re: Slow start up time of runtime

2018-03-20 Thread HeiHon via Digitalmars-d-learn

On Tuesday, 20 March 2018 at 12:18:16 UTC, Adam D. Ruppe wrote:
Go into the Windows security center and uncheck the real time 
virus check protection. I betcha you'll see this delay (and a 
similar one on dmd itself, your compiles could be running at 
half-speed with this too) disappear and everything will seem a 
LOT faster.


I also noticed slow startup times for freshly compiled D programs.
And yes, I can verify that it's the Windows Defender's realtime 
scan.
I switched it off (Windows 10) and dmd itself and the compiled D 
program started just as fast as they should.
It gets better (with realtime scan enabled) when you compile your 
programs with

dmd -O -release -m64 app.d


Re: Checking, whether string contains only ascii.

2017-02-23 Thread HeiHon via Digitalmars-d-learn

On Thursday, 23 February 2017 at 08:34:53 UTC, berni wrote:
On Wednesday, 22 February 2017 at 21:23:45 UTC, H. S. Teoh 
wrote:

enforce(!s.any!"a > 127");


Puh, it's lot's of possibilities to choose of, now... I thought 
of something like the foreach-loop but wasn't sure if that is 
correct for all utf encodings. All in all, I think I take the 
any-approach, because it feels a little bit more like looking 
at the string at a whole and I like to use enforce.


Thanks for all your answers!


All the examples given here are very nice.
But alas this will not work with postscript files as found in the 
wild.


In my program, I read a postscript file. Normal postscript 
files should only be composed of ascii characters, but one 
never knows what users give us. Therefore I'd like to make sure 
that the string the program read is only made up of ascii 
characters.


Generally postscript files may contain binary data.
Think of included images or font data.
So in postscript files there should normally be no utf-8 encoded 
text, but binary data are quite usual.

Think of postscript files as a sequence of ubytes.


Re: std.utf.decode behaves unexpectedly - Bug?

2015-11-07 Thread HeiHon via Digitalmars-d-learn

On Friday, 6 November 2015 at 20:00:43 UTC, BBaz wrote:
Sorry, the forum as stripped my answer. Here is the full 
version:

...


Thank you very much for taking the time to explain it!



std.utf.decode behaves unexpectedly - Bug?

2015-11-06 Thread HeiHon via Digitalmars-d-learn

Consider this:

[code]
import std.stdio, std.utf, std.exception;

void do_decode(string txt)
{
try
{
size_t idx;
writeln("decode ", txt);
for (size_t i = 0; i < txt.length; i++)
{
dchar dc = std.utf.decode(txt[i..i+1], idx);
writeln(" i=", i, " length=", txt[i..i+1].length, " 
char=", txt[i], " idx=", idx, " dchar=", dc);

}
}
catch(Exception e)
{
writeln(e.msg, " file=", e.file, " line=", e.line);
}
writeln();
}

void main()
{
do_decode("abc");
/+ result:
decode abc
 i=0 length=1 char=a idx=1 dchar=a
 i=1 length=1 char=b idx=2 dchar=c
 i=2 length=1 char=c idx=3 dchar=
+/

do_decode("åbc");
/+ result:
decode åbc
Attempted to decode past the end of a string (at index 1) 
file=D:\dmd2\windows\bin\..\..\src\phobos\std\utf.d line=1268

+/

do_decode("aåb");
/+ result:
decode aåb
 i=0 length=1 char=a idx=1 dchar=a
core.exception.RangeError@std\utf.d(1265): Range violation

0x004054D4
0x0040214F
0x004045A7
0x004044BB
0x00403008
0x755D339A in BaseThreadInitThunk
0x76EE9EF2 in RtlInitializeExceptionChain
0x76EE9EC5 in RtlInitializeExceptionChain
+/
}
[/code]

I would expect:
decode abc -> dchar a, dchar b, dchar c
decode åbc -> dchar å, dchar b, dchar c
decode aåb -> dchar a, dchar å, dchar b

Am I using std.utf.decode wrongly or is it buggy?



Re: std.utf.decode behaves unexpectedly - Bug?

2015-11-06 Thread HeiHon via Digitalmars-d-learn
Sorry, I mixed up the line numbers from dmd 2.068.2 and dmd 
2.069.0.

The correct line numbers for dmd 2.069.0 are:

Attempted to decode past the end of a string (at index 1) 
file=D:\dmd2\windows\bin\..\..\src\phobos\std\utf.d line=1281


and

core.exception.RangeError@std\utf.d(1278): Range violation




Re: Learning D

2014-08-26 Thread HeiHon via Digitalmars-d-learn

On Monday, 25 August 2014 at 16:46:11 UTC, Ryan wrote:
What IDE should I use? I'm not big fan of Eclipse, although if 
I had to use it this wouldn't be a dealbreaker.  Give me 
something easy and lightweight, unless you've got a GUI builder 
(this is why I started with MonoDevelop, though this isn't 
working so well for me).


If you can do without all bells and whistles of a fullblown IDE, 
you can try geany. I really like it and do all my D (and 
python/shell/perl) work with geany.


http://www.geany.org/

You just install dmd (or gdc or ldc) and add it to your PATH.
You download and install geany.
You configure the build/compile settings for geany eg:
rdmd --build-only --force -debug %f

And there you go.

Geany is available for Windows and Linux.