We've moved!

TechKnack.blogspot.com has officially moved to TechKnack.net. You should be redirected in 3-5 seconds. Thank you.

March 27, 2008

Anything to make a buck...

Add this post to Del.icio.us. Del.icio.us (0 saved)

I was perusing eBay today, looking at Photoshop CS3 prices, amongst other things. As I was looking down the list, I came across an auction for a copy of the GIMP Only $5 Buy It Now, $4.50 starting bid! Too bad anyone willing to buy it will download it for free. Those who don't know about the free option probably won't bid on it because they've never heard of it :)

I went over the GNU GPL hosted on The GIMP's website, and didn't see anything about selling copies of the software, other than the detail of offering the source code to the purchaser. Of course, the seller in this case also offers the legitimate option of mailing a CD with the program for $3 shipping. I'll be very interested to see how this auction goes, if it sells, how much it sells for, and how much traffic it'll get from Digg. Hehe, sorry, I just couldn't resist...

Edit: Upon further reading the GPL, section 3 states

You may copy and distribute the Program [...] in object code or executable form under the terms of Sections 1 and 2 [...] provided that you also [make the source code available].

It goes on to detail three methods by which you can make the source code available (accompanying the software, with a written offer to transfer the source, or with information concerning such an offer made to you). The seller, however, does not offer the source code anywhere in the listing -- and there's no way to know whether they will offer it after the auction.

At any rate, this seller is selling other GPL'd and open-source software, including 7-Zip and OpenOffice. And all the GPL stuff they're selling, IMO, taste of false advertising.

March 25, 2008

Faviconize your blog

Add this post to Del.icio.us. Del.icio.us (0 saved)

Favicons. Those little icons that appear on FireFox's tabs, IE's favorites bar, and various other places in web-related applications. Simple little icons, no larger than 32 pixels square, yet they are a part of your site's identity.

Why have a favicon? Kiseki.co.uk puts it well:

A favicon can help people identify your site quickly and easily in, say, a long list of bookmarks....It is only a small detail, but it can be useful for people to recognise your site.

A favicon is an instant visual cue that, when a visitor sees it, conjures your website in their minds. As AbstractPromotion.com says, "If you don’t have a favicon, your users will forget about you".

Making a favicon is fairly straightforward: churn up your creative juices, fire up the gimp, create a new 16x16px or 32x32px image, brand away, save as an ICO, GIF, or PNG file, then upload the image to a file hosting site. I personally enjoy Village Photos' free account, though there's always PhotoBucket, ImageShack, or Google's own Picasa service. After the image is web-accessible, add the following lines to the <head> section of your blog HTML template: <link href='http://host.com/path/to/image.png' rel='shortcut icon' type='image/png' /> <link href='http://host.com/path/to/image.png' rel='icon' type='image/png' /> And, voila! You should obviously replace the href and type attributes to fit your situation. For type, use image/png for PNG, image/gif for GIF, and image/ico for ICO, in case you were wondering :)

Why two nigh-identical tags? To answer a question with a question, what browser has, in decades past, caused us all so much pain? That's right. It seems that older versions of IE need the "shortcut icon" link just to see the favicon image...whether or not they decide to display it.

According to the W3C, the rel attribute's value should, "officially", be "icon". Interestingly, they also recommend putting a "profile" attribute in the <head> tag, "to define what the ["icon"] value means". Their version: <head profile="http://www.w3.org/2005/10/profile"> <link rel="icon" type="image/png" href="/somewhere/myicon.png" /> Though I don't know for sure how well this will make IE6 behave...if such a thing is indeed possible.

March 22, 2008

Web 3.0: Are We There Yet?

Add this post to Del.icio.us. Del.icio.us (0 saved)

Quick disclaimer: this article is simply something that I wrote up on a whim, meant to provoke thought. By no means do I claim to be an expert on the history of the web, the intricacies of "Web 2.0" et al, or anything else. This is, simply put, a brainstorm.

Since its inception, the web has been evolving.

In the beginning, there were marked-up files, with the sole purpose of spreading information. Files linked to each other using hyperlinks. Pages were made up of static HTML -- with a strong emphasis on "static". Websites were merely a collection of rarely-changing information. Rarely-changing because...well...because, put simply, they were static.

Enter Server-Side Scripting. Wonder of wonders! Intelligent pages, able to adapt, to learn, to store and retrieve information! Pages could be made easier to update, easier to maintain, and easier to modify. Website owners and visitors alike could create accounts, and later log back in to those accounts to retrieve information they had saved on previous visits.

The world of static pages, difficult maintenance, and ad-hoc special effects has been dubbed the "Web 1.0 era". The focus of the web was information, and information was served.

As dynamic server-side languages gained popularity, people created websites that slowly evolved into communities. Web 2.0, we called it. The focus shifted to the people, and the people were served.

And now where are we? "Well, nothing revolutionary has come along, so we must still be in Web 2.0". I would disagree. In a recent article on IndustryInteractive.net entitled "Facebook has failed us", the author states:

  1. Facebook is great at connecting people. [...] I was able to find people I went to elementary school with, identify them, and connect.
  2. Facebook sucks at playing well with others. There are Facebook Apps to integrate things like Flickr and del.icio.us, but they really blow, and why isn’t Facebook building that functionality right in anyways? [...]

While I won't say how great or how horrible Facebook is, it seems the focus of the web is shifting -- or already has shifted -- away from people, and more towards services. With "web applications" like Google Docs, Flickr, Netvouz, GMail, and Google Reader, web-based computing may not be that far off. Already, most of the functions we perform on our computers can already be done through our favorite web browsers -- even BitTorrent downloading!

People don't expect information or community anymore -- those are a given for any good website. What people expect in this new day and age is integration of services. Can I inject my Del.icio.us bookmarks into my blog feed? Can Google Docs post this document to my Blogger blog? Can I integrate my Flickr pics into my Facebook profile?

With the shift of focus to services, it's possible we may already be in a kind of Web 3.0. Or perhaps not -- perhaps we are only in Web 2.5, the middle grounds between people-focus and service-focus. After all, there was a Web 1.5: the middle grounds between information-focus and people-focus, when those good ol' dynamic web languages were still picking up support.

March 19, 2008

Search Apt package descriptions

Add this post to Del.icio.us. Del.icio.us (0 saved)

On Ubuntu (or Kubuntu, Xubuntu, etc), the command line package manager is Apt. Many people use the apt-get command to install and uninstall packages. I prefer to use the Aptitude command line program, which is a more robust front-end to apt; it allows you to search packages for keywords, and it gives a bit more human-readable information when managing packages. The usual method of searching packages is to issue the command "sudo aptitude search keyword". Here's an example using the keyword flash: $ sudo aptitude search flash p flashplugin-nonfree - Adobe Flash Player plugin installer p flashrom - Universal flash programming utility p flashybrid - automates use of a flash disk as the root filesystem p libflash-dev - GPL Flash (SWF) Library - development files p libflash-mozplugin - GPL Flash (SWF) Library - Mozilla-compatible plugin p libflash-swfplayer - GPL Flash (SWF) Library - stand-alone player p libflash0c2 - GPL Flash (SWF) Library - shared library p libroxen-flash2 - Flash2 module for the Roxen Challenger web server p m16c-flash - Flash programmer for Renesas M16C and R8C microcontrollers p mobile-basic-flash - Home applet for Hildon p vrflash - tool to flash kernels and romdisks to Agenda VR This method only searches the package names for the search term. To search package descriptions, you can pipe aptitude's output through grep, like so: $ sudo aptitude search . | grep flash p amideco - Decompress flashfiles equipped with an AMI p awardeco - Decompress flashfiles equipped with an AWA p flashplugin-nonfree - Adobe Flash Player plugin installer p flashrom - Universal flash programming utility p flashybrid - automates use of a flash disk as the root p ftdi-eeprom - Tool for reading/erasing/flashing FTDI USB p granule - flashcard program for learning new words p kwordquiz - flashcard and vocabulary learning program p kwordquiz-kde4 - flashcard and vocabulary learning program p libflash-dev - GPL Flash (SWF) Library - development file ...etc... Here we use aptitude's search "dot" wildcard, which effectively lists all available packages. We then pipe this output through grep, which filters out the input to show only lines which contain the search terms.

