Resources with Monticello

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

Resources with Monticello

Matthias Korn-4
Hi all,

how does one work with resources (e.g. image files (GIFs, ...)) used
in the application when working with Monticello and in general?

Right now I have them on my hard drive and they are read live into
Squeak when they are needed. Of course, others don't have the
files at hand when working in a distributed fashion.

What are the best practices in regard of distribution/packaging as well
as performance?

Thanks,
Matthias

--
Matthias Korn
Institut für Wirtschaftsinformatik
Fachbereich 5
Universität Siegen
Telefon: +49 (0) 271 / 23 67 660
Mobil: +49 (0) 176 / 700 17 17 8
Uni: +49 (0) 271/ 740 - 3382
eMail: [hidden email]
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Resources with Monticello

Janko Mivšek
Hi Matthias,

Matthias Korn wrote:

> how does one work with resources (e.g. image files (GIFs, ...)) used
> in the application when working with Monticello and in general?
>
> Right now I have them on my hard drive and they are read live into
> Squeak when they are needed. Of course, others don't have the
> files at hand when working in a distributed fashion.
>
> What are the best practices in regard of distribution/packaging as well
> as performance?

Due to lack of decent resource management in all Smalltalks we usually
put such resources directly into methods, usually as literal array. In
Aida/Web we have so called method resources and method images, in
Seaside there is a FileLibrary.

Best regards
Janko

--
Janko Mivšek
AIDA/Web
Smalltalk Web Application Server
http://www.aidaweb.si
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Resources with Monticello

Sean P. DeNigris
Administrator
Janko Mivšek wrote
> how does one work with resources (e.g. image files (GIFs, ...)) used
> in the application when working with Monticello and in general?

Due to lack of decent resource management in all Smalltalks we usually
put such resources directly into methods, usually as literal array. In
Aida/Web we have so called method resources and method images, in
Seaside there is a FileLibrary.
I found this post from a while back.  Is this still accurate?  If so, what does it mean i.e. how do you put a jpeg/bmp/whatever into a method?  And how to you change it back to a jpeg/bmp again?

Thanks,
Sean
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Resources with Monticello

Janko Mivšek
Hi Sean,

On 09. 04. 2010 23:03, Sean P. DeNigris wrote:

>>> how does one work with resources (e.g. image files (GIFs, ...)) used
>>> in the application when working with Monticello and in general?

>> Due to lack of decent resource management in all Smalltalks we usually
>> put such resources directly into methods, usually as literal array. In
>> Aida/Web we have so called method resources and method images, in
>> Seaside there is a FileLibrary.

> I found this post from a while back.  Is this still accurate?  If so, what
> does it mean i.e. how do you put a jpeg/bmp/whatever into a method?  And how
> to you change it back to a jpeg/bmp again?

Pretty easy. We have a tool method which reads a file and converts it
into such a method. Such method just returns a file content as byte
literal array. Concrete instance from DefaultWebStyle in Aida:

buttonCloseGif
  " '/home/mivsek/vw7.2/image/imgs/yuiForum/tab-close.gif' asFilename
       contentsAsMethod"
^#(71 73 70 56 57 97 13 0 13 0 135 0 0 77 87 90 115 116 115 64 255 64
133 143 143 138 145 144 175 181 179 158 190 245 192 218 249 198 221 250
204 225 250 211 229 251 217 232 252 223 236 252 228 230 224 230 240 253
236 244 253 242 247 254 249 251 254 0 0)

Hope this helps
Janko


--
Janko Mivšek
AIDA/Web
Smalltalk Web Application Server
http://www.aidaweb.si
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Resources with Monticello

Sean P. DeNigris
Administrator
Janko Mivšek wrote
Pretty easy. We have a tool method which reads a file and converts it
into such a method. Such method just returns a file content as byte
literal array. Concrete instance from DefaultWebStyle in Aida:
Thanks for the reply.  I was actually asking about using Monticello in Squeak in general (outside Aida/Seaside), where the method you suggested doesn't exist (didn't come up in the message name browser).

I'm sure this must be a common goal: how do package developers, who use Monticello, distribute non-code things, like files (such as image files) with their packages?

Sean
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Resources with Monticello

Bert Freudenberg
On 14.04.2010, at 17:41, Sean P. DeNigris wrote:
>
>
> I'm sure this must be a common goal: how do package developers, who use
> Monticello, distribute non-code things, like files (such as image files)
> with their packages?

Typically, they don't. Usually packages only have code. Small things (like icons) are converted to source code. Larger media files do not normally occur in shared packages, only in app development. For apps, media files are distributed separately.

However, *if* you wanted to include arbitrary files with your code package, SAR files would be the #1 choice:

        http://wiki.squeak.org/squeak/3324


- Bert -


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Resources with Monticello

Sean P. DeNigris
Administrator
Bert Freudenberg wrote
Typically, they don't. Usually packages only have code. Small things (like icons) are converted to source code.
I think that's where I'll start, but I'm not quite there.  This is what I did so far, cobbling together things from old posts:

stream := ReadWriteStream on: (String new).
form storeOn: stream.

Is this the right direction and how do I reconstitute it?  The only stream-related fromXxx method in Form was fromBinaryStream, which gave an 'image format not recognized' error.

Bert Freudenberg wrote
For apps, media files are distributed separately.
What is the standard procedure for this - SAR files?

Thanks.
Sean
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Resources with Monticello

Bert Freudenberg
On 14.04.2010, at 19:20, Sean P. DeNigris wrote:

>
>
>
> Bert Freudenberg wrote:
>>
>> Typically, they don't. Usually packages only have code. Small things (like
>> icons) are converted to source code.
>>
> I think that's where I'll start, but I'm not quite there.  This is what I
> did so far, cobbling together things from old posts:
>
> stream := ReadWriteStream on: (String new).
> form storeOn: stream.
>
> Is this the right direction and how do I reconstitute it?

Any object that you serialized this way can be read back with #readFrom:.

The simpler invocation for this #storeString:

s := Form fromUser storeString. "store"
f := Form readFrom: s. "read"

>  The only
> stream-related fromXxx method in Form was fromBinaryStream, which gave an
> 'image format not recognized' error.

There are more space-efficient ways of course, e.g. you could store a GIF image base64 encoded.

> Bert Freudenberg wrote:
>>
>> For apps, media files are distributed separately.
>>
> What is the standard procedure for this - SAR files?

No. Application as in "Mac application" or "Windows application" or "Linux application". These just bundle a couple of files in whatever is suitable for the deployment platform - a VM, an image, and whatever other files are necessary.

Typically you just have a directory of files on your development system, managed by subversion.

- Bert -


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Resources with Monticello

Sean P. DeNigris
Administrator
Thanks.  That's exactly what I wanted to know.

Sean DeNigris
[hidden email]
Cheers,
Sean