Karthick Pattabiraman

Greenhorn
+ Follow
since May 12, 2015
Cows and Likes
Cows
Total received
-1
In last 30 days
0
Total given
0
Likes
Total received
2
Received in last 30 days
0
Total given
3
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Karthick Pattabiraman

I am new to web development. I have this in index.jsp



My intension is to do a form submit when a list item is selected from the dropdown menu. I tried to put this.form.submit() on the onclick event of the list item. But nothing happens.

Any direction is much appreciated.

If you need any additional details please let me know.
Ok then, here is my solution



and if at all I need a reset approach I would go with Exception handling. That's more understandable and elegant in my opinion.

5 years ago

Ganish Patil wrote:
Put condition in that loop if counter reaches max index of second array then make it 0 again to start from 0th index's element of array two.



Or how about using % operator and avoid reset
5 years ago

Sterling Hicks wrote:
Im following the Head Start Java book and this was an example in the book. Why have boolean canRecord = false; ?



One of the fundamental principal of Object Oriented Programming is Encapsulation. And Its always better to bind a attribute (Variable) with a behavior (Method) and not expose the attribute directly. And the behavior should decide on the state of the attribute.
5 years ago

Ganish Patil wrote:I know It's not related to Java mainly but still I need help from this community as I like Java. I live in Pune India.
My profile
10th standard, pass out year 2003 with 43.88%
12th standard, pass out year 2007(2 years of gap) with 47.33%
Bachelor of computer application, pass out year 2010 with 71.68%
Master of computer application, , pass out year 2013 with 67.62%
No certification
After Master of computer application 2 years of gap. During final year project I worked in a small company on core Java. Did their small projects in swing. after that had gap. so what should I do now. I know core java and little adv. Java. I heard of fake certificate my friends are doing course for 25,000 Rs and fake certificate also but I feel guilt of such fake certificate and all so please need help what should I do now? I don't even know any Java framework. if I join class now then It will take 3,4 months for class again so don't want to spend more than a month as jobless. frankly I did nothing in gap and don't want to lie to any company. so please any suggestions



Never fake your experience. Even if you get away with it now it will come and bite you in the future. I have seen people working for a organization for several years getting fired because some client background verification turned negative. So don't do that.

Next, your 10th and 12th percentage are not very good, so as a fresh graduate (0 experience) leading companies will not pick your CV. Leading companies expect 60% in India. So your best bet is with small and medium size companies.

First job is always the tough one to get and that's the one that mostly decide your career. My suggestion would be, do not restrict yourself in terms of location or technology. Lot of companies that hire people with 0 experience do not expect you to be skilled in any technology in specific. The test your genera aptitude and attitude. Having Java knowledge is a added advantage.

And do not believe training academy that offers placement after training. Most of them are fake.

So update your CV in all job portals, be active in social media like Facebook, LinkedIn and twitter. Lot of job related information gets posted there.

I hope these suggestion helps. All the best!!
5 years ago

David Spades wrote:problem is, we're given a new box to put our application and the data resides in other box which is not under our control, so....
that's why I've been asking around about ehcache
https://coderanch.com/t/651517/ehcache/caching/ehcache-store-data

I'm only allowed to implement any kind of workaround so long I put it in my box and not changing anything in other boxes. oh well, if it's easy, anybody can do it right? that's why there's always obstacle, be it technical or "non-technical"



What is the DB that you are using?

If its oracle then the data is already cached in the memory in your other box (I don't know about other DB but they should also work the same way).

When returning result set from Oracle DB you just return as ref cursor. Refcursor is pointer to the cursor that need to be executed.

And Java just execute it and gets the data. Java should not be storing the fetched data in a collection, it should be directly sending it to the destination (Report - display or a file etc).

5 years ago

Carey Brown wrote:

Karthick Pattabiraman wrote:Consider I need to build a process to add client details. Today the application has 5 different type of customer.
The process is up and running
Tomorrow a new type of customer is added by the business. Now how should I have written the process so that I can implement the new change without bringing down the existing process?
But this look to be error prone as it’s depending on the runtime input. And also can the new class added to the application can be implemented without stopping the running process. I tried but could not do it.


My take on this is that you have a process that is up and running 24/7 and you want to make changes without bringing it down. This usually involves having two or more copies of your program with a simple load balancer as a front end. Then you can temporarily suspend one of the running programs and bring it back on-line as a new version of the program. In the mean time the other running copies are handling the load. Repeat until all running copies have been updated.



Thanks. Yes that's exactly what I am trying to figure out. So does that mean there is no approach to deploy a code change to a running application (I don't even know if that's a stupid question :-)).
5 years ago

Campbell Ritchie wrote:But in both those approaches the changes to code are minimal. If your CustomerX class is a true subclass of your plain simple Customer, then won't it work if you add a new customer type like that.

You can have configuration files which you add customer types too. Or you can have databases which you add customer types to. But you will have to write some code somewhere whichever approach you take.



Sorry for going back and forth on this. All my life I have been a PL/SQL programmer. So this is kind of new.

So if I have the configuration stored in a DB table and I load the HashMap from that. I actually don't have to change the existing code. All I have to do is create a new class CustomerF. And in the DB add entry for this. Good so far. But if the current application is running do I have to bring down it to deploy the new class?

5 years ago

Campbell Ritchie wrote:Look at Kendall Ponder's app in this thread. If he wants to add an option to his menu, how is he going to do it?



Are you referring to the ENUM approach?

I did worked out a solution using HashMap Something like this



But here again I need to change the code (add to HashMap) if I add a new customer.
5 years ago
Consider I need to build a process to add client details. Today the application has 5 different type of customer.

pseudo code is like this



The process is up and running

Tomorrow a new type of customer is added by the business. Now how should I have written the process so that I can implement the new change without bringing down the existing process?

Looking at various options one thing that caught my eye is the use of Class.forName

Basically the solution would be to Build an interface CustomerType which has a method processCustomer() and create 5 Class (One for each customer type) which implements the interface CustomerType .

And the process code would be something like this



But this look to be error prone as it’s depending on the runtime input. And also can the new class added to the application can be implemented without stopping the running process. I tried but could not do it.
5 years ago

Campbell Ritchie wrote:The reason is that handing out a complete answer prevents OP learning from the exercise. This is what it says on the contents page for this forum:

We're all here to learn, so when responding to others, please focus on helping them discover their own solutions, instead of simply providing answers.

So, don't be annoyed, but I have pulled rank and deleted the post (it remains in memory so I might restore it later).



No problem. I am also in the process of learning. So thought of sharing my approach which would attract some comments if there is something good or bad in it.
5 years ago

Joshua Harris wrote:Hello,

So, as the title says I'm trying to count the number of elements in an ArrayList which also have duplicates. So for example, in an ArrayList of strings which contains cat, cat, dog, horse, zebra, zebra, the answer should be two.



Give this a try

5 years ago
Combining both the question in one answer. I have used Scanner class. Also I have used do..while loop as I wanted to print the exit message as well.

5 years ago