天气预报[取自sohu]

2006年05月26日 1:09 下午  |  分类:Develop

本打算”偷”Yahoo的,但后来还是爱上sohu的了
立马就放了上来
大家可以看看效果

http://www.yibin001.com/zh-cn/Weather.html

获取yahoo的天气预报信息

2006年05月25日 6:20 下午  |  分类:Develop

下午弄出来的
准备用到blog上

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Net;
using System.IO;
using System.Text.RegularExpressions;

public partial class Default2 : System.Web.UI.Page
{
    protected string _content;
    protected void Page_Load(object sender, EventArgs e)
    {
        GetWebInfo web = new GetWebInfo(new UriBuilder(@"http://weather.cn.yahoo.com/area.html?city=%CE%E4%BA%BA"));

        _content = web.LinkFind();
    }
}
class GetWebInfo
{
    public String filetext;
    public GetWebInfo(UriBuilder url)
    {
        filetext = "";
        HttpWebRequest rs = (HttpWebRequest)WebRequest.Create(url.Uri);
        try
        {
            HttpWebResponse rsp = (HttpWebResponse)rs.GetResponse();

            using (StreamReader reader = new StreamReader(rsp.GetResponseStream(), System.Text.Encoding.Default))
            {
                String tmstr = "";
                while ((tmstr = reader.ReadLine()) != null)
                {
                    filetext += tmstr;
                }
            }
        }
        catch
        {
        }
    }
    public string  LinkFind()
    {
        Regex r;
        Match m;
        string _str = "";
            r = new Regex("<!--3-->\\s*(?<1>.*[^<])<!--3-->",
            RegexOptions.IgnoreCase | RegexOptions.Compiled);
        for (m = r.Match(filetext); m.Success; m = m.NextMatch())
        {
            _str+=m.Groups[1].ToString();
        }
        return _str;
    }
}

.net中实现繁简互换

2006年05月25日 3:06 下午  |  分类:Develop

重写了Stream类
本站就是这样实现的
需要引入Microsoft.VisualBasic;

class CnToTwStream : Stream
{
private Stream _sink;
private MemoryStream _ms;
private Encoding _encoding;</code>

public CnToTwStream(Stream sink, Encoding encoding)
{
_sink = sink;
_ms = new MemoryStream();
_encoding = encoding;
}

public override bool CanRead
{
get { return false; }
}

public override bool CanSeek
{
get { return false; }
}

public override bool CanWrite
{
get { return true; }
}

public override long Length
{
get { return _ms.Length; }
}

public override long Position
{
get { return _ms.Position; }
set { throw new NotSupportedException(); }
}

public override int Read(byte[] buffer, int offset, int count)
{
throw new NotSupportedException();
}

public override long Seek(long offset, System.IO.SeekOrigin direction)
{
throw new NotSupportedException();
}

public override void SetLength(long length)
{
throw new NotSupportedException();
}

public override void Close()
{
_ms.Close();
byte[] buffer_cn = _ms.GetBuffer();
string str_cn = _encoding.GetString(buffer_cn);
string str_tw = Strings.StrConv(str_cn, VbStrConv.TraditionalChinese, 0);
byte[] buffer_tw = _encoding.GetBytes(str_tw);
using (_sink)
{
_sink.Write(buffer_tw, 0, buffer_tw.Length);
}
}

public override void Flush()
{
_ms.Flush();
}

public override void Write(byte[] buffer, int offset, int count)
{
_ms.Write(buffer, offset, count);
}
}

张韶涵-隐形的翅膀

2006年05月24日 2:14 下午  |  分类:音乐人生

在某一天突然发现自己喜欢上她的歌曲
中午午休时听这首曲子比较合适
感觉自己真的长了翅膀
向自己的梦想飞去….

每一次
都在徘徊孤单中坚强
每一次
就算很受伤
也不闪泪光
我知道
我一直有双隐形的翅膀
带我飞
飞过绝望
不去想
他们拥有美丽的太阳
我看见
每天的夕阳
也会有变化
我知道
我一直有双隐形的翅膀
带我飞
给我希望
我终于
看到
所有梦想都开花
追逐的年轻
歌声多嘹亮
我终于
翱翔
用心凝望不害怕
哪里会有风
就飞多远吧
隐形的翅膀
让梦恒久比天长
留一个
愿望
让自己想象

Pages: « 1 2 3 ...106 107 108 109 110 111 112 113 »