Using CSS, how can I remove a Woocommerce grid from a specific page that has ::before & ::after inserted in it

Everything between the before and after needs to go

The specific page ID is 6329

I have tried different variations of the CSS below, but still can’t get it to work!

CSS used:

.page-id-6329 .products.columns-3 {
display: none !important;
}

and other variations on the same lines with no success. I think it has to do with the ::before and ::after, but have no idea how to write the CSS.

I am setting up a website that caters for retail and wholesale. The retail will show the normal category grid to the user, while the wholesale will have a special page where a list of products shown in a table.
The wholesale page, as it is now, shows the category grid AND the table underneath. I just need to get the grid to disappear for that particular page.

Any help will be appreciated.
Thanks

docker – Messaging specific microservice

We have an .NET application where we need to scale a background job worker (IHostedServcice) to perform a long running task of compiling/building code requested by front end clients. Each task will receive a task Id so that front end clients can interrogate the status of the task. The intention is to use docker containers for each of the background tasks. Each code compilation job would be on a separate container so if one went down it wouldn’t affect others.

We were planning to have another ‘Supervisor’ container do the scaling and keep track of all instances. We would maybe have a number of worker containers available for jobs but would increase the pool depending on the number of jobs coming into the system. What we would like to know is how best to manually scale the worker containers and also how do we communicate with a specific instance by Task Id. It appears we need some sort of sticky session as front end client requests need to directed to the correct container.

Thanks

Regex To Validate A String, But The String Can’t Contain n Number Of A Specific Character

Recently I ran into a validation situation I’ve been trying to solve with regex. The rules are as such:

  • Must start with a capital letter
  • Center of the string may be of any length
  • Center of the string may have any combination of upper and lower case letters and numbers
  • Center of the string may have up to one underscore
  • Must end with a number

I have attempted to match this string with the following regex:

^(?!_{2,})((A-Z)(a-zA-Z0-9_)*(0-9))$

and

^(?<=_{0,1})((A-Z)(a-zA-Z0-9_)*(0-9))$

Both of these attempts still match cases where there is more than one underscore present. I.E. App_l_e9 or App__le9.

How can you check to see if your regex match, I.E. the ((A-Z)(a-zA-Z0-9_)*(0-9)) part contains zero or one underscore in any place within the middle of the string?

customization – Adding Custom HTML/CSS/JS code in specific page

I’ve written a HTML/JS code, it’s something like a survey which consists of code like this:

 <div class="Question">
        <h3>1. I have the knowledge of procedures needed for starting and running a business <span class="star">
                *</span></h3>

        <br>

        <div class=None>
            <input type="radio" name="Q1" id="none1" value="None">
            <label for="none1">None</label>
        </div>

        <div class=Withguidance>
            <input type="radio" name="Q1" id="wguid1" value="With Guidance">
            <label for="wguid1">With Guidance</label>
        </div>

        <div class=Beginner>
            <input type="radio" name="Q1" id="beg1" value="Beginner">
            <label for="beg1">Beginner</label>
        </div>

        <div class="Intermediate">
            <input type="radio" name="Q1" id="inter1" value="Intermediate">
            <label for="inter1">Intermediate</label>
        </div>

        <div class="Expert">
            <input type="radio" name="Q1" id="ex1" value="Expert">
            <label for="ex1">Expert</label>
        </div>
    </div>

At the end of the questions, there is a button that uses jsPDF library to convert the answers inputted by the user into a custom PDF that i made. Now this works perfectly when running the raw html file. The problem comes when i tried to insert it on my WordPress site.
Firstly, i use the latest version of WordPress and Elementor (WordPress 5.7.1 and Elementor Pro 3.1.1)

At the trial phases , before my code was complete, i could add it perefectly fine using the HTML widget on Elementor. As the code got bigger and lines were added, Elementor started lagging everytime i copied pasted my code. When my code was finished, when i tried to copy paste my code in Elementor, the page tab got unresponsive and couldn’t do anything than close the tab. I couldn’t paste my code in the HTML widget regardless how many times i tried.
I then tried using the Gunberg editor, while the code pasted and the tab was responsive, when i tried to update, there was an error “Update failed”.
Is there anyway that i can paste the code to my page without it crashing? Maybe with a plugin or via source files?
I already tried WP Coder but it didnt work.

P.S. I use 2 base64 strings, one for an image and one for a font that may be the reason that the editors cant handle the code. The base64 strings worked perefectly fine at the beginning, before the code got bigger.

Thanks in advance!
(sorry if my English is poor, not a native speaker)

country specific – How to stop showing AdSense ads in some countries?

You can use an ad server such as Google Doubleclick for Publishers (DFP) Google makes DFP available for free for most websites.

To use DFP, you have to change the JavaScript tags that power your ads. You would need to set up your ad slots (inventory) in DFP, and generate new JavaScript code to include on your site. Unlike AdSense, DFP uses a block of code in the head of the page in addition to the code for each ad slot.

