Friday, December 27, 2019

UseAuthentification() and UseAuthorization differences in ASP.NET core 3.0

In the past few days struggling with implementing login on ASP.NET core 3.1 with razor
i have tried to use identityserver4 but it provides MVC template rather than razor. I actually got a simple example running but using it further has met with problems. Hence i decide to write some simple finding

what are the differences between authentication and authorization ?

app.UseAuthentication();
app.UseAuthorization();

in simple meaning,
authentication means we check a user is login or not
after login, we use policy to check the user claim and role whether they are authorized to access certain method
example role is Guest , Admin
example claim is email address, name

i put the reference here about authentification
https://visualstudiomagazine.com/articles/2019/04/01/aspnet-core-security.aspx
https://visualstudiomagazine.com/articles/2019/10/24/aspnet-core-security-2.aspx

An article on https://visualstudiomagazine.com/articles/2019/10/29/aspnet-authentication.aspx explains authorization nicely.

Saturday, August 31, 2019

adding SSD harddisk to HP Zbook Studio X360 G5

After adding M.2 NVMe PNY branded SSD to my laptop. we open disk management in Windows and is presented with this screen


after choosing the newer GPT partition style, i select disk 0, right click and select new simple simple volume
click Next and then select the partition size we want to partition our drive. 
We then choose to assign it a drive letter
Format the disk
After the very quick format we will see the new drive in windows explorer and start using it. 

Wednesday, December 26, 2018

HP Zbook Studio x360 G5

for very long time, i haven't purchased my own laptop, and last week i have received my new Zbook Studio G5. it is also the most expensive laptop that i have purchased at RM12k+

There are a couple of reason why i choose it. One is it has the combination of hardware performance i want - i7 8th generation with vPro, SSD (although only 500GB, but when i have more budget i can slot in another nvme ssd), nvidia P1000 and touch screen with pen. The hardware performance is essential for my work that involves software development involving computer vision and artificial intelligence. it is also graphically intensive as i deal with CAD software. One extra pulling factor is it has the pen input that i have long to have.

In addition, it does have a number of latest connection technologies, Bluetooth 5, thunderbolt 3. What is good is that it comes with a HDMI output, this save the trouble of hooking up to a bulky convertor to hook up for presentation, something i need to use frequently

Although i am not an artist, i enjoy writing and sketching ideas with pen. Zbook Studio G5 is paired with a WACOM pen. So far i am still very much a beginner with pen and there is nothing much that i can shout for it yet. But i do find that there is no good way for me to attach the pen to my laptop, although it comes with a holder that slots into the sd card slot. i worry that the protruding holder might break as i travel. Although the pen itself has magnet and can attach itself to the arm rest area of the laptop, that makes closing the lid not possible and risky (screen is easily broken if one accidently close the screen with the pen beneath. I find the way Microsoft surface attach its magnetic pen to the screen area is more convenient and elegant. Now i am thinking to shop for a leather holder for the pen. The pro is that the pen is responsive, and i have installed a couple of pen friendly program to try it out

Fresh paint
Tracing
One note
paint 3D
xodo
autodesk sketchbook

another thing i like after a few day usage is the feel of the keyboard, the keypress is responsive and the way the pad response to the fingers are very good. HP has really make a good keyboard for this.

Friday, December 14, 2018

troubleshooting visual studio 2017 community fail to install with event viewer

My visual studio 2017 community fail to install. after some troubleshooting, i find it is useful to use the windows event viewer


on windows search, search for event viewer. for my error it seems to be related to another program that i am running. after i end that program, installation of visual studio can be run without error



troubleshooting .net framework 3.5 won't install on windows 8.1

when this .net 3.5 framework cannot install on my windows 8.1 it make other installation fail (sourcetree, visual studio 2017). it also make uninstallation fail (like visual studio 2015)

after following some forum, i follow this thread https://www.softwarecrew.com/2012/07/net-framework-setup-verification-tool-adds-net-4-5-windows-8-support/

i install the .net framework verification tool and verify that .net 4.0 is running, and there are some comments on forum to suggest removing .net 4.0. i hesistate

eventually on the same blog by Aaron Stebner on .net framework cleanup tool at https://blogs.msdn.microsoft.com/astebner/2008/08/28/net-framework-cleanup-tool-users-guide/
As mentioned by Aaron, this tool is the last resort. Good news is that within this blog there is this .net framework repair tool 

i download and run the repair tool till the step to restart the windows installer service for me. i then successfully install .net framework 3.5 (along with 2.0 and 3.0). the last step is of course restart the pc

Saturday, September 8, 2018

Securifi Almond+ adding USB printer on Windows 10

I spent some time figuring out how to connect my USB printer to a Securifi Almond device.
i have Almond 3 and Almond+ and i find that although Almond 3 has USB port, it cannot be used for a USB printer. Below are the step for configuring a USB printer to Almond+

first follow the step on https://wiki.securifi.com/index.php/USB_printer_support_-_Almond%2B_2014

Then, in printer and scanners, try to add a printer. It will fail and we click 'The printer that i want isn't listed' . In the next page (screenshot below), select add a local printer


select create a new port







In the next page 
  • In the "Hostname or IP address:" field enter the IP address of your router.
  • The "Port name:" field may be set to something you like.
  • De-select "Query the printer and automatically select the driver to use," then click next.
  • The computer will then attempt to detect the TCP/IP port, and this will fail after some time.
  • On the "Additional port information required" page set the device type to Custom and click "Settings…"
  • Verify the Printer Name or IP Address. The Protocol should be set to "Raw" and the Raw Settings Port Number should be 9100. Leave LPR Settings and SNMP Status Enabled empty or de-selected. Then click OK.







After clicking next, select the printer driver of your printer.

Tuesday, July 31, 2018

My first Jenkins installation

after a good 3 hours, eventually i have managed to setup my first Jenkins on Ubuntu 16.04.4
due to some oversight i have actually set it up on the desktop version of Ubuntu. However, it should be working similarly to the recommended server version. I follow the instruction on https://www.digitalocean.com/community/tutorials/how-to-install-jenkins-on-ubuntu-16-04, but reader should take note that java jre and jdk are not installed automatically as dependency as guided in the url. I did a manual install via
sudo apt install openjdk-8-jre-headless
sudo apt install openjdk-8-jdk-headless

I have actually tried with server edition 18.04. it couldn't find the package of openjdk-8-jdk, causing Jenkins to fail installation