Josh was reading a tutorial on the website at
http://www.htmlgoodies.com/primers/jsp/article.php/3478421 and felt
inspired to send me a question. He asked "I was looking at article
number 29. You have a test for zip code. It says if (x!=5 && x!=10)
..... Shouldn't this be OR and not AND??" Great question, Josh, and
thanks for sending it in.

This question highlights a very common programming error, which stems
from our everyday speech. In normal conversation we have a tendency,
when it comes to asking questions involving negatives, to incorrectly
form the question, and to rely on the listener to correctly interpret
the meaning. Listen to what I mean, not what I say, so to speak.

Here's an example: "Is it true that it's not red or black?" If we look
at it and see that it's green, we will say yes. But what if we see
red? We will tend to say that it's false, but we would be incorrect,
logically speaking. Here's why: expand the question to include all the
implied words and we get "Is it true that it's not red or that it's not
black?" If it is red it will fail the first part of the test, but it
will pass the second (it is not black.) Our question actually asked if
a OR b was true, so the correct answer is "yes, it is true." In fact,
the answer to the question is going to be yes no matter what color it
is!

What if we had asked "is it true that it's not red and black?" Our
everyday interpretation is now going to be looking for something that
has both colors. This makes it hard to ask the question correctly.
Maybe we should ask "is it true that is not red and that its not
black?" Hmmm.... that looks familiar! That's how the question is asked
in the tutorial -- it seems Joe got it right!

When it comes to negatives, our thinking can quite quickly become
befuddled! Try asking yourself "isn't it true that that's not quite
what I didn't actually ask?" Spend too much time with questions like
that and your brain will resemble spaghetti! Computers, on the other
hand, will simply follow the logic -- not matter what we really meant.
The trick is to use negatives sparingly and with caution.

Thanks for not ignoring!

- Vince Barnes

************************************************************

Q & A Goodies
***********************************
Questions are taken from submissions to our Community
Mentors. You can ask a Mentor a question by going to
http://www.htmlgoodies.com/mentors/

Q. How do I lose the blue line that appears round an image when I make
it a link?

Q. I am constantly creating files (pdf or word) files that I need to
show to many co-workers. Instead of having to email everyone every time I
finish a file, I would like to upload the file to my server and have
them view the list of files online and download the ones they want.
These files need to be password protected as different people in
different departments should only see files pertaining to them. Here was
my idea, create a bunch of password protected folders on a server - one
for each department, and I will upload the file to any folder that
should be allowed to view these files. Two questions: 1) I put the
files in a folder, but when I try to view the folder in a browser it
tells me I don't have permission to access this folder (I assume because
I never created an index file). How can I set it up that I should be
able to view a list of files that are in the folder? 2) how can I
create a page that will allow me to upload files to folders using a
browser?

A. I believe you are correct in that you do not have an INDEX file for
the server to show when you try to access the folder. You could create
an INDEX file with the links to the documents for downloading. I am
assuming that you have already password protected the folder? An even
easier way would be to use a password log in feature for your pages. The
application would allow users to sign up themselves and you would
control which group the user should be in and only the documents or
files you allow each group or person to view. There is a nice web
application called ASPLogin. It has to run on a server that supports
ASP. For example, to make a document available to all users in a group
called 'management', members of a group called 'administrators' and a
user called 'fred' (who may or may not be in either of the groups), you
would add the following code to the top of the document:
<%@ LANGUAGE=VBScript %>
<%
Set asplObj=Server.CreateObject("ASPL.Login")
asplObj.Group("management")
asplObj.Group("administrators")
asplObj.User("Fred")
asplObj.Protect
Set asplObj=Nothing
%>
Any other group or person trying to see that document will not be
allowed to see it. It is a pretty slick application You can take a look
here: http://www.asplogin.com
To create a page to allow you to upload documents would call for some
scripting. This all depends on what type of server you site is hosted
on. If it is a Windows server then it will support Active Server Pages
(ASP).

Q. Is there was a way to position a background image in the center of a
page regardless of screen resolution?

To position in the center of a table, try using this (be sure to replace
__ with the height and width of the image):
<body>
<table height="100%" width="100%">
<tr><td valign="center" align="center">
<table height="__" width="__" background="image.jpg">
Any text on the background
</table>
</td></tr>
</table>
</body>

Q. I want to change the background color of a cell containing a link,
but only when the mouse is on that link. Then it should go back to the
original color.

Did you ever wish your newsletter was an easy two way communications
medium? Ploof! It now is!
If you would like to comment on the newsletter or expand/improve on
something you have seen in here, you can now send your input to:

We already receive a lot of email every day. This address helps us sort
out those relating specifically to this newsletter from all the rest.
When you send email to this address it may wind up being included in
this section of the newsletter, to be shared with your fellow readers.
Please don't send your questions to this address. They should be sent
to our mentors: see
http://www.htmlgoodies.com/mentors/

Thanks for all your feedback!

Windows Tech Goodie of the Week
***********************************

Building an Image Keyword System

Unlike text-based file formats image files aren't made up of words,
which makes searching for an image file by keyword difficult. Instead of
being able to simply open the file to see what it contains, we're stuck
looking at the text around it and other metadata to determine the
image's meaning.
In this article, Ziran Sun shows you how to build a simple
database-based image keyword system that allows you to associate
keywords with images and use these keywords to make finding images
easier.

In this article we'll look at how, exactly, list controls are rendered.
We'll then see how to extend the list control classes to enable
attributes of the control's ListItem instances. Then we'll look at a
real-world demo that illustrates how to have a CheckBoxList with a
"None" checkbox option that, if checked, uses client-side script to
automatically uncheck all other CheckBoxes in the list. Read on to learn
more!

In addition to the primary goal of programmatically creating and adding
server controls to a web form dynamically, this script also illustrates
a number of other cool .NET concepts including: using an ArrayList to
populate a DropDownList, building a string using a StringBuilder, and
hiding sections of a page using the Panel web control.

If you ask me, it's one of the main reasons for visiting the French
Riviera - that, and pretty much everything else about the Riviera!
Delayed by World War II (it was originally to debut on September 1 1939,
but Hitler invaded Poland that day) the Festival de Cannes began on this
day in 1946 as a promotion to bring tourists back to the South of France
and the Riviera. By the 1950's the Festival International du Film de
Cannes had become the most prestigious film festival in the world.
Attended by more than 30,000 people each year, it is still regarded as
such by most people in the industry.

Today was also the day that in: 1664 Maryland enacted the first
anti-amalgamation law to prevent widespread intermarriage of English
women & black men; 1797 The US frigate Constitution (Old
Ironsides) was launched in Boston; 1830 first National Black
convention met in Philadelphia; 1881 Chester A. Arthur was sworn
in as President of the US; 1884 the Equal Rights Party nominated
female candidates for President and Vice-President of the US; 1954
the first computer program written in FORTRAN was run; 1958
Martin Luther King Jr was stabbed in the chest by a deranged black woman
in New York City; 1960 the United Nations General Assembly
admitted 13 African nations, along with Cypress, bringing the total of
member countries to 96; 1962 James Meredith was prevented from
entering Mississippi University as its first black student; 1972
police found cannabis growing on Paul and Linda McCartney's farm;
1973 Billy Jean King beat Bobby Riggs in the "Battle of the Sexes"
tennis match; 1975 David Bowie's "Fame" hit #1 (stayed for two
weeks); 1977 Voyager 2 was launched, the mission completed fly-by
passes of Jupiter, Saturn, Uranus and Neptune; 1985 Orlando's
Walt Disney World welcomed its 200 millionth guest; 1990 East and
West Germany ratified their reunification;