[Pharo-users] Re: Whats the easiest/cheapest way to run a Pharo web app in 2021?

2021-04-08 Thread Pierce Ng
On Thu, Apr 08, 2021 at 11:58:10AM +0100, Tim Mackinnon wrote:
> Pierce - who/where are you rnning your Docker image? Do you use a
> particular service (or are you running your own?)

I am using a Linux VPS which I manage myself.

The Pharo application is my blog. It was a web app fronted by a HTTPS
reverse proxy. At the start of this year I rewrote it into a static site
generator. Instead of running all the time, Pharo is now invoked when
triggered by a CI hook, which happens when I publish a new blog post or
otherwise update my site.

I play with all kinds of software on my VPS and it was getting a bit RAM
cramped, hence the rewrite. Wasn't willing to spend more money every month
for more RAM. :-P

Pierce


[Pharo-users] Re: Whats the easiest/cheapest way to run a Pharo web app in 2021?

2021-04-07 Thread Pierce Ng
On Wed, Apr 07, 2021 at 02:21:14AM +0100, Tim Mackinnon wrote:
> I also feel its quite important to call out that the "eval 'Metacello
> new..." command referenced in the DockerFile RUN - is only going to work

Hi,

I build my Pharo image outside of Docker. My Dockerfile then packages the
built image plus whatever artefacts required into a Docker image. I am
using my Alpine Linux-based VM.

  GH: https://github.com/pharo-contributions/Docker-Alpine/
  DH: https://hub.docker.com/r/pierceng/pharovm-alpine

Pierce


[Pharo-users] Re: Easiest light weight cloud/web persistence for Pharo?

2020-10-06 Thread Pierce Ng
On Tue, Oct 06, 2020 at 09:41:21PM +0100, Tim Mackinnon wrote:
> Anyway, that login screen… oh crap I have to write one of those…

For Seaside, there is TF-Login. And oh, it rolled its own file-based
versioning object persistence.

Version that I ported to Pharo 7 and Seaside 3.3:

- https://github.com/PierceNg/TF-Login/tree/pharo7

Feature branch for better security:

- https://github.com/PierceNg/TF-Login/tree/password

Some of the classes are too tightly coupled IMO. Also I'm tending
towards an API-first approach, which needs OAuth2 and OpenID Connect,
meaning either more pieces to integrate or totally not using this.

Pierce


[Pharo-users] Re: Easiest light weight cloud/web persistence for Pharo?

2020-10-05 Thread Pierce Ng
On Mon, Oct 05, 2020 at 11:23:25PM +0100, Tim Mackinnon wrote:
> I know there is Sven’s P3 - but I’m not sure I’m ready to run and
> maintain a SQL database for a simple application, but could be
> persuaded it its simple to setup with little maintenance. Would mongo
> be a suggestion - is that easy to setup and run? (And is that
> Voyage?).
>
> Possibly I could even use image persistence, and fuel out a Dictionary
> from time to time - but I think that might be a little bit too belt
> and braces for me.

Hi Tim,

If you are familiar with Docker then starting a database server is easy
that way. Assuming you pick a 'boring' product then what matters for
your app is the quality of the database interface code on Pharo for that
product. For PostgreSQL and MySQL no problem. I've not used Mongo itself
nor Voyage so no comment.

If you neither want to run a separate database server nor roll your own
writing out to Fuel etc, then you're looking at 'embedded' databases.
For pure Smalltalk, Omnibase or SimplePersistence. If you are ok with
something that uses FFI, then SQLite, Unqlite and probably others.

Personally I'd choose SQLite because it is boring - ubiquitous, high
quality, and importantly unlike the pure Smalltalk and many embedded
key-value databases there is a plethora of external tools that operate
on SQLite databases which will help your debugging. 

For SQL databases you can also use an ORM like Glorp or ReStore.

Finally there are also NoSQL-as-a-service like Google Firebase. 

Many options. Great time sinks. :-) Have fun.

- PostgreSQL - https://github.com/svenvc/p3
- MySQL - https://github.com/pharo-rdbms/Pharo-MySQL
- Omnibase - https://github.com/sebastianconcept/OmniBase 
- SimplePersistence - https://github.com/seandenigris/Simple-Persistence
- SQLite - https://github.com/pharo-rdbms/Pharo-SQLite3
- Unqlite - https://github.com/mumez/PunQLite
- Glorp - https://github.com/pharo-rdbms/glorp
- ReStore - https://github.com/rko281/ReStoreForPharo
- Firebase - https://github.com/psvensson/firebase-st
- Choose Boring Technology - http://boringtechnology.club/

Pierce


[Pharo-users] Re: Standalone html builder (a la seaside without seaside?)

2020-09-29 Thread Pierce Ng
On Mon, Sep 28, 2020 at 08:35:43PM +0200, Franz Josef Konrad wrote:
> Some years ago I was looking for something for the same purpose and looked
> at this library 

Hi,

I stopped working on that and just used what comes with Seaside.
Seaside's HTML DSL works fine and has the nice add-on stuff like
Torsten's Bootstrap 3 and 4.

Only small road bump is form handling, where Seaside uses one or more
dynamic variables. To keep it simple, for my non-Seaside apps, when
rendering forms I use Zinc's HTML streaming instead. Mix and match.

Pierce


Re: [Pharo-users] Difference between VM and image

2020-08-17 Thread Pierce Ng
On Mon, Aug 17, 2020 at 11:45:46AM +0200, rob...@robkuz.com wrote:
> I am trying to find out what the difference between an VM and an Image is
> when using Pharo.

An image is like a computer game that can save its state to disk. The VM
is for running the game. With a fresh image, you start the game with a
clean slate. With a saved image, you restart the game where you last
left it.

And programming in Pharo is usually as enjoyable as playing a computer
game. :-)

Pierce




Re: [Pharo-users] Iceberg: Installing a baseline from a self hosted Git/Gitea repository branch

2020-07-15 Thread Pierce Ng
On Wed, Jul 15, 2020 at 08:41:04AM -0500, Offray Vladimir Luna Cárdenas wrote:
> So, a better question would be: Is possible to load programatically (via
> a code snippet) using Iceberg, Monticello or something else a baseline
> that installs a project and its dependencies and is hosted in an
> independent Git provider? How can self hosted git repositories
> containing baselines be loaded?

Hi Offray,

I don't define dependencies in baselines for stuff in my self-hosted
Gitea because I work on them myself and I know their interdependencies.
And since I am working on them, they are all locally checked out.

I load my stuff in the correct order like this:

  Metacello new
baseline: 'StuffOne';
repository: 'tonel:///home/pierce/work/git/StuffOne/src';
load.

  Metacello new
baseline: 'StuffTwo';
repository: 'tonel:///home/pierce/work/git/StuffTwo/src';
load.

Here StuffTwo is dependent on StuffOne. To be clear, I have written
baselines for StuffOne and StuffTwo, which is how I am loading them
here. I'm just not defining in StuffTwo's baseline that StuffOne is a
dependency.

For me this is more agile because I only need to edit my load snippet
and I get immediate feedback by running it.  The Git repo roundtripping
of fixing up dependencies in baselines OTOH feels more like the
edit-compile-test cycle.  Eventually if/when I publish StuffOne and
StuffTwo, I do have to define the dependencies but it'll be easy because
then they'll be on Github.

Pierce




[Pharo-users] Tracker for Smalltalkhub project migration

2020-07-14 Thread Pierce Ng
Hi all,

I've created below project to keep track of Smalltalkhub project
migration. Please feel free to fork, update and send PR.

  https://github.com/PierceNg/sth-migration

Pierce



[Pharo-users] Updated Alpine Linux Pharo VM Docker image

2020-07-12 Thread Pierce Ng
Hi all,

I've updated the Docker image for pharo.cog.spur.minheadless VM
built on Alpine Linux. This version is built on Alpine Linux 3.12. 

Some links:

- https://hub.docker.com/r/pierceng/pharovm-alpine
- https://github.com/pharo-contributions/Docker-Alpine/tree/master/vm.build
- https://github.com/PierceNg/opensmalltalk-vm/tree/pierce_alpine_839a5ca

This version removes the following plugins. I'm still thinking about some
of the others, especially the GUI-related ones. The idea is of course to
have the smallest possible set of plugins. Comments welcome.

- Security
- Drop
- Croquet
- DSAPrims
- JoystickTablet
- MIDI
- Serial
- StarSqueak
- InternetConfig

The output Docker image contains the Pharo VM only and is not runnable by
itself. It is intended to be used as a base to build your own Docker image
containing your application-specific Pharo image. 

I'll be building a similar Docker image for Pharo's fork of the VM.

Pierce




Re: [Pharo-users] UFFI Problem: A call to an external function failed (FFIOpaqueObject)

2020-06-23 Thread Pierce Ng
On Mon, Jun 22, 2020 at 08:41:22AM +0200, Sven Van Caekenberghe wrote:
> > On 22 Jun 2020, at 03:47, Pierce Ng  wrote:
> > Finally, there is a non FFI pure Smalltalk implementation of the MySQL
> > wire protocol that has been around a while.
> 
> >  https://github.com/pharo-rdbms/Pharo-MySQL
> 
> Hmm, that is interesting, I somehow missed that.
> A little bit more documentation, like a description in the README file would 
> be great though.

Agree. Your docu for P3 is the standard to aim for.

Quick bit of history: This driver is the one from Squeaksource that was
then incorporated into DBXTalk and Garage, and finally moved to the GH
repo mentioned above.

  http://www.squeaksource.com/StdbMysqlProtocol.html

Pierce




Re: [Pharo-users] UFFI Problem: A call to an external function failed (FFIOpaqueObject)

2020-06-21 Thread Pierce Ng
On Sun, Jun 21, 2020 at 11:27:22AM +0200, Georg Hagn wrote:
> 'mariaDB://localhost:5432/sodbxtest?&user=sodbxtest&password=sodbxtest'.

Hi,

Firstly, 5432 is PostgreSQL. MySQL/MariaDB default port is 3306.

Just a note, as mysql_init() only allocates the C level structure and
doesn't connect.

> FFILibrary subclass: #MariaDBLibC
> 
> FFIOpaqueObject subclass: #MariaDBHandle
> MariaDBHandle >> unixModuleName [
>^ '/usr/lib/x86_64-linux-gnu/libmariadb.so'
> ]

With your code, implementing #unixModuleName in MariaDBLibC works for
me. I've never done that in FFIOpaqueObject subclasses.

