<<<<<<< HEAD --- layout: default title: Abdul Bijur Vallarkodath ---
======= Bijur Vallarkodath

Bijur Vallarkodath

The force is strong in this one

Clojure on Mac & Emacs

| Comments

First you need to get “lein”. Lein is a tool that lets you manage your projects in clojure. Lein also has a REPL that lets you run clojure directly.

~$ wget https://raw.github.com/technomancy/leiningen/stable/bin/lein

This will download lein into your home directory. Once downloaded, move it to ~/bin directory. Add bin directory to your PATH environment variable and then finally make this file executable using the following commands.

~$ mkdir ~/bin
~$ mv lein ~/bin
~$ export PATH=$PATH:~/bin #put this into your .bashrc
~$ chmod u+x ~/bin/lein

Once this is done, run lein with the following command

~$ lein repl 

This command is to get a REPL command line to run your clojure code. When run for the first time, it will try to find clojure and if it doesn’t find it installed, then it will download clojure and install it and return you the following shell

user=> 

Write your first clojure program by typing (println “hello, world”) into this shell. You can type (exit) to exit.

There you go, now you have clojure and lein installed.

Now you need to configure your emacs to use this setup. I am going to use SLIME and swank-clojure. First let us install swank-clojure plugin to lein.

~ $ lein plugin install swank-clojure 1.3.4

This command should end with :

Including clojure-1.2.1.jar
Created swank-clojure-1.3.4.jar

Now add the ~/bin to execution path within your .emacs file. (anywhere)

(setenv "PATH" (concat (getenv "PATH") ":~/bin"))
(setq exec-path (append exec-path '("/sw/bin")))

I prefer using slime for my lisp! sweet sweet slime. It is important that you do not have your old slime, its known to create problems. I would recommend commenting out the old slime load instructions on your .emacs. To load slime, all you need is clojure-mode.el from

https://github.com/jochu/clojure-mode

and add the following lines in your .emacs

(add-to-list 'load-path "~/.emacs-local/clojure-mode")
(require 'clojure-mode)

This is all you need.

Now on your command prompt you could use lein to create a new project.

$ lein new first-project

This will create a new directory called first-project in your current directory.

Open emacs, go to eshell and cd to the directory of the project. Once you are there type

M-x clojure-jack-in

and thats it!! you will have SLIME ready to go!

“hack and glory await”

Upgrading From Jekyll to Octopress

| Comments

Couldn’t resist the temptation. Octopress templates looked so groovy. I decided to take the dive and 2 hours later, now I am typing this post on my emacs. I still have to migrate my other posts on to this blog. I will do that over this week.

Octopress is the built on Jekyll and is just really jekyll packaged and made prettier with default fonts and styles. Thank you octopress.

You have to do a ruby, gems, octopress gem installation. But once the initial installation is done, you can do all your posting on markdown. I use emacs for all my coding and editing and hence being able to type in markdown is a great advantage for me.

Mobile Communications Primer

| Comments

This guide was written for a friend who wanted a quick read of some basic information on the different wireless technologies. Feel free to correct me if I am wrong or if I miss something.

Electromagnetic radiation

Electromagnetic radiation (EM radiation or EMR) is a form of energy emitted and absorbed by charged particles, which exhibits wave-like behalfvior as it travels through space. EMR has both electric and magnetic field components. In vacuum, electricalectromagnetic radiation propagates at a characteristic speed, the speed of light.

EMR represents all energy of electrical and magnetic proportion that can be used to transmit data and information.Just like a ruler, a particular point of EMR is pin pointed by the frequency of the particular radiation. By affecting the electrical or magnetic property of a particular point of an EMR at a particular frequency, we can transmit data along this frequency. A lot of these frequencies are good enough to transport data, a lot of them aren’t (atleast with the methods we know now). The entire range (universal set) of these frequencies is called the electromagnetic spectrum.

Electromagnetic spectrum

The electromagnetic spectrum extends from low frequencies used for modern radio communication to gamma radiation at the short-wavelength (high-frequency) end, thereby covering wavelengths from thousands of kilometres down to a fraction of the size of an atom. It is for this reason that the electromagnetic spectrum is highly studied for spectroscopic purposes to characterize matter. The limit for long wavelength is the size of the universe itself, while it is thought that the short wavelength limit is in the vicinity of the Planck length, although in principle the spectrum is infinite and continuous.

The lower frequency range is used for Radio waves which are used for mobile communications. At any frequency, by constantly modifying the electrical or magnetic properties of the radiation, messages can be transmitted.

Mobile communication using EMR

Let us assume that a person A wants to send a message to a person B. Person A choses a particular frequency lets say 3.122 x 104 (or 31.22 KHz) to transmit the message. The person, then with a device, lets call it an encoder, encodes his message into a series of changes at the particular frequency. By changing the electrical and/or magnetic properties of this particular frequency a coded message can be transmitted. Person B can simply listen to this exact frequency of 31.22 kHz and use a ‘decoder’ to convert these variations in electrical and magnetic properties into a human understandable form. Thus A has used a particular point on the electro magnetic spectrum to communicate with person B.

This is exactly how we use our mobile phones to communicate with each other. The encoding and decoding I mentioned in the above paragraph is the different methods of transfering a human understandable message into electric and/or magnetic variations that the wave can carry and decoding is the method of converting them back. Such a device would be your mobile phones.

There are several methods used to do this encoding and decoding. They are 1G, GSM (2G), GPRS, CDMA etc.

1G

1G or the first generation refers to the analog methods of transmitting and receiving information. 1G speeds vary between that of a 28k modem(28kbit/s) and 56k modem(56kbit/s). Antecedent to 1G technology is the mobile radio telephone, or 0G.

2G

2G (or 2-G) is short for second-generation wireless telephone technology. Second generation 2G cellular telecom networks were commercially launched on the GSM standard in Finland by Radiolinja (now part of Elisa Oyj) in 1991. Three primary benefits of 2G networks over their predecessors were that phone conversations were digitally encrypted; 2G systems were significantly more efficient on the spectrum allowing for far greater mobile phone penetration levels; and 2G introduced data services for mobile, starting with SMS text messages.

GSM (Global System for Mobile Communication)

GSM (Global System for Mobile Communications, originally Groupe Spécial Mobile), is a standard set developed by the European Telecommunications Standards Institute (ETSI) to describe technologies for second generation (2G) digital cellular networks. Developed as a replacement for first generation (1G) analog cellular networks, the GSM standard originally described a digital, circuit switched network optimized for full duplex voice telephony. The standard was expanded over time to include first circuit switched data transport, then packet data transport via GPRS (General Packet Radio Services). Packet data transmission speeds were later increased via EDGE (Enhanced Data rates for GSM Evolution) referred as EGPRS. The GSM standard is more improved after the development of third generation (3G) UMTS standard developed by the 3GPP. GSM networks will evolve further as they begin to incorporate fourth generation (4G) LTE Advanced standards. “GSM” is a trademark owned by the GSM Association.

General Packet Radio Service (GPRS)

General packet radio service (GPRS) is a packet oriented mobile data service on the 2G and 3G cellular communication system’s (GSM). GPRS was originally standardized by European Telecommunications Standards Institute (ETSI). It is a service provided with GSM technologies of mobile communications.

3G

G or 3rd generation mobile telecommunications is a generation of standards for mobile phones and mobile telecommunication services fulfilling the International Mobile Telecommunications-2000 (IMT-2000) specifications by the International Telecommunication Union. Application services include wide-area wireless voice telephone, mobile Internet access, video calls and mobile TV, all in a mobile environment.

Several telecommunications companies market wireless mobile Internet services as 3G, indicating that the advertised service is provided over a 3G wireless network. Services advertised as 3G are required to meet IMT-2000 technical standards, including standards for reliability and speed (data transfer rates). To meet the IMT-2000 standards, a system is required to provide peak data rates of at least 200 kbit/s (about 0.2 Mbit/s). However, many services advertised as 3G provide higher speed than the minimum technical requirements for a 3G service. Recent 3G releases, often denoted 3.5G and 3.75G, also provide mobile broadband access of several Mbit/s to smartphones and mobile modems in laptop computers.

CDMA

Code division multiple access (CDMA) is a channel access method used by various radio communication technologies.It should not be confused with the mobile phone standards called cdmaOne, CDMA2000 (the 3G evolution of cdmaOne) and WCDMA (the 3G standard used by GSM carriers), which are often referred to as simply CDMA, and use CDMA as an underlying channel access method.

One of the concepts in data communication is the idea of allowing several transmitters to send information simultaneously over a single communication channel. This allows several users to share a band of frequencies (see bandwidth). This concept is called multiple access. CDMA employs spread-spectrum technology and a special coding scheme (where each transmitter is assigned a code) to allow multiple users to be multiplexed over the same physical channel. By contrast, time division multiple access (TDMA) divides access by time, while frequency-division multiple access (FDMA) divides it by frequency. CDMA is a form of spread-spectrum signalling, since the modulated coded signal has a much higher data bandwidth than the data being communicated.

Wifi or Wireless Local Area Network

Wi-Fi is a popular technology that allows an electronic device to exchange data wirelessly (using radio waves) over a computer network, including high-speed Internet connections. The Wi-Fi Alliance defines Wi-Fi as any “wireless local area network (WLAN) products that are based on the Institute of Electrical and Electronics Engineers’ (IEEE) 802.11 standards”. However, since most modern WLANs are based on these standards, the term “Wi-Fi” is used in general English as a synonym for “WLAN”.

A device that can use Wi-Fi (such as a personal computer, video game console, smartphone, tablet, or digital audio player) can connect to a network resource such as the Internet via a wireless network access point. Such an access point (or hotspot) has a range of about 20 meters (65 feet) indoors and a greater range outdoors. Hotspot coverage can comprise an area as small as a single room with walls that block radio waves or as large as many square miles — this is achieved by using multiple overlapping access points.

Wifi is usually protected by encryption mechanisms like the WEP/WPA/WPA2/802.11 and other standards in order to prevent unauthorized access.

Wimax

WiMAX (Worldwide Interoperability for Microwave Access) is a wireless communications standard designed to provide 30 to 40 megabit-per-second data rates, with the 2011 update providing up to 1 Gbit/s for fixed stations. It is a part of a “fourth generation,” or 4G, of wireless-communication technology. WiMax far surpasses the 30-metre (100-foot) wireless range of a conventional Wi-Fi local area network (LAN), offering a metropolitan area network with a signal radius of about 50 km. The name “WiMAX” was created by the WiMAX Forum, which was formed in June 2001 to promote conformity and interoperability of the standard. The forum describes WiMAX as “a standards-based technology enabling the delivery of last mile wireless broadband access as an alternative to cable and DSL”. WiMax offers data-transfer rates that can be superior to conventional cable-modem and DSL connections, however, the bandwidth must be split among multiple users and thus yields lower speeds in practice.

Remember wimax is a Local area wireless connection. Though the range is now at 50km, it still is more closer to your wifi at home than the Mobile communication standards of 3G.

Long Term Evolution (LTE) 3GPP

3GPP Long Term Evolution, referred to as LTE and marketed as 4G LTE, is a standard for wireless communication of high-speed data for mobile phones and data terminals. It is based on the GSM/EDGE and UMTS/HSPA network technologies, increasing the capacity and speed using new modulation techniques. The standard is developed by the 3GPP (3rd Generation Partnership Project) and is specified in its Release 8 document series, with minor enhancements described in Release 9.

The world’s first publicly available LTE service was launched by TeliaSonera in Oslo and Stockholm on 14 December 2009. LTE is the natural upgrade path for carriers with GSM/UMTS networks, but even CDMA holdouts such as Verizon Wireless, who launched the first large-scale LTE network in North America in 2010, and au by KDDI in Japan have announced they will migrate to LTE. LTE is, therefore, anticipated to become the first truly global mobile phone standard, although the use of different frequency bands in different countries will mean that only multi-band phones will be able to utilize LTE in all countries where it is supported.

Nearfield wireless communication using Bluetooth

Bluetooth is a proprietary open wireless technology standard for exchanging data over short distances (using short-wavelength radio transmissions in the ISM band from 2400–2480 MHz) from fixed and mobile devices, creating personal area networks (PANs) with high levels of security. Created by telecoms vendor Ericsson in 1994, it was originally conceived as a wireless alternative to RS-232 data cables. It can connect several devices, overcoming problems of synchronization.

Most of the data in this article is from Wikipedia. The purpose of this article is to aggregate information for educational purposes

NCERT Textbooks in a Download Friendly Format.

| Comments

First things first, the Project is available on Github.

A friend of mine was preparing for the UPSC services examination and he asked my help to locate the NCERT textbooks as that is a good place to start preparing. I found the NCERT website quite fast, but found out that downloading these files from the website is a pain. They make each chapter a separate pdf and cover pages jpg formats. All in all you have to download 20 files if you want to read a text book.

Thus, I started a project so as to unify these pdf files into a single more human-form pdf. The pdf would thus be a complete ebook for one subject of NCERT. To do this, I needed three things

  • a tool to download these files easily : wget
  • a tool to combine these pdfs into a single file : gs (ghostscript)
  • a tool to convert jpg to pdfs : ghostscript/ImageMagik

All these tools are free open source tools that can be used. So I created two scripts jpg2pdf and compdf to ease their usage.

compdf takes in two arguments, 1st is the final pdf name e.g. 8th-Maths.pdf, and the second is the list of pdf file to be merged. The order that is given here is important.

usage:

    compdf "Final pdf name" "coverpage.pdf hesc10?.pdf hesc11?.pdf hesc1an.pdf"

e.g.

    compdf "9th-Science-Problems.pdf" "ieep1cc.pdf ieep1ps.pdf ieep10?.pdf ieep11?.pdf ieep1a?.pdf"

jpg2pdf is required as compdf can only merge pdfs and some coverpages are given in jpg files. so you will need to convert them to pdf.

usage:

    jpg2pdf JPEG-Filename.jpg PDF-Filename.pdf 

Note, most probably the jpg2pdf will error out on your computer because of the location of the viewjpeg.ps file on your computer. It will be different on your computer so use locate or find to find this file and then replace the path to that file in the jpg2pdf script.

These both tools are also added in the scripts folder of the project.

I used these tools and have uploaded a few textbooks, mostly those relevant to the UPSC civil services examinations.So folks who are preparing for it, can download the complete textbooks from this website.

Plea to contribute

While I was creating this, I realised that this is a good way of trying to provide a way for people to easily download pdf files directly to their computers, without having to worry about merging the pdfs etc. I have provided you with all the tools you will need, in the scripts folder.

If you have some time, rather than wasting it on tv, make yourself interesting use it to contribute to this project. Your efforts would be greatly appreciated by the millions of kids in India who will be helped by this deed of yours.

If you have unmerged pdf files, you can also contribute by uploading them to the directory called “unmerged”. I will merge them as soon as I can.

A note about copyrights

All copyright belongs to NCERT. I only function as a facilitator and do not own any copyright. We thank NCERT for making these textbooks available in the public domain.

SSH - Complete Guide, Keys, Passwords & Connect

| Comments

Why bother? The bother is that people are listening. Everyone from your prying neighbour, your ISP, your country and crackers and botnets are all listening to your traffic. Everytime you connect to a server online either through ftp, http, telnet etc. your login information and other information can be read by listeners since they arent encrypted. To overcome this, enter ftps, https and ssh.

SSH is a safe way of connecting, copying files and authenticating with a server online. You can generate your public key and let the server know your public key. By doing this, everytime you connect to the server, the server knows that the person connecting is you. You are the only person who can decrypt the public key with your private key that always only stays on your computer.

Generating SSH keys

On a linux/unix like machine (yes a mac too) run this

ssh-keygen -t rsa -C "your_email@youremail.com"

This will prompt you for a passphrase. You could use one to be safe, so that if someone gets access to your private key, they cannot take advantage of it.

This will create two files

~/.ssh/id_rsa (your private key) 

and

~/.ssh/id_rsa.pub (your public key)

Keep your private key safe. The public key you can give away ;)

Passwordless Authentication

For a server that you used to login into, use the keys above to enable passwordless authentication.

$ cat ~/.ssh/id_rsa.pub 

This will output something similar to this

ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEArkwv9X8eTVK4F7pMl 
St45pWoiakFkZMw G9BjydOJPGH0RFNAy1QqIWBGWv7vS5K2tr+EEO+F8WL2Y 
jK4ZkUoQgoi+n7DWQVOHsRijcS3LvtO+50Np4yjXYWJKh29JL6GHcp8o7
+YKEyVUMB2CSDOP99eF9g5Q0d+1U2WVdB WQM=raman@ramantePC

It is one line in length.

Login into your server the normal way and then copy this one line into .ssh/authorized_keys file using the following

echo [your public_key] >> .ssh/authorized_keys

Thats it. Now log off and try ssh into your server again.

ServerKeepAlive to maintain SSH Connections

Now that you are using ssh to connect yo your online server, you would have probably noticed how often ssh connections times out. This is because of one variable ServerAliveInterval in one of these files:

/etc/sshd_config  or /etc/ssh/sshd_config

That’s how often, in seconds, ssh will send a keepalive request to the other end of the connection. Now, I have found that at the servers, this value is usually set at 60. Setting your client machine to a value less than 60, like e.g. 45 is enough to make sure that there would be no idle timeout.

This is relatively safe cos as long as your client computer is on, the connection is alive. The moment it goes to sleep or is shutdown, the connection is lost.

ssh-agent, the true passwordless wonder

ssh-agent is considered a more safer way of connecting to servers as there are critics about the passwordless mechanism explained earlier. This is because of the vulnerability of having a file physically on your computer, that might get stolen etc. I haven’t delved into it much, but this seems like a good link for those who want to try it.

>>>>>>> 7800df135b70ac2c12fad5dca2683272e21a5385