人生是一场不能存盘的RPG,我只能尽量多搞几个Screenshot

November 30, 2006

Function Discovery Browser

Filed under: 开发工具

A new tool come with .NET SDK 3.0
C:\Program Files\Microsoft SDKs\Windows\v6.0\Bin\fdbrowser.exe

November 29, 2006

My Vista

Filed under: Windows platform

Virtual PC 2007 beta1 + 1G memory

Offiece 2007

Visio 2007

Windows SDK for Windows Vista

现在的问题是,玩点什么好呢?

November 26, 2006

几本新书

Filed under: 技术书籍

今天逛了逛书店.看到几本书值得进一步了解:

.NET Patterns: Architecture, Design, and Process
中译本: .NET模式:架构、设计与过程
免费试读: http://www.dearbook.com.cn/book/ReadBook.aspx?pno=TS0029381
讲述.net framework中用到的Design pattern, 以及在web service中的应用.

Maximizing ASP.NET: Real World, Object-Oriented Development -by Jeffery Putz
中译本: 最优化ASP.NET –面向对象开发实践
免费试读: http://book.csdn.net/bookfiles/90/index.html
偏重于实践和案例分析

ASP.NET 2.0 MVP Hacks and Tips
中译本: ASP.NET 2.0编程珠玑– 来自MVP的权威开发指南
免费试读: http://book.csdn.net/bookfiles/185/index.html
看名字应该完全来自实战, 可能不是完全适合每个人

DOM Scripting: Web Design with JavaScript and the Document Object Model
中译本: JavaScript DOM 编程艺术
免费试读: http://book.csdn.net/bookfiles/177/
http://domscripting.com/

同时对csdn有点小小建议:
能否学习china-pub,告诉我中译本图书的原书名,不要让我用放大镜在封面照片上找.
能否把封面图片上的dearbook.com字样去掉.
http://book.csdn.net/bookfiles/185/index.html

November 24, 2006

Vista 优化

Filed under: Windows platform

–bcdedit.exe
修改多重启动菜单

–Vista BootPRO
图形UI,修改启动设置

TweakVI for Windows Vista
http://www.totalidea.com/content/tweakvi/tweakvi-index.html

微软新系统Vista服务优化攻略
http://soft.yesky.com/os/435/2087435.shtml

Windows Command

Filed under: 使用技巧

———————-Service 相关
–列举系统中运行的service
tasklist /svc xp
tlist -s win2k

–重启IIS
iisreset

–启动,停止service
net start Service
net stop Service

sc start “my service”
sc stop “my service”

–安装service
installutil XXX.XXX.exe Install .NET service
sc create myservice Install win32 service

–卸载service
Installutil /u myservice .NET service
sc delete myservice Win32 service

———————-控制台相关
–打开控制台,可以看到常用的.msc
mmc

–打开services 控制台
services.msc

–性能监测器
perfmon.msc

–共享文件夹管理器
fsmgmt.msc

–把网络共享映射到一个盘符
net use x: \\<ip>\c$

–把目录映射到一个盘符
subst z: c:\Temp
subst z: /D 去掉映射

–Event 查看
eventvwr

–内存使用情况查看
mem

November 23, 2006

Create the group label in the dropdown list.

Filed under: ASP.NET

http://www.w3schools.com/tags/tag_optgroup.asp
<select>
<optgroup label=”Swedish Cars”>
<option value =”volvo”>Volvo</option>
<option value =”saab”>Saab</option>
</optgroup>
<optgroup label=”German Cars”>
<option value =”mercedes”>Mercedes</option>
<option value =”audi”>Audi</option>
</optgroup>
</select>

November 22, 2006

How to Get Neutral Culture

Filed under: .NET, Code snippets

string resourceFolder = “Folder”;
string resourceFileName = “ResFile.resx”;
CultureInfo ci = System.Threading.Thread.CurrentThread.CurrentCulture;
string fileName = String.Format(”{0}\\{1}\\{2}”, resourceFolder, ci.Name, resourceFileName);

Console.WriteLine(fileName);

ci = new CultureInfo(ci.LCID & 0x03ff);

fileName = String.Format(”{0}\\{1}\\{2}”, resourceFolder, ci.Name, resourceFileName);
Console.WriteLine(fileName);

ci = new CultureInfo(”zh-CHS”);
Console.WriteLine(ci.IsNeutralCulture); //Note! it’s true

ci = new CultureInfo(”fr-FR”);
Console.WriteLine(ci.IsNeutralCulture);

November 21, 2006

Prison break

Filed under: 娱乐

