Tuesday, December 10, 2024

Goodies To Go! Newsletter #363


************************************************************
Goodies to Go ™
November 15, 2005 — Newsletter # 3
63
 
This newsletter is part of the internet.com
network.
http://www.internet.com
 

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


Featured this week:
 
*   Goodies Thoughts – World Wide Pizza
*   Q & A Goodies
*   News Goodies
*   Feedback Goodies
*   Windows Tech Goodie of the Week 
*   And Remember This…
 
************************************************************
 

World Wide Pizza
 
There is absolutely no doubt that the best thing to happen to the world
since sliced bread is the World Wide Web!  Here’s the proof:  I can now be
sitting at my computer, typing in commands to which computers around the
world will respond (such is my job) and when this tires or bores me, or when
I feel a tad peckish, I can simply type in a few more commands to which
computers around the world and my local pizzeria will respond!
 
I did this a few minutes ago and am now awaiting an extra large with all my
favorite toppings.  How great can it get? — I don’t even have to leave my
chair before someone will bring me everything I need to gain far more weight
than my body should carry!  Along the way, however, I couldn’t help but
notice something that irked my sense of professionalism.  "I have to tell my
readers," I thought, "in order to help them avoid this pitfall."  And so,
(and while I’m at it, let me quickly apologize for gratuitously advertising
my personal favorite pizza delivery company, but it’s necessary so that you
can see for yourself what I’m talking about) here it is:
 
I went to www.papajohns.com, put in
my email address and password and clicked on their "Order Online" link. 
They have a great menu system whereby you can check out their specials,
order by size or type of pizza, select drinks or extras, everything you
could want, easily laid out.  If you choose to create your own custom pizza,
you get to select size and crust type and add toppings either in half pizza
or whole pizza ranges.  (It occurs to me that if I was to order, for
example, three half toppings, how would they know which ones were to go with
which?  Clearly there could be quite a number of variations!)
 
Having selected the pizzas, drinks extras, etc., that are needed you proceed
to checkout — all standard shopping cart stuff, all working very well.  At
the checkout summary page, you can add a tip for the driver, select your
payment method and proceed.  I chose credit card, put all my CC info into
the secure page (having checked the certificate, of course — <G>) clicked
confirm and received the confirmation page.
 
The confirmation page showed me Amount, Delivery Charge (yes, believe it or
not, they charge for delivery!), Sales Tax (unlike some countries, in the US
the sales tax is always added as a separate item after totaling the pre-tax
charges) and Grand Total.  Here’s the problem….. I couldn’t remember if I
added the tip for the driver!
 
I had seen the total for the items ordered on the checkout summary page, but
with my mouth beginning to water in anticipation, I hadn’t been paying that
much attention to it.  What irked me a little was that while I had
previously seen the sub-total amount for the items ordered, I was now being
presented an "Order Amount" that included the tip…. if I had entered one. 
I now had no way of checking.  If the confirmation page had carried the tip
as a separate item along with the other non-item-ordered amounts, as it had
been on the summary page, I would not have had the problem.  As it was, I
had to call their customer service phone number to find out.  Now, you know
how much I enjoyed that!!
 
The problem is a simple, little, and I’m afraid too common, slip in the
programmer’s mind (or programmers’ minds.)  For just that one moment, they
forgot to see things from the buyer’s perspective, and continued with things
from the computer’s logical accumulation of information point of view.
 
A tiny slip that resulted in the need for a phone call, which needed a
person to answer it and look things up on another computer, etc….  all of
which wasted money that could otherwise have allowed a little extra sausage
on my pizza.  Clearly you can see what kind of disaster that is!
 
 
 
 
 
Thanks for reading!
 
 
 
 
 
– Vince Barnes
 
 
 
 
 
************************************************************
 
Q & A Goodies
***********************************
Questions are taken from submissions to our Community
Mentors. You can ask a Mentor a question by going to
https://www.htmlgoodies.com/mentors/
 
 
Q. I’m making a website with a "fixed" background.  I can’t figure out how
to make the picture fit the browser perfectly on everybody’s system.  Is
there a code I can place inside my document to alter the fixed background to
fit the browser?  My site content will go into a smaller screen/box within
the background so there is no need for scrollers on my outside browser and
my background image doesn’t need to be tiled because it basically is my
site.
 
A. You can use Cascading Style Sheets to fix a background image. The code
would have to be edited for your particular situation and image but here is
the code:
<style type="text/css">
body {
background-image: url("/images/your_image_name.gif");
background-repeat: no-repeat;
background-attachment: fixed
}
</style>
 
 
 

    
Q. I am trying to figure out how to make a check box on an HTML form checked
by default.
 
A. If you want a check box to be checked when the page opens you can do it
without JavaScript like this:
<input type="checkbox" id="ckbox" checked>
With JavaScript you can set the checked property to true when the page loads
like this:
<script type="text/javascript">
  document.form_name.check_box_name.checked=true
</script>
The above will work if there is only one checkbox.  If you have multiple
checkbox’s with the same name then you have to specify itslocation in the
array like this:
<script type="text/javascript">
  document.form_name.check_box_name[0].checked=true
</script>
The above would set the first checkbox’s checked property to true.
 
 
 

    
Q. I am looking for JavaScript help in order to pre-select a option in a
select field inside a form.  I am using server-side scripting (PHP) in order
to provide the selected value.
 
A. You could use PHP to create your option tag and select the option you
want that way.  I have a small Help Desk application written in PHP that I
have set up dropdowns to select the date.  I have them default to the
current date.  Here is an example of the dropdown for the
month:
<select name="beg_req_month">
   <?php
   for($i=1;$i<=12;$i++)
        {
         if($i==$prob_month)
           {print "<option value=’" . $i . "’ selected>" . $i .
"</option>n";}
         else
           {print "<option value=’" . $i . "’>" . $i . "</option>n";}
        }
   ?>
   </select>
The variable $prob_month is set to the current month in some previous code. 
For Javascript to set the selected option you would use a statement like
this (which sets the first option tag to selected):
document.form_name.select_name.options[0].selected=true
[Beware of the period following the less than symbol in the "for" statement
above — this is one of the periods inserted as a part of the technique
mentioned in the note at the beginning of this section & does not belong in
the code you execute — Ed.]
 
 
 

 

Q. Is it possible to change the link color with the onMouseOver command?
 
A. Yes it is.  I have done it using JavaScript (there is also a way using CSS).  Here is my JavaScript version:
<html>
<head>
<title>Change Link Color</title>
    <style type="text/css">
      /* Set colors for IE5.0+ and Netscape 6.0 */
     .textRed {color:red}
     .textBlue {color:blue}
     .textLgreen {color:lightgreen}
     /* Set colors for Netscape 4.0+ */
     A.normal{color:blue}
     A.over{color:red}
     A.overb{color:lightgreen}
     /* No underline on link for all browsers */
     A{text-decoration:none}
    </style>
     <SCRIPT LANGUAGE="JavaScript">
       /* This script was written by Jim Young of
www.requestcode.com and has been
tested in Internet Explorer 5.0+, Netscape 4.0+ and Netscape 6.0.  I use the
statement (this.className) to  change the class for the links in NS6 and
IE5.0+ .  The scripts below are strictly for NS4.0+ . Add links below that
are in the same order as your links in the body section.  the format for the
array is:
           page to link to, the link name(what is displayed on your page),
div id, class(color) for the mouseover, and class(color) for the mouseout.
Make sure you separate them by a comma (,).
     */
    var links = new Array()
          links[0]="http://www.wsabstract.com,Website
Abstraction,divLink0,over,normal"
          links[1] ="http://www.requestcode.com,Requestcode,divLink1,overb,normal"
    //  Unless you absolutely have to DO NOT change the functions below.
    function change(linknum)
          {
           if(document.layers)  // Check for NS4.0+
             {
              linkval=links[linknum].split(",") // split out the values
              linkpage=linkval[0]
              linkname=linkval[1]
              linkdiv=linkval[2]
              linkclass=linkval[3]
              var linkd="<A HREF="+linkpage+" CLASS="+linkclass+"
onMouseOut=changeb(""+linknum+"")>"+linkname+"</A>"
              var docwrta="document."+linkdiv+".document.write(‘"+linkd+"’)"
              eval(docwrta)
              eval(‘document.’+linkdiv+’.document.close()’)
             }
          }
   function changeb(linknum)
        {
         if(document.layers)
           {
            linkval=links[linknum].split(",")
            linkpage=linkval[0]
            linkname=linkval[1]
            linkdiv=linkval[2]
            linkclass=linkval[4]
            var linkd="<A HREF="+linkpage+" CLASS="+linkclass+"
onMouseOver=change(""+linknum+"") onMouseOut=changeb(""+linknum+"")
>"+linkname+"</A>"
            var docwrta="document."+linkdiv+".document.write(‘"+linkd+"’)"
            eval(docwrta)
            eval(‘document.’+linkdiv+’.document.close()’)
           }
        }
     </SCRIPT>
</head>
<body>
  <SCRIPT>
      /* If you add more links here make sure you update the links array
with the same url and other required information.  Make sure they are
entered in the array in the same order as they appear on your page. Also
remember to change the value being passed on the mouseover and mouseout to
the functions to match the entry in the array.  Make sure you use different
names for each div.  In the mouseover for IE and NS6 you can change the
class name specified by the statement this.className to a color you have
setup in the styles area in your head section above.  You should leave the
class(color) for the mouseout the same as when your link is displayed when
the page is first loaded.  I currently have them set to blue which is the
class normal.
     */
  </SCRIPT>
<CENTER>
<H1>Link Effect Example</H1>
Run your mouse over the links to see them change color </CENTER> <div
id="divLink0" style="left:15; position:absolute; top:90;
visibility:visible">
 <a href="http://www.wsabstract.com"
onMouseOver="change (‘0’);this.className=’textRed’" class="normal"
onMouseOut="changeb (‘0’);this.className=’textBlue’">Website
Abstraction</a> </div> <div id="divLink1" style="left:15; position:absolute; top:120;
visibility:visible">
 <a href="http://www.requestcode.com"
onMouseOver="change (‘1’);this.className=’textLgreen’" class="normal"
onMouseOut="changeb (‘1’);this.className=’textBlue’">Requestcode</a>
</div>
</body>
</html>
 
 
 

 
 
Q. How do I lose the blue line that appears round an image when I make it a
link?
 
A. In the IMG SRC tag add this:
border="0"
 
 
 

    
Q. Is there any way to place text on top of pictures?

 
A. Here is the link to see how that’s done:

https://www.htmlgoodies.com/tutors/textonimages.html
 
 
 
 
 
 
 


Discussion Goodies

***********************************
 
Have you seen the discussion forums on the HTML Goodies website?  It’s a
great place to get help from others who, just like you, are developing web
pages.  Many different topics appear in the forum, and a new one will appear
if you create it!  Here’s a sample of recent topics:
 
 
 
What is attribute to get horizontal scroll bar?:

http://www.webdeveloper.com/forum/showthread.php?threadid=84787
 
How to reference an element in the previous web page?:

http://www.webdeveloper.com/forum/showthread.php?threadid=84751
 
File upload (image) requires reload to appear:

http://www.webdeveloper.com/forum/showthread.php?threadid=84747
 
 
 
 
 
 
 
News Goodies
***********************************
 
Gas Prices Fueling Online Holiday Outlook
[November 8, 2005] Online sales are expected to grow again this holiday
season.
Read the article:

http://www.internetnews.com/ec-news/article.php/3562496
 

Sun CTO: ‘Microprocessors Are About to Die’
[November 15, 2005] Greg Papadopoulos says "server-on-a-chip" processors
signal the end of traditional microprocessors. 
Read the article:

http://www.internetnews.com/ent-news/article.php/3564231
 

Microsoft’s 64-Bit Support Rains In Spain
[November 15, 2005] The company pledges allegiance to 64-bit computing and
ties Great Plains software to Office, among other things.
Read the article:

http://www.internetnews.com/ent-news/article.php/3564346
 

Supercomputing With Microsoft
[November 15, 2005] The software giant’s new Windows Compute Cluster Server
2003 is aimed at serving departments and workgroups.   
Read the article:

http://www.internetnews.com/ent-news/article.php/3564061
 

Google, Pheedo Give Away Analytics
[November 15, 2005] Growing interest in analysis of Web site, blog and ad
performance reflects complex marketplace.
Read the article:

http://www.internetnews.com/xSP/article.php/3564191
 

MSN Rolls Enterprise-Strength Desktop Search
[November 15, 2005] New version aims at coming Microsoft services.
Read the article:

http://www.internetnews.com/ent-news/article.php/3564106
 

Small Business a Cisco Target
[November 15, 2005] The company’s Linksys division unveils a new offering to
deliver broadband, hosted business software and VoIP.
Read the article:

http://www.internetnews.com/ent-news/article.php/3564311
 

Keeping Drugs Legit With RFID
[November 15, 2005] Sun’s new RFID package helps track and verify drugs from
factory to pharmacy.
Read the article:

http://www.internetnews.com/ent-news/article.php/3564226
 

Ebay Frees Its Developer API
[November 14, 2005] Five years after its original launch, eBay removes all
fees for accessing its APIs. 
Read the article:

http://www.internetnews.com/dev-news/article.php/3563941
 

AOL Streaming Reruns
[November 14, 2005] AOL and Warner Brothers to deliver old television shows
over the Internet.  
Read the article:

http://www.internetnews.com/xSP/article.php/3564011
 
 
 

 
 
 
Feedback Goodies
***********************************
 
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:
 
mailto:nlfeedback@htmlgoodies.com
 
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

https://www.htmlgoodies.com/mentors/
 

Thanks a lot for all the support for my position on software piracy — when
I think about the fact that my livelihood depends in part on software
buyers’ honesty, I am reassured by those responses.
 
I must send a quick message to Andrew B. in response to his comment which,
while not the only one in the same vein, was one in a tiny minority.  Andrew
says,
 
"First off all, software Pirates are not straight out thieves. They take a
couple dollars from multibillion dollar companies. Unless everybody starts
pirating files, the music, video and software industries will still make a
fairly decent profit (billions of dollars). I pirate software because it is
outrageous to pay $170 U.S for Windows XP pro. I could get a decent computer
with Linux for that price. If companies stated charging less for their
digital products I would consider switching to legal methods. I tunes is a
start but it is still very expensive. Fortunately Bill gates, being a
multibillionaire, will not be worried about losing a few bucks, or in his
eyes a couple pennies."
 
It’s not Microsoft you’re stealing from, Andrew (and even less Bill Gates!)
It’s me, and your neighbors, and your friends.  Microsoft does not simply
suffer the loss of revenues due to piracy, nor do they simply suffer the
cost of their anti-piracy campaigns or legal costs involved in seeing
pirates charged.  They add those charges into the cost of their products,
and we all pay for them — just the same way that we all pay for items
shoplifted out of our local stores.  Please don’t make the mistake of
thinking that a crime is OK because you believe the victim can afford it. 
Software pirates are thieves — criminals — and we are all their victims.
 
 
 
Thanks for all your feedback!
 
 
 
 
 
 
 

Windows Tech Goodie of the Week 
***********************************
 
Working with Databases in ASP.NET 2.0 and Visual Studio 2005
 
In this article we’ll look at how to connect and display data from a
database in ASP.NET 2.0. Specifically, we’ll see how to use both the
programmatic and declarative approaches for accessing data, as well as the
basics of displaying data using the GridView control. Read on to learn more!
 
 
*** AND ***
 

Simple Database ASP.NET Sample Code
 
It seems you can never make code simple enough. No matter how many database
related samples I publish, I’m always getting requests for simpler ones.
Well, this one is as simple as they get. This script connects to our SQL
Server database, executes a basic query, and drops the results right into a
DataGrid. You won’t find any fancy formatting or cool tricks in this sample,
just straight-forward code — plain and simple.
 
 

*** AND ***
 

An Examination of Visual Basic’s Random Number Generation
 
In this article Mark Hutchinson takes an in-depth look at Visual Basic’s
pseudo-random number generator. In particular, he discusses the Randomize,
Rnd and Timer functions, why the numbers generated aren’t really random, and
what that means for your applications.
 
 
 
 
 
 
 
 
 
 
 
 
And Remember This …
***********************************
 
1984 Baby "Fae" died
 
At the Loma Linda University Medical Center in Loma Linda, California,
doctors attempted a radical procedure to save the life of an infant, dubbed
"Baby Fae" to protect her family’s privacy.  Baby Fae had been born with a
heart abnormality which almost always resulted in death.  Heart surgeon Dr.
Leonard L. Bailey persuaded her parents to allow him to try an experimental
Baboon heart transplant procedure.  Previously, three other patients had
received animal heart transplants, but none had survived more than
eighty-four hours.  Dr. Bailey felt that an infant like Fae would have a
better chance since their immune system was less developed and would not be
able to reject the heart so easily.  The operation was performed on October
26, 1984, when the infant was fourteen days old.  Initially, prospects were
positive.  After a couple of weeks, however, her body’s rejection of the
alien organ began to build.  The required increase in immunosuppressive
drugs caused a kidney failure, and eventually led to a heart failure which,
on this day in 1984, proved fatal.  She lived for twenty days.
 

Today was also the day that in: 1763 Charles Mason and Jeremiah Dixon
began surveying the line between Pennsylvania and Maryland (the Mason-Dixon
line); 1777 the Articles of Confederation were adopted by the
Continental Congress; 1806 explorer Zebulon Pike sighted Pike’s Peak;
1932 the Walt Disney Art School was created; 1939 the US
Social Security Administration approved its first welfare check; 1957
Soviet spy Rudolf Ivanovich was sentenced to 30 years and $3,000 fine in the
US; 1969 250,000 protesters held a peaceful demonstration against the
Vietnam War in Washington DC; 1969 Janis Joplin was accused of
"vulgar and indecent language" in Tampa, Florida, US; 1982 Funeral
Services were held in Moscow’s Red Square for Leonid Breshnev; 1983
Turkey proclaimed the "Turkish Republic of Northern Cyprus"; 1988 the
Palestine Liberation Organization (PLO) proclaimed the State of Palestine,
recognizing also the existence of the State of Israel;
 

Born today were: in 1708 the "Great Commoner" and twice UK Prime
Minister, William Pitt the Elder; 1738 discoverer of Uranus,
astronomer Sir William Herschel; 1815 painter of the world’s largest
painting, the "three mile canvas", John Banvard; 1882 Austrian, and
US Supreme Court Justice, Felix Frankfurter; 1891 WWII German African
Campaign Field Marshall Erwin Rommel;  1905 Italian orchestra leader
Mantovani; 1919 Louisianas "People’s Court" Judge Joseph Albert
Wapner; 1923 English actor Peter Hammond; 1929 actor Edward
Asner; 1931 actor John Kerr; 1932 English singer Petula Clark;
1933 comedian Jack Nurns; 1934 actress Joanna Barnes; 1937
actor Yaphet Kotto; 1939 actor Thalmus Rasulala; 1945 Swedish
musician Anni-Frid Lyngstdad (ABBA); 1954 actress Bevery D’Angelo;
1977
9th in succession to the throne of the United Kingdom Peter Mark
Andrew Phillips;
 

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Popular Articles

Featured