Friday, August 17, 2012
Mobile Computing - evolution and current status
When people talk about mobile devices, what immediately comes up to memory is the mobile phone. The mobile phone appeared after a sequence of about 100 years of inventions, which aim was to be able to communicate from a long distance.
The first successfull telephone transmission was accomplished by Alexander Graham Bell in 1876. He and Thomas Edisson competed in the race that lead to the invention of the first telephone.
Immediately in 1877 the first commercial telephone line entered into operation.
The mobile phone only appeared nearly 100 years after the first phone, adding mobility to the initial goal of speaking at a long distance.
The first (analog) mobile phone appeared in 1960. It was too big to be transported personally, so it had to be installed in vehicles.
In 1973 appeared the first handheld mobile phone (analog).
Only in 1977 appeared the first digital cellular networks.
Currently, mobile devices, including most mobile phones have processing power, having added the goal of mobile computing to the previous goals of distance communication and mobility.
Today, in a confluence of different lines and different research goals, we have IP phones (VoIP), cellular packet switching networks (3G, 4G), mobile devices of various sizes, manufacturers, and with different operating systems, incorporating sensors, GPS , electronic compass, accelerometer, etc..
The number of mobile subscriptions rose from just over 1 billion in 2002 to almost 5 billion in 2008. We currently have 6.8 billion people worldwide, and more than 5 billion mobile subscriptions, of which 50% are prepaid.
Monday, May 7, 2012
First Windows Phone App
In this article we make a first approach to software development for Windows Phone.
To start, we need to install the Windows Phone SDK 7.1, wich comes with a free IDE (Visual Studio Express) and with a Windows Phone Emulator, which allows you to test your apps before deploying them to a Windows Phone-based mobile device.
In this example app, the Visual Studio 2010 has been used, but, of-course, Windows Phone SDK 7.1 must allways be installed.
Windows Phone execution model
Before starting the development of our first app, just some words about the Windows Phone execution model:- Just one App may run in foreground at a given moment in time;
- Other Apps in execution are put into a dormant state;
- When the device's memory isn't enough, the operating system (OS) starts terminating Apps in the dormant state.
- Through their programming framework, Apps can manage their state when they are activated or deactivated. This can be used to give the user the impression that an app has always been running, even when it is stopped and later reactivated.
Create the Windows Phone Project
In Visual Studio (or Visual Studio Express), create a new project with the template for "Silverlight for Windows Phone", and type Windows Phone Application:Tuesday, April 17, 2012
Using Hibernate for Java - 2
In the previous article we saw how to use Hibernate as a middleware layer between the class structure of our Java program and the representation of instances of these classes in a database.
The previous article illustrated the mapping between a Java class and a database table, namelly the class Book and the table with the same name.
Let us now see how to map the class relationships, of type 1-to-N and N-to-N, to the database.
Let's start by adding to our model, which only had one class, two new classes:
- BookCopy (A Book contains the information of a book, and is related to several BookCopy, which correspond to the book copies a library has of that book) --> 1-N relationship.
- Author (A Book has several Author and vice-versa) --> relação N-N relationship.
In the Java project, developed in the previous post, let's start by adding class BookCopy and the respective Hibernate mapping file BookCopy.hbm.xml.
The previous article illustrated the mapping between a Java class and a database table, namelly the class Book and the table with the same name.
Let us now see how to map the class relationships, of type 1-to-N and N-to-N, to the database.
Let's start by adding to our model, which only had one class, two new classes:
- BookCopy (A Book contains the information of a book, and is related to several BookCopy, which correspond to the book copies a library has of that book) --> 1-N relationship.
- Author (A Book has several Author and vice-versa) --> relação N-N relationship.
In the Java project, developed in the previous post, let's start by adding class BookCopy and the respective Hibernate mapping file BookCopy.hbm.xml.
Sunday, April 15, 2012
Using Hibernate for Java - 1
Hibernate is a framework for object-relational mapping with Java language. It facilitates mapping classes, attributes and class relationships between an application class model and its implementation in a relational database. For defining the mappings, XML files or Java anotations can be used.
Hibernate works as a middleware layer between the Java objects and the relational database.
In this article, and in the next one, we will use Hibernate version 3 to ilustrate, through a small example, the utilization of Hibernate in a Java program.
As database system we will be using Oracle 10g.
To start with, we need to crate the database tables. In the article Example of Java Swing Application with Oracle Database - 1 this process is explained.
In this article, we will only be mapping class BOOK.
We create a package for the classes corresponding to database tables, and create class Book:
Saturday, March 3, 2012
Example of Java Swing desktop application without the JSR - 2
In this article we are going to create a Java Swing-based GUI project to complement the ones we previously made, and whose developments are addressed in:
- Example of Java Swing Application with Oracle Database – 1
- Example of Java Swing Application with Oracle Database – 2
- Example of Java Swing Application with Oracle Database – 3
- Example of Java Swing desktop application without the JSR - 1
In NetBeans 7.1, we need to create a Java Application Project:
A Java Application Project automatically creates a class with method main().
We really don't need that class, because we are going to create a JFrame, which automatically creates a main() method that launches it and makes the frame visible.
Anyway, and before creating the JFrame, let's add the needed references to our new project. We need to add, in the project libraries, references to projects HelperDB and librarySystemBLL. References to "ojdbc" jars that come with Oracle XE also need to be added, just like we did before in the other two projects.
Now, let's create the JFrame, that will be the application's main window:
- Example of Java Swing Application with Oracle Database – 1
- Example of Java Swing Application with Oracle Database – 2
- Example of Java Swing Application with Oracle Database – 3
- Example of Java Swing desktop application without the JSR - 1
In NetBeans 7.1, we need to create a Java Application Project:
A Java Application Project automatically creates a class with method main().
We really don't need that class, because we are going to create a JFrame, which automatically creates a main() method that launches it and makes the frame visible.
Anyway, and before creating the JFrame, let's add the needed references to our new project. We need to add, in the project libraries, references to projects HelperDB and librarySystemBLL. References to "ojdbc" jars that come with Oracle XE also need to be added, just like we did before in the other two projects.
Now, let's create the JFrame, that will be the application's main window:
Friday, February 24, 2012
Example of Java Swing desktop application without the JSR - 1
From NetBeans 7.1, Swing application framework (JSR) left being supported by NetBeans, and is no longer part of the official JDK (Java Development Kit).
So, in this article, and the next one, we'll make a small application with Swing classes without using the Swing application framework.
We will make use of the application layers previously developed in:
- Example of Java Swing Application with Oracle Database – 1 (database creation)
- Example of Java Swing Application with Oracle Database – 2 (HelperDB project for accessing the database)
- Example of Java Swing Application with Oracle Database – 3 (librarySystemBLL project / BLL classes)
So, after creating the database, and having present projects HelperDB and librarySystemBLL, we will create a new project (librarySystemGUI) for the user interface.
Firstly, we will see how to import a project to NetBeans, having only the java sources developed in any IDE.
Thursday, February 23, 2012
Swing-based desktop applications after NetBeans 7.1
In the articles
- Example of Java Swing Application with Oracle Database – 1
- Example of Java Swing Application with Oracle Database – 2
- Example of Java Swing Application with Oracle Database – 3
- Example of Java Swing Application with Oracle Database – 4
we developed a small example application, for desktop, using Java/JavaSwing.
For that we used NetBeans IDE, and created a project of type Java Desktop Application for the user interface.
Since NetBeans 7.1, however, Swing application framework is no longer supported by NetBeans, and stopped being part of the official JDK (Java Development Kit). In fact, in NetBeans 7.0.1, the following message already appeared every time one created a Java Desktop Application project:
In NetBeans 7.1 we have, at least, two alternatives:
- Example of Java Swing Application with Oracle Database – 1
- Example of Java Swing Application with Oracle Database – 2
- Example of Java Swing Application with Oracle Database – 3
- Example of Java Swing Application with Oracle Database – 4
we developed a small example application, for desktop, using Java/JavaSwing.
For that we used NetBeans IDE, and created a project of type Java Desktop Application for the user interface.
Since NetBeans 7.1, however, Swing application framework is no longer supported by NetBeans, and stopped being part of the official JDK (Java Development Kit). In fact, in NetBeans 7.0.1, the following message already appeared every time one created a Java Desktop Application project:
In NetBeans 7.1 we have, at least, two alternatives:
- To create an application from scratch, or
- To create a project of type Netbeans Platform Application
Friday, February 17, 2012
First Eclipse Modeling Framework (EMF) example - 3
In the previous article we've created a domain model for a Library Management System, and we've generated a set of corresponding Java classes, by using Eclipse Modeling Framework (EMF).
Now, we're going to test those classes through a new Eclipse project, which references the one with the generated classes.
So, we now create a new plug-in project:
File --> Create --> New --> Project... --> Plug-in Project.
And, in folder src, we create a new class with a stub for method main:
And we create, in method main(), a few lines of code:
This is only the beginning. Now you should create instances of the remaining classes, inter-relate them, and query its attribute values and the values of the relation attributes.
Related articles:
- First Eclipse Modeling Framework (EMF) example - 1
- First Eclipse Modeling Framework (EMF) example - 2
Now, we're going to test those classes through a new Eclipse project, which references the one with the generated classes.
So, we now create a new plug-in project:
File --> Create --> New --> Project... --> Plug-in Project.
And, in folder src, we create a new class with a stub for method main:
And we create, in method main(), a few lines of code:
package javaUsingEMFModel.LibrarySystem;
import org.eclipse.emf.ecore.*;
import LibraryModel.*;
import LibraryModel.impl.*;
import LibraryModel.util.*;
public class MainClass {
public static void main(String[] args) {
import org.eclipse.emf.ecore.*;
import LibraryModel.*;
import LibraryModel.impl.*;
import LibraryModel.util.*;
public class MainClass {
public static void main(String[] args) {
// Inicialize the LibraryModelPackageImpl
LibraryModelPackageImpl.init();
LibraryModelPackageImpl.init();
LibraryModelFactory factory = LibraryModelFactory.eINSTANCE;
// Create a new Book
Book book = factory.createBook();
// Create a new Book
Book book = factory.createBook();
// Give a title to the book
book.setTitle("Os Lusiadas");
// Create an Author, and define his/her name and surname
Author author1 = factory.createAuthor();
author1.setName("Luis");
author1.setSurname("Camoes");
// Add that author as an author of the previously created book
book.getAuthors().add(author1);
System.out.println(book.getTitle());
}
}
book.setTitle("Os Lusiadas");
// Create an Author, and define his/her name and surname
Author author1 = factory.createAuthor();
author1.setName("Luis");
author1.setSurname("Camoes");
// Add that author as an author of the previously created book
book.getAuthors().add(author1);
System.out.println(book.getTitle());
}
}
Related articles:
- First Eclipse Modeling Framework (EMF) example - 1
- First Eclipse Modeling Framework (EMF) example - 2
Subscribe to:
Posts (Atom)