show certain products in a category on home page in magento 2

I added a widget on a homepage and selected a categories from a drop down to include some items from a category (73)- I have 5 items to show up. I am not sure why but it only displays the 5 oldest products from that categories, anyways I can pick certain items to display or even show the newer items? I tried to shows only certain SKU. by selecting SKU instead of Category from drop down, it works with one SKU but when I do multiple SKUs the widget doesnt work. is there something I am missing?

Thanks Roger

How to avoid multiple definitions in C? Beyond Headers guards

I’m kind of a beginner on software engineering, and I’ve been working on my embedded C largest code ever.

Sometimes I stuck with multiple definitions errors, that points to .o files, what seems to me that it happens on linking time. Im aware about circular dependencies, and about #ifndef #def “guard rails” in the header files, but there might be something im missing. The only way I can get rid off these multiple definitions is placing the definitions in .C rather than .H, what sometimes is very inelegant.

MacBook pro won’t stay on and has difficulties powering up

MacBook pro 13″ touchbar from 2016.

The MacBook sometimes will turn on, most of the time it won’t. When it does turn on, I can get as far as the login screen, where it will completely shut off after ~30 seconds. During that time I can see a battery icon in the top that says 1% and has a charge icon. SMC reset does not help. Getting into recovery is near to impossible with the spotty way it powers on at all.

The laptop has been stored in a cabinet for some time (at least 2 months), with unknown battery charge on storing.

Could this be a malfunctioning battery pack that no longer holds a charge and has not enough juice to power the MacBook? Shouldn’t the machine be able to run on AC power even if the battery pack is dead? Are there any solutions I can try?

Do Rogues become Tier 3 by removing restrictions on sneak attack?

I enjoy playing Rogues, but they generally have a hard time keeping pace in a 3.5 game and are only Tier 4* per this answer. I’ve personally found one of the biggest hindrances to Rogues is the absurd number of creatures flat out immune to sneak attacks. Indeed of the 12 general types of creatures, 5 are completely immune to sneak attacks, which includes things like Undead and Constructs, which are often walking piles of hit points and usually plentiful in many campaigns. Not to mention the number of creatures of Huge size and greater whom can reasonably be construed as having unreachable vitals by the Rogue under normal conditions.

The ability’s description is as follows:

If a rogue can catch an opponent when he is unable to defend himself effectively from her attack, she can strike a vital spot for extra damage.

The rogue’s attack deals extra damage any time her target would be denied a Dexterity bonus to AC (whether the target actually has a Dexterity bonus or not), or when the rogue flanks her target. This extra damage is 1d6 at 1st level, and it increases by 1d6 every two rogue levels thereafter. Should the rogue score a critical hit with a sneak attack, this extra damage is not multiplied.

Ranged attacks can count as sneak attacks only if the target is within 30 feet.

With a sap (blackjack) or an unarmed strike, a rogue can make a sneak attack that deals nonlethal damage instead of lethal damage. She cannot use a weapon that deals lethal damage to deal nonlethal damage in a sneak attack, not even with the usual -4 penalty.

A rogue can sneak attack only living creatures with discernible anatomies—undead, constructs, oozes, plants, and incorporeal creatures lack vital areas to attack. Any creature that is immune to critical hits is not vulnerable to sneak attacks. The rogue must be able to see the target well enough to pick out a vital spot and must be able to reach such a spot. A rogue cannot sneak attack while striking a creature with concealment or striking the limbs of a creature whose vitals are beyond reach.

With that in mind, if the criteria for sneak attacks was changed to delete the last paragraph, would that move the Rogue from a Tier 4 class to a Tier 3? The definition for each being:

Tier 4

Capable of doing one thing quite well, but often useless when encounters require other areas of expertise, or capable of doing many things to a reasonable degree of competance without truly shining. Rarely has any abilities that can outright handle an encounter unless that encounter plays directly to the class’s main strength. DMs may sometimes need to work to make sure Tier 4s can contribue to an encounter, as their abilities may sometimes leave them useless. Won’t outshine anyone except Tier 6s except in specific circumstances that play to their strengths. Cannot compete effectively with Tier 1s that are played well.

