How to disable all links using jQuery

To disable all links using jQuery you cna use the snippet below.

Samples

jQuery Sample

If you have any questions or suggestions feel free to rate this snippet, post a comment or Contact Us via Email.

Related links:

Please rate this snippet

How to uppercase the first letter of each word in C# and VB.NET

To uppercase the first letter of each word in C# and VB.NET you can use the following snippet.

Sample C#

public static string ToTitleCase(string input)
{
	return CultureInfo.CurrentCulture.TextInfo.ToTitleCase(input);
}

Sample VB.NET

Public Shared Function ToTitleCase(input As String) As String
	Return CultureInfo.CurrentCulture.TextInfo.ToTitleCase(input)
End Function

Please rate this snippet

How to list the avaiable fonts in Java

To list the avaiable fonts in Java you can use the following snippet.

Sample Java

GraphicsEnvironment g = GraphicsEnvironment.getLocalGraphicsEnvironment();
String fonts[] = g.getAvailableFontFamilyNames();
for (int Counter = 0; Counter < fonts.length;Counter++ ){
	System.out.println(fonts[Counter]);
}

Please rate this snippet

How to iterate a dictionary in C# and VB.NET

To iterate a dictionary in C# and VB.NET you can use the following snippet.

Sample C#

var myDictionary = new Dictionary<int, string>();
myDictionary.Add(10, "Value1");
myDictionary.Add(20, "Value2");
myDictionary.Add(30, "Value3");

foreach (KeyValuePair<int, string> myPair in myDictionary)
{
    Console.WriteLine("{0} - {1}", myPair.Key, myPair.Value);
}

Sample VB.NET

Dim myDictionary = New Dictionary(Of Integer, String)()
myDictionary.Add(10, "Value1")
myDictionary.Add(20, "Value2")
myDictionary.Add(30, "Value3")

For Each myPair As KeyValuePair(Of Integer, String) In myDictionary
	Console.WriteLine("{0} - {1}", myPair.Key, myPair.Value)
Next

for more informations see KeyValuePair

Please rate this snippet

How to list all user defined functions in MSSQL

To list all user defined functions in MSSQL you can use the following snippet.

Sample MSSQL

SELECT name AS function_name, SCHEMA_NAME(schema_id) AS SCHEMA_NAME ,type_desc FROM sys.objects WHERE type_desc LIKE '%FUNCTION%' ORDER BY name asc;

Please rate this snippet

How to list all installed windows services in C# and VB.NET

To list installed services in C# and VB.NET you can use the following snippet.

Sample C#

public static void ListInstalledServices()
{
	var services = ServiceController.GetServices();
	foreach (var service in services)
	{
		Console.WriteLine(@"Installed: {0}", service.ServiceName);
	}
}

Sample VB.NET

Public Shared Sub ListInstalledServices()
	Dim services = ServiceController.GetServices()
	For Each service As var In services
		Console.WriteLine("Installed: {0}", service.ServiceName)
	Next
End Sub

Please rate this snippet

How to get all culturenames in C# and VB.NET

To get all culturenames in C# and VB.NET you can use the following snippet.

Sample C#

private static void Main(string[] args)
{
	var cultureInformations = GetCultureData();
	foreach (var cultureInformation in cultureInformations)
	{
		Console.WriteLine("Name:{0} ; SpecificName:{1}; FullName:{2}{3}", cultureInformation.Name, cultureInformation.SpecificName, cultureInformation.Fullname, Environment.NewLine);
	}
	Console.Read();
}

public static List<CultureInformation> GetCultureData()
{
	var cultureInformations = (from cultureInfo in CultureInfo.GetCultures(CultureTypes.AllCultures) let specificName = CultureInfo.CreateSpecificCulture(cultureInfo.Name).Name select new CultureInformation() {Fullname = cultureInfo.EnglishName, Name = cultureInfo.Name, SpecificName = specificName}).ToList();
	return cultureInformations.OrderBy(data => data.Name).ToList();
}

public sealed class CultureInformation
{
	public string Name { get; set; }
	public string SpecificName { get; set; }
	public string Fullname { get; set; }
}

Sample VB.NET

Private Shared Sub Main(args As String())
	Dim cultureInformations = GetCultureData()
	For Each cultureInformation As var In cultureInformations
		Console.WriteLine("Name:{0} ; SpecificName:{1}; FullName:{2}{3}", cultureInformation.Name, cultureInformation.SpecificName, cultureInformation.Fullname, Environment.NewLine)
	Next
	Console.Read()
End Sub

Public Shared Function GetCultureData() As List(Of CultureInformation)
	Dim cultureInformations = (From cultureInfo In CultureInfo.GetCultures(CultureTypes.AllCultures)Let specificName = CultureInfo.CreateSpecificCulture(cultureInfo__1.Name).NameNew CultureInformation() With { _
		Key .Fullname = cultureInfo__1.EnglishName, _
		Key .Name = cultureInfo__1.Name, _
		Key .SpecificName = specificName _
	}).ToList()
	Return cultureInformations.OrderBy(Function(data) data.Name).ToList()
End Function

Public NotInheritable Class CultureInformation
	Public Property Name() As String
		Get
			Return m_Name
		End Get
		Set
			m_Name = Value
		End Set
	End Property
	Private m_Name As String
	Public Property SpecificName() As String
		Get
			Return m_SpecificName
		End Get
		Set
			m_SpecificName = Value
		End Set
	End Property
	Private m_SpecificName As String
	Public Property Fullname() As String
		Get
			Return m_Fullname
		End Get
		Set
			m_Fullname = Value
		End Set
	End Property
	Private m_Fullname As String
End Class

Please rate this snippet

How to read a textfile line by line in VBA

To read a textfile line by line in VBA you can use the following snippet.
To read a textfile complete into a string you can use How to read a textfile in VBA.

Sample VBA

public sub ReadTextFileLinebyLine()
    Dim sFileName As String
    Dim iFile As Integer
    Dim sLine As String

	on error goto errorhandler
    sFileName = "C:\Users\Codesnippets\Desktop\Test.txt"
	
	If Len(Dir$(sFileName)) = 0 Then
        Exit Sub
    End If

    iFile = FreeFile()
    Open sFileName For Input As iFile

    Do While Not EOF(iFile)
        Line Input #iFile, sLine
        Debug.Print sLine 
    Loop

    Close iFile
	exit sub
	
errorhandler:
'handle the error your way
End Sub

Please rate this snippet