Jan 30
$from = 'FROM: "=?UTF-8?B?' . base64_encode($yourname) . '?=" <from@yourdomain.com>';
$content = 'Content-Type: text/html; charset=UTF-8';
if (mail("to@yourdomain.com", "Subject", $msg, "{$from}\r\n{$content}\r\n")) {
    echo "搞定!";
}
else {
    echo "可耻地失败鸟...";
}

大致记录一下:

额外的HEADER指定了FROM和Content-Type字段

Content-Type用于标识内容是什么格式(text/html),什么编码(UTF-8)

下面这一行表示发件人,显示名称“xxxxxx”是经过BASE64编码(那个?B?的意思)后的UTF-8字符。
FROM: "=?UTF-8?B?xxxxxxxx?=" <from@yourdomain.com>

如果Subject需要中文字符,应该类似地:
SUBJECT: =?UTF-8?B?xxxxxxx?=
Jan 29

炫一下:SmartQ V7全家福 不指定

felix021 @ 2010-1-29 13:29 [IT » 硬件] 评论(3) , 引用(0) , 阅读(5518) | Via 本站原创
SmartQ V7,水木行KB850迷你蓝牙键盘,百度无线鼠标,百度有啊兜兜台历。

点击在新窗口中浏览此图片
Jan 25

WEB Windows 3.1 不指定

felix021 @ 2010-1-25 14:41 [IT » 操作系统] 评论(2) , 引用(0) , 阅读(6581) | Via 本站原创
Jan 24
参考这里的教程写的: http://www.developer.com/article.php/3417381

同时也终于知道了stmt原来是Statement的简写,惭愧。。。
import java.sql.*;

public class Jdbc11 {
    public static void main (String args[]) {
        try {
            Class.forName("com.mysql.jdbc.Driver");
            Statement stmt = null;
            String url     = "jdbc:mysql://localhost:3306/test";
            String dbuser  = "root";
            String dbpass  = "123456";
            String dbname  = "felix021";
            String tblname = "users";

            Connection con = DriverManager.getConnection(url, dbuser, dbpass);
            stmt = con.createStatement();
            System.out.println("URL: " + url);
            System.out.println("Connection: " + con);

            //建库
            stmt.executeUpdate("CREATE DATABASE IF NOT EXISTS " + dbname);
            stmt.executeUpdate("USE " + dbname);

            //建表
            stmt.executeUpdate("DROP TABLE IF EXISTS " + tblname);
            stmt.executeUpdate(
                    "CREATE TABLE " + tblname + "(\n" +
                    "  `id` INT PRIMARY KEY AUTO_INCREMENT, \n" +
                    "  `name` CHAR(20) NOT NULL, \n" +
                    "  `description` varchar(255) DEFAULT NULL\n" +
                    ")"
                    );

            //插入
            int count = stmt.executeUpdate(
                    "INSERT INTO " + tblname + "\n" +
                    "(`id`, `name`, `description`) VALUES \n" +
                    "(NULL, 'a', 'ooxx'), \n" +
                    "(NULL, 'b', NULL), \n" +
                    "(NULL, 'c', 'haha'), \n" +
                    "(NULL, 'd', 'hoho')"
                    );
            System.out.println("Inserted " + count + " rows");

            //statement for resultset
            stmt = con.createStatement(
                    ResultSet.TYPE_SCROLL_INSENSITIVE,
                    ResultSet.CONCUR_READ_ONLY);

            //查询
            ResultSet rs = stmt.executeQuery("SELECT * FROM " + tblname);
            System.out.println("All results are listed below:");
            while (rs.next()) {
                int    id           = rs.getInt("id");
                String name         = rs.getString("name");
                String description  = rs.getString("description");
                System.out.println(
                        "id=" + id + ", " +
                        "the name is " + name + ", " +
                        description
                        );
            }

            //删表
            stmt.executeUpdate("DROP TABLE " + tblname);

            //删库
            stmt.executeUpdate("DROP DATABASE " + dbname);
        }
        catch (SQLException sqlE) {
            System.out.println("SQL Error: " + sqlE);
        }
        catch (Exception e) {
            e.printStackTrace();
        }
    }
}
Jan 23
php代码
<?php

define ("MAX_MSG_COUNT", 5);
define ("USER_NAME", 'felix021');

$msg_c = isset($_GET['c']) ? intval($_GET['c']) : MAX_MSG_COUNT;
$user  = isset($_GET['u']) ? $_GET['u'] : USER_NAME;

require ('../lib/twitter.php'); //注: 此文件从twitese的lib目录下提取,并增加了
                                       //define("API_URL", "http://twitter.com");

$t = new twitter();

$s = $t->userTimeline(1, $user);

$msg = array();
for ($i = 0; $i < $msg_c; $i++) {
    $msg[$i] = htmlspecialchars(stripslashes($s[$i]->text));
    $msg[$i] = preg_replace(
            array(
                "/(\w+):\/\/([a-zA-Z0-9\.\/\-%+\?#_=@:&;])*/i",
                '/(\s|^)@([a-zA-Z0-9_-]+)/',
                '/(\s|^)#([a-zA-Z0-9_-]+)/',
                ),
            array(
                '<a href="\0" target="_blank">\0</a>',
                '\1<a href="/t/\2" target="_blank">@\2</a>',
                '\1<a href="/t/~\2" target="_blank">#\2</a>',
                ),
            $msg[$i]
            );
}

echo json_encode($msg);

?>


侧边栏的内容:
<div id="twitter" style="font-size:12px"></div>
<script>
function getXML() {
    var a = null;
    try {
        if (window.XMLHttpRequest) {
            a = new XMLHttpRequest();
        } else if (window.ActiveXObject) {
            a = new ActiveXObject("Msxml2.XMLHTTP");
        }
    }catch(e) {}
    return a;
}

function _t(c) {
    var x = getXML();
    x.onreadystatechange = function(){
        if(this.readyState == 4 && this.status == 200){
            var g  = eval(this.responseText);
            var tt = '';
            var t  = document.getElementById('twitter');
            for(var i = 0; i < g.length; i++){
                tt += g[i] + (i+1 == g.length ? "" : "<hr/>");
            }
            t.innerHTML = tt;
        }
    }
    x.open("GET", "/blog/tt.php?c="+c, true);
    x.send('');
}
_t(4);
</script>
Jan 22

给twitese推荐的一个.htaccess 不指定

felix021 @ 2010-1-22 14:36 [IT » 网络] 评论(0) , 引用(0) , 阅读(4276) | Via 本站原创
RewriteEngine On
RewriteBase /t

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^~@].*)$ user.php?id=$1 [QSA,L]
RewriteRule ^(@.*)$ search.php?q=$1 [QSA,L]                                                                                      
RewriteRule ^~(.*)$ search.php?q=$1 [QSA,L]
Jan 20

世界上最贵的网站 不指定

felix021 @ 2010-1-20 19:52 [IT » 网络] 评论(4) , 引用(0) , 阅读(6174) | Via 本站原创
世界上最贵的网站出现在中国,而不是欧美等国家,充分体现了中国特色社会主义的优越性。

传送门:http://www.mof.gov.cn/mof/xinxi/zhongyangbiaoxun/zhongbiaogonggao/200912/t20091215_246271.html

为防止一小撮别有用心的人消灭社会主义的建设成果,特此存截图留念。

点击在新窗口中浏览此图片

p.s. 还有一个670w造价的网站,传送门:
http://www.mof.gov.cn/mof/xinxi/zhongyangbiaoxun/zhongbiaogonggao/200912/t20091230_254406.html

相比之下一个150w造价的3间厕所,实在上不了台面啊!

@ 20100121 p.s.
rtmeme: RT @yuanxinting RT @xiaomi2020: 国家汉办3520万元建立网络孔子学院。中标公司是五洲汉风网络科技(北京)有限公司。该公司法人代表是胡志平。其另一职务是国家汉办副主任。也就是国家汉办开出了标书,是国家汉办创建了企业

@ 20100122 p.s.
此新闻已经开始被和谐,详见:Google搜索 中国工会网扩建项目 网易
Jan 20

一个简单的url rewrite规则 不指定

felix021 @ 2010-1-20 00:35 [IT » 网络] 评论(0) , 引用(0) , 阅读(3862) | Via 本站原创
折腾了好久才弄出来,sigh,不熟这东西
引用
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} /(index\.php)?
RewriteRule ^.*$ - [L]

RewriteCond %{HTTP_HOST} 19880711\.com
RewriteRule ^(.*)$ http://www.felix021.com/$1 [QSA,L]
分页: 34/99 第一页 上页 29 30 31 32 33 34 35 36 37 38 下页 最后页 [ 显示模式: 摘要 | 列表 ]