Connecting to MQTT in Swift & IOS

MQTT is a Message Queuing Telemetry Transport protocol, it is also called MQ Telemetry Transport. It is widely used in IOT (Internet of Things) to have a good connectivity between machine and machines (machine-to-machine M2M). It is designed to be  extremely lightweight to publish/subscribe messaging transport. It is useful for connections with remote locations where a small code footprint is required and/or network bandwidth is at a premium. It is widely used in different areas like sensor communications, satellite broker link, dialup connection, healthcare providers and home automations. It is extremely ideal for Mobile Application because of its light weight, low power usage and minimised data packets.. For more information about MQTT visit Here.

I recently had a chance to implement it to one of the smart home application i developed, Therefore i thought of sharing my experience relate  to development. I have implemented this Protocol to my IOS application using Swift programming language.

Instruction to implement MQTT

One of the MQTT library available for IOS is called Moscapsule Visit Here

Lets get started……………..

Add these two lines to your podfile

run the command pod install. Then close and open your .workspace file

Now you have the Moscapules added to you project, open your AppDelegate.swift file and ad the following codes. You can see the comments inside the code itself

Thats it, Its very simple to connect, Since you have implemented this code in you AppDelegate, You can start the connection from anywhere inside the application by calling

You can check connection and subscribe to topics

The best way to send to your view controllers is buy Broadcasting the received message in onMessageCallback . Here is how i have done it.

You can add a broadcast receiver to you ViewController so that you can receive this broadcast

Thats it, Its very simple. Hope this helps for someone.

If you have any Question or suggestions please leave it below in the comments section. Happy Coding 🙂 . Enjoy MQTT


Protect Yourself From WannaCry Ransomware Attacks

Last week the earth experienced a largest global Ransomware attack in internet history and we were not able to defend or handle it, rather we are just good at calculating the damage caused but Wannacry program. The damages are in both human lives at hospitals and in dollars. This malware has encrypted more than 200,000 computers in more than 150 countries.

What is a Ransomware?

It is a simple computer malicious program written by programmers and often transmitted by emails as a attachment. Once the user try to download the attachment from the mail by double clicking the program will execute and start doing its work. First it will encrypt all the files and folders in your computer and then it will look for SMB ( Server Message Block ) connection in network, then the  Ransomware is spread to other computers in your network through SMB network connection.

In this particular wannacry program when the user try to open his files  and folders, it opens a program saying “oops your files have been encrypted” , It also asks you to pay a $300 to $600 in bitcoin to restore access to your files and folders. If you failed to make the payment within 7days your files will be permanently deleted from your system.

what are the major casualties?

An estimate of 40 hospital in UK has been fully effected by this attack and some of them had lead to fully close the out patient department for days.

Unapproved online sources says, there are company’s paid up to $60,000  to regain accesses to their files, but since the Bitcoin currency is virtual account and the bitcoin account owner is anonymous, its hard to find who had really paid and how much he earned.

 Is the malware currently active?

According David Kennedy, cyber security consultant formerly with the NSA, who looked in to the original program says that software is outdated now and it is not harming any PC at the moment.

How to avoid these type of situations?

These types of situations are really rare, but can happen any time. I will give you some suggestion to be prepared defend this type of situation.

  1. No matter what, always keep a backup somewhere in external resource that is not connected to internet.
  2. keep your computer up to date, always make sure to install all the security update released by the operating system.
  3. Beware of what you execute from your emails and popups.
  4. Use good Antivirus software. (It will slowdown your PC but it will prevent you from being a victim)
  5. Learn and use Linux, because most of these virus effect only Microsoft Operating system.

Hope this article will help you. please leave your comments and suggestion below. Thank you 🙂

List of countries in the world – Raw Data

I am developing an android application. In which i must ask the users to select their country, Therefore i searched on the internet for list of countries. I got lot of results, but i cant use those data in my application directly, with out making some modifications. Its just waste of time.

Here i am sharing the raw data which i have modified and used it in my applications. Hope this will we helpful for someone, while coding.

Thank you. Happy coding. 🙂

Sample application form for US diversity visa program

I have tried the us diversity program for the past three years, but i have not found lucky enough. In this article i will give you some information and screenshots of the US diversity program.

Usually the us diversity program opens for application in the period of October and November. Usually they accept application for around 30 days.

sample application form

Screenshot from 2015-10-17 10_38_41


Screenshot from 2015-10-17 10_43_57

Screenshot from 2015-10-17 10_48_04

Screenshot from 2015-10-17 10_48_24

Screenshot from 2015-10-17 10_48_32

Screenshot from 2015-10-17 10_49_01

Screenshot from 2015-10-17 10_49_12

Screenshot from 2015-10-17 10_49_24

Screenshot from 2015-10-17 10_49_29

Screenshot from 2015-10-17 10_58_02

Screenshot from 2015-10-17 10_58_53

Screenshot from 2015-10-17 10_59_11



Good Luck!

mysql get the existing table code

I had a situation where i have a table with huge lot of fields. i want to recreate this table with some other name. It would be very easy if i have any user interface like php myadmin or mysql work bench but since i am working on the server there is no UI. Therefore i was looking on the internet for a way to get the sql code for existing table, so that i can just recreate the table by just running a single command.

then i found this on My Sql Developer page

Here is the results

Screenshot from 2016-05-16 14-43-25

Now i just need to copy the existing code and change the name of the table to the name i want and then run the script. thats it.


Privacy in Ubiquitous Computing

In the recent years use of desktop computers has fallen gradually, this means people have started moving to next generation of computing called Ubiquitous Computing or everywhere computing. In Ubiquitous environment computers are embedded in to the environment. This way of embedding computers in to the environment will make the humans life easy in many areas of day to day life such as health care, sports, education, etc. The main goal of ubiquitous environment is to free users from interacting with computers by making computers invisible to the users. When it comes to invisible computing one of the major barrier in implementing the ubiquitous environment is Privacy.

When it comes to privacy, there are many different kinds of privacy. Therefore it is difficult to narrow it into one section. According to Malcolm Crompton “What is Privacy?” “Some fundamental part of human dignity requires privacy. Privacy is part of the claim to personal autonomy. It supports the various freedoms that democratic countries value”.  (S. Dritsas, D. Gritzalis, and C. Lambrinoudakis, 2006)

Weiser, (1991); Lamming & Newman,  Hindus & Schmandt, (1992), “The need to understand and protect personal privacy in sophisticated information Systems is becoming critical as computing power moves out of the box-on-the-desk into the world at large. While we are entering the age of ubiquitous computing”

But in my point of view there is no way to define exactly “what is privacy”, it varies with people and the information they have and, what they want to share and not to share.

Marc Langheinrich states 5 different types of privacy in his Article “Privacy by Design – Principles of Privacy-Aware Ubiquitous Systems “which all has developed since the first privacy issue arose in the 1360s. These five types are “territorial privacy”, “media privacy”, “bodily privacy”, communicational privacy” and “information privacy”. (Cedric Laurant, 2003)


In this paper we will look we will mainly look on communicational privacy and information privacy. But we also have a small concern on territorial privacy, media privacy and bodily privacy.


Ubiquitous computing interface reach beyond the computational infrastructure and attempt to encompass the surrounding physical spaces as well. Ubiquitous applications often exchange physical location and other context information about users and resources to enhance the user experience. In this type of situation information and physical security becomes a question. As a result such environment becomes prone to more severe security threats, which can threaten people and other equipment’s in the physical world. Therefore traditional mechanisms that focus on digital security becomes in adequate in ubiquitous environment.

Accumulating active spaces with active sensors enables the construction of much more high intelligent spaces and computing capabilities, using various sensors and embedded devices in the environment can capture the user’s full information. Unfortunately these environment will be a high threating for the users privacy. Using these environment system administrators can track the particular user’s information and use it for their commercial purpose. Some environments like homes and clinics the users have the abundance of sensitive and personal information which must be preserved, most of the situation the users don’t want to be tracked.

One of the main characteristics of the ubiquitous applications in the rich full user interface for interaction between the user and the environment. To do this verity of multimedia mechanisms are used for input and output and to control the physical aspect of the environment. In this situation the set of users in the space may affect the security properties of the environment. Because of the nature of interaction the users in the space cannot easily be prevented from hearing and seeing things happening in it, therefore it has to be taken in to major consideration while designing the access control system. The access control system should allow the individual and the group or devices to use the environment in a manner that has collaboration, while giving the appropriate access control policies and preventing unauthorized use of the environment. While designing the users interface physical and the virtual aspects of access control for such environment have to be considered.

It is important for ubiquitous computing to have convenient and flexible method for defining and managing security policies in a flexible manner. The policy management tools provide the administrators ability to implement and specify rules to gain the greater control over the behavior of entities in their system. But currently most network policies are implemented by the system administrators using the tool based on scripting application that intact through the list of low-level applications. Their policy management software’s maintains a separate database for corresponding device and resource interfaces, these tools need to be updated frequently to accommodate new hardware or software, or the system will be difficult to manage it. As a result general purpose of the low level management tools are limited in functionality. Since most policy management tools deal with the low-level interface, the administrators may not have clear picture of the policy management actions. These discloser security policies may be a risk for security. Example, someone knowing whether the system is on the lookout for an intruder could actually be a secret. Thus, unauthorized person should not know the security policy.

One of the great deal of concern in ubiquitous environment is the concern over the new types of threads, information operations and cyber-terrorism, which is the natural consequences of increasing importance in the electronic information and the heavy reliance on digital communications networks in most of civilians and military activities. Example info ops, which is defined as “actions taken that affect adversary information and information system while defending one’s own information and information system”. Info ops is a serious concern in today’s networking in this stations cyber-terrorist and other techno villains can exploit computer networks, inject misleading information, steal electronic assets. Ubiquitous computing gives a very high priority for this and adds more capabilities to defend info warriors and make info ops a much more severe threat. ( E. A. M. Luiijf, 1999)

The security and the privacy guarantees in ubiquitous environment should be specified and drafted in to design process rather than considering as an add-on or future thinking. The previous effects in reroofing security and anonymity in to existing system had been proved to be ineffective and in efficient. The main two examples are internet and Wi-Fi, both of these still suffer from inadequate security. In this section we will look on important requirements needs for security of subsystem to be used in ubiquitous environment. (R. Mundy, D. Partain, and B. Stewart, 1999)

The main focus of ubiquitous computing is to transform users in to first class entities, where users no longer need to show more concern on their computing machinery. Therefore even the security subsystems can be transparent to some level, blending in to the background without distracting the users. When it comes to a security, the security architecture deployed should be able to provide different levels of security services based on system policy, context information, environmental situations and available resources, etc. situations which require a high level of assurance or greater security may require users to interact with security system explicitly by authenticating themselves using a variety of means to boot system’s confidence.

Traditional security is static and context insensitive. Ubiquitous computing integrates context and situational information, transforming the computing in to virtual space. In this situations the security services has to make full use of context information available. For example, access control decisions may depend on time or special situations. The principals of “Need to Know” should be applied on temporal and situation basis. For instance the security polices must be able to change dynamically to limit the permissions for the times and the situations they are needed. However viewing “what security policy might be activate in what particular?” should not be possible. Most of these, there needs to be a verification for authenticity and integrity of the context information required.


The security subsystems flexible, customizable and adaptable. It should be able to adapt in to environments with extreme should be able to evolve and provide additional functionality when more resources become available, tools for defending and managing policies should be dynamic as the environment itself. With many security technologies surfacing and being developed. The assumptions that a particular security mechanism will eventually prevails. For that reason it is necessary to support multiple security mechanisms. While traditional security was restricted to virtual world, security now should incorporate some aspects of physical world.

The ubiquitous environment can have hundreds or thousands of diverse devices. The security services should be able to scale to the dust of mobile and embedded devices available to some particular instance of time. In addition to the security services, it need to able to serve huge number of users with different roles and privileges, under different situation. In the following sections we see some suggestions and solutions to safe grad the privacy in ubiquitous environment.


Justification and Solution

In day to day life, although ubiquitous computing help the people in mays ways. It cannot survive in the real world without taking some major actions to protect the privacy of the users. Therefore I came out with some suggestions that will help the ubiquitous environment to protect the user’s privacy.

There should be a limit for each ubiquitous applications to collect users data and any such situation the application should make the user aware that his particular data is been collected. The personal data collected from the users, should be relevant for the purpose for which it is to be used and to extent the necessary for the purposes, the users should be kept informed about the extended use of their data. The purpose for which the data is collected should be specified to the user at the time of collection and the subsequent use limited to fulfill the purpose, or such that not incompatible with those purpose should notify the user in each occasion and get authorization from the user. The personal data collected should not be disclosed or made available or otherwise used for purposes other than those specified, expect in the situation in authority of law. The personal data should be protected with the reasonable safeguards against the risk like stolen, modification, unauthorized access, and destruction use etc. There should be a general policy of openness about development, practices and policies with respect to the personal data. Means it should be readily available for establishing the existence and the nature of personal data, purpose of use and identity about the usual residence of the data collector. The individual must have the right to obtain the form of data collected or conform weather or not the data controller has data related to him. And the user should have the control to withdraw or make changes to his data at any point of time.



Although paper address some of the major privacy issues in ubiquitous environment and it also gives some solutions to protect user’s privacy in ubiquitous environment. The problems regarding the privacy is not that easy to solved, mainly because each individuals has their own personal opinions and values of what privacy really is. I also believe that when a new technology arise, the privacy problems will increase rapidly. Especially within the ubiquitous environment, which make it even hard to protect the integrity because sometimes data collection is almost completely invisible and it also provide the possibilities of recording people’s feelings and emotions.

Although it is hard to develop a fully privacy protected system in ubiquitous environment, I believe with the help of further research we can reduce the privacy issues to maximum level and can build a trust full ubiquitous environment  in future.

Alternatives for Adsense – Are they really helpful?

I have been blocked from Google Adsense about 5 years back for doing some illegal clicks. From that day onwords i been looking alternatives for Google adsense. I have done some research and found the best two alternatives uses suggest. they are

1) Infolinks
2) Chitika

Now the question is do they pay well like adsense?. Are they really helpful to website owners?
In my experience as a Asian users i would strongly say No. Its no worth at all.

Here is my experience
To test these programs i wasted my time and developed two websites on my own they are and Then i added those programs one by one and tested the results. the following paragraphs will show the results i obtained from these programs.

Infolinks is one the popular ad publisher program that most uses suggest as the best alternative for Google Adsense. I implemented the program and this is my result.

As you can see from the above report. It payed me $0.01 when i could gave only 75 page views, but when the page views has risen almost to 1k it didn’t pay me anything. This is sort of really stupid.

Mostly infolinks use popups to display the ads. which really irritates the visitors of the website as the result i gradually started to loose my visitors to the website. Not only this infolinks slows down my page by 15%. This has increased the bounce rate of my website.

Conclusion : I dont know how it might help the US and Canada users, but as a Asian user i would suggest implementing the infolinks on the website is of no use. Not only it don’t pay, it will also increase the page loading time and increase your websites bounce rate. This will lead you to loose your visitors and irritate the users by sending popups. Which is of no use at all.

This is one of the another alternative for Google Adsense that many users suggest. This company was formed by group of Indians in Silicon Valley and they are the Partners for Yahoo publishers. Al though this is a very big company and they hold some of very big publishers. They are almost same as infolinks when it comes to Asian users.

This is the result i get after implementing the chitika program on my websites.

As you can see from the report i dint pay me at all. But its bit different from Infolinks. It don’t send popups or increase any websites bounce rate. The only problem i identified is that most of the time it don’t show any ads.

Conclusion : Although Chitika don’t send popups and irrite the users or increase your website bounce rate, it use no worth of having something that don’t benefit you in any ways. Therefore i suggest you as a Asian users users chitika is of no use, it just holds the space in your website for no reason.

