Categories
Mastering Development

Strange behavior of makefile functions

im having issues with $(foreach..) and echo functions. im trying to iterate over a variable and append it into a file. here is my code: vars = a b c d all: @$(foreach var, $(vars), echo $(var) >> variables.txt) the generated file looks like a echo b echo c echo d i have no idea […]

Categories
Mastering Development

Python parameterized SQL adding extra apostrophes

Having an issue with a parameterized psycopg2/flask/postgres query inserting an extra apostrophe and wondering how to stop that. I read every article on here that seemed – based on my issue – to answer my question but nope, didn’t see any, so here I am! Thanks for any help you can give! THE ERROR MESSAGE […]

Categories
CMS Mastering Development Wordpress

wp_localize_script no longer working after 5.5 update

Why this function is no longer working in my theme after WordPress 5.5 updater: add_action(‘wp_enqueue_scripts’, function() { $vars = array(’11’ => ’22’); wp_localize_script(‘jquery’, ‘vars’, $vars); }); It used to insert JS code in the header before the 5.5 update.

Categories
Mastering Development

Modify value of body in django request

I want to update the value of the json body value in a post Request in my django API (also using rest framework), right now I’m trying to doing this with a custom middleware. This is my middleware. def CustomMiddleware(get_response): def middleware(request): print(‘request: ‘, request, ‘ type: ‘, type(request), ‘ vars: ‘, vars(request)) print(‘request: ‘, […]

Categories
Mastering Development

custom functions do not produce multi-index columns in pivot_table (pandas)

I want to use pandas function “pivot_table” to create two new columns from the original column ‘value’ based on levels (obs and mod) in the column “obsmod”. You can find sample data here. I want to have percentiles along with mean, median, and std. So I made the following script. def my5(g): return np.percentile(g, 5) […]

Categories
Mastering Development

how to solve “ERROR: Names must be unique.” in r-package ggstatsplot?

The problem: I tried to run a function (ggwithinplot) to plot data in an r package, ggstatsplot. But it took a long time to run this function, and nothing turned out. So I shut down this function while it was running. I tried waiting. It didn’t work. So this problem was not a time issue. […]

Categories
CMS Development Drupal

Theme suggestion for file link in on commerce product page

I’m listing some files for download on a commerce product page and I want to customize the output. I’m trying to get a theme suggestion for file-link.html.twig but I’m failing to get them to work. I’ve previously used https://www.dannyenglander.com/code/drupal-8-theming-file-link-by-content-type/ for nodes, but it causes “Call to a member function getType() on null” error, I assume […]

Categories
Development

How do I add a dynamic list of variable to the command pd.concat

I am using python3 and pandas to create a script that will: Be dynamic across different dataset lengths(rows) and unique values – completed Take unique values from column A and create seperate dataframes as variables for each unique entry – completed Add totals to the bottom of each dataframe – completed Concatenate the sperate dataframes […]

Categories
Development Linux

Offlineimap variable do not work, however, there are plenty of examples on the internet

I’ve seen examples on variable usage for expansion in offlineimaprc like this “%(variable)”. This is also in official docs: http://www.offlineimap.org/doc/ConfigurationFactorization.html I need to post-process specific maildir folders in postsynchook. I run the following command to sync mail folders: /usr/bin/offlineimap -o -q -c “/lib/gmail/.offlineimaprc” -f “Systems/<Name>/Problems” , where <Name> can be different. In above offlineimaprc there […]