Archive for Internet

Dealing With cPanel: Setting Up a 301 Redirect to Your Main Domain And Preventing .htaccess Hell

cPanel is surprisingly ill-suited for managing domains. Rather than treating each domain as a separate entity, you get one main domain and various so-called add-on domains. The most annoying aspect of this is that it always creates a subdomain when you add a new add-on domain. There should be no such thing as an add-on domain, just a bunch of domains. cPanel has some features that help you work around these defects, but I wasn’t too thrilled with those. It now seems to automatically redirect the www-subdomain to your no-www domain and you can easily set up subdomains to redirect through the interface, but it doesn’t satisfy me.

Setting Up a 301 Redirect

Instead of having to bother with a plethora of settings in cPanel itself, I came up with the following to stick at the top of .htaccess. A quick look around on the Internet brought up Fayaz Miraz’s blog, but while the solution suggestion was close, it misses one crucial aspect: it only redirects from the main page as far as I can tell. This is fixed easily by the addition of $1 (i.e. everything that was added after the main page).

<IfModule mod_rewrite.c>
RewriteEngine On

RewriteCond %{HTTP_HOST} !^fransdejonge\.com$
RewriteRule ^(.*)$ http://fransdejonge.com/$1 [R=301,L]

</IfModule>

Simply put, it matches all possible routes of approach (whether through www or through a subdomain of another domain) and if it’s not fransdejonge.com, it will 301 redirect to fransdejonge.com. The L means no further rewriting will occur after that rule. Mostly because it would just be inefficient, and partially because something else further down the line might mess things up.

Preventing .htaccess Hell

Another problem is that cPanel automatically creates a /public_html/addondomain directory. This is bad, because /public_html already contains a .htaccess file for the main domain. When accessing /public_html/addondomain, it would first parse the .htaccess file in /public_html before moving on and overriding it in /public_html/addondomain, and that’s assuming none of the rules in /public_html make anything go awry!

To prevent this kind of nightmare from occurring I took the simple precaution of creating a new directory /domains. This domain is contained in /domains/fransdejonge.com, for instance, and any other add-on or subdomains can reside in their own /domains/domain.com directory to prevent any added load from needlessly parsing .htaccess files.

Comments (1)

What Is a Malamanteau?

The following article appeared on Wikipedia for a very short time due to a recent xkcd comic. It’s a reference back to Language Log, which references xkcd sometimes, but the reverse seldom happens.

A malamanteau (plural malamanteaux) is a neologism for a portmanteau created by incorrectly combining a malapropism with a neologism. It is itself a portmanteau of malapropism and portmanteau. In a less strict definition, a portmanteau of a malapropism with another word can also be considered a malamanteau. The contained malapropism must be typically a very common one, probably most people are not aware of, in order to be able to regain the meaning of a malamanteau.

A malamanteau often is created when somebody tries to use a neologism (alternatively, an idiom) but mistakenly confuses a word with another one. However, unlike a malapropism or an eggcorn, the fumbled word is not completely replaced, but merely transfixed to the new one. A famous example is: “misunderestimate” which was popularized by the 43rd President of the United States, George W. Bush. Probably it was intended to be “underestimate” but mistakenly jumbled with “misunderstand.”

Examples

  • Somebody describes his misunderstanding of what someone was saying by stating, “I misconscrewed it up.”
  • Somenone explains his inability to talk while being upset by saying he was “flustrated.”
  • A meaningful malamanteau is “ambiviolent,” as in: “Beatrix Kiddo in Kill Bill was ambiviolent. She didn’t know who to kill first.”

I was going to write more about it when I made this draft, but by now it’s two weeks later and I’ve lost interest. Booyah.

Comments

Opera and Link Targets

If you’re like me and you aren’t particularly fond of sites opening in new tabs without your explicit command, you might be interested in activating Opera’s Ignore Target setting. This setting “Unfortunately … also disables the window.open() method, breaking the functionality of many sites,” so you might prefer to utilize JKing’s UserJS which stops most links from opening in new windows.

On the other hand, you might prefer all links to external sites to open in a new tab. I recently wrote a script that does just that for someone on the MyOpera forum.

Comments

Acceptable Advertisements

I agree with everything that Faruk Ateş wrote about ad blockers and flash blockers, but I would like to add one more point, with which I presume he will agree; I think it’s implied by his writing by referring to certain advertisements as being beautiful and fitting with the content, but never explicified. My point is simple: the advertisements have to be compatible with the type of media I’m viewing.

I don’t block Flash as it typically crashes separately from Opera on Linux, nor does it seem to slow things down for me. I don’t typically block ads, either — though it is really annoying if one ad is making the entire page load slowly. However, I will generally close a page while it’s loading if I am annoyed by the ads. When do ads annoy me? Simple: when they do not fit the type of content I’m looking at. If I want to read some text, I’m fine with static textual or image-based ads. I don’t want animation, although I suppose it’s possible to change ads now and then without it being too obtrusive. Anything that utilizes Flash typically breaks these rules and comes with distracting animation. Worse, it often even comes with sound. It doesn’t really matter what I’m doing; as long as I’ve got my sound system turned on I don’t want any sound to come from my speakers that I did not explicitly ask for.

Now if I’m going to watch a video, like on Uitzendinggemist, then I’m perfectly fine with a video-based advertisement with audio. Uitzendinggemist literally means “missed broadcast.” It’s an online archive of most of Dutch public television broadcasts. After all, I’m requesting video with sound. A 10-15 second advertisement prior to actually viewing the particular video I requested is perfectly acceptable. Similarly, I welcome short audio clips or endorsements in podcasts if they help pay for the podcast. But don’t start playing such messages at random. Although I don’t frequently use Firefox for regular browsing, my favorite extension is StopAutoPlay. This isn’t just about ads of course and applies just as much to people who decide to stick background music on their site, or to start playing videos automatically (I’m looking at you, YouTube), though if I opened a video somewhere it’s usually not too hard to figure out where the noise is coming from.

What could be an acceptable form of a video-based advertisement on a non-moving Internet page would be something akin to YouTube embedded videos. These don’t autoplay, but you have to click the play button first.

Everything I said applies just as much to things that aren’t advertisements, but too many advertisements seem to be made as annoyingly as possible on purpose. I hope that nobody has ever gained any business from such advertisements. They sure haven’t from me.

Comments

Tubes Beats Yahoo Pipes: Feed Fixup

Although it has only been a couple of weeks since I started work on Tubes, the mechanism I put in place to output feeds is already serving me very well. So well that it’s approaching all of my personal needs. This may potentially be bad for other people, but it’s great for me. Besides, I put the code out there; it should be easy enough to fork it if you wish it to do more! Bitbucket is also said to make it easy to merge such changes in later. I should also point out that the large majority of the work was of course done by the people who made SimplePie.

Anyway, I wanted to subscribe to the UN News podcast. To my surprise, gPodder was incapable of handling it. No surprise, as it turns out, because it’s not even proper according to the iTunes enclosure specification (although I imagine it works in iTunes). SimplePie had a nice get_enclosure() function already, so the first step, adding a proper enclosure to my Tube’s output feed, was a matter of minutes. The UN also fails to specify any size information, however, which I can’t say I was too enthused about in my trusty gPodder interface. Another 10 minutes or so later, I finished adding some cURL magic to my application. I should probably stash it away into a class later and see if I can somehow make it utilize SimplePie’s cache system to minimize useless traffic, but for now I just stuck it straight in the feed generation code. Now the UN feed is transformed from something gPodder couldn’t handle into something that essentially fixes all the UN did wrong. Thank you SimplePie for providing this great foundation!

Before (RSS):

<item>
  <title>UN Daily News 12 March 2010</title>
  <itunes:author>United Nations Radio</itunes:author>
  <itunes:subtitle>News and features from United Nations Radio.</itunes:subtitle>
  <itunes:summary></itunes:summary>
  <enclosure url="http://downloads.unmultimedia.org/radio/en/ltd/mp3/2010/10031200.mp3" length="" type="audio/mpeg" />
  <guid>http://downloads.unmultimedia.org/radio/en/ltd/mp3/2010/10031200.mp3</guid>
  <pubDate>Fri, 12 Mar 2010 11:42:32 EST</pubDate>
  <itunes:duration>0:00</itunes:duration>
</item>

After (Atom):

<entry>
  <author>
   <name>United Nations Radio</name>
  </author>
  <title>UN Daily News 12 March 2010</title>
  <summary> </summary>
  <published>2010-03-12T11:42:32-05:00</published>
  <updated>2010-03-12T11:42:32-05:00</updated>
  <id>http://downloads.unmultimedia.org/radio/en/ltd/mp3/2010/10031200.mp3</id>
  <link rel="enclosure" type="audio/mpeg" href="http://downloads.unmultimedia.org/radio/en/ltd/mp3/2010/10031200.mp3" length="6720384" />
  <link rel="alternate" type="text/html" href="http://downloads.unmultimedia.org/radio/en/ltd/mp3/2010/10031200.mp3"/>
</entry>

I realize the alternate link currently has the wrong type attribute, which I’ll look into fixing, but at least my gPodder can handle the feed now.

I also set up a little demo so you can check the difference with the original feed for yourselves. I’d be curious to hear how different podcatchers handle both feeds.

Comments

Microsoft and Video on The Web

Opera employee Haavard posted an open letter to Microsoft regarding video on the web. I’m just going to quote the last and best part.

I know you are a patent licensor in the MPEG LA, and this would actually make your actions even more powerful and meaningful. You could show just how serious you are about interoperability on the Web by supporting the free and open codec rather than the one that would best suit your short-term interests.

This is a unique opportunity for you to win back the hearts and minds of people who might have otherwise dismissed you as carrying on with “business as usual”.

Are you up for it?

Comments

Lighttpd and PHP on Ubuntu

I prefer Lighttpd over Apache on my personal computers because of its phenomenal speed and reduced memory usage. It’s surprisingly easy to get Lighttpd and PHP running on Ubuntu. For an extensive guide, including how to enable MySQL, Ubuntu Geek is the place to be.

This entry only deals with the basics of getting Lighttpd up and running with PHP. To get started, use:

sudo apt-get install lighttpd php5-cgi

Then run lighty-enable-mod and enter fastcgi.

Then you can edit /etc/lighttpd/lighttpd.conf. Stick the following at the end:

fastcgi.server = ( “.php” => ((
“bin-path” => “/usr/bin/php5-cgi”,
“socket” => “/tmp/php.socket”
)))

Recommended: sudo apt-get install php5-curl php5-tidy to be able to run Tubes with all functionality, and of course any other modules you might like. There’s nothing to it; you don’t even have to edit php.ini.

When you’re done customizing things to your liking, use sudo /etc/init.d/lighttpd restart to see the changes.

Comments

The Way Alternative Text Should Be Rendered

Vlad Alexander describes how browsers mess up horribly on alternative text. I noticed the deficiencies in Opera and Firefox before, but what Webkit does is simply ridiculous. I don’t entirely agree with him since I don’t think that the alternative content should display without any indication that it’s alternative text whatsoever. I consider Opera’s behavior best in this regard (as opposed to the obtrusive icons most other browsers throw in there), except for the part where it applies width and height meant for images to the text thus cutting them off.

Comments

Opera 10.50

For those of you who read my blog, use Opera and don’t follow the latest releases, Opera 10.50 for Windows was released yesterday. Download it now!

Comments

SimplePie-based Feed Mashup

This tool is now named Tubes and is hosted on Bitbucket.

As I wrote a few months ago, Yahoo Pipes is a nice tool. Nonetheless, it has a few shortcomings which annoyed me because I could neither fix nor work around them. Therefore, I decided to write my own mashup tool. For the impatient, you can download the file right now before reading anything else.

Since SimplePie seems to be the feed aggregation library of choice for many projects, I decided to go with it. I ran into a few minor issues, but nothing I couldn’t handle easily. The code I wrote is based on the multifeeds.php demo file and SimplePie 1.1.3, because in 1.2 it didn’t work (the multifeeds demo, that is — by extension I suppose this file won’t either). It’s a little rough around the edges, and SimplePie is clearly meant for HTML output rather than XML (although its HTML isn’t quite decent either, even if the input feed is), so I decided to fix the whole thing up with Tidy, which takes care of low quality input material as well. Hopefully that makes this whole thing more robust than it would otherwise be. The code is based around bringing various Opera feeds I read together in one big feed, but this can very easily be changed.

So now that I’ve got the basics of output into a feed taken care of, I can easily duplicate other functionality of Yahoo Pipes if I want. Much better.

Comments

Older Entries »