Ian - thanks for such an interesting and erudite post!

I was a freelance IBM\370 Assembler system designer and developer for three 
decades writing and maintaining operating system enhancements and compilers and 
although I started with punched cards input (and output!) and then 3270 
screens, I later migrated to IBM PCs to talk to the mainframes and this use was 
later subsumed into Windows 3.1 on IBM Thinkpads. I’ve used every version of 
Windows since then and I never had time to get involved in Macs. I first got 
into iPads as leisure items mainly for entertainment and although I still do my 
low-level J development on a PC I find it very convenient to also develop in J 
on my iDevices. A great example of their use occurred yesterday evening between 
8 and 10pm, when I was able to develop and test my latest fun project (a Wordle 
analyser) more or less entirely with my iPhone on a plane trip between Palma 
and Gatwick! This despite the drawbacks of one-finger pecking that you mention 
in your excellent essay! This is an advantage of the terseness of J! I was 
testing my J a line at a time - another huge advantage of J and I was delighted 
with my progress. I can’t think of another language that I could have 
progressed so quickly in!


I must confess that I am a great iOS fan despite the shortcomings of the Files 
app. I circumvent most of the drawbacks by heavy use of Dropbox and iCloud. The 
lack of a good text editor is irritating, I am composing this email in Apple 
Notes which is free with iPadOS and iOS but is only very basic. On the PC I use 
Textpad which is fine for my needs.  If you do write one as you suggest, 
perhaps it will be in J?!


I first used J possibly 15+ years ago when I managed to run it on an an HP 
Jornada Pocket PC I had (do you remember those?). Their hard keyboard was very 
tricky to used so maybe that’s why I can cope with the iStuff soft keyboards 
which I find much easier ?


The first J project I wrote was a text reformatter that I used to reformat 
downloaded cricket scores from the Internet on my PC into a suitable size to be 
able to transfer over to the Jornada (via SD card!) so I could have all the 
scores to hand while watching cricket. It was a very interesting and 
informative introduction to J with a useful end product but it’s use has since 
been superseded. I still watch cricket but with 4G and an iPhone I have all 
current and past scores to hand at all times!


Richard Donovan

On 17 Feb 2022, at 02:57, Ian Clark <[email protected]> wrote:

Thanks, Richard.

My search for a text editor in App Store for iPadOS was hasty. I advise
anyone to look more deeply that I have done (to-date).
I too need a text editor with the "proper' behaviour – and I might end up
writing my own. This isn't my last word on the topic. I shall be reporting
back.

Broaden your search to programming language IDEs too, notably Python
(multiple apps, of which Pythonista stands out). All such have a text
editor to handle their own source scripts. Some handle the controversial
".txt" in the grand old way, driving a coach-and-horses through the Apple
bullshine.

I need a text editor as I migrate fully from PC to iPad so I am grateful
for your suggestions.

You have a rocky road ahead of you. You might have got an easier ride if
you'd migrated from Windows to iOS/iPadOS via macOS. The last leg of the
journey is the painful one: macOS --> iPadOS.

I've been an Apple (Macintosh) registered developer since the late 1980s,
and I've seen the beast come out of the sea and sprout legs. Yet when I
bought an iPad 2 years ago it completely baffled me how to do the simplest
tasks with it. See my thoughts on iPadOS here:
https://code.jsoftware.com/wiki/Essays/iOS_Fitness_For_J

Out of interest, did you discover why this phenomenon does not also occur
on the iPhone?

Oh-no. Don't get me started! :-)

I can take a shrewd guess, but I don't *know*. And won't until I can
convince myself the bug doesn't lie in my own code.

The Apple iOS team has got its knickers twisted over the whole business.
Every year it sticks on another band-aid. The mischief really got going
with the introduction of the Files app in iOS 11. Actually it started long
before, when Apple began admitting there were such things as files, above
and beyond the contents of the sandbox of a legacy app ported to iOS. (Ever
wondered why Xcode has never been ported to iOS – and never will? Ditto
Terminal?)

