Sends for the fellow dear visitors:welcome to dongpad!


 Welcome to DongPad!

 msn


| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | > >> 预览模式: 普通 | 列表

depends.exe & dumpbin.exe

This Article is Published by Live Writer。

1.vc自带的工具depends.exe可以查看exe或dll依赖哪些dll的工具。通常情况下,自己编写的程序要依赖系统或其他软件的各种dll文件,如果在另一台电脑上没有这些文件程序运行就会报错。VS的depends.exe工具能够帮我们找到依赖文件的名称路径等。一般depends.exe位置在“D:\Program Files\Microsoft Visual Studio 8\Common7\Tools\Bin\depends.exe ”

2.dumpbin.exe是visual studio中带的工具,可以查看二进制文件的信息,其中就可以用来查看一个程序依赖的dll:

dumpbin.exe /dependents

其位置一般在“C:\Program Files\Microsoft Visual Studio 8\VC\bin\dumpbin.exe”。

3.另外推荐一个Process Explorer ,它可以显示有关进程已打开或加载哪些句柄和 DLL 的信息。链接在这里

Tags: DongPad

分类:C# | 固定链接 |评论: 0| 引用: 0 | 查看次数: 731 | 返回顶部

如何验证信用卡是否合法

Tags:

分类:Study | 固定链接 |评论: 0| 引用: 0 | 查看次数: 792 | 返回顶部

How to make XmlnsDefinition work on the local assembly?

This Article is Published by Live Writer。

track @ http://stackoverflow.com/questions/2760504/how-to-make-xmlnsdefinition-work-on-the-local-assembly

Q:

I've started using the XmlnsDefinition attribute to tie together some CLR namespaces into a single xmlns for convenience in XAML.

Unfortunately, it seems that this only works when using foreign assemblies. If I have a XAML file in the same assembly as the types that are in the namespace I'm referencing from XmlnsDefinition, then the compiler gives an error about the type not existing in the xmlns I am defining.

Moving the type to a foreign assembly fixes the problem.

Is there a way to use XmlnsDefinition on an assembly and have it be used from within that assembly via XAML?

A:

Unfortunately, no. The XAML file must be parsed before the assembly is built in order to generate the code implied by the XAML to be included in the assembly. The XAML compiler produces code behind files (the files ending in, for example, .g.cs) and these file then become part of the assembly the XAML file is contained in. Since the assembly hasn't been built yet, the XAML compiler cannot load it to determine XmlnsDeclaration attributes have been specified.

Tags: DongPad

分类:C# | 固定链接 |评论: 0| 引用: 0 | 查看次数: 770 | 返回顶部

LINQ to SQL Debug Visualizer

http://weblogs.asp.net/scottgu/archive/2007/07/31/linq-to-sql-debug-visualizer.aspx

how to install:

1.download a copy of it here

2.copy the assembly into your local \Program Files\Microsoft Visual Studio 9.0\Common7\Packages\Debugger\Visualizers directory.


Tags: DongPad

分类:C# | 固定链接 |评论: 0| 引用: 0 | 查看次数: 818 | 返回顶部

F#对斐波那契数列求和

This Article is Published by Live Writer。

如题,1+1+2+3+5+8+13+…?

let sumfib n =
    let rec fib x =
        match x with
        | 1 -> 1
        | 2 -> 1
        | x -> fib(x-2)+fib(x-1)   
    let rec addfib x =
        match x with
        | 1 -> 1
        | x -> fib (x)+ addfib (x-1)   
    addfib n

cool!

Tags: DongPad

分类:F# | 固定链接 |评论: 0| 引用: 0 | 查看次数: 1011 | 返回顶部

Isolated Storage in SL4

This Article is Published by Live Writer。

在Silverlight4中,默认应用程序存储配额是1MB=1024KB=1048576Bytes,可以在SL程序的右键菜单点击查看,如下图1:

如果要申请配额,可以在构造里检查存储配额然后执行一下代码,但要考虑到用户可能阻止该请求:

using (var store = IsolatedStorageFile.GetUserStoreForApplication())
{
    Int64 IsoQuota = store.Quota; //单位为bytes
    Int64 requestIsoQuota = 1000;
    if (store.IncreaseQuotaTo(IsoQuota +requestIsoQuota )) //增加到指定大小
    {
       //……
    }
}

执行上述代码将自动提示用户"是否要增加可用存储",结果如下图2:

为了保持默认的1MB默认存储,我们选择“否”以便于后面的测试,如果选择了“是”也没关系,我们可以在应用程序存储选项页中选择该程序删除网站对应的存储使其重新初始化到1MB。在上述代码中,我们请求增加的配额为1000bytes,但是提示请求的大小依然是默认的配额1MB,这里Silverlight是如何显示申请存储配额时请求的大小的呢?

经测试发现,Silverlight对请求的大小采用了小数点保留一位四舍五入的策略,上图的请求的大小实际上就是上述代码中(IsoQuota +requestIsoQuota)除以(1MB*1024*1024)四舍五入保留一位小数的结果。在默认配额情况下,如果请求的配额requestIsoQuota 小于0.05MB=52428.8bytes=52429时,提示请求到的存储大小的小数位将被忽略,但这并不影响实际的存储配额,提示请求的大小依然是1.0MB,如果requestIsoQuota大于或等于0.05MB=52428.8bytes(requestIsoQuota类型为Int64,即requestIsoQuota最小为52429时提示请求大小为1.1MB)将提示请求大小为1.1MB。这里我们可以来验证一下,将requestIsoQuota的值更改为52428,提示请求的大小为1.0M,选择“是”对其进行增加可用存储,然后将requestIsoQuota的值更改为1,这时候的提示是请求的大小为1.1M,这也就从侧面反映了显示出来的请求的大小并不影响实际的存储配额,虽然他们可能是不一致的。

Tags: DongPad

分类:C# | 固定链接 |评论: 0| 引用: 0 | 查看次数: 1025 | 返回顶部

Difference between DataContext and ItemsSource in

DataContext is a general (dependency) property of all descendants of FrameworkElement. Is is inherited through the logical tree from parent to children and can be used as an implicit source for DataBinding. It does not do anything by itself, you must basically databind to it.

查看全部...

Tags: DongPad

分类:C# | 固定链接 |评论: 0| 引用: 0 | 查看次数: 1224 | 返回顶部

F# Type Tips

F#有强大的类型推理(type inference),所以在F#中不需要我们显示指定参数类型。如 let add p1 p2 = p1+p2;; 这样我们就定义了接收两个int类型参数返回int类型的一个add函数:val add : int -> int –> int,这个推理过程是由f#编译器完成的。

因为F#不使用隐式类型转换,所以如果我们对add传入float类型参数,如:add 100.0 200.0,编译将产生如下错误:

stdin(46,5): error FS0001: This expression has type float but is here used with type int

因此这里需要显示指定参数的类型,方式如:let add2 (p1:float)  p2 = p1+p2;; 这样编译器推理出add2函数接受两个float类型参数并返回float类型:val add2 : float -> float -> float。虽然在这里没有显示指定add2的p2参数类型,但是因为显示指定了F#的第一个参数为float类型,p2自然也就被推理为float类型了。因此如果有不同类型的参数,应该为这些参数都显示指定类型,add3接受一个float和一个int类型参数,并返回两个参数的连接形式string:let add3 (p1:float) (p2:int)=(string p1)+(string p2),编译器编译结果为:val add3 : float -> int -> string,在这里要注意的就是(string p1),它的意思是对p1进行强制转换。

积硅步以至千里。


Tags: DongPad F#

分类:F# | 固定链接 |评论: 0| 引用: 0 | 查看次数: 1103 | 返回顶部

F#之打印函数占位符详解

打印函数主要有三个:printf、printfn和sprintf。

printf将参数打印到控制台窗口中。printfn将参数打印输出并且换行。

打印函数可以使用下面这些格式指示符:

 

%O格式指示符会将对象进行装箱操作,并调用Object.ToString函数。%A的运作方式相同,但是在调用Object.ToString之前会检查[]属性指定的任何特殊打印选项。

PS: 紧接着的是来自官方的解释,从侧面说明了 printfn "%O" false (结果为False)与 printfn "%A" false(结果为false)的区别

%O 设置通过将对象装箱并使用其 ToString 方法来打印的任何值的格式。

%A 设置使用默认布局设置打印的任何值的格式。

sprintf用于输出的目标为一个字符串的情况。

节选自:CC682,更多格式请参考官方Core.Printf的%[flags][width][.precision][type]详解


Tags: DongPad F# 占位符

分类:F# | 固定链接 |评论: 0| 引用: 0 | 查看次数: 1302 | 返回顶部

我正在看的书籍

1.Foundations of F#

我正在看的电视剧 Functional programming (FP) is the future of .NET programming, and F# is much more than just an FP language. Every professional .NET programmer needs to learn about FP, and theres no better way to do it than by learning F#and no easier way to learn F# than from Foundations of F#.

If youre already familiar with FP, youll find F# the language youve always dreamed of. And all .NET programmers will find F# an exciting real-world alternative to C# and Visual Basic. This book is likely to have many imitators, but few true competitors. Written by F# evangelist Rob Pickering, and tech reviewed by F#s main designer, Don Syme, this is an elegant, comprehensive introduction to all aspects of the language and an incisive guide to using F# for real-world professional development. F# is the future of programming (not just on .NET), and the future is now.

这本书09年夏就开始在看了,后来一度荒废,继而直到上周参加盛大创新院赞助首届.NET技术交流会听了老赵的《F#语言对异步程序设计的支持》,才又激起我对F#探索的兴趣来。也希望籍此机会,好好的熟悉一下F#。


Tags: DongPad

分类:Study | 固定链接 |评论: 0| 引用: 0 | 查看次数: 1632 | 返回顶部
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | > >>