iOS remote MySQL database, technology recommendation - java

There is web application, journalism related, that uses MySQL databases and presents a web based interface to users.
I want to build a iOS app that does a mobile interface as well. The UI is pretty easy and I have experience with that.
The problem is with the database, which I have no experience with.
I will be learning about databases and probably take the Coursera course on it. I am not asking you to teach me that. I just wanna know which technologies I should invest my time in over the next couple months.
My understanding so far is that the app should not talk to the database directly,
but rather there should be some one on the server talking to the database on behalf of the App.
This is the question and the part I want to understand clearly, so correct me if I am wrong.
I will have to write some sort of a unix program that runs on the server and talks to the db and then communicates back to app? how? using a web view? Using unix sockets to talk to the app? ssh? Which one is cool with Apple?
My preference for writing something like that on the server would be: python(have experience), java(have experience), and maybe ruby(no experience). I'd prefer to avoid scripting languages.
Are they ok? Which one is best suited? Also is this middle dude going to have to be on the same server that has the database or can be another machine on the internet(i'd prefer this, so i can put it on my own VPS and not have to screw up with the server machine)

This is similar to another question from tonight, but you're coming at it from a different angle.
In general terms, an iOS application that needs to be able to run in offline mode will need to have its own database. This means creating Core Data models to store all of the data required by the application. Internally this is stored in a SQLite database.
If you want to make an application that's online-only, it's somewhat easier since you won't need to worry about the Core Data part and can instead focus on building your service API. If you're familiar with Python then your best bet is Django to provide that layer. You'll need to implement a number of endpoints that can receive requests, translate that into the appropriate database calls, then render the result in a machine readable format.
Scripting languages are what power most back-ends even for massive scale systems. In most cases the database will be the bottleneck and not the language used to interface with it. Even Twitter stuck with Ruby until they hit tens of millions of active users, so unless you're at that level, don't worry about it.
For most applications, using HTTP as your transport mechanism and JSON as your encoding method is the way to go. It's very simple to construct, easy to consume, and fairly easy to read. There are probably a number of ways you might go about reading and writing this, but that's another question.
For small-scale applications where the number of users is measured in the hundreds then you can host the application and database on the same server. Even a modest VPS with 512MB of memory might do the job, though for heavier loads you might want to invest in a 1GB instance. It really depends on how often people are accessing your application and what the peak loads are like.

Related

Usability: How do I provide & easily deploy a (preferably node.js + MongoDB based) server backend for my users?

I'm currently planing an application (brainstorming, more or less), designed to be used in small organizations. The app will require syncronization w/ a backend-server, e.g. for user management and some advanced, centralized functionality. This server has to be hosted locally and should be able to run on Linux, Mac and Windows. I haven't decided how I'm going to realize this, mainly I simply don't know which would be the smartest approach.
Technically speaking, a very interessting approach seemed to be node.js + mongoose, connecting to a local MongoDB. But this is where I'm struggeling: How do I ensure that it's easy and convienient for a organization's IT to set this up?
Installing node.js + MongoDB is tedious work and far from standartized and easy. I don't have the ressources to provide a detailled walthrough for every major OS and configuration or do take over the setup myself. Ideally, the local administrator should run some sort of setup on the machine used as server (a "regular" PC running 24/7 should suffice) and have the system up and running, similar to the way some games provide executables for hosting small game-servers for a couple friends (Minecraft, for instance).
I also thought about Java EE, though I haven't dug into an details here. I'm unsure about whether this is really an option.
Many people suggest to outsource the backend (BaaS), e.g. to parse.com or similar services. This is not an option, since it's mandatory that the backend will be hosted locally.
I'm sorry if this question is too unspecific, but unfortunately, I really don't know where to start.
I can give you advice both from the sysadmin's side and the developers side.
Sysadmin
Setting up node.js is not a big task. Setting up a MongoDB correctly is. But that is not your business as an application vendor, especially not when you are a one man show FOSS project, as I assume. It is an administrators task to set up a database, so let him do it. Just tell them what you need, maybe point out security concerns and any capable sysadmin will do his job and set up the environment.
There are some things you underestimate, however.
Applications, especially useful ones, tend to get used. MongoDB has many benefits, but being polite about resources isn't exactly one of them. So running on a surplus PC may work in a software development company or visual effects company, where every workstation has big mem, but in an accountant company your application will lack resources quite fast. Do not make promises like "will run on your surplus desktop" until you are absolutely, positively sure about it because you did extensive load tests to make sure you are right. Any sensible sysadmin will monitor the application anyway and scale resources up when necessary. But when you make such promises and you break them, you loose the single most important factor for software: the users trust. Once you loose it, it is very hard to get it back.
Developer
You really have to decide whether MongoDB is the right tool for the job. As soon as you have relations between your documents, in which the change of of document has to be reflected in others, you have to be really careful. Ask yourself if your decision is based on a rational, educated basis. I have seen some projects been implemented with NoSQL databases which would have been way better of with a relational database, just because NoSQL is some sort of everybody's darling.
It is a FAR way from node.js to Java EE. The concepts of Java EE are not necessarily easy to grasp, especially if you have little experience in application development in general and Java.
The Problem
Without knowing anything about the application, it is very hard to make a suggestion or give you advice. Why exactly has the mongodb to be local? Can't it be done with a VPC? Is it a webapp, desktop app or server app? Can the source ode be disclosed or not? How many concurrent users per installation can be expected? Do you want a modular or monolithic app? What are your communication needs? What is your experience in programming languages? It is all about what you want to accomplish and which services you want to provide with the app.
Simple and to the point: Chef (chef solo for vagrant) + Vagrant.
Vagrant provides a uniform environment that can be as closed to production as you want and Chef provides provisioning for those environments.
This repository is very close to what you want: https://github.com/TryGhost/Ghost-Vagrant
There are hundreds of thousands of chef recipes to install and configure pretty much anything in the market.

What do people mean when they say back-end Java with front-end PHP or something? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I've been programming for a while now, and I am pretty familiar with Java and PHP and websites. What I'm confused about is how programmers use them together. I hear about how Facebook and Google use all sorts of languages like Python, C, Java, PHP all for one product, but I'm just confused on how that would be possible.
Also, another side question:
What work exactly do software engineers do when working for large online companies like Twitter and Facebook? Most of the code deals with database and information, and so what major level programming, besides what can be learned online with a few tutorials, needs to be done on the server side?
This is an incredibly broad question, but here's a shot at a vague answer. Often times large applications will have a number of components. For instance, you may have some sort of reporting engine, business logic, web interface, desktop interface, web service API, mobile interface, etc, etc, etc. Each of these could, in theory be written in a different language and communicate via a database or something like a web service.
To your second question. At large companies there is a great deal of work to be done to maintain stability, develop new features, fix bugs as they are discovered and work to increase efficiency etc. Facebook, for instance (and Google) employs a large number of software engineers to help them deal with the massive amounts of volume they receive on a daily basis.
Edit Here's a bit more clarification and a direct answer to your question.
Most of the code deals with database and information, and so what major level programming, besides what can be learned online with a few tutorials, needs to be done on the server side?
The truth is, for the most part, the high-level principals are the same. You could pretty easily build a Facebook clone after doing some basic PHP/MySQL tutorials on the web. Here's the difference: your clone would die before it reached a fraction of the users Facebook sees on a daily basis. It would be slow, unreliable and people would leave because their data would be consistently hacked through SQL injection and other malicious attacks. And that's not even talking about distributed computing. So, yes, from a high-level, that's all you need to know. The implementation and reality is much, much more complex.
As you might expect, larger "websites" are not built in the traditional sense that you have some PHP code, a few HTML templates and a database, since this kind of architecture has severe issues scaling to thousands of concurrent users.
What you can to to mitigate this is split the website out in several components:
Load balancers that distribute requests to several App servers
App servers which generate the UI and handle user actions
Middleware servers that handle business logic and distribute it among DB servers
DB servers that store data in some way
Every component of this system might be implemented in a different language and you might even have different app servers depending on request type (e.g. mobile devices).
This type of system is called Multitier Architectures. You can also find academic books on this topic.
Most complex products consist of numerous pieces. For example, StackExchange has code that runs in your browser that's written in JavaScript so it can run in your browser. But the code that builds the web pages doesn't run in a browser and so isn't written in JavaScript. And if complex database queries are needed, they're likely to be in SQL. And so in. Each piece of the big puzzle is implement in the language most appropriate for what that piece does and the environment in which it runs.
Thank about GMail. There's a in-browser piece that's written in JavaScript. There's also a web server, a database, a mail server, a bulk storage system, indexing, and many, many other pieces.
this is the actual answer you are looking for
you are confused because you dont see how using the C and C++ applications in websites but I want to tell you that, they are used for many things... like, when you upload a image in facebook containing pornographic content, then php wont validate that image, what they will do is that execute a program by passing the address of that image by parameters and that application will validate the image... and some data should be stored for future use, so that application uses the common database that the site is using, if we upload a image in googleplus, then it will load tag sugestion to some part where people's faces are seen, it is done by that app, it will save the image data to the common database which google is using and php takes that information from there, this is the technique of developing much more functional websites...
like, i have made a program to shutdown my home computer while working on localhost:
<?php
$command="shutdown -s -f -t 5";
shell_exec($command);
?>
this script once run in apache will shut the server down similarly you can pass the parameters into some apps like if you want to create email account in command line for your own server which dont have Cpanel installed...
and the answer of second part of your question:
actually software engineers are hired so that they will develop some apps that can be run in a server for increasing the functionality of the website... like if there would be only webscripting language for websites, then google couldnot recognise the face neither facebook, and artificial intillegence would not be possible for websites..
this post may clear your confusion...

Need to replace complex MS Access by JAVA / Oracle or MySQL

Hi DB experts out there,
what do you SQL experts recommend to substitute a couple of MS Access databases by s.th. more modern like JAVA / Oracle or JAVA / mySQL?
The databases are small, not more than a few thousand records each. so there is no need for performance speed on the DB side.
But all of the MS Access stuff has complex forms with colors (for information purposes), details, nested sub-forms and a lot of nested queries.
Since MS Access is hard to debug and misses modern development tools as those in Eclipse I think about a redesign of the old stuff.
Said with other words, what is the best way to substitute especially forms?
Is Java Swing a good library to rebuild all the form stuff?
Or should I stay with the old stuff?
It depends how much time you want to spend on your new-design and who is using MS Access.
As you said, your MS Access db is very complex. If you want to replace this with mysql/oracle, it may take you long time to redesign the presentation layer (as you said, colors, details and so on.)
If you have time, you can design as totally new MVC framework project instead of old MS Access by using all new technologies. And you can learn a lot.
Not really a db question, the forms side of it is access as an application language not a database, whatever you choose you are looking at a good deal of work in Java if that's your application language choice.
This is a serious question: can it look like crap? Whatever tool you use, you'll probably want some kind of form-generation support (just to move things along). Form generation tools are all bad. It's a rule. But, they're bad in different ways. Also, having said that, I've never used one for Swing, as my desktop app forms were easy enough to build by hand. JFormDesigner looks feature rich and has some good-looking forms to boot (but because of the rule, we know you'll hate something about it).
If you want to stay with the old stuff, I recall that you used to be able to use access on the front end and connect to a different database server (SQL server). Depending on what year the access system is, you may have to replace immediate if (IIF) statements and do some other translation, but it would give you a database that makes troubleshooting queries a little better.
I guess only you can decide "why" you want to do this. If it not broke, then why fix it?
You can use source code control with Access if you want. I cannot say the debugging tools in Access are great, but then most Access applications tend to not have tons of code anyway. (much of the forms etc. work without code). And the report writer has received some upgrades that makes it even better – still one of the best around.
And Access 2010 has web like controls and effects now, so your screens can look like this:
Even the above round buttons and shadow effects where built using ONLY the tools inside of Access. So the new design options are quite extensive.
Same goes for the new navigation system you see on the left side. (no thrird party tools were used for above. So here is a SMALL sample screen shot of some new design options:
Also +1 for those here that pointed out that moving the data to MySql or some such is NOT the same as what you going to develop the application with.
Access is more of the development tool and part then that of the just some tables. The tables can be sent off to darn near any system like SQL server, MySql etc.
The problem and question and challenge is that of building the application part with the code and logic.
Speaking of SQL server, Access 2010 has baked in support for the cloud edition of SQL server. So Access works with SQL Azure. So if you looking for a cloud play, this setup works with Access.
Access also allows your tables to moved up to the new office 365. This is a great low cost way to get into cloud computing. And the office 365 setup allows Access to go "off line" mode. This means your laptops can go out, run the Access desktop application, and when they find some wi-fi or get back to the office, they sync their data. This is a true automatic "replication" model but works without any coding on the part of the Access developer.
And if you have SharePoint, then your tables and "off line" mode works with that.
Last but not least, Access now supports web publishing of your database. This works with office 365 or SharePoint.
This web publishing is true cloud computing with unlimited number of users. The only real limits are the capacity of Microsoft's computer farm (and it is really big one!).
Access forms when web published are converted into "zammel" .net forms (XAML). The Access code you write in the forms are converted to JavaScript and in fact this code runs "browser" side. (so you are building true multi-tier applications). Your table procedures you write inside of Access go up and run server side – even on office 365 (Not even .net developers can have code run so easy on office 365 servers!)
For those who not seen the web ability, in the following video, I switch to running the Access application 100% in a web browser at the half way point:
http://www.youtube.com/watch?v=AU4mH0jPntI
Such web applications built in Access don’t' require ActiveX or Silverlight, and as such they run fine on my iPad.
So, I am not really sure if one needs to get "caught" up on all of the new buzz words.
But if you looking to using office 365 and publish web forms, then Access does this now.
And if you looking to use the latest and greatest new edition of SQL Azure that runs up in the cloud, then again Access can be used.
And if you looking to use Access with SharePoint which is really popular, then again Access can be used.
And if you want "cool" shaded buttons with cool "hover" effects, then the new Access designer has these types of choices:
So there is tons of neat-o buzzy gee wiz bang things you can do with Access. Heck you can even build custom ribbons in Access now!
However, if you have a few basic forms that work just fine now? Why not just stick with what works?
I vote for KISS.
No real need to get caught up in the latest fads, but if such is your cup of tea, Access does have lots of that "new stuff" to play with these days.

Choices for smartphone accessibility of pre-existing vb.net/sql server desktop crud application

The application is vb.net front end and sql server express backend. The networks are always cabled LANs.
Installations are small with only a few users, none of whom would have any technical knowledge.
Very little technical support is ever called for and I'd like to keep it that way.
I don't know Java or Objective C or HTML/CSS/Javascript which as far as I can see seem to be the choices for smartphone development on Android, iphone or web based application
I want users to be able to access as much of the functionality of the application as possible for the least effort both in terms of coding and acquiring new skills on my part.
I don't know where to start or which would provide the easiest path.
I don't know how to make the database available to smartphones whilst keeping it physically secure in a small office.
If all things were equal I'd probably learn towards HTML/CSS?Javascript as it seems to be the most widely applicable.
On the other hand maybe I should wait for win phone 7?
To reach the largest number of users in a device independent manner then delivery via browser is going to give you the best results for the least effort.
If you have designed you existing application with a Data Access Layer, a Business Rules Layer and a User Interface layer, this may be as simple as creating an ASP.NET UI for mobile/internet/intranet users.
If your appliciaction is not designed this way, then my approach would be to seperate out the code in you existing into these three layers, or at the very least seperate the UI layer out of the existing code. Then it just a matter of implementing a UI layer for each access method you plan to use.
That way you end up with a lot less code to maintain, and when the businees rules or backend data changes you only have to do the change in one place for all you User Interfaces.
Well, .NET Compact Framework is already avaialbe on WinMobile, so you defenitely should give it a try if you're free to choose which mobile OS to target.
If not, I suppose that for task like this it would really be better to use web interface. If you don't now HTML/CSS/JS - as for me it's not a problem but a great chance to learn new interesting trendy things! :)
I would go with a simple html app designed for a mobile screen.
Android or iphone will only get a % of your users. If you want to get them all, you would need to write in both (and then blackberry and winmo are SOL).
So without seeing the application, it is very hard to know how much work converting vn.net to something you can get at from a web browser would be... but I don't think it would be much worse than a port to android or iphone, and it will allow a much bigger market to view.
Either way, you will need to learn something new. Learning is good though, right?

Web-based or PC based for process control application?

I want to create a process control application. Events update the database and that should be reflected on the GUI.
Although I personally prefer Linux, the hard fact it that 100% of the potential customers I can imagine run Windows.
Ok, for Windows I am comfortable with C++ Builder.
I suppose I could switch to NetBeans and use Java just in case someone ever wants it cross-platform.
browser based is probably the easiest way to cross-platform (barring some disagreements between browsers).
The thing about browser-based is I am not sure how to implement it. Would I auto-refresh the page every second or so? Can a database change be propagated upwards via PHP and refresh the screen? A very basic question, but I am new to this sort of thing, coming from an embedded background.
If all else is equal, which is easier for me to implement and maintain?
If it's real-time control, and you have to respond within a very narrow time band, then web based and Java based probably won't do it. If it's real-time control problem you ought to look elsewhere for a solution.
You can certainly use the web, Java and PHP to display results as they are produced, but the actual control and persistence to a database should be done with different technology.
I'd also be careful about writing to a database. It should be an asynchronous, "write behind" capability rather than the naive, "connect to a relational database and do an INSERT" sort of thing. I think that will be too slow.
If it is desired to be multiuser apllication I prefer web applications. Easy to make changes, easy to deploy. No problem with firewall settings and etc.
About propagation of changes from server to client. No way. But you can utilize AJAX tu "ping" on server and checking if somethink is changed. And if somethink is changed then load id and change view. Facebook/Google use somethink like this for chat/googletalk and so on.
About browser differencies. You can use CSS framework, JavaScript framework and most of problems with diferencies between browsers are solved.
Edit: If it is about seconds I think that PHP, Python or somethink really easy and fast is good part on server side. Or C++ CGI module. And on database side SQLite. Lightweight and fast solution for not much complex data. ANd not to big amount of data.

Categories