Posts tagged ‘software’


Create an HTML version of man pages

There is a program designed for the purpose of creating an HTML version of a manual page (man page). This program is called man2html. However, man2html does not create a table of contents in the resulting HTML, which would be very useful for long man pages. But we can actually accomplish that with the man utility itself, believe it or not!

The man utility gives us the ability to view a man page in a browser, with the man page formatted into HTML (with table of contents). This is done using the following command:

man -Hbrowser page

where “browser” is the browser you wish to use, for example “firefox” or “google-chrome” (these need to be in your PATH), and where “page” is the man page you wish to read, for example “bash” or “emacs”.

Unfortunately, the HTML file created for this purpose is a temporary file which is deleted! So if you close the tab or window of the browser, or even refresh the page, you will get an error telling you the HTML file cannot be found anymore! To get around this, we trick the man utility into using the cat utility as the browser. We then let cat redirect its output of the HTML file to a permanent file, like so:

man -Hcat bash > bash.html

After that, we can view the file in a browser:

google-chrome bash.html



Installing LaTeX packages in your home directory

I was recently in a position where I wanted to use a LaTeX package, but it was not installed on the computer system I was working on. The computer system was at my workplace, at Umeå University. I had a conversation with the systems administrator and he told me that updating the entire TeX distribution would require a lot of work, but that I could place the package in the current directory, with my document, and it would hopefully compile.

I hoped so too. But of course, this being the real world, such luck is rare with computers. So I decided to dive into how I might install a LaTeX package locally, in my home folder. I finally managed to find a solution, and I will detail this below.

This “how-to” will not cover how to create a package, or even how to download ready-made packages or whatever. I had the package that I required installed on my computer at home, so I just copied and pasted that over to the work computer. This tutorial will only cover how to make LaTeX look for packages elsewhere than the default package path.

LaTeX automatically looks to see if there are any package installations in $HOME/texmf/. That search path is the default value of the environment variable TEXMFHOME. This is very nice and handy; what this means is we can use “$HOME/texmf” as a folder to chuck packages into. However, I prefer to have files that I never really intend to open in hidden folders (folders whose name starts with “.” (dot)). So the next step I took was to create a folder where I can put packages, in my home directory (“$HOME”).

> mkdir $HOME/.texmf

After that, I went and added a command to my .bashrc file that will change the value of the TEXMFHOME variable to be that of the newly created folder. This way, LaTeX will search for packages in that folder instead. The following lines were added to the .bashrc file.

# LaTeX stuff
export TEXMFHOME=$HOME/.texmf

I usually use pdflatex to compile my LaTeX documents, so if you use some other program, the environment variable you need to change might be different. I compile my LaTeX documents on the command line, so if you use another system, you might have to find another way to export your environment variable, or even use the specific application settings in your editor, if your editor supports compiling LaTeX documents.


New Google Interface

Apparently if you’re running a late enough version of Chromium or Google Chrome I really don’t know how you enable this, but you might experience that Google’s home and search results page have been revamped to a new style. I’m running Chromium 5.0.335.0 5.0.356.2 (on the dev channel).

This is what these pages look like for me now:

Notice how the buttons and search text box is bigger, and the Google logotype now lacks shadows and the trademark symbol has been taken off of it. This page no longer features the fade-in effect, but shows everything on the page immediately. Though I have to say, in Chromium, the page reloads much, much faster anyway, than in Firefox 3.5.8 (current version in Ubuntu 9.10 as time of writing).

Update (2010-03-12): Fade-in effect is now activated in the new design as well.

Moving on to the results page now:

As you can see there is an entirely new menu on the left hand side. This menu is collapsed by default but I expanded it to show what it looks like. The options that were available before–such as sorting by date, and other attributes–can now be found under “More options…” also on the left hand side. The first menu on the left is very smooth-looking with its little favicon/thumbnail style of icons, and probably AJAX-powered, with its smooth expanding and collapsing. The menu below it however, unfortunately is not very smooth and seemingly even reloads the page when one expands/collapses it. It also resets the state of the menu above it.

Update (2010-03-23): The lower menu is now much more smooth and does not reload the page. It also features a few options (two at first: “All results” and “Page images” and more as you use other options), and the menu has now been titled “Recommended Tools”.

Update (2010-03-12): The little icons in the left-hand side menu are now colored as opposed to monochromatic/gray-ish.

Another thing to notice is the integration of the search button into the search text box, giving them both a more coherent look.

One thing I’m really missing from this new interface is the handy dictionary on the right side. If you search for a word that Google’s dictionary recognizes, there would otherwise be a link to its definition (see image below). I can’t see that anymore, but hope it resurfaces some day.


