Thursday, July 31, 2008

Oracle Spatial Documentation Oracle Spatial 10g Release 2

Oracle Spatial Documentation

Oracle Spatial 10g Release 2 (10.2)
B14255-01 HTML PDF Oracle Spatial User's Guide and Reference
B14254-01 HTML PDF Oracle Spatial GeoRaster
B14256-01 HTML PDF Oracle Spatial Topology and Network Data Models
B14373-01 HTML
Oracle Spatial Java API Reference
Oracle Spatial 10g Release 1 (10.1)
B10826-01 HTML PDF Oracle Spatial User's Guide and Reference
B10827-01 HTML PDF Oracle Spatial GeoRaster
B10828-01 HTML PDF Oracle Spatial Topology and Network Data Models
Oracle Spatial 9.2 Documentation
A96630-01 HTML PDF Oracle Spatial User's Guide and Reference
Oracle Spatial 9.0.1 Documentation
A88805-01 HTML PDF Oracle Spatial User's Guide and Reference
Oracle Spatial 8.1.7 Documentation
A85337-01 HTML PDF Oracle8i Release 3 (8.1.7) Documentation (The Oracle Spatial 8.1.7 User's Guide includes documentation of Coordinate Systems, Linear Referencing, and R-tree Indexing-all of which are production features in 8.1.7.)
Oracle Spatial 8.1.5 & 8.1.6 Documentation
A67295-01 HTML PDF Oracle Spatial User's Guide and Reference
A67298-01 HTML PDF Locator User's Guide

Wednesday, July 30, 2008

AngelikaLanger.com - Java Generics FAQs - Type Parameters - Angelika Langer Training/Consulting

AngelikaLanger.com - Java Generics FAQs - Type Parameters - Angelika Langer Training/Consulting: "Can I create an object whose type is a type parameter?
No, because the compiler does not know how to create objects of an unknown type.
Each object creation is accompied by a constructor call. When we try to create an object whose type is a type parameter then we need an accessible constructor of the unknown type that the type parameter is a place holder for. However, there is no way to make sure that the actual type arguments have the required constructors.

Example (illegal generic object creation):

public final class Pair< A , B > {
public final A fst;
public final B snd;

public Pair() {
this.fst = new A() ; // error
this.snd = new B() ; // error
}
public Pair(A fst, B snd) {
this.fst = fst;
this.snd = snd;
}
}

In the example above, we are trying to invoke the no-argument constructors of two unknown types represented by the type parameters A and B . It is not known whether the actual type arguments will have an accessible no-argument constructor."

Java OO


public abstract class Shape {
public abstract void draw(Canvas c);
}
public class Circle extends Shape {
private int x, y, radius;
public void draw(Canvas c) { ... }
}
public class Rectangle extends Shape {
private int x, y, width, height;
public void draw(Canvas c) { ... }
}

Any drawing will typically contain a number of shapes. Assuming that they are
represented as a list, it would be convenient to have a method in Canvas that draws
them all:

public void drawAll(List shapes) {
for (Shape s: shapes) {
s.draw(this);
}
}

Now, the type rules say that drawAll() can only be called on lists of exactly Shape:
it cannot, for instance, be called on a List. That is unfortunate, since all
the method does is read shapes from the list, so it could just as well be called on a
List. What we really want is for the method to accept a list of any kind of
shape:


public void drawAll(List shapes) { ... }


There is a small but very important difference here: we have replaced the type
List with List. Now drawAll() will accept lists of
any subclass of Shape, so we can now call it on a List if we want.

Generics in the Java Programming Language

generics-tutorial.pdf

Java 6.0 也有類似 C++ 的 template 了
叫做 Generics

JGeometry (Oracle Spatial Java API Reference)

oracle.spatial.geometry
Class JGeometry

/// reading a geometry from database
     ResultSet rs = statement.executeQuery("SELECT geometry FROM states where name='Florida'");
STRUCT st = (oracle.sql.STRUCT) rs.getObject(1);
//convert STRUCT into geometry
JGeometry j_geom = JGeometry.load(st);

// ... manipulate the geometry or create a new JGeometry ...

/// writing a geometry back to database
PreparedStatement ps = connection.prepareStatement("UPDATE states set geometry=? where name='Florida'");
//convert JGeometry instance to DB STRUCT
STRUCT obj = JGeometry.store(j_geom, connection);
ps.setObject(1, obj);
ps.execute();

Tuesday, July 29, 2008

Java: Images - BufferedImage

Java: Images - BufferedImage:

To create a BufferedImage

import java.awt.image.*;
. . .
class Painting extends JPanel {
. . .
BufferedImage grid; // declare the image
. . .
public void paintComponent(Graphics g) {
super.paintComponent(g); // paint background
Graphics2D g2 = (Graphics2D)g; // we need a Graphics2D context

if (grid == null) {
// Compute the grid only one time
int w = this.getWidth();
int h = this.getHeight();
grid = (BufferedImage)(this.createImage(w,h));
Graphics2D gc = grid.createGraphics();
for (int x=0; x<w; x+=10) {gc.drawLine(x, 0, x, h);}
for (int y=0; y<h; y+=10) {gc.drawLine(0, y, w, y);}
}
// Draw the grid from the precomputed image
g2.drawImage(grid, null, 0, 0);
. . . // draw remaining, dynamic, image

The Java Swing tutorial

The Java Swing tutorial

Good Java Swing tutorial

Friday, July 18, 2008

Amazon.com: Numerical Optimization: Jorge Nocedal, Stephen Wright: Books

Amazon.com: Numerical Optimization: Jorge Nocedal, Stephen Wright: Books
Numerical Optimization
另一本推薦

Numerical Recipes in C

Numerical Recipes in C
Numerical Recipes book
這本書的好處是以工程的角度來介紹 linear algebra
後面還有附code 第一版可以免費線上閱讀
學長說: "啥! 你還不知道這本書喔?"
看來是一本必讀經典書
趕緊來看看囉

Third edition