Originally iOS cancelled the security problems (posed by files as objects
in the user's universe) by having no operating system. That's like the Mac
having no Finder. Apps would have to pass data to each other via a
byzantine system of exports/imports.

But by iOS 11 it admitted that some of its tenants wanted to keep coal in
the bath, and if prevented they'd all go out and buy Androids. Hence the
Files app: a "Finder" for iOS.

Now basically the Finder lets you keep your data as a collection of files,
and "open" any file you asked it to by launching the app that owns it.
Files app has to do the same. Well, kinda.

Now...

  - Who owns myfile.pages? Why, Apple Pages, of course.
  - Who owns myfile.numbers? Why, Apple Numbers, of course.
  - Who owns myfile.ijs? Well, we guess it's j901, if the developer has
  got through the obstacle course and keeps the app up-to-date.
  - Who owns myfile.png? Errm… that's a bit more difficult. How about the
  last app you installed that handles pictures?
  - Who owns myfile.txt? Nobody. That's contraband. How dare you possess
  such a file!

In fact, when you consider the security risks involved in "opening" a file
of no known provenance like whosefile.txt, the safest thing is for Files
app to refuse to open it at all. Merely hint at its contents, in the
vaguest way.

Well, that's King Canute commanding the tide not to come in.

But whatever Files app does this year, next year it will do something
different. We already know it needs to behave differently in iOS and
iPadOS. In the latter only, it has to handle split screens, i.e. run two
separate apps in foreground simultaneously. Which iOS emphatically does
not. I would guess the current Files app has all sorts of nasty little
fixups just to handle that feature.

How best to handle a suspicious orphan like whosefile.txt is something
Apple is supremely unconcerned with, once it has fixed the known security
exposures. I bet the code inside is like Google's spam filter. Anyone
toting *.txt inside iPadOS deserves an alert from St Christopher telling
you you're on your own now.

On Wed, 16 Feb 2022 at 06:45, Richard Donovan <[email protected]> wrote:

Thanks Ian, and well analysed!

I need a text editor as I migrate fully from PC to iPad so I am grateful
for your suggestions.

Out of interest, did you discover why this phenomenon does not also occur
on the iPhone?

Richard Donovan

On 16 Feb 2022, at 03:00, Ian Clark <[email protected]> wrote:



I can’t try with J702 as it seems to have been removed from the App
Store.

No, it's called j701, not j702, and it's still there.
Type into the App Store searchbar: j7
and you will see it listed.

I can replicate the bug now, and it will be fixed in the next update of
j901 for iOS/iPadOS.
j901 does indeed capture ownership of text files with the extension:
".txt"
from Files app, which would otherwise show the text of the file using
QuickLook. It seems j701 does not have this bug, insofar as it's not
launched by Files app.

As a workaround  until a solution is found, I can copy all my text files
from iCloud to DropBox and access them from there.

You don't need to move all your text files with ".txt" into DropBox.
Instead of using Files app, why not download a 3rd party text editor from
App Store? After a quick glance through a search on "text editor", I'd
recommend QuickText (free, though it does limit you to editing only 15
files a week unless you buy the Pro version for £4.49). It starts up in
its
Document Picker, which is sufficiently like Files app to be reassuring.
And
it seems to display every text file whatever the extension. Even the
J-owned files: ".ijs".

Ian Clark

On Wed, 16 Feb 2022 at 00:38, Richard Donovan <[email protected]>
wrote:

Hi Ian and thanks for taking an interest.

I mean that I tap the file name of a text file from within the files
app.
This causes J901 to start up immediately.

I should have said File Viewer rather than text editor. This a feature
of
the files app which displays the content of several files types such as
text, photo and PDF files.

Now it gets really interesting…

I remembered that these same text files were also present in my DropBox.
When I went to DropBox and tapped on a file there, it opened correctly,
seemingly using the same inbuilt viewer.

Also, I have a lot of files with a .gpx file type but contain text.
These
are displayed correctly so it appears the call to J is made only with
files
having  a .txt ending.

Also,

If  I remove J901 from my system, again, the problem goes away.

I can’t try with J702 as it seems to have been removed from the App
Store.

A most peculiar problem.


I hope the above helps in debugging; if you need any more info, or want
to
watch a screen recording of this phenomenon in action, please let me
know.

As a workaround  until a solution is found, I can copy all my text files
from iCloud to DropBox and access them from there.


Richard Donovan

On 16 Feb 2022, at 00:28, Ian Clark <[email protected]> wrote:

Richard Donovan wrote
when I try to access a text file it triggers J instead of the text
editor!

What exactly do you mean by "access"? That's a highly ambiguous term
where
iPadOS is concerned. Read? Write? Edit?
Do you mean: "open" a textfile by tapping on its icon in Apple Files
app?

What exactly do you mean by "the text editor". On iOS/iPadOS there is
no
"the" (as Yoda might say). See below.

In stark contrast, macOS has TextEdit.app – which is indeed "the" text
editor, although there are others (e.g. BBEdit). TextEdit will try to
edit
any file you drag'n'drop onto its icon. And ⌘I will let you specify
TextEdit.app as the "owner" for a whole range of inappropriate
filetypes
&
extensions. iOS/iPadOS emphatically does not allow any of that.

There's a known bug in j901 for iOS: it interfaces badly with the
(Apple)
Files app. This is a messy area, and Apple has changed how Files app
behaves over the last 2 years, especially its a.p.i – how 3rd-party
apps
communicate with it. From what you're saying, they've changed iPadOS to
behave differently from iOS. If so, this is a Files app bug, because I
can
see no logical reason why iOS and iPadOS should behave differently
here.

There is only one j901 release for both platforms, though Apple does
"fixup" an app between the developer uploading it to App Store, and the
end-user downloading it. Indeed j701 (the forerunner to j901) has been
thus
tinkered with - and its App Store entry admits it.

But there's the little matter of split screens, which iPadOS has to
deal
with and iOS doesn't. So iPadOS can actually run both j901 in one
screen
(editing a TXT file), and a 3rd-party text editor in the other
(editing a
IJS file). I don't believe even Apple has anticipated what fun'n'games
that
can lead to.

What should happen is: when Files app is showing the icon for a data
file
belonging to j901 viz. having the extension IJS, IJT, IJX, if you tap
on
the icon it should (a) launch j901 (which it did last time I tried it)
(b)
tell J901 to edit the tapped file (which, alas, j901 does not respond
to,
because Files app is hopelessly buggy here, and the documentation is
out
of
date. This is a known j901 bug).

I can't see how this particular j901 bug is causing it to capture all
text
files, however.

iOS (and iPadOS) do not (officially) support the editing of (general)
text
files. Apple would rather you didn't know what a textfile was – indeed
that
you didn't know what a *file* was (yes, really!) – and thought only in
terms of data owned by a particular app, such as Pythonista, Safari,
j901,
etc. --Which isn't just down to the file's extension, e.g. TXT, which
iOS/iPadOS goes out of its way to hide from the end-user.

However, App Store grudgingly hosts a number of 3rd-party general
textfile
editors There's even a Terminal lookalike, and various versions of
Python,
which can edit Python source files – and maybe TXT (IJS, IJT, IJX) too.
Which one are you using? It may be pretending ownership of more classes
of
textfile than it is entitled to. Or else not defining its ownership in
the
proper Apple way (which keeps changing every year or so).

Which is "your" textfile editor? Until I know, I can't replicate your
bug.

I'll look into it, but it's all a vastly messy area, and one which
Apple
is
trying to deprecate by stealth.
Meanwhile, here's some things to try.

1. Shut down and restart your iPad, to help it sort out its priorities.
Does it now behave like your iPhone?

2. Delete j901. Does Files app launch the textfile editor? Repeat step
1.
Problem fixed?

3. Reinstall j901 again. Does the problem reappear?

4. Delete the textfile editor you're using, then reinstall it. This
will
make iPadOS ask it "is this file one of yours?" before it asks j901.
Repeat
step 1. Problem fixed?

5. The textfile editor ought to have an "open file" option of its own,
which is independent of Files app. Can you open your (previously
captured)
TXT file that way? (Perhaps this should be step 0.)

4. Download j701 (it's still there on App Store) Which app gets
launched
now when you try to edit a textfile? Delete j901. Which now?

5. Try every permutation of the above until a pattern emerges. (It's
only
what I'm going to have to do.)

Is anyone running an iPad on a back-version of iPadOS? Can you
replicate
Richard's bug?

Ian Clark

On Tue, 15 Feb 2022 at 16:18, Richard Donovan <[email protected]>
wrote:

Hi

Since I installed J901 on my iPad when I try to access a text file it
triggers J instead of the text editor! The problem does not occur on
my
iPhone. The version of iPadOS I have is 15.2.1 and the iPhone uses iOS
15.2.1 also.

Is this a problem for anyone else? Has J stolen the file association
for
*.txt files?!

Thanks,

Richard Donovan
----------------------------------------------------------------------
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

----------------------------------------------------------------------
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
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to