Cannot find wrapper assembly for type library “ADODB”

Happy new year and Happy coding!
Using Visual Studio 2022 on Windows 11 with the latest updates to 24H2, started giving the following errors when trying to compile an older project:

The "ResolveComReference" task returned false but did not log an error.
Cannot find wrapper assembly for type library "ADODB". Verify that (1) the COM component is registered correctly and (2) your target platform is the same as the bitness of the COM component. For example, if the COM component is 32-bit, your target platform must not be 64-bit.

So, you Google a bit and find this, but don’t do that!
In my case, the following article helped, or just a comment from it “Mine was resolved by removing the reference to “Microsoft HTML Object Library” and adding it again in the project.“.

  • In solution Explorer, open ‘My Project’
  • Go to the tab ‘References’
  • Find your mentioned library on the top, in my case, ‘Microsoft ActiveX Data Objects 2.8 Library’ with some ‘ADODB.dll’ in a system32 folder.
  • Click the ‘Add’ button, tab COM > Type Libraries, and find your library, it should be checked.
  • UNCHECK it, and OK the popup
  • Repeat: Click the ‘Add’ button, tab COM > Type Libraries, and find your library, now unchecked.
  • CHECK it, and OK the popup
  • Save everything and try to compile again.

That should work.
If not, so sorry, but it did for me…

Have a nice day!


PHP8 and function list() = each()

Time to write something about PHP again. With PHP 7.2, the function each() is deprecated. The documentation says: “Warning This function has been DEPRECATED as of PHP 7.2.0. Relying on this function is highly discouraged.“.
If you ignored this warning before, in PHP8 you will now get the following error: Fatal error: Uncaught Error: Call to undefined function each() in /path/file.php:line
So, what do you do when you find this in your old code or in some library that you use, but is not being updated anymore? Stackoverflow to the rescue…

Continue reading PHP8 and function list() = each()

How to encode and decode Base64 in VB.NET

Because sometimes you just need a string with ‘normal characters’ instead of funky ones…

Public Function EncodeBase64(input As String) As String
	Return System.Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(input))
End Function

Public Function DecodeBase64(input As String) As String
	Return System.Text.Encoding.UTF8.GetString(Convert.FromBase64String(input))
End Function

Have a nice day!

WordPress Auto Logout

When you click on the “Remember Me” option on the login page of your WordPress website, it will keep you logged in for 2 weeks. If you don’t, it will keep your login active for 2 days. However, you can extend the auto logout period in WordPress by adding a little code snippet. Keep in mind that it will affect site’s security by keeping user logged in for too long.

function keep_me_logged_in_for_1_year($expirein) {
return 31536000; // one year in seconds
}
add_filter( 'auth_cookie_expiration', 'keep_me_logged_in_for_1_year' );

The above code will keep your authentication cookie for a year.

Have a nice day!