Social Icons

twitterfacebookgoogle pluslinkedinrss feed

Thursday, March 20, 2008

Fantastic Features In Net Bean IDE

I downloaded latest Net Bean IDE for my new project in University. There i can create GUI very easily. Yesterday I connect my project folder in to SVN server. Using this latest Net Bean IDE I can very easily connect to SVN server.


Monday, March 10, 2008

Java Bean

JavaBeans are classes written in the Java programming language conforming to a particular convention. They are used to encapsulate many objects into a single object (the bean), so that the bean can be passed around rather than the individual objects.The specification by Sun Microsystems defines them as "reusable software components that can be manipulated visually in a builder tool".

Example:

// PersonBean.java
       public class PersonBean implements 
           java.io.Serializable {
        private String name;
        private boolean deceased;
        // No-arg constructor (takes no arguments).
        public PersonBean() {

        }

       // Property "name" (note capitalization) 
             readadble/writable
       public String getName() {
          return this.name;
       }

       public void setName(String name) {
           this.name = name;

       }

       // Property "deceased"
       // Different syntax for a boolean field 
          (is vs. get)

       public boolean isDeceased() {
           return this.deceased;
       }

       public void setDeceased(boolean deceased) {
         this.deceased = deceased;
       }


     }





// TestPersonBean.java

    public class TestPersonBean {
    public static void main(String[] args) {

    PersonBean person = new PersonBean();
    person.setName("Bob");
    person.setDeceased(false);

    // Output: "Bob [alive]"
    System.out.print(person.getName());
    System.out.println(person.isDeceased() 
        ? " [deceased]" : " [alive]");
    }
    }

Thursday, March 06, 2008

What Is Hibernate

Hibernate is an object-relational mapping (ORM) library for the Java language, providing a framework for mapping an object-oriented domain model to a traditional relational database. Hibernate solves Object-Relational impedance mismatch problems by replacing direct persistence-related database accesses with high-level object handling functions.Hibernate is free as open source software that is distributed under the GNU Lesser General Public License.


Hibernate's primary feature is mapping from Java classes to database tables (and from Java data types to SQL data types). Hibernate also provides data query and retrieval facilities. Hibernate generates the SQL calls and relieves the developer from manual result set handling and object conversion, keeping the application portable to all SQL databases, with database portability delivered at very little performance overhead.


LINK: Interview with Gavin King, founder of Hibernate HIBERNATE 



Wednesday, March 05, 2008

Video Transmit Using JMF

Here is One example for video transmit using JMF:


import java.awt.*;
import javax.media.*;
import javax.media.protocol.*;
import javax.media.protocol.DataSource;
import javax.media.format.*;
import javax.media.control.TrackControl;
import javax.media.control.QualityControl;
import java.io.*;

