IT Nota

  • Home
  • How To
  • .NET
  • WordPress
  • Contact

How to Show Hidden Folders and Files in Mac Finder

This gets asked a lot especially from someone who just switched from Windows to macOS. When you open a New Finder Window on your mac. You might want to see all the hidden files in your folder as well.

The quickest way to do it is just by using a keyboard shortcut:

  1. Open a New Finder Window on the folder where you want to see the hidden files.
  2. Press ⌘ Command + ⇧ Shift + . (Period). To be exact, hold down the Command and Shift keys together, then press the Period key.
  3. The hidden files and folders will appear semi-transparent in the finder (see below).

Hidden Folders and Files in Mac Finder, Before and After

Of course, some people may find it too distracting, in which case you can always hide them again by using the same keyboard shortcut.

February 1, 2022 Filed Under: How To Tagged With: macOS

How to Solve MS Office VBA Compile Error UserAuthentication

This is such a persistent issue that hopefully will die down soon. In a corporate world where there are so many legacy systems though, and this comes up more than we want to admit.

This happened in one corporation that has one department relies on various macro-enabled Microsoft Word documents to process requests. One morning, one processor encountered a Visual Basic for Applications error in one of their Microsoft Word forms.

MS Word VBA Compile error UserAuthentication

Microsoft Visual Basic for Applications

Compile error in hidden module: UserAuthentication.
This error commonly occurs when code is incompatible with
the version, platform, or architecture of this application. Click
"Help" for information on how to correct this error.

When you encounter this, right away check both the MS Word doc (or docx) file and what version of MS Words is used to open the file.

As the error indicates, the keyword here is code incompatible with the version… of this application.

In our case, we did not have to check their document library since we know their forms were really old. So we just needed to check their MS Office version.

If you use MS Word 2016 or later, just go to File, Account and click on About Word and check on the header. In this very specific case, the end user used a 64-bit version of MS Word to open the old document and that was the cause of error.

Microsoft Word 64-bit Version

Once we have this information, there were two options that the client could take. Either, the forms need to be rewritten or the user’s MS Word need to be downgraded to a 32-bit version. The latter option of course is easier and faster.

The client opted for a downgrade to resolve the issue.

January 24, 2022 Filed Under: How To Tagged With: Microsoft, Office

How to Install Fonts on macOS using Homebrew

If you have used Homebrew to manage your packages, you can also use it to install fonts on your macOS so long as the fonts are available. And as you’ll see in the example below, this is way easier (and quicker) than downloading the fonts and install them conventionally.

If you haven’t, it’s quick to install Homebrew. Just open your Terminal and type in the following:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Homebrew Package Manager installation page

For the latest update of this command, please check Homebrew’s website. You just need to copy the command line and paste it in your Terminal.

Here are some commands you need to know. You need to run this once:

brew tap homebrew/cask-fonts

Then, as I want to try to install some fonts with ligatures from Microsoft such as Cascadia Code and Fira Code, I want to search them first if those fonts are available.

To search the font, you can type in this command:

brew search font- | grep cascadia

Which would give the result (at this time):

font-cascadia-code
font-cascadia-code-pl
font-cascadia-mono
font-cascadia-mono-pl

We’re in luck, it’s available.

Important: The font name is all in lowercase and it’s case-sensitive. For example, you will not find anything if you typed in “Cascadia” as your search word.

Now, we just need to install the Cascadia Font by typing this command:

brew cask install font-cascadia-code

Once completed, your font is installed and active. But in this specific example, if you use Visual Studio Code, even though the font is active, you still need to enable the font ligatures before you can see it.

If you use Sublime Text on the other hand, the change is instant.

That’s all there is to it. So far, we’ve just installed one font Cascadia Code, if you also want to install Fira Code font, you can do it on your own. That would be a good exercise for you.

Additional Note

If you just run the command brew search font- without grep, you will get a list of all available fonts you can install via Homebrew.

Further Reading

How to Enable Font Ligatures in Visual Studio Code

January 21, 2022 Filed Under: How To Tagged With: macOS

How to Enable Font Ligatures in Visual Studio Code

Ligatures are special characters in a font that combine two or more characters into one.

For example, if you use a ligatured font, whenever you type != it will become ≠.

Aside from the arguments whether using a ligatured font is a good or bad thing in your code, here’s what you need to do if you want to enable it in Visual Studio Code.

For this example, we’ll use Cascadia Code (NOT Cascade as shown in the screenshots) and Fira Code. If you want to follow along, you can download the fonts by using the download link below.

On macOS, instead of downloading and installing the fonts manually, you can use Homebrew instead, which is way easier and quicker.

  1. Launch Visual Studio Code.
  2. Press CTRL+, (or Cmd ⌘+, on macOS) to open Settings.
  3. Under Settings, you can see and edit what font you want to use. The way it’s setup now, Cascadia Code is prioritized and Fira Code is used only if Cascadia Code is not available.

    Visual Studio Code Font Family in Settings

  4. To enable the ligatures though, we need to edit the settings.json file. We can type in the word “ligatures” in the Search settings box. Then click on the link Edit in settings.json to open the json file.

    Visual Studio Code Font Ligatures in settings.json

  5. You can add editor.fontLigatures and set it to true under the editor.fontFamily.

    Visual Studio Code font in settings.json

    {
      "editor.fontFamily": "'Cascadia Code', 'Fira Code'",
      "editor.fontLigatures": true,
    
    [deleted for brevity]
    
    }
    
  6. Close the settings.json tab and you should be able to see the ligatures.

Now, we can test if we can see the font ligatures work.

Testing font ligatures in Visual Studio Code

If you did not see any change, make sure you restart Visual Studio Code before trying it again.

This setting also works for Visual Studio Codium.

Download

Fira Code: free monospaced font with programming ligatures
Microsoft Cascadia Code Font

Further Reading

Ligatures in Programming Fonts are a Terrible Idea
How to Install Fonts on macOS using Homebrew

January 19, 2022 Filed Under: How To Tagged With: Code Editor, Microsoft, Visual Studio Code

How to Use Python to Connect to SQL Server

Can Python work with SQL Server database? Some may argue that SQL Server is not the best SQL database for Python, but in most cases it actually does not matter. In my corporate experience, SQL Server may be the easiest database to use with Python. Besides, in the workplace often times we just have to use what’s available to solve our business problems.

One of the advantages of Python language is the short development time that makes it very suitable to use as a simple tool to query a database.

The easiest way to access a SQL Server database with Python is by using pyodbc. From its project description, pyodbc is an open source Python module that makes accessing ODBC databases simple.

There is another driver called pymssql, but I have not tested it and it looks like even Microsoft themselves recommend pyodbc over pymssql although try to remain somewhat neutral.

There are several python SQL drivers available. However, Microsoft places its testing efforts and its confidence in pyodbc driver.

Source: Python SQL Driver: Getting Started.

You can install it by running the pip command in the Command Prompt (Windows) or Terminal (macOS):

pip install pyodbc

Once installed, create a new python file (e.g., hrquery.py) and import the pyodbc.

Example

hrquery.py

#!python3
# hr.py - Look for HR record based on last name.
#         If no argument is passed, return total count of records.

import sys, pyodbc

conn = pyodbc.connect('Driver={SQL Server};'
                      'Server=DB_SERVER_NAME;'
                      'Database=DATABASE_NAME;'
                      'UID=SQLID_OR_NTID;'
                      'PWD=PASSWORD;'
                      'Trusted_Connection=no;')

cursor = conn.cursor()

# Check if there is a passed argument (last name)
# If yes, search by last name, in parameterized query
# otherwise, give total count of records from HR table.

if len(sys.argv) > 1:
    lastName = sys.argv[1]

    cursor.execute('SELECT * FROM dbo.HR WHERE [Last name] = ?', lastName)
    for i in cursor:
        print(i)
else:
    totalCount = cursor.execute('SELECT COUNT(*) FROM dbo.').fetchval()
    print(f"\nTotal count in HR table: {totalCount} records\n")

Other than Driver and Trusted_Connection, you need to substitute the values of all the parameters with your own (Server, Database, UID, and PWD).

To run your program, you can launch Command Prompt or Terminal and type the following:

C:\> python.exe hrquery.py lastname

OR

C:\> python.exe hrquery.py

Using Windows Authentication

If you use your NTID or a Windows Service Account (Windows Authentication) to login to the database, then there’s a slight difference in how you setup the connection string. This is the preferred way nowadays since you don’t store your password as a clear text in your code.

You just need to remove the PWD and set the Trusted_Connection to yes so it will look like the following:

conn = pyodbc.connect('Driver={SQL Server};'
                      'Server=DB_SERVER_NAME;'
                      'Database=DATABASE_NAME;'
                      'UID=NTID_OR_SVCACCT;'
                      'Trusted_Connection=yes;')

That’s all there is in using Python to connect to SQL Server and the program will work the same way.

Further Reading

How to Install Python on Windows Server
pyodbc
Python SQL Driver

January 12, 2022 Filed Under: How To Tagged With: Microsoft SQL Server, Python, SQL Server

« Previous Page
Next Page »
Buy me a coffee Support this site
Buy Me a Coffee?

Categories

  • .NET
  • Coding
  • Cybersecurity
  • Database
  • How To
  • Internet
  • Multimedia
  • Photography
  • Programming
  • Resources
  • Review
  • Tips and Tricks
  • Uncategorized
  • Use Case
  • WordPress
  • Writing

Recent Posts

  • How to View Stored Procedure Code in SQL Server
  • How to Find a String in SQL Server Stored Procedures
  • How to Remove Cached Credentials without Rebooting Windows
  • ESP Work Automation: Empowering Enterprises with Streamlined Workflows and Operational Efficiency
  • How to Search for a String in All Tables in a Database

Recent Posts

  • How to View Stored Procedure Code in SQL Server
  • How to Find a String in SQL Server Stored Procedures
  • How to Remove Cached Credentials without Rebooting Windows
  • ESP Work Automation: Empowering Enterprises with Streamlined Workflows and Operational Efficiency
  • How to Search for a String in All Tables in a Database

Tags

.NET .NET Core AdSense ASP.NET Cdonts Dll Classic ASP Code Editor ETL FSharp Genesis Framework Git Google HP Asset Manager HTML5 Hugo IIS Information Security Internet Internet Information Services iOS JAMStack Linux macOS Microsoft Microsoft SQL Server MVC PHP PowerShell Python Simple Mail Transfer Protocol Smtp Server SQL SQL Server SSIS SSMS SSRS Sublime Text Visual Studio Visual Studio Code VPN Windows Windows 8 Windows 10 Windows 2012 Windows Server

Copyright © 2011-2025 IT Nota. All rights reserved. Terms of Use | Privacy Policy | Disclosure