Introduction to Modular Arthimetic

Introduction

The study on modular arithmetic is very common as it has applications in many fields. For example:

  • in mathematics of course; it is one of the foundations of number theory
  • in computer science; cyclic data structures
  • in cryptography
  • in banks; to trap user input errors in bank account numbers
  • in music; twelve-tone equal temperament
  • and many more.

Its foundation wad laid by Euclid in third century BCE. (Pretty old and used by modern computers)

It is a system of arithmetic for integers, where numbers “wrap around” upon reaching a certain value—the modulus. A very simple example for it is a clock. Consider a 12 hour clock. If the time at the moment is 10:00 A.M, then after 4 hours the time will be 2:00 P.M, not 14:00. Therefore, the clock is modulo 12.

r ≡ a (mod m)  where r, a and m are integers. (which is nothing but  a = q x m + r )

For example:

2 ≡ 14 (mod 12)

2 ≡ 26 (mod 12)

2 ≡ 38 (mod 12)

2 ≡ -10 (mod 12)

The set of all numbers which gives remainder 2 when mod 12 is performed is {…,-10, 14, 26, 38, … } is called congruent modulo 12.

If a, b, c are integers ∋ a(mod m), b(mod m), c(mod m) are equal, then a, b, c are said to be congruent.

a ≡ b(mod m) ≡ c(mod m) and  a(mod m) = b(mod m) etc.

Properties

  1. a ≡ a(mod n)
  2. a ≡ b(mod n) ⇒ b ≡ a(mod n)
  3. a ≡ b(mod n) and b ≡ c(mod n)  ⇒ a ≡ c(mod n)
  4. (a + b) (mod n) ≡ [a(mod n) + b(mod n)] (mod n)

Example (24 + 57)(mod 7)

[24(mod 7) + 57(mod 7)](mod 7) = (3 + 1) (mod 7) = 4

 

 

GHCI ’15

Hello!

I am blogging after a very long time. I was busy with my exams and last minute preparations.

So, few months ago I applied for a scholarship to attend Grace Hopper Celebration India, 2015. It is a celebration for women in computing. It was held in Bangalore from 2nd of December to 4th of December. The thing which I least expected happened. I got selected and also my friend. I really did not know what to expect from the celebration. I was fully funded for the trip which include accommodation provided by them, food, conference cost and travel expenses ( not fully covered though 😛 ). All the student scholars connected via emails and social networking. People who had already attended shared their experiences which sounded wonderful. I was pretty much excited for this celebration. I was all geared up for this in spite of last minute changes in the plan.

DAY 1: 2nd December, White Orchid, Bangalore

I reached Bangalore station and took an auto to the hotel Marks Grandeur. I checked in and realized that I had to share a room with another girl, a Srilankan. She had been to India for the same conference last year too. That was cool. I could see student scholars every where in the hotel.
The biggest question which arose was what to wear for such a conference. Everyone suggested us to wear formals. I had not brought any but I decided to wear semi-formals. We all got ready and headed to the venue in a bus arranged by them. I registered at the entrance and I received a bag-pack full of goodies. I had to carry it every where I went. Few student scholars came and introduced themselves. I could recognize few of them from the social networking and the groups we had made. We ate a little snacks and took seats in the convention center. Telle Whitney,  President and CEO, spoke regarding the institute (Anita Borg), her experience and the conference.

ABI India’s Geetha Kannan discussed how sexism and the fear to speak up keeps women from staying in the tech field, and what ABI is doing to change the culture in India. This conference was a record breaking conference with 2300 participants.The program begun with the following key notes.

Keynote 1: Kimberly S. Stevenson, Corporate Vice President and Chief Information Officer of Intel Corporation

Keynote 2: Roopa Kudva, Partner of Omidyar Network and Managing Director of Omidyar Network India Advisors

