Updates

Missing Favicon

The file favicon.ico is a file that appears as an icon for the webpage. This file can generally be found in the root director - for example: https://www.google.com/favicon.ico is a G representing Google, likewise a lighthouse for pharo.org:

Server Alias
The favicon can either be found in the root directory (like the google example), or as a link listed in the page header.

For Pier 5 and older, one would login as root and open setting at the root page, choose the file in 'Shortcut Icon:'. For Seaside 3.2 pages have the following in the header:

<link rel="shortcut icon" type="image/png" href="/pier?_s=fe-YRIO0hdXYmPie"/>

Loading the same icon and setting up accordingly in a newer version has the source:

<link rel="shortcut icon" type="image/png" href="/pier?_s="/>

This does not display the icon correctly.

If NGinX is running in front of Pier, then it can be setup with the following work-around in the config file:

 location = /favicon.ico {
   alias /data/static/favicon.ico;
 }
Posted by John Borden at 1 June 2020, 2:54 am with tags Pier link

Complete Task in List of Changes

Currently, when one clicks Changes for a ToDo list, it raises an error. The Changes view shows a logged-in user what has been updated, but clicking on a completed task brings up an error:

Unable to open 'Complete' in the current context

This should do something else. If a task is opened and a user clicks changes, it displays the editor on that task.

This is due to the following code:

PRCompleteToDoTaskCommand(class)>>isValidIn:
	^ (super isValidIn: aContext) and: [ aContext structure isRoot not and: [ aContext structure parent isToDo ] ]

One reason the code is written this way is so the Complete option only shows up on the menu when a task is open - it doesn't make sense to "complete" the Syntax page. The menu is the gray text at the bottom of this page, or in the left pane of the default install:

Complete in bold for a task
The code related to this is:

isValidIn: aContext
	^ (super isValidIn: aContext)
		and: [ aContext command class = self
				or: [ aContext command isView
						and: [ aContext command viewComponentClass isNotNil
								and: [ aContext command viewComponentClass = PRChangesView ] ] ] ]

The scenarios that this handles are:

  • When viewing or editing a page which is not a task or todo option, the Complete menu option should not show up
  • When opening the changes view from a page that contains some child which is a ToDo Task, any time the task was completed should be listed, and clicking on the open link should access that page
  • The Complete menu option is only available when viewing a complete history item, it opens the normal pier page editor

The tests for equality make adding a subclass of PRCompleteToDoTaskCommand more difficult than necessary, but this code is sufficient to create a non-abstract test. This allows adding:

PRCommand>>shouldBeIncludedInCompleteHistory
	^ false
PRViewCommand>>shouldBeIncludedInCompleteHistory
	^ self viewComponentClass isNotNil
		and: [ self viewComponentClass = PRChangesView ]
PRCompleteToDoTaskCommand>>shouldBeIncludedInCompleteHistory
	^ true

Then #isValidIn: can ask aContext's command if it should be displayed instead of performing checks itself.

Posted by John Borden at 26 April 2020, 10:31 pm with tags Pier link

Missing Parser in Pharo 8

Loading Pier 3.2 in Pharo 8 fails with the error:

This package depends on the following classes:
  SHParserST80
You must resolve these dependencies before you will be able to load these definitions:
  SHParserST80>>#ranges

The problem is clear from the code:

SPHighlightedCode>>rangesFor: aString
	"Try to find out if this is a method, maybe with a class declaration. Otherwise parse as expression."
	| parser index string |
	parser := SHParserST80 new.
	parser classOrMetaClass: classOrMetaClass.

This is found in the NECompletion package, which is loaded in BaselineOfBasicTools & BaselineOfIDE.

The shout package is used for code blocks like this (taken from Pillar docs):

[[[label=script1|caption=My script that works|language=smalltalk
self foo bar
]]]

Unfortunately these square brackets haven't worked in Pier since before Pharo 5. Removing the shout package seems like a logical choice.

A second problem is the load order for the Seaside and Grease. For Pharo 7 it can be loaded in either order, but for Pharo 8 if conflicts are ignored, or #onConflictUseIncoming is used, then http://localhost:8080 brings up the error:

Internal Error: BlockClosure>> #fixCallbackTemps

Using #onConflictUseLoaded resolves this problem.

Posted by John Borden at 26 March 2020, 12:02 pm with tags Pharo, pier link

Teapot Tutorial

While working through the Teapot tutorial in Chapter 1 & 2 of Enterprise Pharo, everything worked well locally. When installing on the Digital Ocean virtual server, a library issue popped up due to 32bit Pharo:

root@ubuntu-s-1vcpu-1gb-nyc1-01:~# ./pharo Pharo.image printVersion
Error. Could not determine platform's libc path for VM.
Try forcing $PLATFORMLIBDIR in /root/pharo-vm/pharo, based on LIBC_SO.
Please report what works to pharo [vm-dev] mail list.
  LIBC_SO=
  DISTRIB_ID=Ubuntu
  ...
  System seems to be 64 bit. You may need to (re)install the 32-bit libraries.
root@ubuntu-s-1vcpu-1gb-nyc1-01:~# apt install pharo6-32-ui pharo6-64-ui
Reading package lists... Done
Building dependency tree
Reading state information... Done
...
E: The repository 'http://download.opensuse.org/repositories/devel:/languages:/pharo:/stable/xUbuntu_16.04 ./ Release' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

Installing the 64bit of Pharo 8 worked well, similar to what was done for the example Pier install.

Posted by John Borden at 20 March 2020, 2:15 am link

Scratch to Smalltalk

The journalist Virginia Heffernan wrote a wired article titled Stemtrails:

The contemporary STEM curricula in lower schools seem, in fact, to have very little as a through line, unless you count the popular Scratch app, a production of the Siegel Family Endowment, which is heavily subsidized by Google and the Cartoon Network. The app lets kids learn loops and if-then blocks in a kind of baby programming language that no adult uses. It’s fun.

When reading the phrase "real languages", my first reaction was: We don't send kids down into salt mines either. If kids are using the same languages that are used in production today, should it surprise anyone that they don't have any new ideas?

For several years, I have been using Pier for years, but the Pillar project never seemed like anything more than an academic tool - it specializes in generating Latex for publishing in journals. After thinking on Virginia's quote I realized I had fallen into the same trap and ignored Pillar documentation. One benefit that I immediately gained after opening it was that I could use annotations instead of HTML for creating the above quote.

Several years ago, I wrote about principles learned using the EToy's Painting Tool, however there could be more done to move Scratchers to Smalltalk programmers where more principles could be discovered.

Posted by John Borden at 24 February 2020, 2:11 pm link
<< 1 2 3 4 5 6 7 8 9 10 >>