The Naming of the Bovid

Michael Lustfield is crazy. He also wrote a post on his web log in which he, long story short, pretty much claims the GNU project is being a bunch of whiny babies about the whole GNU/Linux / Linux naming convention discussion that’s been going on for a great while now.

I generally share the same opinion as Michael. GNU, in their own documents (as reviewed by Michael), keep saying

  • “We started this thing. We were first. Give us credit.”
  • “GNU is an operating system, just lacking a kernel.”
  • “Most people use a GNU/Linux system which is essentially a GNU system with Linux tacked on.”
  • “We deserve credit because the operating system you use is GNU. (…) Using the Linux kernel.”

I interpret Michael’s opinion to be that “GNU IS NOT an operating system” because they never finished their own kernel, while GNU feels that an operating system is a complete, general system that enables you to do your work with your computer.

It is my belief that it all boils down to one’s definition of “operating system”. I acknowledge several definitions, but one definition is much simpler than the other; it is much easier to just define it as “the kernel”, but if you define it the way GNU defines it you are faced with the difficult problem of where to draw the line. Should a Word Processor count as essential software in the operating system? Media player? GAMES? APPARENTLY according to GNU (again, see Michael’s post and/or GNU’s documents).

This is a problem, so I do actually prefer the OS to be just “the kernel”. This is why I don’t feel bad saying that “I use Linux”, and not that “I use GNU slash Linux”, the latter of which would just sound ridiculous in all honesty.

But even so, if you would take “operating system” to mean what GNU feels an operating system means, you most definitely have to include the kernel, and GNU’s software and the Linux kernel are huge contributions in such an operating system. This is why it would be appropriate to call it GNU/Linux, but then for the same reason, GNU still really isn’t an operating system without Linux, so no, Michael, GNU indeed IS NOT an operating system.

Regarding the quote “with a kernel tacked on” (might be paraphrased), as if the kernel is just a regular piece of software running inside the OS. It’s much more than that—it’s what facilitates all the system resources to all other software in the “operating system”. All this is pretty confusing, but in conclusion, GNU isn’t an operating system by my definition, which is that the operating system is the kernel:

Schematic View of Operating System

Schematic Orientation of Operating System

Interestingly, a Wikipedia article defines the kernel to be, in fact, a part of the operating system, but I don’t think the definition in general is set in stone.

Nonetheless, while the GNU folks do come off as being whiny babies about this, there is truth in that it is important to recognize GNU for the work that they have done and for what they have done and are doing the work, which is a great, great thing. But fussing over the naming of operating systems is definitely not the way to go about doing this. It clearly just causes frustration in the community, and it is dividing it. Luckily I don’t think this fussing is causing a division deep enough to cause any real damage because of shared philosophies, but it is worth being fine with calling it just “Linux”, getting on with your life, and finding another way to promote Free Software.


Open-Source Calculus

I’m (re(re))taking the second course on calculus during the summer at the university. It’s going much better this time around, which is a good thing.

I did have problems with one problem (har), and I couldn’t make sense of it on my messy notebook, and I didn’t feel like doing the entire problem over again. The only thing wrong with my solution is that the answers in the back of the book said term1 – term2, while I kept getting term2 – term1 in my notebook, so I wasn’t too far off but still couldn’t get it right — couldn’t find the erring minus sign. All I really felt like was doing some programming, which I enjoy, but what would I code if I have no software needs?

Then I thought: I need to get a more structured view of this problem. Why not write it up in LaTeX and make it into a nice, good-enough-to-print, PDF solution. That way, I will get some practice writing LaTeX documents (it’s been a few months, sadly), and writing LaTeX is pretty much programming in a way, so I get to practice LaTeX, scratch my coding itch, and maybe find out where that offending minus sign went.

Sure enough, it worked pretty well.

Solution to problem 6.2.9 in Calculus, A Complete Course (Sixth Edition).

I want to point out that this PDF was produced entirely using Free and Open-Source Software (FOSS):

  • texlive LaTeX distribution (tex->PDF compiler: pdflatex/pdftex)
  • GNU Emacs as the LaTeXt editor
  • Ubuntu Linux to run Emacs and tex compiler
  • Totem to play music while writing up the solution
  • Grip + oggenc to rip CDs to Ogg Vorbis
  • Ogg Vorbis media container format
  • libVorbis 1.2.0 used by oggenc (darn you Ubuntu for not updating libVorbis since 2007)
  • and so forth.

It works, folks!


Bloat Warning

On my system, iTunes and QuickTime take up a combined space of over 180 MiB. That. Is. Crazy.

