REAL Subdomains under Linode

While trying to add a sub-domain to my Linode account, I did the typical Google search to see if someone else had done so already, and I could just copy their instructions. Alas, there were plenty of posts titled “Subdomain on Linode” (or something to that effect), but they all only showed how to register a host under the DNS, and set up the <VirtualHost> records under Apache.

A host is not the same as a sub-domain.

Let’s assume we have a domain “mydomain.com”. Adding in “lab.mydomain.com” as an “A” record will simply make a host. You cannot then do “work.lab.mydomain.com” using this method – something which should be perfectly acceptable under an actual sub-domain.

Herewith, I present the correct procedure for adding in a sub-domain under the Linode DNS (using the above example of “mydomain.com”).

  1. Under the Domain zone for “mydomain.com”, add in the following “NS” records:
    1. ns1.linode.com -> lab.mydomain.com
    2. ns2.linode.com -> lab.mydomain.com
    3. ns3.linode.com -> lab.mydomain.com
    4. ns4.linode.com -> lab.mydomain.com
    5. ns5.linode.com -> lab.mydomain.com
  2. Create a new domain zone for “lab.mydomain.com”

Presto. You can now add in host records such as “www.lab.mydomain.com” or whatever you want.

My Problem With TV Streaming Websites

I don’t have TV – either cable or satellite. So when I want such entertainment, I just turn to on-line streaming (Netflix, Crackle, etc.) yet I have a problem with all of the ones I’ve found – they are so “website”-centric, that if you are actually a bit of a power user, it becomes an encumbrance to have a browser tab/window open to keep it streaming. To me, it’s a lot easier to run a desktop app which can be dynamically sized, nice reduced interface – think VLC here.

Anyway, that’s my pet peeve with it.

Does anyone actually use QRCodes?

The title says it all – I’ve now worked for 2 separate companies who have had to implement QRCode printing in order to cater to the whims of clients, and yet when it comes times for analyse sources using Google Analytics, we find that virtually nobody actually uses these things.

For example, one of our clients generates 10,000 unique visitors per month – after 2 months of QRCodes, we noticed a whopping 2 hits coming from the QRCodes. Now, to me, the costs involved with having to create these things, and then find printers who will support it, and produce something actually usable just doesn’t make financial sense for 2 whole hits.

I know it’s supposed to be something to catch onto the whole mobile wave right now, but really, it seems to be something people just aren’t interested in – does anyone else have a differing story?

WordPress Shortcodes – My Way

As anyone whose work in WordPress whose tried to create their own shortcodes knows, it can be a nuisance. Trying to come up with unique names for the shortcodes so as not to cause conflicts, supporting nested shortcodes, etc., etc. It can be a challenge.

Instead of using functions, however, I’ve started using enclosures and classes. Such a class itself registers shortcodes which it can have embedded. And to overcome the actual shortcode tag itself conflicting – I’ve found you can “namespace” those, too. Here’s an actual example:

So, what we have here is a shortcode “sunsport:tiles:start” which creates an instance of our class. That instantiation registers a new shortcode “sunsport:tiles:create”, which would be unavailable otherwise, thus we avoid have to check to make sure it’s properly enclosed in a parent “start” shortcode, and we gracefully deregister it at the end of the run.

It’s probably worth include the “fragments/tiles/start.php” file just for reference:

And here’s the actual usage:

There’s is one word of warning – do not do a naming convension like this:

  • parent shortcode – sunsport:tiles
    • child shortcode – sunsport:tiles:create

The child shortcode will never fire. For some reason, it seems WordPress doesn’t actually read in the full shortcode in this scenario – instead of “sunsport:tiles:create” firing, WordPress will simple re-run “sunsport:tiles”.

That caveat aside, I find this feels a lot cleaner and less collision-prone than other examples I’ve seen.

Another “WTF?!” IE9 Bug

With Internet Explorer’s complete lack of support for any of the neat and useful CSS styles, one always has to revert to Microsoft’s disgusting “filter” hack. The filters don’t take in very many useful parameters (such as color stops in gradients) and disable text anti-aliasing. 

But here’s something you probably really didn’t see coming – under IE9 only (this doesn’t affect IE8), filters completely cripple events. If you define any mouse over or even click events, they will not fire.

This created a situation where I could no longer use a horizontal sliding accordion, because IE doesn’t support text rotation and uses a … you guessed it … filter.

I hate Microsoft so much … so very very much …

XMLSerializer for Internet Explorer

While trying to convert a jQuery element object into a string, I noticed that all the major browsers support “XMLSerializer”, which does precisely that task. Of course, Internet Explorer is the exception. However, IE does offer the “outerHTML” property on DOM elements, which seems to do the same thing.

I herewith present an extremely short JavaScript snippet which allows global use of XMLSerializer

Why I Think Governments Still Hide UFOs

So, I’m watching some UFO documentaries on YouTube yesterday and today, and the one question which keeps coming up is why would governments (especially the US) keep UFOs a secret.

Here’s my take on it – it would cost too much to admit it now. Financially.

