Javascript Inheritance Notes
var mymaps = new ExtMyMapsControl();
function markerControl(){
var me = this;
me.a = "ere";
}
markerControl.prototype = new ExtMyMapsControl();
markerControl.prototype.constructor = markerControl;
markerControl.prototype.initialize = function(map){
var me = this;
me.container = mymaps.initialize.call(this,map);
me.container.id = "yeah!";
return me.container;
}
var mc = new markerControl();
mymaps.options.controlPosition = "changed";
console.log(map);
console.log(mymaps.initialize(map));
console.log(mc.initialize(map));
Sunday, July 20, 2008
Friday, July 11, 2008
Oracle DB Build For Spring's Petclinic Sample
DROP TABLE visits;
DROP TABLE pets;
DROP TABLE owners;
DROP TABLE types;
DROP TABLE vet_specialties;
DROP TABLE specialties;
DROP TABLE vets;
CREATE TABLE vets (
"id" INTEGER NOT NULL,
first_name VARCHAR(30),
last_name VARCHAR(30),
constraint "PK_ID" primary key ("id")
);
CREATE INDEX vets_last_name ON vets(last_name);
CREATE TABLE specialties (
"id" INTEGER NOT NULL ,
name VARCHAR(80),
constraint "PK_SPECIALTIES_ID" primary key ("id")
);
CREATE INDEX specialties_name ON specialties(name);
CREATE TABLE vet_specialties (
vet_id INTEGER NOT NULL,
specialty_id INTEGER NOT NULL
);
alter table vet_specialties add constraint fk_vet_specialties_vets foreign key (vet_id) references vets("id");
alter table vet_specialties add constraint fk_vet_specialties_specialties foreign key (specialty_id) references specialties("id");
CREATE TABLE types (
"id" INTEGER NOT NULL,
name VARCHAR(80),
constraint "PK_TYPES_ID" primary key ("id")
);
CREATE INDEX types_name ON types(name);
CREATE TABLE owners (
"id" INTEGER NOT NULL,
first_name VARCHAR(30),
last_name VARCHAR(30),
address VARCHAR(255),
city VARCHAR(80),
telephone VARCHAR(20),
constraint "PK_OWNERS_ID" primary key ("id")
);
CREATE INDEX owners_last_name ON owners(last_name);
CREATE TABLE pets (
"id" INTEGER NOT NULL,
name VARCHAR(30),
birth_date DATE,
type_id INTEGER NOT NULL,
owner_id INTEGER NOT NULL,
constraint "PK_PETS_ID" primary key ("id")
);
alter table pets add constraint fk_pets_owners foreign key (owner_id) references owners("id");
alter table pets add constraint fk_pets_types foreign key (type_id) references types("id");
CREATE INDEX pets_name ON pets(name);
CREATE TABLE visits (
"id" INTEGER NOT NULL,
pet_id INTEGER NOT NULL,
visit_date DATE,
description VARCHAR(255),
constraint "PK_VISITS_ID" primary key ("id")
);
alter table visits add constraint fk_visits_pets foreign key (pet_id) references pets("id");
CREATE INDEX visits_pet_id ON visits(pet_id);
/**
* Populate
*/
INSERT INTO vets VALUES (1, 'James', 'Carter');
INSERT INTO vets VALUES (2, 'Helen', 'Leary');
INSERT INTO vets VALUES (3, 'Linda', 'Douglas');
INSERT INTO vets VALUES (4, 'Rafael', 'Ortega');
INSERT INTO vets VALUES (5, 'Henry', 'Stevens');
INSERT INTO vets VALUES (6, 'Sharon', 'Jenkins');
INSERT INTO specialties VALUES (1, 'radiology');
INSERT INTO specialties VALUES (2, 'surgery');
INSERT INTO specialties VALUES (3, 'dentistry');
INSERT INTO vet_specialties VALUES (2, 1);
INSERT INTO vet_specialties VALUES (3, 2);
INSERT INTO vet_specialties VALUES (3, 3);
INSERT INTO vet_specialties VALUES (4, 2);
INSERT INTO vet_specialties VALUES (5, 1);
INSERT INTO types VALUES (1, 'cat');
INSERT INTO types VALUES (2, 'dog');
INSERT INTO types VALUES (3, 'lizard');
INSERT INTO types VALUES (4, 'snake');
INSERT INTO types VALUES (5, 'bird');
INSERT INTO types VALUES (6, 'hamster');
INSERT INTO owners VALUES (1, 'George', 'Franklin', '110 W. Liberty St.', 'Madison', '6085551023');
INSERT INTO owners VALUES (2, 'Betty', 'Davis', '638 Cardinal Ave.', 'Sun Prairie', '6085551749');
INSERT INTO owners VALUES (3, 'Eduardo', 'Rodriquez', '2693 Commerce St.', 'McFarland', '6085558763');
INSERT INTO owners VALUES (4, 'Harold', 'Davis', '563 Friendly St.', 'Windsor', '6085553198');
INSERT INTO owners VALUES (5, 'Peter', 'McTavish', '2387 S. Fair Way', 'Madison', '6085552765');
INSERT INTO owners VALUES (6, 'Jean', 'Coleman', '105 N. Lake St.', 'Monona', '6085552654');
INSERT INTO owners VALUES (7, 'Jeff', 'Black', '1450 Oak Blvd.', 'Monona', '6085555387');
INSERT INTO owners VALUES (8, 'Maria', 'Escobito', '345 Maple St.', 'Madison', '6085557683');
INSERT INTO owners VALUES (9, 'David', 'Schroeder', '2749 Blackhawk Trail', 'Madison', '6085559435');
INSERT INTO owners VALUES (10, 'Carlos', 'Estaban', '2335 Independence La.', 'Waunakee', '6085555487');
INSERT INTO pets VALUES (1, 'Leo', to_date('2000-09-07','yyyy-mm-dd'), 1, 1);
INSERT INTO pets VALUES (2, 'Basil', to_date('2002-08-06','yyyy-mm-dd'), 6, 2);
INSERT INTO pets VALUES (3, 'Rosy', to_date('2001-04-17','yyyy-mm-dd'), 2, 3);
INSERT INTO pets VALUES (4, 'Jewel', to_date('2000-03-07','yyyy-mm-dd'), 2, 3);
INSERT INTO pets VALUES (5, 'Iggy', to_date('2000-11-30','yyyy-mm-dd'), 3, 4);
INSERT INTO pets VALUES (6, 'George', to_date('2000-01-20','yyyy-mm-dd'), 4, 5);
INSERT INTO pets VALUES (7, 'Samantha', to_date('1995-09-04','yyyy-mm-dd'), 1, 6);
INSERT INTO pets VALUES (8, 'Max', to_date('1995-09-04','yyyy-mm-dd'), 1, 6);
INSERT INTO pets VALUES (9, 'Lucky', to_date('1999-08-06','yyyy-mm-dd'), 5, 7);
INSERT INTO pets VALUES (10, 'Mulligan', to_date('1997-02-24','yyyy-mm-dd'), 2, 8);
INSERT INTO pets VALUES (11, 'Freddy', to_date('2000-03-09','yyyy-mm-dd'), 5, 9);
INSERT INTO pets VALUES (12, 'Lucky', to_date('2000-06-24','yyyy-mm-dd'), 2, 10);
INSERT INTO pets VALUES (13, 'Sly', to_date('2002-06-08','yyyy-mm-dd'), 1, 10);
INSERT INTO visits VALUES (1, 7, to_date('1996-03-04','yyyy-mm-dd'), 'rabies shot');
INSERT INTO visits VALUES (2, 8, to_date('1996-03-04','yyyy-mm-dd'), 'rabies shot');
INSERT INTO visits VALUES (3, 8, to_date('1996-06-04','yyyy-mm-dd'), 'neutered');
INSERT INTO visits VALUES (4, 7, to_date('1996-09-04','yyyy-mm-dd'), 'spayed');
DROP TABLE visits;
DROP TABLE pets;
DROP TABLE owners;
DROP TABLE types;
DROP TABLE vet_specialties;
DROP TABLE specialties;
DROP TABLE vets;
CREATE TABLE vets (
"id" INTEGER NOT NULL,
first_name VARCHAR(30),
last_name VARCHAR(30),
constraint "PK_ID" primary key ("id")
);
CREATE INDEX vets_last_name ON vets(last_name);
CREATE TABLE specialties (
"id" INTEGER NOT NULL ,
name VARCHAR(80),
constraint "PK_SPECIALTIES_ID" primary key ("id")
);
CREATE INDEX specialties_name ON specialties(name);
CREATE TABLE vet_specialties (
vet_id INTEGER NOT NULL,
specialty_id INTEGER NOT NULL
);
alter table vet_specialties add constraint fk_vet_specialties_vets foreign key (vet_id) references vets("id");
alter table vet_specialties add constraint fk_vet_specialties_specialties foreign key (specialty_id) references specialties("id");
CREATE TABLE types (
"id" INTEGER NOT NULL,
name VARCHAR(80),
constraint "PK_TYPES_ID" primary key ("id")
);
CREATE INDEX types_name ON types(name);
CREATE TABLE owners (
"id" INTEGER NOT NULL,
first_name VARCHAR(30),
last_name VARCHAR(30),
address VARCHAR(255),
city VARCHAR(80),
telephone VARCHAR(20),
constraint "PK_OWNERS_ID" primary key ("id")
);
CREATE INDEX owners_last_name ON owners(last_name);
CREATE TABLE pets (
"id" INTEGER NOT NULL,
name VARCHAR(30),
birth_date DATE,
type_id INTEGER NOT NULL,
owner_id INTEGER NOT NULL,
constraint "PK_PETS_ID" primary key ("id")
);
alter table pets add constraint fk_pets_owners foreign key (owner_id) references owners("id");
alter table pets add constraint fk_pets_types foreign key (type_id) references types("id");
CREATE INDEX pets_name ON pets(name);
CREATE TABLE visits (
"id" INTEGER NOT NULL,
pet_id INTEGER NOT NULL,
visit_date DATE,
description VARCHAR(255),
constraint "PK_VISITS_ID" primary key ("id")
);
alter table visits add constraint fk_visits_pets foreign key (pet_id) references pets("id");
CREATE INDEX visits_pet_id ON visits(pet_id);
/**
* Populate
*/
INSERT INTO vets VALUES (1, 'James', 'Carter');
INSERT INTO vets VALUES (2, 'Helen', 'Leary');
INSERT INTO vets VALUES (3, 'Linda', 'Douglas');
INSERT INTO vets VALUES (4, 'Rafael', 'Ortega');
INSERT INTO vets VALUES (5, 'Henry', 'Stevens');
INSERT INTO vets VALUES (6, 'Sharon', 'Jenkins');
INSERT INTO specialties VALUES (1, 'radiology');
INSERT INTO specialties VALUES (2, 'surgery');
INSERT INTO specialties VALUES (3, 'dentistry');
INSERT INTO vet_specialties VALUES (2, 1);
INSERT INTO vet_specialties VALUES (3, 2);
INSERT INTO vet_specialties VALUES (3, 3);
INSERT INTO vet_specialties VALUES (4, 2);
INSERT INTO vet_specialties VALUES (5, 1);
INSERT INTO types VALUES (1, 'cat');
INSERT INTO types VALUES (2, 'dog');
INSERT INTO types VALUES (3, 'lizard');
INSERT INTO types VALUES (4, 'snake');
INSERT INTO types VALUES (5, 'bird');
INSERT INTO types VALUES (6, 'hamster');
INSERT INTO owners VALUES (1, 'George', 'Franklin', '110 W. Liberty St.', 'Madison', '6085551023');
INSERT INTO owners VALUES (2, 'Betty', 'Davis', '638 Cardinal Ave.', 'Sun Prairie', '6085551749');
INSERT INTO owners VALUES (3, 'Eduardo', 'Rodriquez', '2693 Commerce St.', 'McFarland', '6085558763');
INSERT INTO owners VALUES (4, 'Harold', 'Davis', '563 Friendly St.', 'Windsor', '6085553198');
INSERT INTO owners VALUES (5, 'Peter', 'McTavish', '2387 S. Fair Way', 'Madison', '6085552765');
INSERT INTO owners VALUES (6, 'Jean', 'Coleman', '105 N. Lake St.', 'Monona', '6085552654');
INSERT INTO owners VALUES (7, 'Jeff', 'Black', '1450 Oak Blvd.', 'Monona', '6085555387');
INSERT INTO owners VALUES (8, 'Maria', 'Escobito', '345 Maple St.', 'Madison', '6085557683');
INSERT INTO owners VALUES (9, 'David', 'Schroeder', '2749 Blackhawk Trail', 'Madison', '6085559435');
INSERT INTO owners VALUES (10, 'Carlos', 'Estaban', '2335 Independence La.', 'Waunakee', '6085555487');
INSERT INTO pets VALUES (1, 'Leo', to_date('2000-09-07','yyyy-mm-dd'), 1, 1);
INSERT INTO pets VALUES (2, 'Basil', to_date('2002-08-06','yyyy-mm-dd'), 6, 2);
INSERT INTO pets VALUES (3, 'Rosy', to_date('2001-04-17','yyyy-mm-dd'), 2, 3);
INSERT INTO pets VALUES (4, 'Jewel', to_date('2000-03-07','yyyy-mm-dd'), 2, 3);
INSERT INTO pets VALUES (5, 'Iggy', to_date('2000-11-30','yyyy-mm-dd'), 3, 4);
INSERT INTO pets VALUES (6, 'George', to_date('2000-01-20','yyyy-mm-dd'), 4, 5);
INSERT INTO pets VALUES (7, 'Samantha', to_date('1995-09-04','yyyy-mm-dd'), 1, 6);
INSERT INTO pets VALUES (8, 'Max', to_date('1995-09-04','yyyy-mm-dd'), 1, 6);
INSERT INTO pets VALUES (9, 'Lucky', to_date('1999-08-06','yyyy-mm-dd'), 5, 7);
INSERT INTO pets VALUES (10, 'Mulligan', to_date('1997-02-24','yyyy-mm-dd'), 2, 8);
INSERT INTO pets VALUES (11, 'Freddy', to_date('2000-03-09','yyyy-mm-dd'), 5, 9);
INSERT INTO pets VALUES (12, 'Lucky', to_date('2000-06-24','yyyy-mm-dd'), 2, 10);
INSERT INTO pets VALUES (13, 'Sly', to_date('2002-06-08','yyyy-mm-dd'), 1, 10);
INSERT INTO visits VALUES (1, 7, to_date('1996-03-04','yyyy-mm-dd'), 'rabies shot');
INSERT INTO visits VALUES (2, 8, to_date('1996-03-04','yyyy-mm-dd'), 'rabies shot');
INSERT INTO visits VALUES (3, 8, to_date('1996-06-04','yyyy-mm-dd'), 'neutered');
INSERT INTO visits VALUES (4, 7, to_date('1996-09-04','yyyy-mm-dd'), 'spayed');
Monday, May 26, 2008
Wednesday, May 07, 2008
Wednesday, April 30, 2008
Saturday, April 26, 2008
Wednesday, April 23, 2008
Monday, April 21, 2008
Friday, March 28, 2008
Google Chart API: Extended encoding function for Javascript !
couldnt find a javascript implementation for extended encoding for google chart api, so here it is. if the function looks a little strange to you, check out this article about memoizing
http://osteele.com/archives/2006/04/javascript-memoization
also, thanks to
http://www.felipebarone.com/node/52
for putting this out there for php!
couldnt find a javascript implementation for extended encoding for google chart api, so here it is. if the function looks a little strange to you, check out this article about memoizing
http://osteele.com/archives/2006/04/javascript-memoization
also, thanks to
http://www.felipebarone.com/node/52
for putting this out there for php!
BaseMap.prototype.extendedEncoding = function(valueArray){
var MAX = 4095, MIN = 0, delta = MAX - MIN;
var extendedString = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-.';
var stringLength = extendedString.length;
var encoded = function(valueArray){
var chartdata = 'e:';
for(var i=0;i= MIN && i <= MAX){
var calc1 = Math.round((valueArray[i] - MIN) / stringLength * MAX / delta);
var calc2 = ((valueArray[i] - MIN) % stringLength) * MAX / delta;
var first = extendedString.substring(calc1,calc1+1);
var second = extendedString.substring(calc2,calc2+1);
chartdata += first + second;
}else {
chardata += '__'; // Value out of max range;
}
}
return chartdata;
}
this.extendedEncoding = function(valueArray){return encoded(valueArray);}
return encoded;
}
Monday, March 17, 2008
Configuring Tomcat for Rational Application Developer and Websphere
Wouldn't it be nice to have your websphere projects run in tomcat as well, so that for those people who aren't lucky enough to have a RAD installation could easily and quickly run your projects? YES!!!
Unfortunately, its not completely straightforward how to do this, so, lest I forget, I'm keep track of the various changes here.
1. installing tomcat
-the main thing here is that added a tomcat server to RAD doesnt seem to work, unless you switch up the jre. see this thread-
http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=56&t=006084&p=1
2. Also, you wont be able to have a single dynamic web project target multiple runtimes if you have the websphere facets enabled.
That's all i've run into so far, hopefully this will save you some time!!
3. ugh, so far being the operative word. ok, i've found that the administration console for tomcat does not correctly configure jdbc references. looking here
http://tomcat.apache.org/tomcat-5.5-doc/jndi-resources-howto.html
it appears that you have to manually add a similar looking data source reference to the context.xml in conf.
4. ok, now, with projects working normally in tomcat, how about with tomcat running in rad? does it work? NOOOO!!!, ugh, apparently there is some issue with the difference in servlet mapping, this article describes it well
http://faq.javaranch.com/view?InvokerServlet
un-commenting the two section (def and mapping) for the invoker servlet i know how servlet mapping working for a spring project in RAD running on tomcat.
5. but can spring find the jdbc mapping..... NO!! of course not. oy, im getting the same error
that i got before using just tomcat, before i added the additional context reference
Cannot create JDBC driver of class '' for connect URL 'null'
6. Finally, the last piece of the puzzle
http://www.experts-exchange.com/Software/Server_Software/Application_Servers/Java/Apache_Tomcat/Q_22849258.html
some obscure eclipse setting, and who knew, META-INF actually does something...oh wait... wrong again!! ahhhhhhhhhhhhhhhhhhhhhh
7. finally. ok, using that setting in eclipse just gets around eclipse looking for a datasource cause its running right out of the tomcat. the final peice did end up being the context.xml file in the meta-inf AND!!! adding the oracle jars to the lib. that did it. whew. finally.
Wouldn't it be nice to have your websphere projects run in tomcat as well, so that for those people who aren't lucky enough to have a RAD installation could easily and quickly run your projects? YES!!!
Unfortunately, its not completely straightforward how to do this, so, lest I forget, I'm keep track of the various changes here.
1. installing tomcat
-the main thing here is that added a tomcat server to RAD doesnt seem to work, unless you switch up the jre. see this thread-
http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=56&t=006084&p=1
2. Also, you wont be able to have a single dynamic web project target multiple runtimes if you have the websphere facets enabled.
That's all i've run into so far, hopefully this will save you some time!!
3. ugh, so far being the operative word. ok, i've found that the administration console for tomcat does not correctly configure jdbc references. looking here
http://tomcat.apache.org/tomcat-5.5-doc/jndi-resources-howto.html
it appears that you have to manually add a similar looking data source reference to the context.xml in conf.
4. ok, now, with projects working normally in tomcat, how about with tomcat running in rad? does it work? NOOOO!!!, ugh, apparently there is some issue with the difference in servlet mapping, this article describes it well
http://faq.javaranch.com/view?InvokerServlet
un-commenting the two section (def and mapping) for the invoker servlet i know how servlet mapping working for a spring project in RAD running on tomcat.
5. but can spring find the jdbc mapping..... NO!! of course not. oy, im getting the same error
that i got before using just tomcat, before i added the additional context reference
Cannot create JDBC driver of class '' for connect URL 'null'
6. Finally, the last piece of the puzzle
http://www.experts-exchange.com/Software/Server_Software/Application_Servers/Java/Apache_Tomcat/Q_22849258.html
some obscure eclipse setting, and who knew, META-INF actually does something...oh wait... wrong again!! ahhhhhhhhhhhhhhhhhhhhhh
7. finally. ok, using that setting in eclipse just gets around eclipse looking for a datasource cause its running right out of the tomcat. the final peice did end up being the context.xml file in the meta-inf AND!!! adding the oracle jars to the lib. that did it. whew. finally.
Wednesday, January 09, 2008
Subscribe to:
Posts (Atom)