managed property – Add a new keyword to Querystring to search in a Document Library

I created one managed property that is called Csearch and this brings true results when I search for <managed property>: <property value>.

I go to Search Center and type this.Csearch:word

I can see the result I want in the querystring. k=Csearch%3Aword

enter image description here

And now I want to add new keywords to this querystring.

For example when I type Csearch:word Sharepointin Search Center, I want to see the sharepoint keyword in a querystring with a new name and the & symbol.

Thanks.

enter image description here

I have managed property and it works fine. I saw it in Querystring so, how do I add a new keyword to Querystring to search in a Document Library?

I created one managed property that is called Csearch and this brings true results when I search for <managed property>: <property value>.

I go to Search Center and type this.Csearch:word

I can see the result I want in the querystring. k=Csearch%3Aword

enter image description here

And now I want to add new keywords to this querystring.

For example when I type Csearch:word Sharepointin Search Center, I want to see the sharepoint keyword in a querystring with a new name and the & symbol.

Thanks.

enter image description here

sass – A styled ordered list whose outer list should have numbers and inner list should have letters using CSS counter property

I am trying to styles an ordered list where i want all the outer list elements to have numeric list style and inner list item to have letters.

The below is my structure.

 <div class="subitems">
    <ol><li>This is a list with numeric list style
        <ol><li>This is a list with numeric list style
            <ol class="rulebook-alpha"><li>This is a list with numeric list style</li>
                <li>This is a list with numeric list style</li>
            </ol></li>
            <li>This is a list with numeric list style</li>
        </ol></li>
    </ol>
</div>

This is my css

div.subitems {
    ol {
        list-style-type: none;
        counter-reset: item;
        padding-left: 20px;
        li {
            counter-increment: item;
            padding: 0 0 20px 5px;
            position: relative;
            z-index: 0;

            &::before {
                content: counters(item, ".") ". ";
                display: table-cell;
                position: absolute;
                left: -22px;
            }
            ol.rulebook-alpha {
                counter-reset: alpha;
                padding-left: 30px;

                li {
                    padding: 20px 0 0 10px;

                    &::before {
                        counter-increment: alpha;
                        content: "("counter(alpha, lower-alpha) ") ";
                    }
                }
            }
            
        }
    }
 
}

This is my output
enter image description here

My aim is to have 1.2 instead of 1.4 could you anyone please help me

Is there a simpler way to replace nested property?

During an interview I’ve got interesting javascript-task:

Given the code:

const testStr = "bar.baz.foo:111222",
      testObj = {
        bar: {
          baz: {
            foo: 333444,
            foo2: 674654
          },
          boo: {
            faa: 11
          }
        },
        fee: 333
      };

function replaceInObj(obj, str) {
  // your code
}

write the implementation of the replaceInObj function

  1. I was not allowed to use 3rd-party library.
  2. I kinda solved the task, but I’m not satisfied with my solution.
  3. And I’m struggling with my complex implementation.
  4. At the same time I cannot find another solution by myself.

My implementation of the replaceInObj function

const testStr = 'bar.baz.foo:111222';
const testObj = {
  bar: {
    baz: {
      foo: 333444,
      foo2: 674654,
    },
    boo: {
      faa: 11,
    },
  },
  fee: 333,
};

console.log('(before) testObj.bar.baz =', testObj.bar.baz);

// run
replaceInObj(testObj, testStr);

console.log('(after) testObj.bar.baz =', testObj.bar.baz);

function replaceInObj(obj, str) {
  const (path, valueToChange) = str.split(':');

  path.split('.').reduce((acc, prop, index, arr) => {
    const isLastProp = arr.length === index + 1;
    if (isLastProp) {
      acc(prop) = valueToChange;
    }

    return acc(prop);
  }, obj);
}

How would you implement the function replaceInObj?

  • I hope there’s much-much simpler implementation.
  • And I would be grateful if you’d share your solution

I assume everyone who is against police brutality protests that caused any property damage also believes the Boston Tea Party was wrong?

Depends on your point of view…to the British, Loyalists and even many of the rest of the Colonists who wanted a peaceful resolution, the Sons of Liberty were considered a terrorist organization…

– and I’m pretty sure that the East India Trading Company wasn’t overly fond of them either since it was their tea that got dumped.

– BUT different times, now days they would have been condemned for impersonating Native Americans when they committed their crime.

javascript – Add Dynamic Property Panes to SPFX

I know this has been asked 1000 times, but i’ve tried everything in the first 2 pages of google so i’ve decided to come to you guys for help.

I’m trying to create some dynamically added property panes.
I’ll have a column (on my sharepoint webpart) with a few tiles. I want to add different options for those tiles and i want to add the ability to add a tile with a button in the property pane.
I’ve tried with arrays and such, but thats not the point.

I’m working on SPFX 1.6.0 with React (15.6 i think its the latest for spfx)

