Re: [Pharo-users] seaside javascript builders

2016-12-10 Thread Siemen Baader
Thanks, that was very helpful!

Siemen

Sent from my iPhone

On 09/12/2016, at 19.45, "p...@highoctane.be"  wrote:

> I guess that's where passengers: come handy.
> 
> Because what you pass can be the result of a jQuery.
> 
> TBH sometimes it is easier to do a JSStream on: 'some js code that does what 
> you want' instead of wondering for ages how to do the same with the 
> Javascript classes, subclasses and methods.
> 
> Look into the test packages for lots of examples. That helped me.
> 
> Phil
> 
> On Fri, Dec 9, 2016 at 2:20 PM, Siemen Baader  wrote:
>> Hi all,
>> 
>> I'm confused about the limitations and intended use of Seaside's javascript
>> builders. I can follow that we can do eg: "(html jQuery: 'div') remove" or
>> "html javascript alert: 'hello'" within the "renderContentOn: html" methods,
>> but how do I deal with logic and variables? How do I eg. install an event
>> listener and provide a browser-side function that extracts data from the
>> event and then passes it to the server via "html jQuery ajax"?
>> 
>> Is this something to be done in pure JS returned from the #script method?
>> 
>> Thanks for any enlightenment!
>> 
>> Siemen
>> 
>> 
>> 
>> --
>> View this message in context: 
>> http://forum.world.st/seaside-javascript-builders-tp4926336.html
>> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
> 


Re: [Pharo-users] Hash collision

2016-12-10 Thread Martin McClure

On 12/09/2016 09:45 AM, Ben Coman wrote:


The suggested fix depended on being willing to let go of byte ordering 
(which we might not want different results on different platforms)

Float>>hash
^ByteArray
   hashBytes: self
   startingWith: self species hash

This fix contains a good idea, but has at least two problems:
1) The check for integers is important, that's what makes sure that 1.0 
has the same hash as 1. Which it must, since they compare equal.
2) #hashBytes:startingWith: is designed to hash *bytes*. A BoxedFloat64 
is two *words*, which ensures that when you hashMultiply the high-order 
bits of each word get discarded.


