如果找到了对您有用的资料,烦请点击右手边的Google广告支持我继续共享知识,谢谢! http://dengpeng.spaces.live.com/

2008年5月31日星期六

Learning from Data Streams

Learning from Data Streams
Processing Techniques in Sensor Networks
Gama, Joao; Gaber, Mohamed Medhat (Eds.)
2007, X, 244 p. 73 illus., Hardcover
ISBN: 978-3-540-73678-3

 

Sensor networks consist of distributed autonomous devices that cooperatively monitor an environment. Sensors are equipped with capacities to store information in memory, process this information and communicate with their neighbors. Processing data streams generated from wireless sensor networks has raised new research challenges over the last few years due to the huge numbers of data streams to be managed continuously and at a very high rate.

The book provides the reader with a comprehensive overview of stream data processing, including famous prototype implementations like the Nile system and the TinyOS operating system. The set of chapters covers the state-of-art in data stream mining approaches using clustering, predictive learning, and tensor analysis techniques, and applying them to applications in security, the natural sciences, and education.

This research monograph delivers to researchers and graduate students the state of the art in data stream processing in sensor networks. The huge bibliography offers an excellent starting point for further reading and future research.

 

Written for:
Researchers and libraries
Keywords:

    * Data Stream Processing
    * Predictive Learning
    * Sensor Data
    * Sensor Networks
    * Tensor Analysis
    * TinyOS

http://www.mediafire.com/?4meme1vtxjc

Hello jtwitter!

A easy to use Java interace to Twitter API. http://thinktankmaths.com/java-twitter/

Very simple:

1. Add this component jar to your project library

2. invoke it by following code:

Twitter t = new Twitter("your_username", "your_password");
t.updateStatus("This message will be submitted to twitter!");


3. Done


I have created a Netbeans Java project to show the demo. Please download it from http://www.mediafire.com/?msh4dotngd9

2008年5月29日星期四

Comparing Mobile Platforms: Java ME and Adobe Flash Lite

http://blogs.sun.com/mobility_techtips/entry/comparing_mobile_platforms_java_me

By Bruce Hopkins

If you’re a mobile developer, you may have noticed that more devices these days are supporting Adobe Flash Lite. According to the latest figures, approximately 300 million devices in the market support some form of the Flash Lite specification. Of course that’s nothing compared to the 1.2 billion (yes, that’s with a “b”) Java ME devices that are currently available, but I thought that it would be worthwhile to see the strengths and weaknesses of each platform side by side. In the tables that follow, I’ll compare the latest and greatest specifications for both platforms in the following categories:

Graphics
Multimedia
Local Device Accessibility
Security
Network Connectivity
Miscellaneous

Our first category for comparison is graphics. As you can see in the table below, the Flash Lite 3 platform supports all the standard rasterized graphic formats and supports FLA (Flash format) and SVG formats for vector graphics. In my opinion, FLA is a superior vector graphics format compared to SVG, and the tools required to create sophisticated applications are easier (and more widely available) to use for FLA compared to SVG. So, the Flash Lite 3 platform is a worthy competitor in the graphics department for mobile applications, and it is easy to see why many Flash Lite applications are games. One downside, however, is that Flash Lite 3 has no support for 3D graphics.

Graphics

When it comes to multimedia (the playback of various formats and codecs of audio and video). The Flash Lite 3 platform is a clear winner. It not only supports the Flash 8 video specification but also Sorensen video, which is an industry standard for compressed video. Both platforms support streaming audio and video, which is crucial when your mobile device needs to communicate with a media server.

Multimedia

How do the two platforms compare when you want to gain access to local resources on the mobile device? As you can see in the table below, the Java ME MSA specification gives the developer an unprecedented amount of access to local resources such as the GPS radio, camera, and microphone.

This may be a little known fact: both platforms support the capability to initiate a request to the handset to dial a phone number. However, since the Java ME MSA platform can also read phonebook entries on the local device, it’s more suited for creating powerful business applications. Note that there are Java ME and Flash Lite implementations that do have access to sensor data from accelerometers, but such functionality is not a part of the Java ME MSA spec or Flash Lite 3.

Accessibility

In the security realm, both platforms support HTTPS, so you can use either platform to securely communicate with a SSL-enabled web server. However, applications that use the Java ME MSA platform can also use digital certificates for secure identification. MSA devices have the added ability to use various encryption algorithms to secure data at rest (that is, on the filesystem).

Security

