How to remove null data in java derby database? [closed] - java

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 years ago.
Improve this question
I worked on how to input data into java derby database, but once I save my data into database and needs previewing my data always come up with null e.g nullFemale or nullMale. While I need only Female and Male to be displayed, how to solve this please........
enter image description here
My code is
my code

GENDER is null. Then you modify it using
GENDER += male.getText() + "";
So you concatenate null with the actual gender.
Just don't do that. Just use
GENDER = male.getText()
There is no reason to use concatenation. And GENDER shouldn't even be an instance variable. it should be a local variable.
Notes:
Post your code as text in the question. Blind people can't read your images. I can't copy-paste code from your images. People behind firewalls can't read your images. Next time, I'll simply vote to close your question, since it doesn't respect the rules.
Respect the Java naming conventions. ALL_CAPS is for constants (static final variables). Not for variables.

Related

REFLECTION: Getting the field from a class without the name [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 1 year ago.
Improve this question
I want to get the java.lang.reflect.Field of (Eg. Object.field1), but my program is going to be obfuscated. I can't use the name of the field, but I just want to get it by that reference. I also don't want to cycle through the array of fields and find the one I want.
Sorry if I worded things wrong, I don't know what I'm supposed to call that.
You have painted yourself into a corner.
There is no way to get a field (or Field) using reflection if you don't know the field's obfuscated name AND you don't want to (or can't) cycle through all of the fields to identify the correct one.
I have a couple of suggestions:
Alter the obfuscation rules; e.g. don't obfuscate this class, or the field names for this class, or this specific field name.
Add a method for accessing this field so that you don't need to use reflection.
You could also figure out what the obfuscated name of the field is going to be and hard-wire it into your reflective code, but this is a bad idea. Small changes to your code are liable to make the obfuscated field name change. Then your code breaks.

Has operation in Android SQLite [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
I have a some trouble about my own simple android project. I save data pair (key-value), and I dont want to save same data. ( for example: I save the data "Car"- "Blue" once. and then application can not permisson save again same the data.) I wrote already update method but I couldnt use for search & control data repetition. How can I solve ?
Make the combination of the two columns a Primary Key
You can also use if else block along with SELECT statement to validate inputs.

Java local variable notation: 'textEntered' or 'enteredText'? [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 6 years ago.
Improve this question
I have just had a not let me sleep doubt about how to name a local variable which stores the text entered by an user (in a text box).
Should I name it 'enteredText' or 'textEntered'?
My main concern is about what comes first? participleSubject or subjectParticiple.
There are some accepted patterns as in events, where it is always onSubjectVerb, e.g. onItemClick ...
I am not sure which is the styling rule for my case (entering text in a TextBox'
I have made some searches on different code repositories and both names are used?
Any idea?
Thanks!
Miguel Ángel
This problem is one of the two hardest problems in computer science, naming things. I think that both are equally non descriptive of what the text that has been entered describes.
For example: what does this text field provide the use the ability to enter? Their name? Then call it userName
More of a matter of taste, I think.
Anyway for me it is a matter of context: if I'm writing a complex class or method with lots of variables and where e.g. there's text entered, text computed and text fixed (i.e. a label), I tend to name them textEntered, textComputed and textFixed, so when I need to access some kind of text the IDE auto completion features easily show me all texts available.

Unicode character's are not working in java when i m storing values in String query for jdbc [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
String query = "select * from table where word='سیب'";
unicodes works fine in java but not fetching values from database
i don't know what's the problem :(
thanks in advance
Check if your database configuration is supporting UTF-16.
What happens executing the query on a database client instead from java code?
Your problem is that a given string is not matched in the database, even though you have the value stored. I believe your problem is as follows: you are using different character sets in your application from your database. You should either change the character set in one of those or you should convert the string into the character set used at the db before you run your query.

Java naming conventions versus English language correctness [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'm not sure is this right place to ask so correct me if I'm wrong.
The case is that:
one category has one code
we want to get list of codes for multiple categories
Which version is correct and why?
getCategoriesCodes()
or
getCategoryCodes()
I see this problem from two points of view, one is the English grammar, and the second one is the clean code and code meaningful naming.
Please give me your opinion which method name is better and add note is English you native language.
As both a native English speaker and a Java programmer: getCategoryCodes() is preferable. getCategoriesCodes() implies to me that I am getting multiple codes for each category, or that the codes relate to the collection of categories, rather than a code for each category.
As an example from "real" English: a car has one driver; you would refer to the drivers of many cars as "car drivers", not "cars drivers".
I would side with the clean code and meaningful naming. Nobody will judge your English in your code and also looking at the code in a month or a year will make it easier to understand if its worded correctly
There is no harm in giving names grammatical correct provided it is readable and understandable and not become very long because long names are difficult to understand.

Categories

Resources