Get x numbers of a woocommerce category products using Wp_Query

Is possible to show some woocommerce products inside a swiper slider? I want to create a slider that will show some “featured” products on the home page. For now I have a cpt that is achieving this, but I don’t know how to link them to the products that I will add to woocommerce. So I want to replace the cpt with a query to get an x number of products from woocommerce products and put them into the slider. Any help will be appreciated.

The code I’m using now is this

<div class="row featured-row" <?php $  featured = new WP_Query( ['post_type' => 'featured', 'order' => 'ASC', 'posts_per_page' => 3] ); ?> <?php $  i = 0; ?> <?php if( $  featured->have_posts() ): while( $  featured->have_posts() ): $  featured->the_post(); ?> <?php #$  class = get_post_meta( get_the_ID(), 'class', true); ?> <?php if( $  i === 1 ): ?>   <div class="col-md-6 col-lg-6 d-none d-sm-none d-md-block featured-desc">     <h2 class="featured-title-right text-right"><?php the_title(); ?></h2>     <p class="featured-excerpt-right text-right"><?php echo get_the_excerpt(); ?></p>   </div>   <div class="col-md-6 col-lg-6 text-center d-none d-sm-none d-md-block featured-img">     <img class="img-fluid" src="<?php the_post_thumbnail_url(); ?>">   </div> <?php else: ?>   <div class="col-md-6 col-lg-6 text-center d-none d-sm-none d-md-block featured-img">     <img class="img-fluid" src="<?php the_post_thumbnail_url(); ?>">   </div>   <div class="col-md-6 col-lg-6 d-none d-sm-none d-md-block featured-desc">     <h2 class="featured-title"><?php the_title(); ?></h2>     <p class="featured-excerpt"><?php echo get_the_excerpt(); ?></p>   </div> <?php endif;?> <?php $  i++; ?> <?php endwhile; ?> <?php endif; wp_reset_postdata(); ?> </div>  

How to identify performance issues with large numbers of mods?

My current problem is with RimWorld, but in the past I had the same issue with Minecraft. Basically the game gets more fun with more mods, up until the point where performance becomes unmanageable. Most mods are open source and I am confident that I could fix many of these performance issues if I could only identify where the hotspots are.

So as a modder, how can I figure out where I should try and help out?

-200+ mods, though obviously I would add more if I could.
-I don’t have access to the core game source code.
-I don’t have access to a debug version of the core game.
-I probably have source code access to a given mod.
-I’m looking for ways to help the community, not ways to make the game faster for just me (like adding more memory).

Scientific notation for exact numbers?

Some of my symbolic computations involve many large numbers, e.g.:


As the computation is symbolic, I’d like to leave the numbers in exact form, holding off the numerical conversion until the end.

This, however, makes the presentation of intermediate results unwieldy (especially if the expression contains a lot of large numbers). It would be nice if there were a function that caused an output to display all its over-threshold exact numbers in scientific notation, while keeping them exact internally. For instance in the case of the above, it would be:

3.78945801888 x 10^49

Wolfram’s documentation says “The Wolfram Language provides flexible mechanisms for full typeset formatting of numbers of any magnitude and precision”, but I’ve not been able to find a function that does this.

If XOR of n distinct numbers is ANDed over one of the number, the result would be zero

Say we Have n distinct numbers


And we xor the result

xoredResult = x1^x2...^xn 

And if we AND(&) with one of the number say x2 We get Zero

xoredResult & x2 = 0 

Can we always claim that if the ANDed result is zero that the number is repeated ? Can this be used to find the first repeated element in a stream of numbers ?

Theoretically, what if I were to change some magic numbers in, say, AES

Purerly theoretically. I know it’s a bad idea to try to invent your own encryption and that’s not the intention here. Just a thought experiment.

Say, I change some or all of the magic numbers used in, say, AES (but this would could also apply to other algorithms) and create “AES-RobIII”. Ofcourse this would be incompatible with the current AES algorithm.

  1. First: I know these numbers are chosen (usually) very carefully (sometimes maybe even crafted so that they can contain a secret backdoor, but I’m not interested in conspiracy theories etc). How are these numbers chosen generally and I assume there are many (‘infinite’) variations possible? Do they come from a ‘RNG’ (tuned to some specific rules)? Are they chosen ‘manually’? I know they have to satisfy some polynomial(s) but do they (the cryptographers designing the algorithm) just start with a random seed or pick a specific number or…?
  2. Since these magic numbers are, along with the algorithm, out in the open (as any good encryption algorithm should be), I could theoretically pad the encrypted message with them and ‘load’ these tables with the numbers before the algorithm is kicked off to encrypt/decrypt, right?
  3. Then why have these numbers as constants in the algorithm (unless size is a priority ofcourse) in the first place? Or why don’t we have, say, AES-I, AES-II and AES-III with the only difference being another set of magic numbers? You could even consider the table(s) of magic numbers used a sort of “extra key” so, say, a company could use their generated (similar to how private/public keypairs are generated for example) set of numbers internally for extra added security when stuff would leak. I realise it won’t add much (if anything at all) but added complexity but I was just wondering.

Again, I realise this won’t add any advantage of any meaning (probably), if at all, but I was just wondering. Also this question is based on the assumption that if I change any of the magic numbers and encrypt something with it and then try to decrypt it (with the same, altered, magic numbers) it would still decrypt correctly.

$O(k)$ Algorithm to find the first $k$ pairs of Magic numbers $a$ and $b$ such that $\sum_{i=1}^{a-1} i = \sum_{k=a+1}^b k $, with restrictions

Provide an $ O(k)$ algorithm to find $ k$ – magic pairs of positive integers a and b of type signed int where a magic pair is defined as $ \sum_{i=1}^{a-1} i = \sum_{k=a+1}^b k $ . You can’t use the summation formula $ \frac{N \cdot (N+1)}{2}$ as it would result in an overflow. Even you can’t run sums such as sum1 and sum2, it’s still going to overflow.

Example: (6,8) (35,49) (204,288) are the first three Magic Pairs.
P.C: This was our recent examination question, I am curious to know the algorithm.