Follow me on this one – you have a “cold war ” between two super powers, each of which is trying to one-up the other. Okay, so it makes sense to keep anything a secret in the hopes of gaining an advantage over the other. However, in order to make sure you keep the secret, you have to deal with leaks. The best way of doing this is to destroy the reputation and careers (and ultimately lives) of individuals who may come forward with what they know. This not only discredits the reports of UFOs, but also strikes fear into anyone thinking of reporting an incident, for fear of having their lives destroyed, too.

In the run of time, the cold war ends – but now you have a problem. Even though you don’t have an enemy of that magnitude anymore, you’ve now unjustly destroyed the lives of hundred (thousands?) of people in your own country. Can anyone spell “class-action lawsuit?”

Imagine the field day lawyers would have in a situation where the government now completely admits that UFOs are real, they’ve always been real, and they (the government) has always known about it. This would mean the government intentionally lied outright, causing the wilful destruction of people’s lives. Yeah, the government would get sued into the group.

At this point, they simply cannot admit it, not because of any secret society pulling the strings, but simply because it would bankrupt them.

Just a thought.

Is It Time For More SVG?

I’ve always been a proponent of SVG, even back when everyone was gung-ho with using Flash for every little thing, whether it was a good idea even back then or not.

However, recently I’ve started thinking that perhaps it’s time to start taking it a lot more seriously. With the obvious demise of Flash as a main-stream RIA choice; greater support in all the major browsers; and with Apple pushing Retina displays on their laptops as well as tablets, I think it’s time to start moving away from pixel-defined websites and raster graphics to using “em”-defined websites and SVG graphics.

The combination makes perfect sense – it’s clear you cannot rely on website layouts which are strictly defined using “px” unit-of-measure – that would result in a website being 1000px wide (a good idea if you want to support 1024 x 768 screen resolutions) looking ridiculous on ultra-high resolution displays (such as retina). The obvious problem then becomes fitting graphics in PNG and other raster formats into this different unit-of-measure. Sure, you could scale the graphics image, or have several versions of it and try to detect the screen resolution, but all of that becomes moot if you use SVG, which by it’s very design will scale up and down without pixelation.

What I find interesting is that Sun saw the writing on the wall (even before they were taken over by Oracle) when it comes to greater resolutions, which is why the “Nimbus” look and feel for Swing was specifically designed using vector graphics and not bitmaps/raster images.

As with everything in web programming, however, you’re always stuck with users refusing to upgrade their version of IE to something even vaguely useful (I’m talking IE9 at least), or moving onto a better browser. I wonder if perhaps as an industry we (as programmers, business people, scientists) need to drag consumers along, kicking and screaming. Imagine, if you will, if 90% of all major websites dropped support for IE8 and below tomorrow morning. Users would have no room to complain, and would simply be forced into upgrading. No more “why can I use IE6 on my bank website, but not on your website?”

Bliss.

IE Sucks – Deal With It

I’m so tired of Microsoft fan-boys trying to claim that IE isn’t as crap as everyone else with a brain keeps saying. Their typical rhetoric is that IE can do everything the other browser can do, just using a “hack”.

Well, this would be the crux of my problem with it – why the hell must everything be a hack? And for the record, the hacks don’t work right.

Here’s an example – background gradients. All the major browsers (including mobile browsers) all support some fort of native background gradients. IE doesn’t have anything like that. BUT WAIT! Microsoft fan-boys will point to the all-powerful “filter” CSS property. Yeah, great, here’s the problem – the minute you run anything through Microsoft’s “filter” rubbish, all the text loses anti-aliasing. And believe me – it’s noticeable. I actually had one of my most unobservant, tech-unsavvy (not a real word, I know) customers complain that the text “looked like shit”.

And he was right.

So, really – until you can write a website which looks perfect under IE without hacks (and without having to always fall back in static images everywhere), fan-boys should just shut the heck up and accept that Internet Explorer is a massive, steamy pile of rat-turds.

And as for customers – given the ease with which other browsers can now be downloaded and installed, there’s absolutely no excuse any more for using it. If your IT guy says there’s no reason to switch, then you need a new IT guy, because you’re currently working with a monkey.

Lithium Problem on Rackspace

Today I came across a situation where I was deploying a PHP-based webapp written in Lithium and running on a Rackspace cloud site. In my scenario, I noticed 2 symptoms (appearing differently, but having the same cause).

  1. if the Lithium app is a subdirectory of another webapp (in my example, the main site is WordPress), you will always get a WordPress “Oops! The page you are looking for does not exist.” error.
  2. if the Lithium app is in the root, you will get an “Internal Server Error” page.

As it turns out, the problem is the .htaccess file included with Lithium.

I don’t think there’s anything wrong with the .htaccess per se, but under Rackspace you seem to have to include the “RewriteBase” directive.

So, as a result, you must edit all 3 .htaccess files in your Lithium project thus:

  • /.htaccess – RewriteBase /
  • /app/.htaccess – RewriteBase /app/
  • /app/webroot/.htaccess – RewriteBase /app/webroot/

If your webapp is a subdirectory, this subdirectory name will need to prepended to RewriteBase path:

  • /.htaccess – RewriteBase /subdir/
  • /app/.htaccess – RewriteBase /subdir/app/
  • /app/webroot/.htaccess – RewriteBase /subdir/app/webroot/

And presto, it now magically works!