手机浏览 RSS 2.0 订阅 膘叔的简单人生 , 腾讯云RDS购买 | 超便宜的Vultr , 注册 | 登陆
浏览模式: 标准 | 列表全部文章

常用设置网页编码的方法

非常方便:

Perl. Output the correct header before any part of the actual page. After the last header, use a double linebreak, e.g.:
print "Content-Type: text/html; charset=utf-8\n\n";

Python. Use the same solution as for Perl (except that you don't need a semicolon at the end).

PHP. Use the header() function before generating any content, e.g.:
header('Content-type: text/html; charset=utf-8');

Java Servlets. Use the setContentType method on the ServletResponse before obtaining any object (Stream or Writer) used for output, e.g.:
resource.setContentType ("text/html;charset=utf-8");
If you use a Writer, the Servlet automatically takes care of the conversion from Java Strings to the encoding selected.

JSP. Use the page directive e.g.:
<%@ page contentType="text/html; charset=UTF-8" %>
Output from out.println() or the expression elements (<%= object%>) is automatically converted to the encoding selected. Also, the page itself is interpreted as being in this encoding.

ASP and ASP.Net. ContentType and charset are set independently, and are methods on the response object. To set the charset, use e.g.:
<%Response.charset="utf-8"%>
In ASP.Net, setting Response.ContentEncoding will take care both of the charset parameter in the HTTP Content-Type as well as of the actual encoding of the document sent out (which of course have to be the same). 

The default can be set in the globalization element in Web.config (or Machine.config, which is originally set to UTF-8).

常用网站的反向代理页[2013-09-28]

做了几个常用网站的反向代理页。为什么要做,你懂的(标题的时间就是最新更新的时间)【建议自主翻墙,不再提供反代页面

1、golang:http://go.neatcn.com , 或者点击 golang
2、Yiiframework,http://yii.neatcn.com 或者点击 yii
3、golang play:http://goplay.neatcn.com 或者点击:goplay

目前仅做了这些个网站的反向代理 ,如果你有其他需求,请提出来,我会尽量解决。超大型的网站就算了。

[2013-09-28]
4、VIM官方网站:http://vim.neatcn.com 或者点击:VIM
5、SlideShare:http://slideshare.neatcn.com , 如果你觉得域名太长,也可以直接访问:http://ss.neatcn.com ,或者点击:slideshare

Tags: golang, yii

怎么获取内网机器的公网IP

说到获取公网IP,那方法是相当的多啊
1、利用第三方服务:ip138,用脚本访问他的首页,然后正则取出自己的IP
2、还是处用第三方的服务,如QQ,那种QQ判断来源IP,然后得到地址URL,连上去也能获取IP,当然也得正则
3、自己在自己的服务器上架个服务。返回公网IP,
4、利用dns的服务,比如 这样:

XML/HTML代码
  1. function getClientIp(){  
  2.     $socket = socket_create(AF_INET, SOCK_STREAM, 6);  
  3.     $ret = socket_connect($socket,'ns1.dnspod.net',6666);  
  4.     $buf = socket_read($socket, 16);  
  5.     socket_close($socket);  
  6.     return $buf;      
  7. }  

5、利用tracert,基本上也能获取 IP。ping也行。只是麻烦了一点
6、如果是本机直接拨号,那就方便了ifconfig , ipconfig /all也可以

捉马记

不知道从什么时候开始。突然发现fck竟然又被黑了。然后花了一个晚上的时候,检查代码,写脚本找马。
最后找了一大堆代码。找到了7、8个挂马位。不知道还有没有马了。确实准备什么时候重写。然后。。。所见所得换成markdown编辑器。这回我看你们怎么挂 马。NND

为什么BOSS偏重于产品而不是技术?

下面这段话是来自于兔子所说,两三个月前说的了,然后我保存了下来,觉得有点意义。

1.程序员提供的是技术实现,这种实现所需的能力是普遍性的,不具有不可替代性。产品提供的创造,不同的人创造的结果也会不一样,创造性越强的工种越值钱,创造性好的还具有不可替代性。
2.当你砌墙的时候你当然需要用大脑分别现在是该涂水泥了还是该放砖头了,经验工还知道怎么砌这个墙更牢固,但是砖头砌到那里该转弯了是设计墙的人决定的,这就是我说的脑和手。
3.老板都自认为自己是做产品的,他和产品有天生的亲近感。
4.技术和老板往往是被产品隔断的。
5.老板和PM都可以说这个产品是我的,技术只会说我参与开发了,自我看待产品的视角就不一样。

---
在公司里谁更强势谁就有话语权,就象某人说的,曾有某大型互联网公司的产品去他们那边唧唧歪歪,然后被他们开掉一样。但大多数的人还是会迷信这些人。就象上面的第3点。
其实痛苦的是第四点,当老板发现产品不是自己想的那样时,技术更多的可能是说没办法实现。于是这时候问题就来了,技术不给力啊,产品也很得意,不是我设计的不好,而是对方没能力实现我的想法我的创意啊。

如此循环,互斗。