Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp

Mark Spencers

Ranch Hand
+ Follow
since Apr 05, 2017
Cows and Likes
Cows
Total received
2
In last 30 days
0
Total given
0
Likes
Total received
9
Received in last 30 days
0
Total given
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Mark Spencers

Is she dead or alive?
11 months ago
Finally I read this sentence.

Once long ago the someone that got killed was my wife.

This is heartbreaking.
11 months ago

From 1 to 10 how do you like yourself?


If I have a good job then I like myself 8. But if I have job with little salary - 5.

It's difficult to say. I think if I did smth good then i feel inspired but if smth is wrong - I am upset.

If I succeed on smth then I rate myself 10 if I fail my rate is based on how much effort I did.
11 months ago
Thank you for support!

I really need good councelling. At this moment I seek good psychologist.

I began to take Gidazepam IC(it is tranquilizer). I prescribed it myself. After two pills I feel a little better.
11 months ago
Thank you very much for such attention.

I get through depression by taking sedative. I think I am very angry, because I have no girl. This is like intrusive thought and I can't get rid of that. I also feel bad about my job in a supermarket.
My mother said: only unlucky people work there. After I told her that I am unlucky too, she said that I cling to words.

After reading all replies I am very glad. I do not visit psychologist because we don't have trustful psychologist. And he is probably expensive.
Depress for me is - bad, ill thoughts attack my brains. In such case I find best to phone my mother and tell her what tortures me.

I visited recently psychiatrist and he told me that I am ok. And he prescribed me pills for depression but for 2 months. This was too much I took them only for 1 month. They made no difference!!!

Another pain in my brain is videos where I saw girl (who I liked) doing sex. This makes me feel very bad. I can't get rid of these memories.

When I see a beautiful girl I feel inappropriate for her. When I see ugly one I feel hate.

As I live in  one-room flat only with my mother and do not earn big money I am afraid that I shall meet my girl-friend not soon. For few years I lived in this flat with my mother and stepfather who drank alcohol and earned little money.

In addition I am shy and even coward. My mother says I am unsure of yourself and do not make steps to find a girl.

When I was learning programming I didn't know how to earn  money. SoftServe didn't employ me and I was usual candidate into their IT academy. I was coding just to code.
Even worse people around me didn't take me seriously because they didn't know that programming is reality. But my fault was to be very nervous and and I kept my insult inside me. I disbelieved that I will ever earn something.
Add to this that my mother was my enemy and I cursed her as much as possible.
I was usual candidate for training classes in different IT companies. It lasted around 3 years.

I got through it because of pills which my mother secretly put into my food. And after 1-2 years after I left java, I understood that I love my mother.
I listen to her words but not all.

Thank you for your encouragement. I hope that thoughts about girls will torture me less.
11 months ago
I am 28 years old. I have never had a girl-friend, even acquaintance. I feel horrible these days. Sexy girls make me want to die.

I am in deep depression. I am scared to come up to girl. Many have boys, many had. Nobody loves me and I am hopeless.

I have no friends. I go to job and work a bit as a freelancer. No personal life.

Can you help me, if words can.
11 months ago
Good way to learn java is to answer questions on stackoverflow and coderanch. This will teach you right things and much quicker than a book.

Solving others problems is difficult
11 months ago
In doPost method of Identification servlet use this code to redirect user to views/intranet.jsp:

// Forward to /WEB-INF/views/intranet.jsp
       // (Users can not access directly into JSP pages placed in WEB-INF)
       RequestDispatcher dispatcher = this.getServletContext().getRequestDispatcher("/WEB-INF/views/intranet.jsp");
       
       dispatcher.forward(request, response);
11 months ago
Use swing but get ready to hard work. Learn swing layouts first. Because I still do not know them well
11 months ago
Citation from Effective Java book:

"The Cloneable interface was intended as a mixin interface for objects to advertise that they permit cloning. Unfortunately it fails to serve this purpose ... This is a highly atypical use of interfaces and not one to be emulated ... In order for implementing the interface to have any effect on a class, it and all of its superclasses must obey a fairly complex, unenforceable and largely undocumented protocol"

11 months ago

final int x= y<10 ? y++ : z++;


This line means if y is less than 10, increment y by 1 and assign it to x, else if y is more or equal 10 increment z by 1.

In your program y is less than 10 and y is incremented first and then assigned to x.

From this we know that after condition ?: y++(or could be method call) is executed
Anonymous class is created with keyword new, name of interface or class. Example:
1 year ago
Learn java core. You need only core to start learning Android. Focus on java polymorphism,interfaces, oop design patterns. Learn java collections, java reflection,java type paramteres,java io, java threads.

Do more coding, cover tutorials and ask questions on forums.
1 year ago
JToggleButton has only two states selected and deselected. If you need listener to state changes use ItemListener:
1 year ago
If you explicitly define default constructor in superclass you can create any constructor in subclass.
1 year ago