Get entire URL including query string in PHP

<?php // Get current protocol. $protocol = stripos($_SERVER[‘SERVER_PROTOCOL’],’https’) === 0 ? ‘https://’ : ‘http://’; // Get current domain. $domain = $_SERVER[‘HTTP_HOST’]; // Get current path to the current file. $path = $_SERVER[‘SCRIPT_NAME’]; // Get current…

Cast integer to enum in C#

Enum values can be converted to integral values and vice versa using type casts. For example: using System; public class Program { public enum ProgrammingLanguages { CSharp, PHP, Python, Java, Go, Javascript } public static…

vb.net | convert base64Binary to pdf

First convert from your base64 string to a byte array: Dim bytes As Byte() = Convert.FromBase64String(base64_string) Next save the byte array to disk: Dim stream As System.IO.FileStream = New FileStream(“C:\mypdf.pdf”, FileMode.CreateNew) Dim writer As System.IO.BinaryWriter…

Export HTML table to excel using Javascript

Simply add this script to your web page: <script src=”https://cdn.dotmaui.com/p24/js/exportTableToExcel.min.js”></script> To use it, call the exportTableToExcel() function specifying the table id as the first argument and optionally the file name as the second argument. Example:…

jQuery to pure Javascript examples – 5

Get inner text // jQuery var text = $(“#myElm”).text(); // Pure javascript var text = document.getElementById(“myElm”).textContent; Set inner text // jQuery $(“#myElm”).text(“My text”); // Pure javascript document.getElementById(“myElm”).textContent = “My text”; Get inner HTML // jQuery…

jQuery to pure Javascript examples – 4

Add onclick event // jQuery $(“#myElm”).click(function(){ alert(“Hello world”); }); // Pure javascript document.getElementById(“myElm”).addEventListener(“click”, function() { alert(“Hello world!”); }, false); Get child node by index //jQuery var child = $(“#myElm”).eq(2); // Pure javascript var child =…