Why To Learn XML?

XML is everywhere and is now becoming very important for the web. I think there’s a hardly any field where you can avoid it. XML stands for eXtensible Markup Language and is designed to transport and store data.

A markup language is one which uses additional items (called markup) to create a document.

Now, you would be wondering what the word extensible mean here!!

XML is called extensible ( http://en.wikipedia.org/wiki/Extensibility) as it allows the author of the document to define the markup elements by their own.

This is really very easy to learn. For this, you need to have basic knowledge of HTML and javascript (these are one of the easiest languages in world).

XML is much like HTML. Here you must not confuse. These both languages are made for entirely different goals.

XML was designed to store as well as exchange data and HTML to display data. In XML, tags are not defined. You have to define your own.

Here you make all the commands (like a boss). So, you can call it a user made language.

XML does not DO anything, it is just to store and transport data. Infact, it is just information wrapped in tags.

 

Now, here’s question which usually comes into mind, why we need to learn XML then?

 

Its feature which really fascinated me is that it supports UNICODE. So every human language can be communicated using XML.

In XML, you can invent your own tags. Unlike HTML, you don’t have predefined tags here. XML is also platform independent and so technological changes doesn’t effect it.

A lot of new Internet languages are created with XML such as XHTML, RSS ,WSDL (for describing available web services ), SMIL (for describing multimedia for the web).

 

Now, if still these things dosen’t convince you, then I would say:

Why To Leave A Thing Which You Can Learn In About Half An Hour??

 

The only code which you need to learn in XML is:

 

<?xml version=”1.0″> and some grammar rules you need to follow.

 

Just take a look to this video to see what you can do in just four minutes 🙂

 

 

 

Today, I learned XML. I found a great XML tutorial in w3schools.com. I love the way how they split difficult sections into numerous easy ways. Now I’m looking forward to learn latex.

I heard about latex in my GD family. I haven’t learned it yet, but  I know anything discussed  there is always something worth!!

Feeling privileged to be a part of such environment 🙂

My thoughts on OpenStreetMap

 

OpenStreetMap is the project that creates and distributes free geographic data for the world.

OSM is a collaborative project to create a free editable map of the world.

OpenStreetMap is the Wikipedia of maps. Everyday thousands of people edit map.

Here I must say – “everyday thousands of people improve map, fix mistakes and are adding new data”.

 

Now, a question comes in mind, What makes OpenStreetMap great ?

There may be different views from different people.

 

There is less chance of mistake or wrong mapping in OpenStreetMap. For the first time, anybody viewing the map can suggest correction. If by mistake one person marked some location wrong, then there would be ten more to pick it.

 

OpenStreetMap project has amazing amount of geodata made available to the world for free. OSM data is even used by many known names on web like Foursquare, Craigslist, Wikipedia, Mapquest, and Apple’s iOS Maps app. It is used in humanitarian operations also, as now many contributers are working together to mark the havoc caused by rain in Kedarnath, India.

 

You can add notes on OSM by just clicking ‘Add a note’ in the bottom right corner.

OpenStreetMap is a map for the people, by the people, and made with personal local knowledge.

Personally, OpenStreetMap is very special to me. Working in OSM project made me feel for the first time that I can love Computer Science as much as I love Civil Engineering. Thank You Rai Sir for you gave me such a awesome project to work.

 

Today, day started with new hope,though we were bit worried for our work.

Kamal has some problem with her tiles. So we stared reading bash scripts of my packages.

While reading scripts,we found some files are missing in her file system. In /usr/share/munin/plugins/mod_tile*, Kamal don’t have mod_tile_fresh,mod_tile_zoom,mod_tile_response.

We found that tile server set up with packages and manually have entirely different paths for their files.

Then we all five  sat in circle and discussed about various things like mapnik,rendering processes,apache etc.It was a kind of hot debate.

In evening, we had two presentations. From them, I got to know about many new things

Debian Package Structure

One can find lots of .deb files in directory ‘/var/cache/apt/archives/.

From there I'm taking package “youtube-dl_2012.02.27-1ubuntu0.1_all.deb” to explain structure of Debian package.

As you can see, the package further contains two folders: DEBIAN and usr.

DEBIAN has two files:md5sums and control.

'md5sums' contains for each file in data.tar.gz the md5sum.

The MD5 protection that exists in dpkg is really only useful for accidental corruption, and not necessary to protect the installation path.

You might be interested in the debsums package, but since it uses MD5s, it also is only useful for checking for accidental corruption.

In our example the content looks like this:

....................................................................................................................................

43678cad6a1b4ff3330c2fada3206894 usr/bin/youtube-dl 
2fcb94a9ce36afaeecf4265b19244727 usr/share/doc/youtube-dl/NEWS.Debian.gz 
77da787ff167347b77383440c31891c1 usr/share/doc/youtube-dl/changelog.Debian.gz 
705df117892f3fd870fb153fb3a530a8 usr/share/doc/youtube-dl/copyright 
33ccd4dcbefa3eb9daf7d3774d7734fa usr/share/man/man1/youtube-dl.1.gz

.............................................................................................................................................

Control file : Each Debian package contains the master `control' file, which contains a number of fields, or comments when the line starts with '#'. Each field begins with a tag, such as Package or Version (case insensitive), followed by a colon, and the body of the field. Fields are delimited only by field tags. In other words, field text may be multiple lines in length, but the installation tools will generally join lines when processing the body of the field

Here are contents of control file from my example:

Package: youtube-dl 
Version: 2012.02.27-1ubuntu0.1 
Architecture: all 
Maintainer: Ubuntu Developers  
Installed-Size: 205 
Depends: python (>= 2.5) 
Recommends: ffmpeg, ffmpeg (>= 4:0.6) | ffprobe, rtmpdump 
Section: web 
Priority: extra 
Homepage: http://rg3.github.com/youtube-dl/ 
Description: downloader of videos from YouTube and other sites 
 youtube-dl is a small command-line program to download videos from 
 YouTube.com and other sites that don't provide direct links to the 
 videos served. 
 . 
 youtube-dl allows the user, among other things, to choose a specific video 
 quality to download (if available) or let the program automatically 
 determine the best (or worst) quality video to grab. It supports 
 downloading entire playlists and all videos from a given user. 
 . 
 Currently supported sites are: CollegeHumor, Comedy Central, Dailymotion, 
 Facebook, Metacafe, MyVideo, Photobucket, The Escapist, Vimeo, Yahoo!, 
 YouTube, blip.tv, depositfiles.com, video.google.com, xvideos, Soundcloud, 
 InfoQ, Mixcloud, OpenClassRoom. 
Original-Maintainer: Rogério Brito 

............................................................................................................................................

'man deb-control' has more information about it.

'postinst' and 'prerm' files are not mandatory for your first package. But every proper official Debian package has them for good reasons.

‘prerm’ and ‘postinst’ seem to take care of removing old documentation files and adding a link from doc to share/doc.

Here are contents of prerm file from package “python-apt_0.8.3ubuntu7.1_i386.deb”.

……………………………………………………………………………………………………………………….

#!/bin/sh
set -e

# Automatically added by dh_python2:
if which pyclean >/dev/null 2>&1; then
pyclean -p python-apt
else
dpkg -L python-apt | grep \.py$ | while read file
do
rm -f "${file}"[co] >/dev/null
done
fi

# End automatically added section

……………………………………………………………………………………………………………………………….

Simplest Way To Create A debian Package

Normal Debian packages get a proper source package, including a debian/rules file which automates the steps involved in creating the binary package. Here we just show how to package a simple shell script or binary executable into a small binary package.

One can find lots of examples of .deb files in ‘/var/cache/apt/archives/

Here is a simplest way to make a stand-alone Debian package:

First decide a name for package. Debian Packages have a particular format for their names.The code is:

Code:

<project>_<major version>.<minor version>-<package revision>

For Example, you can name your package as:

gurpinder@gurpinder:~$ firstt_1.0-1
 firstt_1.0-1: command not found 

Now create a directory for your package and it must have same name as that of your package.

gurpinder@gurpinder:~$ mkdir firstt_1.0-1

Now run following commands to put the files of your program where they would be installed to on a system.You can run these commands without sudo power.

gurpinder@gurpinder:~$ mkdir firstt_1.0-1/usr
gurpinder@gurpinder:~$ mkdir firstt_1.0-1/usr/local
gurpinder@gurpinder:~$ mkdir firstt_1.0-1/usr/local/bin
gurpinder@gurpinder:~$ cp "~/Projects/firstt/firstt" firstt_1.0-1/usr/local/bin

Now create a special metadata file with which the package manager will install it.

gurpinder@gurpinder:~$ mkdir firstt_1.0-1/DEBIAN
gurpinder@gurpinder:~$ gedit firstt_1.0-1/DEBIAN/control

Now put something like this in your file.

Package: firstt
Version: 1.0-1
Section: base
Priority: optional
Architecture: i386
Depends: libsomethingorrather (>= 1.2.13), anotherDependency (>= 1.2.6)
Maintainer: Your Name <you@email.com>
Description: Hello World
 Debian GNU/Linux is one of the most popular
 Linux distributions for personal and 
 Internet server machines

 (the space before each line in the description is important)

Now you just need to make the package like this:

gurpinder@gurpinder:~$ dpkg-deb --build firstt_1.0-1

To add fonts to my OSM, I made changes in various files.

Here are my notes:

rendred conf.   The font_dir line in my renderd.conf  is

font_dir=/usr/share/fonts/truetype/ttf-dejavu

I changed it  to:

font_dir=/usr/share/fonts/truetype/ttf-punjabi-fonts

and set font_dir_recurse  to true.

I also made few changes in /etc/mapnik-osm-data/inc/fontset-settings.xml.inc.template as:

………………………………………………………………………………………………………………….

<FontSet name=”book-fonts”>
<Font face-name=”lohit_pa” />
<Font face-name=”unifont Medium” />
</FontSet>
<FontSet name=”bold-fonts”>
<Font face-name=”lohit_pa” />
<Font face-name=”unifont Medium” />
</FontSet>
<FontSet name=”oblique-fonts”>
<Font face-name=”lohit_pa” />
<Font face-name=”unifont Medium” />
</FontSet>

……………………………………………………………………………………………………………………………

Even this  doesn’t helped.

Then,I moved my /fonts in mapnik and changed  font_dir line in my renderd.conf as:

font_dir=/usr/lib/mapnik/fonts/fonts/truetype/ttf-dejavu/
DejaVuSansCondensed-Bold.tt

Again nothing changed in my map.

Today again I did many things which are next to nothing 😦

Working To Change OSM fonts

From last few days, I am working  to change my fonts on OpenStreetMap server.

Here are my notes of what all I did to change my fonts.

I first followed the link:

http://weait.com/content/add-fonts-your-openstreetmap-server

http://sajjad.in/2010/05/setting-up-mapnik-for-rendering-tiles-in-your-language/

Here >>> import mapnik gave error.

…………………………………………………………………………………

gurpinder@gurpinder:~$ python
Python 2.7.3 (default, Aug  1 2012, 05:16:07)
[GCC 4.6.3] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.
>>> import mapnik
Traceback (most recent call last):
File “<stdin>”, line 1, in <module>
ImportError: No module named mapnik
>>>
……………………………………………………………………………………

To remove error,I took help from link:

https://github.com/mapnik/mapnik/wiki/MacInstallationSource

This didn’t helped much.

Then I took help from this link:

http://highearthorbit.com/cjk-fonts-in-openstreetmap-tiles/

As I got some problem in my Internet, so I did few silly things which proved to be really useful in end.

I moved  few files (style.css)in /var/www/osm/

I also made few changes in style.css and this helped me to change  my scaleline.