Sunday, January 10, 2021

Winner - Best clipboard tool review of 2021

After reviewing many clipboard tools, I found them all frustrating to use because they were wasting my time with too many clicks. 

With ClipBoard PlainText PowerTool, is menu driven so you can reach 111 transformations and 19 Power Tools in 1-click, saving time.

5 Top Unique Features; 

  • paste plain text into application stripping all formatting, hotkey enabled. Any 130 function can be programmed to hotkeys. 
  • For media files get full metadata extraction integration with Exiftool, that will extract metadata from copied files. Downloads and runs latest version. 
    ExifTool supports many different metadata formats including EXIF, GPS, IPTC, XMP, JFIF, GeoTIFF, ICC Profile, Photoshop IRB, FlashPix, AFCP and ID3, Lyrics3, as well as the maker notes of many digital cameras by Canon, Casio, DJI, FLIR, FujiFilm, GE, GoPro, HP, JVC/Victor, Kodak, Leaf, Minolta/Konica-Minolta, Motorola, Nikon, Nintendo, Olympus/Epson, Panasonic/Leica, Pentax/Asahi, Phase One, Reconyx, Ricoh, Samsung, Sanyo, Sigma/Foveon and Sony.
  • Launch SysInternals Process Explorer, downloads and runs latest version, never look for it again and unzip it.
  • create blogging URLs and turn an image to an inline base64 image for HTML using free Hex Editor, unlimited file images size.
  • clipboard history available in 1-click and options logging by time and SOURCE APPLICATION to create an Apple like "Screen Time" report.
World-wide 1st found in no other clipboard tool
  • on-the-fly metadata data extraction - When you copy or move a file it pulls some metadata from the file and puts it on the clipboard history. For example, below animations shows data pulled from a Word document, but works for all media files, including PDFs. 








Get it ClipBoard PlainText PowerTool the most productive and advanced clipboard tool on the planet.

 



Friday, January 8, 2021

C# .NET How to get all emails from a HTML page with a href inner text


The ExtractEmailswithInnerText method below will extract emails from an HTML page in the format "name <email@address.com>" using HTMLAgilityPack.

Here's a typical example of  an email address we find on a webpage


which is marked-up with following HTML 

<a href="mailto:marketcall@bnnbloomberg.ca">marketballs@bnnbloomberg.ca</a>

where the inner text is "marketballs@bnnbloomberg.ca".

Therefore the expect result is this aliased email address,

marketballs@bnnbloomberg.ca <marketcall@bnnbloomberg.ca>




Source Code

using System;using System.Text; using System.Linq;using HtmlAgilityPack; 
					
public class Program
{
	
	/// <summary>
	/// Extract a href with mailto (emails) links with inner text
	/// </summary>
	public static string ExtractEmailswithInnerText(string s)
	{
		string mailto = "mailto:"; 
		//removal ASCII and UNICODE control characters
		string h = new String(s.Where(c => !char.IsControl(c)).ToArray());

		StringBuilder sb = new StringBuilder(h.Length); 
		
		try
		{
			HtmlAgilityPack.HtmlDocument htmldoc  = new HtmlAgilityPack.HtmlDocument();
			htmldoc.LoadHtml(h);
			//var urls = html.DocumentNode.SelectNodes("//a[@href!='']").Select(i => i.Attributes["href"].Value);

			if (htmldoc.DocumentNode.SelectNodes("//a/@href").Count > 0)
			{

				foreach (HtmlAgilityPack.HtmlNode node in htmldoc.DocumentNode.SelectNodes("//a/@href"))
				{
					if (node.Name == "a")
					{
						if (node.Attributes["href"].Value.StartsWith(mailto))
							sb.AppendLine(string.Concat(node.InnerText.Trim(), " <", node.Attributes["href"].Value.Replace(mailto, string.Empty), ">"));
					}

				}

				return sb.ToString();
			}
			else
			{
				return string.Empty;
			}
		}
		catch //(Exception ex)
		{
			//bad formed HTML error handle it
		}

		return string.Empty;
	}
	
	public static void Main()
	{
		string html = "<a href=\"https://trojanhorsethebook.com/wordpress/\">Home</a><div class=\"footerLeft\"><p>©<script type=\"text/javascript\">copyright=new Date();update=copyright.getFullYear();document.write(update);</script>2021      Mark Russinovich.  All Rights Reserved.</p>    <p>Email: <a href=\"mailto:mark@russinovich.com\">mark@russinovich.com</a></p></div>";
		//Best practice, we should check for this empty case, but not really common, defeats purpose
		//string html2 = "<a href=\"https://trojanhorsethebook.com/wordpress/\">Home</a><div class=\"footerLeft\"><p>©<script type=\"text/javascript\">copyright=new Date();update=copyright.getFullYear();document.write(update);</script>2021      Mark Russinovich.  All Rights Reserved.</p>    <p>Email: <a href=\"mailto:mark@russinovich.com\"></a></p></div>";
		string html3 = "<div id=\"post\"><article class=\"article single\"><header class=\"article-header\"><h1>Contact</h1></header><div class=\"article-content\"><p>If you have any questions, comments or concerns, please email help@thurrott.com</p></div></article> </div>"; 
		Console.WriteLine(ExtractEmailswithInnerText(html));
		Console.WriteLine(ExtractEmailswithInnerText(html3));
	}
}

Thursday, January 7, 2021

C# .NET How to get all emails from a HTML page with a href inner text


The ExtractEmailswithInnerText method below will extract emails from an HTML page in the format "name <email@address.com>" using HTMLAgilityPack.

Here's a typical example of  an email address we find on a webpage


which is marked-up with following HTML 

<a href="mailto:marketcall@bnnbloomberg.ca">marketballs@bnnbloomberg.ca</a>

where the inner text is "marketballs@bnnbloomberg.ca".

Therefore the expect result is this aliased email address,

marketballs@bnnbloomberg.ca <marketcall@bnnbloomberg.ca>




Source Code

using System;using System.Text; using System.Linq;
					
public class Program
{
	
	/// <summary>
	/// Extract a href with mailto (emails) links with inner text
	/// </summary>
	public static string ExtractEmailswithInnerText(string s)
	{
		string mailto = "mailto:"; 
		//removal ASCII and UNICODE control characters
		string h = new String(s.Where(c => !char.IsControl(c)).ToArray());

		StringBuilder sb = new StringBuilder(h.Length); 
		
		try
		{
			HtmlAgilityPack.HtmlDocument htmldoc  = new HtmlAgilityPack.HtmlDocument();
			htmldoc.LoadHtml(h);
			//var urls = html.DocumentNode.SelectNodes("//a[@href!='']").Select(i => i.Attributes["href"].Value);

			if (htmldoc.DocumentNode.SelectNodes("//a/@href").Count > 0)
			{

				foreach (HtmlAgilityPack.HtmlNode node in htmldoc.DocumentNode.SelectNodes("//a/@href"))
				{
					if (node.Name == "a")
					{
						if (node.Attributes["href"].Value.StartsWith(mailto))
							sb.AppendLine(string.Concat(node.InnerText.Trim(), " <", node.Attributes["href"].Value.Replace(mailto, string.Empty), ">"));
					}

				}

				return sb.ToString();
			}
			else
			{
				return string.Empty;
			}
		}
		catch //(Exception ex)
		{
			//bad formed HTML error handle it
		}

		return string.Empty;
	}
	
	public static void Main()
	{
		string html = "<a href=\"https://trojanhorsethebook.com/wordpress/\">Home</a><div class=\"footerLeft\"><p>©<script type=\"text/javascript\">copyright=new Date();update=copyright.getFullYear();document.write(update);</script>2021      Mark Russinovich.  All Rights Reserved.</p>    <p>Email: <a href=\"mailto:mark@russinovich.com\">mark@russinovich.com</a></p></div>";
		//Best practice, we should check for this empty case, but not really common, defeats purpose
		//string html2 = "<a href=\"https://trojanhorsethebook.com/wordpress/\">Home</a><div class=\"footerLeft\"><p>©<script type=\"text/javascript\">copyright=new Date();update=copyright.getFullYear();document.write(update);</script>2021      Mark Russinovich.  All Rights Reserved.</p>    <p>Email: <a href=\"mailto:mark@russinovich.com\"></a></p></div>";
		string html3 = "<div id=\"post\"><article class=\"article single\"><header class=\"article-header\"><h1>Contact</h1></header><div class=\"article-content\"><p>If you have any questions, comments or concerns, please email help@thurrott.com</p></div></article> </div>"; 
		Console.WriteLine(ExtractEmailswithInnerText(html));
		Console.WriteLine(ExtractEmailswithInnerText(html3));
	}
}