I tried implementing a hash that actually uses the bytes of the float 
(code at bottom of this message). I didn't do any real analysis of it, 
but at least it gives different answers for 0.5 and -0.5. I think it 
matches the *intent* of the code above (though would still need the 
integer check, which I didn't bother with).




but anyway that doesn't actually help this case...
-0.5 hash "==>120484352"
0.5 hash "==>120484352"

I see Squeak5's float hash has changed...
 Float>>hash "Squeak5"
(self isFinite and: [self fractionPart = 0.0]) ifTrue: [^self 
truncated hash].

^ ((self basicAt: 1) bitShift: -4) +
  ((self basicAt: 2) bitShift: -4)

This is slightly better. It's only discarding eight bits out of 64, 
instead of discarding 32. But it would be better to mix all the bits 
into the hash.


Note that all of these hash implementations end up manipulating at least 
one large integer most of the time, since each word can be a large 
integer. It's possible that a primitive to copy a word object into the 
equivalent bytes might speed things up somewhat.


Regards,

-Martin


"Strictly experimental method on BoxedFloat64, could probably be made 
faster even without a primitive."


bytesHash
| bytes word1 word2 |
bytes := ByteArray new: 8.
word1 := self basicAt: 1.
word2 := self basicAt: 2.
bytes at: 1 put: (word1 bitShift: -24).
bytes at: 2 put: ((word1 bitShift: -16) bitAnd: 16rFF).
bytes at: 3 put: ((word1 bitShift: -8) bitAnd: 16rFF).
bytes at: 4 put: (word1  bitAnd: 16rFF).
bytes at: 5 put: (word2 bitShift: -24).
bytes at: 6 put: ((word2 bitShift: -16) bitAnd: 16rFF).
bytes at: 7 put: ((word2 bitShift: -8) bitAnd: 16rFF).
bytes at: 8 put: (word2  bitAnd: 16rFF).
^ ByteArray hashBytes: bytes startingWith: self class hash



[Pharo-users] Fuel fuelAfterMaterialization - wrong order?

2016-12-10 Thread Petr Fischer
Hello,

I have "Model" class, dictionary instance variable in it and in this 
dictionary, there is "Task" and "Meeting" classes (Meeting is subclass of Task).

I have problem with fuelAfterMaterialization order, if I log debug line in 
fuelAfterMaterialization, I got this fuelAfterMaterialization call order:

Task
Task
Task
...
Task
Model (!) - here? why? Model is root object
Meeting
Meeting
Meeting
and some other objects, collections etc.

Problem is, when I need to do some things with Tasks and Meetings in 
fuelAfterMaterialization of Model (eg. rebuild caches), I am excepting, that 
all fuelAfterMaterialization calls is done before on all Tasks and Meetings - 
because they are stored in instance var dictionary of Model.

Is it a bug? Thanks! Petr Fischer



Re: [Pharo-users] [Pharo-dev] Pharo poster

2016-12-10 Thread stepharong


**tx**
I added the two files to the media folder on file.pharo.org

On Sat, 10 Dec 2016 12:12:36 +0100, Cyril Ferlicot D.  
 wrote:



On 10/12/2016 12:08, stepharong wrote:

Hi

I'm brainstorming about a pharo poster and I remember that one person
produce a poster with all the pharo technologies.
I'm that I saved it somewhere but I do not know where. I tried to find
it with google but no chance for now.

Stef




Hi!

See join files:

http://forum.world.st/Pharo-family-update-td4857661.html




--
Using Opera's mail client: http://www.opera.com/mail/



Re: [Pharo-users] [Pharo-dev] Pharo poster

2016-12-10 Thread Cyril Ferlicot D.
On 10/12/2016 12:08, stepharong wrote:
> Hi
> 
> I'm brainstorming about a pharo poster and I remember that one person
> produce a poster with all the pharo technologies.
> I'm that I saved it somewhere but I do not know where. I tried to find
> it with google but no chance for now.
> 
> Stef
> 
> 

Hi!

See join files:

http://forum.world.st/Pharo-family-update-td4857661.html

-- 
Cyril Ferlicot

http://www.synectique.eu

2 rue Jacques Prévert 01,
59650 Villeneuve d'ascq France



signature.asc
Description: OpenPGP digital signature


[Pharo-users] Pharo poster

2016-12-10 Thread stepharong

Hi

I'm brainstorming about a pharo poster and I remember that one person  
produce a poster with all the pharo technologies.
I'm that I saved it somewhere but I do not know where. I tried to find it  
with google but no chance for now.


Stef


--
Using Opera's mail client: http://www.opera.com/mail/



Re: [Pharo-users] [Pharo-dev] consider putting stars on our nice books on github :)

2016-12-10 Thread stepharong

Thanks for the explanation

Stef

On Fri, 09 Dec 2016 18:54:26 +0100, Ben Coman  wrote:


Good idea.  Done.
Now just because I couldn't remember explicitly what "starring" meant,
from GitHub help...

Starring a repository allows you to keep track of projects that you
find interesting, even if you aren't associated with the project. When
you star a repository, you're actually performing two distinct
actions:

* Creating a bookmark for easier access
* Showing appreciation to the repository maintainer for their work

Many of GitHub's repository rankings depend on the number of stars a
repository has. For example,repositories can be sorted and searched
based on their star count. In addition, the Explore pageshows you
popular repositories based on the number of stars they have.

=Viewing your starred repositories=

You can see all the repositories that you have starred by going to
your stars page. For more information on interacting with your starred
repositories, see "Managing your stars."

=Notifications=

Notifications are not affected when a repository is starred. You won't
receive any information about a repository you've starred, unless
you're also watching the repository. Activity from starred
repositories don't show up in your dashboard feed, so you don't have
to worry about missing important notifications for things you are
working on.




--
Using Opera's mail client: http://www.opera.com/mail/



Re: [Pharo-users] setter method

2016-12-10 Thread stepharong




Hi everybody!

I've just joined the community:) and have a question
How to write the method count: such that, when invoked on an instance of  
Counter, instance variable is set to the argument given to the message?

so that
Counter new count: 7
would set the value of a new Counter instance to 7
(It is a little exercise from  
http://rmod-pharo-mooc.lille.inria.fr/MOOC/Exercises/Exo-Counter.pdf)


did you check the videos?
because this is shown

count: anInteger
   counter := anInteger





Best wishes,
Kateryna




--
Using Opera's mail client: http://www.opera.com/mail/