Re: Words of wisdom on moving from the Picture Library to external PNG files

classic Classic list List threaded Threaded
16 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: Words of wisdom on moving from the Picture Library to external PNG files

info-2
welcome to current times

one caveat concerning the resources-folder: put everything into subfolders and keep the count of subfolders low. I was told, 4D will compress folders and then send the compressed folders and all files in resources-folder, when in C/S. Folders and nearly no files will speed up sending resources to the client.

another caveat, true for Windows-user: much to many only copy the *.4db file when updating and missing the resources-folder. This is true for longterm 4D- and Mac-users too, as long as they didn't attach .4dbase to the main database-folder.

install the 4D Pop-suite


Regards
O r t w i n  Z i l l g e n
---------------------------------------------
<mailto:[hidden email]>   <http://dddd.mettre.de?4713>
<feed://dddd.mettre.de/dddd.xml> <https://twitter.com/Ozett>
member of developer-network <http://www.die4dwerkstatt.de>


**********************************************************************
4D v13 is available now - with more than 200 new features to make
your applications richer and faster
http://www.4d.com/products/new.html

4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: Words of wisdom on moving from the Picture Library to external PNG files

David Adams-4
>> one caveat concerning the resources-folder: put everything into
subfolders and
>> keep the count of subfolders low. I was told, 4D will compress folders
and
>> then send the compressed folders and all files in resources-folder, when
in
>> C/S. Folders and nearly no files will speed up sending resources to the
>> client.

Hmmm. I'm not sure how to take this. Is there something unreliable about
the file transfer mechanism? I'd hoped those bugs were ironed out years
ago. Or do you take this as general advice not to put too many MB into the
download sequence as users need to sit through it? What would "low" mean in
the case above. I'm imagining a hundred folders or more with 1-n files:

/Resources/Icons/Table/Table_Name/Accounts.png
/Resources/Icons/Table/Table_Name/Accounts_Small.png

...and so on.

If 4D can't be counted on to sync the files properly, then this is a
non-starter.

If the system is reliable and it's just a matter of "optimizatation" for
speed, I'm not worried. My total load of images is under 2MB and won't
change much, after the conversion.

>> another caveat, true for Windows-user: much to many only copy the *.4db
file
>> when updating and missing the resources-folder. This is true for
longterm 4D-
>> and Mac-users too, as long as they didn't attach .4dbase to the main
>> database-folder.

I don't understand this. Can you explain?

>> install the 4D Pop-suite
Okay, I'll bite. What do you have in mind to help out here?

For my conversion process, I'm figuring on pulling each library picture
into a table where I can assign a target relative path and then push
everything out when I'm ready. In many cases, I can calculate the correct
(for me) relative path based on other code. (Images are already tied to
tables, where appropriate, by ID.)

Thanks for the answer!

**********************************************************************
4D v13 is available now - with more than 200 new features to make
your applications richer and faster
http://www.4d.com/products/new.html

4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: Words of wisdom on moving from the Picture Library to external PNG files

David Adams-4
>> What are you talking about when you refer to "multiple displays"? Are you
>> talking about "ref counting" for pictures?

Yes, that's what I meant...I just didn't say it clearly at all.

>> How about if you put all your pictures in the Resources folder, all those
>> picture files must be sent to the client during the "duplicating
resources
>> locally" phase of 4D Client.  Say you have 50MB of pictures in your
Resources
>> folder. They all get transferred to the client at startup whether the
client
>> needs them or not. Could be a little performance hit for that initial
transfer
>> over a WAN.

Makes sense. My pictures total less than 2MB. For comparison, 4DIC is
nearly 5MB.

>> I'm curious why storing pictures in the Resources folder is now
considered by
>> some to be "best practice" and to use the Picture Library is inferior in
some
>> way.

Not sure. It's what the kids are saying. 1+ to this question and all of
your others. I don't want the other kids laughing at me.

**********************************************************************
4D v13 is available now - with more than 200 new features to make
your applications richer and faster
http://www.4d.com/products/new.html

4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: Words of wisdom on moving from the Picture Library to external PNG files

David Adams-4
In reply to this post by info-2
Not sure how my response to this line came out sounding:

> one caveat concerning the resources-folder: put everything into
subfolders and keep the count of subfolders low

Thanks to Ortwin for passing it along...but it set off alarm bells for me.
Sometimes with 4D words of wisdom things are a big vague...like this. When
I've ever managed to track these things down to the real facts with
Engineering, the meaning can be any of the following:

* This is an opinion being expressed in a way to make it sound like a
technical detail. It's up to you.

