The Nothing Type in Scala <font size=-2><a href=http://www.lifemichael.com/en/?page_id=73 target=_blank>PRO</a></font>
The main usage for Nothing is when specifying the return type for methods which never return normally (e.g. throw an exception when been called). object Sample { def main(args:Array[String]):Unit = { val ob = getMyStack[Int](10) } def getMyStack[T](num:Int) = { new EmptyMyStack[T] } } abstract class MyStack[T](size:Int) { def data:T; } class EmptyMyStack[T] extends MyStack[T](0) […]
Generic Functions in Scala <font size=-2><a href=http://www.lifemichael.com/en/?page_id=73 target=_blank>PRO</a></font>
The Scala programming language allows us to define generic functions. This code sample shows that. object Sample { def main(args:Array[String]):Unit = { val ob = getMyStack[Int](10) } def getMyStack[T](num:Int) = { new MyStack[T](num) } } class MyStack[T](size:Int) { //… } The following video clips overviews this code sample, shows its execution and provides more information.
Tomcat Support for HTML5 Web Sockets <font size=-2><a href=http://www.lifemichael.com/en/?page_id=73 target=_blank>PRO</a></font>
The Apache Tomcat web containers supports web sockets. The basic web sockets samples it includes can serve as a great jump start. The following video clip shows the execution of one of these samples.
Overloading Unary Operators in Scala <font size=-2><a href=http://www.lifemichael.com/en/?page_id=73 target=_blank>PRO</a></font>
When overloading an unary operators in Scala we should precede the operator name with ‘unary_’. Not doing so we will get an exception when using it. The following code sample shows that. package il.ac.hit.samples object Program { def main(args: Array[String]) { val ob = new RationalNumber(1,3) val other = -ob println(other) } } class RationalNumber(a:Int,b:Int) […]
Accessing The Query String in Node.js <font size=-2><a href=http://www.lifemichael.com/en/?page_id=73 target=_blank>PRO</a></font>
In order to access the query string we should first require the url module. Doing so we will be able to invoke the method parse on the url module passing over req.url and true. The method parse returns an object that its properties are the parameters the query string includes. var http = require(‘http’); var […]
Developing Android Broadcast Receiver <font size=-2><a href=http://www.lifemichael.com/en/?page_id=73 target=_blank>PRO</a></font>
In order to develop an android broadcast receiver we should define a class that extends BroadcastReceiver, implement our onReceive method and update the android platform about the new broadcast receiver, either via the manifest xml file or by calling the registerReceiver method. The following code sample includes the definition of a BroadcastReceiver that will get […]
Developing Android Remote Services <font size=-2><a href=http://www.lifemichael.com/en/?page_id=73 target=_blank>PRO</a></font>
The first step is coding the aidl file that includes our definition for the interface that lists the methods we want to enable their invocation from another process. package com.abelski.currencyservice; interface ICurrencyService { double getCurrency(String country); } The aidl compiler will go over that file and auto generate the interface we defined in the aidl […]
Learning Android Java Applications Development <font size=-2><a href=http://www.lifemichael.com/en/?page_id=73 target=_blank>PRO</a></font>
Using HTML5 and other web technologies when developing an application for the android platform simplifies the development process and helps us cooping with the well known android platform fragmentation problem. I chose to write this post in order to point at those cases in which we cannot avoid using Java in our application development for […]
PHP Mobile Applications HIT December 2012 <font size=-2><a href=http://www.lifemichael.com/en/?page_id=73 target=_blank>INFO</a></font>
On December 11th I started to deliver a detailed professional course for cross platform web and mobile applications development. The course focuses on PHP for the server side and focus on JavaScript for the client side. The course includes 220 academic hours and it takes place in HIT. You can find detailed information about this […]
Android 4.1 Professional HIT November 2012 <font size=-2><a href=http://www.lifemichael.com/en/?page_id=73 target=_blank>INFO</a></font>
On November 15th I start delivering a professional course for learning how to develop applications in Java for the android platform. The course includes 180 academic hours, it takes place in HIT and it splits into three parts. The first part covers the topics in Java required for learning android development and it includes extensive […]