Fix the Missing Ubuntu One Nautilus Integration in Ubuntu 13.10

Ubuntu One Nautilus Integration

If you have made a fresh clean installation of Ubuntu 13.10, you would have noticed one announced missing feature. The Ubuntu One icons and context menu is missing from Nautilis (File Manager). Why is it missing?? Couldn’t find a valid reason even in Launchpad although Ubuntu One was supposed to be important to Ubuntu. Anyway…

To fix, you will need to install to packages from 13.04 and restart Nautilis. Follow these steps:

Download the required two packages:

wget https://launchpad.net/ubuntu/+source/ubuntuone-client-gnome/4.2.0-0ubuntu1/+build/4405128/+files/ubuntuone-client-gnome_4.2.0-0ubuntu1_amd64.deb -O ubuntuone-client-gnome_4.2.0-0ubuntu1_amd64.deb
wget https://launchpad.net/ubuntu/+source/ubuntuone-client/4.2.0-0ubuntu1/+build/4405191/+files/libsyncdaemon-1.0-1_4.2.0-0ubuntu1_amd64.deb -O libsyncdaemon-1.0-1_4.2.0-0ubuntu1_amd64.deb

Install them:

sudo dpkg -i ubuntuone-client-gnome_4.2.0-0ubuntu1_amd64.deb
sudo dpkg -i libsyncdaemon-1.0-1_4.2.0-0ubuntu1_amd64.deb

Restart Nautilus:

nautilus -q

Back to the day and satisfied days 🙂

Turn Off Warning & Error Messages in Drupal

Drupal

Drupal

Drupal is a popular CMS built in PHP, which is flexible and powerful. Currently in version 7 and the next version 8 is due in some time. Drupal has a way to Log and Report Errors. Like almost all CMS, it also periodically checks for new updates to the core, as well as themes and modules. Once an update is detected, it will Log Report it. It will also report about other errors in your code.

This all helpful in making your there are no bugs and security holes left for your site to be hacked. However you would not like the visitors and viewers of your site to have warning messages shown at the top of every page. To solve this issue, Drupal has a way to Turn them Off for the visitors and let it remain On for the admin user.

Just login to your site as admin and navigate to Configuration (at the top), then under Development click on Logging and errors. You can directly go to it by pasting this URL segment at the end of your drupal home page URL: admin/config/development/logging

You will see a screen similar to the picture below. Just select None and click on Save configuration to make it effective.

Drupal Logging and Errors

Drupal Logging and Errors

Run root Commands in Linux (Ubuntu) Without Password

Terminal Windows

Terminal Windows

Recently a student of mine asked me about running sudo commands in a shell script without prompting for the password. I thought finding the solution would be as easy as typing the question in Google and reading the first result returned. But that was not the case.

The following steps will help you achieve the desired output:

  1. Create a new script file (replace create_dir.sh with your desired script name):
    vim ~/create_dir.sh

    The script will be created in the user’s home directory

  2. Add some commands that only a root or sudo user can execute like creating a folder at the root directory level:
    mkdir /abc

    Note:Don’t add sudo to these commands. Save and exit (using :wq!)

  3. Assign execute permissions to it using:
    sudo chmod u+x create_dir.sh
  4. Make changes so that this script doesn’t require a password.
    1. Open the sudoers file:
      sudo vim /etc/sudoers
    2. Add the following line at the end:
      ahmad ALL=(root) NOPASSWD: /home/ahmad/create_dir.sh

      Replace ahmad with whatever your username is. Also make sure this is the last line. Save and exit.

  5. Now when running the command add sudo before it like:
    sudo ./create_dir.sh

    This will run the commands inside the script file without asking for a password.

Note: Only the script file mentioned in the sudoers file is exempted from asking a password. The rest will behave as usual.

Remove Unwanted Audio Tracks from Video Files

AVI Files

AVI Files

It is now possible to have multiple audio tracks in a single video. This is becoming common for Movies and Documentaries. This way a single video is good for serving people of different lingual backgrounds. However, like me you might not be interested in all those tracks. In this tutorial, we will remove all the unwanted tracks.

The tool we will be using is avconv and in a previous post I have mentioned how to install it in Ubuntu, so I will not be going into the installation part again.

Check how many Tracks are there

First of all we need to check on the track details and for that, run the following command (the extension can be mp4, mov, mkv, avi or any other):

avconv -i file_name.mkv

In my case, I got the following output:

avconv version 0.8.6-6:0.8.6-1ubuntu2, Copyright (c) 2000-2013 the Libav developers
  built on Mar 30 2013 22:20:06 with gcc 4.7.2
[matroska,webm @ 0xc31d40] Estimating duration from bitrate, this may be inaccurate
Input #0, matroska,webm, from 'file_name.mkv':
  Duration: 00:46:15.28, start: 0.000000, bitrate: 768 kb/s
    Stream #0.0(eng): Video: h264 (High), yuv420p, 1280x720, PAR 1:1 DAR 16:9, 25 fps, 25 tbr, 1k tbn, 50 tbc (default)
    Stream #0.1(rus): Audio: ac3, 48000 Hz, 5.1, s16, 384 kb/s (default)
    Stream #0.2(eng): Audio: ac3, 48000 Hz, 5.1, s16, 384 kb/s
