Goodies To Go! Newsletter #384

By Vince Barnes

************************************************************
                      Goodies to Go (tm)
               April 11, 2006 -- Newsletter # 384

     This newsletter is part of the internet.com network.
                  http://www.internet.com

          Please visit http://www.htmlgoodies.com
************************************************************

A Note about Email Filtering:
All Goodies To Go newsletters are sent from the domain "internet.com."  Please use this domain name (not the entire "from" address, which varies) when configuring e-mail or spam filter rules, if you use them.
 

Featured this week:

*   Goodies Thoughts - A Global Problem
*   Q & A Goodies
*   Discussion Goodies
*   News Goodies
*   Feedback Goodies
*   Windows Tech Goodie of the Week 
*   And Remember This...

A Global Problem

Universal truth, the Mr. Universe competition, a "Galaxy of Savings" (as a local car dealer here proclaims) and many other examples illustrate how we love to bandy around adjectives whose real meaning is so large and whose scope encompasses so much that we could not possibly support the claim in anything resembling reality.  How then is the humble programmer to understand when, in a field where precision is paramount and everything is either just right or simply wrong, we take such an adjective and apply it to a simple programming task? How indeed?!  The answer, as you are probably aware by now, is by reading Goodies To Go, where programming tasks, when simply explained, become simple!

Questions arise frequently concerning the penchant we have in this field for using the word "global" for a wide variety of things of varying scope.  Global, of course, is meant to refer to the globe we know as Earth, and means something whose scope affects the whole world.  Euphemistically, that's just how we use it, but the question is, what do we mean by our "world" when we do?

One example is the term "Global Variable".  A variable is a data element used to hold a value that changes, as opposed to a constant, which is a data element whose value does not change.  Various program languages will refer to "global" and "local" variables.  The difference between the two is whether they are confined to a specified scope or are available outside that scope.  What the scope is depends on the language and sometimes even on the context.

For example, in JavaScript, a local variable is one defined within a function using the "var" keyword.  The value of this variable will unavailable to any other function on the page, or to any JavaScript code outside the function.  JavaScript variables defined without the "var" keyword, or defined outside a function, are global.  A global variables value is available to any function or any JavaScript code on the page.  Thus, the scope, or "world",  referred to by "global" in reference to JavaScript variables is a particular JavaScript function.   Any JavaScript code on a different page, even though it is part of the same website and held on the same server, might as well be on a different planet as far as that variable is concerned!

Another example is the expression "global edit".  This is a common task that programmers face.  For example, if you copy some HTML code from this newsletter into a page you are working on, we have advised you to perform a global edit on the opening tag markers to change "<." into "<" so that they will work on your page (see the note at the beginning of the Q & A Goodies section.)  In this case, "global" means "more than one at a time."

In my favorite text editor (UltraEdit -- see http://www.htmlgoodies.com/beyond/webmaster/toolbox/article.php/3473431 ) it is up to me to define the scope that I want "global" to mean.  I can open a file and replace each instance f a string in that file; or I can open several files and replace every instance of a string in all of them.  I can also instruct it to replace a string in every file having a name matching a pattern I specify and residing in a directory (a folder) I specify.  I can also say whether or not to search within subdirectories.  In this way I can define my "world" far a global edit and can save a lot of time by so doing.

When malformed variables are creating conflicts within a series of programs I have, a well thought out global edit can restore harmony to the system.  If only it were that easy with that other kind of global peace.


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
http://www.htmlgoodies.com/mentors/


XXXXXXXXXXXXXXXXXXXXXXXXXX
X                        X
X   Please take note:    X
X                        X
XXXXXXXXXXXXXXXXXXXXXXXXXX

We have had a number of people indicate that their email client programs are interpreting code examples in this newsletter as actual HTML code instead of text.  To overcome this problem and to enable everyone to read the newsletter, there is a period after the "<" in each tag.  If you cut and paste to try out code examples, please remember to remove the periods.  Wherever we intend you to use "<." in your code, the example will show "<..".  In this way, you will be safely able to use a global edit to change "<." to "<".  Thanks to all of you for your patience with this; if this technique creates an undue problem for you however, please let us know via our feedback address (see Feedback, below).


*** This question was submitted to our Mentor Community.
     The answer was provided by one of our Mentor Volunteers
    
Q. I have a piece of Java script I got off the HTML goodies page to open a new window. It works well enough but what I want it to do is to run from an onClick event handler. How do I get it to do this.?

A. You will have to place the window.open into a function and then You can call the function either by using the onClick or by placing the function call in the "href".  Here is an example:
<.html>
<.head>
   <.title>Open new window<./title>
<.script LANGAUAGE="javascript">
         function OpenWin()
                 {
                  MessageWin=window.open ("http://www.wsabstract.com", "newwin",config="location=no,status=no,directories
=no,toolbar=no,scrollbars=no,menubar=no,resizable=no");
                 }
<./script> 
<./head>
<.body>
<.center>

You can do it this way:
<.a href="JavaScript:OpenWin()">Click here<./a> <.br>Or you can use the onClick
event:
<.a href="#" onClick="OpenWin()">Click here<./a>
<./center>
<./body>
<./html>

This is but one example.  You can also set up the function to accept a variable that contains the link you want to open up in the new window like this:
<.html> <.head>
   <.title>Open new window<./title>
<.script LANGAUAGE="javascript">
         function OpenWin(linkid)
                 {
                  MessageWin=window.open
(linkid, "newwin",config="location=no,status=no,directories=no,toolbar=no,scroll
bars=no,menubar=no,resizable=no");
                 }      
<./script> 
<./head>
<.body>
<.center>

You can do it this way:
<.a href="JavaScript:OpenWin('http://www.htmlgoodies.com')">Click here<./a>
<.br>Or you can use the onClick event:
<.a href="#" onClick="OpenWin('http://www.htmlgoodies.com')">Click here<./a> <./center> <./body> <./html>

This will allow you to use the same function for multiple links.


*** This question was submitted to our Mentor Community.
     The answer was provided by one of our Mentor Volunteers
    
Q. I need to set the background to ivory for the cells within my links table and also to center text witin each cell, make font size 8 points, and change text to uppercase. Here is the html code:
<.table id="links">
<.tr>
   <.td>
      <.a href="#">Home Page<./a>
   <./td>
   <.td>
      <.a href="#">Tickets<./a>
   <./td>
   <.td>
      <.a href="#">Events<./a>
   <./td>
   <.td>
      <.a href="#">Tour<./a>
   <./td>
   <.td>
      <.a href="#">Contact Us<./a>
   <./td>
<./tr>
<./table>

and here is my css sheet:
body {background-image: url(back.jpg)}
b {color: blue}
a {text-decoration: none; color: black}
a: hover {color: red; text-decoration: underline}
#links {width: 100%; border-bottom: solid red 3px; center center;
font-size: 8pt; font-family: Arial, Helvetica, sans-serif;
text-transform: uppercase}
td {background-color: ivory; center center;  border: groove red 5pt}
#calendar {float: right; border: groove red 10pt; width: 75%}
th {background-color: lightblue; font-family: Arial, Helvetica,
sans-serif;
border: solid blue 1px}
.prev {border-style: none; background-color: white}
.next {border-style: none; background-color: white}


A. Your css should look something like this:
#links {
 width: 100%;
 border-bottom: solid red 3px; }
#links td {
 background-color: ivory;
 font-size: 8pt;
 font-family: Arial, Helvetica, sans-serif;
 text-transform: uppercase;
 text-align: center;
 border: groove red 5pt; }

I moved the text and font properties to the TD of the table instead. If you want to center something, use the "text-align: center;" definition for your style.

*** This question was submitted to our Mentor Community.
     The answer was provided by one of our Mentor Volunteers
    
Q. I love the Dual Image Flip effect. Instead of buttons I'd like to put plain old links. I don't know how to do this and if I change a thing, it won't work. Please help!  Also, I need help on putting the image in one place, and placing the text in another. I have a square box that I need to put the image flip in.

A. Here's what you want:
<.html>
 <.head>
  <.title>Image Flip<./title>
  <.script language="JavaScript">
   function flip(img,imgn)
    {
     document.images[imgn].src=img
    }
  <./script>
 <./head>
 <.body>
  <.a href="somepage.html" onmouseover="flip('1.gif','pica')" onmouseout="flip ('0.gif','pica')">Mouse Over Me<./a>
  <.img src="0.gif" name="pica" border="0"><./a><.br>
 
 <./body>
<./html>
As far as placing the picture it depends on how you have your square box defined.  You could use a table to position the image or even layers such as <.div> or <.span> in combination with the style tag.

*** This question was submitted to our Mentor Community.
     The answer was provided by one of our Mentor Volunteers
    
Q. I would like to do is to have the main window either resize with no menus (Like a standard pop up window, but without the pop up) or to have my swish (it's a product like Flash) come up in the browser window but sized at the right size without the user being able to change it.
 
A. Here is an example of how you can keep the main window at a set size, but you can change the other properties such as location, status, directories, etc. <.html> <.head> <.title>Resize test<./title>
   <.script language="JavaScript">
      function doresize()
        {
         window.resizeTo(600,400)
        }
   window.onload=doresize
   <./script>
<./head>
<.body onResize="doresize()">
        <.center>
        <.br><.br><.br><.br>
        <.h2>Resize<./h2>
        <./center>
<./body>
<./html>

*** This question was submitted to our Mentor Community.
     The answer was provided by one of our Mentor Volunteers

Q. Is there anyway that I can get a functioning login and password box so that I can have people become members of my website?  If so, do you know where I could find a layout or a template for that code?

A. There are a couple of ways to do that. The easiest way with no scripting is to password protect an entire folder. Your host may offer this. They would have to set it up for you. They then give you access to a text file that you can edit with as many passwords as you need. The other way would require some kind of scripting and possibly a database to hold the usernames and passwords. The scripting involved would depend on what you server supports. If it is a Linux server then you would have to use PERL or PHP. If it is a Windows server then you can use Active Server Pages(ASP). Take a look here: www.code4u.com. You may find something to use.

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 the difference between &quot;www&quot; and &quot;www1&quot;:
http://www.webdeveloper.com/forum/showthread.php?threadid=101487

News Goodies
***********************************

Google Digs Down Under
[April 11, 2006] Search engine snaps up Australian search algorithm and hires its creator.
Read the article:
http://www.internetnews.com/xSP/article.php/3598036


'Red Boss': Day 2
[April 11, 2006] Red Hat continues to talk up its JBoss acquisition during analyst day proceedings.
Read the article:
http://www.internetnews.com/dev-news/article.php/3598236


Skype Buys VoIP Startup
[April 11, 2006] Skype buys Camino Networks to better compete in the lucrative VoIP market.
Read the article:
http://www.internetnews.com/wireless/article.php/3598191


Finding Revenue in The Classifieds
[April 11, 2006] Counter-intuitive thinking says new media might be what's needed to save the old. 
Read the article:
http://www.internetnews.com/ec-news/article.php/3598201


A Wireless Spring in Salesforce.com's Step
[April 11, 2006] The on-demand CRM leader's acquisition of Sendia is a stepping-stone to broader wireless application adoption.
Read the article:
http://www.internetnews.com/xSP/article.php/3598196


Crosswalk Launches iGrid Storage System
[April 11, 2006] The storage grid system, the brainchild of McData founder Jack McDonnell, is designed to add storage capacity when needed and to make every storage volume available to every application server and end-user. 
Read the article:
http://www.internetnews.com/storage/article.php/3598051


IBM's Answer to Security Blues
[April 10, 2006] Big Blue claims hardware-based security advance.
Read the article:
http://www.internetnews.com/security/article.php/3598016


Red Hat to Buy JBoss
[April 10, 2006] The $350 million deal will help Red Hat provide distributed computing platforms for its customers.
Read the article:
http://www.internetnews.com/dev-news/article.php/3597756


Red Hat, JBoss: The Pros And Cons
[April 10, 2006] Analysts chime in on what Red Hat's acquisition of JBoss means for the industry; some like it and some don't think it matters at all. 
Read the article:
http://www.internetnews.com/dev-news/article.php/3597951


Security Group Calls on Congress
[April 10, 2006] CSIA said without Congressional action on data breaches, e-commerce and consumer confidence are likely to erode without national action.
Read the article:
http://www.internetnews.com/bus-news/article.php/3597986


 
 
 
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:

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 
***********************************

Displaying the Sizes of Your SQL Server's Database's Tables

In this article we'll look at two ways to grab some data from an SQL Server and display it in a web page. Read on to learn more!


*** AND ***


An Overview of the New Caching Features in ASP.NET 2.0

With ASP.NET 2.0, caching can still be implemented as simply as it was in
ASP.NET 1.x, but for those of you who want to do more, Microsoft has added
a number of features which help make caching even more flexible and robust.
In this article I'm going to give you a quick overview of the new caching
features in ASP.NET 2.0 and show you how to use them.

And Remember This ...
***********************************

On this day in.....

1814 Napoleon was exiled to Elba; 1876 the Benevolent and Protective Order of Elks was organized; 1890 Ellis Island in New York was designated as an immigration station; 1906 Einstein introduced his Theory of Relativity; 1921 Iowa imposed the first state tax on cigarettes; 1941 Germany Blitzed Coventry in England; 1945 the Allies liberated the first Nazi concentration camp at Buchenwald, Germany; 1950 Prince Rainier III became ruler of Monaco; 1961 Bob Dylan (Robert Zimmerman) made his first appearance at Folk City in Greenwich Village, New York City; 1965 40 tornadoes struck the US midwest, killing 272 and injuring 5,000 more; 1968 President Lyndon Johnson signed the 1968 Civil Rights Act; 1981 Ronald Reagan arrived home from hospital after Hinkley shot him; 1992 Euro-Disney opened near Paris France;


Born today were: in 1866 wife of Henry, Carla Ford; 1907 actor Paul Douglas;1913 designer Oleg Cassini; 1916 producer/director Howard Koch; 1928 wife of Bobby, Ethel Kennedy; 1932 actor Joel Grey (Joe Katz); 1945 musician Robert Fripp (King Crimson); 1950 actor Bill Irwin; 1955 actress Maria Scarabelli; 1958 actor John Castellanos; 1966 English singer Lisa Stansfield;


*************************************************************
EarthWeb's family of online services for IT insiders
*************************************************************
IT MANAGEMENT http://www.earthweb.com/dlink.index-jhtml.72.949.-.0.jhtml


Make a Comment

Loading Comments...

  • Web Development Newsletter Signup

    Invalid email
    You have successfuly registered to our newsletter.
  •  
  •  
  •  
Thanks for your registration, follow us on our social networks to keep up-to-date