Re: about std.csv and derived format

2012-03-01 Thread bioinfornatics
Le jeudi 01 mars 2012 à 04:36 +0100, Jesse Phillips a écrit : On Thursday, 1 March 2012 at 02:07:44 UTC, bioinfornatics wrote: It is ok i have found a way maybe is not an efficient way but it works: https://gist.github.com/1946669 a minor bug exist for parse track line will be fixed

Re: about std.csv and derived format

2012-03-01 Thread Jesse Phillips
On Thursday, 1 March 2012 at 10:09:55 UTC, bioinfornatics wrote: and how convert bedInstances input array to BedData11[] ? std.array.array()

Should uniform(-real.max, real.max) be inf?

2012-03-01 Thread Magnus Lie Hetland
What's the preferred way of generating a random floating-point number in the range of a given floating-point type? We have uniform!T() for integral types, but nothing similar for floats? And uniform(-real.max, real.max) (possibly tweaking the limits) seems to only return inf, which isn't

Re: Should uniform(-real.max, real.max) be inf?

2012-03-01 Thread Magnus Lie Hetland
On 2012-03-01 10:52:49 +, Magnus Lie Hetland said: I could just use uniform(cast(T) -1, cast(T) 1)*T.max I guess (for some floating-point type T). Seems to work fine, at least. Aaactually, not so much. The output here seems to get about the same exponent as T.max. Which isn't all

SysTime in a Struct