public class VideoTransmit {


private MediaLocator locator;
private static MediaLocator ml;
private String ipAddress;
private String port;
private Processor processor = null;
private DataSink rtptransmitter = null;
private DataSource dataOutput = null;
public static CaptureDeviceInfo di = null;

public VideoTransmit(MediaLocator locator,
String ipAddress,
String port) {

this.locator = locator;
this.ipAddress = ipAddress;
this.port = port;
}


public synchronized String start() {
String result;
result = createProcessor();
if (result != null)
return result;


result = createTransmitter();
if (result != null) {
processor.close();
processor = null;
return result;
}

processor.start();

return null;
}


public void stop() {
synchronized (this) {
if (processor != null) {
processor.stop();
processor.close();
processor = null;
rtptransmitter.close();
rtptransmitter = null;
}
}
}

private String createProcessor() {
if (locator == null)
return "Locator is null";

DataSource ds;
DataSource clone;

try {
ds = Manager.createDataSource(locator);
} catch (Exception e) {
return "Couldn't create DataSource";
}


try {
processor = Manager.createProcessor(ds);
} catch (NoProcessorException npe) {
return "Couldn't create processor";
} catch (IOException ioe) {
return "IOException creating processor";
}


boolean result = waitForState(processor, Processor.Configured);
if (result == false)
return "Couldn't configure processor";


TrackControl [] tracks = processor.getTrackControls();

if (tracks == null || tracks.length < 1) return "Couldn't find tracks in processor"; boolean programmed = false;
for (int i = 0; i < tracks.length; i++) {
Format format = tracks[i].getFormat();
if ( tracks[i].isEnabled() && format instanceof VideoFormat && !programmed) { Dimension size = ((VideoFormat)format).getSize();
float frameRate = ((VideoFormat)format).getFrameRate();
int w = (size.width % 8 == 0 ? size.width : (int)(size.width / 8) * 8);
int h = (size.height % 8 == 0 ? size.height : (int)(size.height / 8) * 8);
VideoFormat jpegFormat = new VideoFormat(VideoFormat.JPEG_RTP, new Dimension(w, h), Format.NOT_SPECIFIED, Format.byteArray, frameRate);
tracks[i].setFormat(jpegFormat); System.err.println("Video transmitted as:"); System.err.println(" " + jpegFormat); programmed = true; } else tracks[i].setEnabled(false); } if (!programmed) return "Couldn't find video track";
ContentDescriptor cd = new ContentDescriptor(ContentDescriptor.RAW_RTP);
processor.setContentDescriptor(cd); result = waitForState(processor, Controller.Realized); if (result == false) return "Couldn't realize processor";
setJPEGQuality(processor, 0.5f); dataOutput = processor.getDataOutput(); return null; } private String createTransmitter() { // rtp://129.130.131.132:42050/video String rtpURL = "rtp://" + ipAddress + ":" + port + "/video"; MediaLocator outputLocator = new MediaLocator(rtpURL); try { rtptransmitter = Manager.createDataSink(dataOutput, outputLocator); rtptransmitter.open();
rtptransmitter.start(); dataOutput.start(); } catch (MediaException me) { return "Couldn't create RTP data sink"; } catch (IOException ioe) { return "Couldn't create RTP data sink"; } return null; } void setJPEGQuality(Player p, float val) { Control cs[] = p.getControls(); QualityControl qc = null; VideoFormat jpegFmt = new VideoFormat(VideoFormat.JPEG); for (int i = 0; i < owner =" ((Owned)cs[i]).getOwner();" j =" 0;" qc =" (QualityControl)cs[i];" statelock =" new" failed =" false;" failed =" true;" failed =" false;" state ="="" state ="=""> ");
System.exit(-1);
}*/
ml = args[0];
String url1 = args[1];
String port1 = args[2];
VideoTransmit vt = new VideoTransmit(ml, url1, port1);

String result = vt.start();
if (result != null) {
System.err.println("Error : " + result);
System.exit(0);
}

System.err.println("Start transmission for 60 seconds...");

try {
Thread.currentThread().sleep(60000);
} catch (InterruptedException ie) {
}


vt.stop();

System.err.println("...transmission ended.");

System.exit(0);
}
}


Instructin:

For run: java media_location IPaddress Port
JMF download: SUN

Hardware Requirements

* 166 MHz Pentium, 160 MHz PowerPC, or 166 MHz UltraSparc
* 32 MB RAM or greater
* Optional: An appropriate sound card for audio play back, if necessary. For example, a SoundBlaster-compatible card for Windows machines without built-in audio support, or an Ultimedia sound card for AIX machines without built-in audio support.

Installation Instructions

1. Download the version of JMF you want to install by selecting a download format and and clicking the continue button.

The downloaded file is an executable. For Windows, it's an InstallShield executable; for Solaris, it's a self-extracting shell script; otherwise it's a generic zip file.

2. If you are installing the JMF Performance Pack for Windows

* Run the executable by double-clicking on the
jmf-2_1_1e-windows-i586.exe

NOTE: The Windows installation program automatically detects whether or not Netscape Communicator 4.03 or later is installed and then installs JMF for its use! If you are using Netscape Communicator 4.04 or 4.05, then you must install the JDK 1.1 patch for Netscape Communicator before you can run any JMF applets. Netscape Communicator 4.06 or greater already supports JDK 1.1 without the patch.

If you are installing the JMF Performance Pack for Solaris SPARC

* Change directories to the install location.
* Run the command % /bin/sh ./jmf-2_1_1e-solaris-sparc.bin

If you are installing the JMF Performance Pack for Linux

* Change directories to the install location.
* Run the command % /bin/sh ./jmf-2_1_1e-linux-i586.bin

If you are installing a zip file

* Run the appropriate zip command for your system, e.g. winzip or unzip to extract JMF onto your system.

3. IMPORTANT: You must finish setting up JMF by following the setup instructions included in the JMF Implementation Documentation. You can download the documentation package separately or view it online. ----->


Monday, March 03, 2008

What Is NetBeans IDE

History:

NetBeans began in 1997 as Xelfi, a student project under the guidance of the Faculty of Mathematics and Physics at Charles University in Prague. A company was later formed around the project and produced commercial versions of the NetBeans IDE until it was bought by Sun Microsystems in 1999. Sun open-sourced the NetBeans IDE in June of the following year.


NetBeans 6.0.1NetBeans 6 version support for developing IDE modules and rich client application. The New GIU Builder, Subversion Support, JBoss support, CVS support and many more features included.