也许是等待了太长的时间, 盼来的第11集让我觉得时间过的飞快,
看完了甚至怀疑是不是这一集不足40分钟.500万回到了T-bag手中,
相比之下,好过被龌龊的狱警拿走.
各路人马都急了,焦点转移到了sara身上,最要命的是11的结尾又是
某人名悬一线,虽然知道导演和编剧不会让迷人的sara挂掉,但还是
有些焦躁不安,期待下文…..

November 18, 2006

通过脚本修改xp的cd key

Filed under: 使用技巧

http://www.larkmoon.com/read.php/45.htm

ON ERROR RESUME NEXT

Dim VOL_PROD_KEY
if Wscript.arguments.count<1 then
   VOL_PROD_KEY=InputBox("Message1"&vbCr&vbCr&"Message2","The Title","UserInput, key")
   if VOL_PROD_KEY="" then
     Wscript.quit
   end if
else
   VOL_PROD_KEY = Wscript.arguments.Item(0)   ‘Get usr input from command line
end if

VOL_PROD_KEY = Replace(VOL_PROD_KEY,"-","") ‘Remove hyphens if any

‘WMI
for each Obj in GetObject("winmgmts:{impersonationLevel=impersonate}").InstancesOf ("win32_WindowsProductActivation")

   result = Obj.SetProductKey (VOL_PROD_KEY)   ’Update key

   if err = 0 then
      Wscript.echo "OK!"
   end if

   if err 0 then
      Wscript.echo "Failed"
      Err.Clear
   end if
Next
 

November 12, 2006

width, clientWidth, offsetWidth and scrollWidth

Filed under: Uncategorized

#div_test
{
width:300px;
height:200px;
padding:10px;
border:10px solid #ff0000;
background:#ccc;
font-size:12px;
}

<div id=”Div_CnLei”>
<a href=”javascript:alert(ShowSizeInfo());”>Show size info</a>
</div>

可得到如下结论:
IE7.0,IE6.0,FF1.06:
clientWidth = width + padding
clientHeight = height + padding
offsetWidth = width + padding + border
offsetHeight = height + padding + border

还一个是scrollWidth, scrollHeight
一般的用法是通过计算scrollleft 或 scrollTop做一个滚动的区域.
注意!scrollTop和scrollLeft描述的是一个距离,而不是位置,比如div.scrollTop描述的是
div滚动后的最上边和div的可见区域的最上边之间的距离.所以向上滚动要scrollTop++

在MSDN中,可以找到一张让人抓狂的图:
Measuring Element Dimension and Location, 可以看看

November 11, 2006

RegisterClientScriptBlock and RegisterStartupScript

Filed under: ASP.NET

这两个函数在asp.net1.1中是Page class上的方法.
在asp.net2.0中,变成了ClientScriptManager class上的方法,一般用法是在Page Load事件中调用:
this.ClientScript.RegisterClientScriptBlock
this.ClientScript.RegisterStartupScript

与此配套的函数还有
IsClientScriptBlockRegistered
IsStartupScriptRegistered
设想你写了一个web control, 需要一段client javaScript,如果user 在一个form上创建了这个control
多次,如果没有这个判断,就会生成多份代码.但在page上只注册一段代码可以不调用这个方法,
使用相同的type和key注册代码会被忽略.

这两个方法唯一的不同在于
RegisterClientScriptBlock()在Web 窗体的开始处,<form runat=”server”>之后生成代码,
而RegisterStartupScript()在 Web 窗体的结尾处,</form>标识之前生成代码。
从名称上看,asp.net 希望RegisterStartupScript生成的代码用于在page刚刚完成加载,OnLoad 事件
尚未触发前执行.

–参考
从 ASP.NET 服务器控件插入客户端脚本
http://www.microsoft.com/china/MSDN/library/archives/library/DNAspp/html/aspnet-injectclientsidesc.asp#aspnet-injectclientsidesc_topic3

Adding Client-Side Message Boxes in your ASP.NET Web
http://aspnet.4guysfromrolla.com/articles/021104-1.2.aspx

November 10, 2006

Key not valid for use in specified state

When I create a data base in the VS2005, I get a error message box which
says: “An error occurred while processing the local data file:
Key not valid for use in specified state.” The .mdf was created successfully
but I can’t open it in VS2005.

Google tell me to delete the folder:
C:\Documents and Settings\<My Name>\Application Data\Microsoft\VisualStudio\8.0
I clean the folder, then I can use the data base as usual.

Cool Javescript

Filed under: 代码学习

javascript:R=0; x1=.1; y1=.05; x2=.25; y2=.24; x3=1.6; y3=.24; x4=300; y4=200; x5=300; y5=200; DI=document.images; DIL=DI.length; function A(){for(i=0; i-DIL; i++){DIS=DI[ i ].style; DIS.position=’absolute’; DIS.left=Math.sin(R*x1+i*x2+x3)*x4+x5; DIS.top=Math.cos(R*y1+i*y2+y3)*y4+y5}R++}setInterval(’A()’,5); void(0);

