To enable fiddler to work open from menu TOOLS | Hosts and enter
127.0.0.1 localhost
Now, every address from 127.0.0.1 will become localhost just what ASP.NET development servers like :)
Programming and other things
127.0.0.1 localhost
List<int> listOfInt = new List<int>();
List<List<int>> listOfListOfInts = new List<List<int>>();
foreach (List<int> ints in listOfListOfInts)
{
foreach (int i in ints)
{
listOfInt.Add(i);
}
}
List<int> listOfInt = listOfListOfInts.SelectMany(ints => ints).ToList();
#pragma warning disable 1591
#pragma warning restore 1591
Public Sub UpdateRevisionNumber()
Dim proj As Project
Dim objProj As Object()
objProj = DTE.ActiveSolutionProjects
If objProj.Length = 0 Then
Exit Sub
End If
proj = DTE.ActiveSolutionProjects(0) 'gets the path of the web project to write to the web.config
Dim x As String = proj.ProjectItems.ContainingProject.FullName
Dim p As New System.Diagnostics.Process
'first update the root to get the latest revision
p.StartInfo.UseShellExecute = False
p.StartInfo.RedirectStandardOutput = True
p.StartInfo.RedirectStandardError = True
p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
p.StartInfo.FileName = "svn.exe"
p.StartInfo.WorkingDirectory = proj.Properties.Item("FullPath").Value()
p.StartInfo.Arguments = "info"
p.Start()
Dim strerror As String = p.StandardError().ReadToEnd()
Dim output As String = p.StandardOutput().ReadToEnd()
p.WaitForExit()
'get the revision
Dim re As New Regex("Revision:\s+(\d+)\s*")
Dim ver As String
ver = re.Match(output).Groups(1).Value
'add one so the number is not one revision behind
Dim version As Integer
version = Convert.ToInt32(ver) + 1
Dim propPath As String
propPath = proj.Properties.Item("FullPath").Value() + "Properties\AssemblyInfo.cs"
Dim globalAssemblyContent As String = File.ReadAllText(propPath)
Dim rVersionAttribute As Regex = New Regex("\[[\s]*(\/\*[\s\S]*?\*\/)?[\s]*assembly[\s]*(\/\*[\s\S]*?\*\/)?[\s]*:[\s]*(\/\*[\s\S]*?\*\/)?[\s]*AssemblyVersion[\s]*(\/\*[\s\S]*?\*\/)?[\s]*\([\s]*(\/\*[\s\S]*?\*\/)?[\s]*\""([0-9]+)\.([0-9]+)(.([0-9]+))?(.([0-9]+))?\""[\s]*(\/\*[\s\S]*?\*\/)?[\s]*\)[\s]*(\/\*[\s\S]*?\*\/)?[\s]*\]")
Dim rVersionInfoAttribute As Regex = New Regex("\[[\s]*(\/\*[\s\S]*?\*\/)?[\s]*assembly[\s]*(\/\*[\s\S]*?\*\/)?[\s]*:[\s]*(\/\*[\s\S]*?\*\/)?[\s]*AssemblyFileVersion[\s]*(\/\*[\s\S]*?\*\/)?[\s]*\([\s]*(\/\*[\s\S]*?\*\/)?[\s]*\""([0-9]+)\.([0-9]+)(.([0-9]+))?(.([0-9]+))?\""[\s]*(\/\*[\s\S]*?\*\/)?[\s]*\)[\s]*(\/\*[\s\S]*?\*\/)?[\s]*\]")
'Find Version Attribute for Updating Build Number
Dim mVersionAttributes As MatchCollection = rVersionAttribute.Matches(globalAssemblyContent)
Dim mVersionAttribute As Match = GetFirstUnCommentedMatch(mVersionAttributes, globalAssemblyContent)
Dim gBuildNumber As Group = mVersionAttribute.Groups(11)
Dim newBuildNumber As String
'Replace Version Attribute for Updating Build Number
If (gBuildNumber.Success) Then
newBuildNumber = version.ToString()
globalAssemblyContent = globalAssemblyContent.Substring(0, gBuildNumber.Index) + newBuildNumber + globalAssemblyContent.Substring(gBuildNumber.Index + gBuildNumber.Length)
End If
'Find Version Info Attribute for Updating Build Number
Dim mVersionInfoAttributes As MatchCollection = rVersionInfoAttribute.Matches(globalAssemblyContent)
Dim mVersionInfoAttribute As Match = GetFirstUnCommentedMatch(mVersionInfoAttributes, globalAssemblyContent)
Dim gBuildNumber2 As Group = mVersionInfoAttribute.Groups(11)
'Replace AssemblyFileVersion
If (gBuildNumber2.Success) Then
If String.IsNullOrEmpty(newBuildNumber) Then
newBuildNumber = version.ToString()
End If
globalAssemblyContent = globalAssemblyContent.Substring(0, gBuildNumber2.Index) + newBuildNumber + globalAssemblyContent.Substring(gBuildNumber2.Index + gBuildNumber2.Length)
End If
File.WriteAllText(propPath, globalAssemblyContent)
End Sub
Private Function GetFirstUnCommentedMatch(ByRef mc As MatchCollection, ByVal content As String) As Match
Dim rSingleLineComment As Regex = New Regex("\/\/.*$")
Dim rMultiLineComment As Regex = New Regex("\/\*[\s\S]*?\*\/")
Dim mSingleLineComments As MatchCollection = rSingleLineComment.Matches(content)
Dim mMultiLineComments As MatchCollection = rMultiLineComment.Matches(content)
For Each m As Match In mc
If m.Success Then
For Each singleLine As Match In mSingleLineComments
If singleLine.Success Then
If m.Index >= singleLine.Index And m.Index + m.Length <= singleLine.Index + singleLine.Length Then
GoTo NextAttribute
End If
End If
Next
For Each multiLine As Match In mMultiLineComments
If multiLine.Success Then
If m.Index >= multiLine.Index And m.Index + m.Length <= multiLine.Index + multiLine.Length Then
GoTo NextAttribute
End If
End If
Next
Return m
End If
NextAttribute:
Next
Return Nothing
End Function
devenv /resetskippkgs
Public Sub OpenLog()
Dim solutionPath As String
Dim solutionDir As String
Dim dirInSolution As String()
solutionPath = DTE.Solution.FullName
solutionDir = Path.GetDirectoryName(solutionPath)
solutionPath = solutionDir + "\TestResults"
dirInSolution = Directory.GetDirectories(solutionPath)
Dim lastTestDir As String
Dim currentDT As Date
For Each currentDir As String In dirInSolution
Dim ct As Date
ct = Directory.GetCreationTime(currentDir)
If (ct > currentDT) Then
currentDT = ct
lastTestDir = currentDir
End If
Next
' we have dir name
' open log file from that dir
Dim finalPath = lastTestDir + "\Out\trace.log"
DTE.ItemOperations.OpenFile(finalPath, ViewKind:=EnvDTE.Constants.vsViewKindTextView).Activate()
End Sub
class C1
{
public List Children {get; set;}
public string Name {get; set;}
}
var result =
from c1 in listOfC1
where c1.Name == "N1"
from c2 in c1.Children
where c2.Name == "N2"
from c3 in c2.Children
where c3.Name == "N3"
select c3;