DELETE e1 FROM EMPLOYEE e1, EMPLOYEE e2 WHERE e1.name = e2.name AND e1.id > e2.id;
Tuesday, 21 April 2015
To Remove Duplicate from mysql Table Query
Friday, 17 April 2015
Missing build configuration dropdown in Visual Studio 2008
Build configuration dropdown
9
My project is using Microsoft Visual Studio 2008 for development. For some strange reason the build configuration dropdown does not show up by default in the IDE.
I found the following procedure online and very helpful. It describes how to get this useful dropdown visible:
- In Visual Studio 2008, click “Tools” -> “Options”
- Under “Projects and Solutions” -> “General”, check “Show advanced build options”, and click “OK”
- Right click anywhere in the blank space of the toolbar and click “Customize…”
- In “Commands” tab, select “Build” in “Categories”.
- Scroll the right listbox to the bottom and drag “Solution Configurations” to the toolbar
Opening A URL in vb.net
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
System.Diagnostics.Process.Start("http://nishant2u.blogspot.in/")
End Sub
End Sub
Email Validation function in Vb.net
Public Function ValidateEmail(ByVal strEmail As String) As Boolean
Dim strtmp As String, n As Long, sExt As String
ValidateEmail = True
If strEmail = "" Then
ValidateEmail = False
Exit Function
ElseIf strEmail.ToLower.Contains("error") Then
ValidateEmail = False
Exit Function
ElseIf strEmail.ToLower.Contains("eror") Then
ValidateEmail = False
Exit Function
ElseIf strEmail.ToLower.Contains("websit") Then
ValidateEmail = False
Exit Function
ElseIf strEmail.ToLower.Contains("webside") Then
ValidateEmail = False
Exit Function
ElseIf strEmail.ToLower.Contains("webste") Then
ValidateEmail = False
Exit Function
ElseIf strEmail.ToLower.Contains("webite") Then
ValidateEmail = False
Exit Function
ElseIf strEmail.ToLower.Contains("wqebsite") Then
ValidateEmail = False
Exit Function
ElseIf strEmail.ToLower.Contains("ebsite") Then
ValidateEmail = False
Exit Function
ElseIf strEmail.ToLower.Contains("wesid") Then
ValidateEmail = False
Exit Function
ElseIf strEmail.ToLower.Contains("wewbsite") Then
ValidateEmail = False
Exit Function
ElseIf strEmail.ToLower.Contains("websitw") Then
ValidateEmail = False
Exit Function
ElseIf strEmail.ToLower.Contains("websive") Then
ValidateEmail = False
Exit Function
ElseIf strEmail.ToLower.Contains("websitw") Then
ValidateEmail = False
Exit Function
ElseIf strEmail.ToLower.Contains("webit") Then
ValidateEmail = False
Exit Function
ElseIf strEmail.ToLower.Contains("websi") Then
ValidateEmail = False
Exit Function
ElseIf InStr(1, strEmail, "@") = 0 Then
ValidateEmail = False
Exit Function
ElseIf InStr(1, strEmail, "@") = 1 Then
ValidateEmail = False
Exit Function
ElseIf InStr(1, strEmail, "@") = Len(strEmail) Then
ValidateEmail = False
Exit Function
ElseIf InStr(InStr(1, strEmail, "@") + 1, strEmail, "@") > 0 Then
ValidateEmail = False
Exit Function
ElseIf InStr(1, strEmail, "@.") > 0 Then
ValidateEmail = False
Exit Function
ElseIf Len(strEmail) < 6 Then
ValidateEmail = False
Exit Function
End If
sExt = ""
If InStr(InStr(1, strEmail, "@"), strEmail, ".") <> 0 Then
sExt = Right(strEmail, Len(strEmail) - InStr(InStr(1, strEmail, "@"), strEmail, "."))
End If
If sExt = "" Then
ValidateEmail = False
Exit Function
End If
strtmp = strEmail
While InStr(1, strtmp, "@") <> 0
n = 1
strtmp = Right(strtmp, Len(strtmp) - InStr(1, strtmp, "@"))
End While
If n > 1 Then
ValidateEmail = False
End If
End Function
Dim strtmp As String, n As Long, sExt As String
ValidateEmail = True
If strEmail = "" Then
ValidateEmail = False
Exit Function
ElseIf strEmail.ToLower.Contains("error") Then
ValidateEmail = False
Exit Function
ElseIf strEmail.ToLower.Contains("eror") Then
ValidateEmail = False
Exit Function
ElseIf strEmail.ToLower.Contains("websit") Then
ValidateEmail = False
Exit Function
ElseIf strEmail.ToLower.Contains("webside") Then
ValidateEmail = False
Exit Function
ElseIf strEmail.ToLower.Contains("webste") Then
ValidateEmail = False
Exit Function
ElseIf strEmail.ToLower.Contains("webite") Then
ValidateEmail = False
Exit Function
ElseIf strEmail.ToLower.Contains("wqebsite") Then
ValidateEmail = False
Exit Function
ElseIf strEmail.ToLower.Contains("ebsite") Then
ValidateEmail = False
Exit Function
ElseIf strEmail.ToLower.Contains("wesid") Then
ValidateEmail = False
Exit Function
ElseIf strEmail.ToLower.Contains("wewbsite") Then
ValidateEmail = False
Exit Function
ElseIf strEmail.ToLower.Contains("websitw") Then
ValidateEmail = False
Exit Function
ElseIf strEmail.ToLower.Contains("websive") Then
ValidateEmail = False
Exit Function
ElseIf strEmail.ToLower.Contains("websitw") Then
ValidateEmail = False
Exit Function
ElseIf strEmail.ToLower.Contains("webit") Then
ValidateEmail = False
Exit Function
ElseIf strEmail.ToLower.Contains("websi") Then
ValidateEmail = False
Exit Function
ElseIf InStr(1, strEmail, "@") = 0 Then
ValidateEmail = False
Exit Function
ElseIf InStr(1, strEmail, "@") = 1 Then
ValidateEmail = False
Exit Function
ElseIf InStr(1, strEmail, "@") = Len(strEmail) Then
ValidateEmail = False
Exit Function
ElseIf InStr(InStr(1, strEmail, "@") + 1, strEmail, "@") > 0 Then
ValidateEmail = False
Exit Function
ElseIf InStr(1, strEmail, "@.") > 0 Then
ValidateEmail = False
Exit Function
ElseIf Len(strEmail) < 6 Then
ValidateEmail = False
Exit Function
End If
sExt = ""
If InStr(InStr(1, strEmail, "@"), strEmail, ".") <> 0 Then
sExt = Right(strEmail, Len(strEmail) - InStr(InStr(1, strEmail, "@"), strEmail, "."))
End If
If sExt = "" Then
ValidateEmail = False
Exit Function
End If
strtmp = strEmail
While InStr(1, strtmp, "@") <> 0
n = 1
strtmp = Right(strtmp, Len(strtmp) - InStr(1, strtmp, "@"))
End While
If n > 1 Then
ValidateEmail = False
End If
End Function
String Sound Matching in Vb.net
Public Class SoundexComparison
Public Shared Function GetSoundexCode(ByVal word As String) As String
word = word.ToUpper()
' Keep the first character of the word.
Dim SoundexCode As String = word.Substring(0, 1)
Dim i As Integer
For i = 1 To word.Length - 1
' Transform a single character.
Dim Character As String = Transform(word.Substring(i, 1))
' Decide whether to append this character code,
' depending on the previous sound.
Select Case word.Substring(i - 1, 1)
Case "H", "W"
' Ignore
Case "A", "E", "I", "O", "U"
' Characters separated by a vowel represent distinct
' sounds, and should be encoded.
SoundexCode &= Character
Case Else
If SoundexCode.Length = 1 Then
' We only have the first character, which is never
' encoded. However, we need to check whether it is
' the same phonetically as the next character.
If Transform(word.Substring(0, 1)) <> Character Then
SoundexCode &= Character
End If
Else
' Only add if it does not represent a duplicated
' sound.
If Transform(word.Substring(i - 1, 1)) <> _
Character Then
SoundexCode &= Character
End If
End If
End Select
Next
' A SoundEx code must be exactly 4 characters long.
' Pad it with zeroes in case the code is too short.
SoundexCode = SoundexCode.PadRight(4, "0"c)
' Truncate the code if it is too long.
Return SoundexCode.Substring(0, 4)
End Function
Public Shared Function Transform(ByVal character As String) As String
' Map the character to a SoundEx code.
Select Case character
Case "B", "F", "P", "V"
Return "1"
Case "C", "G", "J", "K", "Q", "S", "X", "Z"
Return "2"
Case "D", "T"
Return "3"
Case "L"
Return "4"
Case "M", "N"
Return "5"
Case "R"
Return "6"
Case Else
' All other characters are ignored.
Return String.Empty
End Select
End Function
End Class
Public Shared Function GetSoundexCode(ByVal word As String) As String
word = word.ToUpper()
' Keep the first character of the word.
Dim SoundexCode As String = word.Substring(0, 1)
Dim i As Integer
For i = 1 To word.Length - 1
' Transform a single character.
Dim Character As String = Transform(word.Substring(i, 1))
' Decide whether to append this character code,
' depending on the previous sound.
Select Case word.Substring(i - 1, 1)
Case "H", "W"
' Ignore
Case "A", "E", "I", "O", "U"
' Characters separated by a vowel represent distinct
' sounds, and should be encoded.
SoundexCode &= Character
Case Else
If SoundexCode.Length = 1 Then
' We only have the first character, which is never
' encoded. However, we need to check whether it is
' the same phonetically as the next character.
If Transform(word.Substring(0, 1)) <> Character Then
SoundexCode &= Character
End If
Else
' Only add if it does not represent a duplicated
' sound.
If Transform(word.Substring(i - 1, 1)) <> _
Character Then
SoundexCode &= Character
End If
End If
End Select
Next
' A SoundEx code must be exactly 4 characters long.
' Pad it with zeroes in case the code is too short.
SoundexCode = SoundexCode.PadRight(4, "0"c)
' Truncate the code if it is too long.
Return SoundexCode.Substring(0, 4)
End Function
Public Shared Function Transform(ByVal character As String) As String
' Map the character to a SoundEx code.
Select Case character
Case "B", "F", "P", "V"
Return "1"
Case "C", "G", "J", "K", "Q", "S", "X", "Z"
Return "2"
Case "D", "T"
Return "3"
Case "L"
Return "4"
Case "M", "N"
Return "5"
Case "R"
Return "6"
Case Else
' All other characters are ignored.
Return String.Empty
End Select
End Function
End Class
Subscribe to:
Posts (Atom)