URLs, the last great ‘what the’ URLs, the last great ‘what the’
  • Home
  • Posts
  • Home
  • Posts

Geekspeak

URLs, the last great ‘what the’

Happily surfing the Microsoft website today (don’t ask), I was amused to note the ridiculous URLs in use – Here are some examples:

  • http://www.microsoft.com/ downloads/details.aspx? FamilyId=4C254E3F-79D5-4012- 8793-D2D180A42DFA &displaylang=en
  • http://www.microsoft.com/ downloads/Browse.aspx? displaylang=en&productID= 4289AE77-4CBA-4A75- 86F3-9FF96F68E491
  • http://www.microsoft.com/ downloads/info.aspx?na=63&p=& SrcDisplayLang=en& SrcCategoryId=&SrcFamilyId= 9996B314-0364-4623-9EDE- 0B5FBB133652&u=%2f genuine%2fdownloads%2f WhyValidate.aspx%3ffamilyid %3d9996B314-0364-4623- 9EDE-0B5FBB133652 %26displaylang%3den

Whatever happened to friendly URLs? If I was going to point someone to an article or a download from Microsoft’s website, I’d need several weeks just to recite it! (I will admit that Apple is no better – take their link to the MacBook Pro on their store site: http://store.apple.com/133-622/WebObjects/australiastore.woa/ 80505/ wo/3s3D4l85iljb2mPXrPH2pCTDMcy /0.SLID? nclm=MacBookPro&mco=7C576790)

Crazy long URLs force site users to work through the navigation instead of being able to point each other to pages: Imagine reciting such a URL over the phone – it would never happen – "slash, 3, lowercase s, 3, capital D, 4, lowercase l, 8, 5…". Instead, one would tend to point to apple.com, and give directions from there. There is also no way anyone could work out what each URL points to by looking at it. It’s crazy!

In the case of the four URLs above, these really should be something like:

  • http://www.microsoft.com/downloads/ Worldwide_English/ActiveSync_4.1
  • http://www.microsoft.com/office
  • http://www.microsoft.com/Windows_Genuine_Advantage
  • http://store.apple.com/au/MacBookPro

These days, with ‘404 handlers’ and such things in common use (this site uses one!), it really is very easy to make user-friendly URLs. Having a decent URL for a site’s users means they’re more likely to be able to point each other to a site (Keep It Simple, Stupid), and thus more likely to bring more visitors to the site.

URL handlers are very easy to write – using Apache, one just needs a .htaccess file sitting in the webroot, which directs all URLs to a handler page:


RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) /index.php

Then, have a page (in this case, index.php) which processes the URL and provides an appropriate page. SiteComponents has:

// Get URL request
$s = substr($_SERVER["REQUEST_URI"],
strrpos($_SERVER["SCRIPT_NAME"], "/")+1);
// Strip off GET parameters and anchors
if ( strpos($s, "?") !== false )
$s = substr($s, 0, strpos($s, "?"));
if ( strpos($s, "#") !== false )
$s = substr($s, 0, strpos($s, "#"));
// Run site
$site->Run(urldecode($s));

The ‘Run’ method within $site will then handle the URL, and return an appropriate page (or suggest one if no exact match is found).

Read More

Fractal image coding

I’m studying for a Digital Video Coding and Compression exam, and just wanted to share the coolness that is fractal coding.

Sierpinski GasketFractals are geometric objects which are said to have infinite complexity, and are often self-similar (that is, a small portion of the fractal is the same as the whole fractal). Iterated Function Systems (IFS) are one kind of fractal. An example is the Sierpinski gasket. Zoom into any of the sub-triangles, and they look just like the original.

It’s formed by making three ‘copies’ of an original image (it doesn’t matter what the image is), and placing them in the shape of a triangle; one above, one bottom-left, one bottom-right. Repeat an infinite number of times:

<

p align=”center”>

The same process, with an altered replication pattern, can be applied to form other shapes, such as a fern leaf (which uses 4 copies of the previous iteration’s image: One thin one for the stem, two rotated shrunk ones for the fronds coming off the sides, and one for the rest of the fern). Such patterns are often observed in nature, which makes fractals particularly interesting.

Fractal image coding applies a similar concept. Parts of the image are used to build up other parts (imagine an image of a tree; A bit of a branch is copied and shrunk, to form the image of a smaller branch coming off the first one). This process of searching for similar parts within the image, and using them to form the current part, is repeated over the whole image.

To reconstruct the image, the same process as generating the Sierpinski gasket is used: Bits of the starting pattern (which, amazingly, can be anything) are copied, scaled, coloured and rotated, as instructed by the encoding process. The whole process is repeated until the image is built:

Oh, it’s such black magic.

Unfortunately, the whole process is incredibly slow, because so much searching is required during the encoding process (Looking for that branch part that looks like the current part of the image being encoded). It also doesn’t quite give enough performance to make the extra work worthwhile. Still, it definitely performs well in some circumstances; maybe it will make a comeback when we have faster computers.

NB. Most of the images are nicked shamelessly from Dr. Tim Ferguson’s lecture notes on fractal coding, from CSE5302. Also, for further reading, Mirsad suggested this paper: A Review of the Fractal Image Coding Literature, by Brendt Wohlberg and Gehard de Jager.

Read More

Hi! I'm Michael Tyson, and I run A Tasty Pixel from our home in the hills of Melbourne, Australia. I occasionally write on a variety of technology and software development topics. I've also spent 3.5-years travelling around Europe in a motorhome.

I make Loopy, the live-looper for iOS, Audiobus, the app-to-app audio platform, and Samplebot, a sampler and sequencer app for iOS.

Follow me on Twitter.

Posts pagination

« 1 … 28 29
© 2021 A Tasty Pixel.