For a piece of software that I use for nothing else than transferring my songs from one place to another, 180 MiB is an astronomical length. iTunes takes up 106 MiB. The rest is accredited to QuickTime. I don’t even use QuickTime! But iTunes refuses to start without it! I use other free and open-source software to play media than iTunes:

On Ubuntu/Linux:

  • Rhythmbox
  • MPlayer
  • Totem

On Windows XP:

  • Winamp
  • VLC
  • XBMC

That covers all of my media-playing needs. Combined, these players, on each system respectively, play just about every format in existence. And MPlayer, VLC and XBMC are available for multiple platforms, it’s just that they run smoother/more gracefully in my experience on the respective platforms mentioned above that I use.

Back to the matter at hand: As I mentioned, I use iTunes for one reason and only one reason — to transfer songs to my iPod. That task does include fetching album cover art, but I count those two as one task. I don’t play any media in iTunes; no music, no podcasts, no videos or movies, nothing! If I have that kind of setup and needs, why shouldn’t I be able to uninstall the unnecessary modules of the software and save some space? I mean I can understand iTunes. It has quite a lot of features, and I assume that all drivers for every single product that iTunes supports comes with the installation of iTunes, but it doesn’t have to be that way!

Alternative #1

Imagine that you just bought a device from Apple. Let’s say it’s a new iPhone.

As soon as you plug in the iPhone for the first time after installing iTunes, iTunes recognizes that you have a new device and suggests to download the necessary drivers, or whatever it needs, to be able to work with your iPhone. Perhaps installing them as plugins, or integrating it with the software in some other way. BRILLIANT. Now, for any other features I like to use in iTunes, enabling them as I go.

Alternative #2

You just bought a new iPod Nano 16 GB (like I have), for example, and you go to the download page for iTunes to download and install the necessary software.

Upon installing iTunes, you are given — oh, I don’t know — OPTIONS REGARDING WHAT YOU WANT TO ACTUALLY INSTALL, as so many other installers do for other software. Then in those options it might say something like “I would like to be able to play music and video”, perhaps separating music and video into two options, and selecting those options would install QuickTime as well (although it’s ~75 MiB is inexplicable to me).

Alternative #3

Release the module that transfers content between hard disk drive and device as a stand-alone application! I understand that you need some type of technology to recognize which types of media can be transferred and played on the actual device, but that doesn’t imply that you also need the technology to play the media before you transfer it to where you actually want to play it.

That was a little messy, so let’s illustrate with a helpful and suitable analogy: You don’t need to take a bite out of the apple to realize it’s an apple! Otherwise I assume people would look at you strangely whenever you go to the grocery store for example. Sampling all the apples before you pick them up.

At the very least, iTunes should include some install-time options. I’m not really sure, but as far as I can remember, I couldn’t even select where I wanted to install it.


The Horror of YouTube

If you’ve watched a video on YouTube in the last few months, you must have noticed the new advertising system they integrated into their Flash-based player a while ago.

My guess is that the advertisement isn’t added to videos that were uploaded before it was enabled. So if you watch a fairly new video you’ll see it. For your convenience, here’s a picture of what it looks like.

YouTube advertisement.

YouTube advertisement.

See that? That thing slides up from the lower edge of the video – not immediately after you start the video, no no, but after a few seconds, right when you’ve let go of the mouse and started to sit back and relax as you watch the video. That’s when it comes up. And sometimes it covers a lot of what you’re trying to watch, for example if the video has captions or subtitles. So not only does it catch you off guard, but it makes you rewind videos! WHAT A STUPID THING.

I loved Google Video when it came out, and I love it today because the player and the whole thing is just a lot cleaner, and the player itself works better, than YouTube. Then YouTube was acquired by Google. Things started to change, and YouTube got a lot of enhancements, not only the obvious changes to the player in terms of style, buttons and recently the different choices of quality of the videos, but also more subtle things like (dis)agreeing with text comments by giving it a thumbs up or down, and other things that make the loading of content in general run smoother than before.

At that point, I really started to think about whether I actually favoured YouTube over Google Video… But, no. Forget that. Never. The player is still junk (seeking is HORRIBLE among other things, not to mention the ads), the pages are waaaay to over-loaded with moving images and content with different styles and colors, and there’s no intuitive way to download the videos to your own hard disk drive to view later or to put on your portable player for instance. And what are those stupid, annoying annotations anyway? Just put it in the description box, will you? If I’m not interested in reading your “LOL”s and your “LMAO”s inside the video, I shouldn’t have to! “But you can turn off the annotations by just by cli…” I KNOW THAT, but it’s ENABLED BY DEFAULT. And if you reload the page, IT COMES BACK ON. AND SOMETIMES YOUTUBE’S PAGE RELOADS AT RANDOM.

