Skip to main content

ES6 101 - Map

ES6 101 - Map
ES6 Map is the topic of today’s post which also is the 11th in the ES6 101 Series. Map is going to be fairly easy, so before jumping into it, if you want to look at other features we have covered so far, here is a quick list for your reference.Fat Arrow FunctionsLexical Declarations - LetLexical Declarations - ConstSpread OPeratorTemplate LiteralRest OperatorDefault parametersDestructuringFor…ofSetNow let’s see what Map has to offer. As opposed to Set (which by the way, I highly recommend reading), Map saves values as key-value pair. Let’s see for ourselves how this works!Example of ES6 Mapvar dummyMap = newMap(); dummyMap.set("1"); // Method is set as against add in ES6 Setconsole.log(dummyMap); // [["1",null]] dummyMap.set("1", "one"); console.log(dummyMap); // [["1","one"]] dummyMap.set("2", "two").set("3","three"); console.log(dummyMap); // [["1","one&…

Rail Radar - Map your Train Live!


    Rail Radar - An interactive map that allows users to watch the movements of trains that are currently running in India. This means that you can now know the status of your trains live! Rail Radar is a real time tracker of the Indian Railways passenger trains. This live tracker is shown on our very own Google Maps and this long awaited system is a result of a collaboration between the CRIS - Center for Railway Information System and RailYatri.in.

    Since this is a live tracking system of the Indian Railways, a few questions that will pop up in the minds who have ever travelled by railways will be - "Is this system really reliable? Is the data accurate? Can I trust the Rail Radar?" Well, the system is reliable and you can trust the data since the information and intelligence behind the Rail Radar is extracted and harnessed from volumes of data from the official Indian Railway's train running operational data. With regards to accuracy – this is fairly accurate in the normal running scenarios. However, there are several factors that can affect a train while it is on its route. Weather, breakdowns, congestions, local control-office directives, and more. RailRadar tries to continuously update this information. However, since the data on the Radar is displayed few minutes later than the actual, the tourists should double check the train running information using the traditional train status search mechanism – also offered by TrainEnquiry.com

    At present the Rail Radar is configured to refresh every 5 minutes. For security and regulatory reasons, the information published  on the Rail Radar is delayed by 5 or more minutes. Apart from this, the system has to do a lot of data crunching before the data is updated on the map. This to contributes to the delay.

    The Rail Radar system has a really cool feature in it. If the system is able to capture the location of the request based on the IP, then the Google Map that is used in the system pans to that location. Now; isn't that cool? So, if you are in Pune, then chances are that when you open up Rail Radar in your browser, you will be taken to Pune, which happens to be a junction in Maharashtra state. It also shows the number of trains that are currently active and also the percentage of trains that are delayed.

    Well my take on the entire application...
  • The Indian Railways needed just such a kind of system, since India has got the largest network of railways in Asia.
  • This system is really a  big boon to the frequent train travellers, who have experienced the agony of waiting for delayed trains at railway stations.
  • The application makes use of really cool Google Maps Satellite view and shows train icons as map markers.
  • Clicking on the train icon, shows you the details of the particular train and a simple mouse over gives you the name of the train you are looking at.
Train Details - On Mouse-over
 
Train Details - On Click
 
  • The User Interface(UI) of the application is not so good, and with 2 big adds at the bottom and bottom-right will be a big turn off for visitors.
  • Overall a very good and much required application for the people travelling by railways in India.
    You can visit the application at Rail Radar and take the benefits of this fabulous application. Do share with us your take on this brand new Google Maps powered live train-tracking application - the Rail Radar.

Recommended for You

ES6 101 - Spread operator

ES6 101 - Spread Operator
Welcome to the fourth post in the ES6 101 series and the topic of discussion today is the Spread operator or the dot dot dot operator.... It is not very common to call it the “dot dot dot” operator, but I just kind of like the ring to it! Also when you say “dot dot dot” it actually helps me visualize unpacking multiple gifts from a gift box. Wondering why I am taking about gifts and gift boxes and “dot dot dot”. Well, the spread operator... is actually more like unwrapping gifts from a gift box. The spread syntax allows an iterable such as an array expression to be expanded in-place. Let’s actually dive into some examples straight away. It is much more simpler that way!Examples of the ES6 Spread Operator ...Example #1Problem statement: Let’s write a function to display the sum of 3 numbers passed to it in an array.

We would have done this as follows in the old ES5 way. 😏var arr = [1,2,3]; functionsum(a,b,c) { var output = a + b + c; consol…

Diwali Wishes

Happy Diwali 2017
We are already on the brink of the new year and the festival of lights is already here!May this festival of lights, bring joy, peace and prosperity to you and your loved ones! Wishing you a very happy Diwali and a prosperous new year!For your holiday family portraits and baby shoots I would recommend a really talented and professional photographer in the SF Bay Area. Her portfolio would speak for itself!Happy holidays and have a safe Diwali!

ES6 101 - Destructuring

ES6 101 - Destructuring ES6 Destructuring assignments is the topic of this post and we will take a look at what destructuring means and we will look at multiole examples to understand the concept. As the name suggests, using the destructuring syntax, we would be breaking down values in an array or properties in an object into seperate variables.Arrays and objects allow you create, on-the-fly various packages of data.let a = [1,2,3]; ES6 destructuring uses similar syntax, however the LHS will now be a variable that would hold the package that you need to create. Sounds complex? πŸ˜“ Not really, just move ahead to the example that follows and you should get the hang of it.let a = [1,2,3]; let [x,y] = a; // We are now assigning array 'a' to a new arrayconsole.log(x); // 1console.log(y); // 2let [m,n,o] = a; console.log(m); // 1console.log(n); // 2console.log(o); // 3This helps us clearly see what destructuring does for an array! It basically unpacks the values in the array a…

ES6 101 - For..of

ES6 101 - For..of This is the 9th post in the ES6 series and we have looked at a whole bunch of some amazing and highly productive ES6 features that you can start using right away! Here is a comprehensive list of all the features that we have covered so far. 😍Fat Arrow FunctionsLexical Declarations - LetLexical Declarations - ConstSpread OPeratorTemplate LiteralRest OperatorDefault parametersDestructuringNow let’s look at what for..if has to offer us. Essentially, for..of does exactly the opposite of what for..in does. Let’s see what the difference is.// Using for..inlet someVar = [1,2,3,4,5] for(let item in someVar) { console.log(item); // The index values would be consoled. } When you execute the above code snippet, you will observe that, you get all the index values 0 1 2 3 4 of the array in the console. If you had to get access to the values at these indexes in the array, you would have to add the following to the above snippet in the for..in loop.console.log(`${it…

ES6 101 - Set

ES6 101 - Set
This is going to be the 10th post in the ES6 101 series and the topic for today is Set. Set object is a collection of values and is iterable. One cool thing about the values in set is that these are unique. This means that a set can have a value only once. Moreover you can think of a set as an actualy set in Mathematics. We will see a few samples to understand this concept of set.Examples of ES6 SetCreating a new set and adding values to it.Let’s create a new set and add some values to it and then discuss it further.let dummySet = newSet(); // That's it! A new set object is created dummySet.add(1); console.log(dummySet); // [1] dummySet.add(1); console.log(dummySet); // [1] and not [1,1]. This is because, values in a set are unique. dummySet.add(2).add(3).add(4); console.log(dummySet); // [1,2,3,4] dummySet.add('The UnderTaker').add('John Cena'); console.log(dummySet); // [1,2,3,4,'The UnderTaker…