There was a problem with & nbsp; displaying as blank
in my mail reader.  So that explains that.

I went to the archive 
http://www.jsoftware.com/pipermail/beta/2010-March/003854.html
to get the code.  It still produces HTML that goes down
then across, rather than the correct across then down.

Anyway I am not too interested in why there is this
discrepancy, since the code now works.



----- Original Message -----
From: "Sherlock, Ric" <[email protected]>
Date: Tuesday, March 30, 2010 15:25
Subject: Re: [Jbeta] displaying boxed array in html
To: Beta forum <[email protected]>

> I've tried the posted code again and it works fine for me. It 
> also seems to handle the multiple space issue that you raise 
> below (see output in last email). Perhaps there is an issue with 
> line-wrapping in the email?
> 
> > From: Roger Hui
> > 
> > This is what I got from your e-mailed code:
> > 
> > <style type="text/css"> ...</style>
> > 
> > <table class="jarray"><tbody>
> >  <tr>
> >   <td><div class="jarray">0</div></td>
> >   <td><div 
> class="jarray">24</div></td></tr>>  
> <tr><td><div class="jarray">12</div></td>
> >   <td><div 
> class="jarray">36</div></td></tr>>  <tr
> > 
> class="spacer"><td> </td><td> </td><td> </td><td> <> /td></tr>
> >  <tr>
> >   <td><div class="jarray">1</div></td>
> >   <td><div 
> class="jarray">25</div></td></tr>>  <tr>
> >   <td><div class="jarray">13</div></td>
> >   <td><div 
> class="jarray">37</div></td></tr>> ...
> > 
> > Another problem was that the code did not handle
> > multiple spaces (by replacing with & nbsp;, say),
> > which the browser will render as a single space.
> > (Try it on  2 2 3 $ (i.&.>i.6),<<2 5$'a   
> efghij' .)
> > 
> > Anyway the code in the Jwiki essay works fine.
> > Thank you for your HTML ideas.
> > 
> > 
> > 
> > ----- Original Message -----
> > From: "Sherlock, Ric" <[email protected]>
> > Date: Tuesday, March 30, 2010 13:42
> > Subject: Re: [Jbeta] displaying boxed array in html
> > To: Beta forum <[email protected]>
> > 
> > > > From: Roger Hui
> > > >
> > > > Thanks.  I see that the code below has some obvious
> > > > problems (e.g. the display of <"0 i.2 2 3 4 has the 0 1 
> 2 ...
> > > > going down then across, rather than across then down,
> > > > as in the ": display).
> > >
> > > Curious. I don't see that problem when I copy the code in my
> > > email to a new J session and run:
> > >    JARRAYSTYLE, dispArray <"0 i.2 2 3 4
> > > I get the following output (abbreviated and whitespace added to
> > > show structure).
> > >
> > > <style type="text/css">
> > > .jarray {font-family:monospace;}
> > > table.jarray {border-collapse:collapse;}
> > > table.jarray td {border:solid black thin;vertical-align:
> > > top;padding:0.3em;}table.jarray tr.spacer td {border:none;}
> > > </style>
> > > <table class="jarray"><tbody>
> > >   <tr>
> > >     <td><div class="jarray">0</div></td>
> > >     <td><div class="jarray">1</div></td>
> > >     <td><div class="jarray">2</div></td>
> > >     <td><div
> > > class="jarray">3</div></td></tr>  <tr>
> > >     <td><div class="jarray">4</div></td>
> > >     <td><div class="jarray">5</div></td>
> > >     <td><div class="jarray">6</div></td>
> > >     <td><div
> > > class="jarray">7</div></td></tr>
> > > ...
> > >   <tr>
> > >     <td><div class="jarray">40</div></td>
> > >     <td><div class="jarray">41</div></td>
> > >     <td><div class="jarray">42</div></td>
> > >     <td><div
> > > class="jarray">43</div></td></tr>  <tr>
> > >     <td><div class="jarray">44</div></td>
> > >     <td><div class="jarray">45</div></td>
> > >     <td><div class="jarray">46</div></td>
> > >     <td><div
> > > class="jarray">47</div></td></tr></tbody></table>
> > >
> > > Were there other problems?
> > >
> > > > But the HTML ideas do work
> > > > (border collapse, vertical alignment, etc.).
> > > > I will incorporate these ideas with my code.
> > > >
> > > > I should point out that in this case I favor shorter code
> > > > rather than shorter output.  So for example I am not
> > > > too bothered by an extra layer of <table>...</table>.
> > >
> > > Given that the length and complexity of the output that will
> > > determine the transmission time and time to render in the
> > > browser, I think that it is worthy of some consideration. Anyway
> > > your new versions remove with the extra layer of nested tables
> > > so the point is moot.
> > >
> > >
> > > > ----- Original Message -----
> > > > From: "Sherlock, Ric"
> > > > Date: Tuesday, March 30, 2010 4:38
> > > > Subject: Re: [Jbeta] displaying boxed array in html
> > > > To: Beta forum <[email protected]>
> > > >
> > > > > > > Roger Hui wrote:
> > > > > > > For the 5 examples I listed, can you produce 
> programmatically> > > > > > (not by hand) results that "look 
> like" what the monad ":
> > > > produces?
> > > > > > > Also, can all the lines have the same width?  Currently
> > > > > the interior
> > > > > > > lines are thicker than the external ones.
> > > > > > >
> > > > > > > Otherwise it looks promising.
> > > > >
> > > > > > I wrote:
> > > > > >
> > > > > > Next step is to handle the nested examples as well.
> > > > > >
> > > > >
> > > > > The following seems to work ok. The obvious exception 
> being that
> > > > > the alignment of row heights between planes is not achieved.
> > > > >
> > > > > Note 'tests'
> > > > > JARRAYSTYLE, dispArray i.2 2 3 4
> > > > > JARRAYSTYLE, dispArray <"0 i.2 2 3 4
> > > > > JARRAYSTYLE, dispArray 5!:2 <'assert'
> > > > > JARRAYSTYLE, dispArray 2 3 4 $ i.&.> i.7
> > > > > JARRAYSTYLE, dispArray x=: 2 2 3 $ (i.&.>i.6),<<2
> > > 5$'abcdefghij'> > )
> > > > >
> > > > > require 'strings'
> > > > >
> > > > > sh     =: (*/@}: , {:)@(1&,)@$ ($,) ]
> > > > > rows   =: */\...@}:@$
> > > > > bl     =: }.@(,&0)@(+/)@(0&=)@(|/ i...@{.@(,&1))
> > > > > mask   =: 1&,. #&, ,.&0@>:@i...@#
> > > > > mat    =: m...@bl@rows { ' ' , sh
> > > > >
> > > > > JARRAYSTYLE=: 0 : 0
> > > > > <style type="text/css">
> > > > > .jarray {font-family:monospace;}
> > > > > table.jarray {border-collapse:collapse;}
> > > > > table.jarray td {border:solid black thin;vertical-align:
> > > > > top;padding:0.3em;}table.jarray tr.spacer td {border:none;}
> > > > > </style>
> > > > > )
> > > > >
> > > > > dispSimpArray=: 3 : 0
> > > > >   t=. mat ": y
> > > > >   t=. _4}., t ,"1 '<br>'
> > > > >   t=. t rplc ' ';' '
> > > > >   '<div class="jarray">',t,'</div>'
> > > > > )
> > > > >
> > > > > dispBoxArray=: 3 : 0
> > > > >   if. 0 = L. y do. y return. end.
> > > > >   t=. dispBoxArray^:(0 < L.)&.> y
> > > > >   cols=. {:$ t
> > > > >   t=. (,&.>/)"1 ('<td>', ,&'</td>') &.> t
> > > > >   t=. (,&.>/)"1 ('<tr>', ,&'</tr>') &.> t
> > > > >   s=. '<tr class="spacer">',(cols ((* #) $
> > > > > ])'<td> </td>'),'</tr>'  while. 0 < #$ t do.
> > > > >     t=. ([ , s , ])&.>/"1 t
> > > > >     s=. s,s
> > > > >   end.
> > > > >   '<table
> > > > > class="jarray"><tbody>',(>t),'</tbody></table>')
> > > > >
> > > > > dispArray=: [: dispBoxArray dispSimpArray L:0
> > ---------------------------------------------------------------
> -------
> > For information about J forums see 
> http://www.jsoftware.com/forums.htm------------------------------
> ----------------------------------------
> 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