Pages

Monday, February 29, 2016

Hello Angular 2.0

I would like to start a new series to introduce Angular 2.0

// Comment
(function(){
    alert("Hello Angular 2);
});

 Today we are going to create a simple Angular 2 Application to output our very own "Hello World"

1. Create Index.html file



    
    SyntaxHighlighter Demo Page - <?= htmlspecialchars($title) ?>

 

 


 

Monday, February 22, 2016

Tools Create Softwares...

I would like you to know the different tools and software that i'll be using on this blog so you might want a headstart.
  1.   Visual Studio
    • This is what I love with Microsoft. They created this ultimate software that helps you create on building you application. Most of what you need in building your very first application is already here and would like to create a session to get around this software and how I use it.
  2.  SQL Server
    • One of my goal for this session is for the reader to create his very own application using Microsoft technologies. What is a web application without a database? This is Microsoft Database Server where your application will store your data of course. I won't be tackling this software in detail because I am not an expert when it comes to database but will go with the basic of course
  3.  Internet Information Server (IIS)
    • This is the software that helps you with hosting your website and this is the reason why there is a "Deployment Issue" :). I'm not the expert too but I hope to learn something new along the way.
  4. Google Chrome
    • This is my best buddy when it comes to debugging the UI of the web applications that we are developing. I'm using firebug previously but I guess this is far more better when viewing your application and debugging it. I solely use Internet Explorer (This is your enemy) to download this amazing browser
That's it. These are the tools/software that I'll be using in these blog. With these tools alone I am confident that you can create your very first web application.
Goodluck to you!

The Software Developer

Kimwan is a software developer that specializes in .Net Microsoft Technologies such as MVC, Entity Framework, SQL Server, etc. He enjoys and preferred Front-End development more than Back-End Development because he is a visual type of person. He has above average skills in HTML, CSS, Javascript using different front-end frameworks such as JQuery, Angular JS 1.x+, Twitter Bootstrap (or other grid based framework: Foundation, Metro UI, etc), etc.
He is happy to commit to blogging and post at least one (1) session of a subject matter regarding programming preferably the skills that he currently possess. The purpose of this is to verify his learning, to share his insights to the web, to improve his communication skills, to create a network and to get comments from other developers that is probably have more experience and expertise than him.
I would like to thank in advance the readers of my blog for following my session and would very much appreciate any questions. I will use everything in my power to answer your questions but will also give my honest opinion if I'm not familiar with the subject matter.

-The Curious Developer

Friday, March 7, 2014

Interview Questions C# - Can a class implement interfaces with same method signatures?

Objective

  • To understand the behavior of C# classes when implementing interfaces with same method signatures
  • To know the best practices when implementing interfaces with same method signatures
For us to understand C# behavior when implementing interfaces with same method signatures please take a look at these two(2) interfaces:

interface Interface1{
       void Method1();
}


interface Interface2{
       void Method1();
}


class Class1:Interface1, Interface2{
      void Method1(){
             Console.WriteLine("this method is called");
      }
}


In our Main Class:

public static void Main(string[] args){
      Interface1 interface1 = new Class1();
      Interface2 interface2 = new Class1();
      interface1.Method1();
      interface2.Method2();
Console.ReadLine(); }
When you hit "F5" when you go to Debug > Start Debugging you will see this result.




The answer to our question "Can a class implement interfaces with same method signature?" is "Yes" but,  what if you want different implementation for same method signatures?

Then you should Implement it Explicitly by modifying your Base Class Similar to this:

class Class1:Interface1, Interface2{
      void Interface1.Method1(){
  Console.WriteLine("Implemented Method From Interface1");
}
      void Interface2.Method1(){
  Console.WriteLine("Implemented Method From Interface2");
} }
The result will then be:
















Conclusion:

  • A class can implement interfaces with same method signatures
  • we can apply explicit implementation when we are aiming for different implementation of interfaces with same method signatures


Thursday, March 6, 2014

Introduction to OOP (Object Oriented Programming) - Inheritance

Objective

  • To be able to understand Inheritance
  • To be able to define a base class and base class
  • To implement Inheritance in C#

INHERITANCE

-Is one of the Pillars of OOP (Object Oriented Programming) which are Inheritance, Encapsulation and Polymorphism. Today, we are just going to tackle Inheritance which allows us to reuse, extend and modify the behavior that is defined in another class.

base class / parent class - The class whose members are inherited
derived class / child class - class that inherits the base class / parent class

in C#, all classes are derived from a base class Object (this provides low-level support to all classes).

to inherit a class we use ":".

public class ChildClass : ParentClass{}

by default all class can be inherited.
We can specify that a class cannot be inherited by using the keyword sealed


public sealed class ChildClass : ParentClass{}
in this way no other class can inherit the ChildClass
if you try inheriting a sealed class you will be having a compile time error 'cannot derived from sealed type' error.
to define that a class can only be inherited and cannot be instantiated (creating an instance of) we use the abstract
public abstract class ParentClass{}
in this scenario, we cannot create an instance of the ParentClass, we can only inherit it. If we try creating an instance of ParentClass we will have a 'Cannot create an instance of the abstract class or interface' error.
For our Exercise/Example:
  1. Create abstract class Transportation with properties: string Color, int NoOfWheels; and method Move() - that writes in a console with message "moved".
  2. Create a new class Car and inherit Transportation.
  3. In the Main Program Create an Instance of Car and fill-up the properties and call the Move() method in the created Car instance.
The Code:
Transportation Class:
public abstract class Transportation{
    //Properties
    public string Color {get; set;}
    public int NoOfWheels {get; set;}

    //Method
    public void Move(){
       Console.WriteLine(string.Format("the {0} transportation with {1} wheel/s moved!", this.Color, this.NoOfWheels));
    }
}

Car class inhereting Transportation Class:
public class Car : Transportation{}

The Program where we create an instance of Car and Call the Move() Method:
public class Program{
   Car car = new Car()
   {
   Color="Red",
   NoOfWheels = 4
   }

   car.Move();
}
Points to Remember:
  • a class can only inherit one(1) class
  • we cannot inherit a sealed class
  • we cannot create an instance of an abstract class
References:
  • http://msdn.microsoft.com/en-us/library/dd460654.aspx

Creating Your First C# Program

Hi, this is my first blog post regarding my experiences as a web developer. I decided to start this blog in order for me to be reminded what are the skills that I know and what are the skills that I am bound to learn. I also started this blog for people out there who want to learn about programming (using C# because this is my native language :D, may be will go with Java & PHP too, who knows?). For my first blog post, please allow me to create a "Hello, World!" console application using Visual Studio 2013.

Objective/s

  • To be able to create your first program in C#
  • To be able to convert a Class Library into a Console App

Requirement/s:


  • IDE - Visual Studio - (mine is VS 2013)
Steps
1. Open your VS2013 (or whatever Visual Studio version you have)


2. Press Ctrl+Shift+N or Go To File > New Project


 3. Select Visual C# then select Class Library and click OK. 
(Optional: Change the Project Name to whatever you prefer)



4. Select Project from the Solution Explorer and Click "Alt + Enter" or Right Click on the Project then click on Properties.



5. In the Application tab, select Output Type as Console Application
*by doing these you are telling to run this project as a Console Application



6. Select the class Class1.cs from the Solution Explorer and type these:



7. Run the program by either pressing F5 or by going to Debug > Start Debugging. A Console window will then appear with the message "Hello, World"