I booted up my Windows PC, and started Seaside, which defaults to running the web-server on port 8080.
I stopped the process, and changed the port number, (action-clicking on the the top pane of the Seaside control panel, then selecting 'Port...' from the menu), then re-starting, and got an error message.
I inferred from the error that port 80 was already in use.
So, at the Windows command prompt (Windows Start Menu, "cmd", or "cmd" and Shift-Control-Enter from an administrator account, to run with Administrator privileges)
NETSTAT -p tcp -ano
List all (-a) the ports using the TCP protocol (-p tcp) in numerical form (-n), and display the process id (PID) for the owning process (-o).
This was good, but it gave a PID of 4112 - which was not appearing on the list of processes and services in Windows Task Manager.
I then ran :
tasklist /FI "PID eq 4112" /FO table
Which lists the active tasks and processes /FIlterered by process Id equal to "4112", in the /FOrmat of a table (can also be a list or a csv).
It turned out to be Skype that had control of port 80. I killed Skype, and everything was ticketty-boo.
Showing posts with label Pharo. Show all posts
Showing posts with label Pharo. Show all posts
Sunday, 20 January 2013
Saturday, 12 January 2013
File In and File Out
To store a new package to a file, which will be stored in the Contents\Resources subfolder of the Smalltalk folder:
Right-click the package in the class browser, > various > file out (o)
To load the package back in to a fresh image:
Left-click the world, Tools > File Browser
Right-click the package in the class browser, > various > file out (o)
To load the package back in to a fresh image:
Left-click the world, Tools > File Browser
Accessors: getters and setters
Smalltalk accessors are always named after the variable they access.
If a variable is called xVal then the getter is also called xVal and the setter is called xVal:
If a variable is called xVal then the getter is also called xVal and the setter is called xVal:
Copy and Paste tips from Pharo By Example
When you c'n'p from PBE, beware: PBE uses − instead of - (i.e. an m dash instead of a minus sign), so any expression including a - operator will not compile until the m dashes are replaced with minus signs.
Create a new Class in Pharo Smalltalk
Amend the package's sample code - changing "Object" to the class you want to
sub-class, and put the name of the new class, prefixed by # (The subclass message gets sent to the object you specified, with a parameter of the name you want to give to the new sub-class).
Action-click, then accept (Cmd-s)
On accept, the system, executes the code.
By convention, if a class defines a method named initialize, it will be called right after the object is created.
The first message to send in an initialize method is generally to call the parent class's initialize method, via super initialize.
Open a workspace, and type myNewClassName new Select it, and inspect it
The inspector has three panes - the left pane lists the instance variables, and the bottom-right pane is a workspace who's self is bound to the object selected in the browser.
Action-click, then accept (Cmd-s)
On accept, the system, executes the code.
By convention, if a class defines a method named initialize, it will be called right after the object is created.
The first message to send in an initialize method is generally to call the parent class's initialize method, via super initialize.
Open a workspace, and type myNewClassName new Select it, and inspect it
The inspector has three panes - the left pane lists the instance variables, and the bottom-right pane is a workspace who's self is bound to the object selected in the browser.
Create a new Package in Pharo Smalltalk
In the Class browser, action-click (in Windows, right-click) on the Packages pane (the left-most pane).
The browser automatically generates the code to create the new sub-class of object, with the 'category' set to the Package name.
Packages should have a two or three letter abbreviation at the start of their name.
(Categories and packages are not entirely the same thing: categories have existed at least since the dawn of Smalltalk-80, and are simply a collections of related classes in a Smalltalk image. A package is a collection of related classes and extension methods that may be versioned using the Monticello versioning tool.)
The browser automatically generates the code to create the new sub-class of object, with the 'category' set to the Package name.
Packages should have a two or three letter abbreviation at the start of their name.
(Categories and packages are not entirely the same thing: categories have existed at least since the dawn of Smalltalk-80, and are simply a collections of related classes in a Smalltalk image. A package is a collection of related classes and extension methods that may be versioned using the Monticello versioning tool.)
Creating a method in Pharo Smalltalk
In the Class browser, navigate to the protocol group of the class of the package that you want.
By convention, for Test Driven Development, you first create a test method for your method .
Also by convention, the test for the Shout method of class String in Package Collections-Text is going to be called testShout in StringTest in CollectionsTest-Text.
The test browser is going to refer to this as StringTest>>#testShout - i.e. the testShout method of class StringTest.
When you run the test, failed tests appear with a Red background, passed tests appear with a Green background
By convention, for Test Driven Development, you first create a test method for your method .
Also by convention, the test for the Shout method of class String in Package Collections-Text is going to be called testShout in StringTest in CollectionsTest-Text.
The test browser is going to refer to this as StringTest>>#testShout - i.e. the testShout method of class StringTest.
When you run the test, failed tests appear with a Red background, passed tests appear with a Green background
Friday, 11 January 2013
Browser tips in Smalltalk
To bring up a Class browser, aka System browser, type
aClassName browse
and do it or (Alt-d)
or World > Class browser (or World > System browser)
The four panes across the browser are (from left to right) Package Class Protocol group Method
The ? button at the bottom of the class pane displays the class comment.
To find an object, focus on the package pane, and Alt-f, or left-click and find class
To find a method, World > Tools > Method finder and type the method name in the top left pane
You can find by name, you can QuickPick through the list of names that match the search substring, or search by the method's effects! (e.g. search 'eureka' . 'EUREKA' and it will return eureka asUppercase --> 'EUREKA' and list the various Classes that implement an asUppercase method in the right-hand pane.
In Pharo 1.4, use the Finder ( World > Finder ).
aClassName browse
and do it or (Alt-d)
or World > Class browser (or World > System browser)
The four panes across the browser are (from left to right) Package Class Protocol group Method
The ? button at the bottom of the class pane displays the class comment.
To find an object, focus on the package pane, and Alt-f, or left-click and find class
To find a method, World > Tools > Method finder and type the method name in the top left pane
You can find by name, you can QuickPick through the list of names that match the search substring, or search by the method's effects! (e.g. search 'eureka' . 'EUREKA' and it will return eureka asUppercase --> 'EUREKA' and list the various Classes that implement an asUppercase method in the right-hand pane.
In Pharo 1.4, use the Finder ( World > Finder ).
Thursday, 10 January 2013
How to Meta-Click in Pharo and Squeak on Windows
How to Meta-Click
In Squeak and Pharo, on Windows, the default method to Meta-Click is to Shift+Alt+left-click
i.e. click : left-click
action-click : right-click
meta-click: Shift+Alt+left-click
To change the behaviour in Pharo 1.4, use
System > Settings > Settings Browser, then
System > Keyboard > Control and Alt Keys.
Where Image files are stored
In both Squeak and Pharo, the image files are stored in
..\Contents\Resources\*.image (or *.ima)
The other default behaviour I have found, with Seaside On Squeak (3.0.6 on 4.3), is:
click : left-click
action-click : Alt+left-click
meta-click: right-click
In Squeak and Pharo, on Windows, the default method to Meta-Click is to Shift+Alt+left-click
i.e. click : left-click
action-click : right-click
meta-click: Shift+Alt+left-click
To change the behaviour in Pharo 1.4, use
System > Settings > Settings Browser, then
System > Keyboard > Control and Alt Keys.
Where Image files are stored
In both Squeak and Pharo, the image files are stored in
..\Contents\Resources\*.image (or *.ima)
The other default behaviour I have found, with Seaside On Squeak (3.0.6 on 4.3), is:
click : left-click
action-click : Alt+left-click
meta-click: right-click
Smalltalk
I've started Smalltalking again.
The plan is to use Smalltalk, and probably Seaside, to create the Fencing Competition App.
Ultimately, the app will work with intelligent clients, but initially, it'll all run on the server.
So I've started working through Pharo By Example Volume 1.
The plan is to use Smalltalk, and probably Seaside, to create the Fencing Competition App.
Ultimately, the app will work with intelligent clients, but initially, it'll all run on the server.
So I've started working through Pharo By Example Volume 1.
Subscribe to:
Posts (Atom)