> > > Kata for better code ? (sorry German) >> > >> > |md5 url| >> > md5 := MD5 new hashStream: (ReadStream on: '[email protected]'). >> > 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: '[email protected]'. >> 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 >> [email protected] >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project >> > >
_______________________________________________ Pharo-project mailing list [email protected] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
