Categories
CMS Mastering Development Wordpress

Custom permalink structure for custom post types including multiple taxonomy

The goal is to have a structure like this: example.com/tax_1/tax_2/post_name This code produces the right structure but the post can’t be found (404) // Register custom post types function register_work() { $args = array( ‘public’ => true, ‘label’ => ‘Projekt’, ‘menu_name’ => ‘work’, ‘menu_icon’ => ‘dashicons-welcome-view-site’, ‘has_archive’ => false, ‘supports’ => array( ‘thumbnail’, ‘title’ ), […]

Categories
CMS Mastering Development Wordpress

Replace word in “the_content” only for index.php

I have some posts with video tag that contains autoplay (they should autoplay when you access the post page). I am using the the_content to show these videos on index page. The problem is that when you access the home page, all the videos start playing. I have used the following function to remove it: […]

Categories
Mastering Development System & Network

Dependency Error Installing Postfix 3 on Centos 6

I’m trying to upgrade to Postfix 3 on Centos, using these instructions: https://www.ryadel.com/en/postfix-3-install-setup-linux-centos-for-sending-mail-smtp-smtps-starttls/ However, I’m getting the following dependency errors: $ sudo yum install postfix3 Loaded plugins: fastestmirror, priorities, replace, security Setting up Install Process Loading mirror speeds from cached hostfile * base: mirror.strencom.net * extras: mirror.strencom.net * remi-php56: mirror.netweaver.uk * remi-php72: mirror.netweaver.uk * remi-safe: […]

Categories
Database Development

Restore data from SQL Server backup

Monthly I need to sync a SQL Server database. Basically the source database generates a .bak file, then I take that file and restore it to the destination database. That worked for the first few times, now the destination database changed because there were some users added, and some tables created. I thought to open […]

Categories
Mastering Development

Regex works in VS Code search/replace but not in sed script

I realize this question has been asked 100 times on Stack Overflow already. Despite reading the many questions and answers I am still stuck. Start: https://website.com/page.html?q=term,tag-one,tag-two,tag-three,15 Goal: https://website.com/page.html,tag-one,tag-two,tag-three,15 This works successfully in VS Code search/replace: Search: \?.*?, Replace: , However when used in a Bash script, this: sed -E ‘s|\?.*?,|,|’ Results in this: https://website.com/page.html,15 While […]

Categories
Mastering Development

BeautifulSoup uncomment a comment by id

I want to use BeautifulSoup to change a html below to uncomment by comment tag id. <div class=”foo”> cat dog sheep goat <!–<p id=”p1″>test</p>–> <p id=”p2″> test </p> </div> This is my expected result below: <div class=”foo”> cat dog sheep goat <p id=”p1″>test</p> <p id=”p2″> test </p> </div> This is my python code I use […]

Categories
Mastering Development

calculate and replace values inside span

I have a site where I show the number of days the product is stored and a percentage of the total is charged based on the days. data-ref holds the percentage value to charge. var thistotal = $(“#total”).text(); var percent1 = $(“#date-1”).attr(“data-ref”); var delrate1 = $(“#date-rate-1”).text(); var replace1_total = thistotal.replace(“€”, “”).replace(“,”, “.”).replace(“+”, “”); var percentVal […]

Categories
Mastering Development

Append function seems doesn’t works in Python

I need an array of JSON files to insert in a DB because bulk_doc (array_of_json) is more efficient and faster than Createdoc (json_doc) I wrote this code: with open(‘C:\DATA_VOTES_CST_PTY.csv’, ‘r’) as f: key = f.readline().replace(‘\n’, ”).replace(‘\”‘, ”).split(‘,’) while (True) : line = f.readline() if (line == ”) : break else : value = line.replace(‘\n’, ”).replace(‘\”‘, […]

Categories
Mastering Development

MongoDB Result can console.log() but not pushed to array NodeJS

I have a list of users I would like to look up in my MongoDB database and once I look them up, I want to store them in an array so I can do things with the data. I’m using the official mongodb package in NodeJS. Here’s the code var chatsData = [] for (let […]

Categories
Mastering Development

How to create DataFrame inside foreach loop in Spark

I am trying to create DataFrame inside foreach loop to do some transformation/Action to get the expected out, but facing issue with NULL Pointer Exception. Code works fine while try to work with rdd. Is there any alternate way to go with DataFrame creation inside foreach? Please help. collectionJson.payloads.keySet.foreach( key => { implicit val formats […]