2012-03-01 Thread albatroz
Hi, I have defined this struct struct preEv { string edate; //010112 string etime; //00:00:00 string etext; // SysTime esystime; this (this) { SysTime esystime = SysTime(DateTime( Clock.currTime.year, to!int(this.edate[2..4]),

Dumb question about git

2012-03-01 Thread H. S. Teoh
OK, so I'm new to git, and I ran into this problem: - I forked druntime on github and made some changes in a branch - Pushed the changes to the fork - Pulled upstream commits to master - Merged master with branch - Ran git rebase master, so that my changes appear on top of the latest upstream

Re: Dumb question about git

2012-03-01 Thread Kevin Cox
When people say git encourages rewriting history. Don't listen. Once you have pushed your changes to the world they are immutable. This is because git uses cryptography internally and changing the history messes everything up. If you haven't pushed you can change all of your history and it

Re: SysTime in a Struct

2012-03-01 Thread Ali Çehreli
On 03/01/2012 06:15 AM, albatroz wrote: Hi, I have defined this struct struct preEv { string edate; //010112 string etime; //00:00:00 string etext; // SysTime esystime; That is a member of this type. this (this) { SysTime esystime = SysTime(DateTime( That is a separate local variable

Re: Should uniform(-real.max, real.max) be inf?

2012-03-01 Thread Ali Çehreli
On 03/01/2012 02:52 AM, Magnus Lie Hetland wrote: What's the preferred way of generating a random floating-point number in the range of a given floating-point type? We have uniform!T() for integral types, but nothing similar for floats? And uniform(-real.max, real.max) (possibly tweaking the

Re: Regarding std.array.Appender

2012-03-01 Thread Timon Gehr
On 03/01/2012 03:40 AM, Jonathan M Davis wrote: On Wednesday, February 29, 2012 21:23:54 bearophile wrote: Jonathan M Davis: put is a function on output ranges, and Appender is an output range. Also, given that it doesn't define ~ (and it wouldn't really make sense for it to), it would be

Re: Dumb question about git

2012-03-01 Thread Dmitry Olshansky
On 01.03.2012 19:11, H. S. Teoh wrote: OK, so I'm new to git, and I ran into this problem: - I forked druntime on github and made some changes in a branch - Pushed the changes to the fork I use the magic pull --rebase how-ever-you-call-dlang master instead of these 3 if I have changes but

Re: SysTime in a Struct

2012-03-01 Thread albatroz
Have fixed the segfault by using DateTime instead of SysTime. That is a separate local variable within this(this). Also, this(this) is the postblit (similar to a copy constructor). Is that what you want to define? No, but not using this(this) will fail to build with: static variable

Re: Dumb question about git

2012-03-01 Thread H. S. Teoh
On Thu, Mar 01, 2012 at 10:22:33AM -0500, Kevin Cox wrote: When people say git encourages rewriting history. Don't listen. Once you have pushed your changes to the world they are immutable. This is because git uses cryptography internally and changing the history messes everything up. If

Re: Dumb question about git

2012-03-01 Thread Kevin Cox
On Mar 1, 2012 12:15 PM, H. S. Teoh hst...@quickfur.ath.cx wrote: On Thu, Mar 01, 2012 at 10:22:33AM -0500, Kevin Cox wrote: When people say git encourages rewriting history. Don't listen. Once you have pushed your changes to the world they are immutable. This is because git uses

Re: SysTime in a Struct

2012-03-01 Thread Ali Çehreli
On 03/01/2012 09:14 AM, albatroz wrote: Have fixed the segfault by using DateTime instead of SysTime. That is a separate local variable within this(this). Also, this(this) is the postblit (similar to a copy constructor). Is that what you want to define? No, but not using this(this) will

Re: Dumb question about git

2012-03-01 Thread Trass3r
OK, so what's the right way to do it then? I have some changes in a branch, but master has been updated since, so I want to merge in the latest updates so that the branch changes are compatible with the latest code. I use a quite crappy way to rebase my feature branch: git stash git checkout

Using lazily ?

2012-03-01 Thread bioinfornatics
dear, Noob question for know if D provide a shorter way i explain we have a struct S: struct S{ string member1; string member2; string member3; } we parse a file: File f = File(a path, r); S s; sise_t tokenLength = member1.length; foreach( char[] line; f.byLine() )

Re: Using lazily ?

2012-03-01 Thread Timon Gehr
On 03/01/2012 10:50 PM, bioinfornatics wrote: dear, Noob question for know if D provide a shorter way i explain we have a struct S: struct S{ string member1; string member2; string member3; } we parse a file: File f = File(a path, r); S s; sise_t tokenLength =

Re: Dumb question about git

2012-03-01 Thread Jonathan M Davis
On Thursday, March 01, 2012 09:17:18 H. S. Teoh wrote: On Thu, Mar 01, 2012 at 10:22:33AM -0500, Kevin Cox wrote: When people say git encourages rewriting history. Don't listen. Once you have pushed your changes to the world they are immutable. This is because git uses cryptography

Re: SysTime in a Struct

2012-03-01 Thread Jonathan M Davis
On Thursday, March 01, 2012 15:15:00 albatroz wrote: Hi, I have defined this struct struct preEv { string edate; //010112 string etime; //00:00:00 string etext; // SysTime esystime; this (this) { SysTime esystime = SysTime(DateTime( Clock.currTime.year, to!int(this.edate[2..4]),

Re: Using lazily ?

2012-03-01 Thread bioinfornatics
Le jeudi 01 mars 2012 à 23:10 +0100, Timon Gehr a écrit : S s; size_t tokenLength = member1.length; void main(){ foreach(char[] line; stdin.byLine()) foreach(m;__traits(allMembers,S)){ if(line[0..tokenLength] == m) mixin(s.~m) = line[tokenLength .. $].idup; } }

Re: Using lazily ?

2012-03-01 Thread Ali Çehreli
On 03/01/2012 02:25 PM, bioinfornatics wrote: Le jeudi 01 mars 2012 à 23:10 +0100, Timon Gehr a écrit : S s; size_t tokenLength = member1.length; void main(){ foreach(char[] line; stdin.byLine()) foreach(m;__traits(allMembers,S)){ if(line[0..tokenLength] == m) mixin(s.~m) =

Re: Regarding std.array.Appender

2012-03-01 Thread Sönke Ludwig
Am 01.03.2012 03:40, schrieb Jonathan M Davis: On Wednesday, February 29, 2012 21:23:54 bearophile wrote: Jonathan M Davis: put is a function on output ranges, and Appender is an output range. Also, given that it doesn't define ~ (and it wouldn't really make sense for it to), it would be

Re: Using lazily ?

2012-03-01 Thread bearophile
Ali: Note that Timon's inner foreach is a compile-time foreach, which is the equivalent of the following three lines: I'd like it to be written: static foreach (...) {... In the meantime an annotation helps clarify the code for the person that will read the code: /*static*/ foreach (...)

Re: SysTime in a Struct

2012-03-01 Thread albatroz
Are you trying to record the time when a prevEv is copied from another one? If not, I suggest not defining this(this). It is the postblit, to make things right for rare structs and only when the compiler generated copying is wrong for a that type. Or, are you just trying to define a type that

Re: SysTime in a Struct

2012-03-01 Thread Ali Çehreli
On 03/01/2012 03:46 PM, albatroz wrote: Hi Ali, just tring to define a type that holds this information. It was just an attempt to create a type DateTime with the values from the known strings, I thought it was possible to create the definition directly in the Struct, with no need for an

Re: SysTime in a Struct

2012-03-01 Thread Jonathan M Davis
On Thursday, March 01, 2012 16:00:09 Ali Çehreli wrote: On 03/01/2012 03:46 PM, albatroz wrote: Hi Ali, just tring to define a type that holds this information. It was just an attempt to create a type DateTime with the values from the known strings, I thought it was possible to create the

Re: Dumb question about git

2012-03-01 Thread Daniel Murphy
Unless you have an expectation that other people are already using the old version of your branch, just use 'git push blah -f' to overwrite the old version. It's not a big deal for patches and pull requests, but it would be a disaster if anyone did this to the master branch. H. S. Teoh

Char * character and string

2012-03-01 Thread Chris Pons
Hello, I am trying to work with SDL and one of their functions takes a char * file as a function a parameter. However, i'm running into trouble how to actually set this variable in my constructor. I am getting a problem where if I use a pointer to a char and set it as test.bmp I get an error

Re: Char * character and string

2012-03-01 Thread Jonathan M Davis
On Friday, March 02, 2012 05:51:14 Chris Pons wrote: Hello, I am trying to work with SDL and one of their functions takes a char * file as a function a parameter. However, i'm running into trouble how to actually set this variable in my constructor. I am getting a problem where if I use a

Re: Char * character and string

2012-03-01 Thread Chris Pons
Thank you for the reply. However, I've run into another problem. I changed: --- char * file; this() { this.filename = test.bmp; } --- To: char * file this() { this.filename = toStringz(test.bmp); } --- I am getting this error:

Cocoa bindings?

2012-03-01 Thread Alex Rønne Petersen
Hi, Are there any actively-maintained Cocoa bindings for D? -- - Alex

Re: Char * character and string

2012-03-01 Thread Jonathan M Davis
On Friday, March 02, 2012 06:22:41 Chris Pons wrote: Thank you for the reply. However, I've run into another problem. I changed: --- char * file; this() { this.filename = test.bmp; } --- To: char * file this() { this.filename =

Re: Char * character and string

2012-03-01 Thread Chris Pons
Ok, got it all sorted. Thank you for the guidance.

Re: Cocoa bindings?

2012-03-01 Thread James Miller
On 2 March 2012 18:52, Alex Rønne Petersen xtzgzo...@gmail.com wrote: Hi, Are there any actively-maintained Cocoa bindings for D? -- - Alex Not as far as I know. You should make some! -- James Miller