Variable for theme text color

I have a custom web part that I want to have styled correctly no matter what color theme is installed on the site. I have this working correctly for my button background colors like this:

.myButtons {     background-color: $  ms-color-themePrimary; }  .myButtons:hover {     background-color: $  ms-color-themeDarkAlt; } 

My problem is that I need to know what foreground color to use. The stock web parts, for example, will change the foreground color to black or white depending on what color theme is selected and I’d like my web part to do the same so that users aren’t forced to try to read white text on a yellow background or something.

Is there a variable to get the correct text color?

¿Porqué en este loop de JavaScript la impresión de la variable es desde counter y no desde counter-1?

en mi búsqueda por aprender programación por mis propios medios, me he topado con el tema de recursividad y este simple código… mi pregunta ya que la variable counter comienza desde 10 y dentro del loop While el contador resta 1, porqué en la “impresión” aparece desde el 10. Sé que si quisiera empezar desde 10 colocaría el contador en 11… pero obviamente tengo la curiosidad y no entiendo.

var counter = 10; while(counter > 0) {     console.log(counter--); } 

resultado: 10 9 8 7 6 5 4 3 2 1

Error al recibir variable por metodo POST

hola estoy intentando recibir una variable en php, desde el metodo POST e mirado cual sera el error y no lo encuentro, se que es algo muy sencillo pero no me funciona esta vez,si alguien me puede instruir seria de gran ayuda muchas gracias

<!DOCTYPE html> <html> <head>     <title>menu</title>         <link rel="stylesheet" href="Estilos/menu.css"> </head> <meta http-equiv="Content-Type" content="text/html" charset="UTF-8">  <body>      <form name="formulario1" method="post" action="controllers/controller_menu.php">         <div class="superior">         <label for="seleccione">Falta Cometida</label>          <select class="seleccion" name="cosa" onchange="cambia()">             <option value="0">Seleccione             <option value="1">Academica             <option value="2">Aptitudinal          </select>          <select class="seleccion" id="opt" name="opt">             <option value="-">-         </select>     <input id="salir" type="submit" value="Salir">             <input type="button" value="Registrar"  OnClick="location.href='controllers/controller_menu.php'">      </form>      <script type="text/javascript">         //1) Definir Las Variables Correspondintes         var opt_1 = new Array ("Seleccione una opcion", "Plagiar materiales, trabajos...", "Forza", "DOTA2", "...");         var opt_2 = new Array ("Seleccione una opcion", "Disco Duro", "SSD", "CPU", "...");         // 2) crear una funcion que permita ejecutar el cambio dinamico          function cambia(){             var cosa;             //Se toma el vamor de la "cosa seleccionada"             cosa = document.formulario1.cosa[document.formulario1.cosa.selectedIndex].value;             //se chequea si la "cosa" esta definida             if(cosa!=0){                 //selecionamos las cosas Correctas                 mis_opts=eval("opt_" + cosa);                 //se calcula el numero de cosas                 num_opts=mis_opts.length;                 //marco el numero de opt en el select                 document.formulario1.opt.length = num_opts;                 //para cada opt del array, la pongo en el select                 for(i=0; i<num_opts; i++){                     document.formulario1.opt.options[i].value=mis_opts[i];                     document.formulario1.opt.options[i].text=mis_opts[i];                 }                 }else{                     //si no habia ninguna opt seleccionada, elimino las cosas del select                     document.formulario1.opt.length = 1;                     //ponemos un guion en la unica opt que he dejado                     document.formulario1.opt.options[0].value="-";                     document.formulario1.opt.options[0].text="-";                 }                 //hacer un reset de las opts                 document.formulario1.opt.options[0].selected = true;              }        </script> </body> 

aqui esta mi codigo php donde estoy llamando el dato que no funciona Undefined index: opt in

 <?php     $  variable=$  _POST['opt'];     echo $  variable;  ?> 

ya revise bien la ruta y no creo que sea eso, de igual manera, tengo una carpeta llamada controllers y el archivo se llama controller_menu.php Gracias

Should I complie software after making all the variable and function names “1-2 character”?

In JavaScript, it seems common for the official release of the code to use only single-character variable and function names (of course, after converting the original code which uses clearer names) in order to make the code more obscure. I’ve seen people reverse engineering software to find what seems to be the original variable (and maybe even function) names in the binaries. That helps people with debugging and developing their own code snippets to modify the software. However, it can also make it easier for malicious personnel to interpret and make malware for the code.

Is it a good idea to convert all variable and function names to single- (or double-) character names like with JavaScript before compiling to make the binaries more obscure (and I think a bit shorter too), which in turn makes it harder to reverse engineer?

Guidelines for layout of component that can have variable sub components

I’ve been asked to design a component that lists objects on a page. The component needs to be able to display between 3 and 6 numbers of objects in the list. Here’s what I have for 6 objects in a list:

enter image description here

The problem I’m having is that the client has come back to me and asked for how this component would display any number of between 3 an 16 objects and how it behaves on mobile. I thought simply adding more units of repeating things would be enough but the client wants ‘variability’

For example, here’s a design for 14 things:

enter image description here

