Re: [Pharo-users] [ANN] JSON schema implementation

2018-11-22 Thread Esteban Maringolo
Thank you Norbert and IID.

Another brick in the bridge towards mainstream. :)

Regards,

El jue., 22 nov. 2018 a las 18:11, Sven Van Caekenberghe
() escribió:
>
> Nice. Another piece of the puzzle. Thank you.
>
> > On 22 Nov 2018, at 17:56, Norbert Hartl  wrote:
> >
> > JSONSchema
> > ===
> >
> > This is an implementation of JSON Schema for the pharo language. It is used 
> > to define the structure and values of a JSON string and to validate it. The 
> > schema itself can be externalized for being consumed by a third party.
> >
> > I like to announce the availability of a JSON schema implementation for 
> > pharo. As part of my implementation of OpenAPI (which is to be released a 
> > bit later) I factored out the JSON schema part into its own repository 
> > because I think it is useful. I release it even it is not really finished. 
> > Code is mostly undocumented and a lot of features are missing from the full 
> > spec. I will improve it slowly and add features as I need them or they 
> > being requested
> >
> > Hope you like it!
> >
> > Norbert
> >
> > 
> >
> > The documentation so far (from https://github.com/zweidenker/JSONSchema)
> >
> > It can be loaded by downloading it in pharo via
> >
> >   Metacello new
> > repository: 'github://zweidenker/JSONSchema';
> > baseline: #JSONSchema;
> > load
> >
> > Defining a schema
> > -
> >
> > These are the expression to create a schema model inside pharo.
> >
> > schema := {
> >   #name -> JSONSchema string.
> >   #dateAndTime -> (JSONSchema stringWithFormat: 'date-time').
> >   #numberOfPets -> JSONSchema number } asJSONSchema.
> >
> >
> > defines as schema that can parse the following JSON:
> >
> > jsonString := '{
> >   "name" : "John Doe",
> >   "dateAndTime" : "1970-01-01T14:00:00",
> >   "numberOfPets" : 3
> > }'.
> >
> > Reading/Writing a value using a schema
> > --
> >
> > To parse the value from JSON we only need to invoke:
> >
> > value := schema read: jsonString
> >
> > The object in value will have name as a string, dateAndTime as a 
> > DateAndTime object and numberOfPets as a SmallInteger object.
> >
> > The schema can also be used to write out the value as JSON. This is 
> > especially useful if we want to ensure that only valid JSON is written. For 
> > this invoke
> >
> > jsonString := schema write: value.
> >
> > Serialize/Materialize a schema
> > 
> >
> > Addtionally to reading and writing objects a schema can be serialized to 
> > string.
> >
> > schemaString := NeoJSONWriter toStringPretty: schema.
> >
> > gives
> >
> > {
> >   "type" : "object",
> >   "properties" : {
> >   "name" : {
> >   "type" : "string"
> >   },
> >   "numberOfPets" : {
> >   "type" : "number"
> >   },
> >   "dateAndTime" : {
> >   "type" : "string",
> >   "format" : "date-time"
> >   }
> >   }
> > }
> >
> >
> > If we would get a schema as string we can instantiate by invoking
> >
> > schema := JSONSchema fromString: schemaString.
> >
> > Nested schemas
> > ---
> >
> > Schemas can be nested in any depth. And it can be specified by using the 
> > literal Array syntax.
> >
> > schema := {
> >   #name -> JSONSchema string.
> >   #address -> {
> > #street -> JSONSchema string.
> > #number -> JSONSchema number
> >   } } asJSONSchema
> >
> > Constraints
> > ---
> >
> > JSON Schema has a defined set of constraints that can be specified. E.g. 
> > for a number the inerval of the value can be specified by
> >
> > numberSchema := JSONSchema number.
> > numberSchema interval
> >   minimum: 1;
> >   exclusiveMaximum: 100
> >
> > constraining the number value to be greater or equal to 1 and smaller than 
> > 100.
> >
>
>



Re: [Pharo-users] [ANN] JSON schema implementation

2018-11-22 Thread Francisco Ortiz Peñaloza
This is great.

Thanks!

On Thu, 22 Nov 2018 at 18:10 Sven Van Caekenberghe  wrote:

