Month: July 2016

My Major is TCC

Original Blog -> here

Minor differences means that would be Major similarities(and vice versa).

In UNIX, Linux, every I/O operation is done through files (at least conceptually). Files on disks are files but even the peripherals attached to your computer are logically mapped(converted) to files in order to communicate data between them and the user.

Our computer stores the data in two forms

  1. Physical(which the machine understands or in binary form).
  2. Logical(which the user understands or in easy form).

So, here mapping is necessary. To find these files explore the /dev directory.

With each  such device file, there are two numbers associated. These are the major number and the minor number.

A device driver is a program that controls a particular type of device that is attached to your computer. There are device drivers for printers, displays. When you buy an operating system, many device drivers are built into the product. It interface hardware of extreme variety with your operating system.

A peripheral(terminal) can be classified by the kind of driver it uses to interface with the operating system.

Need of Major Number?

There is a reason behind each small thing stored in a computer.

Device files(also known as character special files) a device file that provides serial access (as opposed to a block special device such as a disk drive). For example terminals and serial devices are interfaced through character special files.

Now since there are many drivers residing concurrently inside of your OS kernel, each driver must (can) be uniquely identified with a number. These are your major numbers. Every device file is given the major number of the driver which the device needs (uses). Two files can have the same major number.

Minor Numbers

In order to differentiate with devices having the same major number, we assign them another number which is essentially serves as a serial number for all the devices of the same major. These are your minor numbers.

So, a file representing a device, has with it, two numbers, major and minor. Major represents the driver that device belongs to and Minor represents that device’s unique identity among all the devices with the same major. It is absolutely possible for devices to have the same major and majors to have devices of many minors.

As an example, all USB drives(say 3 files having different minor number) can be thought as devices represented by a USB driver(same major number).

To check these out, use the following command:
ls -l /dev
It’ll have an output similar to this:
 crw-rw-rw-    1 root     root       1,   3 Apr 11  2002 null
 crw-------    1 root     root      10,   1 Apr 11  2002 psaux
 crw-------    1 root     root       4,   1 Oct 28 03:04 tty1
 crw-rw-rw-    1 root     tty        4,  64 Apr 11  2002 ttys0
 crw-rw----    1 root     uucp       4,  65 Apr 11  2002 ttyS1
 crw--w----    1 vcsa     tty        7,   1 Apr 11  2002 vcs1
 crw--w----    1 vcsa     tty        7, 129 Apr 11  2002 vcsa1 

Here c means character special files(device files). The 5th and 6th column show the major and minor numbers (of the files) respectively.

Librecad Installation

Librecad Installation


Today, I installed Librecad for a specific task.

Process to install Librecad.

sudo add-apt-repository ppa:librecad-dev/librecad-daily

sudo add-apt-repository ppa:librecad-dev/librecad-stable

sudo apt-get update

sudo apt-get install librecad

And it’s installed. Now use it.

Quality of Grass

In my previous blog, I gave the introductory part of the GRASS GIS. So, it,s time to use it.

I have created a txt file survey.txt containing some coordinates. To see the raster map, contours let study grass.



I run a bash script in “” that contain the commands to show raster map and contours.



Moving to the commands.

r.contour   – Produces a vector map of specified contours from a raster

Digital Terrain Model (DTM) is raster map.

fieldData and ContourVec is vector map.

To plot profile of a map.

r.profile -gc input=DTM1 file=profile1.txt

To give multiple coordinates.

r.profile input=DTM1 coordinates=10,10,20,30.

Here’s is the display of the map.



You are done. My Sir and Amarjeet really helped me a lot in it.

Now, explore it more and have fun.

World’s leading Open Source GIS

World’s leading Open Source GIS

GRASS GIS, commonly referred to as GRASS (Geographic Resources Analysis Support System), is a free and open source Geographic Information System (GIS) software suite used for geospatial data management and analysis, image processing, graphics and maps production, spatial modeling, and visualization.
GRASS GIS is currently used in academic and commercial settings around the world, as well as by many governmental agencies and environmental consulting companies. It is a founding member of the Open Source Geospatial Foundation (OSGeo).


Platforms: Linux, Macintosh, Sun Solaris, Silicon Graphics Irix, HP-UX, DEC-Alpha, and Windows OS.


Background: GRASS GIS Location structure

A LOCATION is simply a set of directories which contains the GRASS data of a project. Within each LOCATION, a mandatory “PERMANENT” MAPSET exists which contains projection information and some more definitions. It can be used to store the base cartography in it as “PERMANENT” is visible to all users accessing a LOCATION.

[GRASS GIS Location structure]Each LOCATION can have many MAPSETs. Each MAPSET is a LOCATION’s subdirectory. New MAPSET can be added at GRASS startup.

Creating and maintaining MAPSETs

One motivation to maintain different MAPSETs is to store maps related to project issues or subregions. Another motivation is to support simultaneous access of several users to the map layers stored within the same LOCATION, i.e. teams working on the same project. For teams, a centralized GRASS DATABASE would be defined in a shared network file system (e.g. NFS). Besides access to his/her own MAPSET, each user can also read map layers in other users’ MAPSETs, but s/he can modify or remove only the map layers in his/her own MAPSET.

 In my next blog I will tell you how to use it.:)



Govind’s blog


A friend in need is a friend indeed means a friend in need is a true friend.

Friendship described with discipline and practiced with immortal faith. True friendship is invaluable and found rarely.

Friendship means exploring beauty of emotions.

Basically, he is trying to correlate the computer world and real world. He is trying to making the base of friend functions through the real life world because he know that our mind holds things in two ways

  1. Visual ways(through pictures).
  2. Base(in Hindi – neev)

He likes C++ language a lot not because he has adapted it’s power or rules rather it is the first programming language he learnt.

