不进则退

Roger's blog @cnblogs

导航

统计

公告

昵称:Roger Wo
园龄:7年2个月
粉丝:0
关注:0

搜索

 
 

常用链接

随笔分类

随笔档案

我的网站

最新评论

阅读排行榜

评论排行榜

推荐排行榜

2005年11月1日 #

[过时的消息]VS2005 Shipped!

Visual Studio 2005的各个版本都陆续发布了,如果之前有安装过CTP、beta版本,最好在安装前把先前的版本都卸载掉,以免不必要的麻烦。有个专门的卸载工具,下载地址是:

http://go.microsoft.com/fwlink/?LinkId=47598

posted @ 2005-11-01 13:37 Roger Wo 阅读(651) 评论(1) 编辑

2005年10月22日 #

用Atlas来实现一个基于AJAX的无刷新Chatroom

Atlas是微软提供的一个AJAX工具包,封装了实现AJAX的所需的Java Script,使用起来非常简单,可以直接调用Web Service方法,然后通过Asynchronous Call的方式回调给客户端script,我用Atlas写了个简单的基于AJAX的无刷新chatroom:

Atlas Chatroom
http://www.worong.com/atlaschat/

为了引用Web Service,首先要在页面中添加以下客户端脚本:

<script language="JavaScript" src="ChatService.asmx/js"/>

用来显示和添加message的调用如下,对于每个方法的调用需要三个参数,分别是:Web Service方法的参数、调用成功后的回调函数、调用超时的回调函数。
 
function GetMsg() {
    AtlsChat.ChatService.GetConversation(
    
"",     //params
    OnComplete,     //Complete event
    OnTimeout       //Timeout event
    );
    
    
return false;
}


