Friday, September 3, 2010
Monday, January 25, 2010
SQL Best Practise
Isolating indexed field
//Bad Idea.
Where TO_DAYS(order_created) - TO_DAYS(CURRENT_DATE())>= 7
//Better Idea. CURRENT_DATE() not working for query cache
Where order_created >= CURRENT_DATE() - INTERVAL 7 DAY
//Best Idea
Where order_created >= '11/11/2009' - INTERVAL 7 DAY
Using calculated field
//Bad idea
WHERE email_address LIKE '%.com';
//Better idea
ALTER TABLE CUSTOMERS
ADD COLUMN rv_email_address VARCHAR(80) NOT NULL;
UPDATE customers SET rv_email_address = REVERSE(email_address);
CREATE INDEX ix_rv_email ON customer (rv_email_address(20));
DELIMITER ;;
CREATE TRIGGER trg_bi_cust BEFORE INSERT ON customers
FOR EACH ROW BEGIN
SET NEW.rv_email_address=REVERSE(NEW.email_address);
END;;
//same trigger for BEFORE UPDATE...
//Then SELECT on the new field...
WHERE r_email_address LIKE CONCAT(REVERSE('.com'),'%');
Saturday, January 2, 2010
J2ME HttpConnection issue
J2ME HttpConnection issue when testing with Digi telco and Sony Ericsson W810i
I am wondering why Lwuit-Makeover is able to connect but my own application can not. Then i found out that my application need to run in Internet setting but Lwuit-Makeover just need WAP setting.
If request connection setting from telco, they will send you the following setting.
Lwuit-Makeover
My own application
Reference
Avoid Connection Problems with Your Java Applications
I am wondering why Lwuit-Makeover is able to connect but my own application can not. Then i found out that my application need to run in Internet setting but Lwuit-Makeover just need WAP setting.
If request connection setting from telco, they will send you the following setting.
- Digi Streaming
- Digi Internet
- Digi MMS
- Digi WAP
Lwuit-Makeover
- "Setting for java" can be WAP setting.
- Internally this application use com.sun.me.web.request api and Get method to make connection.
My own application
- "Setting for java" does not work with WAP setting. It need internet setting.
- I use (HttpConnection) Connector.open("http://.."); and writebyte method to make connection.
Reference
Avoid Connection Problems with Your Java Applications
Subscribe to:
Posts (Atom)