The Returned Type of Recursive Function in Scala <font size=-2><a href=http://www.lifemichael.com/en/?page_id=73 target=_blank>PRO</a></font>
When you define a recursive function you must specify the type of the returned value. If you don’t do it the compilation fails. object Program { def main(args: Array[String]):Unit = { println(factorial(4)) } def factorial(num:Int):Int = if (num==0) 1 else num*factorial(num-1) } The following video clip explains that.
Scala Expressions Evaluation <font size=-2><a href=http://www.lifemichael.com/en/?page_id=73 target=_blank>PRO</a></font>
When creating a variable using val or var and assigning the value of an expression into it the expression is evaluated when the variable is created. When creating a function using def and assigning the value of an expression to it the expression is evaluated when calling the function. object Program { def main(args: Array[String]):Unit […]
Node.js on Cloud9 Jump Start <font size=-2><a href=http://www.lifemichael.com/en/?page_id=73 target=_blank>PRO</a></font>
Node.js is a platform built on top of JavaScript v.8, Google’s JavaScript runtime engine. Node.js enables us to develop web applications that excellent in their performance. The following code sample is a simple HTTP web server developed using node.js that returns the hello greeting back to the client from which the HTTP request arrives. var […]
Log4j Jump Start <font size=-2><a href=http://www.lifemichael.com/en/?page_id=73 target=_blank>PRO</a></font>
Log4j is an open source project developed and maintained by Apache. It is part of a bigger open source project known as the Apache Logging Services. The following code sample shows how to use Log4j in its basic configuration. package il.ac.hit.samples; import org.apache.log4j.BasicConfigurator; import org.apache.log4j.Logger; public class SimpleLoop { static Logger logger = Logger.getLogger(“SimpleLoop”); public […]
WordPress Jump Start Lecture <font size=-2><a href=http://www.lifemichael.com/en/acronyms/>INFO</a></font>
On Tuesday November 27th I delivered a practical jump start for websites development using the WordPress open source project. You can find the detailed presentation I was using during the lecture ready for download at http://www.lifemichael.com/presentations/wordpressjumpstart.pdf. I have just complete to prepare a series of short video clips (in hebrew) you can watch for free and […]
Generics Implementation in Java <font size=-2><a href=http://www.lifemichael.com/en/acronyms/>PRO</a></font>
The generic class has the same behavior for all of its possible parametric types. The same generic class can be viewed each time as if it has a different parametric type. For the JVM it doesn’t matter which parametric type we chose to instantiate a generic class with. In all cases, for the JVM it […]
Generics’ Bounded Wild Cards in Java <font size=-2><a href=http://www.lifemichael.com/en/acronyms/ target=_blank>PRO</a></font>
When using a bounded wild card we can limit the parametric type as if we were saying that it can be any type as long as it extends or implements a specific type we specify. package il.ac.hit.samples; import java.util.Iterator; import java.util.Vector; public class BoundedWildCardSample { public static double calculateTotal(Vector<? extends Shape> vicy) { double sum […]
Generic Type Arrays in Java Limit <font size=-2><a href=http://www.lifemichael.com/en/acronyms/>PRO</a></font>
When using an array of generic type objects in Java we cannot specify the exact parametric type. This limit exists due to the way generics is implemented in Java (in the compiler level). package il.ac.hit.samples; public class ArraysGenericsLimit { public static void main(String[] args) { MyStack<?> []vec = new MyStack<?>[10]; vec[0] = new MyStack<Rectangle>(); vec[1] […]
The Israeli Guide to C++ <font size=-2><a href=http://www.lifemichael.com/en/?page_id=73 target=_blank>INFO</a></font>
I have recently started to work on writing a short practical guide for learning C++. The guide includes texts and video clips. The texts were written in Hebrew. The video clips were taken in Hebre as well. You can find it at www.CPPBook.co.il.
Android Jump Start Lecture <font size=-2><a href=http://www.lifemichael.com/en/?page_id=73 target=_blank>INFO</a></font>
On November 8th I have delivered a jump start lecture for Android applications development in Java. The lecture took place in HIT and pizzas were served (sponsored by Google) during the break. You can download the slides I was using during the lecture. I believe they can assist you while doing your first steps.