List/Grid Computer and Programming Subscribe RSS feed of category Computer and Programming
How to install Microsoft TrueType core fonts in Ubuntu
Microsoft TrueType fonts like Arial, Comic Sans MS, Courier New, Georgia, Times New Roman, Verdana, etc. are not available in Ubuntu by default. You need to install these fonts, so that you can use these in text editors like OpenOffice Writer, LibreOffice Writer or in gedit. In this tutorial, I will show you a simple step to install these fonts using Ubuntu Software Center. Instructions: Open Ubuntu Software Center from Applications…
How To Implement Monoalphabetic Cipher using C
Monoalphabetic Cipher is a method to encrypt messages by substituting one character for another character. This is fairly a simple method for encrypting data. Alike Ceaser Cipher, which have only 26 possible keys, Monoalphabetic Cipher has 26! possible keys (or possible ways to encrypt messages). In this tutorial, I will use the key pair given on Wikipediaas an example to illustrate the working of this cipher. Also I will encrypt the same…
How To Calculate numeric powers in C
Its really easy to calculate power of a base number in C using pow function defined in math.h library. But if you want to calculate the same by using making your own function, you can follow the following instructions. Instructions: Get the base and exponent inputs from the user. printf(“Enter the base number : “); scanf(“%d”, &base); printf(“Enter the exponent(power) : “); scanf(“%d”, &exponent); Now using for loop loop through…
How to add Open With Gedit to the right click menu in Ubuntu
Nautilus Scripts in Ubuntu provides the functionality for file browser to do just about anything. These scripts are invoked by selecting a file or group of files, and right-clicking with the mouse, to bring up a context menu. One of the options in this right click context menu is the ‘Scripts‘ sub menu, which allows you to select a script to invoke on the selected files. In this tutorial, I will…
How to implement Caesar Cipher using C
Caesar Cipher is the most basic cipher technique used to encrypt or decrupt messages. In this technique every character is replaced with the character standing particular number of places down the alphabet. That number serves the purpose of Key. So, for this Cipher technique, Key can only be a number ranging from 1 to 26. The most basic Caesar technique is Julius Cipher, in which Key is taken as 3….
How To Find Sum of Sum of digits of a number using Shell Scripting
In this imple tutorial, I will be using while loop to print the sum of digits of a number which is provided through command line. You can also download the sample script using the link provided at the bottom of the page. Instructions: First of all we will define the Shell program we want to use to run our script using the following command #!/bin/bash Now we will check whether…
How To find Factorial of a number in C
Here in this example, I will show you a quick way to find factorial of a number provided by the user at run time. Instructions: First of all ask the user to enter a number whose factorial he wants to find. int i, j, factorial = 1; printf(“Enter the number : “); scanf(“%d”, &j); Now assign the value of j to i and using for loop, iterate through i number of times, and…
How To find out Biggest number among the three provided numbers through command line using Shell Scripting
In this tutorial, I will show you how can we find out the biggest number among three numbers which are provided through command line while running the script/program. Instructions: First of all, we will define the Shell which will execute our program with the following command. #!/bin/bash Now we will check whether the number of arguments passed are equal to 3 or not, if not we will print error message…
How To Determine Whether you have 32 bit or 64 bit Linux installed in your machine
In this tutorial, I will share two Shell commands which you can use to find out whether you have 32 bit or 64 bit Linux Operating System installed in your machine. Instructions: Using uname command uname command is used to print certain information about your system. By using the option -m with uname, will print only the machine hardware name from which you can find out whether the OS is…
How To Find Sum of Two Numbers which are supplied as Command Line Arguments
In this tutorial, I will show you a quick example to find sum of two numbers using a script in Linux Shell which are supplied as Command Line arguments while running the script. If number of arguments are not equal to 2, then the script will print an error message. Instructions: First of all I will set the shell which will used to run the script using the following command,…