Rubénerd Blog :)

guides

This category has no catchy tagline yet. Then again, even the ones with taglines aren't catchy. What, you're trying to make me look stupid?

Thursday 10th September 2009

HP LaserJet Error -9672 on Snow Leopard

Error HP LaserJet Error -9672 on Snow Leopard

Finally found the first hardware device that Snow Leopard breaks: The HP LaserJet P1005 printer. Using Bonjour on an AirPort express on two separate machines the same cryptic "Error:-9672" error message. Apparently others are having a similar problem

So far this,not being able to play Matroska video files reliably and some weird font smoothing have been the only problems for me with the Snow Leopard system software. Still it means I’ll have to walk to uni to print stuff. As an early adopter I deserve this of course.

Tuesday 01st September 2009

Good encrypted disk images on Mac OS X

There are many options for those using recent versions Mac OS X to encrypt files, one of which is to create an encrypted virtual disk image which has the advantage of being portable across different computers and is simple to backup. While I am still a fan of TrueCrypt because it’s disk images can be opened on multiple OSs (subject for a future post), for Mac specific files I find using hdiutil is the easiest way to go and generally has better performance.

Why not use Disk Image.app?

While you can use Disk Image.app to create encrypted disk images, for some reason Apple refuses to allow you to paste passphrases. I’m sorry, but I don’t consider manually typing 256 character pseudo-random gibberish passphrases with punctuation, letters and numbers to be very practical! If anything by not allowing people to paste passwords Apple are discouraging people from using really solid passphrases.

Create a good passphrase

I like to copy a huge long list of high quality pseudo-random passwords from GRC’s Perfect Passwords page into a text file, then use one of them along with a phrase I have memorised for the final passphrase. That way, even if someone gets a hold of that file, they can’t derive my passphrase from its contents. Goes by the security philosophy of something I have, and something I know.

Create the disk image

Fire up your Terminal.app then enter the following:

hdiutil create -size 10g -type SPARSE -fs HFS+J \
-encryption AES-256 -stdinpass -volName LABEL-NAME \
FILE-NAME.sparseimage
-size 10g
Potential maximum file size in gigabytes
-type SPARSE
Dynamically expand the image as you fill it
-fs HFS+J
The initial filesystem, Mac HFS+ Journaled in this case
-encryption AES-256
Far stronger of two encryption options.
AES-128 may be faster on slower hardware, but is obviously less secure
-stdinpass
Require passwords to be entered in standard input
-volName LABEL-NAME
Name you choose that will appear in the Finder and /Volumes
FILE-NAME.sparseimage
Name you want for your disk image file

Accessing

If you view your Home folder you’ll see your new disk image. Problem is, like I said with Disk Utility.app above if you double click you can’t paste your passphrase in.

To access, just fire up Terminal.app and use the attach keyword. When it prompts you for your passphrase, you can paste your string of high quality pseudo-random gibberish then enter the part you remembered:

hdiutil attach FILE-NAME.sparseimage

You unmount the disk image in the same way you eject USB keys and optical discs in the Finder.

Other tips

If you create disk images that are smaller than 4.5GiB, you can burn your encrypted image to a DVD which makes it a cinch to backup! Also with this level of encryption the easiest way for people to access to your data is social engineering attacks: don’t let yourself down by using a crappy password and obviously don’t share it with anyone except perhaps your cat. No wait, cats are too smart.

WordPress summaries on some posts

Every time I try to pry myself away from WordPress which I’ve been moved over to in 2005 after thinking for far too long, another feature comes along that makes the decision harder. I’ll give you the attention you deserve one day Django!

In this case, it’s the ability to show a summary of a post with a link to read more, but only posts you elect it to happen to. Given I merged all my blogs into this one recently I’ve decided to use this on anime reviews which tend to have a ton more graphics and are much longer. It also means I can append a mild NSFW warning on some posts above the read more link when Her Senjougaharaness insists on spending half an episode in the shower.

To pull it off, make sure you have this code within the the_content() method, NOT the_summary() as you may assume. Finally, wherever you want the more link to be inserted, add <!--more-->.

Spiffyness.

Saturday 29th August 2009

Font smoothing in Snow Leopard

Appearance prefpane in Leopard

For some reason, Apple decided in Snow Leopard to disable graphical configuration of font smoothing (aka sub pixel rendering) and instead rely upon LCDs to report what settings should be used. Problem is, support for this is spotty with some panels and the resulting fonts look rough and pixelated.

On regular Leopard if you open the Appearance prefpane you’re presented with a drop down box where you can choose how heavy font smoothing is applied, as shown in the screenshot above. On Snow Leopard all you get is an ambiguous checkbox saying "Use LCD font smoothing when available" without any option to choose by how much:

Appearance prefpane in Snow Leopard

Fortunately you can still adjust this manually by opening Terminal.app and entering the following command with an integer between 1 and 4 (representing the 4 previously available options), then re-opening your applications. Easiest way is to enter this, then log out and log back in.

defaults -currentHost write -globalDomain AppleFontSmoothing -int 2

Heaven knows why Apple user interface designers decided to remove access to this feature.

Monday 17th August 2009

Downloading, downgrading to Firefox 3.0.13

Firefox 3.0.13

After posting a few weeks ago about how I’d downgraded back from the Firefox 3.5.x series to Firefox 3.0.13 because of serious stability problems I’ve been overwhelmed by the feedback I’ve got from people here on the blog and through Twitter and email saying they’ve had the same problems. Not since I started using Phoenix 0.2 when I was in high school have I ever had to downgrade Mozilla software, it really is that bad.

The problem is Mozilla has (possibly intentionally) made it difficult to locate the downloads for the 3.0.x series which is still being maintained and supported. I admit when I gave up and decided to downgrade I used a copy of 3.0.6 I still had on an external drive then used its internal software update feature to bring me up to 3.0.13.