In terms of organizing code, suggest you implement the FFI calls in
MariaDBLibC itself and do away with MariaDBDriver. Having the FFI calls
in MariaDBDriver while using MariaDBLibC only for locating the C
libraries is using two classes where one will do.

Finally, there is a non FFI pure Smalltalk implementation of the MySQL
wire protocol that has been around a while. If you are doing this FFI
thing for practice, I recommend that you wrap another C library, so that
when you are done, Pharo gets another C library binding.

  https://github.com/pharo-rdbms/Pharo-MySQL

Pierce



Re: [Pharo-users] [Pharo-dev] [ANN] PharoPro

2020-06-17 Thread Pierce Ng
On Wed, Jun 17, 2020 at 10:34:09AM +0200, Norbert Hartl wrote:
> we are very proud to announce the availability of PharoPro, a company
> that offers professional support for the pharo platform. Our mission
> is to enable people and companies to secure their business when
> building products with pharo.

Great stuff! All the best!

Pierce




Re: [Pharo-users] DateTime now nanos

2020-06-17 Thread Pierce Ng
On Wed, Jun 17, 2020 at 02:24:20AM -0500, Jeff Gray wrote:
> I may be misunderstanding, but is the example in the link declaring a sqlite
> column of type datetime? I didn't think you could do that.

SQLite's typing is different from most other SQL engines. See
https://sqlite3.org/datatype3.html. According to that document datetime
is a valid column type. Indeed AFAICT any column type is allowed as long
as it conforms to SQLite's naming requirements.

When writing an instance of DateAndTime, Pharo-SQLite stores it as a
string in the database. When reading, if the database indicates that the
actual type of the value fetched is a string, Pharo-SQLite checks the
column type declaration and turns the string back into a DateAndTime
instance if the declared SQL column type is one of SQLite3Library
dateTimeTypes.

> I just created a person table with four text columns and wrote this in my
> playground:
> 
> |conn sql bindings|
> conn := SQLite3Connection on: 'C:\Users\JeffGray\test.db'.
> conn open.
> sql := 'insert into person (active, created, first_name, last_name) values
> ("Y", ?, "Jeff", "Gray")'.
> bindings := OrderedCollection new.
> bindings add: DateAndTime now.
> conn execute: sql with: bindings.
> conn close.

I added table creation SQL with exactly one declared type of datetime to
your example (slightly rewritten):

  | conn sql bindings |
  conn := SQLite3Connection openOn: '/tmp/dt.db'.
  [  conn execute: 'drop table person'. 
 conn execute: 'create table person (active, created datetime, first_name, 
last_name)'. 
 sql := 'insert into person (active, created, first_name, last_name) values 
("Y", ?, "Jeff", "Gray")'.
 conn execute: sql value: DateAndTime now.
  ] ensure: [ conn close ].

Reading it back gives a DateAndTime instance.

Previous mail I mentioned pluggablity. It turns out when one can declare
any column type one has pluggability already. Below example declares the
column 'created' as type 'unixtime' and writes the value 'DateAndTime
now asUnixTime'.

  | conn sql bindings |
  conn := SQLite3Connection openOn: '/tmp/dt.db'.
  [  conn execute: 'drop table person'. 
 conn execute: 'create table person (active, created unixtime, first_name, 
last_name)'. 
 sql := 'insert into person (active, created, first_name, last_name) values 
("Y", ?, "Jeff", "Gray")'.
 conn execute: sql value: DateAndTime now asUnixTime.
  ] ensure: [ conn close ].

Reading it backs gives an integer. The application programmer, knowing
the column type declaration is unixtime, can then turn that into a
DateAndTime instance.

Pierce



Re: [Pharo-users] DateTime now nanos

2020-06-15 Thread Pierce Ng
On Mon, Jun 15, 2020 at 01:23:06AM -0500, Jeff Gray wrote:
> Maybe I should just be asking what people normally do to store dates in
> SQLite. (I'm guessing there aren't that many...)

The Pharo SQLite binding stores DateAndTime instances as strings. When
fetching from the database, if the declared column type looks
date/time-ish then that string is turned back into a DateAndTime
instance.

See this blog post:

  https://www.samadhiweb.com/blog/2015.04.09.nbsqlite3.datetime.html

The blog post refers to NBSQLite3Connection, which is for the Pharo 4
NativeBoost FFI version. 

Current version is here:

  https://github.com/pharo-rdbsm/Pharo-SQLite3

I've entertained the idea of making it pluggable, so that the
application programmer gets to decide whether to store/fetch Unix epoch
integers, Julian day floats, etc. No action, daydreaming only.

Pierce



Re: [Pharo-users] git and Pharo new book...

2020-05-14 Thread Pierce Ng
On Thu, May 14, 2020 at 03:54:31PM +0200, Stéphane Ducasse wrote:
> if you want to contribute to a chapter on other than github solutions. 
> I would be happy to help editing such chapter. 
> 
> If you want to you can do a PR with a chapter.

Sure, I'll do that. I'll start next month Jun 2020. 

Pierce




Re: [Pharo-users] git and Pharo new book...

2020-05-13 Thread Pierce Ng
On Wed, May 13, 2020 at 11:07:00AM -0500, Offray Vladimir Luna Cárdenas wrote:
> This is perfect timing, as I have started to slowly migrate my own repos
> from SmalltalkHub to a  simple, self hosted and self contained Gitea[1]

Hi Offray,

I run Gitea on a Raspberry Pi at home. I have a couple of scripts that
back up the Gitea data, encrypt the backup with GPG, then uploads
somewhere. Happy to share if you want them.

On the topic, Iceberg works fine with Gitea. My SOP as follows:

- create repo using Gitea web interface
- using command line, clone locally via ssh 
- using command line, 'git remote add ...'

Then in Iceberg use the local clone. 

Pierce




Re: [Pharo-users] About DuneSt / ChartJs

2020-02-11 Thread Pierce Ng
On Tue, Feb 11, 2020 at 05:06:44PM +0100, Sven Van Caekenberghe wrote:
> NeoJSON and Seaside are already in my project's dependencies, but
> Seaside3 seems to never resolve to the same thing, so I would like to
> skip that. Is that possible ? I have this issue often with Seaside. I
> could fork and edit the baseline, but I'd rather not.
 
I do the following near the top of my load script:

  Metacello new
baseline: 'Seaside3';
repository: '...';
load;
lock.

And when loading other packages that may want to load another version of
Seaside:

  Metacello new
baseline: 'whatever';
repository: '...';
onConflictUseLoaded;
load.

I tried doing ifTrue:ifFalse: conditional loading in my baseline to test
for Seaside, but it didn't work. 
  
Pierce




Re: [Pharo-users] Spec2 and Nuklear?

2020-02-11 Thread Pierce Ng
On Tue, Feb 11, 2020 at 01:59:49PM -0500, Offray Vladimir Luna Cárdenas wrote:
> This is not a question, but more like a blue plan thinking about
> minimalist native UI toolkits that can talk with Spec 2. I just found
> Nuklear[1] and I'm kind of wondering if this could take the place of GTK
> in the Spec2 world.
> 
> [1] https://github.com/Immediate-Mode-UI/Nuklear

There is also Dear ImGui, written in C++, and cimgui, its C wrapper.

  https://github.com/ocornut/imgui
  https://github.com/cimgui/cimgui

It will be great to program UIs with one or both of these and Pharo.

Pierce



Re: [Pharo-users] The results are in!

2020-02-08 Thread Pierce Ng
On Sat, Feb 08, 2020 at 05:50:18PM -0500, Benoit St-Jean via Pharo-users wrote:
> MAYBE we need another list...

Maybe Richard just needs to adjust the style of his mails...

> This is getting ridiculous!  The guy spends energy, time, effort and is able
> to gather 13K in prizes and puts Pharo to the forefront with this cool
> contest in schools, makes a lot of youngsters learn & use Pharo for their
> projects, puts up a website, makes videos, writes blog posts, PROMOTES Pharo
> and he gets slapped for posting here ?!?!  WTF ???

Like if the subject of Richard's mail is "Pharo success story part 3:
blah blah" and his opening paragraph is descriptive, similar to what you
wrote above, I'd read the mail and watch the video. As it is, his mail
is content-free and comes across purely as self-promotion.

Pierce




Re: [Pharo-users] Embedding pharo in C++

2020-01-22 Thread Pierce Ng
On Wed, Jan 22, 2020 at 11:04:07AM +0100, teso...@gmail.com wrote:
>nice to hear about the Pascal experiment, 

I've published my code on GH and sent an announcement to pharo-dev.

Repo is https://github.com/PierceNg/pharo-vm-embedded-pascal

Pierce




Re: [Pharo-users] Embedding pharo in C++

2020-01-22 Thread Pierce Ng
On Wed, Jan 22, 2020 at 10:09:33AM +0100, teso...@gmail.com wrote:
> Hi, we are working on the tools required to have embedded Pharo in
> different solutions.

Hi Pablo,

Your published example embed the image as a Windows resource. Well, the
excellent and, like Smalltalk, vastly underrated Free Pascal has
built-in cross platform support for Windows resources.  Basically I have
implemented in Pascal the simplest FFI to libPharoVMCore and the
embedded image access routines for callback by libPharoVMCore, together
with a driver program which is pretty much a straight port of your C
program.

Pascal also produces static and dynamic libraries. My embedded image
access code can be packaged as such, which makes it accessible from
other languages.

> My idea is to implement an API to communicate to the image, I was
> thinking more in an API similar to Objective-C Bridge or COM objects.
> Still I am not sure how to design the API or the way to integrate it.
> Today, I am thinking about not having to much marsharlling of Pharo
> Objects to external objects, I am thinking to use a similar strategy
> like the used with FFI.

I am more thinking about marshaling, using say MessagePack. For 'over
the wire' development, maybe MessagePack RPC between headful Pharo and
the to-be-host program. For embedded, some means to pass MessagePack
structures back and forth.

Pierce



Re: [Pharo-users] Embedding pharo in C++

2020-01-22 Thread Pierce Ng
On Tue, Jan 21, 2020 at 08:20:48PM +0100, Roland Plüss via Pharo-users wrote:
> The first mode is the "runtime mode". This would be the mode used for
> the released products and does not allow to "directly modify" the image.
> This mode would only require basic set of classes (frameworks) since the
> game engine provides a large set of functionality in the module layer so
> the script layer provides the logic, UI and things like that. This image
> would not require to be enriched with a lot of things.

