December 22, 2006, 7:43 pm PST
One of the most common questions on Yahoo! Answers is how classes or objects, or the parts of a class / object, such as properties, methods and events, work.
Here’s a gross simplification of how classes and objects work. Most of this is lifted from a previous blog entry, Interpreting A C# Class Code Structure.
Classes / Objects
A class or object is a way of combining all sorts of data that relates to a single thing in one place, and a way of associating functions with that data. (For most intents and purposes, classes and objects are the same thing. Whenever I use the term class, I also mean object; whenever I use object, I also mean class. More on that in a moment.)
For example, you can think of a human as a class.
In the human class, you are an instance. For example, you might think that God decided to run this code when you were born:
Dim you As New HumanBeing()
What He did was create a variable, named you, and set the value of that variable to be an instance of the HumanBeing object. An instance is the actual use of an object. The object is the mold; the instance is the actual thing you made from the mold.
(Most programmers use the term class when they are speaking about an instance, and object when they are talking in general terms, so that’s the real difference between class and object. However, you can generally use the two terms interchangeably when discussing a specific programming issue.)
Continue reading ‘Objects (Classes) Explained In Very Simple Terms’ »
December 22, 2006, 7:33 am PST
Reported by AFP, the French version of the Associated Press:
PARIS (AFP) - The Internet has given birth to a quirky range of modern addictions and maladies, the British weekly New Scientist says in its Christmas issue published this Saturday.
They include these:
- EGO-SURFING: When you frequently check your name and reputation on the Internet.
I don’t do that frequently; every other month or so, tops.
- BLOG STREAKING: “Revealing secrets or personal information online which for everybody’s sake would be best kept private.”
Well, I do pretty much give my entire life’s history on this site.
Continue reading ‘Guilty, Guilty, Guilty’ »
December 22, 2006, 3:13 am PST
Recently asked on Yahoo! Answers:
How to Make a fake error message on notepad?
Hey guys i wanted to know how to make a fake error message on my computer using notepad so i can send it to my friends and scare them as lyke a april fools joke
if you know plz tell me thanks peace out guys
I actually have a much meaner trick that’s a staple gag among help desk people, one that exploits the fact that even otherwise competent computer users aren’t all that observant. It takes a few steps to pull off, but it works 9 times out of 10 to totally frustrate people, so it’s well worth the effort.
Basically, what you do is replace their desktop wallpaper with a picture of their current screen, then remove all the real icons and taskbar — so that clicking on things doesn’t work at all.
Continue reading ‘A Mean Trick To Play On Windows Computer Users’ »
December 20, 2006, 7:02 am PST
Recently asked on Yahoo! Answers:
Javascript load random link?
I’m trying to figure out a way to use javascript to load a random link every 10 seconds in a new window.
For example, let’s say that I want to load a different Yahoo! Search page every 10 seconds with a different search term.
In the following URL, the ‘SEARCHTERM’ part should be replaced with a random word defined in the javascript: http://search.yahoo.com/search?p=searcht…
I’m not too familar with Javascript which is the reason to why I’m trying to learn. I think that making a list of words should be in the following format from what I’ve seen in other scripts, but I’m not sure:
[0]word1
[1]hello+world
[2]laptop+computers
[3]all+your+base+are+belong+to…
—-
Is anyone out there who can help me develop this script? Hopefully someone who knows javascript inside and out and whip together a little example for me in no time at all so that I can continue learning and actually building something from what I learn.
Thanks in advance!
Without fail, the projects that seem like they’re a snap turn into the projects that never, ever end, and that was certainly the case with this request. It took me quite a while to overcome the various obstacles presented by this question and I had to make a couple compromises to get it to work consistently in both Internet Explorer and Firefox.
But without further ado, I’m proud to present the product of about six hours of toil over a hot monitor: A primarily JavaScript, plus a little PHP, solution to pop up random Yahoo! Web searches in a productive manner.
Continue reading ‘Displaying A Random Yahoo! Search Every 30 Seconds With JavaScript And PHP’ »
December 19, 2006, 9:38 pm PST
Recently asked on Yahoo! Answers:
AJAX - show an extra text field if one radio button is pressed?
I’m looking for a short AJAX script that would add an extra textfield into a form if in the radiogroup a certain button is pressed.
Example
( ) yes ( ) no < if 'no' choosen
Before I get into answering this question, I’m going to launch into a tirade against the worst kind of Yahoo! Answers jackasses: The self-styled know-it-alls who curse darkness, rather than lighting candles.
Certain people on Yahoo! Answers can be counted upon to provide terse, arrogant, useless replies to serious questions. Most often, it’s something along the lines of, “You mean {confusing term} and it is {harangue that doesn’t answer question}. You can do this: {obscure, curt instructions}.”
Being brief when a question is succinct and appropriate is a virtue, so long as it’s obvious the person will understand your answer. It’s also perfectly fine, in my opinion, to ridicule totally moronic questions (such as, “How do I make a chat program?”, “How do I become a hacker?”, “How do I visit MySpace from school? They block it” or “How do I crack the serial number for this program?”).
But when someone (such as this questioner) makes a perfectly reasonable request, clearly demonstrates he has limited knowledge of the subject, makes it clear what he is after and what language he wants used, and even goes so far as to specifically ask for code, you’re not helping if you only say, “That isn’t AJAX, it’s JavaScript,” even if you add in some information that person clearly won’t understand.
Continue reading ‘Showing Or Hiding HTML Form Elements With JavaScript’ »