best way for saving settings to external storage? [closed] - java

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 8 years ago.
Improve this question
In My app I want to have an external file for saving my settings, item tags , etc. (for using it in outside of app like sending it on another device and so on).
after researching a lot I came to have a text file like this:
settings.txt
"Item1" : "data1"
"Item2" : "data2"
...
now is it the best solution for my purpose?
and if it is, how am I supposed to get my data based on it's id (Item number) from this kind of text file? (I can do the writing part but have no idea how to retrieve it).
Thanks in Advanced.

Instead of your way, you can store the key and values in JSON format. That way it would be easier for you to parse the data and get the value based on the item number (key). You can even use Google's Gson lib o make things simpler. JSON.simple example – Read and write JSON will help as well.

Related

Add multiple values on a table using docx4j [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 4 years ago.
Improve this question
The image below describes what I want to do, so I'm supposed to add many values to this three tables.
I'm using the library docx4j
You can use content control databinding for this; docx4j's OpenDoPE convention allows you to repeat table rows. And more recent versions of Word have a concept of repeating content controls; see https://www.docx4java.org/blog/2015/01/word-2013-repeatingsection-content-controls-ready-for-prime-time/
In principle, docx4j supports both, but it'll be easier to get help with the OpenDoPE approach.
To get started, try invoice.docx from https://github.com/plutext/docx4j/tree/master/sample-docs/word/databinding which is an example of repeating table rows.
To merge invoice-data.xml (from the same dir) into it, use https://github.com/plutext/docx4j/blob/master/src/samples/docx4j/org/docx4j/samples/ContentControlsMergeXML.java
If you like this approach, you'll need to author your own input document; to do this, you can try the "friendly" Word AddIn at https://opendope.org/implementations.html

Android SQL database organization [closed]

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 7 years ago.
Improve this question
I am developing an Android native game, but I have problems with Data Storage.
For a better comprehension think it like as i am developing Clash of Clans, but with Native Andorid.
Now imagine I have to store all datas for Buildings, moneys, troups, ecc in my local phone DB.
I read some guides about SQLite for Android, but i don't really like it. It picks always a Cursor object and i have to create an "Helper" class for each table so I can convert the Cursor into the object I picked.
I want a library or anything else that allows you to do like windows phone c#:
SQLiteConnection conn = new SQLiteConnection(DBPath);
return conn.Query<TABLE_NAME>(SQL_QUERY);
//in this way i have a list of TABLE_NAME items without any casting or similar.
I learned SugarORM and it is really simple and intuitive, but it has no possibilities for ID usage(or at least really restricted) and a lot of other limitations.
And here is my question: is there a way to do it with SQLite without using cursor or with any other library, but still complete of all (or at least the most useful) functions?
check this link they explain the most five popular database and there characterstics

How best to store and modify categorized data in Android [closed]

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'm fairly new to android programming and have a couple years of university experience in Java. I am planning on writing an app for android that will require me to see what category an item entered belongs.
As an example, if a user inputs 'apple', that data must be placed under a 'fruit' category. So in other words I require a data file that will be able to tell me what category the item is in or alternatively the user can add an item to a category if it is not yet categorised.
I am wondering what would be the best way to store this data. Should I use an xml file, database file, text file or what? It would be necessary to perform look-ups and also insertions.
Thanks in advance
I think this question is more of a personal preference, but I would use XML in this case. You can have the structure predefined with distribution of your app, and modify/write the file at runtime. Its easy to read and understand, and just as easily modified. Simply universal.
Sqlite has its positives in large forms of data, but can be much more complex for something that doesn't need much detail.
<index>
<category name="fruit">
<item>apple</item>
.....
</category>
......
</index>
A simple for loop through the categories, and see if the item is present, else add it.
Hope this helps, happy coding!
Android has SQLite built in...for your purposes I'd go with that.
http://developer.android.com/guide/topics/data/data-storage.html
http://developer.android.com/training/basics/data-storage/index.html

Should static text be stored in a .properties file? [closed]

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
Given a .JSP, would there be any reason to store static text in a .properties file, pull the key/value pair, and display it? Is that the best practice / standardized way? If so, why? Or can you "hard code" the static text into the .JSP? Are there benefits (performance, code readability, etc.) with each way?
My response could differ depending on what you are referring to as static text? Storing the values within a properties file is one way of approaching it, but I would advise that you store these types of key value pairs in a database that you could later retrieve and cache at start-up.
This depends on what the "text" is. If it's user-visible, such as form labels, then storing it in a properties file allows you to make use of the built-in i18n capabilities of JSP and similar technologies, and it also permits easy updates in case of typos or such. Externalizing user-visible text is always a good best practice.
If the text is something that's "static" but likely to change on a reasonably frequent basis, then it belongs in a persistent store such as the database you're using for your other persistence, or a document database like MongoDB.
Or you can store your text in the database. I think this is most preferrable way.

In hibernate tracking the data that saving in Database [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 am working on encrypting and decrypting of savable data of my application. For that i need to know the strings that saving in my database(I need them exactly just before saving into DB).
How to track that data while before saving ?? any help ??
thanks .
Hinernate supports the concept of interceptors and events. You can use the public boolean onSave(...)
You can do this with the help of Data Access Object design pattern. where u can track data before going to save by implementing your custom function

Categories

Resources