Goodies to Go (tm)
November 3, 2003-- Newsletter #257

By Vince Barnes



Goodies to Go (tm)
November 3, 2003--Newsletter #257

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


Featured this week:

* Goodies Thoughts - "Avast there me 'earties!"
* Q & A Goodies
* News Goodies
* Goodies Peer Reviews
* Feedback Goodies  
* Windows Tech Goodies  
* And Remember This...

 


 

Goodies Announcement

The new Beyond HTML Goodies book is now available!

 

Go beyond the basics and learn how the pros add and use dynamic HTML features and advanced JavaScript techniques. Beyond HTML Goodies demonstrates dozens of new and different features readers can add to their existing Web pages using HTML and JavaScript. The book starts with simple text and image tips, such as adding a clock to a Web page or causing text to appear when the mouse moves over an image. It gradually builds to more complex tricks, including manipulating forms or working with cookies behind the scenes. Throughout the book, readers enjoy Joe's snappy style and "to the point" discussion of each "goody" in the book.

 

http://books.internet.com/books/0789727803

 

 

Goodies Thoughts - "Avast there me 'earties!"


"Avast there me 'earties!"

"How do I stop somebody from right clicking my pictures, downloading them and stealing them?" "How can I prevent somebody from seeing all my JavaScript code and copying it?" Sound like one of your questions? We are asked this type of question a lot, so maybe they do. If so, read on. (If not, please read on anyway!)

"Avast!" -- the word is from the Dutch, "houd vast" -- literally "hold fast" and means "stop!" The title phrase I've used is commonly associated with the swashbuckling types seen at Disneyland's "Pirates of the Caribbean" and their like. Over the years pirates have been glamorized by books, comic books, film and TV until they almost hold hero status, especially in the minds of boys. Public drunkenness, gunfire in public places, brutality, theft, pillaging, rape and murder are not, however, generally considered socially acceptable behavior. In modern times, pirates are a very dangerous threat to smaller sea-going pleasure craft. Those I know who take boats like that out usually carry with them an armory well enough equipped to give me pause and make me think that a cruise ship, or even an airplane, is a close as I'd like to be to those waters! It seems to me strange, all things considered, that we have chosen this type of character to glamorize.

It is perhaps partly a result of this strange duality that so many consider software piracy to be something less than a crime. Perhaps, instead of calling it software piracy, we should call it like it is -- theft. The people who do it are then not "pirates" but thieves. Nothing glamorous there -- just criminal!

Another justification heard is that when something is only copied you don't take it away from the owner, so how can that be theft? If I stay the night in a hotel and leave the next day without taking the room with me, can I then not pay the bill? How about if I rent a car or ride on a bus or train?

The Internet, of course, enables copying at an incredible pace where in times past somebody would have to sit with some duplicating device and then physically distribute the copied items. The net allows one copy to be read and copied by a thousand, each of which can be read by a thousand and in two steps there are a million copies spread all over the world.

We all know how difficult it is to prevent somebody from copying our work and taking the benefits of it for themselves. It's expensive too -- and it's a price we all pay. That copy of Windows that came with your newest computer (i.e., its cost was included in the price) included some money to cover the revenue lost to a software thief and a portion of the cost of tracking them down and prosecuting them. You paid for it.

Think also of the music and film industries. Would you risk $100 million+ to create a film if there was a likelihood of it being reproduced and seen by a large portion of your potential audience before you could recover your costs? I certainly wouldn't (that's actually more than I have in my bank account -- how about you?!!) This kind of theft has the potential of severely damaging the music and film industries as much as it does of driving up the cost of software. That would not be fun at all. I like going to the movies and I like watching them at home with my family. Ditto for music. As for software and the like produced by other programmer types - "do unto others as you would have them do unto you" is my motto there.

"Me 'earties" is "my hearties" meaning "my hearty friends." If you see, hear or know of a friend who is stealing copyrighted material and especially if they're using the Internet to do it, please give 'em a swift "avast there!" and help to save my livelihood and my entertainment as well as your own.
 

Thanks for Reading!
 

- Vince Barnes

 

Top

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.

I'm trying to design a personal portfolio site and need to have people click on my thumbnails to see larger images in a new window... easy. However I found a site that makes it hard for people to save/steal copyright materials- it makes the new window close when it is clicked on... I can't figure out how to do this.

A. You could use the onClick event in the body tag. Of course they can still steal your images because the images have to be downloaded to your PC for your browser to display them. The body tag would look like this:
<body onClick="window.close()">
This will only work if the window was opened using the JavaScript window.open command.




Q. Can you please tell me how to add variables? I know you are supposed to add two variables with a + sign but it doesn't work most of the time. It adds the number to the end of the variable instead of adding them together. For example, if I wrote this:
var a = 7;
var b = 2;
var c = a + b;
document.write( c );
I would get 72. Can you please tell me how to correct this?

