Thursday, 17 December 2015

Introduction to ArchiMate

"Enterprise architecture is the organizing logic for business processes and IT infrastructure reflecting the integration and standardization requirements of the company's operating model. The operating model is the desired state of business process integration and business process standardization for delivering goods and services to customers." - MIT CISR




Archimate is an architecture standard adopted by big companies such as Banque de France, European Central Bank, European System of Central Banks... It is an open enterprise architecture modeling language that visualizes, describes and analyses architecture within and across business domains. It is a technical standard recognized by the TOGAF (The Open Group Architecture Framework). It is different from other languages (BPMN and UML) due to the different modelling scope. While the UML is used for modeling software products and BPMN is used for business process modeling, ArchiMate is used for defining relationships between concepts in different architecture domains.

ArchiMate covers three layers:



  1. Business Layer - includes business processes, functions, services and events. This layer shows the business process of a project/system and the services offered by those processes.
  2. Application Layer - includes software applications, services it offers and functions it performs. This layer shows how the application layer supports the business layer, how applications interact between each other (interfaces) and how the application behaves.
  3. Technology Layer - includes hardware and communications at infrastructure level. This layer describes the infrastructure and how it supports the application layer.


To segregate different areas of architecture, ArchiMate utilizes "view" a part of an architecture description that addresses a set of related concerns and is addressed to a set of stakeholders. This is done through "viewpoints".

Some of the most useful viewpoints are:
  1. Organisation viewpoint - shows the actors and roles involved and how they are organised.
  2. Business process cooperation viewpoint - shows how different business processes interact with each other
  3. Application behaviour viewpoint - shows how the application behaves (functions it performs and services it provides)
  4. Application cooperation viewpoint - shows how the application interacts with other applications, which services it uses from other applications and which services it provides to other applications (interfaces)
  5. Application usage viewpoint - shows how application (through services it provides) supports the business process.
  6. Infrastructure viewpoint - shows the infrastructure
  7. Infrastructure usage - shows how the infrastructure supports the application.
  8. Information structure - shows the static view of business objects and data objects used in a business process.

These viewpoints are useful for creating impact map, capability map, landscape, criticality chain, system dependency map, etc. 


Example:


Here is a simple example of the ArchiMate modeling. 

We start off with an event that occurs every 25th of December. It triggers a business process "Check naughty/nice list" which accesses "List of naughty/nice kids" and is performed by Santa. Santa is a business actor that is associated with the business process and the list is a business object that is accessed by the business process. Finally this business process triggers another business process "Deliver presents" which accesses business object "Presents" and is associated with a business actor "Santa".


If you wish to try out modelling in ArchiMate  you can you the free tool called Archi. If you wish to learn more about ArchiMate standards, you can visit TOGAF ArchiMate website.


Monday, 26 January 2015

Raspberry Pi Introduction and Setup

This post explains what is Raspberry Pi (RPi) and how to set it up.

Raspberry Pi is a low-cost, very small, single-board computer that usually runs one of the several different Linux-based operating systems (it is not strong enough to run Windows, but don't worry - it's still easy to control!). The primary idea behind this small computer is that everyone could learn computing and programming on an affordable, small computer.


MODELS

There are several different versions of Raspberry Pi:

Model A (replaced by model A+), Model B (replaced by model B+), Model A+ and Model B+.
Models A and B were replaced by newer models A+ and B+ in 2014, so I will briefly describe differences between them.


Model A+ and B+ side by side. Photo credit: Adafruit

Specification\Model A+ B+
Dimension 65mm x 56mm / 2.5" x 2.25" 56mm x 85mm  / 2.2" x 3.4"
Weight 23 g 42 g
Processor ARM 11, 700 MHz low power ARM 11, 700 MHz low power
USB ports 1 x 2.0 USB 4 x 2.0 USB
Memory (RAM) 256 MB 512 MB
Ethernet port No Yes
Price $20 / ~€20 $35 / ~€35

Other than above mentioned specifications, they both have 40 GPIO (General Purpose Input Output) pins, a HDMI port, a DSI display connector, a camera connector, GPU (Graphic Processing Unit) and a micro SD card slot. Both models are powered by micro USB - just like the ones most mobile phones use.

