Bhangarh Fort: A Date with Ghosts

We drove straight from Gurgaon to Bhangarh Fort, bravely merging breakfast with lunch. Somewhere on the highway we stopped for mixed veg paranthas with raita — because if you’re heading to India’s most haunted place, it’s best to go well-fed. Ghosts are scary, hunger is scarier.

Someone was watching from treetop

Bhangarh Fort proudly carries the title of India’s Most Haunted Place™. As we entered, the first thing we saw was a Hunuman Temple. Now, in Bengal, there’s a firm belief that Lord Ram is a powerful anti-ghost vaccine. Honestly, a Shiva or Kali temple might have blended better with the overall ghost-and-demon theme, but perhaps the fort management wanted a powerful spiritual crowd control.

Greta and Sukanya in a mood to meet Ghosts

Interestingly, the fort itself looks as if it never faced a serious war — at least not from humans. Large parts remain intact, suggesting that even invading armies may have been spooked. Built in the 16th century in Rajasthan, Bhangarh was established during the reign of Bhagwant Das as the residence of his second son, Madho Singh. The fort has multiple layers of fortification and is naturally protected by hills on three sides. A watchtower crowns the hilltop, which local guides enthusiastically claim was once the residence of a tantrik priest—because every haunted fort needs at least one tantrik for credibility.

The ruins and the watch tower on top of the hill
A close-up view of the tower / Tantrik’s house

The first layer of the fort housed the bazaar and the residences of courtesans. Sadly, time and weather have done what ghosts couldn’t, leaving much of it in ruins. Still, if you squint hard enough (and maybe ignore the ASI signboards), you can almost hear shopkeepers shouting discounts.

Bhangar Bazar

Of course, no haunted place survives on architecture alone — it needs legends. Bhangarh has two, both excellent.

The first involves a sadhu named Baba Balau Nath. Before Madho Singh decided to build a fort here, Baba Balau Nath was peacefully meditating on the site. He allowed construction on one condition: no building should be taller than his house. Also, if any shadow from the fort fell on his home, the entire town would be destroyed. A reasonable request, really. Unfortunately, Ajab Singh, Madho Singh’s grandson, decided height restrictions were optional. He built higher, the shadow fell, and — according to legend — the town met its doom. Moral of the story: always respect zoning laws, especially when enforced by saints.

The second legend is far more dramatic. Princess Ratnavati was extremely beautiful and had suitors lining up from royal families across the land. A wizard skilled in black magic fell in love with her, because of course he did. One day, while the princess was shopping for ittar, the wizard swapped her perfume with a love potion. Unfortunately for him, the princess was smarter than the average fairytale character. She threw the potion at a nearby boulder, which promptly rolled over and crushed the wizard. With his last breath, he cursed the city — never curse mid-accident, it never ends well. Soon after, Mughal forces invaded, the city was destroyed, and everyone, including the princess, perished.

Gopinath Temple

To maintain its haunted reputation, Bhangarh Fort is officially out of bounds before sunrise and after sunset. Because ghosts, like government offices, operate strictly after hours. If you close your eyes during the day, though, you might still imagine the buzz of a once-busy bazaar — or that could just be the wind.

In the second layer of the fort, apparently dissatisfied with human guards alone, Bhagwant Das recruited divine security. This layer contains several temples—Gopinath, Someshwar, Keshav Rai, Mangla Devi, and Ganesh — beautiful examples of 17th-century Nagara architecture. The Gopinath Temple stands on a 14-foot-high plinth with exquisite stone carvings and even has a priest’s residence, the Purohitji Ki Haveli. A small rill trickles down from the hill, feeding a pond near the Someshwar Temple — serene, scenic, and probably ghost-approved.

Someswar Temple

The third layer houses the royal palace, once said to have seven storeys, though only four remain today. Perched high on the hill, it commands a magnificent view of the entire complex and the surrounding landscape — a perfect vantage point to watch approaching enemies, or perhaps to keep an eye on incoming curses.

Royal Palace

Walking through the markets and ruins, one thought haunted me more than ghosts or demons: water. How did a city that housed thousands survive on a tiny rill and a small pond? These might sustain a few hundred soldiers, but an entire town? Unlikely.

Sukanya and Me waiting for the Ghosts

And that realization, perhaps, is the real curse of Bhangarh. Ignore nature, overuse resources, and even the grandest cities turn into ghost towns — no black magic required.

Posted in Environment, Travel | Leave a comment

Different Tuning Systems of Diatonic Harmonica

