Donnerstag, 25. Februar 2010

单件模式(Singleton Pattern)

三要素:对自身的引用,私有构造器,static getInstance()方法。

http://www.jdon.com/designpatterns/singleton.htm

Donnerstag, 30. April 2009

How to change SGA size


In sqlplus, execute

ALTER SYSTEM SET sga_max_size = 4G SCOPE=spfile
shutdown immediate
startup

This is only for starting Oracle with spfile. If you execute
ALTER SYSTEM SET sga_max_size = 4G SCOPE=memory or
ALTER SYSTEM SET sga_max_size = 4G SCOPE=both

you will get
ORA-02095: specified initialization parameter cannot be modifie.

If oracle is automatic shared memory management (ASSM) mode, also execute
ALTER SYSTEM SET sga_target = 4G

Dienstag, 25. November 2008

Remove/unload java object in Oracle database

drop java class "package.Class";

to remove all java objects, use:

$ORACLE_HOME/javavm/install/rmjvm.sql

Donnerstag, 20. November 2008

Linux X11 security problem

Today I ran a script under linux and got such error:
Xlib: connection to ":0.0" refused by server

X11 security: the user that tries to open a window
is an other one than the one that is logged-in (even root cannot access
this). Start by removing X11 security with `xhost +`.


The solution is to execute xhost + under root user. After that, a message was displayed "access control disabled, clients can connect from any host".

Freitag, 25. Juli 2008

VC++ Includeverzeichniss Makros

Using macros to configure projects.

Eigenschaft -> C/C++ -> Allgemein -> Zusaetzliche Includeverzeichniss -> Makros>>

Oracle Coordinate System Transformation Functions

-- how to extract srids
SELECT *
FROM mdsys.cs_srs cs
WHERE cs.cs_name LIKE '%UTM%'
AND cs.cs_name LIKE '%32%';

-- how to make a spatial point (WGS84)
SELECT mdsys.sdo_geometry(2001, 8307, mdsys.sdo_point_type(n.x, n.y, NULL), NULL, NULL) AS geometry
FROM nodes n;

-- how to make a converted spatial point (UTM Zone 32, Northern Hemisphere (WGS 84))
SELECT t.geometry.sdo_point.x as x, t.geometry.sdo_point.y as y FROM (SELECT sdo_cs.transform(mdsys.sdo_geometry(2001, 8307, mdsys.sdo_point_type(n.x, n.y, NULL), NULL, NULL), 82344) AS geometry FROM nodes n) t;

82344 is SRID for UTM Zone 32, Northern Hemisphere (WGS 84).

Donnerstag, 24. Juli 2008

Polymorphism

// abstract base class
#include
using namespace std;

class CPolygon {
protected:
int width, height;
public:
void set_values (int a, int b)
{ width=a; height=b; }
virtual int area (void) =0;
};

class CRectangle: public CPolygon {
public:
int area (void)
{ return (width * height); }
};

class CTriangle: public CPolygon {
public:
int area (void)
{ return (width * height / 2); }
};

int main () {
CRectangle rect;
CTriangle trgl;
CPolygon * ppoly1 = ▭
CPolygon * ppoly2 = &trgl;
ppoly1->set_values (4,5);
ppoly2->set_values (4,5);
ppoly1->area();
ppoly2->area();
return 0;
}