Sunday, 26 May 2013

Xubuntu 13.04 - Tips and Troubleshooting

I recently switched to Xubuntu 13.04 after using Linux Mint for nearly a year. While Linux Mint with Cinnamon desktop is a very good system, the Xubuntu desktop is more lightweight. The fonts look prettier with better anti-aliasing, the startup is much faster and the system somehow feels more powerful. Here's how you can make the most of your new Xubuntu system.

Enable Dropdown Terminal

The latest Xfce Terminal v0.6 features a drop-down terminal mode similar to other drop-down consoles like Guake and Terra. The terminal will appear when you press a key on your keyboard and hide when it loses focus. You can run a command and leave it running while you switch to another window. It supports multiple tabs which allows you to run multiple commands at once.

Saturday, 18 May 2013

Vala #8: Useful Functions

1) Get Process ID

public int get_pid_by_name (string name)
{
    try{
        string output = "";
        Process.spawn_command_line_sync("pidof \"" + name + "\"", out output);
        if (output != null){
            string[] arr = output.split ("\n");
            if (arr.length > 0){
                return int.parse (arr[0]);
            }
        }
    } 
    catch (Error e) { 
        log_error (e.message); 
    }

    return -1;
}

This function returns the process ID of the first running instance. You can modify this function to return an array of process IDs for all running instances.

Vala #7: Process Execution

One of the best things about Linux programming is code-reusability. You can simply call a function in a library or execute a command to get a task done, instead of writing the code from scratch. Since there is a command in Linux for almost every task, it greatly reduces the effort required to develop a program. In this article we will see how Linux commands can be executed as a background process for performing various tasks in a Vala program.

Process.spawn_command_line_sync

public bool spawn_command_line_sync (   string command_line, 
                                        out string standard_output = null, 
                                        out string standard_error = null, 
                                        out int exit_status = null
                                    ) 
                                    throws SpawnError 

The simplest way to execute a process is to call the spawn_command_line_sync function. The first parameter is the command to be executed, the second and third parameters return the data of the StandardOutput and StandardError streams and the fourth parameter returns the exit code. Only the first parameter (the command to execute) is mandatory. We can pass null for the remaining parameters which are optional.

Sunday, 5 May 2013

NVIDIA Panel for Conky

Displays the following information for NVIDIA cards:

  • GPU Temperature
  • Fan Speed
  • GPU Clock
  • Memory Clock
  • Memory Usage

Download

Thursday, 2 May 2013

A Guide to Linux System Backups

In this article I'm going to show you a quick and painless way of taking regular backups of your Linux system. The backups will be completely automated and will not require any attention on your part. So when the day comes when your system finally fails due to a corrupted partition, damaged hard disk, or software issues, you can simply go back in time and restore your system to the way it was on particular day.

A Note about Parted Magic

We all use Parted Magic for taking system backups. It's an amazing utility for system rescue and recovery. Once you boot into the Live CD you can use the Clonezilla tool to backup, restore and duplicate entire partitions. While backing up your system using Parted Magic is very easy, it is not a good substitute for regular system backups. It is not practical to boot the live CD everyday for taking a system backup. Basically, the idea is that if it takes any effort on your part - you're not going to do it. Or you may do it once a month, or when you remember, but when your system finally dies you will feel like doing a fresh installation instead of restoring an old backup. The method shown below is completely automated, does not require much disk space and takes just a few seconds to back up your system.

The only thing we need for this is a portable hard disk with a Linux partition. If you don't have a Linux partition you can create one easily by resizing an existing partition and creating a new one. Format the new partition to ext2, ext3 or ext4. You can do this using the gparted tool (install it with the command 'sudo aptitude install gparted') or use the Parted Magic Live CD.