Unfortunately, grep truncates the input lines, chopping off part of the description. If you find something interesting, though, you can always use aptitude to search for the package name to get the full description.

March 16, 2008

Browsershots: Mass Website Testing

Add this post to Del.icio.us. Del.icio.us (0 saved)

In the world of Web 2.0, cross-browser compatibility is a necessary evil. With different browsers, different versions of different browsers, and different operating systems with different versions of different browsers, you can rarely predict how your visitor might be viewing your site (unless, of course, you're developing for a tightly controlled intranet, where everyone uses the same OS and browser). Unfortunately, it's rarely, if ever, possible or sensible to test your site on even the major browser/OS combinations, let alone every conceivable combination.

Enter BrowserShots (currently version 0.4 beta 2). What is browsershots?

Browsershots makes screenshots of your web design in different browsers. It is a free open-source online service created by Johann C. Rocholl. When you submit your web address, it will be added to the job queue. A number of distributed computers will open your website in their browser. Then they will make screenshots and upload them to the central server here.

The process is very simple: point your browser to BrowserShots.org, enter your website's URL, check off the browser/OS combinations you want to check it in (there are a LOT of choices!), set any optional settings, and click "submit". Optional settings include screen size, color depth, javascript support, java support, and flash support. Once you click submit, your requests are placed in a queue. In my experience, the wait time to receive all requested snapshots (mainly using the top browsers on all three platforms) varies between 3 minutes (last night) and 30 minutes (estimated time as I write this post :) ), though for $15 (10€), you can get priority processing. The snapshots are available for 30min (or more, if you want to extend it), and can be viewed as they are taken (you don't have to wait for the whole batch to finish). Refresh your "Website Overview" page to see screenshots as they are uploaded. On the Website overview page, you also have the opportunity to download a zip file containing all snapshots that have been taken so far.

Once a screenshot has been taken and uploaded, you can click on its thumbnail to view the details of the browser and OS the snap was taken on, as well as a full-size screenshot of the page. Details include browser, engine, javascript capabilities, java capabilities, flash capabilities; "factory", sponsor, hardware, and OS of the machine that took that snapshot; dimensions and file size of the screenshot; and various timestamps related to the screenshot.

Granted, you can't check website behavior (javascript animations, interactions, and such), but for those without access to different operating systems and different browsers, this is a very useful tool for cross-browser compatibility checking.

Browser Shots

March 13, 2008

Blue Spring Blogger template

Add this post to Del.icio.us. Del.icio.us (0 saved)

Download template files

Over my spring break, I decided to spruce up my blog a bit (read: redesign). Unfortunately, I am design-challenged and too cheap to pay someone to create a new design for me. So I started perusing the designs available at OSWD, and found a nice template called Blue Spring.

After finding, downloading, and familiarizing myself with the template's HTML and CSS, I set about hacking it into Blogger XML submission. It was mostly an effort of looking at my existing template, as well as the generated HTML, and revamping the CSS to support the structure produced by the Blogger widgets (mainly the Blog and Header widgets).

After combining HTML and CSS into one XML file and making sure the CSS supported all the widgets one might want in the sidebar, I set about "making it customizable". Not everyone likes to muck about in the CSS code -- some (most?) prefer to use Blogger's "Fonts and Colors" tab to do what they can. Supporting this was a simple matter of pulling out all the major colors and fonts into skin variables. After that, I made sure that all the widget sections had the proper settings.

Now, a "how to" on usage. In the original template, there were designated spots above and below the header for links, namely "navigation" and "other". I have left these as two empty sections, with a limit of one widget each. They are optimized for the "Link List" widget, but, as you can see by the search bar I've placed at the top, you may be able to fit other widgets in them. Beware when putting something other than a LinkList widget in the bottom slot, though -- it can seriously mess up your layout (and can usually be fixed by removing the widget).

The "Page Elements" layout is slightly a mess; as I have no clue how to modify the XML file to fix this -- without melting the layout -- you'll just have to deal with it :) The "edit" link for the top LinkList section is hidden by the logo. To get around this, move the widget to the lower slot (or a slot on the sidebar), edit it, then move it back.

Before uploading the template to your blog, be sure to upload the images to a hosting service, and replace all images used in the template with the appropriate URLs. Searching the XML file for "images/" will show you the images to be replaced. If you have a favicon for your blog, find the following section: <!-- link href='#favicon-url-here' rel='shortcut icon' type='image/gif'/> <link href='#favicon-url-here' rel='icon' type='image/gif'/ --> Uncomment it, and replace "#favicon-url-here" with the URL of your favicon. If you want a small RSS icon to the right of the bottom LinkList section, find this section: <!-- span id='feedlink'> <a href='#your-rss-feed-here'> <img alt='Subscribe' src='images/rss.gif' /> </a> </span --> Uncomment it, and replace "#your-rss-feed-here" with the URL of the feed you want visitors to subscribe to.

As the devil is in the details, you will, more likely than not, come across issues if you try to add custom or third-party code to the sidebar (or any other part of the template, for that matter). The CSS has been tweaked to make most of the official Blogger widgets look good; anything unofficial is just that, unofficial. Please keep in mind that I am not your personal HelpDesk, nor will I likely have time to help everyone "fix" their blog. There are Blogger help forums, as well as HTML/CSS help forums, that will be more than happy to help you, if you ask.

For you web standardistas out there, I don't know if the Blogger engine puts out standards-compliant code or not, but almost any Bloger blog you try to validate will turn out hundreds of errors :) as such, I didn't quite worry about making the template standards-compliant. If it is, it's completely on accident :P The theme does NOT render properly on IE6-. Seems to work fine on IE7, IE8 is unknown.

As always, with anything remotely related to technology, BACKUP!!! Go to your blog's layout, select the "Edit HTML" tab, and click the "Download Full Template" link. Save the XML file to your computer, so you have a backup to restore from if you prefer your old template.

The template's footer (and some comments in the CSS) credits the designer, DCarter, and the one who converted it into a template (Templater?), me. If you do use this template, please leave this info intact.

[ 5/11/08 ] Update: Turns out the first version would break when text size was increased, if you had menu items. Fixed by adding overflow:hidden; to the first #main-wrapper declaration. Still doesn't work in IE6. Also added overflow:hidden; to the #sidebar declaration, and the layout now mostly works in IE6 (there are still a few quirks, but it's usable). The sidebar is strangely displaced in IE5.01 and slightly off in IE5.5 and IE4.01 according to browsershots.org, but the template now supports "all major browsers on all major operating systems".

Additional links:
Download the Blogger template
OSWD: Blue Spring template
Blue Spring WordPress template
Open Source Web Design
The header image I use

This template featured at the The Blogger Templates

March 10, 2008

Super-target your AdSense ads

Add this post to Del.icio.us. Del.icio.us (0 saved)

While perusing the AdSense Optimization Tips, I came across a section on Blogtimizing, optimizing ad placement on a blog. That article, however, linked to the more interesting concept of section targeting - the idea of super-targeting your ads to a specific section of content, rather than all content on the page (which, on a blog, includes navigation links, blog title, sidebar content, and all sorts of non-topic-specific junk). From the section targeting page:

Section targeting allows you to suggest sections of your text and HTML content that you'd like us to emphasize...when matching ads to your site's content. By providing us with your suggestions, you can assist us in improving your ad targeting. We recommend that only those familiar with HTML attempt to implement section targeting.

To implement section targeting, you'll need to add a set of special HTML comment tags to your code. These tags will mark the beginning and end of whichever section(s) you'd like to emphasize...for ad targeting.

The HTML tags to emphasize a page section take the following format:
<!-- google_ad_section_start -->

<!-- google_ad_section_end -->

So, essentially, to super-target your ads, just wrap the relevant content in these special HTML comment tags. For Blogger blogs using the XML templates, however, it's a bit trickier. More likely than not, you'll want to target your ads to the content of your blog posts. To do so, it would appear obvious to wrap the <data:post.body/> Blogger tag with the appropriate comment tags, like so: <!-- google_ad_section_start --> <p><data:post.body/></p> <!-- google_ad_section_end --> The problem is, Blogger's template engine strips out all HTML comments contained within <b:includable> tags. Fortunately, Blogger themselves have a solution to this issue: <data:adStart/> and <data:adEnd/>: <data:adStart/> <p><data:post.body/></p> <data:adEnd/> These tags will be expanded by Blogger into the desired HTML comments, allowing you to super-target your AdSense ads.

Beware of being too specific in your targeting, however. Google has put in measures against "keyword spamming" your ads:

Include a significant amount of content within the section targeting tags; including insufficient content may result in less relevant ads or PSAs. Please also be sure only to emphasize significant sections of your site's relevant content, since it's against our program policies to the ad targeting to result in ads that are not relevant to the content of your pages.

That means no exclusively targeting your post titles or post tags.

Also of use are the "ignore tags" that go hand-in-hand with the targeting tags:

You can also designate sections you'd like to have ignored by adding a (weight=ignore) to the starting tag:

<!-- google_ad_section_start(weight=ignore) -->

This is good for topic-irrelevant content that appears on pages, specifically the content-ridden sidebar(s) that almost every Blogger blog has. Simply wrap the sidebar div in these tags to de-emphasize its content.

The way I set up my ads was to enable per-post ads (blog layout -> page elements -> click "edit" on the "Blog Posts" element -> check "Show ads between posts"), then move (only!) the <data:adCode/> line to the desired position within my post template, after the fashion of an article on Woork. I then removed all Blogger-added adStart and adEnd tags, and placed my own around my <data:post.body/> line, as specified above. I've found it works rather well on the individual posts' pages, though it seems to get a little confused on the front page. This is understandable, since there are multiple targeted content sections to process on the homepage, all with different content.

After specifying the targeted sections, I wrapped my sidebar content in the ignore tags. In my template HTML (no need to "expand widget templates"), I searched for the sidebar section: <b:section class='sidebar' id='sidebar' preferred='no'> ...all the various widgets... </b:section> And wrapped the entire section in the ignore tags: <!-- google_ad_section_start(weight=ignore) --> <b:section class='sidebar' id='sidebar' preferred='no'> ...all the various widgets... </b:section> <!-- google_ad_section_end(weight=ignore) --> And, voila, ads that are more relevant to my content! Enjoy!

March 7, 2008

I'm Digging...a duplicate of WHAT??

Add this post to Del.icio.us. Del.icio.us (0 saved)

Digg is a great source of traffic and popular news. Quite obviously a very popular website. However, its popularity has resulted in so many stories "getting Dugg" that, while Digging a brand-new story, it is almost inevitable to get a "We think you're duping us" alert. Frankly, it's getting quite ridiculous, if you ask me.

As I was digging the first dent in the ground for one of my recent articles, Add entries to Konqueror's "Create new" menu, I ran into the expected "Submit a New Story - Are You Sure It's Not a Duplicate?" message. I usually take the time to look through the stories to see if my topic has been covered before, but usually it's just a bunch of stories that have nothing to do with my topic. This time, though, it was worse.

The title Dugg was "Add entries to Konqueror's "Create new" menu". The content, you can see for yourself at the article's Digg page. The category was "Linux/Unix" under "Technology". The so-called duplicates?

Honestly, what does altering Konqueror's context menu have ANYTHING to do with BK offering Mac and Cheese?? It doesn't even have anything to do with food, and there were no less than three food-related "dupes" in the list. The only dupe that came close to my content was Empty Applications menu on Ubuntu 7.10

The Digg "Dupes Filter" may have worked fine when Digg was a startup site with only a few thousand stories, but with the multitudinous and growing number of stories Dugg on a daily basis, the Digg duplicates filter needs to be more robust than just picking out a few keywords from the Dugg content. It's time to revisit the design phase.
</rant> :)

March 4, 2008

IE Team Changes IE8's Default Behavior

Add this post to Del.icio.us. Del.icio.us (0 saved)

Just yesterday, the IE Team announced that they will be changing IE8's default behavior. Instead of the previously decided default of "IE7 Mode", IE8 will default to "IE8 Mode" with the option to switch to IE7 mode with the X-UA-Compatible meta tag. Web developers rejoice!

Additional links:
QuirksBlog: IE team changes its mind on IE8 default behaviour
WebWare: IE8 to be standards compliant: Good for devs and users
IEBlog: Microsoft's Interoperability Principles and IE8

Diggables:
IE team changes its mind on IE8 default behaviour
IE8 to be standards compliant by default
IE8 will render standards-mode pages as best it can

