Kata for better code ? (sorry German)
|md5 url| md5 := MD5 new hashStream: (ReadStream on: 'gsa@arsol.net'). url := String streamContents: [:aStream| aStream
nextPutAll: 'http://www.gravatar.com/avatar/'.
md5 do:
[:aByte|
aStream nextPutAll: aByte hex asLowercase]].
(ImageMorph fromStream: (url asUrl retrieveContents contentStream)) openInWorld.
Laurent
I really like code that speaks for itself, like this example ! Great, Laurent.
It can even be written shorter, like this:
| md5 url | md5 := MD5 hashMessage: 'gsa@arsol.net'. url := ('http://www.gravatar.com/avatar/', md5 hex) asUrl. (ImageMorph fromStream: url retrieveContents contentStream) openInWorld.
Just sent to Gravatar, hope they will put it. Laurent
I was looking for such brevity, cool !
Laurent
Sven
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project