浏览模式: 普通 | 列表
1

梦里无时莫强求 梦里有时莫须有

[ 2009-04-28 23:37:16 | 作者: progame ]
梦是心头想, 可是前天晚上做了个梦, 却不知起因何在

当时狂风暴雨如注, 大家不分男女地都躲在男厕所里, 虽然都有伞, 可是依然被阻拦了行程
天色暗得如同夜晚, 可是太阳却仍然在四面八方闪现, 强光照得人睁不开眼, 必须用伞挡住
也就是说太阳时常在东边, 时常在西边, 接着风雨慢慢地小了
可是这时天上的太阳也静止在云层后面, 呈现着暗红色, 而且带着毛边

作为一个通晓天文地理的人, 我开始主动给大家讲解
这种天象是大凶之兆啊, 世界末日可能就要来了
正这时在漆黑如墨的天空, 突然清晰的出现一艘很大的集装箱船
和电影里的幽灵船的感觉非常象, 好像挂在天上一样
正想着为什么船会在天上呢, 就看那船直接往头顶砸过来了
于是大家就没命的跑啊, 否则就要灭顶之灾了

很幸运, 我们逃过了这艘船, 接着看到天上远远的又一艘船砸过来了
更幸运的是这次还在奔逃中, 就给吓醒了......

虽然常做梦, 而且没什么好梦, 但这种世界末日的感觉却不多
最早有次是初中, 梦见晚上我们正在宿舍睡觉
突然有人发现外面太阳从西边升起来了,于是我们全部跑到阳台上去看
还有次梦见发大水, 水位高得我们只能躲在几十米高的半山腰的山洞里
在自然面前, 感觉自身是如此的渺小
非自然的也有过, 有次梦见自己在大学的一个花坛后面躲原子弹
结果一片白光中, 梦中的自己死了!

[转] Convert a LINQ Query Resultset to a DataTable [私人]

[ 2009-04-13 15:19:27 | 作者: progame ]
Convert a LINQ Query Resultset to a DataTable
After a long struggle I find out the way to convert a Linq Query resultset to DataTable object. The attached source code shows how to do it. I am sharing this article with my developer friends and make their life easier.

Here are two samples.

Sample I:

I created a public method called LINQToDataTable as following:

public DataTable LINQToDataTable<T>(IEnumerable<T> varlist)
{
DataTable dtReturn = new DataTable();

// column names
PropertyInfo[] oProps = null;

if (varlist == null) return dtReturn;

foreach (T rec in varlist)
{
// Use reflection to get property names, to create table, Only first time, others
will follow
if (oProps == null)
{
oProps = ((Type)rec.GetType()).GetProperties();
foreach (PropertyInfo pi in oProps)
{
Type colType = pi.PropertyType;

if ((colType.IsGenericType) && (colType.GetGenericTypeDefinition()
==typeof(Nullable<>)))
{
colType = colType.GetGenericArguments()[0];
}

dtReturn.Columns.Add(new DataColumn(pi.Name, colType));
}
}

DataRow dr = dtReturn.NewRow();

foreach (PropertyInfo pi in oProps)
{
dr[pi.Name] = pi.GetValue(rec, null) == null ?DBNull.Value :pi.GetValue
(rec,null);
}

dtReturn.Rows.Add(dr);
}
return dtReturn;
}

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

Example: To use this method, just use the following code sample:

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

var vrCountry = from country in objEmpDataContext.CountryMaster
...

阅读全文...

<<紫川>>终于完结了

[ 2009-04-13 00:14:54 | 作者: progame ]
在不抱希望的情况下, 偶尔看了下连城网站, 发现居然更新了, 复制到手机里看, 发现居然完结了

这书是从什么时候开始写的呢, 看一段作者的自述:
2001年的六月夏天,猪还是一个青涩的、等待毕业的大四(百度)学生,一时信手抬笔,在一个小时四块钱的黑心网吧里写了一个小故事。
在当时,猪是万万没有想到这个信手而来的小故事竟会发展到两百五十万字的故事,甚至改变了自己一生的命运。
八年了,即将完结,回首过去,猪真心地感谢大家,感谢一直不离不弃的读者们,感谢那些在出书过程中不断地给猪鼓励和帮助的朋友、评论和编辑,没有你们的支持、鼓励和关注,猪是坚持不下来的。

正如以前看到一位读者说
她追此书硬是从自己读书追成了自己的小孩也开始读书
大家看得艰辛, 作者写得更艰辛
一辈子, 能够做件可以流传下来的事
值了
Securing Silverlight Application and WCF Service using ASP.Net Authentication Techniques
January 7, 2009 — Syed Mehroz Alam
Ads by Google
WPF Controls & Consulting
For Designers and Developers by the leading WPF experts - IdentityMine
www.blendables.com

Security is an issue that experts are discussing since the birth of Silverlight. A typical enterprise Silverlight application will consist of one or more Silverlight pages communicating with one or more WCF services. There are three major security concerns here:

Silverlight 2 supports communication with a WCF service in simple text (the basicHttpBinding), so anyone can use a packet sniffer (e.g. Fiddler) to read our data.
Anyone can access our WCF service, call its methods and get our data.
Anyone can download our Silverlight application (the .xap file), open it (since it is simple a zip file), extract the dlls and use Reflector to read all our code.
The first problem can be solved by securing the transmission via transport security (using https protocol). More on this can be found at msdn here. In this post, I will try to address the last two issues.

The good thing is that the Silverlight application and WCF service is hosted inside an ASP.NET website and luckily ASP.NET provides good tools around authentication so we can apply ASP.NET authentication techniques to secure those. The approach I like is to secure the entire ASP.NET web application using either Windows or Forms authentication and deny all anonymous users. This can be done by configuring the web.config as:

view plaincopy to clipboardprint?
<authentication mode="Windows"/> <!-- or Forms -->
<authorization>
<deny users="?"/>
</authorization>

<authentication mode="Windows"/> <!-- or Forms -->
<authorization>
<deny users="?"/>
</authorization>
This way, if anyone tries to access ...

阅读全文...
1