Tim Yang’s Weblog

Jump to content

About Tim Yang’s Weblog

Nothing to see here.

Subscribe to this

Categories

Archives

Tags


-->

Posts filed in ‘Howto’


How to box-in a speeding driver

Oct 2008
04

Once in a while, every driver will have the experience of having an aggressively-speeding driver tailing him or coming up too fast from the rear.

Two of the more common ways of dealing with such a driver is either to give way or to make a hard brake. The first is passive and doesn’t do any good. The second is inappropriate and downright dangerous.

Here is how I deal with speeding drivers: I execute a two-lane block to box them in. It’s a safer alternative and it gives me a warm feeling inside.

(The scenario I am about describe assumes that both you and the speeding driver are in the fast lane.)

  1. With the speeding driver tailing you, increase your speed until you approach another vehicle that’s ahead in the same lane. The speeding driver will continue to tail you, thinking that he is pushing you faster.
  2. Signal to move into the slower lane, if the slower lane is clear, then move in. The speeding driver will then speed up a bit to take your place, tailing the other vehicle in the fast lane.
  3. Increase your speed a bit as soon as you are in the slower lane. You will now be blocking both the vehicles in the fast lane from moving into your lane. The speeding driver is now effectively boxed in.
  4. Revel in delight at his pain. Every moment that you box him in will be agony to him. But do not make eye-contact with the speeding driver, not even in the side-view mirror. Or else he may figure out that it was all part of a plan.

At this point, one of three scenarios may play out.

  1. The vehicle that’s ahead of the speeding driver in the fast lane will speed up and pull into the slower lane to let the speeding driver pass.
  2. If you are on a highway that has three or more lanes, the speeding driver may execute an over-take from the slowest lane.
  3. If an approaching vehicle looms ahead of you in the slower lane, try to speed up and over-take both vehicles in the fast lane. Then continue to put some distance between you and the speeding driver. By the time the speeding driver has come up to your rear again, you will be in the correct position to execute another box-in. Repeat from Step 1 until you’re satisfied.

How to hide your Facebook friends list and status updates from everyone

Sep 2008
29

Every day, the Facebook Help Center gets asked questions about hiding the friends list and status updates. But they nearly always go unanswered. So I’m providing the solution I use.

The trick is to operate a white list, not a black list.

  1. Create a new “Friend List”. A “Friend List” is what Facebook calls a sub-grouping of friends. Click on the Make A New List button in the Friends section. Let’s name the new list “Blocked”.
  2. Add all your friends to the new “Friend List”. Although there isn’t a “Select All” option to select all your friends at one go, Facebook makes creating a “Friend List” quite easy. Even if you have a few hundred, it takes only a few minutes to add all your friends by clicking on each picture. No need to type their names.
  3. Add the “Friend List” to Limited Profile. Go to Profile Privacy, scroll down to the Friends section, click on the Edit Custom Settings link. Type “Blocked” in the text box underneath Limited Profile. Then click “Okay” and “Save Changes”.
  4. Repeat Step 3 to hide your status updates. Under the Status Updates section of Profile Privacy.

The Caveat. This isn’t a perfect solution because Facebook isn’t designed to operate white lists. For instance, when you add new friends, they’ll be able to see your entire friends list and status updates until you manually add them to “Blocked”. So they may realise that you are hiding stuff.

But in most cases, it works. So give it a try.


Howto: A better Del.icio.us bookmark maker for Wordpress

Aug 2005
07

I promise this is the last Wordpress related post I’m going to make for a long time. I finished with my template and this is the last thing I made for it. I wanted a way to allow people to add my posts to their Del.icio.us collection. I tried Arne Brachhold’s del.icio.us plugin but it wasn’t what I wanted. For one thing, it only worked on single.php. I wanted the bookmark link to be available on the index.php too. Not everyone will visit the individual post page. I also wanted it to have a pop-up. I quite liked the way the old del.icio.us pop-up bookmarklet worked. So here’s how you make a better del.icio.us bookmark. Place this code anywhere within the loop. It works for pages, templates, index.php and single.php.

<a href=”http://del.icio.us/post?url=<?php the_permalink(); ?>&title=<?php the_title(”, ”, true); ?>”>add to del.icio.us</a>

And that’s it. But that’s without the pop-up. If you want the pop-up method, first paste this simple javascript pop-up maker in your head tag.

<script type="text/javascript">
function openpopup(popurl){
var
winpops=window.open(popurl,"",
"width=700,height=250,status,resizable")
}
</script>

Then use this link in your loop instead of the earlier one I showed you.

