[Pharo-users] Pharo 3.0 Issue with instance variables

2016-09-22 Thread Pablo Frias
Hi all,

We are teaching Smalltalk at the Universtity of Cordoba, Argentina with
Pharo, but we are having the following issue.
Sometimes y in different workstations, we notice that when instantiating an
object and setting values using the accesors methods, the values are added
in the object, but in different instance variables.

For example:

|a|

a := MyPersonObject new.
a age: 35.
a name: 'Person name'.

But when using the object, we notice that 35 has been saved to name and the
string to age.

Is that a known issue? Unfortunately we haven't tested Pharo 5.0 yet, so I
cannot tell you if it is already fixed.

Our current image is: Pharo 3.0 on Windows.

Thanks in advance,
Pablo


Re: [Pharo-users] Pharo 3.0 Issue with instance variables

2016-09-22 Thread Nicolai Hess
2016-09-22 15:58 GMT+02:00 Pablo Frias :

> Hi all,
>
> We are teaching Smalltalk at the Universtity of Cordoba, Argentina with
> Pharo, but we are having the following issue.
> Sometimes y in different workstations, we notice that when instantiating
> an object and setting values using the accesors methods, the values are
> added in the object, but in different instance variables.
>
> For example:
>
> |a|
>
> a := MyPersonObject new.
> a age: 35.
> a name: 'Person name'.
>
> But when using the object, we notice that 35 has been saved to name and
> the string to age.
>
> Is that a known issue? Unfortunately we haven't tested Pharo 5.0 yet, so I
> cannot tell you if it is already fixed.
>
> Our current image is: Pharo 3.0 on Windows.
>
> Thanks in advance,
> Pablo
>

Hi Pablo,

I remember an issue with instance variable ordering. Applying some
refactorings from Nautilus, like generate accessor/rename remove or add
instance variables, will reorder (sort)
the instance variables!
This was fixed for 4.0

nicolai


Re: [Pharo-users] Pharo 3.0 Issue with instance variables

2016-09-22 Thread Ben Coman
On Thu, Sep 22, 2016 at 9:58 PM, Pablo Frias  wrote:
> Hi all,
>
> We are teaching Smalltalk at the Universtity of Cordoba, Argentina with
> Pharo, but we are having the following issue.
> Sometimes y in different workstations, we notice that when instantiating an
> object and setting values using the accesors methods, the values are added
> in the object, but in different instance variables.
>
> For example:
>
> |a|
>
> a := MyPersonObject new.
> a age: 35.
> a name: 'Person name'.
>
> But when using the object, we notice that 35 has been saved to name and the
> string to age.
>
> Is that a known issue? Unfortunately we haven't tested Pharo 5.0 yet, so I
> cannot tell you if it is already fixed.
>
> Our current image is: Pharo 3.0 on Windows.
>
> Thanks in advance,
> Pablo

Are they values really going into the wrong instance variables, or is
it just the display of them getting mixed up in the inspector?   What
does...  "a age"return?

Perhaps try a   "Smalltalk recompile"  and open a new Nautilus window

cheers -ben



Re: [Pharo-users] Using a Unix filedescriptor in a FileStream?

2016-09-22 Thread Holger Freyther

> On 21 Sep 2016, at 15:09, Mariano Martinez Peck  wrote:
> 
> 
> 
> Exactly. I have been wanting this a couple of times while doing OSSubprocess. 


https://github.com/pharo-project/pharo-vm/pull/108. Would be nice if you could 
review it and give it a try. It adds two primitive (one to work on fd one to 
work on FILE).

I probably also want to do:

sqFile->isStdioStream = isatty(fileno(file))


> Yes, exactly. I remember now. And as I said, I also wanted to be able to work 
> at fd or FILE* level and I failed. 

Could you give the above a try and then I try to get it into the Opensmalltalk 
VM.

holger




Re: [Pharo-users] Using a Unix filedescriptor in a FileStream?

