在家里吃薯片
Attached Location:
at Jalan Daya, Johor Bahru
fyhao stuffs
搞了一个下午想找一个“可以信赖加稳定”的图片上传 API,而且要让 Titanium Mobile 支持。
第一个:尝试 PhotoBucket
免费帐号可以拥有 2GB,蛮多的。
但是它的 API 有点难做,支持的库又少到可怜,所以,最终放弃了。
第二个:尝试 Flickr
免费账号可以拥有 1TB,超多的,1TB = 1000GB = 1000 x 1000 MB.
它的 API 支持广泛,而且已经有善心人士设计出 Titanium Mobile API 了。它跟我已经使用的 Twitter API 应该是同一个人写的。但是在实际做的时候,一直上传不到照片。主
第三个:尝试 ImageShack
免费账号可以拥有 ??? GB,过后下载了 SkyPath iOS 版本获得了免费一年的 25GB。
它的 API 非常简单,简单到我可以完全100%自己写一个简单的 API Client 出来,然后非常顺利的,上传成功。
可以指定图片网址,或者直接让手机拍照然后上传照片。
这个图片上传功能将内建在我的程序库里。
The PHP str_replace function signature
proto mixed str_replace(mixed search, mixed replace, mixed subject [, bool boyer])
It seem that PHP support boyer as an option (toggle on/off)
Boyer-Moore is a faster algorithm in search and replace, especially in large text search, mostly used in text editor.
Curious about Pingback function in my blog.
After googling, Pingback is a function implemented in blogging software including WordPress. What wordpress does is when your WordPress site enabled auto pingback, when you make a post, WordPress will ping all the links in your post, whenever the links in your post accept the ping (another WordPress blog), then your post will be linked to that another site where another site get the pingback from you.
Then, the blog author can track whoever reference their posts.
Code 1
function fn(elem, a, b) {
elem.onclick=function() {
a,b
}
}
Code 2
function fn(elem, a, b) {
elem.onclick=(function(a,b) {
return function() {
a,b
}
})(a,b)
}
Code 1 is the common way we write JS function.
Code 2 is an ugly way but do the same thing.
But Code 1 will cause memory leak and Code 2 does not.
The memory leak so called circular reference.
The closure is a beautiful structure in JavaScript but easily cause memory leak if written by not experienced developer.
买了一本书叫做:云端时代的杀手级应用 海量资料分析
云端时代的新金脉啊!
又有新书可以阅读,人生一大快事。
Wah, just extend my Notes Apps with a common module called Sharer. Can then write a post in one place, then post it to Facebook, Twitter, and WordPress.
Not starightforward to post from iphone to my WordPress, a lot of PHP and JS to make it works.
But by this improvement, it is easier for me to share post by using one apps here.
My personal apps, worked for me, worked great