Guides/iOS/32bit

From J Wiki
< Guides‎ | iOS
Jump to navigation Jump to search

iOS (iPhones and iPads)

Also see this exciting news about J on Android!


General Approach

Informal announcement

ScreenShots

An iPad landscape view

Showing 2 trigonometric plots in the Html (or "dot") window

Iostrig.png

Showing the J Vocabulary in the Html (or "dot") window

Also showing the results of doubling the default font size Iosvocab2.png

An iPad portrait view

Showing how to access a valuable "Lab" (interactive tutorial)

Ioslab2.png

Windows

  • Log window: This is where text output is presented, and a text line can be touched and resubmitted
  • Html window: This is where graphical results are presented via Html
  • Edit window: This is where script files can be created and edited -- Tap the "E" button

Help

JHelp

Online help for J

iOSHelp

Press the "?" icon in the bottom line of the iOS screen.
Or type 'Hall' (without the quotes) in the Entry field at the bottom of the iOS device screen,
and then press the Return icon to the right of the Entry field.

CompareToDesktop

VersionOfiOS

FileTransfers

The mail/copy/paste method

Due to Appstore restrictions, it is not yet easy to transfer files between iOS devices and desktops. Until more streamlined methods can be developed the following files and instructions are provided. The JAL system, pacman, provides rather elegant downloads of J libraries to desktop directories (~addons/) directly from jsoftware.com, but no such direct method is yet available for iOS devices. For now, any such addons must first be downloaded to a desktop computer first, and then further transfered to iOS platforms.

Following is the jt.ijs script. File:Jt.ijs
.

      • ~temp/jt.ijs (should be installed on Desktop computer)
0 : 0
transfer text file from desktop to iPad:
 load '~temp/jt.ijs'
 jattach '... file to move to iPad ...'
 send email to yourself with attachment ~temp/jattach.html

 read email on iPad
 tap jattach.html - show attachment in browser
 tap textarea     - show keyboard and enter edit mode
 touch-hold-release textarea
 tap Select All
 tap Copy

 switch to J
 jcbtof '~temp/t.ijs' NB. put clipboard data in file
     or to edit immediately
 je jcbtof '~temp/t.ijs'

transfer text file from iPad to desktop:
 je '..... script'
 touch-hold-release
 tap Select All
 tap Copy
 send email with pasted contents
 read email on desktop
 normal methods to copy/paste data to file

Verb jt creates a single text file from a folder (similar to tar).
 jt '' NB. jt help
 jt 'c';'~/t.jt';'~addons/math';'misc' NB. create t.jt with addons
contents
 jattach '~t.jt'

  transfer single file to iPAD

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

)

NB. write file y wrapped in html to file x (default ~temp/jattach.html)
jattach_z_=: 3 : 0
'~temp/jattach.html' jattach y
:
t=. '<html><head>'
t=. t,'<meta http-equiv="Content-type" content="text/html;charset=UTF-8">'
t=. t,'<title>TITLE</title></head><body><div><h1>NB. TITLE</h1>'
t=. t,'<textarea name="ta" rows="20" cols="20">DATA</textarea>'
t=. t,'</body></html>'
t=. t rplc 'TITLE';y
d=. toJ fread y
d=. d rplc '&';'&'
d=. d rplc '<';'<'
d=. d rplc LF;'<br>',LF
t=. t rplc 'DATA';d
t fwrite x
)

jt_z_=: 3 : 0
if. ''-:y do.
 smoutput'jt packs/unpacks 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
)

The following clarifies somewhat the transfer of file directories.

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.

On desktop
   jt '' NB. jt help
   jt 'c';'~/t.jt';'~addons/math';'misc' NB. create single t.jt file
from addon/math misc folder
   send email with t.jt attachement

On iPad
   read email and follow single file example to copy to clipboard

   jcbtof 't.jt' NB. put clipboard contents to file t.jt (at root for less
name typing)
   jt 'x';'t.jt';'~addons/math' NB. extract contents of t.jt

The iExplorer way

Just install and play with iExplorer from www.macroplant.com.

This product lets you mount your iPx as an external drive on your Windows or Mac desktop.

The product costs $35 and is well worth it if you make non-trivial use of J iOS.

Installation

  • Phone
  • Tablet

Keyboard

  • Phone
  • Tablet

Idiosyncrasies (relative to other J versions)

  • To retrieve the last input, swipe left in the text entry field
  • To advance to the next Lab, press the 'return' button
  • No package manager for ~addons (see FileTransfers)
  • Limited keyboard means no 'modifier' keys like Control, Alt

Updates

Comments