Category Archives: Nerd Stuff

Using Javascript document.write for SEO

Search-engines read a bunch of text on your page that may not be relevant. You can use javascript to write text to a page on the client-side, and that text won’t be processed by the search-engines, thus achieving Search Engine Optimization (SEO).

There are a couple ways to do this… the easiest is using javascript’s document.write:


<script type="text/javascript">
document.write('Hello World');
</script>

This works great for simple little messages, but what if you have a large multi-line text string? What if your text has HTML tags and double quotes in it? Then you’re in for some trouble, because the nice little javascript examples will die on you most ingloriously. PHP to the rescue. Use PHP to replace the spaces (and double-quotes)… you may have to escape your double-quotes in the source text.

Extending that simple little example with some meaty text and some PHP, you end up with something like this:


<?php

$text = ”
<p>
Hello,
big, multi-line
\”stuff\”, watch out!
</p>
“;

$text = preg_replace(“/\s+/”,” “,$text);
$text = preg_replace(‘/\\”/’,”””,$text);

?>

<script type=”text/javascript”>
document.write(‘<?php echo $text; ?>’);
</script>

That solution works (at least, it did before I had to replace all the tags with html entities to make this post). The text gets written at that point in the document once it loads on the client-side. Notice that the regular expressions replace double-quotes with 2 single quotes (tricky, eh?), and any excessive space is replaced. But what if you want something more complicated… what if you don’t like the regular expressions and having to escape your double-quotes? The above method is sorta techie for some, and prone to error. There is another solution: use an Ajax library to pipe HTML directly to a div tag. This solution is more scalable because you can put all the HTML in a separate file, and you don’t have to escape characters.

Download this Javascript library from http://www.prototypejs.org/ and copy the file somewhere in your site’s html directory (here I called it div_updater.js and put it in my js directory). Reference the file in a script tag using the ‘src’ element, then use the Ajax.Updater function to specify 1) the div id where the text should be written and 2) the file to be included.


<div id="target_div"></div>
<script type="text/javascript" src="js/div_updater.js"></script>
<script type="text/javascript">
new Ajax.Updater('target_div', 'include_file.php');
</script>

This solution will write the text to where-ever you have the target_div. Just make sure you use give the div an ‘id’ and that its name is referenced correctly by the Updater function. Using one of these solutions, you can utilize javascript to hide text from the search engines.

Domain Switch Complete – from habibbijan.com to TipsFor.us

As you may have noticed, I recently changed the domain name from habibbijan.com to TipsFor.us.

Why?

The old domain (habibbijan.com) was difficult for the average person to remember and pronounce. I liked the old name, which is a combination of an old nickname plus my middle name, but alas, it was time to make the domain name more relevant to the content of the site.

Since the bulk of the content is comprised of tips and tutorials relating to computer technology, the new domain (TipsFor.us) is much more relevant.

Are you keeping the old domain name?

Yes. Also, all links to the old site *should* automatically redirect to the appropriate page. I hope.

Will all the old content remain?

Yes.

Anything else new?

Um… yes and no. The site will still focus on computers and software, but you may see more variety in the topics covered. Two good friends will be joining me in creating content, and the articles they produce will be tailored toward their areas of expertise. Stay tuned.

Will you write a tutorial on how you switched domains with WordPress?

Say, that’s a pretty good idea. I should do that sometime soon. 🙂

Are you still “not a terrorist… seriously”?

Um, yeah. Of course. Seriously.

* for those unfamiliar, my old tagline was “not a terrorist… seriously.” Before you freak out, it was meant as a joke. Hmm, I wonder how many government watch lists I’m on now….

GrandCentral (from Google) – Invites Available

grandcentral_logo.pngI recently started using GrandCentral (now owned by Google).

What is it, you ask?

To put it mildly, it’s an amazingly cool service that starts by giving you one phone number for life. You can link that one phone number to your cell phone, landline, office phone, or whatever else you have. This way, you can choose which phone rings depending on who calls, or you can optionally have it ring ALL your phones. Never worry about changing phone numbers when you move again.

GrandCentral also provides you with an online voicemail system, creating an “inbox” for your call log and voice messages. Miss a call? GrandCentral can e-mail you with a convenient link to the voice message. Neat!

What are just a few other features available? How about call recording and blocking? Done. Just like a good e-mail system, GrandCentral allows you to label certain callers as SPAM. Telemarketer or ex-girlfriend harassing you? Label their calls as “spam” and never hear from them again!

Invitations

Best of all, GrandCentral is FREE. Since the service is currently in BETA, it requires an invitation. I currently have 5 invitations remaining. All out, sorry!

Please note: this service currently only works in the USA.

Find this useful? Subscribe to my feed for notification of future updates!

How DIGG Changed My Life

