Monthly Archives: December 2011

? ????? 2012 ?????!

??????? ??????!

? ???? ?????????????? ??? ??? ??????? ?????????? ???? ??? ? ??????????? 2012 ?????! ??? ???????, ????? ? ????? ??? ???? ???????? ?????? ? ?????? – ??????? ? ???? ???? ? ??????????? ? ???????, ? ???? ??????? ?????????. ????? ???? ????? ???????? ???????, ????????? ? ??????? – ???????????????. ????????, Kinect, ??????????? ????????? ??????????? ?? ??????????.

????????, ??? ??? ??????? ??? ???????? – ???????. ?? ?? ???, ??? ????????????? – ?????????? ?????? ????? ???????????, ?????? ?????????????? ????????????????. ??? ?? ?????? – ????? ? ?????????, ?????? ????????? ??????? ????????? ?? ???????????? ????????????? ? ?? ???, ??? ?????????? ?????? ???? ????? ????? ? ???????.

? ????? ?????! ?????? ?? ???? ? ???? ??? ??? ????? ??????????? ????????? ??? ?????? ? ????????-???????? ??????????. ???????? ? HD-???????? ?? ????? ??????????????? ????????? ? ?????????!

P.S. ???? ?? ?????? ??????? ?????? ?????? ???????, ??? ?? ?????? ??????????? ???????????? ?????? ?????? ???????????.

Happy New Year from Microsoft All-In-One Code Framework

What a year!  So many exciting things have happened since last year. We have been so blessed this year again with your love and support, the breakthrough of 3 million downloads, 700 code samples, over 90% customer satisfaction, the winning of Global 2011 Microsoft Next award, the release of Sample Browser and Sample Browser VS extension, and many other new experiences and achievements.  Our team received lots of constructive feedback and kudos from you throughout the year, and we take action quickly to improve things.  Thank you!

We are looking forward to the New Year, and many coming new launches and growths.   For example, in early 2012, you can expect to see the birth of a new script library project targeting the ITPro audience.   Similar to Microsoft All-In-One Code Framework for developers, this new script library will be a centralized system administration script library driven by IT professionals’ real-world pains and needs observed in TechNet Forums, communities and IT support calls.   The goal is to provide customer-driven scripts for Microsoft products and reduce IT professionals’ efforts in solving typical system admins tasks in Windows Servers, SQL Servers, Exchanges, Office 365, SharePoint Servers, Windows Clients, and Office Clients.  We are just getting started and have several scripts in the pipeline; this will continue to grow.   Additionally, you can also expect to see the release of a new version of Sample Browser.   We expanded the Sample Browser to search for all samples in MSDN Samples Gallery.  With this new version, you will be able to search and download not only 700+ All-In-One Code Framework samples, but also thousands of other Microsoft and community samples.  With this effort, we hope to ease your effort in looking for and managing the wanted code samples.

The holiday season is such a special time for us, a time of new beginnings. Also a time of saying many thanks to all of you. We sincerely wish you a very happy and blessed New Year!

Blessing to all of you!

- Microsoft All-In-One Code Framework Team

????????

[??????] I’m a phony. Are you?

[??????] 2011-08-17 09:15

Phony???phoney (f?’n?) ???pho·ni·er, pho·ni·est

1.

a. ????????????????

b. ??????????

2. ????????????????

3.

a. ???????

b. ????

??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

???

“????????????13????????CS??????????????????????????????”

???????????????????

?????????30???????????????3???????????DNS???????????27??????????????27????????27?????????????????????????????????????????????????

???????Zero????????????????122?????????????????????????????????????????

?21??????????????????????????????????????????????????????????????????????????????????

???????????????Polyglot ????????????F#???????????????????????Ruby?????????

?????????????????????????????????????????????????burrito????????????????????????????????????????????????????????????????????????????????????????????????????????????????

??????????????????????????????????????????????????????????????????????????????????????????????

?????????????????

????????????????????????????????????????????????????????????????????????? ?????????

????????????????????????????????????????

??????????????????????????????????????????????????????? ????????????

????????????????????????????????

??????????????????????

??????????????????????????????????????????????????

??????????????????????????????????????????????????????“????????????????”??????????

???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

?????????????????????????????????????????????????????????????

??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????“????????”??“???????”??????????????????????????????????????????

???????????????????????????????????“??????????????????”???????“????”??????“??????”????????????????????????????????????????????????????????????????????????????????????????IT?????????????????????????????

??????????????????????????

· ???????????????????????????????????????????

· ?????????????????????????????????????????????“?????10??????????”???????????????????????????????????

· ???????????stack overflow????????????????????????????????????????????????????????????????????????????????????????????????????

· ????????????????????????????????????????????

· ????????????????????????????????????????????????????

· ??????????????????????????????????????????

· ??????????????????????????????????????????????????????????????

· ???????????????????????????????????????????????????????

?????????????????????????“?????????”????????2???IT???????IT????????????

