Unleashing the Power of PostgreSQL Event-Based Triggers

https://www.percona.com/blog/wp-content/uploads/2023/03/lucas.speyer_a_postgresql_texture_like_an_elephant_cb75dd38-d342-444a-b3a3-c9b8a348a816-150×150.pngPostgreSQL Event-Based Triggers

PostgreSQL provides a powerful mechanism for implementing event-driven actions using triggers. Triggers on Data Definition Language (DDL) events are a powerful feature of PostgreSQL that allows you to perform additional actions in response to changes to the database schema. DDL events include operations such as CREATE, ALTER, and DROP statements on tables, indexes, and other database objects. In this blog post, we will explore using triggers on DDL events in PostgreSQL to implement custom logic and automate database management tasks.

Creating event-based triggers

To create an event-based trigger in PostgreSQL, first, create a trigger function that defines the logic to be executed when the trigger fires. The trigger function can be written in PL/SQL or PL/Python, or any language supported by PostgreSQL.

Trigger function can be created in the same way as we create any user-defined function except that it returns event_trigger variable unlike returning the normal datatypes:

CREATE OR REPLACE FUNCTION
RETURNS event_trigger AS
$$
DECLARE
-- Declare variables if needed
BEGIN
-- Function body
-- Perform desired actions when the trigger fires
END;
$$
LANGUAGE plpgsql;

Once the trigger function is created, the trigger can be created that is associated with a specific event. Unlike normal triggers (which are executed for INSERT, UPDATE, and DELETE kinds of DML operations) that are created on specific tables, event-based triggers are created for DDL events and not on a particular table.

CREATE EVENT TRIGGER trigger_name
[ ON event_trigger_event ]
[ WHEN filter_condition ]
EXECUTE FUNCTION trigger_function_name();

In this syntax, event_trigger_event can be any of the following events, which are described in more detail in PostgreSQL documentation.

  • ddl_command_start,
  • ddl_command_end,
  • sql_drop and
  • table_rewrite

This syntax will be clearer after seeing the example in the next sections.

Using triggers on DDL events

Triggers on DDL events can be used for a wide range of purposes and database management tasks. Here are some examples of how to use DDL triggers:

  • Log schema changes: One can use DDL triggers to log all schema changes, providing an audit trail of who made the changes and when.
  • Automate database management tasks: One can use DDL triggers to automate routine database management tasks, such as creating indexes or updating views.
  • Enforce naming conventions: One could use a DDL trigger to enforce naming conventions for tables and columns, ensuring that all objects are named consistently.

Let’s create a few triggers that help us understand all the above usages of event triggers.

Before creating the trigger, let’s create the table which will log all the DDL statements:

CREATE TABLE ddl_log (
id integer PRIMARY KEY,
username TEXT,
object_tag TEXT,
ddl_command TEXT,
timestamp TIMESTAMP
);
CREATE SEQUENCE ddl_log_seq;

Let’s create the event trigger function, which will insert the data into the above table:

CREATE OR REPLACE FUNCTION log_ddl_changes()
RETURNS event_trigger AS $$
BEGIN
INSERT INTO ddl_log
(
id,
username,
object_tag,
ddl_command,
Timestamp
)
VALUES
(
nextval('ddl_log_seq'),
current_user,
tg_tag,
current_query(),
current_timestamp
);
END;
$$ LANGUAGE plpgsql;

Let’s finally create the trigger, which will call the trigger function created above:

CREATE EVENT TRIGGER log_ddl_trigger
ON ddl_command_end
EXECUTE FUNCTION log_ddl_changes();

Let’s create a test table and check if we get the entry in the ddl_log table or not:

demo=# create table test (t1 numeric primary key);
CREATE TABLE
demo=# select * from ddl_log;
id | username | object_tag | ddl_command | timestamp
----+----------+--------------+---------------------------------------------+----------------------------
1 | postgres | CREATE TABLE | create table test (t1 numeric primary key); | 2023-06-02 15:24:54.067929
(1 row)
demo=# drop table test;
DROP TABLE
demo=#
demo=# select * from ddl_log;
id | username | object_tag | ddl_command | timestamp
----+----------+--------------+---------------------------------------------+----------------------------
1 | postgres | CREATE TABLE | create table test (t1 numeric primary key); | 2023-06-02 15:24:54.067929
2 | postgres | DROP TABLE | drop table test; | 2023-06-02 15:25:14.590444
(2 rows)

