Archive for ‘Default’ Category
some information about http authentication :
–
As for authentication, the HTTP protocol includes the basic access authentication and the digest access authentication protocols, which allow access to a Web page only when the user has provided the correct username and password. If the server requires such credential for granting access to a Web page, the browser [...]
#context-back,
#context-forward,
#context-reload,
#context-stop,
#context-sep-stop,
#context-bookmarkpage,
#context-savepage,
#context-sendpage,
#context-sep-viewbgimage,
#context-openlink,
#context-sep-open,
#context-bookmarklink,
#context-sendlink,
#context-sep-copyimage,
#context-sendimage,
#context-setWallpaper,
#context-printpage,
#context-smartsearch
{ display: none !important; }
一个好的文件存储结构不但使用、维护方便,关键是调用方便。
废话少说,直接上菜,厨子开始干活 :)
假设用户上传一个头像,系统为其生成大小不同的三种缩略图,并以用户ID做为目录名称,格式如下:
public/images/users/86799/raecoo.gif (原图)
public/images/users/86799/raecoo-big.gif
public/images/users/86799/raecoo-medium.gif
public/images/users/86799/raecoo-thumb.gif
这样的做法在系统规模较小的时候是没什么问题的,但随着用户数量的增加,这样的存储结构肯定是个隐患。下面介绍一种可容纳大规模存储的解决方案,当然这不一定是最好,也不一定适合你 :)
调用远程URL接口的通用方法,临时封装的,还不完善,仅供参考,相信封装完善后将是一个不错的Libary,其实RESTFul的远程也类似这样,但Rails自己封装的肯定比这个要成熟的多,抽空也Copy一个出来,记录在此
require ‘net/http’
require ‘net/https’
require “singleton”
require “erb”
def invoke_remote
RemoteHttp.instance
end
class RemoteHttp
include Singleton
def call(host,url,request_type,params={})
http = Net::HTTP.new(host)
response, data = http.get(host+url, nil)
puts ‘—————————————————-’
puts response
puts ‘—————————————————-’
puts data
puts ‘—————————————————-’
end
end
invoke_remote.call(’http://www.p1.cn’,'/raecoo’,”,{})
看到一段描述国内开发者特点的言论,感觉比较靠谱,至少我可以算是这类人,看起来要努力改进,在此做个记号.
中国开发者的一个大的特点就是对技术痴迷的同时不食人间烟火,整天津津乐道的就是那些算法、数据结构、设计模式、语言技巧、技术规范,对于普通老百姓关心的东西一概没有兴趣。我们中的大部分人对于时尚、化妆品、小资情调嗤之以鼻,对于电影、音乐、艺术、美食一知半解,对于地产、金融、法律知识一窍不通,对于一个普通老百姓市场生活中所能遇到的困难和问题,所追求的那一点享受和乐趣不闻不问,既不愿意亲身实践,更在主观心态上予以拒斥。
策划产品的时候全凭感觉,结果呢,做出来的东西千篇一律,看上去什么都有,一用起来处处不贴心。究其根源,就在于我们太专业,把太多的时间用来围着电脑转,根本上缺少对于生活和需求的深刻体察,对于人的关怀。
http各个状态码含义
1**:请求收到,继续处理
2**:操作成功收到,分析、接受
3**:完成此请求必须进一步处理
4**:请求包含一个错误语法或不能完成
5**:服务器执行一个完全有效请求失败
100 Continue 初始的请求已经接受,客户应当继续发送请求的其余部分。(HTTP 1.1新)
101 Switching Protocols 服务器将遵从客户的请求转换到另外一种协议(HTTP 1.1新)
200 OK 一切正常,对GET和POST请求的应答文档跟在后面。
201 Created 服务器已经创建了文档,Location头给出了它的URL。
202 Accepted 已经接受请求,但处理尚未完成。











