Showing current location in browser using HTML5 Geolocation and Google Maps


HTML5 and Geolocation API

HTML5 comes with Geolocation API which allows user to provide their location to the web application. This is totally secure and user will always be asked for permission whether or not to provide information about their location.

The Geolocation API is provided with navigator.geolocation object of the BOM (Browser Object Model)

Current Position

To obtain the user's current location, you can call the getCurrentPosition() method of the geolocation object. It takes the success function as first parameter which setups position object in the function argument. The second parameter is an error function which setups error object in the function argument.

navigator.geolocation.getCurrentPosition(function(position) {
  
}, function(error) {
  
});

We can get the longitude and latitude from this position object as:
position.coords.latitude 
position.coords.longitude

Watch Position

If the position data changes (either by device movement or if more accurate geo information arrives), you can set up a callback function that is called with that updated position information. This is done using the watchPosition() function, which has the same input parameters as getCurrentPosition().

var watchID = navigator.geolocation.watchPosition(function(position) {
  
});

We can use the watchid value in tandem with the clearWatch() method to stop watching the user's location.

navigator.geolocation.clearWatch(watchID);

Demo Source Code

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">

</head>
<body>

<div id="geo-wrapper" width="600" height="400"></div>
<span id="geo-error"></span>

<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="http://maps.google.com/maps/api/js?sensor=false"></script>

<script>
$(function(){
    if(navigator.geolocation)
    {
        navigator.geolocation.getCurrentPosition(show_map,show_map_error);
    }
    else
    {
        $("#geo-error").html('Your browser does not support geolocation.');
    }
});

function show_map(loc){

var lat = loc.coords.latitude;
var lon = loc.coords.longitude;

var lat_lon = new google.maps.LatLng(lat,lon);

mapholder = document.getElementById('geo-wrapper')
    mapholder.style.height = '250px';
    mapholder.style.width = '500px';

var mapOptions = {
    center:lat_lon,
    zoom:14,
    mapTypeId:google.maps.MapTypeId.ROADMAP,
    mapTypeControl:false,
    navigationControlOptions:{style:google.maps.NavigationControlStyle.SMALL}
}

var map = new google.maps.Map(document.getElementById("geo-wrapper"), mapOptions);
var marker = new google.maps.Marker({position:lat_lon, map:map, title:"You are here.!"});

}

function show_map_error(error){
    var x = document.getElementById("geo-error");
    switch(error.code) {
        case error.PERMISSION_DENIED:
            x.innerHTML = "User denied the request for Geolocation."
            break;
        case error.POSITION_UNAVAILABLE:
            x.innerHTML = "Location information is unavailable."
            break;
        case error.TIMEOUT:
            x.innerHTML = "The request to get user location timed out."
            break;
        case error.UNKNOWN_ERROR:
            x.innerHTML = "An unknown error occurred."
            break;
        }
}

</script>
</body>
</html>

You can get the below code in Github Gist also -
https://gist.github.com/satya-jugran/af36aec8672ce155ee03476bab87da6b

Top features of Visual Studio 2017 you should know


Visual Studio 2017 has arrived with brand new features and enhancements which will make the software development more easier and quicker. With some of its new features, it is going the give a better development experience from it's predecessor's versions. Following are the top introduced and enhanced features of Visual Studio 2017.

You can go through Visual Studio 2017 official home page for detail features description. I have highlighted here those features in short just to have a feel what VS 2017 is providing.

1. Advance IntelliSense

The intellisense has been improved a lot in Visual Studio 2017 with the introduction of prediction algorithm. For example, you can now type "this.LC" and it will show "LoadComplete" in the autocomplete list.



2. Fast Code Navigation

GoTo feature has been improved with fast navigation which will quickly highlight the types and it's references in the code base.


3. Connected Services

With Connected Services, you can see and connect to external could apps more easily. Azure apps, Office 356 and Hockey apps connectivity has been improved to manage your application.


4. Environment Synchronization

It's now more easy to migrate your development environment settings to different workstations. This includes but not limited to settings, preferences and development extensions.

5. Live Code Analysis

No need to integrate with code analysis tools or wait to develop, build and see code analysis errors post build. With live code analysis, the IDE immediately give you the code analysis feedback and suggestions with standard coding style and best coding practices as you write your code.


6. Xamarin Profiler

Building mobile apps in Visual Studio. This feature provides you with an enhance profiler dashboard where in you can see lots of stuffs regarding optimization, memory allocations, performance etc.

7. Debugging

"Run To Click" to execute any line of code without putting a debugging symbol there and "Exception Helper" that provides suggestions about exceptions that might occur at some line of code, has been introduced for better debugging support.



8. Live unit testing

You can setup to run unit test case to run at the background while you are changing your code. This will give you immediate feedback about the test case results.

9. Workloads

Are you installing Visual Studio for a specific work? Just select a specific workload (.Net desktop development, Desktop development with C++, ASP.Net and Web development etc). This will install minimal components required for that workload specific development tasks. It will install very less components as compared to Visual Studio 2015.

10. Developer tools in a nutshell

Integrated powershell, Docker and Continuous integration tools that will give a development team a richer dev experience.

11. Language Improvements

C# 7 : Enhancements in Tuples, expression bodied members, throw expressions, Pattern matching, numeric literal syntax, inline out variables.
C++ : Cross-platform build, Direct-X, latest C++ standards, improved compiler with code analysis, better security.
Typescript : All latest enhancements of Typescript included.
Azure CLI : Better integration with Azure Cloud and apps using Azure CLI.

If you find it useful, please share and subscribe to pass on this information. Thanks!

How to make CORS request from Chrome/IE/Firefox?

It is sometimes required to quickly check weather you are able to make a RESTful request to the API. You can quickly make a CORS request from Chrome console or IE console or Firefox console without using any tool. It will also help to quickly test weather there is any preflight or CORS error or not.



Copy the below two javascript functions to the browser console and hit enter.

function createCORSRequest(method, url) {
  var xhr = new XMLHttpRequest();
  if ("withCredentials" in xhr) {
    // XHR for Chrome/Firefox/Opera/Safari.
    xhr.open(method, url, true);
  } else if (typeof XDomainRequest != "undefined") {
    // XDomainRequest for IE.
    xhr = new XDomainRequest();
    xhr.open(method, url);
  } else {
    // CORS not supported.
    xhr = null;
  }
  return xhr;
}

function makeCorsRequest(url) {
  // This is a sample server that supports CORS.

  var xhr = createCORSRequest('GET', url);
  if (!xhr) {
    console.log('CORS not supported');
    return;
  }

  // Response handlers.
  xhr.onload = function() {
    var text = xhr.responseText;
    console.log('Response from CORS request to ' + url);
  };

  xhr.onerror = function() {
    console.log('Woops, there was an error making the request.');
  };

  xhr.send();
}

Now, you can make a CORS request by calling the makeCorsRequest(<url>) function.

makeCorsRequest("https://example.com/api/GetResults?id=1");

List of projects topics for Computer Science and IT Students


This is the list of projects topics for Computer Science and I.T. studying students. You can opt one of the below mentioned topics for your project.

  1. Automation of an existing Accounting/Sales/Production system in a company industry
  2. Signature / Finger print Verification System
  3. Traffic Management System
  4. City transport Management System
  5. Remote Talk Utility development
  6. Dynamic information Server
  7. Web based Tele shopping / telemarketing System
  8. Student Management System for School/College
  9. Designing of MIS
  10. Web Server for Windows/Unix OS
  11. Remote login System for Networked System
  12. Drinking water distribution Management System
  13. Online Railway/aviation Reservation System
  14. Railway/Telephone Enquiry System
  15. Website offering information about Computerized Accounting
  16. Simulation of E-Commerce
  17. Prototype of a GIS
  18. Intra search – an Intra Net Search System
  19. Prototype for Rental Unit Company
  20. Adoption of X-Windows/motif to real time application
  21. Java based electronic Computer Software
  22. Java based Chat engine/server
  23. Database engine
  24. Dynamic Information server(UNISWITCH)
  25. Graphical utility like screen saver/editor
  26. Office suite containing word processor/spreadsheet
  27. Compiler/Interpreter for language/database
  28. Kernel of an OS / Network OS
  29. Prototype of a computerized EPBAX System
  30. A bank money Transaction System
  31. Automatic attendance System
  32. Computer hardware Purchase System
  33. Book distributor order maintenance application
  34. Merchant house stock management application
  35. Software Company’s attendance record application
  36. Hospital management and Maintenance
  37. University’s student record application
  38. Publishing Export house stock maintenance
  39. Library Database Management System
  40. Passenger Bus Reservation System
  41. Horoscope
  42. Simulation of Typing tutor
  43. Telephone Directory
  44. Telephone Bill Generating application
  45. Java pad- the text editor
  46. Website of a publishing house
  47. Simulation of online personal diary
  48. Website designing in electronic spare parts
  49. Jeweler showroom management and maintenance
  50. Employee pay slip generation System
  51. Label Generation System
  52. Card Trick game
  53. E-Commerce shopping application done in java
  54. Website providing matrimonial services
  55. Job site
  56. Account Management
  57. Automatic Report Scheduler
  58. Banking - Customer care
  59. Benefits Processing
  60. Call Handling System
  61. Charity Fund Raising
  62. Crime Records System/criminal investigation system
  63. Customer Support - Service Operations
  64. Diary Distribution System
  65. Donor Fund Management
  66. Event Management
  67. Extensions Management Systems
  68. Garbage Collection Disposal
  69. Model Management Agency
  70. Radio Taxis
  71. Retail Outlet Operations
  72. Retail Supply Chain
  73. Sales Forecasting Production Planning
  74. State Employment Portal
  75. SW Project Management
  76. Audio file format conversion and compression utility
  77. Voice response/recognition software
  78. SMS sending utility
  79. E mail handling and management s/w
  80. Virus scanner software
  81. Image processing s/w

Importance of customers' trust for entrepreneurs


Trust is what that matters the most. 

Does your customer trust you? If not, forget anything else, this this first thing you should do. You have to make your customers realize that why they should trust you. Even if your product/services have some flaws, make your customers realize that you are always there for them, to help them, to listen to them, to serve their needs.

Are you marketing your product by enumerating the best features and functions it provides, Nah! it takes more than that to build customers' trust.

OK, let me ask you a question. Who are the people that we actually trust? If we think a bit, we trust our family, close friends, close relatives and the person/brand who is trusted by large community.
Family and friends are fine, but the important question for an Entrepreneur arises here is - How to become a person/brand that is trusted by large community?

Customer's service 24x7

There may be many theories but the secret is simple.

"Make few people trust on you and your product and then apply Recursion"

Technology people must be understanding the term Recursion more. Yes, make few customers really trust on you and then ask them to spread their experiences about you and your product to others who trust them. If your customers trust you, believe me they will spread their best experiences to their family and friends. This is very natural because once they trust you, they want their near and dear ones to trust you and your brand too. Here, the trust cycle begins.

Note : Trusted customers grow customers

Once your customers starts building other customers, you can move as fast as you can, but I recommend to be slow at initial stages. Why? Let's discuss some consequences and negative sides of it.

If your trust cycle is broken in a small community you can manage it but if it is broken in large community, it will exponentially grow the negative effect. Building trust takes time but it takes a second to break trust. Your customers' trust may be broken by various reasons, may be you dint treated them well, dint listened to them, when they needed you the most you ignored them, and believe this too - Breaking trust will grow a negative image of you and your products/services that you dint even have and it will grow like a nuclear reaction.

Remember, being an Entrepreneur, don't think that you have to work for your product and your Enterprise. Instead, think that you have to work for the customers, keep earning their trust and help them in providing an ecosystem just made for them.