How does a webapp save files to its server? - database

I'm building a webapp where one can develop documents within the web browser (e.g., something like Zoho's document tool, or Google Docs). In my case, I have a set of arrays that store different paragraphs and other pieces of information, along with parallel arrays that store metadata on the paragraphs themselves.
The entire webapp is written in jQuery and associated libraries / plugins.
Is there an elegant way for me to save this as a file on the server itself? So far, I've been recommended using a hidden form to POST the arrays to the server and store them in a NoSQL database of some sort... This feels a bit painful to me and I'm wondering if (1) there is a more elegant approach, or (2) there is a library / framework that automates some of the sending / POSTing / saving.
Thank you!

You would need to create services that live on the server itself. These services would be methods such as (just as a simple example)
SaveDocument(User, Document)
GetDocument(User, Document)
you would need to configure your web app to call these services and pass in the required parameters. Now as for how to do this, you could write the services in any number of languages (Java using JavaEE, C# using WCF to name a few, but you can also do this in python/ruby/etc) and then generate WSDL interfaces to the services that any number of other languages could call.
There are lots of resources available on the web that cover this, so pick a language you want to learn, or are already proficient in and google around on how to develop web services in that language.
Good luck!

Related

Is it alright to write a software creates a roster for a restaurant with JAVA language?

I need some advice on the project im working for fun during the summer. Say im writing a software that helps creating the roster base on the availiabilities of the staffs. I need some advice on how to implement these items below:
A database that holds the infomation of the staffs (ie.
availiabilities, minimum hours, maximum hours).
The core of the software where the process of arranging staffs on a day base on the database.
A GUI that displays the final version of roster after step 2 above so it can be printed out by the manager.
Im thinking of using Java but not sure how i to implement and connect the database, the core and the GUI together? Can i do everything listed using Java?Can anyone please suggest me a solution or an article for this?
There are many different paths you could follow, depending on what your end goals are.
DO you want to learn Java or are you just trying to practice application development ? I am assuming you are interested in an application that runs on the web.
For me, the best choices are either Java or PHP, but this is largely based on my own experiences. Others might argue that Python or Ruby would be a better to start.
For a Java based solution, you would use: Java JSPs with HTML for the front end (Javascript and JQuery optional); Java (Servlets) for the middle tier; JDBC, JPA, Spring, and/or Hybernate to connect to the DB; MySQL is a good candidate for the DB, but there are other options.
For a PHP based solution, you would use: PHP, HTML for the frond end (Javascript and JQuery optional); PHP for the middle tier (there are frameworks you coulse here as well); PHP to connect to the DB; MySQL is a good candidate for the DB, but there are other options.
If you dont know either, I think PHP is easier to setup and run for beginners, and is the basis for many open source and commercial web applications (e.g., WordPress); but Java is used for most large scale applications.

How to develop a simple database based project

I want to start an information provider service. It works this way:
Some employees will find the information needed and fill a database manually.
Users will request data they need on their client side apps on their own platforms. Some of the project specifications is as follows: 1) Data that will go between database server and clients is really small(Suppose some ordinary images). 2) The client side apps don't need to be kept updated. Once the user of app clicks update button(for example) the app will request the server to send required information. 3)It's important to run client side apps on several platforms like: windows, windows phone, android, ios,... 4) Database doesn't need to be vary fast or vary big.
Note: And It's important to note that I'm not expert and I have some limitations. I know java and html, css, javascript. But I think those are enough for this project. (Am I right?)
So I decided to design this development architecture:
1)Using hibernate and provide a layer for server which stands above hibernate and is used to do database-specific tasks. This layer provides some protocols for client side apps to communicate with server. It enables me to change database later without changing client side apps. 2)Using PhoneGap which is a framework that uses html, css, javascript and produces apps for many platforms.
I really appreciate any suggestion, comment,... Thanks!
The fastest way in Java world would be spring boot. Basically you can configure whole application: datasource, orm, persistance layer and rest services just by adding proper annotations. There are many examples of how to do it. Basically with current implementation of spring jpa and web services you can bind mapped resources to rest services. Also current JPA can generate SQL for you using DAO method name. SO e.g. findPersonByName will generate proper sql for you (of course you need to map your db model in entities but this is also simply done with annotations).
Yes, this is a sufficient tech stack to accomplish your goal. You will have to decide how much logic to implement server-side vs app-side.
Pick a java framework for providing an API so that you can expose a restful API to your apps.
Here are a couple of comparisons from stack overflow:
Which is the best Java REST API?
Easiest frameworks to implement Java REST web services
no! for database you need server side scripting language, like php or perl, java-script is client side and will only work on browser. i recommend first learning mysql database, just the basics how to create Db, table, insert and fetch. then some PHP. i think these will set the ground for your project. '
for development environment : download XAAMP! it comes complete with Sql-database base and PHP.

Publish one product to multiple sites

Is there a way to have one product definition and have it publish to multiple sites? I am looking for this ability specifically in DNN or Umbraco, either with free or paid extensions. I did install both the platforms and played with the free extensions and looked for any extension offering such functionality but did not find one. Any links or pointers are highly appreciated!
I had looked up for this info in many places before reaching over to the expert pool here, hoping to get some hints;
In umbraco there is the built in /base extension (http://our.umbraco.org/wiki/reference/umbraco-base) which enables you to access product data that is maintained in Umbraco from other websites. Base is REST-ish so the implementation is well documented - you can access the data as XML or JSON (Returning Json instead of XML with Umbraco Base).
Also as the implementation is REST-ish the other websites that consume the content maintained in the core site could be written in anything that can consume a REST feed eg html & javascript.
It's not 100% clear to me what setup you're after, but if you're looking to set up a traditional Authoring/Delivery configuration - one of the few paid offerings Umbraco has is called Courier. It's a very reasonably priced (~$135USD,/99EUR) deployment manager that handles syncing content between two sites, i.e., Authoring and a Delivery server.
It's a very smart tool that manages content, configuration, and dependencies. It's neat and also supports a great open-source project!
If you're looking to setup something more like a centralized product database that is used by many sites - amelvin is on good pointer with BASE. They have a nice api where you may also set up your own webservice (beyond their own webservice functaionality!).
If you need this centralized product data to notify the other sites to update their caches - i encourage you to look into the 'distributedCall' functionality.
There's a bit of documentation on distributed calls in this load-balancing tutorial that may help understand the concept a bit better.
...Hope this helps get pointed in the right direction.

Is it possible to create a database driven website with flash?

I am a newbie programmer and i dont yet have any idea of the WEB. I wish to start learning a technology that will allow me to build websites( database driven) i dont know which one to choose. I know some actionscript3 and flash.
Is it possible to create a database driven website using these alone? Or do i need to learn any other technology? If i do then what should i learn? I know j2se for the desktop and oracle SQL/MySQL
please show me a path. Also wanted to know if there is any technology like Wordpress for J2EE/flash
OK so i finally got the feeling that i need to learn PHP anyway along with css and javascript. So it is fine. Also another query. Which CMS should i consider? Wordpress or Joomla?
You can develop a database driven website using Flash, but only in the same sense that you can develop a database driven website using AJAX. That is, you can build the front-end using Flash/ActionScript but the back-end is built using other technologies. Just like working with JavaScript to develop a front-end, from ActionScript you would be communicating with Java or PHP or Python or something on the server using RESTful calls and then actually working with the database in the server-side scripts.
Honestly = this question is too broad and generic, and answers are easily found with some google searches.
That being said = of course you can build a data driven flash site. The one caveat here is that flash itself is fundamentally client-side technology, so we must rely on other remote tech to do the heavy data lifting. The options are profuse.
For example, a developer might create a front facing presentation in Flex, which is the streamlined, data-centric extension of pure flash. His database interactions are written in php, and these are constantly called upon to deliver content to the user.
So - what technologies to use? Whatever you know. And if you don't know, then learn the ones that are closest to what you know.
Finally, although I am a die-hard fan of flash, this type of project (you didn't specify what you had in mind) could be done with many different technologies. So - maybe flash is the right answer, but maybe javascript (ajax) could manage the same thing and do it without the need of plugins.
Yes you can develop database driven site in flash/action script but you still need and back-end technology i recommend you to check WebORB you can develop the back-end using Java, PHP, or .NET In addition you can use Flash Remoting technology Flash/Flex to communicate with a back-end
Flash can't be directly connected to database. You must use another technique which would be "mediator". I have developed Flash game with MySql database and PHP and I recommend you to use this combination. Here is visually presented this kind of communication: http://www.youtube.com/watch?v=gRi-oxjFfCU
yes, it is possible to crate database driven website with flash and action-script. You would get an XML file when you do action script in flash, so you can store nodes of that XML file into database(mysql). You can then create an Admin interface to manage your database contents, that would indirectly change your xml nodes. So basically you can edit the xml file and store it in the database.

Language/Framework support for Interacting With CouchDB

I am interested in knowing if there are any server-side web application frameworks which integrate nicely with CouchDB? Does anyone have any experience in doing this? It seems like a dynamic language would be well-suited for playing with the JSON, but I am more interested in hearing about how it would fit in with the framework and the application's design.
Two frameworks that I would suggest for CouchDB are Ruby on Rails and Django. Both have a small file you can include that allows for easy interaction with CouchDB. For Ruby/Rails, this gives you the ability to write code that looks like this (code snippets yanked from here):
# Create the database
server = Couch::Server.new("localhost", "5984")
server.put("/foo/", "")
# Insert a new document into the database
doc = <<-JSON
{"type":"comment","body":"First Post!"}
JSON
server.put("/foo/document_id", doc)
# Get the document back later
res = server.get("/foo/document_id")
json = res.body
puts json
Python/Django lets you do the same with a relatively minimal amount of work (see here). Both of these aren't at the web framework level but they require a minimal amount of work to set up and are pretty easy to get going in Rails and Django. The Django approach still requires some packages to be installed so if you just can't do that for some reason the Rails approach is the way to go.
Another good how-to on Python on Django can be found here (also lifted from the CouchDB FAQ).
The only web framework that dedicates itself to CouchDB is currently CouchDBKit for Python.
Check out the official wiki page that lists how to get started in your language:
http://wiki.apache.org/couchdb/Basics
Pick the language and framework that suits you best and then use one of the light CouchDB libraries with it.
It seems that things are move quite quickly at the moment for CouchDB. I'm sure there will be more frameworks out there soon with CouchDB support. I'm currently looking into building one for PHP.
I have had good success with jcouchdb for Java and CouchApp for JavaScript and CouchDBKit with Python. All of these are actively developed, open source and well designed and easy to enhance if they are missing something you really need. I have submitted patches and feature enhancements for jcouchdb and couchapp both.
Actually, you don't really need such a framework. Instead, you can just write the whole web application in CouchDB. It allows you to generate HTML files, or any other XML derived format, and you can even use HTML-templates. I consider this a good choice, because JavaScript is a rich and flexible language. On the other hand you don't have the overkill of a connection between the database and your web application.
For more details, check out: http://books.couchdb.org/relax/design-documents/shows
There's also a related question: Using CouchDB to serve HTML
Depending on what you want to build CouchApp may be something to look at: It's specially designed for writing apps with CouchDB:
https://github.com/jchris/couchapp/wiki/manual

Resources