2008年2月28日

http://weblogs.asp.net/scottgu/archive/2008/09/02/asp-net-mvc-preview-5-and-form-posting-scenarios.aspx

连接地址.

posted @ 2008-09-03 14:52 暗香浮动 阅读(67) | 评论 (0)编辑

移除StringBuilder 末尾制定个数的字符,以前都是适用下面的方法做的

 

 

            StringBuilder sb = new StringBuilder();
            sb.Append("abcd");
            sb.Remove(sb.Length - 3, 3);
            Console.Write(sb.ToString());
            Console.Read();

其实有更简单的方法的。设定StringBuilder 的长度就ok了。

            StringBuilder sb = new StringBuilder();
            sb.Append("abcd");
            sb.Length--;
            Console.Write(sb.ToString());
            Console.Read();

 

注意string类型的length是只读的。所以不能采用该方法。

posted @ 2008-08-11 09:07 暗香浮动 阅读(76) | 评论 (1)编辑

 

因为项目把抛到客户端的异常信息处理统一放在了基类里面处理

需要把项目中这类的代码
try
            {
                User user = UserDTOMapper.MapFromDTO(userdto);
                msg.Result = DepartmentManager.IsInDepartment(departmentid, user);
                msg.Message = msg.Result ? Resources.OperationSuccessful : Resources.OperationFailur;

            }
            catch (CustomerException e)
            {
                msg.Message = e.Message;
                msg.Result = false;
            }

成为这个
                User user = UserDTOMapper.MapFromDTO(userdto);
                msg.Result = DepartmentManager.IsInDepartment(departmentid, user);
                msg.Message = msg.Result ? Resources.OperationSuccessful : Resources.OperationFailur;

使用了一下vs的正则表达式替换。还真不错。

 

try[ \n]*\{{[:a. \=;\n\:\?\\,)\(]*}[ }\n]*catch[ ]*\(CustomerException [e|ce]\)[\n][ {]*[ \n]*[:a. \=;\n]*\}

 

红色这部分在替换的地方使用 \1即可。

发现竟然会写正则了。这个可能写的还有点繁琐。先用吧,以后用得多了就熟练了。

posted @ 2008-07-31 16:30 暗香浮动 阅读(112) | 评论 (0)编辑


-------------------------------------------------------------------------------
!EEHeap [-gc] [-loader]

 

!EEHeap enumerates process memory consumed by internal CLR data structures. You

can limit the output by passing "-gc" or "-loader". All information will be

displayed otherwise.

 

The information for the Garbage Collector lists the ranges of each Segment in

the managed heap. This can be useful if you believe you have an object pointer.

If the pointer falls within a segment range given by "!EEHeap -gc", then you do

have an object pointer, and can attempt to run "!DumpObj" on it.

 

Here is output for a simple program:

 

0:000> !eeheap -gc

Number of GC Heaps: 1

generation 0 starts at 0x00a71018

generation 1 starts at 0x00a7100c

generation 2 starts at 0x00a71000

 segment    begin allocated     size

00a70000 00a71000  00a7e01c 0000d01c(53276)

Large object heap starts at 0x01a71000

 segment    begin allocated     size

01a70000 01a71000  01a76000 0x00005000(20480)

Total Size   0x1201c(73756)

------------------------------

GC Heap Size   0x1201c(73756)

 

So the total size of the GC Heap is only 72K. On a large web server, with

multiple processors, you can expect to see a GC Heap of 400MB or more. The

Garbage Collector attempts to collect and reclaim memory only when required to

by memory pressure for better performance. You can also see the notion of

"generations," wherein the youngest objects live in generation 0, and

long-lived objects eventually get "promoted" to generation 2.

 

The loader output lists various private heaps associated with AppDomains. It

also lists heaps associated with the JIT compiler, and heaps associated with

Modules. For example:

 

0:000> !EEHeap -loader

Loader Heap:

--------------------------------------

System Domain: 5e0662a0

LowFrequencyHeap:008f0000(00002000:00001000) Size: 0x00001000 bytes.

HighFrequencyHeap:008f2000(00008000:00001000) Size: 0x00001000 bytes.

StubHeap:008fa000(00002000:00001000) Size: 0x00001000 bytes.

Total size: 0x3000(12288)bytes

--------------------------------------

Shared Domain: 5e066970

LowFrequencyHeap:00920000(00002000:00001000) 03e30000(00010000:00003000) Size: 0x00004000 bytes.

Wasted: 0x00001000 bytes.

HighFrequencyHeap:00922000(00008000:00001000) Size: 0x00001000 bytes.

StubHeap:0092a000(00002000:00001000) Size: 0x00001000 bytes.

Total size: 0x6000(24576)bytes

--------------------------------------

Domain 1: 14f000

LowFrequencyHeap:00900000(00002000:00001000) 03ee0000(00010000:00003000) Size: 0x00004000 bytes.

Wasted: 0x00001000 bytes.

HighFrequencyHeap:00902000(00008000:00003000) Size: 0x00003000 bytes.

StubHeap:0090a000(00002000:00001000) Size: 0x00001000 bytes.

Total size: 0x8000(32768)bytes

--------------------------------------

Jit code heap:

Normal JIT:03ef0000(00010000:00002000) Size: 0x00002000 bytes.

Total size: 0x2000(8192)bytes

--------------------------------------

Module Thunk heaps:

Module 5ba22410: Size: 0x00000000 bytes.

Module 001c1320: Size: 0x00000000 bytes.

Module 001c03f0: Size: 0x00000000 bytes.

Module 001caa38: Size: 0x00000000 bytes.

Total size: 0x0(0)bytes

--------------------------------------

Module Lookup Table heaps:

Module 5ba22410:Size: 0x00000000 bytes.

Module 001c1320:Size: 0x00000000 bytes.

Module 001c03f0:Size: 0x00000000 bytes.

Module 001caa38:03ec0000(00010000:00002000) Size: 0x00002000 bytes.

Total size: 0x2000(8192)bytes

--------------------------------------

Total LoaderHeap size: 0x15000(86016)bytes

=======================================

 

By using !EEHeap to keep track of the growth of these private heaps, we are

able to rule out or include them as a source of a memory leak.

posted @ 2008-07-07 13:32 暗香浮动 阅读(20) | 评论 (0)编辑
select 操作
获取所选值  $("#id").val()
清空 empty();
添加项 $("<option value='a'>aa</option>")
posted @ 2008-02-28 16:36 暗香浮动 阅读(36) | 评论 (0)编辑

导航

公告

云南的精云腿月饼好吃. 9-4 21:10
<2008年2月>
272829303112
3456789
10111213141516
17181920212223
2425262728291
2345678

统计

与我联系

搜索

 

常用链接

留言簿(2)

我管理的小组

我参与的团队

我的标签

随笔分类

随笔档案

文章分类

舎友

最新评论

阅读排行榜

评论排行榜