My recommendation is paying few extra € / $ (or whichever monetary system you use) and get model B+ (unless you really need slightly lower weight and power consumption). With more USB ports you will avoid buying extra USB hubs (on model A+ no ethernet port means you will have to use USB Wi-Fi, thus you won't have a free USB port for keyboard/mouse) and you will get more RAM.


WHAT DO YOU NEED?

Since I have B+ model and will make tutorials based on it, this section is based on what you need for this model. Please note that RASPBERRY PI DOES NOT INCLUDE ANY EXTRA EQUIPMENT!

1 x Raspberry Pi B+ model
1 x micro SD card, UHS 1 or class 10, with 32 GB (can be less)
1 x Micro USB charger (5V, 1 A)
1 x HDMI cable
1 x keyboard (wireless if possible)
1 x mouse (wireless if possible)
1 x ethernet cable or 1 x USB Wi-Fi module (as small as possible)
1 x clear casing with removable top to access GPIO (optional)
1 x micro SD card reader (if you don't buy micro SD card with pre-installed operating system)

I bought a wireless keyboard + mouse combo with only 1 USB receiver, so that I can have more free USB ports. You can buy a micro SD card with pre-installed OS system, or you can install it on your own (in which case you will need micro SD card reader).


My complete equipment.


SETTING UP

If you are going to install OS yourself, put the micro SD card in your card reader and plug it into your computer. Then, depending on your operating system, follow the instructions for writing an image on a micro SD card.

There are several OS you can choose from:
NOOBS - for absolute beginners
RASPBIAN - based on Debian for standard users
PIDORA - based on Fedora for standard users
OPENELEC / RASPBMC - XBCM media centers
and many more official and unofficial OS....

Since I am using Windows, I installed Win32DiskImager and downloaded Raspbian. After both have downloaded, Just double click on Win32DiskImager, select Raspbian file and drive letter your micro SD card is associated with. Click "write" and after few moments your micro SD card will be ready.

Writing image file on H: (micro SD card location)

Now plug in your micro SD card in Raspberry Pi, connect it via HDMI cable to TV/monitor, connect your keyboard and mouse to it and connect either ethernet cable or WiFi module. After everything is set up, finally connect it via micro USB to power outlet.

Your Raspberry Pi should start booting and it will bring up a blue screen with some options.First select "Expand Filesystem" so that OS can take as much space as it needs. If you wish you can also select "Internationalisation options" where you can setup your keyboard layout, time zone, etc. Finally select "Finish".

Raspbian configuration

Raspberry will then ask you for username and password. Default username is "pi" and password "raspberry" (please note what kind of layout you have, it might be "raspberrz"). This will bring you to terminal - a command line interface.

Now you will want to update your Raspbian to newest version. To do that simply type:
sudo apt-get update (to update the sources of the software) and then
sudo apt-get upgrade (to upgrade everything to the latest version).

After it has finished updating, you can switch to GUI (graphic user interface) by typing:
sudo startx

That's it! Now you can explore pre-installed things and what else you could install on your Raspberry.





Thursday, 11 July 2013

Java Hello World (Console)

This is a short tutorial for your first application in Java. I use Eclipse as software integrated developer environment (IDE), however there are many more (like Netbeans).

Let's start off with basic installation. First thing you need to install is Java Development Kit (JDK). After JDK, you need to install Eclipse IDE for Java Developers.

Open your Eclipse and click on "File"->"New"->"Project". Select "Java Project" and click "Next".



Type in a name like "HelloJava" and click "Finish".


A folder named HelloJava is created on left side of screen (Package Explorer). If you double click on that folder you can see its contents. Right-click on src subfolder and select "New"->"Package". Name it test.hello and click "Finish".


Now your package will appear in src subfolder. Right click on that package and select "New"->"Class". In name field type Hello and check the "public static void main(String[] args)" option. Click "Finish".



After this you will get some code that looks like this:

package test.hello;

public class Hello {

 /**
  * @param args
  */
 public static void main(String[] args) {
  // TODO Auto-generated method stub
 }
}


Now add a line System.out.println("This is my Hello Java!"); within main method so  it looks like following:

package test.hello;

public class Hello {

 /**
  * @param args
  */
 public static void main(String[] args) {
  // TODO Auto-generated method stub
  
  System.out.println("This is my Hello Java!");
 }
}

System.out.println("Something, something");  is used to print out whatever is contained within quotation marks (in this case it will print out Something, something.

To run the program, click on green "play" button in upper left corner or press CTRL+F11. Result of your program will appear below your code in console.

Now let's add text input. For this we need to create a Scanner. It will save whatever we write in one line and then we can use it to print out what has been saved in it. To do this we need to insert two lines above our current code. First line is the declaration of Scanner with name "scanner" and it should be Scanner scanner = new Scanner(System.in);. You will notice that the word Scanner is underlined. It means you need to import that class to your project. To do this, simply hover over the word Scanner and select "import java.util.Scanner;". Second line is for printing text and it should be System.out.println(scanner.nextLine()); Your code should now look like this:

package test.hello;

import java.util.Scanner;

public class Hello {
 /**
  * @param args
  */
 public static void main(String[] args) {
  // TODO Auto-generated method stub

  Scanner scanner = new Scanner(System.in);
  System.out.println(scanner.nextLine());
 }
}

Now you can run it, type whatever you wish in console and when you press "Enter" (new line), it will repeat what you wrote. That's it! 



Tuesday, 19 February 2013

C# Hello World (Graphic User Interface)

We are going to create a Hello World with GUI (Graphic User Interface) in C#. Like in previous post we start by creating new project.

Click on "File"->"New"->"Project" or shortcut "CTRL+SHIFT+N".

Again, we click on Visual C# on left side, but this time we need to select Windows Forms Application on the right side of screen. Under name type HelloWorldGUI and click OK button. It should look like this:



This creates new project and a screen with a window appears. On the left side there is also Toolbox which contains different elements that can be dragged and dropped on window. If you don't see toolbox on left side go to "View"->"Toolbox" and it will appear.

Select a Button from toolbox and drag and drop it on the window. Then select Label from toolbox and drag and drop it on the window under button. It should look like this:



Now click once on the window and take a look at lower right part of screen where it says Properties. Find where it says Text in list and write down My First GUI. This will change the text in upper left corner of your window from default text (which is usually Form1) to whatever you write in Text field.

Select button that is inside window, go to properties again, and under Text type Click me! in order to change text on the button.

Now select label that is inside window, go to properties again, and under Text type Button not clicked in order to change text on the label. Now go to (Name) property and change it to myLabel. This will set the name of label which we can use in our code. After renaming GUI should look like this:



Next step is double click on button. This will create a function for clicking on a button (click event). Here we get a code that looks something like this:

 using System;  
 using System.Collections.Generic;  
 using System.ComponentModel;  
 using System.Data;  
 using System.Drawing;  
 using System.Linq;  
 using System.Text;  
 using System.Windows.Forms;  
 namespace HelloWorldGUI  
 {  
   public partial class Form1 : Form  
   {  
     public Form1()  
     {  
       InitializeComponent();  
     }  
     private void button1_Click(object sender, EventArgs e)  
     {  
     }  
   }  
 }  


In order to change text on our label we add a line myLabel.Text = "Hello World!"; so that our code looks something like this:

 using System;  
 using System.Collections.Generic;  
 using System.ComponentModel;  
 using System.Data;  
 using System.Drawing;  
 using System.Linq;  
 using System.Text;  
 using System.Windows.Forms;  
 namespace HelloWorldGUI  
 {  
   public partial class Form1 : Form  
   {  
     public Form1()  
     {  
       InitializeComponent();  
     }  
     private void button1_Click(object sender, EventArgs e)  
     {  
       myLabel.Text = "Hello World!";  
     }  
   }  
 }  

Now run it by pressing F5 and try clicking the button.

Finally let's create a counter for our button that counts how many times it has been pressed. First we initialize an integer by putting int counter=0; before public Form1(). This creates a variable that has initial value 0. Inside our button click function - private void button1_Click we need to increase value of counter. This can be done by typing counter++; or counter = counter + 1; - either one will increase value of counter each time button is pressed. Now instead of "Hello World!" we put "Button has been clicked "+counter+" times!" - this will type out text "Button has been clicked" and "times!", but thanks to + sign it will also print out value of counter between those two parts.

Final code should look like this:

 using System;  
 using System.Collections.Generic;  
 using System.ComponentModel;  
 using System.Data;  
 using System.Drawing;  
 using System.Linq;  
 using System.Text;  
 using System.Windows.Forms;  
 namespace HelloWorldGUI  
 {  
   public partial class Form1 : Form  
   {  
     int counter = 0;  
     public Form1()  
     {  
       InitializeComponent();  
     }  
     private void button1_Click(object sender, EventArgs e)  
     {  
       counter++;  
       myLabel.Text = "Button has been clicked " + counter + " times";  
     }  
   }  
 }  

Try running it and keep clicking the button. Your results should look like this:


Friday, 8 February 2013

C# Hello World (Console)

This is a short tutorial for your first application in C#. Although there are many implementations of C# (like Mono), I will provide tutorial in Microsoft's Visual Studio.

First we will create "Hello World" console application. These are the steps:

Click on "File"->"New"->"Project" or shortcut "CTRL+SHIFT+N".

New window will appear. On left side you can see different languages. Select Visual C#. This will open a list of most common project types on the right side of the window. Select Console Application. Now we have to name it - type MyFirstApplication in name field. While you do this, solution name will change accordingly. If you want you can also change default location of your project. When you are done click "OK" button.



Again new window appears with your first class already generated. You will see some premade code that looks like this:

 using System;  
 using System.Collections.Generic;  
 using System.Linq;  
 using System.Text;  
 namespace MyFirstApplication  
 {  
   class Program  
   {  
     static void Main(string[] args)  
     {  
     }  
   }  
 }  

Now add a line Console.WriteLine("This is my Hello World!"); within Main method so  it looks like following:

 using System;  
 using System.Collections.Generic;  
 using System.Linq;  
 using System.Text;  
 namespace MyFirstApplication  
 {  
   class Program  
   {  
     static void Main(string[] args)  
     {  
       Console.WriteLine("This is my Hello World!");  
     }  
   }  
 }  

Console.WriteLine("bla bla bla"); is used to print out whatever is contained within quotation marks (in this case it will print out bla bla bla.

To start program click on green "play" button or press F5. This will run your program, however you will most likely not be able to see what it prints out because console closes too fast. To avoid that we will add another line of code that requires user to press enter before console closes. Add this line below the last one
Console.ReadLine(); so that code looks like this:

 using System;  
 using System.Collections.Generic;  
 using System.Linq;  
 using System.Text;  
 namespace MyFirstApplication  
 {  
   class Program  
   {  
     static void Main(string[] args)  
     {  
       Console.WriteLine("This is my Hello World!");  
       Console.ReadLine();  
     }  
   }  
 }  

Now try running it again (F5). This time you can see the printed text and console waits for you to press enter in order to finish running.

Now let's try to enter a line of text and print out the text we entered. For this we need to create a String. It will save whatever we write in one line and then we can use it to print out what has been saved in it. To do this we need to insert two lines above our current code. First line is the declaration of String with name "message" and it should be String message;. Second line is for storing text from whatever line you write on keyboard and it should be message = Console.ReadLine();. Your code should now look like this:

 using System;  
 using System.Collections.Generic;  
 using System.Linq;  
 using System.Text;  
 namespace MyFirstApplication  
 {  
   class Program  
   {  
     static void Main(string[] args)  
     {  
       String message;  
       message = Console.ReadLine();  
       Console.WriteLine("This is my Hello World!");  
       Console.ReadLine();  
     }  
   }  
 }  

If you try to run it it will first request from you a line of text (when you press enter it will finish taking text), but it will print out This is my Hello World!. In order to change that we need to make it print out our message. To do this we simply remove "This is my Hello World!" and write message inside parentheses. Now the code should look like this:

 using System;  
 using System.Collections.Generic;  
 using System.Linq;  
 using System.Text;  
 namespace MyFirstApplication  
 {  
   class Program  
   {  
     static void Main(string[] args)  
     {  
       String message;  
       message = Console.ReadLine();  
       Console.WriteLine(message);  
       Console.ReadLine();  
     }  
   }  
 }  

And that's it!

Thursday, 31 January 2013

Science of Freshwater Aquariums (part II)

After discussing starter equipment, we will discuss nitrogen cycle - most important segment of aquarium ecosystem.

Nitrogen Cycle


Nitrogen cycle
Nitrogen Cycle begins with decomposing of organic matter. This includes uneaten food, plant parts and fish feces. When it decomposes it results in ammonia which is highly toxic to fish in aquarium. Smaller part of ammonia is used by plants and greater part is used by Nitrosomonas (Nitrosomas) to produce nitrites. Since Nitrites are still highly toxic it needs to be converted yet again. Nitrospira converts dangerous nitrites into less toxic nitrates. Nitrates are used by plants and are removed from aquarium by water changes.


Step-by.step cycle


Aquarium Cycling


When you set up your new aquarium it is required to cycle it. Cycling means allowing time for bacteria colonies to form in aquarium which help dissolve organic waste into less toxic compounds. This process is usually done without any animal presence (because of high toxicity), however some fish keepers cycle with few fishes that are more resistant to ammonia/nitrites/nitrates.

These are the steps you should take to cycle your aquarium:

1) Ammonia - To start the cycling process first you need ammonia. You can "produce" some by putting some fish food in aquarium and let it decompose.

2) Oxygen - Since Nitrosomonas are aerobic bacteria, they require as much oxygen as possible. This can be done by letting the water pump agitate surface of water and by adding oxygen stones in aquarium.

3) Light - These bacteria love light and if there are no fish in aquarium, light should be kept on all the time.

4) Temperature - Higher temperatures allow bacteria to grow even faster. If there are no fish in aquarium temperature should be kept around 28C (83F).

