About Me

This blog is for informational purposes. By following any advice in this blog, you are solely responsible for any and all damages. Accelerant Learning Games, LLC is not responsible for any damage to your property, finances or self occuring from following any and all advice in this blog.

Saturday, April 16, 2011

In Archlinux II: Implementing MIME and .desktop files outside of a desktop environment

One of the biggest problems Window Manager users face is the lack of an integrated freedesktop system. It is very likely that a useful, seemingly desktop-independent program uses MIME filetypes and desktop environment libraries to function, such as Firefox or Chrome. They both rely on the MIME database to do tasks from the Download Window like opening a PDF or the directory containing the downloaded file, regardless of what File Association is specified in the Preferences dialog. If you have GIMP installed, for example, even if you've specified another PDF viewer (regardless of whether or not it's MIME-based). Firefox and Chrome will both rely on GIMP to open PDFs, because it's the specified default in your mimeinfo.cache file.

Here's 3 ways on how to fix that particular problem



1). If you are comfortable with the command line, and have a $HOME/.local/share/applications/default.list present, this method will work. This requires a .desktop file associated with a pdf-viewer (but this will work for any other MIME filetype of which you know the extension).  you can simply enter:

xdg-mime  default  program.desktop  application/pdf

where program.desktop is a .desktop file residing in /usr/share/applications/. Finish this up with:

update-mime-database <mime-directory>



If you need a .desktop file for your program, follow these links:


Tutorial on .desktop creation from the FreeDesktop Project


Help on how to create a .desktop file from the Archlinux wiki

Help on how to create a .desktop file from the Gnome wiki


2). If you're not comfortable with the CLI, graphical solutions to MIME alterations also exist for this, such as MIME-Editor, MIMEo, and Perl-file-mimeinfo. These are fairly easy to use, but if used incorrectly can introduce errors into your MIME setup.

3). The edit-config-files-by-hand way: If neither of the above attempts work, or you just like doing things the hard way, this is the fallback de facto method. Depending on if you want a system-wide alteration or per-user basis alteration, try to find either file:

defaults.list
or
mimeinfo.cache
respectively,
in either your /usr/share/applications/ or $HOME/.local/share/applications/ directories respectively. Which file you will need to edit will depend on your Linux distro.
Find the line that says:
application/pdf=gimp.desktop;
and either comment it by prefixing a #, or changing the right-hand side how you wish. If you comment it, Firefox will fall back onto whatever your File Association is set to. If you change it to another program, be sure to have a .desktop file association ready.


Update this with update-mime-database.Sendgrid.


More info:

Archlinux Custom File Associations

How to set default MIME-associated applications system wide

Overview on the .desktop system from FreeDesktop Project

In Archlinux I: Building your own Linux Environment

As an ex-Gnome and ex-KDE user, I decided a while ago that I didn't need the excessive packaging that came with these desktop environments (DEs). Instead, I wanted a completely personalized setup, with vim-inspired replacements. This would not only improve my productivity (by giving me an exciting work-space), but also improve my understanding of the  underlying system and the myraid interconnections put in place by the main DEs. It also gave me an excuse to learn and implement Lua and BASH scripting. So far, my setup involves several console/text based programs, many of which are lovely in appearance and elegance(noted by (t)). The list follows:

Archlinux 64-bit
Awesome Window Manager (which is aptly named :-)
GIMP (no way around using this great program)
Eclipse (for Java and android development)
(t)Irssi (text-based IRC chat client)
(t)Rxvt-Unicode (to provide 256 color support for w3m )
OpenOffice
Firefox
Chrome
ATI Radeon open-source driver
feh
Note: add to list

(the following programs were chosen for their vim-based keybindings)
(t)w3m (small, efficient, graphics capable text web-browser)
Apvlv PDF Viewer
(t)Ranger File Manager
Vimperator firefox-plugin
(t)vim & gVim
Note: add to list

The main problem with using text-based programs is that they lack the polish and interconnectivity of GTK/qt/GUI-based programs. However, they're lighter, faster, and largely keyboard-dependent (thus less likely to slow you down by requiring you to reach over to the mouse :-).

Wednesday, April 6, 2011

From Scratch Part I: Linux and FOSS as a part of your start-up strategy

You've probably heard the buzz around the internet about the Linux operating system. You might've heard about something called "Ubuntu" Linux (or Fedora, or Red Hat, or Mandriva... there are tons of different Linux-based operating systems), and that it's sleek, polished, easy to learn, and best of all, It's FREE.

I have some good news and some bad news. 

The good news is that yes, Ubuntu is free, unlike Windows, for commercial use (Windows now requires an Enterprise License for commercial use, and while you could still operate your company with a non-commercial license, why risk the ire of the BSA?). Not only that, but most of the applications that Ubuntu ships with are free.

If you need a word processor, spreadsheet, database, or presentation creator, they're totally, absolutely, legally, free. If you need audio mastering programs, they're free. If you need graphic design programs, they're free. If you need 3D modelling tools, they're free.

Here comes the bad news: you're probably not used to Linux. Yet. Canonical, the makers of Ubuntu, strove to make Linux as user-friendly as possible. However, if you're anything like me, you're so used to Windows/Mac OS X that when you need to change/alter something and find that things aren't exactly analogous to where your old operating system has them, you're going to get a little annoyed, even frustrated.

You are not alone.

Luckily, you're not the only one. I'm saying you're lucky in this regard because, more likely than not, any problem you've had, as a beginner Linux user, has been experienced by hordes of Linux users, and even more luckily, almost all of their solutions are well-documented on the internet. All it takes is a little Googling finesse, and you'll find your solution in no time. I'll have a post on how to do this in the near future.

Hold your horses, you might be thinking. People generally dislike being told they're beginners, especially when they're running a business. Afterall, a beginner using a tool will never be able to maximize its potential as well as an advanced, or even intermediate user. Why don't I stick with Windows or Mac OS X, which I know well enough to get things accomplished?

The reason is this: Beginners transitioning to Linux and Ubuntu can still be just as productive. The applications are the designed to perform similar functions as the applications developed for Windows/Mac OS X. Like I mentioned before, the applications are typically free.

Furthermore, Ubuntu is designed to stay out of your way, so that you can get what you need accomplished. Practically every use of your previous operating systems can be replicated on Ubuntu. Hardware and networking support is a snap. Installation of almost every driver or interface is automated (however, you should look into upsupported/troublesome hardware lists just to make sure you're going to enjoy full support before making the switch).

What's more, if your employees typically do most of their work on the internet, studies have shown their transition to Linux will be even easier. If most of their work takes place inside a web page, then their auxillary tools like text editors and programming IDEs easily have analogous editions or replacements.

If security is an issue, it is also much tighter in Linux than in Windows. Windows has countless viruses, exploits and malware stalking its perimeter, while Linux generally enjoys a penetration-free existence. That's not to say that exploits and malware don't exist in the Linux environment. Their numbers are simply much smaller and are less likely to compromise your system. Linux provides protection for virus and exploit for free download. Commercial protection also exists.