Are there a function like C#'s Path.GetDirectoryName()
(https://docs.microsoft.com/en-us/dotnet/api/system.io.path.getdirectoryname?redirectedfrom=MSDN&view=netframework-4.7.2#System_IO_Path_GetDirectoryName_System_String_) in D standard library or some dub package?
just checking if there's one, s
On Monday, 10 September 2018 at 20:30:52 UTC, Dr.No wrote:
On Saturday, 8 September 2018 at 14:26:45 UTC, ag0aep6g wrote:
[...]
Yes, it does only happens at line breaks. I hadn't realized
that until you mentioned. It does gets in place of \r and \n,
that's why there's all in one line when th
On Saturday, 8 September 2018 at 14:26:45 UTC, ag0aep6g wrote:
On 09/03/2018 08:13 PM, Dr.No wrote:
But it in the middle of output, I got output like this:
outjson = {"barCode":"20","ade":"20"}♪◙outjson =
{"barCode":"X21","ade":"21"}
also there's that extra ♪◙ character. Thos sounds
Does anyone have some tips to try trace the error with debug or
so?
I haven't fixed this issue yet... any help is very appreciated
On Friday, 7 September 2018 at 14:36:42 UTC, Russel Winder wrote:
From what I can see, processes created with std.process:
spawnProcess are not terminated when the creating process
terminates, i.e. it seems Config.detached is the default for
these process.
Is there a way of all spawned proces
so I'im doing an expansive operation with a file, to try speed
up, i switch to using parallel but keeping in the otuput printing
thread-safe. But for some reason, even using synchonized, it
doesn't work as expected, for example, it output multiples
results on same time, as in the example below.
On Saturday, 1 September 2018 at 17:08:25 UTC, Peter Alexander
wrote:
On Saturday, 1 September 2018 at 16:20:11 UTC, Dr.No wrote:
why move flush to outside the synchronized block?
flush should be thread safe. In general, yiu want as little
code as possible to run under the lock. Not that impo
On Thursday, 30 August 2018 at 21:09:35 UTC, Peter Alexander
wrote:
On Thursday, 30 August 2018 at 19:59:17 UTC, Dr.No wrote:
I would to process the current block in parallel but priting
need to be theread-safe so I'm using
foreach(x; parallel(arr)) {
auto a = f(x);
auto res = g(a);
I would to process the current block in parallel but priting need
to be theread-safe so I'm using
foreach(x; parallel(arr)) {
auto a = f(x);
auto res = g(a);
synchronized {
stdout.writeln(res);
stdout.flush();
}
}
Since f() and g() are some heavy functions, I'd l
So I went to try out QWebView on Windows from this wrapper:
https://github.com/MGWL/QtE5
all the examples went fine until I tried QWebView:
https://github.com/MGWL/QtE5/blob/master/examples/webview.d
I compile using this command line:
dmd -m32 webview.d qte5.d -oflol
but when I run I get t
Thank you very much u all guys.
This is the module I'm speaking about:
https://arsd-official.dpldocs.info/arsd.dom.html
So I have this HTML that not even parseGarbae() can del with:
https://hostname.com/?file=foo.png&foo=baa";>G!
There is this spaces between "href" and "=" and "https..." which
makes below code fails:
On Friday, 22 June 2018 at 17:20:03 UTC, Steven Schveighoffer
wrote:
On 6/22/18 1:07 PM, Dr.No wrote:
static if(is(typeof(__traits(getMember, B, field) ==
A[])))
static if(is(typeof(__traits(getMember, B, field)) ==
A[]))
Note the slight change in parentheses.
-Steve
oh,
In the below code, "A[] found" is never printed. What's the
proper way to check for this type?
import std.stdio;
import std.traits : FieldNameTuple;
class A { }
class B
{
string foo;
string baa;
A[] list;
}
void main()
{
static foreach(field; FieldNameTuple!B)
{
How can I do that with D?
In C# you can do that:
var filename = @"C:\path\to\my\file.txt";
var file = new Uri(filename).AbsoluteUri;
// file is "file:///C:/path/to/my/file.txt"
How can I do that in D?
I'd like help of compiler to check this:
consider this:
int f(int n) {
m_n = n;
}
f(10); // ok
f(myTampleteFunction!(compileTimeParameter)); // ok
enum n = 10;
f(n); // I won't use this, but should also be ok
int x = 10;
f(x); // error
int g() { return 20; }
f(g); // error
How can I enforce
Thread is "limited" to local storage, so static variables
(including the ones marked as __gshared in D) which are globals
are shared between the threads. So, calling not pure functions
which depend upon global variables prevent parallization for that
global-dependence.
(please tell me I got an
On Friday, 1 June 2018 at 02:30:34 UTC, Paul Backus wrote:
On Thursday, 31 May 2018 at 19:26:12 UTC, Dr.No wrote:
My application create some HTML which is then converted to PDF
by wkhtmltopdf library. I'm trying to figure out how make the
PDF generation run parallel, currently, it's running lin
My application create some HTML which is then converted to PDF by
wkhtmltopdf library. I'm trying to figure out how make the PDF
generation run parallel, currently, it's running linearly. My
guess is wkhtmltopdf internal variables is preventing
parallelization. But I'm new to parallization and
On Wednesday, 30 May 2018 at 20:43:48 UTC, Ali Çehreli wrote:
On 05/30/2018 01:09 PM, Dr.No wrote:
> consider a C function with this prototype:
>> void foo(const char *baa);
>
> Does it means I should do:
>
>> string s = ...;
>> auto cstring = s.toStringz;
>> foo(cstring);
>
> rather just:
>
>>
The documentation says:
Important Note: When passing a char* to a C function, and the C
function keeps it around for any reason, make sure that you keep
a reference to it in your D code. Otherwise, it may become
invalid during a garbage collection cycle and cause a nasty bug
when the C code t
import std.parallelism : parallel;
foreach(t; parallel(arr))
{
if(!doSomething(t)) {
return false;
}
}
It reuturns the run time error:
std.parallelism.P
On Monday, 28 May 2018 at 02:10:48 UTC, sarn wrote:
On Monday, 28 May 2018 at 01:28:10 UTC, Dr.No wrote:
What's likely the reason of the crash? mismatch between D and
C memory alignment?
From an ABI point of view, the raw pointers won't care about
the memory structure they point to. The func
I'm trying to use wkhtmltopdf[1] with D. I converted this
header[2] with little modification using htod tool which resulted
in this[3].
The libray is passed to link using:
pragma(lib, "wkhtmltox.lib");
(that file is in wkhtmltopdf\lib folder)
and the module imported with:
import pdf;
but it
What's D's way to do that? I need it to be mutable array of wchar
because a Windows function requires that.
Alternative to go down to using pointers, which would be
something like:
wchar[] w = new wchar[s.length];
memcpy(w.ptr, s.ptr, s.length);
On Wednesday, 23 May 2018 at 19:49:27 UTC, Jonathan M Davis wrote:
On Wednesday, May 23, 2018 19:36:07 Dr.No via
Digitalmars-d-learn wrote:
[...]
As the template constraint in the error message says, read
requires an input range. Static arrays are not input ranges.
You need to give it
read fails with both uint and ulong on 64bit platform:
Error: template std.bitmanip.read cannot deduce function from
argument types !(ulong)(ubyte[8]), candidates are:
C:\ldc2-1.9.0-windows-x64\bin\..\import\std\bitmanip.d(3213,3):
std.bitmanip.read(T, Endian endianness = Endian.bigEndi
I'm trying to do some hashing at compile time with xxhash
algorithm but I get this error:
..\..\..\AppData\Local\dub\packages\xxhash-master\xxhash\src\xxhash.d(39,37):
Error: reinterpreting cast from const(ubyte)* to const(uint)* is not supported
in CTFE
this is line 39
(https://github.com/r
where's this stored?
On Monday, 21 May 2018 at 15:16:11 UTC, Atila Neves wrote:
On Friday, 18 May 2018 at 15:16:52 UTC, Russel Winder wrote:
Hi,
What's the current official position on how to create
temporary files for use during a unittest. I found
Not official, but...
import unit_threaded;
with(const
On Sunday, 20 May 2018 at 02:01:20 UTC, Alex wrote:
On Sunday, 20 May 2018 at 01:41:03 UTC, Dr.No wrote:
I'd like to pass a symbol as paramater (class static member0
and at same time get the type of this, something like this:
template myTemp(alias s)
{
enum myTemp = templateFunction!(?
I'd like to pass a symbol as paramater (class static member0 and
at same time get the type of this, something like this:
template myTemp(alias s)
{
enum myTemp = templateFunction!(??)(s.stringof);
}
the templateFunction has this signature:
int templateFunction(T)(string targetMembernam
On Wednesday, 16 May 2018 at 18:56:26 UTC, Steven Schveighoffer
wrote:
On 5/16/18 2:45 PM, Dr.No wrote:
where is the actual source code implementation?
https://github.com/dlang/druntime/blob/7e3b4086fee8f2e2a6882942c677acc28df527ee/src/object.d#L3479
-Steve
thanks
On Friday, 18 May 2018 at 15:30:05 UTC, Uknown wrote:
On Friday, 18 May 2018 at 15:16:52 UTC, Russel Winder wrote:
Hi,
What's the current official position on how to create
temporary files for use during a unittest. I found
https://github.com/dlang/phobos/pull/5788
but it seems to be langui
where is the actual source code implementation?
Has gdc been supported for Windows? if so, where can I find it?
I've only find Linux versions so far...
On Tuesday, 1 May 2018 at 22:51:01 UTC, IntegratedDimensions
wrote:
On Tuesday, 1 May 2018 at 22:08:50 UTC, Dr.No wrote:
On Tuesday, 1 May 2018 at 21:57:22 UTC, IntegratedDimensions
wrote:
Trying to curl basic stuff but std.net.curl isn't cooperating:
curl "https://www.googleapis.com/youtube/v
Looking for make application run fast as possible, aside
optimization in the source code, is using 64 bit over 32 really
worth?
On Tuesday, 1 May 2018 at 21:57:22 UTC, IntegratedDimensions
wrote:
Trying to curl basic stuff but std.net.curl isn't cooperating:
curl "https://www.googleapis.com/youtube/v3/channels"; -G -d
part=contentDetails -d forUsername=test -d key=somekey
[...]
Just a wild guess, do you have the SSL
I'm trying to do an optimization here: a hash function which
expect a ubye[] array as argument, would just work if I cast
string to ubyte[] but I need to convert it to upper case, so I'd
like to do that lazily, so that the byte is converted to its
upper case version soon as it's requested. I'm
On Friday, 27 April 2018 at 14:48:00 UTC, Jesse Phillips wrote:
On Thursday, 26 April 2018 at 16:59:45 UTC, Dr.No wrote:
On Wednesday, 25 April 2018 at 19:25:11 UTC, Jesse Phillips
wrote:
On Wednesday, 25 April 2018 at 17:34:41 UTC, Dr.No wrote:
Is there something implemented already to get the
In C# you can have a readonly member assignable either at
declaration or constructor time, like this:
class C
{
readonly myClass mc;
this()
{
mc = new myClass();
}
void doSomething()
{
mc = new myClass(); // wrong! result in compiler error, mc is
readonly
}
}
Does D h
consider this:
module report;
// output an error message on stderr
void error(A...)(string fmt, A args)
{
import colorize : fg, color, cwriteln, cwritefln, cwrite;
stderr.cwrite("error: ".color(fg.yellow));
cwritefln(fmt.color(fg.yellow), args);
}
void warning(A...)(stri
On Wednesday, 25 April 2018 at 19:25:11 UTC, Jesse Phillips wrote:
On Wednesday, 25 April 2018 at 17:34:41 UTC, Dr.No wrote:
Is there something implemented already to get the files from
directory by name using D or I'm on my own and I have to write
it myself? I didn't find how do that with dirE
On Wednesday, 25 April 2018 at 18:06:07 UTC, Jonathan M Davis
wrote:
On Wednesday, April 25, 2018 17:34:41 Dr.No via
Digitalmars-d-learn wrote:
Is there something implemented already to get the files from
directory by name using D or I'm on my own and I have to write
it myself? I didn
Is there something implemented already to get the files from
directory by name using D or I'm on my own and I have to write it
myself? I didn't find how do that with dirEntries()
On Saturday, 21 April 2018 at 17:15:47 UTC, Jonathan M Davis
wrote:
On Saturday, April 21, 2018 16:05:22 Dr.No via
Digitalmars-d-learn wrote:
import std.meta : Filter;
enum isNotReservedSymbol(string name) = name != "none" && name
!=
"lastToken";
enum string[] m
import std.meta : Filter;
enum isNotReservedSymbol(string name) = name != "none" && name !=
"lastToken";
enum string[] members = staticMembers!Token;
static foreach(member; Filter!(isNotReservedSymbol, members))
{{
This return the error:
Error: template instance `pred!(["none
give structs like this:
struct A
{
int a = 10;
string s = "haha";
}
struct B
{
A aDetails;
}
I'd like to do this and store that symbol name as string (my goal
is store the member name);
string memberName = magic(B.aDetails.s);
writeln(memberName); // otuput "aDetails.
s.length > 0 or s !is null?
used to C++/C#'s world I cautch myself doing something like this:
if(s !is null && s.length > 0 && s[0] == '/)
then a I remembered the D's way, which length is probably a
function not a property (in the C++/C#'s sense, which needs this
as first parameter, hence s.
I'm reading line by line the lines from a CSV file provided by
the user which is assumed to be UTF8. But an user has provided an
ANSI file which resulted in the error:
core.exception.UnicodeException@src\rt\util\utf.d(292): invalid
UTF-8 sequence
(it happend when the user took the originally
51 matches
Mail list logo