5) Filter - In order to accumulate bacteria in filter material, filter has to be running all the time.

6) Plants - Plants reduce nitrate and ammonia levels and produce oxygen for Nitrosomonas.

7) Starters - There are bacterial colony starters available in liquid form. These are usually dropped on filter to make starter colonies.


After cycling has started, three phases can be expected:

Cycling of a new tank
1) Ammonia spike - after few days Nitrosomonas will start appearing. This is so called ammonia spike and from that point on, ammonia levels will go down and nitrite levels will go up. Shortly afterwards Nitrospira will appear and start producing nitrate.

2) Nitrite spike - when ammonia levels hit 0, nitrite level will spike. At this point nitrate level will start going down and nitrate level will continue to grow even faster.

3) Nitrite 0 - at one point nitrate levels will go down to 0. This shows that the cycle is complete. Due to high nitrate level around 40% of water should be changed.

After few more days of measuring ammonia/nitrite/nitrate levels and making sure ammonia and nitrite are 0, it is safe to introduce fish into aquarium.



Oxygen Cycle


Finally there is oxygen cycle. This is a very small part of ecosystem balance. Fish need oxygen (O2) dissolved in water in order to survive. This is accomplished by agitation of water surface (with pump), oxygen stones and plant oxygen production (photosynthesis). Animals and plants also produce carbon dioxide (CO2). This is reused by plants for photosynthesis or it exits ecosystem via surface agitation.

