UML Free Tools INFO

I was recently approached by software developers who are looking for free UML tools. Assuming that you are looking for a tool that supports most of the UML 13 diagrams and assuming that you are looking for a tool that apart of the diagram it creates the model and allows you to generate code, I […]

XML DOM Parsing in Java PRO

JAXP (Java API for XML) provides us with the capability to parse XML documents using a DOM parser. The following code sample shows a simple parsing using the JAXP DOM parser. package com.abelski.samples; import java.io.IOException; import java.net.URL; import java.io.InputStream; import java.net.HttpURLConnection; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; […]

The Android findViewById Function PRO

Most Android developers are fairly well familiar with the findViewById function our activity inherits from the Activity class. This function receives the ID number of a specific View resource the activity user interface includes. If you ever try to call that function before calling the setContentView function (our activity inherits from the Activity class) then […]

HTML5 Relational Database INFO

HTML 5 provides us with a relational database running on the web browser. This relational database supports SQLite sql syntax. The following code sample checks whether the web browser supports the HTML 5 relational database. <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”> <html> <head> <title></title> </head> <body> <script type=”text/javascript”> if(window.openDatabase) { document.write(“support”); } else […]

Writing to Java Script Console PRO

We can easily track our code in Java Script by writing text messages to the Java Script console. The following code sample shows how to do it. <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”> <html> <head> <title></title> <script type=”text/javascript”> var sum = 0; for(i=1; i<=10; i++) { sum+=i; console.log(“i=”+i); console.log(“sum=”+sum); } document.write(“sum=”+sum); </script> </head> […]

Simple Trait in PHP PRO

Defining a trait is very similar to defining a class. Instead of using the keyword class we use the keyword trait. The purpose of traits is to group functionality in a fine grained and consistent way. It is not possible to instantiate a trait. The trait servers as an additional capability that provides us with additional capabilities when […]

Arrays Short Syntax in PHP 5.4 PRO

As of PHP 5.4 we can create new arrays in a simple way. Simpler than ever. The following code sample shows that. <?php $vec_a = [4,6,2,7]; $vec_b = [‘a’=>’australia’,’b’=>’belgium’,’c’=>’canada’]; foreach($vec_a as $k=>$v) { echo ” “.$k.”=>”.$v; } foreach($vec_b as $k=>$v) { echo ” “.$k.”=>”.$v; } ?> The following video clip shows the execution of this […]

Array Dereference in PHP 5.4 PRO

As of PHP 5.4 we can develop a function that returns an array and treat the call to that function as an array we want to access its elements. <?php function doSomething() { $vec = [23,53,75,64]; return $vec; } echo doSomething()[0]; ?> The following video clip shows the execution of this code sample and explains […]

The PHP 5.2 filter_var Function PRO

PHP 5.2 adds the filter_var function. It is an important function that assists with validating the user input. <?php $email_address_dirty = “haim.michael@gmail.com”; if(filter_var($email_address_dirty,FILTER_VALIDATE_EMAIL)) { $email_address_clean = $email_address_dirty; } echo $email_address_clean; ?> The following video clip shows the execution of this code sample and explains it.

PHP 5.4 Short Tags PRO

As of PHP 5.4, the support for short tags exists by default. There is no need to introduce changes into php.ini in order to use the PHP short tags. <? $numA = 24; $numB = 4; ?> <h1><?=($numA+$numB)?></h1> The following video clip shows the execution of this code sample and explains it.

Skip to content Update cookies preferences