Monday, July 20, 2015

How to create a Restful Service in Php and MySQL with JSON data as output? (In Simple Steps)




Step 1 : 

Go to phpMyAdmin ,
select an existing database or create one

Step 2 : 

Create a sample Table (for eg: customers)

Step 3 : 

Insert a few records into the table

Step 4 : 

Create a new php page under www folder (or public_html folder)
Give name for your page (for eg: Get_Customers.php)

Step 5 : 

In the php page, follow these steps
              

             1. Connect to your database

           
 <?php
           
 $con = mysqli_connect("localhost", "<user name>" , "<password>", "<db name>") or die('could not connect');

//Write a query
$qry = "SELECT * FROM  Customers"

//Execute the query
$result = mysqli_query($con,$qry);
?>

               2. Put the data into array

<?php

$json = array();

//Loop through each record in the database and read the values
while($row=mysqli_fetch_array($result))
  {
      $arrcustomers = array
      (
         'customer_id' => $row['customer_id'],
         'customer_name' => $row['customer_name'],
         'shop_name' => $row['shop_name'],
         'loyalty_points' => $row['loyalty_points']
      );
           //push each row into an array
         array_push($json, $arrcustomers);
  }
?>


               3. Output the array as json


<?php

$json1['Customers']=$json;
echo json_encode($json1);

?>

Step 6 : 

Call Php Page in browser (for eg: http://localhost/Get_Customers.php)

Step 7 : 

Get the Result in Web Page in JSON format

Result:

{"Customers":[{"customer_id":"1","customer_name":"sam","shop_name":"SamMedicals","loyalty_points":"50"},{"customer_id":"2","customer_name":"sandy","shop_name":"upahar_gruha","loyalty_points":"100"},{"customer_id":"3","customer_name":"vishal","shop_name":"vishal_panshop","loyalty_points":"30"},{"customer_id":"4","customer_name":"sunny","shop_name":"sunnys shop","loyalty_points":"40"}]}


I hope this article was helpful for beginners trying to create a simple php RESTful service.
I am Shruti Kulkarni and I am a beginner myself with one month of total experience working at Nanite Solutions as an iOS developer.

If you have further questions about RESTful services please feel free to write to me at shruti@nanitesol.com

Thanks

Guided by: Praveen Kumar, Nanite Solutions

Saturday, July 18, 2015

Location Based Social Networking


Topics

  1. Preface
  2. Introduction to Location Based Social
  3. Keywords and Terms
  4. Types or Classification of Location Based Social    - Current Location Social, Resident Social, Non-Resident Social and more
  5. Social Network
  6. End Note

Preface

This article is an abstract on Location Based Social (LBS), introducing the idea, features & activities, classification and benefits of LBS.

Introduction to Location Based Social

In a very broad sense, Location Based Social (LBS) or Location Based Social Networking (LBSN), means what is says. It is all about connecting people via various modes who are situated, involved or interested in a specific geographic location.


Keywords and Terms

Mobile Social, Geo-tagging, Geo-fencing, Geo-Social, Social Units, Crowd-sourced, Community Based

Types or Classification of Location Based Social

There are different types of LBS
  • Current Location Social
  • Resident Social
  • Non Resident Social
  • Travel Social
  • Elsewhere Social
  • Others (Can be more specific, for eg: Parking Social, Gaming Social)

Definition: Social Network

To make sure these terms are clearly understood, let us define Social Network first. Social Network (or Social Networking) represents relationships between individual people, establishments, groups or like-minded social-units in any combination and their interactions digitally or in any other form.
Social Networking interaction generally comprises of the following activities and much more:
  • Sharing knowledge or information
  • Connecting with friends, family and acquaintances
  • Sharing updates or digital media (pictures, audio, video)
  • Connecting with people of similar interests
  • Targeted Advertising or Broadcasting
  • Promotions and offers for monetary benefit
  • Interacting in Fan Clubs, Culture Groups and other Social Units
  • Chats, Messages, Celebrations and Wishes
  • Technology Solutions, Messageboards, Forums
Add "location" to the mix and it produces an entirely new interesting entity.

Now, let us take a look at the different types of Location Social

Current Location Social

This type of Location Based Social Networking is all about where you are at this present time ("Right here, Right now"). If you are in a stadium watching a Baseball game think about the possibilities of Location Based Social. You could:
  • Share/view Geo-tagged content (pictures, video or updates) of the event
  • Connect if there are any friends or colleagues at the same location (or NOT)
  • Find people of your origin or country or fan-club member
  • Find Geo-fenced deals and promotions for dinner, shopping and more
  • Advertise for that location of your product or service if relevant
  • Share rides, car pool, connect in the area
  • Find out public transportation information like Schedule, Stations, Routes, Changes near the event
The possibilities are limitless.

Resident Social

This type of Location Based Social Networking is all about the place where you reside. This could be a macro or a micro level social, right from being a Resident of London or being a Resident of a specific apartment complex in Worcestershire. A Location based Resident Social could mean a lot of things, which involves:
  • Events happening in your locality / neighborhood / town
  • Subscribing to Local news/updates specific to your locality
  • Find restaurants, shops, services in the locality
  • Deals and promotions near your home
  • Find groups, clubs or people of similar interest in your locality (for eg: People speaking French, Wine Lovers etc)
  • Conduct events in the area and invite people in the network
  • Share rides, car pool
  • Public transportation information
  • Contibute to the society by sharing information about your resident area

Non Resident Social

This type of Location Based Social Networking is when you have moved to a different country, city or locality that you are not as familiar with either temporarily or for long term. People buy/build houses in a new locality and move there, people change jobs and move, or it could be temporary move for various other reasons. This could get even more beneficial because it is not your home turf and there will be a need for information in various situations.

  • Find schools, tuition, summer camps and more for kids in the new locality
  • Find/Connect with co-workers, ex-colleagues, batch-mates or friends in the new area
  • Find hobbies or interests in the new location (Guitar classes, Tennis, Hangouts etc)
  • Share rides, car pool to work or other places
  • Find restaurants, shops, services in the new locality
  • Deals and promotions in the new locality

Travel Social

This type of Location Based Social Networking is about places that you are travelling to or travelled from or interested to visit etc. Imagine planning to visit a city in China or Turkey or anywhere else as a tourist; it would be great if you can get specific information like where you could get Vegan food or a homestay or cheap mode of travel etc. Traveling can be very eventful if unplanned, unconnected or can get expensive due to lack of information. Travel Social involves the following and more:
  • Tourist information that can be beneficial ahead of time
  • Where, others "like me" would like to eat or stay or visit
  • Local updates on news, weather for the place of travel
  • Deals and promotions at the place of travel (for eg: Hard Rock Cafe specials in Hong Kong during your visit)
  • Connect with friendly local people who may offer homestay, help, tourist information etc
  • Connect with people of your origin, ethnicity, language or country settled in the place of travel (it is a very happy feeling to meet someone from your hometown in a far off country even if you do not know the person)
  • Find food/products of your origin, ethnicity, language or country when traveling to another destination
  • Car pooling in Europe to travel between multiple countries
  • Information about Pubs and Bars and nightlife especially as a tourist
  • Publish information about your upcomming travel so that someone in your network might have someone in that area of travel for help, information, Do's and Dont's and more

Elsewhere Social

This type of Location Based Social Networking is of a very different nature. This is for those who are interested in a particular location neither as a resident, non-resident nor for traveling to that location. There are many situations when you might be interested to connect with a network about another location. You could be a fan of a band like TomorrowLand and would like to get updates on the event in Brussels though you are located in California. You may want to help your friend who is traveling to a city like Abu Dhabi which he has never been to; as another example, you may want to connect to a network in a place you lived 10 years ago; you wish to buy a Cologne from Koln, Germany and then find a friend on the network who is traveling back from Germany to your location. One more example: Send a birthday dinner gift to your sister in England while you are residing in Johannesburg.
While the Elsewhere Social seems a bit out of place for Location Based Social Networking, surprisingly we all keep trying to connect with People, Events, Groups or other Social Units elsewhere all the time, "with or without our knowledge".

Others

Apart from the broad classification above, on Location Based Social Networking, there could be many specific type of Location Social.
Think about "Parking Social" for a minute!! Find parking spots near your workplace when you are about to reach the office. How many times have we been circling-around-the-blocks trying to find a parking spot especially in downtowns and busy locallities? Saving 5-10 minutes in finding a parking could mean spending 5-10 minutes "extra" with your kid or wife or close friends. You could be late for a meeting at work just because you were frantically finding a parking spot and could not get any. Think about paying 25 bucks for parking in a garage in a busy locality just to find a guy pulling out of a free street parking spot right in front of your office building. What if you could get an update that someone near you has just removed their car and a spot is free or if you get a notification that someone is taking their car out in the next 2 minutes 3 blocks away. What if you could be able to decide which nearest Metro station to park the car from downtown so you could drive more and park closer?
There can be many other types of Location Based Social Networking that can be very specific in nature like Environment and Human Rights, Gaming Social, Health & Fitness and more.


End Note

There could be some disadvantages of Location Based Social Networking too.  You may not want a person, say your boss, to connect with you when you are in that baseball game. While trying to search for information, you end up giving information about your whereabouts or interests that you are searching which can be an intrusion to your own privacy.

Leaving that aside, Location Based Social Networking can be a great tool of limitless possibilities to connect, interact, find, publish and share useful information/interactions among individuals, community, related groups and other types of networks.

All in all, Location Based Social is a potential area for Businesses and Individuals alike to explore a plethora of possibilities with challenging problems to solve and an unexpected knowledge to mine.

Cloud computing primer - What is cloud computing?

What is Cloud Computing?
For people who have "no clue" what is cloud computing, below is a simple example:

Scenario: Imagine its your wedding and many guests are coming from different cities. Questions: 
Would you buy a house for them to stay during the wedding? 
Would you rent a house with a 6-month or one-year contract for their accommodation arrangements?  DEFINITELY NOT!!

Would you rather book some hotel rooms during the wedding? Of course! 
You will end up paying only for your usage and nothing more.

The notion or concept or idea of Cloud computing is somewhat similar to this situation.

Scenario: Imagine you want to create a Gift Products website as a business idea. The traffic to your website is extremely high needing 10 server machines during Christmas or Valentines and only 1-2 servers during off-peak gifting seasons.
Questions:
Would you buy 10 dedicated servers and host them in your office though only 1-2 servers are used for many of the days?
Would you rent 10 servers on a hosting domain for 1 year contract and pay money for more than your usage?  DEFINITELY NOT!!

This is exactly where you can host your application on cloud servers. You can increase or decrease the number of servers or CPU or RAM for your application or even have single or multiple instances of your critical components running based on usage. 
(Remember the hotel booking example above?) 
You will end up paying only for your usage and nothing more.

Let us understand some of the "jargons" related to Cloud Computing

What is IAAS?
INFRASTRUCTURE-AS-A-SERVICE - As the acronym says, only the infrastructure is available for you as a business to use. You can have the option to increase or decrease any amount of infrastructure like Servers, CPU, RAM, I/O etc in this model. But the Applications, Data, Runtime, Middleware, OS all have to managed by you. Things like Virtualization, Servers, Storage, Networking etc will be handled by the Cloud provider.

What is PAAS?
PLATFORM-AS-A-SERVICE - Along with the Infrastructure, even the platform (for eg: Microsoft Azure Cloud, Amazon Cloud or some others) is available for you to host your application. In this case you don't have to worry about Operating System, Runtime, Middleware, Networking, Storage etc as it will be managed by the Cloud provider. Only the applications and the data is something you have to manage.

What is SAAS?
SOFTWARE-AS-A-SERVICE - To quote an example: A complete healthcare application is made available for your to configure and start using on a cloud infrastructure with the platform and software and features and hardware and everything. It can be a Travel Application or a Manufacturing system etc.

Who are some primary cloud computing providers or cloud providers?
There are many players in Cloud computing. Some of the important ones are:

IAAS Providers
Amazon Web Services (AWS), Google Compute Engine, Rackspace Open Cloud, IBM Smartcloud Enterprise, HP Enterprise Converged Infrastructure, Openstack, VMWare, CSC and more

PAAS Providers
AWS (EC2), Force.com (SalesForce), Heroku, EngineYard, DotCloud, Windows Azure (Microsoft), Google App Engine to name a few

SAAS Providers
SalesForce.com, NetSuite, Oracle On Demand, SAP Business (ERP/CRM), Accelops, abiquo, AppDynamics and many more

What is a Public cloud? What is a Private cloud? What is a Hybrid cloud?


1. Public Cloud is hosted by a cloud provider which can be accessed with proper authorization. Infrastructure is shared between tenants and an internet connection is required.

2. Private Cloud is your own cloud solution hosted within the enterprise. This is very Safe and secure and self managed but can be very expensive due to cost of the hardware and maintenance involved

3. Hybrid is a mix of Public and Private cloud. You can separate your Sensitive application data in your private cloud, and the not sensitive and bigger applications can go to Public cloud. Benefits of both Security and Scaling is possible here.

You can take a look at these diagrams for further reading. Hope these simple diagrams very easily help in understanding Hybrid cloud.

Top searched keywords on Google by people

This summary is not available. Please click here to view the post.

Sunday, July 5, 2015

How to add GoogleMaps to an iOS Application?

Steps to follow

Step 1: Create a new iOS project in XCode (Single View Application)

Step 2: Locate GoogleMaps.Framework and GoogleMaps.bundle from your local system ( if you do not find these files, please download them from Google)

Step 3:  Drag these two files into your project. Check the box which says "Copy Items..." and click "Finish"

Step 4: Go to "Build Phases" under targets and expand "Link Binary With Libraries"

Step 5: Click the "+" button to add the following Frameworks

      • AVFoundation.framework
      • CoreData.framework
      • CoreLocation.framework
      • CoreText.framework
      • GLKit.framework
      • ImageIO.framework
      • libc++.dylib
      • libicucore.dylib
      • libz.dylib
      • OpenGLES.framework
      • QuartzCore.framework
      • SystemConfiguration.framework
Step 6: Add a new file to your project folder of the type "Objective-C File" and click "Next" button
Step 7: Give any name to the file ( Ex- Test) and click "Create")
Step 8: Now, XCode will bring up a message "  Would you like to configure an Objective-C bridging header?" 
Step 9: Click "Yes" to create a "Bridging Header" file which will act like a bridge between your SWIFT and Objective-C
Step 10: Delete the file "Test.m" which is automatically created 
Step 11: Open the xxxx-Bridging-Header.h and type #import<GoogleMaps/GoogleMaps.h>
Step 12: Please go to "Build Settings"  tab and search for other linker flags
Step 13: Enter -ObjC in the value (Note the - sign and capital letters)
Step 14: Go to link given below "https://console.developers.google.com" and click "Create Project"
Step 15: Here you will find a button named "Create a new key", just click that button 
Step 16: Here it show four types of Key formats, select the "iOS Key" 
Step 17: Here it will display a blank text box, put the "Bundle Identifier" (Ex- com.example.trymaps)
Step 18: Click "Create" and it will create an API Key
Step 19: Go to AppDelegate.swift file and under the method "didFinishLaunchingWithOptions" add the line "GMSServices.provideAPIKey("AIzaSyAeMHNmiIzWrtul1TCsssHaf4arGwVrXyw"
Step 20: Replace the generated API Key from step 18 in the above line
Step 21: Go to main story board and select the "identity inspector", there it displays many text boxes.
Step 22: Click the scrolling bar in front of the label " Class" and select the "GMSMapView"
Step 23: Now run the project and see the GoogleMap on your project. If you get it, then Congratulations :)    
                                Article by - Praveen Kumar and Abhay Shukle
      


   

Thursday, November 6, 2014

Campus Recruitment Drive, Synechron - A glance at BNCOE, Pusad, Maharashtra

Imagine going for a Campus drive to a town, which is not as big as Pune or Bangalore which is 5 hours drive from nearest airport!!

What did I see? 

A little bit of scenery?

http://chalatmusafir.files.wordpress.com/2009/11/tn_tadoba-8.jpg?w=300&h=225http://farm8.staticflickr.com/7053/6955457042_764dc8d4b7_m.jpg


Something very amazing at BNCOE, Pusad. An English Lab!!

(Left Top) : A Central Controller dashboard which controls all the computers in the Lab
(Right Top): High-Tech english Lab with the latest of the softwares and equipment
(Left Down): Ruchir Godbole, a very dynamic Professor in college running the whole show
(Right down): Post selections in Campuses



One of the softwares that Prof. Ruchir Godbole uses has pre-recorded practice situations where students can practice "conversations" like they happen in real life.

I was amazed to see situations like "US Immigration counter" where the officer asks for a Passport and you have to respond in English and the conversation continues!!

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVMBahhexo146CakyC1UyIQwjlRT778SIxzywTq8el21gbya95d0uqJefYZnRH7WPOdW4N85yK6UYfpuMHP-GYVjI_baMnghWW0AYaXpPsSTYCI0pkzExqQmeum_PblgwFcoLCoIXQf5w/s1600/041111_immigration.jpg 

Prof. Godbole, showed us how they are training students in English.
They have very good headsets and mike
 

An LCD TV for projecting videos to watch, listen, and learn