In this way, schema changes can be logged using the above event trigger code.

Even though it is not a rule of thumb, in my experience, it has been seen that mostly foreign key columns are used for the joining condition in queries. If we have indexes on such columns, it automizes the index creation on foreign key columns. In many applications, there are some naming conventions for table names. Let’s see an example that throws an error if the table name does not start with ‘tbl_’. Similar code can be developed for any object. Let’s check the code which will help in achieving this use case.

Common Trigger function for naming conventions and index creation — this code has been custom developed through my experience working in PostgreSQL and researching online.

CREATE OR REPLACE FUNCTION chk_tblnm_crt_indx()
RETURNS event_trigger AS
$$
DECLARE
obj record;
col record;
table_name text;
column_name text;
BEGIN
FOR obj IN SELECT * FROM pg_event_trigger_ddl_commands() WHERE command_tag = 'CREATE TABLE'
LOOP
-- Check if the table name starts with tbl_
table_name := obj.objid::regclass;
IF table_name NOT LIKE 'tbl_%' THEN
RAISE EXCEPTION 'Table name must start with tbl_';
END IF;
-- Check if there is any foreign key then create index
FOR col IN
SELECT a.attname AS column_name
FROM pg_constraint AS c
CROSS JOIN LATERAL unnest(c.conkey) WITH ORDINALITY AS k(attnum, n)
JOIN pg_attribute AS a
ON k.attnum = a.attnum AND c.conrelid = a.attrelid
WHERE c.contype = 'f' AND c.conrelid = obj.objid::regclass
LOOP
EXECUTE format('CREATE INDEX idx_%s_%s ON %s (%s)', table_name,col.column_name, table_name, col.column_name);
RAISE NOTICE 'INDEX idx_%_% ON % (%) has been created on foreign key column', table_name,col.column_name, table_name, col.column_name;
END LOOP;
END LOOP;
END;
$$ LANGUAGE plpgsql;

Let’s finally create the trigger which will call this event trigger function:

CREATE EVENT TRIGGER chk_tblnm_crt_indx_trigger
ON ddl_command_end
EXECUTE FUNCTION chk_tblnm_crt_indx();

Let’s create a table that does not start with ‘tbl_’ and check how it gives an error:

demo=# create table dept (dept_id numeric primary key, dept_name varchar);
ERROR: Table name must start with tbl_
CONTEXT: PL/pgSQL function chk_tblnm_crt_indx() line 21 at RAISE
demo=#
demo=# create table tbl_dept (dept_id numeric primary key, dept_name varchar);
CREATE TABLE

Now, let’s create another table that references the tbl_dept table to check if an index is created automatically for a foreign key column or not.

demo=# create table tbl_emp(emp_id numeric primary key, emp_name varchar, dept_id numeric references tbl_dept(dept_id));
NOTICE: INDEX idx_tbl_emp_dept_id ON tbl_emp (dept_id) has been created on foreign key column
CREATE TABLE
demo=#
demo=# di idx_tbl_emp_dept_id
List of relations
Schema | Name | Type | Owner | Table
--------+---------------------+-------+----------+---------
public | idx_tbl_emp_dept_id | index | postgres | tbl_emp
(1 row)

As per the output of di, we can see that index has been created automatically on the foreign key column.

Conclusion

Event-based triggers are a powerful feature of PostgreSQL that allows the implementation of complex business logic and helps automate database operations. By creating triggers that are associated with specific events, one can execute custom logic automatically when the event occurs, enabling one to perform additional actions and enforce business rules. With event-based triggers, one can build more robust and automated database systems that can help improve the efficiency of the data.

