Page 1 of 1

Data storage

Posted: Wed Feb 12, 2014 2:00 pm
by carel
I've written a little program for a school that runs on their network.

I've done the following to store data: I create / edit a file on a network share called lessons.txt that looks like this:

lesson name a*1
lesson name b*2
lesson name c*3

The * is the delimiter and the numbers in the second columns is the filename - in other words lessons.txt is in /sharename and in /sharename/lessons is file 1, 2, 3 etc. When a new lesson is created, I look for the highest valued filename and then just add 1 to it to create the new lesson, when a lesson is deleted, I simply remove the line of the lesson from lessons.txt and delete the file 2 for example, then I just have file 1,3 and 2 is never used again (I'm sure filenames can go into billions?)

I'm adding users now and I'm just wondering if there is a better way to store the data, without using sql? ie. something similar that what I have explained here.

Remember that many computers will read from the network, although only the teacher will create lessons, etc. That is until I get to storing reports as well when a student complete a lesson (file access problems?)

Thanks,

Carel

Re: Data storage

Posted: Wed Feb 12, 2014 2:25 pm
by carel
I was just thinking about security and an alternative way of doing it.

Security:
Hidden share? - not very secure, but hey there is companies that has their whole accounting books in a normal shared folder.
Give all the files .exe extension? (don't laugh)

Alternative:
Have a "server" program run on the server, with a data grid (I haven't used one yet) and then "clients" connect to the server listening on a port? (I've also never done anything remotely complicated as this)

Thanks,

Carel

Re: Data storage

Posted: Wed Feb 12, 2014 8:38 pm
by Simon
Hi Carel,
Not sure about the need for security as they are lessons that one would want people to see. Aside from that, lookup encrypt/decrypt very easy to use.

The longest path to a file is 256 characters, that includes your filename so naming of files must be less then that (no infinite length filenames) .

As this gets bigger you'll want descriptions of the lessons, maybe a separate file? Really will need backups.

Basic up and running sqlite takes a day of learning with liveCode and this http://www.w3schools.com/sql/default.asp. Enough to track teachers/lessons. If you have 10 teachers and 100 lessons then not really needed but a great tool to learn. Don't forget sqlite is built into liveCode, you don't have to do anything except check a box in the standalone settings.

2 cents
Simon

Re: Data storage

Posted: Thu Feb 13, 2014 3:53 pm
by carel
Thanks Simon,

I think I must stop being so lazy and just learn SQL. Will all the clients be able to access the database by pointing it to \\server\share\database.mdb without sql running on the server?

The server IS probably running sql, but I don't want my program to be reliant on any third-party services etc. (and not cause problems with it as well).

Thanks,

Carel

Re: Data storage

Posted: Thu Feb 13, 2014 11:31 pm
by Simon
Hi Carel,
Getting mySQL (for multiple users) running on a server is not a beginner task. Well, on-rev/cpanel made it easy for me but I don't know what you have. I just started with the sqLite lesson and worked on it locally then moved to mysql on my server. If you don't have control of the server then best to get IT involved (warning!).
Will all the clients be able to access the database by pointing it to \\server\share\database.mdb ...
Can't really answer that Yes or No, way too specific. With all conditions met then yes.
...without sql running on the server?
Not sure what you mean here, you will want to run mysql... err... to have a database.

No, I'm not a server admin who knows all the ins and outs. Maybe I just got lucky with my setup and fortunately everything fell into place after plenty of studying.
Have a "server" program run on the server, with a data grid (I haven't used one yet) and then "clients" connect to the server listening on a port?
I think you can ease up a bit here... "listening on a port" that is a bit over the top as it has a specific meaning not related to what you should need for this. Just build the whole thing on your local machine see that it's running correctly and when ready for the server, change over all your "put url("file:" & blah/blah.txt ..." to point to the server "put url("file: \\server\share\blah\blah.txt ..."

Simon