Calico QR- code System

Calico is a Sri Lankan company  that manufacture Cords and tapes. Their main customers are Adidas and Nike, company’s manufacturing plant is located at Negombo,  Sri Lannka. Recently they approached us to develop a QR-Code generating  software for their packing section. Which they can put it on their boxes  and access the QR-code using their mobile to get entire details  about the package eg: contents, current location and invoice.

We were able to complete this project successfully, within few weeks. To accomplish this task we used technologies such as PHP, Mysql, HTML, CSS and Javascript. For Qr-code generating process, i used a third party library called phpqrcode developed by Alexandre Assouad, you can check his librarys at github-account.

Here is the code snippet for adding phpqrcode library.

Hope this Helps. 🙂

implementing Android WebView

Hi In this tutorial i will give you instructions on implementing webview in Android. Sometimes you may need to load webpages inside your application itself rather than redirecting the user to browser. In this tutorial we will see the commands necessary to display webpages inside the application. First of all create a new project and compile it, Make sure you build.gradle file look similar to this

This application will need internet to download webpages, therefore add the internet permission to your manifest. Your manifest file must look similar to this.

Now Create a relative layout activity  and then add a web view inside the relative layout, your activity should look similar to this.

Then modify your mainActivity .java file, it should look similar to this. Look for the comments inside the code for explanation.

Now compile your project and run. You should be able to see a webpage loaded inside your webview. As shown Below.

IOS implementing SignalR using Objective-C

For the past few weeks i been doing some research on SignalR in Objective C and i found very few resources available on the internet for implementing signlR in Objective-C. Therefore i thought of writing this tutorial, hoping it will help some developers one day.

In this tutorial i will explain you, how to  get connected to SingalR hub using IOS and Objective-C. This tutorial is not for beginners.

All Information about SignalR Objective-C library can be found in this Link.

Lets setup the environment first. flow the steps below

  1. First of all create a new IOS Objective C project.
  2. Close the project and navigate to the project directory Using Terminal.
  3. Create a new podfile and save the following code. (make sure to change your project name instead of signalRObjective2)
This will install required libraries such as AFNetworkingSocketRocket and as well as SignalR-ObjC

4. Now run the below command  in your terminal

pod install

. This will install all the required libraries and create a file with extension .xcworkspace in side your project folder.

5. Open the file yourproject.xcworkspace file

Now we got over environment setup , lets do the real coding to get connected to SignalR HUB.

In order to do a signal R communication, You need to understand three main factors in Signal R, They are explained below

  1. get connected – You must get connected to signalR Hub and keep the connection with out closing it.
  2. Subscribe to hub method – You must create a subscription to your hub method at the time of connection.
  3. Invoke hun method – You must invoke a hub method, when ever you want to send some message to the Hub and also receive the response through the subscribed method as explained before.

Now lets see how to implement it.

Connection

As you can see from the above code, you will have to tell the signalR hub URl and also the hub proxy name to the signalR-ObjectiveC library.

Then you need to subscribe to the Hub method as shown in the above code. serviceStatus is the hub method and it will return the response to testMethod which is in the client side.

Invoking a method in signalR hub is very simple as shown in the above code. And if you code dont have any parameters. Your invoke will be like this as shown below

That it. Over all Code will be as shown below

That is. If you have any problems are suggestions please be free to comment below, I will be happy to respond them.Thank you. Happy Coding 🙂

 

 

Caught a pikachu – pokemon go

Although i have played many games, i have never thought of writing anything about games before on my blog. This is the first time i am writing about games. I love games as many other mobile developers do. The first computer game i ever played is Dangerous dave, I managed to get up to level 9 but never completed it, Then i played prince of persia the DOS game and then super mario so on. I have also played games like age of empires 3, house of death, call of duty 3 and clash of clans etc. Reason for me writing this article is yesterday (14th December 2016) there was a game officially released in Sri Lanka its none other than the Pokemon go. Pokemon go is the first augmented reality game i ever played, Its really a interesting game. I love the game so much, in just two days of release i have caught 108 pokemon out of 250 and i have also caught pikachu today.

screenshot_20161215-112906    screenshot_20161215-130232   screenshot_20161215-144742

I am gone continue playing this game and also i will write more articles when i found something interesting that i can share with you people. 🙂

 

Signal R in Android

Recently i developed a Android chatting application for the company called zupportdesk. I went through lot of difficulties since there is a very few online resources available for reference to implement signal R in Android, but somehow i figured it out by putting lot of time and effort on it. Now i thought of sharing what i have learned so that it will help some developers someday.

This tutorial will give you instruction on how to implement signal R in Android. Before getting started i expect you to have some knowledge on Android, Android Services and Signal R, therefore this tutorial is not for beginners. Ok lets get started

What is a signal R

SignalR is a new library used to add real-time web functionality to your applications. Signal R uses technology such as

  • web sockets
  • Event Source,
  • forever frame
  • long polling

Signal R is capable of selecting the best from those four technology depending on your internet connection and your application stability.

Signal R is used in application such as

  • Chatting application
  • Stock market application
  • Real-time gaming

It is also used in variety of sectors where ever the real-time communication is needed. to learn more about signal R visit signalr.net.

Required Libraries

  • gson-2.2.2 –  Download
  • signalr-client-sdk-android – Download
  • signalr-client-sdk – Download

Download these libraries and put it on your libs folder and then add it to your build.gradle as shown below.

Also we must ignore some files in the library

You app will work fine with out excluding these files, but when you upload it to the play store your application supported devices will be zero. Therefore its better to exclude the files now itself.

finally your build.gradle file will look some what similar to this

apply plugin: ‘com.android.application’

 

These type for application consumes huge amount of data and battery life of the device, therefore it is important to choose the best service that supports your application, I am going to use Android Bind service for this example. Because i want the application to run background task only when the application is open on the device.

To do the real time communication the services need to do three task.

  1. It should connect to Proxy hub and the keeps the connection continuously open.
  2. It should subscribe to the hub method , so that it can receive information from hub to the device, whenever the change or a new message is received to the hub.
  3. It should invoke the hub method when a device need to send messages to the hub

Example for hub method subscription are shown below

Example for invoke Hub methods are shown below

Finally You Service should look somewhat similar to this

In you Activity just call the Service

That’s it. if you do this properly you will have the connection between your signal R hub and your Android device. You can Check the connection information on ADT logs. From now on you just have to invoke and subscribe to hub method to send and receive messages.

 

Hope this helps. If you have any questions are suggestions, please feel free to ask. Happy Coding 🙂

lolcorps.com

Lolcorps.com is a entertainment website that display funny images, animations with memos. Actually i never planned for this website. This time i was working in a telecommunication company in Sri Lanka, here i used to write scripts for servers. so i was doing some research on servers and testing some of my automated scripts, eventually i ran that script on one of the popular entertainment website and download all their resources from their server with in 3 hours. I downloaded 18000 image assets from that entertainment website in 3hours, that’s  a huge amount of resources. Now i thought of putting this resource in a useful way.

So now i wrote a simple algorithm to sort this images in to categories and get the image name, strip all the unwanted characters and use it as a database field. Now i have the resources and database ready, i then downloaded a HTML theme from themeforest.com and developed a website  using codeigniter with in a month and put it live. It is still live at the time of writing this article. Please visit : http://www.lolcorps.com/home/most_recent

MD5hacking.com

This is my 7th website i ever created back in 2014. Its a simple website, help developers to decrypt and encrypt MD5 hashes. Yes we all know, there is no way you can decrypt md5 hashes, because the algorithm is designed in a way that the original values are lost during the process of encrypting a md5 hash.

I created a huge database by converting all the text from oxford dictionary to md5 hashes and saving it in a database, i wrote an simple algorithm to do this task and  unlike all the other websites i developed, i didn’t spent much time on this website. i was able to complete this project with in a week and put it live.

But this time i had good adsense account, i added it to the website and run it for about a year, but was unable to cover even the domain and hosting expenses with the amount i was getting from adsense. so i decided to drop the website.

 

Lankahomes.lk – adspace.lk

adspace.lk is a online website, that helps uses to advertise their properties online for free. I started creating this project after dropping isaithuli.com, but unlike isaithuli.com now i learned a lot about web development technologies and now i am in my final year of my college, while developing this project. i had lot of college work to do in my final year, therefore i know i cant spend more time on this project, so i was looking for the easiest way to do it.

I downloaded a HTML theme form Themeforest.com and modified it according to my requirements, then using my knowledge on PHP and MYSQL database i was able to complete this project put it live within 3months. at that moment adspace.lk looked like this.

Although i completed the site successfully and running it properly, i was not happy about  the amount of customer and visitors to the site, so i thought something need to change and i decided to redevelop the website with new interface theme and latest technologies.

Now i have finished my college and i had lot of free time and i started working as a PHP developer in one of the big web development companies in Sri Lanka. But i was not paid enough to fulfill my basic needs with the salary i was getting as a fresher. So i started doing project for other people as a freelancer, this gave me a wast knowledge on Codeigniter ( A beautiful and easy learning PHP framework). With this knowledge on technologies i started redeveloping the website, as usual i download the HTML theme from themeforest.com and started modifying it to my expatiation and using my knowledge on Codeigniter i created a fully working product, where users can login and post their properties by themselves and using the admin panel i will decide weather to display the properties or not. This project took almost around 6 months to complete. Now the site looks much better than adspace.lk, ah i forget to tell, i changed the name and re-branded the site as lankahomes.lk. Now the site looks like this

with this design and function, I made lot of promotions on facebook and google ad-words. But i was still not happy about the number of users.

https://www.facebook.com/lankahomeswebsite/

My first website : Isaithuli.com

This is a the first website i ever created back in 2013. I started this  project in my school days, because i had a strong interest in Tamil music, those days i also used work part-time in a communication shop in Mount Lavinia, Sri Lanka. There i used to download huge amount of Tamil music from online resources for my customers. Gradually i started collecting playlist and after about an year i had collection of 60 GB of playlist. with this collection i thought of making my own MP3 website, so after thinking and searching for domain names with some of my friends for days, i found this name called ISAITHULI.COM  (Means music drop in Tamil), I immediately bought the domain name and started the project.

Then on those days, i didn`t had any knowledge on web development, but with the support of my friend, his name is  JERI, i learned dream viewer (an old web development IDE ) and started developing the site. You can see the screen shot of the site i developed, below.

This site is entirely made of HTML and CSS, although i send more than 3 months to develop this site, i found it really difficult to update the site manually.  So i decided to move on and look for something that can automate the process and reduce my work and time i spend on this site. Then i found this tool called Joomla a web development framework, i learned Joomla and redeveloped the site again, but it took more than 6 months. Now the site is better than before and most important thing is that i can automate most of the process like adding new album.

Now i have the website running smoothly and i was happy, but i couldn’t make any money out of it, i tried google Adsense but they rejected the application due to copyright issues.