Welcome to Issue #6 of The Codbix! This week: Use code visibility to illuminate unfamiliar code, Laravel community and How to Get Your Brain to Focus.
Codbix No.6
Karnataka Travel Diaries
One of the most memorable trips I ever had was to Karnataka in August 2012. It was part of my college tour and I had a blast with my ...
Hugo image shortcode
This website is built with Hugo, a static site generator that uses Markdown for writing content files...
Display refresh rate
The refresh rate of a display is the number of times per second that the image refreshes on the screen. For example, a 60Hz display will update the screen 60 times per second.
References
Hugo alert box shortcode
If you are using Hugo as your static site generator, you might want to create a card shortcode that can display different types of information on your blog posts...
Hugo Custom Shortcodes
Writings comments in the code will help you and anyone who reads the code by giving more readability and understandings.
PL SQL Constraints
To find the constraints in a table
ALL_CONSTRAINTS: Provides information about all constraints accessible to the user, across all tables in the database. It includes constraint types, status, and more, but doesn’t show column-specific details.
SELECT * FROM ALL_CONSTRAINTS
WHERE TABLE_NAME='YOUR_TABLE_NAME'
AND OWNER = 'OWNER_NAME';
To find the constarints referring to a table.
SELECT * FROM ALL_CONSTRAINTS
WHERE R_CONSTRAINT_NAME IN (
SELECT CONSTRAINT_NAME FROM ALL_CONSTRAINTS
WHERE TABLE_NAME='YOUR_TABLE_NAME'
)
AND OWNER = 'OWNER_NAME';
USER_CONS_COLUMNS: Shows details about columns associated with constraints for tables owned by the current user. It’s useful for checking specific columns involved in constraints like primary keys, foreign keys, or unique constraints.
SELECT CONSTRAINT_NAME, TABLE_NAME, COLUMN_NAME, POSITION
FROM USER_CONS_COLUMNS
WHERE TABLE_NAME = 'YOUR_TABLE_NAME';
The Simplest way to load CSS asynchronously
Sometimes we want to load the CSS asynchronously to reduce the intial page load and you can do the same by adding media="print" onload="this.media='all' to the link as below.
<link rel="stylesheet" href="/path/to/my.css" media="print" onload="this.media='all'">
Let’s dive into the details of the above:
- The link’s
mediaattribute is set toprint. printis a media type that applies to print-based media or when the user tries to print the page.- By using
media="print", the CSS file loads asynchronously (since it’s not needed immediately for screen display). - However, we still want to apply the styles to the page for screen use.
- To achieve this, we can use the
onloadattribute to change the link’smediatoallonce it finishes loading.
References
Codbix No.5
Welcome to Issue #5 of The Codbix! This week: Learn how to build tools, Things we Wished More Developers Knew About Databases, and The Italian Town That Built Its Own Sun.