????????????????????????????????????????IT?????????????????1%???????????????????????????????????????????????????????????????????????????????????????????????????????

????????Dave Ward??????

??????????????????????????????????????????????????????????????????

???????“??”??“??”???????????????????????????????????????????????????????????????

?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

????????????????????Google+ ??????????

??“????”?

?????59—??????Irony.NET?????

[??????]The Weekly Source Code 59 – An Open Source Treasure: Irony .NET Language Implementation Kit

[??????]2011-10-14 08:41

clip_image001

?????????????????????????????????????????????????????????????????“?????”?????????15????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

????????????????????????????????????????????????????“Irony”.NET??????CodePlex???????

Irony????.NET?????????????????yacc/lex???????Irony?????meta?????????????????????????????Irony?????????????????????????C#??????Irony????????????????????C#??????????????????????C#??????????????????????

Irony??????“C#??????????SQL?GwBasic?JSON?”???????????????????????ANTLR????LL(*) ???????Irony????LALR????????????????

???????????????????SQL???

SELECT ID, Title FROM Shows WHERE ID = 1

????irony???????????Irony???

clip_image002

????????????????????BNF?Backus-Naur Form?????????GOLD Meta?????DSL???????????????????????????????????????????????????????

???????Irony????????????

???????yacc/lex???????Irony?????meta?????????????????????????????Irony?????????????????????????C#??????

Irony?Roman????????C#??????DSL???????????????????C#???????????????????DSL?????????????????????????????????GOLD????????????????????????

clip_image003

