<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://95.179.246.60/mediawiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Ssmith2112</id>
	<title>Cuis CookBook - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="http://95.179.246.60/mediawiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Ssmith2112"/>
	<link rel="alternate" type="text/html" href="http://95.179.246.60/mediawiki/index.php/Special:Contributions/Ssmith2112"/>
	<updated>2026-05-08T12:46:30Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.17</generator>
	<entry>
		<id>http://95.179.246.60/mediawiki/index.php?title=The_Cuis_Cookbook&amp;diff=216</id>
		<title>The Cuis Cookbook</title>
		<link rel="alternate" type="text/html" href="http://95.179.246.60/mediawiki/index.php?title=The_Cuis_Cookbook&amp;diff=216"/>
		<updated>2025-06-03T14:00:44Z</updated>

		<summary type="html">&lt;p&gt;Ssmith2112: Fix typos&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
A programming language cookbook is something like &#039;&#039;[https://stackoverflow.com/ StackOverflow]&#039;&#039;, without the digging part and the try&amp;amp;pray experience. For a gentle and structured introduction to Cuis-Smalltalk, you should start with the &#039;&#039;&#039;The Cuis Book&#039;&#039;&#039; and &#039;&#039;&#039;Learning-Cuis&#039;&#039;&#039; more about this in [[CuisCoookBook-References|References]]. This is intended to be a &amp;lt;u&amp;gt;resource for programmers&amp;lt;/u&amp;gt;, in the sense that it answers questions that will naturally come up to programmers while exploring Smalltalk. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Reliability&#039;&#039;&#039;. I am writing these notes while learning Cuis. Some of what I write may not be the best way to solve the problem, it may not even be correct. Be patient, double check. Since I use these recipes myself I am going to improve them in time.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Sorting principles&#039;&#039;&#039;. Topic order is intended to go from easy to difficult. From frequently necessary to rarely used. From needed at the beginning of the programming experience to needed by black belts. These three forces, as with the 3 laws of robotics, regulate what chapter goes toward the top of the document. They hold also for sub-chapters and articles.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Contributions&#039;&#039;&#039;. I am trying to figure out ways to make contributions possible and fruitful, see [[contributions motivated guidelines]]. As a write I see that [[format guidelines|format guidelines are also important]].  &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Copyright&#039;&#039;&#039;. You have the right to read, print for your own use, and contribute to the document. You can make external links to this document. You can not copy the document and make it available somewhere else on the Internet. You can&#039;t claim ownership. You can&#039;t bring the document to an editor and publish it. I, as the author of more than 99% of the words displayed here, retain all rights as well as the right to change these rules.&lt;br /&gt;
&lt;br /&gt;
* [[Introduction]]. What you should expect from this book and the reason why I am writing it. STARTED.&lt;br /&gt;
* [[Why Smalltalk?]]. For what reason should you learn another programming language which is also not so popular? Read on, there are very good reasons. STARTED.&lt;br /&gt;
* [[Why Cuis Smalltalk?]] . TODO&lt;br /&gt;
* [[MetaCookbook]]. Collection of things about this document.  &lt;br /&gt;
&lt;br /&gt;
== Installation and start up ==&lt;br /&gt;
&lt;br /&gt;
* Install and run Cuis in Windows&lt;br /&gt;
* Install and run Cuis in MacOS&lt;br /&gt;
* [[Install and run Cuis in Linux]]&lt;br /&gt;
* [[Run Cuis in the Web Browser. (SqueakJS)]]&lt;br /&gt;
* [[Run Cuis in a ARM platform, RPi, BeagleBone and similar. (Linux)|Run Cuis in an ARM platform, RPi, BeagleBone and similar. (Linux)]]&lt;br /&gt;
* Run Cuis on a remote server. (Linux)&lt;br /&gt;
* Run Cuis on the metal: without an Operating System&lt;br /&gt;
* How to keep Cuis updated&lt;br /&gt;
* [[How to load the most recent changes Juan made to Cuis-Smalltalk-Dev]]&lt;br /&gt;
&lt;br /&gt;
== Cuis in its environment ==&lt;br /&gt;
&lt;br /&gt;
* What is a .image file?&lt;br /&gt;
* What is a .changes file?&lt;br /&gt;
* [[What is a .user.changes file?]]&lt;br /&gt;
* [[What is a .log file?]]&lt;br /&gt;
* [[What is release of the image and VM I am running?]]&lt;br /&gt;
&lt;br /&gt;
== Things unique to Cuis and/or Smalltalk ==&lt;br /&gt;
Here are all the things that are totally unknown for anybody who has never programmed in any Smalltalk.&lt;br /&gt;
&lt;br /&gt;
* [[How can I make X? Learn to fish in Smalltalk|How can I make X ? Learn to fish in Smalltalk]]&lt;br /&gt;
* [[First things first: 1+1 and &amp;quot;Hello World&amp;quot;]]&lt;br /&gt;
* How can I type in a basic object ? [[Know the literals]] !&lt;br /&gt;
* [[You want something to get done? Ask an object to do it!]]&lt;br /&gt;
* [[How do I define a function?]]&lt;br /&gt;
* [[How do I create my own Class with some methods inside it?]]&lt;br /&gt;
* [[What is a package? How do I create, load and unload one?]]&lt;br /&gt;
* [[My project needs to add a method to somebody else Class, how do I do it?|My project needs to add a method to somebody else Class, how do I do it ?]]&lt;br /&gt;
* [[How to use Class variables]]. STARTED&lt;br /&gt;
* [[Learn how to use the Transcript]] . This is really important, you should take a peek.&lt;br /&gt;
* [[Tips &amp;amp; tricks]] . Those little keyboard/mouse shortcuts or little code snippets that may improve your programmer life.&lt;br /&gt;
* [[Traps and pitfalls for polyglot developers]] . If you know more programming languages this page is for you.&lt;br /&gt;
* [[&amp;quot;It didn&#039;t understand&amp;quot; can&#039;t happen]]. The end of most of your programmer anxiety. You can understand it all.&lt;br /&gt;
&lt;br /&gt;
== About a general Class and Object ==&lt;br /&gt;
&lt;br /&gt;
* [[Create automatically all accessors for a  Class instance variables]]&lt;br /&gt;
* [[Change the way an Object is printed]]&lt;br /&gt;
* [[Find all objects referencing anObject]]&lt;br /&gt;
* [[Make your own object initialization]]. All you need to know about &amp;lt;code&amp;gt;new&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;basicNew&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;initialize&amp;lt;/code&amp;gt; etc. STARTED&lt;br /&gt;
* [[How to dump and restore an Object]] -- STARTED&lt;br /&gt;
* [[How to manage a Class who should have only one instance]]&lt;br /&gt;
* [[Discover in what package a Class lives]]&lt;br /&gt;
* [[Follow step bye how a method call gets resolved. Example-1]]&lt;br /&gt;
&lt;br /&gt;
== Data Structures ==&lt;br /&gt;
&lt;br /&gt;
* Fundamentals: numbers, strings and symbols&lt;br /&gt;
&lt;br /&gt;
=== Strings (before default UTF) ===&lt;br /&gt;
&lt;br /&gt;
* [[Cuis-What Strings are made of and how|What Strings are made of and how]]&lt;br /&gt;
* [[Cuis-String escape|String escape]]&lt;br /&gt;
* [[Cuis-Automatically escape a complex string|Automatically escape a complex string]]&lt;br /&gt;
* [[String formatting with format:]]&lt;br /&gt;
* [[String formatting with printf:]]&lt;br /&gt;
* [[A thousand ways to say new line]] . Newline, to text find it fast&lt;br /&gt;
* [[Trim white chars]]&lt;br /&gt;
* [[String joining]]&lt;br /&gt;
* [[String splitting]]&lt;br /&gt;
* [[String search]]&lt;br /&gt;
* [[String replace]]&lt;br /&gt;
* [[Show me the string, but max N. characters]]&lt;br /&gt;
* [[Dump and restore JSON data strings]]&lt;br /&gt;
* [[How to hash a string]]&lt;br /&gt;
* [[Convert to Base64]]&lt;br /&gt;
* [[Convert strings from/to Utf8]]&lt;br /&gt;
* Remove accents with, &amp;lt;code&amp;gt;&#039;sarà&#039; asUnaccented .    =&amp;gt; &amp;quot; &#039;sara&#039; &amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
* [[Convert UTF16 to Latin1]]. This is quite useful, in Windows-10 UTF16 is called Unicode.&lt;br /&gt;
* Jump to the next level of power, [[use Regex]] . Last in the list for complexity, but should be first for power, don&#039;t overlook this.&lt;br /&gt;
&lt;br /&gt;
=== Collections ===&lt;br /&gt;
&lt;br /&gt;
* [[The things you may call a List]] -- STARTED&lt;br /&gt;
* [[Array]]&lt;br /&gt;
* [[Dictionary a.k.a. Hash Table]]&lt;br /&gt;
&lt;br /&gt;
== Streams ==&lt;br /&gt;
&lt;br /&gt;
* [[Make a stream from a string, for reading]].&lt;br /&gt;
* [[Write a long String with a Stream]]&lt;br /&gt;
* [[Write to stdout in any system]]. Not only Unix like. Useful for shell programs.&lt;br /&gt;
&lt;br /&gt;
== Date and time ==&lt;br /&gt;
&lt;br /&gt;
* [[Get the current date and time]]&lt;br /&gt;
* [[Format date and time as you like most]]&lt;br /&gt;
* [[Date and time algebra]]&lt;br /&gt;
* [[Get the current time with the highest precision]]&lt;br /&gt;
* [[Get date and time as Unix epoch]]&lt;br /&gt;
* [[Get date and time in a different country]]&lt;br /&gt;
* [[Measure how much time it takes to run a code block]]&lt;br /&gt;
&lt;br /&gt;
== Files and directories ==&lt;br /&gt;
You should keep in mind that Smalltalk uses files but it is not based on files. I copy here&lt;br /&gt;
&lt;br /&gt;
part of a &#039;&#039;Juan&#039;&#039; mail to mailing list: &amp;quot;... The essential idea you need to be aware of when learning about all this is that Smalltalk uses files, but it is not file-based. What this means is that all the tools in the Smalltalk image (with the only exception of FileList and FileContentsBrowser) are NOT showing files, but &#039;&#039;&#039;live objects&#039;&#039;&#039;. The way them relate to files is usually not really important ...&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* [[How to Read or Write a text file]] . without Streams, only Strings.&lt;br /&gt;
* [[How to Read or Write a text file with a Stream]]&lt;br /&gt;
* [[Read a file line by line]] . Or any general delimiter.&lt;br /&gt;
* [[Find the current directory, list it and move in the directory tree]]&lt;br /&gt;
* [[Filename extensions]]: .txt, .csv, .json ...&lt;br /&gt;
* [[Check things on a pathname. Is there anything? Is it a file? Is it writable?]] ...&lt;br /&gt;
* [[Delete files and directories]]&lt;br /&gt;
* [[Read/Write a binary file]]&lt;br /&gt;
* [[Create a new non-existing file name]]&lt;br /&gt;
* [[Using file locks]] -- TODO&lt;br /&gt;
* [[Get the list of open files]]&lt;br /&gt;
* [[Get the directory where a Class (its Package) is stored]]&lt;br /&gt;
* [[Where is the image file? Where is the VM?]]&lt;br /&gt;
&lt;br /&gt;
== Error Handling and the Debugger ==&lt;br /&gt;
&lt;br /&gt;
* [[Call the debugger from a code location]]&lt;br /&gt;
* [[Quick exception handling]], equivalent of Python &amp;lt;code&amp;gt;try ... except&amp;lt;/code&amp;gt;&lt;br /&gt;
* [[Assertions]]&lt;br /&gt;
* [[Errors, raise and catch signals]]&lt;br /&gt;
* Case-study-1. &#039;&#039;&#039;TODO&#039;&#039;&#039;. When the debugger pops up send me an email&lt;br /&gt;
* b&lt;br /&gt;
&lt;br /&gt;
== Processes ==&lt;br /&gt;
&lt;br /&gt;
* [[Smalltalk processes are not Unix processes]]&lt;br /&gt;
* [[See the list of running processes]]&lt;br /&gt;
* [[Processes 101]]. Shows how to create a process, name it, start it, stop it and destroy it.&lt;br /&gt;
* [[Run a new process]]&lt;br /&gt;
* [[Kill a process]]&lt;br /&gt;
&lt;br /&gt;
== Uncategorized useful features ==&lt;br /&gt;
&lt;br /&gt;
* [[Run a method every 2 hours or every day at 15:00]], equivalent to Unix cron&lt;br /&gt;
* [[Zip and unZip files and directories]] --- TODO, miss zipping&lt;br /&gt;
* [[Convert a file to/from Base64]]&lt;br /&gt;
* [[Deal with XML files]] -- STARTED&lt;br /&gt;
* [[About Random]]&lt;br /&gt;
* [[How to invoke the garbage collector]]&lt;br /&gt;
* [[Adapt newline characters to Cuis standard]]&lt;br /&gt;
* [[Where to get information about the hardware]] . Screen size, free memory, cpu speed ...&lt;br /&gt;
* [[The Dependency Mechanism - part 1]]. Here we talk about the Smalltalk classic &#039;&#039;&#039;Parent&#039;&#039;&#039; - &#039;&#039;&#039;Dependent&#039;&#039;&#039; model.&lt;br /&gt;
* [[The Dependency Mechanism - part 2]]. Here we explain the why of a &#039;&#039;&#039;Model&#039;&#039;&#039; class.&lt;br /&gt;
* [[The Dependency Mechanism - part 3]]. Here we talk about the &#039;&#039;&#039;Observer Pattern&#039;&#039;&#039;. (preferred current method in Cuis)&lt;br /&gt;
* How to use the &#039;&#039;&#039;serial port&#039;&#039;&#039;. See [https://github.com/nmingotti/Cuis-Smalltalk-SerialPort SerialPort] package, it has documentation.&lt;br /&gt;
&lt;br /&gt;
== Run external programs ==&lt;br /&gt;
If you run Cuis in Linux/Unix, and to some extent also in the Mac, you can use thousands of already written shell programs that solve the most diverse issues. Examples:&lt;br /&gt;
&lt;br /&gt;
* Do you want to know how much free space is available on the disk?&lt;br /&gt;
* How many wireless networks your computer can see? &lt;br /&gt;
* Run an R script to make a fantastic plot?&lt;br /&gt;
* ...  these and thousands of other things are possible once you are able to leverage the power of Unix from Cuis.&lt;br /&gt;
&lt;br /&gt;
You can perform these kind of operations with the module &amp;lt;code&amp;gt;OSProcess&amp;lt;/code&amp;gt; included in Cuis or with the external package &amp;lt;code&amp;gt;CommandShell&amp;lt;/code&amp;gt;. The second is easier, the first is lower level =&amp;gt; more difficult but more flexible.  &lt;br /&gt;
&lt;br /&gt;
* [[Traps and pitfalls specific to running external programs]]&lt;br /&gt;
* [[The basics of interacting with Unix]] . Find this process &amp;lt;code&amp;gt;pid&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;ARGV&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;ENV&amp;lt;/code&amp;gt; , &amp;lt;code&amp;gt;stdin&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;stdout&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;stderr&amp;lt;/code&amp;gt; ... and all those fundamental things.&lt;br /&gt;
* [[Run a program with OSProcess]]&lt;br /&gt;
* [[Run a program with CommandShell]]&lt;br /&gt;
&lt;br /&gt;
== Networking and the Web ==&lt;br /&gt;
&lt;br /&gt;
* How to ping a computer&lt;br /&gt;
* How to discover the IP of a given host name&lt;br /&gt;
* How to get a webpage&#039;s content&lt;br /&gt;
&lt;br /&gt;
== Databases ==&lt;br /&gt;
&lt;br /&gt;
* Talk to &#039;&#039;&#039;PostgreSQL&#039;&#039;&#039;. See the PostgreSQL package, it has documentation.&lt;br /&gt;
* Talk to MongoDB&lt;br /&gt;
* Talk to SQlite&lt;br /&gt;
&lt;br /&gt;
== Scripting Cuis ==&lt;br /&gt;
This section is about setting Cuis to start up in the way you like it, on any image you may want to boot.&lt;br /&gt;
&lt;br /&gt;
* Author name and initials programmatically&lt;br /&gt;
* Set your preferred font size&lt;br /&gt;
* Set your user name&lt;br /&gt;
* Stop the system from asking to save the image on pressing Cuis World-&amp;gt;Quit&lt;br /&gt;
* An example of customized Cuis startup Requires only one executable script file !&lt;br /&gt;
* Do ENV variables affect Cuis ?&lt;br /&gt;
* How do I pass a string to be executed by Cuis when it boots ?&lt;br /&gt;
* How do I pass a file to be executed by Cuis when it boots ?&lt;br /&gt;
* How to quit Cuis immediately. No questions asked.&lt;br /&gt;
&lt;br /&gt;
== Scripting with Cuis ==&lt;br /&gt;
Is it possible to make Unix scripts with Cuis? Does it make any sense? This section explores these subjects.&lt;br /&gt;
&lt;br /&gt;
* Initial considerations. here&lt;br /&gt;
&lt;br /&gt;
= Delivering an application written in Cuis =&lt;br /&gt;
This section explores ways in which you can have other people, non programmers, use your coolest applications. To run the application it may be necessary to: [1] Run VM and an Image [2] Run VM + Image + some code snippet passed as a String [3] Run VM + Image + a script file.&lt;br /&gt;
&lt;br /&gt;
* Deploy a Cuis application in Linux&lt;br /&gt;
* Deploy a Cuis application in Windows-10&lt;br /&gt;
* Deploy a Cuis application in MacOS&lt;br /&gt;
&lt;br /&gt;
= Morphic Cookbook =&lt;br /&gt;
&lt;br /&gt;
* Basic operations with Morphs&lt;br /&gt;
* Kill a Morph . A few ways to destroy a Morph.&lt;br /&gt;
* Place Morphs in World as you wish, automatically&lt;br /&gt;
* Drawing and pictures with the ImageMorph&lt;br /&gt;
* Application. Convert a color image to black and white&lt;br /&gt;
* Application. Show contours in an image&lt;br /&gt;
* How to layout the Morphs . This is the basic step to know prodromic to make your own GUI in Cuis.&lt;br /&gt;
* Fonts - 1. First interactions with Fonts&lt;br /&gt;
* Basic event handling in Morphic . Here we see how to do something when a mouse button or a key on the keyboard get pressed.&lt;br /&gt;
&lt;br /&gt;
= The Sound system =&lt;br /&gt;
To some people doing programming is manipulating sounds. As for some other people it is building a nice graphical user interface or some one else does networks services. For this reason the sound system chapter is placed after Morphic. &lt;br /&gt;
&lt;br /&gt;
All this chapter requires you to load the sound module.  &amp;lt;syntaxhighlight lang=&amp;quot;smalltalk&amp;quot;&amp;gt;&lt;br /&gt;
Feature require: &#039;Sound&#039;.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* [[First experiments with sound]] . Collecting knowledge here, when ready will be split into topics&lt;br /&gt;
* [[Play a melody writing a list of note names and their duration]] . Ok for note in the format C,D,E... TODO for notes with Italian names: Do, Re, Mi...&lt;br /&gt;
* TODO. Realtime sound playing. On event play immediately a sound, simulate and instrument typing on your computer keyboard&lt;br /&gt;
* [[Create and play *.wav files]]. &lt;br /&gt;
* [[References to the Sound system]] . for further study&lt;br /&gt;
&lt;br /&gt;
= Introspection and The compiler =&lt;br /&gt;
These notes are taken reading the wonderful document &amp;quot;The HitchHiker&#039;s guide to the Smalltalk Compiler&amp;quot; by Vassili Bykov, here .&lt;br /&gt;
&lt;br /&gt;
* get the current World object.&lt;br /&gt;
* what happens when Cuis start up.&lt;br /&gt;
* the main loop.&lt;br /&gt;
* The Cuis scanner.&lt;br /&gt;
* The Cuis parser.&lt;br /&gt;
* See the compiled code.&lt;br /&gt;
&lt;br /&gt;
= The Virtual Machine =&lt;br /&gt;
&lt;br /&gt;
* Building the Virtual Machine&lt;br /&gt;
* Building the VectorGraphics plugin&lt;br /&gt;
* Choosing between FFI and plugin&lt;br /&gt;
* Run a script with a proper window title&lt;br /&gt;
&lt;br /&gt;
= Applications built on Cuis =&lt;br /&gt;
&lt;br /&gt;
* DrGeo. &lt;br /&gt;
* Borghi DataStreamer. &lt;br /&gt;
&lt;br /&gt;
== TODO ==&lt;br /&gt;
These are reminders for me about things to do in the Cookbook or in Cuis&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;DEV&#039;&#039;&#039;. SpellChecker, for text panes in Cuis. It would be useful to be able to spellcheck comments in code. I like to put comments, without spell checker they are so full of bugs they appear really untrustworthy.&lt;br /&gt;
* Video about class variables.&lt;br /&gt;
* Page about &#039;;&#039; -- &#039;::&#039; -- &#039;yourself&#039;.&lt;br /&gt;
* Video about installation of Cuis, not so easy the first time&lt;br /&gt;
* Video about updating Cuis, not obvious&lt;br /&gt;
* Video about using the Transcript efficiently&lt;br /&gt;
* Video about creation of a minimal GUI&lt;br /&gt;
* Video about creation of a minimal application, runnable from Linux command line&lt;br /&gt;
* Video about creation of a minimal application, runnable from Windows GUI&lt;br /&gt;
* Video about making Tests, and discovering how to use existing classes with them&lt;br /&gt;
* Video-or-page about variables, especially class variables&lt;/div&gt;</summary>
		<author><name>Ssmith2112</name></author>
	</entry>
	<entry>
		<id>http://95.179.246.60/mediawiki/index.php?title=Format_guidelines&amp;diff=215</id>
		<title>Format guidelines</title>
		<link rel="alternate" type="text/html" href="http://95.179.246.60/mediawiki/index.php?title=Format_guidelines&amp;diff=215"/>
		<updated>2025-06-03T13:51:01Z</updated>

		<summary type="html">&lt;p&gt;Ssmith2112: Fix typos&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* Accumulating material&lt;br /&gt;
* &#039;&#039;&#039;variable assignment syntax&#039;&#039;&#039;. Use &amp;lt;code&amp;gt;&#039;:=&#039;&amp;lt;/code&amp;gt; instead of &amp;lt;code&amp;gt;&#039;-&#039;&amp;lt;/code&amp;gt;.  Ratios. I like  &amp;lt;code&amp;gt;&#039;_&#039;&amp;lt;/code&amp;gt; more, when it is rendered in Cuis XXX-SHOW-IT-UNICODE-XXX  but there is a problem. (1) If we use the backward directed arrow the new user will be in trouble since he will not know how to type in that thing. (2) In other Smalltalks &amp;lt;code&amp;gt;&#039;:=&#039;&amp;lt;/code&amp;gt; is used more often, as far as I know.&lt;br /&gt;
* &#039;&#039;&#039;Syntax highlighting in big code chunks&#039;&#039;&#039;.  It is much easier to read. The automatic highlighter in Mediawiki does a good job.  To insert code you need to do &amp;lt;u&amp;gt;Insert -&amp;gt; More -&amp;gt; Code Block&amp;lt;/u&amp;gt;. &lt;br /&gt;
* &#039;&#039;&#039;Typing in small code chunks (inlined code)&#039;&#039;&#039;. At the moment I haven&#039;t found a way to highlight inlined code. To type in inlined code for the moment do: &amp;lt;u&amp;gt;(1) select a code chunk (2) Click &#039;&#039;&#039;A&#039;&#039;&#039; -&amp;gt;  Computer Code&amp;lt;/u&amp;gt; . &lt;br /&gt;
* &#039;&#039;&#039;Mouse button name by left-right order&#039;&#039;&#039;. Always use the convention first, second, third button. The ordering is left to right. Mice are supposed to have 3 buttons. If people have strange mice (see Apple) they know already how to simulate the 3 buttons. Don&#039;t use the button color names as it is done in Squeak. As of today naming mouse buttons by color just adds to the complexity and perplexity of the new user.&lt;br /&gt;
* aaa&lt;/div&gt;</summary>
		<author><name>Ssmith2112</name></author>
	</entry>
	<entry>
		<id>http://95.179.246.60/mediawiki/index.php?title=Why_Smalltalk%3F&amp;diff=214</id>
		<title>Why Smalltalk?</title>
		<link rel="alternate" type="text/html" href="http://95.179.246.60/mediawiki/index.php?title=Why_Smalltalk%3F&amp;diff=214"/>
		<updated>2025-06-02T14:36:05Z</updated>

		<summary type="html">&lt;p&gt;Ssmith2112: Fix typos&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;NOT COMPLETE -- ACCUMULATING MATERIAL&lt;br /&gt;
&lt;br /&gt;
It would be easy here to fill 10 pages of abstract concepts, I don&#039;t want to do that. We will compare Smalltalk with another language, a popular one, a good one: Python. If you already know Python, why should you learn Smalltalk? &lt;br /&gt;
&lt;br /&gt;
Let&#039;s start from a fundamental concept, almost all popular programming languages can solve almost all existing problems. So why learn more than one? Well, quoting &#039;&#039;Wittgenstein,&#039;&#039;  &amp;quot;My language is my world&amp;quot;, this holds true also for programming languages. When you choose a programming language you mostly don&#039;t choose what is possible for it to do, but what will be easy to achieve according to you or your organization&#039;s taste and preferences. For example, in C you can directly access memory locations, in Python and Smalltalk you can&#039;t easily, therefore if you are working at a very low level, e.g. you are writing a driver, C is a more fit tool. On the other side, suppose your problem is to find the 10 largest files in your computer that were last opened more than 1 year ago. In C, to do this will take about 1 hour, minimum. In Python and Smalltalk you can do it in a few minutes.  &lt;br /&gt;
&lt;br /&gt;
Factors useful in deciding the programming language for your next task.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;execution speed&#039;&#039;&#039;. How fast does your code need to run? Here the fastest are C, Fortran, and C++. Python and Smalltalk can&#039;t even compare to them. TODO COMPARE Python and Smalltalk speed.&lt;br /&gt;
* &#039;&#039;&#039;cross OS portability&#039;&#039;&#039;. Can you run your code in a Mac, Windows, Linux, BSD? Here Python and Smalltalk are very good and C is very bad, your code is going to run on the major OS without changes or with little changes. For example in Windows the root directory is &#039;C:\&#039; in Unix like systems it is &#039;/&#039;. These little things must always be fixed. In C you would need to compile a specific version of the program for every OS.&lt;br /&gt;
* &#039;&#039;&#039;cross architecture portability&#039;&#039;&#039;. Can you run your code in a normal PC as well as in a Raspberry Pi, in a BeagleBone Black, in a Web browser? In C this is a problem. Python is quite portable, and Smalltalk is the king - it can run in very different platforms, for example with [https://squeak.js.org/ SqueakJS] you can run your program written for a PC right on the Web. You can&#039;t do this easily in any other programming language to my knowledge.&lt;br /&gt;
* &#039;&#039;&#039;library availability for your task&#039;&#039;&#039;. Here C is the king, there is a library for everything. Python is still very good, the library park is huge, especially since it got supported from Google. In Smalltalk we are far from the level of C and Python. If you need a very specialized library, either you write it or you call external code.&lt;br /&gt;
* &#039;&#039;&#039;community size and colleagues&#039;&#039;&#039;.  At some point you will get stuck. It is true, with open source you can read all the code and answer your own questions but it can take a lot of effort and if you are at a beginner-intermediate level this is just not possible. Therefore, an important factor to consider is: can you communicate with somebody who may answer your question, are there enough people using the technology. Not least, can you find programmers who know the language and work with you on a project? Here C and Python shine, in Smalltalk it is a bit of an issue but we do have our communities.&lt;br /&gt;
* &#039;&#039;&#039;development speed&#039;&#039;&#039;. Here C is really bad, writing programs takes time, debugging is hard. Python is a lot better - I would estimate you can be 5-10 times faster writing in Python. Smalltalk is the best, with its powerful tools and Platonic design not only is development fast, debugging is fast and not so tedious. I estimate you can be 2-3 times faster writing in Smalltalk versus Python.&lt;br /&gt;
* &#039;&#039;&#039;software maintainability&#039;&#039;&#039;. The moment comes when software must be changed to adapt to new circumstances. In C these are often hard times, in Python better, but still, it&#039;s imperative nature may require you to understand the conceptual workflow of the entire application. The change from Python2 to Python3 was an example of this problem - people are still getting paid to convert scripts to Python3. Here, Smalltalk shines. It is a system made for changes and evolutive software development. There is no difference from the concept of software creation and software change, you work in the same way and Smalltalk, by default, brings the entire development environment with itself, editor and debugger included. In Smalltalk you always work on the running program. There is no concept of switching it off, changing the code, and then running it again. See it this way, for a &amp;quot;Python is better than C&amp;quot; zealot you will hear this argument: &amp;quot;There aren&#039;t boring compile steps&amp;quot;. A Smalltalk zealot laughs at that, he may tell you &amp;quot;There aren&#039;t boring shut down, correct, and restart the application steps&amp;quot;, the application is always running.&lt;br /&gt;
* &#039;&#039;&#039;vendor support&#039;&#039;&#039;. Is there a company that sells an implementation of your language? This can be useful, if you get in real trouble you would know where to ask for help at any level. For C, sure, there are several compiler vendors. Python is a community-only language and as far as I know there isn&#039;t a corporate release of the language, there are though thousands of Python software houses so you can consider yourself kind of safe. In Smalltalk there are vendors with a private implementation of the system, for example [https://www.cincomsmalltalk.com/main/products/visualworks/ VisualWorks]. If you are in a corporate environment consider well the option of using their services. Also, their documentation might be far superior to open source projects. It is an option to keep in mind.&lt;br /&gt;
* &#039;&#039;&#039;self mutability&#039;&#039;&#039;. At times you may want to do something unusual. Maybe you would like to change the language a bit, for example a change in the standard library. Let&#039;s say I want to teach the String class to recognize Italian words, say i want a String to be able to answer the question &#039;isItalian&#039;. In C there is not even the Class concept, in Python there are Classes but you just can&#039;t di it, the standard library is sealed you are not supposed to change it. In Smalltalk you can change whatever you want, you want to change the meaning of &#039;=&#039; between Floats? You can. Add a new operator &#039;@=&#039; to return true if two numbers are equal if their distance is less than 0.00000001? You can, and it is very easy, there isn&#039;t an arcane syntax, it is just standard procedure.&lt;br /&gt;
* &#039;&#039;&#039;the fun factor&#039;&#039;&#039;. After the birth of my first son I had to put a hard stop on Smalltalk coding. More urgent things popped into my hands and I had to restrict my coding to the minimum effort tool to get the job done. In my case it turned out to be a &#039;&#039;sh&#039;&#039; script or &#039;&#039;Python&#039;&#039; or &#039;&#039;Ruby&#039;&#039;.  Let&#039;s restrict to &#039;&#039;Python&#039;&#039;, the most generic tool. I can be very productive in Python, I have all libraries for what I need and I can operate from the shell, I don&#039;t need a GUI, which for server people like me is a major source of problems. But programming in Smalltalk is really another life with respect to Python, even using Python as a Lisp, so REPL&#039;ing all the time, testing all functions and objects and methods. There are 2 key points here: &#039;&#039;&#039;(1-observability)&#039;&#039;&#039; in Smalltalk, most of the time, you can see well the data structure going around your code since they are just objects. &#039;&#039;&#039;(2-correct-rerun-running-code)&#039;&#039;&#039; in Smalltalk when the program breaks it doesn&#039;t just tell you, &amp;quot;I found a problem in line 345&amp;quot; and spit at you the dead body of a stack trace. No, in Smalltalk the debugger opens and you are brought to the middle of the things while they are still happening. This is really, really the best experience. Lisp does kind of the same thing but inspecting live data structures in Lisp is a major source of pain.&lt;br /&gt;
&lt;br /&gt;
There is a first factor which is very important which is &#039;&#039;&#039;execution&#039;&#039;&#039; &#039;&#039;&#039;speed&#039;&#039;&#039;. Some languages are faster than others for example C is faster than Python and Smalltalk, so if speed is of paramount interest, let&#039;s say you are writing a new matrix multiplication algorithm, it is better you just do it in C. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Pure v.s. Mixed languages&#039;&#039;&#039;. Python is an imperative programming language which borrows some Object Orientation principles, some functional style and tries to make everybody happy. Consider this &amp;lt;code&amp;gt;l = [1,2,3]&amp;lt;/code&amp;gt; you made a list, you can&#039;t say &amp;lt;code&amp;gt;l.len()&amp;lt;/code&amp;gt; as it should be if Python was reasonably object oriented, no, no, you must do &amp;lt;code&amp;gt;len(l)&amp;lt;/code&amp;gt;. This is just arbitrary. There is not a global plan in the Python language, it grows to accommodate new fashions. Smalltalk is completely different. In Smalltalk there is a plan, a view of the world and it is inescapable, everything is an object and the only thing you can do is send an object a message. Therefore if I tell you that the format to send a message to an object is &amp;lt;code&amp;gt;OBJECT MESSAGE&amp;lt;/code&amp;gt; then you already know that if &amp;lt;code&amp;gt;L&amp;lt;/code&amp;gt; is some kind of list object and &amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt; is an available message for it, for sure, you can just do &amp;lt;code&amp;gt;L size&amp;lt;/code&amp;gt;. Do you want to upcase a string? what if &amp;lt;code&amp;gt;S&amp;lt;/code&amp;gt; is a string you just do &amp;lt;code&amp;gt;S upcase&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A programming language v.s. an operating system&#039;&#039;&#039;. ... &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Closed languages vs. Open languages&#039;&#039;&#039;. Suppose you want to teach a Python string how to do something. That is, for example, you read a CSV file or are receiving data from a web form, you are parsing fields and you have one for phone numbers. You may have prepared a proper PhoneNumber class to deal with this kind of data but when you read the CSV it will arrive to you as a String. So you would like to do something like this: &amp;lt;code&amp;gt;&#039;+39425805040&#039;.toPhoneNumber() &amp;lt;/code&amp;gt;  well, you can forget about it, you can&#039;t do it in Python, built in data structures are untouchable. In Smalltalk instead it is a very simple process, you add the &amp;lt;code&amp;gt;toPhoneNumber&amp;lt;/code&amp;gt; to the String class and that&#039;s it, your program now knows how to transform String into PhoneNumbers. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Chained v.s. unchained languages&#039;&#039;&#039;. Suppose you are dealing with a very special problem and you need to redefine a builtin method.... no tail call regression ...&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Live programming environment vs. Write-Run-Stop-Write-Run loop&#039;&#039;&#039;. This will seem like magic to you, it was for me. The way we are used to programming a computer is this: we write a program, run it, see what does not work, stop it (if it does not die by itself due to a bug) write in a correction, run again. Repeat the loop, this is your programmer day. If you are unlucky there is also the compile step, if you are really unlucky add the reboot step. Well, forget about this horrible situation, the Smalltalk programming environment is always active! Smalltalk never stops, when a strange condition happens a debugger pops up and asks you 99% of the time &amp;quot;This object does not know how to answer to the message you sent it, what do we do?&amp;quot; . It is nothing dramatic, you teach the object how to answer the message and the program goes on. It seems unreal, but it is just like that. Your programmer day is now building nice objects which are able to understand messages. It could be that you are a scientific programmer and you need to teach the object &amp;lt;code&amp;gt;Matrix&amp;lt;/code&amp;gt; how to deal with a message &amp;lt;code&amp;gt;eigenvalues&amp;lt;/code&amp;gt;, it could be you are into web programming and your &amp;lt;code&amp;gt;WebServer&amp;lt;/code&amp;gt; object has received a message &amp;lt;code&amp;gt;getPriceItemWithCode:231231231&amp;lt;/code&amp;gt; it does not matter what you need to teach your computer, the scheme is fixed, it is just objects and messages. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;HackableSystems vs. LockedSystems&#039;&#039;&#039;. Suppose one day you want to change your control structures, for example, in your application, you would like to define a different kind of for loop, let&#039;s call it the &amp;lt;code&amp;gt;forgettyFor&amp;lt;/code&amp;gt;, that on each loop if forgets to iterate over one element taken at random. That is not going to be easy in Python. In Smalltalk it is trivial, because the for loop is achieved with a message, if you want to define &amp;lt;code&amp;gt;forgettyFor&amp;lt;/code&amp;gt; it is just matter of defining a new message.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Maintainability&#039;&#039;&#039;. The order spurs from the object system. ... &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Live inspectable and changeable objects&#039;&#039;&#039;. This concept does not exist in python. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;The magic of the event system&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Programming by simulation&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;The image&#039;&#039;&#039;. In Smalltalk there is the concept of the image. This does not exist in Python. The image contains all your program and state, always. At some time you can tell Smalltalk to save the image to a file and then, another day, recover to that exact point. You can send the image to a remote colleague for him to see what you are seeing right now, no differences. This can be extremely helpful in at least a few circumstances, you found a bug, you would like to make a proper correction but for the moment the program needs to just run, so you save the image into a file, make a quick fix then send yourself the broken image to produce a better quality code patch. Consider another case, you are doing a simulation, there are several random variables, and the simulation took hours or days to complete. You see some incredible results, you need to think about it, show it to your colleagues, so you save the image into a file and when you will be ready you can inspect whatever you wish. Isn&#039;t that fantastic? A few other languages have images, like &#039;&#039;Common Lisp&#039;&#039; and &#039;&#039;R&#039;&#039;, but in Smalltalk the image is even more interesting because with its integrated environment looking into variables (which for us are objects) is a pleasant activity compared to digging into data files, core dumps or JSON structures from the command line.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;ease of code hiding&#039;&#039;&#039;. If you are not running an opensource project soon enough you will hit this problem: &amp;quot;If I leave my code open my software will be copied and I can&#039;t sell it to anybody&amp;quot;. This is an unfortunate truth. So, if you need to hide your code, at this moment in time, Cuis-Smalltalk is not the tool for you. AFAIK the same goes for Pharo and Squeak. You may wish to try some commercial Smalltalk, for example Cincom.&lt;/div&gt;</summary>
		<author><name>Ssmith2112</name></author>
	</entry>
	<entry>
		<id>http://95.179.246.60/mediawiki/index.php?title=The_things_you_may_call_a_List&amp;diff=158</id>
		<title>The things you may call a List</title>
		<link rel="alternate" type="text/html" href="http://95.179.246.60/mediawiki/index.php?title=The_things_you_may_call_a_List&amp;diff=158"/>
		<updated>2025-05-12T03:18:02Z</updated>

		<summary type="html">&lt;p&gt;Ssmith2112: Fix typos&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In many other programming languages such as Python, Ruby, Lisp-like etc. you will find a structure called &#039;&#039;&#039;list&#039;&#039;&#039;. This is a beautiful structure where you can put stuff in, also of different kinds, you can remove stuff, search the list. It grows by itself its size to fit your requests. It is really handy.&lt;br /&gt;
&lt;br /&gt;
In Cuis, and in Smalltalk in general, we don&#039;t have a data structure named &#039;&#039;list&#039;&#039;. The thing that is nearest to it is the class &#039;&#039;&#039;OrderedCollection&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
There is one thing that may confuse you so let&#039;s get it straight from the beginning. Python, Ruby, Lisp-likes have a way to type in lists directly. In Smalltalk when we type in an object that looks like a list the system store it as an &#039;&#039;&#039;Array&#039;&#039;&#039;. But no worries, &#039;&#039;Array&#039;&#039; and &#039;&#039;OrderedCollection&#039;&#039; are both descendants of &#039;&#039;&#039;SequenceableCollection&#039;&#039;&#039; so many operations work on both data structures and you can easily convert one into another.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Exercise&#039;&#039;&#039;. Open the Browser and check what messages an object of class &#039;&#039;SequenceableColletion&#039;&#039; can understand.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Exercise&#039;&#039;&#039;. Open a Browser and confirm that &#039;&#039;SequenceableCollection&#039;&#039; is an ancestor of both &#039;&#039;Array&#039;&#039; and &#039;&#039;OrderedCollection&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
In the following, to keep the language compact I will talk about &#039;&#039;lists&#039;&#039;, but you have been warned, there is no &#039;&#039;list&#039;&#039; in Smalltalk. Also, I will use the variable &amp;lt;code&amp;gt;v&amp;lt;/code&amp;gt; to store intermediate results just because it looks better than &amp;lt;code&amp;gt;l&amp;lt;/code&amp;gt;, which I often confuse with &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt; (one).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;CAVEAT&#039;&#039;&#039;. We are not going to cover here examples of all possible methods you can use on lists. Use the &#039;&#039;&#039;Terse Guide&#039;&#039;&#039; to see more possibilities and of course the Browser at the relevant Class.&lt;br /&gt;
&lt;br /&gt;
=== Make a list &#039;by hand&#039;, equivalent of &amp;lt;code&amp;gt;v = [1,2,3]&amp;lt;/code&amp;gt; in Python/Ruby and others. ===&lt;br /&gt;
 v _ #(1 2 3).    &amp;quot;=&amp;gt;  #(1 2 3) &amp;quot;&lt;br /&gt;
 v class.         &amp;quot; Array &amp;quot;&lt;br /&gt;
or&lt;br /&gt;
 v _ {1+2. 123. 7/2. &#039;hello&#039;.}. &amp;quot; #(3 123 7/2 &#039;hello&#039;) &amp;quot;&lt;br /&gt;
 v class.                       &amp;quot; Array &amp;quot;&lt;br /&gt;
Observe that in this second case the list has been made with the results of the evaluation of a &#039;&#039;sequence of commands&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Make a list, programmatically ===&lt;br /&gt;
 v _ OrderedCollection new.  &amp;quot;=&amp;gt;  an OrderedCollection() &amp;quot;&lt;br /&gt;
 v add: 1.&lt;br /&gt;
 v add: &#039;foo bar&#039;. &lt;br /&gt;
 &amp;quot;let&#039;s go higher, put another list into the list&amp;quot;&lt;br /&gt;
 v2 _ OrderedCollection new. &lt;br /&gt;
 v2 add: &#039;tizio&#039; . oc2 add: &#039;caio&#039;. oc2 add: &#039;sempronio&#039;. &lt;br /&gt;
 v add: v2. &lt;br /&gt;
 v                           &amp;quot;=&amp;gt; an OrderedCollection(1 &#039;foo bar&#039; an OrderedCollection(&#039;tizio&#039; &#039;caio&#039; &#039;sempronio&#039;)) &amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== The Smalltalk way to see a list ===&lt;br /&gt;
Comparing to Python and Ruby representation of the list you would say that we are really bad. Well, look now, leverage Smalltalk integrated graphical user interface.&lt;br /&gt;
 v explore . &lt;br /&gt;
&lt;br /&gt;
=== Check if a list contains an element ===&lt;br /&gt;
 #(1 2 3) includes: 2.     &amp;quot;=&amp;gt; true &amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== Return the first element of the list satisfying a property ===&lt;br /&gt;
 #(1 2 3 4 5 6) detect: [:a | a &amp;gt; 3] ifNone: nil.        &amp;quot;=&amp;gt;  4 &amp;quot;&lt;br /&gt;
 #(1 2 3 4 5 6) detect: [:a | a &amp;gt; 10] ifNone: nil.       &amp;quot;=&amp;gt; nil &amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== Return all elements of a list satisfying a property ===&lt;br /&gt;
 #(1 2 3 4 5 6) select: [:a | a &amp;gt; 3] .     &amp;quot;=&amp;gt; #(4 5 6) &amp;quot;&lt;br /&gt;
 #(1 2 3 4 5 6) select: [:a | a &amp;gt; 10] .    &amp;quot;=&amp;gt; #() &amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== Iterate over elements of a list for side effects ===&lt;br /&gt;
 tmp _ 0 . &lt;br /&gt;
 #(10 20 30) do: [ :x | tmp _ tmp + x ] .&lt;br /&gt;
 tmp.       &amp;quot;=&amp;gt; 60 &amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== map. Apply an operation to all elements of a list and build a new list with the results ===&lt;br /&gt;
 #(1 2 3) collect: [:el | 2 * el ] .      &amp;quot;=&amp;gt; #(2 4 6) &amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== remove. all elements from a list if they satisfy a property ===&lt;br /&gt;
 se _ Set new. &lt;br /&gt;
 se add: 1.&lt;br /&gt;
 se add: 2. &lt;br /&gt;
 se removeAllSuchThat: [:x | x == 2] . &lt;br /&gt;
&lt;br /&gt;
=== TODO Return the list of all indexes of elements satisfying a property ===&lt;br /&gt;
----NM started on 15-Aug-2021. Examples done in Cuis5.0-4738.image&lt;/div&gt;</summary>
		<author><name>Ssmith2112</name></author>
	</entry>
	<entry>
		<id>http://95.179.246.60/mediawiki/index.php?title=The_Cuis_Cookbook&amp;diff=157</id>
		<title>The Cuis Cookbook</title>
		<link rel="alternate" type="text/html" href="http://95.179.246.60/mediawiki/index.php?title=The_Cuis_Cookbook&amp;diff=157"/>
		<updated>2025-05-12T03:07:41Z</updated>

		<summary type="html">&lt;p&gt;Ssmith2112: Fix typos&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
A programming language cookbook is something like &#039;&#039;StackOverflow&#039;&#039;, without the digging part and the try&amp;amp;pray experience. For a gentle and structured introduction to Cuis-Smalltalk, you should start with the &#039;&#039;&#039;The Cuis Book&#039;&#039;&#039; and &#039;&#039;&#039;Learning-Cuis&#039;&#039;&#039; more about this on the [[CuisCoookBook-References|References]]. This is intended to be a &amp;lt;u&amp;gt;resource for programmers&amp;lt;/u&amp;gt;, in the sense that it answers questions that will naturally come up to programmers while exploring Smalltalk. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Reliability&#039;&#039;&#039;. I am writing these notes while learning Cuis. Some of what I write may not be the best way to solve the problem, it may not even be correct. Be patient, double check! Since I use these recipes myself I am going to improve them in time.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Sorting principles&#039;&#039;&#039;. Topic order is intended to go from easy to difficult. From frequently necessary to rarely used. From needed at the beginning of the programming experience to needed by black belts. These three forces, as the 3 laws of robotics, regulate what chapter goes toward the top of the document. They hold also for sub-chapters and articles.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Contributions&#039;&#039;&#039;. I am trying to figure out ways to make contributions possible and fruitful, see [[contributions motivated guidelines]]. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Copyright&#039;&#039;&#039;. You have the right to read, print for your own use and contribute to the document. You can make external links to this document. You can not copy the document and make it available somewhere else on the Internet. You can&#039;t claim ownership. You can&#039;t bring the document to an editor and publish it. I, as the author of more than 99% of the words here displayed retain all rights as well as the right to change these rules.&lt;br /&gt;
&lt;br /&gt;
* [[Introduction]]. What you should expect from this book and the reason why I am writing it. STARTED.&lt;br /&gt;
* [[Why Smalltalk?]]. For what reason should you learn another programming language which is also not so popular. Read on, there are very good reasons. STARTED.&lt;br /&gt;
&lt;br /&gt;
== Installation and start up ==&lt;br /&gt;
&lt;br /&gt;
* Install and run Cuis in Windows&lt;br /&gt;
* Install and run Cuis in the Mac&lt;br /&gt;
* [[Install and run Cuis in Linux]]&lt;br /&gt;
* [[Run Cuis in the Web Browser. (SqueakJS)]]&lt;br /&gt;
* [[Run Cuis in a ARM platform, RPi, BeagleBone and similar. (Linux)]]&lt;br /&gt;
* Run Cuis in a remote server. (Linux)&lt;br /&gt;
* Run Cuis on the metal: without Operating System&lt;br /&gt;
* How to keep Cuis updated&lt;br /&gt;
* [[How to load the most recent changes Juan made to Cuis-Smalltalk-Dev]]&lt;br /&gt;
&lt;br /&gt;
== Cuis in its environment ==&lt;br /&gt;
&lt;br /&gt;
* What is a .image file?&lt;br /&gt;
* What is a .changes file?&lt;br /&gt;
* [[What is a .user.changes file?]]&lt;br /&gt;
* [[What is a .log file?]]&lt;br /&gt;
* [[What is release of the image and VM I am running?]]&lt;br /&gt;
&lt;br /&gt;
== Things unique to Cuis and/or Smalltalk ==&lt;br /&gt;
Here are all the things that are totally unknown for anybody who never programmed in any Smalltalk.&lt;br /&gt;
&lt;br /&gt;
* [[How can I make X? Learn to fish in Smalltalk|How can I make X ? Learn to fish in Smalltalk]]&lt;br /&gt;
* [[First things first: 1+1 and &amp;quot;Hello World&amp;quot;]]&lt;br /&gt;
* How can I type in a basic object ? [[Know the literals]] !&lt;br /&gt;
* [[You want something to get done? Ask an object to do it!]]&lt;br /&gt;
* [[How do I define a function?]]&lt;br /&gt;
* [[How do I create my own Class with some methods inside it?]]&lt;br /&gt;
* [[What is a package? How do I create, load and unload one?]]&lt;br /&gt;
* [[My project needs to add a method to somebody else Class, how do I do it?|My project needs to add a method to somebody else Class, how do I do it ?]]&lt;br /&gt;
* [[How to use Class variables]]. STARTED&lt;br /&gt;
* [[Learn how to use the Transcript]] . This is really important, better you take a peek.&lt;br /&gt;
* [[Tips &amp;amp; tricks]] . Those little keyboard/mouse shortcuts or little code snippets that may improve your programmer life.&lt;br /&gt;
* [[Traps and pitfalls for polyglot developers]] . If you know more programming languages this page is for you.&lt;br /&gt;
* [[&amp;quot;It didn&#039;t understand&amp;quot; can&#039;t happen]]. The end of most of your programmer anxiety. You can understand it all.&lt;br /&gt;
&lt;br /&gt;
== About a general Class and Object ==&lt;br /&gt;
&lt;br /&gt;
* [[Create automatically all accessors for a  Class instance variables]]&lt;br /&gt;
* [[Change the way an Object is printed]]&lt;br /&gt;
* [[Find all objects referencing anObject]]&lt;br /&gt;
* [[Make your own object initialization]]. All you need to know about &amp;lt;code&amp;gt;new&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;basicNew&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;initialize&amp;lt;/code&amp;gt; etc. STARTED&lt;br /&gt;
* [[How to dump and restore an Object]] -- STARTED&lt;br /&gt;
* [[How to manage a Class who should have only one instance]]&lt;br /&gt;
* [[Discover in what package a Class lives]]&lt;br /&gt;
* [[Follow step bye how a method call gets resolved. Example-1]]&lt;br /&gt;
&lt;br /&gt;
== Data Structures ==&lt;br /&gt;
&lt;br /&gt;
* Fundamentals: numbers, strings and symbols&lt;br /&gt;
&lt;br /&gt;
=== Strings (before default UTF) ===&lt;br /&gt;
&lt;br /&gt;
* [[Cuis-What Strings are made of and how|What Strings are made of and how]]&lt;br /&gt;
* [[Cuis-String escape|String escape]]&lt;br /&gt;
* [[Cuis-Automatically escape a complex string|Automatically escape a complex string]]&lt;br /&gt;
* [[String formatting with format:]]&lt;br /&gt;
* [[String formatting with printf:]]&lt;br /&gt;
* [[A thousand ways to say new line]] . Newline, to text find it fast&lt;br /&gt;
* [[Trim white chars]]&lt;br /&gt;
* [[String joining]]&lt;br /&gt;
* [[String splitting]]&lt;br /&gt;
* [[String search]]&lt;br /&gt;
* [[String replace]]&lt;br /&gt;
* [[Show me the string, but max N. characters]]&lt;br /&gt;
* [[Dump and restore JSON data strings]]&lt;br /&gt;
* [[How to hash a string]]&lt;br /&gt;
* [[Convert to Base64]]&lt;br /&gt;
* [[Convert strings from/to Utf8]]&lt;br /&gt;
* Remove accents with, &amp;lt;code&amp;gt;&#039;sarà&#039; asUnaccented .    =&amp;gt; &amp;quot; &#039;sara&#039; &amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
* [[Convert UTF16 to Latin1]]. This is quite useful, in Windows-10 UTF16 is called Unicode.&lt;br /&gt;
* Jump to the next level of power, [[use Regex]] . Last in the list for complexity, but should be first for power, don&#039;t overlook this.&lt;br /&gt;
&lt;br /&gt;
=== Collections ===&lt;br /&gt;
&lt;br /&gt;
* [[The things you may call a List]] -- STARTED&lt;br /&gt;
* [[Array]]&lt;br /&gt;
* [[Dictionary a.k.a. Hash Table]]&lt;br /&gt;
&lt;br /&gt;
== Streams ==&lt;br /&gt;
&lt;br /&gt;
* [[Make a stream from a string, for reading]].&lt;br /&gt;
* [[Write a long String with a Stream]]&lt;br /&gt;
* [[Write to stdout in any system]]. Not only Unix like. Useful for shell programs.&lt;br /&gt;
&lt;br /&gt;
== Date and time ==&lt;br /&gt;
&lt;br /&gt;
* [[Get the current date and time]]&lt;br /&gt;
* [[Format date and time as you like most]]&lt;br /&gt;
* [[Date and time algebra]]&lt;br /&gt;
* [[Get the current time with the highest precision]]&lt;br /&gt;
* [[Get date and time as Unix epoch]]&lt;br /&gt;
* [[Get date and time in a different country]]&lt;br /&gt;
* [[Measure how much time it takes to run a code block]]&lt;br /&gt;
&lt;br /&gt;
== Files and directories ==&lt;br /&gt;
You should keep in mind that Smalltalk uses files but it is not based on files. I copy here&lt;br /&gt;
&lt;br /&gt;
part of a &#039;&#039;Juan&#039;&#039; mail to mailing list: &amp;quot;... The essential idea you need to be aware of when learning about all this is that Smalltalk uses files, but it is not file-based. What this means is that all the tools in the Smalltalk image (with the only exception of FileList and FileContentsBrowser) are NOT showing files, but &#039;&#039;&#039;live objects&#039;&#039;&#039;. The way them relate to files is usually not really important ...&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* [[How to Read or Write a text file]] . without Streams, only Strings.&lt;br /&gt;
* [[How to Read or Write a text file with a Stream]]&lt;br /&gt;
* [[Read a file line by line]] . Or any general delimiter.&lt;br /&gt;
* [[Find the current directory, list it and move in the directory tree]]&lt;br /&gt;
* [[Filename extensions]]: .txt, .csv, .json ...&lt;br /&gt;
* [[Check things on a pathname. Is there anything? Is it a file? Is it writable?]] ...&lt;br /&gt;
* [[Delete files and directories]]&lt;br /&gt;
* [[Read/Write a binary file]]&lt;br /&gt;
* [[Create a new non-existing file name]]&lt;br /&gt;
* [[Using file locks]] -- TODO&lt;br /&gt;
* [[Get the list of open files]]&lt;br /&gt;
* [[Get the directory where a Class (its Package) is stored]]&lt;br /&gt;
* [[Where is the image file? Where is the VM?]]&lt;br /&gt;
&lt;br /&gt;
== Error Handling and the Debugger ==&lt;br /&gt;
&lt;br /&gt;
* [[Call the debugger from a code location]]&lt;br /&gt;
* [[Quick exception handling]], equivalent of Python &amp;lt;code&amp;gt;try ... except&amp;lt;/code&amp;gt;&lt;br /&gt;
* [[Assertions]]&lt;br /&gt;
* [[Errors, raise and catch signals]]&lt;br /&gt;
* Case-study-1. &#039;&#039;&#039;TODO&#039;&#039;&#039;. When the debugger pops up send me an email&lt;br /&gt;
* b&lt;br /&gt;
&lt;br /&gt;
== Processes ==&lt;br /&gt;
&lt;br /&gt;
* [[Smalltalk processes are not Unix processes]]&lt;br /&gt;
* [[See the list of running processes]]&lt;br /&gt;
* [[Processes 101]]. Shows how to create a process, name it, start it, stop it and destroy it.&lt;br /&gt;
* [[Run a new process]]&lt;br /&gt;
* [[Kill a process]]&lt;br /&gt;
&lt;br /&gt;
== Uncategorized useful features ==&lt;br /&gt;
&lt;br /&gt;
* [[Run a method every 2 hours or every day at 15:00]], equivalent to Unix cron&lt;br /&gt;
* [[Zip and unZip files and directories]] --- TODO, miss zipping&lt;br /&gt;
* [[Convert a file to/from Base64]]&lt;br /&gt;
* [[Deal with XML files]] -- STARTED&lt;br /&gt;
* [[About Random]]&lt;br /&gt;
* [[How to invoke the garbage collector]]&lt;br /&gt;
* [[Adapt newline characters to Cuis standard]]&lt;br /&gt;
* [[Where to get information about the hardware]] . Screen size, free memory, cpu speed ...&lt;br /&gt;
* [[The Dependency Mechanism - part 1]]. Here we talk about the Smalltalk classic &#039;&#039;&#039;Parent&#039;&#039;&#039; - &#039;&#039;&#039;Dependent&#039;&#039;&#039; model.&lt;br /&gt;
* [[The Dependency Mechanism - part 2]]. Here we explain the why of a &#039;&#039;&#039;Model&#039;&#039;&#039; class.&lt;br /&gt;
* [[The Dependency Mechanism - part 3]]. Here we talk about the &#039;&#039;&#039;Observer Pattern&#039;&#039;&#039;. (preferred current method in Cuis)&lt;br /&gt;
* How to use the &#039;&#039;&#039;serial port&#039;&#039;&#039;. See [https://github.com/nmingotti/Cuis-Smalltalk-SerialPort SerialPort] package, it has documentation.&lt;br /&gt;
&lt;br /&gt;
== Run external programs ==&lt;br /&gt;
If you run Cuis in Linux/Unix, and to some extent also in the Mac, you can use thousands of already written shell&lt;br /&gt;
&lt;br /&gt;
programs that solve the most diverse issues. Do you want to know how much free space is available on the disk?&lt;br /&gt;
&lt;br /&gt;
How many wireless networks your computer can see? Run an R script to make a fantastic plot? These and thousands&lt;br /&gt;
&lt;br /&gt;
of other things are possible once you are able to leverage the power of Unix from Cuis.&lt;br /&gt;
&lt;br /&gt;
You can perform these kind of operations with the module &amp;lt;code&amp;gt;OSProcess&amp;lt;/code&amp;gt; included in Cuis or with the external package &amp;lt;code&amp;gt;CommandShell&amp;lt;/code&amp;gt;. The second is easier the first is more lower level.&lt;br /&gt;
&lt;br /&gt;
* Traps and pitfalls specific to running external programs&lt;br /&gt;
* The ABCs of interacting with Unix . Find this process &amp;lt;code&amp;gt;pid&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;ARGV&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;ENV&amp;lt;/code&amp;gt; , &amp;lt;code&amp;gt;stdin&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;stdout&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;stderr&amp;lt;/code&amp;gt; ... and all those fundamental things.&lt;br /&gt;
* Run a program with OSProcess&lt;br /&gt;
* Run a program with CommandShell&lt;br /&gt;
&lt;br /&gt;
== Networking and the Web ==&lt;br /&gt;
&lt;br /&gt;
* How to ping a computer&lt;br /&gt;
* How to discover the IP of a given host name&lt;br /&gt;
* How to get a webpage&#039;s content&lt;br /&gt;
&lt;br /&gt;
== Databases ==&lt;br /&gt;
&lt;br /&gt;
* Talk to &#039;&#039;&#039;PostgreSQL&#039;&#039;&#039;. See the PostgreSQL package, it has documentation.&lt;br /&gt;
* Talk to MongoDB&lt;br /&gt;
* Talk to SQlite&lt;br /&gt;
&lt;br /&gt;
== Scripting Cuis ==&lt;br /&gt;
This section is about setting Cuis to start up in the way you like it, on any image you may want to boot.&lt;br /&gt;
&lt;br /&gt;
* Author name and initials programmatically&lt;br /&gt;
* Set your preferred font size&lt;br /&gt;
* Set your user name&lt;br /&gt;
* Stop the system from asking to save the image on pressing Cuis World-&amp;gt;Quit&lt;br /&gt;
* An example of customized Cuis startup Requires only one executable script file !&lt;br /&gt;
* Do ENV variables affect Cuis ?&lt;br /&gt;
* How do I pass a string to be executed by Cuis when it boots ?&lt;br /&gt;
* How do I pass a file to be executed by Cuis when it boots ?&lt;br /&gt;
* How to quit Cuis immediately. No questions asked.&lt;br /&gt;
&lt;br /&gt;
== Scripting with Cuis ==&lt;br /&gt;
Is it possible to make Unix scripts with Cuis? Does it make any sense? This section explores these subjects.&lt;br /&gt;
&lt;br /&gt;
* Initial considerations. here&lt;br /&gt;
&lt;br /&gt;
= Delivering an application written in Cuis =&lt;br /&gt;
This section explores ways in which you can have other people, non programmers, use your coolest applications. To run the application it may be necessary to: [1] Run VM and an Image [2] Run VM + Image + some code snippet passed as a String [3] Run VM + Image + a script file.&lt;br /&gt;
&lt;br /&gt;
* Deploy a Cuis application in Linux&lt;br /&gt;
* Deploy a Cuis application in Windows-10&lt;br /&gt;
* Deploy a Cuis application in MacOS&lt;br /&gt;
&lt;br /&gt;
= Morphic Cookbook =&lt;br /&gt;
&lt;br /&gt;
* Basic operations with Morphs&lt;br /&gt;
* Kill a Morph . A few ways to destroy a Morph.&lt;br /&gt;
* Place Morphs in World as you wish, automatically&lt;br /&gt;
* Drawing and pictures with the ImageMorph&lt;br /&gt;
* Application. Convert a color image to black and white&lt;br /&gt;
* Application. Show contours in an image&lt;br /&gt;
* How to layout the Morphs . This is the basic step to know prodromic to make your own GUI in Cuis.&lt;br /&gt;
* Fonts - 1. First interactions with Fonts&lt;br /&gt;
* Basic event handling in Morphic . Here we see how to do something when a mouse button or a key on the keyboard get pressed.&lt;br /&gt;
&lt;br /&gt;
= The Sound system =&lt;br /&gt;
To some people doing programming is manipulating sounds. As for some other people it is building a nice graphical user interface or some one else does networks services. For this reason the sound system chapter is placed after Morphic. &lt;br /&gt;
* [[First experiments with sound]] . Collecting knowledge here, when ready will be split into topics&lt;br /&gt;
&lt;br /&gt;
= Introspection and The compiler =&lt;br /&gt;
These notes are taken reading the wonderful document &amp;quot;The HitchHiker&#039;s guide to the Smalltalk Compiler&amp;quot; by Vassili Bykov, here .&lt;br /&gt;
&lt;br /&gt;
* get the current World object.&lt;br /&gt;
* what happens when Cuis start up.&lt;br /&gt;
* the main loop.&lt;br /&gt;
* The Cuis scanner.&lt;br /&gt;
* The Cuis parser.&lt;br /&gt;
* See the compiled code.&lt;br /&gt;
&lt;br /&gt;
= The Virtual Machine =&lt;br /&gt;
&lt;br /&gt;
* Building the Virtual Machine&lt;br /&gt;
* Building the VectorGraphics plugin&lt;br /&gt;
* Choosing between FFI and plugin&lt;br /&gt;
* Run a script with a proper window title&lt;br /&gt;
&lt;br /&gt;
= Applications built on Cuis =&lt;br /&gt;
&lt;br /&gt;
* DrGeo&lt;br /&gt;
&lt;br /&gt;
== TODO ==&lt;br /&gt;
These are reminders for me about things to do in the Cookbook or in Cuis&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;DEV&#039;&#039;&#039;. SpellChecker, for text panes in Cuis. It would be useful to be able to spellcheck comments in code. I like to put comments, without spell checker they are so full of bugs they appear really untrustworthy.&lt;br /&gt;
* Video about class variables.&lt;br /&gt;
* Page about &#039;;&#039; -- &#039;::&#039; -- &#039;yourself&#039;.&lt;br /&gt;
* Video about installation of Cuis, not so easy the first time&lt;br /&gt;
* Video about updating Cuis, not obvious&lt;br /&gt;
* Video about using the Transcript efficiently&lt;br /&gt;
* Video about creation of a minimal GUI&lt;br /&gt;
* Video about creation of a minimal application, runnable from Linux command line&lt;br /&gt;
* Video about creation of a minimal application, runnable from Windows GUI&lt;br /&gt;
* Video about making Tests, and discovering how to use existing classes with them&lt;br /&gt;
* Video-or-page about variables, especially class variables&lt;/div&gt;</summary>
		<author><name>Ssmith2112</name></author>
	</entry>
</feed>