Sunday, January 2, 2011

Patricia Menterola Wedding

CAPTURE VIDEO FROM A WEB CAMERA WITH JAVA (1st part)

JAVA MEDIA FRAMEWORK
E oday applications that interact with external devices are increasingly common. We can meet user authentication systems from something as simple as introducing a security key or a more complex process such as fingerprint recognition. Java provides a multimedia-based mechanism for making applications more friendly to users. Thus, we can create an application that reads a key and display the image of the person we are looking for. This technology known as Java Media Framework (JMF Java and Multimedia Environment). Allows the integration of audio and video (playback and capture) and a set of tools for developing cross-platform technology. This API is available from its official website in the downloads section. Once you've downloaded the program is installed in the traditional way.

JMF already installed on your system do we have to recognize the external multimedia devices with which we have cameras, capture cards, sound cards, microphones, etc.., We to run "JMF Registry "which is inside the folder" \\ JMF2.1.1e \\ bin . " NOTE: If using JMF in Windows Vista / 7 you have to run this program with Administrator permissions.

After running the program select the tab "Capture Devices" and click on the button "Detect Capture Devices" and wait until the program ends to scanning. When finished we will have a window similar to the following:



This window is important to note the capture device name, location and format that enables. In my case I have the following:

Device Name: "vfw: Microsoft WDM Image Capture (Win32): 0"
Location: "vfw: / / 0 "

These values \u200b\u200bare then use to refer to the device from the program. Finally press the "Commit" to apply the changes and close the window, so we registered with the JMF video capture device.

Entering programming, classes that use it to develop example is the following, all found in the package file javax.media JMF.jar found in "\\ JMF2.1.1e \\ lib".

CaptureDeviceInfo
Contains information about the capture device deployed.

CaptureDeviceManager
class that provides information from different capture devices that are available in the system.

Manager
This class provides access to system resources through JFM.

MediaLocator
This
class allows us to identify the location of a multimedia content source device through its URL (Uniform Resource Locator).

Player (Interface)
A Player is an object used to control and process multimedia data a content type specific data, eg audio or video .


videoformat (Javax.media.format package)
Encapsulates format information for video data. attributes of a videoformat include the encoding type, size, frame rate and type of data. For other video formats see the reference page .

Saturday, January 1, 2011

Pleurodiaphragmatic Adhesion Left

abstract table model (AbstractTableModel)

A convenient way to represent information about a particular topic using model life tables is easy to program our own style and convenience. Java offers component called abstract table model (class AbstractTableModel javax.swing.table package) that implements the TableModel interface whose methods to implement are:

public int getRowCount () - Returns the number of rows that contains the table.
public int getColumnCount () - Returns the number of columns table.
public Object getValueAt ( int row, int column) - Returns the element / value at the position (row, column) of the table.

Then, to illustrate the example of using AbstractTableModel class will have the following sample code to the methods mentioned above:


 AbstractTableModel 
class MyTable extends {

@ Override public int getRowCount () {
return
10;


} @ Override public int
getColumnCount ()

{return 10;}


@ Override public Object
getValueAt (int row, int column)

{return "# VALUE #";}

}
addition to these methods we can override other four AbstractTableModel own class. These methods are:


public getColumnClass Class ( int column) - Returns the class type of a particular column, that is the type of object that is hosting this column in the table.
public String getColumnName ( int column) - Returns the name of the column.
public boolean isCellEditable ( int row, int column) - Returns true if the cell specified by the position (row, column) has enabled the edit mode, otherwise returns false.
public void setValueAt (Object value, int row int column) Sets a value (object) within the table at the position specified by row, column. The description of other methods can be found in the documentation page AbstractTableModel.

worth mentioning that this type of tables they can apply custom styles to make them more pleasing to the eye of the user, such as changing the color of the rows and columns, text font and even add Swing components as part data. Below is an example of the implementation of the above methods. To this end incorporates a table in a form containing key, name and address of users from a fictitious company. We will use the Person class that defines the necessary methods to insert and collect these values, its structure is as follows:

 
final class Person {public
Person () {

this (0, "", "");


} public Person (int key, String name, String address)
{
setClave (key);
setNombre (name);
setDireccion (address);
;} public void

setClave (int key) {

this.clave = key;
;}

 public void setNombre( String nombre )
    {
        this.nombre = nombre;
    }

    public void setDireccion( String direccion )
    {
        this.direccion = direccion;
    }

    public void setPersona( Persona persona )
   {
this.persona = person;}


getClave public int () {

return key;}


public String getName () {

; return name;
} Public String

getDireccion ()

{return address;}


GetPerson public Person ()

{return this;}


key private int ;
private String name;
private String address;
private Person person;}


Once we have the Person class can write the Table class that defines the behavior of the table.

class Table extends AbstractTableModel
 

{public Table () {

names = new String [] {"KEY" "NAME", "ADDRESS"};
data = new Vector (0);}


@ Override public Class
getColumnClass (int column)
; {return
getValueAt (0, column). getClass ();}



@ Override getColumnName public String (int column)

{return names [column];}


@ Override public
int getRowCount () {

datos.size return ();}



@ Override ; public int getColumnCount ()
{return
nombres.length;


} @ Override public
getValueAt Object (int row, int column)

{if (datos.size ()> 0)
switch (column)
         {
                case 0:
                    return datos.get( fila ).getClave();
                case 1:
               datos.get return (row). getNombre ();
case 2:
; datos.get return (row). getDireccion ();}

return "";}
Public void

agregarRegistro (Person person) {

datos.add (person);
fireTableStructureChanged ();}


private Vector data;
private String names [];}


Monday, November 8, 2010

Newly Born Baby Wish Sms

Java Connection - Oracle XE

Oracle a management data base relational model, one of the most powerful at present, developed by Oracle Corporation. Like many other systems and database managers can interact with external applications and programming languages \u200b\u200bsuch as Java, to create web sites and applications more suited to our needs.

order to make a connection between Oracle and Java need to use the Oracle JDBC driver, available in the downloads section Oracle. According to the documentation regarding this driver will mention the following:

JDBC Driver (English Java Database Connectivity ) is a protocol for access to database allows you to execute SQL statements and queries on a database. Oracle Corporation provides support for client-server application development through the use of Thin JDBC, the Oracle Call Interface (OCI) and oracle.sql and oracle.jdbc packages. These packages contain classes and interfaces that extend the standard JDBC to manipulate Oracle data types. Using them allows greater performance and flexibility in a Java application.

Oracle Java Thin is a driver for creating Java applications and applets that access to information in an Oracle database. Java Thin driver is especially designed for Web-based applications because it can automatically download from the website automatically, as an applet more. This driver will use the connection for our example. We must ensure, once you've downloaded the JAR file, store it in our class libraries (Classpath) for the Java virtual machine can make use of it. The label blog Installation discusses how to make these settings when installing the JVM.


The code of connection to the database is as follows:




The
application works in console mode, propagate the exceptions that can generate the code execution to be trapped at the highest level of the JVM.

Line 9 of the code shows the communication protocol that we established from the Java application with Oracle Database XE, where the parts that make up this line are:


String url = "jdbc: oracle: thin: @ 127.0.0.1:1521: xe";


jdbc: oracle : refers to the communication protocol.
thin : controller is used for communication.
127.0.0.1 : is the computer (server) where it is hosted database. This address can change if you are working remotely.
1521: is the port from which we obtain data handler Oracle Database XE assigned during installation.
x : is the name of the default database to Oracle XE.


itself to working with Oracle from Java is very similar to using other database managers. You only need to consider the specifications for each of them.