Re: std.experimental.logger + threadIds

2016-12-19 Thread Robert burner Schadek via Digitalmars-d-learn
The ugly way is to create a @trusted function/lambda that coverts the threadId to a string. Not sure about the pretty way.

Re: std.experimental.logger

2016-01-05 Thread Robert burner Schadek via Digitalmars-d-learn
On Tuesday, 5 January 2016 at 02:44:48 UTC, sanjayss wrote: I'm doing the following: import std.experimental.logger; int main(string[] args) { sharedLog = new FileLogger("logfile.log"); log("Test log 1"); log("Test log 2"); log("Test log 3"); } diff: sharedLog = new

Re: std.experimental.logger instantiation fails in 2.067

2015-09-02 Thread Robert burner Schadek via Digitalmars-d-learn
On Wednesday, 2 September 2015 at 06:57:12 UTC, drug wrote: Before 2.067 I used std.experimental.logger in form of a dub package. Because it included in 2.067 I stop using the dub package but now I get the error: Error: safe function

Re: std.experimental.logger instantiation fails in 2.067

2015-09-02 Thread Robert burner Schadek via Digitalmars-d-learn
my guess is that InitiatingPTrack.toString is not @safe

Re: OT - civility in a professional environment

2015-06-19 Thread Robert burner Schadek via Digitalmars-d-learn
nice read, thank you

Re: Chaining input

2015-05-08 Thread Robert burner Schadek via Digitalmars-d-learn
On Friday, 8 May 2015 at 11:00:01 UTC, Chris wrote: I'm sure there is room for improvement. It looks like your reading some kind of comma seperated values (csv). have a look at std.csv of phobos ``` foreach(record; file.byLine.joiner(\n).csvReader!(Tuple!(string, string, int))) {

Re: Create a case-insensitive startsWith

2015-04-29 Thread Robert burner Schadek via Digitalmars-d-learn
if(0X.std.string.indexOf(0x, CaseSensitive.no) == 0) should work

Re: std.logger sharedLog usage

2015-03-30 Thread Robert burner Schadek via Digitalmars-d-learn
On Monday, 30 March 2015 at 04:05:12 UTC, lobo wrote: Thank you, lobo. next version will have equal default LogLevel for all Logger. https://github.com/D-Programming-Language/phobos/pull/3124

Re: std.logger sharedLog usage

2015-03-29 Thread Robert burner Schadek via Digitalmars-d-learn
On Sunday, 29 March 2015 at 01:36:24 UTC, lobo wrote: Hi, I'm trying to use std.experimental.logger and I'd like the logf(), tracef() style functions to log to a file and stdout. (note: I can use sharedLog.logf(), sharedLog.tracef(), but I prefer just logf()) So I did this: shared static

Re: How to generate a random string ...

2015-03-16 Thread Robert burner Schadek via Digitalmars-d-learn
On Monday, 16 March 2015 at 22:19:52 UTC, Gary Willoughby wrote: I guess it depends on the encoding? No the character itself are encoding independent. Some references: http://stackoverflow.com/questions/23853489/generate-a-random-unicode-string This will not work as the caller has to

How to generate a random string ...

2015-03-16 Thread Robert burner Schadek via Digitalmars-d-learn
... from all Unicode characters in an idiomatic D way? (std.interal.unicode_*) ``` T genUnicodeString(T)(size_t minChars, size_t maxChars) if(isSomeString!T) { ... } ```

Re: How to generate a random string ...

2015-03-16 Thread Robert burner Schadek via Digitalmars-d-learn
On Monday, 16 March 2015 at 18:48:29 UTC, bearophile wrote: Perhaps by rejection? I mean, generating a uint, test if it's a character and repeat until the result is true. hm, that must not even terminate.

Re: Why do the same work about 'IndexOfAny' and 'indexOf' function?

2015-01-09 Thread Robert burner Schadek via Digitalmars-d-learn
On Friday, 9 January 2015 at 14:03:21 UTC, ketmar via Digitalmars-d-learn wrote: std.regex can use CTFE to compile regular expressions (yet it sometimes slower than non-CTFE variant), and i mean that we compile regexp before doing alot of searches, not before each single search. if you have

Re: Why do the same work about 'IndexOfAny' and 'indexOf' function?

2015-01-09 Thread Robert burner Schadek via Digitalmars-d-learn
On Friday, 9 January 2015 at 13:25:17 UTC, ketmar via Digitalmars-d-learn wrote: if you *really* concerned with speed here, you'd better consider using regular expressions. as regular expression can be precompiled and then search for multiple words with only one pass over the source string. i

Re: Why do the same work about 'IndexOfAny' and 'indexOf' function?