2016-09-22 Thread Mariano Martinez Peck
On Thu, Sep 22, 2016 at 12:12 PM, Holger Freyther 
wrote:

>
> > On 21 Sep 2016, at 15:09, Mariano Martinez Peck 
> wrote:
> >
> >
> >
> > Exactly. I have been wanting this a couple of times while doing
> OSSubprocess.
>
>
> https://github.com/pharo-project/pharo-vm/pull/108. Would be nice if you
> could review it and give it a try. It adds two primitive (one to work on fd
> one to work on FILE).
>
> I probably also want to do:
>
> sqFile->isStdioStream = isatty(fileno(file))
>
>
> > Yes, exactly. I remember now. And as I said, I also wanted to be able to
> work at fd or FILE* level and I failed.
>
> Could you give the above a try and then I try to get it into the
> Opensmalltalk VM.
>

Hi Holger,

I just reviewed the PR and it looks really good. Please, allow me some time
to get updated to the VM compiling instructions and I will give it a try.
Probably, I will be testing it by doing my original (unused now)
#name:attachToCFile:writable:  use the new primitive and running the
OSSubprocess tests. Does this make sense to you?

Thanks a LOT for going deep and fix it!




-- 
Mariano
http://marianopeck.wordpress.com


[Pharo-users] Non-Pharo IDE in Pharo

2016-09-22 Thread Udo Schneider

All,

I'm currently working on an interpreter for a non-Smalltalk(ish) 
language in written Pharo. I'd like to put some nice tools on top of 
that (like browsers, inspectors, debugger) but I'm not sure where to begin.


Is there some "Meta-IDE" stuff somewhere which allows me to simply 
plugin into or is it reinventing the wheel?


CU,

Udo




Re: [Pharo-users] Non-Pharo IDE in Pharo

2016-09-22 Thread Alexandre Bergel
Glamour is a framework to create browser. You may want to have a look at that.

Alexandre


> On Sep 22, 2016, at 1:35 PM, Udo Schneider  
> wrote:
> 
> All,
> 
> I'm currently working on an interpreter for a non-Smalltalk(ish) language in 
> written Pharo. I'd like to put some nice tools on top of that (like browsers, 
> inspectors, debugger) but I'm not sure where to begin.
> 
> Is there some "Meta-IDE" stuff somewhere which allows me to simply plugin 
> into or is it reinventing the wheel?
> 
> CU,
> 
> Udo
> 
> 




Re: [Pharo-users] Non-Pharo IDE in Pharo

2016-09-22 Thread Udo Schneider

> Glamour is a framework to create browser. You may want to have a
> look at that.
Stupid me ... totally forgot Glamour. So Browsers is "solved".

Maybe a simple Transcript-like REPL and some GT-Inspector views might be 
enough. Still struggling with the debugger though ...


Thanks,

Udo



On 22/09/16 18:50, Alexandre Bergel wrote:

Glamour is a framework to create browser. You may want to have a look at that.

Alexandre



On Sep 22, 2016, at 1:35 PM, Udo Schneider  wrote:

All,

I'm currently working on an interpreter for a non-Smalltalk(ish) language in 
written Pharo. I'd like to put some nice tools on top of that (like browsers, 
inspectors, debugger) but I'm not sure where to begin.

Is there some "Meta-IDE" stuff somewhere which allows me to simply plugin into 
or is it reinventing the wheel?

CU,

Udo












Re: [Pharo-users] Pharo 3.0 Issue with instance variables

2016-09-22 Thread stepharo

Hi Pablo

This is great to know that Cordoba is teaching OOP in Pharo. Let us know 
how we can help you.


Why don't you move to Pharo 50 because we fixed a lot of issues in 3 years.

And the mooc

http://mooc.pharo.org (which has been evaluated to be worth 180 000 
Euros - yes three salaries for some months and professional videos 
processing and translation) is based on Pharo 50.


So you get 30 live videos for free.

Not counting all the lectures.

Stef


