AngularJS and Firebase (AngularFire) 1

Today I have experienced a first app using AngularJS and Firebase. I have initially learned some basic concepts of AngularJS from AngularJS Tutorial w3schools which gave me some ideas first or creating single page app (SPA). If you are new to AngularJS, this tutorial can be a starting point as it is written comprehensively and easy to follow with the examples. 

  

The Firebase website itself is also well documented to follow through and provides tutorials for a various languages and frameworks so please visit the website to get more information. 

Hosting

You can make use of hosting service the Firebase provides. A prerequisites for the hosting service is to have Node.js installed. (You can download and install Node.js here.)

Once all set, then just install the Firebase tool for hosting as follows;

Open Terminal (or command) and;

$ npm install -g firebase-tools

or 

$ sudo npm install –g firebase-tools

If you are updating previously installed Firebase tools, then use;

$ npm update -g firebase-tools 

or

$ sudo npm update -g firebase-tools

Now, we are ready to deploy! Just go to the location of the website directory then type in the Terminal;

$ firebase init

Then deploy your website with;

$ firebase deploy

For further details, please refer to the Hosting Documentation
If you want to see the sample app click here

Advertisements

Ruby (1): The simplest programming language yet

If you have some experience on programming especially based on linux kind operating systems (Ubuntu, Mac OS X, so on.), you will find Ruby easy to get familiar with and very simple to use. This article is just for those who have some programming knowledge or experience such as Java, C#, VB.NET, C, C++ or even Objective-C, assuming that you are somewhat familiar with the concept of OOP and basic idea of programming language.
Ruby is quite not the same as those legendary language like C or java. It is very interactive and simple. If you are using Mac OS X, you already have Ruby development environment. Most of linux OS also include any necessary development tools. – You can find further information on some other many websites that can be found by googling. (i.e. http://www.ruby-lang.org)
I will let you look up those websites for Ruby installation and set-ups. It is as simple as just typing a couple of lines on Terminal if you are on Linux-based-OS, or even you may not need to install in case it is already installed on your operating system.
Firstly, open a terminal and use ‘rib’ commend to get into the Ruby interpreter. You may find it different from other IDE, in fact, this is not IDE at all. However, this is the easiest way to test your code or try out some code quickly.
Basic operators from other languages work almost the same way.
+ – / * (addition, subtraction, multiplication, division)
** (exponent)
% (remainder)
#null type is called “nil” in Ruby.
There are some basic classes that are useful to know.
Integer – integer type
methods: +, -, /, *, %, **, to_s, to_f
Float – float type (decimal)
methods: +, -, /, *, %, **, to_s, to_i
String – text type
methods: capitalise, reverse, length, upcase, to_i, to_f
To use method with a class, it is simple as the following.
“hello”.capitalize
=> “Hello”
(This is “hello” object of String class and the object used ‘captalize’ method like putting ‘.methodName’ in front of the class object.
*To know more about methods of some classes, just use ‘ri’ commend on Terminal window.

If you have some experience on programming especially based on linux kind operating systems (Ubuntu, Mac OS X, so on.), you will find Ruby easy to get familiar with and very simple to use. This article is just for those who have some programming knowledge or experience such as Java, C#, VB.NET, C, C++ or even Objective-C, assuming that you are somewhat familiar with the concept of OOP and basic idea of programming language.
Ruby is quite not the same as those legendary language like C or java. It is very interactive and simple. If you are using Mac OS X, you already have Ruby development environment. Most of linux OS also include any necessary development tools. – You can find further information on some other many websites that can be found by googling. (i.e. http://www.ruby-lang.org)I will let you look up those websites for Ruby installation and set-ups. It is as simple as just typing a couple of lines on Terminal if you are on Linux-based-OS, or even you may not need to install in case it is already installed on your operating system. Firstly, open a terminal and use ‘rib’ commend to get into the Ruby interpreter. You may find it different from other IDE, in fact, this is not IDE at all. However, this is the easiest way to test your code or try out some code quickly.
Basic operators from other languages work almost the same way. + – / * (addition, subtraction, multiplication, division)** (exponent)% (remainder)
#null type is called “nil” in Ruby.
There are some basic classes that are useful to know. Integer – integer type  methods: +, -, /, *, %, **, to_s, to_fFloat – float type (decimal) methods: +, -, /, *, %, **, to_s, to_iString – text type methods: capitalise, reverse, length, upcase, to_i, to_f
To use method with a class, it is simple as the following. “hello”.capitalize=> “Hello”(This is “hello” object of String class and the object used ‘captalize’ method like putting ‘.methodName’ in front of the class object.*To know more about methods of some classes, just use ‘ri’ commend on Terminal window.

** For more basic and detailed information, please refer to the website http://www.ruby-lang.org/en/

(There are some tutorials for beginners)

— coming up next: your own methods and classes

C# Polymorphism

Ok, this is very basic stuff (i mean concept.:D ) but also important. Polymorphism provides a way for a subclass (child class) to define its own version of a method defined by its base class (parent class). This is called “method overriding” and is very common concept in OOP (Object Oriented Programming) such as Java.

Let’s see how this concept works within C#. To re-build your current design, you need to understand the modifiers; virtual and override keywords, and their meanings. Overriding methods in C# is a bit different from doing so in Java, however, the main concept of it remains the same.

If a super class (base class) wishes to define a method that may be (or may be not) overridden by a subclass, it must mark the method with the virtual keyword. These methods with the virtual keyword are called virtual methods.

public class ClassName

{

// This method can be overridden by a derived class.

public virtual void VirtualMethodName(int paraInt)

{

}

}

The same rule is applied to a subclass. When a subclass wishes to change the implementation details of a virtual method, it does so using the override keyword.

class Subclass : SuperClass

{

public override void Method1(int intV)

{

….

base.Method1(10);

}

….

}

Unlike Java, you can leverage the default behavior using the base keyword. In this way (the same as the Java overriding concept, but for those who are new OOP with C#), there is no need to completely re-implement the logic behind Method1(), but can reuse and extend the default behavior of the parent class.