On the other hand, these are good for non-production environments as it might be an overhead in the production environment if the logic is too complex. In my personal opinion, if any table is populated from the application, triggers should not be created on them; such constraints should be implemented from the application side to reduce database load. At the same time, it could act as a boon for the development (or non-production) environment to follow best practices and recommendations like who did what changes, whether proper naming conventions are used or not, and similar industry standards. In my experience, I have extensively used them for audit purposes on development environments to track the changes done by a huge team of hundreds of people.

Percona Distribution for PostgreSQL provides the best and most critical enterprise components from the open-source community, in a single distribution, designed and tested to work together.

 

Download Percona Distribution for PostgreSQL Today!

Percona Database Performance Blog

50 Amazing Rarely Seen Photos From World War II

https://content.artofmanliness.com/uploads/2023/06/ww9.jpg

When you take a step back from it, modern war is genuinely bizarre. Nation-states, formed by drawing arbitrary lines on a map, fight it out over abstract principles of sovereignty, democracy, fascism, etc., and do so by trying to conquer pieces of one another’s territory and having young men in the prime of their lives kill each other until one party cries uncle.

If modern war is strange to contemplate in general, nothing feels quite so surreal as wrapping your head around World War II. The weight, stakes, and drama of it. The extent it transformed everyone’s lives, from the average joe to the well-known celebrity. The millions of people and tons of material involved. The sheer sweep of it. What a truly staggering thing: a world at war.

There’s a reason that modern books and movies perennially return to WWII for their plots. Nothing else inspires awe — that distinct mixture of both fear and wonder — in the same way. Reflecting on the war — which is ever worth doing — serves as a dizzying reminder of just what human beings are capable of: enormous death, depravity, and destruction on one hand, and great humanity and heroism on the other.

To bring an event that can seem far away and yet remains in the living memory of thousands of people back into focus, we dove deep, deep, deep into the photo archives from WWII. When the war is covered and remembered today, there are a few classic pictures that repeatedly reemerge. But, of course, tens of thousands of photographs were taken during the war, and we wanted to find and resurface some lesser-known snapshots from the Big One.

The photos’ original captions have been retained.

9/23/1943: Detroit, MI — Scene at Detroit’s Central Station as three post-Pearl Harbor dads say a fond farewell to their offspring as they leave for training at Fort Custer after induction.

Corporal James Gregory (left) holding a M1 Thompson submachine gun and T/5 (Technician fifth grade) Omer Taylor of Headquarters Company, 36th Armored Infantry Regiment, 9th Infantry Division of the United States First Army smoke cigarettes while taking cover from incoming enemy fire behind an M4 Sherman tank on 11th December 1944 in Geich near Duren in the North Rhine-Westphalia region of Germany. 

View of an American gun crew as they man a 75mm Pack Howitzer M1 (M1A1) emplacement for the defense of Torokina air field, Bougainville Island, Papua New Guinea, mid December 1943. 

An RAF Lancaster bomber over the German city of Hamburg during a bombing raid.

An alleged Soviet spy laughs at a Finnish soldier who is executing the spy in Rukajärvi, November 1942. 

Swinging from one bar to another on an overhead ladder is a muscle toughener to be reckoned with, and when these WAACS do the course in competition as part of their training, it is quite an obstacle. It is part of the intensive physical training regime at the WAAC training camp at Fort Oglethorpe, Georgia.

Coast Guardsmen on the deck of the U.S. Coast Guard Cutter Spencer watch the explosion of a depth charge which blasted a Nazi U-boat’s hope of breaking into the center of a large convoy. Sinking of U-175, April 17, 1943. 

7th June 1943: US film actor Clark Gable, who is serving as a gunnery instructor with the US Army Air Force ‘somewhere in England’, manning a weapon aboard an aircraft.

Bomb damage in Manchester.

American soldiers from the 503rd parachute ski battalion rest in sleeping bags on the snow after hiking and skiing over rough mountain terrain during training exercises.

Two bomber aircrew, Sergeant J. Dickinson from Canada and Sergeant F. Gilkes from Trinidad share a joke while waiting to board their aircraft for a raid on Hamburg. Britain, 1943.

