Thursday, January 27, 2011

VisualSVN Server的配置和使用方法 (ZT)

 

1. Create New  Repository on VisualSVN Server Manger

 

image

 

2. Use TortoiseSVN to check in new project source files to Server

 

image

 

image

3. Checking out project files to local machine

 

在本机创建文件夹,右键点击Checkout

 

image

 

4. Submit modified files to SVN Server/Add New files to SVN Server

提交修改过的文件到SVN服务器/

添加新文件到SVN服务器

在Modifed 文件夹上点击右键或在Model文件下的空白处点击右键,点击SVN Commit…弹出下面的窗体:

 

image

 

5. 更新本机代码与SVN服务器上最新的版本一致

更新的文件夹上点击右键或在该文件下的空白处点击右键,点击SVN Update,就可以

6. Show Difference and other options in Visual Studio 2008

 

image

Note: The file with yellow icon is modified file . We can see difference by clicking “show difference”

SharePoint 2010 SDK(ZT)

(SharePoint的开发技术包括后端开发和前端展现界面,甚至在最新提出的Workspace都是需要认真领会的。

在最新版的SDK包中主要提供了:

1. 最新的开发代码案例 例如:Silverlight List Viewer, Business Connectivity Services(BCS), 企业内容管理(ECM), User Profiles and Social Data

2. 说明文档的更新

3. 智能感知XML文件的更新

详细的内容可以参看MSDN上的两个主要Topics:

44个范例代码可以在MSDN Code Gallery中找到详细的介绍:

http://code.msdn.microsoft.com/sp2010sdk.

Wednesday, January 26, 2011

Configurator WCF Service Application

1. Create a WCF service Class library

2. Create a WCF Service with one svc file(no code behinding needed) ,just a simple svc file like the following (don’t forget to add reference)

<%@ ServiceHost Language="C#" Debug="true" Service="ConfiguratorServiceLibrary.ConfiguratorServiceLibrary" %>

 

3. Edit config file of WCF service ( modify contract , service name, binding ,etc)

 

4. Creating client application to consume these service.

Tuesday, January 25, 2011

SQL Server View VS Store Procedure (ZT)

 

1.

 

视图(regular view)不会对性能提升有什么帮助的,考虑性能因素的话,应该选择存储过程。
视图只不过是存储在sql server上的select语句罢了,当对视图请求时,sql server会像执行一句普通的select语句那样的执行视图的select语句,它的性能并不像人们想象得那么出色。
而存储过程在编译后可以生成执行计划,这使得每次执行存储过程的时候效率将会更高,这是存储过程,另外台提交参数的时候,使用存储过程将会减少网络带宽流量,这是存储过程相对于普通的sql语句在性能上的最大的优势。
当然,从sql   server2000/7.0版本开始普通的sql查询在执行后,它的执行计划将会被放入缓存中,以便下次执行的时候能够获得较高的性能,但是很久不使用的查询计划将会从高速缓存清理出去。

总之,从性能上来说存储过程要优于视图。

 

2.

 

为视图创建聚簇索引,只有这样才会显著地提高系统的性能。当在视图上创建了聚簇索引后,视图的结果集与有聚簇索引的表的数据集一样是存储在数据中的。

Monday, January 24, 2011

GetAllPossbileCombinations With C#

(ZT)

……………………………………..

tatic int counter = 0;
        static string[] m_Data = { "A", "B", "C", "D", "E" };
        static List<String> finalresult = new List<string>();

        static void Main(string[] args)
        {
            Dictionary<string, int> dic = new Dictionary<string, int>();
            for (int i = 0; i < m_Data.Length; i++)
            {
                counter++;
               // Console.WriteLine(counter.ToString() + " " + m_Data[i]);//如果不需要打印单元素的组合,将此句注释掉
                finalresult.Add(m_Data[i]);
                dic.Add(m_Data[i], i);
            }
            GetString(dic);

            Console.WriteLine("Final List Count:" + finalresult.Count.ToString());  
            foreach(string s in finalresult )
            {

                Console.WriteLine(s);
            }
        }

        static void GetString(Dictionary<string, int> dd)
        {
            Dictionary<string, int> dic = new Dictionary<string, int>();
            foreach (KeyValuePair<string, int> kv in dd)
            {
                for (int i = kv.Value + 1; i < m_Data.Length; i++)
                {
                    counter++;
                  //  Console.WriteLine(counter.ToString() + " "+kv.Key + m_Data[i]);
                    finalresult.Add(kv.Key +" " +m_Data[i]);
                    dic.Add(kv.Key + " " + m_Data[i], i);
                }
            }
            if (dic.Count > 0) GetString(dic);
        }

    }

