J iOS (iPhone/iPad/iPod) has been at the app store for nearly a year now.
It has been installed more than 4000 times and the install rate is steady!
Moving content (scripts) between desktop/iOS has been a nuisance. The
only Apple approved method is copy/paste. A bug and a mail client
misunderstanding made the process more difficult than necessary. These
issues are resolved.
The bug was that J iOS truncated content copied to the clipboard. The
iOS mail client (safari gmail mobile) is limited in copying content,
but using an attachment is an easy workaround.
Mail moves content between desktop and iOS mail client. Copy/paste
moves content between iOS mail client and J iOS.
One time steps prepare desktop/iOS for sharing content. After that, it
is relatively easy to use mail/copy/paste to share content.
After any feedback has settled down, this info will be posted in the iOS wiki.
*** one time steps to prepare desktop/iOS
desktop
1. copy jt.ijs (from below)
2. paste and saveas ~system/util/jt.ijs
3. copy iosx.ijs (from below)
4. paste and saveas ~system/util/iosx.ijs
5. send mail to self with iosx.ijs attached
iOS
1. read mail
2. tap iosx.ijs to show attachment in text window
3. tap+tap-hold-release (in whitespace) to select all
4. tap copy
5. J
f=: '~addons/ide/ios/iosx.ijs'
jcbtof f
load f
iosx f
*** move content to iOS (example of ~addons/math/misc)
desktop
1. J
load'~system/util/jt.ijs'
jt'' NB. doc
jt'c';'~temp/t.jt';'~addons/math';'misc'
2. send mail to self with t.jt attached
iOS
1. read mail
2. tap t.jt
3. tap+tap-hold-release
4. tap copy
5. J
jtcb'' NB. doc
jtcb'x';'~addons/math'
*** move content to desktop (~temp to ~temp/ios)
iOS
1. J
jtcb'c';'user';'temp'
2. mail compose, paste, send to self
desktop
1. read mail
2. copy content
3. J
paste content to temp script and save
load'~system/util/jt.ijs'
jt'x';'...temp...';'~temp/ios'
*** jt.ijs - start
jt=: 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=. 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=. LF,~LF,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
)
*** jt.ijs - end
*** iosx.ijs - start
echox_z_=: 3 : 0
a=. 9!:36''
9!:37[4$0,1000+#y
echo y
9!:37 a
i. 0 0
)
jcb_z_=: 3 : 'echox''<ioscmd>cb '',y'
jtcbhelp_z_=: 0 : 0
pack/unpack text files to/from clipboard
jtcb'c';'~user';'temp' NB. pack temp to clipboard
jtcb't';'~user' NB. what would x do
jtcb'x';'~user' NB. extract and create
)
jtcb_z_=: 3 : 0
if. ''-:y do. echo jtcbhelp return. end.
t=. ({.y),(<'/t.jt'),}.y
select. {.t
case. <'c' do.
r=. jt t
jcb fread'/t.jt'
>r
case. 't';'x' do.
'/t.jt' fwrite~ jfromcb''
>(2{t),each '/',each jt t
case. do.
assert 0['not c t or x'
end.
)
iosx_z_=: 3 : 0
t=. toJ fread y
assert 'echox_z_=: 3 : 0'-:(t i. LF){.t['not iosx.ijs source'
t fwrite'~addons/ide/ios/iosx.ijs'
t=. toJ fread '~addons/ide/ios/ios.ijs'
t=. <;.2 t
s=. <' d=. fread f',LF
if. s-:292{t do. t=. (<' d=. LF,~LF,toJ fread f',LF) 292}t end.
s=. <'load''~addons/ide/ios/iosx.ijs',LF
if. -.s-:{:t do. t=. t,s end.
t{~292,<:#t
(;t) fwrite '~addons/ide/ios/ios.ijs'
i.0 0
)
*** iosx.ijs - end
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm