Thursday, December 8, 2016

Create IOT back-end with REST API

 

If you are a developer or an IT student most probably you heard this word "REST". Actually what is this REST ??? 







REST standards for REpresentational State Transfer. It is an architectural way of communicating with most of web services of today.

REST is the popular way of communicating with most of web services today. Most of API of web services use REST architecture ( they are called RESTAPIs ). REST typically runs over HTTP protocol. 

Let's understand what is REST 

Imagine there is a student database system that you need to create, update, display and delete. Assume student database in internet.

Using one single URL if you can do all of above operations how awesome is that :). REST is a that kind of architecture.

example URL : studentDB/ 

if you want to 

  • create new student record simply send POST http request to studentDB/
  • get Student info send GET http request to studentDB/{student id}
  • update student info send PUT http request to studentDB/{student id}
  • delete student record sent DELETE http request to studentDB/{student id}  

using different http methods we easily make our own rest services using json or xml data parsing.

Along with this tutorial series we use

  •  mongoDB as database client 
  • nodejs as our server side handler 
  • Angular.js as our front-end visualizer.
Hope you will join with next part too.

   


  

Friday, July 8, 2016

Maven for beginners : part 1

Introduction 
All build systems are essentially the same. All they have done is same tasks again and again.

  • compile source code 
  • copy recourses 
  • compile and run tests
  • package project
  • deploy project
  • cleanup
Maven is a software management and comprehension tool based on the concept of Project Object Model (POM). It is primarily used for java project but not only that but also it can manage projects on c#, Ruby, Scala and other languages. Maven is intended to make day today work of java developers easier.

Project Object Model (POM)


POM is a XML file that contains information about project and configuration details used by maven to build the project. It describe the project name, version, Artifact type, source code locations, dependencies, plugins etc.

Install and setup Maven  

Make sure that JDK is installed and JAVA_HOME variable is added as windows system variables. 

  • Download maven
You can download maven using  https://maven.apache.org/download.cgi  link. In this tutorial I have used apache-maven-3.3.9 . And extract it to C directory. ( This is for simplicity you can extract it any where you want )

  • Set environment variables for maven

  1. go to system properties -> Environment variables  
























2. Add M2_HOME and MAVEN_HOME user variables





3. Append to System path variable
























  • Check whether maven install correctly
open command prompt and enter mvn -version If you install correctly it will give window like below.  


Create First Maven Project

For this tutorial I have created folder called "maven-test-project". Go to that folder and open command prompt inside it.( press shift and right click inside folder >> inside menu you will see "open command window here" click that ).

now type mvn archetype:generate  
P.S. :make sure that you are connected to internet 



Then it will be automatically download maven archetype plugin when you are required in your first maven project. This is happen only for first time.


 After some time you will see a window like above. Those numbers indicate various archetypes which you are choose from. In default it gives archetype of maven hello world program.This number can be different in your case. Now I pressed enter to make default  maven hello world program.

now it will give you options like below.



since archetypes are the templates, they are evolve in time. Thus They have their own versions. For this tutorial I am going to choose option 6 ( latest version ). press enter for option 6.   

In next step it will be ask to provide group id 


Group id is unique among organization or project. In this case I use " com.logicx ".
Next it will ask artifactId



ArtifactId is the project name In this case I use "maven-test-project"
Next it will ask version 




SNAPSHOT means this is development version not a release version. In this case I give "1.0-SNAPSHOT" as version
Next it will ask package



It gives package hint as com.logicx (In my case) I accept it.
Next it will ask confirmations for your choices  press "y" and enter



see you soon with next tutorial.
 next : Create maven project using intellij, dependency management, Build lifecycle etc. 

Saturday, June 25, 2016

Build LibreOffice

LibreOffice is a huge project you need at least 25GB free space. I will guide you step by step to build LibreOffice. My operating system is xubuntu and it fresh installed OS. Type following commands on terminal

  1. First update the system  (use terminal)
    • sudo apt-get update
    • sudo apt-get dist-upgrade

  2.  Install git
    • sudo apt-get install git

  3. get dependencies of LibreOffice 
    • sudo apt-get build-dep libreoffice

  4. clone git repository
    • git clone git://anongit.freedesktop.org/libreoffice/core

  5. Configure the build
    • go to core directory (use:  $ cd core)
    • ./autogen.sh

  6. Build LibreOffice
    • make

  7. Open LibreOffice
    • instdir/program/soffice

Make it better LibreOffice

LibreOffice is free and open source office suite. It is a project of The Document Foundation.
It is available in 110 languages.There is 6 main features in LibreOffice
  • Writer : A word processor.
  • Calc : A spreadsheet program
  • Impress : A presentation program
  • Draw : A vector graphics editor
  • Math : An application designed for creating and editing mathematical formulae.
  • Base : A database management program, similar to Microsoft Access
I choose contribute to LibreOffice as my 3 rd year software engineering project. Stay touch I will post series of posts that how to contribute LibreOffice as a beginner

Smart Medicine Box

Smart medicine box was done as course project of embedded system.It is a smart device that track our medicines and give alerts at right time.

Problem

forget is common mistake to all of us. But when it comes to medicine it would be dangerous. people usually forget  
  • The date
  • The time
  • No of pills that need to take
Also there are some peoples they don't sure that weather they took their pills or not. There are nurses who taking care older peoples or patients. they also need to remember instructions to remember pills of lot of patients or elders.

at the moment people use manual medicine boxes and put there themselves separated pills according to there schedule and give them at right time.but what if nurse forgot time, that would be lot of problem. So smart medicine box is going to help those peoples.

System model 

 

  In system model we have developed android application, using this application users (guardian or nurse) can update schedule of patient eg. starting time, time duration between drugs, no of pills etc.
This update is can do remotely. we used WSO2 IOT platform agent file for raspberry pi and MQTT broker as mosquito. We deployed database inside raspberry pi to store schedule and separate thread compare database time with system time and give alerts.

p.s keep in touch for further details about smart medicine box

Thursday, April 7, 2016

Hello World

Hello everyone ! This my first blog post. I am an computer engineering undergraduate student of university of Peradeniya. I love tech related stuffs such as Internet of things, Virtual reality, Network security. I like to study new technologies.