Query Product categories what have a custom field

Im trying to build a page template on wordpress that will show a list a categories that have a custom field checked.

So the taxonomy is just the default woocommerce taxonomy product_cat I then have a custom field to the product_cat taxonomy which is a check box called collectable

My set up is
Main Category

  • Child
  • Child
  • Child
  • Child

So for example 2 children categories have the tick box collectable which is set to add the value of 1 into the datbase

So I am doing a page where it will show all categories with the collectable checked.

$args = array(
    'post-type' => 'product',
    'taxonomy' => 'product_cat',
    'hide_empty' => 0
  );
  $c = get_categories($args);
  $c_keep = array();
  foreach($c as  $cat){
 if (get_field('collectable', 'category_'.$cat->term_id)) {
      $c_keep[] = $cat;
    }  
  }
  
  foreach($c_keep as $cat){
    echo $cat->name;
  }

But I am getting nothing at all returned.

I even put a

print_r( $args );

But I am still coming up with a blank (Header and footer Loads and the text above the query)

Can anyone help please

Go to Source
Author: user1348927

SQL Services are off but can access and query from other server on the same domain. Why?

Using configuration manager, I disabled the SQL Server Services for a SQL Server 2008 R2 instance. Yet, I can still connect to the instance from its replacement server, a SQL 2019 box, and query the data! Also, the jobs which I disabled are enabled and appear to have been running, i.e. last run time column. On the SQL Server 2019 environment, I am using SSMS 18.5.1.

What is going on??? Locally, I cannot connect. Is there something else that I need to disable? I’d like to understand why this is occurring.

Go to Source
Author: LeSteelBox

How to model database for system with historic relationships (many-to-many and one-to-many)

I’m working on a system with a main entity, let’s say “Members”, these members have relationships to other entities and it’s important to keep the history to be able to query and know the relationships at a given time in history.

We mainly have two kind of relationships:

  • Company (most exist and can only be on company at a given time)
  • Tags (optional, multiple tags at any given time)

After looking at this I was thinking that I could model the relationships with dates on the “relation table” something like this:

Tag:
- Id
- Text

Company
- Id 
- Name

Member:
- Id
- Name

Member2Tag
- Id
- MemberId
- TagId
- Added (DateTime)
- Removed (Nullable DateTime)

Member2Company
- Id
- MemberId
- CompanyId
- Added (DateTime)
- Removed (Nullable DateTime)

This way I’ve managed to query for relationships at any given time in history, but I started thinking about this and felt a little unsure if the “Removed”-column is really needed, I guess it is since I can’t remove the relation-row (need to keep history).

I just wanted some feedback on the design, what do you think? Have someone else faced a similar problem and used another solution?

All the best!

Go to Source
Author: Markus Knappen Johansson

Conditional Formatting Clear if another cell is not empty

apologies if that has already been answered – I’ve tried searching but nothing that is specific for this.

I am fairly novice with sheets and cant share the whole thing due to potentially confidential nature of the information.

The purpose of my sheet is to monitor dates for projects using colours.
enter image description here

I don’t want to focus too much on the date completed rows, more the rows with the projects on. It has a script in there to count the coloured cells but not sure if this interacts with my requests but thought I would include this in case.

So far, I’ve used to standard conditional formatting that doesn’t require myself to put a formula. So when the date on the (project name) row is today or yesterday (meaning it’s late) it goes red. When the date is tomorrow, it goes orange as warning.
A couple of things that I want to do are

  • I want it to be orange for longer than just the one day but I am not sure what formula to use. I’ve tried simple stuff like conditional formatting, date is tomorrow +4, as that makes sense to me but it doesn’t work, as, quite novice.
  • The second thing I want to happen is, I want to the red to stay longer to, more than just today yesterday. Again, I’ve tried to basic conditional formatting, date is today-5, as again, it just makes sense to me.
  • The final thing I want to happen is, when a date is inputted into the date completed field, I want the colour in the project name row to go clear, as if to say, something has been handed in, it’s no longer upcoming or late. For example, Take the payment holiday approaching exit. It is red, as it was yesterday. When I put the date that it was completed in for this, I want it to go clear because it’s been completed.
    I don’t know if it wont do this as I have 3 conditional formatting over it already.

I hope this is clear enough, I tried to be concise and give context. If anyone can help, it would be much appreciated.

Go to Source
Author: Daniel

Cannot get is_valid() to go back to template with bound form

In the Django docs, it says

“We call the form’s is_valid() method; if it’s not True, we go back to
the template with the form. This time the form is no longer empty
(unbound) so the HTML form will be populated with the data previously
submitted, where it can be edited and corrected as required.”

I am trying to get this behaviour to work.

In views.py:

def test(request):
    if request.method == 'POST':
        form = TestForm(request.POST)

        if form.is_valid():
            return redirect('auctions/test.html')

    else:
        form = TestForm()
        print(form)
        return render(request, 'auctions/test.html', {'form': form})

In forms.py:

class TestForm(forms.Form):
    testnumber = forms.DecimalField(max_digits=1)

In test.html:

<form action="{% url 'auctions:test' %}" method="post">
    {% csrf_token %}
    {{ form }}
    <input type="submit" value="Submit">
</form>

Now, when I submit the form with a number that is more than 1 digit, is_valid() evaluates to False. When that happens, the docs says the template should be rendered with the bound form and the error. Instead, nothing happens, and I get ValueError: The view auctions.views.test didn't return an HttpResponse object. It returned None instead.

Go to Source
Author: Ryan Eom

How can I login to MySQL as 127.0.0.1 or ::1 instead of localhost?

I’ve set different password for 'root'@'localhost' and 'root'@'127.0.01' like this:

mysql -u root
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('pswd1');
SET PASSWORD FOR 'root'@'127.0.0.1' = PASSWORD('pswd2');

but when I try to login like this:

mysql -u root -p -h 127.0.0.1

I still have to use the first password pswd1 even though according to this:

enter image description here

another password pswd2 was set for 127.0.0.1.

What is the problem here? How can I set 3 different passwords for ‘root’@’localhost’, ‘root’@’127.0.0.1’ and ‘root’@’::1′ and login to those accounts with those passwords?

Go to Source
Author: JConstantine

Mate snipping tool faster to display than “mate-screenshot”/Eye-of-Mate

I am a SysAdmin of many decades. I routinely juggle dozens of windows on my Mate desktop when working a crisis. My workstation has 4 monitors, 4 Mate workspaces, and it is not nearly enough! So I use screen captures to help further organize the data.

However, “mate-screenshot –area” has no direct option for “display now”. You have to save to disk and open in “Eye of Mate”. WTF!

Way back, Windows 7 had “Snipping Tool”: one click, one drag, instant display! Of course, Microsoft totally screwed it up in Windows 10 – one of so many reasons my workstations are Ubuntu these days and any Microsoft OS I have to deal with is safely sequestered in a VM!

I am sure I can script/code something that will do all the keystrokes for me but I thought I would ask here first just to avoid possibly reinventing the obviously necessary:

Is there an existing snipping tool for the Mate Desktop that displays with one click and one drag?

Go to Source
Author: Frobozz

Digital Signature for PDF files through Web Application

We are developing a Web Application for manage dental clinics.
The app can generate PDF files through the PHP backend (for example invoices, quotes etc.).

Each of those PDF file needs to be digitally signed by both the app user (the clinician) and the patient.
The sign we are looking for is the Legally Signature European Standard (which requires biometrical parameters or a certificate issued by a trusted provider such as Infocert (but we are not 100% sure how to then use such certificate)).

On average, in our country, each patient signs 5-10 documents and because of this we ruled out third party services such as Docusign, Pandadoc, Eversign.. because the average cost of those api services would be excessive for our needs (and country economy).

Another solution we did think about is to use the signature pads (such as Wacom’s) that are capable to collect biometrical parameters, but we have no idea how to integrate such devices with our Javascript frontend (assuming it is even possible to interface those devices through the web browser).

Assuming our backend displays the PDF already generated to the client, what would it be the best approach to apply a digital signature to it through the client (which would then send back the signed PDF to the server for storage) ?
Is there a way to interact with signature pads devices through the browser (to extract the biometrical parameters together with the visual signature) ?

Thanks

Go to Source
Author: Nite

How to remove the search field in custom taxonomy ui?

In recent versions of wordpress I see a new search/autocomplete text field on top the custom taxonomy metabox (when hierarchical). I also see the taxonomy slug with it (“project_type” in the attached image).

How can I remove It? Is there an argument for that when registering the taxonomy?

enter image description here

Go to Source
Author: Marc

Opendkim running but not signing?

I have had a lot of fun with OpenDKIM – it is actively running on my Debian box and here is my code:

root@web1:~# tail -f /var/log/syslog | grep -i dkim
Sep  7 16:35:38 web1 sm-mta[1504]: 087FZbYw001504: Milter insert (1): header: DKIM-Signature:  v=1; a=rsa-sha256; c=simple/simple;ntd=web1.mydomain.com; s=web1; t=1599492938;ntbh=+j1V4TFBmUGM3frMlslpv/49yjR0n44tuVimZHHRn0Q=;nth=Date:To:From:Reply-To:Subject:From;ntb=Z1gNvmXGQZXdx3iXGDpAWsdROt8iBctCrf248LQWtpNq5D3803fEWgUWCo9Bi81Bxnt qpE3hKokZTfD3jHlmyuhV9kZMulxEVv+jcjBXaK5r2L4957mUYW4Ao+UgBycqM6jt9nt CuOE+YStbaWal5mNNtf0NplJCHbHYk25NTV1y2zs=

However when I test the signature using https://www.appmaildev.com/en/dkim I am getting DKIM-Result: permerror (no key)

From the result of the tail I believe Opendkim isn’t being passed the necessary to,from,reply-to etc but thats just my guess. Why would the email not be signed?

This is my /etc/opendkim.conf but I’m unclear where I would see any extra details such as the “LogWhy” should generate.

Syslog                  yes
UMask                   007
Socket                  inet:8891@localhost
PidFile               /var/run/opendkim/opendkim.pid
OversignHeaders         From
TrustAnchorFile       /usr/share/dns/root.key
UserID                opendkim
Domain                web1.mydomain.com
KeyFile               /etc/opendkim/web1.private
Selector              web1
LogWhy                  yes

So to be clear – my question is: Why is the email not being signed with DKIM?

Go to Source
Author: Antony

Error #2 when trying to install ECM (Extra Cmake Modules)

I am trying to install extra-cmake-modules from source, and then I get an error after executing make command:

Extension error:
Could not import extension ecm (exception: No module named 'sphinxcontrib')
make[2]: *** [docs/CMakeFiles/documentation.dir/build.make:62: docs/doc_format_html] Error 2
make[2]: Leaving directory '/home/masterpi/Documents/Extra-CMake-Modules/extra-cmake-modules/build'
make[1]: *** [CMakeFiles/Makefile2:217: docs/CMakeFiles/documentation.dir/all] Error 2
make[1]: Leaving directory '/home/masterpi/Documents/Extra-CMake-Modules/extra-cmake-modules/build'
make: *** [Makefile:163: all] Error 2

It seems that the problem is about module Sphinx, but I tried to uninstall and install it again via pip and the error still occurred. So what can I do to fix it?
Here are logs when I executed cmake -DCMAKE_INSTALL_PREFIX=/usr .. and make command:

$ cmake -DCMAKE_INSTALL_PREFIX=/usr ..
-- WARNING: skipping tests that require PyQt
-- The following features have been enabled:

 * BUILD_HTML_DOCS, Generate HTML documentation for installed modules.
 * BUILD_MAN_DOCS, Generate man page documentation for installed modules.
 * BUILD_TESTING, Build automated tests.

