XPath chapter...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

XPath chapter...

Stephane Ducasse-3
Hi

I'm fully convinced that we can have the best language if we do not
let people find their way super easily to do what they want to do we
will fail.
Documentation is KEY and I feel a bit alone.

Since I always wanted to learn XPath I started to write a chapter on
XPath. I hope that I did not write too many mistakes.

Pull requests are welcome here
    https://github.com/SquareBracketAssociates/Booklet-Scraping

I would love to have one booklet on SAX and DOM handling.


Stef

scrapingbook.pdf (825K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: XPath chapter...

ghoetker
Thank you, Stef, for providing this (and all else you do).  As a very new
user, I agree completely with your comment about the importance of
documentation.  

I addition to the "Command/Package" based approach exemplified in this and
the other books, I'd encourage the community to also consider a
"Recipes/Cookbook" approach. I've linked to two examples below, but the
basic idea is an organized structure of

Problem: (E.g., I want to list all of the PDFs in a directory and its
sub-directories).
Solution: [Sample code, perhaps heavily commented to explain. May have a
basic and a more advanced code snippet]
Explanation: [An explanation of the sample code, if not provided in its
comments]

This approach is especially helpful when users may not be familiar with the
ecosystem, meaning they wouldn't even know where to start looking for an
answer. Also, some people learn best starting from specific problems.

I feel bad recommending that "Someone should do this..." when I'm not in a
position to help currently (heaviest teaching period of the year), but offer
this up for consideration.  


https://books.google.com/books?id=wVsnCgAAQBAJ&pg=PA192&lpg=PA192&dq=swift+recipe+list+directory&source=bl&ots=lhsrBeSG1C&sig=qAmvYYonS9DVkb-g6hxa0RemKgA&hl=en&sa=X&ved=0ahUKEwjij5eDxr7WAhUN62MKHTvBAC8Q6AEILTAB#v=onepage&q=swift%20recipe%20list%20directory&f=false
<https://books.google.com/books?id=wVsnCgAAQBAJ&pg=PA192&lpg=PA192&dq=swift+recipe+list+directory&source=bl&ots=lhsrBeSG1C&sig=qAmvYYonS9DVkb-g6hxa0RemKgA&hl=en&sa=X&ved=0ahUKEwjij5eDxr7WAhUN62MKHTvBAC8Q6AEILTAB#v=onepage&q=swift%20recipe%20list%20directory&f=false>  

https://iswift.org/cookbook/get-directory-contents
<https://iswift.org/cookbook/get-directory-contents>  



-----
Glenn Hoetker
[hidden email]
http://hoetker.faculty.asu.edu
--
Sent from: http://forum.world.st/Pharo-Smalltalk-Developers-f1294837.html

Glenn Hoetker
ghoetker@me.com
http://hoetker.faculty.asu.edu
Reply | Threaded
Open this post in threaded view
|

Re: XPath chapter...

Nicolas Anquetil
In reply to this post by Stephane Ducasse-3

To make all this documentation (booklets) more easily availbale, we
could create a link to them in pharo itself

for example as a special method, instance variable, or pragma (although
I hate pragmas) in the Manifest?

nicolas

On 24/09/2017 16:27, Stéphane Ducasse wrote:

 > Hi

 > I'm fully convinced that we can have the best language if we do not
 > let people find their way super easily to do what they want to do we
 > will fail.
 > Documentation is KEY and I feel a bit alone.

 > Since I always wanted to learn XPath I started to write a chapter on
 > XPath. I hope that I did not write too many mistakes.

 > Pull requests are welcome here
 > https://github.com/SquareBracketAssociates/Booklet-Scraping

 > I would love to have one booklet on SAX and DOM handling.

 > Stef

--
Nicolas Anquetil -- MCF (HDR)
Project-Team RMod


Reply | Threaded
Open this post in threaded view
|

Re: XPath chapter...

Sean P. DeNigris
Administrator
In reply to this post by ghoetker
ghoetker wrote
> Thank you, Stef, for providing this (and all else you do).  As a very new
> user, I agree completely with your comment about the importance of
> documentation.

+100!!!



-----
Cheers,
Sean
--
Sent from: http://forum.world.st/Pharo-Smalltalk-Developers-f1294837.html

Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: XPath chapter...

Stephane Ducasse-3
The problem is that people really like when others write documentation.
You see I did not know at all what was XPath before starting to write
this chapter.

Stef

On Tue, Sep 26, 2017 at 3:14 AM, Sean P. DeNigris <[hidden email]> wrote:

> ghoetker wrote
>> Thank you, Stef, for providing this (and all else you do).  As a very new
>> user, I agree completely with your comment about the importance of
>> documentation.
>
> +100!!!
>
>
>
> -----
> Cheers,
> Sean
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Developers-f1294837.html
>

Reply | Threaded
Open this post in threaded view
|

Re: XPath chapter...

monty-3
In reply to this post by Stephane Ducasse-3
Great effort. The guide is concise and beginner friendly. I emailed you a git commit patch you can apply with `git am` (I don't use github) that fixes some things and expands on others.

And for the record, I'm not "Monty Kamath" and I don't know him.

> Sent: Sunday, September 24, 2017 at 1:03 PM
> From: "Stephane Ducasse" <[hidden email]>
> To: "Pharo Development List" <[hidden email]>
> Subject: [Pharo-dev] XPath chapter...
>
> Hi
>
> I'm fully convinced that we can have the best language if we do not
> let people find their way super easily to do what they want to do we
> will fail.
> Documentation is KEY and I feel a bit alone.
>
> Since I always wanted to learn XPath I started to write a chapter on
> XPath. I hope that I did not write too many mistakes.
>
> Pull requests are welcome here
>     https://github.com/SquareBracketAssociates/Booklet-Scraping
>
> I would love to have one booklet on SAX and DOM handling.
>
>
> Stef
>

Reply | Threaded
Open this post in threaded view
|

Re: XPath chapter...

kilon.alios
Dont worry Stef you are not alone, I may no longer use Pharo as much I used to but I will keep stalking you :D 
So I have not quit from adding to the pharo documentation. You can at least expect some video tutorials, minor updated to PBE and minor updates to Pharo Wiki. 

Of course  I agree we need more people on this, if every pharo users jusr dedicated 10 minutes per day on documentations we would have a mind blowing documentation in quality and quanity. 

10 minutes is all it takes to update a page of documentation , 100 people, 100 pages per day.  36.500 pages per year and our documentation needing updating is not nowhere near this number

OR

10 minutes to write 100 words of documentation (average writting speed is 40 WPM but I dropped this down to 10 WPM to include research, testing, taking pictures , general foramt etc)  , thats about 1/3rd of  a page . 100 people. 30 pages per day. 10.950 pages per year. so that means with just 100 people contributing 10 minutes of their time per day  we could release around 20 NEW books per year !!!! 

I am sure Pharo has more than 100 users ;) 

On Wed, Oct 11, 2017 at 9:13 AM monty <[hidden email]> wrote:
Great effort. The guide is concise and beginner friendly. I emailed you a git commit patch you can apply with `git am` (I don't use github) that fixes some things and expands on others.

And for the record, I'm not "Monty Kamath" and I don't know him.

> Sent: Sunday, September 24, 2017 at 1:03 PM
> From: "Stephane Ducasse" <[hidden email]>
> To: "Pharo Development List" <[hidden email]>
> Subject: [Pharo-dev] XPath chapter...
>
> Hi
>
> I'm fully convinced that we can have the best language if we do not
> let people find their way super easily to do what they want to do we
> will fail.
> Documentation is KEY and I feel a bit alone.
>
> Since I always wanted to learn XPath I started to write a chapter on
> XPath. I hope that I did not write too many mistakes.
>
> Pull requests are welcome here
>     https://github.com/SquareBracketAssociates/Booklet-Scraping
>
> I would love to have one booklet on SAX and DOM handling.
>
>
> Stef
>

Reply | Threaded
Open this post in threaded view
|

Re: XPath chapter...

Stephane Ducasse-3
In reply to this post by monty-3
Thanks. I do not know which email address you sent you patch because I
did not receive it.
I do not read emails sent to my gmail account.

I do not know how to use git am so I will see because I'm quite
terribly busy in this moment.
You can also edit directly the file if you can.

Stef

On Wed, Oct 11, 2017 at 8:13 AM, monty <[hidden email]> wrote:

> Great effort. The guide is concise and beginner friendly. I emailed you a git commit patch you can apply with `git am` (I don't use github) that fixes some things and expands on others.
>
> And for the record, I'm not "Monty Kamath" and I don't know him.
>
>> Sent: Sunday, September 24, 2017 at 1:03 PM
>> From: "Stephane Ducasse" <[hidden email]>
>> To: "Pharo Development List" <[hidden email]>
>> Subject: [Pharo-dev] XPath chapter...
>>
>> Hi
>>
>> I'm fully convinced that we can have the best language if we do not
>> let people find their way super easily to do what they want to do we
>> will fail.
>> Documentation is KEY and I feel a bit alone.
>>
>> Since I always wanted to learn XPath I started to write a chapter on
>> XPath. I hope that I did not write too many mistakes.
>>
>> Pull requests are welcome here
>>     https://github.com/SquareBracketAssociates/Booklet-Scraping
>>
>> I would love to have one booklet on SAX and DOM handling.
>>
>>
>> Stef
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: XPath chapter...

Stephane Ducasse-3
In reply to this post by kilon.alios
On Wed, Oct 11, 2017 at 10:43 PM, Dimitris Chloupis
<[hidden email]> wrote:
> Dont worry Stef you are not alone, I may no longer use Pharo as much I used
> to but I will keep stalking you :D
> So I have not quit from adding to the pharo documentation. You can at least
> expect some video tutorials, minor updated to PBE and minor updates to Pharo
> Wiki.

thanks this is great


> Of course  I agree we need more people on this, if every pharo users jusr
> dedicated 10 minutes per day on documentations we would have a mind blowing
> documentation in quality and quanity.

exactly.


> 10 minutes is all it takes to update a page of documentation , 100 people,
> 100 pages per day.  36.500 pages per year and our documentation needing
> updating is not nowhere near this number
>
> OR
>
> 10 minutes to write 100 words of documentation (average writting speed is 40
> WPM but I dropped this down to 10 WPM to include research, testing, taking
> pictures , general foramt etc)  , thats about 1/3rd of  a page . 100 people.
> 30 pages per day. 10.950 pages per year. so that means with just 100 people
> contributing 10 minutes of their time per day  we could release around 20
> NEW books per year !!!!
>
> I am sure Pharo has more than 100 users ;)

:)


>
> On Wed, Oct 11, 2017 at 9:13 AM monty <[hidden email]> wrote:
>>
>> Great effort. The guide is concise and beginner friendly. I emailed you a
>> git commit patch you can apply with `git am` (I don't use github) that fixes
>> some things and expands on others.
>>
>> And for the record, I'm not "Monty Kamath" and I don't know him.
>>
>> > Sent: Sunday, September 24, 2017 at 1:03 PM
>> > From: "Stephane Ducasse" <[hidden email]>
>> > To: "Pharo Development List" <[hidden email]>
>> > Subject: [Pharo-dev] XPath chapter...
>> >
>> > Hi
>> >
>> > I'm fully convinced that we can have the best language if we do not
>> > let people find their way super easily to do what they want to do we
>> > will fail.
>> > Documentation is KEY and I feel a bit alone.
>> >
>> > Since I always wanted to learn XPath I started to write a chapter on
>> > XPath. I hope that I did not write too many mistakes.
>> >
>> > Pull requests are welcome here
>> >     https://github.com/SquareBracketAssociates/Booklet-Scraping
>> >
>> > I would love to have one booklet on SAX and DOM handling.
>> >
>> >
>> > Stef
>> >
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: XPath chapter...

jrick
NICE! I was just using XPath for Selenium testing. It is really great for that application (commanding a browser like Firefox or Chrome to simulate user actions). What are the applications for XPath in Pharo? Unit testing of generating markup?

Cheers,

Jeff

PS After spending significant time with other languages at work, I really have an appreciation of how wonderful Pharo is as a development environment.
Reply | Threaded
Open this post in threaded view
|

Re: XPath chapter...

Stephane Ducasse-3
I do not know. querying XML is already good for me.


> PS After spending significant time with other languages at work, I really
> have an appreciation of how wonderful Pharo is as a development environment.

This is why we should have more companies paying smart people doing
cool projects in Pharo.

Reply | Threaded
Open this post in threaded view
|

Re: XPath chapter...

hernanmd
In reply to this post by jrick
I don't know for Pharo development, but I used XPath in Pharo for
getting a textual description of gene ontology terms, for example:

#('GO:0005623' 'GO:0017071' 'GO:0030680') do: [ : goTerm |
    | xPath xmlDoc quickGO |
    quickGO := 'http://www.ebi.ac.uk/QuickGO-Old/GTerm?id={1}&format=oboxml'
format: { goTerm }.
    xmlDoc := (XMLDOMParser on: (ZnEasy get: quickGO) contents) parseDocument.
    xPath := XPath for: 'normalize-space(/obo/term/name/text())' in: xmlDoc.
    Transcript show: goTerm; tab; show: xPath; cr ].

Here you've got similar code in Perl and Java so you can compare:

https://www.ebi.ac.uk/QuickGO-Old/clients/download-term.pl
https://www.ebi.ac.uk/QuickGO-Old/clients/DownloadTerm.java

Best regards,

Hernán



2017-10-21 14:04 GMT-03:00 J.F. Rick <[hidden email]>:

> NICE! I was just using XPath for Selenium testing. It is really great for
> that application (commanding a browser like Firefox or Chrome to simulate
> user actions). What are the applications for XPath in Pharo? Unit testing of
> generating markup?
>
> Cheers,
>
> Jeff
>
> PS After spending significant time with other languages at work, I really
> have an appreciation of how wonderful Pharo is as a development environment.

Reply | Threaded
Open this post in threaded view
|

Re: XPath chapter...

jrick
Nice!

On Sun, Oct 22, 2017 at 11:53 PM Hernán Morales Durand <[hidden email]> wrote:
I don't know for Pharo development, but I used XPath in Pharo for
getting a textual description of gene ontology terms, for example:

#('GO:0005623' 'GO:0017071' 'GO:0030680') do: [ : goTerm |
    | xPath xmlDoc quickGO |
    quickGO := 'http://www.ebi.ac.uk/QuickGO-Old/GTerm?id={1}&format=oboxml'
format: { goTerm }.
    xmlDoc := (XMLDOMParser on: (ZnEasy get: quickGO) contents) parseDocument.
    xPath := XPath for: 'normalize-space(/obo/term/name/text())' in: xmlDoc.
    Transcript show: goTerm; tab; show: xPath; cr ].

Here you've got similar code in Perl and Java so you can compare:

https://www.ebi.ac.uk/QuickGO-Old/clients/download-term.pl
https://www.ebi.ac.uk/QuickGO-Old/clients/DownloadTerm.java

Best regards,

Hernán



2017-10-21 14:04 GMT-03:00 J.F. Rick <[hidden email]>:
> NICE! I was just using XPath for Selenium testing. It is really great for
> that application (commanding a browser like Firefox or Chrome to simulate
> user actions). What are the applications for XPath in Pharo? Unit testing of
> generating markup?
>
> Cheers,
>
> Jeff
>
> PS After spending significant time with other languages at work, I really
> have an appreciation of how wonderful Pharo is as a development environment.