How applications usually store their data (in java)? [closed] - java

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
I'm trying to write a program in Java for personal accounting. My initial plan was for user to log in, and the program would look him up in a text file and let him in. Then there would be a JTable which would load all his transactions (from a txt) and show them. He would then add new ones or edit/delete ones already there. The program would find the line and change it.
But as I started the implementation, I quickly found out that the manipulation with the text file was very exhausting.
I thought about SQL database, or JSON files, but I don't know, if that's a good idea, and where to start. I'm rather new to java, so even opening a text file was a bit of a hassle for me.
Any thoughts?
Thank you.

Since it is for personal accounting and likely small, you could think of it like any document editing program (Notepad, Word, Excel, ...), meaning:
No login. Each person will have a separate file chosen when you start program.
Load entire file into memory.
Nothing is saved until user clicks "Save" (unless you want some auto-recovery logic in case of program/machine crash).
That means that there are only two operations on the file (Load and Save), and both should be fairly simple.
Advantage: Simple and very fast.
Limitation: Memory constraint if file grows very large, and potential for data loss if auto-recovery/auto-save is not implemented.

Related

How to save changes in java? [closed]

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 3 years ago.
Improve this question
I'm new to java and I'm recently working on a project which allows you to deposit, withdraw and create new accounts. I want to know if I can somehow save the changes after rerunning the code, for example, the change of users. I've tried several ways on the internet and they didn't seem to work.
There are a variety of ways to accomplish this. For a new programmer, I'd suggest learning how to read and write from files to start.
A simple database system is also an option, but probably more complicated than what you're looking for. This also can't be covered in one tutorial. If you're interested, you should probably do your own research and find something that works for you.
What you need is a database system.
In short, the database will store the data. Your program reads and displays that data. The user modifies it, and pass it to your program to "save" the data (which is replaced the old data with new ones in the database)

Upload/Download text files in Java? [closed]

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 5 years ago.
Improve this question
I'm currently trying to code a fairly simple program in Java to keep a database on a small library at my university. I'd like for multiple computers to be able to use this program using a shared database stored in a text file that would be downloaded when the program is run, and uploaded once the user is finished using the program and making any edits to the database. I don't know how to go about this at all and would be very grateful for any pointers on a direction to take.
In order to connect to other computers in Java, you should use Sockets, and define your own Protocol (Basically, your protocol would consist on a handshake, and some way on asking the other part of the connection to send the text's data). Anyways, I'd recommend you using a simple SQLite database
To read and save files (txt is a raw text file without any special format), check this
If you'd like the program to display the text, you should learn a bit about Java Swing
Also, try looking a bit in google before asking here

Distributed Text Editor: multiple users editing a text file concurrently [closed]

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
I am working on a distributed system project. I am required to create a program that allow multiple users to edit on the same text file concurrently. I have been looking around online for a relatively simple solution but I haven't found one. I've read about BlockingQueue but that doesn't make much sense to me. I have talked to my TA and he suggested that each client will have a copy of the text file, which will they edit. Those sub-files will then be merged to the main copy. However, the problem is that I won't be able to update those sub-files while they are editing the text file.
As I understand it you want an online text editor with which you can modify files concurrently and the updates should happen as real-time as possible.
Here is what I would do:
If a user opens a file he receives a copy of it and the user is added to the list of users which have opened this file.
After a user makes a change, wait X seconds to accumulate further changes and then send them to the server.
The server processes the change requests for a file one after the other (different files can be done in parallel of course and it can also be done more intelligently by splitting files into chunks which can be processed independently in parallel too, at least on the server side [this is only partially true, two changes can be processed in parallel if the intersection of the set of affected chunks in change A and change B is empty])
A change request is either acceppted and all the changes are broadcastest to all user that have the file opened or the change is refused. This can be pretty complicated. The easiest way is to keep track with a version number and refuse all changes that come from older versions. (If you have a version number for each chunk and the size of the chunks is small, you will only run into rejections if two or more people are working at the almost same location in a document at the same time. But it will be quite some work, consider you will have to split/merge/delete/insert chunks if they become too big or small.)

Can you recommend a way to present many multiple pages of data on the web sortable [closed]

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 3 years ago.
Improve this question
I have a report generated from a database containing about 100,000 entries, each entry contains about 10 columns, the data is stored on Amazon S3 and is generated monthly. I'm looking for some pointers on a way you recommend a way to present this many multiple pages of data on, and I want it to be sortable and because however I sort it it wont suit all users, ideally it should be searchable as well.
Is it possible to do purely client-side or is that unfeasible, do I need go back to the server. I don't have the database available but if needs be, the website is backed by a java servlet application running on Tomcat. A self contained library for doing this would be very useful.
To paraphrase the discussion above.
Providing search/paging in Javascript is not sensible because this would still require the user to download all the data in one go, and representing that amount of data in html is not going to work well.
So either have to provide a server backend and provide a mechanism for searching and paging. Or provide the data in a spreadsheet format then the user can use the capabilities of their spreadsheet tool, which is well suited to dealing with large volumes of data.
Im going to try the spreadsheet idea.

Antigoogleying system [closed]

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 need to design a testing system which would not allow to use google. I mean that, theoretically, the user still can do it, but the purpose is to hinder this as much as possible.
I have an idea, but I don't know how good it is. I want the question in the database to be a simple text. And when we need to load it to the test, we convert it into a picture with a watermark. But the problem is that, theoretically, it still can be recognized. Google is able to convert the text on the image into the text and then search it as a text. Google is also able to recognize images despite some hue differences on them. Does anybody have proposals on that score? What would you do?
just use robots exclusion headers on the page to tell google not to store your page. or even robots.txt
As you say if it's human-readable, google will read it. Google has millions of slaves doing OCR for them (via Re-Captcha). but if you tell google to leave your site alone, it will.

Categories

Resources