Remove custom permalink base from CPT custom category and custom tags

I have a ‘resources’ CPT with ‘resources_category’ (custom category) and ‘resources_term’ (custom terms). They are all working, however the category and terms URL’s pick up the base permalink slug (‘news’) which is used for the blog posts.

ie. the following 2 URL’s are working

/resources/
/resources/post-title/

however the taxonomy URL’s are

/news/resources/category/videos/
/news/resources/tags/water/

I wish to change these to (remove the ‘news’)

/resources/category/videos/
/resources/tags/water/

Changing

'rewrite' => array( 'slug' => 'resources/tags', 'with_front' => true ),

to

'rewrite' => array( 'slug' => 'resources/tags', 'with_front' => false ),

returns a 404 error.

BASE seems the best coin to me now

BASE hourly candle sometimes really cool and it has spikes all the day i mean it moves up and down to a traders plate like an intolerable dish to eat ! Look at graph 2 days back may be in hourly it shows 38 to 122 price jump in only 8 hours more than 3.2x and then again see i marked blue dot 58 price to gray dot 90 thats nearly 55% more ! not all days are like this but after 2-3 days base jumps like this.

sass – Modificar estilos base del tema ngx admin en el archivo styles.scss

En mi aplicación Angular tengo el archivo styles.scss que contiene los estilos de la aplicación.

Este es el contenido:

@import url('https://fonts.googleapis.com/css?family=Open+Sans:400,600,700&display=swap');

// themes - our custom or/and out of the box themes
@import 'themes';

// framework component themes (styles tied to theme variables)
@import '~@nebular/theme/styles/globals';
@import '~@nebular/auth/styles/all';

@import '~bootstrap/scss/functions';
@import '~bootstrap/scss/variables';
@import '~bootstrap/scss/mixins';
@import '~bootstrap/scss/grid';

// loading progress bar theme
@import './pace.theme';

@import './layout';
@import './overrides';

// install the framework and custom global styles
@include nb-install() {

  // framework global styles
  @include nb-theme-global();
  @include nb-auth-global();

  @include ngx-layout();
  // loading progress bar
  @include ngx-pace-theme();

  @include nb-overrides();
};

El tema base instalado con npm tiene un archivo llamado _smart-table.theme.scss con el siguiente contenido:

@mixin nb-tables-smart-table-theme() {

  ng2-smart-table {
    table tr th,
    table tr th a {
      font-family: nb-theme(smart-table-header-font-family);
      font-size: nb-theme(smart-table-header-font-size);
      font-weight: nb-theme(smart-table-header-font-weight);
      line-height: nb-theme(smart-table-header-line-height);
      color: nb-theme(smart-table-header-fg);
    }

    table tr td {
      font-family: nb-theme(smart-table-font-family);
      font-size: nb-theme(smart-table-font-size);
      font-weight: nb-theme(smart-table-font-weight);
      line-height: nb-theme(smart-table-line-height);
      color: nb-theme(smart-table-fg);
      padding : 0px;
      padding-left: 10px;
    }
  }
 }

Necesito sobreescribir el estilo ng2-smart-table. Intenté modificar el archivo del tema base y funcionó bien, pero si el paquete se instala nuevamente los cambios desaparecen.

¿Cómo puedo modificar ng2-smart-table desde el archivo styles.scss para no tener que modificar el archivo base del paquete?

javascript – stubbing the protected function inherited from base class with sinon

I have a confusion on how to test protected method coming from super(inherited base class)

Here is what I have in the base class

export default class DataStoreBase {

protected _url: string;
protected _db: any;
protected _logger: LoggingService;
protected _name: string;
protected _type: string;

public constructor(logger: LoggingService, name: string, config: DatastoreConfig) {
    this._url = "";
    this._logger = logger;
    this._name = name;
    this._type = "";
    if (config.datastoreType === "cloudant") {
        const res = this.getCloudantClient(config.cloudant);
        this._url = res.endpoint;
        this._db = res.db;
        this._type += "Cloudant";
        this._logger.info({message: `${name} instance has been initialized.`});
    } else if (config.datastoreType === "couchdb") {
        const res = this.getCouchDBClient(config.couch);
        this._url = res.endpoint;
        this._db = res.db;
        this._type += "CouchDB";
        this._logger.info({message: `${name} instance has been initialized.`});
    } else {
        throw (new Error(CONFIG_INVALID_ERROR.message));
    }
}

and in another class I extend it:

export default class SearchesDatastore extends DataStoreBase {

 private bulkSize: number;
private designDocsPath: string;
 ....
public async getArchivedSearches() {
const _items = await this._db.find(q)
const items = _items.docs;
if (items.length <= 0) {
  this._logger.warn({ message: `No expired search queries found.` });
  return toBeDeleted;
}
bookmark = _items.bookmark;
for (let i = 0; i < items.length; i++) {
  toBeDeleted.push(items(i))
}
return toBeDeleted;

}

so as you see _db.find is coming from base class and it is protected variable
now I want to stub rhis._db.find
I try this

it("get archived queries", async () => {
  sandbox
    .stub(searchesDatastore, "_db")
    .resolves({ find: () => {return {docs: ()}}  });
  // sinon.stub(searchesDatastore.prototype,<any>"_db").resolves({ find: () => {return {docs: ()}}  });
  searchesDatastore.getArchivedSearches().catch((e:any) => {
    console.log(`eeeeeeeeeeeeeeeee`)
    expect(e.message).to.be.deep.include("error");
  });
});

but stubbing does not happen
I am really confused and appreciate if anyone can help

How to inherit base class dependencies without redefining theme in child class service arguments?

The question asks:

Is there any way to inject the Base Class service , when defining a
child class service (NodeHandler , ParagraphHandler) without using the
arguments: part in the service definition

Yes. For example, look in core.services.yml to see how this is done in core Drupal. Most core Drupal plugin managers have a parent service named default_plugin_manager. The default_plugin_manager service is defined like this:

  default_plugin_manager:
    abstract: true
    arguments: ('@container.namespaces', '@cache.discovery', '@module_handler')

As you can see, there are three services injected into the default_plugin_manager service. Because it is declared as “abstract”, this service definition is more like an alias or a placeholder – it’s simply there to define a set of arguments. Note there’s no class associated with this service.

A concrete plugin manager, for example the plugin.manager.block service, is then defined like this:

  plugin.manager.block:
    class: DrupalCoreBlockBlockManager
    parent: default_plugin_manager
    arguments: ('@logger.channel.default')

This service has FOUR arguments injected; the three defined by the parent default_plugin_manager plus the addition argument defined here.

When you look at the concrete class BlockManager that implements this service, you see that BlockManager has a constructor that looks like this:

public function __construct(Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, LoggerInterface $logger) {
...
}

As you can see, this constructor takes four arguments. The first three defined by the default_plugin_manager service and the last one defined by the plugin.manager.block service.

Core Drupal defines a DefaultPluginManager base class which is extended by BlockManager and other plugins. BlockManager accepts all four arguments in its constructor. Note that if the parent (DefaultPluginManager in this case) has a constructor then you need to call that from the subclass constructor. This way many different plugin managers can extend DefaultPluginManager and inherit those three injected services.

In your specific case, your services.yml file might look like this:

  my_parent_service:
    abstract: true
    arguments: ('@entity_type.manager', '@request_stack', '@sacd_user.permissions', '@logger.factory')

  sacd_rest_api.node_handler:
    class: Drupalsacd_rest_apiserviceNodeHandler
    parent: my_parent_service
  sacd_rest_api.parapgraph_handler:
    class: Drupalsacd_rest_apiserviceParagraphHandler
    parent: my_parent_service

You do not need a create() method anywhere, and you do not need to use ControllerBase at all.

linux – How do I make my Raspberry Pi act as a wireless USB controller? Not over the same network but remotely using a 3G/4G & LTE Base HAT

I am trying to download data from a USB based device remotely. i.e. Using a WiFi dongle or 3G/4G & LTE Base HAT with a Raspberry Pi 3 or 4.

Am I able to install a driver for a WiFi dongle or 3G/4G & LTE Base HAT on an android based Raspberry Pi?

I need the Raspberry Pi to act as a USB controller remotely i.e. not over the same local network but remotely using a 3G/4G & LTE Base HAT. So far I have only been able to get it to work over the same local network.

sql – Multiples base de datos db2 Consulta con DBEAVER

me he instalado en el trabajo Dbeaver y la verdad que me gusta un montón pero no se si tiene una funcionalidad que me gustaría hacer……no la encuentro.

En el trabajo tengo como mas de 100 base de datos db2, correspondientes cada una a un centro diferente, tiene todo igual con sus directorios y ficheros iguales y lo único que cambia son los datos.

Tengo una sql para consultar datos y la tengo que lanzar una a una en cada base de datos para traerme los datos.
Me gustaría saber si hay alguna forma con el dbeaver de que lance la misma consulta conectandose a las diferentes base de datos y me recopile los resultados el solito

Gracias.

php – ¿Insertar codigo ascii a la base de datos sirve para seguridad o no?

lo que pasa es que normalmente tengo la costumbre de insertar datos en la base de datos en UTF-8, pero un día se me ocurrió insertar un código javascript en la base de datos y me topo que es facilmente vulnerable, entonces pensé si de pronto agrego código ASCII al insertar y al hacer la consulta (incluyendo el proceso) y en el final ya puedo quitarlo. ¿consideran que hay otras maneras de hacerlo más seguro o como lo estoy haciendo está bien?

<?php
function addASCII($var){

    if(isset($var) && !empty($var) && $var){
        return htmlentities(addslashes($var));
    }else{
        return null;
    }
    
}


function removeASCII($var){
        
    if(isset($var) && !empty($var) && $var){
        return html_entity_decode(stripslashes($var));
    }else{
        return null;
    }

}


$pdo->prepare("INSERT INTO prueba (nombre) VALUES (:nombre)");
$query->execute(('nombre'=> addASCII('josé muñoz')));



$querypdo = $pdo->prepare("SELECT nombre FROM prueba");
$querypdo->execute();

    while($row = $querypdo->fetch()){
      $nombre= $row('nombre');
    }

  //supongamos que ya aquí he hecho todo el proceso y ahora voy a mostrar el nombre

    echo 'Nombre sin ASCII'.removeASCII($nombre);

?>

real analysis – Is every metric space with countable base a separable metric space?

Theorem: Every compact metric space $K$ has a countable base and therefore $K$ is separable.

A: Since every infinite subset of $K$ has a limit point in $K$ as $K$ is compact, it follows that $K$ is separable and since every separable metric space has a countable base so does $K$. This proves the theorem.

Now, let’s say that this A is not known to us so we proceed as below:
Choose $delta gt 0$,
Clearly $Ksubseteq cup_{xin K} N_delta (x)$. Since, $K$ is compact, there must exist a finite subset $K_fsubset K$ such that $Ksubseteq cup_{xin K_f} N_delta (x)=B$

Let $Gsubseteq K$ be any open subset of $K$. For some $tin G$, $exists epsilon_tgt 0$ such that $N_{epsilon_{t}}(t)subset G$.
Clearly, $tin B$ and hence $d(t,x)lt delta$ for some $xin K_f$

If $ain N_delta (x)$ then $d(a,x)lt delta$
Hence, $d(a,t)le d(a,x)+d(x,t)lt 2delta$
Since $deltagt 0$ is arbitrary, we choose $delta =epsilon_t/2implies d(a,t)lt epsilon_timplies ain G$. Thus we have proved that for any $xin G, x in N_delta (x) text{(for some $delta gt 0$)}subset G$. Hence, $B$ is a countable base of $K$.

I am stuck at proving (if this is true at all):
$K$ has a countable base $implies K$ is separable. If this statement is not true, then $A$ can be employed to prove $K$ is separable.

Please help. Thanks.