The One with the Thoughts of Frans

Archive for Internet

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.

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

30 Days to Becoming an Opera Lover

The 30 Days to Becoming an Opera 6 Lover series may very well have been what pulled me over the edge. That which made me choose Opera instead of MyIE2 (now Maxthon). It should therefore be no surprise that I still harbor warm feelings toward it. While it may be old, and the original series is no longer hosted by TnT Luoma as far as I can tell, I think that the series could still teach current (aspiring) users of Opera a thing or two — even the 30 Days series for Opera 6. Due to the large part the Opera 6 series played in my personal discovery of Opera, however, my judgment may be somewhat impaired.

I dug into the Internet Archive and I was pleasantly surprised to discover that the 30 Days series for Opera 6 is available through the archive in a nice ZIP file. The original Opera 6 lover pages do not seem to have been preserved, but the ZIP file is easier to use regardless.

The 30 Days series for Opera 8 was also preserved.

While I would not recommend a detailed read (it is quite outdated after all), I would certainly recommend skimming through most of it.

By the time Opera 8 came out — and consequently, the 30 Days to Becoming an Opera 8 Lover series — I was already a seasoned Opera user, so the series didn’t do much for me. I did discover one very important Opera feature thanks to it, however. In the default keyboard setup, Shift + F2 is bound to go to nickname. If you don’t know what nicknames are, you can give bookmarks so-called nicknames; if you type them out in the address bar and press enter it will take you to the bookmark, and it will offer autocomplete suggestions while you’re typing. Useful, but not a huge time saver.

Go to nickname is better, because it starts going to the nickname as soon as it’s got a match. So if you have only one bookmark with a nickname that starts with a, you’ll only have to type a and you’ll be on your way. I had not realized this prior to reading the Opera 8 Lover series, and it wasn’t actually written in the series, but without it I might very well never have tried this feature again. After some consideration and major inspiration by Moose I rebound F2 to new page & go to nickname, which means that ever since, pressing F2 automatically opened a new page and this tremendously useful dialog. The introduction of speed dial didn’t do much for me thanks to this keyboard shortcut. It might take a few seconds more to configure, but it’s worth it. Additionally, new tabs will open even faster if you disable speed dial.

Comments (1)

Teaching WordPress Some Manners: Enabling Day/Month/Year Archives

WordPress can’t cope with day/month/year (/%day%/%monthnum%/%year%/) permalinks properly by default. I had no idea because I’ve always used year/month[/day]. It’s fine for the posts, but in the archives /date/month/year fails. Luckily WP (WordPress) supports plugins in a clever manner, and it has a great API (application programming interface).

Initially I tried the WP API:

add_rewrite_rule('date/(\d{1,2})/(\d{4})', 'index.php?m=$matches[2]$matches[1]', 'top');

This kept giving me an error which I couldn’t (be bothered to) debug since it went several functions deep into the WP core, so I gave up on the API and circumvented it with the help of something I found.

Anyhow, here’s the plugin. Save in a file named rewrite-day-month-year.php or just name it whatever you like.

<?php
/*
Plugin Name: Rewrite Rules for Day/Month/Year
Plugin URI: //fransdejonge.com/2010/01/teaching-wordpress-some-manners-enabling-daymonthyear-archives
Description: WordPress can't cope with /%day%/%monthnum%/%year%/ for some reason. That is to day, it fails when you try to go for an archive in the form of /date/month/year/ This teaches it some manners. Probably/hopefully shouldn't interfere with other structures, but why you'd activate it if you don't need it I wouldn't know.
Version: 1.0
License: GPL
Author: Frans
Author URI: //fransdejonge.com

Based on http://dd32.id.au/files/wordpress/test-rewrite.php
*/

function test_add_rewrite_rules( $wp_rewrite ) {
	$new_rules = array(
		"date/(\d{2})/(\d{4})" => 'index.php?m=' . $wp_rewrite->preg_index(2) . $wp_rewrite->preg_index(1),
		"date/(\d{4})" => 'index.php?year=' . $wp_rewrite->preg_index(1)
	);
	$wp_rewrite->rules = $new_rules + $wp_rewrite->rules; //NOTE: You must add it to the start of the array, Else WP's greedy rules at the end of the array will eat the request
}

register_activation_hook( __FILE__, 'flush_rules_initiate' );
register_deactivation_hook( __FILE__, 'test_flush_rules' );
// add_action('init','test_flush_rules'); // for testing

function flush_rules_initiate() {
	// Add the permalink override stuff
	add_action('generate_rewrite_rules', 'test_add_rewrite_rules');
	test_flush_rules();
}

function test_flush_rules(){
	//Flush the rewrite rules so that the new rules from this plugin get added,
	//This should only be done when the rewrite rules are changing, Ie. When this plugin is activated(Or Deactivated), For simplicity while developing using WP Rewrite, I flush the rules on every page load
	global $wp_rewrite;
	$wp_rewrite->flush_rules();
}
?>

Comments

« Newer EntriesOlder Entries »