-- The following OPTIONAL packages have been found:

 * Sphinx (required version >= 1.2), Tool to generate documentation., <https://www.sphinx-doc.org/>
   Required to build documentation for Extra CMake Modules.
 * QCollectionGenerator, Qt help collection generator., <https://www.qt.io/>
   Required to build Extra CMake Modules documentation in Qt Help format.
 * Qt5LinguistTools, Qt5 linguist tools., <https://www.qt.io/>
   Required to run tests for the ECMPoQmTools module.
 * Qt5Core, Qt5 core library., <https://www.qt.io/>
   Required to run tests for the ECMQtDeclareLoggingCategory module, and for some tests of the KDEInstallDirs module.
 * Qt5Network (required version >= 5.14.2)
 * Qt5Qml (required version >= 5.14.2)
 * Qt5QmlModels (required version >= 5.14.2)
 * Qt5Gui (required version >= 5.14.2)
 * Qt5Quick, Qt5 Quick library., <https://www.qt.io/>
   Required to run tests for the ECMQMLModules module.

-- The following features have been disabled:

 * BUILD_QTHELP_DOCS, Generate QtHelp documentation for installed modules.

-- Configuring done
-- Generating done
-- Build files have been written to: /home/masterpi/Documents/Extra-CMake-Modules/extra-cmake-modules/build
$ make
make[1]: Entering directory '/home/masterpi/Documents/Extra-CMake-Modules/extra-cmake-modules/build'
make[2]: Entering directory '/home/masterpi/Documents/Extra-CMake-Modules/extra-cmake-modules/build'
make[2]: Leaving directory '/home/masterpi/Documents/Extra-CMake-Modules/extra-cmake-modules/build'
make[2]: Entering directory '/home/masterpi/Documents/Extra-CMake-Modules/extra-cmake-modules/build'
[ 50%] sphinx-build html: see /home/masterpi/Documents/Extra-CMake-Modules/extra-cmake-modules/build/docs/build-html.log
/usr/lib/python3.8/importlib/__init__.py:127: RemovedInSphinx40Warning: The alias 'sphinx.util.pycompat.htmlescape' is deprecated, use 'html.escape' instead. Check CHANGES for Sphinx API modifications.
  return _bootstrap._gcd_import(name[level:], package, level)

Extension error:
Could not import extension ecm (exception: No module named 'sphinxcontrib')
make[2]: *** [docs/CMakeFiles/documentation.dir/build.make:62: docs/doc_format_html] Error 2
make[2]: Leaving directory '/home/masterpi/Documents/Extra-CMake-Modules/extra-cmake-modules/build'
make[1]: *** [CMakeFiles/Makefile2:217: docs/CMakeFiles/documentation.dir/all] Error 2
make[1]: Leaving directory '/home/masterpi/Documents/Extra-CMake-Modules/extra-cmake-modules/build'
make: *** [Makefile:163: all] Error 2

Go to Source
Author: Minh Nhật

What’s the security risk in password recovery attempts

Last days I’ve received multiple password recovery attempts for a WordPress user. The user didn’t initiate these attempts.

I’m blocking the IP’s on the server, but I don’t see what the goal of the attacker is. I checked the mails the user receives, and they contain a valid password reset link (so no phishing attempt).

So I don’t really understand what the attacker is trying to achieve with these password recovery requests. Or are they just checking for vulnerabilities on that page?

Go to Source
Author: Coder14

apply a script on only a few sheets

function onEdit(e) {
var feuillelundi = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(“Lundi”);
var range = SpreadsheetApp.getActiveSheet().getActiveRange();
var cours, joueurs, coach, motifannul
var ligne = range.getRow();

for (var groupe=3;groupe<118;groupe = groupe +12) {
cours = feuille.getRange(ligne,groupe);
coach = feuille.getRange(ligne,groupe – 1);
motifannul = feuille.getRange(ligne,groupe + 1);

    for (var j=2;j<9;j++) {
        joueurs = feuille.getRange(ligne,groupe + j);
             if (!cours.getValue()) {
                  coach.setValue('REMPLIR');
             }
             if (cours.getValue()) {
                  motifannul.setValue('REMPLIR');
             }          
             if (!cours.getValue() && joueurs.getValue()) {
                     joueurs.setValue('FALSE');
             }
    }
}

}

Go to Source
Author: icekio

What is the purpose of running PHP-FPM in its own container instead in the same container as apache2/nginx?

I’m fairly new to Docker so excuse any obvious ignorance or misunderstandings. That said, I’ve been coding and configuring web applications for a long time now. I have recently been dabbling with some more sophisticated (Docker and “traditional”) web/application server setups and experimenting with performance enhancements and simplifying deployments.

My personal favorite configuration to use for most projects thus far is nginx as a (mostly) “static file” web server &&|| caching mechanism &&|| Load Balancer in a reverse proxy config with Apache v2.4+ as the “backend” which runs PHP (also Perl &&|| Python) in a “FastCGI” (PHP-FPM) configuration (with mod_php disabled) and mpm_events (instead of mpm_prefork). We can always add in something else also such as REDIS or memcached, where applicable (but I rarely see a significant performance gain when using Cloudflare caching).

I’ve been dabbling with a few different ways to keep my “favorite web server composition” flexible and “ephemeral” enough to accommodate any and all possible options for further performance gain or resource load management. What I keep seeing is that there seems to have been a shift towards using PHP-FPM in its own separate “stand-alone” Docker container sometimes around late 2019.

Why?

While I can appreciate keeping resources isolated and separate for an easier to debug/config/secure configuration(s), I don’t fully understand what the benefits are to having PHP-FPM in a separate Docker container that is implicitly REQUIRED by the application that the Docker containers are comprising.

If anything, having a separate PHP-FPM container seems like additional configuration, additional resource consumption and an even more complicated build/deploy consideration in a CI/CD pipeline.

I can even get onboard with “simple preference”, such as instead of using Apache2 and nginx on the same Ubuntu/Debian or RHEL/CentOS container, break off nginx into its own container(s) and simply config your hostname(s) &&|| IPs and ports appropriately.

But what is a practical use case and advantages for having PHP-FPM separated from Apache or nginx containers for any additional benefit beyond perhaps using more Dockerfile &&|| docker-compose.yaml and less ba.sh scripting to get the same job done? If any part of the application fails or falters, then functionality will suffer. The additional network &&|| docker-network communications and hostname resolutions seems like it would just be a performance penalty over combining certain aspects of the docker-composer-ed application together, rather than splitting them up simply for the sake of splitting them up.

Go to Source
Author: kanidrive

SystemD application without sound

I am trying to run a kiosk application thanks to some videos played in chromium launched by a systemd service. When I am launching manually the following script, I can hear the sound of the videos

#!/bin/bash
xset s noblank
xset s off
xset -dpms

unclutter -idle 0.5 -root &

LIBVA_DRIVER_NAME=i965 /usr/bin/chromium-browser --noerrdialogs --autoplay-policy=no-user-gesture-required --disable-accelerated-video-decode --start-fullscreen --kiosk --incognito --disable-translate --no-first-run --fast --fast-start --disable-infobars --disable-features=TranslateUI --disk-cache-dir=/dev/null  --password-store=basic http://127.0.0.1

Unfortunately, when the script is launched by my kiosk.service, there isn’t sound (I found some similar cases on the forum but none seems to fix my issue)

cat /lib/systemd/system/kiosk.service
[Unit]
Description=Chromium Kiosk
Wants=graphical.target
After=graphical.target

[Service]
User=user1
Group=user1
Environment=DISPLAY=:0
Environment=XAUTHORITY=/home/user1/.Xauthority
Type=simple
ExecStart=/bin/bash /home/user1/kiosk.sh
Restart=on-abort

[Install]
WantedBy=graphical.target

Status :

