Login  Register

Re: New Pharo user, some questions

Posted by Edward Povazan on Dec 10, 2014; 9:43pm
URL: https://forum.world.st/New-Pharo-user-some-questions-tp4795325p4795343.html

Hello,

Smalltalk has been on iOS for a while:
https://www.mobilewikiserver.com/Fraction.html
though the apps are by John McIntosh who did the initial port (I think).

I don’t know if there is a formal way of making iOS apps with Pharo/Squeak.
I guess https://github.com/johnmci/Scratch.app.for.iOS would be a starting point.

I am in a similar boat as you are - Pharo is my playground for getting hard ideas done. Then I go back to ObjC when I know what I am doing.
Would really like to use Pharo day to day - one day!

Cheers,
-Ed



On Dec 10, 2014, at 12:26 PM, dboeren <[hidden email]> wrote:

> Now that my image is working properly again and the fires have been put out,
> I wanted to introduce myself a bit better...
>
> My name is David Boeren.  I first learned Smalltalk back in college many
> years ago, we used Smalltalk V in an object oriented programming class I
> took which was first-half Smalltalk, second-half C++.  This would be about
> 1992 I think?  In recent years I've mainly been using Java, with occasional
> Python dabblings.  I remember installing Squeak once or twice over the
> years, but to be honest it felt a bit clunky, perhaps this was just an early
> primitive version or whatever.
>
> Recently, I've been getting the itch to try out some different languages.  I
> was kind of looking at Scala or Clojure, one co-worker suggested Erlang, and
> so forth.  But after doing a brief review I ended up coming back to
> Smalltalk which even after all these years still stands right up with the
> cutting edge I think.  Sure, there are a few things that I think would be a
> little different if it were designed today like tuple support or whatever,
> but it feels like the right choice for something I'm going to use mainly for
> "fun" projects and the interactive environment is awesome.
>
>
> One thing I wanted to ask about is the status of getting Pharo running on
> iOS (or at least iPad).  I found some old posts but nothing much within the
> last couple of years.  I know there were app store policy issues in the past
> but I think that Apple has opened things up a bit since then, you can now
> get Pythonista in the app store, or Codea.  Is there still an obstacle or is
> it just something that hasn't been gotten around to yet?  I'd love to get it
> running on my iPad Mini and be able to transmit code back and forth between
> there and my laptop to work on it wherever I'm at.
>
>
> Second, I'm running into an oddity and I'm not sure what I'm doing wrong or
> whether this is a bug of some sort, this has to do with trying to replace
> unicode characters in a string which seems like it should be a
> straightforward operation.  Here is my code:
>
> "Fetch the raw JSON data from dtdb.co"
> response := 'http://dtdb.co/api/cards/' asUrl retrieveContents asString.
>
> "Clean up the data a bit to make it a little more regular"
> response := response copyReplaceAll: 'null' with: '""'.
> response := response copyReplaceAll: '\u2022' with: ','.
> response := response copyReplaceAll: '\u009e' with: 'e'.
>
> Basically I'm just pulling some JSON data and then doing a few string
> replacements to make the data suit my needs.  The first one works.  The
> second one works.  Since the third one ALSO uses a \uXXXX code I would
> expect it to work too, but it does not - the accented characters are still
> there.
>
> To get a bit more visibility into this, I copied the CopyReplaceAll code
> from SequenceableCollection into a scratch class method and adding some
> Transcript output:
>
> copyReplaceIn: aString All: oldSubCollection with: newCollection
> "Answer a copy of the receiver in which all occurrences of
> oldSubCollection have been replaced by newCollection "
>
> | startSearch currentIndex endIndex |
>
> Transcript show: 'start' ; cr.
> startSearch := 1.
> [(currentIndex := aString indexOfSubCollection: oldSubCollection
> startingAt: startSearch) > 0]
> whileTrue: [
> Transcript show: 'Found at index ' ; show: currentIndex ; cr.
> endIndex := currentIndex + oldSubCollection size - 1.
> aString := aString
> copyReplaceFrom: currentIndex
> to: endIndex
> with: newCollection.
> startSearch := currentIndex + newCollection size].
> Transcript show: 'done' ; cr.
> ^ aString
>
> A minimal test seemed to work:
> HelloWorld copyReplaceIn: 'R\u00e9my Lapointe' All: '\u00e9' with: 'e'.
>
> start
> Found at index 2
> done
>
> Testing this with the real data worked too:
> HelloWorld copyReplaceIn: ('http://dtdb.co/api/cards/' asUrl
> retrieveContents asString) All: '\u00e9' with: 'e'.
> start
> Found at index 22379
> Found at index 22500
> done
>
>
> However, when I went back to using the regular copyReplaceAll:With: method
> it does not work and I'm not sure why.  When it executes this:
> aString indexOfSubCollection: oldSubCollection startingAt: startSearch
>
> The value comes back as 0 even though it's the same data from
> 'http://dtdb.co/api/cards/' asUrl retrieveContents asString (I added a "self
> halt" to be able to step into the method and view the variable values), and
> I'm not sure what the difference is.  There shouldn't be a limit on the size
> of the collection, should there?  The whole thing is around 116k which is
> big but not ridiculously so.  It is however big enough that the debugger
> can't show the whole value, or at least I haven't found a way to do so.
>
>
> And last, is there a good video tutorial for the Pharo beginner on how to
> use the various browsers, debugger, tools, etc... that come with Pharo?  I
> would like to start learning more about the best ways to use these in my
> development processes.  I'm also having a lot of trouble finding the correct
> classes and message for what I want to do, searching online w/ Google often
> seem to turn up outdated information (or for a different smalltalk flavor)
> and it can take a while to figure out the correct way to do things.  Is
> there a good central reference for the APIs somewhere?  I know that you can
> search in the browser but I usually don't know the name to search for.  It
> would be good to have a handy reference detailing how to do all the
> commonplace stuff.
>
> Thanks!
>
>
>
> --
> View this message in context: http://forum.world.st/New-Pharo-user-some-questions-tp4795325.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>