Google Video’s player, however, seeks beautifully, the pages are clean and contain barely anything but the video in a large window and the comments and other things to the right of the video neatly ordered in tabs, and you can download the videos. Even to iPod formats, so you won’t have to convert them yourself! Yet there are more features(!), such as choosing any size of the video by resizing the browser window itself, with the lower limit of the original size of the video. You can choose Original Size, Double Size, Fit to Window and Full Screen. There’s even a “Smooth Video” option if the quality of the video is too poor for the size at which it is being displayed! The latter in my opinion is a much better solution to the quality problem than “HQ” (High Quality) and “HD” (High Definition) options at YouTube.

And now I hear that Google Video is about to stop accepting new videos and Google is focusing all of its video efforts on YouTube. What a waste!

There are still great options for people who want to upload content to Google, and we invite them to explore YouTube’s dynamic global community or Picasa Web Albums.


We’re confident this decision is the right one for our users,

Not for me.

and we’re looking forward to making Google Video an even better place for you to search and find videos from all over the web.

Yeah maybe, if I could watch them using the Google Video player, that’d be AWESOME. Then I’d have all the videos from YouTube but in the format of Google Video’s player.

A man can dream.

Thank God for brilliant software solutions such as the YouTube plugin for Totem (the video player of GNOME).


Project Euler

I’ve become an active member of Project Euler (PE) again. Project Euler ( is a collection of (around 300 or so) mathematical and programmatical problems. I’m not sure when I started the first time, but it’s been a couple of years, I think. Now I’m back again with a bit more knowledge and feeling a bit more comfortable with programming, several programming and math courses later.

When I first joined, I was mostly only comfortable with Java as my programming language of choice, but I’m very interested in learning to program comfortably in C for a few reasons:

  • It is the traditional language in Unix/Linux applications.
  • I like GNU/Linux and Free and Open-Source Software.
  • It is a lot faster than Java… but still has very similar syntax!
  • I like handling pointers for some reason. I feel like I’m much more in contact with the data as I have full control of everything. It’s just so gratifying to get Segmentation Fault after Segmentation Fault and then, after some debugging and messing around with my pointers, finally getting the sought output from the program.

I don’t believe it’s mandatory to join Project Euler to take part in the problems, but I recommend you sign up for an account, because if you do:

  • you can provide answers to the problems and Project Euler will keep track of the problems you’ve solved.
  • you may participate in the forum thread for a particular problem upon solving it, allowing you to discuss your solution with fellow members. (It’s incredible to find solutions written in the J and K programming languages, which afford extremely concise programming.) Note that only relatively recent forum threads are open to new posts, but all threads are open to read (upon solving the corresponding problem, as I already mentioned).

Project Euler is a very fine tool to learn a programming language. If you’re not a programmer by profession and you don’t really have any software needs that aren’t fulfilled, Project Euler provides you with a great environment to experiment with a programming language’s syntax and libraries with problems and tasks to solve and complete.

My goal right now is to solve as many problems as I can using only the standard libraries in the GNU Library (glibc), namely stdlib, stdio and occasionally string (so far I’ve used string only for the strlen function, which I felt was unnecessary to write myself). It’s going pretty well, and it’s kind of fun to have to figure out solutions on your own instead of relying on already-written functions to do the job for you.

Some of the problems at PE can be solved only with the help of pen and paper, but most of them require up to thousands of iterations to find the solution and isn’t feasible without some computational aid. However, according to the site’s FAQ section, which they call “About”, all the problems are designed in a way that a well-constructed algorithm should take no more than 1 minute to output the solution to the problem. I’m very proud of C. Most problems finish in milliseconds, even on the super-slow laptop I use sometimes.


Thank you Microsoft

Microsoft has done it again! I continue to be safe from something that wasn’t a threat in the first place. (Or was it?)

Windows terminated an application to protect my computer. However, an interesting question is: Which application?


My version of Windows XP is Swedish, so I will translate:

Titlebar: Data execution protection [I guess]
In bold: This application was terminated to protect the computer.
Name: [The] Explorer
Publisher: Microsoft Corporation
Button: Close the message
Below horizontal line: Data execution protection helps protect against harm from viruses and other threats.
Link: What should I do?

Apparently Windows thought Explorer was a threat and terminated it accordingly. Explorer shut down after giving me a message that it had terminated in an “unexpected” way, but of course, Explorer being Explorer, it started right back up again. But Windows was not complaining this time.

And all I wanted to do was to shut down the computer. Do you think you can handle that, Windows?