A. In JavaScript, variables can be either numbers or strings. Strings are enclosed in quotation marks. If a number is enclosed in quotation marks, it is treated as a string. In JavaScript, the + sign is used for concatenation, or the combining of strings, as well as the addition of numbers.
Using your example:
var a = "7";
var b = "2";
var c = a + b;
document.write( c );
will return "72" as a string (without the quotation marks of course), but:
var a = 7;
var b = 2;
var c = a + b;
document.write( c );
will return 9 as a number. So, if your results are concatenations instead of numbers, check your code and remove any quotation marks from around digits that should be treated as numbers.




Q. You just explained to me that anything inside of quotes in a variable will be treated as a string. Here is the problem. When I have a user enter a number to be used for math it is treated as a string. Then when I do math with it the number is added to the end which makes the answer incorrect. Can you please give me a method for the user to be able to enter a number and have it treated like a value instead of a string? Or if not, is there a way to convert strings into values?

A. JavaScript interprets a default value given to a text area as a string. The workaround is to use the eval() function when processing that value as a number. If your user inputs a number to a text area in a form, and that number is to be added, subtracted, multiplied, ... etc, process the number within the eval() function. From your previous example, suppose the user inputs to the variables a and b via text boxes in a form, you can then add a to b to return c with this:
c = eval(a+b)
This way, the values in both a and b will be treated as numbers instead of strings.





Q. I have one more problem with JavaScript programs. A lot of times I create variables and then when I try to use them I get an error saying that they are undefined. Why is this? Here is an example of when this happens:
<SCRIPT LANGUAGE="JavaScript">
function part1()
{
var a = 1;
}
function part2()
{
if (a == 1)
{
document.form.textbox.value = "The variable worked, finally!!!";
}
}
</SCRIPT>
</HEAD>
<BODY>
<FORM NAME="form">
<INPUT TYPE="RADIO" NAME="why_doesnt" VALUE="the_variable_work" onClick="part1();">
<INPUT TYPE="BUTTON" VALUE="Variable work?" onClick="part2();">
<INPUT TYPE="TEXT" NAME="textbox" VALUE="If the variable worked, a message would appear here.">
</FORM>
If I write this in a document and click the button, an error message comes up saying that it is undefined. I've tried creating the variable directly from the event handler, renaming the variable, using checkboxes instead of radio buttons, and nothing works. I have tried putting an alert box in the function and it comes up so I know the function is executing. It just won't remember the variable.

A. You are declaring a as a variable from within a function. This makes it a local variable that is only accessible by that function. You can make it a global variable that is accessible by any function by declaring it from outside any functions, but still between the script tags. Usually global variables are declared before the first function for the sake of clarity, but they can be declared from anywhere between the script tags, just not inside a function. Here's your script with a as a global variable:
<SCRIPT LANGUAGE="JavaScript">
var a = 0; // declares a as a global variable and initializes it to 0
function part1()
{
a = 1; // the function sets the global variable a to equal 1
}
function part2()
{
if (a == 1)
{
document.form.textbox.value = "The variable worked, finally!!!";
}
}
</SCRIPT>
</HEAD>
<BODY>
<FORM NAME="form">
<INPUT TYPE="RADIO" NAME="why_doesnt" VALUE="the_variable_work" onClick="part1();">
<INPUT TYPE="BUTTON" VALUE="Variable work?" onClick="part2();">
<INPUT TYPE="TEXT" NAME="textbox" VALUE="If the variable worked, a message would appear here.">
</FORM>





Q. I had to make some last minute changes to my home page and transferred it (FTP) None of the changes I made show up on the page. I removed the home page from the domain and then sent the new one, and still the same problem. I just can't seem to figure it out.

A. Try emptying your browser cache and history and then reload the page. Double check that you are uploading the page to the correct folder AND the correct website if you have more than one website that you work on. I have made the mistake of uploading to the wrong site. Let me know how you make out. 9 times out of 10 it is a caching problem.

 

 

Top

News Goodies


Massachusetts Gets Another Shot at Microsoft
[November 3, 2003] U.S. Court of Appeals to hear oral arguments opposing DoJ's landmark anti-trust settlement with software giant.

Click here to read the article


 

 

DoubleClick, Macromedia Premiere Motif With Multi-Event Tracking
[November 3, 2003] The next phase of the rich media tool for advertisers adds multi-event reporting and analytics to compare rich media and standard campaigns.

Click here to read the article

 


 

Conexant, GlobespanVirata to Merge
[November 3, 2003] The combined entity aims to be a leading provider of components to enable home networking vis-a-vis consumer electronics devices.

Click here to read the article

 

 

Borland Makes Strong Push for .NET, Java
[November 3, 2003] Borland opens its analyst day with refreshes to its two main development environments for .NET and Java.

Click here to read the article

 

 

Brewing Java, PHP En Masse
[November 3, 2003] UPDATE: Zend looks to strengthen its pot of technology courtesy of the latest version of Sun Microsystems' Java System Web Server and Adobe's GoLive platform.

Click here to read the article

 

 