Fortunately since then I found my ISP here in Adelaide has a globally accessible mirror for Firefox 3.0.13 which you can find here:

http://mirror.internode.on.net/pub/mozilla/firefox/releases/3.0.13/

I think it’s safe to say the 3.5.x series is still beta quality software and should be treated as such, meaning when I advise people about what software they should use on production machines I’ll be strongly suggesting they use 3.0.x.

Tuesday 14th July 2009

Seperate templates for WordPress categories

Here’s something interesting. If you use WordPress you can assign separate templates for different categories; presumably I’m assuming (what a redundant few words) this also means you could give different categories different CSS styles too.

The WordPress Codex says you can define different templates in your current theme based on the ID of the category you want to customise. If it doesn’t find a specific template for the category, it reverts back to the theme default.

For example, the Rubenerd Show category here has an ID of 277 (the unfortunate legacy of using categories as tags before WordPress has native tag support) which means if I wanted to create a custom theme template for it, I’d create a category-227.php file. Other categories don’t have that ID, so they’d continue to use the basic category.php template.

My plan of merging all my blogs into this one while giving the appearance of separate sites seems to be a neverending story, but all the pieces seem to be falling into place. So far I’ve learned:

I’m starting to think it may have been less work to just move my blog here to my Django system after all, but I guess I have the advantage in this case that someone else is maintaining the code. I’ve gone this far though I guess, so no point stopping now!

Thursday 18th June 2009

Using Qmax as your free Wireless@SG carrier

StarHub Wireless@SG on an iPhone using WiFi

Little tip for those who use Qmax for their Wireless@SG provider, because you’re not using SingTel or StarHub it means you can log into the free WiFi services at both Starbucks and the Coffee Bean (to use the places I frequent as examples) regardless of the carrier and use the "local roaming customers" option, very cool!

One thing you have to keep in mind though is how you enter your username. On SingTel when you select Qmax the username field will be populated with @qmax.com.sg so you just have to enter your username at the beginning. On StarHub when you select Qmax they fill in the email address part but only after you’ve hit the [SUBMIT] button! In this case don’t worry that you’ve only partially entered your details, when you enter your username and submit the form it’ll still work.

Now if I could get the Singapore Information and Development Authority to pay me for help posts like this we’d be in business.

Thursday 11th June 2009

Using Gnome icons in the Xfce desktop

Xfce with Gnome icons

For a bit of a change in Xfce on my FreeBSD machines I’ve decided to eschew the Tango Project iconset and use the Gnome Desktop icons available from the ports collection:

# cd /usr/ports/x11-themes/gnome-icons
# make install clean
# echo "Grilled Cheese Sandwiches"

They’re very classy and quite minimalistic which really appeals to me, and even though I use Xfce instead of Gnome which the icons were originally designed for, they work smashingly. Did I just say "smashingly?"

Now if only the folder icons weren’t that dull sand colour we’d be in business!

Monday 08th June 2009

Excluding WordPress categories

I can confirm adding the following code to the functions.php in my current theme prevents posts from certain categories appearing on the home page, and the main site RSS feed. In this case we’re filtering category ID 5:

function myFilter($query) {
  if ($query->is_feed || $query->is_home) {
    $query->set('cat','-5');
  }
  return $query;
}
add_filter('pre_get_posts','myFilter');

If you only want to filter categories from the home page, simply remove the $query->is_feed || condition, and vica versa.

This little change really allows WordPress to be used as a simple CMS by allowing you to separate material and provide category feeds for different types of posts. I’ll be using this so regular readers subscribed to my main RSS feed don’t get any of my anime posts from my blog that I’ll be importing from my university intranet.

Thanks to Scott Jangro for this great tip.

Tuesday 19th May 2009

Creating clouds of links instead of long lists

Beautiful colours and clouds
Clouds are pretty

I admit I tend to do more back-end programming than front-end website design, but I have picked up a lot of little tricks. One such trick is instead of displaying links in a dry vertical list, to display lists of links in so called "clouds". This has the benefit of using a tiny fraction of the vertical screen real estate, and they look cooler!

For example, here's a cloud list of the links from the blogroll of this site here. If these links were displayed as a plain list, it would take up over 30 lines!

The key is to use a regular unordered list of links as you would for a plain vertical list of links, but then use CSS to display the list items inline instead.

For example, this is an example of a basic unordered list of links:

<ul class="cloud_list">
  <li><a href="#">K-On</a></li>
  <li><a href="#">Code Geass R2</a></li>
  <li><a href="#">Sola</a></li>
  <li><a href="#">Strike Witches</a></li>
  <li><a href="#">Zero No Tsukaima</a></li>
  <li><a href="#">Grilled Cheese Sandwich</a></li>
</ul>

To display them as a cloud, you use CSS to change each link into an inline element which will cause them to group together, along with a few other properties to clean up their appearance:

.cloud_list li {
  display: inline;  /* DISPLAY LINKS ON SAME LINE */
  margin-right: 1em;  /* SPACE LINKS OUT */
  white-space: nowrap;  /* DON'T START NEW LINES IN LINKS */
  list-style-type: none;  /* REMOVE BULLETS IN IE6 */
}

And this is only scratching the surface! With CSS you could also theoretically use different classes to define different font sizes and styles for certain links to create more of tag cloud look.

And here's the appended CSS showing the different classes we can add to links to differentiate them, in this case my criteria is my opinions of the shows contained in the list:

.cloud_list .love { font: x-large Georgia; }
.cloud_list .like { font: medium; }
.cloud_list .weird { font: medium "Courier New"; }

Anyway that's just one possible use for CSS and lists, there are certainly many more!

< Older posts
Dedicated to my groovy late mum Debra Schade.