The diatonic harmonica, celebrated for its distinctive bluesy sound, is traditionally tuned to a major scale, but numerous alternative tuning systems have evolved to cater to different musical styles and player preferences. These tuning systems vary in their note layouts, offering unique advantages and sometimes posing specific challenges. I find these different tuning styles are not known to many. Here, I will try to give some information on these different styles.

Richter Tuning

Richter tuning, named after its creator Joseph Richter in the early 19th century, is the most prevalent tuning system for diatonic harmonicas. Its layout is designed to facilitate playing chords and melodies in a straightforward manner, making it a versatile choice for various musical genres.

This arrangement provides a C major scale with additional notes available through bending, particularly in the draw notes of the first six holes.

Advantages

Versatility: Suitable for a wide range of music genres, including blues, folk, rock, and country.

Chord Play: Enables easy chord playing and rhythmic accompaniment, especially for folk and blues.

Bending Capability: Supports bending on the draw notes (holes 1-6), allowing for expressive, nuanced playing typical in blues and rock.

Accessibility: Ideal for beginners due to its widespread use and the abundance of learning resources.

Disadvantages

Limited Chromaticism: Achieving a full chromatic scale is difficult without advanced techniques like overblowing and bending.

Non-Intuitive Layout: Some notes needed for certain scales or modes are not easily accessible, requiring skill and practice to play fluently.

Richter tuning remains the cornerstone of diatonic harmonica playing, providing a balance of simplicity and expressive potential that appeals to both novices and seasoned players.

Paddy Richter Tuning

Paddy Richter tuning is a modification of the standard Richter tuning, designed specifically to facilitate the playing of folk and Irish music. The key alteration in this tuning is raising the 3 blow note by a whole step. For a C harmonica, this means changing the 3 blow note from G to A. This tuning has full two octaves of suddh swars, Sa, Re, Ga … etc. It allows easy playing of Indian songs based on Bilaval Thaat. Even other songs can easily played using bending in this tuning:

Advantages:

Melodic Playability: The raised 3 blow note (G to A) provides a complete major scale in the middle octave without needing to bend notes, making it easier to play traditional melodies and tunes, particularly those found in Irish and folk music. This is especially good for Indian music.

Ease of Learning: For those who play melodies in the second octave, the Paddy Richter tuning simplifies the layout, allowing for more intuitive and fluid play.

Improved Accessibility: The altered tuning enables easier access to the notes required for common folk tunes, enhancing the instrument’s capability for fast, melodic runs.

Disadvantages:

Blues Playability: The modification makes it less suited for traditional blues music, as the usual bending and note patterns are altered.

Specialization: While it excels in Indian and Irish music, this tuning might not be as versatile for other genres, limiting its appeal to players who need a broader range of musical styles.

Adjustment Required: Players accustomed to standard Richter tuning might need time to adjust to the new note layout, particularly if they frequently use the 3 blow note.

Paddy Richter tuning offers a valuable alternative for harmonica players focused on Indian music, providing a more intuitive layout for melodic play. While it may limit the instrument’s versatility in other genres, it stands out as an excellent choice for musicians seeking to perform traditional tunes with greater ease and fluency.

Country Tuning

Country tuning modifies the Richter tuning by raising the 5 draw note by a half step. For a C harmonica, the draw note on hole 5 changes from F to F#. If we take C as Sa in Indian music then this tuning will give us all the notes of Yaman-Kalyan Thaat (Lydian scale):

Advantages:

Major Scale Emphasis: Makes it easier to play major scales and modes, particularly suited for country music.

Simplified Melody Playing: Facilitates playing melodies that include the F# or Tivra Ma note of the major scale without bending.

Disadvantages:

Blues Limitation: The altered note can disrupt traditional blues playing, making it less suitable for classic blues techniques.

Specialization: Best for specific genres, reducing its versatility compared to Richter tuning.

Melody Maker Tuning

Lee Oskar company merged the Paddy Richter and Country tuning to create the Melody Maker layout. The Melody Maker tuning alters the 3 blow and 5 draw notes to create a complete Lydian scale in the middle register. This layout marks the scale on second position, i.e. 2nd draw note. To get C on first blow note, one should select G scale harmonica:

Advantages:

Melody Playing: Ideal for playing songs in Kalyan Thaat (Lydian scale) without needing to bend notes. This also excellent for pop, jazz, and other melodic genres.

Ease of Use: Simplifies the execution of major scale passages, benefiting less experienced players.

Disadvantages:

Blues Restriction: The altered notes may hinder traditional blues playing. Especially, chord in first position does not sound as good as Richter tuned harmonica.

Specialized Focus: While excellent for melodies, it may not suit players looking for versatility in blues and folk music.

Natural Minor Tuning

Natural minor tuning shifts the notes to form a natural minor scale (Dorian scale). In this scale B, and E notes are flattened. If we take C as Sa, this means Ga and Ni notes are Komal, which is same as the Kafi Thaat. Note that this scale is designated by its second draw scale. You need to use G scale harmonica for getting C in the first blow position:

Advantages:

Minor Key Playability: Optimized for minor key music, providing a full minor scale (Kafi Thaat) without the need for bending.

Harmonic Minor Songs: Facilitates playing folk, classical, and rock songs that are in minor keys.

Disadvantages:

Blues Compromises: Less effective for traditional blues, which often relies on major scale bends.

Genre Limitation: Not as versatile for major key music, making it less flexible for multi-genre performances.

Harmonic Minor Tuning

Harmonic minor tuning is designed to play harmonic minor scales. This scale has E and A notes flattened. In Indian notation with C as Sa, this means Komal Ma and Komal Dha:

This tuning will be useful in some of the music if we start our Sa from some other position. We had touched briefly on this subject of transposition of swar to suit diffirent music briefly in one of my earlier blog. We shall discuss the mapping of Thaat on different tuning scales at a later blog.

Advantages

Eastern and Classical Music: Suitable for playing music styles that use harmonic minor scales, such as classical and Middle Eastern music.

Distinctive Sound: Offers a unique, exotic sound that is distinct from other tunings.

Disadvantages:

Less Common Use: Less versatile for Western popular music, which predominantly uses major and natural minor scales.

Complex Learning Curve: Requires players to adapt to a different note layout, which can be challenging.

Circular Tuning

All the tuning we discussed so far is based on the Richter tuning. There are many other type that are entirely different from the Richter tuning. Circular tuning gives all base tones arranged in sequence. The idea is that other semitones the player can produce by bending to get a full chromatic range of notes.

Layout of circular tuning is non-intuitive and not popular. This layout has a very long learning curve.

Solo Tuning

Solo tuning address the drawback of circular tuning by creating a repeating pattern of notes that repeats after four hole positions. This is most popular tuning style for chromatic harmonica. Normally the chromatic harmonicas add two more holes to cover complete three octaves. Some cover four octaves with sixteen holes.

Advantages:

The repeating note pattern is intuitive and easy to pickup.

As the same note is available after four holes, it allows for octave playing. Octave playing is a special type of tongue blocking technique to play two notes together separated by an octave to create a rich tone.

Disadvantages:

The note layout is not suitable for blues type of music. Also the layout is not suitable for chord playing other than the first position.

Orchestra Tuning of Harmonica

Orchestra tuning, also known as “Orchestra S” tuning, is a unique diatonic harmonica tuning system designed to provide a fully chromatic scale without the need for bending or overblowing. It achieves this by rearranging the notes in a manner that differs significantly from the traditional Richter tuning. This tuning is also popular in the chromatic harmonicas:

Advantages:

Chromatic Capability: Allows for the complete chromatic scale, enabling the player to perform in any key or mode without complex techniques like bending.

Ease of Play: Facilitates smoother transitions between notes, making it ideal for playing intricate melodies and classical music pieces.

Adaptability: Suitable for orchestral and ensemble settings, where the ability to play accurately in any key is essential.

Disadvantages:

Learning Curve: The non-standard note layout can be challenging for players accustomed to traditional Richter tuning, requiring time and practice to master.

Reduced Blues Expression: Lacks the inherent bluesy feel and bending capabilities of the Richter-tuned harmonica, making it less suitable for blues and folk genres.

Specialization: Best suited for classical and orchestral music, which may limit its appeal for players focused on popular music styles.

In summary, Orchestra tuning offers a versatile and chromatic alternative to traditional diatonic harmonica tunings, making it a valuable tool for musicians aiming to perform complex and varied repertoires, especially in formal musical settings.

Easy Diatonic (EDHarmonica)

Easy Diatonic tuning aims to extend the concept of solo tuning by providing repeating note layout covering full three octave in 10 holes. In doing so, this layout does not have the F note. The F note is one semi-tone above E. The player needs to get F and other semi-tones by bending.

To learn the entire note layout of your EDharmonica you only have to remember the pattern on the first three holes.EDharmonica enables beginners to achieve quick results and offers extraordinary possibilities to advanced harmonica players.

Major Cross Tuning

The MAJOR CROSS tuning, developed by Tony Eyers, allows a major scale to be played in second (or cross) position without any bending. While many players use second position, they often find traditional tunes challenging, due to the bending/overblowing needed for some notes.

Power Bender

The PowerBender tuning builds on the best parts of the traditional Richter Tuning, while altering the scale to make the real juicy and important notes much easier to obtain throughout the whole three octave range. As the name suggests all draw notes bend everywhere, holes 1-10!

Wilde Tuning

This tuning was created by Will Wilde specifically to play rock music. According to its creator, “I designed the Wilde tuning specifically for playing blues rock and hard rock music. As much as I love Richter tuning, I have always found it somewhat frustrating when it comes to playing ‘guitar-like’ minor pentatonic/ blues licks in the upper octave. The Wilde tuning addresses all of the frustrations I had with Richter tuning, whilst still retaining the familiar bluesy feel of classic second position harmonica playing that we all know and love.”

Diatonic harmonica tuning systems each offer distinct advantages and pose unique challenges, catering to various musical styles and player needs. The Richter tuning remains the most versatile and widely used, while specialized tunings like Country, Natural Minor, Harmonic Minor, and Melody Maker provide targeted benefits for specific genres. Understanding these tuning systems allows harmonica players to choose the most suitable instrument for their musical goals, enhancing their ability to express diverse

Posted in music | Leave a comment

Playing Dum in C major scale Harmonica

A few days ago, I published a notation of the famous Hindi song, Dum Maro Dum. The notation is simple and short. One can easily play in harmonica.  Those of you who have tried to play the Dum Maro Dum in a diatonic harmonica must have gotten frustrated. The song starts with Dha in the lower octave, but there is no lower octave Dha in a C major tuned diatonic harmonica. Agreed, it is possible to get the missing note by bending. But bending notes coupled with quick change require some level of skill.

If you remember our discussion in the Indian system of notation where we said that in Indian notation Sa can start from any frequency. Our problem happens if we select middle C as Sa. If we shift our Sa to some other hole then it would be possible to get all the notes in harmonica.

We will use a systematic approach to find the perfect place for our Sa. For this, we shall make a small slider, or use an Excel worksheet and write down all the tone and semitone successively. On the top line, we shall write the Western note and on the lower line, we shall write the Indian swars.

Next, we shall highlight the notes available in our harmonica. I use yellow and pink to indicate blow and draw notes. Here is what I have for my C major tuned Hohner silver star. We can preserve this highlighted slider strip for future use.

Now, we shall highlight the notes that we have in our notation. Let us use a green highlighter for clarity.

We can see the notation uses rather limited notes from the available 20 notes in the diatonic harmonica. We can take advantage of this and shift the lower line to find a place where all notes will be available. Here we need to bend A to get the A# note. But that note comes for a longer duration where bending is comparatively easy.

Now, if we have to mentally adjust the playing position of different swars for every song then it becomes a bit confusing. We can instead rewrite the notation to suit the diatonic harmonica. For this let us put the original layout where C is the same as Sa below this changed scale.

We can rewrite the notation by replacing

OriginalPDNSRGMPDNS
ModifiedSRGMPDnSRGM
Posted in music | Leave a comment

Dum Maro Dum

Dum-Maro-Dum
Posted in music | Leave a comment

Indian Notation System for Word Processor

In today’s computer age, word processors are indispensable tools. Western music relies heavily on symbolic staff notation, which necessitates specialized software for computerized notation. Conversely, Indian notation systems such as Bhatkhande or Rabindrik employ alphabets for notation. Regrettably, the current method of writing Indian notations isn’t conducive to word processors. Drawing from conventions used by musicians, I’ve devised a hybrid convention, amalgamating aspects of the Bhatkhande and Western systems, making it effortlessly typable in any standard word processor.

Basic Notation: We write sudhh swars in its nearest Roman letter i.e. S R G M P D N. Other komal or tivra swars we write in lowercase, i.e. r g m d n. Each note is indicated by a space after the swar. Beat is indicated by a pipe (|) symbol. For example: S R G M | P D N S’| …

Notes in an upper octave are indicated by the apostrophe symbol. The lower octave is indicated by a succeding comma. Example:

N, S R G | N D M – | S’ N d P | m G m R |

A sustained gap is indicated by a dash (-). A semicolon (;) is used to indicate silence.

Timing: Each note followed by a space denotes one matra. When more than one note is played in one beat then we write the notes together without any space in between. For example, in the notation below “PGM” denotes one note, it should be played at the same time that one takes to play the notes like S R, etc.

S R G M | PGM D N S’| …

Half-matra Notes that should be played in half the time it takes to play one note can be denoted by adding a colon after the note. For example S: will mean Sa should be played for just half the time.

Quarter-matra: On rare occasions, we may want to indicate one-fourth time for a note. We can use a dot symbol to indicate one-fourth time for the note. Ex: S.

Ornamentation:

Kan(touch notes): These are indicated by superscipt. Example: S R MG P| G M D S’|

Meed (Glissando): An underline indicates that notes will is played or sung as a smooth glide from lower Dha to Re while touching teevra Ma and Ga along the way. This is indicated as:

N D – R | S N, d, P, | m G m R |

Murki(Trill or Mordent): A small quick taan made up of 3-4 neighboring notes for ornamentation purposes. It is denoted by a preceeding tlide. Ex. P~ could indicate a quick taan such as PdP. Reverse murki or lower modent is indicated by putting the tlide symbol before the note, as in ~P. This will indicate PmP.

Gamak: Gamak is a combination of meed and murki, where the notes slide from one to another with a oscillation. This is indicated by meed sign preceeded by a tlide sign. Example:

N ~D ~ R

Polyphony: Unlike Western staff notation, the Indian notation system does not have a method to indicate polyphonic notes. But with keyboard, harmonica, etc. It is possible to play multiple notes together. I propose to put the notes in a bracket to indicate them being played together. For example, here G and P are played together:

S R (GP) S’| G M D S’|

Section Seperator: A double pipe symbol (||) indicates end of a section like Asthaye, Antara etc. Normally, in indian music asthaye part is played after every section.

Repeat:

Modern notations make many innovative uses of repeat to write the notations in concise manner. We can use few such concept from the western notation system.

Repeat: A curly bracket indicates repeat of the certain part of the notation. If there is some variation in the repeat then that section should be put in a square bracket.First bracket is for playing first time and second one is for second time. For example:

||{S R G D | [GDG – – -]| [GDR – – -]}| MG RS RN, -| N, – N -| P D M G ||

Yeah! You are right. It is the famous Sholay tune.

Measure Repeat Another common type of repeat symbol you may see is a measure repeat, or bar repeat. A bar repeat tells you to play the same thing as in the previous bar. Sometimes you’ll see multi-measure repeats which span 2 or more bars. We can use % symbol for such repeat. A single % sign means repeat the previous beat, %% means repeat previous two beats, and so on.

Da Capo Da Capo is an Italian word that literally means from the head. It is abbreviated as DC and written above the main notation line. This means to play the notes from start. There are three variations to the Da Capo.

1. Da Capo al Fine (often abbreviated as D.C. al Fine): Repeat from beginning to the end, or up to the word Fine (should that appear at the end of the passage)—the word Fine itself signifying the end. Example:

                                                                                 Fine                D.C. al Fine
|{S R G D | [GDG – – -]| [GDR – – -]}| MG RS RN, -| N, – N -| P D M G |

Here after the last “P D M G” the musician should go back to the start and play till “MG RS RN, -”

2. Da Capo al Coda (often abbreviated as D.C. al Coda): Repeat from beginning to an indicated place and then play the tail part (the “Coda”). It directs the musician to go back and repeat the music from the beginning (“Capo”), and to continue playing until one reaches the first coda symbol. Upon reaching the first coda symbol, skip to the second coda symbol and continue playing until the end. The portion of the piece from the second coda to the end is often referred to as the “coda” of the piece, or quite literally as “the tail”. This may also be instructed by simply using the words al Coda after which the musician is to skip to the written word Coda. We use “@” symbol for Coda. Example:


          @              D.C. al Coda
N D – R | S N, d, P, | m G m R |

@
|{S R G D | [GDG – – -]| [GDR – – -]}| MG RS RN, -| N, – N -| P D M G |

Here after playing the first line the musician should go to start and play till the @ sign. After playing “N D – R” he will jump to the portion given in the second line, starting from “S R G D”.

3. Da Capo al Segno (often abbreviated as D.C. al Segno or simply D.S): It means “From the beginning to the sign”. We shall use “$” symbol to indicate the sign. Example:

                                                              $                                                        D.S.
|{S R G D | [GDG – – -]| [GDR – – -]}| MG RS RN, -| N, – N -| P D M G |

In my next blog post I will show how the notation system will work.

Posted in music | Leave a comment

Missing link of analytics – the human