Now Speaking to the Mobile Market: Voice Command
[November 3, 2003] New speech recognition software for PDAs and cell phones is hailed as the the perfect tool (or toy) for commuters and enthusiasts -- but the possibilities for disabled workers are just as promising.

Click here to read the article

 

 


Court Whittles Down MicroStrategy-Business Objects Suit
[November 3, 2003] Court decides MicroStrategy doesn't have a case with regard to its tortious interference allegation versus rival Business Objects; a trade secrets ruling and patent infringement decision loom.

Click here to read the article



 

HP Fills out Integrity, ProLiant Server Lines
[November 3, 2003] HP fills out its integrity and fattens its ProLiant lines, offering everything from 8- and 16-way Itanium 2-based machines to Linux-powered clusters.

Click here to read the article

 

 


Microsoft Revises 'Critical' Patches (Again)
[October 30, 2003] For the second time in as many weeks, the software giant issues 'major revisions' to security patches because of installation problems.

Click here to read the article

 

 

FreeBSD Fills In The Blanks With v4.9
[October 30, 2003] The 'beastie' bunch now has a clear migration path between version 4.7 and 5.0 with the 'stable' release of its popular UNIX-based operating system.

Click here to read the article

 

 

 

 


Top

Goodies Peer Reviews


 

Every week a site is selected for review. Each week, reviews of the previous week's selected site are chosen for publication on the HTML Goodies website.

 

The current week's selected site is published in Goodies To Go and in the Peer Reviews section of the website.  Current contact email addresses for submitting your site and for submitting reviews are published in Goodies To Go.

If you would like to have your site reviewed, sign up for the Goodies To Go newsletter in the Navigation Bar on the left side of this page. 

For full details about this program, see http://www.htmlgoodies.com/peerreviews
 

 

 


Top

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 will help 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/


Goodies To Go is brought to you by our sponsors. They'll keep paying the bills as long as you keep reading. If you know someone who'd be interested in receiving GTG, suggest it to them and send them to http://www.HTMLGoodies.com to subscribe! Keep the numbers up, and GTG will keep on coming!


(This message is repeated from last week -- just in case you missed it!) For those who are missing Peer reviews: we are once again revising the Peer review program in the hopes of creating a workable solution. All those who have been selected for reviews in the past will be featured in the new pages. The new method will make it much easier for your peers to provide feedback and much easier for us to handle the publication side of things. "Watch this space!" It's coming soon!!



Thanks again for all your feedback!
 

Top


 


Windows Tech Goodie of the Week:


Some Very Early Information About ASP.NET 2.0

http://www.asp101.com/articles/john/aspnet2preview/default.asp

I realize that most of you are too busy to try and keep up
with all the news and rumors that circulate in the ASP and
NET communities... that's why you come to us! The latest rumblings from the underground are about the next version of ASP.NET... ASP.NET 2.0.


 

 

Top
And Remember This . . .


On this day in...

1957 Laika Takes Trip Into Space

A Siberian Husky mix who once lived as a stray on the streets of Moscow became the first animal to go out into space on this day in 1957. Unfortunately for her, she paid for fame with her life. She lived for several days aboard the Sputnik II, the second man made Earth satellite. Electrodes attached to her body sent vital information back about the effects of space on her body. After a few days, however there was no power left in her life support system batteries, and she died. The Russians sent a dozen or more dogs into space, at least five of which died there, before sending Yuri Gagarin up for one orbit on April 12, 1961 aboard the Vostok I. The first man in space, Yuri, fared better than Laika, and landed safely back in the USSR.


Today was also the day that: in 1394 Charles VI expelled the Jews from France; 1762 Spain acquired Louisiana; 1868 John W. Menard of Louisiana became the first black American elected to US Congress; 1888 Jack The Ripper killed his last victim in London; Panama gained independence from Colombia; 1918 dissolution of the Austro-Hungarian Empire; 1928 Turkey switches from Arabic to Roman alphabet; 1930 the Bank of Italy became the Bank of America; 1956 the Wizard of Oz was first televised (CBS-TV); 1979 63 Americans taken hostage at US Embassy in Tehran, Iran; 1986 Lebanese magazine Ash Shirra published story of secret US arms sales to Iran (Iran-Contra scandal); 1988 Soviet Union allowed teaching of Hebrew; 1992 Bill Clinton elected President of the US;

Born today were: in 1718 The 4th Earl of Sandwich John Montague (yes, he invented it!); 1793 colonizer of Texas Stephen Fuller Austin; 1922 actor Charles Bronson; 1930 X-15 pilot William Dana; 1933 US presidential candidate (1988) Michael Dukakis; 1948 Scottish singer Lulu; 1952 comedienne Rosanne Barr; 1953 comedian Dennis Miller; 1954 punk rocker Adam Ant (Stuart Goddard); 1959 actor Dolph Lundgren; 1962 rocker Marilyn;

 


Thanks for reading Goodies to Go!

 

Archive Home Page.



Make a Comment

Loading Comments...

  • Web Development Newsletter Signup

    Invalid email
    You have successfuly registered to our newsletter.
  •