Skip to main content

Posts

Showing posts from 2019

Covering Multiple Grounds

I am of belief that we should have reach beyond the work we must do. I feel blessed as growing up, my father had a repair shop on side besides being employed as an Electrical Operator in a factory that built train coaches. Being of curious kind, I got plenty of opportunity to get electrical shock, hence I learned to be very careful and respect this entity that runs our world. Now my father is retired he still has a small shop beside our home. Recently he got an electrical winding machine to do winding of fan coils. Basically it wound coils you see in the picture. Everything was not dandy from get go as the machine was not particularly of high standards, there were a lot of cutting and patching to do, for it to get to point where it wound the coils reasonably well. One thing that gives me comfort is there will be lot less bandage on my father's fingers as the machine will wind coils for him. Getting to point, go out and do stuff beyond your comfort zone and be mindful and respect

Getting user First Name and Last Name from Active Directory

Recently, I had to create a asp.net MVC portal for organizing test messages. Since site is personalized for User, we were required to fetch and disply username, when they login. This being intranet site, user is authenticated using Windows Authentication. Windows user names are most of the time are mix of literal, not conveying users First and Last name. I used following code to get User First and Last name, using DirectorySearcher class to query Active Directory. Since user name in HttpContext is in format DomainName\\UserName, I had to extract user name alone and use it filter. using System.DirectoryServices; ... ... DirectorySearcher ds = new DirectorySearcher(); var indexOfBS = User.Identity.Name.IndexOf( "\\" ); ds.Filter = String.Format( "((SAMAccountName={0}))" , User.Identity.Name.Substring(indexOfBS + 1, User.Identity.Name.Length - indexOfBS - 1)); ds.PropertiesToLoad.Add( "givenName" ); ds.PropertiesToLoad.Add( "sn" ); var direc

Visio 2019 license fix

Today I faced an issue with Visio 2019 License, even though I have MSDN license for Visio, for some reason today when I opened Visio, the title bar displayed message stating it is an unlicensed version. After quick search I was able to fix with license troubleshooter provided by Microsoft. Link:  unlicensed-product-and-activation-errors-in-office