Re: kxml and dub package manager.

2015-10-19 Thread Mike Parker via Digitalmars-d-learn
On Monday, 19 October 2015 at 03:33:18 UTC, holo wrote: ok i fugure out it. When i do initiation i need to add dependencies (thought it is enough to add them to sdl file). Proper initiation should look like that: dub init projectname kxml No, you should never need to do that. I think your

Re: kxml - parsing AWS API xml respond

2015-10-19 Thread Kagamin via Digitalmars-d-learn
Select parent tags and get data from their child tags like instanceId.

Re: kxml - parsing AWS API xml respond

2015-10-19 Thread holo via Digitalmars-d-learn
On Monday, 19 October 2015 at 11:53:08 UTC, Kagamin wrote: On Monday, 19 October 2015 at 04:49:25 UTC, holo wrote: Why there is needed that "//" before tag? That's an XPath expression. Need, to read about that XPaths. How to drop tags from respond? I have such result of parsing by id

Re: kxml - parsing AWS API xml respond

2015-10-19 Thread holo via Digitalmars-d-learn
Sorry i was trying to use that XPaths to take out instanceId and laounchTime but i always get an empty respond. //instanceId/launchTime" - empty //instanceId/* - empty too //instanceId.launchTime - empty too How to take instance id and variable which im interest in or few/all for

Re: kxml - parsing AWS API xml respond

2015-10-19 Thread Kagamin via Digitalmars-d-learn
On Monday, 19 October 2015 at 04:49:25 UTC, holo wrote: Why there is needed that "//" before tag? That's an XPath expression. How to drop tags from respond? I have such result of parsing by id tag: i-xx I need only value. Is there some equivalent to ".text" from std.xml? Try

Re: kxml and dub package manager.

2015-10-19 Thread holo via Digitalmars-d-learn
On Monday, 19 October 2015 at 06:20:19 UTC, Mike Parker wrote: On Monday, 19 October 2015 at 03:33:18 UTC, holo wrote: ok i fugure out it. When i do initiation i need to add dependencies (thought it is enough to add them to sdl file). Proper initiation should look like that: dub init

Re: kxml - parsing AWS API xml respond

