The Martian Chronicles

Thoughts about other worlds...

Easy deploy of Pharo applications on the web (linux)

(For this instructions, I assume you are using Pharo 4.0)

You need to put you application somewere, isn't? So, easiest way is to install your application along your image/changes files:

1. copy you application .image and .changes file into the place you are going to run your web application (usually /var/www/YourApplication)

2. in the same place, do:

 $ wget -O- get.pharo.org/vm40 | bash

3. create a startup script, something like this:

File name: run.sh

sudo -u pharo nohup ./pharo /var/www/YourApplication/YourApplication.image --no-quit &

(Notice that we use an alternative user to run app. Is never recommendable to use root permissions. Remember you need also to change permission of all "YouApplication" subdirectory)

... and thats all :). This is enough to have your application running.

4. [OPTIONAL] Startup script with initialisation

Sometimes you need to prepare some things that might change (for example, running ports, database hosts, etc.).

For this the easiest way is to modify your run.sh script:

sudo -u pharo nohup ./pharo /var/www/YourApplication/YourApplication.image eval --no-quit "
"Start web server"
ZnZincServerAdaptor startOn: 8080.
"Start Voyage-MongoDB"
(VOMongoRepository host: 'localhost' database: 'myApplication') enableSingleton." &

Notice that is very easy to adapt this to receive ports, etc. as an script parameter (in case you need to scale your application and use several ports, for example).

5. [OPTIONAL] NGINX configuration

I do not use Apache since some years, so I do not remember how this is done (but is doable, of course). This is a basic config that works:

 server {
listen 80;
server_name myApplication.com;

location / {
proxy_pass http://127.0.0.1:8080/;
proxy_redirect default;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_set_header Host $host;
proxy_pass_request_headers on;
}
}

And that's is :)

Posted by Administrator at 26 April 2016, 1:36 pm link

A fast table for Pharo

Why we need yet another list?

In Pharo, we have several competing list implementations since day one. But all those implementations depend on one unique original: LazyListMorph. While this is hidden in the most used hierarchy: PluggableListMorph and children, at the end this is what we always have, if we want to use lists in our GUI. The original design worked fine in the use cases they have at the time, but it started to show age very fast (in fact, LazyListMorph is not the first list morph written, it is itself an attempt to solve performance issues).

What were the problems? Well, a short but important list:

  1. List morph does not allow larger lists to be shown performantly. Since it keeps all elements as morphs in a huge collection, it starts to lag after some hundreds.
  2. List morph does not handle very well complex element morphs. While it works fine with string morphs, if we want to use other kind of morphs as list elements (like for example, to show icons, etc.), list morph also lags very fast.

Along with this two fundamental problems, there were some others: since the original was intended to show lists, if you want to do a table, you can't. Now, you can say a list is a particular case of a table (it is a table with just one column, after all), but the other way (a "multi-column" list) is not so easy to implement. But it was done (MulticolumnLazyListMorph and PluggableMultiColumnListMorph) and during some years that was the unique solution we had.

Other attempts have been made to solve the performance issues of this implementation, like the NewList, but it's design is based on spawning threads to fill the elements array and it never worked really fine.

A new implementation

So, I started to write a new list for Pharo during an insomnia night, trying to solve this problem (And honestly, really tired of seeing how the current IDE feels slow –and makes Pharo itself feels slow– when there is no real reason to it).

For me, three conditions need to be fulfilled:

  1. It has to allow large number of rows (infinite if possible) and it has to be fast!
  2. It has to encourage extension (like for example to make editable fields)
  3. It has work for display tables, lists and with time, also trees

Since I know some implementations outside the Pharo world, I reviewed a couple and I decided to take as inspiration the implementation of Cocoa. This is a really simple design, who is proven to work very well:

  1. The main component is a table, and a list is considered just a table with one unique column
  2. It uses a data source (a data model) to provide elements to the list
  3. You can provide any view element as a cell
  4. Implementation demands only the elements to be shown. So you can have infinite elements and not instantiate them unless you will show them.

It looked fine, and after some hours of work, I finished a first version.

Comparing with older implementation

In general, all my benchmarks gave me a 10x increment in the speed of rendering.

And of course, showing thousands of elements cannot be compared because it was simply not possible before.

Using fast table

Fast table is integrated in Pharo 5.0, and it will replace all older list usages. You can check some examples of it browsing class side of FTExample class.

Here, a small example on the easiest way to use it:

FTEasyListMorph new
    extent: 300@550;
    elements: Morph methods;
    icon: [ :method | (FTExampleMethodModel method: method) actionOn: nil ];
    display: [ :method | method selector ];		
    openInWindow.

Screenshot-easylist
Enjoy!

EDIT: I forget to say that I also made Glamour renderers for lists and tables. They are incomplete, but you can start play with them.

To install it, just execute this:

 Gofer it 
    smalltalkhubUser: 'estebanlm' project: 'FastTable';
    package: 'Glamour-FastTable';
    load.

... and you will have #fastList and #fastTable presentations.

Posted by Esteban at 2 July 2015, 10:05 am with tags pharo link

Idea icon pack for Pharo

Last week I made a new Icon Pack for Pharo, based in IntelliJ Idea icons.

This new icons works very fine, icons are less intrusive than the ones from Eclipse (the current default in Pharo). Also very important, they smoothly in all themes, including the Dark Theme, who has some problems with default icons.

Two screenshots to illustrate the new pack:

darktheme.png Dark Theme

defaulttheme.png Default Theme

Install instructions

Is very easy, just execute this:

Gofer it 
	smalltalkhubUser: 'Pharo' project: 'MetaRepoForPharo40';
	configurationOf: 'IdeaIcons';
	loadStable.

ThemeIcons current: #IdeaUIThemeIcons asClass new.
 “In Pharo 3 and 4, you might need to execute this”
AbstractNautilusUI resetIconCaches. 

License

The icon pack itself is distributed under MIT license.

The Idea icons, however, have their own open source license terms, the Apache 2 license, who can be found here.

Enjoy

Posted by Esteban at 1 May 2015, 11:47 am link

Screencast: Use Versionner to make project releases

In this screencast I cover how you can use Versionner tool to make software releases and batch commits.

This is a powerful tool, still on beta and can be used by downloading latest Pharo (version 5), or installing it executing in Pharo 4:

Gofer it 
	smalltalkhubUser: 'PharoExtras' project: 'Versionner';
	configuration;
	loadVersion: '2.13.1'.

Enjoy :)

Posted by Esteban at 30 April 2015, 1:36 pm link

Screencast: Use Versionner in Pharo

I made a small video on how to use Versionner.

Versionner allows you to manage project configurations in a smooth way.

Enjoy :)

Posted by Esteban at 30 April 2015, 11:53 am link
<< 1 2 3 4 >>