Give Java application access to specific Google Spreadsheet - java

How do I give access to one specific Google Spreadsheet to a Java (or Clojure) application?
Read only access is fine. My idea is to keep data in a Spreadsheet that I and some collaborators can edit, instead of in a database. Is Oauth2 needed in this case, or is there an easier way to accomplish this?

Your post intrigues me, simply because I have been using Google Spreadsheet as my "simple centralized database" that I can query against from all my machines. That said, my approach was very rudimentary (written in ~2009) because I only read the published CSV link and I don't do any write on the spreadsheet from my app.
After googling around, it seems like this is doable. Have you checked out this link? https://developers.google.com/google-apps/spreadsheets/ It seems like you can use OAuth to grant/check access before performing read/write on the spreadsheet. And they have examples in both Java and .Net to accomplish that.

Related

what are the steps to make a word search for a website?

I want to write a word search,which connects to a specific website(huge one),takes the word from user,searches the site and returns the strings which contain the word;this should be written in java and as an applet.I have read some tutorials and questions on this,and understood what have to be done is:
1.connect to a website and get the content of a website and save it to a string.(this should be done with a webcrawler which will be made from my own code for connecting to website and save the content to a string + jsoup library to parse the html code).
2.save the datas to a database(in my case nosql database).
3.index the datas in database.
4.query the database to show the results.
5.make a UI for showing the search results(I use swing.japplet).
now my qustions are:
1.have I understood correctly the steps which I have to go?(please explain me in details if a step is unnecessary or necessary)
2.Is it necessary to have a database?
notice:I want to implement it myself,without using ready things such as lucene,nutch,solr,...
edit:3 people told me applet is not suitable for such a thing,so what should be the replacement?
many many thanks for your help.
You should look at using Lucene, as it does most of what you want here.
You should not use applets.
For small data set, database should be sufficient. Databases like mysql comes with full text search functions.
For bigger data set, you might want to consider Lucene or Solr.
That is one way way to implement this. Another (simpler) way would be to use an existing text search / indexing engine like Lucene / Solr. Going to the effort of reimplementing the "text search / indexing" wheel using database technology strikes me as a waste of effort, unless you have a sound technical reason for doing so.
You do need to has some kind of database, because indexing a website on the fly would simply not work. Lucene will handle that.
I think your choice of Java applets to build the UI is a bad idea. There are other technologies that give results that are as good or better ... without the security risk of a Java browser plugin.
Finally, another way to make your website searchable is to get Google to do it for you. Make your website content indexable, and then use Google's search APIs.

How to access online mysql database in android?

I have created an online database about the restaurants and I need to access this database through my android application, so that I can display the data to the users after filtering. My application does not need to update the database, but my problem is how to connect to my online mysql database and provide it to the users? I have looked on many suggestions on this site as well as on others, and I just found I have to use JSON parser while accessing but do not how to do it.
The best solution is provide a public API, managed for example with PHP, which delivers your database data filtered and displayed as your Android application needs.
This link might help you . http://www.androidhive.info/2012/01/android-login-and-registration-with-php-mysql-and-sqlite/
Just get an understanding of JSON parsers and how it can be used in android for retrieving data from database on server... you can write webservices in php..
You need to provide a server side solution that the Android application can speak to. PHP scripts are a good way to go, that can directly interface with the MySQL database, and return results to the device.
You can then be creative with the PHP script, by sorting the results etc, and providing a more comprehensive solution by taking away some of the processing from the Android device, and doing it server side where battery life isn't as much of a problem.
You simply need to implement web service calls on the Android device, simple GET/POST requests over HTTP suffice depending on what you intend to do. Have a look into REST APIs for guidelines on how to implement properly.
You can easily add a PHP script to the same server as the MySQL database for this

Merging cells in google spreadsheet

There is a way for merging cells in Google spreadsheet finally. But I can not find API for doing this. Am I missing something?
There's an API for doing it using Google Apps Script. But this API is only accessible using Apps Script code, not really a public thing that you can call from java or "regular" javascript.
Well, you could publish the script as service and develop your own protocol to do it, which you could call from "external" programs. But that's kind of cumbersome. Much better if you could just write everything in Apps Script.

SQLite DB for GWT?

I'm trying to create a Packaged App for Chrome using GWT, I need an SQLite DB. I can't seem to find any decent resources on doing this. I've looked at gwt-mobile-webkit, is that the definitive way to use sqlite in gwt? I'm getting errors when I follow their example, it seems it hasn't been updated in awhile. Based on the lack of results I'm thinking I'm not searching for the right thing, any guidance?
I'd check out gwt-mobile-webkit, or more specifically the Database API. Though the name says "mobile", it definitely works on the desktop. This library wraps the HTML5 database support, which (depending on the browser) is either SQLite or IndexedDB. There are plenty of other, heavier weight wrappers, but this is the best and easiest I've seen around.

Connect Android application to remote data

Sheesh talk about limited information! I'm trying to get my Android application to connect to an online database to access information. There's quite a bit of info including geotags and these are going to be mapped on my app. The developer site has the very informative piece of information:
You can use the network (when it's available) to store and retrieve data on your own web-based services. To do network operations, use classes in the following packages:
java.net.*
android.net.*
Like I said in my previous question, I'm still very much an android newbie, and trying to remember my java oop from college is slow. Does anyone have an example of how this might work, or how I could implement it? I wouldn't mind even connecting to a local xml file, if I could find a good example of how to do that!? Am I just looking in all the wrong places?!
Help. Please!
T
How do you plan to connect to the database?
Android allows you do to plain socket communication which you can refresh your knowledge of here:
http://java.sun.com/developer/onlineTraining/Programming/BasicJava2/socket.html
Another method would be to put up a REST type service and respond with XML. SAX is commonly used for XML parsing in Android:
http://www.saxproject.org/
You can use SAXParser to parse XML from the net. Here's a tutorial on how to use the same.

Categories

Resources