Finally I suggest you, if you have a Google Adsense account use it properly. Make sure you stick to their policy, because if you loose your Adsense account you will really feel for it as i do now. As a Asian user i would strongly say that there is no alternatives that can be as much supportive like Adsense.

What i do now?
I don’t do any Publisher programs now, but i am concentrating on affiliate programs. Don’t know how that is going do for me. Sure i will share my affiliate program experience in future.

Mean while i will also develop an education related website and try to get my Adsense program back.

Generate ssh Keys – Github

configure git for the first time
git config –global “Yourname”
git config –global “”

generate a local key
ssh-keygen -t rsa -C “”

run ssh agent in background
ssh-agent -s

Change file permissions for id_rsa file
chgrp Users ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa

test the ssh connection
ssh -T

Privacy Policy for Google Play store

Privacy Policy

built the my places app as a Free app. This SERVICE is provided by at no cost and is intended for use as is.

This page is used to inform website visitors regarding my policies with the collection, use, and disclosure of Personal Information if anyone decided to use my Service.

If you choose to use my Service, then you agree to the collection and use of information in relation to this policy. The Personal Information that I collect is used for providing and improving the Service. I will not use or share your information with anyone except as described in this Privacy Policy.

The terms used in this Privacy Policy have the same meanings as in our Terms and Conditions, which is accessible at my places unless otherwise defined in this Privacy Policy.

Information Collection and Use

For a better experience, while using our Service, I may require you to provide us with certain personally identifiable information, including but not limited to sathyabaman. The information that I request is retained on your device and is not collected by me in any way

The app does use third party services that may collect information used to identify you.

Link to privacy policy of third party service providers used by the app

Log Data

I want to inform you that whenever you use my Service, in a case of an error in the app I collect data and information (through third party products) on your phone called Log Data. This Log Data may include information such as your device Internet Protocol (“IP”) address, device name, operating system version, the configuration of the app when utilizing my Service, the time and date of your use of the Service, and other statistics.


Cookies are files with small amount of data that is commonly used an anonymous unique identifier. These are sent to your browser from the website that you visit and are stored on your device internal memory.

This Service does not use these “cookies” explicitly. However, the app may use third party code and libraries that use “cookies” to collection information and to improve their services. You have the option to either accept or refuse these cookies and know when a cookie is being sent to your device. If you choose to refuse our cookies, you may not be able to use some portions of this Service.

Service Providers

I may employ third-party companies and individuals due to the following reasons:

  • To facilitate our Service;
  • To provide the Service on our behalf;
  • To perform Service-related services; or
  • To assist us in analyzing how our Service is used.

I want to inform users of this Service that these third parties have access to your Personal Information. The reason is to perform the tasks assigned to them on our behalf. However, they are obligated not to disclose or use the information for any other purpose.


I value your trust in providing us your Personal Information, thus we are striving to use commercially acceptable means of protecting it. But remember that no method of transmission over the internet, or method of electronic storage is 100% secure and reliable, and I cannot guarantee its absolute security.

Links to Other Sites

This Service may contain links to other sites. If you click on a third-party link, you will be directed to that site. Note that these external sites are not operated by me. Therefore, I strongly advise you to review the Privacy Policy of these websites. I have no control over and assume no responsibility for the content, privacy policies, or practices of any third-party sites or services.

Children’s Privacy

These Services do not address anyone under the age of 13. I do not knowingly collect personally identifiable information from children under 13. In the case I discover that a child under 13 has provided me with personal information, I immediately delete this from our servers. If you are a parent or guardian and you are aware that your child has provided us with personal information, please contact me so that I will be able to do necessary actions.

Changes to This Privacy Policy

I may update our Privacy Policy from time to time. Thus, you are advised to review this page periodically for any changes. I will notify you of any changes by posting the new Privacy Policy on this page. These changes are effective immediately after they are posted on this page.

Contact Us

If you have any questions or suggestions about my Privacy Policy, do not hesitate to contact me.