And followed by a disussion by the following panel.
CXO Panel: Panelists – Dinesh Malkani (President, Cisco India and SAARC), Manish Gupta (Vice President, Xerox Corporation and Director, Xerox Research Centre India), Rekha M Menon (Chairman, Accenture India), Sandhya Vasudevan (Managing Director & Chief Operating Officer, Deutsche Bank Group in India), Sushma Rajagopalan, (Chief Executive Officer & Managing Director, ITC Infotech) and moderator – Dr. Gopichand Katragadda (Group Chief Technology Officer and Innovation Head, Tata Sons).

IMG_20151202_171400480_HDR

Panel Discussion

 

In the end we had food, DJ and little thing such as tattos, nail art etc (this was a conference for ‘women’ 😉 )

DAY 2: 3rd December, Vivanta by Taj, Bangalore

Taj Vivanta was at walkable from our hotel. I got all ready for the interesting day ahead.
I attended two talks.

Talk 1: Auditing in Cloud Computing Solutions with Openstack : By Divya K Konoor (IBM)
This presentation discussed in depth how auditing works in a cloud environment. Cloud Auditing Data Standard (CADF) , the auditing challenges in distributed cloud platform like OpenStack and how they are overcome using pyCADF was taken.

This was really advanced. I had heard all the words but did not understand any.
I went and spoke to Divya after the talk and asked for her suggestions. She suggested to contribute to open source (which I had started 🙂 ).

IMG_20151203_090026670

Talk 2: Aadhar – An Indigenous Solution to an Indian Challenge: By Asha Krishnan (UIDAI)
The gist of the presentation was as follows:

There was no pan-Indian resident-identity creation body in India, prior to UIDAI. Various institutions issued identities to their beneficiaries which are based upon other identity tokens held by the beneficiary. Governments spend a lot of resources on delivery of services, however, there are challenges in the same. The Aadhar program was conceptualized primarily to address the above challenge. The program is now six years in the making. It is the world’s biggest biometric database.

Then I attended the career fair where the companies explained their work and gave us goodies. I had snacks and went back to our hotel.

DAY 3: 4rd December, Vivanta by Taj, Bangalore

Talk 1: Catalyzing the Metamorphosis: Evolution of a Novice into a Corporate Asset. By: Kavitha Shankar and Vineeta Shukla (Global Foundries Engineering Pvt.Ltd)

This was quite an interesting presentation. It dealt with the challenges faced by the newbies in a company and how to overcome those challenges. While trying to rise up to the technical demands of the job assigned to them, they also have to assimilate the corporate culture. This phase is challenging for the young women. Dealing with matrimony and motherhood and career simultaneously was discussed.

IMG_20151203_122510927

Career Fair

I, unfortunately, couldn’t attend any other talk that day. I attended the career fair which was left on day 2.
There was an interacting/introduction session with the Asia head of Adobe. That was very interesting too.
Then I collected the certificate and there was the end of the amazing conference.

The celebration was indeed a celebration for women in computing. It was an inspiring experience. 🙂

Building and running Linux Kernel.

Hello!

This was my first step in contributing to an open source organization. Although it takes approximately 2-3 hours  to complete the process, it took me very long, approximately 6-7 months, to figure out and to get started. Here are the steps to get started.

The following steps will help you clone and build stable version on Ubuntu.

For cloning and building, you need few tools such as git, gcc, ncurses-dev etc.

  • sudo apt-get install libncurses5-dev gcc make git exuberant-ctags bc

Clone a stable kernel tree.

  • git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
  • cd linux-stable

Since here we are planning to work on the latest stable kernel, we could get it by getting the latest kernel tag

  • git tag -l | less

Now, a list of kernel versions appear. Select the largest version. The tags that end with -rc aren’t stable ones. I initially cloned the unstable version, -rc4, and found it difficult to work with.

  • git checkout -b stable <tag>

Kernel Configuration.

When initialized, many or few kernel drivers can be turned off, on or built as modules. When you download the source tree, it doesn’t come with a .config file. So we can duplicate it from the kernel running.

When I first cloned it, the unstable version, my network drivers were turned off.

  • cp /boot/config-`uname -r`* .config

Now, run the following command for configuration.

  • make olddefconfig

Building.

To build, run. It may take really long time to get completed. ( Actually, I completed my homework while it was getting built. 😛 )

  • make

Make modules and install

  • sudo make modules_install install

Now, we need to update the grub by adding this new kernel too. The grub bootloader offers the user a choice of old versions too. This can be useful if the kernel you are working on gets broken. You can shift back to the older version anytime.

  • sudo update-grub2

In fact, I broke the kernel couple of times. (crashed! 😉 )

Now, reboot. You are ready to go!

OSFY : My first Article

Hello!

I had been trying to write for Open Source for You from a very long time and finally my article is now a part of OSFY: October 2015 edition.

The article is on Android Studio. As I was working on Android at that time and the theme of the magazine for the month was the same, how could have I missed a chance of writing an article ? 😉

You can check it out here. Try installing it and get your hands a little dirty.  🙂

( Hoping for another article soon )

Spreading awarness for Sustainable Livelihood

Mahatma Gandhi once said, “It is health that is real wealth and not pieces of gold and silver.” One needs to be healthy, mentally as well as physically to lead a sustainable livelihood. India is one of the highest ranking countries in the world for the number of children suffering from malnutrition. Not only malnutrition, India suffers from a lot more issues, such as AIDS, malaria, Cancers etc.

“Healthy citizens are the greatest asset any country can have.”― Winston S. Churchill.

Healthy citizens are definitely an asset to the society.

Whenever either of my parents are sick, everything around me comes to a stand still.

I have seen many people around me falling sick either because they are careless or ignorant. This triggered an idea for my Social Service Responsibility project. It was a team of 5.

We planned to conduct awareness in and around are neighbourhood followed by a free heath camp.


The first step: AWARENESS.

awarness
                         Spreading awareness

We informed the people in our neighbourhood regarding the idea of awareness and everyone was pretty excited.

We all met at one of our friend’s house, made all the necessary arrangements. We showed them a presentation and explained them the problems in their daily routine which can affect their health in a long run.

We spoke about the commonly caused diseases like common cold, obesity, asthma etc. We also explained them the importance of metal stability midst of hectic schedule of children as well as adults. We also mentioned few ways in which yoga can help relieving them from health issues. Importance of physical activities and sports was also the part of awareness. We made all the children realize that how outdoor activities are better than indoor. And also organized games for them.


The second step: HEALTH CAMP.

diabetes checkup
                         Diabetes checkup

There are many steps to be taken in order to conduct a health camp.

We started with contacting a hospital which was ready to take this as their social responsibility – Care Hospital, Nampally, Hyderabad.

We had a meeting with the Marketing Manager, Mr. Mahesh who was very supportive and happy to see students like us taking this kind of responsibility. He explained how this project can also help them and us morally. Then came the question of the capital. He suggested a social service group which takes up similar kind of responsibilities and will be ready to fund it.

We found are sponsors and they had a huge budget of 70,000 INR.

We were a part of the hospital and all the arrangements were made by the sponsors. The place, which was a government school, medicines (free of cost), publicity and food for volunteers and doctors (which was delicious).

The hospital arranged the equipment transportation. The camp included the following checkups:

  • General health checkup
  • Sugar level checkup
  • Blood pressure checkup
  • Eye checkup

and few more.

We helped the doctors with the equipment (and also as assistants 😉 ), registration of people, keeping track of them in the hospital records, and also guided them through out the camp.

We made new friends of all age groups. A little boy who was eager to get his sugar level in the blood get tested :P, an old lady who was not afraid of the syringe ( she may have had many experiences ) and a young lady who was frightened by an ACCU-CHEK machine.

It was fun and also a learning process. I will definitely take up similar works in near future and make a minute effect to make this world a better place to live 🙂

To keep the body in good health is a duty… otherwise we shall not be able to keep our mind strong and clear.
– Buddha

FUDCon Pune 2015: An Experience to be shared.

FUDCon ’15

I was in Pune from 26 June to 28 June, 2015, attending FUDCon 2015.

It was definitely a great experience of going to a new place, meeting new people and learning new things all at the same time.Here is my day wise experience.

DAY 1: Friday, 26th June 2015

There was an introductory session , Fedora for everything and everyone which supposedly started at 9:00 A.M.I was a bit late and lost in the big campus of MIT (Maharashtra institute of technology, Pune).

MIT entrance

MIT entrance

And then I realized that I was not the only one lost, one of the speakers, Sarup Banskota, was in the same condition (which I did not know by then that he was a speaker :P) . I had a small conversation with him and contacted the juniors who guided me then.

We attended the discussion on how open source should become a part of present education system and how remote places in Bengal have already started working on it. NCERT has also taken a similar initiative,

P.S : This was that talk which I attended unknowingly. Entered the wrong place at wrong time. But was not worthless at all.

Then I attended a  talk on ABI Compatibility for Dummies by Sinny Kumari and then followed by Spartakus: Fighting kernel ABI breakages through semantic processing of linux source code by Samikshan Bairagya. Little did I understand but got to know about some thing new and interesting.

After lunch I attended lightning talks which were short and interesting followed by a talk on Linux-IO : Native scsi target implementation in linux kernel , which I did not understand. 😛

Then which I understood completely was the next talk Documentation: It’s Important and Difficult.


DAY 2: Saturday, 27th June 2015

My day started with Present and Future of Fedora Workstation talk which included the new apps, features and changes in fedora workstation and its impacts.

Then I attended a talk on Documentation in Open Source since it was an extension to what I had attend on day 1.

This included the process of documentation and the tools used for each step.