The point is i am unable to add a propertypane dynamically. I checked out this code -> https://www.c-sharpcorner.com/article/render-spfx-properties-pane-based-on-list-data/

And came up with a little test:

let myArray : any;
myArray.push(PropertyPaneTextField(someID.toString(), {  
                label: someLabel
              }))

And then in my

protected getPropertyPaneConfiguration(): IPropertyPaneConfiguration {

I added something like this ->

    return {
      pages: (
        {
          header: {
            description: strings.PropertyPaneDescription
          },
          groups: (
            {
              groupName: strings.BasicGroupName,
              groupFields: (
              {.....BUTTON HERE....},
              this.properties.myArray
              )
            }
          )
        }
      )
    };

Once again, this is not the actual code!

The error that comes up in my console is something like “can’t get ‘type’ of undefined’. But i am console logging the array and some objects do exist in it…

I’ll update my question tomorrow with the actual code from my webpart, but it was so damn frustrating that i had to ask.

Thanks in advance.

EDIT: Adding the actual code below ->

protected getPropertyPaneConfiguration(): IPropertyPaneConfiguration {

const displayApps = () => {
  var self = this;
  if (this.properties.itemArray === undefined) {
    this.properties.itemArray = ();
  }
  if (this.properties.itemArray.length > 0) {
    for (let x = 0; x < this.properties.itemArray.length; x++) {
      return this.properties.itemArray(x);
    }
  }
  else {
    return (this.properties.itemArray.push(PropertyPaneTextField('0', {
      label: "First App"
    }))
    );
  }
  self.context.propertyPane.refresh();
};

And for displaying i’m trying ->

          groupFields: (
            PropertyPaneHorizontalRule(),
            PropertyFieldButtonWithCallout('addAppsButton', {
              calloutTrigger: CalloutTriggers.Click,
              key: 'buttonWithCalloutFieldId',
              calloutContent: React.createElement('p', {}, 'Tests connection to the database with the parameters listed above'),
              calloutWidth: 150,
              text: 'Add App',
              onClick: () => { addApps(); }
            }),
            displayApps()

If i add the array directly it won’t be able to display all PropertyPanes that are saved in it (sine it will be an array of object i assume it needs a foreach or a for loop).

EDIT2: Ok so i’ve got rid of the “undefined” problem. This is my array ->

enter image description here

My webpart has no errors, but no PropertyPaneTextField is displayed either.
I even tried an onclick function to refresh the pane by using this.context.propertyPane.refresh();

If i use the array with a target ex: myArray(0) i do see a field.
How were other people able to simply drop the array of object inside groupFields and have it render all of them? Every example that i’ve looked at does that. They create an array by using :any and array.push and then add it to groupFields.

I am on SPFX 1.6.0. Is there a different way to do t now or what am i missing?

2013 – TreeView WebPart Property

Is there a way to add a list items TreeView as a WebPart Property?
Can you give me an overview on how to do this, knowing that the TreeView should contain selectable checkboxes that allow to retrieve the selected items.

I know that a custom property will be displayed automatically in the Property Pane if it’s of type bool, DateTime, enum, int, or string. But what if we want to add a TreeView, like in my case?

(I’m under SharePoint 2013)

computer science – What does “L being a CFL” mean as a property of CFL’s?

In Ullman’s Introduction to Automata, Languages and Computation (1979):

8.8 Use Theorem 8.14 to show that the following properties of CFL’s are undecidable.

a) L is a linear language.

b) L is a CFL.

Does a property of CFL’s mean exactly a subset of CFL’s?

Does it mean that if L is a CFL, then the problems of whether L is a linear language and whether L is a CFL are both undecidable? If L is a CFL, why do we need to decide if it is a CFL again?

Similarly

8.10 Show that the following properties of linear languages are undecidable. You may use the fact that every regular set is a linear language.

a) L is a regular set.

b) L is a linear language.

c) L is a CFL.

d) L has no unambiguous linear CFG.

Does it mean that if L is a linear language, then the problems of whether L is a linear language and whether L is a CFL are both undecidable? If L is a linear language, why do we need to decide if it is linear and CFL again?

php – uncaught typeerror: cannot read property ‘valor’ of null

estoy totalmente seguro que este error debe ser algo muy tonto… jaja pero llevo 4 días buscando la solución.

Les explico, es un CRUD básicamente, que estoy utilizando consultas preparadas y bootstrap, js, php, MySQL, etc…

Lo que sucede es que estoy recibiendo este error en la consola, pero no con todos los registros al tratar de editarlos, solo pasa con algunos:

uncaught typeError: cannot read property ‘codigo1’ of null

He estado investigando y pues dicen que es porque es un valor nulo el que está buscando, osea que no existe, pero incluso en la DB están los campos como “Not Null”… pero eso no explica el porqué solo sucede con algunos registros y no con todos 🤔 , desde que tuve este mismo error no permite cargar correctamente la modal tampoco, así que imagino que es eso… Falta que cargue algo en la página.