function Add() {
    document.getElementById('info').innerHTML 
= '<span style="background-color: yellow">&nbsp;posting&nbsp;</span>';
    AtlsChat.ChatService.Add(
    document.getElementById('inputName').value.replace('\t','
&nbsp;&nbsp;&nbsp;')+'\t'+ document.getElementById('inputMsg').value.replace('\t','&nbsp;&nbsp;&nbsp;'),
    GetMsg,
    OnTimeout
    );
    
    
return false;
}

    
function OnComplete(result) 
    
{
        document.getElementById('msg').innerHTML 
= result;
            
        document.getElementById('info').innerHTML 
= "";
    }


    
function OnTimeout(result) 
    
{
        document.getElementById('info').innerHTML 
= "time out";
    }


最后,需要在页面中引用Atlas提供的几个js:

<atlas:Script ID="Script1" runat="server" Path="~/ScriptLibrary/AtlasCompat.js" Browser="Mozilla" />
    
<atlas:Script ID="Script2" runat="server" Path="~/ScriptLibrary/AtlasCompat.js" Browser="Firefox" />
    
<atlas:Script ID="Script3" runat="server" Path="~/ScriptLibrary/AtlasCompat.js" Browser="AppleMAC-Safari" />
    
<atlas:Script ID="Script4" runat="server" Path="~/ScriptLibrary/AtlasCore.js" />
    
<atlas:Script ID="Script5" runat="server" Path="~/ScriptLibrary/AtlasCompat2.js" Browser="AppleMAC-Safari" />

 
<script type="text/xml-script">
        
<page xmlns:script="http://schemas.microsoft.com/xml-script/2005">
            
<references>
                
<!-- Repath the following src attributes, using regular client relative paths as necessary -->
                
<add src="ScriptLibrary/AtlasUI.js" />
                
<add src="ScriptLibrary/AtlasControls.js" />
            
</references>
            
<components>
            
</components>
        
</page>
   
</script>

Atlas的官方网站是http://beta.asp.net/default.aspx?tabindex=7&tabid=47,虽然提供了对非IE浏览器的支持,但是在Firefox中更新div会有刷新的感觉,在Mac的Safari上也根本就不work

posted @ 2005-10-22 17:24 Roger Wo 阅读(3970) 评论(8) 编辑

2005年10月19日 #

Passion回来了

痛定思痛,这个blog不能再荒废了

posted @ 2005-10-19 00:40 Roger Wo 阅读(146) 评论(2) 编辑

2005年4月12日 #

SQL Server / Access数据类型对照表

SQL Server and Access data types.
SQL Server 7 data type ADO data type Enum value
binary adVarBinary
bit adBoolean
char adChar
datetime adDate
decimal adNumeric
float adDouble
int adInteger
money adCurrency
nchar adWChar
ntext adLongVarChar
numeric adNumeric
nvarchar adVarWChar
real adSingle
smalldatetime adDate
smallint adSmallInt
text adLongVarChar
timestamp adBinary
tinyint adUnsignedTinyInt
UniqueIdentifier adGUID
varBinary adVarBinary
varChar adVarChar

posted @ 2005-04-12 14:33 Roger Wo 阅读(1017) 评论(0) 编辑

2005年4月5日 #

VS.NET Add-in在Design time获取控件值

客户要写一个Visual Studio .NET的Add-in,需要在design time获取form上控件的值,以下是用Reflection的做法

     

       Dim win As Window = applicationObject.ActiveWindow
            
Dim d As ComponentModel.Design.IDesignerHost = win.Object
            iss 
= d.GetService(GetType(ComponentModel.Design.ISelectionService))
            
Dim c As ComponentModel.Component = iss.PrimarySelection
            
Dim pi As Reflection.PropertyInfo = CObj(c).GetType().GetProperty("Visible")
            
            
Dim val As Object = pi.GetValue(c, Nothing)
            
Dim tc As System.ComponentModel.TypeConverter = ComponentModel.TypeDescriptor.GetConverter(val)
            
MsgBox(c.Site.Name & "." & pi.Name & " = " & tc.ConvertToString(val))


这样做有一个问题,当我要取TextBox.Visible这类属性的时候,返回值永远为true,因为reflect的是designer中的textbox对象,它的visible值永远为true。正确的做法是通过PropertyDescriptorCollection来读取Properties window里面的值,代码如下:

  
   
           
'query Properties
            Dim properties As System.ComponentModel.PropertyDescriptorCollection
            properties 
= System.ComponentModel.TypeDescriptor.GetProperties(c)
            
Dim prop As System.ComponentModel.PropertyDescriptor
            prop 
= properties("Visible")
            
MsgBox(c.Site.Name & "." & prop.Name & " = " & prop.GetValue(c))

本贴子以“现状”提供且没有任何担保,同时也没有授予任何权利

posted @ 2005-04-05 14:44 Roger Wo 阅读(851) 评论(2) 编辑

2005年3月2日 #

Visual Studio .NET 2002 Service Pack 1 出来了

摘要: 下载地址:http://www.microsoft.com/downloads/details.aspx?FamilyId=C41D8159-B42F-4D06-A797-E510494976EE&displaylang=en需要VS.NET 2003 SP1的同志再等等,马上就会有了。阅读全文

posted @ 2005-03-02 11:23 Roger Wo 阅读(1357) 评论(4) 编辑

2005年2月22日 #

在.NET程序中控制系统音量

摘要: 在windows下控制系统音量,需要通过使用win32的WDM audio components(winmm.dll)来实现,为了方便起见,将其封装到了一个AudioMixerHelper类中,可以直接通过GetVolume()和SetVolume方法来改变音量。 using System; using System.Runtime.InteropServices; ...阅读全文

posted @ 2005-02-22 16:43 Roger Wo 阅读(2317) 评论(7) 编辑

2005年2月7日 #

Winform下通过控件名称来获取控件

摘要: 以前一直在Webform下用Control.FindControl(string)方法来获取页面上的某个控件,可是Winform下面的ControlCollection却没有提供FindControl的方法: http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemwindowsformscontrolcontrolcollect...阅读全文

posted @ 2005-02-07 16:53 Roger Wo 阅读(1645) 评论(1) 编辑

2005年2月4日 #

关于AD编程的一些资料

摘要: 有人问我怎样在.NET下操作AD对象,找了些资料和Sample,留作备用。阅读全文

posted @ 2005-02-04 16:24 Roger Wo 阅读(1495) 评论(0) 编辑

2004年12月11日 #

Microsoft发布Member Management 组件 for ASP.NET v1.1

摘要: Member Management可以非常容易地创建和管理用户、对 Web 应用程序中的页面进行密码保护。尽管是ASP.NET 2.0新增的功能,现在我们也可以在ASP.NET 1.1下使用Member Management Component了!不用再自己去写代码实现user check, role based authentication了,在DotNetNuke和Community Serv...阅读全文

posted @ 2004-12-11 23:06 Roger Wo 阅读(1949) 评论(6) 编辑

2004年11月20日 #

我的hotmail信箱容量变成2G了!

摘要: 今天无意中发现的,庆祝一下!!阅读全文

posted @ 2004-11-20 00:04 Roger Wo 阅读(813) 评论(2) 编辑

2004年11月11日 #

好消息: Gmail 推出pop3服务了

摘要: 终于可以用outlook来收取Gmail邮件了!pop3: pop.gmail.comsmtp:smtp.gmail.com 一定要使用ssl链接,不过暂时还不支持IMAP协议。详细设置请参照:http://gmail.google.com/support/bin/answer.py?answer=10350&rand=0.6764270708572596 阅读全文

posted @ 2004-11-11 16:19 Roger Wo 阅读(3827) 评论(11) 编辑

msdn mag Dec 2004 (preview)

摘要:   Download the complete code from this issue: MSDNMag0412.exe (914 KB) DECEMBER 2004Volume 19 Number 12  • Tablet PC: Add Support for Digital Ink to Your Windows ApplicationsPaul Yao  &...阅读全文

posted @ 2004-11-11 09:10 Roger Wo 阅读(582) 评论(0) 编辑

2004年11月9日 #

在client端通过java script调用Web Service

摘要: 以下代码实现了在客户端用java script调用Web Service,通过对Web Service:TimeService中GetTime()方法的调用,在客户端显示服务器当前时间,并且以1秒为间隔自动刷新。TimeService: GetTime() //Return time on server     ...阅读全文

posted @ 2004-11-09 13:47 Roger Wo 阅读(8237) 评论(5) 编辑

2004年11月3日 #

DataGrid绑定对象为数组时怎样确定DataFileld

摘要: 昨天有人问了我这样一个问题:指定DataGrid的DataSource为一个简单的一维数组,并且需要通过BoundColumn来显示,那么这个BoundColumn的DataFileld值应该是什么?注意:仅仅是一个System.Array数组,而不是ArrayList。答案是 "!"。这样的数组确实是没有data field name的,所以.net会把它当作"!&...阅读全文

posted @ 2004-11-03 10:32 Roger Wo 阅读(2438) 评论(4) 编辑

2004年11月2日 #

为asp.net程序添加自定义配置区域

posted @ 2004-11-02 21:41 Roger Wo 阅读(1862) 评论(6) 编辑

2004年11月1日 #

first day in microsoft

摘要: 今天是我在微软gtec上班的第一天,早早就来到了美罗大厦,这时虽然离九点还有一刻钟,本以为电梯会比较空的,没想到第一天就见识到了传说中美罗早上电梯排大队的情况,一共6部电梯分高低两个区,尽管每部电梯里的人数都达到了最优装载,外面还依旧排着长队,想想原先在外滩中心有十几部电梯同时运行都回拥挤,碰到这种情况也就不足为奇了,看来以后还得赶早。 原本以为一天会在无聊地setup机器中度过,没想到却被告知我...阅读全文

posted @ 2004-11-01 20:08 Roger Wo 阅读(387) 评论(3) 编辑

2004年10月31日 #

new blog, new life

摘要: 终于决定在这里安营扎寨了,感谢dudu老大和Justin同学的大力推荐。无奈于自己的服务器老是罢工,再加上要跑一个sps,对于一台512M的p4实在是够呛了,当然,搬家的主要原因还是这里有这么多热爱.net的technical guy们,在这里先跟个位新邻居问声好:-)阅读全文

posted @ 2004-10-31 22:38 Roger Wo 阅读(556) 评论(10) 编辑