Author Topic: Javascript offline 'Web'app with 'database'  (Read 5219 times)

0 Members and 1 Guest are viewing this topic.

Offline matthias1992

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 408
  • Rating: +33/-5
    • View Profile
Javascript offline 'Web'app with 'database'
« on: May 07, 2011, 08:35:02 pm »
Hi there,

Its been quite a time...
simply put, school sucks.

Anyway, I have been asked to develop (if I could) a application for the (i)Mac (OS X) that manages a shop's stock. So basically someone has to be able to see how many stock is left of a certain product, how much its worth etc. But for now its just that simple. Problem is, I don't have a mac and its quite a hassle to get anything platform independent actually working. So I thought, lets be smart for the sake of change...why not make it a Webapp? However since I own no server I would like to make the webapp offline. Basically the app is a 'executable' html file. Well that idea works fine, point is, I need to READ & WRITE .txt files from an offline 'app' so that I can keep the stock up to date.

Say for example there were nine chairs in stock. The shop gets a request for four chairs and registers in my 'app' that four chairs have been sold. Well that change of data needs to be recorded thus I need to write to a txt file (with some sort of improvised delimitation to keep different pieces of info seperate). For the same reason I may need to import the database every time after I shut down the app, thus i need to read the txt file.

it boils down to this, reading and writing .txt files offline using html5 and/or javascript. If its not possible at all I can of course actually host the site at 000's site but for security reasons and the lack of server reliability (plus it makes the app internet dependent) i'd rather not.

Any help is greatly appreciated, examples too, layman's language even more! I don't know if I will get paid for this but if I do and you guys can help me out I'll be sure to cash in some money to omnimaga as a sign of appreciation. Only if I get paid for this 'job' eventually of course...

Thanks!!
MASM xxxxxxxxxx aborted | SADce ====:::::: 40% -Halted until further notice| XAOS =====::::: 50% -Units done| SKYBOX2D engine ========== 100% -Pre-alpha done. Need to  document it and extend |

~Those who dream by day are cognizant of much more than those who dream by night only. -Sir Edgar Allen Poe-

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Javascript offline 'Web'app with 'database'
« Reply #1 on: May 07, 2011, 09:33:00 pm »
It's really not practical to use Javascript for saving information. You can use it to download files, but that would get really nasty (imagine a download prompt every time you want to update something, as well as an upload prompt every time the webapp starts up to retrieve information).

And then there's the issue of what it's for: A Javascript webapp is an independent script. If you run it on one computer, it saves it there. If you run it on another computer, you start from scratch and save it there. There's no way to collaborate in pure Javascript without a server, so unless you're willing to constantly send manual updates to everyone involved, you'd have as many different versions as you'd have users.

Basically, the problem is this. Javascript is a client scripting language, meaning it's meant to do little tricks like flash a little animation or prettify a web page. What you need (from what I understand from your post) is a server script, which gets information from users (such as through a form) and stores it in a true database on the central server. You talk about making an offline webapp, but IMHO that's just impractical -- sorry :-\ (Plus it defeats the point: a webapp, by definition, is an app on the web.

If you want to keep it offline, you should try making an app in C(++)/Python/Java. Macs have all three languages installed by default (GCC through XCode). If you need help with that just ask around :)

EDIT: Whoa, topic got locked while I was posting. Didn't notice until I finished, sorry 'bout that.
« Last Edit: May 07, 2011, 09:34:09 pm by Deep Thought »