代码改变世界

How Is The Application Configuration File Protected From Tampering?

2012-04-10 10:11 by barbarossia, 207 阅读, 0 推荐, 收藏, 编辑
摘要:How is theapplication configuration file protected from tampering?The attack scenario: Can an "end user" check the database connection string to get the database privillage.The best way to encrypt configuration settings is with DPAPI, the Data Protection Application Programmer's Interf 阅读全文

Reading XML File

2012-03-21 09:32 by barbarossia, 159 阅读, 0 推荐, 收藏, 编辑
摘要:string xmlString = new FileInfo(@"d:\XMLFile1.xml").OpenText().ReadToEnd(); 阅读全文

一个简单的性能计数器:CodeTimer

2012-03-19 10:57 by barbarossia, 202 阅读, 0 推荐, 收藏, 编辑
摘要:http://blog.zhaojie.me/2009/03/codetimer.htmlThe source code download is:here 阅读全文

Update In Linq

2012-03-16 17:22 by barbarossia, 215 阅读, 0 推荐, 收藏, 编辑
摘要:http://stackoverflow.com/questions/3658028/linq-to-objects-updateAnd I write a code example to test perfomence.class Program { static void Main(string[] args) { List<Person> source = Generate(10000, (c) => { return c * 10; }); ... 阅读全文

Global Variables Example

2012-03-08 12:13 by barbarossia, 590 阅读, 0 推荐, 收藏, 编辑
摘要:You want to store global variablesin your ASP.NET site. Global variables don't need to be copied and only one is needed in the website application. We can use static properties to store single instance data.Overview:This ASP.NET example shows how to use global variables in web sites. It uses C# 阅读全文

How to: Create and Install Temporary Client Certificates in WCF During Development

2012-03-01 12:43 by barbarossia, 128 阅读, 0 推荐, 收藏, 编辑
摘要:http://msdn.microsoft.com/en-us/library/ff650751.aspx 阅读全文

The Crypt Design Pattern

2012-02-20 10:42 by barbarossia, 241 阅读, 0 推荐, 收藏, 编辑
摘要:We use the AES and RSA as the crypt algorithm.The sample is : public static EncryptedExportKeyList EncryptExportFile(string productKeysXml) { X509Certificate2 certificate = GetChinasoftCerticate(); byte[] productKeysData = Constants.DefaultEncoding.GetBytes(produc... 阅读全文

The Simple BackgroundWorker Sample

2012-02-20 10:41 by barbarossia, 254 阅读, 0 推荐, 收藏, 编辑
摘要:The code is:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Windows;using System.Windows.Controls;using System.Windows.Data;using System.Windows.Documents;using System.Windows.Input;using System.Windows.Media;using System.Windows.Media.Imaging;using Sys 阅读全文

The Async Work In WPF

2012-02-20 10:40 by barbarossia, 201 阅读, 0 推荐, 收藏, 编辑
摘要:The implement of async work in wpf.The source code: /// <summary> /// Executes the work in background to avoid hangs /// </summary> /// <param name="work"></param> protected void WorkInBackground(DoWorkEventHandler work, RunWorkerCompletedEventHandler onCompleted =. 阅读全文

How To Binding the DataContext Property To DataGrid

2012-02-20 10:40 by barbarossia, 339 阅读, 0 推荐, 收藏, 编辑
摘要:When we use the NVVM design mode in wpf develop. We also binding some property to datagrid as well. For example we can define datagrid to binding a list in such place. <DataGrid x:Uid="dgByKeys" ItemsSource="{Binding Keys}" ... 阅读全文