Almost exactly one year ago, I became a member of the Digg community. My life was perfectly fine beforehand, or so I thought. To me, Digg was just another news site, and I suspected I would occasionally scan it for interesting articles and then be on my merry way, giving Digg no more than five minutes of my time per day. Boy was I wrong!

Now, my life is forever changed. My eyes have been opened. I’ve swallowed the “red” pill. Before my Digg addiction, I was a happily married man in the early stages of my career, a fairly-devout Christian, a Windows-using Republican, and a technology enthusiast. I’m still a technology enthusiast, but since Digg overtook my life, a few things have changed.

For starters, Digg taught me that Microsoft Windows is a crap operating system, and Bill Gates is the anti-Christ. Or was it Steve Ballmer? One never knows…. So, I switched to Linux, but not just any Linux. The collective wisdom of the pre-pubescents who populate Digg informed me again and again that Ubuntu is the best Linux. Naturally, whenever I see any word resembling Ubuntu in an upcoming story, I froth at the mouth in a rabid digging frenzy! Ubuntu = Dugg. No other Linux matters.

With a change to my operating system came a change to my religion. Though I always had a few uneasy questions about Christianity, my faith was pretty solid. However, roughly 3 minutes after I joined Digg, I quickly learned how foolish I had been for ever believing in the possibility of an all-powerful divine force. On Digg, atheism runs rampant, and is growing in popularity every day. Soon the government will have to give us tax-exempt status as a bonafide religion! Oh wait.

Anyway, the strong faith in atheism at Digg has caused me to toss my old faith aside. I mean, that many utterly life-inexperienced 12-year-olds must be right. Right?

Additionally, the collective wisdom of the 12-year-old diggers emphatically informed me that Ron Paul is the savior of America. At first it seemed like Obama would be the choice, but the far-from-voting-age experts showed me time and again that Ron Paul would save me from the Neocons who want nothing more than to use me as cannon fodder in Iraq. Or was it Iran? One never knows…, but thank science that Digg showed me the “light” (or should I say “electromagnetic radiation of a wavelength?” One never knows….).

After a few months as a Digg member, I suddenly found that my attention span had shrunk to a maximum of about 4 seconds. More and more, I found that I could not concentrate on tasks at work, and found that my main work productivity included 4-second skims of articles on Digg (plus the subsequent digg, of course). Nevermind that I could never read entire articles – I could rely on the intelligent and profound Digg comments to give me the facts.

These mental changes took a toll on my life. First of all, I was fired from work. Apparently reading Digg doesn’t benefit the company. It doesn’t matter – they’re all a bunch of Giuliani lovers, I bet). My wife left me soon after that. Apparently she was incapable of understanding my lifelong goal of “digging” for 22 hours a day. She didn’t like my newfound faith in atheism either, but it’s her loss.

With my lost income and lost wife, I decided to move back into my parent’s basement. I feel comfortable here, and no one persecutes my faith (or lack thereof). Sure, I miss my wife at times, but I can always rely on Digg to comfort me. There, see! There’s a video of Israeli women in bikinis! I digg Kosher babes. Ah, Digg, I can always count on you. Seeing a video of a woman is almost like being with a real woman, provided that I shut my eyes and… pretend.

Finally, I live in constant fear of taser-happy police, feel that the US will become a “police state” in 5… 4… 3… 2… 1…, unless Ron Paul can valiantly charge in and save us. My newfound anxiety keeps me from leaving the comfort of my parent’s basement without carrying a video camera at all times. You never know when those bad cops are waiting to pounce (or is it Pownce? One never knows….)!

That’s ok. I really don’t mind my self-imposed, jobless, womanless, solitude. After all, I still get plenty of excitement just by hanging around Digg. There’s enough stories about Linux, atheism, and Ron Paul to keep me dancing, drooling, and writhing in a Bacchic fit for hours. Plus, all the old internet jokes and pictures are cool again!

Thanks Digg! Kevin Rose is my hero!

If you cannot tell, this article is a complete satire, a fabrication, a creative indulgence. Or, to put it into Digg-speak: FAKE!!!!11!!! Its teh shopped!!!!

Oh, I really do like Ron Paul, though. Promise. 🙂

Get OpenDNS

A few days ago I found out about OpenDNS – it’s one of those services that once you start using it, you wonder how on earth you ever got along without it before.

In short, it’s a FREE Domain Name Service (DNS) that you can tap into on a specific computer or router level. I simply logged into my Linksys WRT54GL router, entered two server addresses, and rebooted. That’s it.

What can it do for you? A lot! 🙂

opendns_specs.png

Anti-phishing

For starters, it protects you from “phishing” sites, such as attempts to steal your PayPal passwords and bank account information. This alone is enough reason for anyone to use it. Also, it corrects common misspellings and re-directs to the appropriate site. For instance, if you type “craigslist.og,” it will redirect you to “craigslist.org.” Pretty slick.

Also, it’s supposedly faster, though I haven’t noticed much difference. It certainly did not slow my internet connection in any way.

Keyword Shortcuts

If you create an account, you have even more tools at your disposal, such as keywords. If you have a commonly-used long URL, you can easily create a shortcut it. For instance, if you find yourself navigating to the Wikipedia article on J. S. Bach a lot, you can create a shortcut to take you to that page just by simply typing “bach.”

opendns-shortcut.png

Adult Site Blocking

If you feel the need, you may also block all “adult” sites very easily, which is sure to cause the 14-year old in your life much despair. 🙂

opendns-block.png

For best results, set up OpenDNS on your router, not just on your computer. That way, everyone else on your network can take advantage of its benefits.

If you enjoyed this article, please subscribe for future updates.

Simple Web Hosting Performance Test: 1and1 versus HostICan

Is it true that 1and1, the world’s #1 web host, has slow servers? Let’s find out.

Since I just switched to a HostICan hosting package, I have a prime opportunity to do a little performance comparison. But first, let’s do a reverse IP check.

Reverse IP Check

By doing a “Reverse IP,” one can tell how many domains are hosted on a server. Since I have a few other domains still on my 1and1 hosting package, I can check both my old plan and my new one.

Current PlanHostICan Base Host Package
reverse-ip_hostican.png

Thirty-four domains on one server. Not too shabby.

Old Plan1and1 Business Package
reverse-ip_1and1.png

Whoa! 251 domains? Now I don’t know the specifics of each server, but my educated guess is that the HostICan server will run circles around 1and1’s poor server, which must feel a lot like Atlas right now.

The Test

The test is simple: in order to stress the CPUs of the servers, I decided to use the WordPress Database Backup plugin to export a copy of the database for this site. The actual MySQL database is fairly small – only about 1.5 MB. The database is exactly the same on each server.

So, how long will it take 1and1 to export this database versus HostICan? When you see the download window pop up, that means the export has finally completed.

And they’re off!

Results

Depending on your download speed, you may need to click the “play” button again to restart the screencasts. If you start them at the same time, you will see that the HostICan backup takes just under 30 seconds to complete. The 1and1 backup, on the other hand, takes approximately 70 seconds to complete an export of the exact same database!

So, based on my very unscientific conclusion, yes, 1and1’s servers are slow, at least in comparison to HostICan.

Switching Web Hosts: From 1and1 to HostICan

I recently switched web hosts for this site since I was starting to outgrow my former hosting package. Here is an overview of my experience.

Former Host: 1and1 Business Package

New Host: HostICan Base Host Package

I run several different web sites. This one receives by far the most traffic. I have already been warned once by 1and1 that I was “consuming the resources of the shared server,” and if I overload the server again, I must either purchase a dedicated server or leave.

Hmph. Ordinarily my site traffic levels are fairly mild (roughly 1,000 visitors a day), but last October one of my articles was “dugg,” and apparently 1and1 will kick me if I write another popular article, thereby knocking ALL of my sites offline (since they were all hosted on the same package). You can read more about the dangers of shared web hosting here.

So, what to do? Not quite wanting to shell out the cash for a dedicated or virtual private server, I decided to simply host this site elsewhere, isolated from the others. That way, all of my eggs are no longer in one basket, and if this site goes down again, it goes down alone. 🙂

Finding A Shared Host

What, then, differentiates one shared hosting host from another? Is it gigabytes of storage space and bandwidth? No, most of that is a pipe dream, and due to overselling, no shared host will really let you consistently consume the hundreds of gigabytes offered without finding a way to ban you.

Is it claims of “unlimited” databases, e-mail accounts, and subdomains? No, that’s overselling in action again. Nothing is “unlimited,” except human stupidiy, of course. 🙂

Is it the quality of support offered? Somewhat, though I’ve never called any web host since I try to handle everything through e-mail. Anyway, most web hosts are abysmal when it comes to support. Receiving an e-mail response in 2-3 days is great. Heck, I’m STILL waiting for replies to questions I asked to web hosts of ages past.

Quite simply, the distinguishing factor for me in finding a shared web host is in how they handle resource consumption. Forget the bloated claims of how many terabytes of bandwidth they offer; it’s the CPU that’s important!

When looking for a shared web host, be sure to read the Terms and Conditions (usually a tiny link at the bottom of their main page). Most of them will mumble something about “excessive resource consumption,” but they don’t define what they mean by excessive.

On the other hand, HostICan has a very clear policy on resource consumption.

Yes, HostICan enforces rules where customers are not permitted to be using more than 25% of the entire server resources for more than 90 seconds.

For example, if you are using a script that is poorly written and you are using more than 25% for 90 seconds your account maybe suspended pending an account review.

Clear. Simple. To the point. With that policy, I probably won’t survive a good Digging, but at least I know my limits.