2015-10-19 Thread holo via Digitalmars-d-learn
On Monday, 19 October 2015 at 12:54:52 UTC, Kagamin wrote: Select parent tags and get data from their child tags like instanceId. void main() { string xmlstring = cast(string)read("test.xml"); XmlNode newdoc = xmlstring.readDocument(); XmlNode[] searchlist =

Enough introspection to report variable name of calling argument

2015-10-19 Thread Handyman via Digitalmars-d-learn
Is the following possible in D? To call a (unary) function f with variable a, and let f print: Called with argument named 'a'. I am of course asking for a generic solution, independent of the actual variable name (in this case, 'a'). I am aware that I am likely asking the impossible

Re: foreach loop

2015-10-19 Thread Dominikus Dittes Scherkl via Digitalmars-d-learn
On Monday, 19 October 2015 at 14:28:06 UTC, Namal wrote: Is it possible to create a foreach loop with a breakstetemen? I mean something like that for the second loop where i want to break if element from: int [] g = [9,15,21]; int [] v = [2,3,5,7,8,9,11,13,17,19]; foreach(j;1..10) for(int

Re: foreach loop

2015-10-19 Thread Rikki Cattermole via Digitalmars-d-learn
On 20/10/15 3:28 AM, Namal wrote: Is it possible to create a foreach loop with a breakstetemen? I mean something like that for the second loop where i want to break if element from: int [] g = [9,15,21]; int [] v = [2,3,5,7,8,9,11,13,17,19]; foreach(j;1..10) for(int i = 0; v[i]

Check Instance of Template for Parameter Type/Value

2015-10-19 Thread Stewart Moth via Digitalmars-d-learn
I'm working with a library that has template structs of mathematical vectors that can sometimes be the type of an array I'm passing to a function. The definition of the struct is like this: struct Vector(type, int dimension_){ ... } Where type is going to be an int/float/etc and dimension_

Re: Enough introspection to report variable name of calling argument

2015-10-19 Thread anonymous via Digitalmars-d-learn
On Monday, October 19, 2015 04:14 PM, Handyman wrote: > Is the following possible in D? To call a (unary) function f > with variable a, and let f print: > >> Called with argument named 'a'. > > I am of course asking for a generic solution, independent of the > actual variable name (in this

Re: Check Instance of Template for Parameter Type/Value

2015-10-19 Thread anonymous via Digitalmars-d-learn
On Monday, October 19, 2015 04:51 PM, Stewart Moth wrote: > struct Vector(type, int dimension_){ ... } > > Where type is going to be an int/float/etc and dimension_ is > 2/3/4. > > I could write a bunch of functions for each case, but I'd rather > not... I'd like to use something like the

foreach loop

2015-10-19 Thread Namal via Digitalmars-d-learn
Is it possible to create a foreach loop with a breakstetemen? I mean something like that for the second loop where i want to break if element from: int [] g = [9,15,21]; int [] v = [2,3,5,7,8,9,11,13,17,19]; foreach(j;1..10) for(int i = 0; v[i]

Re: foreach loop

2015-10-19 Thread Daniel Kozak via Digitalmars-d-learn
V Mon, 19 Oct 2015 14:28:03 + Namal via Digitalmars-d-learn napsáno: > Is it possible to create a foreach loop with a breakstetemen? > > I mean something like that for the second loop where i want to > break if element from: > > int [] g = [9,15,21]; >

Re: Check Instance of Template for Parameter Type/Value

2015-10-19 Thread Justin Whear via Digitalmars-d-learn
On Mon, 19 Oct 2015 14:51:28 +, Stewart Moth wrote: > I'm working with a library that has template structs of mathematical > vectors that can sometimes be the type of an array I'm passing to a > function. > > The definition of the struct is like this: > > struct Vector(type, int

Re: kxml - parsing AWS API xml respond

2015-10-19 Thread Kagamin via Digitalmars-d-learn
If you don't want parent tag, then: XmlNode[] searchlist2 = newdoc.parseXPath("//launchTime");

Re: foreach loop

2015-10-19 Thread Namal via Digitalmars-d-learn
On Monday, 19 October 2015 at 14:43:04 UTC, Rikki Cattermole wrote: On 20/10/15 3:28 AM, Namal wrote: Is it possible to create a foreach loop with a breakstetemen? I mean something like that for the second loop where i want to break if element from: int [] g = [9,15,21]; int [] v =

Re: foreach loop

2015-10-19 Thread Namal via Digitalmars-d-learn
Is it possible to use foreach backwards? foreach(int i;20..1) writeln(i); compiles but I get nothing.

Re: std.algorithm.startsWith only predicate

2015-10-19 Thread Nordlöw via Digitalmars-d-learn
On Sunday, 18 October 2015 at 21:44:57 UTC, Jonathan M Davis wrote: startsWith doesn't have an overload that takes only a predicate. The existing overloads all require at least one "needle" to search for in the "haystack." An overload that doesn't require a needle could certainly be added, but

Re: kxml - parsing AWS API xml respond

2015-10-19 Thread holo via Digitalmars-d-learn
On Monday, 19 October 2015 at 16:12:56 UTC, Kagamin wrote: If you don't want parent tag, then: XmlNode[] searchlist2 = newdoc.parseXPath("//launchTime"); I wanted parent tag, i think. I almost figure out what i needed, but getCData stops working :/ void main() { string xmlstring =

Re: kxml - parsing AWS API xml respond

2015-10-19 Thread holo via Digitalmars-d-learn
I have no idea what i'm doing, but i did it (i just choose 1 element of array): void main() { string xmlstring = cast(string)read("test.xml"); XmlNode newdoc = xmlstring.readDocument(); XmlNode[] searchlist = newdoc.parseXPath(`//instancesSet/item`); foreach(list;

Re: foreach loop

2015-10-19 Thread novice2 via Digitalmars-d-learn
On Monday, 19 October 2015 at 15:56:00 UTC, Namal wrote: Is it possible to use foreach backwards? yes http://dlang.org/statement.html#ForeachStatement http://dpaste.dzfl.pl/cf847a9e1595

Re: foreach loop

2015-10-19 Thread Mike Parker via Digitalmars-d-learn
On Monday, 19 October 2015 at 15:56:00 UTC, Namal wrote: Is it possible to use foreach backwards? foreach(int i;20..1) writeln(i); compiles but I get nothing. foreach_reverse(i; 1 .. 20) writeln(i); Or: import std.range : iota, retro; foreach(i; iota(1, 20).retro) writeln(i); But