He distinctly remember the circumstances leading to this delicious learning journey.

Ohh No, the new semester is going to be start and half book is yet to be read.

The above talk was his past but now again he has keen power to explore beauty of C++

So, below I’ll write the summary of it as you know the motive of writing this blog.

“Computer programming is nothing but a simulation(representation to computer program) of the human mind, experiences, challenges and goals”.

Friends in C++:

A class contains all types of data i.e. public, private, protected. Analogy, there are things that man can share publicly, private(with family members and friends).

To know the secrets of a man be a family member is not so easy and always but being a friend is much easy. Isn’t it?

Just re-declare that function inside the class body (you must not re-define it, that’d be a syntax error) and use the keyword “friend” in this declaration. The re-declaration must be in the public section of the class definition.

Friend function can access the private and protected data of the class through the objects.

The defination of a friend function should be in the same file.
Limitations of Friendship:
  1. Friendship is not implicitly reciprocated. If class A is a friend to class B then the inverse is not true. That would need an explicit desire from the programmer.2. A derived class does not inherit the friendship of its parents. If your parents are friends with someone, then that does not mean you should be friends with them too, does it?
  2. A friend function (or class) cannot be extern. This means that friend functions need to be defined in the same file as their friend class. You cannot declare a function defined in some other file as the friend of a class. Vicinity is a necessity for friendship.
  3. A friend function must not be static because static function are used without objects(contradicts the point of accessing data of class through objects).

Hope I was able to make you clear th objective of his blog.

Thankyou for tolerating me.;)




Hie friends, first of all I’ll tell you why I have made this category.

What is reason(Ground) behind it?

The whole story starts from lack of confidence. Actually, I hesitate to speak in ENGLISH. While giving presentations even I know the whole concept of that topic, then also I fail to make understand that topic clearly to others, due to lack of confidence in speaking English.

Then my Sir gave me an idea to improve my English. He gave a task to me and two three students more on improving English.

So, the one who really want to learn English first stop weeping(being sad) and be a team to start learn English.

What I’ll do is rewrite a blog of my senior Govind in very simple English. That is what the blogs under this category will hold.

The syntax of writing the blogs in the same category would be first I will give his blog reference then, simplify it in a easy English.

Moreover, to learn English from Hindi refer this site

Be Patient:)

Challenge To Change Colors of OSM Map

Challenge To Change Colors of OSM Map

Yeah, a small challenge to change the colors of OSM map is solved.

Actually, it’s very easy.

For this change your “palette.mss” file.

Changes I have made are:-

I changed the color of buildings(to red), primary_line(to green), secondary_line(to green), road_halo(to black),standard_fill(to black).

And after that I run the command.

 carto project.mml > OSMBright.xml

And then rerender it. Re-rendereing the tiles means

run commands

sudo -u username renderd -f -c /usr/local/etc/renderd.conf

sudo /etc/init.d/renderd restart

Restart your apache also.

But nothing happen:(

Then after searching a lot I took a risk to delete the folder “default” in /var/lib/mod_tile.

It means I deleted the previous tiles created in the tile directory and again re-render the tiles.

Breaking News.

Problem is solved.




Important Points


While I was searching for changing colors in my osm map. I got some useful information regarding OSM.

OSM data is coming from shp files and postgresql database.

.py means python file. I don’t knew about it beforehand.

Purpose of is used to render the map through mapnik. Size of the tile is defined in this file. is a slippymap. I told about slippymap in my previous blogs.

OpenStreetMap layer tagging is converted by Osm2pgsql into a z_order parameter in the PostGIS/PostgreSQL database.

The term “Z-order” refers to the order of objects along the Z-axis.

An analogy would be some sheets of paper scattered on top of a table, each sheet being a window, the table your computer screen, and the top sheet having the highest Z value.

Command:- The below command tells which tiles are rendered and when it is rendered it prompts DONE TILE message shown below.

sudo tail -f /var/log/syslog | grep “TILE “

It’s output is like this

Jul 21 11:50:31 amishapc-Vostro-2520 renderd[9992]: DEBUG: START TILE default 16 46552-46559 26856-26863, new metatile
Jul 21 11:50:31 amishapc-Vostro-2520 renderd[9992]: DEBUG: DONE TILE default 16 46552-46559 26856-26863 in 0.279 seconds



Shell Scripting

Shell Scripting

For , making a script for installation and configuration of OSM I am going to learn “Shell scripting”

Variables are case-sensitive, just like filename in Linux.

Double Quotes “Double Quotes” – Anything enclose in double quotes removed meaning of that characters (except \ and $).
Single quotes ‘Single quotes’ – Enclosed in single quotes remains unchanged.
` Back quote `Back quote` – To execute command


$ echo “Today is date”

Today is date

$ echo “Today is `date`”

Today is Sun Jul 17 17:53:07 IST 2016

ls *.c

Show all files with extension c

The sed utility is a batch (noninteractive) editor.The sed commands are usually stored in a script-file . . .although you can give simple sed commands from the command line

If you need a particular command within the script to be run without sudo privileges, you can run it as a regular user with

sudo -u username command

sed s/day/night/

where s means substitute


sed -i ‘s/hello/new/g’ rakesh.txt
sudo  apt-get -y install littler

sed -i '/TEXT_TO_BE_REPLACED/c\This line is removed by the admin.' /tmp/foo

sed 's/.*TEXT_TO_BE_REPLACED.*/This line is removed by the admin./'

sed -i s@/usr/bin@/home/amishuser@

sed -n ‘N’p filename

example.    sed -n 3p

What is a pbf file?

PBF is a backup archive file created by a Paragon backup and recovery applications. It stores backup files in a proprietary format, and can be browsed within the software which also enables restore for individual files or a whole file system.