问:
identifier mapping has wrong number of columns:
can anyone help me
i have this error
caused by: org.hibernate.MappingException: identifier mapping has wrong number of columns: com.twins.FootFans.model.MemberAllTeam type: component[allTeam,member]</p>

```<code>@Id
@ManyToOne
@JoinColumn(name = "team_id", referencedColumnName = "teamId")
private Team allTeam;

@Id
@ManyToOne
@JoinColumns({
    @JoinColumn(name = "identifier_AllTeam" ,referencedColumnName ="identifier" ),
    @JoinColumn(name = "connectionType_AllTeam" ,referencedColumnName ="connectionType")
} )

private Member member;
</code>```

答:
remove @Id before @ManyToOne. for more refer bellow link

http://www.java2s.com/Code/Java/JPA/UseTwoJoinedColumnsforManytooneMapping.htm

http://www.java2s.com/Tutorial/Java/0355__JPA/ManyToOneSetJoinColumnName.htm

Body:
can anyone help me
i have this error
caused by: org.hibernate.MappingException: identifier mapping has wrong number of columns: com.twins.FootFans.model.MemberAllTeam type: component[allTeam,member]

@Id
@ManyToOne
@JoinColumn(name = "team_id", referencedColumnName = "teamId")
private Team allTeam;

@Id
@ManyToOne
@JoinColumns({
    @JoinColumn(name = "identifier_AllTeam" ,referencedColumnName ="identifier" ),
    @JoinColumn(name = "connectionType_AllTeam" ,referencedColumnName ="connectionType")
} )

private Member member;


来源: stackexchange

问:
Merge specific cells from columns from multiple files to one sheet
I am trying to merge data from particular columns from multiple csv files. This thread: Excel VBA - Merge specific columns from multiple files to one sheet worked for whole ranges of columns. However, I want to copy e.g. each 100th cell from particular column (instead of whole column as it is at the moment).

I have tried to modify the code as per below method 1 and 2 (see **** notes).

This VBA is to go through datalog files which have time stamps in rows and parameters for each time stamp. However, I don't want all parameters, only selected ones (per columns) and in each 100th row.

```<code>'takes worksheet and returns last row
Private Function LastRowUsed(sh As Worksheet) As Long
    On Error Resume Next
    LastRowUsed = sh.Cells.Find(What:="*", _
                    After:=sh.Range("A1"), _
                    LookAt:=xlPart, _
                    LookIn:=xlFormulas, _
                    SearchOrder:=xlByRows, _
                    SearchDirection:=xlPrevious, _
                    MatchCase:=False).Row
     On Error GoTo 0
 End Function

'takes worksheet and returns last column
Private Function LastColUsed(sh As Worksheet) As Long
    On Error Resume Next
    LastColUsed = sh.Cells.Find(What:="*", _
                    After:=sh.Range(A1), _
                    LookAt:=xlPart, _
                    LookIn:=xlFormulas, _
                    SearchOrder:=xlByColumns, _
                    SearchDirection:=xlPrevious, _
                    MatchCase:=False).Column
    On Error GoTo 0
End Function

'takes worksheet and returns last row in column
Private Function LastRowUsedbyCol(sh As Worksheet, ByVal Col As String) As Long
    On Error Resume Next
    LastRowUsed = sh.Cells.Find(What:="*", _
                    After:=sh.Range(Cell(Col, 1), Cell(Col, 1)), _
                    LookAt:=xlPart, _
                    LookIn:=xlFormulas, _
                    SearchOrder:=xlByRows, _
                    SearchDirection:=xlPrevious, _
                    MatchCase:=False).Row
    On Error GoTo 0
End Function

Function GetFileListArray() As String()
    Dim fileDialogBox As FileDialog
    Dim SelectedFolder As Variant
    Dim MYPATH As String
    Dim MYFILES() As String
    Dim FILESINPATH
    Dim FNUM, i As Integer
    '''''
    Set fileDialogBox = Application.FileDialog(msoFileDialogFolderPicker)

    'Use a With...End With block to reference the FileDialog object.
    With fileDialogBox
        If .Show = -1 Then 'the user chose a folder
            For Each SelectedFolder In .SelectedItems
                MYPATH = SelectedFolder 'asign mypath to the selected folder name
                'MsgBox "The path is:" & SelectedFolder, vbInformation 'display folder selected
            Next SelectedFolder
        'The user pressed Cancel.
        Else
            MsgBox "Cancel was pressed or Invalid folder chosen, ending macro"
            Exit Function
        End If
    End With
    'Set the file dialog object variable to Nothing to clear memory
    Set fileDialogBox = Nothing
    If Right(MYPATH, 1) <> "\" Then
        MYPATH = MYPATH & "\"
    End If
    FILESINPATH = Dir(MYPATH & "*.csv")
    'MsgBox FILESINPATH
    If FILESINPATH = "" Then
         MsgBox "No files found"
         Exit Function
    End If

    'Fill the array(myFiles)with the list of Excel files in the folder
    FNUM = 0
    Do While FILESINPATH <> ""
        FNUM = FNUM + 1
        ReDim Preserve MYFILES(1 To FNUM)
        MYFILES(FNUM) = MYPATH & FILESINPATH
        FILESINPATH = Dir()
    Loop

    GetFileListArray = MYFILES()
End Function

Sub RFSSearchThenCombine()
'search first worksheet in files opened, change to search other worksheets
Const SHEET_TO_SEARCH = 1

Dim FileList() As String
Dim CurrentFolder As String
Dim openedWorkBook As Workbook, HeadingWorkbook As Workbook
Dim OpenedWorkSheet As Worksheet, HeadingWorkSheet As Worksheet
Dim i, counter, x, j As Integer
Dim LRowHeading, LRowOpenedBook, LColHeading, LColOpenedBook, LRowHeadingC As Long
Dim dict As dictionary
Dim searchValue
'set original workbook with headings to retrieve
Set HeadingWorkbook = ActiveWorkbook
Set HeadingWorkSheet = HeadingWorkbook.Sheets(1)
'find last column on heading worksheet
LColHeading = LastColUsed(HeadingWorkSheet)

'create dictionary to link headers to position in heading worksheet

Set dict = CreateObject("Scripting.Dictionary")
For x = 1 To LColHeading
    dict.Add HeadingWorkSheet.Cells(1, x).Value, x
Next x

FileList() = GetFileListArray()

For counter = 1 To UBound(FileList)
    Set openedWorkBook = Workbooks.Open(FileList(counter))
    Set OpenedWorkSheet = openedWorkBook.Sheets(SHEET_TO_SEARCH)
    LColOpenedBook = LastColUsed(openedWorkBook.Sheets(1))
    LRowOpenedBook = LastRowUsed(openedWorkBook.Sheets(1))
    LRowHeading = LastRowUsed(HeadingWorkSheet)

    For i = 1 To LColOpenedBook 'search headers from a1 to last header
        searchValue = OpenedWorkSheet.Cells(1, i).Value 'set search value in to current header
        If dict.Exists(searchValue) Then

            ' *** code from previous thread
            'OpenedWorkSheet.Range(OpenedWorkSheet.Cells(1, i), _
            'OpenedWorkSheet.Cells(LRowOpenedBook, i)).Copy _
            '(HeadingWorkSheet.Cells(LRowHeading, dict.Item(searchValue)))

            '**** my proposal
            For j = 1 To LRowOpenedBook Step 100
                OpenedWorkSheet.Range(OpenedWorkSheet.Cells(j, i), _
                OpenedWorkSheet.Cells(j, i)).Copy _
                (HeadingWorkSheet.Cells(LRowHeading + 1, dict.Item(searchValue)))
                LRowHeading = LRowHeading + 1

            '**** my 2nd  proposal
            'LRowHeadingC = HeadingWorkSheet.Cells(Rows.Count, i).End(xlUp).Row
            'For j = 1 To LRowOpenedBook Step 100
                ' OpenedWorkSheet.Range(OpenedWorkSheet.Cells(j, i), _
                'OpenedWorkSheet.Cells(j, i)).Copy _
                '(HeadingWorkSheet.Cells(LRowHeadingC + 1, dict.Item(searchValue)))
                'LRowHeadingC = LRowHeadingC + 1

            Next j

        End If
    Next i
    openedWorkBook.Close (False)
Next counter ' move on to next file

End Sub
</code>```

