this Method means prevent event from tag's basic event.I can show you sample belowA href's basic function removed<!DOCTYPE html><html><head><script src="http://code.jquery.com/jquery-1.9.1.js"></script></head><body><a href="http://jquery.com">default click action is prevented</a><div id="log"></div><script>$("a").click(function(event) {event.preventDefault();$('<div/>').append('default ' + event.type + ' prevented').appendTo('#log');});</script></body></html>
Sunday, March 31, 2013
event.preventDefault(); in javascript
Wednesday, March 27, 2013
make sequences in mysql
create table mysql_sequences(
seq_name varchar(10) not null,
seq_currval Bigint unsigned not null,
primary key (seq_name)
)engine=MyISAM;
DELIMITER ;;
CREATE FUNCTION nextval()
returns bigint unsigned
modifies sql data
sql security invoker
begin
insert into mysql_sequences
set seq_name='default', seq_currval=(@v_current_value:=1)
on duplicate key
update seq_currval=(@v_current_value:=seq_currval+1);
return @v_current_value;
end ;;
Tuesday, March 26, 2013
Create Scheduler in Mysql
Repeactable Scheduler
CREATE EVENT daily_ranking
on SCHEDULE EVERY 1 DAY STARTS '2011-05-16 01:00:00' ENDS '2013-04-01 12:59:59'
DO
INSERT INTO SCHEDULER_TEST VALUES (NOW(), 'DONE');
every day on 01:00:00 doing insert in period
Only one time Scheduler
CREATE EVENT daily_ranking
on SCHEDULE at CURRENT_TIMESTAMP + INTERVAL 1 HOUR
DO
INSERT INTO SCHEDULER_TEST VALUES (NOW(), 'DONE');
blow line is test and Query
CREATE EVENT daily_ranking
on SCHEDULE EVERY 1 DAY STARTS '2011-05-16 01:00:00' ENDS '2013-04-01 12:59:59'
DO
INSERT INTO SCHEDULER_TEST VALUES (NOW(), 'DONE');
CREATE EVENT daily_ranking_AT4
on SCHEDULE at CURRENT_TIMESTAMP + INTERVAL 1 MINUTE
DO
INSERT INTO SCHEDULER_TEST VALUES (NOW(), 'Test2');
SELECT * FROM INFORMATION_SCHEMA.EVENTS;
SELECT * FROM SCHEDULER_TEST;
SELECT NOW();
SELECT db, name, interval_value, interval_field, status, on_completion, time_zone, execute_at, starts, ends, last_executed, created, modified
from mysql.event;
SELECT event_schema, event_name, interval_value, interval_field, status, on_completion, time_zone, execute_at, starts, ends, last_executed, created, last_altered
from information_schema.events;
show global variables like '%sche%';
set global event_scheduler = 1 ;
process kill in mysql
kill only query from thread
mysql>kill query 1000;
kill query with thread
mysql> kill 1000;
mysql>kill query 1000;
kill query with thread
mysql> kill 1000;
Phonegap file uploader in android
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>File Transfer Example</title>
<script type="text/javascript" charset="utf-8" src="cordova-2.5.0.js"></script>
<script type="text/javascript" charset="utf-8">
// Wait for PhoneGap to load
//
// document.addEventListener("deviceready", onDeviceReady, false);
function imageObject(){
var options,
fileEntry,
ft,
imageURI
};
imageObject.prototype = {
// 기본 셋팅
initUpload : function(imageURI){
console.log("initUpload");
image.options = new FileUploadOptions();
window.resolveLocalFileSystemURI(imageURI, image.onSuccessFile, image.onFailFile);
image.imageURI = imageURI;
image.options.fileKey="file";
image.options.fileName=image.fileEntry.name;
image.options.mimeType="image/jpeg";
image.ft = new FileTransfer();
},
// 파일전송
send : function(){
image.ft.upload(image.imageURI, "http://203.233.82.229/non/test/file.json", win, fail, image.options);
},
onSuccessFile : function(f){
console.log("getFile");
image.fileEntry = f;
alert(f.name);
},
onFailFile : function(f){
}
}
var image = new imageObject();
// PhoneGap is ready
//
function readImageFile() {
// Retrieve image file location from specified source
navigator.camera.getPicture(image.initUpload,
function(message) { alert('get picture failed'); },
{ quality: 50,
destinationType: navigator.camera.DestinationType.FILE_URI,
sourceType: navigator.camera.PictureSourceType.PHOTOLIBRARY,
mediaType: Camera.MediaType.ALLMEDIA }
);
};
function win(r) {
console.log("Code = " + r.responseCode);
console.log("Response = " + r.response);
console.log("Sent = " + r.bytesSent);
alert("status : " + JSON.parse(r.response).status);
}
function fail(error) {
alert("An error has occurred: Code = " = error.code);
}
</script>
</head>
<body>
<h1>Example</h1>
<p>With PhoneGap API</p>
<button onclick="readImageFile()">Open Image</button>
<button onclick="image.send()">Send To Server</button>
<br>
<br>
<p>With Original Form</p>
<form method='POST' enctype='multipart/form-data' action='http://203.233.82.229/non/test/file.json'>
File to upload: <input type="file" name="file"><br>
Notes about the file: <input type="text" name="note"><br>
<br>
<input type="submit" value="Press"> to upload the file!
</form>
</body>
</html>
Sunday, March 24, 2013
Thursday, March 21, 2013
FullText in mysql
Engine = myisam
index = fulltext key fx_article (acolumn, bcolumn)
ex)
select doc_id doc_title, doc_body
from ft_article where match(doc_title, doc_body) against('list' in boolean mode);
ft_min_word_len : minimum length of searching word
ft_stopword_file : engine consider it not word, Skip
ft_max_word_len : maximum length of searching word
in Natural Language Mode
ex) searching by word
select doc_id, doc_title, doc_body
from ft_article
where match(doc_title, doc_body) against('hash key' in natural language mode);
in Boolean Mode
+ : AND
-: Not
nothing : OR
index = fulltext key fx_article (acolumn, bcolumn)
ex)
select doc_id doc_title, doc_body
from ft_article where match(doc_title, doc_body) against('list' in boolean mode);
ft_min_word_len : minimum length of searching word
ft_stopword_file : engine consider it not word, Skip
ft_max_word_len : maximum length of searching word
in Natural Language Mode
ex) searching by word
select doc_id, doc_title, doc_body
from ft_article
where match(doc_title, doc_body) against('hash key' in natural language mode);
in Boolean Mode
+ : AND
-: Not
nothing : OR
Subscribe to:
Posts (Atom)