Tuesday, October 17, 2017

View Article

Промучался с установкой сертификата на unifi.
в итоге получилось после того как записал cloudkey.key без шифрования
View Article:

'via Blog this'

Friday, August 11, 2017

How to Attach a SQL Server Database without a Transaction Log and with Open Transactions

Помогло с восстановление SQL баз....
How to Attach a SQL Server Database without a Transaction Log and with Open Transactions: "USE master GO DBCC TRACEON(3604) GO ALTER DATABASE TestDB_Repair SET EMERGENCY GO ALTER DATABASE TestDB_Repair SET SINGLE_USER GO DBCC CHECKDB('TestDB_Repair', REPAIR_ALLOW_DATA_LOSS) WITH ALL_ERRORMSGS GO ALTER DATABASE TestDB_Repair SET MULTI_USER GO"

'via Blog this'

Wednesday, February 22, 2017

VBA украинский транслит и regexp

Dim direction As Boolean


Public Function ТРАНСЛИТ(ТЕКСТ As String) As String
Dim UA As Variant, Eng As Variant
Dim i As Long, j As Integer
Dim simb As String
Dim FindUA As Boolean
Dim simbtrans As String
Dim MergeText As String

UA = Array("а", "б", "в", "г", "ґ", "д", "е", "є", "ж", "з", "и", "і", "ї", "й", "к", "л", "м", "н", "о", "п", "р", "с", "т", "у", "ф", "х", "ц", "ч", "ш", "щ", "ь", "ю", "я", "'")
Eng = Array("a", "b", "v", "h", "g", "d", "e", "ie", "zh", "z", "y", "i", "i", "i", "k", "l", "m", "n", "o", "p", "r", "s", "t", "u", "f", "kh", "ts", "ch", "sh", "shch", "", "iu", "ia", "")
EngF = Array("a", "b", "v", "h", "g", "d", "e", "ye", "zh", "z", "y", "i", "yi", "y", "k", "l", "m", "n", "o", "p", "r", "s", "t", "u", "f", "kh", "ts", "ch", "sh", "shch", "", "yu", "ya", "")

simb = Mid(ТЕКСТ, 1, 1)
FindUA = False

For j = 0 To 33
If UA(j) = simb Then
simbtrans = EngF(j)
FindUA = True
Exit For
End If
Next
If FindUA Then MergeText = MergeText & simbtrans Else MergeText = MergeText & simb

For i = 2 To Len(ТЕКСТ)
simb = Mid(ТЕКСТ, i, 1)
FindUA = False

For j = 0 To 33
If UA(j) = simb Then
simbtrans = Eng(j)
FindUA = True
Exit For
End If
Next
If FindUA Then MergeText = MergeText & simbtrans Else MergeText = MergeText & simb
Next
ТРАНСЛИТ = MergeText
End Function


Function regex(strInput As String, matchPattern As String, Optional ByVal outputPattern As String = "$0") As Variant
Dim inputRegexObj As New VBScript_RegExp_55.RegExp, outputRegexObj As New VBScript_RegExp_55.RegExp, outReplaceRegexObj As New VBScript_RegExp_55.RegExp
Dim inputMatches As Object, replaceMatches As Object, replaceMatch As Object
Dim replaceNumber As Integer

With inputRegexObj
.Global = True
.MultiLine = True
.IgnoreCase = False
.Pattern = matchPattern
End With
With outputRegexObj
.Global = True
.MultiLine = True
.IgnoreCase = False
.Pattern = "\$(\d+)"
End With
With outReplaceRegexObj
.Global = True
.MultiLine = True
.IgnoreCase = False
End With

Set inputMatches = inputRegexObj.Execute(strInput)
If inputMatches.Count = 0 Then
regex = False
Else
Set replaceMatches = outputRegexObj.Execute(outputPattern)
For Each replaceMatch In replaceMatches
replaceNumber = replaceMatch.SubMatches(0)
outReplaceRegexObj.Pattern = "\$" & replaceNumber

If replaceNumber = 0 Then
outputPattern = outReplaceRegexObj.Replace(outputPattern, inputMatches(0).Value)
Else
If replaceNumber > inputMatches(0).SubMatches.Count Then
'regex = "A to high $ tag found. Largest allowed is $" & inputMatches(0).SubMatches.Count & "."
regex = CVErr(xlErrValue)
Exit Function
Else
outputPattern = outReplaceRegexObj.Replace(outputPattern, inputMatches(0).SubMatches(replaceNumber - 1))
End If
End If
Next
regex = outputPattern
End If
End Function