之所以要记录它,是因为为了这个手机,我跑了4次南京路。。。
膘叔的简单人生
之所以要记录它,是因为为了这个手机,我跑了4次南京路。。。
就在wwdc 2013的前夜。osx升级了。。10.8.4就这样提示我安装了。
The OS X Mountain Lion v10.8.4 Update is recommended for all OS X Mountain Lion users and includes new features and fixes.
Updating your system
You can also download the manual update installer. This is a useful option when you need to update multiple computers but only want to download the update once. These versions of the standalone installers are available from Apple Support Downloads.
About the update
The OS X Mountain Lion v10.8.4 Update is recommended for all OS X Mountain Lion users and includes features and fixes that improve the stability, compatibility, and security of your Mac, including the following:
For detailed information about the security content of this update, see Apple security updates.
好吧,反正闲着也是闲着,而且说不定也没资格升级到10.9,我还是就这么随便先升到10.8.4吧。
在用一个jQuery插件的时候,突然报错:b.browser undefined。。。
最初的时候想想不太可能啊?browser的判断不是从1.2.1的时候就一直就有了吗?于是搜索了一下jquery.mini.js,搜索browser,居然找不到。。。。
然后去官网看了一下,看到官方居然有这么一段:
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script><script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
居然建议我们加载migrate,打开这个文件搜索browser。。果然找到了。
于是在项目里加入这一行,不报错的。做个记录。(不就7K嘛。干嘛不放进去,真是的。。)
说实话,我还是挺喜欢这个标签选择器的,但是评论里说了,除了chrome外,其他浏览器几乎都不支持。因此,我就很纠结了。。
;(function(){
$.fn.extend({
iSelectTags:function(options){
var iset={
name:'.tagsbox',//表单或class或id名
drop:$('#dropbox'),//弹出框定位
pseudoClass:$('#dropbox>p>a'),//可选择的标签定位
close:$('em.close'),//关闭按钮定位
separator:',',//标签间分隔符,建议使用英文逗号
maxCount:10 //默认限制个数,也可以设置表单的data-count值覆盖默认值
}
options=$.extend(iset, options || {});
var _input=$(iset.name);
var _inputVal=_input.val();
var _arr=new Array(); //存放标签的数组
var _left=_input.offset().left; //左绝对距离
var _top=_input.offset().top+_input.outerHeight(); //上绝对距离,此处要加上表单的高度
var _dropW=_input.outerWidth()-parseInt(_input.css('border-left-width'))-parseInt(_input.css('border-right-width'))-parseInt(iset.drop.css('paddingLeft'))-parseInt(iset.drop.css('paddingRight'));
iset.drop.css({'position':'absolute','left':_left+'px','top':_top+'px','width':_dropW+'px'});
//弹出框的宽度,此处计算的是与表单实际宽度相等的.也可以直接在样式中定义.
var _txt=null;
var _maxCount=parseInt(_input.attr('data-count'));//限制选择个数
if(isNaN(_maxCount)){
_maxCount=iset.maxCount
}
_input.click(function(){
iset.drop.show();
iset.drop.bgiframe();//调用bgiframe插件,解决ie6下select的z-index无限大问题
}).bind('keyup change',function(){
//可以在此处扩展手动输入标签情况下的相关判断
//if语句可避免清空重新选择时第一个字符为逗号
if ($(this).val() == '') {
_arr = new Array();
}else {
_arr = $(this).val().split(iset.separator);//当用户手动删除或修改标签值后更新标签值
}
});
$(document).click(function(e){
//点击非弹出框区域时关闭弹出框
//下面的 if语句是用来判断传入的是class还是id
if(iset.name.charAt(0)=='#'){
if(e.target.id!=iset.name.substring(1)){
iset.drop.hide();
}
}else if(iset.name.charAt(0)=='.'){
if(e.target.className!=iset.name.substring(1)){
iset.drop.hide();
}
}
});
iset.drop.click(function(e){
//阻止弹出框区域默认事件
e.stopPropagation();
});
iset.pseudoClass.click(function(){
//标签选择
_txt=$(this).text();
//下面的$.inArray是用来判断是否重复
//若想反馈重复提示或走出限制个数提示,可改进下面的if语句
if(($.inArray(_txt,_arr)==-1) && (_arr.length<_maxCount )){
_arr.push(_txt);
_inputVal=_arr.join(iset.separator);
_input.val(_inputVal);
}
});
//关闭按钮
iset.close.click(function(){
iset.drop.hide();
});
}
});
})(jQuery);
说实话,关于存储过程的博客还真的不多,有几个是值得看一下的
1、官方;http://dev.mysql.com/doc/refman/5.1/zh/stored-procedures.html
2、http://www.netingcn.com/tag/%E5%AD%98%E5%82%A8%E8%BF%87%E7%A8%8B
3、http://blog.why100000.com/?p=711
也发现,如果不做复杂查询,存储过程对我来说几乎没有,本来是想解决查找GEO相关的信息的,但发现这样的SQL:
SELECT userid,lat,lng,gender,
( 6371 * acos( cos( radians(31.000700) ) * cos( radians( lat ) ) * cos( radians( lng ) - radians(120.000099) ) + sin( radians(31.000700) ) * sin( radians( lat ) ) ) ) AS distance
FROM `user_geo` WHERE last_activity_time > '2013-03-11 00:00:00'
ORDER BY distance ASC limit 100
这其中的复杂度就在于distance每次都要计算,所以我尝试换成了存储过程:
DROP PROCEDURE IF EXISTS search_around_user;
DELIMITER //
CREATE PROCEDURE search_around_user
(
s_lat float(10,6),
s_lng float(10,6),
s_last_act datetime,
s_gender tinyint,
s_number tinyint,
s_page tinyint
)
LABEL_PROC:
BEGIN
if s_number <= 1 then
set s_number = 20;
end if;
if s_page <= 0 then
set s_page = 0;
end if;
if s_gender <= 0 then
set @genderQuery = "";
else
set @genderQuery = concat(" and gender = " , s_gender , " ");
end if;
set @limitQuery = concat("LIMIT " , s_page * s_number , " , " , s_number , " ");
set @strsql = CONCAT("select userid, ",
"( 6371 * acos( cos( radians(",s_lat,") ) * cos( radians( lat ) ) * cos( radians( lng ) - radians( ",s_lng," ) ) ",
"+ sin( radians( ",s_lat," ) ) * sin( radians( lat ) ) ) ) AS distance ",
" FROM user_geo where last_activity_time >= '", s_last_act , "' " , @genderQuery , " ORDER BY distance " , @limitQuery) ;
prepare stmtsql from @strsql;
execute stmtsql;
END LABEL_PROC;
//
DELIMITER ;
然后再次调用:
call search_around_user(31.000700,120.000099,'2013-03-11 00:00:00',0,20,0)
所耗费的时间和上述直接写SQL的时间是几乎一样的。想来,这也是因为distance的计算不能被优化而导致的。。。于是乎,放弃用存储过程
继昨天的处理之后,又来新的笔记 ,这次的笔记纯粹是个人的测试,与实际条件有关,比如,我要查询的字段不超过varchar的255的长度,所以我才这么做。
昨天做普通索引后,1100万条记录,索引 为220M,改成全文索引后,索引文件为1.1G,存储空间上,涨了5倍左右。
以下是笔记 ,请不要笑话,场景不同而已
北京游时的小吃:
某天的早饭,骨头汤馄饨,包子是按两卖的,不是按个的。豆腐脑(好奇怪,与南方的完全不一样)



石头带我去的特色,说是豆汁相对比较正宗,认为我喝不下,结果我喝大半碗,觉得还OK。小吃是大杂烩,每样买了点,正好是吃了上述的早饭,然后实在撑不下了。不过我还是吃了好多




吃的特色馄饨店的馄饨。。(盘子上有字:馄饨候)


说这个是玫瑰酥?我一看就觉得是月饼嘛。。上海这种N种花样的月饼太多了,吃了一个,好吧,不太习惯吃这种月饼,上海的月饼我也只吃肉的,比如老大坊的鲜肉月饼,黑黑
这是一篇未完成的博客,在这里面做了一点记录
早上锅巴在群里发了个链接(http://www.php.net/conferences/)。一看,大为震惊,这真是很难得的事情:
ThinkInLAMP is pleased to announce the first Shanghai PHP conference 2013. This event will be held on Sunday June 30th 2013 in Shanghai, China. A community oriented conference which is organized by an excellent line up and socials.
This event will concentrate on PHP languages and web based technologies used today; extension, latest dynamics and new applications within the increased demand for developers and everyone who is interested in PHP language.
There will be more than 500 developers owned over 3 year’s experiences andsenior technical persons come for learning and networking. Register soon as the Early Bird discount rate expires on May 30.
Go to http://php.thinkinlamp.com/2013 for more information, we are looking forward to seeing you in June!
看到这个,你还有什么好犹豫的?赶紧拿起手中的电话,拨打thinkinlamp的参与热线吧
这是一篇文档的简要介绍,本来没有想过要提的,因为我以前真没用过straight join,看到这个名词其实是老王的一句话,他说,利用这个优化了SQL,于是就看了一下。果然发到了这句话:
STRAIGHT_JOIN 实际上与内连接 INNER JOIN 表现完全一致,不同的是使用了 STRAIGHT_JOIN 后,table1 会先于 table2 载入。
提示
MySQL 在执行 INNER JOIN 的时候,会根据自己内部的优化规则来决定先载入 table1 还是 table2,如果您确认 MySQL 载入表的顺序并不是最优化的时候,就可以使用 STRAIGHT_JOIN 以替代 INNER JOIN。
我参考的这页,说是关于mysql 的join有五篇:
本章节内容共分 5 部分: