Counting term occurrences in JSON arrays using regex in VS Code
Working on a project where the JSON dataset contains over 460,000 named records, we are preparing to upsert these records into Pinecone. However, for validation and testing purposes, it's essential to cross-check how many times a specific term appears across the dataset. To ensure data integrity, we only want to include one record per occurrence, regardless of whether the term appears once or multiple times within a record.
How to search for specific 'SBT' occurrences in VS Code using regular expressions
If you're working with a large codebase in Visual Studio Code (VS Code) and need to find specific occurrences of a term, but only when it's a standalone word possibly surrounded by spaces or parentheses, regular expressions (regex) are your best friend. This guide will walk you through the steps to efficiently search for these instances, I'll be searching for the term 'SBT' and ensuring you don't pick up unwanted matches like `'ADSBTCR'` or `'SBT123'`.
How to search for "text" in VS Code while excluding comments
When working with code in Visual Studio Code, you may need to search for specific instances of a function or method, such as self.logger.log. However, it can be frustrating to sift through lines that are commented out, like # self.logger.log. Fortunately, VS Code provides a powerful search feature that allows you to exclude these commented lines from your search results.
Managing VS Code extensions via terminal
Visual Studio Code (VS Code) allows you to manage extensions using the VS Code Command Line Interface (CLI) called code. With the code CLI, you can install, list, uninstall, and manage extensions from the command line.
To check you have the code prompt running, run
code --version
Response you're looking for is
VS Code - Unable to locate phpcs
phpcs issue in Visual Studio Code, I'm receiving this warning in VS Code:
phpcs: Unable to locate phpcs. Please add phpcs to your global path or use composer decency manager to install it in your project locally.
How to fix
You can install phpcs by using composer global command:
composer global require squizlabs/php_codesniffer
Then in VS Code, go to
Setting up a new local site environment
Setting up a new project in Docker and VS Code.
Using Terminal, go to your Sites directory and create a new directory using the mkdir command. In this instance I'm going to create a new directory titled ADCE
shortcut command to access the Sites directory
cd ~/Sites
Create the new directory
mkdir ADCE
Go in to the new directory
cd ADCE
Run the devcontainer command