Discussion Forums  >  Images, Documents, File Locations

Replies: 12    Views: 154

clhend
Aspiring developer
Profile
Posts: 76
Reg: Dec 23, 2014
Weatherford, TX
5,460
06/01/15 05:10 AM (4 years ago)

Is Self-Hosting Really Best?

I have about 200 files, a mixture of html and excel files, that I'm self-hosting on my website. However, I'm not real happy with the appearance of the screen where one has to download the file.

It also appears that when I do download a file, the next time I enter the app and try to access the same file, it is not cached. Instead I once again have to download it.

I'm wondering if it would be better to just include all of the files in the files.
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
06/01/15 05:28 AM (4 years ago)
That's personal preference. In my particular case, people in my 'region' don't necessarily have an 'all you can eat' data plan, so connectivity can sometimes be an issue. For that reason, most of my apps are 'as self contained as possible'.

Keep in mind, if you include files in your app, and the content 'has' to change, you can always switch to dataURL.

Cheers!

-- Smug
 
Susan Metoxen
buzztouch Evangelist
Profile
Posts: 1700
Reg: May 01, 2011
Hopkins, Minnes...
26,200
like
06/01/15 10:08 PM (4 years ago)
I do what Smug does. I put everything I can into the app, and save the dataURL for changes after its published. We are often testing in wifi, but users may use their data plan to download. Also, run all your images through tinypng.org, which compresses them, especially if they are on a url.
 
clhend
Aspiring developer
Profile
Posts: 76
Reg: Dec 23, 2014
Weatherford, TX
5,460
like
06/02/15 05:29 AM (4 years ago)
Forgive my ignorance. I'm not sure what a dataURL is.
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
06/02/15 06:45 AM (4 years ago)
In the section of the control panel for 'most' plugins, there is usually a 'dataURL' field.

a 'dataURL' is a fancy name for the web address of a file. So, let's say you're using the HTMLDoc plugin, and you've copied a file 'in' the app, called 'mypage.html'. It's a local file, and gets compiled inside the app. You submit it to the app store, it gets released, and life is good.

But later, something happens (regardless what) that causes you to want to change the content of 'mypage.html'. It's already 'in' the app, so there really isn't much you can do to change *that* page.

But you *can* use a dataURL. You create your 'new' mypage.html file, and in the control panel, you change the reference from a local file, to a 'dataURL'.

It will end up looking similar to "http://www.myserver.com/some/file/path/mypage.html" and 'publish' the change. When that happens, the next time a user opens the app, and the config file 'phones home', it will detect a change in the config, and will download the new config. Then, when the user 'taps' in the plugin that utiliizes the 'mypage.html' it will locate the dataURL on the web, download and cache a copy of the file in your app, and use that.

Does that make sense? If not, feel free to ask about what doesn't. We're happy to help.

Cheers!

-- Smug
 
clhend
Aspiring developer
Profile
Posts: 76
Reg: Dec 23, 2014
Weatherford, TX
5,460
like
06/02/15 07:00 AM (4 years ago)
Thank you, Smug

Right now, I've got the app set up to go to the URL of my website where I'm hosting all of the html and excel files. So while I don't foresee having to make changes to most of them, it could happen.

If I understand you correctly, if I keep them there rather than including them in the app files, if I make changes, then the app won't know it? And the files won't automatically update?

And right now, for some reason, the files aren't caching anyway. So that every time I open the app and go to a file, even if I've opened it two minutes previously, I have to once again download it.
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
06/02/15 08:03 AM (4 years ago)
Grrr... I'm really beginning to hate Safari. Well, enough about my 'lost post' complaints...

The summary of what I was saying is:

1) Some plugins have a setting for cache. Make sure yours aren't set to 'always refresh'.
2) If your dataURL points to 'myfile.html' and you change the file, and don't change the name, it will not know there is an update; change the name of the file so the config will realize there is something new going on.

Cheers!

-- Smug
 
clhend
Aspiring developer
Profile
Posts: 76
Reg: Dec 23, 2014
Weatherford, TX
5,460
like
06/02/15 08:29 AM (4 years ago)
#1 - All my plugins are supposed to cache, but I though I had NOT selected 'always refresh'. Will check.

#2 - Got it. So updates will include the date of the update, and then I just need to change it in the app where it's called for.

Thanks Smug...sorry about Safari :)
 
Susan Metoxen
buzztouch Evangelist
Profile
Posts: 1700
Reg: May 01, 2011
Hopkins, Minnes...
26,200
like
06/02/15 04:24 PM (4 years ago)
I do what Smug does. I put everything I can into the app, and save the dataURL for changes after its published. We are often testing in wifi, but users may use their data plan to download. Also, run all your images through tinypng.org, which compresses them, especially if they are on a url.
 
Susan Metoxen
buzztouch Evangelist
Profile
Posts: 1700
Reg: May 01, 2011
Hopkins, Minnes...
26,200
like
06/02/15 04:25 PM (4 years ago)
I do what Smug does. I put everything I can into the app, and save the dataURL for changes after its published. We are often testing in wifi, but users may use their data plan to download. Also, run all your images through tinypng.org, which compresses them, especially if they are on a url.
 
clhend
Aspiring developer
Profile
Posts: 76
Reg: Dec 23, 2014
Weatherford, TX
5,460
like
06/02/15 08:12 PM (4 years ago)
Thank you, Susan. Unfortunately right now it doesn't really matter whether the files are stored on my website or are part of the app files. Nothing is caching, so everytime you want to access a file it has to download again (if you've closed the app since the last time you downloaded it)>

And yes, all of the plugins I'm using are supposed to automatically cache, but they're not...and I'm not sure if it's an issue with my phone or is a problem with the plugin.
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
06/02/15 08:44 PM (4 years ago)
Check your logs in xcode (or android). Those usually give you a running comment on what's going on... and check specifically when the plugin loads, and downloads the file. It *should* say it's caching, or if not, 'why' its not caching... Might help...

Cheers!

-- Smug
 
clhend
Aspiring developer
Profile
Posts: 76
Reg: Dec 23, 2014
Weatherford, TX
5,460
like
06/03/15 05:30 AM (4 years ago)
Thanks Smug.
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.