Saturday, April 25, 2015

Typing Nonprintable Unicode Zero width non joiner (ZWNJ) in Ubuntu 14.04

Urdu is written in cursive script, which means that consecutive characters join together and change their shape according to the context. To correctly shape characters a Zero width non joiner has to be used, which can not be typed by a single key stroke like the regular space bar key on the keyboard.

For typing non printable ZWNJ in Ubuntu 14.04 follow these steps:


  1. Click the dash and search for Character Map
  2. Launch Character Map and click the box next to "Text to copy"
  3. Press and hold Ctrl Shift and press U, an underline u will appear
  4. Now type the sequence 200C
  5. As the sequence represent a non printable character it will be replaced by ZWNJ and nothing will appear
  6. Now click the "copy" button
You can now paste it in the editor using the keyboard shortcut Ctrl+V or via menu

Link to a post on Ubuntu Forum that helped me


Thursday, January 8, 2015

How to replace "Unknown Unkown" with "your name" in Gmail

Not long ago most of AITians migrated from the old webmail to the new gmail account. For those of you who have recently started using gmail there are bundle of new options to explore. One thing that might be annoying you, is your emails arriving in your friends' inbox labeled "Unknown Unknown". Below is the screenshot. In this post I will show you how you can replace the "Unknown Unknown" with your name, so that your friends can locate your emails easily.




  • Go to Gear Drop Down Button and Select "Settings"






  • Now click the "Accounts" or "Accounts and Import" Tab 



  • In the "Send mail as" section click "edit info"


  • Now replace the "Unknown Unknown" phrase with your name, in the above screen shot I have specified the box by typing "Type your name here"


  • Finally click "Save Changes" and you are done.


  • Wednesday, November 19, 2014

    Where has the MTP option vanished ?



    Recently I ran into a problem, the notification (see the image below)

    that usually appears after connecting any android smart phone to laptop using USB for transferring media files, suddenly stopped appearing.
    I tried to locate the option and finally got it in a very unusual place. This option is now available under Settings -> Storage ->
    and tap the dotted menu on the right 



    On some smart phones USB fork symbol appears instead of the dotted menu.

    Thursday, May 15, 2014

    Example .arff files for Weka on Ubunut 14.04

    Where are the example ".arff" files for Weka on Ubuntu 14.04?

    I recently installed Weka on my laptop having Ubuntu 14.04. For getting familiar with Weka I started locating the example files that come with the Weka package. After several Google queries I found that the example files are located in
    /usr/share/doc/weka/examples/
    A comprehensive list of files for the Weka package can be found here

    Wednesday, April 2, 2014

    How I installed arabtex latex package on ubuntu 13.10

    While compiling a latex project, the compiler complained it could not locate the package arabtex. This latex package is used to render Arabic script in pdf. A useful post "Easy installation/removal of a LaTeX package" suggested searching for the package using the command
    apt-file -x search '/arabtex.sty$'

    The command line prompted "The program 'apt-file' is currently not installed. You can install it by typing: sudo apt-get install apt-file"
    Thus I installed apt-file first by
    sudo apt-get install apt-file 

    after installing the apt-file I again issued the command
     apt-file -x search '/arabtex.sty$' 

    This time the terminal responded by
     texlive-lang-arabic: /usr/share/texlive/texmf-dist/tex/latex/arabtex/arabtex.sty
    

    where the part before : i.e. texlive-lang-arabic indicates the name of the package required. Finally I issued the command
     sudo apt-get install texlive-lang-arabic 
    to successfully install the package.

    Tuesday, March 25, 2014

    Generating a Random m x n sparse matrix in python with given number of ones

    A friend of mine Sheraz needed a small code chunk in python that could generate a random sparse matrix. The requirement was to be able to generate a m by n matrix where most of the entries are 0's and the user mentions the number of 1's required. I am listing down the code that was written by me and later improved by Sheraz for the purpose of preserving it by making it accessible online. The function genmatrix takes 3 arguments en is required number of 1's, s and n correspond to the number of rows and columns of matrix a

    from numpy import *
    from random import *
    from math import *
    
    def genmatrix(en,s, n):
        count=0
        S=range(s)
        N=range(n)   
        a = zeros(shape=(s,n))
        while (count < en):
            i= randint(0,s-1)
            j= randint(0,n-1)
            print i, j
            if (i in S) and (j in N):
                a[(i,j)]=1
                S.remove(i)
                N.remove(j)
                count +=1
        #print a
        #print [sum(a[i]) for i in range(s)]
        #print [sum(a[:,i]) for i in range(n)]
        return a 
    

    Sunday, February 16, 2014

    Ubuntu Terminal Commands

    Just wanted to keep track of commands and configurations I frequently forget and google.


    For unzipping a .zip file via terminal

    unzip file.zip -d destination_folder
    
    For copying files using ssh

    scp [[user@]from-host:]source-file [[user@]to-host:][destination-file]
    


    from-host: Is the name or IP of the host where the source file is, this can be omitted if the from-host is the host where you are actually issuing the command

    user: Is the user who has the right to access the files and directories to be copied in case of from-host, and the user who has the rights to write in case of to-host

    source-file: Is the file or files that are going to be copied to the destination host, it can be a directory but in that case you need to specify the -r option to copy the contents of the directory

    destination-file: Is the name that the copied file is going to take in the to-host, if none is given all copied files are going to keep its names