Ture Hefner

Greenhorn
+ Follow
since Nov 14, 2004
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
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 Ture Hefner

I read an article about this in the Denver Post this weekend. When I heard a more complete report on NPR today it brought back memories of my experience with heavy-handed censorship on a JavaRanch forum years ago, so I had to come back and respond to this thread.

I find the attacks against Kathy Sierra to be criminal and abhorrent. However, I also find the over-the-top censorhip practiced by this forum and, apparently, supported by Kathy, to be enough to make me stay away from this place.

I had vowed never to return to this place after what I considered to be unfair and biased editing/censorship of one of my posts after being chastised by some long-time posters. In my view, the censorship was way over the top and I stopped using this forum. I had to come back today to say that this whole crazy business with the attacks against Kathy is disgusting but it does not suprise me.

It is sad because the JavaRanch is such a cool resource otherwise and I guess I am kind of friends of friends of this place because I am a longtime Java programmer and I know people who know the people who run this place. It really bummed me out when they censored me years ago and I had to make the decision to leave. I believe that if you let adults be adults and don't try to censor every little thing then things will naturally settle at an acceptable level of civility. Kathy is way off the mark when it comes to the subject of censorship.

You can delete my account now, I'm never coming back.
16 years ago
Marcus,
I KNOW that. My point is that I believe it is very important to supplement your internet-based research with as many good Java books as you can get your hands on. If you want a job working the night shift in IBM's call center then listen to Mikalai and give up. He is right, it is tough to get a Java book in a village in India.
However, if you want to strive for a better job that will change your life and the life of the generations of your family that will follow you, then rise to the challenge and do everything you can to be the best Java developer that you can.
[Combative comment removed].
I am a citizen of the world who happens to hold U.S. citizenship. One of my grandfathers emmigrated to the US by himself without knowing any English and worked hard labor in factories in Chicago to get a better life. My mother was born of an eastern european family who could not afford to keep her, probably not too far from Mikali's home in Byelorussia. She was adopted as an infant by my grandparents, an American family. I am a white boy with Asian eyes. I have travelled every continent except Africa and Antarctica. I know what is out there. [Generally, if you have to say it in all caps, your points might be too emotional to help promote discussion]
[An insinuation that other posters are Less Than Perfect]
[ December 06, 2004: Message edited by: Michael Ernest ]
Yosi,

Sorry, here is the correct link to Rene's posting. She wants to sell her book cheap. If you live in Asia, the postage will be low:

https://coderanch.com/t/168628/java-Web-Component-SCWCD/certification/HFSJ
Here you go, Yosi:

Rene is selling her book for $23 and she will mail it to you:

https://coderanch.com/t/168635/java-Web-Component-SCWCD/certification/SCWCD-Day-Result-unknown

If there is anyone out there who cannot afford a technical book or lives in a location in which it is logistically impossible to get one: I would encourage you to Google "technical book donations" or something like that. There are lots of organizations that are trying to help you.
Hello Sundar,
In my opinion, the ultimate goal of a programming certification is to help you gain employment or to help you advance to a better job with the employer you already have. A certification will not necessarily get you a job, but I think that getting a certification increases your chances in two ways:

1) by studying for the certification you will fill in some of the gaps in your knowledge and you will reinforce what you already know. The more completely you know your subject, the more likely you are to succeed in using the technology to make something that works. The more often you make stuff that works, the more obvious it will be to an employer or prospective employer that you are a desirable employee.

2) an employer can assume a basic level of knowledge from a candidate who holds a certification. This makes it easier on an employer when they have a stack of 100 resumes and they need to trim it to a dozen for initial phone interviews.

However, the certifications won't get you anywhere if you don't practice what you know. In a technical interview you won't get any slack just because you have a cert. Unless it is an entry level position you will be expected to prove your knowledge within the first few minutes.

The certification gets your foot in the door for a technical interview and it helps strengthen you for the onslaught once you get it.
Hello Taty,
The mime-mapping doesn't directly set the content type of the response as far as I know. You can use the mime-mapping to decide what to use in ServletResponse.setContentType(String type) when you receive a GET request for a file with an extension that you have mapped.

How do you get the mime-type when you know the extension of the file that the client has requested? Use ServletContext.getMimeType(String file):

As far as I know, the servlet container uses your mime-mapping to maintain a map that is used to return values for the ServletContext.getMimeType() method and that is all the container uses that mime-mapping for. However, I could be wrong. I haven't seen any documentation about how it is used, from start to finish, in the real world and I have never used it in the real world.
Hi V.,
Don't worry. You are understanding it correctly. The answer in the book is wrong. Check out the errata at

http://www.oreilly.com/catalog/headservletsjsp/errata/

"[416] Be the Container Answers;
The third example will not work for the same reason that the first example doesn't work, because the attribute is at Request Scope, and the default scope is Page scope. The handwritten comment for bullet #3 should be the same as for bullet #1."
Mikalai,
I KNEW that someone was going to rip on me for giving a US-centric answer to the question.
My US-based international company is hiring lots of J2EE developers in India and China right now and we have been for quite a while. It is like a goldrush for J2EE developers outside of the US right now. Our developers in Bangalore make a lot less than those in the US, but they make enough that $80 or $90 is not significant compared to the money they can make as a J2EE developer.
Your sarcastic response is not appreciated, Mikalai.
[ MC snipped retaliatory sarcastic comment ]
[ December 05, 2004: Message edited by: Mike Curwen ]
Janna,
I would ask the testing center to give some of the $150 back if I were you. They probably make a nice profit for renting out decrepit office space on the wrong side of town.
It works for me with the latest (WLS 8.1 SP3). Sorry, I don't have 7.0 installed anymore.