<a href=”javascript:openpopup(’http://del.icio.us/post?url=<?php the_permalink(); ?>&title=<?php the_title(”, ”, true); ?>’)”>add to del.icio.us</a>


Howto: Skip all the other floors when riding in the elevator

Aug 2005
03

Somehow I always knew this was possible. I’m sure I did this as a kid. But for some reason, I’d forgotten it until I saw this post again.

If you want to avoid stopping at all the other floors when you’re in the elevator, just press the floor number and the door-close button at the same time. All elevators apparently have this “Express” mode built into them.

via TheDamnBlog.com


Howto: Tell-a-friend script for Wordpress

Aug 2005
01

I had a tell-a-friend script on my old blog. But Wordpress doesn’t have anything like that, not even in plugin form. So I wrote a quick one. This script is extremely simple. It works but there are no checks, validations or contingencies built into it. So don’t kill me, I’m still on page 28 of PHP for Dummies (”Concantenating is not a Mexican dance”). Caveat emptor, you have been warned.

The script is meant for use with single post pages. It does not have to be in the Loop, so it can be placed in the sidebar of single.php. If you put it on index.php (or any other page), it will simply send the url and page title of the first post you ever made (not good). If I was informing Madame X of this post, the message the script sends out is formated like this (but you can change it where appropriate to suit your taste):

Subject: Have a look at this blog page, Madame X

Message: Hi, Madame X, I found this interesting post on Tim Yang’s Geek Blog called “Howto: Tell-a-friend script for Wordpress” that I thought you would also find interesting. It’s at http://timyang.com/2005/07/howto-tell-a-friend-script-for-wordpress.

Signed, Tim Yang

Here are the instructions.
Read the rest of this entry »


Howto: Customising the description metatag to the title of each post in Wordpress

Jul 2005
31

Instead of having a set of standard metatags across all the pages of my blog, I wanted to customise the description metatag of each post to the title of the post and the keywords metatag to the categories of each post. I thought I saw a plugin that did this, but when I looked again, I couldn’t find it. Because I’m reading up on Wordpress Template Tags right now, it made sense for me to try do something different with them. So out comes the PHP for Dummies manual. I succeeded (partially) in my goal. If you check the description metatag of each post, they are all customised while the homepage has the standard blog name and description that’s set in the admin interface. But I failed in the categories as keywords because the category template tags don’t work outside of the Loop.

Here’s the code I used. Just copy the description metatag part and paste it between your head tag to achieve the result.

	<meta name="description" content="<?php if ( is_single() ) {
		single_post_title('', true);
	} else {
		bloginfo('name'); echo " - "; bloginfo('description');
	}
	?>" />

Howto: Generating a list of earlier posts in Wordpress

Jul 2005
30

I had this feature in my earlier weblog. I had ten posts on the home page and I wanted to show in the sidebar a list of the ten posts that pre-dated the ones on the homepage. You can see the unstyled list on the sidebar right now. I used the get_posts function that comes in Wordpress. Although the_date function is supposed to work only within The Loop, somehow it works here. Here’s the code I used.

<ul id="earlierposts">
<?php
$posts = get_posts('numberposts=10&offset=10&order=ASC');
foreach ($posts as $post) : start_wp();
?>
<?php
echo "<li><a href="";
the_permalink(); echo "">";
the_title('', '', true);
the_date('j M','</a> <em>','</em></li>');
?>
<?php
endforeach;
?>
</ul>

Howto: Fake a Google Page Rank 10

Jul 2005
27

SEO Black Hat has an interesting article on
how to give any website an outward appearance of PR 10. It does work (SEO Black Hat points out a PR10 demo site), but it’s a superficial PR10 that only website visitors are able to see.

  1. Add a permanent (301) redirect with htaccess or some other means on your website to a PR10 site (eg Google.com).
  2. Wait for a Google update to happen. After that, when your website visitors check the PR of your URL, they will see your website now “has” PR 10.
  3. When you have your “new PR”, add a condition to your permanent redirect that says only Googlebots get redirected while allowing your website visitors into your site. Voila! People can now visit your new PR10 website while Googlebots are still sent away.

As the author of SEO Black Hat also says, Google will not index your site while you are permanently redirecting. So as far as Google is concerned, your PR is the same as before the redirect (and it will probably be lower after the update because it can’t index any of the content on your site). You cannot pass on your “new PR” with outbound links. But your site visitors will get fooled and they won’t know any better (unless they try to Google your site).

Note: This works for Google. But it might also work for Yahoo search and other search engines like AskJeeves too. I’m just not sure if it does, but theoretically it ought to.


Paging

Credits