This is doable currently. The Pharo image is embedded into the
executable and used in read-only mode. Although personally I'd implement
as much of the app logic in Pharo as possible simply because of the high
productivity.

> The second mode is the "development mode". For this one I thought about
> exposing a Pharo VM image acting as the Coding and Debugging IDE. Here I
> would opt to expose the full power of Pharo/Smalltalk to the developer.

I envisage doing this via some kind of data exchange between the host
program and Pharo, which seems doable for both the embedded and 'over the
wire' development cases.

Pablo recently published an example of embedding a headless-but-GUI
Pharo image inside a C program via the Windows resource mechanism. As it
happens, I have just implemented the same example that works on Linux
and MacOS from one source code. Didn't test on Windows, but I'm sure
it'll work there too. In a day or two I will publish the code and blog
post.

Attached teaser screenshot. :-)

Pierce



Re: [Pharo-users] Floating point arithmetic

2020-01-13 Thread Pierce Ng
On Tue, Jan 14, 2020 at 12:41:51AM +1300, Richard O'Keefe wrote:
> Squeak and Pharo interpret as "rational number *printed* in
> decimal form but not *computed* using decimal arithmetic", so
> that can give extremely confusing results too.

Can you expand on this please?

For money-related calculations I have been using Hernán Morales Durand's
FixedDecimal: https://github.com/hernanmd/FixedDecimal.

Pierce




Re: [Pharo-users] Floating point arithmetic

2020-01-13 Thread Pierce Ng
On Sun, Jan 12, 2020 at 02:13:00PM -0600, Donald Howard wrote:
> "What are other suggestions, workarounds or approaches community has?"

This is a good read on the subject:

  https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html

Title is "What every computer scientist should know about floating point 
arithmetic".

Pierce



Re: [Pharo-users] [ANN] Phoedown - Markdown to HTML

2020-01-02 Thread Pierce Ng
On Thu, Jan 02, 2020 at 12:56:55PM -0600, Sean P. DeNigris wrote:
> bugs seem to be
> more severe and difficult to diagnose, so we'll see how it goes as FFI use
> becomes more and more common...

There's a saying about (aspects of) building software which source I
cannot recall:

  If it hurts, do it more frequently.

I believe FFI should be pushed as much as possible to work out bugs and
develop new capabilities. Looking forward to playing with threaded FFI.

Pierce



Re: [Pharo-users] [ANN] Phoedown - Markdown to HTML

2020-01-01 Thread Pierce Ng
On Wed, Jan 01, 2020 at 02:35:03PM +0100, Tim Mackinnon wrote:
> I’m curious why you chose to use ffi for this one in particular as it
> would seem to be quite straightforward to do it all in native
> Smalltalk (not to down play your integration in any way of course).
> Was performance a big thing? Or was it simply relying on others to
> keep it up to date?

I wanted something that works out of the box. I did not want to
implement MD parsing myself.

Also I saw hoedown's wiki page on bindings and thought I'd put Smalltalk
on the map there.

  https://github.com/hoedown/hoedown/wiki/Bindings

Pierce




[Pharo-users] [ANN] Phoedown - Markdown to HTML

2020-01-01 Thread Pierce Ng
Hi all,

I've published Phoedown, an FFI to hoedown, the standards compliant, fast, 
secure Markdown
processing library written in C. 

- https://github.com/PierceNg/Phoedown
- https://github.com/hoedown/hoedown

A simple example:

| md |
md := (FileSystem memory / 'somefile.md')
writeStreamDo: [ :ws |
ws nextPutAll: 
'
 ```smalltalk
Transcript show: ''Happy New Year!''; cr
 ```
' ];
contents.
HdHtmlRenderer new
setMarkdownExtension: HdMarkdownExtensions FencedCode;
setMarkdownExtension: HdMarkdownExtensions NoIntraEmphasis;
render: md

This is the output:

Transcript show: 'Happy New 
Year!'; cr

 
Pierce




Re: [Pharo-users] I feel like an overwhelmed maintenance programmer - how to get some toeholds?

2019-12-21 Thread Pierce Ng
On Sat, Dec 21, 2019 at 08:32:02AM -0600, ponyatov wrote:
> The problem can be covered by a few experienced programmers who stream their
> everyday work on a regular basis.
> As I know, there is no anyone doing it.

Twitch for programmers? Intriguing idea. 

Pierce



Re: [Pharo-users] [ANN] ReStore for Pharo - object<>relational database framework

2019-12-08 Thread Pierce Ng
On Sun, Dec 08, 2019 at 01:09:29PM +, John Aspinall wrote:
> https://github.com/rko281/ReStoreForPharo 
> 
> Initially ReStore supports SQLite via UDBC and PostgreSQL via P3;
> kudos and thanks to the authors of these packages. Documentation
> largely remains on the “to do” list but the ReadMe gives a flavour of
> what ReStore is and what it can do via a few simple examples. Please
> feel free to post any questions here and I’ll do my best to answer
> them.

Very nice! Thanks!

Pierce



Re: [Pharo-users] Pillar in-image rendering (was: String concatenation vs. Stream)

2019-10-20 Thread Pierce Ng
On Sat, Oct 19, 2019 at 04:39:21AM -0700, Kasper Østerbye wrote:
> I am currently working on a github markdown -> pillar tree (the internal
> rep of pillar). I estimate I am a few days out from that one.

Are you doing this in pure Pharo?

I have wrapped libhoedown, a Markdown to HTML library. libhoedown uses
callbacks to invoke its renderer and I started constructing a Markdown
to Pillar (string, not object tree) renderer by having libhoedown call
back into Pharo.

Pierce




Re: [Pharo-users] Glorp + P3 + SQLite

2019-10-19 Thread Pierce Ng
On Sat, Oct 19, 2019 at 01:26:10AM -0700, Todd Blanchard via Pharo-users wrote:
> I loaded GLORP+P3 without issue.
> Trying to load SQLite3 - it also wants to load GLORP which complains of 
> conflict.

Todd, to load SQLite3 only:

  Metacello new
repository: 'github://astares/Pharo-UDBC/src';
baseline: 'UDBC';
load: 'SQLite'

Pierce



Re: [Pharo-users] Smallest docker image for pharo >=7 ?

2019-10-14 Thread Pierce Ng
On Mon, Oct 14, 2019 at 04:07:49AM -0300, Hernán Morales Durand wrote:
> Because I am lazy and want to avoid searching through all DockerHub
> repository pages... Do you know a Dockerfile to generate the smallest
> possible docker image for Pharo?
> Anyone could make it work Pharo on Alpine since it uses different libc?

Hi Hernán,

Please see following links:

- https://github.com/pharo-contributions/Docker-Alpine
- https://hub.docker.com/r/pierceng/pharovm-alpine
- https://hub.docker.com/r/pierceng/pharo7-alpine
- https://www.samadhiweb.com/blog/2019.07.20.alpine.pharo.minimal.html
- https://www.samadhiweb.com/blog/2019.08.11.minimizing.pharo.html

The Alpine-based VM can be made smaller by removing unused/irrelevant
modules.

Image-wise, currently I am using Pharo 7 minimal, which is just under
30MB, and that forms the lower bound of the Pharo image size.

However there is also the Pharo Candle effort that aims to make really
small images, which I hope to try out soon.

> I am also interested in which stage you use to install packages into the
> image, and why? Do you copy the contained image into docker already built?

For Pharo, I start with the regular or minimal image, then load my
packages. 

For Docker, I first build a container image for the VM only. Using that
I build a new container image from the Pharo image and other required
files.

> [1] http://subuser.org/news/0.3.html

Interesting. I use Firejail for big programs such as Chromium.

Pierce



Re: [Pharo-users] Running a teapot instance remotely

2019-10-10 Thread Pierce Ng
On Thu, Oct 10, 2019 at 04:18:14PM -0400, sergio ruiz wrote:
> How are people keeping it running these days?

I used to use daemontools. These days I use Docker.

Pierce



Re: [Pharo-users] TestRunner to run superclass's tests

2019-05-23 Thread Pierce Ng
On Thu, May 23, 2019 at 02:14:08PM +0200, Cyril Ferlicot wrote:
> Currently, to inherit tests you need to override
> #shouldInheritSelectors to return true.

Thank you Cyril. 




[Pharo-users] Discord Recaptcha

2019-05-23 Thread Pierce Ng
Hi all,

I just tried to login to Discord after a few weeks away. I cannot get
past Google's recaptcha - it kept showing me super grainy pictures of
road scenes from which I was supposed to pick out the ones with cars
(apparently without success).

I have set up 2FA for Discord and don't remember having to deal with
recaptcha previously.

Is this something the Pharo Discord admins can configure? Like, disable
recaptcha totally?

TIA. 

Pierce



[Pharo-users] TestRunner to run superclass's tests

2019-05-23 Thread Pierce Ng
Hi all,

I have a testing class that is sub-subclass of TestCase, i.e., the class
hierarchy looks like this:

  TestCase
ExistingTestingClass
  MyNewTestingClass

How do I get TestRunner to run MyNewTestingClass's tests, as well as
ExistingTestingClass's tests in the context of MyNewTestingClass?

Pierce



Re: [Pharo-users] Runaway scrolling in Pharo 7 on Ubuntu 18.04

2019-04-30 Thread Pierce Ng
On Sun, Apr 28, 2019 at 10:02:35AM -0500, Brainstorms wrote:
> I tried this in a Linux container on a Chromebook (a Pixelbook model), and
> got the same behavior for both the Glamour Example Browser and when
> scrolling long methods in the code browser.
> 
> The Linux version in the default ChromeOS container is Debian 9 (stretch).

So not just me. Thanks.




[Pharo-users] Runaway scrolling in Pharo 7 on Ubuntu 18.04

2019-04-27 Thread Pierce Ng
Anyone encountering runaway scrolling in Pharo 7 on Ubuntu 18.04-based
systems?

In Pharo 7.0.3, click Help > Glamour Example Browser. When the browser
comes up, click Fast List Outline Simple on the left pane. In the right
pane's Browser tab, click inside the scrollbar's gutter, i.e., not on
the end arrows nor on the positional brick. The list doesn't stop
scrolling until it reaches the bottomest entry.

In the code browser, it happens in the bottom code pane but not in the
other panes.

This happens on my laptop running Xubuntu 18.04 and also in VirtualBox
VMs running Xubuntu 18.04 and Lubuntu 18.04 on my Mac.

It does _not_ happen on the Xubuntu 18.04 laptop when doing the same in
a 60546 image.

It does also happen running a current Pharo 8 snapshot image; no Glamour
Example browser built in but I get the same scrollbar behaviour in a
Form inspector window.

It does _not_ happen when doing the same in a 7.0.3 image in a
VirtualBox VM running a LinuxMint version that is based on Xubuntu
16.04.

Pierce




Re: [Pharo-users] FFI to UFFI

2019-03-23 Thread Pierce Ng
On Sat, Mar 23, 2019 at 05:22:32PM +, Tomaž Turk wrote:
> - Is there any elegant way to successfuly load the package into Pharo 7 to
> get started with the code adaptation?

Elegantly, dunno. 

Manually, open Monticello browser, right click on the repo (if you have
loaded the ConfigOf then the repo will be listed), click "open
repository". Click the mcz file in the right pane of the repo browser,
click "browse". You'll see the (not loaded) code in the resulting code
browser and can attempt to adapt the FFI calls.

> - And, of course, I'd be grateful if someone could point me into the right
> direction of how to tackle with the above cdecl syntax with the new UFFI.

https://files.pharo.org/books-pdfs/booklet-uFFI/UFFIDRAFT.pdf

Also see my very simple demo:

https://github.com/PierceNg/libffidemo

HTH. 

Pierce



Re: [Pharo-users] Fw: Re: R: R: UDBC ODBC

2019-03-22 Thread Pierce Ng
On Fri, Mar 22, 2019 at 09:46:35AM +, Tomaž Turk wrote:
> Do you possibly know (or anyone) if this implementation can be used together
> with Glorp? 

Glorp has a notion of database platforms, and currently there are
MySQLODBCPlatform, OracleODBCPlatform and SQLServerODBCPlatform. (I've
not used any of them so no comment on whether they are even functional
in Pharo 7 and whatever combination of OS/database product/versions.)

> And more generally, are there any intentions and guidance in the
> Pharo community of how to proceed toward a stronger support for database
> connectivity - specifically, whether to put our efforts into Torsten's UDBC
> ODBC or Diego's ODBC ...

Pragmatically, what gets used gets supported. What database product are
you connecting to from which OSes?

Pierce




Re: [Pharo-users] 7.0.2 and the font glitch - seems far worse than 7.0.1

2019-03-17 Thread Pierce Ng
On Sun, Mar 17, 2019 at 02:44:25PM +, Tim Mackinnon wrote:
> Hey Pierce - what font did you use - are you talking about the Bitmap
> fonts, or did you pick something else?

I use the platform fonts to show Chinese and Japanese content correctly.
On Mac, PingFang SC. On Ubuntu I have been using Noto Sans.

Pierce



Re: [Pharo-users] 7.0.2 and the font glitch - seems far worse than 7.0.1

2019-03-17 Thread Pierce Ng
On Fri, Mar 15, 2019 at 11:04:35PM +, Tim Mackinnon wrote:
> In 7.0.1 (osx - high Sierra - launcher), I was seeing the odd font
> glitch (where characters suddenly start glyphing in code and menus -
> see photos) and it seemed to be fixable by saving your image the first
> time (e.g. after 30+ mins you would see this in a new install). Once
> the image was saved, this seemed to stick and never be a problem.
>
> In 7.0.2 this is now happening to me very 10-60 mins. The save fix
> still works - the moment you save the glyphs will all just disappear
> until it happens again.

Worked on my Mojave Mac with fresh 7.0.2 images today. Saw the font
glitch after a short while. I switched to native fonts and the glitch
went away. I don't use Launcher.

Pierce




[Pharo-users] planet.smalltalk.org

2019-03-09 Thread Pierce Ng
I deleted the earlier thread from my mailbox, so starting a new one.

By chance I found http://prog.vub.ac.be/~cderoove/planet/ which is the
Planet Smalltalk aggregator hosted by Coen De Roover. It is still
running and has the latest entries. 

Just a bit more work is needed to get planet.smalltalk.org to once again
point to this aggregator.

Pierce




Re: [Pharo-users] http://planet.smalltalk.org ?

2019-03-03 Thread Pierce Ng
On Sun, Mar 03, 2019 at 12:56:26PM -0300, Hernán Morales Durand wrote:
> Me too I used to track a lot of interesting blogs out there. At one
> time the main contact for the site was Coen de Roover :
> http://soft.vub.ac.be/~cderoove/
> 
> Maybe someone already wrote him to ask?

I wrote Coen a few weeks back. Did not receive a reply.

At least going by www.smalltalk.org the domain hasn't gone to squatters.

Pierce




[Pharo-users] [ANN] Pharo-SQLite even more multilingual

2019-03-02 Thread Pierce Ng
Hi all,

I've enhanced the Pharo SQLite library to be even more multilingual. It has
always supported data elements that are Pharo WideString instances, these
being converted to/from UTF8 transparently by the library. Now the library
also handles multilingual table names, column names and default column
values; in other words, multilingual SQL statements.

To install in Pharo 7, load GlorpSQLite from the Catalog Browser. 

Example:

| db |
db := UDBCSQLite3Connection openOn: '/tmp/ml.db'.
[   "Chinese table name, column names, and default column value."   
db basicExecute:  'create table 表一 (键一 integer primary key, 列二 text 
default ''中文'');'.
"Insert a row, taking default column value for the 2nd column."
db basicExecute: 'insert into 表一 (键一) values (NULL)'.
"Insert another row, specifying a value in Chinese for the 2nd column."
db execute: 'insert into 表一 values (NULL, ?)' 
with: (Array with: '值二').
(db execute: 'select * from 表一') rows inspect.
] ensure: [ db close ]