* This is a coded warning that the underlying system isn't 100% reliable.
Don't count on it, don't quote me.

* This was true years and versions ago but is no longer relevant. Ignore.

* This is a comment taken out of context and not what was originally meant.
The comment can't be interpreted accurately and should be disregarded.

* This comment is true for a particular set of circumstances. If you don't
have these circumstances, then the comment doesn't apply.

* None of the above and variants on the above...

I don't expect Ortwin to know which of the above the information fits
in....but hopefully other people have heard something too. From there, it
might be possible to triangulate a bit.

I don't want to spend time on a rework that's going to make the system less
reliable. With that said, I don't want to be scared off of a decent feature
needlessly.

And, really, 100% thank you to Ortwin. I very much asked my broad question
in hopes of flushing out exactly this sort of background information.

**********************************************************************
4D v13 is available now - with more than 200 new features to make
your applications richer and faster
http://www.4d.com/products/new.html

4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: Words of wisdom on moving from the Picture Library to external PNG files

Jeffrey Kain
In reply to this post by David Adams-4
Probably the best reason for using the Resources folder instead of the picture library is for native support of PNG images and transparency. You’ll get the best results with picture buttons, multistate buttons, etc. if you use PNG.

Jeff

On Feb 2, 2014, at 5:20 PM, David Adams <[hidden email]> wrote:

>>> I'm curious why storing pictures in the Resources folder is now considered by
>>> some to be "best practice" and to use the Picture Library is inferior in some
>>> way.
>
> Not sure. It's what the kids are saying. 1+ to this question and all of
> your others. I don't want the other kids laughing at me.


**********************************************************************
4D v13 is available now - with more than 200 new features to make
your applications richer and faster
http://www.4d.com/products/new.html

4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: Words of wisdom on moving from the Picture Library to external PNG files

David Adams-4
Thanks Jeff.

Question: How would you recommend most easily switching pictures? For
example, I've got a single form that can display any number of different
tables. The picture should change based on the current table. I'd rather
use a single object and SET FORMAT, or the like, than load a picture
variable.

I haven't even looked at my code yet...just looking for
off-the-top-of-your-head comments.

**********************************************************************
4D v13 is available now - with more than 200 new features to make
your applications richer and faster
http://www.4d.com/products/new.html

4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: Words of wisdom on moving from the Picture Library to external PNG files

Jeffrey Kain
I haven’t tried it, but it would be interesting if you could use the SET FORMAT technique and have a large picture with all your graphics. My first instinct would be to have separate images and just load a picture into a variable, just for ease of maintenance. Was there a reason you were wanting to avoid separate files?

On Feb 2, 2014, at 6:21 PM, David Adams <[hidden email]> wrote:

> I haven't even looked at my code yet...just looking for
> off-the-top-of-your-head comments.


**********************************************************************
4D v13 is available now - with more than 200 new features to make
your applications richer and faster
http://www.4d.com/products/new.html

4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: Words of wisdom on moving from the Picture Library to external PNG files

David Adams-4
I wasn't at all clear before. I very much want individual files I just
don't feel like loading them into picture variables as they'll be
duplicated in memory. Like it matters these days with tiny little pictures.
Still.

I just tried it out and, yes, SET FORMAT works fine. I tried it with a 3D
button of type 'custom'. I ground out a little method that should serve my
needs - it would be easy enough to improve and expand for other sorts of
buttons, image sources, etc. By the way, Object get format is my new best
friend.

http://doc.4d.com/4D-Language-Reference-13.4/Object-Properties/OBJECT-Get-format.301-1218662.en.html

I "read" the docs a few time and couldn't find the syntax for using a
resource file for my 3D button. I got it working, read the format with Get
object format and - guess what - the information is in the docs....under 3D
button. That's where they should have been...I was looking at the wrong
type of button-that-can-show-a-picture. It's great that the OBJECT SET
FORMAT docs were updated a few years back for completeness as they'd
previously been a bit of a black box...but now they're so long that a guy
that starts his day with as much coffee as I do just can't always spot the
right details. Get object format rules as you can set up everything exactly
how you like in the Form Editor and then go and grab the correct syntax as
a starting point for code.

Anyway, below is the code. If anyone does make improvements, it would be
kind to send it back out to the list.

// Button_SetIconToResourceFile

// I use this with 3D buttons of type 'custom' and haven't tried it
// with anything else. -- DPA

// Note: For docs on OBJECT SET FORMAT, see
//
http://doc.4d.com/4D-Language-Reference-13.4/Object-Properties/OBJECT-SET-FORMAT.301-1218696.en.html