11/12/43 — Darwin, Australia: Three p.m. is siesta time in Darwin, Australia, and flying Captain R.N. Skipper dreams up a date with a dream girl. Since their flight missions usually encompass a distance of 3,000 miles, personnel of B-24 squadrons in the Darwin area are only allowed four or five raids a month. Thus, in between times, they lead a hum-drum existence, and 3 p.m. is official nap time, although the heat usually makes it impossible to sleep.

An American tank goes forward with infantrymen following in its cover, searching for Japanese that infiltrated American lines the night before. Bougainville, Solomon Islands, March 1944.

Approximately three of the seven weeks training course of the U.S. Marine recruits at Parris Island are spent on the rifle range where the future leathernecks are trained in the use of weapons with which a Marine is normally armed. This is followed by a week of advanced instruction in combat work and practice with the bayonet. Here, recruits undergo calisthenics under arms.

Sharing a joke at the wartime dance hall, 1944.

The dead body of a GI who has not been picked up is on the beach. 7th June 1944. Vierville-sur-Mer (Omaha Beach, White Dog), Normandy, France. 

A French civilian woman pours a drink of cider for a British soldier with Bren gun in Lisieux, 1944.

Infantrymen of the U. S. First Army silently move through the snow-blanketed Krinkelter woods in Belgium on their way to contact the enemy during the current Nazi counteroffensive on the First Army front.

Two Navy dauntless dive bombers are poised to plunge through the thick cloud in left foreground. They carry thousand pound bombs to be dropped on Japanese installations on Wake Island.

Assault troops leave “alligator” as it hits the beach of Morotai Island. 

A YMCA mobile canteen serves soldiers next to an anti-aircraft battery. November 1940. 

Easter morning finds Technician Fifth Grade (T/5) William E. Thomas and Private First Class (PFC) Joseph Jackson preparing a special Easter egg basket for Hitler, March 1945. 

18th September 1944: A white phosphorous shell explodes as soldiers run across the street in Brest to plant explosives in enemy positions.

The British Army in Athens, Greece, October 1944. Sergeant R. Gregory and Driver A. Hardman on the Erectheum during a tour of the Acropolis.

A group of American soldiers has gathered around a piano and sings a song in the street Montéglise. 10th August 1944. The two GI’s on the right wear the insignia of the U.S. Army’s 2nd Armored Division, which has just arrived in Barenton, Normandy, France. 

8/23/1944: Leap to free France. Thousands of vari-colored parachutes, some holding equipment, some carrying men, fill the sky over Southern France between Nice and Marseilles after dropping from their C-47 carrier planes.

617 Squadron (Dambusters) at Scampton, Lincolnshire, 22 July 1943. The crew of Lancaster ED285/AJ-T sitting on the grass, posed under stormy clouds. 

Soldiers from the 331st Infantry Regiment, 83rd Infantry Division of the United States First Army run across a road to take cover from enemy fire in the bocage hedgerows near the village of Periers during the Normandy Campaign on 21st July 1944 near Periers in Normandy, France. 

CB’s of 50th Battalion sitting on sandbags in a Canvas, NCB, Chapel, bow their heads in prayer during candlelight Holy Communion service, at Tinian, Marianas Islands. December 24, 1944.

Assault troops crossing river, Rhineland Campaign, Germany, 1945.

American Marine Corps Private First Class Natalie Slack and American Marine Corps Corporal Dean L Stidham, both wearing so-called ‘peanut suits’, overalls named so for their tan color, on the deck of the troop transport taking them to Hawaii, location unspecified, in the South Pacific, circa 1943. 

Fourth Division Marines charging from their landing craft onto the beach in the battle at Iwo Jima, Iwo Jima, Japan, March 2, 1945. 

In London during World War II, on July 30, 1944, an English soldier rescues a little girl named Barbara James from the ruins of her home after a series of aerial bombings. 

Member of Cavalry Reconnaissance Squadron checks .30-caliber machine gun, Ardennes-Alsace Campaign, Battle of the Bulge, 1945.

German patrol exploring the Egyptian desert while blowing the ghibli. El Alamein, September 1942.

A British soldier in battledress kneeling in prayer at a Service of Intercession for France which took place at Westminster Cathedral, London, 14th June, 1940.

Soldiers of 2nd Battalion, 165th Infantry Regiment from the United States Army’s 27th Infantry Division landing at Yellow Beach on Butaritari Island against the incoming defensive fire from naval ground troops of the Imperial Japanese Navy’s 6th Special Naval Landing Force during the Battle of Makin Atoll on 20th November 1943 at Butaritari Island, Makin Atoll in the Gilbert Islands. 

Infantrymen advancing under enemy shell fire, Ardennes-Alsace Campaign, Battle of the Bulge, 1945.

Black members of a Marine division on Iwo Jima. 

1941: Red Army troops storming an apartment block amidst the ruins of war-torn Stalingrad.

Using an unexploded 16-inch naval shell for a resting place, Marine Pfc. Raymond Hubert shakes a three-day accumulation of sand from his boondocker. July 4, 1944.

USS LSM(R)-190 (MacKay) a United States Navy LSM(R)-188-class Landing Ship Medium (Rocket) fires a barrage of rockets in salvos on to the shores of Tokishi Shima in a prelanding bombardment during the Okinawa Campaign on 27th March 1945 at Tokishi Shima near Okinawa, Japan. USS LSM(R)-190 (MacKay) was attacked and sunk by 3 Japanese Kamikaze aircraft off Okinawa on 4th May 1945.

U.S. soldiers aboard Landing Craft, Vehicle, Personnel (LCVP), approaching Omaha Beach, Normandy, France.

Company F, 145th Infantry, 37th Infantry Division soldiers move past the General Post Office building on their way to assault the walled city of Intramuros, Feb. 23, 1945, in Manila, Philippines.

Vertical aerial photograph taken during a daylight attack on an oil storage depot at Bec d’Ambes situated in the Garonne estuary at the confluence of the Rivers Garonne and Dordogne, France. An Avro Lancaster of No. 514 Squadron RAF flies over the target area while dense clouds of smoke rise as bombs burst among the oil storage tanks, 4 August 1944. 

Scene of cheering crowd in the streets of Paris during the Liberation. Civilians waving at French tanks. 

Parisian women welcome soldiers of the allied troops, on August 25, 1944 in Paris, after the battle for the Liberation of Paris.

Circa 1945: GIs stand at the ruins of the great living room window of Hitler’s mountain retreat in Berchtesgaden, the so-called Berghof. 

A battle-weary soldier from George S. Patton’s Third Army sleeps on the luxurious bed where Hermann Goering once slept.

A boatload of soldiers aboard a liner arrives in New York City from the Pacific front, US, circa October 1945. 

The post 50 Amazing Rarely Seen Photos From World War II appeared first on The Art of Manliness.

The Art of Manliness

Pizza Puzzles

https://theawesomer.com/photos/2023/06/pizza_puzzles_t.jpg

Pizza Puzzles

 | Buy | Link

Each slice of Stellar Factory’s pizza puzzles is a smaller puzzle indicated by patterns on the back of its pieces, making them great fun for cooperative puzzle parties. Each 550-piece, 8-slice puzzle features a wavy edge and is loaded with toppings ranging from delicious to downright disturbing. Choose from pepperoni, veggie supreme, or meat lover’s varieties.

The Awesomer

Lest we forget

http://img.youtube.com/vi/0wg5x5WaZPo/0.jpg

 

D-day, 1944.

We remember those who gave their lives for freedom on that day.

Peter

Bayou Renaissance Man

Learning How Explosions Work

https://theawesomer.com/photos/2023/06/learning_how_explosions_work_t.jpg

Learning How Explosions Work

Link

There’s data out there that helps scientists simulate what happens after an explosion gets going, but they still don’t fully understand how to simulate the genesis of a blast. Tom Scott visited a team at the UK’s University of Sheffield working on solving this problem, which could improve the safety of handling explosives and bomb disposal.

The Awesomer

ListenData: Transformers Agent: AI Tool That Automates Everything

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUCF3SxehuVWMtcrd4Ir8LM0OMQNVRubaR-dyhcQKJjfQyxs00fzXBbnie6tqQjPeDoEbjrT7XYYYYv6Ndnn1VyXGu280UqdknFTtoadJr207NXHFS5JZR34ddSW9eLu6gLRQ9CmwAe7IdBcDeHKuwYqPkbR5OMR415bf6ojXZ9PhL5zhjhiLEAdDW5g/s1600/transformers_agent.png

We have a new AI tool in the market called Transformers Agent which is so powerful that it can automate just about any task you can think of. It can generate and edit images, video, audio, answer questions about documents, convert speech to text and do a lot of other things.

Hugging Face, a well-known name in the open-source AI world, released Transformers Agent that provides a natural language API on top of transformers. The API is designed to be easy to use. With a single line code, it provides a variety of tools for performing natural language tasks, such as question answering, image generation, video generation, text to speech, text classification, and summarization.

Transformers Agent released by Hugging Face

READ MORE »

This post appeared first on ListenData

Planet Python

Using LaraChain to Seamlessly Integrate Your API, Data, and LLMs

https://i.ytimg.com/vi/_ZHbHCLQceQ/maxresdefault.jpgIn today’s video, we’ll demonstrate how effortless it is to construct an API using LaraChain. This API will enable authenticated requests to ask Large Language Models, like OpenAI, questions about your data. With just a few clicks, your applications can communicate with your data and interact with the LLM in use.Laravel News Links

Bootstrap 5.3.0: Unlocking Its Exciting New Features

https://static1.makeuseofimages.com/wordpress/wp-content/uploads/2022/11/HTML-webpage-on-screen-with-boostrap-styles.jpg

Bootstrap is a popular front-end framework that has revolutionized web development. With its latest release, Bootstrap 5.3.0, the framework has introduced a wealth of exciting new features and enhancements that empower you to create stunning, responsive, feature-rich websites and applications.

Dark Mode Toggle

One of the noteworthy Bootstrap 5.3.0 additions is a toggle for dark mode. This toggle lets users of your website effortlessly switch between light and dark modes, facilitating seamless usage of your website or application across various lighting conditions.

MAKEUSEOF VIDEO OF THE DAYSCROLL TO CONTINUE WITH CONTENT

To use this feature, simply add the data-bs-toggle=”dark-mode” attribute to any button or link element.

Here’s an example:

 <button type="button" class="btn btn-primary" data-bs-toggle="dark-mode">
   Toggle Dark Mode
</button>

Font Scale Utilities

Bootstrap 5.3.0 introduces a set of font scale utilities that allow you to quickly adjust the size of your text based on predefined scales, without having to pick specific font values yourself.

You can use these utilities in combination with other Bootstrap typography classes to achieve scalable and consistent typography across your website or application.

Here are a few examples of how you can use the font scale utilities:

 <p class="fs-1">This is the largest font size</p>
<p class="fs-2">This is a slightly smaller font size</p>
<p class="fs-3">This is a medium font size</p>
<p class="fs-4">This is a small font size</p>
<p class="fs-5">This is the smallest font size</p>

Gutter Utilities

Another new addition in Bootstrap 5.3.0 is the introduction of gutter utilities. These utilities make it easy to add gutters between columns in your Bootstrap grid layout without having to write custom CSS.

Here’s an example of how you can use the gutter utilities:

 <div class="row gx-3"> 
    <div class="col">Column 1</div>
    <div class="col">Column 2</div>
</div>

This example uses the gx-3 class to add a gutter of 3 units (or 1.5rem) between the two columns.

Updated Form Controls

The form controls in Bootstrap have been updated in version 5.3.0 to improve consistency and usability. The new form controls include updated styles for checkboxes, radio buttons, and select boxes, as well as improved validation feedback.

Checkboxes and Radio Buttons

Bootstrap 5.3.0 introduces new styles for checkboxes and radio buttons that make them easier to use and more accessible. The new design features larger hit areas and improved focus indicators, making it easier for you to interact with these inputs.

Here’s an example of how you can use the new checkbox styles:

 <div class="form-check">
    <input class="form-check-input" type="checkbox" value="" id="check1">
    <label class="form-check-label" for="check1">Default checkbox</label>
</div>

And here’s an example of how you can use the new radio button styles:

 <div class="form-check"> 
    <input class="form-check-input" type="radio" name="exampleRadios" id="radio1" value="option1">
    <label class="form-check-label" for="radio1"> Option 1 </label>
</div>

Notice how this markup uses the .form-check-input class to style the input element itself, and the .form-check-label class to style the label.

Select Boxes

Select boxes have also been updated in Bootstrap 5.3.0 with new styles for better consistency and usability. The new select box styles feature larger hit areas and improved focus indicators, making it easier for you to interact with these inputs.

Here’s an example of how you can use the new select box styles:

 <select class="form-select" aria-label="Default select example"> 
  <option selected>Open this select menu</option>
  <option value="1">One</option>
  <option value="2">Two</option>
  <option value="3">Three</option>
</select>

Notice how you can use the .form-select class to style the select box itself.

Validation Feedback

Bootstrap 5.3.0 also introduces new validation feedback styles for form controls. These styles make it easier to provide visual feedback to your website users when they fill out a form incorrectly.

Here’s an example of how you can use the new validation styles:

 <div class="form-group"> 
  <label for="exampleInputPassword1">Password</label>
  <input type="password" class="form-control is-invalid" id="exampleInputPassword1" placeholder="Password" required>
   <div class="invalid-feedback"> Please provide a valid password. </div>
</div>

Notice how the .is-invalid class indicates that the input field is invalid, and the .invalid-feedback class displays a message to the user.

With these new styles, it’s easier than ever to create accessible and consistent forms for your website or application.

Exciting Enhancements in Bootstrap 5.3.0

Bootstrap 5.3.0 is a significant update to the popular CSS framework that brings several new features and improvements to the table. From the dark mode toggle to the font scale utilities and gutter utilities, there are plenty of new tools at your disposal to help you build better websites and applications.

MakeUseOf

1000 LEGO Astronauts Head to Space

https://theawesomer.com/photos/2023/06/lego_astronauts_in_space_t.jpg

1000 LEGO Astronauts Head to Space

Link

Some LEGO astronaut minifigs go their whole lives only dreaming of space travel. Now, 1000 lucky minifigs have traveled to the edge of space courtesy of LEGO and Kreativ Gang. Three crews of 335 plastic astronauts flew to a height of roughly 35,500 meters aboard a carbon fiber and stainless steel space shuttle carried aloft by a weather balloon.

The Awesomer

They taught their kids properly back then

 

A friend sent me a link to an article titled "Return of the One Room Schoolhouse".  I found it very interesting, particularly because it gave examples of eighth grade final examinations from 1895.  I doubt most of our modern schoolchildren could pass them – in fact, I think most of us adults would have a hard time with them too!

Here, for example, is the Geography exam.

Geography (Time, one hour)

1. What is climate? Upon what does climate depend?

2. How do you account for the extremes of climate in Kansas?

3. Of what use are rivers? Of what use is the ocean?

4. Describe the mountains of N.A.

5. Name and describe the following: Monrovia, Odessa, Denver, Manitoba, Hecla, Yukon, St. Helena, Juan Fernandez, Aspinwall and Orinoco.

6. Name and locate the principal trade centers of the U.S.

7. Name all the republics of Europe and give capital of each.

8. Why is the Atlantic Coast colder than the Pacific in the same latitude?

9. Describe the process by which the water of the ocean returns to the sources of rivers.

10. Describe the movements of the earth. Give inclination of the earth.

All that in one hour?  I’d be very hard pressed to answer that many questions, concisely enough, in that time limit.

Click over to the article to look at the examinations for English, arithmetic and other subjects.  They’re interesting and thought-provoking.  Why are modern children taught so much less factually, and so much more about irrelevant, touchy-feely subjects that will do nothing to help them as adults?

Peter

Bayou Renaissance Man