Le 22/9/16 à 16:58, Pablo Frias a écrit :

Hi all,

We are teaching Smalltalk at the Universtity of Cordoba, Argentina 
with Pharo, but we are having the following issue.
Sometimes y in different workstations, we notice that when 
instantiating an object and setting values using the accesors methods, 
the values are added in the object, but in different instance variables.


For example:

|a|

a := MyPersonObject new.
a age: 35.
a name: 'Person name'.

But when using the object, we notice that 35 has been saved to name 
and the string to age.


Is that a known issue? Unfortunately we haven't tested Pharo 5.0 yet, 
so I cannot tell you if it is already fixed.


Our current image is: Pharo 3.0 on Windows.

Thanks in advance,
Pablo





Re: [Pharo-users] Sharing Seaside URLs between users (security) + what is actual way for session expiration page

2016-09-22 Thread stepharo

Mariano


It would be cool.

Why don't you paste it on your blog?

I hope to get back to the seaside book one of these days and I would 
like to add such tips and tricks



Stef


Le 21/9/16 à 18:00, Mariano Martinez Peck a écrit :



On Wed, Sep 21, 2016 at 11:50 AM, Johan Brichau > wrote:



> On 21 Sep 2016, at 12:31, Petr Fischer mailto:petr.fisc...@me.com>> wrote:
>
> Hello, two questions about Seaside sessions:
>
> 1) URL sharing between different users - what if "boss" shares
URL from his browser and send it to another regular user - of
course, easy way, whole URL with session (_s=) - when
another/regular user opens that link -> whole "boss" session opens
in regular user's browser, with all "boss" permissions, UI state
etc etc - very bad, is there any solution for this? Rewrite every
(!) URL with updateURL: is not solution :(

If this is a concern, you can use a cookie for session tracking,
but that means you cannot have multiple Seaside sessions running
in the same browser at the same time.

There are probably other ways, but I think the solution is not to
rely on a session key for authentication.
Here’s a strategy:
Keep the Seaside session key in the url for session tracking but
use an authorization cookie for authorization. Put that cookie
when the user logs in and check its presence when requests come in
for a session.
I think that using a filter for that is a good choice.

Whenever another user copy/pastes the url, he cannot ‘hijack’ the
session because he lacks the correct authentication cookie.


That's exactly what I did in my case. And the way to implement that 
was with a custom session tracker that dealt with the cookie plus a 
filter for the checking and kickout.


I can share this if someone wants it (I think I already shared it before)

> 2) What is the actual way for "session expiration/login page"?
There is few tutorials and books on the inet - but info about
session expiration is obsolete :( Methods from tutorials not
exists in Seaside 3.2.0.
> Some trick with WAApplication subclass is actual?

I’m not sure what the question is. Do you want to redirect users
to a page whenever the session is expired?

cheers
Johan




--
Mariano
http://marianopeck.wordpress.com




Re: [Pharo-users] Sharing Seaside URLs between users (security) + what is actual way for session expiration page

2016-09-22 Thread Mariano Martinez Peck
OK, "TooMuchPressureExpcetion signal".

I will do it. There is another open-source-task related to OSSubprocess
that I must address first. Then will come to this one.
Probably I can also put the code in github.

Will let you know when ready.

Cheers,

On Thu, Sep 22, 2016 at 2:53 PM, stepharo  wrote:

> Mariano
>
>
> It would be cool.
>
> Why don't you paste it on your blog?
>
> I hope to get back to the seaside book one of these days and I would like
> to add such tips and tricks
>
>
> Stef
>
> Le 21/9/16 à 18:00, Mariano Martinez Peck a écrit :
>
>
>
> On Wed, Sep 21, 2016 at 11:50 AM, Johan Brichau 
> wrote:
>
>>
>> > On 21 Sep 2016, at 12:31, Petr Fischer  wrote:
>> >
>> > Hello, two questions about Seaside sessions:
>> >
>> > 1) URL sharing between different users - what if "boss" shares URL from
>> his browser and send it to another regular user - of course, easy way,
>> whole URL with session (_s=) - when another/regular user opens that
>> link -> whole "boss" session opens in regular user's browser, with all
>> "boss" permissions, UI state etc etc - very bad, is there any solution for
>> this? Rewrite every (!) URL with updateURL: is not solution :(
>>
>> If this is a concern, you can use a cookie for session tracking, but that
>> means you cannot have multiple Seaside sessions running in the same browser
>> at the same time.
>>
>> There are probably other ways, but I think the solution is not to rely on
>> a session key for authentication.
>> Here’s a strategy:
>> Keep the Seaside session key in the url for session tracking but use an
>> authorization cookie for authorization. Put that cookie when the user logs
>> in and check its presence when requests come in for a session.
>> I think that using a filter for that is a good choice.
>>
>> Whenever another user copy/pastes the url, he cannot ‘hijack’ the session
>> because he lacks the correct authentication cookie.
>>
>>
> That's exactly what I did in my case. And the way to implement that was
> with a custom session tracker that dealt with the cookie plus a filter for
> the checking and kickout.
>
> I can share this if someone wants it (I think I already shared it before)
>
>
>
>> > 2) What is the actual way for "session expiration/login page"? There is
>> few tutorials and books on the inet - but info about session expiration is
>> obsolete :( Methods from tutorials not exists in Seaside 3.2.0.
>> > Some trick with WAApplication subclass is actual?
>>
>> I’m not sure what the question is. Do you want to redirect users to a
>> page whenever the session is expired?
>>
>> cheers
>> Johan
>>
>
>
>
> --
> Mariano
> http://marianopeck.wordpress.com
>
>
>


-- 
Mariano
http://marianopeck.wordpress.com


[Pharo-users] Spec: Class pop list code completion

2016-09-22 Thread Brad Selfridge
Is there a way in Spec to pop a list widget that contains class names when
entering a partial class name in a test field, (like GTPlayground does)?   

p.s. I do not want to go down the Glamour route. 



-
Brad Selfridge
--
View this message in context: 
http://forum.world.st/Spec-Class-pop-list-code-completion-tp4916672.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.



Re: [Pharo-users] Spec: Class pop list code completion

2016-09-22 Thread Johan Fabry
Hi Brad,

AFAIK there is nothing prebuilt, you will have to roll your own.

--
Does this mail seem too brief? Sorry for that, I don’t mean to be rude! Please 
see http://emailcharter.org .

Johan Fabry   -   http://pleiad.cl/~jfabry
PLEIAD and RyCh labs  -  Computer Science Department (DCC)  -  University of 
Chile

> On Sep 22, 2016, at 16:04, Brad Selfridge  wrote:
> 
> Is there a way in Spec to pop a list widget that contains class names when
> entering a partial class name in a test field, (like GTPlayground does)?   
> 
> p.s. I do not want to go down the Glamour route. 
> 
> 
> 
> -
> Brad Selfridge
> --
> View this message in context: 
> http://forum.world.st/Spec-Class-pop-list-code-completion-tp4916672.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
> 
> 




[Pharo-users] strange cache behaviour for DSAdaptiveModel magritte description

2016-09-22 Thread Yanni Chiu
Does any one have any insight into the caching of magritte descriptions
for DSAdaptiveModel?

What I see is that there seem to be multiple copies of the description
elements. A problem appears when a MACachedMemento seems to have a
different description instance (a different hash value anyway), but the
rest of the values seem to be the same as the other copy.


Re: [Pharo-users] Using a Unix filedescriptor in a FileStream?

2016-09-22 Thread Mariano Martinez Peck
Hi Holger,

OK, I made a new VM with your PR after I reviewed it. Good news? It
works!!!  If you want to check OSSubprocess, I am using now the
primCreatePipe from OSProcess because that would answer me directly the
SQFiles of the pipe. Originally (before ending up doing that), I was trying
to make the pipes myself via FFI ( pipe() ) but I came to the problem we
discussed earlier (remember the #name:attachTo:writable:).

So now I can go back to my original solution. The code is in #
*makePipeWithReadBlocking*: and now it looks like this:

| pipePointer returnValue fileDescriptors pipe fileIDsArray fileDescriptor1
fileDescriptor2 |
pipePointer := ExternalAddress allocate: 8.
[
returnValue := self primitivePipe: pipePointer.
(returnValue = -1) ifTrue: [ self perror: 'pipe()' ].
fileIDsArray := Array new: 2.
fileDescriptor1 := pipePointer nbUInt32AtOffset: 0.
fileDescriptor2 := pipePointer nbUInt32AtOffset: 4.
fileIDsArray at: 1 put: *(self primitiveFileOpenUseFileDescriptor:
fileDescriptor1 writeFlag: false)*.
fileIDsArray at: 2 put: *(self primitiveFileOpenUseFileDescriptor:
fileDescriptor2 writeFlag: true).*
pipe := OSSPipe newWith: fileIDsArray readBlocking: aBoolean.
] ensure:[
pipePointer free.
].
^ pipe


I just run all OSSubprocess tests and they all worked! (tested in Pharo
5.0).

I guess I will commit this on the dev branch and hopefully when this is
integrated into the VM I can merge that for my next OSSubprocess release.

Thank you very much Holger




On Thu, Sep 22, 2016 at 12:35 PM, Mariano Martinez Peck <
marianop...@gmail.com> wrote:

>
>
> On Thu, Sep 22, 2016 at 12:12 PM, Holger Freyther 
> wrote:
>
>>
>> > On 21 Sep 2016, at 15:09, Mariano Martinez Peck 
>> wrote:
>> >
>> >
>> >
>> > Exactly. I have been wanting this a couple of times while doing
>> OSSubprocess.
>>
>>
>> https://github.com/pharo-project/pharo-vm/pull/108. Would be nice if you
>> could review it and give it a try. It adds two primitive (one to work on fd
>> one to work on FILE).
>>
>> I probably also want to do:
>>
>> sqFile->isStdioStream = isatty(fileno(file))
>>
>>
>> > Yes, exactly. I remember now. And as I said, I also wanted to be able
>> to work at fd or FILE* level and I failed.
>>
>> Could you give the above a try and then I try to get it into the
>> Opensmalltalk VM.
>>
>
> Hi Holger,
>
> I just reviewed the PR and it looks really good. Please, allow me some
> time to get updated to the VM compiling instructions and I will give it a
> try. Probably, I will be testing it by doing my original (unused now)
> #name:attachToCFile:writable:  use the new primitive and running the
> OSSubprocess tests. Does this make sense to you?
>
> Thanks a LOT for going deep and fix it!
>
>
>
>
> --
> Mariano
> http://marianopeck.wordpress.com
>



-- 
Mariano
http://marianopeck.wordpress.com

On Thu, Sep 22, 2016 at 12:35 PM, Mariano Martinez Peck <
marianop...@gmail.com> wrote:

>
>
> On Thu, Sep 22, 2016 at 12:12 PM, Holger Freyther 
> wrote:
>
>>
>> > On 21 Sep 2016, at 15:09, Mariano Martinez Peck 
>> wrote:
>> >
>> >
>> >
>> > Exactly. I have been wanting this a couple of times while doing
>> OSSubprocess.
>>
>>
>> https://github.com/pharo-project/pharo-vm/pull/108. Would be nice if you
>> could review it and give it a try. It adds two primitive (one to work on fd
>> one to work on FILE).
>>
>> I probably also want to do:
>>
>> sqFile->isStdioStream = isatty(fileno(file))
>>
>>
>> > Yes, exactly. I remember now. And as I said, I also wanted to be able
>> to work at fd or FILE* level and I failed.
>>
>> Could you give the above a try and then I try to get it into the
>> Opensmalltalk VM.
>>
>
> Hi Holger,
>
> I just reviewed the PR and it looks really good. Please, allow me some
> time to get updated to the VM compiling instructions and I will give it a
> try. Probably, I will be testing it by doing my original (unused now)
> #name:attachToCFile:writable:  use the new primitive and running the
> OSSubprocess tests. Does this make sense to you?
>
> Thanks a LOT for going deep and fix it!
>
>
>
>
> --
> Mariano
> http://marianopeck.wordpress.com
>



-- 
Mariano
http://marianopeck.wordpress.com


Re: [Pharo-users] Using a Unix filedescriptor in a FileStream?

2016-09-22 Thread Holger Freyther

> On 22 Sep 2016, at 23:33, Mariano Martinez Peck  wrote:
> 
> Hi Holger,

Hey!

> 
> I just run all OSSubprocess tests and they all worked! (tested in Pharo 5.0). 
> 
> I guess I will commit this on the dev branch and hopefully when this is 
> integrated into the VM I can merge that for my next OSSubprocess release.

cool and thank you for trying it so quickly. I thought it make sense to mark 
non files the same as isStdioStream but that triggers a funny case:

do {
clearerr(file);
if (fread(dst, 1, 1, file) == 1) {
bytesRead += 1;
if (dst[bytesRead-1] == '\n'
 || dst[bytesRead-1] == '\r')
break;
}
} while (bytesRead <= 0 && ferror(file) && errno == EINTR);

which means 0 or 1 char is read with >>#primRead:into:startingAt:count: and in 
case of inotify the event is lost (partially read and the rest discarded). I 
will have to start a discussion why primRead should be line buffered at all.

Anyway. My good news is that:

"an INotify"
| arr fileID |
self init: 8r4000.
self prim_add_watch: '/tmp' flags: 16r0100.
arr := ByteArray new: 4096.
fileID := StandardFileStream new primFdOpen: fd writable: false.
StandardFileStream new
primRead: fileID into: arr startingAt: 1 count: 4096.
arr

has read a file notification event.. :)


Re: [Pharo-users] Using a Unix filedescriptor in a FileStream?

2016-09-22 Thread Ronie Salgado
Hi Holger,

Sorry for not noticing this thread before. Some months ago, I did some
experiments myself using inotify and epoll, with the UFFI. I was creating a
file system monitoring API similar in design to OSWindow. I just did some
minor changes for making this usable along with making a configure script.
I left all of the code and some scripts for loading the FileSystemMonitor
API at: http://smalltalkhub.com/#!/~ronsaldo/OSCalls .

For testing the monitoring API, try the following in a playground:

monitor := FileSystemMonitor for: '.' do: [ :event |
Transcript show: event; cr.
].

If you do this, open a Transcript and you start browsing some methods in
Nautilus, you will start receiving some events where Pharo is accessing the
.changes file. For the destroying the monitor and stop receiving the
events, you can do the following:

monitor destroy.

Currently the events given by this API are only holding a copy of the raw
inotify event in rawEvent and a copy of the raw path in rawPath. Further
work is required for translating the events into a more platform
independent interface, and for supporting OS X and Windows with this API.
However, this is already something that could be useful to you.

Best regards,
Ronie

2016-09-20 15:26 GMT-03:00 Holger Freyther :

> Hi,
>
> I explored to use the Linux inotify API using UFFI. The
> inotify_init/inotify_init1 routine will me a Unix filedescriptor and I
> would like to
>
> a.) monitor it for being readable
> b.) read from it with a stream
>
>
> For a.) I have found the AioEventHandler and think I will be able to call
> >>#descriptor: directly and then can use it (still figuring out the API,
> probably just wait for the >>#changed: call).
>
> For b.) I thought I could use AttachableFileStream but that required a
> "fileId" but not a filedescriptor. Is there a way I can read from my fd
> using the standard stream API (otherwise I can try to use UFFI for read)
>
>
> regards
> holger
>