??????Grammar?????????????????????

   1: [Language("SQL", "89", "SQL 89 grammar")]

   2: public class SqlGrammar : Grammar {

   3:    public SqlGrammar() : base(false) { //SQL is case insensitive

   4:    ...

????????????????????SQL?????

   1:  

   2: ! 

   3: =============================================================================

   4: ! 

   5: Select Statement

   6: ! 

   7: =============================================================================

   8: <Select 

   9: Stm> ::= SELECT <Columns> <Into Clause> <From Clause> 

  10: <Where Clause> <Group Clause> <Having Clause> <Order 

  11: Clause>

  12: <Columns> ::= <Restriction> '*'

  13: | 

  14: <Restriction> <Column List>

  15: ...snip for 

  16: clarity...

  17: <Restriction> ::= ALL

  18: | 

  19: DISTINCT

  20: |

  21: <Aggregate> ::= Count '(' '*' ')'

  22: | Count '(' 

  23: <Expression> ')'

  24: | Avg '(' <Expression> ')'

  25: | Min '(' 

  26: <Expression> ')'

  27: | Max '(' <Expression> ')'

  28: | StDev '(' 

  29: <Expression> ')'

  30: | StDevP '(' <Expression> ')'

  31: | Sum '(' 

  32: <Expression> ')'

  33: | Var '(' <Expression> ')'

  34: | VarP '(' 

  35: <Expression> ')'

  36: <Into Clause> ::= INTO Id

  37: |

  38: <From 

  39: Clause> ::= FROM <Id List> <Join Chain>

  40: <Join Chain> ::= 

  41: <Join> <Join Chain>

  42: |

  43: ...snip for clarity...

?????????????????????????????????????????????

   1: //Select stmt

   2: selectStmt.Rule = SELECT + selRestrOpt + selList + intoClauseOpt + fromClauseOpt + whereClauseOpt +

   3:                   groupClauseOpt + havingClauseOpt + orderClauseOpt;

   4: selRestrOpt.Rule = Empty | "ALL" | "DISTINCT";

   5: selList.Rule = columnItemList | "*";

   6: columnItemList.Rule = MakePlusRule(columnItemList, comma, columnItem);

   7: columnItem.Rule = columnSource + aliasOpt;

   8: aliasOpt.Rule = Empty | asOpt + Id; 

   9: asOpt.Rule = Empty | AS;

  10: columnSource.Rule = aggregate | Id;

  11: aggregate.Rule = aggregateName + "(" + aggregateArg + ")";

  12: aggregateArg.Rule = expression | "*"; 

  13: aggregateName.Rule = COUNT | "Avg" | "Min" | "Max" | "StDev" | "StDevP" | "Sum" | "Var" | "VarP";

  14: intoClauseOpt.Rule = Empty | INTO + Id;

  15: fromClauseOpt.Rule = Empty | FROM + idlist + joinChainOpt; 

  16: joinChainOpt.Rule = Empty | joinKindOpt + JOIN + idlist + ON + Id + "=" + Id;

  17: joinKindOpt.Rule = Empty | "INNER" | "LEFT" | "RIGHT";

  18: whereClauseOpt.Rule = Empty | "WHERE" + expression;

  19: groupClauseOpt.Rule = Empty | "GROUP" + BY + idlist;

  20: havingClauseOpt.Rule = Empty | "HAVING" + expression; 

  21: orderClauseOpt.Rule = Empty | "ORDER" + BY + orderList;

??????????????????????????????

   1: var SELECT = ToTerm("SELECT"); 

   2: var FROM = ToTerm("FROM");

   3: var AS = ToTerm("AS");

???????????????????????????C#?????BNF?????DSL????????C#??????????????????????????SQL GOLD????259????????C#????247??????????????????????????????????C#???????????????????????????????Roman??Irony???????????????????????????????????????????

· "Mini" Python – ~140?

· Java – ~130?

· Scheme – ~200 ?

· JSON – 39 ?

????????JSON??????

   1: using System;

   2: using System.Collections.Generic;

   3: using System.Linq;

   4: using System.Text;

   5: using Irony.Parsing;

   6:  

   7: namespace Irony.Samples.Json {

   8:   [Language("JSON", "1.0", "JSON data format")]

   9:   public class JsonGrammar : Grammar {

  10:     public JsonGrammar() {

  11:       //Terminals

  12:       var jstring = new StringLiteral("string", "\"");

  13:       var jnumber = new NumberLiteral("number");

  14:       var comma = ToTerm(","); 

  15:        

  16:       //Nonterminals

  17:       var jobject = new NonTerminal("Object"); 

  18:       var jobjectBr = new NonTerminal("ObjectBr");

  19:       var jarray = new NonTerminal("Array"); 

  20:       var jarrayBr = new NonTerminal("ArrayBr");

  21:       var jvalue = new NonTerminal("Value");

  22:       var jprop = new NonTerminal("Property"); 

  23:  

  24:       //Rules

  25:       jvalue.Rule = jstring | jnumber | jobjectBr | jarrayBr | "true" | "false" | "null";

  26:       jobjectBr.Rule = "{" + jobject + "}";

  27:       jobject.Rule = MakeStarRule(jobject, comma, jprop);

  28:       jprop.Rule = jstring + ":" + jvalue;

  29:       jarrayBr.Rule = "[" + jarray + "]";

  30:       jarray.Rule = MakeStarRule(jarray, comma, jvalue);

  31:  

  32:       //Set grammar root

  33:       this.Root = jvalue;

  34:       MarkPunctuation("{", "}", "[", "]", ":", ",");

  35:       this.MarkTransient(jvalue, jarrayBr, jobjectBr);

  36:  

  37:     }//constructor

  38:   }//class

  39: }//namespace

????????????????????????????????C#????????????????????

????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

???????????????????????????????????????????????????????????????

????

· Irony??Roman (????)

· CodePlex?Irony – 10????Alpha???

· Irony?????????

??: 2009?Roman?LangNet???Irony

?????59—??????Irony.NET?????

[??????]The Weekly Source Code 59 – An Open Source Treasure: Irony .NET Language Implementation Kit

[??????]2011-10-14 08:41

clip_image001

?????????????????????????????????????????????????????????????????“?????”?????????15????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

????????????????????????????????????????????????????“Irony”.NET??????CodePlex???????

Irony????.NET?????????????????yacc/lex???????Irony?????meta?????????????????????????????Irony?????????????????????????C#??????Irony????????????????????C#??????????????????????C#??????????????????????

Irony??????“C#??????????SQL?GwBasic?JSON?”???????????????????????ANTLR????LL(*) ???????Irony????LALR????????????????

???????????????????SQL???

SELECT ID, Title FROM Shows WHERE ID = 1

????irony???????????Irony???

clip_image002

????????????????????BNF?Backus-Naur Form?????????GOLD Meta?????DSL???????????????????????????????????????????????????????

???????Irony????????????

???????yacc/lex???????Irony?????meta?????????????????????????????Irony?????????????????????????C#??????

Irony?Roman????????C#??????DSL???????????????????C#???????????????????DSL?????????????????????????????????GOLD????????????????????????

clip_image003

??????Grammar?????????????????????

   1: [Language("SQL", "89", "SQL 89 grammar")]

   2: public class SqlGrammar : Grammar {

   3:    public SqlGrammar() : base(false) { //SQL is case insensitive

   4:    ...

????????????????????SQL?????

   1:  

   2: ! 

   3: =============================================================================

   4: ! 

   5: Select Statement

   6: ! 

   7: =============================================================================

   8: <Select 

   9: Stm> ::= SELECT <Columns> <Into Clause> <From Clause> 

  10: <Where Clause> <Group Clause> <Having Clause> <Order 

  11: Clause>

  12: <Columns> ::= <Restriction> '*'

  13: | 

  14: <Restriction> <Column List>

  15: ...snip for 

  16: clarity...

  17: <Restriction> ::= ALL

  18: | 

  19: DISTINCT

  20: |

  21: <Aggregate> ::= Count '(' '*' ')'

  22: | Count '(' 

  23: <Expression> ')'

  24: | Avg '(' <Expression> ')'

  25: | Min '(' 

  26: <Expression> ')'

  27: | Max '(' <Expression> ')'

  28: | StDev '(' 

  29: <Expression> ')'

  30: | StDevP '(' <Expression> ')'

  31: | Sum '(' 

  32: <Expression> ')'

  33: | Var '(' <Expression> ')'

  34: | VarP '(' 

  35: <Expression> ')'

  36: <Into Clause> ::= INTO Id

  37: |

  38: <From 

  39: Clause> ::= FROM <Id List> <Join Chain>

  40: <Join Chain> ::= 

  41: <Join> <Join Chain>

  42: |

  43: ...snip for clarity...

?????????????????????????????????????????????

   1: //Select stmt

   2: selectStmt.Rule = SELECT + selRestrOpt + selList + intoClauseOpt + fromClauseOpt + whereClauseOpt +

   3:                   groupClauseOpt + havingClauseOpt + orderClauseOpt;

   4: selRestrOpt.Rule = Empty | "ALL" | "DISTINCT";

   5: selList.Rule = columnItemList | "*";

   6: columnItemList.Rule = MakePlusRule(columnItemList, comma, columnItem);

   7: columnItem.Rule = columnSource + aliasOpt;

   8: aliasOpt.Rule = Empty | asOpt + Id; 

   9: asOpt.Rule = Empty | AS;

  10: columnSource.Rule = aggregate | Id;

  11: aggregate.Rule = aggregateName + "(" + aggregateArg + ")";

  12: aggregateArg.Rule = expression | "*"; 

  13: aggregateName.Rule = COUNT | "Avg" | "Min" | "Max" | "StDev" | "StDevP" | "Sum" | "Var" | "VarP";

  14: intoClauseOpt.Rule = Empty | INTO + Id;

  15: fromClauseOpt.Rule = Empty | FROM + idlist + joinChainOpt; 

  16: joinChainOpt.Rule = Empty | joinKindOpt + JOIN + idlist + ON + Id + "=" + Id;

  17: joinKindOpt.Rule = Empty | "INNER" | "LEFT" | "RIGHT";

  18: whereClauseOpt.Rule = Empty | "WHERE" + expression;

  19: groupClauseOpt.Rule = Empty | "GROUP" + BY + idlist;

  20: havingClauseOpt.Rule = Empty | "HAVING" + expression; 

  21: orderClauseOpt.Rule = Empty | "ORDER" + BY + orderList;

??????????????????????????????

   1: var SELECT = ToTerm("SELECT"); 

   2: var FROM = ToTerm("FROM");

   3: var AS = ToTerm("AS");

???????????????????????????C#?????BNF?????DSL????????C#??????????????????????????SQL GOLD????259????????C#????247??????????????????????????????????C#???????????????????????????????Roman??Irony???????????????????????????????????????????

· "Mini" Python – ~140?

· Java – ~130?

· Scheme – ~200 ?

· JSON – 39 ?

????????JSON??????

   1: using System;

   2: using System.Collections.Generic;

   3: using System.Linq;

   4: using System.Text;

   5: using Irony.Parsing;

   6:  

   7: namespace Irony.Samples.Json {

   8:   [Language("JSON", "1.0", "JSON data format")]

   9:   public class JsonGrammar : Grammar {

  10:     public JsonGrammar() {

  11:       //Terminals

  12:       var jstring = new StringLiteral("string", "\"");

  13:       var jnumber = new NumberLiteral("number");

  14:       var comma = ToTerm(","); 

  15:        

  16:       //Nonterminals

  17:       var jobject = new NonTerminal("Object"); 

  18:       var jobjectBr = new NonTerminal("ObjectBr");

  19:       var jarray = new NonTerminal("Array"); 

  20:       var jarrayBr = new NonTerminal("ArrayBr");

  21:       var jvalue = new NonTerminal("Value");

  22:       var jprop = new NonTerminal("Property"); 

  23:  

  24:       //Rules

  25:       jvalue.Rule = jstring | jnumber | jobjectBr | jarrayBr | "true" | "false" | "null";

  26:       jobjectBr.Rule = "{" + jobject + "}";

  27:       jobject.Rule = MakeStarRule(jobject, comma, jprop);

  28:       jprop.Rule = jstring + ":" + jvalue;

  29:       jarrayBr.Rule = "[" + jarray + "]";

  30:       jarray.Rule = MakeStarRule(jarray, comma, jvalue);

  31:  

  32:       //Set grammar root

  33:       this.Root = jvalue;

  34:       MarkPunctuation("{", "}", "[", "]", ":", ",");

  35:       this.MarkTransient(jvalue, jarrayBr, jobjectBr);

  36:  

  37:     }//constructor

  38:   }//class

  39: }//namespace

????????????????????????????????C#????????????????????

????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

???????????????????????????????????????????????????????????????

????

· Irony??Roman (????)

· CodePlex?Irony – 10????Alpha???

· Irony?????????

??: 2009?Roman?LangNet???Irony

Storing IIS 7.5 WebDAV Properties in NTFS Alternate Data Streams

Two months ago Microsoft published an update for the WebDAV module that shipped with IIS 7.5 in Windows 7 and Windows Server 2008 R2, and this update is documented in the Microsoft Knowledge Base article ID 2593591:

FIX: A hotfix is available that enables WebDAV to store the properties of file resources by using NTFS alternate data streams in IIS 7.5

This update enables administrators to configure the IIS 7.5 WebDAV module to store WebDAV-based properties in NTFS alternate data streams instead of properties.dav files. By way of explanation, WebDAV has two HTTP methods – PROPFIND and PROPPATCH – which enable WebDAV clients to store custom properties on a WebDAV server. These properties may contain anything that makes sense to the WebDAV client. For example, if you were creating a WebDAV client that stored Microsoft Office documents on a WebDAV server, you could store metadata in WebDAV properties for each document, like the author’s name, document abstract, etc.

By default, the IIS 7.5 WebDAV module stores properties in system files in each folder of a website that are called properties.dav. These files are essentially text-based INI files that contain the encoded WebDAV properties for the various files in each folder. In contrast, the WebDAV functionality in IIS 6 had used NTFS alternate data streams to store WebDAV properties, which are described in the following Microsoft TechNet article:

The NTFS File System

After we shipped IIS 6, we received a lot of complaints from customers who were losing their WebDAV properties when they were copying their website files between NTFS and FAT file systems. This was expected behavior – NTFS alternate data streams will be removed when you copy files from NTFS to FAT. To remedy this situation, in IIS 7.0 we decided to switch to using INI-based functionality in order to prevent losing custom WebDAV properties when files are copied between disparate file systems.

When we were designing IIS 7.5, we wanted to add optional support for storing WebDAV properties in NTFS alternate data streams, and we wanted to do so because NTFS alternate data streams might perform faster when you are working with larger websites; however, we ran out of time to implement that functionality before we shipped Windows 7 and Windows Server 2008 R2. That being said, we still wanted to implement the feature, and the update that I listed at the beginning of this blog contains the functionality that is required to enable storing WebDAV properties in NTFS alternate data streams.

Enabling Alternate Data Streams for WebDAV Properties

The above information is good news for anyone who is storing large quantities of WebDAV properties, so your next logical question might be: “How do I enable NTFS alternate data streams for WebDAV properties ?”

Actually, it’s really simple. In the KB article that I listed in the beginning of this blog, I documented two methods that show you how to enable storing WebDAV properties in NTFS alternate data streams:

  1. By modifying your applicationHost.config file
  2. By using AppCmd.exe

For the sake of completeness, I will repost some of the information here. ;-)

Method #1: Modifying your applicationHost.config file

You can enable storing WebDAV properties in alternate data streams for the simple property provider by adding a “useAlternateDataStreams” attribute to the property provider’s registration settings in your applicationHost.config file, which is highlighted in the following global configuration snippet:

<webdav>
  <globalSettings>
    <propertyStores>
      <add name="webdav_simple_prop"
        image="%windir%\system32\inetsrv\webdav_simple_prop.dll"
        image32="%windir%\syswow64\inetsrv\webdav_simple_prop.dll"
        useAlternateDataStreams="true" />
    </propertyStores>
    <lockStores>
      <add name="webdav_simple_lock"
        image="%windir%\system32\inetsrv\webdav_simple_lock.dll"
        image32="%windir%\syswow64\inetsrv\webdav_simple_lock.dll" />
    </lockStores>
  </globalSettings>
  <authoring>
    <locks enabled="true" lockStore="webdav_simple_lock" />
    <properties>
      <clear />
      <add xmlNamespace="*" propertyStore="webdav_simple_prop" />
    </properties>
  </authoring>
  <authoringRules />
</webdav>

Once you have enabled the feature, you have to restart IIS in order for it to take effect.

Method #2: Using AppCmd.exe

I wrote the following batch file for the KB article, which uses AppCmd.exe to enable the NTFS alternate data streams functionality, and it automatically restarts IIS for you:

pushd "%SystemRoot%\System32\Inetsrv"

iisreset /stop

appcmd.exe set config -section:system.webServer/webdav/globalSettings -propertyStores.[name='webdav_simple_prop'].useAlternateDataStreams:true /commit:apphost

iisreset /start

popd

Migrating IIS 7 WebDAV Properties into Alternate Data Streams

Once you’ve enabled storing WebDAV properties in alternate data streams, you are presented with a new challenge: “How do I migrate my existing WebDAV properties?”

Here’s the situation, once you have enabled the alternate data streams feature, the WebDAV property provider is going to ignore any properties that have already been set in properties.dav files. With this in mind, I wrote a script that will migrate all of the WebDAV properties from all of the properties.dav files in a website into their corresponding per-file NTFS alternate data streams.

To use the following script, you will need to update the folder path in the third line of the script with the path to your website. Once you have done that, you can run the script to migrate your existing WebDAV properties.

NOTE: You need to run this script as an administrator!

Option Explicit

Dim arrFolderTree, intFolderCount

arrFolderTree = BuildFolderTree("C:\inetpub\wwwroot")

For intFolderCount = 1 To UBound(arrFolderTree)
  MigratePropertiesToADS arrFolderTree(intFolderCount)
Next

Sub MigratePropertiesToADS(strFolderPath)
  On Error Resume Next

  ' Declare all our variables
  Dim objTempFSO, objTempFolder
  Dim objTempPropertiesFile, objTempAlternateDataStream
  Dim strTempLine, strTempObjectName, blnTempOpenStream
  Const strTempPropertiesDAV = "\properties.dav"
  Const strTempAlternateDataStream = ":properties.dav:$DATA"

  ' Create a file system object.
  Set objTempFSO = WScript.CreateObject("Scripting.FileSystemObject")

  ' Flag the function as having a closed output stream.
  blnTempOpenStream = False

  ' Retrieve a folder object for the path.
  Set objTempFolder = objTempFSO.GetFolder(strFolderPath)

  ' Check for a properties.dav file in the current folder.
  If objTempFSO.FileExists(objTempFolder.Path & strTempPropertiesDAV) Then
    ' Open the properties.dav file for the current folder.
    Set objTempPropertiesFile = objTempFSO.OpenTextFile(objTempFolder.Path & _
      strTempPropertiesDAV,1,False,-1)
    ' Loop through the properties.dav file.
    Do While Not objTempPropertiesFile.AtEndOfStream
      ' Retrieve a line from the properties.dav file.
      strTempLine = Trim(objTempPropertiesFile.ReadLine)
      ' Check if it's a section heading.
      If Left(strTempLine,1) = "[" And Right(strTempLine,1) = "]" Then
        ' Parse the name of the object (file/folder).
        strTempObjectName = Replace(Trim(Mid(strTempLine,2,Len(strTempLine)-2)),"/","\")
        ' Strip off a backslash from the parent folder.
        If Len(strTempObjectName) = 1 Then strTempObjectName = ""
        ' Check to see if the file/folder exists.
        If objTempFSO.FileExists(objTempFolder.Path & _
             strTempObjectName) Or objTempFSO.FolderExists(objTempFolder.Path & _
             strTempObjectName) Then
          ' Create a file object for the alternate data stream.
          Set objTempAlternateDataStream = objTempFSO.CreateTextFile(objTempFolder.Path & _
             strTempObjectName & _
             strTempAlternateDataStream,True,-1)
          ' Write the WebDAV section header.
          objTempAlternateDataStream.WriteLine "[WebDAV]"
          ' Flag the function as having an open output stream.
          blnTempOpenStream = True
        Else
          ' Flag the function as having a closed output stream.
          blnTempOpenStream = False
        End If
      Else
        ' Check if we have an open output stream.
        If blnTempOpenStream = True Then
          ' Output a property.
          objTempAlternateDataStream.WriteLine strTempLine
        End If
      End If
    Loop
    ' Close the properties.dav file.
    objTempPropertiesFile.Close
  End If
  Set objTempFSO = Nothing
End Sub

Function BuildFolderTree(strTempBaseFolder)
  On Error Resume Next

  ' Declare all our variables
  Dim objTempFSO
  Dim objTempFolder
  Dim objTempSubFolder
  Dim lngTempFolderCount
  Dim lngTempBaseCount

  ' Create our file system object.
  Set objTempFSO = WScript.CreateObject("Scripting.FileSystemObject")

  ' Define the initial values for our folder counters.
  lngTempFolderCount = 1
  lngTempBaseCount = 0

  ' Dimension an array to hold the folder names.
  ReDim strTempFolders(1)

  ' Store the root folder in our array.
  strTempFolders(lngTempFolderCount) = strTempBaseFolder

  ' Loop while we still have folders to process.
  While lngTempFolderCount <> lngTempBaseCount
    ' Set up a folder object to a base folder.
    Set objTempFolder = objTempFSO.GetFolder(strTempFolders(lngTempBaseCount+1))
    ' Loop through the collection of subfolders for the base folder.
    For Each objTempSubFolder In objTempFolder.SubFolders
      ' Increment our folder count.
      lngTempFolderCount = lngTempFolderCount + 1
      ' Increase our array size
      ReDim Preserve strTempFolders(lngTempFolderCount)
      ' Store the folder name in our array.
      strTempFolders(lngTempFolderCount) = objTempSubFolder.Path
    Next
    ' Increment the base folder counter.
    lngTempBaseCount = lngTempBaseCount + 1
  Wend

  ' Return the array of folder names.
  BuildFolderTree = strTempFolders

End Function

In Closing

I have a couple final notes for you to consider:

  • Enabling NTFS alternate data streams is a global WebDAV setting; you cannot do this on a per-site basis.
  • As with IIS 6, once you enable storing WebDAV properties in NTFS alternate data streams, you will lose your WebDAV properties if you copy your files between NTFS and FAT file systems.

RFC????????????WebPI?????

[??????]RFC: Web Platform Installer (WebPI) with an offline feed mode for bandwidth savings

[??????]2011-09-24 07:45

???????????????????????????????????????Visual Studio???????????????????3G????????????ASDL??????512kbps???????????????????????????????????????????????????????????????????????????????????????????????

???????????????????????????????????Redmond Reality Distortion Field???????????????35megabit??????

????????????????????????????????????????????????????????????????????????????

??????WebPI????????????????WebPI??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

????????

????????????????????50??????????????50????x gig??????????IS????????????????????

??????????????????????????????????????????DVD???????????????????????????????????????????

WebPI????????“??ID”????ID???????????????ID??????????????????????????“??????”??????????URL?http://www.microsoft.com/web/gallery/install.aspx?appid=VWDorVS2010SP1Pack?

??“VWDorVS2010SP1Pack”???????????????????ID??????????????ID????????????????????http://www.microsoft.com/web/gallery/install.aspx?appid=MVC??VS2010??ASP.NET MVC 3????????“?”????????ID?????????????

?????????wpiutil.exe????????????????????????????????????????????????????????????

????Atom Feed??????????????ID????feed?https://go.microsoft.com/?linkid=9767054???????????????????????????????

?????WebpiCmdLine.exe /list:all????????????????????????????????ID?

Current language of installers is English

–Previously Installed Products
ID Title
—————————————-
AppFabric Windows Server AppFabric
AppFabricSetup Windows Server AppFabric Setup
*SNIP*
MVC2 ASP.NET MVC 2
MVC3 ASP.NET MVC 3 (Visual Studio 2010)
MVC3Loc ASP.NET MVC 3 Tools Update Language Packs
MVC3Runtime ASP.NET MVC 3 Runtime
*SNIP*
–Applications
ID Title
—————————————-
AcquiaDrupal Acquia Drupal
Atlas Atlas
*SNIP*
Umbraco Umbraco CMS
WordPress WordPress

Scott???????????????ID????GUI?????????????????“??ID?”??????

clip_image001[4]

???????????

C:\>wpiutil.exe /create-shadow /shadow-path:c:\webpicache /product-ids:MVC3;IISExpress
Loading products in webpi feeds …
Creating shadow for following products:
MVC3
NETFramework4
WindowsImagingComponent
MVC3Installer
IISExpress
Processing feed: ‘https://go.microsoft.com/?linkid=9767054′
Processing resources …
Processing product entries …
Processing product entry: ‘MVC3Installer’.
Processing product entry: ‘MVC3′.
Processing product entry: ‘NETFramework4′.
Processing product entry: ‘IISExpress’.
Processing product entry: ‘WindowsImagingComponent’.
Done.

?????????????????????????????????

clip_image002[4]

???????????????????feed?????????feed?????????????????????????????????????????????????

C:\>WebpiCmdLine.exe /xml:"C:\webpicache\feeds\shadowfeeds\shadow-webproductlist.xml" /List:All
Successfully loaded metadata from feed C:\webpicache\feeds\shadowfeeds\shadow-webproductlist.xml
Current language of installers is English
–Available Products
ID Title
—————————————-
MVC3Installer ASP.NET MVC 3 Tools Update Installer
IISExpress IIS 7.5 Express
MVC3 ASP.NET MVC 3 (Visual Studio 2010)
NETFramework4 Microsoft .NET Framework 4

???????????

C:\>WebpiCmdLine.exe /xml:"C:\webpicache\feeds\shadowfeeds\shadow-webproductlist.xml" /Products:MVC3

???????????????????

· ?????Visual???????????????????????????3G???????????????????56meg??345kb?

· ????feed??????GUI????????

· ???????vs????????????????UNC???????????????WebPI????

· ????????BITS?????????????Windows???????????????????

· “??”??????????????????Windows??????????????????

· ?????????????feed??????????????NuGet?Visual Studio 2010????????WebPI??MSI?feed????

· ??????????????????????

· ???????????IT????????????WebPI?????????

· ??????????????? c:\webpicache or .\webpicache ??????????

???????????????????????????????????????

???????????????????????????

· ???????

· ??????

· ?????????

· ??GUI????????

· ?????????

· ??????????????????

?????????????

?????24-???-.NET????????????????

[??????]The Weekly Source Code 24 – Extensibility Edition – PlugIns, Providers, Attributes, AddIns and Modules in .NET

[??????]2008-04-18 01:43

???????????????????????????????????????????????????????????????????????????????????????????“?????”?????24??

“??”???????framework????????????????????Gang of Four Patterns using C# over here.?????C#D??????

???????????????????????????xUnit.NET????????????????????????/??????????"HanselTest2000"??????2008?3???Miguel Castro?????Sexy Extensibility Patterns?CINNUG?????????Miguel?????????CodeBreeze?????/???????????DNRTV?????????Windows Live Writer?WLW SDK??????

?????????????????????????????????????????????????????????????????????????

??????????????????????????????????????VBA??PowerShell???????????????????????????-API?????????????????????????????????????????System.AddIn,???????????????????????????????????

xUnit.NET
xUnit.NET?Brad Wilson?Jim Newkirk????NUnit??)?????????????????????????????????“???????????????????”????????????????????????????????????MSBuild???Resharper?TestDriven.NET?????????????????????????

xUnit.NET?????????????????????????????????“????????“???????????????????

???????Visual Studio???“???????”???????????????????????“??/??????????”??????????????????

??????????????????????????NET 3.5-?????xunitext?xunitext35????????“??”?????????????????????????

??????????????????????????????????

clip_image002

?BeforeAfterTest????????????????????[Fact]???????????????[Test]:

clip_image004

???Before()?After()???????????

?????????????????xUnit.NET????????[RunWith]?????????????????????"run this test with nUnit."?????????????????[RunWith(typeof(MyRunner)]????????????

clip_image006

nUnitCommand??????????ITestCommand???“??????????????????”

clip_image008

???????????????????“?????”?????xUnit.NET????????????????????????????????????????????????????????????????????????????????

NUnitCommand???????NUnit SDK/API???????????????xUnit.NET????Nunit??????????????????????????

?????????????????????IComparer<T>??????????????Asserts????Assert.Equal?Assert.Contains?Assert.InRange?????????????????Icomparer?????????

clip_image010??

?????????????????????????????????????????????????????????Moq ? xUnit.NET????????????????????????????????

???????

???????????????????????“??”???“??”?“??”?Miguel?CINNUG????????????????C#?VB?????

Miguel????????????????????

??? – ??????????
??-??????
?? – ??????????????

???????????????????ASP.NET 2.0?????????????????????????????“??”??????????????????????????????IOC??????????

???????????????????????????:

clip_image011

????????????????????????????????????ProviderFactory??????????????

clip_image013

?????? ???????Miguel??????????????????????????J

???????????????????

clip_image015

??????????????????????????????????????????????????

clip_image017

?Miguel??????????????????????HttpModules??????????????????????????

clip_image019

????????????????????????????“??”???????????????????????????????????????????????????????????????????????????

????????????????ModuleEvents????????????????????????????????????????????????????

clip_image021

????????

clip_image023

????????????????????????????????????Miguel????????????????????????????PPT?

???????????????????????????????????????????????????????????????????????????????????????????????

Windows Live Writer

????Windows Live Writer???????????????????????????????????????????????????????Go download it now???????????3??????(???MSDN)?

API????????Writer ????????????????????"Blog This"??
??????API??Writer??????????????????????
??????API???Writer??????????????????

?????????????????????API???????????????????????????????to extend the Windows Live Writer UI using only an XML file for DasBlog??????????????????XML???????????????

?

?????API????????????“??”???WLW????????????85????

??????????Travis’s CueCat??????CueCat Windows Live Writer?????????????????Monthly Reading List?????????????????????????????????????????????????????

????????????Coding4Fun???????????????????????

clip_image025

Windows Live Writer????????????????????????????????????????????????????????????HTML????????????????????????????Joe Cheng?????????????????????????????

WLW????????????????????????????

clip_image027

?????????????????????????????????????URL????GUID?????????"Hello World"?????????????WinForm??????????????WLW???HTML?????????????????????DialogResult?????????????????????????????????????????????????????????????????????????????

??????????????????????

C++ small gotcha – 3

Have two class as below:

 

struct MyBase

{

  __int64 x;

  __int64 y;

  MyBase()

  {

          memset(this, 0, sizeof(MyBase));

  }

};

 

struct MyDerived: public MyBase

{

  int z;

  MyDerived():MyBase(), z(0)

  {}

};

 

Then create two objects as below, and then compare these two
objects with memcmp, do you think the c compare will be equal since the
constructor has initialized all the members of the objects to be 0?

MyDerived obj1;
MyDerived obj2;
 
if (memcmp(&obj1, &obj2, sizeof(MyDerived)) == 0)
{
        cout << "equal" << endl;
}

 

The answer is no. Since due to data alignment, the size of
MyDerived is 24 bytes, although the constructor has initialized x, y and z to
0, there are still 4 bytes keeps uninitialized, so they may be equal or not.

C++ small gotcha – 3

Have two class as below:

 

struct MyBase

{

  __int64 x;

  __int64 y;

  MyBase()

  {

          memset(this, 0, sizeof(MyBase));

  }

};

 

struct MyDerived: public MyBase

{

  int z;

  MyDerived():MyBase(), z(0)

  {}

};

 

Then create two objects as below, and then compare these two
objects with memcmp, do you think the c compare will be equal since the
constructor has initialized all the members of the objects to be 0?

MyDerived obj1;
MyDerived obj2;
 
if (memcmp(&obj1, &obj2, sizeof(MyDerived)) == 0)
{
        cout << "equal" << endl;
}

 

The answer is no. Since due to data alignment, the size of
MyDerived is 24 bytes, although the constructor has initialized x, y and z to
0, there are still 4 bytes keeps uninitialized, so they may be equal or not.