Posts

Showing posts from 2016

On the path to become a MEAN Developer - 2 (The N)

Part 1 is here:  On the path to become a MEAN Developer - 1 Lets start by creating our very own node server. Check if npm and node is properly installed on your machine Go to the location of your choice. Create a directory myapp. Goto myapp. Type npm init . It will give you certain options. Default options are good to go. A package.json file will be created. Create a server.js file. var http=require("http"), port=1234; var server=http.createServer(function(request, response){ response.writeHeader(200, {"Content-Type" : "text/plain"}); response.write("Hello world!"); response.end(); }); server.listen(port); console.log("server is listening on http://localhost:" + port); To run the server, >> node server.js server is listening on http://localhost:1234 Hit http://localhost:1234 from your web browser, you should get Hello World as the output.

On the path to become a MEAN Developer - Misc

Check if node and npm is properly installed on your machine. Firstly add the path (upto bin) of your node installation. > npm --version > node --version These commands should return some values. Node and npm are installed on your machine.

On the path to become a MEAN Developer - 1

Image
I always wondered, But MEAN-ness rescued me! Yay! Oh well, not "being MEAN to somebody" but the MEAN Stack. ;) I am going to blog about the entire learning curve. I have a windows development machine. You get it right! I am in for a lot of challenges coming up the way to installation on my windows machine. Lets start with a brief on what a MEAN Stack is, what, who and why? MEAN is a Full Stack for Web Application Development. M - Mongo DB, a NoSQL database E - Expressjs, a web application framework that runs on Nodejs A - AngularJS, Javascript MVC framework that runs in browser Javascript engines N - NodeJS, an execution environment for event-driven server side and networking application. Did you get the best part of this stack? you need to know Java script to code to use this Stack! Only Javascript. One language to build it all. Client is a browser with javascript engine. Thats it! Though I say Javascript, I will be using Typescript. Typescript is modul

typings error following Angularjs 2 quickstart tutorial

I got the following error when i tried npm install on the Angularjs 2/ng2 quickstart example: typings ERR! message Unable to connect to "https://api.typings.org/entries/dt/core-js/tags/0.0.0%2B20160317120654" typings ERR! caused by connect ECONNREFUSED 104.24.112.177:443 When i tried connecting to https://api.typings.org/entries/dt/core-js/tags/0.0.0%2B20160317120654 from my browser, it works fine. So the issue? Proxy problem! Create a .typingsrc file in the root directory of the project with the following content: proxy="http://proxy:port/" rejectUnauthorized=false and npm install will install with Warning, which as the quickstart example suggests can be ignored. ng2 quickstart example can be found at: https://angular.io/docs/ts/latest/quickstart.html

Running ol3cesium using nodejs on desktop

Image
I was trying to run ol3-cesium as a desktop application. I downloaded the latest code with examples from the official site : http://openlayers.org/ol3-cesium/. When I tried opening the main.html (from examples folder) in my web browser..........  And as soon as I hit the enable/disable button view the map in 3D looks like this....... Debug and you will get an error similar to this: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource. How did I solve it? Its a CORS issues and can be solved by using a web server. I used nodejs server to host the directory. Create a server.js file in your ol3-cesium root directory. The content of my server.js: =========== var http = require('http'); var fs = require('fs'); var url = require('url'); // Create a server http.createServer( function (request, response) {    // Parse the request containing file name    var

npm ECONNREFUSED error

If you face error which says ECONNREFUSED while doing npm install <<package name>>, you are probably behind a proxy which is not allowing you to connect to the server and download the packages required. Just follow the below steps: npm config set proxy  http://your_proxy_name:port npm config set https-proxy https://your_proxy_name:port And then try npm install How to get npm config? npm get proxy will do the work :)

Revise Servlets in 10 mins

Revising Servlets in 10 mins, useful only if you have already read on servlets and just need to some guide points to recollect. Servlet is used to create dynamic web applications. Resides at server side. Implement Servlet interface to make a Servlet. Or you can extend the HTTPServlet class. Capable to serving and responding to requests. Better performance (creates new thread for each request), robust, secure and portable(since in java) Uses the HTTP Protocol to transfer data between the web server and the web browser. Stateless by default. HTTP Request methods: GET POST HEAD PUT DELETE OPTIONS TRACE Container provides runtime environment for j2ee applications Life cycle management Multithreading support object pooling Security Content Types: text/html, text/plain, images/jpeg etc Server types: Web server and application server Servlet Life Cycle: Servlet class is loaded Servlet instance is created  init method is invoked service method is invoked, every

Why Java!?

Java is an Object Oriented Programming Language. This means that everything in Java is an Object, whose template is given by the Class. Object Oriented Programming Features in Java: 1. Encapsulation Keep variables private and methods public ie just capsule all the data in java 2. Polymorphism Showing many forms. In java this is achieved by overriding and overloading 3. Abstraction Hide the complex implementation hidden from the user and show only the required information 4. Inheritance In java inheritance can be achieved by either extending a class or implementing an interface Features of Java Purely OOPs based Simple to learn Robust - Exception handling and Garbage collection make life easy for a Java Developer Secure - No pointers and high security as it doesnot allow a web applet to read and write from to a file easily High Performance Multi-threading Platform independent and Architecture neutral - java is compile once and run anywhere

Restarting Oracle DB amd OEM

Ever wanted to restart your oracle database instance? Here are some basic steps that will help you restart your oracle db on linux. Firstly, login to your database as oracle You can keep a check on ora processes like this - > ps - ef | grep ora Check that ORACLE_HOME, ORACLE_SID is properly set. Login as sysdba using sqlplus sqlplus / as sysdba >shutdown abort; This will abort all the running processes and immediately shutdown your oracle db. Once this is done, >startup; This will start and mount your db and your db is ready to use. In case your listener is down, start it using the following commands: Set the proper ORACLE_SID. lsnrctl start Db is ready to use. Starting and stopping OEM There is a very powerful oracle monitoring tool called the oracle enterprise manager. I totally love using it. It gives entire performance matrix of your db and also make oracle administration easy. Use it to believe its power. Start emctl. Useful command

My Book-et list

This is a list of books i want to read before I die ;) . I will also mention books i am currently reading and books which have i have loved. If you come across this list and know some really great worth - reading books, please mention in the comments below. Thanks already!!! :D Books i want to read: Autobiography of Napolean Hill Ramayana The Hobits Ignited minds Mein Kampf Shantaram I want to read any travelogue(please suggest)  ... Will keep adding to this list. Books I have read and loved: To kill a mocking bird :  This book is a must read for everyone if you have already not read it. This is one of the only two books by Harper Lee. (PS. Can be an excellent gift for anyone)  Wings of fire :  A beautiful book. Its about struggle and endurance to achieve your goal. It is about the efforts and vision of a great visionary - A P J Abdul Kalma The Lord of the Rings :  Masterpiece by J R R Tolkien. I have heard a lot about his other work and do plan on reading them. Y

Process Communication in Erlang

Image
Hi there! In erlang, no process talks directly to each other. You can think of it as a process in erlang has locked itself up in a room. And it is very workaholic. It loves doing its own work. What about Concurrency and inter process communication? Your one process can mail other process with required details and ask it to work on the data. (Erlang processes are workaholic). You just need the address of the process (the Process ID or the PID for this). Lets take a very simple example, where in the erlang process prints the sound of the animal. ==================== -module(animal_sound). -compile(export_all). sound()-> receive dog -> io:format("bhuw bhuw"); cat -> io:format("Meow"); _ -> io:format("Whisperings!") end. ==================== Save as animal_sound.erl, compile and run. Note : compile(export_all) can be used when you want all your functions to be visible to the outside world. Else you can export onl