Page 1 of 2
deployment basics
Posted: Wed Nov 28, 2012 6:05 pm
by cusingerBUSCw5N
I am attempting to deploy on windows and two bad things are happening:
1) I get a notice on my computer confirming that I want to download the exe - it "may harm my computer" because it is "not commonly downloaded". This is not a good way to promote your product. How can I get rid of it?
2) When my app opens, nothing runs. It is only when you click on a button that things begin to format correctly. What am I doing wrong?
Thank you!!!
Re: deployment basics
Posted: Wed Nov 28, 2012 9:39 pm
by cusingerBUSCw5N
I have figured out that the code is failing in the initial Preopen sequence at this point:
Code: Select all
answer tdatabasePath & " is tdatabasepath"
put revOpenDatabase("sqlite", tDatabasePath, , , , ) into tDatabaseID
## Store the database id as a custom property so other handlers can access it
answer "got to line 880"
answer tdatabaseID
set the cDatabaseID of me to tDatabaseID
It identifies tdatabasepath as c:/users/owner/documents/tasks4.sqlite
I verified that the database is there (although it has a little orange dot isntead of a green dot on the small icon)
But it doesn't get the tDatabaseID
I closed out of all the Livecode applications in case there was a conflict.... no change.
Re: deployment basics
Posted: Wed Nov 28, 2012 9:42 pm
by cusingerBUSCw5N
the yellow dot on the icon means it isn't backed up - has nothing to do with this problem.
Re: deployment basics
Posted: Wed Nov 28, 2012 9:45 pm
by cusingerBUSCw5N
Livecode on the same computer identifies the same databaseID as 7.
So why can't the standalone running on my computer identify it?
Re: deployment basics
Posted: Wed Nov 28, 2012 10:12 pm
by Klaus
Hi cusingerBUSCw5N,
the problem is the way Livecode standalones load the externals like RevDB!
The standalone builder will implement a hidden group on the first card which will load the externals
when that group receives a "openbackground" message.
Unfortunately this will only be sent AFTER the startup/preopenstack/openstack/preopencard/opencard messages!
So the db drivers (externals) are just not yet loaded "on preopenstack"
Do this:
Put the db connect routine into a separate handler and execute it a tad later like this:
Code: Select all
on openstack
send "my_db_connect_routine" to me in 100 millisecs
## your stuff here...
end openstack
Best
Klaus
Re: deployment basics
Posted: Wed Nov 28, 2012 11:01 pm
by cusingerBUSCw5N
oh goodie.
I have a bunch of database queries in preopen stack because I don't want them to run everytime someone goes to the home card.
So...the only way I can think of doing this is putting all of them on the stack level, setting a hidden field that is blank initially, then calling it when the home card is opened, putting something in my hidden field so that the next time someone goes to the home page, it won't run again.
If I am making this too complicated, please let me know.
I am assuming that this is will also work for the mac standalone...it won't open at all.
Thanks...someday I will be through the whole process and will celebrate!