Estas son las dependencias:

    <meta name="viewport" content="width-device-width, initial-scale=1.0">
    <link rel="stylesheet" href="../../bootstrap-4.5.0-dist/css/bootstrap.css" crossorigin="anonymous">
    <script src="https://code.jquery.com/jquery-3.5.1.js" integrity="sha256-QWo7LDvxbWT2tbbQ97B53yJnYU3WhH/C8ycbRAkjPDc=" crossorigin="anonymous"></script>
    <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.13.0/css/all.css" integrity="sha384-Bfad6CLCknfcloXFOyFnlgtENryhrpZCe29RTifKEixXQZ38WheV+i/6YWSzkz3V" crossorigin="anonymous">
    <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>
    <script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
    <script src="js/funciones.js"></script>```

Formulario de la modal edición:

<form id="actualizardatos">
                        <label>Cod:</label>
                        <input type="number" id="codigo1" name="codigo1" class="form-control form-control-sm">
                        <label>id:</label>
                        <input type="number" id="idup" name="idup" class="form-control form-control-sm">
                        <label>Nombre</label>
                        <input type="text" id="nombreup" name="nombreup" class="form-control form-control-sm">
                    </form>

Creo que esto no es tan necesario, pero igual la pongo cambiandole cosas:

include("conexion.php");
$conexion=conexion();

$codigo1=$conexion->real_escape_string(htmlentities($_POST('codigo1')));
$sql="SELECT codigo1,idup,nombre FROM empresas WHERE codigo1=?";
$query=$conexion->prepare($sql);
$query->bind_param('i',$codigo1);
$query->execute();
$datos=$query->get_result()->fetch_assoc();

echo json_encode($datos);

Y esta es la función que estoy utilizando:


function actualizardatos(codigo1){
    $.ajax({
        type:"POST",
        data:"codigo1=" + codigo1,
        url:"datosUpdate.php",
        success:function(r){
            //console.log(r);
            datos=jQuery.parseJSON(r);

            $('#codigoup1').val(datos('codigo'));
            $('#idup').val(datos('id'));
            $('#nombreup').val(datos('nombre'));
        }
    });
}

Y esto es lo que debe salir en modal:

$tabla="";

while($datos=$result->fetch_assoc()){
    $tabla=$tabla.'<tr>
    <td>'.$datos('codigo1').'</td>
    <td>'.$datos('id').'</td>
    <td>'.$datos('nombre').'</td>
    <td>
    <span class="btn btn-warning btn-sm" data-toggle="modal" data-target="#actualizardatos" onclick="agregaDatosParaEdicion('.$datos('codigo').')">
;
}

Al presionar este botón es que Aveces se muestra el error en consola, no pasa en todos los registros.

Creo que sería todo… ojalá alguien pueda ayudarme con este error 😅.

Muchas Gracias de antemano!

python – PyCrypto based encrypted Property class for Google App Engine standard – is this AES implementation secure

I have a need to encrypt OAuth access and refresh tokens stored in the Google Cloud Datastore.

The goal here is to ensure that if the Datastore entities are accessed independently of the code, the OAuth tokens will be encrypted and thus unusable.

This is not intended to protect against situations where both the code and Datastore are exposed together.

To securely store the data, I have leveraged PyCrypto’s AES implementation, and created a custom property type that automatically encrypts/decrypts the properties when accessing them.

The logic is as follows:

  • To store – I generate a random initialization vector, encrypt the data, then I base64 encode both the initialization vector and the encrypted data, and store them together in a text property.

  • To retrieve – I fetch the text data, slice off the base64 encoded initialization vector, and proceed to decode then decrypt the remaining data.

In addition to securing my own application, I am considering publishing the details and distributing the relevant code for others, so I want to ensure I have a secure or “correct” implementation of this functionality

(Note I have stripped out App Engine specific code and just included relevant encryption code here, for simplicity. The actual implementation allows it to be dropped into existing Datastore models in a backwards-compatible fashion).

 from Crypto.Cipher import AES 
 from Crypto import Random
 from base64 import b64encode,b64decode
 from meta_secure import aes_key #aes_key is a 32 digit alphanumeric string (GUID)
 
 #encryption scheme
 def encrypt_value(value):
    rand = Random.new()
    init_vector = rand.read(16)
    aes = AES.new(aes_key,AES.MODE_CFB,init_vector)
    encrypted = b64encode(aes.encrypt(value))
    return '%s%s'%(b64encode(init_vector),encrypted)
 
 def decrypt_value(value):
    init_vector = b64decode(value(:24))
    aes = AES.new(aes_key,AES.MODE_CFB,init_vector)
    decrypted = aes.decrypt(b64decode(value(24:)))
    return decrypted
   

Have I used PyCrypto and AES correctly for the goal as stated above?