user1@user1-nuc:~$ sudo systemctl status kiosk.service 
● kiosk.service - Chromium Kiosk
     Loaded: loaded (/lib/systemd/system/kiosk.service; enabled; vendor preset: enabled)
     Active: active (running) since Sun 2020-09-06 17:52:11 CEST; 10s ago
   Main PID: 2822 (bash)
      Tasks: 102 (limit: 4523)
     Memory: 424.4M
     CGroup: /system.slice/kiosk.service
             ├─2822 /bin/bash /home/user1/kiosk.sh
             ├─2840 unclutter -idle 0.5 -root
             ├─2841 /usr/lib/chromium-browser/chromium-browser --enable-pinch --noerrdialogs --autoplay-policy=no-user-gesture-required --disable-accelerated-video-decode --start-fullscreen --kiosk --incognito >
             ├─2849 /usr/lib/chromium-browser/chromium-browser --type=zygote --no-zygote-sandbox --noerrdialogs
             ├─2850 /usr/lib/chromium-browser/chromium-browser --type=zygote --noerrdialogs
             ├─2852 /usr/lib/chromium-browser/chromium-browser --type=zygote --noerrdialogs
             ├─2872 /usr/lib/chromium-browser/chromium-browser --type=gpu-process --field-trial-handle=12499335857368612092,12890752898176720314,131072 --disable-features=TranslateUI --noerrdialogs --gpu-prefer>
             ├─2874 /usr/lib/chromium-browser/chromium-browser --type=utility --field-trial-handle=12499335857368612092,12890752898176720314,131072 --disable-features=TranslateUI --lang=en-US --service-sandbox->
             ├─2899 /usr/lib/chromium-browser/chromium-browser --type=renderer --autoplay-policy=no-user-gesture-required --disable-accelerated-video-decode --disable-webrtc-apm-in-audio-service --field-trial-h>
             ├─2926 /usr/lib/chromium-browser/chromium-browser --type=renderer --autoplay-policy=no-user-gesture-required --disable-accelerated-video-decode --disable-webrtc-apm-in-audio-service --field-trial-h>
             ├─2969 /usr/lib/chromium-browser/chromium-browser --type=renderer --autoplay-policy=no-user-gesture-required --disable-accelerated-video-decode --disable-webrtc-apm-in-audio-service --field-trial-h>
             └─2983 /usr/lib/chromium-browser/chromium-browser --type=utility --field-trial-handle=12499335857368612092,12890752898176720314,131072 --disable-features=TranslateUI --lang=en-US --service-sandbox->

sept. 06 17:52:13 user1-nuc bash[2841]: [2841:2871:0906/175213.315275:ERROR:bus.cc(393)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp>
sept. 06 17:52:13 user1-nuc bash[2841]: [2841:2871:0906/175213.315295:ERROR:bus.cc(393)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp>
sept. 06 17:52:13 user1-nuc bash[2841]: [2841:2871:0906/175213.315317:ERROR:bus.cc(393)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp>
sept. 06 17:52:13 user1-nuc bash[2841]: [2841:2871:0906/175213.315336:ERROR:bus.cc(393)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp>
sept. 06 17:52:13 user1-nuc bash[2841]: [2841:2871:0906/175213.315370:ERROR:bus.cc(393)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp>
sept. 06 17:52:19 user1-nuc bash[2841]: [2841:2871:0906/175219.534878:ERROR:bus.cc(393)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp>
sept. 06 17:52:19 user1-nuc bash[2841]: [2841:2871:0906/175219.534969:ERROR:bus.cc(393)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp>
sept. 06 17:52:19 user1-nuc bash[2841]: [2841:2871:0906/175219.535020:ERROR:bus.cc(393)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp>
sept. 06 17:52:19 user1-nuc bash[2841]: [2841:2871:0906/175219.535098:ERROR:bus.cc(393)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp>
sept. 06 17:52:19 user1-nuc bash[2841]: [2841:2871:0906/175219.535135:ERROR:bus.cc(393)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp>

Have you an idea about this ?

Go to Source
Author: Rom D