Keep in mind:

  • more animals means less oxygen and more carbon dioxide
  • less light in planted aquarium means less oxygen and more carbon dioxide
Bear in mind that some fish need to go to surface and take oxygen (Anabantoidei - Labyrinth fish) like bettas and gouramis, so it is wise to keep the surface area accessible for those fish.






Monday, 28 January 2013

Science of Freshwater Aquariums (part I)

When I decided to buy aquarium for the first time, I was pretty lost. I didn't know what to buy and why do I need it. In order to help future aquarium owners I will create my first post on one of my hobbies - aquaristics.

First off - what are the basic items needed for freshwater aquariums?

1) Aquarium - It is generally not recommended to buy bowls since it distorts fish view and is considered to be painful for fish. Bigger aquariums are usually better (although some fish species prefer smaller environments). If you opt for custom made aquarium, keep in mind that thickness of glass depends on volume of aquarium.

2) Lid with lights - In order to minimise vaporisation as well as protect ecosystem from outside, lid is needed to cover the aquarium. Lights are crucial because it provides fishes vitamin D. Different types of light are beneficial for different things - some are good for fish colouration, some are good for plant growth.

3) Filter - Fish don't always eat all of their food and they defecate in the aquarium. This produces deadly ammonia. Ammonia needs to be converted to nitrite by bacteria. Nitrite is still toxic for fish so it has to be further converted to nitrate. Nitrate is not toxic in smaller quantities and can serve as growing supplement for plants. In order to keep aquarium clean filter collects decaying matter and houses bacteria which convert it to nitrates (as final product).

