Archive for January, 2010
Spam Mail
Posted by jeruliu in Google Map on January 29, 2010
这三天依然效率低下,拦路虎是开源框架中的插件,本来 Cakephp 也算是两大主流框架之一, 就算有问题基本还是能找到答案的,坏就坏在它内置了 Prototype 而不是 jQuery 才引发一系列的麻烦。 基本上我就是在费力的把各种乱七八糟的 plugin, fix, add-on 都揉的一块去,在高度定制化的情况下可想而知会有很多不兼容的问题。而一旦出现问题就比较难解决了,因为这些插件相对来说比较偏门,Mister Google 也无能为力了。
今天算是把主体功能很粗糙的都实现了,接下去就做细化工作,还尝试了一下 Firebug,真是 Firefox 下的神兵利器, 可以洞悉一切。
20 / 80 principle
Posted by jeruliu in Google Map on January 25, 2010
为了从这种繁重的体力活中解脱出来,又找到了 Firefox 有个插件叫 Firebug, Debug 这些乱七八糟的东西很有帮助。
Prototype to JQuery
Posted by jeruliu in Google Map on January 24, 2010
Cakephp 中也正是整合了 Prototype 来做 AJAX Helper. 结果不小心就惹出大麻烦,花了一整天时间才发现 Prototype 和 JQuery 有严重冲突,不可同时使用,偏偏这次在 IE 下到没有问题, 只有 Firefox say no.
浪费了很多时间,还好发现了一个 JQuery 版本的 AJAX Helper for Cakephp, 可以实现无缝转移,唯一的差别就是不能更新多个 DIV, but who cares?
开发都是业余时间做做,可是现在游泳健身打球都占用了我大部分的业余时间,进度很成问题了。
Static Map API
Posted by jeruliu in Google Map on January 21, 2010
The following example contains the URL of a static map image of downtown New
York City, which is displayed below:
# You can copy the URL from the image below, however.
# For clarity, we don't write the actual API key in use.
#
http://maps.google.com/maps/api/staticmap?center=Brooklyn+Bridge,New+York,NY&zoom=14&size=512x512
&maptype=roadmap&markers=color:blue|label:S|40.702147,-74.015794
&markers=color:green|label:G|40.711614,-74.012318
&markers=color:red|color:red|label:C|40.718217,-73.998284&sensor=false&key=MAPS_API_KEY
Query Limit: 1000 unique (different) image requests
per viewer per day (not per key).
If a user exceeds the limit as proscribed above, the following image will be displayed indicating
that the quota has been exceeded:
Resizing Google Map InfoWindow (Speech Bubble)
Posted by jeruliu in Google Map on January 20, 2010
The
code examples included here have been simplified somewhat as my working
system had complexities specific to the application that would not
exist normally.
To resize the infoWindow just call the resizeInfoWindow function and pass in the Id to the element that contains the content.
// Get the current open infowindow from the map
var infoWindow = map.getInfoWindow();
// Get the point this infowindow belongs to
var point = infoWindow.getPoint();
// Get the size of the content block so to make the info window the correct size to hold it
var contentBlock = document.getElementById(contentElementId);
var width = contentBlock.getElementWidth();
var height = contentBlock.getElementHeight();
infoWindow.reset(point, null, new GSize(width,height));
}
Object.prototype.getElementWidth = function() {
if (typeof this.clip !== "undefined") {
return this.clip.width;
} else {
if (this.style.pixelWidth) {
return this.style.pixelWidth;
} else {
return this.offsetWidth;
}
}
}
Object.prototype.getElementHeight = function() {
if (typeof this.clip !== "undefined") {
return this.clip.height;
} else {
if (this.style.pixelHeight) {
return this.style.pixelHeight;
} else {
return this.offsetHeight;
}
}
}
翻墙二三技
1. 镜像大法 (It works like a charm)
有的苦主有好几个分身,斩杀了一个还有几个后来人,比如我最爱上的 Google Group, 主站被封,但是可以上其他国家镜像啊,内容是一样的,只是标签变成了德文,法文。。。看不懂? 可以猜啊,很简单。所以只要把 groups.google.com 换成 groups.google.de 就可以了,凭着对界面的熟悉,笑傲八国语言。喜欢 Google Group 里面牛人多如牛毛,各种疑难杂症半个小时内就有方案出来了,经常还会碰到偶像级牛人为你解答。
2. https
大多数的小网站就没有那么雄厚的实力去建多国镜像了,但是很可能有用安全协议,于是把 http 换成 https 说不定有些就能访问了。不行的话再换翻墙工具上
Web online 翻墙: 不计其数,但是可以用的还真不多,这个北美服务器代理还可以用下 – http://www.daili.my/
桌面程序: 轮子的无_界好像再也用不了了,但是又有很多后起之秀,比如 Puff 什么的,问题是如果本身已经用过一次代理就不好使了,还不如之前的网页版代理。
其实无非我就是要查点和政治色情毫无关系的资料而已,为什么要弄的这么麻烦??????
装回文青, 借用 Charles Dickens 的名言发泄一下: "It was the best of times, it was the worst of times; it was the age of wisdom, it was the age of foolishness; it was the epoch of belief, it was the epoch of incredulity; it was the season of Light, it was the season of Darkness; it was the spring of hope, it was the winter of despair; we had everything before us, we had nothing before us; we were all going directly to Heaven, we were all going the other way."
Tuning Cakephp Performance
Posted by jeruliu in Google Map on January 18, 2010
关于 CP 的优化我只能想到三点:
1. Optimise database calls to return only the data necessary.
2. Use memcache instead of file cache.
3. Use an opcode cache like APC.
加了 Cache 以后页面还是比较慢,发现原来是装载 Google 的 Javascript 需要两秒左右延迟,通尝说来 JS 都是放在头部加载,其实可以反过来放到尾部,有点 lazy loading 的味道,这样装载页面就不用等待 JS 下载了。
也可以使用 Google 的 Ajax APIs. 所有的 Google Service 都可以通过 JSAPI 来动态加载,不用 block 页面 loading.
<script type="text/javascript" src="http://www.google.com/jsapi?key=ABCDEFG"></script>
<script type="text/javascript">
google.load("maps", "2");
google.setOnLoadCallback(function() {
// Your logic goes here.
// It will be run right after the maps module was loaded.
});
</script>
网球
莲花的场地最好,进行过重大比赛,而且有6片场地。
高尔夫里的场地环境也不错,价格贵点,博林诺富特酒店赛点环境很好,场地一般。
今天上午两个小时,下午三个小时,刚刚找回一点感觉。
需要改进的地方: 拍头过低容易打高,应该水平挥拍发力向前,最后加旋压低。引伸有所改进,但是还是没有用到腰部力量,所以只能打借力球,也就是遇强则强,遇弱则弱,碰到软球就无法主动发力。另外球拍需要换线了。。。
邪恶的 IE 伤感的 Google
1. 不遵循CSS规范,好端端的样式,到了IE那里就全变样了,乱七八糟的需要一堆补丁, 比如臭名昭著的PNG图片透明度问题。
2. 内存泄露问题, 很多FF看的好好的网站,用IE就会发现机器越来越慢,我下了一个叫 Drip 的东西来测试地图装载内存泄露问题,随着地图的自动刷新,内存使用以一种恐怖的斜率不断攀升(股票要这么牛就好了),最后直接把测试软件给干掉了。
3. Failed to open HTTPS site, 已经尝试了所有 fix 都无解,本来换着用 FF 就好了,可惜 IE 内置绑定,自己垮了不算,把所有用到 HTTPS 的软件也全部拖下水了,于是 MSN, 网上银行全部 Over…
破手机
等我拿回来手机的时候发现一个好消息和一个坏消息:
坏消息是他们把我手机重置了,所有信息被清空。
好消息是前几天我把它摔花屏了,这么一重置反而彻底好了。