Then which I was eagerly waiting for to clarify my doubts on was Compiling Linux Kernel & Submit first patch.Disappointingly the speaker was late and began writing driver. :(

Nothing of compilation and first patch was taken. I did not attend the second half of the day.

DAY 3: Sunday, 28th June 2015

Since I had a slight idea about dockers and container (Thanks to Bithin bhaiya),I decided to attended all the talks and workshops related to dockers and container.

Docker Basics Workshop.

There was a huge wifi trouble which was making it difficult to have a proper workshop.

But nonetheless, this was made very simple and easy to understand by the speakers Aditya Patawari, Lalatendu Mohanty, Shivaprasad Katta .

Fedora Atomic.

Everything was linked with the previous workshop. Detailed talk on Project Atom was given followed by the workshop. From setting up Atomic host to deploying containers.

Hands-On Kubernetes.

This was again more of a talk which was supposedly a work shop due to lack of time and resources.

Orchestration of Docker containers using Openshift v3 and Kubernetes.

This one was difficult and was made boring by the speaker.

Most of them were from RedHat. There were handful of students attending FUDCon. People were surprised seeing freshers and sophomores attending it.

Everyone was really helpful and ready to explain in layman’s language to students like us.

I asked Sarup Banskota for suggestions for attending talks as a sophomore and suggested me that I cannot learn all of the new things at a time (some of which were new to him too ) but can know about new things and learn gradually.

The most inspiring thing was people very much experienced ( who would be around 40 years old) were sitting with us learning new things, putting up questions and suggesting new ideas.

This was An Experience to be remembered and made use of.

Sublime Text editor 2: Making Coding easier.

Do you find it difficult to write or debug your code?

Here is something which can help you code faster and make your life simple.

Sublime Text editor is one such editor which can make you forget other editors.

If one finds out these specialties, they would never go back to any other editor or may be would not even try any other editor.

  1. Multiple cursors: It helps you to navigate easily and edit the code around the braces.
  2. Vintage mode: This is really useful for people who do not use keyboard shortcuts
  3. Very fast code editor: Sublime Text 2 itself opens instantly. Files open instantly.
  4. Offers a command palette: It consists of all the functionality you might require during your project
  5. Plug-in community: It has a very active plug-in community. If you have thought of creating a new plug-in, there are chances that they have already been created and you just need to install them.

Cross Platform

It is a closed source project and is available for OS X, Windows and Linux.You can buy it here.

It uses a custom UI toolkit, optimized for speed and beauty, while taking advantage of native functionality on each platform.

Configuration files in Sublime Text are text files that conform to a predefined structure or format. JSON predominates, but you’ll find XML files too. For the more advanced extensibility options, Python source code files are used.

It has real time built in Python console for interactivity.

It supports variety of languages. Few of which are AppleScript, C, MATLAB, C#, PHP etc.

Default sublime-desktop

Default sublime-desktop

Vintage Mode.

Many have been working on other editors such as vim. For them, Sublime Text 2 has a Vintage Mode.Vintage is a vi mode editing package for Sublime Text 2. It allows you to combine vi’s command mode with Sublime Text’s features, including multiple selections.

Vintage mode is developed in the open an you can contribute to it. Vintage includes most basic actions: d (delete), y (copy), c (change), gu (lower case), gU (upper case), g~ (swap case), g? (rot13), < (unindent), and > (indent).

Themes

It has various color schemes and other visual themes in preferences. It has a wonderful syntax highlighting scheme which can be customised.

In addition to that other themes can also be added and customized. It is very flexible and almost anything can be customized from Key Bindings to Macros just with simple JSON files.

It consists of a side bar which helps in switching to the portion of the code you want to refer to.    Just one click on the side bar will take you to the selected portion of the code.

Switching a project.

Ctrl + Alt + P will help you to switch to other project. If you have switched to another project without saving it, the work is restored the next time you open it.

Screen shot showing a C++ code.

Screen shot showing a C++ code.

Multiple Selection

Ctrl+Shift+L helps to split the selection into lines .You can select multiple occurrences of a word by pressing Ctrl + D. You can also swap adjacent words by pressing Ctrl + T. You can edit multiple line of code by selecting an entire column at a time.

Column can be selected by pressing Alt + ⇧ + Up and Alt + ⇧ + Down.

All cursors then behave as if each of them was the only one in the text.

And other small things which can come in handy are:

Open search panel     Ctrl + F

Toggle regular expressions     Alt + R

Toggle case sensitivity     Alt + C

Toggle exact match     Alt + W

An very important thing which has made sublime a success is its ability to Goto Anything

Goto Anything

Goto Anything panel is lightning fast and gives quick results. Working on multiple large code bases becomes easier, where there may be different classes with the same base filename. It is a very cool feature which increases the rate at which work can be done.

It can be triggered with Ctrl+P, it is possible to type part of a file name to open it or type @ to jump to symbols, # to search within the file, and : to go to a line number.

For example

name :10, will open the ‘name’ and take you to line 10.

And to close Got Anything just press Esc.

Distraction Free Mode

Distraction Free Mode shows your files full screen, with nothing but text shown in the centre of your monitor. All UI chrome is hidden, but accessible. Distraction Free Mode can be entered into via the View/Enter Distraction Free Mode menu item.

When in Distraction Free Mode, all UI chrome (side bar, minimap, status bar, etc) will be hidden. You can selectively enable parts of the UI via the View menu – your settings will be remembered next time you enter Distraction Free Mode.

As told earlier, search is very efficient and lightning fast. Just by typing the shortest set of unique characters you can find your desired word which can be done by triggering Ctrl + F.

Auto Completion.

Based on the language you are working with, Sublime Text helps you complete the entries and also completes the variables created by the user.

Few other features are:

Find as you type, begins to look for the text being entered as the user types without requiring a separate dialog box.

Spell check function corrects as you type.

Macros.

Repeat the last action.

A wide selection of editing commands, including indenting and un-indenting, paragraph re-formatting and line joining.

Almost everything can be done with the keyboard. It has shortcuts for almost all the features in it. It will definitely be useful for the people who avoid using mouse.

These are just few reasons why one should at least try using Sublime Text 2. To try an unregistered version of it, check out this and download the relevant package. After using it, you would definitely recommend this to others.

CORE MEMORY

I was just surfing the net and I came across a very fascinating part of history of computers.

Core Memory or Magnetic-core Memory.

It was a form of random-access computer memory for around 20 years (circa 1955–75).

It uses tiny magnetic toroids (rings), the cores, through which wires are threaded to write and read information.

Each core represents one bit of information.

The way in which the cores were magnetized by the current (say clockwise or anti-clockwise) would decide a bit to be zero or one.

The process of reading the core causes the core to be reset to a “zero”, thus erasing it. This is called destructive readout.

Photo

The first magnetic core memory, from the IBM 405 Alphabetical Accounting Machine. The photo shows the single drive lines through the cores in the long direction and fifty turns in the short direction. The cores are 150 mil inside diameter, 240 mil outside, 45 mil high. This experimental system was tested successfully in April 1952.

Photo

Photo

The half currents applied in vertical and horizontal directions switch that particular core at where they coincide.

Individual half current is not large enough to switch the cores through which they pass.

One interesting past.

Removing Linux Kernel Source.

If one has cloned and built the source code of kernel and now wants it to be removed can follow the following steps.

Removing it from the grub in the conventional way will not work because it wasn’t installed from deb packages.

Open terminal and type the following.

( {BAD_KERNEL_VER} here indicates the version which is to be removed )

sudo rm -rf /lib/modules/{BAD_KERNEL_VER}/

sudo rm -f /boot/vmlinuz-{BAD_KERNEL_VER}*

sudo rm -f /boot/initrd-{BAD_KERNEL_VER}*

sudo rm -f /boot/config-{BAD_KERNEL_VER}*

sudo update-grub2

The first command removes the bad kernel’s installed modules. The rest of the commands remove the bad kernel image and any initial ramdisk images, system maps, and kernel config files.

The last command updates your grub and one can see the bad kernels are no more seen 🙂

The Last Lecture: Achieving your childhood dreams.

The Last lecture is by Randy Pausch. He was an American professor of computer science, human-computer interaction, and design at Carnegie Mellon University in Pittsburgh, Pennsylvania.

He was diagnosed  with Pancreatic cancer and he then gave a very inspiring lecture called The Last Lecture: Achieving your childhood dreams. He co-authored the book The Last Lecture on the same.

According to me one should definitely watch this video. This is simply awe-inspiring. There was a smile on my face through out the video. It never felt that he is not going it live long enough. His lecture was about achieving childhood dreams, enabling others dreams and the lessons learnt.

There is not one but many things one can learn from this lecture.

This video reminded me or my silly yet fun filled childhood dreams. Few were as follows.

1. Para-gliding

2. Scuba diving ( In-spite the fact that i can’t swim)

3. Gaze at the stars all night until the break of the dawn.

4. Go to New York

and many more.

This has made my wish even stronger.

He also talks about the brick walls we face in our lives i.e, the obstacles.

They let us prove how badly we want things. Everyone faces many hurdles in life. Sometimes the wall breaks at once and sometimes not. But one has to keep trying until the wall breaks. Coming to me, even I had to work hard every time. Let it be a small class project or an examination. Nothing was easy. We strive hard for the things we want badly. That is when the wall breaks. If we don’t, that implies we were not passionate enough to break the wall. My sir says when you do something for the first time, it is always hard. Just like static friction is greater than the kinetic friction, the initial stages are always harder, but when you overcome it, it becomes easier. But you have to bring all your force and apply constantly.

Randy Pausch also say that everyone should make their fundamentals strong.

The strength of every structure lies in its foundation. Similarly, one must have their fundamentals strong, whether it be studies, sports, any sort of activity, moral values etc.

He then talks about helping others dreams come true.

Once we have accomplished our dreams, should help others achieving it. That gives more happiness. When I complete my work and then help others complete theirs make me happy. I feel, one should not “do” others work but should help if they are stuck. Otherwise the other person learns nothing and may not be able to full fill their dreams. And asking for help should be the last resort because, by making mistakes, its us who learn the most.

There are many more things this video teaches us. It teaches us to be original, creative.

This might also change ones perspective of seeing and facing challenges. This will let you childhood dreams come alive again.

I would suggest that everyone should take time to watch this video. This will surely make your day 🙂