Re: deployment basics
Posted: Wed Nov 28, 2012 11:04 pm
by cusingerBUSCw5N
maybe I misunderstood. It looks like your directions were to put this on the openstack, not opencard level.
I like that better
Re: deployment basics
Posted: Wed Nov 28, 2012 11:33 pm
by cusingerBUSCw5N
doesn't work.
I tried increasing the time to 4000 - no difference
Here's the code I'm using:
Code: Select all
on openstack
send "my_db_connect_routine" to me in 4000 millisecs
end openstack
here's my_db_connect_routine (it gets there because it gives me "hi") - but gets stuck in databaseconnect (in the next set of code)
Code: Select all
on my_db_connect_routine
answer "hi"
databaseConnect
##check for changes on main database
##get id from local and send it to main database
put "SELECT Tid from basics " into tSQL
put revDataFromQuery(,,the cDatabaseID of me,tSQL) into tid
##put tid into field "tid" of card "docs"
put field "needs_updating" of card "home page" into tupdate
## if there are changes on local side
if tupdate is "emails_updated" then
put "SELECT buddy from basics " into tSQL
put revDataFromQuery(,,the cDatabaseID of me,tSQL) into tbuddy
put "SELECT email from basics " into tSQL
put revDataFromQuery(,,the cDatabaseID of me,tSQL) into temail
## send emails to remote database and clear emails_updated
put "http://www.toolsforbusiness.info/disaster/update_email.cfm?email=" & temail & "&buddy=" & tbuddy &"&ID=" & tid & "" into turl
put url (turl) into theData
if theData is not "done" then
else
put empty into field "needs_updating" on card "home page"
end if
end if
##sync back - get remote email and buddy and put in local database
put "http://www.toolsforbusiness.info/disaster/syncemail.cfm?id=" & tid into turlv
put url (turlv) into theDatav
put "update basics set email=" & theDatav & "" into vSQL
revExecuteSQL the cDatabaseID of me, vSQL
put "http://www.toolsforbusiness.info/disaster/syncbuddy.cfm?id=" & tid into turlw
put url (turlw) into theDataw
replace "XYZe" with TAB in theDataw
split theDataw by TAB
put theDataw[1] into tbuddy
put thedataw[2] into texpiration_month
put thedataw[3] into texpiration_year
put thedataw[4] into taccount_type
put thedataw[5] into tkeep_informed
put "update basics set buddy='" & tbuddy & "', expiration_month=" & texpiration_month & ",expiration_year=" & texpiration_year & ", account_type='" & taccount_type & "',keep_informed='" & tkeep_informed & "'" into wSQL
revExecuteSQL the cDatabaseID of me, wSQL
getexpiration
answer "got to end"
end my_db_connect_routine
this is the code for databaseconnect (gets stuck at the same place: put revOpenDatabase("sqlite", tDatabasePath, , , , ) into tDatabaseID
Code: Select all
on databaseConnect
answer "got to databaseconnect"
local tDatabasePath, tDatabaseID
## The database must be in a writeable location
put specialFolderPath("documents") & "/tasks4.sqlite" into tDatabasePath
## Open a connection to the database
## If the database does not already exist it will be created and we will add the table
if there is not a file tDatabasePath then
put revOpenDatabase("sqlite", tDatabasePath, , , , ) into tDatabaseID
## Store the database id as a custom property so other handlers can access it
set the cDatabaseID of me to tDatabaseID
databaseCreateTable
else
answer tdatabasePath & " is tdatabasepath"
answer "ccc got here"
put revOpenDatabase("sqlite", tDatabasePath, , , , ) into tDatabaseID
## Store the database id as a custom property so other handlers can access it
answer tdatabaseID & " is tdatabaseid"
set the cDatabaseID of me to tDatabaseID
end if
end databaseConnect
Re: deployment basics
Posted: Thu Nov 29, 2012 11:41 am
by Klaus
Hi,
I don't know if this is important, but you have a COMMA too much in your line:
...
put revOpenDatabase("sqlite", tDatabasePath, , , , ) into tDatabaseID
...
Should be:
...
put revOpenDatabase("sqlite", tDatabasePath, , ,) into tDatabaseID
...
On the other hand, in my current project I have even more COMMAS there:
...
put revOpenDatabase("sqlite",tDBPath,,,,,,) into tDBID
...
???
But what do you mean by:
...
but gets stuck in databaseconnect ...
...
Does it give you an error? Is tDatabaseID empty or what?
Try to add more "ANSWER this and that" to get a hint.
Best
Klaus
Re: deployment basics
Posted: Thu Nov 29, 2012 4:55 pm
by cusingerBUSCw5N
As usual, I am my own worst enemy. I found this in the library:
Important! The revOpenDatabase function is part of the Database library. To ensure that the function works in a standalone application, you must include this custom library when you create your standalone. In the Inclusions section of the General screen of the Standalone Application Settings window, make sure the Database Support checkbox is checked and the database drivers you are using are selected in the list of database drivers.
Sure enough - the Database was checked in one area and not another. I'm trying it now and will report back

Re: deployment basics
Posted: Thu Nov 29, 2012 5:06 pm
by Klaus
Well, erm.., yes...

Re: deployment basics
Posted: Thu Nov 29, 2012 5:54 pm
by cusingerBUSCw5N
doesn't work.
Through testing I found out that the code has to be
if the environment is "standalone application"..... (I had standalone)
I also clicked on database under scripts for standalone settings.
Then I put answer "" all over the place.
Failed. It just doesn't like the line
put revOpenDatabase("sqlite", tDatabasePath, , , , , ) into tDatabaseID
I tried the same line with 2, 3 and 4 commas after tdatabasePath (i.e. tdatabasePath,,, tdatabasePath,,,, and tdatabasepath,,,,,)
(I'm now getting double vision trying to count commas).... - none of it made a difference
I added the code - put the result into.... - never got there
it just never gets to processing the line.
It works quite nicely on my laptop before making it a standalone. It works on mobile devices.
Also..FYI, I do not have the security settings for Microsoft yet - and so you have to click "you may harm your computer"...when opening it. Could that affect it? Or what else is happening with a standalone that wouldn't happen using Livecode directly?
....and also to confirm - "sqlite" is the type of database. because my actual database is called sqlite4 (but I think that would have shown up as a problem long before I created a standalone for windows.)
Anyway...I'm at a loss.
Code: Select all
answer "there is a path" & tdatabasePath & " is tdatabasepath"
put revOpenDatabase("sqlite", tDatabasePath, , , , , ) into tDatabaseID
## Store the database id as a custom property so other handlers can access it
put the result into twhat
answer twhat
answer tdatabaseID & " is tdatabaseid"
set the cDatabaseID of me to tDatabaseID
Re: deployment basics
Posted: Thu Nov 29, 2012 6:00 pm
by Klaus
Code: Select all
answer "there is a path" & tdatabasePath & " is tdatabasepath"
put revOpenDatabase("sqlite", tDatabasePath, , , , , ) into tDatabaseID
put the result into twhat
answer twhat
So you never get answered "twhat"?
What is in tDatabasePath?
Try:
Code: Select all
...
put revOpenDatabase("sqlite", tDatabasePath, , , , , ) into tDatabaseID
## Store the database id as a custom property so other handlers can access it
answer tDatabaseID & CR & the result
Re: deployment basics
Posted: Thu Nov 29, 2012 6:13 pm
by cusingerBUSCw5N
Does the problem have to do with closing the database? Maybe I am not closing the database correctly so it won't open a new version?
I have this code that is called on closestack. It seems right to me.
Code: Select all
on databaseDisconnect
revCloseDatabase the cDatabaseID of me
end databaseDisconnect
Re: deployment basics
Posted: Thu Nov 29, 2012 6:19 pm
by Klaus
Short question: what is ME in your scripts? The stack or the card with the scripts?
Try to change "ME" with "this stack" or "stack NameOfStack" to be sure!