Posts

Showing posts from September, 2015

AngularJS Introduction

AngularJS 1.5

Directive is a marker on an HTML tag that tells Angular to run or reference some Javascript code.
HTML page: <html ng-app="studentModule"><head><link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" /><script type="text/javascript" src="js/angular.min.js"></script><script type="text/javascript" src="js/app.js"></script></head><body class="container" ng-controller="StudentController as s"><ul class="list group"><li class="list group item" ng-repeat="student in s.students"><h3> {{student.firstName}} {{student.lastName}} <em class="pull-right">{{student.emailId}}</em></h3></li></ul></body></html> Javascript: (function() { var app = angular.module('studentModule', []); …

Flask introduction

Flask is a python microframework for building web applications or for rapid prototyping one.

sudo easy_install virtualenv python3 -m venv venv --- create a venv directory for the project source venv/bin/activate -- activate the virtual env. pip install flask -- install flask
The idea for virtual environment is to import packages like flask only in a copy of the python Virtual environment and not pollute the global python installation.
An example flask application:
Hello.py:
from flask import Flask, render_template app = Flask(__name__)

@app.route('/') def index(): return render_template('index.html')

@app.route('/user/') def user(name): return render_template('user.html', name=name)

if __name__ == '__main__': app.run(debug=True)
templates/User.html:
Hello, {{ name }}!
Run: Python hello.py
It will start the web server http://127.0.0.1:5000
If you browse to http://127.0.0.1:5000/user/watsh
It should o/p Hello, watsh in browser.

Mac OSX: can't start Git - Intellij IDEA complains

The solution is: in terminal, run 'sudo xcodebuild -license' and then agree to the terms.

https://intellij-support.jetbrains.com/hc/en-us/articles/206827657-Mac-OSX-can-t-start-Git-after-updating-Mac-OS-XCode

MongoDB

MongoDB is a NoSQL document-oriented database which stores data as BSON (Binary Script Object Notation) documents.
Salient features of MongoDB are: Document Oriented - aggregates the data in minimal number of documents. Ad hoc queries - like regular expression search, by ranges or field is supported. Indexing - any field in the document can be indexed. Replication - high availability is supported by maintaining replicas of data in more than one replica set member. The data is eventually consistent between the replica members. Load Balancing - uses sharding (a shard is a master with one or more slaves) to distribute the data split into ranges (based on shard key) between multiple shards. File storage - supports storing a file not as a single document but split across multiple shards - GridFS feature of MongoDB comes built in and is used by NGNIX and lighthttpd. Aggregation