You may want to take a look at the httpget.ijs script.

  http://www.jsoftware.com/jwiki/Scripts/HTTP_Get

> the number of messages for its month: "Messages: 357".

   load '~user/httpget.ijs'
   require 'regex'

   A=: 
httpget'http://www.jsoftware.com/pipermail/programming/2007-October/thread.html'

   'Messages:[^0-9]*([0-9]+)' (,.@:{:@rxmatch ];.0 ]) A
357




----- Original Message ----
> From: Brian Schott <[EMAIL PROTECTED]>
> To: Programming forum <[email protected]>
> Sent: Saturday, July 12, 2008 3:23:05 PM
> Subject: [Jprogramming] Sockets and internet question
> 
>     The context of this problem is described in the
> forwarded message far below. I am attempting to read the
> archive files using a coding model suggested in the Sockets
> and internet Lab, but I am running into the following value
> error which seems to occur in the verb "conn" in the script
> 'system\examples\socket\socklab.ijs' :
> 
> ***************begin typical J session******************
>    load '/Users/brian/readjdata.ijs'
>    readdata yearmonth 5 3 15
> |value error: sdgethostbyname
> |   0~:s=.>{.x=.    sdgethostbyname host
> ***************end typical J session******************
> 
>     My script "readjdata.ijs" is as follows.
> 
> ***************begin script******************
> NB. readjdata.ijs
> NB. 7/11/8
> 
> load'socket'
> coinsert'socket'
> require '~system\examples\socket\socklab.ijs'
> 
> months =: <;._2 ]0 : 0
> January
> February
> March
> April
> May
> June
> July
> August
> September
> October
> November
> December
> )
> 
> yrsmths =: 12 12&#:
> NB.* year v
> NB.  monad triple: start year after 2000
> NB.                start month (eg. April = 4)
> NB.                number of months
> NB.  year 3 4 15 is start at 2003-April and contain 15 months
> year =: 2000+{.+({:{.(1&{|.(12&[EMAIL PROTECTED], 12&#)&{.)& [EMAIL 
> PROTECTED]:)
> 
> NB.* month v
> NB. monad triple: same inputs as year triple
> month =: <:@(1&{) 12&|@+ [EMAIL PROTECTED]:
> 
> NB. sample usages:
> NB. months{~month 3 4 15
> NB. ;/@('-',.~":)@,[EMAIL PROTECTED] 3 4 15
> 
> yearmonth =: ,each/@(;/@('-',.~":)@,[EMAIL PROTECTED],:months{~month)
> NB.  yearmonth 3 4 15
> 
> urlhead =: <'www.jsoftware.com/pipermail/programming/'
> urltail =: <'/thread.html'
> 
> readdata =: monad define
>   result =: i. 0
>   yy =. ;"1 urlhead,.y,.urltail
>   for_xx. yy
>   do.
>     result =. result, ".' ' taketo 'Messages: ' dropto toJ 0 webget xx
>   end.
> )
> 
> Note 'demo'
> readdata yearmonth 5 3 15
> )
> ***************end script******************
> 
>     I would appreciate help eliminating the value error
> or suggestions for an alternative approach.
> 
> 
> ---------- Forwarded message ----------
> Date: Thu, 10 Jul 2008 13:10:12 -0400 (EDT)
> From: Brian Schott 
> To: General forum 
> Subject: Re: [Jgeneral] Re: Forum traffic
> 
>     The link below is typical of ones I would like to
> read because in produces a line for each month that gives
> the number of messages for its month: "Messages: 357".  So I
> would like to have suggestions for how to read (at least the
> first few lines) of all such files from the web as a text
> file in such a way that I can extract the key line from each
> into a single file for stats anaylysis. By all such files I
> mean the ones that are like the following link, but for
> which the yyyy-month phrase is all that differs.
> 
> 
> http://www.jsoftware.com/pipermail/programming/2007-October/thread.html
> 
> TIA,
> 
> 
> --
> 
> (B=)
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm



      
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to