Data analytics can tell us everything from the correlation between adverse weather conditions and profitability to the trends in consumer behavior that fuel the success of a start-up business going to initial public offering (IPO). According to a recent survey that EY conducted with Forbes Insights, the majority (66%) of global companies are investing upwards of US$5 million in analytics, yet only 12% of global companies describe their analytics maturity as “leading.” Those who were not “born” digital have a longer journey ahead than those who are capturing customer data and interactions digitally from the start.

 

Organizations are investing in data collection but are often struggling to derive value from it. So what’s the solution?

Creating value from big data

Analyzing collected information with a human lens is where the true business advantage lies. Without the human element, analytics is an informative tool to create a bank of information. To create value from big data, you need to intelligently analyze, review and act on data findings.

Data, at its best, should have the power to disrupt and transform. Results from a rigorous analysis of short- and long-term data sets can confound an organization’s accepted wisdom and assumptions influenced by human bias. The leading 10% of enterprises surveyed reported a “significant” shift in their ability to use data to help meet competitive challenges. They encourage data analysis to be performed by someone who knows the organization — someone who is fully aware of the business objectives in the context of culture and leadership and who will inspire the right line of questioning. Rigorous questioning will lead to better answers and produce solutions that are fit for purpose.

How can big data drive transformative business change?

A quick glance at the way bigdata enabled analytics is being used will tell us that the current focus of business houses is to manipulate human emotions and choices to push their sales rather than make the product better. Such a strategy can, at the very best work for a short time. Long-term manipulation of people is bound to fail. People are not mere objects that can be expected to produce the same result by a given stimulus. Once people feel being manipulated, they react by losing trust in the process. Fact-checkers of social site content are proof that society is currently getting into a trust deficit. Next, it will follow up with an outright rejection of digital technologies. 

Big data analytics give us the power to combine information from diverse contents and comprehend it. Used to create an adorable product that the consumers will like it can actually transform the user experience. For that to happen data analysis focus will need to shift from user manipulation to user research. Instead of pushing sales promotion data analytics need to feed product development activities. Create values for the customer and society.

Crowd sourced map and traffic information is one such excellent example. This can even expand to reduce carbon footprint. Map navigation may suggest the most eco-friendly route and speed reduce greenhouse gas footprint. In my recent paper, we present an IoT-based methodology to collect the vehicle emission data during vehicle movements and provide information to various stakeholders with location, performance, and status data to address the problem directly. Crowd-sourced performance analysis will show the best operating parameters and point out the problems be it the road condition, vehicle design, or driver’s training. 

Vehicle performance monitoring is not the only example of a transformative business application of big data. Similar changes can be made in inventory management of slow-moving goods, disaster planning, public health, redistribution of pre-owned products, and product recycling. 

Big data analytics is about big collaboration, bringing bigger harmony, about creating systemic changes. It is foolish to misuse such beautiful technologies for manipulating and dehumanizing fellow human beings. 

Posted in Analytics, automation, Environment, right technology, spatial data | Leave a comment

Geo-Spatial Analytics with R

I got couple of questions about what is R. Well, R is freely available language and environment for statistical computing and graphics. R provides a wide variety of statistical and graphical techniques: linear and nonlinear modelling, statistical tests, time series analysis, classification, clustering. R is a free software. Here the word free is used in the same sense as freedom. R can be developed, modified and distributed freely, provided one abides by the GNU General Public License. You may consult the R project homepage for further information.

Being Open source and free, lot of interesting development has happened in R, that help us to perform data analysis quickly. R has many excellent library that can put most costly commercial products to shame. R is powerful, though not very easy to learn. There are too many choices in R and one need to devote considerable time to understand what works best for a particular situation.

In this blog, we will see how to read data from a RDBMS – MySQL. Perform some amount of data manipulation to generate reports. We will also present data in Geo-spatial reports in addition to  standard charts.

For our tutorial, we use month-wise sales data at dealer level. We also have address of dealers in our database that we will leverage to generate sales data at district level. We have this data in a relational database – MySQL. R has library to extract data from most standard data bases. Here to access this data we need to first connect R with the database. This require RMySQL package, which is currently not installed in my machine. I need to get this package. So I give a command in R:

install.packages(“RMySQL”)

It gives me a list of server to choose form. I select the closest server in India, about a minute later I get confirmation that the package is downloaded but it has failed with an error. A quick look in the terminal window tells me that it could not find mysqlclient-dev library. This error is kind of expected in a Linux system. Unlike windows, linux machines compile the code in local machine. I have not installed mysql client programs in my machine, all I have is a server. Naturally RMySQL installation fails. Error message gives me the way out is to install libmysqlclient-dev or  libmariadbclient-dev. I install this library with in Ubuntu:

sudo apt-get install libmysqlclient-dev

and then again try installing RMySQL. This time installation succeeds without any problem.

Note: There are some alternate remedy suggested like installing r-client-dev of libmariadbclient-dev. These solutions do not work, at least in my Ubuntu 14.10 machine. So stick to the suggestion pointed in error message.

To connect to MySQL one needs userid and password. While these can be given in script, it is actually a foolish idea to do so. It is quite easy to share program script with someone with userid and password, I would never take such chance and prefer to use a configuration file to keep the connection recipe secure. The file where these information is kept should be named .my.cnf and placed in the home directory. Here is how you set up .my.cnf file (or ‘c:/my.cnf’ under Windows)
# this is a comment
[client]
user = dj
host = localhost
[rs-dbi]
database = s-data
[lasers]
user = opto
database = opto
password = pure-light
host = merced
[iptraffic]
host = data
database = iptraffic
This file should be readeable only by you. Inside each section, MySQL parameters may be specified one per line (e.g., user = opto). MySQL always considers default options from the [client] group for connecting to a server. To override or add additional options, R MySQL combines default options from the [rs-dbi] group, but you may specifiy you own group in the dbConnect call to tailor your environment. Note that to override options, you must place your group after the [client] group in configuration file.
For instance, if you define a group, say, [iptraffic], then instead of including all these parameters in the call to dbConnect, you simply supply the name of the group, e.g., dbConnect(mgr, group = “iptraffic”).
library(DBI)
# Connect to my-db as defined in ~/.my.cnf
con <- dbConnect(RMySQL::MySQL(), group = "my-db")

dbListTables(con)
dbWriteTable(con, "mtcars", mtcars)
dbListTables(con)

dbListFields(con, "mtcars")
dbReadTable(con, "mtcars")

# You can fetch all results:
res <- dbSendQuery(con, "SELECT * FROM mtcars WHERE cyl = 4")
dbFetch(res)
dbClearResult(res)

# Or a chunk at a time
res <- dbSendQuery(con, "SELECT * FROM mtcars WHERE cyl = 4")
while(!dbHasCompleted(res)){
  chunk <- dbFetch(res, n = 5)
  print(nrow(chunk))
}
# Clear the result
dbClearResult(res)

# Disconnect from the database
dbDisconnect(con)

MySQL configuration file

Instead of specifying a username and password in calls to dbConnect(), it’s better to set up a MySQL configuration file that names the databases that you connect to most commonly. This file should live in~/.my.cnf and look like:

[database_name]
option1=value1
option2=value2

If you want to run the examples, you’ll need to set the proper options in the [rs-dbi] group of any MySQL option file, such as /etc/my.cnf or the .my.cnf file in your home directory. For a default single user install of MySQL, the following code should work:

[rs-dbi]
database=test
user=root
password=

Posted in Analytics, spatial data | Leave a comment

Of Pickle and Money – Part I

Pranati is in very bad mood today. She needs to leave for her office in another half an hour and her cook just phoned to say she won’t be coming.  Great news! Today her boss is coming from Bangalore.  In the afternoon there is a board meeting.  There is absolutely no way she can take a leave.  Yet if she do not cook something her daughter Minu won’t get her lunch.  Pranati checked the store and started to prepare a quick lunch for Minu. She knows, the result will be bad, but that’s all she can manage in this short time. While preparing Pranati remembered the nice food her mother used to make and how she played with her. The memory made her feel guilty.

Pranati works in a food processing plant, Grannis Pickles.  She is chief accountant there.  The plant is one of the best.  They buy best quality ingredients and strict process control. Pickles they make taste good, but Pranati knows the difference.

In her childhood days, Pranati used to help her Grandma in those chore.  Grandma used cut the mangoes and then put lots of salt and spice. Then she will dry it in the sun. Salt dehydrated mango. In this slow dehydration process some fermentation will also take place. That will turn the sugar into vinegar.  Once the fruit is properly dehydrated She will preserve it in oil.  In her plant the process is different. They will boil the mango and spice in vinegar. After good amount of boiling they preserve it in oil.

In this process, most vitamins and antioxidants are destroyed. Fruit will have lots of sugar so it will spoil easily so they add some preservatives.    The taste is also not same.  But plant can’t spend one month to mature the product.  It will be a financial nightmare.

