Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I am working on a program which gets all links from a website to use them later on. I am using the Java library JSoup to get the links form the website.
My problem is that I don't know where to store all links for later use. Every link has some attributes like "used" or "not used" and the date when it was used. It should also be Windows and Mac compatible. The saved data should be updateable, editable and the program should read the file where the data is saved fast.
Does anyone know a way to solve my problem?
Edit:
As my question wasn't clear for everyone here's a simpler question:
Should I store the links with their attributes in a database or in a file?
If you need to store on a single file I'd go for SQLite. It's a SQL database provider that can save a whole database on a single file. SQLite databases are universally portable.
EDIT: As #bigdestroyer commented, Apache Derby is pure Java and may be another interesting option for you. I haven't used it though, but there is a nice comparison here.
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I would like to copy the table from this website =
http://www.nasdaq.com/symbol/tlt/dividend-history
everytime I open my jar file and paste it into a csv file. I already know how to download a csv file from websites that provide a download button for it. But now I need to copy it from this URL, which doesn't provide a download button. Please help?!
Use the below code, it will give you the required data.
Document document = Jsoup.connect("http://www.nasdaq.com/symbol/tlt/dividend-history").get();
Element content = document.select("#quotes_content_left_ContentPanel").first();
System.out.println(content.html());
Basic functionality:
Fire the URL and read the data from it.
Now as the required data resides between which tag you have to figure out that. Here, the highlighted part is the required data.
Now you have to refer the JSOUP documents more to get used to the libraries and functionlity provided.
I have extracted the data on the basis of the "id" of the html element. Similarly there are many functionality you should checkout.
The problems with HTML tables is that they often vary in their HTML-design and if you learn how to deal with this one, the next one may provide problems. JSoup can help you in general and with this problem specifically, but you will need to look at the source code of the site in question (your browser can you help do that, if in doubt use its help function to search for the functionality) to extract the information needed with JSoup.
EDIT: based on your comment, learn about HTML first before you automatically want to download tables. Your problem may be a bit too advanced if you just started out. I also doubt you will find tutors on this site, that's not what it is for.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
My code is simple, it generates a Data Base to store certain data (obviously), but the problem resides in the fact that it would create an "overflow" of DBs becuase every time the class ran it would generate another Data Base, I heard of a command:
CREATE DATABASE IF NOT EXISTS insertYourFavoriteName;
But some people say that why should I need a DB for each computer, when I could just do a central one when users conect, but correct me if I'm wrong, that would make the app depend on internet, right?
So in resume here are the 2 questions:
Does the command mentioned above works? Or does a better version or way to work around it exists?
Data Bases where all users connect to it mean that you need a server, and as a consecuence your app would depend on internet?
If you want to learn about databases you practice basic CRUD operations on that database. After that do some sample applications on database
If you want to create a database if not exists in mysql simply use this CREATE DATABASE IF NOT EXISTS DBName;
Basically before checking all these things you have to have basic understanding of what is database and how it works, So, please go through some good resources and get good understanding on the concepts.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
sorry to ask it...i know there are lots of question on SO regarding same but none of the techniques are not working.
I want to encrypt the jar or class so that no one can retrieve it.
Actually there is user name and password of server database in the application. So if anyone retrieve it then they can gain unauthorized access to the database.
I tried many software, and after creating exe file,it can be extracted easily.
so please tell me what can i do?
You could use a property file.
You externalize it out of your jar.
And retrieve the informations via a "getResourceAsStream" or something like that.
The second solution is to use a JNDI configuration, so in your jar you just define a name, and the web server declare all the properties of your connection.
I got the solution:
ProGuard is the best software to safe the class or jar from reverse engineering.
After using it, if anyone will try to decrypt it then he will not able to understand it because it has been changed to new one.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I am developing a java dictionary application...
I used jdbc for maintaining words but i realized that it won't work on other machines since i am making a desktop application...
suggest me a way to maintain words other than files
I don't think there is an alternative to using files if you want to persist your data - it will have to be stored somewhere!
What about the following:
- Use an in memory database that can be persisted to file (h2 for example)
- Use XML persistance - there are plenty of libraries to help.
My suggestion: http://www.manning.com/ingersoll/ :)
And after getting familiar with it, try Solr.
https://lucene.apache.org/solr/
Btw: Please make your question more specific. As this is your first post, I upvoted the question. But think of all the guys around here, who have no knowledge about your problem. Everyone wants to help, but you have to provide more information.
Why not use Embedded Derby?
It's platform independent, uses standard JDBC, and writes files which are accessible across any platform.
http://db.apache.org/derby/papers/DerbyTut/embedded_intro.html
There's no reason why you cannot use JDBC in a standalone java application incidentally. Think of JDBC as a kind of socket you can plug into, but what's behind that socket is entirely implementation specific, and usually can be defined by configuration.
JCR is another good example of this, but this kind of engineering technique is plentiful in the Java universe.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I am currently working on a project in which I am storing the name of program/application window titles and my knowledge of databases and datastores is fairly limited.
The idea is that I want to query the database with a string to see if it is present in the database. I am currently using MongoDB to do this but I have seen that MongoDB is mostly used to be run on a server which isn't what I'm looking for.
My question is - if I am just storing strings / searching for strings would a custom Array or HashMap be sufficient or would search times make it inefficient meaning that SQLite would be more ideal for this situation.
SQLite is perfect for this application. Firefox, for example, uses SQLite for storing its internal configuration settings (the about:config page). SQLite databases are single files, and it can be transparent to the user and requires very little in the way of system resources--unlike most server/client database solutions.
i would suggest to use java preferences api, if the data to be saved is not too much and if it needs to be available even when the application is terminated and restarted.,