Which platform provides more options for connectivity when your mobile application needs to communicate with external resources? The following table gives you a good idea of what you can expect when you create a mobile application that needs to communicate to a networked or local device. As you can see, both platforms support the capability for mobile applications to initiate requests using raw TCP sockets or with the HTTP protocol. However, mobile devices that support the Java ME MSA standard have the additional capability to act as servers, and wait for incoming requests on various protocols on both TCP and UDP transports. This allows the mobile device to communicate in a peer-to-peer mode without the necessity of server-to-proxy requests between them. If you’re in server mode, your application doesn’t even need to be running in order to receive its data. The PushRegistry allows Java ME application to “wake up” upon an incoming network request.

Mobile devices that adhere to the Java ME MSA standard also have the ability to use the local serial and infrared ports on the mobile device.

Connectivity

The following capabilities really didn’t fit in any of the categories discussed earlier in this article. For those of you who have never developed Flash Lite applications, you may be surprised to learn that it supports floating point math, XML parsing, and even TCP/IP networking without necessitating the use of a threading framework for its developers.

Miscellany

Conclusion

Each platform has its own strengths and weaknesses when it comes to mobile application development. Flash Lite-enabled devices are really good at displaying graphics and multimedia, which lends itself to several gaming applications. On the other hand, devices that support the Java ME MSA platform are the obvious choice when you need to communicate with Bluetooth devices, use location based services, capture audio/video, render 3D graphics, or perform any form of asynchronous communication.

I’m really glad to see that one of the Java ME licensees, Sony Ericsson, has made significant progress on bridging the gap between both platforms with its Capuchin technology, which was announced in late April: "...a Java ME API that defines a bridge between the Java ME and Adobe Flash Lite programming environments. This API makes it possible to use Flash Lite as the front end and Java ME as the back end of applications, meaning that Flash tools can be used for UI design while still having access to all the phone services available to Java ME." Both platforms have made significant advances from their initial 1.0 versions. I can’t wait to see what’s on the horizon for both platforms as the standards evolve.

2008年5月21日星期三

2008年5月20日星期二

Just gimme a second to put words in your SQL statement

Digest from http://blogs.msdn.com/coding4fun/archive/2008/05/19/8510470.aspx

Do you have your application hooked up to a database?  Do you do stuff like

string sql = "SELECT * FROM Products"+"Where Id " + userInput;


