搞了一个下午想找一个“可以信赖加稳定”的图片上传 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 出来,然后非常顺利的,上传成功。
可以指定图片网址,或者直接让手机拍照然后上传照片。
这个图片上传功能将内建在我的程序库里。
Author: fyhao
PHP str_replace Boyer Option
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.
PayPal从Java迁移到Node.js
PayPal从Java迁移到Node.js
http://goo.gl/MM8PPw
Keyword: Kraken Framework, based on Express + Grunt.
Ping back feature in blogging
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.
Awesome Remote Plane Singapore Airline
JavaScript Closure Memory Leak by Circular Reference Example
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.
买了一本书 云端时代 海量资料分析
买了一本书叫做:云端时代的杀手级应用 海量资料分析
云端时代的新金脉啊!
又有新书可以阅读,人生一大快事。
Improvement on my Personal Note Apps
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
Node JS Doubt on it’s Threaded Model
Node JS claimed using single threaded model, asynchronous, easily handle thousand concurrent HTTP request with efficient memory consumptions.
But underlying not. It does create internal threads from the main event loop thread using select calls.
For *nix based it creates fixed size thread pool, 4 threads.
Having one doubt:
Don’t say networking IO, it does consumes singke thread to do async IO.
But how File IO, it should utilize thread pools or OS level thread or process to read/write buffer. When dealing with large file, say, thousand concurrent requests to read large file, will 4 threads need to queue in order to process all read large file requests, then how the Node JS performance can be.
Nevertheless, Node JS really suitable to implement lightweight things like socket IO for soft real time, communication apps, the “front end” of the back end system, like API Interface, which is blazing fast, non blocking.
But it is not suitable for heavy business calls, like expensive large file read/write, complex database transactions like money transfer from one bank accounts to another, or any other data extensive operations.
Imgshow API on Github
Published Imgshow API on Github.
At the time of writing, supported PHP, Node.JS, Freeswitch, Titanium Mobile API client.
Come and support the project.
https://github.com/fyhao/imgshow-api