Tag Archives: JavaScript

Day 26: TogetherJS–Let’s Code Together

Today for my 30 day challenge, I decided to learn a cool new JavaScript library from Mozilla called TogetherJS. A few months ago, I wrote an online Java editor for the latest version of Java i.e. version 8. Today, we will learn how to add collaborative features to the TryJava 8 application using TogetherJS. Read the full blog here https://www.openshift.com/blogs/day-26-togetherjs-lets-code-together

Day 23: TimelineJS–Build Beautiful Timelines

Today it took me a lot of time to find the right topic that I was comfortable with. I started with brain, then looked at Twitter Server, but finally I zeroed down on TimelineJS. So, today for the 30 day challenge, we will learn how to build a beautiful timeline for this blog series using TimelineJS. Read the full blog here https://www.openshift.com/blogs/day-23-timelinejs-build-beautiful-timelines

Day 19: Ember–The Missing EmberJS Tutorial

So far in this series we have looked at BowerAngularJSGruntJSPhoneGap, and MeteorJS JavaScript technologies. Today for my 30 day challenge, I decided to learn a framework called Ember. In this blog post, we will learn how to build a single page social bookmarking site using Ember. This tutorial will be covered in two posts — first post will cover the client side and persist data to HTML 5 Local Storage and in the second post we will use a RESTful backend deployed on OpenShift. I will write the second post in next few days. Read the full blog here https://www.openshift.com/blogs/day-19-ember-the-missing-emberjs-tutorial

Day 7 : GruntJS LiveReload : Take Productivity To Another Level

On day 5 of my 30 technologies in 30 days challenge I talked about using GruntJS to perform repetitive tasks. Today, we will extend the example covered in that blog with html templates and livereload server. In this blog, we will first cover how we can use an html template with grunt-markdown plugin and then I will cover how we can take productivity to the next level by using grunt-watch plugin. Please read my earlier blog on GruntJS in case you are not familiar with GruntJS. Read the full blog at https://www.openshift.com/blogs/day-7-gruntjs-livereload-take-productivity-to-the-next-level

Day 5 : GruntJS : Let Someone Else Do My Tedious Repetitive Tasks

Today I decided to learn GruntJS. GruntJS is a JavaScript based command line build tool. It can help us automate repetitive tasks. We can think of it as JavaScript alternative to Make or Ant. It can perform tasks like minification, compilation , unit testing, linting, etc. As more and more development moves towards client side, it makes a lot more sense to use tools which can help us become more productive. In this blog, I will show how we can use GruntJS to minify javascript files. Then using GruntJS markdown plugin we will convert a markdown document to HTML5 document. Let’s get started. The full blog series can be tracked on this page.

Why should we care?

The main reason why we should learn GruntJS is that developers by nature are lazy creatures. They make mistakes when doing repetitive tedious manual tasks. Continue reading

How To Enhance Location Aware Apps with Google’s Directions Service

In my previous blog post, I talked about how we can use HTML 5 GeoLocation capabilities to build location aware applications with JAXRS and MongoDB at the backend. Today, we will extend the LocalJobs application we built in that blog post with Google’s Direction Service. It is recommended that you first read my previous post and then continue with this blog entry. The Directions Web Service allows applications to obtain Driving, Bicycling, and Walking directions through an XML/JSON REST interface. All of the features of the Map API v3 Directions service are supported, including “avoid highways”, “avoid tolls”, and waypoint optimisation.To see the application in action, just go to http://localjobs1-t20.rhcloud.com/. Enter skills such as java , php , mongodb , etc. and press the “Find Jobs” button. The Browser will then ask you to allow the application to use your computer’s location. Click on “allow” and you will see results as shown below:

Read full blog at https://www.openshift.com/blogs/how-to-enhance-location-aware-apps-with-googles-directions-service

Learning JavaScript Programming Language Functions Part 3

Intent of My Blog

Today, i heard the third lecture on javascript functions  by Douglas Crockford. This blog is third in this series. Please refer to first and second post regarding the history and statements in javascript.

Functions in JavaScript

Today i have seen the third lecture of the series.Checkout this lecture

Key points from the presentation are:-
  1. function are first class object
  2. function can be passed, returned and shared just like any other value.
  3. function inherit object and store name value pair.
  4. function are container like objects
  5. functions are equivalent to Lambda
  6. Lambda has enormous expressive power
  7. Unlike most power constructs, lambda is secure
  8. function statement var foo = function foo(){// statements to execute}
  9. In JavaScript, one function can contain other functions.
  10. An inner function has access to the variable and parameter of function that it is contained within.
  11. This is called static scoping or lexical scoping
  12. JavaScript also supports Closure
  13. The scope that an inner function enjoys continues even after the parent function has returned.This is called Closure
  14. Closure are one of the most powerful features of JavaScript
  15. JavaScript is the first lambda language to go mainstream
  16. when a function is called with too many arguments, the extra arguments are ignored
  17. When the function is called with too less arguments, the missing values are set to undefined
  18. Methods can be invoked in four ways
  19. Function Form –> functionObject(argument)
  20. Method Form –> thisObject.methodName(arguments) and thisObject[“methodname”](arguments)
  21. Constructor Form –> new Function(“x”,”y”,”return x*y”)
  22. Apply form –> functionObject.apply(thisObject, arguments)
  23. When a function is invoked, it also gets a special parameter called arguments.
  24. arguments contain all of the arguments from the invocation
  25. It is an array like object (it is not a full array)
  26. arguments.length gives the number of arguments passed.
  27. In JavaScript, you can extend the built-in types(like String, Boolean)
  28. Do not use eval function
  29. Built in wrapper types like String, Boolean, Integer are not useful
  30. Global variables are evil
  31. Implied global are evils too.
  32. Always use functional scope.

These were some of the points from the talk.