Until the dust settles and necessary code is in standard library and
procedures are documented in a wiki page, the discussion in beta will drive
how we transfer stuff for J iOS.

To simplify discussion we'll talk about desktop and iPad.

First, put the script at the end of this message in your desktop J
~temp/jt.ijs.

To transfer a script from desktop to iPad:
   load'~temp/jt.ijs'
   jattach '.... file you want to move to iPad'
   send email to yourself with attachment ~temp/jattach.html

   read email on iPad
   tap jattach.html
   tap hold to select all
   tap copy
   jcbtof '~temp/t.ijs' NB. put clipboard data in file
      or to edit immediately
   je jcbtof '~temp/t.ijs'

To transfer a script from iPad to desktop:
   je '..... script'
   tap hold - select all - copy
   send email with pasted contents
   ...

Use jt to transfer a folder of files. jt is similar to tar. It creates a
single file with the info necessary to recreate a folder.
   jt '' NB. jt help
   jt 'c';'~temp/t.jt';'~addond/math';'misc' NB. create single file from
addon

   transfer single file to iPAD

   jcbtof 't.jt'
   jt 'x';'~t.jt';'~addons'

An interesting alternative to email is www.gethopper.com. With a hopper
account you can drag files to hopper and then get them from hopper on your
iPad.

Your help in refining and streamlining these steps will be much appreciated.


*** ~temp/jt.ijs
jattach_z_=: 3 : 0
t=. '<html><head>'
t=. t,'<meta http-equiv="Content-type" content="text/html;charset=UTF-8">'
t=. t,'<title>TITLE</title></head><body><div class="section"><h1>NB.
TITLE</h1>'
t=. t,'DATA</div></body></html>'
t=. t rplc 'TITLE';y
d=. toJ fread y
d=. d rplc '&';'&amp;'
d=. d rplc '<';'&lt;'
d=. d rplc LF;'<br>',LF
NB.! need to fix d < & LF
t=. t rplc 'DATA';d
t fwrite '~temp/jattach.html'
i.0 0
)


jt_z_=: 3 : 0
if. ''-:y do.
 smoutput'jt packs/uppacks text files'
 smoutput'jt ''c'';''~temp/test.jt'';''~system'';''util'''
 smoutput'jt ''t'';''~temp/test.jt'''
 smoutput'jt ''x'';''~temp/test.jt'';''~temp/test'''
 i.0 0
 return.
end.
t=. >{.y
f=. >1{y
a=. LF,'NB. ********** jta '
z=. LF,'NB. ********** jtz '
r=. ''
select. {.>{.y
case. 'c' do.
 assert. 4=#y['needs 4 paramters'
 'file path folder'=. }.y
 assert 2=ftype path['path must exist'
 '' fwrite file
 path=. jpath path
 base=. path,'/',folder
 d=. {."1 dirtree base
 files=. (>:#path)}.each d
 for_f. files do.
  f=. >f
  d=. toJ fread path,'/',f
  if. +./((32{.a.)-.TAB,CRLF)e.d do.
   smoutput 'file with non-char bytes ignored: ',f
  else.
   r=.r,<f
   d=. ((a,f,LF),d,z,f,LF) fappend file
  end.
 end.
fcase. 'x' do.
 assert 3=#y['x needs 3 parameters'
 path=. >{:y
 y=. }:y
case. 't' do.
 assert 2<:#y['t needs 2 parameters'
 d=. toJ fread f
 while. d do.
  i=. (a E. d)i.1
  if. i=#d do. r return. end.
  d=. i}.d
  d=. (#a)}.d
  i=. d i. LF
  f=. i{.d
  r=. r,<f
  d=. }.i}.d
  i=. ((z,f,LF) E. d)i.1
  if. i=#d do. r return. end.
  fd=. i{.d
  d=. i}.d
  if. t='x' do.
   p=. path,'/',f
   for_n. I. p='/' do. 1!:5 :: [ <jpath n{.p end.
   assert (#fd)=fd fwrite p
  end.
 end.
case.     do.
 assert 0['unsupported feature'
end.
r
)
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to