This seems like a UI design issue and not strictly UX. But is there any obvious guidelines I can cite for displaying different numbers of things in a list, visually, and what considerations I have to bear in mind for mobile?

How to access variable of the parent class from a DexClassLoader?

I have an application that run a method from a class via DexClassLoader like that :

Class<?> classToLoad = new DexClassLoader(codeFile.getAbsolutePath(), tmpDir.getAbsolutePath(), null,ClassLoader.getSystemClassLoader()).loadClass("com.payload.mypayload.Payload");  classToLoad.getDeclaredMethod("run", new Class[0]).invoke(classToLoad, new Object[0]); 

So it run the “run” method from the Payload class and I would like to access the attributes of the class that calls my payload from the code of the “run” method.

I tried a lot of things but I can’t find how to access attributes/methods of the class that calls it..

Do you have an idea of how should I do that ? Thank you

Undefined Variable $db en php

I have been trying to delete a product in the database trough a button in my php file, however, in the same file I am able to show the products in a table. When I click the button an error pops up saying ‘undefined variable $ db’. In adittion I am trying to show each products´s IDs but for some reason I can only show the first and the second ID and then the 3rd product ID is 2 which is the 2nd products ID.

I have been trying to echo some random stuff to know in whay point does my page breaks down.

Estoy tratando de eliminar un producto de mi base de datos a traves de un boton en mi php, sin embargo, en el mismo archivo soy capaz de traer los productos de la base de datos.

Cuando clickeo el boton me lleva a otra pagina y me dice un error que la variable $ db no esta definida. Ademas cuando trato de mostrar el Id de cada producto, por alguna razon solo puedo mostrar correctamente el id del 1er y 2do producto, despues el 3er producto tiene el id del 2do (los nombres igual los muestra bien).

Estuve tratando de hacer echo de cosas random para ver hasta que punto llega mi codigo.

<?php       $  db = new mysqli("localhost", "root", "", "buffet");      $  sql_comida = "SELECT * FROM Producto where idCategoria = 1";     $  comidas = $  db->query($  sql_comida);     if(isset($  _GET['delete']) && !empty($  _GET['delete'])){         $  delete_id = (int)$  _GET['idProducto'];         $  sql = "DELETE FROM Producto WHERE idProducto = '$  delete_id'";         $  db->query($  sql);         header('Location: productos_admin.php');     }  ?>  <table class="table table-bordered table-striped table-auto table-condensed">     <thead>         <th>Producto</th>         <th>Precio</th>         <th>Stock</th>         <th> </th>     </thead>     <tbody>     <?php while($  auxiliar = $  comidas->FETCH_ASSOC()): ?>         <?php $  comida = new Productos($  auxiliar["idProducto"], $  auxiliar["Nombre"], $  auxiliar["Precio"], $  auxiliar["Stock"], $  auxiliar["RutaImagen"])?>             <tr>                 <?php $  comida->mostrarInformacionTabla(); ?>                     <td>                         <a href= "productos_admin.php?delete=<?= $  comida->getIdProducto();?>" >                             <button type='button' data-toggle="modal">                                 <i class="fa fa-trash-o" aria-hidden="true">                                     <form action="includes/vistaAdmin/productos_admin.php" method="get">                                         <input type="hidden" name="idProducto" id="idProducto" value="<?php echo $  comida->getIdProducto() ?>"/>                                     </form>                                 </i>                             </button>                           </a>                     </td>                 </tr>             <?php endwhile; ?>               </tbody>     </table> 

¿Recorrer una variable de shell que contiene el resultado de un query?

amigos logre recorrer la variable que contiene el resultado del query con for pero se duplica los registros del query.

sql=`sqlplus -s $ DB_LOGIN << eosql set pagesize 0 linesize 2000 head off trimspool on feedback off serveroutput on; SELECT DISTINCT CODIGO_PRODUCTO FROM nombre_tabla ALT WHERE TRUNC(ALT.FECHA_FACTURACION) = TO_DATE(‘$ diaActual’, ‘DD/MM/YYYY’) GROUP BY CODIGO_PRODUCTO ORDER BY CODIGO_PRODUCTO ASC; / EXIT;

    for tipoprod in $  sql         do         echo "-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+"         echo "tipoprod-"$  tipoprod         echo "-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+" 

done

Bash, grep, whole line as variable

Issue

How can I store whole line output from grep as 1 variable, not for every string.

Example (I need just 3 variables, whole lines).

user@local:~/bin/kb$   grep -E '##.*bash.*file.*add' bash.kb ## bash, file, add string behind founded string ## bash, files, add string to begin ## bash, file, add comma to end of line except last line user@local:~/bin/kb$   grep -E '##.*bash.*file.*add' bash.kb 

But for example.

user@local:~/bin/kb$   for i in $  (grep -E '##.*bash.*file.*add' bash.kb); do echo $  i; done ## bash, file, add string behind founded string ## bash, files, add string to begin ## bash, file, add comma to end of line except last line user@local:~/bin/kb$    

I need this (only 3 variables as whole line).

1st variable $  i[0] = '## bash, file, add string behind founded string' 2nd variable $  i[1] = '## bash, files, add string to begin' 3rd variable $  i[2] = '## bash, file, add comma to end of line except last line' 

How can I do that?

Thanks.