SQLite DB for GWT? - java

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.

Related

Android: Should I use local Storage or SQLite (or similar)?

I am just starting to learn Android Development. I have to develop something similar to a Log APP where the user can save information.This is student project, so I don't have to use Users/Passwords, instead I am allowed to save the info using the Local Storage of the device.
The problem is that I will need to extract that info into a CSV file, and I am not sure if using Local Storage is the best option.
Which option do you think is more efficient?
Which one do you think is less complicated to use in this case?
Thanks in advance!
You probably wanted to use Room for it is the official Android Database framework and the learning curve is quite easy. It even supports other Jetpack libraries such LiveData to make your Android development far more easier.
Use SQLite. You can query the data from the database and write it to a cvs file upon need.
Definitely use Sqlite, and not raw sqlite but use instead Room. Room is architecture component by android and is actually just one layer above sqlite so it is easier to use and removes a lot of boilerplate code. For storing really little things like login information you can use SharedPrefrences. Here is documentation about Room I suggest reading it.

Where to place my android app's data

I'm currently developing an app that lets you create and save excercises and routines for the gym. I want the app to come with some example excercises and routines and also to give the user the ability to add his own.
The thing is, I know I can use "getFilesDir()" and save it in the internal memory, but if I do that, how do I put my example files also in the internal memory? I don't think I can do that without creating those files by code everytime the app runs. I've also tried putting the example excercises in "res/raw" but then the ones the user adds go to a different place and I don`t know if that's good practice, apart from just how annoying it is having to read them from different places.
Where would be the best place to put those excercises and routines files?
Thank you very much!
The best practice is to store data inside "Sqlite Database".
"Sqlite Database" is the internal database that android provides to store data locally and is easy to use.
It's queries are easy to implement. It is more easy to work on, if you have worked on any database before. Just create a "Database Helper" class and initiate inside the activity where you plan to store data.
Many big applications like "whatsapp", use this database to store data on user's device.
The plus point of using "Sqlite" is that, you can iterate through each and every data easily.
It is quick, easy to work and is also a good programming practice. It is also secure.
While using a sqlite database for managing your app data is the traditional
approach, there are also alternatives to it. Realm is such an alternative. You can check the comparison with sqlite and see if it meets your need.
https://realm.io/
In Android development, you can store locally and as well as remotely. This link will walk you through all possible ways to store data.
As per your requirement, I would recommend you got for SQLite Database provided especially for android as it is light weight. Sqlite queries are straightforward and easy to use with some APIs comes with the package. you can start with this link with Sqlite.
I suggest using Firebase to store your data. Not only it is online and realtime, it can also work in offline mode and sync later. Because you're developing a gym app, why not give it an online or offline capability? I think users prefer it that way. You can check it at firebase.google.com

Programmatic annotations via YouTube's Data API

Wondering if anyone knows of a way to insert annotations programmatically using YouTube's Data API. It's entirely possible to access functions like upload, meta-data, etc. I don't see anything annotations however.
https://developers.google.com/youtube/v3/guides/uploading_a_video
Basically I'm trying to upload a video that has a different annotation on every frame (that points to a corresponding frame elsewhere in the video) — obviously the GUI YouTube provides would make that incredibly time consuming.
Here's an real example of the sort of functionality I'm after:
https://www.youtube.com/watch?v=VNRMSKSZY04
Any ideas welcome so long as they sit natively within the YouTube environment.
Many thanks.
Unfortunately you can not do it using the API. One way would be a browser Plugin to do this using the annotations-page...

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.

Concurrency embedded Java Database for simple Application

I am trying to build a simple GUI in which you can write some Integers. These Integers are supposed to be written into a Database, which I am looking for.
So far so good. The data in the Database should then be used for another stand-alone application, which already exists.
I tried it with SQLite already but I received a lot of "Database locked" Errors. I searched Google. The key answer I often read about was to switch to a database which supports concurrent processes.
I went further on and had a look at H2 and HSQLDB. Both of them seem to be legit but much more complicated.
So I wonder:
I would like to have the GUI to be portable in a .jar file (or a folder only) combined with the Database, so when I switch computers I do not have to install the DB in a certain folder like the home-directory or something. With SQLite all you do is this:
Connection con = DriverManager.getConnection("jdbc:sqlite:test.db");
As you can see, no Path-infortmation is necessary. How can I do this with H2 or HSQLDB?
I am really looking forward to your suggestions. But only open source please.
Kindest regards and thank you very much!
Stefan
With H2 and HSQLDB you can do the same.
With H2, a database URL of the form jdbc:h2:test will create a file called test.h2.db in the current working directory of your application. If this is what you want, then that's fine. Please note I usually don't suggest to do that, because many people run into the problem that they sometimes start the application in a different directory (which will then create a new database). Because of that, I suggest to use jdbc:h2:~/test, which means the database file is stored relative to the current user home directory.
Handling the creation of an embedded db file should not be a big issue - but if you really dislike this stick with SQLite: it should handle concurrency well enough for basic usage - 'database locked' sounds more like an application level problem

Categories

Resources