Open a web page contains image, and copy the code snippet into IE’s address, GO!

GAC里有什么?

Filed under: .NET

Keywords:GAC,GAC_32,GAC_MSIL,NativeImages

安装了.net2.0后,在命令行下可以看到
c:\windows\assembly目录下有如下内容
2006-04-08 00:32 <DIR> GAC
2006-11-10 21:55 <DIR> GAC_32
2006-04-07 23:39 <DIR> GAC_MSIL
2006-04-08 00:32 <DIR> NativeImages1_v1.1.4322
2006-10-20 04:23 <DIR> NativeImages_v2.0.50727_32
2006-10-19 02:18 <DIR> temp
2006-10-19 02:19 <DIR> tmp

GAC中是.net1.1的assembly

从.net2.0开始支持64bit,理论上.net assembly是MSIL代码,不用关心平台是
32位还是64位,但有些Manage c++的assembly同时包含MSIL code和Native code,
所以出现了32bit .net assembly 和64bit .net assemlby,在32位平台上,只需要安装
32bit .net assembly, 在64位平台上,要能直接运行32位的程序(Windows on windows),
所以要同时安装32bit .net assembly和64bit .net assembly,然而不是所有的assembly
都包含native code,所以可以把.net assembly分为两部分,所以在32位机器上会看到
GAC_32和GAC_MSIL这两个目录,在64位机器上会看到GAC_32,GAC_64,
GAC_MSIL这三个目录.打开GAC_32和GAC_MSIL这两个目录,可以看到GAC_MSIL
中包含大部分.net framework assembly和所有应用程序的assemly,GAC_32中包含
mscorlib等底层的assembly.

打开NativeImages目录,可以看到目录中包含所有的.net framework assembly的Native
Image,可见为了提高性能,MS为所有的.net framework assembly生成了image,

temp和tmp是两个空目录.

c:\windows\assembly下的隐藏文件Desktop.ini指定了使用Shell扩展SHFusion.dll来显示目录下的文件.

RegisterClientScriptBlock vs RegisterStartupScript

Filed under: ASP.NET

RegisterClientScriptBlock一般返回的是客户端函数的包装,而RegisterStartupScript返回得函数在document装载完成后会执行,类似于body onload=”f()”里面的函数;

这两个方法在客户端呈现的代码位置不同,RegisterClientScriptBlock在<form runat=server>之后,而RegisterStartupScript在</form>之前。

November 9, 2006

An error in my T-SQL

Filed under: SQL&DB Accessing

Column XXX is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
——————
http://sqlzoo.net/howto/source/z.dir/err979/sqlserver
When using a GROUP BY clause every field in the SELECT list must be either:
One of the GROUP BY terms - in this case region
An aggregate function - for example SUM or COUNT
An expression based on the above

In the example the field name may not be used on the SELECT line.
SELECT name, region, MAX(population)
FROM bbc
GROUP BY region

In a group by line each region shows up only once - however in a typical region such
as Africa there are several different name values. WHich one should SQL pick?

Solutions
-Remove the offending field from the SELECT line
-Add the field to the GROUP BY clause
-Aggregate the offending field

Specific to SQL Server

Administrator can’t open IIS Manager

Filed under: 使用技巧

I had been added to the administrator group on a remote server, but when I try to manage the IIS service on it, the access was denied.
Other people tell me to modify my User Profile on the server:
My computer’s context menu->Propery->Advanced->User Profiles
Find my name, change Profile Type from Roaming to Local.

He is correct.

November 6, 2006

What’s Event Toaster?

Filed under: Visual Studio

装完了VS 2005 SDK后,在任务栏上出现了一个名为Event Toaster的图标,google后得知这是VS SDK Power Toys的一个小工具,可在VS工作时触发事件,执行一些命令,可在
VS 2005的Tools -> Option中PowerToys->EventToaster中进行设置.

参考:
http://blogs.msdn.com/aaronmar/archive/2006/07/19/671687.aspx

November 3, 2006

Some “new” tools for me.

Filed under: 技术资源

1.VMWare Player. It’s free.
There are some images for it:
http://www.vmware.com/vmtn/appliances/

2.Lingoes dictionary. Free.
http://www.lingoes.net/

3.ubuntu. Debian
http://www.ubuntu.org.cn/
http://www.debian.org/international/Chinese/

4.DownThemAll for firefox2.0






















Get free blog up and running in minutes with Blogsome
Theme designed by Hadley Wickham