If you’ve ever set up a Rust development environment, you know the drill: install Rust, configure your toolchain, set up your editor, and manage dependencies. It can be a hassle, especially when working across different machines or collaborating with others. Enter ezRust, a lightweight Docker-based development environment for Rust that simplifies the process. What is… Continue reading ezRust: Fast Docker-Based Rust Development
Tag: programming
APIs: Why Rust’s Axum Leads Over Python’s FastAPI
In a real-world example, the difference between running a FastAPI container versus an Axum container is astonishing. The amount of memory and CPU usage for an API container that performs a series of complicated equations is astounding enough that future use cases of Python have to be seriously considered against why they should be used… Continue reading APIs: Why Rust’s Axum Leads Over Python’s FastAPI
Generating Code with AI? You Need To Learn SCM
Generating Code with AI? Use Git as SCM (Source Code Management)
WordPress: change all url/websites address in posts
The SQL statement to change all references of a string in WordPress posts is: UPDATE wp_posts SET post_content = REPLACE(post_content, ‘staging.server.com’, ‘www.productionserver.com’);
How to Get The Domain and TLD from a URL using PHP and Regular Expression
How to get a domain and it’s TLD from a URL string using PHP and Regular Expression: preg_match(“/[a-z0-9\-]{1,63}\.[a-z\.]{2,6}$/”, parse_url($_url_string, PHP_URL_HOST), $_domain_tld); echo $_domain_tld[0]; This is particularly useful for dealing with country TLD’s, like co.uk, on.gc along with the general .com, .net, etc. It is also capable of ruling-out multiple subdomains like: http://i83tr.cdn-2.delivery.net/homepage/sprite.png so you end… Continue reading How to Get The Domain and TLD from a URL using PHP and Regular Expression
WordPress Find All Global Details
The following piece of code will help list all objects, arrays and vars in the $GLOBALS variable scope. < ?php foreach($GLOBALS as $glob_key => $glob_val){ echo $glob_key.” – “; echo (is_array($glob_val)||is_object($glob_val))?print_r($glob_val,1):$glob_val; echo “\r\n”; } ?> This can be very useful as there is usually a lot of information stored in $GLOBALS by both WordPress and… Continue reading WordPress Find All Global Details
In WordPress, Replace Text In All Fields
Replacing, Updating, Changing text in WordPress fields is as easy as using the MySQL replace command. Here’s an example for updating the post_title field: update wp_posts set post_title = REPLACE(post_title, ‘Old’, ‘New’) WHERE post_title LIKE ‘%Old%’; This will update all the columns that have the word ‘Old’ in their post_title field with the word ‘New’.… Continue reading In WordPress, Replace Text In All Fields
WordPress Reserved Terms
A great list to know: WordPress, Reserved Terms A lot of issues can arrise if reserved terms are used in customization of WordPress Taxonomy and Post Types. Just best to avoid these terms in whole.
Replace HTML tags with PHP
preg_replace(‘@< (iframe|script|noscript)\b.*?>.*?@si’, ”, $string); Removes iframe, script and noscript tags and contents from $string. Performs an inverted version of strip_tags function.
Multiple MySQL query with PHP
// Enter multiple query string $query_str = ” — Update table UPDATE t SET id = id + 1; — Insert into table INSERT INTO example (name, age) VALUES(‘John Doe’, ’23’ ); “; // Explode string into separate queries $query = explode(‘;’,$query_str); // Loop through exploded queries and execute foreach($query as $index => $sql) {… Continue reading Multiple MySQL query with PHP