In the J2EE spec, it says "See the servlet spec for detailed requirements of
context root naming." In the servlet spec, I don't see much. I would probably not end it with /, from what I read.

This works fine for me in application.xml:

<module>
<web>
<web-uri>beer.war</web-uri>
<context-root>beer/ture</context-root>
</web>
</module>

I access it like this:
http://localhost:7001/beer/ture/form.html

In the end, this is probably something to take up with BEA support. The context-root in application.xml is part of the J2EE packaging, used to override the context-root in weblogic.xml (which is, of course, WLS specific), which is used to override simply using the uri minus the .war extension as the context-root.

http://e-docs.bea.com/wls/docs81/webapp/weblogic_xml.html#1040721

I don't think the SCWCD exam covers J2EE app (EAR) packaging. It just covers the web app (WAR) as far as I know, so this forum probably won't be the best place to get an answer.
Hasan,
Servlets come before JSPs in J2EE books because JSP pages become servlets. An understanding of servlets is required before you can have an understanding of JSPs.
Someone I know recently interviewed someone with JSP/servlets on their resume and they couldn't tell him that a JSP becomes a servlet without a lot of hints. That doesn't happen often...usually if they stumble they will have a problem with some part of the servlet/JSP lifecycle, not the entire thing. He didn't get the job.
Yosi, the HFS&J book is great. So is Hanumant's old J2EE 1.3 version of the SCWCD exam study kit. Yosi, why would you want to try to pass the test without buying a book?

How much is the test? $150? It costs a lot more than a few books.

If you are already working and your company won't buy you a few books for you to study for SCWCD then you should check out dice.com and get another job because that is not the kind of employer who cares about the development of their employees.

If you are not working and you don't have much money then consider this a wise investment. Go make $40 however you can so you can buy the book: a strong J2EE developer can make a lot of money.

Yosi, if you are just taking this test for your own satisfaction and for the sense of accomplishment that it will bring you then my statements are wrong. If I am wrong, and you are doing this for fun, then you have too much time on your hands and I would recommend growing a beard and taking up surfing or some other pursuit more meaningful than J2EE development.
Right. If you override the init(ServletConfig sc) method in a Servlet, you must still call the overridden method in order to initialize the instance varible that keeps a handle to the ServletConfig. However, you use the "super" keyword to do this, not "base":

// base.init(sc); // nope
super.init(sc); // yessiree

See http://java.sun.com/docs/books/tutorial/java/javaOO/methodbody.html
The session is scoped at the web app (servlet context) level. If you put an attribute into the HttpSession, you can get to it from any JSP or servlet in your web app. See the servlet 2.4 specification:

SRV.7.3 Session Scope
HttpSession objects must be scoped at the application (or servlet context) level. The underlying mechanism, such as the cookie used to establish the session, can be the same for different contexts, but the object referenced, including the attributes in that object, must never be shared between contexts by the container. To illustrate this requirement with an example: if a servlet uses the RequestDispatcher to call a servlet in another Web application, any sessions created for and visible to the servlet being called must be different from those visible to the calling servlet.
Alec,
I like to use PuTTY to sniff HTTP response headers:

http://www.chiark.greenend.org.uk/~sgtatham/putty/

I learned how to use PuTTY to sniff HTTP request/response when I was reading the O'Reilly book for Struts. It is mentioned somewhere in the introductory chapters. If you install PuTTY then you can configure a session to hit your Tomcat server. Use the PuTTY GUI to configure these settings for your session:

host=localhost
port=8080
protocol=raw
close window on exit: never
You can turn on logging if you want.

Type your HTTP request into a textpad and copy it to get it into your buffer so you can quickly paste it when you open a connection to your server. Something like this:

GET /Beer-v1/form.html HTTP/1.1
Host: www.wickedlysmart.com
User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac )S X Mach-O; en-US; rv1.4) Gecko/20030624 Netscape/7.1
Accept: text/html
Accept-Language: en-us
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive

Hit the "Open" button on the PuTTY gui to open a connection to your web server.

Paste your request into the window that pops up by right-clicking the mouse
and then hit return a few times (you need a blank line to end the request, I think).

If you set PuTTY to "close window on exit = never" then you will see the HTTP response in the window:

HTTP/1.1 200 OK
ETag: W/"540-1100387127031"
Last-Modified: Sat, 13 Nov 2004 23:05:27 GMT
Content-Type: text/html
Content-Length: 540
Date: Sun, 21 Nov 2004 22:37:40 GMT
Server: Apache-Coyote/1.1

<html>
<body>
<h1 align="center">Beer Selection Page</h1>
<form method="post" action="SelectBeer.do">
Select beer characteristics<p>
Color:
<select name="color" size="1">
<option>light
<option>amber
<option>brown
<option>dark
</select>
<br><br>
<center>
<input type="submit">
</center>
</form>
</body>
</html>