Tier 3

Capable of doing one thing quite well, while still being useful when that one thing is inappropriate, or capable of doing all things, but not as well as classes that specialize in that area. Occasionally has a mechanical ability that can solve an encounter, but this is relatively rare and easy to deal with. Challenging such a character takes some thought from the DM, but isn’t too difficult. Will outshine any Tier 5s in the party much of the time.

I suspect that this has been attempted before at someone’s table before. A good answer would discuss that experience and whether the player felt that Rogues ascended to Tier 3 in usefulness.

*Full discussion on tiers provided here.

Width of stroke in an SVG icon

I’d like to use the “material” icons — https://material.io/tools/icons/?style=outline

They look a bit cartoonish to me, e.g. here they are on a black top-bar:

enter image description here

Their design guidelines say, for outlined icons,

To maintain legibility, the recommended stroke weight is 2dp for most icons.

2dp outlined icons remain readable across sizes and applications.

My question is — if I’ll only display these icons at their recommended 24×24 size — can I (might it be good or bad) to edit the SVG to reduce the stroke width to 1?

My guess is:

  • They’ll look better, less eye-catching — i.e. less distracting from the page content
  • They’ll still be readable/recognisable
  • The design guideline says 2dp, because it says that although the icons are best viewed at 24×24, but they can also be displayed smaller e.g. 20×20 (which I don’t need)

It seems to me that e.g. the borders which you create using CSS, with a 1px width, are all quite visible.

Is there a reason why that mightn’t be true too of an SVG icon — i.e. 1 is enough?

Cannot activate “Workflows can use app permissions” Site Feature in Sharepoint Foundation 2019

I am trying to create a workflow (According to the “Approval – Sharepoint 2010” template) and to activate “Enable Content Approval” in it, this works fine, but it doesn`t do anything.

Some research resulted in the site feature “Workflows can use app permissions” to be nessessary to use this feature.

So I go to the site that contains the library, go to “Site settings”, “Manage site features”, look for the feature and click the Activate-button.

Doing that results in this error message

An unexpected error has occured.

Using the Correlation ID I was able to find this stack trace, which seems to maybe explain why it does not work:

Unexpected Microsoft.SharePoint.WorkflowServices.NotConnectedException: Exception of type 'Microsoft.SharePoint.WorkflowServices.NotConnectedException' was thrown.  at Microsoft.SharePoint.WorkflowServices.SPAppOnlyPolicyManagerFeatureReceiver.ConfigureAppOnlyPolicy(SPFeatureReceiverProperties properties, Boolean isAppOnly) at Microsoft.SharePoint.SPFeature.DoActivationCallout(Boolean fActivate, Boolean fForce) at Microsoft.SharePoint.SPFeature.Activate(SPSite siteParent, SPWeb webParent, SPFeaturePropertyCollection props, SPFeatureActivateFlags activateFlags, Boolean fForce) at Microsoft.SharePoint.SPFeatureCollection.AddInternal(SPFeatureDefinition featdef, Version version, SPFeaturePropertyCollection properties, SPFeatureActivateFlags activateFlags, Boolean force, Boolean fMarkOnly) at Microsoft.SharePoint.SPFeatureCollection.AddInternalWithName(Guid featureId, Int32 compatibilityLevel, String featureName, Version version, SPFeaturePropertyCollection properties, SPFeatureActivateFlags activateFlags, Boolean force, Boolean fMarkOnly, Boolean fIgnoreMissing, SPFeatureDefinitionScope featdefScope) at Microsoft.SharePoint.WebControls.FeatureActivator.ActivateFeature(Guid featid, Int32 compatibilityLevel, SPFeatureDefinitionScope featdefScope) at Microsoft.SharePoint.WebControls.FeatureActivatorItem.ToggleFeatureActivation() at Microsoft.SharePoint.WebControls.FeatureActivatorItem.BtnActivateFeature_Click(Object objSender, EventArgs evtargs) at System.Web.UI.WebControls.Button.OnClick(EventArgs e) at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 

Sadly I do not know what this means, and I couldn`t find anything on Google.

I hope someone can explain what this means, or maybe even tell me, how to solve this problem.

Formulario con select, hacer multiplicación de numero productos por el precio

Estoy haciendo un formulario de pedidos donde, a través de un select se selecciona desde una base de datos el tipo de producto y necesito que, al seleccionarlo me añada el campo precio unitario para poderlo multiplicar con el resultado del numero de productos que el usuario inserta. Estoy tratando de aprender la dinámica, pienso que se debe usar el input hidden para llamar el dato del precio unitario, pero no se como integrarlo al select.

<!DOCTYPE html>     <html lang="es">     <head>       <title>Bootstrap Example</title>       <meta charset="utf-8">       <meta name="viewport" content="width=device-width, initial-scale=1">       <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">       <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>       <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>       <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>     </head>     <body>     <div class="container">        <br>      <form method='post' action='insertprueba.php' target='_self'>        <div class="form-group" >          <input type="hidden" name="preciobot" value="$  preciobot">          <select class="form-control" name="tipobot" id="tipobot" required="">                <option value="">Seleccionar el tamaño:</option>            <?php  include 'conexion.php';            mysqli_set_charset($  mysqli, "utf8"); //*--conexion*//            $  query = $  conn->query("SELECT * FROM  preciobot"); //*--variable llamadatos*//            while ($  valores = mysqli_fetch_array($  query)) {              echo '<option value="' . $  valores[tambot] . '" , "' . $  valores[preciobot] . '">' . $  valores[tambot] . ' : ' . $  valores[preciobot] . '</option>';              }            ?>               </select>      </div>      <div class="form-group">      <div class="input-group">      <span class="input-group-addon"><i class="fa fa-users"></i></span>                <input type="number" min="0" class="form-control input-lg" name="cantibot" placeholder="Ingresar Cantidad Botellas" required>              </div>            </div>            <button type="submit" class="btn btn-primary">Submit</button>          </form>        </div>      </body>      </html>      

Php:

<?php include 'conexion.php';     // Create connection $  conn = new mysqli($  servername, $  username, $  password, $  dbname); // Check connection if ($  conn->connect_error) {     die("Connection failed: " . $  conn->connect_error);}         $  tipobot = $  _POST['tipobot'];         $  cantibot = $  _POST['cantibot'];         $  preciobot = $  _POST['preciobot'];         $  costo_pedido = $  _POST['costo_pedido'];  {     $  sql = "INSERT INTO pedidos ( tipobot, cantibot, costo_pedido )     VALUES ('" . $  _POST["tipobot"] . "',             '" . $  _POST["cantibot"] . "',             '" . $  _POST["costo_pedido"] . "')";     $  result = mysqli_query($  conn, $  sql); } header("Location: /pruebasuma/formprueba.php"); die(); 

Is there a WebSockets server that accepts connections and can be controlled via HTTP?

I have a little RabbitMQ cluster and I want clients to be able to see results from jobs in that cluster. I don’t want them to connect to RabbitMQ directly for security reasons. Is there a simple client-facing server I can use to accept WebSocket connections from the clients through which I can send my clients messages? I’m hoping for something with some API over HTTP that I can just connect to from my backend code and send a message over a specific topic. If any clients happen to be connected at that point, they should get the update.

Basically a simple messaging server that works over WebSockets so I don’t have to reconfigure my backend application. I’m pretty sure RabbitMQ itself can be used for this but I’m guessing that’s not the best idea since it’s pretty complicated and not intended for direct client connections. If nothing like this is possible, I will likely have to write one myself but I was hoping for something a bit more battle-tested.