1st method (when working) results in shift of rows from next columns (all pasted data start from last row (not last row in particular column), it more less results in below pattern (where cl is for column and x represents data):

```<code>cl1  cl2  cl3  cl3
x
x
x
      x
      x
      x
           x
           x
           x     x
                 x
                 x

x
x
x
</code>```

While I want to receive below pattern:

```<code>cl1  cl2  cl3  cl3
x    x    x    x
x    x    x    x
x    x    x    x
</code>```

Another question is how should I modify function: LastRowUsed not to start from A1, but e.g. from B1, etc.? I tried to resolve that with Method 2.

答:
Based on feedback above I have changed the loops order and that made it work. I have also polished the code (copying from range to range and added option explicit). Code does the job now.

Now I will be trying to change it to more efficient version (it takes plenty of time with few hundreds of workbooks). At the moment I am copying and pasting each cell individually between workbooks. I think that a set of cells (e.g. multiple selection of each 100th cell) would be quicker.
Or building an array of values needed and pasting array into headingsWorkbook as range.

Here is how the code looks now:

```<code>    Option Explicit

   'takes worksheet and returns last row
    Private Function LastRowUsed(sh As Worksheet) As Long
        On Error Resume Next
        LastRowUsed = sh.Cells.Find(What:="*", _
                        After:=sh.Range("A1"), _
                        LookAt:=xlPart, _
                        LookIn:=xlFormulas, _
                        SearchOrder:=xlByRows, _
                        SearchDirection:=xlPrevious, _
                        MatchCase:=False).Row
        On Error GoTo 0
    End Function

    'takes worksheet and returns last column
    Private Function LastColUsed(sh As Worksheet) As Long
    On Error Resume Next
    LastColUsed = sh.Cells.Find(What:="*", _
                        After:=sh.Range(A1), _
                        LookAt:=xlPart, _
                        LookIn:=xlFormulas, _
                        SearchOrder:=xlByColumns, _
                        SearchDirection:=xlPrevious, _
                        MatchCase:=False).Column
        On Error GoTo 0
    End Function

        'takes worksheet and returns last row in column
    Private Function LastRowUsedbyCol(sh As Worksheet, ByVal Col As String) As Long
        On Error Resume Next
        LastRowUsed = sh.Cells.Find(What:="*", _
                        After:=sh.Range(Cell(Col, 1), Cell(Col, 1)), _
                        LookAt:=xlPart, _
                        LookIn:=xlFormulas, _
                        SearchOrder:=xlByRows, _
                        SearchDirection:=xlPrevious, _
                        MatchCase:=False).Row
        On Error GoTo 0
    End Function

Function GetFileListArray() As String()
    Dim fileDialogBox As FileDialog
    Dim SelectedFolder As Variant
    Dim MYPATH As String
    Dim MYFILES() As String
    Dim FILESINPATH
    Dim FNUM, i As Integer
        '''''
        Set fileDialogBox = Application.FileDialog(msoFileDialogFolderPicker)

         'Use a With...End With block to reference the FileDialog object.
         With fileDialogBox
            If .Show = -1 Then 'the user chose a folder
            For Each SelectedFolder In .SelectedItems
               MYPATH = SelectedFolder 'asign mypath to the selected folder name
               'MsgBox "The path is:" & SelectedFolder, vbInformation 'display folder selected
            Next SelectedFolder
            'The user pressed Cancel.
            Else
            MsgBox "Cancel was pressed or Invalid folder chosen, ending macro"
            Exit Function
            End If
         End With
         'Set the file dialog object variable to Nothing to clear memory
         Set fileDialogBox = Nothing
           If Right(MYPATH, 1) <> "\" Then
             MYPATH = MYPATH & "\"
           End If
        FILESINPATH = Dir(MYPATH & "*.csv")
        'MsgBox FILESINPATH
        If FILESINPATH = "" Then
           MsgBox "No files found"
          Exit Function
        End If

        'Fill the array(myFiles)with the list of Excel files in the folder
        FNUM = 0
        Do While FILESINPATH <> ""
          FNUM = FNUM + 1
          ReDim Preserve MYFILES(1 To FNUM)
          MYFILES(FNUM) = MYPATH & FILESINPATH
          FILESINPATH = Dir()
        Loop

GetFileListArray = MYFILES()
End Function

Sub RFSSearchThenCombineEach1000thRow()
'search first worksheet in files opened, change to search other worksheets
Const SHEET_TO_SEARCH = 1

Dim FileList() As String
Dim CurrentFolder As String
Dim openedWorkBook As Workbook, HeadingWorkbook As Workbook
Dim OpenedWorkSheet As Worksheet, HeadingWorkSheet As Worksheet
Dim i, counter, x, j As Integer
Dim LRowHeading, LRowOpenedBook, LColHeading, LColOpenedBook As Long
Dim dict As dictionary
Dim searchValue
'set original workbook with headings to retrieve
Set HeadingWorkbook = ActiveWorkbook
Set HeadingWorkSheet = HeadingWorkbook.Sheets(1)
'find last column on heading worksheet
LColHeading = LastColUsed(HeadingWorkSheet)
'create dictionary to link headers to position in heading worksheet

    Set dict = CreateObject("Scripting.Dictionary")
    For x = 1 To LColHeading
        dict.Add HeadingWorkSheet.Cells(1, x).Value, x
    Next x

FileList() = GetFileListArray()

For counter = 1 To UBound(FileList)
    Set openedWorkBook = Workbooks.Open(FileList(counter))
    Set OpenedWorkSheet = openedWorkBook.Sheets(SHEET_TO_SEARCH)
    LColOpenedBook = LastColUsed(openedWorkBook.Sheets(1))
    LRowOpenedBook = LastRowUsed(openedWorkBook.Sheets(1))
    LRowHeading = LastRowUsed(HeadingWorkSheet)

        For j = 2 To LRowOpenedBook Step 1000
            LRowHeading = LRowHeading + 1 'move one row down in HeadingWorkbook, each 1000 rows of openedworkbook

                For i = 1 To LColOpenedBook 'search headers from a1 to last header
                     searchValue = OpenedWorkSheet.Cells(1, i).Value 'set search value in to current header
                     If dict.Exists(searchValue) Then

                             OpenedWorkSheet.Range(OpenedWorkSheet.Cells(j, i), _
                             OpenedWorkSheet.Cells(j, i)).Copy _
                             HeadingWorkSheet.Range(HeadingWorkSheet.Cells(LRowHeading, dict.Item(searchValue)), _
                             HeadingWorkSheet.Cells(LRowHeading, dict.Item(searchValue)))

                     End If
                 Next i

        Next j
        openedWorkBook.Close (False)
Next ' move on to next file

    End Sub
</code>```

ContentLicense: CC BY-SA 3.0

Body:
I am trying to merge data from particular columns from multiple csv files. This thread: Excel VBA - Merge specific columns from multiple files to one sheet worked for whole ranges of columns. However, I want to copy e.g. each 100th cell from particular column (instead of whole column as it is at the moment).

I have tried to modify the code as per below method 1 and 2 (see **** notes).

This VBA is to go through datalog files which have time stamps in rows and parameters for each time stamp. However, I don't want all parameters, only selected ones (per columns) and in each 100th row.

'takes worksheet and returns last row
Private Function LastRowUsed(sh As Worksheet) As Long
    On Error Resume Next
    LastRowUsed = sh.Cells.Find(What:="*", _
                    After:=sh.Range("A1"), _
                    LookAt:=xlPart, _
                    LookIn:=xlFormulas, _
                    SearchOrder:=xlByRows, _
                    SearchDirection:=xlPrevious, _
                    MatchCase:=False).Row
     On Error GoTo 0
 End Function

'takes worksheet and returns last column
Private Function LastColUsed(sh As Worksheet) As Long
    On Error Resume Next
    LastColUsed = sh.Cells.Find(What:="*", _
                    After:=sh.Range(A1), _
                    LookAt:=xlPart, _
                    LookIn:=xlFormulas, _
                    SearchOrder:=xlByColumns, _
                    SearchDirection:=xlPrevious, _
                    MatchCase:=False).Column
    On Error GoTo 0
End Function

'takes worksheet and returns last row in column
Private Function LastRowUsedbyCol(sh As Worksheet, ByVal Col As String) As Long
    On Error Resume Next
    LastRowUsed = sh.Cells.Find(What:="*", _
                    After:=sh.Range(Cell(Col, 1), Cell(Col, 1)), _
                    LookAt:=xlPart, _
                    LookIn:=xlFormulas, _
                    SearchOrder:=xlByRows, _
                    SearchDirection:=xlPrevious, _
                    MatchCase:=False).Row
    On Error GoTo 0
End Function

Function GetFileListArray() As String()
    Dim fileDialogBox As FileDialog
    Dim SelectedFolder As Variant
    Dim MYPATH As String
    Dim MYFILES() As String
    Dim FILESINPATH
    Dim FNUM, i As Integer
    '''''
    Set fileDialogBox = Application.FileDialog(msoFileDialogFolderPicker)

    'Use a With...End With block to reference the FileDialog object.
    With fileDialogBox
        If .Show = -1 Then 'the user chose a folder
            For Each SelectedFolder In .SelectedItems
                MYPATH = SelectedFolder 'asign mypath to the selected folder name
                'MsgBox "The path is:" & SelectedFolder, vbInformation 'display folder selected
            Next SelectedFolder
        'The user pressed Cancel.
        Else
            MsgBox "Cancel was pressed or Invalid folder chosen, ending macro"
            Exit Function
        End If
    End With
    'Set the file dialog object variable to Nothing to clear memory
    Set fileDialogBox = Nothing
    If Right(MYPATH, 1) <> "\" Then
        MYPATH = MYPATH & "\"
    End If
    FILESINPATH = Dir(MYPATH & "*.csv")
    'MsgBox FILESINPATH
    If FILESINPATH = "" Then
         MsgBox "No files found"
         Exit Function
    End If

    'Fill the array(myFiles)with the list of Excel files in the folder
    FNUM = 0
    Do While FILESINPATH <> ""
        FNUM = FNUM + 1
        ReDim Preserve MYFILES(1 To FNUM)
        MYFILES(FNUM) = MYPATH & FILESINPATH
        FILESINPATH = Dir()
    Loop

    GetFileListArray = MYFILES()
End Function

Sub RFSSearchThenCombine()
'search first worksheet in files opened, change to search other worksheets
Const SHEET_TO_SEARCH = 1

Dim FileList() As String
Dim CurrentFolder As String
Dim openedWorkBook As Workbook, HeadingWorkbook As Workbook
Dim OpenedWorkSheet As Worksheet, HeadingWorkSheet As Worksheet
Dim i, counter, x, j As Integer
Dim LRowHeading, LRowOpenedBook, LColHeading, LColOpenedBook, LRowHeadingC As Long
Dim dict As dictionary
Dim searchValue
'set original workbook with headings to retrieve
Set HeadingWorkbook = ActiveWorkbook
Set HeadingWorkSheet = HeadingWorkbook.Sheets(1)
'find last column on heading worksheet
LColHeading = LastColUsed(HeadingWorkSheet)

'create dictionary to link headers to position in heading worksheet

Set dict = CreateObject("Scripting.Dictionary")
For x = 1 To LColHeading
    dict.Add HeadingWorkSheet.Cells(1, x).Value, x
Next x

FileList() = GetFileListArray()

For counter = 1 To UBound(FileList)
    Set openedWorkBook = Workbooks.Open(FileList(counter))
    Set OpenedWorkSheet = openedWorkBook.Sheets(SHEET_TO_SEARCH)
    LColOpenedBook = LastColUsed(openedWorkBook.Sheets(1))
    LRowOpenedBook = LastRowUsed(openedWorkBook.Sheets(1))
    LRowHeading = LastRowUsed(HeadingWorkSheet)

    For i = 1 To LColOpenedBook 'search headers from a1 to last header
        searchValue = OpenedWorkSheet.Cells(1, i).Value 'set search value in to current header
        If dict.Exists(searchValue) Then

            ' *** code from previous thread
            'OpenedWorkSheet.Range(OpenedWorkSheet.Cells(1, i), _
            'OpenedWorkSheet.Cells(LRowOpenedBook, i)).Copy _
            '(HeadingWorkSheet.Cells(LRowHeading, dict.Item(searchValue)))

            '**** my proposal
            For j = 1 To LRowOpenedBook Step 100
                OpenedWorkSheet.Range(OpenedWorkSheet.Cells(j, i), _
                OpenedWorkSheet.Cells(j, i)).Copy _
                (HeadingWorkSheet.Cells(LRowHeading + 1, dict.Item(searchValue)))
                LRowHeading = LRowHeading + 1

            '**** my 2nd  proposal
            'LRowHeadingC = HeadingWorkSheet.Cells(Rows.Count, i).End(xlUp).Row
            'For j = 1 To LRowOpenedBook Step 100
                ' OpenedWorkSheet.Range(OpenedWorkSheet.Cells(j, i), _
                'OpenedWorkSheet.Cells(j, i)).Copy _
                '(HeadingWorkSheet.Cells(LRowHeadingC + 1, dict.Item(searchValue)))
                'LRowHeadingC = LRowHeadingC + 1

            Next j

        End If
    Next i
    openedWorkBook.Close (False)
Next counter ' move on to next file

End Sub

1st method (when working) results in shift of rows from next columns (all pasted data start from last row (not last row in particular column), it more less results in below pattern (where cl is for column and x represents data):

cl1  cl2  cl3  cl3
x
x
x
      x
      x
      x
           x
           x
           x     x
                 x
                 x

x
x
x

While I want to receive below pattern:

cl1  cl2  cl3  cl3
x    x    x    x
x    x    x    x
x    x    x    x

Another question is how should I modify function: LastRowUsed not to start from A1, but e.g. from B1, etc.? I tried to resolve that with Method 2.

Body:
Based on feedback above I have changed the loops order and that made it work. I have also polished the code (copying from range to range and added option explicit). Code does the job now.

Now I will be trying to change it to more efficient version (it takes plenty of time with few hundreds of workbooks). At the moment I am copying and pasting each cell individually between workbooks. I think that a set of cells (e.g. multiple selection of each 100th cell) would be quicker.
Or building an array of values needed and pasting array into headingsWorkbook as range.

Here is how the code looks now:

    Option Explicit

   'takes worksheet and returns last row
    Private Function LastRowUsed(sh As Worksheet) As Long
        On Error Resume Next
        LastRowUsed = sh.Cells.Find(What:="*", _
                        After:=sh.Range("A1"), _
                        LookAt:=xlPart, _
                        LookIn:=xlFormulas, _
                        SearchOrder:=xlByRows, _
                        SearchDirection:=xlPrevious, _
                        MatchCase:=False).Row
        On Error GoTo 0
    End Function

    'takes worksheet and returns last column
    Private Function LastColUsed(sh As Worksheet) As Long
    On Error Resume Next
    LastColUsed = sh.Cells.Find(What:="*", _
                        After:=sh.Range(A1), _
                        LookAt:=xlPart, _
                        LookIn:=xlFormulas, _
                        SearchOrder:=xlByColumns, _
                        SearchDirection:=xlPrevious, _
                        MatchCase:=False).Column
        On Error GoTo 0
    End Function

        'takes worksheet and returns last row in column
    Private Function LastRowUsedbyCol(sh As Worksheet, ByVal Col As String) As Long
        On Error Resume Next
        LastRowUsed = sh.Cells.Find(What:="*", _
                        After:=sh.Range(Cell(Col, 1), Cell(Col, 1)), _
                        LookAt:=xlPart, _
                        LookIn:=xlFormulas, _
                        SearchOrder:=xlByRows, _
                        SearchDirection:=xlPrevious, _
                        MatchCase:=False).Row
        On Error GoTo 0
    End Function

Function GetFileListArray() As String()
    Dim fileDialogBox As FileDialog
    Dim SelectedFolder As Variant
    Dim MYPATH As String
    Dim MYFILES() As String
    Dim FILESINPATH
    Dim FNUM, i As Integer
        '''''
        Set fileDialogBox = Application.FileDialog(msoFileDialogFolderPicker)

         'Use a With...End With block to reference the FileDialog object.
         With fileDialogBox
            If .Show = -1 Then 'the user chose a folder
            For Each SelectedFolder In .SelectedItems
               MYPATH = SelectedFolder 'asign mypath to the selected folder name
               'MsgBox "The path is:" & SelectedFolder, vbInformation 'display folder selected
            Next SelectedFolder
            'The user pressed Cancel.
            Else
            MsgBox "Cancel was pressed or Invalid folder chosen, ending macro"
            Exit Function
            End If
         End With
         'Set the file dialog object variable to Nothing to clear memory
         Set fileDialogBox = Nothing
           If Right(MYPATH, 1) <> "\" Then
             MYPATH = MYPATH & "\"
           End If
        FILESINPATH = Dir(MYPATH & "*.csv")
        'MsgBox FILESINPATH
        If FILESINPATH = "" Then
           MsgBox "No files found"
          Exit Function
        End If

        'Fill the array(myFiles)with the list of Excel files in the folder
        FNUM = 0
        Do While FILESINPATH <> ""
          FNUM = FNUM + 1
          ReDim Preserve MYFILES(1 To FNUM)
          MYFILES(FNUM) = MYPATH & FILESINPATH
          FILESINPATH = Dir()
        Loop

GetFileListArray = MYFILES()
End Function

Sub RFSSearchThenCombineEach1000thRow()
'search first worksheet in files opened, change to search other worksheets
Const SHEET_TO_SEARCH = 1

Dim FileList() As String
Dim CurrentFolder As String
Dim openedWorkBook As Workbook, HeadingWorkbook As Workbook
Dim OpenedWorkSheet As Worksheet, HeadingWorkSheet As Worksheet
Dim i, counter, x, j As Integer
Dim LRowHeading, LRowOpenedBook, LColHeading, LColOpenedBook As Long
Dim dict As dictionary
Dim searchValue
'set original workbook with headings to retrieve
Set HeadingWorkbook = ActiveWorkbook
Set HeadingWorkSheet = HeadingWorkbook.Sheets(1)
'find last column on heading worksheet
LColHeading = LastColUsed(HeadingWorkSheet)
'create dictionary to link headers to position in heading worksheet

    Set dict = CreateObject("Scripting.Dictionary")
    For x = 1 To LColHeading
        dict.Add HeadingWorkSheet.Cells(1, x).Value, x
    Next x

FileList() = GetFileListArray()

For counter = 1 To UBound(FileList)
    Set openedWorkBook = Workbooks.Open(FileList(counter))
    Set OpenedWorkSheet = openedWorkBook.Sheets(SHEET_TO_SEARCH)
    LColOpenedBook = LastColUsed(openedWorkBook.Sheets(1))
    LRowOpenedBook = LastRowUsed(openedWorkBook.Sheets(1))
    LRowHeading = LastRowUsed(HeadingWorkSheet)

        For j = 2 To LRowOpenedBook Step 1000
            LRowHeading = LRowHeading + 1 'move one row down in HeadingWorkbook, each 1000 rows of openedworkbook

                For i = 1 To LColOpenedBook 'search headers from a1 to last header
                     searchValue = OpenedWorkSheet.Cells(1, i).Value 'set search value in to current header
                     If dict.Exists(searchValue) Then

                             OpenedWorkSheet.Range(OpenedWorkSheet.Cells(j, i), _
                             OpenedWorkSheet.Cells(j, i)).Copy _
                             HeadingWorkSheet.Range(HeadingWorkSheet.Cells(LRowHeading, dict.Item(searchValue)), _
                             HeadingWorkSheet.Cells(LRowHeading, dict.Item(searchValue)))

                     End If
                 Next i

        Next j
        openedWorkBook.Close (False)
Next ' move on to next file

    End Sub


问:
Corrupt Gemfile.Lock
I've built my rails app using Ruby Mine on Windows (not ideal I know) and am trying to deploy it on Ubuntu Server at the moment.

Following along with this guide: https://www.phusionpassenger.com/library/walkthroughs/deploy/ruby/ownserver/nginx/oss/xenial/deploy_app.html.

I am trying to install any gemfile dependencies utilising the following command:

```<code>bundle install --deployment --without development test
</code>```

But I keep receiving the following error:

Your Gemfile.lock is corrupt. The following gem is missing from the DEPENDENCIES section: 'nokogiri'

Gemfile:

```<code>source 'https://rubygems.org'

git_source(:github) do |repo_name|
  repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
  "https://github.com/#{repo_name}.git"
end

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.0.1'
# Use mysql as the database for Active Record
gem 'mysql2', '>= 0.3.18', '< 0.5'
# Use Puma as the app server
gem 'puma', '~> 3.0'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# See https://github.com/rails/execjs#readme for more supported runtimes
#gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 3.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug', platform: :mri
end

group :development do
  # Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
  gem 'web-console', '>= 3.3.0'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
</code>```

Gemfile.Lock:

```<code>GEM
  remote: https://rubygems.org/
  specs:
    actioncable (5.0.4)
      actionpack (= 5.0.4)
      nio4r (>= 1.2, < 3.0)
      websocket-driver (~> 0.6.1)
    actionmailer (5.0.4)
      actionpack (= 5.0.4)
      actionview (= 5.0.4)
      activejob (= 5.0.4)
      mail (~> 2.5, >= 2.5.4)
      rails-dom-testing (~> 2.0)
    actionpack (5.0.4)
      actionview (= 5.0.4)
      activesupport (= 5.0.4)
      rack (~> 2.0)
      rack-test (~> 0.6.3)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.0, >= 1.0.2)
    actionview (5.0.4)
      activesupport (= 5.0.4)
      builder (~> 3.1)
      erubis (~> 2.7.0)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.0, >= 1.0.3)
    activejob (5.0.4)
      activesupport (= 5.0.4)
      globalid (>= 0.3.6)
    activemodel (5.0.4)
      activesupport (= 5.0.4)
    activerecord (5.0.4)
      activemodel (= 5.0.4)
      activesupport (= 5.0.4)
      arel (~> 7.0)
    activesupport (5.0.4)
      concurrent-ruby (~> 1.0, >= 1.0.2)
      i18n (~> 0.7)
      minitest (~> 5.1)
      tzinfo (~> 1.1)
    arel (7.1.4)
    bindex (0.5.0)
    builder (3.2.3)
    coffee-rails (4.2.2)
      coffee-script (>= 2.2.0)
      railties (>= 4.0.0)
    coffee-script (2.4.1)
      coffee-script-source
      execjs
    coffee-script-source (1.12.2)
    concurrent-ruby (1.0.5)
    erubis (2.7.0)
    execjs (2.7.0)
    globalid (0.4.0)
      activesupport (>= 4.2.0)
    i18n (0.8.4)
    jbuilder (2.7.0)
      activesupport (>= 4.2.0)
      multi_json (>= 1.2)
    jquery-rails (4.3.1)
      rails-dom-testing (>= 1, < 3)
      railties (>= 4.2.0)
      thor (>= 0.14, < 2.0)
    loofah (2.0.3)
      nokogiri (>= 1.5.9)
    mail (2.6.6)
      mime-types (>= 1.16, < 4)
    method_source (0.8.2)
    mime-types (3.1)
      mime-types-data (~> 3.2015)
    mime-types-data (3.2016.0521)
    mini_portile2 (2.2.0)
    minitest (5.10.2)
    multi_json (1.12.1)
    mysql2 (0.4.7-x86-mingw32)
    nio4r (2.1.0)
    nokogiri (1.8.0-x86-mingw32)
      mini_portile2 (~> 2.2.0)
    puma (3.9.1)
    rack (2.0.3)
    rack-test (0.6.3)
      rack (>= 1.0)
    rails (5.0.4)
      actioncable (= 5.0.4)
      actionmailer (= 5.0.4)
      actionpack (= 5.0.4)
      actionview (= 5.0.4)
      activejob (= 5.0.4)
      activemodel (= 5.0.4)
      activerecord (= 5.0.4)
      activesupport (= 5.0.4)
      bundler (>= 1.3.0, < 2.0)
      railties (= 5.0.4)
      sprockets-rails (>= 2.0.0)
    rails-dom-testing (2.0.3)
      activesupport (>= 4.2.0)
      nokogiri (>= 1.6)
    rails-html-sanitizer (1.0.3)
      loofah (~> 2.0)
    railties (5.0.4)
      actionpack (= 5.0.4)
      activesupport (= 5.0.4)
      method_source
      rake (>= 0.8.7)
      thor (>= 0.18.1, < 2.0)
    rake (12.0.0)
    sass (3.4.24)
    sass-rails (5.0.6)
      railties (>= 4.0.0, < 6)
      sass (~> 3.1)
      sprockets (>= 2.8, < 4.0)
      sprockets-rails (>= 2.0, < 4.0)
      tilt (>= 1.1, < 3)
    sprockets (3.7.1)
      concurrent-ruby (~> 1.0)
      rack (> 1, < 3)
    sprockets-rails (3.2.0)
      actionpack (>= 4.0)
      activesupport (>= 4.0)
      sprockets (>= 3.0.0)
    thor (0.19.4)
    thread_safe (0.3.6)
    tilt (2.0.7)
    turbolinks (5.0.1)
      turbolinks-source (~> 5)
    turbolinks-source (5.0.3)
    tzinfo (1.2.3)
      thread_safe (~> 0.1)
    tzinfo-data (1.2017.2)
      tzinfo (>= 1.0.0)
    uglifier (3.2.0)
      execjs (>= 0.3.0, < 3)
    web-console (3.5.1)
      actionview (>= 5.0)
      activemodel (>= 5.0)
      bindex (>= 0.4.0)
      railties (>= 5.0)
    websocket-driver (0.6.5)
      websocket-extensions (>= 0.1.0)
    websocket-extensions (0.1.2)

PLATFORMS
  x86-mingw32

DEPENDENCIES
  byebug
  coffee-rails (~> 4.2)
  jbuilder (~> 2.5)
  jquery-rails
  mysql2 (>= 0.3.18, < 0.5)
  puma (~> 3.0)
  rails (~> 5.0.1)
  sass-rails (~> 5.0)
  turbolinks (~> 5)
  tzinfo-data
  uglifier (>= 1.3.0)
  web-console (>= 3.3.0)

BUNDLED WITH
   1.15.1
</code>```

Any ideas?

答:
The mismatch between deployment and development environments appears to be the root cause of the issue. Removing windows dependancies and compatibility using:

```<code>bundle lock --remove-platform x86-mingw32
</code>```

And adding Linux support using:

```<code>lock --add-platform x86_64-linux
</code>```

Appears to have fixed the issue.

Title: Corrupt Gemfile.Lock

Body:
I've built my rails app using Ruby Mine on Windows (not ideal I know) and am trying to deploy it on Ubuntu Server at the moment.

Following along with this guide: https://www.phusionpassenger.com/library/walkthroughs/deploy/ruby/ownserver/nginx/oss/xenial/deploy_app.html.

I am trying to install any gemfile dependencies utilising the following command:

bundle install --deployment --without development test

But I keep receiving the following error:

Your Gemfile.lock is corrupt. The following gem is missing from the DEPENDENCIES section: 'nokogiri'

Gemfile:

source 'https://rubygems.org'

git_source(:github) do |repo_name|
  repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
  "https://github.com/#{repo_name}.git"
end

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.0.1'
# Use mysql as the database for Active Record
gem 'mysql2', '>= 0.3.18', '< 0.5'
# Use Puma as the app server
gem 'puma', '~> 3.0'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# See https://github.com/rails/execjs#readme for more supported runtimes
#gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 3.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug', platform: :mri
end

group :development do
  # Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
  gem 'web-console', '>= 3.3.0'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

Gemfile.Lock:

GEM
  remote: https://rubygems.org/
  specs:
    actioncable (5.0.4)
      actionpack (= 5.0.4)
      nio4r (>= 1.2, < 3.0)
      websocket-driver (~> 0.6.1)
    actionmailer (5.0.4)
      actionpack (= 5.0.4)
      actionview (= 5.0.4)
      activejob (= 5.0.4)
      mail (~> 2.5, >= 2.5.4)
      rails-dom-testing (~> 2.0)
    actionpack (5.0.4)
      actionview (= 5.0.4)
      activesupport (= 5.0.4)
      rack (~> 2.0)
      rack-test (~> 0.6.3)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.0, >= 1.0.2)
    actionview (5.0.4)
      activesupport (= 5.0.4)
      builder (~> 3.1)
      erubis (~> 2.7.0)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.0, >= 1.0.3)
    activejob (5.0.4)
      activesupport (= 5.0.4)
      globalid (>= 0.3.6)
    activemodel (5.0.4)
      activesupport (= 5.0.4)
    activerecord (5.0.4)
      activemodel (= 5.0.4)
      activesupport (= 5.0.4)
      arel (~> 7.0)
    activesupport (5.0.4)
      concurrent-ruby (~> 1.0, >= 1.0.2)
      i18n (~> 0.7)
      minitest (~> 5.1)
      tzinfo (~> 1.1)
    arel (7.1.4)
    bindex (0.5.0)
    builder (3.2.3)
    coffee-rails (4.2.2)
      coffee-script (>= 2.2.0)
      railties (>= 4.0.0)
    coffee-script (2.4.1)
      coffee-script-source
      execjs
    coffee-script-source (1.12.2)
    concurrent-ruby (1.0.5)
    erubis (2.7.0)
    execjs (2.7.0)
    globalid (0.4.0)
      activesupport (>= 4.2.0)
    i18n (0.8.4)
    jbuilder (2.7.0)
      activesupport (>= 4.2.0)
      multi_json (>= 1.2)
    jquery-rails (4.3.1)
      rails-dom-testing (>= 1, < 3)
      railties (>= 4.2.0)
      thor (>= 0.14, < 2.0)
    loofah (2.0.3)
      nokogiri (>= 1.5.9)
    mail (2.6.6)
      mime-types (>= 1.16, < 4)
    method_source (0.8.2)
    mime-types (3.1)
      mime-types-data (~> 3.2015)
    mime-types-data (3.2016.0521)
    mini_portile2 (2.2.0)
    minitest (5.10.2)
    multi_json (1.12.1)
    mysql2 (0.4.7-x86-mingw32)
    nio4r (2.1.0)
    nokogiri (1.8.0-x86-mingw32)
      mini_portile2 (~> 2.2.0)
    puma (3.9.1)
    rack (2.0.3)
    rack-test (0.6.3)
      rack (>= 1.0)
    rails (5.0.4)
      actioncable (= 5.0.4)
      actionmailer (= 5.0.4)
      actionpack (= 5.0.4)
      actionview (= 5.0.4)
      activejob (= 5.0.4)
      activemodel (= 5.0.4)
      activerecord (= 5.0.4)
      activesupport (= 5.0.4)
      bundler (>= 1.3.0, < 2.0)
      railties (= 5.0.4)
      sprockets-rails (>= 2.0.0)
    rails-dom-testing (2.0.3)
      activesupport (>= 4.2.0)
      nokogiri (>= 1.6)
    rails-html-sanitizer (1.0.3)
      loofah (~> 2.0)
    railties (5.0.4)
      actionpack (= 5.0.4)
      activesupport (= 5.0.4)
      method_source
      rake (>= 0.8.7)
      thor (>= 0.18.1, < 2.0)
    rake (12.0.0)
    sass (3.4.24)
    sass-rails (5.0.6)
      railties (>= 4.0.0, < 6)
      sass (~> 3.1)
      sprockets (>= 2.8, < 4.0)
      sprockets-rails (>= 2.0, < 4.0)
      tilt (>= 1.1, < 3)
    sprockets (3.7.1)
      concurrent-ruby (~> 1.0)
      rack (> 1, < 3)
    sprockets-rails (3.2.0)
      actionpack (>= 4.0)
      activesupport (>= 4.0)
      sprockets (>= 3.0.0)
    thor (0.19.4)
    thread_safe (0.3.6)
    tilt (2.0.7)
    turbolinks (5.0.1)
      turbolinks-source (~> 5)
    turbolinks-source (5.0.3)
    tzinfo (1.2.3)
      thread_safe (~> 0.1)
    tzinfo-data (1.2017.2)
      tzinfo (>= 1.0.0)
    uglifier (3.2.0)
      execjs (>= 0.3.0, < 3)
    web-console (3.5.1)
      actionview (>= 5.0)
      activemodel (>= 5.0)
      bindex (>= 0.4.0)
      railties (>= 5.0)
    websocket-driver (0.6.5)
      websocket-extensions (>= 0.1.0)
    websocket-extensions (0.1.2)

PLATFORMS
  x86-mingw32

DEPENDENCIES
  byebug
  coffee-rails (~> 4.2)
  jbuilder (~> 2.5)
  jquery-rails
  mysql2 (>= 0.3.18, < 0.5)
  puma (~> 3.0)
  rails (~> 5.0.1)
  sass-rails (~> 5.0)
  turbolinks (~> 5)
  tzinfo-data
  uglifier (>= 1.3.0)
  web-console (>= 3.3.0)

BUNDLED WITH
   1.15.1

Any ideas?

Body:
The mismatch between deployment and development environments appears to be the root cause of the issue. Removing windows dependancies and compatibility using:

bundle lock --remove-platform x86-mingw32

And adding Linux support using:

lock --add-platform x86_64-linux

Appears to have fixed the issue.


答:
The dependency was missing for the jar file.

```<code><dependency>
    <groupId>javax.xml.crypto</groupId>
    <artifactId>jsr105-api</artifactId>
    <version>1.0.1</version>
</dependency>
</code>```

After adding the above dependency, the error got resolved.

Title: Maven build failing because of "Exception in thread "main" java.lang.NoClassDefFoundError: javax/crypto/spec/Sec retKeySpec"

Body:
I am using Eclipse with Maven and trying to deploy a code for my AEM project. But I am getting the below error and my build is getting failed-

C:\Documents\Source>mvn clean install
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] acs
[INFO] ACS - Core
[INFO] ACS - UI apps
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building acs Snapshot-Release-06-Final
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.6.1:clean (default-clean) @ acs ---
[INFO]
[INFO] --- maven-enforcer-plugin:1.4:enforce (enforce-maven) @ acs ---
[INFO]
[INFO] --- maven-install-plugin:2.5.2:install (default-install) @ acs ---
[INFO] Installing C:\Documents\Source\pom.
xml to C:\.m2\repository\com\acs\web\acs\Snapshot-Release-06-Fi
nal\acs-Snapshot-Release-06-Final.pom
[INFO][INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building ACS - Core Snapshot-Release-06-Final
[INFO] ------------------------------------------------------------------------
Downloading: http://repo.adobe.com/nexus/content/groups/public/org/apache/common
s/commons-imaging/1.0-SNAPSHOT/maven-metadata.xml
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] acs ................................................ SUCCESS [  1.566 s]
[INFO] ACS - Core ......................................... FAILURE [  2.216 s]
[INFO] ACS - UI apps ...................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 11.444 s
[INFO] Finished at: 2017-07-05T22:36:20-04:00
[INFO] Final Memory: 14M/154M
[INFO] ------------------------------------------------------------------------
---------------------------------------------------
constituent[0]: file:/C:/Maven/apache-maven-3.5.0-bin%20(1)/apache-maven-3.5.0/b
in/../conf/logging/
constituent[1]: file:/C:/Maven/apache-maven-3.5.0-bin%20(1)/apache-maven-3.5.0/b
in/../lib/aopalliance-1.0.jar
constituent[2]: file:/C:/Maven/apache-maven-3.5.0-bin%20(1)/apache-maven-3.5.0/b
in/../lib/cdi-api-1.0.jar
constituent[3]: file:/C:/Maven/apache-maven-3.5.0-bin%20(1)/apache-maven-3.5.0/b
in/../lib/commons-cli-1.4.jar
constituent[4]: file:/C:/Maven/apache-maven-3.5.0-bin%20(1)/apache-maven-3.5.0/b
in/../lib/commons-io-2.5.jar
constituent[5]: file:/C:/Maven/apache-maven-3.5.0-bin%20(1)/apache-maven-3.5.0/b
in/../lib/commons-lang3-3.5.jar
constituent[6]: file:/C:/Maven/apache-maven-3.5.0-bin%20(1)/apache-maven-3.5.0/b
in/../lib/guava-20.0.jar
constituent[7]: file:/C:/Maven/apache-maven-3.5.0-bin%20(1)/apache-maven-3.5.0/b
in/../lib/guice-4.0-no_aop.jar
constituent[8]: file:/C:/Maven/apache-maven-3.5.0-bin%20(1)/apache-maven-3.5.0/b
in/../lib/jansi-1.13.jar
constituent[9]: file:/C:/Maven/apache-maven-3.5.0-bin%20(1)/apache-maven-3.5.0/b
in/../lib/javax.inject-1.jar
constituent[10]: file:/C:/Maven/apache-maven-3.5.0-bin%20(1)/apache-maven-3.5.0/
bin/../lib/jcl-over-slf4j-1.7.22.jar
constituent[11]: file:/C:/Maven/apache-maven-3.5.0-bin%20(1)/apache-maven-3.5.0/
bin/../lib/jsr250-api-1.0.jar
constituent[12]: file:/C:/Maven/apache-maven-3.5.0-bin%20(1)/apache-maven-3.5.0/
bin/../lib/maven-artifact-3.5.0.jar
constituent[13]: file:/C:/Maven/apache-maven-3.5.0-bin%20(1)/apache-maven-3.5.0/
bin/../lib/maven-builder-support-3.5.0.jar
constituent[14]: file:/C:/Maven/apache-maven-3.5.0-bin%20(1)/apache-maven-3.5.0/
bin/../lib/maven-compat-3.5.0.jar
constituent[15]: file:/C:/Maven/apache-maven-3.5.0-bin%20(1)/apache-maven-3.5.0/
bin/../lib/maven-core-3.5.0.jar
constituent[16]: file:/C:/Maven/apache-maven-3.5.0-bin%20(1)/apache-maven-3.5.0/
bin/../lib/maven-embedder-3.5.0.jar
constituent[17]: file:/C:/Maven/apache-maven-3.5.0-bin%20(1)/apache-maven-3.5.0/
bin/../lib/maven-model-3.5.0.jar
constituent[18]: file:/C:/Maven/apache-maven-3.5.0-bin%20(1)/apache-maven-3.5.0/
bin/../lib/maven-model-builder-3.5.0.jar
constituent[19]: file:/C:/Maven/apache-maven-3.5.0-bin%20(1)/apache-maven-3.5.0/
bin/../lib/maven-plugin-api-3.5.0.jar
constituent[20]: file:/C:/Maven/apache-maven-3.5.0-bin%20(1)/apache-maven-3.5.0/
bin/../lib/maven-repository-metadata-3.5.0.jar
constituent[21]: file:/C:/Maven/apache-maven-3.5.0-bin%20(1)/apache-maven-3.5.0/
bin/../lib/maven-resolver-api-1.0.3.jar
constituent[22]: file:/C:/Maven/apache-maven-3.5.0-bin%20(1)/apache-maven-3.5.0/
bin/../lib/maven-resolver-connector-basic-1.0.3.jar
constituent[23]: file:/C:/Maven/apache-maven-3.5.0-bin%20(1)/apache-maven-3.5.0/
bin/../lib/maven-resolver-impl-1.0.3.jar
constituent[24]: file:/C:/Maven/apache-maven-3.5.0-bin%20(1)/apache-maven-3.5.0/
bin/../lib/maven-resolver-provider-3.5.0.jar
constituent[25]: file:/C:/Maven/apache-maven-3.5.0-bin%20(1)/apache-maven-3.5.0/
bin/../lib/maven-resolver-spi-1.0.3.jar
constituent[26]: file:/C:/Maven/apache-maven-3.5.0-bin%20(1)/apache-maven-3.5.0/
bin/../lib/maven-resolver-transport-wagon-1.0.3.jar
constituent[27]: file:/C:/Maven/apache-maven-3.5.0-bin%20(1)/apache-maven-3.5.0/
bin/../lib/maven-resolver-util-1.0.3.jar
constituent[28]: file:/C:/Maven/apache-maven-3.5.0-bin%20(1)/apache-maven-3.5.0/
bin/../lib/maven-settings-3.5.0.jar
constituent[29]: file:/C:/Maven/apache-maven-3.5.0-bin%20(1)/apache-maven-3.5.0/
bin/../lib/maven-settings-builder-3.5.0.jar
constituent[30]: file:/C:/Maven/apache-maven-3.5.0-bin%20(1)/apache-maven-3.5.0/
bin/../lib/maven-shared-utils-3.1.0.jar
constituent[31]: file:/C:/Maven/apache-maven-3.5.0-bin%20(1)/apache-maven-3.5.0/
bin/../lib/maven-slf4j-provider-3.5.0.jar
constituent[32]: file:/C:/Maven/apache-maven-3.5.0-bin%20(1)/apache-maven-3.5.0/
bin/../lib/org.eclipse.sisu.inject-0.3.3.jar
constituent[33]: file:/C:/Maven/apache-maven-3.5.0-bin%20(1)/apache-maven-3.5.0/
bin/../lib/org.eclipse.sisu.plexus-0.3.3.jar
constituent[34]: file:/C:/Maven/apache-maven-3.5.0-bin%20(1)/apache-maven-3.5.0/
bin/../lib/plexus-cipher-1.7.jar
constituent[35]: file:/C:/Maven/apache-maven-3.5.0-bin%20(1)/apache-maven-3.5.0/
bin/../lib/plexus-component-annotations-1.7.1.jar
constituent[36]: file:/C:/Maven/apache-maven-3.5.0-bin%20(1)/apache-maven-3.5.0/
bin/../lib/plexus-interpolation-1.24.jar
constituent[37]: file:/C:/Maven/apache-maven-3.5.0-bin%20(1)/apache-maven-3.5.0/
bin/../lib/plexus-sec-dispatcher-1.4.jar
constituent[38]: file:/C:/Maven/apache-maven-3.5.0-bin%20(1)/apache-maven-3.5.0/
bin/../lib/plexus-utils-3.0.24.jar
constituent[39]: file:/C:/Maven/apache-maven-3.5.0-bin%20(1)/apache-maven-3.5.0/
bin/../lib/slf4j-api-1.7.22.jar
constituent[40]: file:/C:/Maven/apache-maven-3.5.0-bin%20(1)/apache-maven-3.5.0/
bin/../lib/wagon-file-2.12.jar
constituent[41]: file:/C:/Maven/apache-maven-3.5.0-bin%20(1)/apache-maven-3.5.0/
bin/../lib/wagon-http-2.12-shaded.jar
constituent[42]: file:/C:/Maven/apache-maven-3.5.0-bin%20(1)/apache-maven-3.5.0/
bin/../lib/wagon-provider-api-2.12.jar
---------------------------------------------------
Exception in thread "main" java.lang.NoClassDefFoundError: javax/crypto/spec/Sec
retKeySpec
        at sun.security.ssl.CipherSuite$BulkCipher.isAvailable(CipherSuite.java:
507)
        at sun.security.ssl.CipherSuite$BulkCipher.isAvailable(CipherSuite.java:
489)
        at sun.security.ssl.CipherSuite.isAvailable(CipherSuite.java:194)
        at sun.security.ssl.SSLContextImpl.getApplicableCipherSuiteList(SSLConte
xtImpl.java:338)
        at sun.security.ssl.SSLContextImpl.getDefaultCipherSuiteList(SSLContextI
mpl.java:296)
        at sun.security.ssl.SSLSocketImpl.init(SSLSocketImpl.java:583)
        at sun.security.ssl.SSLSocketImpl.<init>(SSLSocketImpl.java:547)
        at sun.security.ssl.SSLSocketFactoryImpl.createSocket(SSLSocketFactoryIm
pl.java:109)
        at org.apache.maven.wagon.providers.http.httpclient.conn.ssl.SSLConnecti
onSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:363)
        at org.apache.maven.wagon.providers.http.httpclient.conn.ssl.SSLConnecti
onSocketFactory.connectSocket(SSLConnectionSocketFactory.java:353)
        at org.apache.maven.wagon.providers.http.httpclient.impl.conn.DefaultHtt
pClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:141)
        at org.apache.maven.wagon.providers.http.httpclient.impl.conn.PoolingHtt
pClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353)
        at org.apache.maven.wagon.providers.http.httpclient.impl.execchain.MainC
lientExec.establishRoute(MainClientExec.java:380)
        at org.apache.maven.wagon.providers.http.httpclient.impl.execchain.MainC
lientExec.execute(MainClientExec.java:236)
        at org.apache.maven.wagon.providers.http.httpclient.impl.execchain.Proto
colExec.execute(ProtocolExec.java:184)
        at org.apache.maven.wagon.providers.http.httpclient.impl.execchain.Retry
Exec.execute(RetryExec.java:88)
        at org.apache.maven.wagon.providers.http.httpclient.impl.execchain.Redir
ectExec.execute(RedirectExec.java:110)
        at org.apache.maven.wagon.providers.http.httpclient.impl.client.Internal
HttpClient.doExecute(InternalHttpClient.java:184)
        at org.apache.maven.wagon.providers.http.httpclient.impl.client.Closeabl
eHttpClient.execute(CloseableHttpClient.java:82)
        at org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.execute
(AbstractHttpClientWagon.java:834)
        at org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.fillInp
utData(AbstractHttpClientWagon.java:985)
        at org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.fillInp
utData(AbstractHttpClientWagon.java:962)
        at org.apache.maven.wagon.StreamWagon.getInputStream(StreamWagon.java:12
6)
        at org.apache.maven.wagon.StreamWagon.getIfNewer(StreamWagon.java:88)
        at org.apache.maven.wagon.StreamWagon.get(StreamWagon.java:61)
        at org.eclipse.aether.transport.wagon.WagonTransporter$GetTaskRunner.run
(WagonTransporter.java:569)
        at org.eclipse.aether.transport.wagon.WagonTransporter.execute(WagonTran
sporter.java:436)
        at org.eclipse.aether.transport.wagon.WagonTransporter.get(WagonTranspor
ter.java:413)
        at org.eclipse.aether.connector.basic.BasicRepositoryConnector$GetTaskRu
nner.runTask(BasicRepositoryConnector.java:456)
        at org.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunne
r.run(BasicRepositoryConnector.java:359)
        at org.eclipse.aether.util.concurrency.RunnableErrorForwarder$1.run(Runn
ableErrorForwarder.java:76)
        at org.eclipse.aether.connector.basic.BasicRepositoryConnector$DirectExe
cutor.execute(BasicRepositoryConnector.java:590)
        at org.eclipse.aether.connector.basic.BasicRepositoryConnector.get(Basic
RepositoryConnector.java:231)
        at org.eclipse.aether.internal.impl.DefaultMetadataResolver$ResolveTask.
run(DefaultMetadataResolver.java:616)
        at org.eclipse.aether.util.concurrency.RunnableErrorForwarder$1.run(Runn
ableErrorForwarder.java:76)
        at org.eclipse.aether.internal.impl.DefaultMetadataResolver$1.execute(De
faultMetadataResolver.java:536)
        at org.eclipse.aether.internal.impl.DefaultMetadataResolver.resolve(Defa
ultMetadataResolver.java:391)
        at org.eclipse.aether.internal.impl.DefaultMetadataResolver.resolveMetad
ata(DefaultMetadataResolver.java:214)
        at org.apache.maven.repository.internal.DefaultVersionResolver.resolveVe
rsion(DefaultVersionResolver.java:238)
        at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.
loadPom(DefaultArtifactDescriptorReader.java:232)
        at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.
readArtifactDescriptor(DefaultArtifactDescriptorReader.java:199)
        at org.eclipse.aether.internal.impl.DefaultDependencyCollector.resolveCa
chedArtifactDescriptor(DefaultDependencyCollector.java:544)
        at org.eclipse.aether.internal.impl.DefaultDependencyCollector.getArtifa
ctDescriptorResult(DefaultDependencyCollector.java:528)
        at org.eclipse.aether.internal.impl.DefaultDependencyCollector.processDe
pendency(DefaultDependencyCollector.java:418)
        at org.eclipse.aether.internal.impl.DefaultDependencyCollector.processDe
pendency(DefaultDependencyCollector.java:372)
        at org.eclipse.aether.internal.impl.DefaultDependencyCollector.process(D
efaultDependencyCollector.java:360)
        at org.eclipse.aether.internal.impl.DefaultDependencyCollector.doRecurse
(DefaultDependencyCollector.java:513)
        at org.eclipse.aether.internal.impl.DefaultDependencyCollector.processDe
pendency(DefaultDependencyCollector.java:467)
        at org.eclipse.aether.internal.impl.DefaultDependencyCollector.processDe
pendency(DefaultDependencyCollector.java:372)
        at org.eclipse.aether.internal.impl.DefaultDependencyCollector.process(D
efaultDependencyCollector.java:360)
        at org.eclipse.aether.internal.impl.DefaultDependencyCollector.collectDe
pendencies(DefaultDependencyCollector.java:263)
        at org.eclipse.aether.internal.impl.DefaultRepositorySystem.collectDepen
dencies(DefaultRepositorySystem.java:325)
        at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(D
efaultProjectDependenciesResolver.java:169)
        at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDe
pendencies(LifecycleDependencyResolver.java:195)
        at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.resol
veProjectDependencies(LifecycleDependencyResolver.java:127)
        at org.apache.maven.lifecycle.internal.MojoExecutor.ensureDependenciesAr
eResolved(MojoExecutor.java:246)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:200)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:154)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:146)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
ct(LifecycleModuleBuilder.java:117)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
ct(LifecycleModuleBuilder.java:81)
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThre
adedBuilder.build(SingleThreadedBuilder.java:51)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(Lifecycl
eStarter.java:128)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:191)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Laun
cher.java:289)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav
a:229)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La
uncher.java:415)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:
356)

Does anyone have any idea how to resolve this error?

I got some references here- ref1 and ref2, but not sure how to apply them in Maven and eclipse.

Thanks,

Body:
The dependency was missing for the jar file.

<dependency>
    <groupId>javax.xml.crypto</groupId>
    <artifactId>jsr105-api</artifactId>
    <version>1.0.1</version>
</dependency>

After adding the above dependency, the error got resolved.


问:
How to create two databases connected between each other different servers
Edit: Example if one server is down, the other one has the same data and i will be able to use it.

Example of what I want to achieve:

Server 1 -> DBExample

```<code>INSERT INTO DBExample (idExample, nameExample) VALUES (123, 'Example');

SELECT * FROM DBExample;
+-----------+-------------+
| idExample | nameExample |
+-----------+-------------+
|       123 | Example     |
+-----------+-------------+
</code>```

Server 2 -> DBExample2

```<code>SELECT * FROM DBExample2;
+-----------+-------------+
| idExample | nameExample |
+-----------+-------------+
|       123 | Example     |
+-----------+-------------+
</code>```

And vice versa:

Server 2 -> DBExample2

```<code>INSERT INTO DBExample2 (idExample, nameExample) VALUES (1234, 'Example2');

SELECT * FROM DBExample;
+-----------+-------------+
| idExample | nameExample |
+-----------+-------------+
|       123 | Example     |
|      1234 | Example2    |
+-----------+-------------+
</code>```

Server 1 -> DBExample

```<code>SELECT * FROM DBExample;
+-----------+-------------+
| idExample | nameExample |
+-----------+-------------+
|       123 | Example     |
|      1234 | Example2    |
+-----------+-------------+
</code>```

答:
As this is SQL Server look at bi-directional transactional replication, or peer to peer replication.

http://sqlblog.com/blogs/hilary_cotter/archive/2011/10/28/implementing-bi-directional-transactional-replication.aspx

Body:
Edit: Example if one server is down, the other one has the same data and i will be able to use it.

Example of what I want to achieve:

Server 1 -> DBExample

INSERT INTO DBExample (idExample, nameExample) VALUES (123, 'Example');

SELECT * FROM DBExample;
+-----------+-------------+
| idExample | nameExample |
+-----------+-------------+
|       123 | Example     |
+-----------+-------------+

Server 2 -> DBExample2

SELECT * FROM DBExample2;
+-----------+-------------+
| idExample | nameExample |
+-----------+-------------+
|       123 | Example     |
+-----------+-------------+

And vice versa:

Server 2 -> DBExample2

INSERT INTO DBExample2 (idExample, nameExample) VALUES (1234, 'Example2');

SELECT * FROM DBExample;
+-----------+-------------+
| idExample | nameExample |
+-----------+-------------+
|       123 | Example     |
|      1234 | Example2    |
+-----------+-------------+

Server 1 -> DBExample

SELECT * FROM DBExample;
+-----------+-------------+
| idExample | nameExample |
+-----------+-------------+
|       123 | Example     |
|      1234 | Example2    |
+-----------+-------------+


问:
How to stop tidyr spread sorting columns alphabetically
I've got a table 'inputdf' with sample names in a random order in column 'SampleFileName'.

```<code>> colnames(inputdf)
 [1] "Dye/SamplePeak" "SampleFileName" "Marker"         "Allele"         "Size"           "Height"
 [7] "Area"           "DataPoint"      "flank"          "correction"     "start"          "end"
[13] "control"        "iithreshold"    "CAG"
</code>```

I'm using tidyr spread results from the 'height' column into separate columns, with each column named by the value in 'SampleFileName'.

```<code>library(tidyr)
height <- spread(inputdf, key=SampleFileName, value=Height, fill = 0, convert = FALSE) #Extract heights into separate columns for each sample
</code>```

My samples aren't in alphabetical order in column 'SampleFileName' and I'd like to keep them in that order. However, spread automatically sorts them alphabetically. I'd be grateful for your help!

```<code>> colnames(height)
 [1] "Dye/SamplePeak"                         "Marker"
 [3] "Allele"                                 "Size"
 [5] "Area"                                   "DataPoint"
 [7] "flank"                                  "correction"
 [9] "start"                                  "end"
[11] "control"                                "iithreshold"
[13] "CAG"                                    "A01_MF20170522_FA_A01_2017-05-22_1.fsa"
[15] "A01_MF20170623_FA_A01_2017-06-23_1.fsa" "A02_MF20170623_FA_A02_2017-06-23_1.fsa"
[17] "A03_MF20170623_FA_A03_2017-06-23_1.fsa" "A05_MF20170623_FA_A05_2017-06-23_1.fsa"
[19] "A06_MF20170623_FA_A06_2017-06-23_1.fsa" "A07_MF20170623_FA_A07_2017-06-23_1.fsa"
[21] "A08_MF20170623_FA_A08_2017-06-23_1.fsa" "A09_MF20170623_FA_A09_2017-06-23_1.fsa"
[23] "A10_MF20170623_FA_A10_2017-06-23_1.fsa" "A11_MF20170623_FA_A11_2017-06-23_1.fsa"
[25] "A12_MF20170623_FA_A12_2017-06-23_1.fsa" "B01_MF20170623_FA_B01_2017-06-23_1.fsa"
[27] "B02_MF20170623_FA_B02_2017-06-23_1.fsa" "B03_MF20170623_FA_B03_2017-06-23_1.fsa"
[29] "B04_MF20170623_FA_B04_2017-06-23_1.fsa" "B05_MF20170623_FA_B05_2017-06-23_1.fsa"
[31] "B06_MF20170623_FA_B06_2017-06-23_1.fsa" "B07_MF20170623_FA_B07_2017-06-23_1.fsa"
[33] "B08_MF20170522_FA_B08_2017-05-22_1.fsa" "B08_MF20170623_FA_B08_2017-06-23_1.fsa"
[35] "C01_MF20170623_FA_C01_2017-06-23_1.fsa" "C02_MF20170529_FA_C02_2017-05-30_1.fsa"
[37] "C02_MF20170623_FA_C02_2017-06-23_1.fsa" "C05_MF20170623_FA_C05_2017-06-23_1.fsa"
[39] "C07_MF20170623_FA_C07_2017-06-23_1.fsa" "C08_MF20170623_FA_C08_2017-06-23_1.fsa"
[41] "C09_MF20170623_FA_C09_2017-06-23_1.fsa" "C10_MF20170623_FA_C10_2017-06-23_1.fsa"
[43] "C11_MF20170623_FA_C11_2017-06-23_1.fsa" "C12_MF20170623_FA_C12_2017-06-23_1.fsa"
[45] "D02_MF20170623_FA_D02_2017-06-23_1.fsa" "D03_MF20170623_FA_D03_2017-06-23_1.fsa"
[47] "D04_MF20170623_FA_D04_2017-06-23_1.fsa" "D05_MF20170623_FA_D05_2017-06-23_1.fsa"
[49] "D06_MF20170623_FA_D06_2017-06-23_1.fsa" "D08_MF20170623_FA_D08_2017-06-23_1.fsa"
[51] "D10_MF20170623_FA_D10_2017-06-23_1.fsa" "D11_MF20170623_FA_D11_2017-06-23_1.fsa"
[53] "D12_MF20170623_FA_D12_2017-06-23_1.fsa"
</code>```

答:
You could try something like this.</p>

```<code>library(tidyr)

# Get vector of current column names (excluding "SampleFileName" and "Height" as they will not exist in final dataset) and all of the SampleFileName values.
cols <- c(colnames(inputdf)[!(colnames(inputdf) %in% c("SampleFileName","Height"))], unique(inputdf$SampleFileName))

# Spread the SampleFileName column
height <- spread(inputdf, key=SampleFileName, value=Height, fill = 0, convert = FALSE)

# Select the columns in the order they are listed in the cols vector
height <- height[,cols]
</code>```

Body:
I've got a table 'inputdf' with sample names in a random order in column 'SampleFileName'.

> colnames(inputdf)
 [1] "Dye/SamplePeak" "SampleFileName" "Marker"         "Allele"         "Size"           "Height"
 [7] "Area"           "DataPoint"      "flank"          "correction"     "start"          "end"
[13] "control"        "iithreshold"    "CAG"

I'm using tidyr spread results from the 'height' column into separate columns, with each column named by the value in 'SampleFileName'.

library(tidyr)
height <- spread(inputdf, key=SampleFileName, value=Height, fill = 0, convert = FALSE) #Extract heights into separate columns for each sample

My samples aren't in alphabetical order in column 'SampleFileName' and I'd like to keep them in that order. However, spread automatically sorts them alphabetically. I'd be grateful for your help!

> colnames(height)
 [1] "Dye/SamplePeak"                         "Marker"
 [3] "Allele"                                 "Size"
 [5] "Area"                                   "DataPoint"
 [7] "flank"                                  "correction"
 [9] "start"                                  "end"
[11] "control"                                "iithreshold"
[13] "CAG"                                    "A01_MF20170522_FA_A01_2017-05-22_1.fsa"
[15] "A01_MF20170623_FA_A01_2017-06-23_1.fsa" "A02_MF20170623_FA_A02_2017-06-23_1.fsa"
[17] "A03_MF20170623_FA_A03_2017-06-23_1.fsa" "A05_MF20170623_FA_A05_2017-06-23_1.fsa"
[19] "A06_MF20170623_FA_A06_2017-06-23_1.fsa" "A07_MF20170623_FA_A07_2017-06-23_1.fsa"
[21] "A08_MF20170623_FA_A08_2017-06-23_1.fsa" "A09_MF20170623_FA_A09_2017-06-23_1.fsa"
[23] "A10_MF20170623_FA_A10_2017-06-23_1.fsa" "A11_MF20170623_FA_A11_2017-06-23_1.fsa"
[25] "A12_MF20170623_FA_A12_2017-06-23_1.fsa" "B01_MF20170623_FA_B01_2017-06-23_1.fsa"
[27] "B02_MF20170623_FA_B02_2017-06-23_1.fsa" "B03_MF20170623_FA_B03_2017-06-23_1.fsa"
[29] "B04_MF20170623_FA_B04_2017-06-23_1.fsa" "B05_MF20170623_FA_B05_2017-06-23_1.fsa"
[31] "B06_MF20170623_FA_B06_2017-06-23_1.fsa" "B07_MF20170623_FA_B07_2017-06-23_1.fsa"
[33] "B08_MF20170522_FA_B08_2017-05-22_1.fsa" "B08_MF20170623_FA_B08_2017-06-23_1.fsa"
[35] "C01_MF20170623_FA_C01_2017-06-23_1.fsa" "C02_MF20170529_FA_C02_2017-05-30_1.fsa"
[37] "C02_MF20170623_FA_C02_2017-06-23_1.fsa" "C05_MF20170623_FA_C05_2017-06-23_1.fsa"
[39] "C07_MF20170623_FA_C07_2017-06-23_1.fsa" "C08_MF20170623_FA_C08_2017-06-23_1.fsa"
[41] "C09_MF20170623_FA_C09_2017-06-23_1.fsa" "C10_MF20170623_FA_C10_2017-06-23_1.fsa"
[43] "C11_MF20170623_FA_C11_2017-06-23_1.fsa" "C12_MF20170623_FA_C12_2017-06-23_1.fsa"
[45] "D02_MF20170623_FA_D02_2017-06-23_1.fsa" "D03_MF20170623_FA_D03_2017-06-23_1.fsa"
[47] "D04_MF20170623_FA_D04_2017-06-23_1.fsa" "D05_MF20170623_FA_D05_2017-06-23_1.fsa"
[49] "D06_MF20170623_FA_D06_2017-06-23_1.fsa" "D08_MF20170623_FA_D08_2017-06-23_1.fsa"
[51] "D10_MF20170623_FA_D10_2017-06-23_1.fsa" "D11_MF20170623_FA_D11_2017-06-23_1.fsa"
[53] "D12_MF20170623_FA_D12_2017-06-23_1.fsa"

Body:
You could try something like this.

library(tidyr)

# Get vector of current column names (excluding "SampleFileName" and "Height" as they will not exist in final dataset) and all of the SampleFileName values.
cols <- c(colnames(inputdf)[!(colnames(inputdf) %in% c("SampleFileName","Height"))], unique(inputdf$SampleFileName))

# Spread the SampleFileName column
height <- spread(inputdf, key=SampleFileName, value=Height, fill = 0, convert = FALSE)

# Select the columns in the order they are listed in the cols vector
height <- height[,cols]


问:
How would a for loop be done with Elixir recursion?
I have a simple Go for loop and i want to learn how to do this with Recursion in Elixir. I don't really know how the recursion loop works at this time but i am working on that part! I also don't know if this is even the right way to do recursive functions.

```<code>package main

import "fmt"

func main() {
    for i := 0; i < 10000000; i++ {
        fmt.Println(i)
    }
}

defmodule Looping do
      def loops(i, e) when e <= 0 do
        IO.puts i + e
      end

      def loops(i, e) do
        IO.puts i + e
        loops(i, e + 1)
      end
    end

    Looping.loops(1, 1)
</code>```

Produces 1 + 1 + 1 on going in Elixir.

Martin over at the beginners slack channel suggested the following.

```<code> 1..1_000_000 |> Enum.each(&IO.puts/1)
</code>```

答:
In your case using a range & a simple comprehension would work very well, but if you wanted to use recursion specifically you could do something like

```<code>defmodule SomeName do
    def addr(range), do: addr(Enum.to_list(range), 0)
    def addr([first|rest], sum), do: addr(rest, sum + first)
    def addr([], sum), do: sum
end
</code>```

if you wanted to print each line you could throw an IO.inspect/1 in addr/2 to print out the sum like

```<code>def addr([first|rest], sum) do
  IO.inspect(sum)
  addr(rest, sum + first)
end
</code>```

Body:
I have a simple Go for loop and i want to learn how to do this with Recursion in Elixir. I don't really know how the recursion loop works at this time but i am working on that part! I also don't know if this is even the right way to do recursive functions.

package main

import "fmt"

func main() {
    for i := 0; i < 10000000; i++ {
        fmt.Println(i)
    }
}

defmodule Looping do
      def loops(i, e) when e <= 0 do
        IO.puts i + e
      end

      def loops(i, e) do
        IO.puts i + e
        loops(i, e + 1)
      end
    end

    Looping.loops(1, 1)

Produces 1 + 1 + 1 on going in Elixir.

Martin over at the beginners slack channel suggested the following.

 1..1_000_000 |> Enum.each(&IO.puts/1)

Body:
In your case using a range & a simple comprehension would work very well, but if you wanted to use recursion specifically you could do something like

defmodule SomeName do
    def addr(range), do: addr(Enum.to_list(range), 0)
    def addr([first|rest], sum), do: addr(rest, sum + first)
    def addr([], sum), do: sum
end

if you wanted to print each line you could throw an IO.inspect/1 in addr/2 to print out the sum like

def addr([first|rest], sum) do
  IO.inspect(sum)
  addr(rest, sum + first)
end


问:
How can you verify validity of an HTTPS/SSL certificate in .NET?
How can you verify validity of an HTTPS/SSL certificate in .NET?

Ideally I want to establish an HTTPS connection to a website and then find out if that was done in a valid way (certificate not expired, host name matches, certificate chain trusted etc), but the built in HTTP Client seems to ignore certificate errors (and I'm not sure that physically downloading a web page is necessary to verify a certificate?).

I've tried to use the code below (adapted from an answer in the comments) but the ValidationCallback never gets called:

```<code>    static void Main(string[] args)
    {
        String url = "https://www.example.com";
        HttpWebRequest request = WebRequest.CreateHttp(url);
        request.GetResponse();
        request.ServerCertificateValidationCallback += ServerCertificateValidationCallback;
        Console.WriteLine("End");
        Console.ReadKey();
    }

    private static bool ServerCertificateValidationCallback(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
    {
        if (sslPolicyErrors == SslPolicyErrors.None)
        {
            Console.WriteLine("Certificate OK");
            return true;
        }
        else
        {
            Console.WriteLine("Certificate ERROR");
            return false;
        }
    }
</code>```

答:
It doesn't get called because you're setting the ValidationCallback after you've already made the request.

Change it to this:

```<code>HttpWebRequest request = WebRequest.CreateHttp( url );
request.ServerCertificateValidationCallback += ServerCertificateValidationCallback;
using( HttpWebResponse response = (HttpWebResponse)request.GetResponse() ) { }
Console.WriteLine("End");
</code>```

...and it will work.

Body:
How can you verify validity of an HTTPS/SSL certificate in .NET?

Ideally I want to establish an HTTPS connection to a website and then find out if that was done in a valid way (certificate not expired, host name matches, certificate chain trusted etc), but the built in HTTP Client seems to ignore certificate errors (and I'm not sure that physically downloading a web page is necessary to verify a certificate?).

I've tried to use the code below (adapted from an answer in the comments) but the ValidationCallback never gets called:

    static void Main(string[] args)
    {
        String url = "https://www.example.com";
        HttpWebRequest request = WebRequest.CreateHttp(url);
        request.GetResponse();
        request.ServerCertificateValidationCallback += ServerCertificateValidationCallback;
        Console.WriteLine("End");
        Console.ReadKey();
    }

    private static bool ServerCertificateValidationCallback(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
    {
        if (sslPolicyErrors == SslPolicyErrors.None)
        {
            Console.WriteLine("Certificate OK");
            return true;
        }
        else
        {
            Console.WriteLine("Certificate ERROR");
            return false;
        }
    }

Body:
It doesn't get called because you're setting the ValidationCallback after you've already made the request.

Change it to this:

HttpWebRequest request = WebRequest.CreateHttp( url );
request.ServerCertificateValidationCallback += ServerCertificateValidationCallback;
using( HttpWebResponse response = (HttpWebResponse)request.GetResponse() ) { }
Console.WriteLine("End");

...and it will work.


问:
How do I remove the first 30 charicters in each line from a CMD dir command, and execute a script write for each in javascript?
I'm looking at building a command that can take in the dir list from a cmd and dump out a list of commands to be executed, but can only have the code able to work on the first line. What do I need to do in order to have it work on all of the lines?

```<code><!DOCTYPE html>
<html>
    <body>
        <p>
            drive:<br>
            <input type=text>
        </p>
        list:<br>
        <textarea onchange="myFunction(this.value)"></textarea>
            <div id='output'>
            </div>

        <script>
            function myFunction(val)
            {
                val = val.toLowerCase(); //new object assigned to var str
                val = val.substring(30);
                val = val.replace(/_/g, "");

                val = val.replace(/\r?\n/g, '<br />');
                document.getElementById("output").innerHTML = val;
            }
        </script>

    </body>
</html>
</code>```

input data:

```<code>07/05/2017  02:56 PM                    sample1
07/06/2017  02:12 AM                    sample2
07/05/2017  06:09 PM                    sample3
07/05/2017  07:20 PM                    sample4
07/05/2017  10:59 PM                    sample5
07/05/2017  10:54 AM                    sample6
07/06/2017  05:44 AM                    sample7
</code>```

output sample:

```<code>samplecheck.exe E:\sample1  >E:\sample1.txt
samplecheck.exe E:\sample2  >E:\sample2.txt
samplecheck.exe E:\sample3  >E:\sample3.txt
samplecheck.exe E:\sample4  >E:\sample4.txt
</code>```

答:
Removing characters from the beginning of a set of filenames can be done using a quirk in the way Dos works with spaces on the command line. first replacing the unwanted characters with spaces, and then dropping the spaces using a FOR...IN...DO construction. Whatever the actual length of the filenames, handling of long filenames by FOR must be enabled with LFNFOR On so that the spaces can be accepted as part of the filenames.

Example:

To remove the first two characters from the beginning of all filenames in the current directory:
REN . " ."
LFNFOR On
FOR %v IN (.) DO REN "%v" %v

Body:
I'm looking at building a command that can take in the dir list from a cmd and dump out a list of commands to be executed, but can only have the code able to work on the first line. What do I need to do in order to have it work on all of the lines?

<!DOCTYPE html>

            drive:

            <input type=text>

        list:

        <textarea onchange="myFunction(this.value)"></textarea>

input data:

07/05/2017  02:56 PM                    sample1
07/06/2017  02:12 AM                    sample2
07/05/2017  06:09 PM                    sample3
07/05/2017  07:20 PM                    sample4
07/05/2017  10:59 PM                    sample5
07/05/2017  10:54 AM                    sample6
07/06/2017  05:44 AM                    sample7

output sample:

samplecheck.exe E:\sample1  >E:\sample1.txt
samplecheck.exe E:\sample2  >E:\sample2.txt
samplecheck.exe E:\sample3  >E:\sample3.txt
samplecheck.exe E:\sample4  >E:\sample4.txt


问:
How to write output to powershell GUI with Scripts
Powershell novice here.  I'm trying to write a useful tool that has 3 buttons and a text window.  Each button calls a different powershell (.ps1) script that do various things. If I can I would like to write the output of those scripts to the GUI text window, but that seems to be harder to do than one would think.  If that's too much then at the minimum I would like to atleast display that the script has ran to completion in the text window.  Something like " script has been ran".

Here is what I have so far.

```<code>Add-Type -AssemblyName System.Windows.Forms

function call_Clean
{
      # Here the path to call your script
      . "C:\Scripts\Script1.ps1"
}

function call_CreateTestLabConfig
{
      # Here the path to call your script
      . "C:\Scripts\Script2.ps1"

}

function call_LocalDeploy
{
      # Here the path to call your script
      . "C:\Scripts\Script3.ps1"
}

function CreateFormButton ( $locationheight, $locationwidth, $sizeheight, $sizewidth, $fieldname, $functionname ) {
  $Button = New-Object System.Windows.Forms.Button
  $Button.Location = New-Object System.Drawing.Size($locationheight, $locationwidth)
  $Button.Size = New-Object System.Drawing.Size($sizeheight, $sizewidth)
  $Button.Text = $fieldname
  $Button.Add_Click( $functionname )
  $Form.Controls.Add($Button)
}

function CreateStartPosition ( $FormSize, $FormLocation ) {
 $Form.Size = New-Object System.Drawing.Size ($varFrmMSizeWidth, $varFrmMSizeHeight)
 $Form.Location = New-Object System.Drawing.Point($varFrmMLocationX, $varFrmMLocationY)
  $Form.Controls.Add($TextWindow)
}

function CreateTextWindow ( $locationHeight, $LocationWidth, $TextBoxHeight, $TextBoxWidth ) {
  $TextWindow = new-object System.Windows.Forms.ListView
  $TextWindow.Size = New-Object System.Drawing.Size($textBoxHeight,$textBoxWidth)
  $TextWindow.location = new-object system.drawing.point($locationHeight,$LocationWidth)
  $Form.Controls.Add($TextWindow)
}

$Form = New-Object system.Windows.Forms.Form
$Form.Text = "Test Lab Tool"
#$Form.TopMost = $true
$Form.Size = New-Object System.Drawing.Size (475, 600)
$Form.Location = New-Object System.Drawing.Point(4000, 300)

CreateFormButton 20 100 120 40 'Clean' ${function:call_Clean}
CreateFormButton 170 100 120 40 'Create TestLab Config' ${function:call_CreateTestLabConfig}
CreateFormButton 315 100 120 40 'Local Deploy'
CreateTextWindow 20 160 415 375 'Test'

$Form.ShowDialog()
</code>```

答:
Powershell is very linear. When you call a script it's going to freeze the GUI up until it is completed. You can update the GUI with information based on the return from your script, or, simply wait until the script has completed and update the GUI with the information that the script is complete.

For example:

```<code>function call_Clean
{
      # Here the path to call your script
      . "C:\Scripts\Script1.ps1"
      $TextWindow.Text = "Call Clean Script Completed"
}
</code>```

Or:

You can use the same GUI update, $TextWindow.Text = "Call Clean Script Completed" in the Click Event of your button after your script has completed.

I've updated your code a little bit to show how to access the text attribute of the textwindow. ===========================================================================

```<code>Add-Type -AssemblyName System.Windows.Forms

function call_Clean
{
      # Here the path to call your script
      . "C:\Scripts\Script1.ps1"
        $Form.Controls | % {
            if($_ -is [System.Windows.Forms.TextBox] -and $_.Name -eq "TestTextBox")
            {
                $_.Text = "test"
            }
        }
}

function call_CreateTestLabConfig
{
      # Here the path to call your script
      . "C:\Scripts\Script2.ps1"

}

function call_LocalDeploy
{
      # Here the path to call your script
      . "C:\Scripts\Script3.ps1"
}

function CreateFormButton ( $locationheight, $locationwidth, $sizeheight, $sizewidth, $fieldname, $functionname ) {
  $Button = New-Object System.Windows.Forms.Button
  $Button.Location = New-Object System.Drawing.Size($locationheight, $locationwidth)
  $Button.Size = New-Object System.Drawing.Size($sizeheight, $sizewidth)
  $Button.Text = $fieldname
  $Button.Add_Click( $functionname )
  $Form.Controls.Add($Button)
}

function CreateStartPosition ( $FormSize, $FormLocation ) {
 $Form.Size = New-Object System.Drawing.Size ($varFrmMSizeWidth, $varFrmMSizeHeight)
 $Form.Location = New-Object System.Drawing.Point($varFrmMLocationX, $varFrmMLocationY)
 $Form.Controls.Add($TextWindow)
}

function CreateTextWindow ( $locationHeight, $LocationWidth, $TextBoxHeight, $TextBoxWidth, $name) {
  $TextWindow = new-object System.Windows.Forms.TextBox
  $TextWindow.Size = New-Object System.Drawing.Size($textBoxHeight,$textBoxWidth)
  $TextWindow.location = new-object system.drawing.point($locationHeight,$LocationWidth)
  $TextWindow.Name = $name
  $TextWindow.Multiline = $true
  $Form.Controls.Add($TextWindow)
}

$Form = New-Object system.Windows.Forms.Form
$Form.Text = "Test Lab Tool"
#$Form.TopMost = $true
$Form.Size = New-Object System.Drawing.Size (475, 600)
$Form.Location = New-Object System.Drawing.Point(4000, 300)

CreateFormButton 20 100 120 40 'Clean' ${function:call_Clean}
CreateFormButton 170 100 120 40 'Create TestLab Config' ${function:call_CreateTestLabConfig}
CreateFormButton 315 100 120 40 'Local Deploy'
CreateTextWindow 20 160 415 375 'TestTextBox'

$Form.ShowDialog()
</code>```

Body:
Powershell novice here.  I'm trying to write a useful tool that has 3 buttons and a text window.  Each button calls a different powershell (.ps1) script that do various things. If I can I would like to write the output of those scripts to the GUI text window, but that seems to be harder to do than one would think.  If that's too much then at the minimum I would like to atleast display that the script has ran to completion in the text window.  Something like " script has been ran".

Here is what I have so far.

Add-Type -AssemblyName System.Windows.Forms

function call_Clean
{
      # Here the path to call your script
      . "C:\Scripts\Script1.ps1"
}

function call_CreateTestLabConfig
{
      # Here the path to call your script
      . "C:\Scripts\Script2.ps1"

}

function call_LocalDeploy
{
      # Here the path to call your script
      . "C:\Scripts\Script3.ps1"
}

function CreateFormButton ( $locationheight, $locationwidth, $sizeheight, $sizewidth, $fieldname, $functionname ) {
  $Button = New-Object System.Windows.Forms.Button
  $Button.Location = New-Object System.Drawing.Size($locationheight, $locationwidth)
  $Button.Size = New-Object System.Drawing.Size($sizeheight, $sizewidth)
  $Button.Text = $fieldname
  $Button.Add_Click( $functionname )
  $Form.Controls.Add($Button)
}

function CreateStartPosition ( $FormSize, $FormLocation ) {
 $Form.Size = New-Object System.Drawing.Size ($varFrmMSizeWidth, $varFrmMSizeHeight)
 $Form.Location = New-Object System.Drawing.Point($varFrmMLocationX, $varFrmMLocationY)
  $Form.Controls.Add($TextWindow)
}

function CreateTextWindow ( $locationHeight, $LocationWidth, $TextBoxHeight, $TextBoxWidth ) {
  $TextWindow = new-object System.Windows.Forms.ListView
  $TextWindow.Size = New-Object System.Drawing.Size($textBoxHeight,$textBoxWidth)
  $TextWindow.location = new-object system.drawing.point($locationHeight,$LocationWidth)
  $Form.Controls.Add($TextWindow)
}

$Form = New-Object system.Windows.Forms.Form
$Form.Text = "Test Lab Tool"
#$Form.TopMost = $true
$Form.Size = New-Object System.Drawing.Size (475, 600)
$Form.Location = New-Object System.Drawing.Point(4000, 300)

CreateFormButton 20 100 120 40 'Clean' ${function:call_Clean}
CreateFormButton 170 100 120 40 'Create TestLab Config' ${function:call_CreateTestLabConfig}
CreateFormButton 315 100 120 40 'Local Deploy'
CreateTextWindow 20 160 415 375 'Test'

$Form.ShowDialog()

Body:
Powershell is very linear. When you call a script it's going to freeze the GUI up until it is completed. You can update the GUI with information based on the return from your script, or, simply wait until the script has completed and update the GUI with the information that the script is complete.

For example:

function call_Clean
{
      # Here the path to call your script
      . "C:\Scripts\Script1.ps1"
      $TextWindow.Text = "Call Clean Script Completed"
}

Or:

You can use the same GUI update, $TextWindow.Text = "Call Clean Script Completed" in the Click Event of your button after your script has completed.

I've updated your code a little bit to show how to access the text attribute of the textwindow. ===========================================================================

Add-Type -AssemblyName System.Windows.Forms

function call_Clean
{
      # Here the path to call your script
      . "C:\Scripts\Script1.ps1"
        $Form.Controls | % {
            if($_ -is [System.Windows.Forms.TextBox] -and $_.Name -eq "TestTextBox")
            {
                $_.Text = "test"
            }
        }
}

function call_CreateTestLabConfig
{
      # Here the path to call your script
      . "C:\Scripts\Script2.ps1"

}

function call_LocalDeploy
{
      # Here the path to call your script
      . "C:\Scripts\Script3.ps1"
}

function CreateFormButton ( $locationheight, $locationwidth, $sizeheight, $sizewidth, $fieldname, $functionname ) {
  $Button = New-Object System.Windows.Forms.Button
  $Button.Location = New-Object System.Drawing.Size($locationheight, $locationwidth)
  $Button.Size = New-Object System.Drawing.Size($sizeheight, $sizewidth)
  $Button.Text = $fieldname
  $Button.Add_Click( $functionname )
  $Form.Controls.Add($Button)
}

function CreateStartPosition ( $FormSize, $FormLocation ) {
 $Form.Size = New-Object System.Drawing.Size ($varFrmMSizeWidth, $varFrmMSizeHeight)
 $Form.Location = New-Object System.Drawing.Point($varFrmMLocationX, $varFrmMLocationY)
 $Form.Controls.Add($TextWindow)
}

function CreateTextWindow ( $locationHeight, $LocationWidth, $TextBoxHeight, $TextBoxWidth, $name) {
  $TextWindow = new-object System.Windows.Forms.TextBox
  $TextWindow.Size = New-Object System.Drawing.Size($textBoxHeight,$textBoxWidth)
  $TextWindow.location = new-object system.drawing.point($locationHeight,$LocationWidth)
  $TextWindow.Name = $name
  $TextWindow.Multiline = $true
  $Form.Controls.Add($TextWindow)
}

$Form = New-Object system.Windows.Forms.Form
$Form.Text = "Test Lab Tool"
#$Form.TopMost = $true
$Form.Size = New-Object System.Drawing.Size (475, 600)
$Form.Location = New-Object System.Drawing.Point(4000, 300)

CreateFormButton 20 100 120 40 'Clean' ${function:call_Clean}
CreateFormButton 170 100 120 40 'Create TestLab Config' ${function:call_CreateTestLabConfig}
CreateFormButton 315 100 120 40 'Local Deploy'
CreateTextWindow 20 160 415 375 'TestTextBox'

$Form.ShowDialog()