Updating a Server Side Text File via Android - java

I'm building an app that needs to periodically append lines to a server side text file. So far, the best way I've come up with for doing this is using the Dropbox API, where the user has to download the text file, update it, and then upload it back - obviously this is not ideal. What would be the best (free) way to do something like this? I'd like a solution where I don't have to personally host a server, but can use some third party cloud (like Dropbox).

Google's Android Backup Service seems appropriate for this, and is free.

Related

Google Drive - push notifications content update - download

I have an application where user stores files (on the server) and on it's own google drive. I would like to reflect document changes from drive to server files. The only way of achieving this I could think of is using push notifications api for drive files and if type of notification is content update to download and replace file on server side. Is there a better way of achieving this, since notifications are being received often (almost for each letter typed) and downloading file every second doesn't seem like optimal solution.
There are many ways in which you can handle this ...
You can poll the Google Drive server for its state every minute. Figure out what changed and download it. This can help.
You can also use an existing tool or another one to solve this problem.

Java web application with S3 File Manager

I am working on a web application based on Java/JSP and I need to include a web based file explorer that connects to an Amazon S3 bucket that can handle the basic file explorer tasks such as upload, delete, rename and navigation. Any suggestions would be appreciated.
have you tried simply creating a wrapper to wrap around s3cmd ? that would be the ultra lazy way to do it. since then all the protocol handling is done for you and all you have to do is feed/parse its input and output
S3cmd is extremely well documented and pretty simple to use.

Client android application for site

I want to write a client application for a site (e.g. to read smth from site, add some comments, likes etc). I haven't got access to site sources and there isn't any API for work with it. So at my Android application I decided to parse this site (it has static pages) using : JSOUP Library
And using this library I'm going to write unofficial, but API for my purposes to work with this site, and then use it in my Android application.
Can somebody tell me, is this good practice or there are better ways to do? Is this good idea at all to parse site in Android device.
As I wrote in comment - in general building your own application on top of the third party www service is not a good idea. If you want to do it anyway you have 2 options:
Use jSoup (or any other html parser if exists) and parse third party content on the device
Set up some middleware server to parse content and serve it in some more convenient way.
The second option has a little advantages - you can fix application without forcing users to update it and probably you'll save a bit of device's bandwidth. Of course disadvantage is that you have to pay for server.
General problem with applications like that is that every single change with layout, skin, server configuration can cause your application to stop working, as well as parsing html needs much more work that just connect to existing API.
More over - publishing your application can cause some legal issues (copyright) and is against Google Play's policy:
Do not post an app where the primary functionality is to: Drive
affiliate traffic to a website or Provide a webview of a website not
owned or administered by you (unless you have permission from the
website owner/administrator to do so)

How to upload file by giving a path in url

Is it possible to upload a file in Play! framework only by giving a path in url?
For example I would like to call:
www.mywebsite.com/upload_PATH
It's for me quite important, because I would like to upload and process a lot of data. Selecting manually 1000 files is too much time consuming and I want to write a program which will make it for me :-) I'm using Play with Java.
If upload_PATH is a local file path on your system, it is not a good way to go.
You should write a Play action where you can upload a file, as it is done in this example.
Then, you should write a HTTP client (started by a main Java method) which go through your files and upload then calling the Play! action. You can use the httpclient Apache library for writing the client part.
As nico_ekito wrote www.mywebsite.com/upload_from_local_path won't work
In case of huge amount of files you can create temporary folder on the distant server and upload your files with FTP. Then in your app you'll need only action for post-upload processing, ie. it can check if file is valid and move it to calculated destination and register in database if required.
Other possibility is using some flash/ajax multi uploader for an example swfupload (don't know it, it's just first hit from the search engine). This approach will be better if you are going give the upload possibility to people who you don't want to give any FTP access.
Finally you can mix the solutions -> use uploader instead of FTP and later post-process new items remotely.

News Articles: Write to server disk without PHP?

I'm looking into a small project just now where we have a need for a very very basic news article system. Ideally, this is a simple XML file that will be written to with some news, and then parsed to display on the homepage. This file is on the server, of course.
My question is how to allow a client browser to write to this XML file, given that the server will not have PHP enabled?
I know of TiddlyWiki which uses a .JAR file to allow the writes, but are there any other methods I should try?
Since FTP seems to be enabled/supported, your best bet is to create an applet which does the job. FTP connectivity can fairly simple be done by Apache Commons Net FTPClient. Your only problem is that the FTP connection details needs to be embedded in the applet somehow and that anyone with bad intent can extract it from the applet's source code since applets are downloaded into the client machine.
Without some serverside code, you will not be able to write files to the server.
You need a "PHP/Java/FTP-Server/something else"-backend serverprocess to take the content and write it to a file.
Apache supports HTTP PUT, and some browsers support it in XMLHttpRequest. So long as you are willing to limit editors to browsers that support it, you could use that without installing additional software on the server or using a plugin on the client.
FTP would definitely work, depending on how well the user doing the updates is familiar with it.
If the upload solution needs to be browser-based, you could perhaps run an FTP applet and have the user remember the connection details/password.

Categories

Resources