Posts

Donate

Generic Method With BitConverter.GetBytes() Throws Error: CS1503 Argument 1: cannot convert from 'T' to 'bool'

Image
Hello And Good Day! There was a post in VBForums Generic Method with BitConverter.GetBytes problem on how to pass a T variable without causing the issue CS1503 Argument 1: cannot convert from 'T' to 'bool' private static byte [] GetBytes<T> (T valu) { var bytes = BitConverter.GetBytes(valu); if (BitConverter.IsLittleEndian) Array.Reverse(bytes); return bytes; } Since Generic Constraints for a numeric types isn't available at this time, I attempted to solve this issue by checking the type of T and then perform the conversion explicity. private static byte [] GetBytes<T>(T value ) { byte [] bytes; ushort val1; uint val2; Type t = typeof (T); if (t == typeof ( ushort )) { val1 = Convert.ToUInt16( value ); bytes = BitConverter.GetBytes(val1); } else if (t == t...

How To Create Or Generate PDF Reports Or Files Using DinkToPDF in .NET 5 or .NET Core Console Application

Image
Good day! In this tutorial, I will demonstrate on how to create or generate PDF reports or files using DinkToPDF in .NET 5 or .NET Core Console Application. This library is a C# .NET Core wrapper for wkhtmltopdf library that uses the Webkit engine to convert HTML files or page to PDF and was developed by 'rdvojmoc Rok Dvojmoč' from Slovenia. To begin with lets start by establishing the project structure. Project Structure 1. Create a .NET 5 or .NET Core Console Application Project. 2. Add DinkToPDF and Unity packages using NuGet. 3. Copy the libwkhtmltox (dll, dylib and so) files from DinkToPDF and attach those files to your project. Make sure to set the Copy to Output Directory attribute of those files to Copy Always . Note that there are two versions for these files,32 and 64 bit. 4. Create three folders to the project and in each folder add the empty classes or interface shown in step #6. 5. Add an empty html file called ReportTemplate inside the project and set...

Using Microsoft.Extensions.DependencyInjection In .NET 5 or .NET Core Console Application

Image
Team, Here's how to incorporate the Microsoft.Extensions.DependencyInjection namespace and it's ServiceProvider class in a .NET 5 or .NET Core Console Application project. If you're an ASP.NET Core MVC developer, you might recognize how it is applied in Startup.cs for Dependency Injection specifically ConfigureServices() method wherein the AddTransient() method is utilized to map an interface class and it's implementation type. To begin with, lets by creating a .NET 5 Console application project and follow the steps below. Project Setup 1. Add the Microsoft.Extensions.DependencyInjection package to your project via NuGet. 2. Create three folders, new classes and interfaces based from the image below. Models Add two model classes specifically Employee and Product with three properties for each class. Product.cs public class Product { public int ProductCode { get ; set ; } public string ProductName { get ; set ; } public double Prod...

Sharkoon SKILLER SGS2 Gaming Chair Product Review

Image
Team, A week ago,I decided to purchase a gaming chair at a local computer shop in one of the malls here in Cebu since the piston of my old office chair does not work anymore. I did canvass at several stores but I'm not amazed by the brands that they were selling.While most of the chairs' upholstery that were presented to me were made of leather, the Sharkoon SKILLER SGS2 Gaming Seat was made of fabric and the price is just within my budget. That's why I decided to purchase this item. The main features of Sharkoon SKILLER SGS2 Gaming Chair based from the main website Sharkoon SKILLER SGS2 Gaming Chair are: A. Breathable and Supple - which describes the upholstery that is entirely made of soft fabric. B. Versatility through Adjustability - denotes the adjustable backrest, ergonomic posture, 3D armrest and seating height. C. Comfortable Extras - these extras include suspension and tilt control system, large 60 mm wheels and a backrest which can be reclined and locked ...

How To Persist Input Control Values In Bootstrap-Table On Paging, Filtering And Searching In ASP.NET MVC

Image
Team, When working with the Bootstrap-Table by Wenzhixin in a specific project, I encountered an issue which is the value of input controls such as checkbox and textbox were lost when I performed searching, filtering or pagination of the Bootstrap-Table. I tried several solutions presented in github and the documentation such as setting the properties of data-maintain-meta-data or data-maintain-selected to true and much more. After a few hours, I did found the solution in the documentation which is Saving Row Data Using Input . The solution is to fetch the current value of the control and call Bootstrap-Table updateRow method to preserve the values. The entire page is shown below including it's JavaScript code. @{ ViewBag.Title = "Home Page"; } <div class= "row" > <div id= "divPeople" class= "col-md-12" > <div class= "table-responsive" > <table id= "tblPeople" ...

How To Insert Or Add Emojis In Microsoft Teams Status Message

Image
Good day Gents! I was trying to update my Microsoft Teams status and was wondering if I can add or insert emoji. For editing or adding new teams status, only text fields are available and there's no emoji icon similar to writing a teams message. After googling for a few minutes, I found this link Emoji's in status which is a feature request in Microsoft Teams User's Voice Forum. So far this upgrade request only has thirty votes which is relatively small and may be considered a low priority for the product team to implement. Given the limitations at hand, I tried several approach including copying an emoji in a chat message which didn't work and later found a solution using Microsoft Outlook 365. First is to create a new email message in Microsoft Outlook and press (Window Key + .). The emoji dropdown control will appear. Next is to select the emoji that you wanted to add to Teams. Copy the emoji from the newly created email message template and paste that to Micr...

.NET 5 - CA1416: This call site is reachable on all platforms. is only supported on Windows 7.0 and later

Image
Hi All, Our software architect just recently upgraded our custom class library that contains common data access classes, custom utilities and functions for our day to day tasks from .NET Framework 4.7x to .NET 5. Since we are only deploying our applications to windows users, he set the TargetFramework value to net5.0-windows in .csproj file. <Project Sdk= "Microsoft.NET.Sdk" > <PropertyGroup Label= "Globals" > <SccProjectName>SAK</SccProjectName> <SccProvider>SAK</SccProvider> <SccAuxPath>SAK</SccAuxPath> <SccLocalPath>SAK</SccLocalPath> </PropertyGroup> <PropertyGroup> <TargetFramework>net5.0-windows</TargetFramework> <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> <UseWPF>true</UseWPF> <PackageId>Utilities.XYZLibNET</PackageId> <Version>1.0.0.3</Version> <Authors>Development Te...

How To Setup TP-Link Wi-Fi Range Extender TL-WA855RE With Your Wireless Modem Or Router

Image
Hello Gents! Just recently, our ISP replaced our modem with a new one due to internet outage issues that occured these past few weeks. Since the new router's coverage can't reach some parts of our house, I have to reconnect our TP-Link TL-WA855RE range extender device to this new Wi-Fi router or modem. The steps to setup are presented below below. 1. Connect the TP-Link extender to a laptop or desktop using a CAT5 Straight-Through cable. Reset the device by pressing the reset button using a small pin. Make sure that the device is powered on. 2. Open a browser and enter the following IP address: " http://192.168.0.25 4". When the create password screen appears, add a default password. This will open the home page of the repeater. 3. In Quick Setup tab, scan for the wireless devices available. Select your Wi-Fi SSID and enter the device's password. Click Next. 4. You may check the Hide SSID Broadcast checkbox or leave it as unchecked. Then click Next. 5. A s...

WPF Custom DataGrid Vertical Scrolling Slow With Thousands Of Records

Image
Hello And Good Evening! I was tasked by our software architect to investigate an existing project of our company as to why a custom WPF DataGrid's vertical scrolling is slow, lagging or sluggish. This project will collect and show thousands of records that composed mostly hardware and software assets and it's related attributes. The DataGrid control used in the project is a custom class that inherits the DataGrid class with user-defined functions that performs specific tasks. public class clsCustomDataGrid : DataGrid { public clsCustomDataGrid() { //More codes here... } //More codes here... } We tried setting the virtualizations through the XAML but no luck. The scrolling is still lagging both using the mouse wheel and vertical scroll bar. After several attempts of researching through the forums and trying out the recommended answer, the solution that fixed the vertical scrolling issue is to set the virtualizations of the column, row, VirtualizingPanel a...

Donate