Well, if I was mean (I'm not), I could do some naughty things that would be called a SQL Injection Attack.  Imagine if I did sent in "1; Drop Table Product;" as a end user.



Well, fear not, there are a few super easy ways to prevent this type of attack.



Colin Mackay has an article that explains in more detail on the SQL injection attack and multiple ways to prevent it.



A few quick ways are to use SQL parameters and to validate your data instead of blindly trusting your end user.  Here is an example of a parameterized query.



string commandText = "SELECT * FROM Customers "+"WHERE Country=@CountryName";
SqlCommand cmd = new SqlCommand(commandText, conn);
cmd.Parameters.Add("@CountryName",countryName);


Remember, Johnny Drop Table, can cause some trouble.

2008年5月16日星期五

7.9 Magnitude Earthquake Hit Sichuan Province China

Earthquake in Sichuan China

Earthquake in Sichuan China

I am crying...

I donated 500 RMB. Hope this money can help them.

2008年5月8日星期四

Livescribe Smartpen

The Past and Future of Pen and Paper
From prehistoric cave walls and charcoal to the modern notebook and fountain pen, the human need for spontaneous self-expression through drawing and writing has endured. People have actively used writing tools and paper, in one form or another, for thousands of years.
The use of pen and paper endures, despite its inherent lack of digital connectivity, because it is incredibly well-suited to the unstructured, spontaneous, flexible nature of our lives and work styles. It gives people contextual cues and perspective, supports collaboration in live groups, and in many settings, allows for very easy navigation, reference and comparison of information.
Still, paper and pen usage presents serious limitations in an increasingly digital world. Paper documents are static and difficult to share broadly. Written notes are susceptible to loss and damage. They suffer an inherent lack of connectivity; despite how rich the content on a piece of paper is, it is physically bound and limited. What’s missing is a way to maximize the freedom of expression and rich context afforded by pen and paper while delivering the connectivity, archiving system and “capture” capability of a computer.
Livescribe Chief Executive Officer Jim Marggraff introduces a new solution to this age-old problem and a long-term vision on how paper-based computing will advance the next chapter in mobile computing. Livescribe’s intelligent writing system includes an innovative smartpen and dot paper that together bring traditional paper to life. By developing a paper-based platform, Livescribe will fundamentally change the way people capture, use and share information with pen and paper, making the possibilities of pen and paper endless. With Livescribe, people will no longer have to settle – they can have the best of both the paper and digital worlds.

 

http://www.livescribe.com/smartpen/techspecs.html

Sentilla wireless sensors

About Sentilla
Sentilla is about making the real-world -- and everything in it -- smarter, with software for tiny computers that can be put anywhere or attached to anything. Called pervasive computing, this technology is applied in wide-ranging industries such as logistics, transportation, security, health care, agriculture and green technology. Founded in 2003, Sentilla Corporation uses our unique Java-based software platform for pervasive computing to create solutions that address real-world business problems. To Sentilla, "The World is the Computer", and our mission is to use our software platform to help make that world a better place.

Sentilla Software Platform Overview
Pervasive computing — small, wireless computers that interact with the physical world and with each other — represents a new era of computing technology that makes objects smarter and more responsive to people and businesses alike. Yet despite the widespread promise of this technology to address problems large and small, solutions have been very difficult to create — until now.
With Sentilla, true pervasive computing applications are now possible thanks to the familiarity of Javatm technology. This familiar, standard approach allows companies to develop, deploy, integrate and manage compete solutions to real-world business problems.

Sentilla Software Architecture
Sentilla's software platform architecture is designed to allow a complete solution to be developed specifically for your real-world business need. This overview shows how all of the pieces of the Sentilla platform work together to form a complete solution.
Sentilla Work is an Integrated Development Environment that simplifies programming for pervasive computers. Adapted from the popular Eclipse program, Sentilla Work provides a single environment for the development, debugging, installation and testing of solutions.
Sentilla Point is the software platform that operates on pervasive-class computers. Sentilla Point contains the operating system, virtual machine and system libraries that allow the devices to effectively manage power, form mesh networks, and run programs, and includes Application Frameworks that allow developers to easily create applications to solve problems in the real-world.
Sentilla SOA is a host server that allows the pervasive computers in your network to connect to your enterprise infrastructure. This service-oriented architecture approach allows companies to effectively integrate and manage a pervasive-computing based solution using well-known and standard interfaces.

http://blog.sentilla.com/

2008年5月6日星期二

Multi-Listeners in Java

package events;

/*
* Swing version
*/

import javax.swing.*;

import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import java.awt.Insets;
import java.awt.Dimension;
import java.awt.Color;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class MultiListener extends JPanel
implements ActionListener {

JTextArea topTextArea;
JTextArea bottomTextArea;
JButton button1, button2;
final static String newline = "\n";

public MultiListener() {
super(new GridBagLayout());
GridBagLayout gridbag = (GridBagLayout) getLayout();
GridBagConstraints c = new GridBagConstraints();

JLabel l = null;

c.fill = GridBagConstraints.BOTH;
c.gridwidth = GridBagConstraints.REMAINDER;
l = new JLabel("What MultiListener hears:");
gridbag.setConstraints(l, c);
add(l);

c.weighty = 1.0;
topTextArea = new JTextArea();
topTextArea.setEditable(false);
JScrollPane topScrollPane = new JScrollPane(topTextArea);
Dimension preferredSize = new Dimension(200, 75);
topScrollPane.setPreferredSize(preferredSize);
gridbag.setConstraints(topScrollPane, c);
add(topScrollPane);

c.weightx = 0.0;
c.weighty = 0.0;
l = new JLabel("What Eavesdropper hears:");
gridbag.setConstraints(l, c);
add(l);

c.weighty = 1.0;
bottomTextArea = new JTextArea();
bottomTextArea.setEditable(false);
JScrollPane bottomScrollPane = new JScrollPane(bottomTextArea);
bottomScrollPane.setPreferredSize(preferredSize);
gridbag.setConstraints(bottomScrollPane, c);
add(bottomScrollPane);

c.weightx = 1.0;
c.weighty = 0.0;
c.gridwidth = 1;
c.insets = new Insets(10, 10, 0, 10);
button1 = new JButton("Blah blah blah");
gridbag.setConstraints(button1, c);
add(button1);

c.gridwidth = GridBagConstraints.REMAINDER;
button2 = new JButton("You don't say!");
gridbag.setConstraints(button2, c);
add(button2);

button1.addActionListener(this);
button2.addActionListener(this);

button2.addActionListener(new Eavesdropper(bottomTextArea));

setPreferredSize(new Dimension(450, 450));
setBorder(BorderFactory.createCompoundBorder(
BorderFactory.createMatteBorder(
1, 1, 2, 2, Color.black),
BorderFactory.createEmptyBorder(5, 5, 5, 5)));
}

public void actionPerformed(ActionEvent e) {
topTextArea.append(e.getActionCommand() + newline);
topTextArea.setCaretPosition(topTextArea.getDocument().getLength());
}

/**
* Create the GUI and show it. For thread safety,
* this method should be invoked from the
* event-dispatching thread.
*/

private static void createAndShowGUI() {
//Create and set up the window.
JFrame frame = new JFrame("MultiListener");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

//Create and set up the content pane.
JComponent newContentPane = new MultiListener();
newContentPane.setOpaque(true); //content panes must be opaque

frame.setContentPane(newContentPane);

//Display the window.
frame.pack();
frame.setVisible(true);
}

public static void main(String[] args) {
//Schedule a job for the event-dispatching thread:
//creating and showing this application's GUI.
javax.swing.SwingUtilities.invokeLater(new Runnable() {

public void run() {
createAndShowGUI();
}
});
}
}

class Eavesdropper implements ActionListener {

JTextArea myTextArea;

public Eavesdropper(JTextArea ta) {
myTextArea = ta;
}

public void actionPerformed(ActionEvent e) {
myTextArea.append(e.getActionCommand() + MultiListener.newline);
myTextArea.setCaretPosition(myTextArea.getDocument().getLength());
}
}


 



http://java.sun.com/docs/books/tutorial/uiswing/examples/events/MultiListenerProject/src/events/MultiListener.java

Java DB: Embedded Database in JDK6

JRE6 introduces a new feature: JavaDB. You can directly use this DB in both within desktop application or network application like we normally did using MySQL.

I am particulaly interested in the embedded DB. Here below is a simple demo showing how it works:

1. Create project in Netbeans;

2. Add two JAR files to project library (JavaDB SDK can be downloaded from http://db.apache.org/derby/derby_downloads.html)

  • derby.jar: contains the Derby engine and the Derby Embedded JDBC driver
  • derbytools.jar: optional, provides the ij tool that is used by a couple of sections in this tutorial

 3. Compose your source code:

package hellojavadb;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Properties;

public class helloJavaDB {

public static void main(String[] args) {
try { // load the driver

Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance();
System.out.println("Load the embedded driver");
Connection conn = null;
Properties props = new Properties();
props.put("user", "user1");
props.put("password", "user1");
//create and connect the database named helloDB
conn = DriverManager.getConnection("jdbc:derby:helloDB;create=true", props);
System.out.println("create and connect to helloDB");
conn.setAutoCommit(false);

// create a table and insert two records
Statement s = conn.createStatement();
s.execute("create table hellotable(name varchar(40), score int)");
System.out.println("Created table hellotable");
s.execute("insert into hellotable values('Ruth Cao', 86)");
s.execute("insert into hellotable values ('Flora Shi', 92)");
// list the two records
ResultSet rs = s.executeQuery(
"SELECT name, score FROM hellotable ORDER BY score");
System.out.println("name\t\tscore");
while (rs.next()) {
StringBuilder builder = new StringBuilder(rs.getString(1));
builder.append("\t");
builder.append(rs.getInt(2));
System.out.println(builder.toString());
}
// delete the table
s.execute("drop table hellotable");
System.out.println("Dropped table hellotable");

rs.close();
s.close();
System.out.println("Closed result set and statement");
conn.commit();
conn.close();
System.out.println("Committed transaction and closed connection");

try { // perform a clean shutdown

DriverManager.getConnection("jdbc:derby:;shutdown=true");
} catch (SQLException se) {
System.out.println("Database shut down normally");
}
} catch (Throwable e) {
// handle the exception
e.printStackTrace();
}
System.out.println("SimpleApp finished");
}
}


4. Execute the application. You should see the print out:



Load the embedded driver
create and connect to helloDB
Created table hellotable
name score
Ruth Cao 86
Flora Shi 92
Dropped table hellotable
Closed result set and statement
Committed transaction and closed connection
Database shut down normally
SimpleApp finished


This tutorial is modified from http://www.ibm.com/developerworks/cn/java/j-lo-jse65/

2008年5月5日星期一

Implements Serializable() in J2ME

Serializable is avaliable in J2SE and J2EE only.

However, you can do it manually. To do that you just need to write each value individually into a radiogram or a byte stream...

radiogram.reset();
radiogram.writeInt(1000); // integer
radiogram.writeUTF("hello"); // string


then when you get the radiogram or stream on the host decode it in the exact same order



int number = radiogram.readInt(); // integer
String text = radiogram.readUTF(); // string


so if you have an object that you wnat to serialise you could just add a method to encode to radiogram, and likewsie decode...


2008年5月4日星期日