> Nice. Another piece of the puzzle. Thank you.
>
> > On 22 Nov 2018, at 17:56, Norbert Hartl  wrote:
> >
> > JSONSchema
> > ===
> >
> > This is an implementation of JSON Schema for the pharo language. It is
> used to define the structure and values of a JSON string and to validate
> it. The schema itself can be externalized for being consumed by a third
> party.
> >
> > I like to announce the availability of a JSON schema implementation for
> pharo. As part of my implementation of OpenAPI (which is to be released a
> bit later) I factored out the JSON schema part into its own repository
> because I think it is useful. I release it even it is not really finished.
> Code is mostly undocumented and a lot of features are missing from the full
> spec. I will improve it slowly and add features as I need them or they
> being requested
> >
> > Hope you like it!
> >
> > Norbert
> >
> > 
> >
> > The documentation so far (from https://github.com/zweidenker/JSONSchema)
> >
> > It can be loaded by downloading it in pharo via
> >
> >   Metacello new
> > repository: 'github://zweidenker/JSONSchema';
> > baseline: #JSONSchema;
> > load
> >
> > Defining a schema
> > -
> >
> > These are the expression to create a schema model inside pharo.
> >
> > schema := {
> >   #name -> JSONSchema string.
> >   #dateAndTime -> (JSONSchema stringWithFormat: 'date-time').
> >   #numberOfPets -> JSONSchema number } asJSONSchema.
> >
> >
> > defines as schema that can parse the following JSON:
> >
> > jsonString := '{
> >   "name" : "John Doe",
> >   "dateAndTime" : "1970-01-01T14:00:00",
> >   "numberOfPets" : 3
> > }'.
> >
> > Reading/Writing a value using a schema
> > --
> >
> > To parse the value from JSON we only need to invoke:
> >
> > value := schema read: jsonString
> >
> > The object in value will have name as a string, dateAndTime as a
> DateAndTime object and numberOfPets as a SmallInteger object.
> >
> > The schema can also be used to write out the value as JSON. This is
> especially useful if we want to ensure that only valid JSON is written. For
> this invoke
> >
> > jsonString := schema write: value.
> >
> > Serialize/Materialize a schema
> > 
> >
> > Addtionally to reading and writing objects a schema can be serialized to
> string.
> >
> > schemaString := NeoJSONWriter toStringPretty: schema.
> >
> > gives
> >
> > {
> >   "type" : "object",
> >   "properties" : {
> >   "name" : {
> >   "type" : "string"
> >   },
> >   "numberOfPets" : {
> >   "type" : "number"
> >   },
> >   "dateAndTime" : {
> >   "type" : "string",
> >   "format" : "date-time"
> >   }
> >   }
> > }
> >
> >
> > If we would get a schema as string we can instantiate by invoking
> >
> > schema := JSONSchema fromString: schemaString.
> >
> > Nested schemas
> > ---
> >
> > Schemas can be nested in any depth. And it can be specified by using the
> literal Array syntax.
> >
> > schema := {
> >   #name -> JSONSchema string.
> >   #address -> {
> > #street -> JSONSchema string.
> > #number -> JSONSchema number
> >   } } asJSONSchema
> >
> > Constraints
> > ---
> >
> > JSON Schema has a defined set of constraints that can be specified. E.g.
> for a number the inerval of the value can be specified by
> >
> > numberSchema := JSONSchema number.
> > numberSchema interval
> >   minimum: 1;
> >   exclusiveMaximum: 100
> >
> > constraining the number value to be greater or equal to 1 and smaller
> than 100.
> >
>
>
> --
Sent from the past


Re: [Pharo-users] [ANN] JSON schema implementation

2018-11-22 Thread Sven Van Caekenberghe
Nice. Another piece of the puzzle. Thank you.

> On 22 Nov 2018, at 17:56, Norbert Hartl  wrote:
> 
> JSONSchema
> ===
> 
> This is an implementation of JSON Schema for the pharo language. It is used 
> to define the structure and values of a JSON string and to validate it. The 
> schema itself can be externalized for being consumed by a third party.
> 
> I like to announce the availability of a JSON schema implementation for 
> pharo. As part of my implementation of OpenAPI (which is to be released a bit 
> later) I factored out the JSON schema part into its own repository because I 
> think it is useful. I release it even it is not really finished. Code is 
> mostly undocumented and a lot of features are missing from the full spec. I 
> will improve it slowly and add features as I need them or they being requested
> 
> Hope you like it!
> 
> Norbert 
> 
> 
> 
> The documentation so far (from https://github.com/zweidenker/JSONSchema)
> 
> It can be loaded by downloading it in pharo via
> 
>   Metacello new
> repository: 'github://zweidenker/JSONSchema';
> baseline: #JSONSchema;
> load
> 
> Defining a schema
> -
> 
> These are the expression to create a schema model inside pharo.
> 
> schema := {
>   #name -> JSONSchema string.
>   #dateAndTime -> (JSONSchema stringWithFormat: 'date-time').
>   #numberOfPets -> JSONSchema number } asJSONSchema.
> 
> 
> defines as schema that can parse the following JSON:
> 
> jsonString := '{
>   "name" : "John Doe",
>   "dateAndTime" : "1970-01-01T14:00:00",
>   "numberOfPets" : 3
> }'.
> 
> Reading/Writing a value using a schema
> --
> 
> To parse the value from JSON we only need to invoke:
> 
> value := schema read: jsonString
> 
> The object in value will have name as a string, dateAndTime as a DateAndTime 
> object and numberOfPets as a SmallInteger object.
> 
> The schema can also be used to write out the value as JSON. This is 
> especially useful if we want to ensure that only valid JSON is written. For 
> this invoke
> 
> jsonString := schema write: value.
> 
> Serialize/Materialize a schema
> 
> 
> Addtionally to reading and writing objects a schema can be serialized to 
> string.
> 
> schemaString := NeoJSONWriter toStringPretty: schema.
> 
> gives
> 
> {
>   "type" : "object",
>   "properties" : {
>   "name" : {
>   "type" : "string"
>   },
>   "numberOfPets" : {
>   "type" : "number"
>   },
>   "dateAndTime" : {
>   "type" : "string",
>   "format" : "date-time"
>   }
>   }
> }
> 
> 
> If we would get a schema as string we can instantiate by invoking
> 
> schema := JSONSchema fromString: schemaString.
> 
> Nested schemas
> ---
> 
> Schemas can be nested in any depth. And it can be specified by using the 
> literal Array syntax.
> 
> schema := {
>   #name -> JSONSchema string.
>   #address -> {
> #street -> JSONSchema string.
> #number -> JSONSchema number
>   } } asJSONSchema
> 
> Constraints
> ---
> 
> JSON Schema has a defined set of constraints that can be specified. E.g. for 
> a number the inerval of the value can be specified by
> 
> numberSchema := JSONSchema number.
> numberSchema interval
>   minimum: 1;
>   exclusiveMaximum: 100
> 
> constraining the number value to be greater or equal to 1 and smaller than 
> 100.
> 




Re: [Pharo-users] can't debug TinyBlog in the Pharo MOOC

2018-11-22 Thread iu136 via Pharo-users
--- Begin Message ---
EstebanLM wrote
> Hi, 
> 
> You are missing to initialise the Voyage repository. 
> I don’t know how is explained in the Mooc, but you will probably need to
> do something like: 
> 
> VOMemoryRepository new enableSingleton.
> 
> Cheers,
> Esteban