At least one output file must be specified

The lines in bold tell us how many tracks are there.

Removing the track

Since I have no interest in Russia audio, I would like to remove it. In my case I would like to keep the second track. Here is the command:

avconv -i file_name.mkv -map 0:0 -map 0:2 -acodec copy -vcodec copy output.mkv

If your track is different, for instance you want to keep the first track, replace -map 0:2 with -map 0:1 and it will work.

Another advantage you will get is a reduction in file size, which is always a good news. 🙂

Fix the Count Badge of Firefox in Ubuntu Unity

Firefox Count Badge

Firefox Count Badge

With Ubuntu’s Unity interface comes a nice feature of displaying progress or count badge for the application in their Launcher, just as in the picture here. Today however when I updated by browser to Firefox 23 on my Ubuntu 13.04 system, my system crashed (not because of Firefox) and I had to close everything that was open.

I was in a process of downloading two files in Firefox when this crash happened. Everything was working fine after that expect that the count badge and progress was stuck for Firefox. Even a system restart didn’t help.

A Solution of My Own

My natural reaction was to Google it but on this rare occasion, Uncle Google had no answer for me or maybe I wasn’t putting search expression well enough. Anyway, I though of looking for the user profile files and see if any clue was there. So the following is what I did and it worked for me.

I listed all the directories and files in my home directory using ls -la and ls -la ~/.config
Which is a common place for configuration files for various application but unfortunately Firefox isn’t one of those. But what I did find was the hidden .mozilla folder. So after going deeper into the directory structure, this is the file which had answer to my question:

~$ ls -la ~/.mozilla/firefox/nlqcscp8.default/downloads.sqlite
SQLite Database Browser

SQLite Database Browser

One more was that I didn’t have any program to open SQLite file, so I had to install such a software also:

~$ sudo apt-get install sqlitebrowser

Now all I had to do was to open this Application, locate the downloads.sqlite file and delete the rows as should in the picture. Save and done!

Firefox back to normal 🙂

Smartly download stuff from the Command Line using wget

Terminal Windows

Terminal Windows

Normally you would be downloading files from the internet using your browser and its own download manager would be the right choice. However, what if you need to download files on the server which has command-line (terminal) only or you want to download a long list of files but one at a time or you want to limit the maximum download speed so that it doesn’t eat up all your limit. These are just a few of the cases in which wget command comes in handy.

Installing wget

For Linux, the fun part is that it is already installed on every Linux machine. You can verify this running the command:

wget --version

For Windows, there is a download available here. For simplicity, select the option labelled “Complete package, except sources”. Once downloaded, install it. The installation path on Windows XP is “C:\Program Files\GnuWin32\bin” but you can add it to the PATH environment variable to make it easily accessible.

For MAC OS, it doesn’t come installed but getting it is easy. Before installing wget, you need to get HomeBrew, the package manager for MAC OS. Go to http://brew.sh/ and install it by simply running the command mentioned there.

Once HomeBrew is installed, run the following command to install wget:

brew install wget

Once it is installed and ready, we can get started

Downloading a Single File

wget http://dummyurl.com/file.zip

This will start downloading the file to the current folder in which the Terminal prompt is. Besides downloading, it will display the progress in percentage, the download speed, total bytes downloaded and remaining time.

Downloading a Single File to a Different Location

The file downloaded in above command will be saved in the current working directory of the Terminal and with the name file.zip as it was its original name.

To save it with a different name:

wget -O new_name.zip http://dummyurl.com/file.zip

To save it in a different location, give the path also (which can be relative of absolute):

wget -O /home/user1/new_name.zip http://dummyurl.com/file.zip

Resume Download for a File

If your file was partially downloaded, you can resume it by using the -c switch, which is for continue.

wget -c http://dummyurl.com/file.zip

To Limit the Max Download Rate/Speed

wget --limit-rate=50K http://dummyurl.com/file.zip

This will not download at speed more than 50KB per second.

Download Files in the Background

If there are numerous task and you want that wget keeps on downloading them in the background:

wget -b http://dummyurl.com/file.zip

Download Multiple Files from a List of URLs

The wget command can take input URLs from a text file with a URL on every line and it will pipeline them for downloading:

wget -i list_of_urls.txt

These are only some of the scenarios I had to come across. I will inshAllah be updating the list of commands as the need arises.

Check which IP addresses are working in your LAN

Of course pinging a single known IP address is the most simple task in networking but there arises a need when you need to know which devices and systems are available on your network.

For that purpose, the following simple command can do the job for you in Linux:

for ip in $(seq 1 254); do ping -c 1 192.168.1.$ip>/dev/null; [ $? -eq 0 ] && echo "192.168.1.$ip UP" || : ; done

It will start pinging all the addresses from 1 to 254 in the provided network. Change 192.168.1. to whatever you want.