Little how to

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

Little how to

stepharo
Hi guys

for the mooc I would like have a list of how to that students should
look in the system and implement.
The idea is to show to the participants that Pharo is open and that they
can find information.
For example,
         - extracting a sprite from a png file
         - access a time service of the web

Now I would love to get your ideas and their solution.

Stef



Reply | Threaded
Open this post in threaded view
|

Re: Little how to

Sven Van Caekenberghe-2

> On 03 Mar 2016, at 09:23, stepharo <[hidden email]> wrote:
>
> Hi guys
>
> for the mooc I would like have a list of how to that students should look in the system and implement.
> The idea is to show to the participants that Pharo is open and that they can find information.
> For example,
>        - extracting a sprite from a png file
>        - access a time service of the web

Time is soo simple that there is no real need for a true web service and such a service would be trivial anyway (yet I did not find any public/free ones).

Here is one way to do it:

| stream unixTime |
stream := nil.
[
        "RFC 868 TCP protocol https://en.wikipedia.org/wiki/Time_Protocol "
        stream := ZdcSocketStream openConnectionToHostNamed: 'time.nist.gov' port: 37.
        unixTime := (stream next: 4) asInteger ]
        ensure: [ stream ifNotNil: [ [ stream close ] on: Error do: [] ] ].
DateAndTime fromUnixTime: unixTime.


The real stuff is SNTP though

        http://en.wikipedia.org/wiki/Network_Time_Protocol
        http://tools.ietf.org/html/rfc2030

which is implemented in ZTimestamp and which can do much more:

  ZTimestampSNTPClient new remoteClock.

Sven

> Now I would love to get your ideas and their solution.
>
> Stef
>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: [Pharo-dev] Little how to

Damien Cassou-2
In reply to this post by stepharo
stepharo <[hidden email]> writes:

> Now I would love to get your ideas and their solution.

getting a photo from an email address through gravatar:

email := '[hidden email]'.
url := 'http://www.gravatar.com/avatar/', (MD5 hashMessage: email trimBoth asLowercase) hex, '.jpg'.
(ZnEasy getJpeg: url) asMorph openInHand

--
Damien Cassou
http://damiencassou.seasidehosting.st

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill

Reply | Threaded
Open this post in threaded view
|

Re: Little how to

abergel
In reply to this post by stepharo
These little how to may be included as an help in the image. 

Alexandre
-- 
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.



On Mar 3, 2016, at 5:23 AM, stepharo <[hidden email]> wrote:

Hi guys

for the mooc I would like have a list of how to that students should look in the system and implement.
The idea is to show to the participants that Pharo is open and that they can find information.
For example,
       - extracting a sprite from a png file
       - access a time service of the web

Now I would love to get your ideas and their solution.

Stef




Reply | Threaded
Open this post in threaded view
|

Re: Little how to

Tudor Girba-2
In reply to this post by stepharo
Hi,

I wrote a little post with a how to extract sprites from a larger png file:
http://www.humane-assessment.com/blog/extracting-sprite-from-png

Cheers,
Doru


> On Mar 3, 2016, at 9:23 AM, stepharo <[hidden email]> wrote:
>
> Hi guys
>
> for the mooc I would like have a list of how to that students should look in the system and implement.
> The idea is to show to the participants that Pharo is open and that they can find information.
> For example,
>        - extracting a sprite from a png file
>        - access a time service of the web
>
> Now I would love to get your ideas and their solution.
>
> Stef
>
>
>

--
www.tudorgirba.com
www.feenk.com

"Beauty is where we see it."





Reply | Threaded
Open this post in threaded view
|

Re: [Pharo-dev] Little how to

abergel
Excellent!

