Wednesday, October 8, 2008

ON DUPLICATE KEY UPDATE

INSERT ON DUPLICATE KEY UPDATE - MySQL Performance Blog
http://www.mysqlperformanceblog.com/2006/05/29/insert-on-duplicate-key-update-and-summary-counters/

example:
      CREATE TABLE ipstat(ip int UNSIGNED NOT NULL PRIMARY KEY,
                                hits int UNSIGNED NOT NULL,
                                last_hit timestamp);
      INSERT INTO ipstat VALUES(inet_aton('192.168.0.1'),1,now())
                             ON duplicate KEY UPDATE hits=hits+1;
info: If there is no such IP address in the table it will be added with hits=1 if it is already where (note ip is PRIMARY KEY) it would be just incremented and last visit timestamp updated.

performance boost: 30% speedup should be typical.

more: This example actually shows one more neat feature of MySQL - inet_aton  and inet_ntoa functions which can convert IP address strings to integers and back. This allows to save on field length significantly by using 4 bytes instead of 15

INSERT ON DUPLICATE Syntax
http://dev.mysql.com/doc/refman/5.0/en/insert-on-duplicate.html

Saturday, October 4, 2008

Clustering, Display multiple categories, subcategories using PHP/mysql-html-js, INSERT IGNORE, SWFObject

How to display infinite depth expandable categories using php and javascript.
http://codeassembly.com/How-to-display-infinite-depth-expandable-categories-using-php-and-javascript/

MySQLi vs MySQL (benchmarks)
http://www.johnjawed.com/benchmarks/

How to delete table name with special character
http://halisway.blogspot.com/2008/02/how-to-delete-object-with-special.html

a-r-t: MySQL - query to ingnore duplicate insertion (where there's a unique key field)
INSERT IGNORE INTO
more:


MySQl 5.0 Reference Manual 12.2.5 INSERT Syntax
http://dev.mysql.com/doc/refman/5.0/en/insert.html

info: If you use the IGNORE keyword, errors that occur while executing the INSERT statement are treated as warnings instead. For example, without IGNORE, a row that duplicates an existing UNIQUE index or PRIMARY KEY value in the table causes a duplicate-key error and the statement is aborted. With IGNORE, the row still is not inserted, but no error is issued.

more: You can use REPLACE instead of INSERT to overwrite old rows. REPLACE is the counterpart to INSERT IGNORE in the treatment ofnew rows that contain unique key values that duplicate old rows: The new rows are used to replace the old rows rather than being discarded

How to do an "insert ignore" in Oracle
http://halisway.blogspot.com/2007/04/how-to-do-insert-ignore-in-oracle.html

php: in_array() - Checks if a value exists in an array
http://us.php.net/in_array

Writing SQL queries in XMl - A support intensive approach
http://www.codeproject.com/KB/database/SQLInXML.aspx?df=100&forumid=203933&exp=0&select=1181052&tid=1180595

php: tutorial: Email System
http://www.tutorialized.com/tutorials/PHP/Email-Systems/1

php: tutorial: Mailing list management
http://www.tutorialized.com/tutorials/PHP/Mailing-List-Management/1

Building your own Myspace.com with PHP Part 1
http://www.upgradetheweb.com/2007/07/31/building-your-own-myspacecom-with-phppart-i-introduction/

good: Creating a simple PHP forum tutorial
http://www.phpeasystep.com/workshopview.php?id=12

Discussion board tutorials
http://www.chipmunk-scripts.com/board/index.php?forumID=43&ID=9268

SourceCodeOnline - Python - Discussion Boards - Free Source Code and Scripts Downloads
http://www.sourcecodeonline.com/sources/python/discussion_boards.html

Scriptmob - World's Biggest Script Resource
http://www.scriptmob.com/PHP/Tips_and_Tutorials/Discussion_Boards/

good: webmonkey tutorials
http://www.webmonkey.com/codelibrary/

Vanilla Discussion Forum documentation
http://lussumo.com/docs/doku.php

PHPbb3 Documentation
http://area51.phpbb.com/docs/code/

Stackless Python - an enchanced version of Python programming language . (Beneifts of thread based programming without the complexitiy problems associated with conventional threads.)
http://zope.stackless.com/

Microwulf: A personal, portable beowulf Cluster
http://www.calvin.edu/~adams/research/microwulf/

[ closed as of March 1, 2008. ] openMosix - An Open Source Linux Cluster Project
http://openmosix.sourceforge.net/

Building your first cluster
http://ask.slashdot.org/article.pl?sid=06/07/27/001201

Rocks Cluster
http://www.rocksclusters.org/wordpress/

SWFObject v2.0 HTML and Javascript Generator
http://www.swffix.org/swfobject/generator/

SWFObject Documentation - Embedding Adobe Flash Player Content using SWFObject
http://code.google.com/p/swfobject/wiki/documentation