One click publishing

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

bsouthuk
Posts: 261
Joined: Fri Dec 05, 2008 7:25 pm

One click publishing

Post by bsouthuk » Mon Aug 23, 2010 2:29 pm

HI

Wonder if someone can help me.

I have developed an application which is updated very frequently, so when customers open the standalone app I have sent them it downloads the stack file everytime they double click my app which sits on their desktop.

Its just one line of code:

go url "http://mydomain/mystacks/portal.rev"

This works fine however, my stack is 18 MB so my customers are having to wait around 1-2 minutes before my applicaition opens therefore i'm uploading my stack compressed:

put compress(tPathToMyStackFile) into tCompressedStackData
put tCompressedStackData into url \
"ftp://user:password@ftp.mydomain.com/my ... tal.rev.gz"

I have checked my web portal and the stack.gz file is there but it isnt opening when using the following script:

get url "http://mydomain/mystacks/portal.rev.gz"
go decompress(it)

Does anyone know what I am doing wrong?

Thanks

Daniel

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10057
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: One click publishing

Post by FourthWorld » Mon Aug 23, 2010 3:24 pm

Hello Daniel -

I'm a bit overdue getting back to you on your post to the improve-rev list, but I've been working on a library to help your work along so the time has been well spent. This week is a bit impacted with some client deadlines, but with any luck I should have some scripts for you early next week. Feel free to call me in the meantime if you like: 323-225-3717.

In the meantime, to diagnose what's happening in your scripts you may want to check "the result" after your commands. The result will be empty after successful calls, but usually contains error info for those that have trouble.

E.g.:

Code: Select all

put compress(tPathToMyStackFile) into tCompressedStackData
put tCompressedStackData into url \
"ftp://user:password@ftp.mydomain.com/mystacks/portal.rev.gz"
if the result is not empty then answer the result
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

bsouthuk
Posts: 261
Joined: Fri Dec 05, 2008 7:25 pm

Re: One click publishing

Post by bsouthuk » Mon Aug 23, 2010 3:49 pm

Hi Richard

Thank you very much for your help it really is most appreciated.

The error message I am getting when geting the url and decompressing it is 'no such card'

Not sure why it comes back saying this?

Klaus
Posts: 14208
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: One click publishing

Post by Klaus » Mon Aug 23, 2010 4:09 pm

Hi Daniel,

looks like you only compress the string in the variable "tPathToMyStackFile"
and upload that to your server!

You need to use "binfile":

Code: Select all

...
put compress(url"binfile:" & tPathToMyStackFile) into tCompressedStackData
put tCompressedStackData into url \
"ftp://user:password@ftp.mydomain.com/mystacks/portal.rev.gz"
...
So no valid stack file is in the compressed archieve ergo: no such card!


Best

Klaus

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10057
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: One click publishing

Post by FourthWorld » Mon Aug 23, 2010 4:10 pm

I'm assuming you're getting no error with the decompress function, which would normally throw an execution error if the data being passed to it is not complete compressed data. That much is good. But now we have to figure out how the seemingly-successfully-compressed data is not recognized as a stack file.

Instead of using "go", perhaps you could replace that with:

put it into url ("binfile:"&specialFolderPath("desktop")&"/TestStack.rev")

...and then see if you can open it in Rev. That would at least let us know if the file is good stack data.

If that doesn't work out, perhaps there was an issue uploading (though I'd suspect that a problem on that end would throw an error when you try to decompress it). Maybe adding a check on the result after the upload statement as I showed above might tell us something useful.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10057
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: One click publishing

Post by FourthWorld » Mon Aug 23, 2010 4:11 pm

Looks like Klaus caught it. My bad, since you were using the example I posted pre-coffee to the improve-rev list. :)

Thanks, Klaus.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

bsouthuk
Posts: 261
Joined: Fri Dec 05, 2008 7:25 pm

Re: One click publishing

Post by bsouthuk » Mon Aug 23, 2010 4:25 pm

Thanks Klaud but unfortunately still getting same problem. Coming back saying 'No such card'

Richard - I have tried what you suggested:

'Instead of using "go", perhaps you could replace that with:
put it into url ("binfile:"&specialFolderPath("desktop")&"/TestStack.rev")'

This saves the stack to my desktop, however when I try to open it, a message appears saying 'This is not a stack file'. Very strange.

When i upload to my server using the 'if the result is not empty then answer the result' script, no errors appear so I am completely bamboozled!

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10057
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: One click publishing

Post by FourthWorld » Mon Aug 23, 2010 4:31 pm

See Klaus' post above. He caught an error in my original script which failed to use the "binfile" directive for specifying that you're after a file and not the variable itself.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

bsouthuk
Posts: 261
Joined: Fri Dec 05, 2008 7:25 pm

Re: One click publishing

Post by bsouthuk » Mon Aug 23, 2010 4:47 pm

Hey Richard

Yes I tried that but hasnt made any difference. Still saying no such card

bsouthuk
Posts: 261
Joined: Fri Dec 05, 2008 7:25 pm

Re: One click publishing

Post by bsouthuk » Mon Aug 23, 2010 4:54 pm

Though what I do know is that it isnt compressing and uploading correctly as the 'compressed stacl' thats uploading to my server is always the same size: 38KB regardless of how big the stack actually is

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10057
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: One click publishing

Post by FourthWorld » Mon Aug 23, 2010 4:55 pm

Right. Klaus' post explains it all. Really. Make the change he suggests and I suspect your code will work well.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

bsouthuk
Posts: 261
Joined: Fri Dec 05, 2008 7:25 pm

Re: One click publishing

Post by bsouthuk » Mon Aug 23, 2010 5:12 pm

Sorry Richard but I have tried this and still the same problem.

The stack is clearly not compressing and uploading even after Klaus' changes. The stack on my server is always the same size at 38KB regardless of the size of the stack.

I have looked hard at the script:

Code: Select all

put compress(url"binfile:" & tPathToMyStackFile) into tCompressedStackData
put tCompressedStackData into url \
"ftp://qgloginc:manutd07@ftp.qglogin.co.uk/public_html/boo1.rev.gz"
Looks fine to me - i'm hoping it has nothing to do with me using Windows 7!

Klaus
Posts: 14208
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: One click publishing

Post by Klaus » Mon Aug 23, 2010 5:24 pm

Hi Daniel,

hmmm, try this one (see the additional parenthesis around "binfile:"!):
...

Code: Select all

put compress(url("binfile:" & tPathToMyStackFile)) into tCompressedStackData
answer the result
## is empty if everythings worked out fine and 
## might give a hint what might have been wrong otherwise?
...
Best

Klaus

bsouthuk
Posts: 261
Joined: Fri Dec 05, 2008 7:25 pm

Re: One click publishing

Post by bsouthuk » Mon Aug 23, 2010 6:11 pm

Thanks for your help Klaus but still the same probem.

When adding the extra parenthesis the problem still persists. Now I have:

Code: Select all

put compress(url("binfile:" & tPathToMyStackFile)) into tCompressedStackData
put tCompressedStackData into url \
       "ftp://qgloginc:manutd07@ftp.qglogin.co.uk/public_html/boo.rev.gz"
 answer the result
The result is empty so no errors are showing.

Do you think its worther reporting the problem to RunRev?

Klaus
Posts: 14208
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: One click publishing

Post by Klaus » Mon Aug 23, 2010 6:35 pm

Hi Daniel,

well, I wrote and meant to check the result right after the COMPRESSING,
since the uiploading obviously works!
...
put compress(url("binfile:" & tPathToMyStackFile)) into tCompressedStackData
answer the result ## !!!

put tCompressedStackData into url "ftp://qgloginc:manutd07@ftp.qglogin.co. ... boo.rev.gz"
...
I do not think this is a Rev error, I have been using this technique for yearts and never had problems!
There is something going wrong on your side, I'm afraid.


Best

Klaus

P.S.
Try to do everything on your HD first, I mean:
1. compress your stack
2. save the compressed data to a file
3. decompress the resulting file from 2. and
4. save the decrompressed file to your HD and check if you
5. can open that file with Rev

Post Reply