> On Mar 3, 2016, at 6:58 PM, Tudor Girba <[hidden email]> wrote:
>
> Hi,
>
> I wrote a little post with a how to extract sprites from a larger png file:
> http://www.humane-assessment.com/blog/extracting-sprite-from-png
>
> Cheers,
> Doru
>
>
>> On Mar 3, 2016, at 9:23 AM, stepharo <[hidden email]> wrote:
>>
>> Hi guys
>>
>> for the mooc I would like have a list of how to that students should look in the system and implement.
>> The idea is to show to the participants that Pharo is open and that they can find information.
>> For example,
>>       - extracting a sprite from a png file
>>       - access a time service of the web
>>
>> Now I would love to get your ideas and their solution.
>>
>> Stef
>>
>>
>>
>
> --
> www.tudorgirba.com
> www.feenk.com
>
> "Beauty is where we see it."
>
>
>
>
>

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.




Reply | Threaded
Open this post in threaded view
|

Re: Little how to

stepharo
In reply to this post by Sven Van Caekenberghe-2
Tx
This is a cool challenge


Le 3/3/16 13:08, Sven Van Caekenberghe a écrit :

>> On 03 Mar 2016, at 09:23, stepharo <[hidden email]> wrote:
>>
>> Hi guys
>>
>> for the mooc I would like have a list of how to that students should look in the system and implement.
>> The idea is to show to the participants that Pharo is open and that they can find information.
>> For example,
>>         - extracting a sprite from a png file
>>         - access a time service of the web
> Time is soo simple that there is no real need for a true web service and such a service would be trivial anyway (yet I did not find any public/free ones).
>
> Here is one way to do it:
>
> | stream unixTime |
> stream := nil.
> [
> "RFC 868 TCP protocol https://en.wikipedia.org/wiki/Time_Protocol "
> stream := ZdcSocketStream openConnectionToHostNamed: 'time.nist.gov' port: 37.
> unixTime := (stream next: 4) asInteger ]
> ensure: [ stream ifNotNil: [ [ stream close ] on: Error do: [] ] ].
> DateAndTime fromUnixTime: unixTime.
>
>
> The real stuff is SNTP though
>
> http://en.wikipedia.org/wiki/Network_Time_Protocol
> http://tools.ietf.org/html/rfc2030
>
> which is implemented in ZTimestamp and which can do much more:
>
>    ZTimestampSNTPClient new remoteClock.
>
> Sven
>
>> Now I would love to get your ideas and their solution.
>>
>> Stef
>>
>>
>>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: [Pharo-dev] Little how to

Offray Vladimir Luna Cárdenas-2
In reply to this post by Damien Cassou-2
Hi,

That little howtos are really nice! I'll include them in the grafoscopio
interactive notebook/tutorial... now Damien, how I delete your face of
my image? :-P (but... seriously.. how I delete that morph. Alt-click is
not working)

Cheers,

Offray

On 03/03/16 08:46, Damien Cassou wrote:
> stepharo <[hidden email]> writes:
>
>> Now I would love to get your ideas and their solution.
> getting a photo from an email address through gravatar:
>
> email := '[hidden email]'.
> url := 'http://www.gravatar.com/avatar/', (MD5 hashMessage: email trimBoth asLowercase) hex, '.jpg'.
> (ZnEasy getJpeg: url) asMorph openInHand
>


Reply | Threaded
Open this post in threaded view
|

Re: [Pharo-dev] Little how to

Ben Coman


On Wed, Mar 9, 2016 at 9:14 AM, Offray Vladimir Luna Cárdenas <[hidden email]> wrote:
Hi,

That little howtos are really nice! I'll include them in the grafoscopio interactive notebook/tutorial... now Damien, how I delete your face of my image? :-P (but... seriously.. how I delete that morph. Alt-click is not working)

Maybe browse "Morph allSubInstances"
then "self delete" on the one you want to delete.

cheers -ben
 

Cheers,

Offray


On 03/03/16 08:46, Damien Cassou wrote:
stepharo <[hidden email]> writes:

Now I would love to get your ideas and their solution.
getting a photo from an email address through gravatar:

email := '[hidden email]'.
url := 'http://www.gravatar.com/avatar/', (MD5 hashMessage: email trimBoth asLowercase) hex, '.jpg'.
(ZnEasy getJpeg: url) asMorph openInHand




Reply | Threaded
Open this post in threaded view
|

Re: Little how to

Stephan Eggermont-3
In reply to this post by stepharo
On 03/03/16 09:23, stepharo wrote:
> for the mooc I would like have a list of how to that students should
> look in the system and implement.
> The idea is to show to the participants that Pharo is open and that they
> can find information.

At #saner16 there was a talk about type hints in argument names in
Pharo. The longest they found was
aSelectorOrElementOrjQueryOrBooleanOrNumber.
Alexandre replied that that could have been one of his, so I checked in
  a Seaside image (jQuery is a good hint), it was
JQAccordion>active: aSelectorOrElementOrjQueryOrBooleanOrNumber
by Lukas. So what are the longest type hinting argument names Alexandre
uses? In Moose 6-1137?

|arguments|
arguments := Set new.
(CompiledMethod allInstances select: [ :each |
   each author = 'AlexandreBergel' ])
do: [ :m |
   arguments addAll: m argumentNames ].
arguments asOrderedCollection sort: [ :a :b | a size > b size ]

gives
numberOfMillisecondsToWaitBeforeRefresh
changePrimarySelectionSelector
aValueOrASymbolOrAOneArgBlock
...

Stephan



Reply | Threaded
Open this post in threaded view
|

Re: Little how to

Tudor Girba-2
Nice one!

Doru


> On Mar 16, 2016, at 11:36 PM, Stephan Eggermont <[hidden email]> wrote:
>
> On 03/03/16 09:23, stepharo wrote:
>> for the mooc I would like have a list of how to that students should
>> look in the system and implement.
>> The idea is to show to the participants that Pharo is open and that they
>> can find information.
>
> At #saner16 there was a talk about type hints in argument names in Pharo. The longest they found was aSelectorOrElementOrjQueryOrBooleanOrNumber.
> Alexandre replied that that could have been one of his, so I checked in  a Seaside image (jQuery is a good hint), it was
> JQAccordion>active: aSelectorOrElementOrjQueryOrBooleanOrNumber
> by Lukas. So what are the longest type hinting argument names Alexandre uses? In Moose 6-1137?
>
> |arguments|
> arguments := Set new.
> (CompiledMethod allInstances select: [ :each |
>  each author = 'AlexandreBergel' ])
> do: [ :m |
>  arguments addAll: m argumentNames ].
> arguments asOrderedCollection sort: [ :a :b | a size > b size ]
>
> gives
> numberOfMillisecondsToWaitBeforeRefresh
> changePrimarySelectionSelector
> aValueOrASymbolOrAOneArgBlock
> ...
>
> Stephan
>
>
>

--
www.tudorgirba.com
www.feenk.com

"Beauty is where we see it."





Reply | Threaded
Open this post in threaded view
|

Re: Little how to

abergel
In reply to this post by Stephan Eggermont-3
:-)

Alexandre


> On Mar 16, 2016, at 11:36 PM, Stephan Eggermont <[hidden email]> wrote:
>
> On 03/03/16 09:23, stepharo wrote:
>> for the mooc I would like have a list of how to that students should
>> look in the system and implement.
>> The idea is to show to the participants that Pharo is open and that they
>> can find information.
>
> At #saner16 there was a talk about type hints in argument names in Pharo. The longest they found was aSelectorOrElementOrjQueryOrBooleanOrNumber.
> Alexandre replied that that could have been one of his, so I checked in  a Seaside image (jQuery is a good hint), it was
> JQAccordion>active: aSelectorOrElementOrjQueryOrBooleanOrNumber
> by Lukas. So what are the longest type hinting argument names Alexandre uses? In Moose 6-1137?
>
> |arguments|
> arguments := Set new.
> (CompiledMethod allInstances select: [ :each |
>  each author = 'AlexandreBergel' ])
> do: [ :m |
>  arguments addAll: m argumentNames ].
> arguments asOrderedCollection sort: [ :a :b | a size > b size ]
>
> gives
> numberOfMillisecondsToWaitBeforeRefresh
> changePrimarySelectionSelector
> aValueOrASymbolOrAOneArgBlock
> ...
>
> Stephan
>
>
>

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.