By default, DFP shows AdSense ads for every slot. DFP allows targeting by demographics. You could set users from various countries to not see ads, or to see “house ads” that advertise other portions of your own site.

Unfortunately, DFP has a pretty steep learning curve. It is much harder to use than AdSense. It used different terminology for the things that AdSense does.

url – How to intercept application specific MIME types used by 3rd party (Windows) browser/plugins apps?

I’m trying to intercept and decipher scripted code that is sent to a previously installed Windows application, after a user have clicked on a particular URL in their web browser which is somehow returning a MIME response that is intercepted by the Win app and processed as a script/program.

The particular example of concern, is how the (Windows) trading application Think-or-Swim (aka. TOS) is downloading and running user scripts from either a custom URL handler of the form: tossc:XXXX or using a standard URL like http://tos.mx/A1PZUml which then sends one of the MIME types:

x-scheme-handler/tossc
application/x-tossc
application/x-thinkorswim

I have posted a similar question on SO here but I don’t think that forum is appropriate for this question and hope someone here would a have some more technical know-how of how to do this and also explain what’s going on. As you can tell I am probably not even using the correct language for asking the question in a clear manner. So feel free to correct me or this post.

Q: How can I intercept and inspect code that is loaded in this way?

(Hoping to also learn what is going on and how this is done, or an be done, by e.g. python?)

performance – Creating a specific distribution of random numbers in Powershell

I originally posted this on StackOverflow but was requested to post it here instead as it relates to optimization/performance of the code rather than a specific problem.

TL;DR: Get-Random produces an even distribution of numbers where every number in the pool has an even chance of appearing. I’m looking for a way to generate random numbers where every individual number appears with a frequency that I myself specify.


If I run

for($i=1;$i -le 1000;$i++){
    Get-Random -Minimum 0 -Maximum 10
}

I get a very evenly distributed count for each number (roughly 100 for each number between 0 and 9). Using Get-Random allows me to get a random number every time but on average, every individual result will appear roughly an equal amount of times. I want to decide the frequency for how often any specific number appears, and then generate random numbers that fit that distribution. As an example:

Number   Probability
0        10
1        11
2        19
3        12
4        3
5        10
6        6
7        7
8        4
9        18

I’m looking for a way to use the above list to randomly generate a number between 0 to 9, but with the probability of each individual number appearing using the Probability column.

My very hard-coded and not so generic solution so far is that I thought of doing something like adding a cumulative percentage column:

Number   Probability   CumulativeProbability
0        10            10
1        11            21
2        19            40
3        12            52
4        3             55
5        10            65
6        6             71
7        7             78
8        4             82
9        18            100

And from here, run the object through a filter. Something like:

$RandomNumber = Get-Random -Minimum 0 -Maximum 100
$MyProbabilityObject | Where-Object {$RandomNumber -ge $_.CumulativeProbability}

This gives me all numbers with a lower Cumulative probability than the random number. Let’s say the $RandomNumber was 42, that would result in:

Number   Probability   CumulativeProbability
0        10            10
1        11            21
2        19            40

From here, I could pipe the result to

Select-Object CumulativeProbability | Measure-Object -Property CumulativeProbability -Maximum 

Which gives me the highest value, and then use that column as a reference to find the number with

Where-Object {$_.CumulativeProbability -eq $TheNumberIGetAbove}

While this kinda works, it feels like I’m doing several laps around a problem that should be easier and more straightforward to solve. Are there any better ways of generating random numbers that fit a distribution you specify yourself instead of using an even distribution such as Get-Random?

sensor size – Focal length for a specific distance?

I have the following information:

s: Image sensors dimensions: 6.00mm, 4.80mm, 3.60mm (diagonal, horizontal, and vertical)
f: focal length range: 5.1mm - 51mm
f=(s*WD/FOV), where `WD` is the working distance and the `FOV` is the object size. 

I would like to compute the optimal f for a given WD=10m and FOV=1mx1m.

Which sensor dimension should I choose (diagonal, horizontal, or vertical)? Since the results differ quite heavily depending on that.

Thanks

wordpress version – Unqueue css file from specific page

I’m trying to unqueue style.css file from a specific page.

In my functions.php (child theme) if I add:

add_action( ‘wp_enqueue_scripts’, ‘apc_child_desregistra_estilos’, 11 );
function apc_child_desregistra_estilos() {
wp_dequeue_style( ‘main-styles’ );
}

Works.

But when I add something like:

if (is_front_page()):
wp_dequeue_style( ‘main-styles’ );
endif;

Doesn’t

I really doesn’t know wha I am doing wrong.

pygame – How do I click on specific text in an array of text?

I am trying to click on a specific word in an array but I can’t think of how.

This is what I have:

  for x in range(0, len(names)):
    templine = font.render(names(x), True, WHITE)
    tempRect = templine.get_rect()
    tempRect.midleft = (50, (170+30*x))
    if mouse012(0) == True and tempRect.collidepoint(mouseXY):
      state = AppState.STATS

      detailsName = names(x)
    screen.blit(templine, tempRect)