4) Pump - Even though fish live in water they still need oxygen to survive. Without oxygen dissolved in water fish will suffocate. Pump has dual role - first is to stir water so more oxygen can be dissolved in water and second is to drive water through filter so it can be cleansed.

5) Heater - Not all species live in cold waters, some (e.g. Guppy) live in tropical waters. To provide stable temperature at all time is important for fish health as sudden temperature changes can lead to stress, sickness and death.

6) Thermometer - To make sure you have constant temperature in aquarium you need a thermometer.

7) Siphon - Some decay can be stuck among gravel at the bottom of the aquarium. It can be removed with a simple siphon that circulates the gravel and sucks up decaying matter.

8) Water conditioner - Tap water contains chlorine and heavy metals. This is harmful to aquarium organisms and should be removed with conditioner.

9) Bacteria starter - If you are setting up your aquarium for first time, these bacteria needs to be introduced to aquarium in order to multiply and start converting ammonia to nitrate.

10) Gravel or sand - Bottom dwellers prefer sand due to their body touching the bottom which is not as harsh as gravel.

11) Fish food - Be sure you know what your fish eats. Some eat algae, some eat meat, some are bottom dwellers, some swim in mid/top section. Take all that in consideration when buying food.

12) Net - Safest and least stressful way of handling fish is with net. This way it does not come in contact with your hands (which might have some harmful bacteria/fungi on them). For fish with delicate fins use finer nets.

13) Plants and decorations - Plants can greatly improve your ecosystem by consuming nitrate and producing oxygen. They also serve as hiding and resting places for fish. When putting decorations make sure they don't have sharp edges and that they are properly treated before introducing it to aquarium.

That is all you need to start your aquarium.