Carl John

Ranch Hand
+ Follow
since Jun 14, 2010
Carl likes ...
Netbeans IDE Eclipse IDE Java
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Carl John

Hi

I'm developing a Java Swing application and enabled them with Java web start feature.

Currently, i'm logging the events in a log file and saving them in jre folder.

Is this a correct way of logging an application?

If not where can i save the log files?
10 years ago
It just prints only single character. not till the end of line..

I want to print hyphen till the end of line.
10 years ago
Hi

I'm writing string value to JTextpane like (heading of contents)

Order# OrderDate Product Description Rate Qty Specs.

I just want to write hyphen character below to the headings, to the entire line of the textpane until it wraps..

Any suggestions ?

10 years ago
Yes Steve, that's good idea..! BTW this approach is good? or any suggestions for some better way of accomplishing the tasks like without properties files or something.. If so please let me know..!

Thanks once again.
10 years ago


I'm developing a stand-alone application in Java, with the user-level restrictions as mentioned below in the table.

I'm not using any Databases in the application. Based on the these restriction levels, I've to control the screen and some actions.


To accomplish this scenario, I come up with an approach like, Creating a properties file like

Config.properties -- (ACTION = USERLEVEL pair)

OPEN=USER,GUEST,ADMIN
SAVE=USER,ADMIN
IMPORT=ADMIN
EXPORT=ADMIN

While logging in to the application ,I'll look for the properties file and get the Userlevel strings and process them further.

ex. if user login as an ADMIN, i will set true for OPEN, SAVE,IMPORT,EXPORT and enable them accordingly.

I want to confirm that this approach is good or bad.

Thanks for any suggestions for better approach ..!

Note: I've already asked this same question in other forum, but i haven't got any comments till yet...
10 years ago
Maneesh,

Hint: If as per the rules CAT is "equal" to CTA, will it help of you change all CTA values to CAT in the list?...



You're asking to change the all CTA values to CAT..

Suppose if you have a list over hundreds and thousands of string values , to which extent you will change the values ?

Certainly as i said before, i don't have any logical steps left over, for this scenario..!

I just want to know whether there is a possibility to achieve this ?

10 years ago
Dear Maneesh,


Anyway. Did you start writing logical steps on paper like Winston suggested?



That's the idea i've been following till date.

Coming back to this scenario, Find the count of the string in the list ? .Please Suggest me Is there any logical steps to do that or it is impossible to achieve that..?

Only thing i can figure out is to convert them to ascii values and do further comparison.

As i said before , i was asked in the interview panel.Certainly i don't know what they really expect from this question.!

Thanks.
10 years ago
Dear Winston,

I was asked this question couple of weeks back in an interview...

For example, if CAT and CTA are considered "equal", then you obviously won't be able to use String.equals(); so, how else do you think you might do that comparison?



The way to compare is to convert the strings to ASCII values so that CAT/CTA will have same values.



But in some cases this scenario fails too..

10 years ago
Hi All,

I'm having a list of string like

List<String> ls = new ArrayList<String> ();
ls.add("CAT");
ls.add("MAT");
ls.add("TAM");
ls.add("CTA");
ls.add("AMT");



Now i want the count of the string in the list like

CAT --> 2
MAT --> 3
TAM --> 3
CTA --> 2
AMT --> 3


(the string characters can be interchanged...(CAT/CTA can be both considered as same) .

How to get a count like this.?
10 years ago
Hi All,

I'm developing a Java swing application with back end Database MySQL . I've a screen to upload my datas to the Database using the Query like

.

Here the datas are like from January to June. But if i want to skip any month data or to upload only a particular month then how will i modify the above query.

In my database table , the date column is 'SLDATE'.

Any suggestions please.?

Thanks for the answer.It was helpful. Actually i just had an interview yesterday, the interviewer asked to write down a generic method to return sum of contents in list having only digits..
10 years ago
Hi All ,

I want to write a method which adds the contents of List and returns the sum value.

The below method only accepts List<Integer> and returns int ...



But how can we make this method to accept any list of numbers like Integer,Float,Double to return the sum of List contents..


Thanks in advance
10 years ago
Hi All

I'm using MySQL database. In that i'm having sales datas in one table and i've created an index for the Date column (i.e) OrderedDate.

The datas are retrieved fast when we use the query like



But for taking the details for Particular Quarter cycle , it gets slow and scans whole table datas..

The Query is like



Is there anyway to index the quarter function (or) any way to speedup the data retrieval for quarter cycle...?

I've asked the very same question in other forum , but i'm not getting any answers from there..So i'm posting the same question here.!
Hi All,

I'm newbie in SWT . I'm trying to print the StyledText value into an image format. I don't know how to deal with StyledText. My code snippet is


final StyledText styledText = new StyledText(shell, SWT.V_SCROLL | SWT.BORDER);

styledText.setText("HELLO WORLD");

styledText.setStyleRange(new StyleRange(0, 5, display.getSystemColor(SWT.COLOR_GREEN), null));

styledText.setStyleRange(new StyleRange(7, 11, display.getSystemColor(SWT.COLOR_RED), null));

...
.....


Anyone please guide me...!

Very Thanks in advance..!
11 years ago
I'm writing to a excel file in xlsx format ,which has some conditional rules (i.e) (Cell value = "OK", color is green).

After writing data to that file, the rules were disappeared and only datas are there.

Moreover, it is not opening in .xlsx format, it opens only in .xls format.

Please help me to solve this....
11 years ago