From the SQLite shell:

% sqlite3 /tmp/ml.db 
SQLite version 3.27.2 2019-02-25 16:06:06
Enter ".help" for usage hints.
sqlite> .header on
sqlite> .schema 
CREATE TABLE 表一 (键一 integer primary key, 列二 text default '中文');
sqlite> select * from 表一;
键一|列二
1|中文
2|值二
sqlite> 

Testing and feedback welcome, especially on which other parts of the
library needing internationalization.

Pierce




Re: [Pharo-users] Partition/Sync ready databases for Pharo?

2019-02-21 Thread Pierce Ng
On Tue, Feb 19, 2019 at 01:02:51PM +, Tim Mackinnon wrote:
> When you say Fossil - are you referring to
> "https://fossil-scm.org/index.html/doc/trunk/www/index.wiki” ?
> I’ve seen it come up a few times - is it good? 

Yes I mean the Fossil SCM. I use it as a personal wiki and file repo. It
comes with built-in ticketing system and forum, all wrapped into one
executable file. Fossil also imports/exports Git repos.

I'd use Fossil for small development teams too. Except for game
development and other cases involving multi-GB repos with lots of binary
blobs.

> can you hook into it to save application runtime artefacts such that a
> distributed application can read them back 

Fossil was designed as a standalone executable. It is difficult to
"library-ify" and the developers have no plan to do so. But it is just a
single executable, supports JSON output for some of its functions, and
can be invoked via OSSubprocess and the like, conceptually similar to
how Iceberg uses libgit2 to do Git stuff.

Pierce



Re: [Pharo-users] Partition/Sync ready databases for Pharo?

2019-02-21 Thread Pierce Ng
On Tue, Feb 19, 2019 at 10:36:18AM -0300, Esteban Maringolo wrote:
> No problem, I was going to ask about Fossil as well, I know it is a
> self contained SCM, with issue tracker, and whatnot. People that uses
> it don't want to use git except if forced to.
> So I also ask how this would work. :)

Fossil's built-in sync mechanism is described at
https://fossil-scm.org/index.html/doc/trunk/www/sync.wiki.

Fossil's traffic works through tunneling - this is how I 'fossil push'
new blog posts from my laptop to my server through an SSH tunnel. I had
also tested Fossil behind Internet-reachable Caddy HTTPS reverse proxy,
which works too.

For your use case, I might approach it like this: Write data locally and
commit to Fossil as blobs. To sync, run Fossil under OSSubprocess to
sync with the central server, either directly (if Fossil on central
server is directly reachable) or thru a tunnel created by your
application if your application runs on both ends.

> I saw SQLite-sync before, but it is a commercial product, and its
> platform support/setup seems convoluted.
>
> dqlite might be a viable alternative, from more than reliable
> provider, it's is not clear whether I have to use a different library
> to access SQLite (it seems so) or a special wire protocol/api calls.

I was actually thinking of https://github.com/rqlite/rqlite/ but did not
remember the name when I replied originally.

But it seems that, however you choose to sync, your application still
needs to handle any data conflict that arises.

Pierce



Re: [Pharo-users] Running pharo in daemon mode

2019-02-21 Thread Pierce Ng
On Tue, Feb 19, 2019 at 05:17:34AM -0800, sergio ruiz wrote:
> My daemontools run file looks like:
> but for some reason, it just sits and grinds and restarts.. never remaining
> started for more than a second..

PharoDebug.log or "ps ax | egrep readproctitle" should contain some
clues. 

> VM="/home/bandtracker/pharoImages/pharo"
> IMAGE="/home/bandtracker/pharoImages/Pharo.image"

Looks like you put the VM and image/changes files in the same directory.
Depending on how you set up, Pharo may need write-access to the image's
containing directory, /home/bandtracker/pharoImages in your case. 

I suggest to put the VM files somewhere else, and owned by root:root.
This greatly reduces the risk of bug or exploited vulnerability in your
code or Pharo running as your uid overwriting the VM files.

Pierce




Re: [Pharo-users] Partition/Sync ready databases for Pharo?

2019-02-18 Thread Pierce Ng
On Mon, Feb 18, 2019 at 02:56:10PM -0300, Esteban Maringolo wrote:
> I have the requirement that an app that I'm prospecting must be able
> to work offline and synchronize changes once the connection is
> restored.
> 
> I want to avoid having to write "sync" logic manually.

I've not done this for real before, but here are some possibilities:

- https://github.com/sqlite-sync/SQLite-sync.com
- http://www.symmetricds.org/
- https://github.com/CanonicalLtd/dqlite
- Use Fossil as your database





Re: [Pharo-users] Running pharo in daemon mode

2019-02-18 Thread Pierce Ng
On Mon, Feb 18, 2019 at 04:39:03PM -0500, sergio ruiz wrote:
> I found my issue.. I need to be running in daemon mode.. i was running with
> &, but as soon as my connection lets go, the app dies..

My daemontools run file:

  #!/bin/sh
  /usr/bin/setuidgid app1 \
/pkg/vm/pharo -vm-display-null -vm-sound-null app1.image --no-quit

My Dockerfile CMD

  /pkg/vm/pharo -vm-display-null -vm-sound-null app.image --no-quit st runApp.st

You could also try '-headless' instead of '-vm-display-null'. 

Pierce



Re: [Pharo-users] im using pharo 7 with linux env. but cannot input korean.

2019-02-15 Thread Pierce Ng
On Fri, Feb 15, 2019 at 10:42:42PM +0900, peter yoo wrote:
> hello~.. im using pharo 7 with linux env. but cannot input korean.
> and.. already start shell script file open and add "--compositioninput".

I start Pharo with -compositioninput (one dash, didn't try two dashes
for the option). Chinese and Japanese input works for me. In Pharo I use
Noto Sans font loaded from system. OS is Xubuntu 18.04. Input system is
fcitx and mozc for Japanese. In Pharo playground, press alt-space to
enable Chinese/Japanese input, and just type.




Re: [Pharo-users] Trying to understand Developing with Pharo, Deploying with Gemstone/s

2019-02-09 Thread Pierce Ng
On Sat, Feb 09, 2019 at 01:15:43PM +0100, Petr Fischer via Pharo-users wrote:
> Loading code and projects into Gemstone - it's more like "do it
> yourself" or use tODE from GsDevKit_home (open source project, but
> completely unofficial, supported by "Dale").

Gemstone has Gofer. I develop on Pharo, save to .mcz using Monticello
and then 'Gofer it' via a Pharo 3 image running Tode to load into
Gemstone. Dale is updating Tode so that Pharo versions 6 and 7 should
now or soon run Tode.

Gemstone also does Git. 

Pierce



Re: [Pharo-users] SQLite3 [UDBC2] - "Could not coerce arguments" error for UTF8 chars

2019-02-05 Thread Pierce Ng
On Tue, Feb 05, 2019 at 08:20:22PM +0100, Petr Fischer via Pharo-users wrote:
> But still... I do not expect anyone to create tables through binding
> values (like in your example), so following SQL command is still
> broken:
> db execute: 'create table A (ID INTEGER, T TEXT DEFAULT ''áěšřčá'')'.

Your original mail was about insert, not create.

Anyhow, I think I see the problem: SQLite's APIs accept UTF8-encoded SQL
input strings. UDBCSQLite just uses UFFI's String to char* conversion to
pass strings in Pharo to the FFI calls. But 'áěšřčá' is a WideString.
Judiciously sending #utf8Encoded to the input SQL string seems to do the
trick. 

| db |
db := UDBCSQLite3Connection openOn: '/tmp/u.db'.
[| rs |
 db execute: 'create table a (k, v varchar default 
''ěščřžýáíéúůĚŠČŘŽÝÁÍÉÚŮ'')'.
 db execute: 'insert into a (k) values (NULL)'.
 rs := db execute: 'select k, v from a'.
 rs next inspect.
] ensure: [ db close ]

Above snippet evaluates to an inspector on a UDBCSQLite3Row instance
with the expected data. See screenshot.

I should be able to fix this in UDBCSQLite over the next two days as it
is Chinese New Year long holiday here.

Btw, you mentioned UDBC2. Not speaking for Torsten but I believe UDBC2
is WIP experimental stuff. Better to use UDBCSQLite. Easiest way to load
is to install GlorpSQLite via the Catalog Browser. Ignore the warning
that the package is not tested for Pharo 7 - that's a Catalog Browser
bug.




Re: [Pharo-users] Non-greedy RegEx?

2019-02-05 Thread Pierce Ng
On Tue, Feb 05, 2019 at 07:25:07PM +0100, Norbert Hartl wrote:
> > Am 05.02.2019 um 16:16 schrieb Sven Van Caekenberghe :
> > Still, there are advantages to an in-image solution, can't says this
> > enough, these external lib dependencies pose their own problems ...
> +1

Libraries like libgit2, libssh2 and quite a few more are already a core
part of Pharo, so I'd say philosophically might as well go all in to
make FFI to external libraries an intrinsic part of computing with
Pharo, not just for developing Pharo itself. The more people use UFFI,
the better it will become.





Re: [Pharo-users] Non-greedy RegEx?

2019-02-05 Thread Pierce Ng
On Wed, Feb 06, 2019 at 12:26:00AM +1300, Richard O'Keefe wrote:
> Please DON'T move to PCRE.
> "Outside world standards"?  There are so many.
> There are two important things to know about
> PCRE: (1) it is a popular open source regexp
> library for Perl-style regexps, (2) because of
> that, it is prone to truly horrendous performance
> problems.  There are alternatives, such as re2,
> https://github.com/google/re2 ,
> which are not subject to PCRE's intrinsic
> performance pathologies.  As it happens, re2
> supports *? +? and ??.

Can you share some examples of PCRE's bad performance? 

Pierce



Re: [Pharo-users] Github pharo-* organizations

2019-02-05 Thread Pierce Ng
On Tue, Feb 05, 2019 at 12:52:37AM -0300, Hernán Morales Durand wrote:
> I am currently writing a command-line tool which queries pharo repositories
> using the GitHub API, and based on the repository tag. Maybe not exactly
> what you asked for but it's a start. You can find the tool at:
> https://github.com/hernanmd/pi

Looks interesting. Thanks.

Pierce




Re: [Pharo-users] SQLite3 [UDBC2] - "Could not coerce arguments" error for UTF8 chars

2019-02-05 Thread Pierce Ng
On Tue, Feb 05, 2019 at 02:51:42PM +, Petr Fischer via Pharo-users wrote:
> When I executing this insert SQL command:
> insert into "TABLE" (..., "VARCHAR_FIELD") values (..., 
> 'ěščřžýáíéúůĚŠČŘŽÝÁÍÉÚŮ');
> this UDBC error occurs (what's wrong?):
> Error: "Could not coerce arguments"

Please show complete code.

Below code completes without error.

| db |
db := UDBCSQLite3Connection openOn: '/tmp/u.db'.
[   db basicExecute: 'create table x (xv varchar)'.
db execute: 'insert into x values (?)'
with: (Array with: 'ěščřžýáíéúůĚŠČŘŽÝÁÍÉÚŮ').
] ensure: [ db close ]

Below checks the database outside Pharo.

% sqlite3 /tmp/u.db
SQLite version 3.26.0 2018-12-01 12:34:55
Enter ".help" for usage hints.
sqlite> .tables
x
sqlite> .schema x
CREATE TABLE x (xv varchar);
sqlite> .header on
sqlite> select xv from x;
xv
ěščřžýáíéúůĚŠČŘŽÝÁÍÉÚŮ
sqlite>





[Pharo-users] Github pharo-* organizations

2019-02-04 Thread Pierce Ng
Hi all,

Is there a definitive list of all the pharo-* organizations on GH? Like
pharo-rdbms, pharo-nosql, pharo-vcs, ... Or, a way to query GH to find out?

Pierce



Re: [Pharo-users] why doesn't this baseline load any package when included in another baseline?

2019-02-03 Thread Pierce Ng
On Sun, Feb 03, 2019 at 01:41:30PM -0800, PAUL DEBRUICKER wrote:
> MCHttpRepository
> location: 'http://www.squeaksource.com/TimeZoneDatabase'

Hi Paul,

I see that there is a ConfigurationOfTimeZoneDatabase in the SS repo as
well. 

>   spec baseline: 'TimeZoneDatabase'
>   with: [ spec repository: 
> 'http://www.squeaksource.com/TimeZoneDatabase' ].

In your BaselineOfYourProject that is citing TimeZoneDatabase as a
dependency, you could try loading ConfigOfTimeZoneDatabase instead:

spec project: 'TimeZoneDatabase' with: [ 
   spec 
 className: 'ConfigurationOfTimeZoneDatabase';
 version: #stable;
 repository: 'http://www.squeaksource.com/TimeZoneDatabase' ].

This is known working in my BaselineOfGlorpSQLite which loads 
ConfigurationOfUDBC
from STH.

Pierce




Re: [Pharo-users] PharoV50.sources in VM?

2019-02-02 Thread Pierce Ng
On Sat, Feb 02, 2019 at 12:54:13PM +0100, Alistair Grant wrote:
> On Sat, 2 Feb 2019 at 09:32, Hilaire  wrote:
> > By the way, is there any reason to not remove the symbols in the Windows
> > and Linux VM libraries? It saves several MB. At least for DrGeo
> > distribution, there is no use.
> 
> I'm  not sure what the impact of this would be, so would prefer others
> to comment.

I just built the 32-bit Windows VM from opensmalltalk-vm on Windows 7.
Here's what I got. Pharo.exe works fine. 

 Volume in drive C has no label.
 Volume Serial Number is FCE0-E161

 Directory of C:\pkg\pharo6vm32

03/02/2019  12:54 AM 2,875,628 Pharo.exe
03/02/2019  12:54 AM 2,875,628 PharoConsole.exe
03/02/2019  12:54 AM 9,567,149 PharoConsoleUnstripped.exe
03/02/2019  12:54 AM 9,567,149 PharoUnstripped.exe
   4 File(s) 24,885,554 bytes
   0 Dir(s)  33,491,107,840 bytes free

I think the stripping comes from build.win32x86/common/Makefile starting
line 309:

ifneq ($STRIPEXE,)
$(STRIPEXE): $(VMEXE)
$(STRIP) --strip-unneeded -o $(STRIPEXE) $(VMEXE)
$(OBJCOPY) --add-gnu-debuglink=$(VMEXE) $(STRIPEXE)

$(STRIPCONSOLEEXE): $(CONSOLEVMEXE)
$(STRIP) --strip-unneeded -o $(STRIPCONSOLEEXE) $(CONSOLEVMEXE)
$(OBJCOPY) --add-gnu-debuglink=$(CONSOLEVMEXE) $(STRIPCONSOLEEXE)
endif

The build output is in build.win32x86/pharo.cog.spur/build/vm. I copied
the *exe and *.dll into c:\pkg\pharo6vm32 and run the VM from there.

Oh, my Linux VM (also self-built) isn't stripped.

% file ~/pkg/pharo6vm64/pharo 
/home/pierce/pkg/pharo6vm64/pharo: ELF 64-bit LSB executable, x86-64, 
version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, 
for GNU/Linux 2.6.32, BuildID[sha1]=79f0524e9ecda9a3a3143fb6ba4ff45f552e05dd, 
with debug_info, not stripped





[Pharo-users] Updated README for PasswordCrypt

2019-01-25 Thread Pierce Ng
Hi all,

I've updated the README for PasswordCrypt as part of my objective to
write proper READMEs for my Github repos in 1Q2019.

  https://github.com/PierceNg/PasswordCrypt

Pierce



Re: [Pharo-users] [VIDEO TUTORIAL] How to use external code editors to code in Pharo

2019-01-24 Thread Pierce Ng
On Thu, Jan 24, 2019 at 08:29:46PM +0530, K K Subbu wrote:
> Nice clip - short and sweet. You may want to point people to about chunk
> file format in the description to alert people who may break chunk syntax by
> accident and get confused when fileIn breaks (been there, done that :-().

Maybe Esteban has already solved the chunk file problem by inventing the
Tonel format. People can concat all their Tonel class files into one
gigantic text file and knock themselves out with emacs/vim. 

Say a client-server setup: Headless Pharo runs a Shampoo server. Emacs
runs the Shampoo client and talks to the Pharo instance to manipulate
whatever Pharo stuff on the Emacs side as text. 

I'm not seriously suggesting the above by the way. That'll be like
making Emacs into an ad-hoc bug-ridden slow implementation of the
Smalltalk IDE, to borrow a phrase from a famous person.

Pierce




Re: [Pharo-users] [Pharo-dev] [ANN] Pharo 7.0 released!

2019-01-23 Thread Pierce Ng
On Wed, Jan 23, 2019 at 06:43:50PM -0500, Offray Vladimir Luna Cárdenas wrote:
> I joined HN just to be able to comment on this thread[1]. Yes, it seems
> [1] https://news.ycombinator.com/item?id=18984409

Kudos for a measured response. 




Re: [Pharo-users] RSA and cryptography

2019-01-23 Thread Pierce Ng
On Wed, Jan 23, 2019 at 02:56:09PM +0100, Norbert Hartl wrote:
> I don’t think so. We use RSA public key validation. It does not seem
> that libsodium supports that. 
>
> A binding to libcrypto would be best :)

Hi Norbert,

  https://github.com/PierceNg/OpenSSL-Pharo

To load:

  Metacello new
baseline: 'OpenSSL';
repository: 'github://PierceNg/OpenSSL-Pharo/src-st';
load.

I'm writing a proper README.md. For now the unit tests show what's there
and how to use. For RSA, see LcEvpPublicKeyTest.

I started this with the goal of writing a Let's Encrypt client. That
goal is now dropped, as there are enough tools out there that make LE
integration easy. I'll wrap more of libcrypto as and when I need them.
Contributions welcome. :-) 

Pierce



Re: [Pharo-users] [Iceberg] Loading my git project into a new image

2019-01-21 Thread Pierce Ng
On Mon, Jan 21, 2019 at 03:10:49AM +0100, sergio ruiz wrote:
> While I can clone the the repo on in my new image using Iceberg, I can’t
> figure out now to load the packages, now that they are loaded up via
> iceberg.

If you mean you want to load from a git repo in your local filesystem,
then like this:

  Metacello new
repository: 'gitlocal:///local/filesystem/path/to/your/repo';
baseline: '...';
load

Pierce




Re: [Pharo-users] Pier CMS

2019-01-15 Thread Pierce Ng via Pharo-users
--- Begin Message ---
On Tue, Jan 15, 2019 at 09:08:43AM -0500, Richard Kenneth Eng wrote:
> I'm looking at Pier CMS and it appears to require (32-bit) Pharo 1.3. Since
> I'm running 64-bit Pharo on 64-bit Linux, this is a problem, am I right?

You can install 32-bit run-time libraries on your 64-bit Linux to run
32-bit Pharo. I'm still running Pharo 5 and 6 images that way. However,
Pier on Pharo 1.3 is ancient by Internet time scale and you are unlikely
to get much help if/when you run into problems.

Pierce

--- End Message ---


Re: [Pharo-users] Library to use multi-core in Pharo?

2019-01-09 Thread Pierce Ng via Pharo-users
--- Begin Message ---
On Wed, Jan 09, 2019 at 01:18:45PM -0300, Alexandre Bergel via Pharo-users 
wrote:
> Is there an effort to easily use multi-core or native processes in Pharo?
> I am thinking about a library that offer a construct like:

There used to be a Hydra VM for Squeak: 

  http://squeakvm.org/~sig/hydravm/devnotes.html

From the developer notes: A HydraVM encapsulates full interpreter state
in single object. This allowing it to support as many as needed
interpreter instances to be run using different native threads. Most of
VM functions (and all primitives) now require an additional argument -
interpreter instance.

Pierce


--- End Message ---


[Pharo-users] PostgresV3 with parameter binding

2018-12-25 Thread Pierce Ng
Hi all,

I've modified PostgresV3 to do parameter binding, i.e., parsing SQL and
binding/executing with data are performed in separate protocol steps.
I've add a simple client API with some examples demonstrating usage. The
examples require a PostgreSQL server loaded with the Sakila database.
Instructions on bringing the database up and running the examples are in
my blog post:

  https://www.samadhiweb.com/blog/2018.12.25.postgresv3.html

Season's greetings!

Pierce







Re: [Pharo-users] Teapot and SSL

2018-12-22 Thread Pierce Ng
On Sat, Dec 22, 2018 at 02:07:06PM -0500, Offray Vladimir Luna Cárdenas wrote:
> In your setup, you talk about SmallCMS1 as a blog engine that runs on
> Pharo 6 and seems kind of integrated with Fossil. Brea [1] (in early
> stages now), pursuits similar goals. Do you have any link to SmallCMS1?

Hi Offray,

I wrote SmallCMS1 as a programming exercise. Its code is like a ball of
wax and I have no plan to release it. 

It's not particularly integrated to Fossil per se. SmallCMS1 serves
content from an open Fossil repo. The repo has a push-hook defined and
there is a Fossil server running for that repo.  When I 'fossil push'
from my laptop to the server, the push-hook is triggered to update the
repo, and the new content is transparently served by SmallCMS1. The
mechanism is conceptually similar to Git push hooks on which much has
been written.

I blogged about the pre-Docker setup.

  https://www.samadhiweb.com/blog/2016.08.12.fossil.html

I'm not satisfied with the way the Fossil thing is done for several
reasons, but hey it works for me on my computers. :-)

> [1] https://mutabit.com/repos.fossil/brea/

Good stuff!

Pierce



Re: [Pharo-users] Teapot and SSL

2018-12-21 Thread Pierce Ng
On Fri, Dec 21, 2018 at 02:42:04PM -0600, horrido wrote:
> Okay, I will dispense with the self-signed certificate and purchase a
> commercial one, say, from Comodo (PositiveSSL).

Use Let's Encrypt-issued certificates, available without charge. Let's
Encrypt's CA certificate is built-in trusted by all the major web
browsers, meaning no action is required on the part of the web browser
user when visiting a site over HTTPS with certificate issued by Let's
Encrypt.

Use Caddy as reverse proxy for your webapp. Caddy has transparent
integration with Let's Encrypt: it generates/saves crypto keys, performs
the Let's Encrypt protocol dances to request for and renew Let's Encrypt
certificates, meaning no action is required on the part of the web
site/app administrator after setting it up.

Use Docker, which makes it easy to set up Caddy and your Pharo webapp. 

See my recent blog post:

  https://www.samadhiweb.com/blog/2018.12.09.https.html

Pierce



Re: [Pharo-users] GlorpSQLite not finding sqlite library on Mac

2018-12-16 Thread Pierce Ng
On Sun, Dec 16, 2018 at 10:25:11AM -0800, Todd Blanchard via Pharo-users wrote:
> Metacello new 
>   repository: 'github://pharo-rdbms/glorp-sqlite3';
>   baseline: 'GlorpSQLite';
>   load.

Hi Todd,

Pharo 6 or 7? 32- or 64-bit?

> This seems to be the only way to get SQLite support?  There is no
> standalone UFFI library?  Not that I have a problem with it, I know
> and like GLORP.

GlorpSQLite is built on the standalone SQLite UFFI library. 

> Then I ran the basic UDBCSQLite tests and they all fail with 'External
> module not found'.  I presume this means that the sqlite library was
> not found but the best I can find is a method #library that returns
> #sqlite 
> Reading the well written
> https://files.pharo.org/books-pdfs/booklet-uFFI/UFFIDRAFT.pdf I gather
> that I should subclass FFILibrary to make a SQLiteLibrary and have
> UDBCSQLite class that implements  #macModuleName to return
> '/usr/local/Cellar/libspatialite/4.3.0a_6/libspatialite.dylib'?

The library was written before that convention was established.
Currently it is UDBCSQLite3Library (subclassing Object) and its #library
says this:

  library
Smalltalk os isMacOS ifTrue: [ ^ #sqlite3 ].
^ 'sqlite3'

This worked before as I had used it with Pharo 5 when my Mac was on El
Capitan and Sierra. The Mac is now on High Sierra. 

Testing... Ok, the system-supplied library is named libsqlite3.0.dylib.
After some experimentation, copying/renaming said library works:

  % cp -p /usr/lib/libsqlite3.0.dylib % 
~/Pharo.app/Contents/MacOS/Plugins/libsqlite3.dylib

Now 64-bit Pharo 60543 finds the dylib, the SQLite tests run and pass.
I also tested keeping the '3.0' in the dylib file name, modifying the
#library method accordingly, and evaluating 'UDBCSQLite3Library reset'
to clear the singleton class variable.

I've not run into this situation before because I've always used my own
custom SQLite shared library that includes JSON, FTS etc extensions.

For good measure I also ran the Glorp tests and got 891 run, 890 passes,
1 error. The error is due to my changing SQLite's boolean handling, see 

  https://www.samadhiweb.com/blog/2018.05.20.sqlite.boolean.html

The test error has been fixed for Pharo 7. Not yet back-ported for Pharo
6. 

To load GlorpSQLite for Pharo 7, use the Catalog Browser, or,
equivalently, load from my repo:

  Metacello new 
repository: 'github://PierceNg/glorp-sqlite3:pharo7';
baseline: 'GlorpSQLite';
load.

> spatialite

Cool! Please let me know how this goes. 

Back in Pharo 4's Native Boost days, NBSQLite as it was called then
supported both SQLite and SQLcipher. I had experimented with loading
libsqlcipher3 from UDBCSQLcipher3Library, which subclasses
UDBCSQLite3Library, and IIRC also via some class variable in
UDBCSQLite3Library determining which shared library to load. Torsten
Bergmann kindly ported NBSQLite to UFFI. The SQLcipher part is still on
my to-do list, and I am also interested to have (Glorp|UDBC)SQLite load
Spatialite (and maybe even libspatialitecipher) cleanly.

Pierce




Re: [Pharo-users] GPS / Longitude / Latitude library

2018-12-05 Thread Pierce Ng
On Wed, Dec 05, 2018 at 07:34:35AM +, Alistair Grant wrote:
> I'm not doing any database work at the moment (storing results in STON
> files for now), but will also add the links to the class comments.

Hi Alistair,

I wasn't suggesting storing data in a database per se. 

I thought that, given that the desired functionality is not available in
Pharo, the options are to implement it in pure Smalltalk or wrap an
existing library. In the latter case, typically one wraps a C library
using FFI.  With SQLite, its extensions are C libraries that are already
wrapped for SQL. Writing SQL queries may get you a long way where you're
going.

Pierce




Re: [Pharo-users] GPS / Longitude / Latitude library

2018-12-04 Thread Pierce Ng
On Tue, Dec 04, 2018 at 10:21:20AM +0100, Alistair Grant wrote:
> Does anyone know of a library for processing GPS coordinates?
> 
> What I'm looking for are things like:
> 
> - Parsing from and printing to various string formats (HMS, NESW, decimal)
> - Distance between two points
> - etc.

SQLite-based possibilities:

- Spatialite: https://www.gaia-gis.it/fossil/libspatialite/index
- R*Tree: https://sqlite.org/rtree.html
- GeoPoly: https://sqlite.org/geopoly.html




Re: [Pharo-users] Unable to compile myself Pharo

2018-12-02 Thread Pierce Ng
On Sat, Dec 01, 2018 at 07:37:12PM +0100, Alexandre Garreau wrote:
> >   https://github.com/OpenSmalltalk/opensmalltalk-vm
> 
> Wait if it’s the same than for squeak… knowing there’s a “squeak-vm”
> package in debian that claim to be able to run several images… could it
> be that it could be used to run pharo?

Unlikely. OpenSmalltalk VM's single source code base is used to build
VMs for several different Smalltalk-like languages.

Pierce



Re: [Pharo-users] Unable to compile myself Pharo

2018-11-30 Thread Pierce Ng
On Fri, Nov 30, 2018 at 07:15:22PM +0100, Alexandre Garreau wrote:
> But I saw the bootstrap process involve redownloading a binary image
> anyway… I’d have just prefered to recompile it to be sure, as I’m
> usually more comfortable with this idea.  Normally compiling a new
> language is —though long— not that difficult.

For Pharo (and relatives like Squeak and Cuis) there are two parts: VM
and image. To build your own VM, follow the README's instructions for
the OpenSmalltalk VM:

  https://github.com/OpenSmalltalk/opensmalltalk-vm

As for building your own images, for now, I suggest to use the standard
downloadable images.

Pierce



Re: [Pharo-users] VPS difficulties

2018-11-29 Thread Pierce Ng
On Wed, Nov 21, 2018 at 07:06:08PM -0500, Richard Kenneth Eng wrote:
> I'm creating the competition website using Pharo and Teapot. For
> encryption, I'm using Pierce Ng's PasswordCrypt, which requires a 32-bit C
> library. This means I must run 32-bit Pharo.

PasswordCrypt can be built as a 64-bit library.

(Was away on vacation. Just saw this.)

Pierce



Re: [Pharo-users] External module not found

2018-11-18 Thread Pierce Ng
On Sat, Nov 17, 2018 at 05:38:28PM -0500, Richard Kenneth Eng wrote:
> I have a most peculiar problem. I've been using Pierce Ng’s PasswordCrypt
>  encryption
> package with Pharo 5. Now that I'm using Pharo 6, it doesn't seem to work
> anymore. The ffiCall:module: message always gives me "External module
> not found".

I use the library myself on 32-bit Pharo 6, so it works, for me at least.

For custom so/dll files such as this library or my custom-built SQLite
library, my practice is to place them into the VM directory where
the Pharo executable and all its bundled so/dll files are. Then I run
following script to start Pharo:

  #!/bin/sh
  PHAROVMPATH=$(dirname `readlink -f "$0"`)
  LD_LIBRARY_PATH="$PHAROVMPATH" exec "$PHAROVMPATH/pharo" $@ &

Pierce



[Pharo-users] GlorpSQLite on Pharo 7

2018-10-23 Thread Pierce Ng
Hi all,

GlorpSQLite now runs on Pharo 7, passing all 891 tests.

Load from my repo's pharo7dev branch:

  Metacello new
baseline: 'GlorpSQLite';
repository: 'github://PierceNg/glorp-sqlite3:pharo7dev';
load.

Tested on 32- and 64-bit Ubuntu 18.04 with image 5f13ae8. 

Pierce



Re: [Pharo-users] Installing SmaCC

2018-10-18 Thread Pierce Ng
On Wed, Oct 17, 2018 at 01:38:36PM +0300, Dimitris Chloupis wrote:
> About your last part on platforms, I will be providing a way to inline C
> code so one can you use C macros to detect the platform and generate code
> accordingly. 

Smalltalk/X allows inline C. Not sure about macros though, as I don't
know whether Smalltalk/X runs the C code through the C preprocessor or
does its own compilationn magic. 

Pierce



Re: [Pharo-users] GlorpSQLite Github release management

2018-10-17 Thread Pierce Ng
On Sat, Oct 13, 2018 at 09:51:53AM +0800, Ben Coman wrote:
> Note that git branches are simply pointers to a particular commit hash.
> There is no computational link between the "branch name" in your repo
> and the "branch name" in the target repo.

Thanks Ben and Alistair. I'll experiment and write up whatever I find
out.

Pierce




Re: [Pharo-users] compiling libraries for Pharo on macOS

2018-10-17 Thread Pierce Ng
On Wed, Oct 17, 2018 at 10:08:58AM +0200, Michel Onoff wrote:
> Specifically, I'm trying to build on all supported platforms, namely macOS,
> Windows and Linux. Currently I've got Linux and Windows under control, but I
> cannot find a systematic way to build on macOS.

When I last tried either on Yosemite or El Capitan, I found that the
Pharo at that time could not load 32/64-bit universal libraries.
Building a 32-bit library for 32-bit Pharo fixed it for me. You might
want to try it. 

Pierce




[Pharo-users] GlorpSQLite Github release management

2018-10-11 Thread Pierce Ng
Hi all,

So GlorpSQLite works on Pharo 5 and 6, but not yet on Pharo 7.

Currently, I have the following:

  https://github.com/PierceNg/glorp
  https://github.com/PierceNg/glorp-sqlite3

Which are forks of these:

  https://github.com/pharo-rdbms/glorp
  https://github.com/pharo-rdbms/glorp-sqlite3

I'm thinking to create a release, say, v1.0, for the current known
working GlorpSQLite combo for Pharo 5 and 6 in my repos, then, ...
create a branch for Pharo 7? Then turn the branch into release v2.0 when
ready? I do all of these actions in my repo, and through pull requests
to upstream, Git will take care of synchronizing across the forks?

Does the above sound workable? Is there a better approach? 

Pierce, Git noob



Re: [Pharo-users] World Cup 2018 with Glorp : SQL dump for SQLite : wc2018.sql

2018-10-11 Thread Pierce Ng
On Thu, Oct 11, 2018 at 06:45:07PM +0200, H. Hirzel wrote:
> Hi Pierce
> 
> In your blog entry
> 'World Cup 2018 with Glorp'
> you write about an SQL dump file wc2018.sql and mention a repo?
> 
> https://github.com/openfootball/world-cup/tree/master/2018--russia
> 
> seems to be a candidate, but on SQL.
> 
> In which repo is it?

Hi Hannes,

I built SQLite databases from the data in
https://github.com/openfootball/datafile.git, then generated the SQLite
dump files, which went into the 'data' directory in my repo
https://github.com/PierceNg/footballdb-Glorp.  

I don't remember whether the WC 2018 dump file has the match results,
but the WC 2014 one ought to contain the full tournament data.

Pierce



Re: [Pharo-users] What is the easiest way to get SQLite3 support in Pharo7? (Ubuntu)

2018-10-11 Thread Pierce Ng
On Thu, Oct 11, 2018 at 06:27:21PM +0200, H. Hirzel wrote:
> Great! Just this very minute before I saw your mail I found your
> website with a lot of Pharo related SQLite posts.

Enjoy! :-)

> Are you the maintainer of GlorpSQLite?

Yes, I wrote it and I am maintaining it.

Pierce




Re: [Pharo-users] What is the easiest way to get SQLite3 support in Pharo7? (Ubuntu)

2018-10-11 Thread Pierce Ng
On Thu, Oct 11, 2018 at 03:38:21PM +0200, H. Hirzel wrote:
> What is the easiest way to get SQLite3 support in Pharo7 (Ubuntu Linux)?

Hi Hannes,

Until the catalog is updated, the snippet way is as follows:

  Metacello new
repository: 'github://pharo-rdbms/glorp-sqlite3';
baseline: 'GlorpSQLite';
load.

I'm on Ubuntu 18.04. I've just run the above for Pharo7.0 f8ef5eb
images, both 32- and 64-bit. After installing, in Test Runner, I
selected UDBC and ran the SQLite tests: all 82 UDBCSQLite tests passed.
For Glorp, on both, 891 run, 881 passes, 10 errors. For good measure, I
did the same in a fresh Pharo-60543 image, and this time all 891 Glorp
tests passed. So need to look into Glorp on Pharo 7.

Pierce




Re: [Pharo-users] Glorp with P3

2018-10-10 Thread Pierce Ng
On Wed, Oct 10, 2018 at 11:12:37AM +0200, Sven Van Caekenberghe wrote:
> I know that the actual PSQL DB that I am using has all the Glorp test
> tables in it, I forgot whether that happened automatically or not.

The Glorp test database is set up by "#GlorpDemoTablePopulatorResource 
asClass invalidateSetup".  In the case of Glorp-SQLite3, that step is
done by BaselineOfGlorpSQLite>>postLoadDoIt.

Pierce



Re: [Pharo-users] [Pharo-dev] [ANN] Success story Mobility Map

2018-09-30 Thread Pierce Ng
On Wed, Sep 26, 2018 at 07:49:10PM +0200, Norbert Hartl wrote:
>>> And a lot more. This is a coarse grained overview over the
>>> architecture. I’m happy to answer further questions about this.
>>> [very nice writeup]

Hi Norbert,

Very nice write-up, thanks. 

What persistence mechanism are you using - Gemstone/S, Glorp, Voyage, ...?

Pierce




Re: [Pharo-users] [Pharo-dev] Pharo and Docker (some steps)

2018-09-09 Thread Pierce Ng
On Mon, Aug 20, 2018 at 03:10:58PM +0200, Torsten Bergmann wrote:
> I recently played with Pharo and Docker and summarized some of my
> steps in a small tutorial in my Pharo wiki:

Monkey saw, and monkey did. :-) Here's my report on my experimentation:

  http://www.samadhiweb.com/blog/2018.09.09.docker.html

Pierce



Re: [Pharo-users] HMAC-SHA512

2018-03-06 Thread Pierce Ng
On Sun, Mar 04, 2018 at 04:00:23PM -0300, Esteban A. Maringolo wrote:
> Thank you Pierce, I managed to make play the SHA classes of your
> OpenSSL wrapper with the PBKDF2 from Udo's plus HMAC from the
> Cryptography package.
> I sent you a pull-request
>  that includes
> missing accessors that I needed to achieve the above interplay.

Thanks Esteban. Pull request merged.

> The end result is this: https://github.com/eMaringolo/pharo-bip39mnemonic

Cool!

> What I'm missing is a better PRNG to generate random numbers from 128
> to 256 bits.

OpenSSL has RAND_* functions waiting to be wrapped. :-) Or, if your code is
running on a modern Unix-like system, read directly from /dev/random or
/dev/urandom.

Pierce




Re: [Pharo-users] Yet another Pharo in docker

2018-03-03 Thread Pierce Ng
On Sat, Mar 03, 2018 at 09:04:59AM -0700, Sean P. DeNigris wrote:
> Cool! I noticed the following [1]:
> ln -s \
>   `/sbin/ldconfig -p | sed -e 's|[^/]*||' | grep sqlite3` \
>   `find . -type f -name SqueakSSL.so -print0 | xargs -0
> dirname`/sqlite3.so
> What does it do?
> 
> Answer from Herby in private mail: fixes linux lib lookup problem in ffi,

I was just about to do this Docker thing the other way, which is to bundle my
own SQLite library, for these reasons:

- Customize SQLite to include JSON, FTS, etc.

- Yesterday I committed functionality to load SQLite extensions (so/dylib/dll
  files implementing SQL functions and virtual tables). I'm using a PCRE-based
  extension.

- SQLcipher. This is in NBSQLite3, to be ported to UFFI.

Pierce




Re: [Pharo-users] HMAC-SHA512

2018-03-03 Thread Pierce Ng
On Fri, Mar 02, 2018 at 11:24:36AM -0300, Esteban A. Maringolo wrote:
> There is a PBKDF2 package made by Udo Schneider, and seems to be
> easily pluggable with a different hashing algorithm, so I'd need a
> SHA512 class.

OpenSSL-Pharo wraps the SHA512 in libcrypto. See LcEvpSHA512Test.

  https://github.com/PierceNg/OpenSSL-Pharo

Pierce




[Pharo-users] Pillar Re: Neural Network - Handwritten Digit Recognition

2018-02-09 Thread Pierce Ng
On Thu, Feb 08, 2018 at 07:42:09PM +0800, Pierce Ng wrote:
> On Wed, Feb 07, 2018 at 08:24:29PM +0100, Stephane Ducasse wrote:
> > Here is the link 
> > https://github.com/SquareBracketAssociates/Booklet-IA-Neurons
> > I can give you commit rights.
> 
> My Github username is PierceNg. Thank you.

Stef, thanks for adding me to the repo. I've plugged my blog post in as chapter
1.

On Pillar, I see that the generated PDF shows the array inspector screenshot as
an outsized image. What's the best practice on sizing images?

Anyhow, I've set up Docker with the texlive:pillar image and just did a
successful test run. I can now experiment with agility. :-)

Pierce



Re: [Pharo-users] Neural Network - Handwritten Digit Recognition

2018-02-08 Thread Pierce Ng
On Wed, Feb 07, 2018 at 08:24:29PM +0100, Stephane Ducasse wrote:
> Here is the link https://github.com/SquareBracketAssociates/Booklet-IA-Neurons
> I can give you commit rights.

My Github username is PierceNg. Thank you.

Pierce



Re: [Pharo-users] Neural Network - Handwritten Digit Recognition

2018-02-06 Thread Pierce Ng
On Tue, Feb 06, 2018 at 11:40:12AM +0100, Stephane Ducasse wrote:
> Thanks for sharing this. This is cool.
> I set up a booklet Booklet-IANeurons for alex and a little book around
> neural networks and your work could fit there.

Happy to contribute to the book. The blog post content is already in Pillar.

Pierce



Re: [Pharo-users] Neural Network - Handwritten Digit Recognition

2018-02-06 Thread Pierce Ng
On Mon, Feb 05, 2018 at 05:59:53PM +0100, francesco agati wrote:
> the model can also be serialized for loading in other vm?

Yes. Serialized with STON on Linux 64-bit Pharo 6, materialized
and ran on Linux 32-bit Pharo 6 on another computer.

Pierce



Re: [Pharo-users] Examples of Garage for DB2

2018-01-04 Thread Pierce Ng
On Wed, Jan 03, 2018 at 11:42:22AM -0500, Andrei Stebakov wrote:
> I tried before to install odbc.
> Gofer new
>   squeaksource: 'ODBC';

Not Squeaksource. Load the version from Smalltalkhub:

  Gofer new
smalltalkhubUser: 'PharoExtras' project: 'ODBC';
...

Hopefully this version works with or without Esteban's suggestion.

> I still don't see how postgres can help but I'll give it another try.

I suggested PostgreSQL FDW because I know PostgreSQL. If you are not familiar
with PostgreSQL, then setting it up, setting up its FDW, and finally setting up
programmatic access to PostgreSQL to get at the FDW data is probably more work
than it is worth.

Pierce




Re: [Pharo-users] Examples of Garage for DB2

2018-01-03 Thread Pierce Ng
On Wed, Jan 03, 2018 at 10:12:32AM -0500, Andrei Stebakov wrote:
> Pierce, I couldn't find any smalltalk framework to work with DB2 at this
> point. I couldn't also find any Pharo odbc library. That's why at this
> point I am looking for any ideas how to connect to DB2 from Pharo.

I suppose Instantiations VA Smalltalk will be able to talk to DB2. I'm quite
sure Dolphin Smalltalk does ODBC too.

Staying with Pharo, assuming you have known-working DB2 ODBC driver for Windows
installed and ODBC to DB2 configured, try this:

  http://smalltalkhub.com/#!/~PharoExtras/ODBC/

Most recent commit was in Apr 2015 by Torsten 'switching to newer FFI'. So
hopefully this works with Pharo 6.1.

If the above doesn't work, but you know that the Windows DB2 ODBC driver works,
then - I'm not being facetious - install PostgreSQL, set up PostgreSQL foreign
data wrapper to ODBC, and talk to PostgreSQL using Pharo.

   
http://www.postgresonline.com/journal/archives/372-ODBC-FDW-now-supports-9.5-and-9.6.html

Or, set up Python's SQL Alchemy for DB2, install PostgreSQL, set up PostgreSQL
foreign data wrapper to SQL Alchemy, and talk to PostgreSQL using Pharo.

  https://wiki.postgresql.org/wiki/Foreign_data_wrappers
  https://github.com/Kozea/Multicorn

HTH.




Re: [Pharo-users] Examples of Garage for DB2

2018-01-03 Thread Pierce Ng
On Tue, Jan 02, 2018 at 02:10:03PM -0500, Andrei Stebakov wrote:
> I downloaded Garage to my Pharo 6.1 on windows. But in Garage I only see
> drivers for MySql, Postgres and Sqlite3.
> Does it mean that for DB2 I should look somewhere else or there is a way to
> create a connection for DB2 using existing Garage functionality?

Garage uses the OpenDBX C language database access library underneath.  Looking
at https://linuxnetworks.de/doc/index.php?title=OpenDBX/Support, it doesn't
look OpenDBX supports DB2.

Does the Windows DB2 ODBC driver work? Does Pharo successfully use the ODBC
driver to talk to DB2?

Pierce



Re: [Pharo-users] Running headless on Windows

2017-12-28 Thread Pierce Ng
On Wed, Dec 27, 2017 at 04:58:39PM +0100, Cyril Ferlicot D. wrote:
> On 12/27/2017 04:39 PM, Andrei Stebakov wrote:
> > When I run Pharo 6.1 with -- headless option on Windows, it executes the
> > eval command as expected but during the execution (which lasts 4 sec) it
> > opens the Pharo GUI. 
> > Is it expected? I thought headless means that the whole execution would
> > happen in the background
> 
> I think that currently Pharo does not have a "real" headless. But I
> heard there was work on that part for Pharo 7.

I know OP is talking about Windows...  I've been running server applications on
Linux without X11 with -vm-display-null and in-image RFBServer for access to
Pharo over VNC. This works very well for me.

I believe "real" headless means GUI is not run at all and therefore does not
consume CPU cycles, which is very welcome. Meanwhile, maybe -vm-display-null
works on Windows for scripting purposes?

Pierce




Re: [Pharo-users] HMAC-SHA512

2017-12-21 Thread Pierce Ng
On Tue, Dec 12, 2017 at 12:52:11AM +0800, Ben Coman wrote:
> I was going to ask why these updates aren't being pushed an OpenSSL repo
> shared with Squeak,
> since things should not be much different at this low level, but actually
> it was hard to
> determine which was the original repo. I see...
>http://www.squeaksource.com/SqueakSSL.html
> seems to have not beenupdated since 2012.

I think this might be the SSL plugin which is now part of the VM and is still
called SqueakSSL.

My library is for access to the crypto/X509 functions in OpenSSL's libcrypto.

For green field applications I recommend using NaCl aka libsodium with its
modern algorithms and crypto-safe programming practices.

Pierce




  1   2   3   >