Forum Moderators: phranque
How does geotargeting work?
Geotargeting lets you, the webmaster, know where in the world a visitor is from. It's based on the user's IP address, which is sent along with every HTTP request. Blocks of IP addresses are allocated to ISPs, and those ISPs usually allocate IPs to clients in a predictable way, usually segmented geographically. So even if your IP address is not static, you're usually using an IP which identifies you as being in a certain geographic location.
To get the location of an IP address, you have look it up in a huge table. There are a fair number of data companies that provide GeoIP databases. Some are free, some are not; some of the free ones are only free for a while, others are licensed... there are even companies that offer geoIP data as a RESTful web service. None can guarantee 100% accuracy, but they're generally quite good.
The more granular a geoIP database is, the less likely it is to be cheap. The best ones have data targeting down to the City level, even providing postal codes, area codes, latitude and longitude. If you really care about accurate geoIP targeting, you'll want a data provider that provides frequent (or even automatic) updates to the geoIP data tables.
What is "Predictive Fetch"?
Predictive Fetch is the technique of loading resources before they're needed, anticipating user behaviour. Predictive Fetch results in a less interrupted user experience. Preloading adjacent though unseen map tiles in Google Maps is an example of PF.
How do I tell if a user has cookies enabled?
Scenario: You want to show one thing if a user has cookies enabled, and something else if cookies are disabled. How do you do it?
When someone requests your page for the first time, there is no way to know if they have cookies enabled. It's just not possible - that's not how HTTP works. The cookie mechanism can "drop" a cookie on the user's first visit, then from that point the user sends that cookie along with all subsequent requests to the same domain.
One way to fake it: drop a cookie on the entry page. Then using JavaScript, inject a hidden <iframe> on the page that targets a URL on your server. If the user has cookies enabled, that second request should have the cookie in it. Based on that second request, load a script into the <iframe> which executes a JS function on the parent page (window.parent) indicating if the cookie was detected (true or false). The parent page can then react accordingly. It's tricky, and requires some finicky JavaScript, but it works.
Other than that, you pretty much have to do a reload or wait until the second page view before you know the user's cookieability.
What's going to happen to Yahoo!?
Your guess is as good as mine, but I do wish both mainstream and underground media would stop portraying Yahoo as a flailing, doomed patch of roadkill. It's all hyperbole. It's time to look at what Yahoo *is*, not what they *might have become* had they sold out entirely to Microsoft.
Can I get rich making videos on YouTube?
This was recently discussed as a home page feature, and became the subject of a lot of discussion around here.
Do you think you have what it takes to create compelling videos that millions of people want to watch, week after week? The people making bundles of cash from their videography are those that have honed a superb and engrossing product, usually after months and months of thankless, rewardless work building an addicted audience.
Or you could record a song like "Chocolate Rain" and become a star overnight.
I say, go for it.
What does a DTD do?
DTD is a Document Type Definition. It defines the elements, entities and attributes that may appear in an XML document, and in which configuration. A DTD allows an XML document to be validated.
You've probably heard of creating valid HTML. If your HTML is valid, it conforms to the rules defined in the HTML DTD. HTML is, after all, a subset of XML. The DTD, in essence, defines what HTML is: a subset of XML which has specific elements (like <table> and rules for element hierarchy (like, <tbody> goes inside a <table>, and what attributes are acceptable (like, <table> may have a "colspan" attribute, but a <p> can not).
For more information, consult the W3C.
What is "Progressive Enhancement"?
Progressive Enhancement is the flipside of "graceful degradation". PE is a development methodology of developing features for older technology, then adding enhancements (which may or may not supplant baseline features) that are executable only by those who are capable of using them. A common example is a <form> which submits normally with GET, but gets intercepted by an equivalent AJAX feature for those clients that have JavaScript enabled.
What is canonicalization?
One of my favourite topics. I'll try to be brief.
Canonicalization is the notion that every unique block of content on the interweb should reside at one URL, and each URL should contain one unique block of content. If the same content can be requested via two or more URLs, then it's a canonical error. Canonicalization gets attention because supplemental indexing and duplicate content can be hazardous to SEO, and in some situations canonicalization errors can even become "spider traps".
Canonicalization is often abbreviated as C14N.
A very simple and common example is the default subdomain canonicalization error. That's when you can get the same page at http://example.com or http://www.example.com. One of them should be chosen as the Canonical URL, and the other should redirect users to it.
ergophobe notes: "Not to be confused with canonization, which is handled not by the webmaster and the Search Engines, but by the Vatican."
How do I measure how fast my PHP scripts are executing?
You use a technique called benchmarking. Simply put, you inject timers into the code, and record the time (in milliseconds) as the script executes. Then at the end you output the benchmarks and see how much time elapsed processing each section.
There is a PEAR module built especially for this.
When you add benchmarks to measure how quickly parts of your program are running, it's called "profiling" because it exposes a "profile" of your script's execution. Benchmarking shows how fast your script is going, profiling shows you why it took that long.
thanks to ergophobe and jatar_k for clarifying this one
I want to become a webmaster like you. What do I need to learn first?
Learn HTML, CSS, JavaScript, PHP*, and SQL. Those are your 5 core competencies that you should get to know. There are many other peripheral skills that you'll pick up along the way like Regular Expressions, DNS, XSLT, and of course some mad PhotoShop skillz.
* IMHO, PHP is a good entry-level server scripting language. Alternately you could get started right away with C#
I'd tackle them in that order too, starting with HTML.
HTML is pretty much a finite week-long course. It's simple, and once you've got it figured out, that's all there is to it. The other 4 skills are vastly profound - you could spend many years becoming a expert in any one of them, and some people devote entire careers to specializing. But any good webmaster should have a rudimentary fluency in all 5.
Which entities do I need to escape in my XML?
There are 5 predefined entities in XML. These need to be encoded in your XML content no matter what, because they are the basic ingredients of XML itself.
I've started calling them the "furious five":
" = "
' = '
< = <
> = >
& = &
I'm still trying to find a good pnemonic for them.
Here are some attempts:
Quit Looking At Gillian Anderson
Quality Agents Like Atlanta Georgia
At A Glance, Look Quick
Gosh, Leroy Ate A Quilt
Apple Geeks Aren't Likely Quitters
Why isn't PHP a strongly typed language?
Well that's like asking why a bird isn't a mammal. It just isn't. It wasn't made that way.
Having worked extensively in both types, I really can't decide whether I like one more than the other. There were times, working in C#, that I really appreciated knowing that my 5 was a float, not a long or a string or an int. Strong typing examplifies an exquisite precision that seems to permeate C#. And then there were times when recasting became a pain in the rump.
But on the other hand, I really enjoy the fluid way that PHP evaluates all the various kinds of false, and that how easily I can concatenate strings and numbers together without needing piles of this.toString(), that.toString(), yomama.toString().
What is "black hat"?
Black Hat is a cute nickname for "villain".
In Internet circles, it refers to someone who uses unauthorized techniques to achieve online success. Note that I define black hat using the word "unauthorized", not "illegal" - there are lots of black hat techniques that clearly violate rules (eg, breaking the Terms of Service of an online service), but which are not actually illegal.
Some black hat stuff (like email spam) is illegal.
Though not synonymous with "hacker", there's certainly some overlap.
Why hats? An old timer told me that in spaghetti westerns the hero wore a white hat, and the villain wore a black hat. I've never bothered checking if the movies actually did that.
Take care with fundamental difficulties in the classifications: e.g. a single corporate IP address might hide a world-wide network behind it. One cannot predict where the internal network goes or doesn't go.
Proxies might do the same, users of e.g. TOR (The Onion Router) appear to come from a relative few exit nodes, but are likely being anonymous far away from where they appear to come from.
Also be aware that switching content and/or languages automatically might annoy your visitors a lot as you can step into local sensitivities you didn't even knew existed. At least allow your visitors an override on language and snail mail addresses.