Android Resources Names PRO
Each resource has an ID number held in a static variable that belongs to one of the static inner classes in R. The name of that static variable is the very same name we specify as the name of the resource. It can be name of the string (string resource), the name of the image […]
The Difference Between include and require in PHP PRO
Basically, the require and the include commands in PHP do the same thing. Both of them allows our code to use code written in another file by including it into the file we code as if it was part of it. The only difference takes place when encountering a problem. When using require the problem […]
The __PHP_Incomplete_Class Object in PHP PRO
When storing an object in $_SESSION trying to retrieve it in another page we will get an error if the class itself is not available when the session_start() function builds the $_SESSION array. Debugging the $_SESSION we will find that our object is available and is stored as a __PHP_Incomplete_Class object. In order to avoid […]
Facebook PHP SDK Jump Start INFO
The Facebook PHP SDK is composed of two files: facebook.php and base_facebook.php. The first includes the definition for the Facebook class. The second includes the definition for the BaseFacebook class, which is a parent class for Facebook together with few more classes. You can easily download the Facebook PHP SDK at https://github.com/facebook/facebook-php-sdk. The following video […]
Nexus Q Introduction INFO
The Android 4.1 new feature that turns NFC connectivity into bluetooth makes device connectivity into a much simpler process and sets the foundation for new creative products. Nexus Q is one of them.
Java 7 Type Inference for Generic Instance Creation PRO
As of Java 7 we can take out the type arguments required to instantiate a generic class as long as the compiler can infer the type arguments from the context. Many developers name the remaining pair of angle brackets as ‘diamond’. package com.abelski.samples; import java.util.LinkedList; import java.util.List; public class GenericsTypeInference { public static void main(String[] […]
Java 7 Multiple Exception Types Catch PRO
As with Java 7 we can handle more than one type of exception using a single catch block. We should use the ‘|’ operator for putting them together in the same catch statement. When catch handles more than one type of exception the catch parameter is implicitly final. We won’t be able to assign it with […]
The Java 7 try-with-resources Statement PRO
As of Java 7 we can code a try statement that declares one or more resources. Each resource is an object that must be closed after the program is finished. The try-with-resources statement ensures that each resource is closed at the end of the statement. Each object considered as a resource must be instantiated from a class […]
Java 7 Binary Number System PRO
Java 7 allows us to express integral numbers using the binary numbers system. We just need to prefix our integral number with either ‘ob’ or ‘0B’. package com.abelski.samples; public class BinaryDemo { public static void main(String[] args) { int a = 0b101; int b = 0b011; int c = a | b; System.out.println(c); } } […]
Java 7 Switch Case PRO
As of Java 7 we can write a switch case statement that works on strings. This new capability might assist us with writing a shorter code. package com.abelski.samples; public class Demo { public static void main(String[] args) { String operator = args[1]; double numA = Double.parseDouble(args[0]); double numB = Double.parseDouble(args[2]); String result; switch(operator) { case […]