Category “Geek”

How to find the ID of a Facebook page for non-admins

If you need to find the ID of a Facebook page, you can click the Edit button and find the ID in the edit page URL, for example www.facebook.com/pages/edit/?id=20531316728

But what if you’re not an admin for the page? You can still find out the page’s ID simply by going to http://graph.facebook.com/PAGENAME.

So if you point your browser at http://graph.facebook.com/facebook, you’ll find that the ID for Facebook’s official Facebook Page is 20531316728.

Hat tip @dustyhawk

GoDaddy supports SOPA, so let's all move to Hover

Recently I’ve started using Hover as my main domain registrar, an excellent alternative to the popular GoDaddy which is where many people buy their domain names from. Like many others, I have got tired of GoDaddy’s site and service. Their CEO’s elephant-killing antics didn’t help with their public image too.

Today, we have another reason to ditch GoDaddy – they are a supporter of the Stop Online Piracy Act. While stopping online piracy is a noble cause, this bill being put forward by US lawmakers is really dumb. So dumb that Google, Yahoo!, Twitter, Craigslist and many other internet giants are opposed against the bill. Ars Technica has a great explanation on why SOPA is so bad.

Anyway, back to Hover. Go check out their website and compare them against GoDaddy. They currently have a promotion where transferring domains to Hover only costs USD10.

P.S. Use my affiliate link and get 10% off 😉 http://hover.com/clickstarter

Custom size featured image thumbnail with fallback in WordPress

Occasionally you may need to display featured images in sizes other than WordPress’ default thumbnail, medium and large sizes. That’s quite easily solved with the add_image_size() and the_post_thumbnail() functions. Unfortunately, there are still 2 problems to be solved:

  • Some posts may not have images at all, or the author forgets to attach a featured image
  • Previous posts don’t have featured images

Here’s a solution that 1) resizes the featured image to the right size, 2) uses the first image in the post if a featured image is not set and 3) falls back to a default image if none of the above are true. Read More »

More robust footer widget areas for Headway

I recently got an email from a reader who wanted to know how I implemented my footer widget areas, and seen some similar requests in the Headway forums. With Headway, you can flip your widget areas horizontally to make a widgetized footer but it works best when you only have 3-4 widgets in them. I wanted to have more flexibility and so I injected 3 widget areas into my footer.

Screenshot for posterity, if I ever re-design this blog. Click for full-size image.

I didn’t have time for a full tutorial but hopefully you’ll find these code snippets useful:

blogjunkie.net custom_functions.php for Headway theme

blogjunkie.net custom.css for fat footer widget areas

4 Awesome Tutorials on creating iframe Facebook tabs

Facebook recently revamped their Facebook Pages. One of the biggest effects of this is that you will no longer be able to create custom tabs with the Static FBML application by 11 March 2011. Luckily some people have quickly put out some excellent tutorials and resources to get everyone up to speed.

HyperArts has been publishing a series of tutorials on how to create iframe Facebook tabs.

Webdigi shares not only a tutorial, but downloadable examples as well!

Check these articles out and definitely bookmark them to bring yourself up to speed on creating iframe Facebook tabs.

 

Solved: Cufon text not refreshing on jQuery UI Tabs

Update: I no longer use Cufon in my projects and prefer @font-face. If you are struggling with Cufon it will actually be faster for you to replace it with @font-face than to figure out your Cufon problems. Start with this tutorial here: The Essential Guide to @font-face

Today I was working on a project that:

  1. Made use of jQuery UI Tabs through the WordPress Post Tabs plugin
  2. Uses custom fonts for the tabs via Cufon
  3. Requires tab font to change color when selected

Read More »

Bulletproof domain redirection for CPanel Add-On domains

Recently I helped my friend Beth Heavrin of Smart Green Tips to migrate her blog to a new domain name. Along the way I realized that the simple way of domain redirection doesn’t work as well for websites that are add-on domains in CPanel environments. This article shows you how to create bulletproof redirects that will work, even for add-on websites.

The Problem

CPanel site structure

In CPanel environments, you start off with a primary domain that resides in the public_html directory. When you add new site to your CPanel hosting, they are added as add-on domains whose root folder are subdirectories of public_html.

You end up with a directory structure in your web hosting account like the image on the right.

Simple .htaccess Redirects Don’t Work

For our example, let’s assume that the primary domain is PrimaryDomain.com and the new domain we want to redirect it to is AddOn1.com. To redirect PrimaryDomain.com to AddOn1.com, you may have used this code in the .htaccess file for PrimaryDomain.com:

# Redirect 301 / http://www.AddOn1.com/

Or, you may have used this code:

# RewriteRule ^(.*) http://www.AddOn1.com/$1 [R=301,L]

With the code above, PrimaryDomain.com will get redirected to AddOn1.com. But unfortunately visitors to AddOn2.com will be wrongly redirected to AddOn1.com/AddOn2.com. Same for other add-on domains within the public_html directory.

This is because AddOn2.com is a subdirectory of public_html. The 2 code snippets above redirect everything, including add-on domain subdirectories to AddOn1.com. Confused? Never mind! Just use the solution below.

The Solution

The solution is to check the hostname (URL) that the visitor is trying to visit before redirecting them. So, let’s update our .htaccess file to the following:

# Redirect PrimaryDomain.com to www.AddOn1.com
RewriteCond %{HTTP_HOST} ^PrimaryDomain.com$
RewriteRule ^(.*)$ http://www.AddOn1.com/$1 [R=301,L]

#Redirect www.PrimaryDomain.com to www.AddOn1.com
RewriteCond %{HTTP_HOST} ^www.PrimaryDomain.com$
RewriteRule ^(.*)$ http://www.AddOn1.com/$1 [R=301,L]

The first block of rules only redirects visitors to PrimaryDomain.com and the second block only redirects visitors to www.PrimaryDomain.com. Visitors to AddOn2.com or AddOn3.com will not be redirected. Solved!

Simple form validation with FBJS on Facebook Page Tabs

Today I was working on a custom Facebook Page which included a sign up form. On the sign up form was a checkbox with an id of confirmoptin that needed to be checked before the form could be submitted: Read More »

Absolute basic Subversion for newbies with svnX

Update 11 Oct: Someone from the svnX team actually stopped by to add on to my post. See his comments below.

I’m not a programmer, but occasionally need to do programmer type things. One of these things is to use Subversion to keep collaborate on projects with other people. This is a tutorial on how to use Subversion on your Mac, for non-programmers like me. I’ll only cover the basics and what is absolutely necessary to get started with it. Ready? Let’s dive in. Read More »

Now I understand all the fuss about the Kindle

So I got an iPad. Don’t worry, I’ll spare you the fanboy gushing. I actually want to talk about Amazon’s Kindle service.

I’ve been wanting to stop buying paper books for a while now. I’ve also been buying ebooks in PDF and ePub format. Reading these ebooks have been less than ideal because I’ve had to read them on my computer (inconvenient) or on my iPhone (too difficult).

Kindle on iPad Read More »