……………………………….

Wednesday, January 12, 2011

Lamada Expession VS Query Expression in Linq

 

Sample Ciode:

 

…….

List<int> list = new List<int>();
            list.AddRange(new int[] { 20, 1, 4, 8, 9, 44 });

            // Anonymous method to find event number
            var r = list.FindAll(delegate(int i)
            {
                return i % 2 == 0;
            }
            ).ToList() ;

            // Linq : Lamada expression to find event number(method syntax)
            var r1 = list.FindAll((i) => i % 2 == 0).Select(i => i ).ToList();

//or : select is not required if no projection

  var r1 = list.FindAll((i) => i % 2 == 0).ToList();

            // Linq : Query expression to find event number(query syntax)

            var r2 = (from item in list
                      where item % 2 == 0
                      select item).ToList();

 

…….

Tuesday, January 11, 2011

Read/Write Excel Cell Value Via VBscript(ZT)

'==========================================================================
'
' VBScript Source File -- Created with SAPIEN Technologies PrimalScript 4.1
'
' NAME:
'
' AUTHOR: bo , bo
' DATE  : 1/11/2011
'
' COMMENT:
'
'==========================================================================

Function  GetCellValue(excelSheet, row, column, path)
on error resume Next
Set  Wshshell  = CreateObject ( "Wscript.shell" )
Set  ExcelApp  = CreateObject ( "excel.Application" )
        ExcelApp.Visible  = True
Set  newBook  =  ExcelApp.Workbooks.Open(path)
If   Err  = 0 Then
Set  excelSheet  =  ExcelApp.ActiveSheet
                GetCellValue  =  excelSheet.Cells(row, column)
                ExcelApp.Quit
                Wshshell.Popup GetCellValue, 2 , " EXCEL VALUE : " , 0 + 64
Else
                Wshshell.Popup  " Please confirm file exists  " , 3 , " file not exist " , 0 + 64
                ExcelApp.Quit
End If
End Function
'Call  GetCellValue( "Sheet1" , 1 , 2 , "C:\excel.xls" )

Function  WriteExcel(row,col,value,path)
Set  Wshshell  = Createobject ( "Wscript.shell" )
        Err  = 0
on error resume next
Dim  fso,f
Set  fso  = CreateObject ( "Scripting.FileSystemObject" )
Set  f  =  fso.GetFile(path)
Set  ExcelApp  = CreateObject ( "Excel.Application" )
        ExcelApp.Visible  = true
If   Err  = 0 Then
Set  newBook  =  ExcelApp.Workbooks.Open(path)
                newBook.Worksheets( 1 ).Activate
                newBook.Worksheets( 1 ).Cells(row,col).value = value
                newBook.Worksheets( 1 ).Name = "Sheet1"
                newBook.Save
                ExcelApp.Application.quit
set  newBook  = nothing
Set  ExcelApp  = Nothing
Elseif  Err  = 53 Then
Set  newBook  =  ExcelApp.Workbooks.Add
                newBook.Worksheets( 1 ).Activate
                newBook.Worksheets( 1 ).Cells(row,col).value = value               
                newBook.Worksheets( 1 ).Name = "Sheet1"
                newBook.SaveAs path
                ExcelApp.Application.quit
set  newBook  = nothing
Set  ExcelApp  = nothing
Else
                Wshshell.Popup  " Unknown error" ,  5 ,  " can not continue " , 0 + 32
End If
End Function
Call  WriteExcel( 3 , 3 , "sadfasdfasdf" , "c:\excel.xls" )

Monday, January 03, 2011

SSIS Deployment Tip

 

(1) Can create package via import/export wizard and save as ssis package.

(2) . Create a ssis project in BIDS and add the package created from last step.

(3) Check connection manager and execute task to make sure it is working properly.

(4) . Project—> [Project] Properties –> set create deployment true

(5) SSIS—> Package Configuration—>Enable package configuration and add a new xml config file

(6) Modifying config file for deployment ( this is very important )

(7) Deployment: click *. *deploymentmanifest in deployment folder to deploy

Helpful link :

 

http://www.cnblogs.com/invinboy/archive/2010/02/02/1661459.html