Hi Esteban. 

actually I'm using an External Mongo database and in the MOOC the
initialization of Voyage Mongo repository, is done like: 

TBBlog class >> initializeLocalhostMongoDB
| repository |
repository := VOMongoRepository database: 'tinyblog'.
repository enableSingleton.

TBBlog class >> reset
self initializeLocalhostMongoDB

and in my code I'm doing exactly like above. but interestingly when I wanted
to reset the cache of Voyage by:
 VORepository current reset

again I've got another Error saying: "MessageNotUnderstood: receiver of
"reset" is nill".

thanks anyway!



--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html

--- End Message ---


Re: [Pharo-users] VPS difficulties

2018-11-22 Thread Hans-Martin Mosner
It can't find the display drivers since the appropriate 32 bit libraries 
are missing. Use the 'ldd' command on the VM binary and on the shared 
libraries in its directory to find out which ones you're missing.


Cheers,
Hans-Martin

Am 22. November 2018 4:22:19 nachm. schrieb horrido 
:



I'm running 64-bit Debian in a VirtualBox image on my Mac.

When I install 64-bit Pharo, it works fine. When I install 32-bit Pharo, I
get the error message below. What's the difference??? Why can one find the
display driver and the other can't? This makes no sense.

Earlier, people have been telling me to use './pharo-ui Pharo.image &'. Is
this no longer kosher? What am I doing wrong?



Fred Kaiser Borg wrote

Those errors are not related to a 32 or 64 bits problem. The issue looks
like you've launched pharo-ui which looks for a physical screen that
isn't there. Are you trying to run pharo-ui in a debian VPS ?

You should run 'pharo' and 'pharo-ui', something like this:

$ pharo myApplication.image

Search on google for 'pharo headless', you should find plenty of example.

HTH,

Fred

On 22/11/2018 13:31, horrido wrote:

I ran 32-bit Pharo under 64-bit Debian and got this error:

[1] 8127
richard@debian:~/pharo32$ could not find display driver vm-display-X11;
either:
   - check that
/home/richard/pharo32/pharo-vm/lib/pharo/5.0-201806281256//vm-display-X11.so
exists, or
   - use the '-plugins


' option to tell me where it is, or

   - remove DISPLAY from your environment.
./pharo-ui: line 11:  8131 Aborted
"$DIR"/"pharo-vm/pharo"
"$@"

--

I thought you could always run 32-bit software in a 64-bit OS, but I
guess
I'm wrong.



Sean P. DeNigris wrote

horrido wrote

it threw up a bunch of errors.

Can you be more specific and did you try Mariano's suggestion about
32-bit
libs?



-
Cheers,
Sean
--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html





--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html







--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html







Re: [Pharo-users] VPS difficulties

2018-11-22 Thread horrido
Okay, I've resolved everything. First, the reason why I'm getting the
'pthread_setschedparam failed' error when I run Pharo under Debian is
because it must be run as 'root'! Don't ask me why, but that's the reason
why Pharo can't set thread priorities. (This wasn't an issue under Ubuntu
Server – go figure.)

Second, I am now using Pharo's own SHA256 class. It's probably not as secure
(because it doesn't use a salt value) and not as quick to execute (not being
C code), but for my purpose, it doesn't really matter.

So I can use DigitalOcean or OVH to run my web server in a VPS.



--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html



Re: [Pharo-users] can't debug TinyBlog in the Pharo MOOC

2018-11-22 Thread Esteban Lorenzano
Hi, 

You are missing to initialise the Voyage repository. 
I don’t know how is explained in the Mooc, but you will probably need to do 
something like: 

VOMemoryRepository new enableSingleton.

Cheers,
Esteban

> On 22 Nov 2018, at 17:51, iu136 via Pharo-users  
> wrote:
> 
> 
> From: iu136 
> Subject: can't debug TinyBlog in the Pharo MOOC
> Date: 22 November 2018 at 17:51:12 CET
> To: pharo-users@lists.pharo.org
> 
> 
> hi guys
> I'm following the Pharo MOOC and I'm at Week 4. the other day, I was trying
> to implement TinyBlog: Data Persistency using Voyage and Mongo, when I tried
> to compile the code, I've got an Error. the title of Error says:
> "MessageNotUnderstood: receiver of "save:" is nil", and it refers to
> TBMBlog>>writeBlogPost.
> 
> TBMBlog>>writeBlogPost: aTBMPost
>posts add: aTBMPost.
>aTBMPost save.
>self save .
> 
> thanks for your answers!
> 
> 
> 
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
> 
> 
> 



[Pharo-users] [ANN] JSON schema implementation

2018-11-22 Thread Norbert Hartl
JSONSchema
===

This is an implementation of JSON Schema for the pharo language. It is used to 
define the structure and values of a JSON string and to validate it. The schema 
itself can be externalized for being consumed by a third party.

I like to announce the availability of a JSON schema implementation for pharo. 
As part of my implementation of OpenAPI (which is to be released a bit later) I 
factored out the JSON schema part into its own repository because I think it is 
useful. I release it even it is not really finished. Code is mostly 
undocumented and a lot of features are missing from the full spec. I will 
improve it slowly and add features as I need them or they being requested

Hope you like it!

Norbert 



The documentation so far (from https://github.com/zweidenker/JSONSchema 
)

It can be loaded by downloading it in pharo via

  Metacello new
repository: 'github://zweidenker/JSONSchema';
baseline: #JSONSchema;
load

Defining a schema
-

These are the expression to create a schema model inside pharo.

schema := {
  #name -> JSONSchema string.
  #dateAndTime -> (JSONSchema stringWithFormat: 'date-time').
  #numberOfPets -> JSONSchema number } asJSONSchema.


defines as schema that can parse the following JSON:

jsonString := '{
  "name" : "John Doe",
  "dateAndTime" : "1970-01-01T14:00:00",
  "numberOfPets" : 3
}'.

Reading/Writing a value using a schema
--

To parse the value from JSON we only need to invoke:

value := schema read: jsonString

The object in value will have name as a string, dateAndTime as a DateAndTime 
object and numberOfPets as a SmallInteger object.

The schema can also be used to write out the value as JSON. This is especially 
useful if we want to ensure that only valid JSON is written. For this invoke

jsonString := schema write: value.

Serialize/Materialize a schema


Addtionally to reading and writing objects a schema can be serialized to string.

schemaString := NeoJSONWriter toStringPretty: schema.

gives

{
"type" : "object",
"properties" : {
"name" : {
"type" : "string"
},
"numberOfPets" : {
"type" : "number"
},
"dateAndTime" : {
"type" : "string",
"format" : "date-time"
}
}
}


If we would get a schema as string we can instantiate by invoking

schema := JSONSchema fromString: schemaString.

Nested schemas
---

Schemas can be nested in any depth. And it can be specified by using the 
literal Array syntax.

schema := {
  #name -> JSONSchema string.
  #address -> {
#street -> JSONSchema string.
#number -> JSONSchema number
  } } asJSONSchema

Constraints
---

JSON Schema has a defined set of constraints that can be specified. E.g. for a 
number the inerval of the value can be specified by

numberSchema := JSONSchema number.
numberSchema interval
  minimum: 1;
  exclusiveMaximum: 100

constraining the number value to be greater or equal to 1 and smaller than 100.



[Pharo-users] can't debug TinyBlog in the Pharo MOOC

2018-11-22 Thread iu136 via Pharo-users
--- Begin Message ---
hi guys
I'm following the Pharo MOOC and I'm at Week 4. the other day, I was trying
to implement TinyBlog: Data Persistency using Voyage and Mongo, when I tried
to compile the code, I've got an Error. the title of Error says:
"MessageNotUnderstood: receiver of "save:" is nil", and it refers to
TBMBlog>>writeBlogPost.

TBMBlog>>writeBlogPost: aTBMPost
posts add: aTBMPost.
aTBMPost save.
self save .

thanks for your answers!



--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html

--- End Message ---


Re: [Pharo-users] VPS difficulties

2018-11-22 Thread Ben Coman
On Thu, 22 Nov 2018 at 23:22, horrido  wrote:

> I'm running 64-bit Debian in a VirtualBox image on my Mac.
>
> When I install 64-bit Pharo, it works fine. When I install 32-bit Pharo, I
> get the error message below. What's the difference??? Why can one find the
> display driver and the other can't? This makes no sense.
>

Apart from the much larger images possible, a big driver to produce 64-bit
Pharo
is that Linux installations were becoming predominantly 64-bit
and by default don't pre-install all the 32 bit libraries.
e.g... https://www.maketecheasier.com/run-32-bit-apps-in-64-bit-linux/

When Pharo was *only* 32-bit, there were instructions on which 32-libs were
required.
I'm not sure were they are now.  (Maybe its worth keeping them around for
such cases, although it seems a backward step.)
You might find something at forum.world.st.  Ah, I see Sven has some good
info.


>
> Earlier, people have been telling me to use './pharo-ui Pharo.image &'. Is
> this no longer kosher? What am I doing wrong?
>

It depends on whether you download the standalone or using zero-conf.
This inconsistency has bitten me a few times, but I was familiar enough to
quickly determine what was going.
 Consistency would be good, but we'd need to break the long standing
pattern of one or the other.

cheers -ben


Re: [Pharo-users] VPS difficulties

2018-11-22 Thread Sven Van Caekenberghe
Using Linux requires certain skills/knowledge, this has nothing to do with 
Pharo or Smalltalk.

To run 32-bit binaries on a 64-bit system you need 32-bit libraries.

This might help (although maybe it is not totally up to date for Pharo 7)

https://github.com/svenvc/pharo-server-tools/blob/master/ubuntu-32bit-support-on-64bit.sh

You can check the dependencies of binaries and dynamic libraries with ldd. They 
have to be resolved correctly.

$ uname -a
Linux sigfox-1 4.4.0-21-generic #37-Ubuntu SMP Mon Apr 18 18:33:37 UTC 2016 
x86_64 x86_64 x86_64 GNU/Linux

$ file bin/pharo-vm/pharo 
bin/pharo-vm/pharo: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), 
dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.6.24, 
BuildID[sha1]=dcf3b690e793d6960e1dbccd36bd0b3938019471, not stripped

$ ldd bin/pharo-vm/pharo 
linux-gate.so.1 =>  (0xf773)
libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xf76d2000)
libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xf76cd000)
libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xf76b)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xf74fa000)
/lib/ld-linux.so.2 (0x565fe000)

pharo and pharo-ui are just scripts 

I would also strongly recommend not using native (FFI) libraries (at first).

You must also understand the difference between a UI based and headless system.

> On 22 Nov 2018, at 16:21, horrido  wrote:
> 
> I'm running 64-bit Debian in a VirtualBox image on my Mac.
> 
> When I install 64-bit Pharo, it works fine. When I install 32-bit Pharo, I
> get the error message below. What's the difference??? Why can one find the
> display driver and the other can't? This makes no sense.
> 
> Earlier, people have been telling me to use './pharo-ui Pharo.image &'. Is
> this no longer kosher? What am I doing wrong?
> 
> 
> 
> Fred Kaiser Borg wrote
>> Those errors are not related to a 32 or 64 bits problem. The issue looks 
>> like you've launched pharo-ui which looks for a physical screen that 
>> isn't there. Are you trying to run pharo-ui in a debian VPS ?
>> 
>> You should run 'pharo' and 'pharo-ui', something like this:
>> 
>> $ pharo myApplication.image
>> 
>> Search on google for 'pharo headless', you should find plenty of example.
>> 
>> HTH,
>> 
>> Fred
>> 
>> On 22/11/2018 13:31, horrido wrote:
>>> I ran 32-bit Pharo under 64-bit Debian and got this error:
>>> 
>>> [1] 8127
>>> richard@debian:~/pharo32$ could not find display driver vm-display-X11;
>>> either:
>>>   - check that
>>> /home/richard/pharo32/pharo-vm/lib/pharo/5.0-201806281256//vm-display-X11.so
>>> exists, or
>>>   - use the '-plugins 
>> 
>> ' option to tell me where it is, or
>>>   - remove DISPLAY from your environment.
>>> ./pharo-ui: line 11:  8131 Aborted
>>> "$DIR"/"pharo-vm/pharo"
>>> "$@"
>>> 
>>> --
>>> 
>>> I thought you could always run 32-bit software in a 64-bit OS, but I
>>> guess
>>> I'm wrong.
>>> 
>>> 
>>> 
>>> Sean P. DeNigris wrote
 horrido wrote
> it threw up a bunch of errors.
 Can you be more specific and did you try Mariano's suggestion about
 32-bit
 libs?
 
 
 
 -
 Cheers,
 Sean
 --
 Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
>>> 
>>> 
>>> 
>>> 
>>> --
>>> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
>>> 
> 
> 
> 
> 
> 
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
> 




Re: [Pharo-users] VPS difficulties

2018-11-22 Thread horrido
I'm running 64-bit Debian in a VirtualBox image on my Mac.

When I install 64-bit Pharo, it works fine. When I install 32-bit Pharo, I
get the error message below. What's the difference??? Why can one find the
display driver and the other can't? This makes no sense.

Earlier, people have been telling me to use './pharo-ui Pharo.image &'. Is
this no longer kosher? What am I doing wrong?



Fred Kaiser Borg wrote
> Those errors are not related to a 32 or 64 bits problem. The issue looks 
> like you've launched pharo-ui which looks for a physical screen that 
> isn't there. Are you trying to run pharo-ui in a debian VPS ?
> 
> You should run 'pharo' and 'pharo-ui', something like this:
> 
> $ pharo myApplication.image
> 
> Search on google for 'pharo headless', you should find plenty of example.
> 
> HTH,
> 
> Fred
> 
> On 22/11/2018 13:31, horrido wrote:
>> I ran 32-bit Pharo under 64-bit Debian and got this error:
>>
>> [1] 8127
>> richard@debian:~/pharo32$ could not find display driver vm-display-X11;
>> either:
>>- check that
>> /home/richard/pharo32/pharo-vm/lib/pharo/5.0-201806281256//vm-display-X11.so
>> exists, or
>>- use the '-plugins 
> 
> ' option to tell me where it is, or
>>- remove DISPLAY from your environment.
>> ./pharo-ui: line 11:  8131 Aborted
>> "$DIR"/"pharo-vm/pharo"
>> "$@"
>>
>> --
>>
>> I thought you could always run 32-bit software in a 64-bit OS, but I
>> guess
>> I'm wrong.
>>
>>
>>
>> Sean P. DeNigris wrote
>>> horrido wrote
 it threw up a bunch of errors.
>>> Can you be more specific and did you try Mariano's suggestion about
>>> 32-bit
>>> libs?
>>>
>>>
>>>
>>> -
>>> Cheers,
>>> Sean
>>> --
>>> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
>>
>>
>>
>>
>> --
>> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
>>





--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html



Re: [Pharo-users] MetaLink>>level: failing?

2018-11-22 Thread Vitor Medina Cruz
It works like a charm now!!! Thanks!

On Tue, Nov 13, 2018 at 11:23 AM Marcus Denker 
wrote:

> More progress… in the latest Pharo7 this is now working... (#operation
> reifies the original operation):
>
> | link choice |
>
> choice := true.
> link := MetaLink new metaObject: [ :operation |
>   UIManager default alert:
> 'Linked Version'.
>   choice ifTrue: [operation
> value ].
>];
> selector: #value:;
> arguments: #(#operation);
> control: #instead.
>
>
> (TestMetaLink >> #execute) ast link: link.
> TestMetaLink new execute.
> link uninstall.
>
> No need for using #level: as #operation for method execution is reifying
> the *original* method that would have been executed without the link.
>
> (this then is, too, what will be used to make finally “turning off”
> instead links work correctly: if the instead link is not active (due to a
> condition or level), it will
> instead execute “operation value”, that is, what would have been done
> without the #instead link present.
>
> Marcus
>
> On 7 Nov 2018, at 15:47, Marcus Denker  wrote:
>
> Hi,
>
> I added
>
>
> https://pharo.fogbugz.com/f/cases/22642/instead-links-and-meta-level-original-code-not-executed
>
> as a workaround, you can use a #before link with an explicit return:
>
>
> choice := true.
> link := MetaLink new metaObject: [ :object :selector :arguments :context |
>   UIManager default alert:
> 'Linked Version'.
>   choice ifTrue: [ context
> sender sender sender sender return: (object perform: selector
> withArguments: arguments)].
>];
> selector: #value:value:value:value:;
>  arguments: #(#object #selector #arguments #context);
>  control: #before;
>  level: 0.
>
> (TestMetaLink >> #execute) ast link: link.
> TestMetaLink new execute.
> link uninstall.
>
> (yes, the  context sender sender sender  shows that #context needs to do
> the right thing when using  level: 0. or not… another thing to fix)
>
> Marcus
>
> On 7 Nov 2018, at 15:08, Marcus Denker  wrote:
>
> Hello,
>
> I added a fist issue (and fix) for parts of the problem
>
>
> https://pharo.fogbugz.com/f/cases/22641/Semantic-analysis-needs-to-take-instead-preambles-into-account
> https://github.com/pharo-project/pharo/pull/1960
>
> But after this, it does not work as the level just turns off calling the
> meta level code, but does not execute the
> original code where the #instead is put.
> (#instead in general needs more work in this implementation).
>
> I will open another issue for that.
>
> Marcus
>
> On 31 Oct 2018, at 18:03, Vitor Medina Cruz  wrote:
>
> Thanks! Is there an issue on fogbuzz where I can be notified of
> resolution? Do you need me to create it?
>
> After that how can update the code? Software update is safe or should I
> create a new image?
>
> regards,
> Vitor
>
> On Mon, Oct 29, 2018 at 12:08 PM Marcus Denker 
> wrote:
>
>>
>>
>> On 25 Oct 2018, at 01:33, Vitor Medina Cruz  wrote:
>>
>> Hello,
>>
>> I am playing with MetaLink, really cool!, but I am having issues that I
>> am unsure if it's some erro or if I am doing something wrong (I am using
>> Pharo 6.1 32 bits in windows.). Consider:
>>
>> TestMetaLink>>execute
>> UIManager default alert: 'Actual Version'.
>>
>> And in Playground:
>>
>> | link |
>>
>> link := MetaLink new metaObject: [ :object | UIManager default alert:
>> 'Linked Version' ];
>> selector: #value:;
>>  arguments: #(#object);
>>  control: #instead.
>>
>>
>> (TestMetaLink >> #execute) ast link: link.
>> TestMetaLink new execute.
>> link uninstall.
>>
>> This works as expected, an alert with 'Linked Version' is promped. But
>> then suppose I want to execute the actual node alongside with the linked
>> one considering some condition:
>>
>> | link choice |
>>
>> choice := true.
>> link := MetaLink new metaObject: [ :object :selector :arguments |
>>   UIManager default alert:
>> 'Linked Version'.
>>   choice ifTrue: [ object
>> perform: selector withArguments: arguments].
>>];
>> selector: #value:value:value:;
>>  arguments: #(#object #selector #arguments);
>>  control: #instead;
>> * level: 0*.
>>
>>
>> (TestMetaLink >> #execute) ast link: link.
>> TestMetaLink new execute.
>> link uninstall.
>>
>> As I understand, level:0 is necessary in order to avoid an infinite loop,
>> but then I get an error:
>>
>> KeyNotFound: key #RFArgumentsReificationVar not found in Dictionary
>>
>> Am I doing something wrong? Is that an error?
>>
>> Hello,
>>
>> Yes, this 

Re: [Pharo-users] VPS difficulties

2018-11-22 Thread Fred Kaiser Borg
Those errors are not related to a 32 or 64 bits problem. The issue looks 
like you've launched pharo-ui which looks for a physical screen that 
isn't there. Are you trying to run pharo-ui in a debian VPS ?


You should run 'pharo' and 'pharo-ui', something like this:

$ pharo myApplication.image

Search on google for 'pharo headless', you should find plenty of example.

HTH,

Fred

On 22/11/2018 13:31, horrido wrote:

I ran 32-bit Pharo under 64-bit Debian and got this error:

[1] 8127
richard@debian:~/pharo32$ could not find display driver vm-display-X11;
either:
   - check that
/home/richard/pharo32/pharo-vm/lib/pharo/5.0-201806281256//vm-display-X11.so
exists, or
   - use the '-plugins ' option to tell me where it is, or
   - remove DISPLAY from your environment.
./pharo-ui: line 11:  8131 Aborted "$DIR"/"pharo-vm/pharo"
"$@"

--

I thought you could always run 32-bit software in a 64-bit OS, but I guess
I'm wrong.



Sean P. DeNigris wrote

horrido wrote

it threw up a bunch of errors.

Can you be more specific and did you try Mariano's suggestion about 32-bit
libs?



-
Cheers,
Sean
--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html





--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html





Re: [Pharo-users] VPS difficulties

2018-11-22 Thread Ben Coman
On Thu, 22 Nov 2018 at 20:27, horrido  wrote:

> I tried recompiling the SHA256 library without the '-m32' flag and 64-bit
>

Would the in-Image SHA256 be sufficient to start with?
Perhaps allow you to move forward while sorting out the main problem.

Another option could be libsodium
https://libsodium.gitbook.io/doc/password_hashing
https://libsodium.gitbook.io/doc/advanced/sha-2_hash_function
I used a different libsodium function here...

https://github.com/Traadh/bittrex/blob/master/src/Bittrex.package/BittrexLibsodium.class/class/crypto_auth_hmacsha512__out.in.inlen.k..st
Installation should simply be...
sudo apt-get install libsodium18

-

Pharo seg faulted:
>

The following might not be related.  Its fairly common to see if
limits.d/pharo.conf hasn't been set.


> pthread_setschedparam failed: Operation not permitted
> This VM uses a separate heartbeat thread to update its internal clock
> and handle events.  For best operation, this thread should run at a
> higher priority, however the VM was unable to change the priority.  The
> effect is that heavily loaded systems may experience some latency
> issues.  If this occurs, please create the appropriate configuration
> file in /etc/security/limits.d/ as shown below:
>
> cat < *  hardrtprio  2
> *  softrtprio  2
> END
>
> and report to the pharo mailing list whether this improves behaviour.
>


cheers -ben


Re: [Pharo-users] My Keynote at the Salta Conference

2018-11-22 Thread horrido
David Buck provided a revision on his proposal:

I agree with tossing the VM hack - it's not worth it.

An objective score is best and I would prefer not to score based on number
of classes, number of methods or method size.  The score should be simply
the highest total of captured cells in the game within a certain time period
(eg. 60 seconds).

Here's how I imagine this would work:  The game is run in several rounds. In
each round, we throw in a new aspect to the game (kill cells, teleports,
etc). For each round, we provide some sample boards for the students to test
their algorithms on their own computers.  At the end of the round, the
students submit their code to us.

We then take each submission run it on our computer with a new board that
the students haven't seen.  As we run the game, we capture the moves and the
score after each move.  We can then take the top 20 (or so) submissions and
create a video.  I would like to see the video look like an Olympic event -
every 10 seconds, show the current time versus the best score at that time. 
It would also be nice to have a running audio commentary for the video.  We
could then stream the video real-time for the teams to watch and we can make
the video available after the stream is finished for teams who may have
missed the live stream or wish to watch it again.

All of the rounds up to the final round are just "practice rounds" for
bragging rights.  The final round is what determines which team wins the
scholarship prizes.

If we do it well, we should be able to get media attention such as local or
national news.

--

Sounds good to me! No hacking the VM. It looks like it shouldn't be too
difficult to implement.




horrido wrote
> Thank you for your well-considered responses. I appreciate them.
> 
> As I said in the original post, I am open to an alternative approach to
> the
> competition. The current approach may be problematic, I don't know.
> 
> I still want a five-round four-person team event. I want to stretch this
> out
> for maximum effect. I want to structure it like a sporting event in order
> to
> raise excitement.
> 
> There are several key points:
> 
> 1) It has to sufficiently challenging to the contestants so that they
> really
> learn to use Pharo effectively. This should also help to mitigate
> cheating.
> After all, where are they going to find a sharp Smalltalker to aid in
> deception? ;-)
> 
> 2) It has to be easy to "judge" each round. This should be automatable.
> After all, if there are 500 teams, we don't want to spend countless hours
> judging the team submissions manually. It would be daunting.
> 
> At this point, I welcome any new ideas for the competition.
> 
> 
> 
> Pharo Smalltalk Users mailing list wrote
>> OK, sorry.  I missed that.
>> 
>> Now I've read it. And it requires a customized VM that can count
>> bytecodes
>> executed against a budget and terminate execution if the budget is
>> exceeded.
>> 
>> For the developer it requires an awareness of the relationship between
>> bytecodes and source code.  I, personally, have virtually no idea what
>> that relationship is.  I used Smalltalk as a high level language and try
>> not to worry about how expensive things are until it actually matters.  I
>> think that is most developers.
>> 
>> So I'm not really a fan of this contest approach.  The implementation is
>> certainly beyond my skills.  I have been dabbling with Squeak since its
>> release and only recently trying to get into Pharo "in anger" because I
>> have a couple projects I personally want to realize.  I'm finding the
>> entire thing to be really fast moving and hard to get my head around and
>> the VM is pretty much still impenetrable to me after a couple months
>> trying to build one.
>> 
>> So I'm definitely not your guy and the number of people who are on top of
>> the VM enough to pull this off is likely on the order of ten.
>> 
>> Maybe a different kind of coding contest?  I'd try adapting problems from
>> some existing competition questions.
>> 
>>> On Nov 20, 2018, at 6:32 PM, horrido 
> 
>> horrido.hobbies@
> 
>>  wrote:
>>> 
>>> Basically, implementing what was outlined in David Buck's document
>>> (attached
>>> to the original post). It may involve hacking the VM to count byte
>>> codes.
>>> 
>>> SmalltalkContestIdeas.docx
>>> http://forum.world.st/file/t128560/SmalltalkContestIdeas.docx
>>> http://forum.world.st/file/t128560/SmalltalkContestIdeas.docx;>  
>>> 
>>> 
>>> Pharo Smalltalk Users mailing list wrote
 OK, I'll bite.
 
 What does "code the competition" mean exactly?
 
 I last used Smalltalk "in anger" pre-pharo with squeak.  I live ST and
 am
 looking for a way back "in" but
 TBH the changes from Squeak are vast and I have too many ideas to work
 on
 and keep hitting walls.
 
 I'm intrigued but need more direction.  Whatcha need - ELI5.
 
 
 
> On Nov 20, 2018, at 5:13 PM, horrido 
>>> 
 horrido.hobbies@
>>> 
  

Re: [Pharo-users] VPS difficulties

2018-11-22 Thread horrido
I ran 32-bit Pharo under 64-bit Debian and got this error:

[1] 8127
richard@debian:~/pharo32$ could not find display driver vm-display-X11;
either:
  - check that
/home/richard/pharo32/pharo-vm/lib/pharo/5.0-201806281256//vm-display-X11.so
exists, or
  - use the '-plugins ' option to tell me where it is, or
  - remove DISPLAY from your environment.
./pharo-ui: line 11:  8131 Aborted "$DIR"/"pharo-vm/pharo"
"$@"

--

I thought you could always run 32-bit software in a 64-bit OS, but I guess
I'm wrong.



Sean P. DeNigris wrote
> horrido wrote
>> it threw up a bunch of errors.
> 
> Can you be more specific and did you try Mariano's suggestion about 32-bit
> libs?
> 
> 
> 
> -
> Cheers,
> Sean
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html





--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html



Re: [Pharo-users] VPS difficulties

2018-11-22 Thread horrido
I tried recompiling the SHA256 library without the '-m32' flag and 64-bit
Pharo seg faulted:

pthread_setschedparam failed: Operation not permitted
This VM uses a separate heartbeat thread to update its internal clock
and handle events.  For best operation, this thread should run at a
higher priority, however the VM was unable to change the priority.  The
effect is that heavily loaded systems may experience some latency
issues.  If this occurs, please create the appropriate configuration
file in /etc/security/limits.d/ as shown below:

cat 
He's got a 32 bit library that he wants to use, that won't work with a 64 
bit VM.
Of course, recompiling the library for 64 bit is an option, too, but 
probably more complicated.

Cheers,
Hans-Martin

Am 22. November 2018 9:21:47 vorm. schrieb Sven Van Caekenberghe 
sven@:

> Just use 64 bit Pharo 7 on a 64 bit Linux and be done with all this mess.
>
>> On 22 Nov 2018, at 01:39, horrido horrido.hobbies@ wrote:
>>
>> Using zeroconf, I installed 32-bit Pharo under 64-bit Debian. Pharo
>> refused
>> to run – it threw up a bunch of errors.
>>
>>
>>
>> Mariano Martinez Peck wrote
>>> Run Pharo 32 bits and install 32 bit libs...
>>>
>>> On Wed, Nov 21, 2018, 21:07 Richard Kenneth Eng 
>>
>>> horrido.hobbies@
>>
>>> 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.

 And this means I must run 32-bit Pharo under 32-bit Linux. Therein lies
 the rub...

 I would like to host the website at DigitalOcean or Linode or OVH. As
 far
 as I can tell, however, these services do not support 32-bit Linux,
 only
 64-bit.

 What can I do?

>>
>>
>>
>>
>>
>> --
>> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html





--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html



Re: [Pharo-users] VPS difficulties

2018-11-22 Thread Hans-Martin Mosner
He's got a 32 bit library that he wants to use, that won't work with a 64 
bit VM.
Of course, recompiling the library for 64 bit is an option, too, but 
probably more complicated.


Cheers,
Hans-Martin

Am 22. November 2018 9:21:47 vorm. schrieb Sven Van Caekenberghe 
:



Just use 64 bit Pharo 7 on a 64 bit Linux and be done with all this mess.


On 22 Nov 2018, at 01:39, horrido  wrote:

Using zeroconf, I installed 32-bit Pharo under 64-bit Debian. Pharo refused
to run – it threw up a bunch of errors.



Mariano Martinez Peck wrote

Run Pharo 32 bits and install 32 bit libs...

On Wed, Nov 21, 2018, 21:07 Richard Kenneth Eng 



horrido.hobbies@



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.

And this means I must run 32-bit Pharo under 32-bit Linux. Therein lies
the rub...

I would like to host the website at DigitalOcean or Linode or OVH. As far
as I can tell, however, these services do not support 32-bit Linux, only
64-bit.

What can I do?







--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html







Re: [Pharo-users] VPS difficulties

2018-11-22 Thread Tim Mackinnon
I think Sven is probably right - but my notes show a DO installation from 5 
months ago with:

curl https://get.pharo.org | bash
wget -O - 
http://download.opensuse.org/repositories/devel:/languages:/pharo:/stable/xUbuntu_16.04/Release.key
 | apt-key add - 
echo "deb 
http://download.opensuse.org/repositories/devel:/languages:/pharo:/stable/xUbuntu_16.04/
 ./" > /etc/apt/sources.list.d/pharo.list

apt install pharo6-32-ui pharo6-64-ui

mkdir -p /opt/pharo &&\
cd /opt/pharo &&\
curl https://get.pharo.org/61+vm | bash &&\
ln -s \
`/sbin/ldconfig -p | grep -v x86-64 | sed -e 's|[^/]*||' | grep 
sqlite3` \
`find . -type f -name SqueakSSL.so -print0 | xargs -0 
dirname`/sqlite3.so

cd /usr/local/bin && ln -s /opt/pharo/pharo && ln -s /opt/pharo/pharo-ui

pharo /opt/pharo/Pharo.image eval  "'Pharo {1}bit installed\' format: {32}"

./pharo Pharo.image printVersion

Sent from my iPhone

> On 22 Nov 2018, at 07:39, horrido  wrote:
> 
> Using zeroconf, I installed 32-bit Pharo under 64-bit Debian. Pharo refused
> to run – it threw up a bunch of errors.
> 
> 
> 
> Mariano Martinez Peck wrote
>> Run Pharo 32 bits and install 32 bit libs...
>> 
>> On Wed, Nov 21, 2018, 21:07 Richard Kenneth Eng 
> 
>> horrido.hobbies@
> 
>> 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.
>>> 
>>> And this means I must run 32-bit Pharo under 32-bit Linux. Therein lies
>>> the rub...
>>> 
>>> I would like to host the website at DigitalOcean or Linode or OVH. As far
>>> as I can tell, however, these services do not support 32-bit Linux, only
>>> 64-bit.
>>> 
>>> What can I do?
>>> 
> 
> 
> 
> 
> 
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
> 


Re: [Pharo-users] VPS difficulties

2018-11-22 Thread Sven Van Caekenberghe
Just use 64 bit Pharo 7 on a 64 bit Linux and be done with all this mess.

> On 22 Nov 2018, at 01:39, horrido  wrote:
> 
> Using zeroconf, I installed 32-bit Pharo under 64-bit Debian. Pharo refused
> to run – it threw up a bunch of errors.
> 
> 
> 
> Mariano Martinez Peck wrote
>> Run Pharo 32 bits and install 32 bit libs...
>> 
>> On Wed, Nov 21, 2018, 21:07 Richard Kenneth Eng 
> 
>> horrido.hobbies@
> 
>> 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.
>>> 
>>> And this means I must run 32-bit Pharo under 32-bit Linux. Therein lies
>>> the rub...
>>> 
>>> I would like to host the website at DigitalOcean or Linode or OVH. As far
>>> as I can tell, however, these services do not support 32-bit Linux, only
>>> 64-bit.
>>> 
>>> What can I do?
>>> 
> 
> 
> 
> 
> 
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html