2015-01-09 Thread Robert burner Schadek via Digitalmars-d-learn
On Friday, 9 January 2015 at 14:21:04 UTC, ketmar via Digitalmars-d-learn wrote: heh. regexps *are* fast enough. it's hard to beat well-optimised generated thingy on a complex grammar. ;-) I don't see your point, anyway I think he got his help or at least some help.

Re: Why do the same work about 'IndexOfAny' and 'indexOf' function?

2015-01-08 Thread Robert burner Schadek via Digitalmars-d-learn
use canFind like such: bool a = canFind(strs,s) = 1; let the compiler figger out what the types of the parameter are.

Re: ini library in OSX

2014-12-23 Thread Robert burner Schadek via Digitalmars-d-learn
as you properly know, ini files don't support sections arrays. If you know all items at compile time, you could create structs for all of them, but that is properly not what you're looking for.

Re: ini library in OSX

2014-12-22 Thread Robert burner Schadek via Digitalmars-d-learn
On Saturday, 20 December 2014 at 08:09:06 UTC, Joel wrote: On Monday, 13 October 2014 at 16:06:42 UTC, Robert burner Schadek wrote: On Saturday, 11 October 2014 at 22:38:20 UTC, Joel wrote: On Thursday, 11 September 2014 at 10:49:48 UTC, Robert burner Schadek wrote: some self promo:

Re: Really in need of help with std.container.array.d

2014-10-16 Thread Robert burner Schadek via Digitalmars-d-learn
On Wednesday, 15 October 2014 at 21:15:14 UTC, Nordlöw wrote: Comint exited abnormally with code 1 at Wed Oct 15 23:14:37 I'm stuck. Need help. I will give it a try

Re: Really in need of help with std.container.array.d

2014-10-14 Thread Robert burner Schadek via Digitalmars-d-learn
On Tuesday, 14 October 2014 at 12:51:29 UTC, Nordlöw wrote: Could you please give me a code example? I'm not skilled enough in D to follow this description. struct Range(T) { Array!S array; T opIndex(size_t i) { return cast(T)array[i]; } } struct Array(T) { Range!(const(T))

Re: Really in need of help with std.container.array.d

2014-10-13 Thread Robert burner Schadek via Digitalmars-d-learn
hm, the problems seams to be that inout Array is not becoming const Array and friends. A blunt force solution would be to create a range as Range!(ReturnType!Array...)(cast(Array!T)this, low, high); and then do the correct casts in Range. The ReturnType would be the ReturnType of opIndex of the

Re: ini library in OSX

2014-10-13 Thread Robert burner Schadek via Digitalmars-d-learn
On Saturday, 11 October 2014 at 22:38:20 UTC, Joel wrote: On Thursday, 11 September 2014 at 10:49:48 UTC, Robert burner Schadek wrote: some self promo: http://code.dlang.org/packages/inifiled I would like an example? go to the link and scroll down a page

Re: Docs for PR

2014-09-16 Thread Robert burner Schadek via Digitalmars-d-learn
On Tuesday, 16 September 2014 at 08:26:57 UTC, Ilya Yaroshenko wrote: How generate documentation for phobos PR? http://wiki.dlang.org/Building_DMD has a section called building the docs. I properly missed something while writing that, but it is good starting point and the rest you will find

Re: Recomended cairo bindings

2014-09-14 Thread Robert burner Schadek via Digitalmars-d-learn
On Sunday, 14 September 2014 at 13:30:28 UTC, Paul Z. Barsan wrote: Hello, I want to use a cairo XlibSurface for painting in a project of mine and I don't know what bindings should I use. I've started with deimos.cairo which has a C-style syntax and works well on my linux machine. After I

std.conv checking if to will work

2014-09-11 Thread Robert burner Schadek via Digitalmars-d-learn
I like the to template a lot, but sometimes I want to make sure beforehand that a call to it works. Is there anything in phobos in missed to do that. And I don't want to try catch.

Re: std.conv checking if to will work

2014-09-11 Thread Robert burner Schadek via Digitalmars-d-learn
On Thursday, 11 September 2014 at 09:10:03 UTC, monarch_dodra wrote: There's an open request for it, and plans to have a bool maybeTo!(OUT, WHAT)(WHAT what, ref OUT out), but we aren't quite there yet. The idea is that *once* we have that, then to would simply become an enforce!maybeTo.

unit testing version statements

2014-08-22 Thread Robert burner Schadek via Digitalmars-d-learn
How do I unit test version statements without fixing version in place forever. bool fun() { version(Version1) return true; else version(Version2) return true; else return false; } version = Version1; unittest { assert(fun()); } version = Version2; unittest {

Re: unit testing version statements

2014-08-22 Thread Robert burner Schadek via Digitalmars-d-learn
On Friday, 22 August 2014 at 09:33:10 UTC, Kagamin wrote: Compile and run the tests with different version options. that is not an option