// Tip: Hey! Object get format is great. Set things up how you want them
visually and then get back
// the right syntax to look at.

C_POINTER($1;$button_pointer)
C_TEXT($2;$icon_relative_path)  // I pass in a relative path, like
 icons/query.png for a file located at ...../Resources/icons/query.png

$button_pointer:=$1
$icon_relative_path:=$2

C_TEXT($format_text)
$format_text:=""
$format_text:=$format_text+" ;"  // Button title - use space to stop the
icon from recentering vertically.
$format_text:=$format_text+"#"+$icon_relative_path+";"  // There's another
syntax available file: - but I haven't tried it.
$format_text:=$format_text+";"  // Background picture
$format_text:=$format_text+"4;"  // Title position 4:Bottom
$format_text:=$format_text+"0;"  // Title visible 1:True
$format_text:=$format_text+"1;"  // Icon visible 1:True
$format_text:=$format_text+"0;"  // Button style - push button, bevel, etc.
0=none
$format_text:=$format_text+"0;"  // horizontal margin
$format_text:=$format_text+"0;"  // vertical margin
$format_text:=$format_text+"0;"  // icon offset
$format_text:=$format_text+"0;"  // popup menu 0=none

OBJECT SET FORMAT($button_pointer->;$format_text)

**********************************************************************
4D v13 is available now - with more than 200 new features to make
your applications richer and faster
http://www.4d.com/products/new.html

4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

RE: Words of wisdom on moving from the Picture Library to external PNG files

Thomas Maul-3
In reply to this post by David Adams-4
Regarding discussion about subfolders, how many or none:

This is not limited to pictures, but to anything inside the resource folder. It is still the same rules as it once was for "Extras" folder.

There is no secret, the concept is transparent, you can 'monitor' simply by launching your app once with 4D Server, connect a client and then check the Server's Resource folder. There is a new folder named "Cache".

It contains an entry per top level item (file or folder) as .4darchive, which is the compressed item.

So I guess it's clear:
If you have thousands of top level files/folders, you will have thousands of items to transfer to the client.
If you ever have copied thousands of small files to an USB drive - and compared time to only one big compressed file, I guess you learned that many files is much slower.

If you open Cache.xml you will notice, that there is a hash code for every item.

So I guess it is obvious, that 4D creates a hash code on server and client (you find the same on the local client), on startup of a client the client ask the server to see if his list of hash codes is still valid - and the server sends only the changed items to the client.

As a result you can expect that if you have everything in a single folder and change just one tiny item, everything needs to be resend to the client.

So the general recommendation is to group objects. Never ever have your own 'mydata.xml', which you change for every server start, in the same folder as all your images or your html online help, as this would force on every launch to retransmit everything.
You need to find a logical way to group your objects, like documentation, images, php files, webarea/javascript files, etc.






**********************************************************************
4D v13 is available now - with more than 200 new features to make
your applications richer and faster
http://www.4d.com/products/new.html

4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: Words of wisdom on moving from the Picture Library to external PNG files

David Adams-4
> So the general recommendation is to group objects.

Thanks for answering in detail. From what you say, it's not at all
mysterious or even 4D-specific - just the realities of file transfers.

**********************************************************************
4D v13 is available now - with more than 200 new features to make
your applications richer and faster
http://www.4d.com/products/new.html

4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: Words of wisdom on moving from the Picture Library to external PNG files

Arnaud de Montard
In reply to this post by Jeffrey Kain

Le 3 févr. 2014 à 00:08, Jeffrey Kain a écrit :

> Probably the best reason for using the Resources folder instead of the picture library is for native support of PNG images and transparency.

Resources folder has a cache, too.

Very good… but sticky sometimes! See Simil's message here
<http://forums.4d.fr/Post/FR/11503529/1/11577882#11577882>
and Vincent's solution under.

--
Arnaud de Montard




**********************************************************************
4D v13 is available now - with more than 200 new features to make
your applications richer and faster
http://www.4d.com/products/new.html

4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: Words of wisdom on moving from the Picture Library to external PNG files

info-2
In reply to this post by David Adams-4
> Hmmm. I'm not sure how to take this. …

- delivery of resources folder is reliable, you can even trigger an update by code NOTIFY RESOURCES FOLDER MODIFICATION
- the resource-folder should not contain too main files at first level. They'll be send to the client as single files, uncompressed. Folders will be send as one compressed file, which is faster.
- nesting files too deep into folders of resources-folder, will hide the filename in property list
- take care of knowledgable users, they might not handle the 4dbase-package as package and miss updating the resources folder, which is a recurring behavior of seasoned 4D-users and on Windows, where 4dbase is just a folder