Many times Pranati thought of quitting the job but she needs the money. She has to pay for the car loan that she took. More over inflation has made everything so costly. Even her child’s toys cost almost her weeks salary.  Car has been invaluable help in her commuting to office.  She thought again: no she can’t quit.  In her guilt, Pranati put a reminder to buy a toy for Minu on her way back to home.

As Pranati was returning she went to the toy shop. As usual, she went straight to the barbie doll section. But suddenly Ravi’s sermons came to her mind.  She knew Minu won’t like anything other than the best.  Just to prove Ravi false,  Pranati bought an ethnic doll. She was getting a sadistic picture of Minu trampling Ravi’s idea of ethnic consumption.  She could imagine Minu ripping the flimsy doll apart. She was thinking of making a video of the destruction and giving it to Ravi and see how he defends bad quality ethnic stuff over good quality imported doll.

Minu was happy to get a different doll. She put it in the doll house.  It was too big for the other furniture designed for Barbie doll. “Lack of standards” Pranati thought.  Minu cleared some stuff to make room for her new doll.  Result was some more broken Barbies but surprise of surprise, new doll remained intact.   Pranati was not sure, if she was disappointed of the lost opportunity of proving Ravi wrong or was happy that Minu liked her gift.

Posted in Art of living, fantasy, Story, Sustainability | Leave a comment

Harvest your data

Image result for money

All of us heard about bitcoin, the new money of digital world that is supposed to become the money of the future. Little do we realize that we ourselves are sitting over a goldmine, a goldmine of data. The companies which have found the magic wand are converting this data into commercially viable tangible asset and disrupting the way business is done. Those who fail to find use of their data may well start to prepare for bankruptcy. The days of business as usual has gone. Ability to use and monetize data is now impacting almost every industry that is in business.
Most companies realize that they have wealth of data. Many feel the data to be somewhat important, but few are aware on how to derive economic benefit out of the data. Situation of the business houses today are very similar to Mayan tribes. They have lots of gold, and even realize it to be valuable but is ignorant on how to derive benefit from its wealth. Even though many business are better at leveraging their data for their own purposes than they once were, the value of the data from an enterprise perspective has not been fully realized. Young Bang, VP of the civil health business at Booz Allen Hamilton, said in an interview, “I think the piece a lot of folks miss is: You need to understand the business so you can understand the value of the data and then [you can] monetize it”.
Very often organization faces issues of data quality, changed environment, data confidentiality issues that restrict their ability to use data. Many times data is available in plain text or coded inaccurately. Data analytics help to reduce the errors by pattern searches. It can also use natural language processing engines to extract relevant information from plain text.  Analytics can also flag the document for potential error for further scrutiny.
Now-a-days many organization use surveys and social media sentiment analysis to better understand customer satisfaction levels. Analysis of past services can also help in this regard. For instance, if you know that a particular customer was allotted middle seat in her past 7 flights, you can jolly well deduce that she is pretty unsatisfied. You need to do something about such undeclared dissatisfaction otherwise the passenger may switch to some other airline. You don’t need any costly survey to get such data. A simple analysis from your own data archive is all that is required to pull out such information.
Many companies are using the customer data to develop new product, expand their market. Many manufacturing company has supplemented their products with new offerings and create new value streams. For instance, a leading pharmaceutical retail chain in Kolkata used its customer data to launch medical insurance service. Another shop provided free weighing facility. It captured the customer data and used it to market a weight control package. Companies are not selling data to others, but instead using the data they have to provide new products and services. They are also using the data to price their product correctly and create new market segments.
Real value of data comes from combining different data. For instance real estate prices can indicate changing demographic profile in a locality. In turn, this can indicate latent demand for products and services. Using analytical algorithm, data scientists can pinpoint location that has such unfulfilled demand and help business to locate their outlets better.
Every business operates in its own way and their practices evolve over time.  More and more business run today on digital platform. New technologies, like IoT, RFID are making the products generate rich data that was not available in the past. These data, by themselves has no value. It require to be matched with some other data and analyzed to generate new meaning and discover new possibilities. The business that embraces these technologies and harvest their data will flourish.
Posted in Analytics | Leave a comment

Auram Field Trial

Compressed Earth Blocks are environment friendly alternative to normal bricks. It has better properties than earth fired bricks and does not pollute environment. Automated press can make about 1000 bricks per hour. Automatic controller for the press has to perform in dusty environment with lots of vibration. The bricks need good control on dimension.

DeciGen Consulting Services developed complete electronics for the controller and also advised on suitable modification of the press structure to ensure dimensional accuracy.

Posted in automation, robotics | Leave a comment