Author: Jorge Saldivar
-
WordPress 6.7 Now Available
WordPress 6.7 debuts the modern Twenty Twenty-Five theme, offering ultimate design flexibility for any blog at any scale. Control your site typography like never before with new font management features. The new Zoom Out feature lets you design your site with a macro view, stepping back from the details to bring the big picture to life.
Read more: https://wordpress.org/news/2024/11/rollins/
-
CSS for YouTube iFrame
iframe[src*="youtube.com"] { max-width: 100%; height: auto; aspect-ratio: 16 / 9; }
The provided content is a CSS rule for styling
<iframe>
elements that contain YouTube videos. It sets the maximum width to 100%, makes the height adaptable (auto), and maintains an aspect ratio of 16:9. -
In JavaScript, when is the target property used in a forEach() loop?
In JavaScript, the
target
property is not directly associated with aforEach()
loop itself. However, when you’re usingforEach()
to iterate over a collection of DOM elements (like those obtained fromdocument.querySelectorAll()
), you might encounter thetarget
property if you’re working with event listeners inside the loop.Here’s an example:
document.querySelectorAll('.my-button').forEach(button => { button.addEventListener('click', (event) => { console.log(event.target); // This will log the button that was clicked }); });
In this case,
event.target
refers to the element that triggered the event (e.g., the button that was clicked). So, whiletarget
isn’t specific to theforEach()
loop, you may use it inside the loop when handling events on elements. -
Who is Larry Kenobi?
Screenshot Steve Obi-Wan Larry Kenobi is a Jedi junky responsible for the destruction of Saint Jabba’s Hospital For the Survivors of the Singularity Engine.
-
Finally getting a chance to watch Invincible S2…
… so far, not too impressed. The story telling is choppy. A lot of filler content with a thin story line.
-
MySQL CLI Quick Reference
Connecting to MySQL
- Login to MySQL:
mysql -u username -p
Prompts for a password.
- Specify Database on Login:
mysql -u username -p -D database_name
Basic Commands
- Show all databases:
SHOW DATABASES;
- Select a database:
USE database_name;
- Show all tables in the current database:
SHOW TABLES;
- Describe the structure of a table:
DESCRIBE table_name;
- Show the current MySQL user:
SELECT USER();
- Show current database:
SELECT DATABASE();
- Show process list:
SHOW PROCESSLIST;
- Show full process list (to see full queries):
SHOW FULL PROCESSLIST;
- Exit MySQL:
EXIT;
CRUD Operations
- Create a new database:
CREATE DATABASE database_name;
- Create a new table:
CREATE TABLE table_name ( id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(100), age INT );
- Insert data into a table:
INSERT INTO table_name (name, age) VALUES ('John', 30);
- Select data from a table:
SELECT * FROM table_name;
- Update data in a table:
UPDATE table_name SET age = 31 WHERE name = 'John';
- Delete data from a table:
DELETE FROM table_name WHERE name = 'John';
- Drop a table:
DROP TABLE table_name;
Loading
.sql
FilesTo load and execute an SQL file that contains queries or database structure (e.g.,
schema.sql
ordata.sql
):Method 1: From Inside the MySQL Prompt
- Open MySQL:
mysql -u username -p
- Select the database you want to load the file into:
USE database_name;
- Load the SQL file:
SOURCE /path/to/your/file.sql;
Method 2: Directly from the Command Line
You can execute the SQL file directly from the command line without entering the MySQL prompt:
mysql -u username -p database_name < /path/to/your/file.sql
This method runs the
.sql
file directly into the specified database.Common Tips
- View running MySQL queries:
UseSHOW FULL PROCESSLIST;
to view running queries, especially helpful for debugging long-running queries. - Check MySQL version:
SELECT VERSION();
- Enable SQL logging:
UseSET GLOBAL general_log = 'ON';
to start logging all queries. To view the log, check the path from the following:
SHOW VARIABLES LIKE 'general_log_file';
These commands and tips should help you navigate MySQL efficiently!
You must be logged in to post a comment.