Regards
O r t w i n  Z i l l g e n
---------------------------------------------
<mailto:[hidden email]>   <http://dddd.mettre.de?4713>
<feed://dddd.mettre.de/dddd.xml> <https://twitter.com/Ozett>
member of developer-network <http://www.die4dwerkstatt.de>


**********************************************************************
4D v13 is available now - with more than 200 new features to make
your applications richer and faster
http://www.4d.com/products/new.html

4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: Words of wisdom on moving from the Picture Library to external PNG files

Sujit Shah
Interesting discussion. Sooner or later I have to move all the pictures to
the resources folder. At the moment it is 50- 50%. I had a look at my
standalone build. There are 2 resources folder one in the database folder
and the other in the main application folder. From the contents it looks
like the "other resources folder" holds resources for the 4D native
elements like MSC etc. Are these synchronised? Or is it only synched when
there is a 4D client update.


On Mon, Feb 3, 2014 at 7:38 PM, Ortwin Zillgen <[hidden email]> wrote:

> > Hmmm. I'm not sure how to take this. ...
>
> -       delivery of resources folder is reliable, you can even trigger an
> update by code NOTIFY RESOURCES FOLDER MODIFICATION
> -       the resource-folder should not contain too main files at first
> level. They'll be send to the client as single files, uncompressed. Folders
> will be send as one compressed file, which is faster.
> -       nesting files too deep into folders of resources-folder, will hide
> the filename in property list
> -       take care of knowledgable users, they might not handle the
> 4dbase-package as package and miss updating the resources folder, which is
> a recurring behavior of seasoned 4D-users and on Windows, where 4dbase is
> just a folder
>
>
>
> Regards
> O r t w i n  Z i l l g e n
> ---------------------------------------------
> <mailto:[hidden email]>   <http://dddd.mettre.de?4713>
> <feed://dddd.mettre.de/dddd.xml> <https://twitter.com/Ozett>
> member of developer-network <http://www.die4dwerkstatt.de>
>
>
> **********************************************************************
> 4D v13 is available now - with more than 200 new features to make
> your applications richer and faster
> http://www.4d.com/products/new.html
>
> 4D Internet Users Group (4D iNUG)
> FAQ:  http://lists.4d.com/faqnug.html
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:[hidden email]
> **********************************************************************
>



--

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
"There must be ingenuity as well as intention, strategy as well as
strength. "

**********************************************************************
4D v13 is available now - with more than 200 new features to make
your applications richer and faster
http://www.4d.com/products/new.html

4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: Words of wisdom on moving from the Picture Library to external PNG files

Arnaud de Montard
In reply to this post by David Adams-4

Le 3 févr. 2014 à 00:21, David Adams a écrit :

> The picture should change based on the current table. I'd rather
> use a single object and SET FORMAT, or the like, than load a picture
> variable.

I use OBJECT SET FORMAT with source pictures in the Resources folder or calculated on the fly:
<http://www.screencast.com/users/arnaud.demontard/folders/Jing/media/2bd79d6d-6e82-4368-be28-a32c6f05f6f0>

--
Arnaud de Montard
documentation unreader



**********************************************************************
4D v13 is available now - with more than 200 new features to make
your applications richer and faster
http://www.4d.com/products/new.html

4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: Words of wisdom on moving from the Picture Library to external PNG files

Arnaud de Montard
In reply to this post by info-2

Le 3 févr. 2014 à 09:38, Ortwin Zillgen a écrit :

> - nesting files too deep into folders of resources-folder, will hide the filename in property list

Hi Ortwin,
an idea of what "too deep" is?

--
Arnaud de Montard




**********************************************************************
4D v13 is available now - with more than 200 new features to make
your applications richer and faster
http://www.4d.com/products/new.html

4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: Words of wisdom on moving from the Picture Library to external PNG files

Piotr Chabot Stadhouders-2
In reply to this post by David Adams-4
Hi all,

 

I don't know if this belongs exactly to this topic, but talking about
pictures in the picture library converting to the resources folder:

One of my main problems is that over the past years our picture library has
grown and grown. I thought it was a good idea, while moving these pictures
to the resources folder, to remove unused pictures. Unfortunately we have
always used the picture id to indicate a picture. We use them in 3D buttons,
and in code by the command "GET PICTURE FROM LIBRARY". My question is: Is
there a 100% guaranteed way to find out which pictures are used in a 4D
application?

 

Thanks,

 

Piotr

 


**********************************************************************
4D v13 is available now - with more than 200 new features to make
your applications richer and faster
http://www.4d.com/products/new.html

4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************