March 2, 2008

Add entries to Konqueror's "Create new" menu

Add this post to Del.icio.us. Del.icio.us (0 saved)

This has been a point of frustration for me since I first wanted to add "Create new .doc file" to Konqueror's context menu. To the best of my knowledge, there is no GUI method of adding filetypes to Konqueror's "Create new" menu, and there is little or no online documentation that details how to go about adding filetypes, or even how the system works. Grr.

The good news is that it is possible, even easy, to add filetypes to Konqueror's "Create new" menu. Best of all, it only requires adding a couple of files to an existing directory.

The entries in the "Create new" menu are actually called "templates". Which makes sense, since the newly created file is nothing more than a blank template to which you add content. The files that make up the menu entries are .desktop files located at /usr/share/templates/. The .desktop files point to template files located at /usr/share/templates/.sources, a hidden directory inside the templates directory. For my example, I'm going to add a .doc file template, since it is so often used in school. The basic idea can be applied to any file type, though.

First, open the program which can create the file you want to add (in this case, OpenOffice Writer). Create a new, blank document, and "Save as" the appropriate file (be sure to choose the .doc extension, not .odf) in an easily-accessible place (meaning user-accessible, a good place would be your desktop). I believe the name of the template file is used as the default name of the new document, though it will ask you for a filename before creating the file; I simply named my file "MS Word 2003 Doc.doc". After the template is created, fire up a command line and use

sudo mv "~/Desktop/MS Word 2003 Doc.doc" /usr/share/templates/.sources/

to move the template into its new permanent residence. Now go up a level to /usr/share/templates/. You will need root privileges of some sort (either a konqueror instance running under root, or sudoing at the command line). Copy one of the existing .desktop files (I recommend a filetype-specific file, such as the HTMLFile.desktop or TextFile.desktop files) to something like MSDoc.desktop. Open the new file for editing with root privileges (from a command line,

kdesu kate /usr/share/templates/MSDoc.desktop &

). Now you can either delete all the nonessential lines of foreign language code (keeping one line of each of Encoding, Name, Comment, Type, URL, and Icon instructions), and edit the remainder to fit your preferences, or you can copy my file's contents and paste it into your file:

[Desktop Entry] Encoding=UTF-8 Name=MS Word 2003 Document... Comment=Enter Document name: Type=Link URL=.source/MS Word 2003 Doc.doc Icon=document

I leave the Encoding line as-is from the HTMLFile.desktop file I copied it from. Name is the text that will show up in the menu. Comment is the text that will prompt for the new file's name. Type=Link specifies that this file is a link to another file (leave as is). URL points to the template file (which resides in the .source directory). Icon specifies what icon will be used in to identify the file type in the "Create new" menu. For Icon, "document" gives the file the icon associated with document files. The Icon for TextFile.desktop is "txt", and for HTMLFile.desktop, "html". I don't know how to go about finding the correct word form other filetypes, other than experimentation. A couple that seem to work for me include "spreadsheet" for a spreadsheet icon, "openofficeorg23-oasis-presentation" for the Oasis icon for OO Impress. One thing to try would be to open KControl, go to KDE Components -> File Associations, click on any mime type, and click the filetype's icon on the right. You should be taken to the Icon chooser. Select "Mime types" from the dropdown, and search for portions of keywords that match the icon you're looking for. Do not click any icons. To get the name of an icon, hover over the icon, and the chooser should give you a tooltip with the icon's name. Use that name in the .desktop file, and it should present that icon in the "Create new" menu.

If you followed everything correctly, you should now have an entry in Konqueror's "Create new" menu for creating a new .doc file. To recap:

  1. Create a blank template file
  2. Move the template file to /usr/share/templates/.source/
  3. Create a .desktop file in /usr/share/templates/ with the appropriate values
  4. Enjoy your new file-creation capabilities!

To extend functionality, you can, obviously, add template content to your template files. For example, if you develop websites and you're tired of always looking up the correct doctype declaration, you can build an html template file, complete with doctype, and simply create it from the Konqueror context menu. In fact, the existing HTMLFile.html file in my .source directory already has the basic structure of a standard web page. Of course, this isjust an example, and could be applied to other filetypes.