Re: Sql problem

2017-05-25 Thread Bob Sneidar via use-livecode
Should read, "Forms Generator currently connects directly to SQL VIA SQLYOGA 
because if I had to write it using only the LC API, I would never have persued 
it to the level that I have. 
> 
> On May 25, 2017, at 12:27 , Bob Sneidar via use-livecode 
>  wrote:
> 
> Forms Generator currently connects directly to SQL because if I had to write 
> it using only the LC API, I would never have persued it to the level that I 
> have. 


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Sql problem

2017-05-25 Thread Andre Garzia via use-livecode
On Thu, May 25, 2017 at 4:27 PM, Bob Sneidar via use-livecode <
use-livecode@lists.runrev.com> wrote:

> mySQL for Windows is *VERY VERY DIFFICULT* to set up to run with SSL


Bob,

About running MySQL on Windows, a good choice would be using docker[1].
There are pre-made images for running MySQL under Docker, it would just be
a matter of familiarizing yourself with docker and then configuring the
image. No need to compile anything.

[1] Docker: http://docker.com/
[2] Official MySQL image for Docker:
https://hub.docker.com/r/mysql/mysql-server/

Cheers
andre


-- 
http://www.andregarzia.com -- All We Do Is Code.
http://fon.nu -- minimalist url shortening service.
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Sql problem

2017-05-25 Thread Bob Sneidar via use-livecode
Boy howdy do I have one! Forms Generator currently connects directly to SQL 
because if I had to write it using only the LC API, I would never have persued 
it to the level that I have. As it is, it's a critical component of our 
everyday workflow for my IT techs. I bet with a Web API, a LOT more people 
would look at it. I personally would pay for an upgrade using the Web API, as 
technically I am breaking all kinds of best practices. 

What makes it even more appealing is the fact that mySQL for Windows is *VERY 
VERY DIFFICULT* to set up to run with SSL, perhaps not possible at all with the 
Public Source version without being an application compilation guru, so 
encryption point to point is an issue a web API would solve. 

Bob S


> On May 25, 2017, at 02:02 , Trevor DeVore via use-livecode 
>  wrote:
> 
> I always thought it would be nice to have a different type of connector in
> SQL Yoga that would interface with a web API. I never had a project where I
> needed to actually flesh out the idea to see if it was practical.
> 
> -- 
> Trevor DeVore
> ScreenSteps
> www.screensteps.com


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Sql problem

2017-05-25 Thread Richard Gaskin via use-livecode

William Prothero wrote:

> Thanks for the comments. I bet the linefeeds caused me the problem,
> since I just took the contents of a text field, put them in an array,
> and didn’t pay attention to linefeeds.

Linefeeds are common in data.  Consider any user note, such as bug 
reports at Bugzilla, or most emails, or the body of a note in Evernote, 
or most JSON data, or a great many other circumstances.


Many base64 implementations output with 80-char wraps.  LiveCode's 
formatting is not at all uncommon.


If lineFeeds are a problem with a storage system there's probably a good 
way to account for them that will benefit many things beyond serialized 
arrays.



> Now I remember why I didn’t try to directly connect to the dB. The
> security issue makes it inadvisable to go direct. It would be nice
> if there was a cautionary statement about that in the dictionary.

This is an ongoing theme in forum discussions:  what should the scope of 
the Dictionary encompass?


It's a good question, one without an easy answer:

On the one hand, the Dictionary is the first go-to for most learners and 
experienced devs alike, so it can indeed be helpful to pack as much 
relevant info there as practical.


But on the other hand, a dictionary serves a fundamentally different 
role from a User Guide, the former serving as a quick reference, 
emphasizing only the essentials for a given token, while the latter is 
where we might expect longer discussions of broader contexts like 
architecture.


Part of the problem with the User Guide is that it's seldom read, and I 
find many new users don't even know it exists at all.


We can't blame them for missing the User Guide and being disappointed 
that the Dictionary doesn't serve both roles, given that the Dictionary 
is very easy to find in the IDE but the User Guide is buried deep in the 
middle of the Help menu.


Suggestions for a quick rearrangement of Help menu items to draw 
appropriate attention to each learning resource have been submitted:

http://quality.livecode.com/show_bug.cgi?id=19511

But on this specific issue, even if those valuable changes were made, it 
wouldn't solve the issue at hand in this thread:


While there is a section in the User Guide on working with databases, 
the common practice of using middleware like PHP, Perl, Ruby, 
JavaScript, LiveCode, etc. to deliver RESTful APIS that also protect the 
DB from the open internet isn't covered there.


Perhaps one of the readers of this list this might take a stab at adding 
something on that?


--
 Richard Gaskin
 Fourth World Systems
 Software Design and Development for the Desktop, Mobile, and the Web
 
 ambassa...@fourthworld.comhttp://www.FourthWorld.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: Sql problem

2017-05-25 Thread Trevor DeVore via use-livecode
I always thought it would be nice to have a different type of connector in
SQL Yoga that would interface with a web API. I never had a project where I
needed to actually flesh out the idea to see if it was practical.

-- 
Trevor DeVore
ScreenSteps
www.screensteps.com

On Wed, May 24, 2017 at 12:05 PM, Bob Sneidar via use-livecode <
use-livecode@lists.runrev.com> wrote:

> My problem with that is that I use sqlYoga in a fairly complex app. How
> would I incorporate sqlYoga calls with a web interface and still retrieve
> the data in the same format as I currently have? If I cannot do that, then
> the burden of refactoring the entire application would be considerable.
>
> Bob S
>
>
> > On May 23, 2017, at 17:53 , Andre Garzia via use-livecode <
> use-livecode@lists.runrev.com> wrote:
> >
> > William,
> >
> > You could but it is not a good security practice to expose a mysql
> database
> > to the larger internet. The internet is very hostile and keeping your
> mysql
> > server safe would be a job on its own. Best you use your php cgi or
> > anything else to put a wall between your database and the net.
> >
> > Never, ever, expose a database server. Thats a golden rule. Now, if
> you're
> > building something that is for internal use on a LAN, business network,
> > intranet, then the rules are different, even though, even in this case, I
> > would put something in front of the database if it was up to me to make
> > such decision.
> >
> > Cheers
> > andre
> >
> >
> > --
> > http://www.andregarzia.com -- All We Do Is Code.
> > http://fon.nu -- minimalist url shortening service.
>
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Sql problem

2017-05-24 Thread William Prothero via use-livecode
Folks:
Thanks for the comments. I bet the linefeeds caused me the problem, since I 
just took the contents of a text field, put them in an array, and didn’t pay 
attention to linefeeds.

Now I remember why I didn’t try to directly connect to the dB. The security 
issue makes it inadvisable to go direct. It would be nice if there was a 
cautionary statement about that in the dictionary. 

Best,
Bill

> On May 23, 2017, at 6:22 PM, Roger Eller via use-livecode 
>  wrote:
> 
> I have always replaced the linefeeds with a unique placeholder for
> transport, and switched it back to linefeeds in the server script.  I
> didn't even consider replacing with empty.
> 
> On May 23, 2017 8:55 PM, "Jonathan Lynch via use-livecode" <
> use-livecode@lists.runrev.com> wrote:
> 
>> One quick note about base64encode:
>> 
>> LC adds linefeeds. After you base64encode, you may need to replace
>> linefeed with empty in the variable.
>> 
>> Sent from my iPhone
>> 
>>> On May 23, 2017, at 8:10 PM, William Prothero via use-livecode <
>> use-livecode@lists.runrev.com> wrote:
>>> 
>>> Andre,
>>> This is good advice. I did it this way as a shortcut for an app I’ve
>> built for myself only. You are right that it makes debugging harder because
>> I can’t use other management applications to examine the contents.
>>> 
>>> For many years now I’ve used php cgi’s to connect to the remote mysql db
>> and it works well. I just haven’t spent the time to set up JSON.
>>> 
>>> But it looks like I could dispense with the php and directly access the
>> mySQL db from my mobile app, without a cgi?
>>> 
>>> Best,
>>> Bill
>>> 
 On May 23, 2017, at 3:30 PM, Andre Garzia via use-livecode <
>> use-livecode@lists.runrev.com> wrote:
 
 William,
 
 If I may add a bit of personal opinion here... so, I have been using and
 storing LC stuff in databases for a long time. Not only I have been
>> storing
 arrays in database but I had them flying over TCP sockets and being
 decoded/encoded as needed. For a long time I used the same approach as
>> you,
 which is to arrayEncode + base64 the array.
 
 I don't do that any longer. That combination is very hard to debug. I
>> would
 advise you simply to use JSON and store it as JSON on the db. Instead of
 encoding the array twice, you do it only once with jsonexport() and then
 when importing, you do it only once with jsonimport()
 
 Not only that reduces complexity but it also makes it a lot easier to
 debug. As a bonus, your data can be consumed by other applications which
 are not based on LC which may open a whole ecosystem of plugins and
 interoperation to your product.
 
 Cheers
 andre
 
 
 On Sun, May 21, 2017 at 9:45 PM, William Prothero via use-livecode <
 use-livecode@lists.runrev.com> wrote:
 
> Never mind. I got it working. I’m not exactly sure about the problem
> because the method I used should have been quite general. However, what
> made it work is that I had the contents of a list field in the array I
>> was
> storing and that somehow caused an error when I tried to decode the
>> array.
> I deleted that array key, because there was no reason I needed to have
>> it
> in the db anyway, and it worked.
> 
> I’ll look into why and report back if I find anything interesting.
> Best,
> Bill
> 
>> On May 21, 2017, at 5:23 PM, William Prothero via use-livecode <
> use-livecode@lists.runrev.com> wrote:
>> 
>> Whoops, I lied.
>> The data is stored incorrectly in the simulator too.
>> Hmm….
>> The IDE stores it correctly. There is something in the encoding that
>> I’m
> missing.
>> Bill
>> 
>>> On May 21, 2017, at 5:03 PM, William Prothero via use-livecode <
> use-livecode@lists.runrev.com> wrote:
>>> 
>>> Folks:
>>> I have an app that stores data to a mysql database on my server. It
> works fine in the IDE and in the iPhone simulator. However, when I
>> load the
> app onto the iPhone, the saved data is corrupted.
>>> 
>>> I am saving an array. The array is saved in a big string that has
>> been
> base64 encoded.
>>> 
>>> When saving, I do:
>>> 
>>> put arrayEncode(tArray) into tData
>>> 
>>> put base64encode(tData) into xData
>>> 
>>> put urlEncode(xData) into xData
>>> 
>>> xData is sent to the db
>>> 
>>> When I read back the data, I do the inverse:
>>> 
>>> urlDecode
>>> base64Decode
>>> arrayDecode
>>> 
>>> The base64 data on the db is different when I store it from the
>> iPhone.
> I can see this with Navicat, which I use for db management. So, the
>> problem
> is in the storing of the data.
>>> 
>>> What the heck? I am just using a post command to a php script that
> writes to the db.
>>> 
>>> Why would the iPhone data that is sent be different from 

Re: Sql problem

2017-05-24 Thread Bob Sneidar via use-livecode
My problem with that is that I use sqlYoga in a fairly complex app. How would I 
incorporate sqlYoga calls with a web interface and still retrieve the data in 
the same format as I currently have? If I cannot do that, then the burden of 
refactoring the entire application would be considerable. 

Bob S


> On May 23, 2017, at 17:53 , Andre Garzia via use-livecode 
>  wrote:
> 
> William,
> 
> You could but it is not a good security practice to expose a mysql database
> to the larger internet. The internet is very hostile and keeping your mysql
> server safe would be a job on its own. Best you use your php cgi or
> anything else to put a wall between your database and the net.
> 
> Never, ever, expose a database server. Thats a golden rule. Now, if you're
> building something that is for internal use on a LAN, business network,
> intranet, then the rules are different, even though, even in this case, I
> would put something in front of the database if it was up to me to make
> such decision.
> 
> Cheers
> andre
> 
> 
> -- 
> http://www.andregarzia.com -- All We Do Is Code.
> http://fon.nu -- minimalist url shortening service.


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Sql problem

2017-05-23 Thread Roger Eller via use-livecode
I have always replaced the linefeeds with a unique placeholder for
transport, and switched it back to linefeeds in the server script.  I
didn't even consider replacing with empty.

On May 23, 2017 8:55 PM, "Jonathan Lynch via use-livecode" <
use-livecode@lists.runrev.com> wrote:

> One quick note about base64encode:
>
> LC adds linefeeds. After you base64encode, you may need to replace
> linefeed with empty in the variable.
>
> Sent from my iPhone
>
> > On May 23, 2017, at 8:10 PM, William Prothero via use-livecode <
> use-livecode@lists.runrev.com> wrote:
> >
> > Andre,
> > This is good advice. I did it this way as a shortcut for an app I’ve
> built for myself only. You are right that it makes debugging harder because
> I can’t use other management applications to examine the contents.
> >
> > For many years now I’ve used php cgi’s to connect to the remote mysql db
> and it works well. I just haven’t spent the time to set up JSON.
> >
> > But it looks like I could dispense with the php and directly access the
> mySQL db from my mobile app, without a cgi?
> >
> > Best,
> > Bill
> >
> >> On May 23, 2017, at 3:30 PM, Andre Garzia via use-livecode <
> use-livecode@lists.runrev.com> wrote:
> >>
> >> William,
> >>
> >> If I may add a bit of personal opinion here... so, I have been using and
> >> storing LC stuff in databases for a long time. Not only I have been
> storing
> >> arrays in database but I had them flying over TCP sockets and being
> >> decoded/encoded as needed. For a long time I used the same approach as
> you,
> >> which is to arrayEncode + base64 the array.
> >>
> >> I don't do that any longer. That combination is very hard to debug. I
> would
> >> advise you simply to use JSON and store it as JSON on the db. Instead of
> >> encoding the array twice, you do it only once with jsonexport() and then
> >> when importing, you do it only once with jsonimport()
> >>
> >> Not only that reduces complexity but it also makes it a lot easier to
> >> debug. As a bonus, your data can be consumed by other applications which
> >> are not based on LC which may open a whole ecosystem of plugins and
> >> interoperation to your product.
> >>
> >> Cheers
> >> andre
> >>
> >>
> >> On Sun, May 21, 2017 at 9:45 PM, William Prothero via use-livecode <
> >> use-livecode@lists.runrev.com> wrote:
> >>
> >>> Never mind. I got it working. I’m not exactly sure about the problem
> >>> because the method I used should have been quite general. However, what
> >>> made it work is that I had the contents of a list field in the array I
> was
> >>> storing and that somehow caused an error when I tried to decode the
> array.
> >>> I deleted that array key, because there was no reason I needed to have
> it
> >>> in the db anyway, and it worked.
> >>>
> >>> I’ll look into why and report back if I find anything interesting.
> >>> Best,
> >>> Bill
> >>>
>  On May 21, 2017, at 5:23 PM, William Prothero via use-livecode <
> >>> use-livecode@lists.runrev.com> wrote:
> 
>  Whoops, I lied.
>  The data is stored incorrectly in the simulator too.
>  Hmm….
>  The IDE stores it correctly. There is something in the encoding that
> I’m
> >>> missing.
>  Bill
> 
> > On May 21, 2017, at 5:03 PM, William Prothero via use-livecode <
> >>> use-livecode@lists.runrev.com> wrote:
> >
> > Folks:
> > I have an app that stores data to a mysql database on my server. It
> >>> works fine in the IDE and in the iPhone simulator. However, when I
> load the
> >>> app onto the iPhone, the saved data is corrupted.
> >
> > I am saving an array. The array is saved in a big string that has
> been
> >>> base64 encoded.
> >
> > When saving, I do:
> >
> > put arrayEncode(tArray) into tData
> >
> > put base64encode(tData) into xData
> >
> > put urlEncode(xData) into xData
> >
> > xData is sent to the db
> >
> > When I read back the data, I do the inverse:
> >
> > urlDecode
> > base64Decode
> > arrayDecode
> >
> > The base64 data on the db is different when I store it from the
> iPhone.
> >>> I can see this with Navicat, which I use for db management. So, the
> problem
> >>> is in the storing of the data.
> >
> > What the heck? I am just using a post command to a php script that
> >>> writes to the db.
> >
> > Why would the iPhone data that is sent be different from that sent in
> >>> the simulator?
> >
> > Mac OSX 10.12.4, Livecode 8.1.4 (rc2) and XCode 8.3.
> >
> > Any suggestions would be welcome.
> > Thanks,
> > Bill P.
> >
> > William A. Prothero
> > http://earthlearningsolution.org/
> >
> > ___
> > use-livecode mailing list
> > use-livecode@lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your
> >>> subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
> 
> 

Re: Sql problem

2017-05-23 Thread Jonathan Lynch via use-livecode
One quick note about base64encode:

LC adds linefeeds. After you base64encode, you may need to replace linefeed 
with empty in the variable.

Sent from my iPhone

> On May 23, 2017, at 8:10 PM, William Prothero via use-livecode 
>  wrote:
> 
> Andre,
> This is good advice. I did it this way as a shortcut for an app I’ve built 
> for myself only. You are right that it makes debugging harder because I can’t 
> use other management applications to examine the contents. 
> 
> For many years now I’ve used php cgi’s to connect to the remote mysql db and 
> it works well. I just haven’t spent the time to set up JSON. 
> 
> But it looks like I could dispense with the php and directly access the mySQL 
> db from my mobile app, without a cgi?
> 
> Best,
> Bill
> 
>> On May 23, 2017, at 3:30 PM, Andre Garzia via use-livecode 
>>  wrote:
>> 
>> William,
>> 
>> If I may add a bit of personal opinion here... so, I have been using and
>> storing LC stuff in databases for a long time. Not only I have been storing
>> arrays in database but I had them flying over TCP sockets and being
>> decoded/encoded as needed. For a long time I used the same approach as you,
>> which is to arrayEncode + base64 the array.
>> 
>> I don't do that any longer. That combination is very hard to debug. I would
>> advise you simply to use JSON and store it as JSON on the db. Instead of
>> encoding the array twice, you do it only once with jsonexport() and then
>> when importing, you do it only once with jsonimport()
>> 
>> Not only that reduces complexity but it also makes it a lot easier to
>> debug. As a bonus, your data can be consumed by other applications which
>> are not based on LC which may open a whole ecosystem of plugins and
>> interoperation to your product.
>> 
>> Cheers
>> andre
>> 
>> 
>> On Sun, May 21, 2017 at 9:45 PM, William Prothero via use-livecode <
>> use-livecode@lists.runrev.com> wrote:
>> 
>>> Never mind. I got it working. I’m not exactly sure about the problem
>>> because the method I used should have been quite general. However, what
>>> made it work is that I had the contents of a list field in the array I was
>>> storing and that somehow caused an error when I tried to decode the array.
>>> I deleted that array key, because there was no reason I needed to have it
>>> in the db anyway, and it worked.
>>> 
>>> I’ll look into why and report back if I find anything interesting.
>>> Best,
>>> Bill
>>> 
 On May 21, 2017, at 5:23 PM, William Prothero via use-livecode <
>>> use-livecode@lists.runrev.com> wrote:
 
 Whoops, I lied.
 The data is stored incorrectly in the simulator too.
 Hmm….
 The IDE stores it correctly. There is something in the encoding that I’m
>>> missing.
 Bill
 
> On May 21, 2017, at 5:03 PM, William Prothero via use-livecode <
>>> use-livecode@lists.runrev.com> wrote:
> 
> Folks:
> I have an app that stores data to a mysql database on my server. It
>>> works fine in the IDE and in the iPhone simulator. However, when I load the
>>> app onto the iPhone, the saved data is corrupted.
> 
> I am saving an array. The array is saved in a big string that has been
>>> base64 encoded.
> 
> When saving, I do:
> 
> put arrayEncode(tArray) into tData
> 
> put base64encode(tData) into xData
> 
> put urlEncode(xData) into xData
> 
> xData is sent to the db
> 
> When I read back the data, I do the inverse:
> 
> urlDecode
> base64Decode
> arrayDecode
> 
> The base64 data on the db is different when I store it from the iPhone.
>>> I can see this with Navicat, which I use for db management. So, the problem
>>> is in the storing of the data.
> 
> What the heck? I am just using a post command to a php script that
>>> writes to the db.
> 
> Why would the iPhone data that is sent be different from that sent in
>>> the simulator?
> 
> Mac OSX 10.12.4, Livecode 8.1.4 (rc2) and XCode 8.3.
> 
> Any suggestions would be welcome.
> Thanks,
> Bill P.
> 
> William A. Prothero
> http://earthlearningsolution.org/
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
>>> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
 
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
>>> subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode
>>> 
>>> 
>>> ___
>>> use-livecode mailing list
>>> use-livecode@lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your
>>> subscription 

Re: Sql problem

2017-05-23 Thread Andre Garzia via use-livecode
On Tue, May 23, 2017 at 9:10 PM, William Prothero via use-livecode <
use-livecode@lists.runrev.com> wrote:

> But it looks like I could dispense with the php and directly access the
> mySQL db from my mobile app, without a cgi?


William,

You could but it is not a good security practice to expose a mysql database
to the larger internet. The internet is very hostile and keeping your mysql
server safe would be a job on its own. Best you use your php cgi or
anything else to put a wall between your database and the net.

Never, ever, expose a database server. Thats a golden rule. Now, if you're
building something that is for internal use on a LAN, business network,
intranet, then the rules are different, even though, even in this case, I
would put something in front of the database if it was up to me to make
such decision.

Cheers
andre


-- 
http://www.andregarzia.com -- All We Do Is Code.
http://fon.nu -- minimalist url shortening service.
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Sql problem

2017-05-23 Thread William Prothero via use-livecode
Andre,
This is good advice. I did it this way as a shortcut for an app I’ve built for 
myself only. You are right that it makes debugging harder because I can’t use 
other management applications to examine the contents. 

For many years now I’ve used php cgi’s to connect to the remote mysql db and it 
works well. I just haven’t spent the time to set up JSON. 

But it looks like I could dispense with the php and directly access the mySQL 
db from my mobile app, without a cgi?

Best,
Bill

> On May 23, 2017, at 3:30 PM, Andre Garzia via use-livecode 
>  wrote:
> 
> William,
> 
> If I may add a bit of personal opinion here... so, I have been using and
> storing LC stuff in databases for a long time. Not only I have been storing
> arrays in database but I had them flying over TCP sockets and being
> decoded/encoded as needed. For a long time I used the same approach as you,
> which is to arrayEncode + base64 the array.
> 
> I don't do that any longer. That combination is very hard to debug. I would
> advise you simply to use JSON and store it as JSON on the db. Instead of
> encoding the array twice, you do it only once with jsonexport() and then
> when importing, you do it only once with jsonimport()
> 
> Not only that reduces complexity but it also makes it a lot easier to
> debug. As a bonus, your data can be consumed by other applications which
> are not based on LC which may open a whole ecosystem of plugins and
> interoperation to your product.
> 
> Cheers
> andre
> 
> 
> On Sun, May 21, 2017 at 9:45 PM, William Prothero via use-livecode <
> use-livecode@lists.runrev.com> wrote:
> 
>> Never mind. I got it working. I’m not exactly sure about the problem
>> because the method I used should have been quite general. However, what
>> made it work is that I had the contents of a list field in the array I was
>> storing and that somehow caused an error when I tried to decode the array.
>> I deleted that array key, because there was no reason I needed to have it
>> in the db anyway, and it worked.
>> 
>> I’ll look into why and report back if I find anything interesting.
>> Best,
>> Bill
>> 
>>> On May 21, 2017, at 5:23 PM, William Prothero via use-livecode <
>> use-livecode@lists.runrev.com> wrote:
>>> 
>>> Whoops, I lied.
>>> The data is stored incorrectly in the simulator too.
>>> Hmm….
>>> The IDE stores it correctly. There is something in the encoding that I’m
>> missing.
>>> Bill
>>> 
 On May 21, 2017, at 5:03 PM, William Prothero via use-livecode <
>> use-livecode@lists.runrev.com> wrote:
 
 Folks:
 I have an app that stores data to a mysql database on my server. It
>> works fine in the IDE and in the iPhone simulator. However, when I load the
>> app onto the iPhone, the saved data is corrupted.
 
 I am saving an array. The array is saved in a big string that has been
>> base64 encoded.
 
 When saving, I do:
 
 put arrayEncode(tArray) into tData
 
 put base64encode(tData) into xData
 
 put urlEncode(xData) into xData
 
 xData is sent to the db
 
 When I read back the data, I do the inverse:
 
 urlDecode
 base64Decode
 arrayDecode
 
 The base64 data on the db is different when I store it from the iPhone.
>> I can see this with Navicat, which I use for db management. So, the problem
>> is in the storing of the data.
 
 What the heck? I am just using a post command to a php script that
>> writes to the db.
 
 Why would the iPhone data that is sent be different from that sent in
>> the simulator?
 
 Mac OSX 10.12.4, Livecode 8.1.4 (rc2) and XCode 8.3.
 
 Any suggestions would be welcome.
 Thanks,
 Bill P.
 
 William A. Prothero
 http://earthlearningsolution.org/
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode
>>> 
>>> 
>>> ___
>>> use-livecode mailing list
>>> use-livecode@lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
>> 
>> ___
>> use-livecode mailing list
>> use-livecode@lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
> 
> 
> 
> -- 
> http://www.andregarzia.com -- All We Do Is Code.
> http://fon.nu -- minimalist url shortening service.
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> 

Re: Sql problem

2017-05-23 Thread Andre Garzia via use-livecode
William,

If I may add a bit of personal opinion here... so, I have been using and
storing LC stuff in databases for a long time. Not only I have been storing
arrays in database but I had them flying over TCP sockets and being
decoded/encoded as needed. For a long time I used the same approach as you,
which is to arrayEncode + base64 the array.

I don't do that any longer. That combination is very hard to debug. I would
advise you simply to use JSON and store it as JSON on the db. Instead of
encoding the array twice, you do it only once with jsonexport() and then
when importing, you do it only once with jsonimport()

Not only that reduces complexity but it also makes it a lot easier to
debug. As a bonus, your data can be consumed by other applications which
are not based on LC which may open a whole ecosystem of plugins and
interoperation to your product.

Cheers
andre


On Sun, May 21, 2017 at 9:45 PM, William Prothero via use-livecode <
use-livecode@lists.runrev.com> wrote:

> Never mind. I got it working. I’m not exactly sure about the problem
> because the method I used should have been quite general. However, what
> made it work is that I had the contents of a list field in the array I was
> storing and that somehow caused an error when I tried to decode the array.
> I deleted that array key, because there was no reason I needed to have it
> in the db anyway, and it worked.
>
> I’ll look into why and report back if I find anything interesting.
> Best,
> Bill
>
> > On May 21, 2017, at 5:23 PM, William Prothero via use-livecode <
> use-livecode@lists.runrev.com> wrote:
> >
> > Whoops, I lied.
> > The data is stored incorrectly in the simulator too.
> > Hmm….
> > The IDE stores it correctly. There is something in the encoding that I’m
> missing.
> > Bill
> >
> >> On May 21, 2017, at 5:03 PM, William Prothero via use-livecode <
> use-livecode@lists.runrev.com> wrote:
> >>
> >> Folks:
> >> I have an app that stores data to a mysql database on my server. It
> works fine in the IDE and in the iPhone simulator. However, when I load the
> app onto the iPhone, the saved data is corrupted.
> >>
> >> I am saving an array. The array is saved in a big string that has been
> base64 encoded.
> >>
> >> When saving, I do:
> >>
> >> put arrayEncode(tArray) into tData
> >>
> >> put base64encode(tData) into xData
> >>
> >> put urlEncode(xData) into xData
> >>
> >> xData is sent to the db
> >>
> >> When I read back the data, I do the inverse:
> >>
> >> urlDecode
> >> base64Decode
> >> arrayDecode
> >>
> >> The base64 data on the db is different when I store it from the iPhone.
> I can see this with Navicat, which I use for db management. So, the problem
> is in the storing of the data.
> >>
> >> What the heck? I am just using a post command to a php script that
> writes to the db.
> >>
> >> Why would the iPhone data that is sent be different from that sent in
> the simulator?
> >>
> >> Mac OSX 10.12.4, Livecode 8.1.4 (rc2) and XCode 8.3.
> >>
> >> Any suggestions would be welcome.
> >> Thanks,
> >> Bill P.
> >>
> >> William A. Prothero
> >> http://earthlearningsolution.org/
> >>
> >> ___
> >> use-livecode mailing list
> >> use-livecode@lists.runrev.com
> >> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> >> http://lists.runrev.com/mailman/listinfo/use-livecode
> >
> >
> > ___
> > use-livecode mailing list
> > use-livecode@lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



-- 
http://www.andregarzia.com -- All We Do Is Code.
http://fon.nu -- minimalist url shortening service.
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: Sql problem

2017-05-21 Thread William Prothero via use-livecode
Never mind. I got it working. I’m not exactly sure about the problem because 
the method I used should have been quite general. However, what made it work is 
that I had the contents of a list field in the array I was storing and that 
somehow caused an error when I tried to decode the array.  I deleted that array 
key, because there was no reason I needed to have it in the db anyway, and it 
worked.

I’ll look into why and report back if I find anything interesting.
Best,
Bill

> On May 21, 2017, at 5:23 PM, William Prothero via use-livecode 
>  wrote:
> 
> Whoops, I lied.
> The data is stored incorrectly in the simulator too.
> Hmm….
> The IDE stores it correctly. There is something in the encoding that I’m 
> missing.
> Bill
> 
>> On May 21, 2017, at 5:03 PM, William Prothero via use-livecode 
>>  wrote:
>> 
>> Folks:
>> I have an app that stores data to a mysql database on my server. It works 
>> fine in the IDE and in the iPhone simulator. However, when I load the app 
>> onto the iPhone, the saved data is corrupted.
>> 
>> I am saving an array. The array is saved in a big string that has been 
>> base64 encoded.
>> 
>> When saving, I do:
>> 
>> put arrayEncode(tArray) into tData
>> 
>> put base64encode(tData) into xData
>> 
>> put urlEncode(xData) into xData
>> 
>> xData is sent to the db
>> 
>> When I read back the data, I do the inverse:
>> 
>> urlDecode
>> base64Decode
>> arrayDecode
>> 
>> The base64 data on the db is different when I store it from the iPhone. I 
>> can see this with Navicat, which I use for db management. So, the problem is 
>> in the storing of the data. 
>> 
>> What the heck? I am just using a post command to a php script that writes to 
>> the db.
>> 
>> Why would the iPhone data that is sent be different from that sent in the 
>> simulator?
>> 
>> Mac OSX 10.12.4, Livecode 8.1.4 (rc2) and XCode 8.3.
>> 
>> Any suggestions would be welcome.
>> Thanks,
>> Bill P.
>> 
>> William A. Prothero
>> http://earthlearningsolution.org/
>> 
>> ___
>> use-livecode mailing list
>> use-livecode@lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription 
>> preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> 
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: Sql problem

2017-05-21 Thread William Prothero via use-livecode
Whoops, I lied.
The data is stored incorrectly in the simulator too.
Hmm….
The IDE stores it correctly. There is something in the encoding that I’m 
missing.
Bill

> On May 21, 2017, at 5:03 PM, William Prothero via use-livecode 
>  wrote:
> 
> Folks:
> I have an app that stores data to a mysql database on my server. It works 
> fine in the IDE and in the iPhone simulator. However, when I load the app 
> onto the iPhone, the saved data is corrupted.
> 
> I am saving an array. The array is saved in a big string that has been base64 
> encoded.
> 
> When saving, I do:
> 
> put arrayEncode(tArray) into tData
> 
> put base64encode(tData) into xData
> 
> put urlEncode(xData) into xData
> 
> xData is sent to the db
> 
> When I read back the data, I do the inverse:
> 
> urlDecode
> base64Decode
> arrayDecode
> 
> The base64 data on the db is different when I store it from the iPhone. I can 
> see this with Navicat, which I use for db management. So, the problem is in 
> the storing of the data. 
> 
> What the heck? I am just using a post command to a php script that writes to 
> the db.
> 
> Why would the iPhone data that is sent be different from that sent in the 
> simulator?
> 
> Mac OSX 10.12.4, Livecode 8.1.4 (rc2) and XCode 8.3.
> 
> Any suggestions would be welcome.
> Thanks,
> Bill P.
> 
> William A. Prothero
> http://earthlearningsolution.org/
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Sql problem

2017-05-21 Thread William Prothero via use-livecode
Folks:
I have an app that stores data to a mysql database on my server. It works fine 
in the IDE and in the iPhone simulator. However, when I load the app onto the 
iPhone, the saved data is corrupted.

I am saving an array. The array is saved in a big string that has been base64 
encoded.

When saving, I do:

put arrayEncode(tArray) into tData

put base64encode(tData) into xData

put urlEncode(xData) into xData

xData is sent to the db

When I read back the data, I do the inverse:

urlDecode
base64Decode
arrayDecode

The base64 data on the db is different when I store it from the iPhone. I can 
see this with Navicat, which I use for db management. So, the problem is in the 
storing of the data. 

What the heck? I am just using a post command to a php script that writes to 
the db.

Why would the iPhone data that is sent be different from that sent in the 
simulator?

Mac OSX 10.12.4, Livecode 8.1.4 (rc2) and XCode 8.3.

Any suggestions would be welcome.
Thanks,
Bill P.

William A. Prothero
http://earthlearningsolution.org/

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode