Professional Documents
Culture Documents
49 An Introduction to Haskell
classes and User Defined
Data Types
Admin
70 Send Bulk Mail Without Be-
ing Treated Like a Spammer
48 Case Study: Unotech helps 09 Offers of the Month 100 Tips & Tricks
Mahindra & Mahindra
Financial Services Limited
10 New Products
105 FOSS Jobs
to optimize 87 per cent of its 13 FOSSBytes
proprietary field force solu-
tions costs.
www.esds.co.in www.cloudoye.com
Get 10%
discount
35%
off & more
“Do not wait! Be a part of
Reseller package special offer ! the winning team”
Free Dedicated hosting/VPS for one Get 35% off on course fees and if you appear
month. Subscribe for annual package for two Red Hat exams, the second shot is free
of Dedicated hosting/VPS and get
Hurry!till 31st one month FREE Hurry!till 31st
alid alid Contact us @ 98409 82184/85 or
Offer vber 2014! Contact us at 09841073179 Offer vber 2014! Write to enquiry@vectratech.in
Octo or Write to sales@space2host.com Octo
www.space2host.com www.vectratech.in
www.goforhosting.com www.prox.packwebhosting.com
Fees Register in
Rs. 15000/- Advance to EMBEDDED SOFTWARE DEVELOPMENT
(SC/ST/PH-50% receive a COURSES AND WORKSHOPS
Concession) BIG DATA ANALYTICS special School of Embedded
using hadoop eco-system discount Software Development
Venue: Malleshwaram, Bangalore Faculty - Babu Krishnamuthy
Date: 27th, 28th Sept. & 4th, 5th, 11th, 12th Visiting Faculty/ CDAC/ACTS Porting
18th & 19th October2014 Embedded RTOS to an ARM platform
Time: 10.00 am to 02.00pm (4 hrs.) per day
Qualification: Degree / Diploma Dates : October 11 and 12 ( 2 days program )
Trainging Contents: Introduction, HDFS Nominal
Certificates Maoreduce, Administration, Hbase, Hive, Pig fees: CDAC Alumni will get a special rate if
Will Be Sqoop, Flume, Oozie, Hadoop2.0 42/-
Rs.67siv registered in advance -please write to
e of
(inclu tax) babu_krishnamurthy@yahoo.com
Awarded For more information, call us on service
mentioning the CDAC/ACTS center
Balajee. K.M, Asst, Director, per delegate
Mob.: 9900226980, 080 41100557 and batch details
www.msmedibangalore.gov.in
FOSSBYTES Powered by www.efytimes.com
DigitalOcean is one of the fastest growing cloud vendors and offers services Avnet releases Linux-ready
for just US$ 5 a month. It runs on fast solid state drives (SSDs). ‘PicoZed’ COMs
In March this year, DigitalOcean had announced a round of funding that An array of four Linux-ready ‘PicoZed’
brought in US$ 37.5 million from investors. Droplets are deployed by users COMs has been released by Avnet.
as virtual instances of operating systems. The new partnership has brought out
the CoreOS as an image, which DigitalOcean customers can easily deploy as
a Droplet. This partnership between CoreOS and DigitalOcean does not have
a specific revenue target.
A Guide to Buying
the ‘Perfect’ Projector
Looking for a projector for the classroom, home theatre, meeting room, auditorium or
even for gaming? Here’s a guide that helps you decide between the huge variety of
models, as well as a wide range of technologies, shapes and sizes.
P
rojectors are no longer used only in those stylish meeting affordable price point, in order to get more people to indulge in their
rooms. People are now also replacing their huge LCD and craving for bold, big-screen entertainment at home. Packed with an
plasma screens with these reflectors. And gone are the days assortment of advanced features and Hitachi’s unparalleled technology
when they were categorised based on their weight. Technology and reliability, our designers have ensured that this projector truly
has changed all that! Saji Kumar, director, product management, enhances the entertainment experience — presenting movies, sports
Acer India, explains, “Earlier, we used to bundle projectors with and video games in a way that one has never seen before.”
other key products as there was not much demand for them. Now Acer believes in giving the best support to its customers. Kumar
we see so many requirements for projectors coming from various explains, “We first try and understand the requirements of our customer,
segments that we have dedicated manpower for this product. as we just don’t want to sell a product. Rather, we want to help a
It has become a key product like desktops and laptops.” Apart customer buy a product. We ask a few questions before selling our
from Acer, there are other brands like Hitachi that offer a variety product—whether the customer is looking for a home theatre, what the
of technologically advanced projectors. Tarun Jain, country room’s dimensions are, the resolution or brightness required, etc.”
head, Hitachi Home Electronics India, says, “Hitachi offers a To help you decide on what you need, here are a few factors to
comprehensive range of projectors, designed to suit varied space keep in mind.
and projection needs. Whether it is maximising screen size in a Specifications: If you’re a technical person, you will know
small room, limiting shadowing and glare, or maximising image the kind of specifications required for your projector. But if you
quality in a large space, we have a projector for every purpose.” are not, you will have to research a bit on that too. Specifications
would include a few factors that are listed below.
Comparing DLP-based projectors with Dimensions: The dimension of the room in which you plan to
LCD versions place your projector. Projectors have different configurations to
Projectors can be best described as inverted cameras which, suit the dimensions of a place.
instead of receiving light, emit it out of the lens. They fall into two Size: Projectors now have a wide range in shapes and sizes as well.
broad categories, LCD- and DLP-based. LCDs represent an old Wireless or wired: Both wireless and wired projectors are now
technology and the first projector ever launched was a LCD version. available. If you are planning to buy one for your home, you may
With time, the use of DLP projectors has become more widespread. be comfortable with the wired version but if you’re looking for a
There are many leading players in the market including Acer, projector in your meeting room then a wireless projector might be
Hitachi and BenQ, and most of them offer DLP projectors. Saji more appropriate.
Kumar states, “We focus on DLP projectors as it accounts for 60-65 Resolution: This is the number of pixels used to display an
per cent of the market.” DLP or digital light processing projectors image. If the projector has a higher resolution, it uses more pixels
use a type of MEMS (microelectromechanical systems) technology to create the image, which results in a cleaner, sharper and crisper
with a digital micro-mirror device. These projectors are used in image. A high resolution will be necessary if the projector is
a variety of display applications, ranging from traditional static intended for classrooms or meeting rooms as it will help to project
displays to interactive displays. They are also used in non-traditional charts, texts and graphs more clearly.
applications like the security, medical and industrial domains. Colour brightness or lumens: Select the level of brightness
based on the room’s dimensions. The brightness of a projector
Factors you should consider when is measured in lumens. For homes, you would need nearly
buying a projector 1500 lumens, and for classrooms and conference rooms, you
Buying a projector is a major decision and there are many factors to would need a minimum of 2500 lumens. For larger spaces like
keep in mind when doing so. Potential buyers should be very clear auditoriums, you would need even higher lumens.
about what their requirements are and then thoroughly research Distance and positioning: This refers to the distance between
what the market offers, as a projector is an expensive product to the projector and the screen. The position of the projector and
acquire. This is where companies shoulder a big portion of the the dimensions of the room or hall will determine the size of the
responsibility of ensuring buyers pick up the right product. Says image projected. You would need to look for the features that
Jain, “We have deliberately introduced this product at an extremely offer flexibility in placement.
Hitachi: CP-DH300
Native resolution: 1080p (1920 x 1080)
Brightness: 3000 ANSI lumens
Key features: 3D ready, weighs 2.2 kg, power supply:
AC100-120V (50/60Hz), wireless display (optional)
BenQ: MW665
Native resolution: WXGA (1280×800)
Brightness: 3200AL
Key features: 3D ready, weighs 2.65kg, USB
display, wireless display (optional), power
supply: AC100 to 240V, 50 to 60Hz
Epson: EB-
1420WI/1430WI
Native resolution: WXGA (1280×800)
Brightness: 3,300lm / 1,900lm
Key features: Weighs 5.6kg, 365W/274W
lamp, lamp type: 245W UHE
In this month’s column, we shift our focus to mobile application development and
discuss the issue of energy consumption of mobile apps. We also briefly cover
how a layman can quickly learn to develop Android apps.
F
or the past few months, we have been discussing characteristics being validated and documented. This
information retrieval and natural language can lead to poorly written apps causing an abnormal
processing as well as the algorithms associated drain on the device’s battery.
with them. In this month’s column, we take a break Given a smartphone with a fully charged battery,
from our discussion of NLP and, instead, focus on the user expects that the device should be usable for
mobile application development. We discuss some a certain number of hours without requiring a battery
of the recent research work on the energy consumed recharge. The user is aware that prolonged use of
by mobile apps. Then we move on to mobile app certain hardware such as the camera, GPS, etc, can
development, which has been growing at a furious shorten the period before the next recharge. However,
pace over the past few years and has attracted many in the course of using normal apps, such ‘Abnormal
non-software developers to its fold, including school Battery Drain’ (ABD) issues are not expected to
students. Learning to develop mobile apps using occur. When an ABD issue occurs, it is difficult
open source software is quite easy. In this month’s for normal users to figure out what it is caused by.
column, we have one of our student readers, Ankith Some of the potential causes could be configuration
Subramanya, who is a Class XI student from The changes; a hardware or software malfunction which
International School, Bengaluru, share his experience keeps a power-hungry hardware component such
of learning to develop an Android app. as the camera always on, even when not in use;
an app upgrade, etc. Hence, intelligent tools are
Energy consumption in mobile apps needed to diagnose ABD issues. One such tool is a
Smartphones run complete operating systems tailored research project called eDoctor, which is described
for the mobile device, and support a wide variety of in the following research paper http://cseweb.ucsd.
additional hardware devices such as cameras, GPS, a edu/~voelker/pubs/edoctor-nsdi13.pdf. eDoctor
light sensor, accelerometer, gyroscope, compass, etc. records various events such as configuration changes,
Along with such a rich plethora of ‘exotic’ hardware, app installations and app upgrades; and it monitors
smartphones also need to be extremely lightweight app phases. Using this information, it tries to pinpoint
and portable. This requires that smartphone batteries what is responsible for the ABD.
must be small and lightweight. This, in turn, implies Given the importance of conserving battery life,
that energy consumption in smartphones needs to be as smartphone OSs are designed to turn off hardware
low as possible to conserve battery life. Hence, energy components the moment they detect that they are not
consumption by mobile apps needs to be tracked and in use. Smartphones employ aggressive CPU/screen
managed to extend the battery life of smartphones. sleeping policies. Such measures can result in issues
Smartphones have become open platforms for for apps which are in the middle of communicating
hosting a variety of applications. Given the rapid pace with an external server and are waiting for data to be
of mobile app development, more and more apps are returned from the server. In such cases, the device
being developed, downloaded and installed on to the should not be put to sleep. Hence, smartphone OSs
device, without their performance, security and energy export explicit ‘wakelock’ APIs, which can be used
None
OSFY?
“I’m writing this for those novices out there who are itching is entirely your choice. As Android Studio is still in the
to develop Android apps, but don’t yet know how to. Until a early stages of development, and as only the beta version
few weeks ago, I too had no idea about creating Android apps, is available for use, I would recommend using Eclipse
but I really wanted to develop my own mobile apps. I did some (www.eclipse.org). Android apps can be made on Eclipse
reading on the Internet, and found out that Android apps are by downloading the necessary plugins. The complete
developed using Java. I was a little disheartened at first because package that you need to install, including Eclipse with
I had never learnt Java or, for that matter, any Object Oriented the necessary plugins, as well as the SDK manager (an app
Programming language. Nonetheless, I found the time in my that manages the downloading and installation of build
summer vacation to attend a few classes on Java at a local tools and libraries) is available on developer.android.com,
teaching centre. A few weeks into it, I discovered that Java is and is called the ADT (Android Developer Tools) bundle
extremely intuitive and easy to grasp. (JDK must be pre-installed). The IDE contains Java classes
“Earlier experience in Java would definitely be a plus and XML files, that are made to interact with the help of
point, but don’t be disheartened if you don’t know any Java Android manifest, which is an XML file.
at all. There are plenty of resources online to help you learn, “Essentially, each screen of an Android project is called
and using a book wouldn’t be a bad idea as well. I must stress an activity, and every activity has a backing XML file and
that getting your syntax bang on is not as important as getting Java class. Android apps follow the MVC (model view
the hang of the basics and the fundamental concepts. You controller) design pattern. The XML file, which is for UI,
should have a solid understanding of OO concepts such as acts as the view, whereas the backing Java classes are for the
object creation, inheritance, overriding, interfaces, collections, model and controller. If you do not wish to do the XML part,
packages, etc. These might sound like Greek and Latin, but the UI can be designed by the intuitive dragging and dropping
once you get started on Java, this will be your bread and of UI elements (called views), and the IDE will automatically
butter. make changes in the XML file.
“A lot of people think that knowing XML is crucial in “Debugging is made simple with the help of LogCat,
building Android apps, but the truth is that you can build a debugging tool that shows what exactly is going on at
whatever you want with no previous knowledge of XML. every step in the runtime of the application. The app that
This is basically because the XML elements are integrated you create can be run either using an emulator or on your
as a drag and drop feature in the Android environment. Also, Android device. I would recommend the latter, as the
XML is very simple and you will definitely pick it up while emulator is incredibly slow in loading. If you want to run on
building an app. Learning Android is merely about getting your Android device, make sure that you install the device
to know a few additional concepts. First, visit developer. driver. Also, if your Android version is 4.2 or higher, you will
android.com. You will find instructions there to install and need to turn on developer options. You can do this by going
set up your SDK (what you’ll need to develop the apps). to ‘About phone’ in ‘Settings’ and then clicking on ‘Build
This contains half-built Android programs, in the sense that version’. However, if you do not have an Android device,
it contains incomplete classes that you have merely to extend you will have to create an emulator on AVD (Android Virtual
(again, don’t worry about these terms, you’ll understand them Device) manager. Simple apps such as a calculator and apps
soon enough) to build your apps. This way, it becomes very to print out your name are surprisingly easy to build. Now go,
simple as you don’t have to start from scratch. get started on your Android adventure!”
“There are plenty of resources online to help you learn Thank you, Ankith, for sharing your experience on
Android. Udacity (www.udacity.org) and Coursera (www. learning Android app development!
coursera.org) offer courses on mobile app development. If you have any favourite programming questions/software
The course in Udacity, named ‘Developing Android apps’, topics that you would like to discuss on this forum, please
is interactive and is centred on the purpose of making you send them to me, along with your solutions and feedback, at
build your own weather app. The entire course involves sandyasm_AT_yahoo_DOT_com. Till we meet again next
the steps to build that app, and you are expected to do so month, happy programming!
on your own. The idea is that, from this, you will develop
your skillsets to develop your own Android apps. This By: Sandya Mannarswamy
is a very nice concept, and provides a hands-on learning The author is an expert in systems software and is currently working
experience. There is also another course available from with Hewlett Packard India Ltd. Her interests include compilers,
Coursera titled, ‘Creative, Serious and Playful Science of multi-core and storage systems. If you are preparing for systems
Android Apps’. This requires no previous knowledge of software interviews, you may find it useful to visit Sandya’s LinkedIn
Java. You may find this useful as well. group: Computer Science Interview Training India at http://www.
linkedin.com/groups?home=HYPERLINK “http://www.linkedin.com/
“The two IDEs that you can use for Android groups?home=&gid=2339182”&HYPERLINK “http://www.linkedin.
development are Android Studio and Eclipse. While both com/groups?home=&gid=2339182”gid=2339182
are very similar in many ways, I use Eclipse, though this
O
nce you have the basics of Hadoop functioning, the $ sudo systemctl start hadoop-datanode
obvious question is: how does one put the data into $ hdfs dfs -copyFromLocal large_file.txt second_large_file.txt
the system? And the corollary to that is: how does $ hadoop fs -ls -h
one distribute the data between the various data nodes? Since -rw-r--r-- 1 fedora supergroup 3.3 G 2014-08-15 12:25
the system can grow to thousands of data nodes, it is pretty large_file.txt
obvious that you should not have to tell HDFS anything more -rw-r--r-- 1 fedora supergroup 3.3 G 2014-08-15 12:33
than the bare minimum. second_large_file.txt
$ sudo du -sh /var/cache/hadoop-hdfs/
A simple test [fedora@h-mstr ~]$ sudo du -sh /var/cache/hadoop-hdfs/
Your first test can be to take a large text file and load it into 3.4G /var/cache/hadoop-hdfs/
HDFS. Start the Hadoop cluster as described in the previous $ ssh -t fedora@h-slv1 du -sh /var/cache/hadoop-hdfs/
article, with three nodes. On the first test, stop the datanode 1.7G /var/cache/hadoop-hdfs/
service on h-mstr and copy a large file on two slave nodes. Connection to h-slv1 closed.
(To create a text file for testing, take a hexdump of a 1GB tar [fedora@h-mstr ~]$ ssh -t fedora@h-slv2 sudo du -sh /var/cache/
—you should get a text file of around 3GB.) hadoop-hdfs/
1.7G /var/cache/hadoop-hdfs/
$ ssh fedora@h-mstr Connection to h-slv2 closed.
$ sudo systemctl stop hadoop-datanode
$ hdfs dfs -copyFromLocal large_file.txt The new data seems to be stored on the h-mstr only. If you
run the command from h-slv2, the data is likely to be stored on
You can verify that the data has been copied and how the h-slv2 datanode only. That is, HDFS will try to optimise
much resides on each node, as follows: and store the data close to the origin. You can find out about
the status of HDFS, including the location of data blocks, by
$ hadoop fs -ls -h large_file.txt browsing http://h-mstr:50070/.
Found 1 items The file you want to put in HDFS may be on the desktop. You
-rw-r--r-- 1 fedora supergroup 3.3 G 2014-08-15 12:25 can, of course, access that file using nfs. However, if you have
large_file.txt installed the HDFS binaries on your desktop, you can copy the file
$ sudo du -sh /var/cache/hadoop-hdfs/ by running the following command on the desktop:
13M /var/cache/hadoop-hdfs/
$ ssh -t fedora@h-slv1 du -sh /var/cache/hadoop-hdfs/ $ HADOOP_USER_NAME=fedora hdfs dfs -fs hdfs://h-mstr/ -put
1.7G /var/cache/hadoop-hdfs/ desktop_file.txt
Connection to h-slv1 closed.
$ ssh -t fedora@h-slv2 du -sh /var/cache/hadoop-hdfs/ The commands -put and -copyFromLocal are synonyms.
[fedora@h-mstr ~]$ ssh -t fedora@h-slv2 sudo du -sh /var/
cache/hadoop-hdfs/ Replication
1.7G /var/cache/hadoop-hdfs/ You should stop the Hadoop services on all the nodes. In /etc/
Connection to h-slv2 closed. hadoop/hdfs-site.xml, on each of the nodes, change the value of
dfs.replication from 1 to 2 and the data blocks will be replicated
The data file is distributed on h-slv1 and h-slv2. Now, start on one additional datanode.
the datanode on h-mstr as well. Run the above commands
again, as follows: <property>
<name>dfs.replication</name> '--outdir','/tmp','/'.join([inpath,infile])])
<value>2</value> return '/tmp/' + infile.rsplit('.',1)[0] + '.txt'
</property> # Convert & print file as a single line replacing '\n' by '\t'
adding file name at the start
Restart the Hadoop services. Increase the replication for def process_file(p,f):
existing files and explore http://h-mstr:50070/. print("%s"%f, end=DELIM)
textfile = convert_to_text(p,f)
$ hadoop fs -setrep -R 2 /user/fedora/ for line in open(textfile):
print("%s"%line.strip(),end=DELIM)
These experiments illustrate the resilience and flexibility print()
of the Hadoop distributed file system, and the implicit # Generator for files of type odt, doc, etc.
optimisation to minimise the transfer of data across the def get_documents(path):
network. You don't need to worry about distribution of data. for curr_path,dirs,files in os.walk(path):
During your experiments, in case you come across the for f in files:
error stating that the namenode is in safe mode, run the try:
following command: if f.rsplit('.',1)[1].lower() in FILETYPES:
yield curr_path,f
$ sudo runuser hdfs -s /bin/bash /bin/bash -c "hdfs dfsadmin except:
-safemode leave" pass
# pass the root directory as a parameter
Loading data programmatically for path,f in get_documents(sys.argv[1]):
It is likely that you will need to get the data from some existing process_file(path,f)
sources like files and databases and put what you need into HDFS.
As the next experiment, you can take up the document files you You may run the above program as follows, from the desktop:
may have collected over the years. Convert each into text and load
them. Hadoop works best with large files and not with a collection $ ./load_doc_files.py ~/Documents | HADOOP_USER_NAME=fedora \
of small files. So, all files will go into a single HDFS file, where hdfs dfs -fs hdfs://h-mstr/ -put – doc_files.txt
each file will be a single record with the name of the file as the
prefix. You don't need to create a local file. The output of the The above program can be easily extended to convert and
program can be piped to the hdfs dfs -put command. load PDF files as well. Or another program can be used to
The following Python program load_doc_files.py append to the existing HDFS file.
illustrates the idea. The obvious next step is that once the data is in Hadoop, you
It selects document files. need to figure out how to use it and what you can do with it.
Each document file is converted to a text file.
The name of the file is output with a delimiter (a tab, in An example of modified word count
this case). Hadoop Map-Reduce offers a very convenient streaming
Each line from the file is read and output with the new framework. It takes input lines from an HDFS file and passes
line character replaced by a delimiter. them on standard input to one or more mapper programs.
On reaching the end of the file, a new line character is The standard output of the mapper programs is routed to
written to the standard output. the standard input of the reducer programs. The mapper and
reducer programs could be in any language.
#!/usr/bin/python Each line of a mapper output is expected to be a keyword,
from __future__ import print_function value pair separated by a tab. All lines with the same keyword
import sys are routed to the same reducer.
import os A common first example is a word count in a text file.
import subprocess Each line of a text file is split into words by a mapper. It
writes the word as the key with the value 1. The reducer
DELIM='\t' counts the number of times a particular word is received.
FILETYPES=['odt','doc','sxw','abw'] Since the word is the key, all occurrences of the same word
# use soffice to convert a document to text file will be routed to the same reducer.
def convert_to_text(inpath,infile): In doc_files.txt, each line is actually a file. It is very likely
subprocess.call(['soffice','--headless','--convert- that words will be repeated in a line. So, it is better if the
to','txt:Text', mapper counts the words in a line before writing to stdout, as
July 2014 Firewall and Network security Web Hosting Solutions Providers MFD Printers for SMEs
August 2014 Kernel Development Big Data Solutions Providers SSDs for Servers
November 2014 Cloud Special Virtualisation Solutions Providers Network Switches and Routers
January 2015 Programming Languages IT Consultancy Service Providers Laser Printers for SMEs
February 2015 Top 10 of Everything on Open Source Storage Solutions Providers Wireless Routers
E
ven though C was developed around 1973, it still elicits many people still cling to this tool, citing ease of use. I have had
a fair share of interest from professional programmers. a difficult time convincing others how easy it is to use the Linux
But beyond this, C is also the preferred language of environment to program in C, and this article has its roots in my
academia. There is possibly not a single university in the frustration over this argument. In this article, I have presented a
world which does not have a C programming paper in its few open source tools that will make the life of a C programmer
undergraduate curriculum. The destinies of C and UNIX comfortable in the Linux environment.
have been intertwined ever since they were created. C is There are lots of open source tools that can be used to
most powerful when it is used with UNIX. In fact, the system automate and simplify many of the steps involved in program
calls and commands of UNIX/Linux invigorate C programs. development, using C. This list is in no way comprehensive,
Unfortunately, in India, this language is most often taught using but the tools have been selected based on my experience
proprietary tools. To add insult to injury, the most widely used and personal preferences. So the relevance of a particular
IDE is Turbo C++ for Microsoft Windows, a product of Borland tool might be debatable, occasionally, but the general idea is
Software Corporation, an erstwhile software company. The last to introduce some useful tools to the interested user. Open
stable version of this IDE was released in 1996, which makes it source tools from the following categories will be discussed:
as old as many of the first-year undergraduate students who use • Integrated Development Environments
it. In 2006, the Turbo C++ IDE was released as freeware, which • Build automation tools
effectively tells us that the software has become obsolete. But • Revision control systems
/**
EMBEDDED SOFTWARE
DEVELOPMENT
* @file doxygen_example.c
* @author deepu
* @date 15 Jul 2014 COURSES AND WORKSHOPS
* @brief Example for using doxygen with C.
*/
This article presents Tornado, the Python Web framework. Originally developed at FriendFeed,
Tornado is an asynchronous networking library. It is able to scale up to tens of thousands of
open connections with the help of its non-blocking network I/O.
A
part from introducing you to Tornado, this article is Facebook’s real time Python Web framework (we will go
explores the extent to which it can be scaled, its into this later). It enables a clean approach to Web server
features, the installation process, and its advantages programming, focuses on non-blocking operations and scales
compared to other Python Web frameworks. This article to an enormous number of open connections. Tornado is an
is meant for those interested in knowing more about Web asynchronous networking library that was originally developed
designing as well as Web developers. It may even be helpful at FriendFeed, a kind of social network that enables you to
to serious Python developers or contributors trying to explore share the issues you found on the Web and it allows discussions.
ways to improve their Web development skills. FriendFeed was acquired by Facebook in 2009 and Tornado
A framework is a collection of programs that uses was open sourced soon after. Django, CherryPy, web2Py, Grok,
a control mechanism to structure code to build a bigger Pylons and TurboGears are some of the other frameworks.
system. We can develop simple websites using basic
designing languages like HTML, CSS, Python, etc. However, Why Tornado?
considering the complex and dynamic nature of the Web, it is So why is Tornado preferred, even though Python has a
difficult to do this at a low cost and within the short deadlines number of frameworks? Well, Tornado is noted for its high
that sites are typically developed. Hence, developers want performance and supposedly has the capacity to solve the
something that empowers them and has fewer bugs. The C10k problem (problem of optimising network related issues
purpose of a Web framework is to provide some features that so that it can handle a large number of clients at the same
are essential for all kinds of applications, such as database time) that affects other servers. Tornado focuses on speed and
support, URL handling, HTML templating, etc. handling large volumes of simultaneous traffic.
Python is one of the most used general-purpose Let’s look at those features of Tornado that differentiate it
programming languages. It is also used as a scripting language from other frameworks.
but mostly in non-scripting contexts. Python’s environment Built-in support: Tornado comes with built-in support
consists of a number of Web frameworks, ranging from the and finds solutions for most of the tedious aspects of Web
minimalistic to the fully bloated. Tornado is one of the best development like templates, localisation, signed cookies, etc.
Web frameworks of the Python programming language. It Tornado also allows users to mix it with other frameworks,
Here’s an introduction to Flask Microframework, which can be used to easily build and deploy
good Web applications with the minimum of effort and time. Added security and functionality
for the app is provided by the Jinja 2 engine.
F
lask is a microframework written in Python. It is a entity tags, cache control headers, HTTP dates, cookie handling,
lightweight Web application framework, which uses the file uploads and a powerful URL routing system. It does not force
Werkzeug WSGI and Jinja2 template engine. There is you to use a specific template engine or any other extension, but
no database abstraction layer or form validation layer, because leaves everything else to you, the developer, to choose.
the core is kept simple and supports extensions, which can add
application features. There are many different extensions available Jinja2
for Flask to support databases, upload files, for authentications, This template engine is mainly used for creating static or
form validation, etc, which the user has to import and use. dynamic Web pages with minimal coding. A basic layout can be
set up and used for a large number of static or dynamic pages
The Werkzeug WSGI (Web Server Gateway Interface) with little coding. Flask uses the Jinja2 template engine, inspired
WSGI is the interface between Web servers and Web applications by the Django framework. The Jinja template adds sandboxed
for Python. At present, Werkzeug is one of the most advanced execution for security reasons. It features the automatic escape of
WSGI utility modules. It includes a powerful debugger, fully HTML from XSS Vulnerability and uses inheritances.
featured request and response objects, HTTP utilities to handle Flask is built on the above two libraries, the Jinja2
template engine and Werkzeug WSGI. The remaining Our first app
decisions are left to you, as the developer. You can choose Let’s create a directory for our application to start off with
different extensions depending on your needs and interests. Flask, as follows:
Let’s create a simple Web application using Flask.
$ mkdir myapp
Flask installation $ cd myapp
As a prerequisite, you need Python 2.6 or higher to get
started, and Pip, which is a tool to install and manage Python File structure:
packages. Pip makes it easy for users to install and uninstall myapp
Python packages in a single command. For example: __init__.py
manage.py
$pip install PackageName templates/
$pip uninstall PackageName about.html
base.html
You have two ways to install Flask on your machine. You index.html
can either choose a virtual environment that allows you to work posts.html
in an isolated environment with a separate copy of Python, and static/
without worrying about affecting other projects if anything goes css/
wrong, or you can go for a direct installation of Python and Flask style.css
on your native machine. I have explained both the methods here.
Let us first try the virtual environment using Pip. Ubuntu Create the directories and files which are listed above.
users can try it directly without Pip. __init__.py will create an object for application using
Flask and will be ready to run the app.
$sudo pip install virtualenv manage.py will handle all URL routing properties and content.
The templates directory contains all HTML pages needed for the
Ubuntu users should use: applications and static contains all static resources like the style
sheet, images, etc; this is handled by the Jinja2 template engine.
$sudo apt-get install python-virtualenv
__init__.py file
…to begin the virtual environment, and activate it by
issuing the following command: from flask import Flask
app = Flask(__name__)
$ virtualenv venv
$ . venv/bin/activate if __name__ == ‘__main__’:
app.run(debug = True)
You can deactivate virtualenv as follows:
The above code will create an instance (app) for our app using the
$deactivate Flask class. The app.run method is used to run the local server with
our application; we have imported the app object via manage.py, so
Once you have activated virtualenv, you are ready to we can run the server from there.
install Flask in the virtual environment. Do so by using debug = True will automatically restart and reload the server if
Python package management. any modifications are done to any file of the application.
The app.run method is not actually needed here, because we
$pip install Flask are going to import app instance in the manage.py file and we
$pip install flask-script can run the server from the manage file.
You can install Flask directly in the system by avoiding the manage.py file
virtual environment (sometimes Flask comes with Python):
from flask import Flask, url_for, render_template
$ pip install Flask from flask.ext.script import Manager, Server
$ pip install flask-script
import os, sys
Once successfully installed, you can go ahead to create a sys.path.append(os.path.abspath(os.path.join(os.path.
simple Web application. dirname(‘__file__’),’..’)))
#importing app from the __init__.py file, path can be obtained sys, and app object is imported from the __init__.py file.
from the above statement manage.py will take care of routing and content in our
from article import app application. Routing can be done using the @app.route()
manager = Manager(app) method, which takes string arguments and will be appended to
the URL, e.g., @app.route(‘/index’). You can load the index
# main page can load either url 127.0.0.0:5000/ or page with the help of http://127.0.0.0:5000/index.
127.0.0.0:5000/index render_template will, by default, look for HTML pages in
@app.route(‘/’) the template directory, which takes the first argument as a page
@app.route(‘/index’) name and passing key; value pairs are also possible in the render_
def index(): template method and values can be received using its key.
return render_template(“index.html”, title = “Myapp home”) Manager module in Flask-script allows the user to create a new
command. Using the add_command we can set up the server and
#About page new command. Here, we used runserver as our new command, and
@app.route(‘/about’) server settings like debugging, reloading and application IP address.
def about(): Enabling debugger (use_debugger = True) is recommended for the
return render_template(“about.html”, title= “About”) purpose of testing and not for the production environment. It will
display an error message if something goes wrong, and reloader
# load posts page and displays the content from the post array (use_reloader = True) will automatically reload the applications
@app.route(‘/posts’) after we have made changes to the code.
def posts(): You can run the application using ./manage.py runserver.
posts = [ runserver is our own command, which has been created using
{ the Manager module.
“title” : “Hello World”,
“body” : “Welcome to python flask tutorial” base.html
},
{ <!DOCTYPE html>
“title” : “Sample post”, <html>
“body” : “Sample post for testing python flask “ <head>
} {% if title %}
] <title> {{title}}</title>
return render_template(“posts.html”, title = “Posts”, {% else %}
posts = posts) <title> Myapp home</title>
{% endif %}
# Create a new command ‘runserver’ using Manager and set host <link rel=”stylesheet” type=”text/css” href=”{{ url_
and enable debugger module. for(‘static’, filename=’css/style.css’) }}”>
# Debugger module only for developing not for production </head>
server <body>
manager.add_command(‘runserver’, Server( <header>
use_debugger = True, <h1><a href=”{{url_for(‘index’)}}”>MyApp</a></h1>
use_reloader = True, </header>
host = ‘127.0.0.1’ <div class=”menu”>
)) <ul>
#manager.run will start the server, which holds the app object <li><a href=”{{url_for(‘index’)}}”>Home</a></
also from the file __init__.py registered using ‘Manager’ li>
if __name__ == “__main__”: <li><a href=”{{url_for(‘about’)}}”>About</a></
manager.run() li>
<li><a href=”{{url_for(‘posts’)}}”>Post</a></
Import all necessary modules for our app. The render_template li>
module in Flask uses the Jinja2 template, which automatically </ul>
locates the file from the templates directory in the app. You can pass </div>
the template name and arguments as well. url for is good for building <div class=”container”>
URLs. Instead of hard code, the URLs passing the function names {% block content %}{% endblock %}
will take care of everything and arguments will also be accepted. </div>
The application path can be obtained from modules os and </body>
index.html ul li{
list-style: none;
{% extends “base.html” %} display: inline;
{% block content %} float: right;
<h1>Welcome to my app</h1> padding: 10px;
{% endblock %} }
style.css References
[1] http://en.wikipedia.org/wiki/Flask_(web_framework)
a { [2] http://werkzeug.pocoo.org/
text-decoration: none; [3] http://jinja.pocoo.org/
[4] http://flask.pocoo.org/
} [5] http://flask.pocoo.org/docs/installation/#installation
IBM
Worklight
A Mobile App
Development
Platform
IBM Worklight offers cross-
platform portability of the
application code, which is crucial
during apps development.
Worklight enables the
development of rich HTML 5 and
hybrid apps using native code.
I
BM Worklight provides an open, comprehensive including ACL and LDAP support;
and advanced mobile app development platform for Employees with a central location for the latest apps
smartphones and tablets. It can be used to create all needed by their department and optimised for their device;
kinds of native, Web-based or hybrid mobile apps very Developers with an easy way to distribute mobile
easily. It includes the IBM Worklight Studio―an Eclipse- builds and elicit feedback from development and test
based IDE (integrated development environment) in which team members.
all the coding and integration tasks are performed to develop
a fully functional mobile app. Device runtime
IBM Worklight consists of five main components as Device runtime is client-side runtime code that embeds server
shown in Figure 1. functionality within the target environment of deployed apps.
Application Code
Optimization Blackberry Server Integration
Framework Enterprise App Provisioning
Build Engine Windows Framework
Integrated Device And Governance
Phone Encrypted and
SDKs Syncable Storage
3rd Party Library Windows 8 App Feedback Management
Integration Runtime Skinning
Java ME
WYSIWG Editor Public App Stores
and Simulator Mobile Web Reporting for Statistics
Functional and Diagnositics
Testing Desktop Web
4
Enterprise Backend Systems
Worklight Server
Worklight Console
Mashups and Service Direct Update
Composition Unified Push and SMS Notification
JSON Translation Mobile
Web Apps Development and Operational Analytics
Geolocation Services
Unified Push App Version Management
Adapter Library for Notification
Backend Connectivity
<html>
<body>
<font color = red> Mohit's Calculator </font>
<FORM NAME="Calc">
<TABLE BORDER=4>
<TR>
<TD>
<INPUT TYPE="text" NAME="Input" Size="16">
<br>
</TD>
</TR>
<TR>
<TD> Figure 6: IBM Worklight
<INPUT TYPE="button" NAME="one" VALUE=" 1 "
OnClick="Calc.Input.value += '1'">
<INPUT TYPE="button" NAME="two" VALUE=" 2 "
OnCLick="Calc.Input.value += '2'">
<INPUT TYPE="button" NAME="three" VALUE=" 3 "
OnClick="Calc.Input.value += '3'">
<INPUT TYPE="button" NAME="plus" VALUE=" + "
OnClick="Calc.Input.value += ' + '">
<br>
<INPUT TYPE="button" NAME="four" VALUE=" 4 "
OnClick="Calc.Input.value += '4'">
<INPUT TYPE="button" NAME="five" VALUE=" 5 " OnCLick="Calc.
Input.value += '5'">
<INPUT TYPE="button" NAME="six" VALUE=" 6 " Figure 7: A simple calculator
OnClick="Calc.Input.value += '6'"> </body>
<INPUT TYPE="button" NAME="minus" VALUE=" - " </html>
OnClick="Calc.Input.value += ' - '">
<br> Copy the above code and paste it in
<INPUT TYPE="button" NAME="seven" VALUE=" 7 " the index.html page as shown in Figure 7.
OnClick="Calc.Input.value += '7'"> Step 2: Create the Worklight
<INPUT TYPE="button" NAME="eight" VALUE=" 8 " Environment as shown in Figure 8.
OnCLick="Calc.Input.value += '8'"> When a window opens, select Project
<INPUT TYPE="button" NAME="nine" VALUE=" 9 " Name, then Application Name and check
OnClick="Calc.Input.value += '9'"> the Android Phone & Tablets box before
<INPUT TYPE="button" NAME="times" VALUE=" x " clicking on Finish.
OnClick="Calc.Input.value += ' * '"> Figure 8: The running app Step 3: Right click on the mohit_
<br> android folder (under the Apps folder); go
<INPUT TYPE="button" NAME="clear" VALUE=" c " to Run and then select Run on Worklight Development Server.
OnClick="Calc.Input.value = ''"> Step 4: After the successful build, right-click on the newly
<INPUT TYPE="button" NAME="zero" VALUE=" 0 " created Mohit_android_AppAndroid (it may be a different
OnClick="Calc.Input.value += '0'"> name, sometimes) Android project. Select Run As > Android
<INPUT TYPE="button" NAME="DoIt" VALUE=" = " Application to launch it on the emulator, and verify if it works.
OnClick="Calc.Input.value = eval(Calc.Input.value)"> Figure 8 shows the app is running successfully.
<INPUT TYPE="button" NAME="div" VALUE=" / "
By: Mohit
OnClick="Calc.Input.value += ' / '">
The author is a certified ethical hacker, EC Council certified
<br>
security analyst and IBM certified mobile application developer
</TD> with a master’s degree in computer science engineering.
</TR> He currently works at IBM India, and can be contacted at
</TABLE> mohitraj.cs@gmail.com and on LinkedIn at: https://www.
linkedin.com/profile/view?id=104187708
</FORM>
This article helps you to start using the Android Open Accessory (AOA) protocol, and also
illustrates how to make use of a simple Linux machine (PC, notebook or any embedded
board) to communicate with Android apps via USB.
T
he Android Open Accessory (AOA) protocol support from Android versions 3.1 onwards, and with an add-
allows simple USB communication with two bulk on library for the Android versions 2.3.4 and above. This was
end points between two nodes, which are: demonstrated with a custom shield on top of an Atmega-based
An external hardware device with USB host Arduino Mega board.
capabilities and peripheral support known as an Later in 2012, version 2.0 of this protocol was released at
Accessory Development Kit (ADK) or Accessory Google I/O 2012 with additional support for communication over
Host, from now onwards. Bluetooth, apart from USB. Also, two new features were added
An Android gadget, which works in device mode. with Audio and Human Interface Devices (HID) capabilities
The ADK host should be capable of supplying 500mA from the ADK side. This was demonstrated with a custom kit
at 5V power to the device. We know that most Android made from the ARM Cortex-m3-based Arduino Due board with
gadgets come with USB device capabilities in order to open hardware specs, popularly known as the ADK 2012 kit.
support data transfer and debugging (adb); so this protocol
chooses external hardware in the host mode and an Android Supporting hardware
machine in device mode. This eliminates the need for host Here is a list of some boards which can act like ADK, with
support on the Android side as very few gadgets come with the availability of sample code or libraries:
such capabilities. Also, there is no need to root the device Arduino Mega board
for any changes to the Android kernel, as peripheral support Arduino Due board
is taken care of by external hardware. AOA kit from Embedded Artists
Microchip PIC24F series MCUs
History Sparkfun IOIO
AOA version 1.0 was launched at Google I/O 2011 with FTDI Vinculum - II
Figure 1: USB modes of an Android device Here, ‘string id’ is a value between 0 to 5, which
represents each type of identity string as listed below.
M
MFSL (Mahindra & Mahindra reduced data rejection, better employee
Financial Services Ltd) has training with consistent processes, easier
adopted MFEKA (Mahindra access to data for quality decisions,
Finance Enterprise Key Access), which is improved relations with business users,
a structured approach to providing easy streamlined administration and optimal
accessibility to all the applications. It focuses trend analysis.
on business, customer, dealer and Intranet- Customer satisfaction: It was
based applications. Due to demanding needs, imperative that customer satisfaction
the complexity of portals and their technical should increase with the process in place.
and functional requirements have increased. Unotech gave the most robust structure
Even though there are tools available to to the system, which made it more user
build simple portals, the challenge lies in friendly and one of the best-in-class
integrating them. One such challenge is communication systems.
with authentication. In this competitive Risk management: Having
environment, it is imperative to have robust standardised procedures across the breadth
processes. To cope up with the ever growing Suresh A Shanamugam is the National of a company helped prevent errors.
number of users and to avoid technical Head of Business Information Technology Accurate information flow was provided.
complexities, MMFSL has always aspired Solutions (BITS) of Mahindra & Mahindra Traceability and due diligence:
Financial Services Limited
for excellence in all its products, services and In a growing business and market, the
processes. Unotech as a vendor began its partnership with solution ensured maintenance of the complete set of records
MMFSL in order to replace its existing mailing platform and to guarantee the delivery of the right information and
was eventually selected to develop the EKA Core Engine. credentials, with full documentation to support it.
The five major pillars on which EKA’S technology had Improved user service delivery: A major impact was seen in
to be designed are: sustainability, reliability, compliance, providing services, with authentic data given via a secured path.
scalability and robustness in the technology used. The Improved TAT: Due to established processes, users
growing business of MMFSL brought along with it more could manage their own approval channels and appropriate
complex rules, and the deployed solution had to be designed communications, leading to accurate TAT governance.
to sustain complex processes. The model preferred in such Well established processes: Common processes for all
a case was to adopt a partner like Unotech, who offered digital approvals helped users to keep up with the solution,
enterprise-ready open source solutions as a service. hence reducing the need for training.
Unotech helps Mahindra & Mahindra Financial Services Securing all requests: A four-layer and a multi-layer
Limited to optimise 87 per cent of its proprietary field force approval channel were established, which further eliminated
solutions. Unotech has also been maintaining the servers and the risks associated with insufficient documentation or vague
the core engine used for EKA, which has gained more than assignment of responsibility/ownership.
1000 million hits since its inception. The solution, with its
dynamic rule & role engine, which is a multi-level approval Unotech Software Pvt Ltd also provides:
engine, has serviced a quarter of a million EKA requests for Single sign-on solutions that can be integrated with
securing and fulfilling compliance needs. It is a single unified proprietary and open source product lines.
repository, resulting in great advantages to administrators An Enterprise Document Management System as a
when maintaining the systems. product line and support services for other open source
In a fast-growing business, there are a lot of factors product lines.
an organisation needs to deal with, and Unotech helped A mailing solution on open source platforms.
MMFSL in the following spheres. Implementation and customisation of enterprise-ready
Efficiency: By controlling critical points in production open source products.
systems, like the authorisation channel and in record- For more details, contact www.unotechsoft.com or info@
keeping, vast improvements were seen in communication, unotechsoft.com
to
An Introduction s and User
se
Haskell claasta
efined D Types
D
Continuing our series on Haskell, this
month, we focus on Haskell classes and
user defined data types.
H
askell is a purely functional programming language x /= y = not (x == y)
and it enforces strictness with the use of types. In x == y = not (x /= y)
this article, we shall explore type classes and user
defined data types. The keyword class is used to define a type class. This
Consider the elem function that takes an element of a type, is followed by the name of the class (starting with a capital
a list, and returns ‘true’ if the element is a member of the list; letter). A type variable (‘a’ here) is written after the class
and if not, it returns ‘false’. For example: name. Two functions are listed in this class for finding if
two values of a type are equal or not. A minimal definition
ghci> 2 `elem` [1, 2, 3] for the two functions is also provided. This code is available
True in libraries/ghc-prim/GHC/Classes.hs in the ghc (Glasgow
ghci> 5 `elem` [1, 2, 3] Haskell Compiler) source code.
False The example works for integers ‘2’ and ‘5’ in the example
above, because they are of type Int, which is an instance of
It’s type signature is shown below: Eq. Its corresponding definition is given below:
The class definition for Enum is given below: ghci> show 3.1415
“3.1415
class Enum a where ghci> show True
succ :: a -> a “True”
pred :: a -> a
toEnum :: Int -> a The above code works for both ‘Float’ and ‘Bool’ because
fromEnum :: a -> Int there are instance definitions for each for the Show type class.
The read function for the ‘Read’ type class takes as input a
enumFrom :: a -> [a] ‘String’ and converts it to an appropriate data type, if possible.
enumFromThen :: a -> a -> [a] For example:
enumFromTo :: a -> a -> [a]
enumFromThenTo :: a -> a -> a -> [a] ghci> read “1” + 2.0
3.0
succ = toEnum . (+ 1) . fromEnum ghci> read “False” || True
pred = toEnum . (subtract 1) . fromEnum True
You will find the class definitions and instances for Show In an equation for `it’: it = read “3”
and Read in libraries/base/GHC/Show.lhs and libraries/base/
GHC/Read.lhs respectively. The .lhs file is a literate Haskell The interpreter does not know what type to convert ‘3’ to,
source file in which you can combine both text and code. and hence you will need to explicitly specify the type:
You can also find the definition for a class, a function or type
inside GHCi using ‘:i’. For example: ghci> read “3” :: Int
3
ghci> :i Eq ghci> read “3” :: Float
class Eq a where 3.0
(==) :: a -> a -> Bool
(/=) :: a -> a -> Bool A type synonym is an alias that you can use for a type.
-- Defined in `GHC.Classes’ ‘String’ in the Haskell platform is an array of characters
instance Eq Integer -- Defined in `integer-gmp:GHC.Integer.Type’ defined using the type keyword:
instance Eq Ordering -- Defined in `GHC.Classes’
instance Eq Int -- Defined in `GHC.Classes’ type String = [Char]
instance Eq Float -- Defined in `GHC.Classes’
instance Eq Double -- Defined in `GHC.Classes’ You can also create a new user data type using the data
instance Eq Char -- Defined in `GHC.Classes’ keyword. Consider a Weekday data type that has the list of the
instance Eq Bool -- Defined in `GHC.Classes’ days in a week:
...
data Weekday = Monday
ghci> :i read | Tuesday
read :: Read a => String -> a -- Defined in `Text.Read’ | Wednesday
| Thursday
ghci> :i Int | Friday
data Int = GHC.Types.I# GHC.Prim.Int# -- Defined in `GHC. | Saturday
Types’ | Sunday
instance Bounded Int -- Defined in `GHC.Enum’
instance Enum Int -- Defined in `GHC.Enum’ The data keyword is followed by the name of the data
instance Eq Int -- Defined in `GHC.Classes’ type, starting with a capital letter. After the ‘equal to’ (‘=’)
instance Integral Int -- Defined in `GHC.Real’ sign, the various value constructors are listed. The different
instance Num Int -- Defined in `GHC.Num’ constructors are separated by a pipe (‘|’) symbol.
instance Ord Int -- Defined in `GHC.Classes’ If you load the above data type in GHCi, you can test the
instance Read Int -- Defined in `GHC.Read’ value constructors:
instance Real Int -- Defined in `GHC.Real’
instance Show Int -- Defined in `GHC.Show’ ghci> :t Monday
Monday :: Weekday
Let’s suppose you input the following in a GHCi prompt:
Each value constructor can have many type values. The user
ghci> read “3” defined data type can also derive from type classes. Since the
primitive data types already derive from the basic type classes,
<interactive>:5:1: the user defined data types can also be derived. Otherwise,
No instance for (Read a0) arising from a use of `read’ you will need to write instance definitions for the same. The
The type variable `a0’ is ambiguous following is an example for a user data type ‘Date’ that derives
Possible fix: add a type signature that fixes these type from the ‘Show’ type class for displaying the date:
variable(s)
Note: there are several potential instances: data Date = Int String Int deriving (Show)
instance Read () -- Defined in `GHC.Read’
instance (Read a, Read b) => Read (a, b) -- Defined in Loading the above in GHCi, you get:
`GHC.Read’
instance (Read a, Read b, Read c) => Read (a, b, c) ghci> Date 3 “September” 2014
-- Defined in `GHC.Read’ Date 3 “September” 2014
...plus 25 others
In the expression: read “3” The above code will work even if we swap the year and
day, because the syntax is correct but the semantics are not! year and day cannot be swapped:
data Date = Date { day :: Int Load the code in GHCi, and run the following:
, month :: String
, year :: Int ghci> show (Date 3 September 2014)
} “3 September 2014”
ghci> show (Date 2014 September 2)
This gives you three helper functions to retrieve the day, “*** Exception: Invalid day
month and year from a ‘Date’.
Suppose you wish to support different Gregorian date
ghci> let d = Date {day = 14, month = “September”, year = formats, you can define a data type ‘GregorianDate’ as follows:
2014}
ghci> day d data GregorianDate = DMY Day Month Year | YMD Year Month Day
14
ghci> month d You can also define your own type classes for functions
“September” that define their own behaviour. For example, if you wish to
dump the output of a date that is separated by dashes, you can
You can also make data type definitions more explicit write a ‘Dashed’ class with a dash function.
with types:
class Dashed a where
data Date = Date Day Month Year deriving (Show) dash :: a -> String
data Month = January Testing the above in GHCi will give the following output:
| February
| March ghci> dash (Date 14 September 2014)
| April “14-September-2014”
| May
| June Haskell allows you to define recursive data types also. A
| July parametrised list is defined as:
| August
| September data List a = Empty | Cons a (List a) deriving (Show)
| October
| November Lists for the above definition can be created in GHCi,
| December using the following commands:
deriving (Show)
ghci> Empty
Loading the above in GHCi, you can use: Empty
ghci> (Cons 3 (Cons 2 (Cons 1 Empty)))
ghci> Date 3 September 2014 (Cons 3 (Cons 2 (Cons 1 Empty)))
Date 3 September 2014
Installing JHBuild
JHBuild helps users by making the installation process much
easier. It needs the Python runtime environment, with version
2.3 as the least recommended.
The recommended way of downloading JHBuild is
via the Git version control system. This can be done
with the following command. It is recommended that
you run the command from a new directory where
G
NOME is one of the leading all the source code will be installed, for example, ~/
open source organisations jhbuild/checkout.
in the world. A lot of
people work for it, fixing bugs, git clone git://git.gnome.org/jhbuild
implementing new features,
etc. Since people use various This will download JHBuild into a new
platforms for this, here’s a simple folder named JHBuild under the current
guide to installing the source code working directory. To build and install JHBuild,
for GNOME on different platforms. use the following commands:
Also learn how you can begin with
your first contribution towards open cd jhbuild
source using GNOME and a few . . . .
of its developer tools. You can ./autogen.sh
contribute to different parts such . . . .
as the GNOME shell, GNOME- make
music, GNOME-games, Evolution, . . . .
Evolution data server, etc. make install
If the above steps complete successfully, a small shell [9] Go to phase “distclean”
script will be installed in ~/.local/bin to start JHBuild. For the choice:
script to run, you need to add ~/.local/bin to the PATH.
It is also possible to build a different set of modules and
PATH = $PATH:~/.local/bin their dependencies by passing the module name as arguments to
the build command. For example, to build gtk+, use:
To permanently add ~/.local/bin to the PATH variable, run
the following command: jhbuild build gtk+
echo ‘PATH = $PATH:~/.local/bin’ >> ~/.bashrc If JHBuild is cancelled half way through a build, it is possible to
resume the build at a particular module using the --start-at option:
JHBuild prerequisites
Before any modules can be built, it is necessary to have jhbuild build --start-at = module-name
certain build tools installed. Common build tools include the
GNU Autotools (autoconf, automake, libtool and gettext), the To build one or more modules, ignoring their dependencies,
GNU toolchain (binutils, gcc, g++), make, pkg-config and JHBuild provides the buildone command. For the buildone command
Python, depending on which modules will be built. JHBuild to complete successfully, all the dependencies must be previously
can check the tools installed using the sanitycheck command: built and installed or provided by the distribution package.
If this command displays any messages, please install the When actively developing a module, you are likely to do so
required packages from the distribution’s repository. A list of in a source working directory. The ‘make’ will invoke the build
package names for different distributions is maintained on the system and install the module. This will be a key part of the
GNOME wiki. Run the sanitycheck command again after installing edit-compile-install-test cycle.
the distribution’s packages to ensure the required tools are present.
jhbuild make
Using JHBuild
After the set-up is complete, JHBuild can be used to build If JHBuild is cancelled half way through a build, it is
software. To build all the modules selected in the ~/.config/ possible to resume the build at a particular module using the
jhbuildrc file, run the following command: --start-at option. To get a list of the modules and dependencies
JHBuild will build and the order in which they will be built, use
jhbuild build the list command:
JHBuild will download, configure, compile and install each jhbuild list
of the modules. If an error occurs at any stage, JHBuild will
present a menu that asks you what needs to be done. The To get information about a particular module, use the info
choices include dropping to a shell to fix the error, rerunning command:
the build from various stages, giving up on the module, or
ignoring the error and continuing. jhbuild info module-name
Note: Giving up a module will cause other modules To download or update all the software sources without
that depend on it to fail. building, use the update command, which provides an
opportunity to modify the sources before building, and can be
Shown below is an example of the menu displayed when useful if Internet bandwidth varies:
you get an error message:
[1] Return phase build jhbuild update
[2] Ignore error and continue to install
[3] Give up on module Later, JHBuild can build everything without downloading or
[4] Start shell updating the sources:
[5] Reload configuration
[6] Go to phase “wipe directory and start over” jhbuild build --no-network
[7] Go to phase “configure”
[8] Go to phase “clean” To run a particular command with the same environment
1+1
global.get_window_actors( )
global.get_window_actors( ).forEach(function
Figure 1: Looking glass (w) {Tweener.addTween(w, {time:3, transition:
‘easeOutQuad’, scale_x: 0.3, scale_y: 0.3 } ) } )
used by JHBuild, use the run command: global.get_window_actors( ).forEach(function (w) {w.set_
scale(1, 1) } )
jhbuild run program global.get_window_actor( ) [0]
it.scale_x
To start a shell with the same environment used by
JHBuild, use the shell command: Special Evaluator features: This last bit deserves more
explanation. One thing about the Evaluator that’s different
jhbuild shell from, say, Python’s default interactive prompt is that each
computed value is saved, by default, and can be referred back
Looking Glass (lg): A developer tool to. Typing ‘r (number)’ will get you back the result with that
Looking Glass (lg) is GNOME Shell’s integrated inspector number, and it is the last result.
tool and JavaScript console, which is useful for debugging. The evaluator also has a history feature; you can press
To access looking glass, type lg in the Alt+F2 prompt. To exit Up and Down to access previously used entries. The history
is automatically saved to the dconf key /apps/gnome-shell / In this command, -a means all the changes. The Git
looking-glass-history, and loaded when you restart the shell. commit command takes you to an editor where you can
Slowing down shell animations: You can use Looking add the commit message. Your commit message should
Glass to call the special function St.set_slow_down_ follow a standard format: a short title, followed by a longer
factor(factor) where ‘factor’ is a value greater than 1 to make explanation, followed by a link to the relevant bug. Your
all shell animations slower. This is particularly useful when commit message should look something like this:
implementing new animation behaviour.
The Picker: The Picker allows you to visually select any Short title describing your changes to the code.
object from the shell’s scene. When you do so, it is inserted as Longer description and explanations if necessary.
a result into the Evaluator pane. Bug link
Getting started with your first contribution Create a patch: To create a patch you need to give the
Now, after building the source code of the particular module, following command:
you can start with your first contribution. This process
basically consists of going through the source code and git format-patch HEAD^
finding that part of the code responsible for the bug. For help,
you can contact the GNOME developers on the IRC. Submit a patch: Send the patch to the project by attaching
it to the relevant bug report in GNOME Bugzilla. Unless
Connecting to the GNOME IRC explicitly stated in the patch file, do not send the patches
If your browser is Mozilla Firefox, then you can install the privately to the maintainer. If your patch is an enhancement
ChatZilla extension for the IRC, which is basically an IRC client and not a bug, you can create a new bug report with severity ->
developed by Mozilla. If you are not interested in using ChatZilla, enhancement. Don’t forget to attach your (Git) patch.
you can try IRCCloud, Mibbit or XChat based on what suits you.
The next step is to connect to the GNOME IRC server. For this, Tips for creating a patch
connect to the GNOME server by using the following command: • In your commit messages, describe both what the patch
does and how it is done, unless the patch is very trivial.
/server irc.gnome.org • Strictly follow the coding style used in the code you are
working on. This may sound trivial, but consistency is very
Once you are connected to their IRC server, you can join a important. Many projects describe the preferred coding
channel where you can get help for the bug. To join a channel, style in the patch file; for other projects, just take a look at
just type: the surrounding code and try to use the same format.
• Avoid unrelated changes. This makes the patch easier to
/join #channel-name read and approve.
• Provide one patch per issue. Do not make big patches that
After you connect to any channel, you can start asking fix unrelated bugs.
questions regarding the bug or about anything else too. • Make sure the patch does not contain trailing
whitespace and spurious empty lines. You can use git
Starting with the first bug fix in GNOME diff --check for this.
Once you are ready with the build, go to Bugzilla to search • Do not compress the patch with gzip or similar tools,
for bugs. As a beginner, it is recommended that you start since it makes reviewing more painful. If the patch is
with minor or trivial bugs. Once you find a bug, just mention big enough to really require compression, chances are
that you are interested in working on this bug in the ‘bug that you need to carefully discuss your patch with the
comments’ section. After some time, you will get that bug maintainer anyway.
assigned to you. Once you are done with selecting a bug, you
can ask for any help regarding the bug in #gnome-love on the References
IRC. After you have fixed the bug, you have to make a patch, [1] https://wiki.gnome.org/GnomeLove/SubmittingPatches
for which you have to use Git. [2] https://wiki.gnome.org/action/show/Projects/Jhbuild
Grails
An Agile and
Friendly Framework
Grails is an open source Web application framework for the Java Virtual Machine. In this article,
the author introduces developers to the ‘holy grail’ in software—the Grails Framework.
I
n the competitive world of start-ups and business you're using another distro, you can easily adapt the following
expansion, a software developer is always hunting for the steps accordingly.
best technology to build applications faster. This article 1. Installing JDK: On Ubuntu, you can type the following
is an introduction to Grails, which according to Wikipedia, command into the terminal to install the JDK.
“… is an open source Web application framework that uses
the Groovy programming language (which is in turn based sudo apt-get install openjdk-6-jdk
on the Java platform).” If you have never worked with
Groovy before, you shouldn't worry because standard Java You can alternatively use the Sun version of Java as well,
language constructs work as is, in Groovy. And if you know but use version 6 of the OpenJDK for maximum compatibility
scripting languages like Python or Ruby, you will find that with Grails.
Groovy is very intuitive and simple to use. Another obvious 2. Installing GVM (Groovy enVironment Manager): The
reason to use Grails is that it provides built-in support for GVM is a command line tool that helps you manage
well-developed Java technologies like Spring and Hibernate, different versions of the SDK on UNIX systems. Using
which makes migrating from a Java stack to Grails a very GVM, you can install multiple versions of Grails and
painless and simple process. Being a Web framework, it uses Switch easily. Let’s install GVM by first using curl
the well-tested MVC design paradigm. Quoting Wikipedia (a UNIX tool used to download files) to get the GVM
again, some of the other key features of Grails is that it offers script and then execute it. So before starting, ensure
documentation for key portions of the framework like: you have curl installed on your system by using the
The Persistence framework following command.
Templates using GSP (Groovy Server Pages)
Dynamic tag libraries for creating Web page components sudo apt-get install curl
Customisable and extensible Ajax support
As a consequence, Grails is one of the most productive After running the above command, you can use the following
amongst frameworks. command to download the GVM script and execute it.
The above command creates an application for you. In our At this point, you can fire up your browser and type that
above example, we used the name ‘test’ for our project. The URL into the URL bar (Pro tip: if you're feeling a bit lazy,
really nifty thing about Grails (or any other Web framework) clicking Control on the link in the terminal will open the link in
is that it provides a boilerplate application, which is ready your default browser).
When you go to the URL, you'll be able to see a page like
the screenshot given in Figure 2, which lists specifics about
various plugins and your application’s configuration details. If
you do see this screen, you've successfully installed Grails for
your development environment.
Warning: The run-app command is intended for
development purposes only. It isn't meant to be used for
production environments. In production, you could use Grails to
build WAR (Web Application Archive) files and then deploy it on
an Apache Tomcat server, for instance, because a lot of possible
optimisations aren't supported by the Grails’ run-app server.
GORM
GORM is Grails' object relational mapping (ORM)
Figure 2: Grails screenshot implementation. Under the hood, it uses Hibernate 3 (a
very popular and flexible open source ORM solution). The next step is to configure the environments variable to
Thanks to the dynamic nature of Groovy, with its use test_dev for development and test_prod for production.
static and dynamic typing, along with the convention Edit your environment’s variable as shown in the code
of Grails, there is much less configuration involved in snippet below.
creating Grails domain classes. While this is a topic
that requires a separate article and a lot of practice, I environments {
will try to cover the main points about GORM. Grails development {
is known as a domain driven language, which means dataSource {
that an application can be built in a bottom-up manner. dbCreate = "create-drop" // one of 'create',
Domain classes are the core of any business application. 'create-drop', 'update', 'validate', ''
They can be linked together through relationships which url = "jdbc:mysql://localhost/test_dev”
can be one-to-one, one-to-many or many-to-many. By username = "root"
default, Grails applications are configured to use an in- password = "root"
memory database called HSQLDB. For the purposes of }
this tutorial, I will walk you through setting up MySQL. }
To do so, follow the steps listed below. test {
dataSource {
1. Creating a database in MySQL: Use the following dbCreate = "update"
command in MySQL to create a database. url = "jdbc:mysql://localhost/test_prod"
username = "root"
CREATE DATABASE test_prod password = "root"
}
This will create a database called test_prod, which }
we will use in production. Additionally, we can create a production {
database called test_dev, which can be used in development dataSource {
mode for testing our application. dbCreate = "update"
2. Updating the BuildConfig.groovy file in grails-app/ url = "jdbc:mysql://localhost/test_prod"
conf: We do this to tell Grails that our application needs username = "root"
to use the MySQL connector, so we need to add that password = "root"
as a dependency to our application. All dependencies }
must be specified in this file. When your application is }
run, all dependencies specified here are automatically }
downloaded and installed so that your application can
use them. Open up the BuildConfig file located in the dbCreate deserves a special mention. It determines
grails-app/conf folder and find the line... what happens to your database between server restarts. For
example, a value of create-drop means that the database
// runtime 'mysql:mysql-connector-java:5.1.24' tables will be dropped and then recreated when you start the
server, so you lose any data that was in there. This is fine for
...and uncomment it. The complete BuildConfig file testing, but is definitely not what you want in production.
can be downloaded from http://www.opensourceforu.com/ 4. Creating a new domain class: We're done with setting
article_source_code/sept14/grails.zip up Grails to use MySQL; so now we can simply create
3. Updating DataSource.groovy in grails-app/conf: a domain class which will be persisted in our database.
After setting up the dependencies, we must set up our Let’s create a domain class that represents a user of our
application to use certain data sources. In our project, application, using the following command.
we'd like it to use our test_dev for development
purposes and test_prod for production. First, we must grails create-domain-class test.User
edit the DataSource variable so that it knows how to
use the InnoDB engine, as follows: After this, Grails will tell you that it created a few files.
Let’s now edit Grails app/domain/test/User.groovy file to
dataSource { store the information of our users. The following is the
pooled = true edited User.groovy file.
driverClassName = "com.mysql.jdbc.Driver"
dialect = "org.hibernate.dialect.MySQL5InnoDBDialect" package test
}
grails run-app
package test
class UserController {
def scaffold = User
def index() { }
} Figure 5: New controller added to Grails
Password * HelloWorld
folder. Controllers go into the Controller folder.
10. The naming convention: All models, services,
Create
controllers and scripts should be named consistently.
Figure 6: Create User screenshot
In our example application, we had a model
named ‘User’; hence, our controller was named
‘UserController’. Grails will link them based on the
naming convention.
With Grails, we can develop applications quickly and in
an agile manner. Since it is based on well tested paradigms
like ‘Convention over configuration’ and DRY, Grails
provides a robust platform for development. In a world
where developers race against the clock to meet vicious
Figure 7: MySQL query output deadlines, having a framework which provides so many
built-in features makes Grails an invaluable tool.
application rather than using the ‘install-plugin’ command.
5. Keep your view simple: Make your views as simple By: Sahil Chelaramani
as possible.
The author is a software developer at a reputed start-up in
6. Use layouts: Use a layout for a consistent look across your UI. Bengaluru. He loves to code.
7. DRY: Keep your views DRY (‘Don't repeat yourself’).
www.eb.efyindia.com www.OpenSourceForU.com
Clo ure
The flexibility and simplicity offered by this programming language, which is hosted on
the Java Virtual Machine, is bound to make it very popular among developers.
C
lojure is a dynamically and strongly typed between state and identity, and help provide defined
programming language, created by Rich Hickey concurrency semantics to manual threading and locking
and hosted on the Java Virtual Machine. It was strategies.
formed by incorporating the finest features of a variety of It is very efficient when it comes to programming to small
programming languages, such as Python, Java, Haskell, interfaces.
etc. Clojure helps eliminate various issues faced by the Clojure is dynamically and strongly typed but when
programmer, while setting them right for the future. Hickey it comes to compiling, it's compiled to Java method
developed Clojure because he felt the need to develop a invocations, which makes it fast.
modern LISP for functional programming. The simple It offers a safe and simple method to handle mutability.
syntax that it has makes meta programming through macros The manner in which it models data makes it easy to
extremely simple. work on.
The REPL in Clojure has no runtime penalty and, hence,
Why Clojure? is faster in comparison to its counterparts.
The best part about Clojure is that it is hosted on JVM, which
has an efficient runtime environment. Hence, it would be Setting up Clojure
better to choose Clojure rather than select a completely new We need not install Clojure as such, but we need a build tool
language and work in a completely new environment. The capable of managing dependencies. The most recommended
other reasons to choose Clojure include: build tool is leningen. By following the steps mentioned
The great flexibility and strong metaprogramming below, you can easily set up leningen:
facilities it has, due to its LISP origins. 1. Confirm that you have a Java development kit (JDK)
The remarkable concurrency and parallelism semantics version 6 or higher.
that it provides. 2. Download the lein script from the most stable version of
The presence of persistent data structures whose the project. (Refer leningen.org for more information)
performance puts even the mutable data structures to 3. Place it in your $PATH.
shame. 4. Make it executable.
It's very useful when it comes to dealing with large 5. Run it.
amounts of data, because of which it is extensively used
in data mining and large scale predictions. A few simple programs in Clojure
Clojure's reference types ensure a clear separation Here, let’s look at two simple examples.
Figure 1: What a REPL for Clojure looks like Data structures in Clojure
Maps, vectors, sets and lists are the basic data structures
1. Hello world that Clojure provides; the other data structures are present in
Clojure collection hashes, StructMaps, ArrayMaps, etc.
Type the following command in a terminal: In Clojure, there are seven primary abstractions whose
data structures are as follows.
$ lein repl 1. Collection: All data structures in Clojure follow the
common collection abstraction. A collection is a value that
You'll get something similar to what is shown in Figure 1. you can use with the set of core collection functions.
Now type the following command and press Enter. Notice * conj is used to add an item to a collection:
how it's similar to the System.out.println familiar to all in Java.
user=> (conj '(237 4 2) 5)
user=> (println “Hello World!”) (5 237 4 2)
2. Sequence: The sequence abstraction shows a way for 4. Indexed: The index abstraction here is similar to the
traversal on sequential views over some set of values one in C++. The index can be given to access an element
—either another collection or values that are the result present at that specific position. There is only one function
of some calculation. There are a few operations that here, nth, which acts like the get function and returns the
sequences undergo: element at the nth position. There are also exceptions to
seq produces a sequence over its argument. check the out-of-bounds condition.
The first, next and rest of the keywords help make
traversal through the seq an easy task.
user=> (def S '[1 2 3 4 5])
user=> (def a (seq '(1 2 3 4 5 6 7))) #'user/S
#'user/a user=> (nth a 2)
user=> (first a) 3
1
user=>(rest a) 5. Stack: Clojure does not have a stack data structure as
(2 3 4 5 6 7) such, but we can use lists and vectors to realise this data
structure. The three main operations here are:
It is possible for the contents of a sequence to be conj, to add an element to the top of the stack:
evaluated at leisure, where values are computed and
produced only when a user tries to access it. user=> (def stack '(5 4 3 2 1))
3. Associative: The associative abstraction is found in all #'user/stack
data structures that map keys to certain values in some user=> (conj stack 6)
way; so, it is mostly seen in various kinds of maps. It (6 5 4 3 2 1)
has four operations:
assoc, through which connections are made between a pop, to remove the element present at the top of the stack:
key and its value:
user=> (def stack '(5 4 3 2 1 ))
user=> (def S {:a 10 :b 20 :c 30}) #'user/stack
#'user/S user=> (pop stack )
user=> (assoc S :d 40) {4 3 2 1}
{:a 10 :b 20 :c 30 :d 40}
peek, for obtaining the value on the top of the stack:
dissoc, which cuts off the connections between a key
and its value: user=> (def stack '(5 4 3 2 1))
#'user/stack
user=> (def S {:a 10 :b 20 :c 30}) user=> (peek stack)
#'user/S 5
user=> (dissoc S :a )
{:b 20 :c 30} 6. Set: The set abstraction is technically a reusing of the
functions in a collection as well as associative semantics.
get, which searches the value for a specific key in the The clojure.set namespace provides a number of functions
collection: that can be performed on a set, including subset?,
superset?, union, etc.
user=> (def S {:a 10 :b 20 :c 30})
#'user/S user=> (require '[clojure.set :as t])
user=> (get S :a) nil
10 user=> (def a '[1 2 3 4 5 6 7 8])
#'user/a
contains?, which checks if a key has a specific value user=>(def b '[1 2 3])
and returns true if it does: #'user/b
user=>(t/subset? b a)
user=> (def S {:a 10 :b 20 :c 30}) true
#'user/S user=>(t/superset? a b)
user=> (contains? S :a ) true
true Continued on page no 68...
some are GSM-based, while others use less common network URL: http://www.appium.io
standards like FOMA and TD-SCDMA. Each network Robotium: Robotium is the Android test automation
operator uses a different kind of network infrastructure and framework that offers full support for native and hybrid
this limits the flow of information. applications. Robotium makes it easy for engineers to
Scripting: The variety of devices being used makes write powerful and robust automatic black-box UI tests for
executing the test script (scripting) a key challenge. As Android applications. With the use of Robotium, the test case
devices differ in keystrokes, input methods, menu structure developers can write function, system and user acceptance
and display properties, a single script does not function on test scenarios, spanning multiple Android activities.
every device. The following are the features of Robotium:
It can test any type of Android app - native and hybrid.
Mobile application testing tools Detailed knowledge of the application under test is
Using specific as well as specialised tools, mobile apps can be not required.
tested on multiple parameters and dimensions. The framework handles multiple activities of Android
automatically.
iPhone Less time consuming when writing solid and complex
The following tools can be downloaded and used to test test cases.
mobile applications that run on the iPhone. Readability of test cases is greatly improved, compared to
Clang Static Analyzer: URL: http://clang-analyzer.llvm.org standard instrumentation tests.
XCode: URL: https://developer.apple.com/library/ Test cases are more efficient and robust due to the run-
prerelease/ios/documentation/ToolsLanguages/Conceptual/ time binding to UI components.
Xcode_Overview/UnitTestYourApp/UnitTestYourApp.html Speedy and accurate test case execution.
Integrates easily with Maven, Gradle or Ant to run tests as
Android part of continuous integration.
A wide range of tools can be downloaded and used for testing URL: https://code.google.com/p/robotium
mobile applications that run on Android. Some of these are MonkeyRunner: This tool provides an API for writing
listed here. the programs that can control the Android device or emulator.
Android Lint: This is integrated with the Eclipse IDE for Using MonkeyRunner, the test engineer can write a Python
Android app testing. This software highlights the potential program that installs an Android application or test package,
bugs and performance problems in the app. The Android Lint runs it, sends keystrokes, takes screenshots of its GUI, and
tool is a static code analysis tool that checks the Android stores the screenshots on the workstation.
project source files for potential bugs. It also optimises The MonkeyRunner tool was developed primarily to test
and improves the app’s performance, usability, security, applications and devices at the functional or framework level
accessibility and internationalisation features. and to run unit test suites, but test engineers are free to use it
URL: http://developer.android.com/tools/help/lint.html for other purposes.
FindBugs: This is an open source code library for static This software allows test engineers to perform functional
analysis. It is a special plugin for Android-specific coding, app testing by providing the API for managing the device.
and is a static code analysis tool for finding bugs in standard MonkeyRunner makes use of Jython, an implementation of
Java programs. Python that uses the Java programming language. Jython
URL: https://code.google.com/p/findbugs-for-android allows the MonkeyRunner API to interact directly and easily
Appium: Appium is an open source test automation with the Android framework. With the use of Jython, the
framework for use with native and hybrid mobile apps. test engineer can use Python syntax to access the constants,
It works for iOS and Android apps using the WebDriver classes, and methods of the API.
JSON wire protocol. Appium is cross-platform and allows MonkeyRunner does not have advanced features like
the writing of tests for multiple platforms (iOS, Android) Robotium. The tool has three modules:
using the same API. It enables code to be reused between MonkeyRunner, to manage connections to the devices.
iOS and Android test suites. It allows users to create test scripts with Python or just
Native apps are those written using the iOS or Android record and play them.
SDKs. Mobile Web apps are those accessed using a mobile MonkeyDevice, to manage apps and events.
browser (Appium supports Safari on iOS and Chrome, or MonkeyImage, to gather screenshots for advanced test
the built-in ‘Browser' app on Android). Hybrid apps have a reporting.
wrapper around a ‘webview’—a native control that enables The MonkeyRunner tool provides the following unique
interaction with Web content. Projects like Phonegap make features for Android testing:
it easy to build apps using Web technologies that are then Multiple device control: The MonkeyRunner API can
bundled into a native wrapper, creating a hybrid app. apply one or more test suites across multiple devices or
emulators. Test engineers can attach all the devices or start for automating GUI testing. It is an open cross-platform
up all the emulators at once, connect to each one, in turn, visual platform for creating the scripts, and is oriented
programmatically, and then run one or more tests. They can towards programming the graphic interface with the help of
also start up the emulator configuration programmatically, images or screenshots. Sikuli is a tool that can supplement
run one or more tests, and shut down the emulator. the testing toolbox. The scripts the test engineer creates
Functional testing: The MonkeyRunner software can execute with this tool are in the Sikuli Script language, which has a
an automated start-to-finish test of any Android application. Python (Jython) extension.
Test engineers can provide the input values with keystrokes URL: http://www.sikuli.org
or touch events, and view the results as screenshots. Calabash: Calabash enables test engineers to write and
Regression testing: The software can test the app’s stability execute automated acceptance tests for mobile apps. It is
by executing an app and comparing its output screenshots cross-platform, and supports Android and iOS native apps.
to a set of screenshots that are known to be correct. Calabash is free, being distributed as open source software,
Extensible automation: As MonkeyRunner is an API toolkit, with the company Xamarin backing and developing it.
test engineers can develop an entire system of Python-based URL: http://calaba.sh
modules and programs for controlling Android devices.
Besides using the MonkeyRunner API itself, engineers can By: Dr Gaurav Kumar
use the standard Python OS and sub-process modules to call The author is the MD of Magma Research & Consultancy Pvt
Android tools such as Android Debug Bridge. Ltd, Ambala. He is associated with a number of academic
URL: http://developer.android.com/tools/help/ institutes, and delivers lectures and conducts technical
monkeyrunner_concepts.html workshops on the latest technologies and tools. E-mail:
kumargaurav.in@gmail.com
Sikuli: This is another open source tool that is used
user=>(t/union a '[9 10 11]) options for anyone who wishes to work on it.
[1 2 3 4 5 6 7 8 9 10 11] ClojureScript: ClojureScript (github.com/clojure/
clojurescript) is mainly targeted at JavaScript (technically,
7. Sorted: Collections that follow sorted abstraction are ECMAScript 3), and therefore produces code that can
assured that their elements will be sorted. Only maps and be run in all the latest browsers, as well as in other
sets are available in the sorted variant. The main functions environments that execute JavaScript such as Node.js,
here are as follows. CoffeeScript, etc. There is a big difference between Clojure
rseq, which returns the sequence in the reverse order: and ClojureScript. This is not only because there is a major
difference between the hosts for JavaScript and the JVM,
user=> (vec (range 16)) but also due to the fact that ClojureScript is a source-to-
[0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16] source compilation. An overview of the differences between
user=> (rseq (vec (range 16))) Clojure and ClojureScript is available at github.com/clojure/
(15 14 13 12 11 10 9 8 7 6 5 4 3 2 1) clojurescript/wiki/Differences-from-Clojure.
Though Clojure has not reached its zenith of success and
subseq, which returns a subseq that's in a particular order: popularity yet, it's pretty certain that it will do so in a couple
of years. Many of the core companies have started adding
user=> (subseq (sorted-set 1 2 3 4 5 6 7 8) > 4) Clojure to the pre-requisites candidates need to have when it
( 5 6 7 8) comes to recruiting. So, we can say with certainty that Clojure
is indeed the future.
rsubseq, which is the same as subseq, but in reverse order:
References
user=>(rsubseq (sorted-set 10 20 30 40 50) < 29) [1] clojure.org
(20 10) [2] stackoverflow.com3.
[3] ‘Clojure in Action’ by Amit Rathore
[4] ‘Clojure Programming’ by Chas Emerick, Brian Carper
What next? and Christophe Grand
ClojureCLR: ClojureCLR1 is a port of Clojure to the .NET
CLR. It is not a simple cross-compilation; rather, it is maintained
By: Aravind K
separately and aims at providing the same level of usability for
CLR as it provides for JVM. Even though ClojureCLR is not The author is an open source enthusiast and is a contributor to
Mediawiki and Clojure. You can reach him at aravikn@gmail.com
as widely used as Clojure, it's well-tested and provides a lot of
There are several ways to send bulk mail that’s not treated as spam. The easiest way is to sign
up for a service like Mailchimp. However, there is a great thrill in setting up your own bulk
mailing infrastructure, which is what this article is about.
M
ost organisations would like to engage with their $wget http://downloads.sourceforge.net/project/phplist/
customers or the community by sending out regular phplist/3.0.6/phplist-3.0.6.tgz?r=http%3A%2F%2Fwww.phplist.
product updates. As the volume of emails sent com%2Fdownload&ts=1403941429&use_mirror=jaist
grows, over-aggressive filters at the receiving end are likely
to flag these emails as ‘Spam’ and trash them, often without It’s a long URL, so rather than typing it, you can copy the
informing the sender of this action. As a consequence of this, URL from the direct link that appears when you download
the reputation of the organisation's domain may get tarnished, PHPList from Sourceforge. Alternatively, you can download
resulting in the domain being listed on one of the several it to your laptop and then upload it to your server, though I
online blacklists like Spamhaus. wouldn't recommend it.
To set up your own bulk mailing infrastructure, let’s Unpack the archive in your HOME folder. This should
assume that you have access to the command line, ideally on a create a directory called phplist-3.0.6. This directory has a
VPS or dedicated server. I have used a Centos 6.4 VPS, so the sub-directory called public_html/lists which contains the
commands are for Centos, but Ubuntu users can easily adapt files that are required to run PHPList; the rest of the files are
the steps. First, here’s an inventory of the things we need. not required for PHPList to work. However, we'll let these
A VPS or bare metal machine connected to the Internet files remain.
PHPList
MySQL $tar -zxvf phplist-3.0.6.tgz
A registered domain with access to change the DNS zone
entries MySQL
Now, let’s create a database for PHPList. Most Linux
PHPList distributions have MySQL installed by default. To check if
PHPList is a popular open source newsletter manager written MySQL is installed, type the following in your CLI:
in PHP. Let’s use this to set up our bulk mailing infrastructure
to manage our subscription lists. So get started and download $ mysql -V
the required files like the PHPlist TGZ from http://www. mysql Ver 14.14 Distrib 5.1.69, for redhat-linux-gnu (i386)
phplist.com into your home directory. using readline 5.1
nano phplist-3.0.6/public_html/lists/config/config.php
# what is the name of the database we are using Figure 2: Installing the database
$database_name = "phplist";
PHPList will be installed within a few seconds (Figure 2). Do
# what user has access to this database the developers a favour and tell them that you have installed
$database_user = "your username"; PHPList by clicking the ‘Tell us about it’ button. Then click
‘phpList Setup’ to continue with the installation.
# and what is the password to login to control the database Click on Verify settings. Use admin for the login name and
$database_password = 'your password'; the password you provided during the installation in order to
log in. Let’s not change any other settings, for now.
# if test is true (not 0) it will not actually send ANY Click the Configure attributes. PHPList has a set of default
messages, but display what it would have sent lists that can be used while creating newsletters. We'll load
# this is here, to make sure you edited the config file and the following by clicking the Predefined Defaults and then
mails are not sent "accidentally" clicking Countries in the world and States in India. Then click
# on unmanaged systems on the Add button.
define ("TEST",0); Having done this, let’s create a Subscribe page. Click on
Create subscribe page and create a page to subscribe to your
DNS entries newsletter (Figure 3).
Now, set up a domain (www.yourdomain.in) and point the Let’s now add some subscribers to our list. Just copy and
A record to your IP address. Set up your Apache or NGINX paste a few emails in the box, click the Import button and you
server virtual host document root to point to the directory are done (Figure 4).
phplist-3.0.6/public_html/ and restart your server. (The Before we send out campaign mails, we should set a
Apache configuration files are available in /etc/httpd/conf.d few domain entries. This is to ensure that our bulk mails are
and those of Nginx are available under /etc/nginx/conf.d) not flagged as spam at the receiving end. For this, we have
to follow some of the best practices as espoused by large
PHPList configuration webmail providers like Gmail.
Fire up your browser and visit http://www.yourdomain.in/
admin. You should see the PHPList dashboard (Figure 1). Finalise an IP address
Click the initial database link and follow the instructions. The first step is to finalise the IP address for your PHPList. If
type of email, so that when recipients respond to your mail by Ensure that you change the ownership of the key:
hitting the ‘Reply to' button on their email clients, they land in
the boxes designated for them. $mv default.private /etc/opendkim/keys/.
$chown opendkim /etc/opendkim/keys/default.private
Publish the SPF and PTR records
An SPF or Sender Policy Framework specifies which We need to instruct Opendkim to use the KeyTable
servers can send emails to ‘yourdomain.com’. In most file. So, open the DKIM configuration file and look for the
cases, an SPF record is created by your hosting providers following line and uncomment it:
but for the sake of this article, let's create one for our bulk
email server. KeyTable /etc/opendkim/KeyTable
yourdomain.com. IN TXT "v=spf1 a mx ptr -all" Create an entry in the KeyTable by editing the file using
Nano or any other editor. The domain key should be as
The v=spf1 is the version specification for the SPF shown below:
being used. ‘a' means that the IP address of yourdomain.
com is allowed to send emails while ‘mx’ means that $nano /etc/opendkim/KeyTable
even the ‘mx’ servers can send email. You can also
specify a different server for ‘mx’ by mentioning default._domainkey.sastratechnologies.in sastratechnologies.
‘mx:sastratechnologies.com’. The PTR mechanism means in:default:/etc/opendkim/keys/default.private
that if a host has a PTR record ending with mydomain.com,
then it can send email. Create a TXT record in your DNS Zone file, where you
set the HOST to default_domainkey and the value to the key
Sign with DKIM using a key that’s value. It should look something like what follows:
less than 1624 bits
DKIM stands for ‘Domain Key Identified Mail’. It v=DKIM1; g=*; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBg
provides a method for validating a domain name identity QDrwLEIYP2BAC53zzJn3WPnC9oD
that is associated with the message through cryptographic Mq0l+b+zs5O2FtjXVqi0+Fs4gMLJDCdltOHpLU2hoPXpnyTFmi2/
authentication. We'll use ‘Opendkim Milter’ to sign our lwsF9KXS6MLt
outgoing email. dy/XpiwaXYbi+Zw68PMWhougUomF/XOkY0j2yTHF/9M+ZI0RVmR6eGWLWtB
PHPList is an email generator and Opendkim is a milter yjO7Y
or a mailfilter! The two must be bridged by an MTA or Mail Y7ED+lYOfRCYqLq57wIDAQAB
Transfer Agent. Most distributions of Linux have Sendmail
installed. We'll cover the process of installing DKIM and …where ‘p’ is the value of the public key that we
configuring Sendmail to use the DKIM milter. The process is generated, i.e., default.public
similar to using Postfix as your MTA. Now instruct Sendmail to use DKIM by editing submit.mc
Install Opendkim by using the following command: and adding the following line:
non-intended recipients of your bulk mail to report abuse. To Send confirmation messages to subscribers
do that, send an email (TXT, not HTML) to update@abuse. that offer a facility to unsubscribe
net. Ideally, you should list the email address that recipients Periodically, send a summary mail of the newsletter
will use to report abuse, and the email should look similar to subscriptions and allow the recipient to unsubscribe by
the following: clicking a link from within this email.
sastratechnologies.com: abuse@sastratechnologies.com
Ensure that your contact information on WHOIS is up to Have an email ID for people to report abuse
date. You can do this via your domain registrar. Earlier in this article we created an email ID for abuse
This apart, there are certain last minute details that you reporting and listed it on abuse.net. So do ensure that this
should look into before you send your first email newsletter. email ID is monitored and any reports of abuse are dealt
For starters, make changes to the email text body, as with appropriately.
follows.
Use the precedence:bulk header field
Include a link to add the address in Though some people advocate the usage of a ‘precedence:
the address book bulk’ field in the header of your email messages, we have
Your email text body should have a link telling subscribers seen very few organisations use it. The Huffington Post sets
to add the sender ID to their address book, especially on a ‘precedence: bulk’ in its daily briefs but several others
public mail servers like Gmail and Yahoo. If the sender’s don't.
address is in your address book, the incoming mail is not RFC is the ‘Request For Change’, a mechanism by
classified as spam. which users request for changes in programs. The RFC 2076
deals with common Internet message headers and explains
Include an explanatory message in great detail the commonly occurring headers in email
At the bottom of the page, include a line to mention why the messages. It discourages the use of the precedence header,
recipient is receiving this email. Figure 5 gives an example of as many recipient servers will just filter that off.
a large online retailer using such a message in the footer of its
bulk email. Send your first newsletter
Now that you are set, create your first email campaign.
Include a link to unsubscribe Ensure that you include everything mentioned above in your
Include a link, which when clicked on, unsubscribes the email, and then send it out to a close circle of friends. Enjoy
recipient from the list. the response you receive!
H
opefully, readers have learnt from and enjoyed the • Ethernet device driver
earlier articles in this series on Wireshark, which • Presence of worms (a type of malware which generates a
started in July 2014. The articles included discussions lot of network traffic)
on various important and interesting Wireshark features and • Insufficiently configured computer hardware
various protocols such as ARP and DHCP, capturing packets • Too many downloads initiated from a single system or network
in a switched environment, detecting an ARP spoofing attack, • All systems scheduled to update the anti-virus or the
etc. This article will discuss how to put Wireshark to use operating system simultaneously
when troubleshooting ‘slow network’ problems. • Simultaneous use of ERP software during a particular time
Computer users often say, “The network is slow” or “The To arrive at the correct troubleshooting approaches,
Internet is working very slowly.” Field engineers trying to consider the fundamental basis of networking –- the OSI/
troubleshoot such problems face an uphill task; first, to figure TCP–IP layers. I assume that readers are knowledgeable
out what exactly a ‘slow network’ means and further, to about them - a lot of excellent information is also available
locate and solve the actual problem. There are just too many on the Internet. Still, let me describe these layers in brief for
different aspects and variables to check. relevance and immediate reference.
The actual reasons for slow network speeds could be OSI layers separate network communication into seven
broadly classified as follows. different layers, each offering its services to its immediate
Network related issues: upper and lower layer. This enables structured and standardised
• Slow Internet bandwidth available from the ISP, communication between systems. The OSI model does not
especially in shared connections require presence of each one of these seven layers. Also,
• A faulty Ethernet switch multiple adjacent layers could be combined to form one layer.
• A fault in the Ethernet interface on the switch As of today, the most widely used model is TCP/IP, which has
• A defective Ethernet card on a computer system or device four layers. Do go through Table 1, which describes the four
in the network TCP/IP layers, their functions and corresponding OSI layer(s).
• The presence of electrical noise in the vicinity of the These OSI and TCP-IP layers are important from
network’s cabling troubleshooting perspective—depending upon the situation,
Problems linked to the operating system, drivers and one may use these layers as guidelines when selecting a
everything else: particular approach while troubleshooting.
The top down approach: The diagnosis starts from the switches always stabilises the network, but after a random
the operating system, device drivers, anti- virus software period of time, the problem reappears. To sum it up, the
and application software, before going down towards the problem reported was actually the non-functioning of the entire
network access layer. LAN and was not limited to just “the Internet is not working.”
The bottom up approach: In this case, troubleshooting The best approach to troubleshooting in this case would
starts from the Ethernet media (cabling), Ethernet card, MAC have been to use Wireshark if managed Ethernet switches with
address and IP address before moving up the layers towards a SPAN port (port mirroring) were available. With the help of a
the application layer. In short, this approach involves starting SPAN port, traffic from all the other ports on that switch could
by locating faults in the network infrastructure before moving be copied to one port. A system with Wireshark connected
up to the application layer. on this SPAN port would capture the entire switch traffic. An
Before deciding upon the approach and starting the actual analysis of this would lead to the faulty component or system
tests or hands-on diagnosis, discuss the problem with the end being detected. However, on this site, managed switches were
user or site engineer (if any). For example, when the problem not available; hence a different approach was followed:
of a slow network is reported, the actual problem could be 1. First, the stacking of the switches was disconnected.
non-accessibility (or slow speed) of a particular service (say, 2. Then, the Ping command was used continuously from one
FTP). Here, you can certainly select the top down approach server to the default gateway.
and proceed. As you troubleshoot more and more problems, 3. The stacking cables were connected, one by one.
you will develop ‘troubleshooting insight’, which helps to When one of the switches was stacked, the Ping response
take the correct approach and locate the exact problem in the started slowing down—thus the faulty switch was isolated
shortest possible time. quickly. Proceeding further, to confirm the diagnosis, the
This article describes three real-life network faulty switch was replaced using an additional switch; but,
troubleshooting scenarios. These will definitely be interesting, unfortunately, the problem reappeared. So the fault was not
readily applicable and helpful during day-to-day network with the switch. Troubleshooting continued further:
diagnostics, especially for field engineers. 4. All Ethernet cables from the switch located in Step 3 were
removed.
Scenario 1: The Internet is not working 5. One cable at a time was plugged – till the problem appeared.
The network setup had approximately 75 computer systems 6. The computer system/device (which had a faulty Ethernet
spread across four floors in one building. The server room card!) with a slow Internet speed was isolated.
was located on the second floor, which housed the networking
rack, the firewall, the router for Internet connectivity and the Scenario 2: Slow Internet speed
servers. Cabling was structured with patch panels in the rack The set-up had 10 computer systems connected to the Internet
and information outlets at the user end. Cables and passive using the GNU-based IPCop firewall via a DSL connection.
network components were of a reputed brand. The network Discussions with the systems administrator revealed that the
installation was approximately four years old. A total of LAN speed was perfect; however, the Internet speed was very
six 10/100MBps unmanaged Ethernet switches were used. slow. Trials had already been conducted to bypass the firewall by
Out of them, one switch connected all the servers and the connecting one laptop directly to the DSL connection. Here, the
remaining connected systems were located on various floors. Internet speed available for one PC was satisfactory.
Site inspection revealed that the cabling was done as per the The discussions clearly revealed that the issue arose only when
industry’s best practices—with numbering at both ends, cable the office computer systems were trying to access the Internet. So,
bend radius guidelines being followed, and patch cable being the following steps were taken to isolate the problem:
used at both the ends. (a) The firewall was the first suspect – a firewall installed on
Detailed discussions with the administrator revealed a very a PC, and that too, with GNU? It must be the culprit! But
interesting problem. First, the Internet stops functioning, then bypassing it did not resolve the problem. Internet speed
the network goes on becoming slower and slower, and finally, continued to be slow.
it comes to a complete halt. Even local copying of files and (b) Next, the possibility of a virus was explored.
accessing computer systems becomes impossible. The problem (c) To capture complete network traffic, the Ethernet switch
is random in nature and has developed gradually. Rebooting was replaced with an Ethernet hub (remember that
Table 1: TCP/IP layers, their functions and corresponding OSI layers
TCP/IP layers Function Corresponding OSI layer(s)
Application layer Interacts with actual applications such as http, ftp, etc. Application + presentation + session
Transport layer Defines TCP/UDP protocols Transport
Internet layer Understands IP addresses Network
Network access layer Incorporates media and MAC addresses Physical + data link
OpenSourceForU.com
Follow us on Twitter@LinuxForYou
Use
for an Extraordinary Surveying
L
imeSurvey helps to set up surveys or questionnaires
with a click of the mouse and the minimum of
technical knowledge. According to Wikipedia,
LimeSurvey “…is a Web server-based software. It enables
users to develop and publish online surveys and collect
responses, without doing any programming.” It is written
in PHP and requires a database (MySQL, PostgreSQL,
etc) to function. LimeSurvey was initiated by Carsten
Schmitz, and is now available in its stable release 2.05
under the GNU General Public License. MS SQL is required. To set up a basic working environment,
I would recommend installing the WAMP server on your
Striking features machine, which is a complete development environment for
LimeSurvey offers exceptionally good features. As a Web applications and hence includes Web server (Apache)
surveying tool, it has everything that you’ll ever want. and database applications (MySQL).
Here are some of the features provided by LimeSurvey: You can download WAMP from
Multiple surveys at a time http://sourceforge.net/projects/wampserver/files/
No limit to the number of questions WampServer%202/WampServer%202.0/WampServer2.0i.exe/
Grouping of questions download
20+ types of questions Make sure that after the installation of the WAMP server,
User profile management you have the directory c:\wamp and the access to it. I am
Unlimited participants assuming that you have a working WAMP server installed.
Support for 70+ languages
Token-based survey participation Installation
Support for printer-friendly version of surveys Download the latest stable release of the LimeSurvey
The capability to add images in surveys from the following link: http://www.limesurvey.org/en/
Multiple themes and support for WYSIWYG HTML stable-release
Editor Unzip the contents of the .zip file you downloaded, to the
folder C:\wamp\www\LimeSurvey.
Pre-requisites The installation part is done. Just start the WAMP server
LimeSurvey is compatible with Linux-based systems (Start menu->start wampserver).
as well as with Microsoft Windows platforms. For this Using any Web browser, go to http://localhost/ and
article, I will demonstrate a Windows installation to LimeSurvey should be listed under Your Projects.
keep things simple. LimeSurvey is server-based software On its first run, LimeSurvey needs certain parameters to
and hence requires a Web server to run on the hosting be set up. Follow the steps shown below:
machine. Also, a database like MySQL, PostgreSQL or Go to http://localhost/LimeSurvey, which will open up
Managing conditions
LimeSurvey is capable of arranging dynamic or intelligent
surveys. Conditions are used to determine whether a question
will show up or not. Every question can be made to appear
when it satisfies all its prior conditions.
Exporting responses
LimeSurvey allows the administrator to get responses in one
place by providing support for exporting the responses in
formats that those in the industry are familiar with. Responses
of LimeSurvey can be exported in the following formats:
Figure 2: Preinstallation check CSV
Microsoft Excel sheets
a welcome screen. Choose the language you want to PDF
continue in and click Start Installation. HTML
On clicking ‘Accept’ in relation to the terms of the GNU Microsoft Word documents
General Public License, a pre-installation check will be
performed. This should be all green if the WAMP server Analysis of responses
was installed successfully. If the Next button appears, LimeSurvey also provides ways of analysing all your responses
it means you have met the requirements; otherwise, and viewing graphs. It allows users to see which options have
please check the manual of LimeSurvey (http://manual. been selected, and by what percentage of the respondents.
limesurvey.org/Installation). These analytics can help the organiser of the survey in various
In the database settings, most of
the fields will be filled by default.
Just provide a valid database name
(e.g., survey00, questionnaire, etc).
After this, an administration
panel will come up. Just fill in
the desired settings and continue.
T
o understand and use the full power of Asterisk, we like Blink can be downloaded and installed on a desktop. The
need to have a good understanding of the possible GUI resembles a dial pad, and with the help of a headset with
hardware accessories involved. The objective of this a microphone, the desktop can be turned into a phone. You
article is to introduce you to different kinds of hardware in the may also use the microphone and speaker of the desktop or
Asterisk world. laptop. After starting the software, it registers itself with the
Nowadays, any standard desktop or server comes with IP Asterisk PBX and starts receiving as well as making calls.
connectivity. So, if we are connecting IP phones to each other
through the PBX, we need not use any additional hardware. Smartphones as VoIP phones
However, we also need to connect to landlines, mobile phones, VoIP clients, available on smartphones, can connect to the
etc. For this, there is hardware to connect to a PSTN network or PBX server over Wi-Fi and function like any other phone.
a GSM network. Let us examine these devices, individually. One open source VoIP smartphone is the CSipClient,
which can be downloaded freely from the Google Android
VoIP phones Play Store. This client opens up innumerable application
VoIP phones are directly connected to the server over a LAN. possibilities, as follows.
The dominating protocol standard is SIP (Session Initiation Phoneless desktop: Users need not clutter their desks
Protocol). Some phones support IAX, a proprietary Asterisk with standard phones. Their mobile phones can serve as an
extension to the PBX. Outside the office, these can be normal only PRIs are used in the corporate scenario, and BRI is non-
GSM phones; inside the office, they turn into dual phones, existent, for all practical purposes.
which can also act as extensions. The PRI card can be inserted into the server PCI or PCIe
Roaming extension: Doctors roaming around hospitals, slot, and can be configured as NT (Network Terminator
work-site supervisors, hotel staff, hotel room guests, etc, are or trunk side equipment) or TE (Terminal Equipment or
rarely found at their desktops or in their rooms. With Wi-Fi subscriber side equipment). A PRI connection can have
technology, they are always logged into the IP PBX and are, one pilot number and multiple subscriber numbers or DIDs
therefore, reachable. (Direct Inward Dialling), typically 100.
Cost savings: The user is always logged into the PBX and
therefore can route all the calls through the PBX, which could VoIP GSM gateway or card
be cheaper, especially when the volume of calls is high. The mobile network, specially the GSM mobile network, is
the most popular and widespread network nowadays. The
FX or ‘foreign exchange’ GSM gateway or card makes it possible to connect Asterisk
FXO or FXS are used to denote various connections in directly to this network. This equipment resembles a mobile
analogue technology (or POTS – Plain Old Telephone phone, where a SIM card can be inserted, and comes in 1, 2
System), which is the most common SOHO (Small Office or 4 ports. The GSM network can also be used as a backup for
Home Office) technology prevalent in India today. FX stands the POTS or ISDN lines.
for Foreign eXchange. FXO (Foreign eXchange Office) is For large density connectivity, VoIP GSM gateways are
the line which connects to the local telecom switch and FXS suitable, which come in 8, 16 and 32 ports.
(Foreign eXchange Subscriber) connects to the phones or
other end user devices like fax machines. Echo cancellation hardware
An echo is the phenomenon by which sound is repeated,
VoIP FXS gateway or FXS card which in turn affects the clarity of the sound. Asterisk has
Analogue telephones are the cheapest user equipment built-in software routines to combat this problem. In cases
available, with prices starting as low as ` 300 compared to where the software routines are not effective, DSP-based
a VoIP telephone starting at ` 3000. An FXS gateway/card hardware is available for analogue as well as PRI hardware.
connects an analogue phone to the Asterisk server. Most of Most of them are ‘piggy back’ modules, which have to be
the interface hardware comes in two forms, i.e., PCI/PCIe plugged on to the existing boards.
cards, which can be inserted into the server or external
standalone gateways connected to the server over IP. These Voice logger
devices can have multiple ports—the common ones are Conversations can be logged within Asterisk without any
FXS cards with up to 16 ports or gateways with up to 48 additional device. A command in dialplan is enough to
ports. For a larger number of ports, it is advisable to use activate the voice logging feature in Asterisk for calls passing
multiple gateways. through the Asterisk equipment.
Asterisk can also operate as a voice logger system for other
VoIP FXO gateways or cards systems in an active or passive mode. In both cases, the line to
Analogue trunks are the most common trunk connection be tapped has to loop through the voice logger system. In the
available for PBX equipment to connect to the outside world. case of active voice loggers, interface cards with double ports
With the help of a VoIP FXO gateway or card, one can of the interfaces to be tapped are required, i.e., to tap one PRI,
connect the Asterisk equipment to the PSTN world. Their we need a 2-port PRI card. The line to be tapped is connected
dimensions or capabilities are given as 1-, 2-, 4-, 16-port, etc. to the voice logger system and the destination system also.
When a call comes, the connection is established to the voice
VoIP PRI gateway or card logger system, and then again a back-to-back connection is
ISDN (Integrated Services Digital Network), which is purely generated to the destination system. The calls are recorded in a
a digital network, is the next generation of telecommunication similar manner in an Asterisk system using dialplan.
networks, a step up from analogue networks. PRI (Primary In case of passive voice loggers, a passive interface
Rate Interface) and BRI (Basic Rate Interface) are the two card with double the number of interfaces to be tapped is
common connection types available. PRI is a 4-wire interface connected. The main difference is that there is no connection
to the customer, and can carry 30 B channels (voice channels) established to the voice logger system. The voice logger
and one D channel (control channel) in an E1 configuration, system passively taps the required information and stores it.
the most common in the Indian scenario. There is also a T1
configuration with 24 B channels and one D channel, which is Redundancy hardware
more prevalent in the US. The BRI with two B-channels and Redundancy hardware can be created easily by having a
one D-channel is meant for SOHO use. In India, generally mirror copy of the existing server. In case of a crisis, when
the primary server crashes, the situation is detected by systems also allow two-way communication, by allowing
noticing missing live messages between the systems; and then the receiver also to pass back messages.
redundancy hardware can take over the operations. The IP SIP-based paging systems are available, which will accept
phones and other IP-based equipment can be easily switched the call as soon as the call comes, amplify the voice and
over to the new server. A complicated case would involve output it through speakers. Asterisk supports creating multiple
switching over the physical layers of interfaces like FXO and groups of paging devices and also incorporates the two-way
FXS, which are directly connected to the server, for which messaging option.
physical switchover hardware is available.
Answering the front doorbell
Physical layer switchover hardware A visitor might ring the house bell, and one can pick up an
Manufacturers provide physical hardware where, for internal phone to communicate with him or her. There are a
example, the FXO line is connected. The output is few SIP door phones available. Else, it is possible to connect
duplicated and connected to the primary and secondary an analogue phone with an FXO card to Asterisk.
servers. The control signals to the device can come from We have now explored quite a lot of Asterisk hardware,
the primary and secondary servers through the USB port or which enhances its capabilities in the IP world by interfacing
the IP port. As soon as a critical situation is discovered, the with other telecom networks, and carrying out multiple tasks.
relays are activated and the physical connection is changed The power of applications on a simple switching platform is
to the secondary server. sometimes magical.
Sheela Foam
Founded in 1972, Sheela Foam Pvt Ltd is India’s largest
mattress manufacturer and is ranked among the top five
manufacturers of Slabstock PU foam in South East Asia.
The firm has 11 manufacturing units using state-of-the- INDUSTRY CORPORATE HEADQUARTERS
art technology across India and five manufacturing units Manufacturing Ghaziabad, India
in Australia. Sheela Foam caters to a wide spectrum of EMPLOYEES PRODUCT
customers through an efficient distribution network of over 100 1,500 + Zimbra Collaboration
distributors and 4,500 dealers. Its products include Sleepwell in
KEY BENEFITS
India and Joyce in Australia. A combination of manufacturing
• Powerful user experience
excellence and a wide distribution network has helped it • Ease of management
acquire over 40 per cent of the Indian PU foam market. • Flexible licensing
• Cost-effective
The opportunity
Because Sheela Foam operates over a distributed The Zimbra team worked very closely with the Sheela Foam
geography and has a widespread network, the team to ensure that the transition was extremely easy. “The team
communication within the distribution channel had to be did a great job by providing us with all the support we needed
really quick for the network to work efficiently. The email during the transition. The solution has turned out to be a perfect
solution was an area of concern for Sheela Foam’s IT fit for our requirements, with the numerous benefits it offers us
department. The team was using a combination of email in comparison to our earlier set-up,” said Mankotia.
systems, including Microsoft Exchange. As the business
grew, the number of users increased as well, and Sheela The results
Foam began facing issues related to the burgeoning cost of Messaging and collaboration made easy: The feature-
Microsoft Exchange user licences. Sheela Foam’s IT team, rich browser-based experience of Zimbra allows users to
lead by Pertisth Mankotia, was looking at consolidating stay connected securely, anywhere, and to any device or
the email systems into a single email system that was platform. The briefcase feature also allows users to share
fast, efficient, cost-effective, user-friendly and scalable. large files. Zimlets gives users the ability to integrate third-
In addition, the team required the email solution to be party applications into the email client, thereby enhancing
compatible with a wide range of operating systems. productivity and the user experience.
Simple licensing: Zimbra’s uncomplicated licensing has
The solution allowed Sheela Foam to scale up its email system to include more
The IT team evaluated various email solutions, including users with the Starter or Professional editions. This helped the
Zimbra. The team members were very impressed with the company to lower the licensing costs by almost a tenth of what it
flexibility, scalability and economy Zimbra offered. Its simple would have otherwise spent on Microsoft Exchange licences.
licensing (based on mailboxes) offered additional flexibility, A lower total cost of ownership: Sheela Foam was able
compared to the existing set-up. to drastically reduce costs on licensing, hardware requirements
The Zimbra deployment was done in less than three and in-built features, such as storage tiering (HSM), file
days, during which 1,100 mailboxes were migrated to it. As sharing (briefcase) and backup tools, which would have
Zimbra is available in multiple editions (Starter, Standard and involved additional costs had the IT team chosen to go with
Professional), Sheela Foam was able to offer the Standard other competitive solutions, including Microsoft Exchange.
edition to non-power users and the Professional edition to Ease of migration: As Zimbra offers native migration tools,
power users. This helped Sheela Foam lower licensing costs Sheela Foam did not require a third-party tool for migrating its
further, and offer mailboxes to their dealers and distributors users from Microsoft Exchange to Zimbra.
as well. The IT team also leveraged Zimbra’s collaboration
features, such as file sharing, scheduling, instant messaging For more information, trial or demo please contact sales at
+91 20 6730 4731 or email india.marketing@zimbra.com
and the mobile Web client.
I
f you have a basic knowledge of Vim and are interested in hitting ‘u’ will undo the last change.
exploring some advanced ways to use it, but think you may be
missing some essential features of the GUI-based editor, this 4. The % key
article is for you. This is a really awesome feature for programmers. The % key
can be used for the following:
1. Word suggestion To jump to a matching opening or closing parenthesis,
Sometimes, when writing programs, you do need suggestions of square bracket or a curly brace: ( [ { }] )
variable/function names from the IDE. This is possible with Vim. In To jump to the start or end of a C-style comment: /* */.
insert mode, type the first couple of characters of a word, then press: To jump to a matching C/C++ pre-processor conditional:
Ctrl-N to insert the next matching word #if, #ifdef, #else, #elif, #endif.
Ctrl-P to insert the previous matching word In command mode, press ‘%’ to find the matching brace/
For a programmer, this is very useful when entering the names comment that is under the cursor.
of variables in a program.
Incidentally, if you really want CTRL-P or CTRL-N to scan a 5. Repeat the previous action
dictionary file, then try :set dictionary=/usr/. Multiple dictionaries The ‘.’ command repeats the last change made in normal
can be used as well. mode. For example, if you press dw to delete a word, you can
then press '.' to delete another word.
2. Find the next or previous occurrence of the word
under the cursor 6. Open multiple windows in Vim
Sometimes, it’s useful to find the next or previous occurrence of a It is a basic requirement for any programmer to open multiple
word in your file. This is possible with Vim. In command mode, hit files concurrently. Vim supports this too.
‘#’ or ‘*’ to find the previous or next occurrence of the word that is Vim has the ability to split its window into multiple panes
under the cursor. using the :sp or :vsp commands.
To open a different file in a newly split window, you can
3. Undo recent changes specify the filename as part of the command. For a horizontal split,
To undo changes, the ‘u’ command is used. In command mode, use :sp <filename> and for a vertical split, use :vsp <filename>.
I
n today’s credit-oriented world, loans, EMIs, the principal, norm when calculating interest rates.
interest rates, savings, etc, are commonly used terms.
How well do we really understand these terms, or for $ maxima -q
that matter, are we able to accurately compute the figures (%i1) load(finance);
related to such matters? Do we just accept what the other (%o1) /usr/share/maxima/5.24.0/share/contrib/finance/finance.
party has provided us? Or should one go into the details to mac
first understand and then double-check the numbers being (%i2) days360(2014, 1, 1, 2014, 10, 1);
presented to us? This is where Maxima’s finance package (%o2) 270
comes to your rescue; you can actually verify figures without (%i3) days360(2014, 1, 1, 2014, 12, 31);
much involvement in the computational details. This article is (%o3) 360
going to walk you through the details of this package. (%i4) days360(2014, 1, 1, 2014, 3, 1);
(%o4) 60
Basic operations (%i5) days360(2014, 1, 1, 2015, 1, 1);
To be able to use the finance package of Maxima, the first (%o5) 360
thing to do, after getting the Maxima prompt, is to load (%i6) quit();
the finance package, using load(). Then go ahead to do the
various computations. days360() is the simplest function to Note that days360() takes ‘from’ and ‘to’ dates, each as a
give the number of days between two dates, assuming there triplet of the year, month and date.
are 360 days per year and 30 days per month – this is the One common computation that we often deal with is the
final amount we would get after applying a particular rate
of compound interest on a particular principal amount –
just use fv(<rate>, <principal>, <period>) for
computing the future value of the <principal>, at
the compound interest <rate> , after a certain
<period>. As an example, what would be
the future value of investing `10,000 for
10 years at the compound interest rate of
15 per cent per year – just call fv(0.15,
10000, 10);
$ maxima -q And clearly, over the long run, the four-year project P3
(%i1) load(finance)$ has a better benefit-cost ratio. But if one is only looking
(%i2) npv(0.07, [100, 200, 150, 600]); for shorter term benefits, then you could go with project P1
(%o2) 848.3274983420189 as well.
(%i3) quit();
MEAP MEAP!
OpenMEAP
Create Mobile Apps with Ease!
OpenMEAP is an open source HTML5 mobile application platform. It empowers
businesses and consumers with a little programming experience to create, manage, and
deploy mobile applications that can then be easily optimized for various devices such as
tablets, desktops, and smartphones.
L
et's understand the term MEAP before going into The MEAP approach is encouraged because organisations
further explanations on OpenMEAP. A mobile need the following mobile solutions:
enterprise application platform (MEAP) is a wide- Support for multiple mobile applications
ranging suite of products and services that enable the Support for multiple mobile operating systems (OS)
development of mobile applications across various platforms. Integration with multiple back-end data sources
The term MEAP was coined in a 2008 Gartner Magic OpenMEAP is an open source HTML5 mobile application
Quadrant report, which is a series of market research reports platform, which enables clients to easily create, manage and
published by Gartner Inc frequently. install mobile applications that are automatically optimised
MEAPs address the difficulties of developing mobile for almost every device. Organisations gain considerable
software by managing the user groups, as well as the range savings and advantages by using this flexible platform.
of devices and networks at the time of deployment and OpenMEAP is compatible with the Android, iOS and
throughout the mobile solution’s lifecycle. Unlike individual BlackBerry platforms. Currently, it is available only in
apps, a MEAP provides a widespread, long-term approach to English. It delivers productivity benefits like mobile data
deploying mobility. Cross-platform considerations are one access while maintaining a good amount of security and
of the main reasons for using MEAPs. Let us consider an Public Key Infrastructure compliance. It enables organisations
example in which an organisation uses a MEAP to develop of all sizes to proficiently develop, deliver and manage mobile
the mobile application and deploy it to a variety of mobile applications while using their existing Web development
devices such as smartphones, tablets and notebooks with no platform and resources. It provides flexibility to write the
changes to the underlying business logic. application in a preferred Web development environment
using HTML5, CSS3 and JavaScript, and deploy OpenMEAP provides flexibility to use
it through the OpenMEAP interface. OpenMEAP is an integrated and
any HTML5 or CSS3 framework or
responsive design frameworks. It pro-
open sourcemobile technology vides freedom to use any mobile user
solution with less administrative
Features overhead; less need of upgrades
interface usch as browsers supporting
HTML5 and Css3. It alos provides free-
OpenMEAP is available with an open source that reduces management costs. dom to deploy OpenMEAP in the cloud,
licence, which allows all organisations to hosted or in onpremise environment
based on existing business strategy.
take an active role in ensuring the security
and quality of the product by providing
inputs in the development of various features. OpenMEAP avoids vendor lock-in
It can be used to enable existing teams to and open source code will allow to
modify features according to the Source code is available in public
create applications by using HTML 5, CSS3, business needs. Users can select in- domain hence there is better
and JavaScript for a device-agnostic solution tegrated development environments chance to ensure security claims by
of their own choice and they are not rigorous auditing.
or service offering. OpenMEAP mobile bound to use any specific IDE
clients remove the need for developing
mobile apps across various platforms such as
iOS, Android, Windows and BlackBerry. Figure 1: Benefits of OpenMEAP
It does not require any new ports to be opened
in the firewall. This allows the product to be implemented OpenMEAP is the flexibility to deploy it in the cloud
without creating unnecessary vulnerabilities. environment—either hosted or in an on-premise environment,
OpenMEAP offers end-to-end security, as it supports based on existing business strategies.
256 bits Advanced Encryption Standard (AES) and
Secure Socket Layer (SSL). It offers full Public Key OpenMEAP on the Amazon Web Services
Infrastructure (PKI) agreement and also provides an (AWS) public cloud
option to share it with the user’s existing Certificate The OpenMEAP 1.4.5 version is available in the AWS
Authority. Marketplace. It is available on Base Operating System Linux/
Its architecture is designed for high availability; UNIX and Amazon Linux 2012.03.3 as a 64-bit Amazon
applications developed and designed using proper best Machine Image (AMI). AMI is an encrypted machine image
practices can continue to function in a number of adverse of a specific virtual machine. It contains a base OS, and a set
situations, including network loss or power outages. of applications and services for achieving a specific purpose
The OpenMEAP admin interface manages application with a specific configuration. Amazon Web Services (AWS)
versions, device management, deployments and security is a public cloud service provider that provides a computing
policies. Administrators can also design a security profile environment for running instances of an AMI on a pay-as-
that is appropriate for the implementation. It allows users you-go basis. Amazon EC2 and Amazon EBS services are
to build, manage, test and install mobile applications. required to run open source OpenMEAP. There are multiple
OpenMEAP supports simple object access protocol OpenMEAP bundles available in the AWS Marketplace
and Web services that allow access to other systems or such as OpenMEAP - Small Business Support Bundle
services from the mobile application. [RedHat and Amazon Linux]; OpenMEAP - Enterprise
Support Bundle [Amazon Linux and Red Hat]; OpenMEAP
OpenMEAP installation - Developer Support Bundle [Amazon Linux and Red Hat];
Download OpenMEAP installer from http://www.openmeap. and OpenMEAP - Mobile Enterprise Application Platform
com/products/download/ based on the operating system you [Amazon Linux and Red Hat].
are using. The installer requires the Mac OS X 10.6+ 64 bits Here are the steps you need to follow to install
or Windows XP/Vista/7/8 or any Linux distribution. OpenMEAP on AWS:
Here is a list of OpenMEAP pre-requisites/software Visit AWS Marketplace to access an OpenMEAP bundle
requirements: Select an OpenMEAP version from AWS Marketplace
Eclipse IDE for Java EE developers (Windows or Mac) to deploy it
Windows Phone 8 SDK (Win 8) Configure it for an AWS server setup
Android SDK (Windows or Mac) Configure firewall rules for http, https and ssh
Xcode 4.2+ (Mac) Start the OpenMEAP virtual machine on AWS
Apache Tomcat 7.0 Log in with admin account OpenMEAP
Apache IvyDE Connect to EC2 instance with an ssh instance for any other
Apache Ant 1.8+ required configuration or modifications
Java JDK 1.6+
One of the most promising advantages of using To be continued on page 97...
Deploy Synergy
to Share Your Devices
This article discusses a program called Synergy, which is used for sharing the mouse and
keyboard of server with number of clients. By definition, the word ‘synergy’ implies that
the whole is greater than the sum of its parts. This awesome software program clearly
demonstrates this!
D
o you have two or more computers at your desk? using a wired or wireless network. As long as both systems
And how do you operate them? Like everyone are reachable over the network, Synergy will do its job. So let
else, by using the keyboard and mouse of each us get our hands dirty with it.
computer, right? Wouldn’t it be great if you could use
just a single keyboard and mouse to operate multiple An introduction to Synergy
computers? Well, you can do that with Synergy. So let’s go Synergy is a software application that allows you to share a
ahead and explore this software’s configuration and some keyboard and a mouse between multiple systems. It is somewhat
of its troubleshooting techniques. similar to the KVM (Keyboard, Video and Mouse) switch but
For demonstration purposes, I’ll use Windows 7 and is purely a software entity. It is convenient when a single user
Ubuntu GNU/Linux. Figure 1 depicts the details of my set-up. wants to operate multiple systems, and is also useful in situations
In my set-up, both the systems are laptops but any in which several systems are connected to a monitor and the user
combination of desktop/laptop is fine. An external keyboard wants to operate them using a single keyboard and mouse.
and mouse are connected to the Ubuntu machine. And Synergy follows the client-server model, in which there
with the help of Synergy, they will be used to operate both is a single server and one or more clients. The server is the
these machines. It doesn’t matter whether the keyboard or system to which the keyboard and mouse are physically
mouse are connected via PS2, USB or wireless; whether the connected. In my case, it is the Ubuntu machine. To operate
architecture is x86 or x64; or if the systems are connected another system, just move your mouse pointer to the other
In the above configuration, ‘screens’ and ‘links’ are NOTE: connecting to ‘xxx.xxx.xxx.xxx’: xxx.xxx.xxx.xxx:24800
mandatory and ‘aliases’ are optional. The default syntax of NOTE: connected to server
any section is as follows: INFO: entering screen
INFO: leaving screen
section: name
arguments Congratulate yourself; the connection has been
end established successfully. You should now be able to move the
mouse between synergy sessions.
Section names can be ‘links’, ‘screens’, ‘aliases’ or
‘options’. Let us first understand the configuration file. Note: For security reasons in the article, I have used
The first section is ‘screens’, which simply lists the ‘x.x.x.x.’ Do replace this with the actual IP address of your
names of the systems participating in the Synergy session. server machine.
In our case, there are two systems and, hence, there are two
entries. In this section, you can either use the hostname or IP One of the advantages of the text configuration is that we
address of the system. can copy it to another machine, and Synergy can be started
The next section is ‘aliases’. Synergy clients provide the by doing just a little modification. But some people prefer the
hostname while establishing a connection with the server, so GUI tool instead. No problem! Synergy also has an intuitive
the server can find them in the configuration. Some systems GUI tool from which you can configure the server, and there
report FQDN (Fully Qualified Domain Names) and some report is also a GUI client. The section below illustrates the steps to
only hostnames, depending on their network configuration. configure the server using the GUI tool.
This section provides a list of names by which each computer 1) On the Ubuntu machine, first launch the Synergy
is known. To describe this section, we can either use the IP application from Unity dash. The first two screens don’t
address or the FQDN of the system. If you are using the FQDN require any special attention.
in the ‘screens’ and ‘links’ section, then this section is optional. 2) Select the server option from the third screen.
Our last section is ‘links’. This describes the virtual 3) Optionally, you can enable the encryption feature for
adjacency of the systems. If you remember, in the Synergy. After that, click the ‘Finish’ button.
configuration, the Windows 7 machine is to the left of the 4) From the main screen, ensure that the ‘Configure
Ubuntu machine or, you could say that the Ubuntu machine Interactively’ radio button is selected. Then click on the
is on the right side of the Windows 7 machine. The ‘links’ ‘Configure Server’ button.
section depicts this information. To know more about 5) To add a new client, drag a new screen onto the grid from
Synergy’s configuration options, go through the details on the spare ones at the upper right. By default, the name of
http://synergy2.sourceforge.net/configuration.html. the screen is shown as ‘Unnamed’. To rename it, double
Now let us test this configuration. On the Ubuntu click on it and give it an appropriate name. In my case,
machine, start the server in the foreground by using the the name is ‘windowspc’. Optionally, we can also define
following commands: aliases on this screen.
5) Similarly, to remove a client, drag the screen to the trash
[bash]$ synergys --config ~/synergy.conf --no-daemon --no- icon present in the upper left.
restart Figure 2 shows what our configuration screen will look like.
INFO: Synergy 1.5.1 Server on Linux 3.13.0-24-generic To activate the configuration, click the ‘OK’ button
#46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64
NOTE: started server, waiting for clients
and start the server. That’s it! We have started the server
successfully. Now let us switch to the client. The section
below describes the steps to be performed on the client.
1) First, launch the Synergy application.
2) Select the ‘Client’ check-box, enter the IP address of the
Synergy server in the ‘Server IP’ text-box and click on the
‘Start’ button.
After establishing the connection, the screen will look like
what’s shown in Figure 3.
Auto-launching Synergy
Synergy is an awesome utility. By default, we have to launch
it explicitly, every time. Wouldn’t it be great if Synergy starts
automatically when you log in to the system? We can do this
too. In this section, we are going to explore auto-launching
the Synergy server after logging into a GNOME session.
We can also launch the Synergy GUI application from the
command prompt. Just type synergy at the command prompt Figure 3: Client
and that’s it. To auto-start Synergy, go to Unity Dash -> Startup
Application Preference -> Click on Add button. This will result Synergy’s official website.
in a pop-up message window. In place of the command, type 4) While copying text between multiple sessions, Synergy
‘absolute path of Synergy’. In my case, it is /usr/bin/synergy. automatically translates linefeeds between UNIX and
Click the Add button to save the configuration. Windows formats, enabling cutting and pasting across
If you want to use the configuration set-up with systems as easily as within a single one. In addition, it
‘synergys’, use the following instead: forces screensavers to activate and deactivate, in concert.
mouse movements on the server. Please follow the steps • Click on the ‘Edit’ menu and select ‘Settings’.
given below to do so. • Change the ‘Logging level’ drop-down box to ‘Debug’ or
• Click on the ‘Configure Server’ button. higher. The debug output should appear in the ‘Log’ area
• Then click on the ‘Advanced server settings’ tab. of the main window (if not, try restarting the program).
• Tick the ‘Use relative mouse moves’ check-box and You can copy and paste the text from this window.
press the ‘OK’ button. If you want to delve deeper into Synergy or want to
In addition to this, you can try to lock the mouse to your contribute to the Synergy project, visit the official website
client screen by pressing the ‘Scroll Lock’ key. http://synergy-project.org/.
5) How do I send a debug output to the developers?
If Synergy is not working as expected and you want help By: Narendra Kangralkar
from the community, then provide some debug logs while The author is a FOSS enthusiast and loves exploring
describing the problem. That makes troubleshooting really easy. anything related to open source. He can be reached at
narendrakangralkar@gmail.com
Please follow the steps below to capture and send debug logs.
watch -n<Seconds> ‘your command here’ Save it and update Grub by using the following
command:
For example, if you want to view a DB table in PostgreSQL
every two seconds, you can use the following command: $sudo update-grub
watch -n2 ‘psql -U postgres -d my_db -c select count(*) If this does not work out, please downgrade your
from order;’ kernel to the 3.2.0-* version. To do that, first install the
—Deepak Gupta, kernel version by using the following command:
deepakgupta101@yahoo.co.in
$ sudo apt-get install linux-headers-3.2.0-25-generic
Repositioning the cursor in Vim linux-headers-3.2.0-25 linux-image-3.2.0-25-generic
Here is a tip that will help you to move the cursor on
the screen: Now, to make this as a default boot kernel, edit /etc/
H – Makes it jump to the top of the screen. default/grub and change the line…
M – Makes it jump to the middle of the screen.
L – Takes it to the bottom of the screen. GRUB_DEFAULT=0
Now, if you want to reposition the cursor along with
the line, you may have to try this: …to:
z. => Repositions the cursor along with the line to the
centre of the screen GRUB_DEFAULT=2>0
z+ => Repositions the cursor along with the line to the
top of the screen Save it and update Grub using the following
z- => Repositions the cursor along with the line to the command:
bottom of the screen
—Ahmed Sharif, $ sudo update-grub
ahsh767@gmail.com
Reboot the machine and check that you have the
Power-off after shutdown correct Linux kernel by using the following command:
In some Linux systems with kernel 3.5.0-*, the
system will not power off after the shutdown command $uname -r
is passed to it. You need to press the power button
continuously to halt the machine. After downgrading the kernel, powering off will work
One possible way to fix this issue is by editing the /etc/ perfectly.
default/grub file and changing the line … —Nagaraja T,
naga2raja@gmail.com
Note: Care should be taken while executing the – Mohammad Jamal Mohiuddin,
above commands as wrong usage can lead to loss of data. md.jamalmohiuddin@gmail.com
[bash]$ tr -d ‘\r’ < dos_file.txt > unix_file.txt Share Your Linux Recipes!
The joy of using Linux is in finding ways to get around
Check the new file format: problems—take them head on, defeat them! We invite you to
share your tips and tricks with us for publication in OSFY so
that they can reach a wider audience. Your tips could be related
[bash]$ file unix_file.txt to administration, programming, troubleshooting or general
tweaking. Submit them at www.opensourceforu.com. The sender
of each published tip will get a T-shirt.
As expected, the output will be as shown below:
“Software defined
infrastructure is set to
make the lives of IT
heads easy!”
Intel has recently introduced its Xeon The Intel Xeon processor E5-2600 v3 product family
processor E5-2600/1600 v3 product introduces new features that provide greater visibility into
families to address the requirements the system than ever before. A new cache monitoring feature
of diverse workloads and the rapidly provides data to enable orchestration tools to intelligently
evolving needs of data centres. The new place and rebalance workloads, resulting in faster completion
processor families include performance times. This also provides the ability to analyse performance
increases of up to 3x over the previous anomalies due to competition for cache in a multi-tenant
generation, world-class energy efficiency cloud environment, where there is little visibility into what
and enhanced security. To facilitate the workloads consumers are running.
explosive demand for software defined The new processors also include platform telemetry
infrastructure (SDI), the processors sensors and metrics for CPU, memory and I/O utilisation.
expose key metrics, through telemetry, With the addition of thermal sensors for airflow and
which enable the infrastructure to deliver outlet temperature, the visibility and control has increased
services with the best performance, significantly from the prior generation. The processors
resilience and optimised total cost offer a holistic set of sensors and telemetry for any SDI
of ownership. Diksha P Gupta from orchestration solution to more closely monitor, manage
Open Source For You spoke to Ravi and control system utilisation to help maximise data centre
Gupta, vertical head–public sector and efficiency for a lower total cost of ownership.
enterprise, enterprise solutions group,
Intel India, about how SDI’s evolution will
impact data centres in India and how they
will change the IT world. Excerpts:
Q Why do you think that software defined infrastructure is
poised to change the current state of IT?
Right now, IT involves a lot of intervention from
systems administrators and systems. It needs to be more
intelligent, wherein the infrastructure itself takes the
decisions on resourcing and orchestration, as it is known
EB Times
• Electronics • Trade Channel • Updates
An EFY Group publication
is Becoming Regional
Get East, West, North & South Editions at you
doorstep. Write to us at myeb@efy.in and get EB
Times regularly
This monthly B2B Newspaper is a resource for traders, distributors, dealers, and those
who head channel business, as it aims to give an impetus to channel sales