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 ignore all unmapped properties using Automapper in C# and VB.NET

To ignore all unmapped properties using Automapper in C# and VB.NET you can use the following snippet.

Sample C#

var testClassA = new TestclassA() {Name = "Testname", Title = "Testtitle"};
Mapper.CreateMap<TestclassA, TestclassB>().ForAllMembers(opt => opt.Ignore());
Mapper.CreateMap<TestclassA, TestclassB>().ForMember(source => source.Title, destination => destination.MapFrom(x => x.Title));

var testClassB = Mapper.Map<TestclassA, TestclassB>(testClassA);
Console.WriteLine(testClassB.Title); //prints out "Testtitle"
Console.WriteLine(testClassB.Name); //print nothing  (NULL)

Sample VB.NET

Dim testClassA = New TestclassA() With { _
	Key .Name = "Testname", _
	Key .Title = "Testtitle" _
}
Mapper.CreateMap(Of TestclassA, TestclassB)().ForAllMembers(Function(opt) opt.Ignore())
Mapper.CreateMap(Of TestclassA, TestclassB)().ForMember(Function(source) source.Title, Function(destination) destination.MapFrom(Function(x) x.Title))

Dim testClassB = Mapper.Map(Of TestclassA, TestclassB)(testClassA)
Console.WriteLine(testClassB.Title)
'prints out "Testtitle"
Console.WriteLine(testClassB.Name)
'print nothing  (NULL)

Please rate this snippet

How to download a website source in Java

To download a website source in Java you can use the following snippet.

Sample Java

private static String getUrlSource(String url) throws IOException {
	URL website = new URL(url);
	URLConnection connection = website.openConnection();
	BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(connection.getInputStream(), "UTF-8"));
	String input;
	StringBuilder strBuilder = new StringBuilder();
	while ((input = bufferedReader.readLine()) != null){
			strBuilder.append(input);
	}
	bufferedReader.close();
	return strBuilder.toString();
}

Please rate this snippet

How to get the source of a website in C# and VB.NET

To get the source of a website in C# and VB.NET you can use the following snippet.

Sample C#

public static string GetHtmlSourceFromUri(string uri)
{
	var retVal = string.Empty;
	var request = (HttpWebRequest)System.Net.WebRequest.Create(uri);
	using (var response = (HttpWebResponse)request.GetResponse())
	{
		bool success = (int)response.StatusCode >= 200 && (int)response.StatusCode < 299;
		if (success)
		{
			var responseStream = response.GetResponseStream();
			if (responseStream != null)
			{
				using (var reader = new StreamReader(responseStream,Encoding.UTF8))
				{
					retVal = reader.ReadToEnd();
				}
			}
		}
	}
	return retVal;
}

Sample Vb.NET

Public Shared Function GetHtmlSourceFromUri(uri As String) As String
	Dim retVal = String.Empty
	Dim request = DirectCast(System.Net.WebRequest.Create(uri), HttpWebRequest)
	Using response = DirectCast(request.GetResponse(), HttpWebResponse)
		Dim success As Boolean = CInt(response.StatusCode) >= 200 AndAlso CInt(response.StatusCode) < 299
		If success Then
			Dim responseStream = response.GetResponseStream()
			If responseStream IsNot Nothing Then
				Using reader = New StreamReader(responseStream,Encoding.UTF8)
					retVal = reader.ReadToEnd()
				End Using
			End If
		End If
	End Using
	Return retVal
End Function

Please rate this snippet