mediawiki – How can I modify categories on a Wikipedia Talk page?

The category option is grayed out because Talk pages generally don't need categories. Source

Each Wikipedia page must belong to at least one category. (However, discussion pages, redirects, or user pages do not need to be classified, although these can be categorized where appropriate.)

Look at the template: logo requested. You will see that there are several categories and subcategories here. In the case of a television show, you're probably looking {{tvimage}} however it could also be {{image requested}} or any other template listed on the template page.

Once you have removed the appropriate template, the category will also be removed.

c – How can I modify my graphics traversal algorithm to increase efficiency?

I have an "A" adjacency matrix that I am using to represent a graph for a social network. Each node in the graph represents the name of a person, and I'm storing the names of the people in a 2-d array (the index of the person's name in the array is the same as the row index of the node in the array adjacency). I wrote an algorithm to return the neighbors of the node in the graph that are maximum x nodes away from the node (the indexes of the neighboring nodes will be stored in a binary tree and the tree root will be returned) but the algorithm is inefficient and delays 1 to 2 minutes to return the output, even if it is correct. I would appreciate some tips on how to optimize this algorithm.

b_tree *get_friends(b_tree *root, int x, int y, char a_name(50) int dim) {
    /* root is root if b-tree containing pointers to the neighbors */
    /* a_name is the name of a person in the graph (want to get the neighbors of this node)*/
    /* x is maximum distance the neighbor can be from the node */
    /* y is used to keep track of x and is always 0 and dim is the length/width of matrix */
    /* M is a global variable for the matrix */
    /* name_search searches the tree and returns NULL if the index is already in the tree (to prevent duplicates) */
    /* friend_list is a global array containing the names of all the nodes in the graph (including a_name) */ 
    /* retrieve_ind returns the index of the user name in the the friend_list array */
    if (x == y - 1) return root;
    int r = retrieve_ind(a_name);
    for (int a = 0; a < dim; a++) {
        if (M(r)(a) > 0) {
            if (name_search(root, a) == NULL) root = insert_in_tree(root, a);
            root = get_friends(root, x, y + 1, friend_list(a), dim);
        }
    }
    return root;
}

How to modify the view of subdirectories within a directory?

When trying to modify the view of an electrode, I prefer this view:

enter the image description here

But I hate the right part where we see the information in every app.
Is it possible to modify it so that it has a default value like this (without the information part on the right):

enter the image description here

Payment – Modify a product price add to cart Magento 1

I wrote a page to add to the cart with the identification product

Everything was fine, I can add product to the cart

I want to add to the cart with the price of only that product 0, if the cart has more product, just add the price of the product from page = 0

Can you help me

This is my code:

 $data = $this->getRequest()->getParam("values");
 $dataProduct = $this->dataProduct($data);
 $product = Mage::getModel('catalog/product')->load($dataProduct('id'));
 $params = array(
            'entity_id' => $dataProduct('id'),
            'qty' => $dataProduct('qty')
 );
 $cart = Mage::helper('checkout/cart')->getCart();
 $cart->addProduct($product, $params);
 $this->modifyPrice($dataProduct('id'));
 $cart->save();

MODIFY PRICE function

private function modifyPrice($productId){
    $quote = Mage::helper('checkout/cart')->getQuote();
    foreach ($quote->getAllVisibleItems() as $item) {
        if($item->getProduct()->getId() != $productId) {continue;}
        $item->setPrice(0);
        $item->setPriceInclTax(0);
        $item->save();
    }
    $quote->save();
}

How to modify function to accept 2 SVG to convert to Base64?

I have this Js code which allows me to pass the ID of an SVG as a parameter and convert it to BASE64 png

    (function() {
  const out$ = typeof exports != 'undefined' && exports || typeof define != 'undefined' && {} || this || window;
  if (typeof define !== 'undefined') define('save-svg-as-png', (), () => out$);
  out$.default = out$;

  const xmlNs = 'http://www.w3.org/2000/xmlns/';
  const xhtmlNs = 'http://www.w3.org/1999/xhtml';
  const svgNs = 'http://www.w3.org/2000/svg';
  const doctype = ')>';
  const urlRegex = /url(("')?(.+?)("')?)/;
  const fontFormats = {
    woff2: 'font/woff2',
    woff: 'font/woff',
    otf: 'application/x-font-opentype',
    ttf: 'application/x-font-ttf',
    eot: 'application/vnd.ms-fontobject',
    sfnt: 'application/font-sfnt',
    svg: 'image/svg+xml'
  };

  const isElement = obj => obj instanceof HTMLElement || obj instanceof SVGElement;
  const requireDomNode = el => {
    if (!isElement(el)) throw new Error(`an HTMLElement or SVGElement is required; got ${el}`);
  };
  const requireDomNodePromise = el =>
    new Promise((resolve, reject) => {
      if (isElement(el)) resolve(el)
      else reject(new Error(`an HTMLElement or SVGElement is required; got ${el}`));
    })
  const isExternal = url => url && url.lastIndexOf('http',0) === 0 && url.lastIndexOf(window.location.host) === -1;

  const getFontMimeTypeFromUrl = fontUrl => {
    const formats = Object.keys(fontFormats)
      .filter(extension => fontUrl.indexOf(`.${extension}`) > 0)
      .map(extension => fontFormats(extension));
    if (formats) return formats(0);
    console.error(`Unknown font format for ${fontUrl}. Fonts may not be working correctly.`);
    return 'application/octet-stream';
  };

  const arrayBufferToBase64 = buffer => {
    let binary = '';
    const bytes = new Uint8Array(buffer);
    for (let i = 0; i < bytes.byteLength; i++) binary += String.fromCharCode(bytes(i));
    return window.btoa(binary);
  }

  const getDimension = (el, clone, dim) => {
    const v =
      (el.viewBox && el.viewBox.baseVal && el.viewBox.baseVal(dim)) ||
      (clone.getAttribute(dim) !== null && !clone.getAttribute(dim).match(/%$/) && parseInt(clone.getAttribute(dim))) ||
      el.getBoundingClientRect()(dim) ||
      parseInt(clone.style(dim)) ||
      parseInt(window.getComputedStyle(el).getPropertyValue(dim));
    return typeof v === 'undefined' || v === null || isNaN(parseFloat(v)) ? 0 : v;
  };

  const getDimensions = (el, clone, width, height) => {
    if (el.tagName === 'svg') return {
      width: width || getDimension(el, clone, 'width'),
      height: height || getDimension(el, clone, 'height')
    };
    else if (el.getBBox) {
      const {x, y, width, height} = el.getBBox();
      return {
        width: x + width,
        height: y + height
      };
    }
  };

  const reEncode = data =>
    decodeURIComponent(
      encodeURIComponent(data)
        .replace(/%((0-9A-F){2})/g, (match, p1) => {
          const c = String.fromCharCode(`0x${p1}`);
          return c === '%' ? '%25' : c;
        })
    );

  const uriToBlob = uri => {
    const byteString = window.atob(uri.split(',')(1));
    const mimeString = uri.split(',')(0).split(':')(1).split(';')(0)
    const buffer = new ArrayBuffer(byteString.length);
    const intArray = new Uint8Array(buffer);
    for (let i = 0; i < byteString.length; i++) {
      intArray(i) = byteString.charCodeAt(i);
    }
    return new Blob((buffer), {type: mimeString});
  };

  const query = (el, selector) => {
    if (!selector) return;
    try {
      return el.querySelector(selector) || el.parentNode && el.parentNode.querySelector(selector);
    } catch(err) {
      console.warn(`Invalid CSS selector "${selector}"`, err);
    }
  };

  const detectCssFont = (rule, href) => {
    // Match CSS font-face rules to external links.
    // @font-face {
    //   src: local('Abel'), url(https://fonts.gstatic.com/s/abel/v6/UzN-iejR1VoXU2Oc-7LsbvesZW2xOQ-xsNqO47m55DA.woff2);
    // }
    const match = rule.cssText.match(urlRegex);
    const url = (match && match(1)) || '';
    if (!url || url.match(/^data:/) || url === 'about:blank') return;
    const fullUrl =
      url.startsWith('../') ? `${href}/../${url}`
      : url.startsWith('./') ? `${href}/.${url}`
      : url;
    return {
      text: rule.cssText,
      format: getFontMimeTypeFromUrl(fullUrl),
      url: fullUrl
    };
  };

  const inlineImages = el => Promise.all(
    Array.from(el.querySelectorAll('image')).map(image => {
      let href = image.getAttributeNS('http://www.w3.org/1999/xlink', 'href') || image.getAttribute('href');
      if (!href) return Promise.resolve(null);
      if (isExternal(href)) {
        href += (href.indexOf('?') === -1 ? '?' : '&') + 't=' + new Date().valueOf();
      }
      return new Promise((resolve, reject) => {
        const canvas = document.createElement('canvas');
        const img = new Image();
        img.crossOrigin = 'anonymous';
        img.src = href;
        img.onerror = () => reject(new Error(`Could not load ${href}`));
        img.onload = () => {
          canvas.width = img.width;
          canvas.height = img.height;
          canvas.getContext('2d').drawImage(img, 0, 0);
          image.setAttributeNS('http://www.w3.org/1999/xlink', 'href', canvas.toDataURL('image/png'));
          resolve(true);
        };
      });
    })
  );

  const cachedFonts = {};
  const inlineFonts = fonts => Promise.all(
    fonts.map(font =>
      new Promise((resolve, reject) => {
        if (cachedFonts(font.url)) return resolve(cachedFonts(font.url));

        const req = new XMLHttpRequest();
        req.addEventListener('load', () => {
          // TODO: it may also be worth it to wait until fonts are fully loaded before
          // attempting to rasterize them. (e.g. use https://developer.mozilla.org/en-US/docs/Web/API/FontFaceSet)
          const fontInBase64 = arrayBufferToBase64(req.response);
          const fontUri = font.text.replace(urlRegex, `url("data:${font.format};base64,${fontInBase64}")`)+'n';
          cachedFonts(font.url) = fontUri;
          resolve(fontUri);
        });
        req.addEventListener('error', e => {
          console.warn(`Failed to load font from: ${font.url}`, e);
          cachedFonts(font.url) = null;
          resolve(null);
        });
        req.addEventListener('abort', e => {
          console.warn(`Aborted loading font from: ${font.url}`, e);
          resolve(null);
        });
        req.open('GET', font.url);
        req.responseType = 'arraybuffer';
        req.send();
      })
    )
  ).then(fontCss => fontCss.filter(x => x).join(''));

  let cachedRules = null;
  const styleSheetRules = () => {
    if (cachedRules) return cachedRules;
    return cachedRules = Array.from(document.styleSheets).map(sheet => {
      try {
        return {rules: sheet.cssRules, href: sheet.href};
      } catch (e) {
        console.warn(`Stylesheet could not be loaded: ${sheet.href}`, e);
        return {};
      }
    });
  };

  const inlineCss = (el, options) => {
    const {
      selectorRemap,
      modifyStyle,
      modifyCss,
      fonts,
      excludeUnusedCss
    } = options || {};
    const generateCss = modifyCss || ((selector, properties) => {
      const sel = selectorRemap ? selectorRemap(selector) : selector;
      const props = modifyStyle ? modifyStyle(properties) : properties;
      return `${sel}{${props}}n`;
    });
    const css = ();
    const detectFonts = typeof fonts === 'undefined';
    const fontList = fonts || ();
    styleSheetRules().forEach(({rules, href}) => {
      if (!rules) return;
      Array.from(rules).forEach(rule => {
        if (typeof rule.style != 'undefined') {
          if (query(el, rule.selectorText)) css.push(generateCss(rule.selectorText, rule.style.cssText));
          else if (detectFonts && rule.cssText.match(/^@font-face/)) {
            const font = detectCssFont(rule, href);
            if (font) fontList.push(font);
          } else if (!excludeUnusedCss) {
            css.push(rule.cssText);
          }
        }
      });
    });

    return inlineFonts(fontList).then(fontCss => css.join('n') + fontCss);
  };

  const downloadOptions = () => {
    if (!navigator.msSaveOrOpenBlob && !('download' in document.createElement('a'))) {
      return {popup: window.open()};
    }
  };

  out$.prepareSvg = (el, options, done) => {
    requireDomNode(el);
    const {
      left = 0,
      top = 0,
      width: w,
      height: h,
      scale = 1,
      responsive = false,
      excludeCss = false,
    } = options || {};

    return inlineImages(el).then(() => {
      let clone = el.cloneNode(true);
      clone.style.backgroundColor = (options || {}).backgroundColor || el.style.backgroundColor;
      const {width, height} = getDimensions(el, clone, w, h);

      if (el.tagName !== 'svg') {
        if (el.getBBox) {
          if (clone.getAttribute('transform') != null) {
            clone.setAttribute('transform', clone.getAttribute('transform').replace(/translate(.*?)/, ''));
          }
          const svg = document.createElementNS('http://www.w3.org/2000/svg','svg');
          svg.appendChild(clone);
          clone = svg;
        } else {
          console.error('Attempted to render non-SVG element', el);
          return;
        }
      }

      clone.setAttribute('version', '1.1');
      clone.setAttribute('viewBox', (left, top, width, height).join(' '));
      if (!clone.getAttribute('xmlns')) clone.setAttributeNS(xmlNs, 'xmlns', svgNs);
      if (!clone.getAttribute('xmlns:xlink')) clone.setAttributeNS(xmlNs, 'xmlns:xlink', 'http://www.w3.org/1999/xlink');

      if (responsive) {
        clone.removeAttribute('width');
        clone.removeAttribute('height');
        clone.setAttribute('preserveAspectRatio', 'xMinYMin meet');
      } else {
        clone.setAttribute('width', width * scale);
        clone.setAttribute('height', height * scale);
      }

      Array.from(clone.querySelectorAll('foreignObject > *')).forEach(foreignObject => {
        foreignObject.setAttributeNS(xmlNs, 'xmlns', foreignObject.tagName === 'svg' ? svgNs : xhtmlNs);
      });

      if (excludeCss) {
        const outer = document.createElement('div');
        outer.appendChild(clone);
        const src = outer.innerHTML;
        if (typeof done === 'function') done(src, width, height);
        else return {src, width, height};
      } else {
        return inlineCss(el, options).then(css => {
          const style = document.createElement('style');
          style.setAttribute('type', 'text/css');
          style.innerHTML = ``;

          const defs = document.createElement('defs');
          defs.appendChild(style);
          clone.insertBefore(defs, clone.firstChild);

          const outer = document.createElement('div');
          outer.appendChild(clone);
          const src = outer.innerHTML.replace(/NSd+:href/gi, 'xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href');

          if (typeof done === 'function') done(src, width, height);
          else return {src, width, height};
        });
      }
    });
  };

  out$.svgAsDataUri = (el, options, done) => {
    requireDomNode(el);
    return out$.prepareSvg(el, options)
      .then(({src, width, height}) => {
          const svgXml = `data:image/svg+xml;base64,${window.btoa(reEncode(doctype+src))}`;
          if (typeof done === 'function') {
              done(svgXml, width, height);
          }
          return svgXml;
      });
  };

  out$.svgAsPngUri = (el, options, done) => {
    requireDomNode(el);
    const {
      encoderType = 'image/png',
      encoderOptions = 0.8,
      canvg
    } = options || {};

    const convertToPng = ({src, width, height}) => {
      const canvas = document.createElement('canvas');
      const context = canvas.getContext('2d');
      const pixelRatio = window.devicePixelRatio || 1;

      canvas.width = width * pixelRatio;
      canvas.height = height * pixelRatio;
      canvas.style.width = `${canvas.width}px`;
      canvas.style.height = `${canvas.height}px`;
      context.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0);

      if (canvg) canvg(canvas, src);
      else context.drawImage(src, 0, 0);

      let png;
      try {
        png = canvas.toDataURL(encoderType, encoderOptions);
      } catch (e) {
        if ((typeof SecurityError !== 'undefined' && e instanceof SecurityError) || e.name === 'SecurityError') {
          console.error('Rendered SVG images cannot be downloaded in this browser.');
          return;
        } else throw e;
      }
      if (typeof done === 'function') done(png, canvas.width, canvas.height);
      return Promise.resolve(png);
    }

    if (canvg) return out$.prepareSvg(el, options).then(convertToPng);
    else return out$.svgAsDataUri(el, options).then(uri => {
      return new Promise((resolve, reject) => {
        const image = new Image();
        image.onload = () => resolve(convertToPng({
          src: image,
          width: image.width,
          height: image.height
        }));
        image.onerror = () => {
          reject(`There was an error loading the data URI as an image on the following SVGn${window.atob(uri.slice(26))}Open the following link to see browser's diagnosisn${uri}`);
        }
        image.src = uri;
      })
    });
  };

  out$.download = (name, uri, options) => {
    console.log(name+' | '+uri+' | '+options)

    if (navigator.msSaveOrOpenBlob) navigator.msSaveOrOpenBlob(uriToBlob(uri), name);
    else {
      const saveLink = document.createElement('a');
      // if ('download' in saveLink) {
      //   saveLink.download = name;
      //   saveLink.style.display = 'none';
      //   document.body.appendChild(saveLink);
      //   console.log(saveLink)
      //   try {
      //     const blob = uriToBlob(uri);
      //     const url = URL.createObjectURL(blob);
      //     saveLink.href = url;
      //     saveLink.onclick = () => requestAnimationFrame(() => URL.revokeObjectURL(url));
      //   } catch (e) {
      //     console.error(e);
      //     console.warn('Error while getting object URL. Falling back to string URL.');
      //     saveLink.href = uri;
      //   }
      //   saveLink.click();
      //   document.body.removeChild(saveLink);
      // } else if (options && options.popup) {
      //   options.popup.document.title = name;
      //   options.popup.location.replace(uri);
      // }
    }
  };

  out$.saveSvg = (el, name, options) => {
    const downloadOpts = downloadOptions(); // don't inline, can't be async
    return requireDomNodePromise(el)
      .then(el => out$.svgAsDataUri(el, options || {}))
      .then(uri => out$.download(name, uri, downloadOpts));
  };

  out$.saveSvgAsPng = (el, name, options) => {
    const downloadOpts = downloadOptions(); // don't inline, can't be async
    return requireDomNodePromise(el)
      .then(el => out$.svgAsPngUri(el, options || {}))
      .then(uri => out$.download(name, uri, downloadOpts));
  };
})();

saveSvgAsPng (document.getElementById ("HumanHuman"), "download-name.png");

The code I have modified so that it only gives me an alert of the Base64 code, since at first the function what it did was to download the image as such; and I just want Base64 png

And even there it works perfectly the thing is that I need to pass not 1 SVG ID but I need to pass 2 SVG ID

Something similar to this

saveSvgAsPng(document.getElementById("CuerpoHumano1"),document.getElementById("CuerpoHumano2"), "nombre-de-descarga.png");

And to be able to obtain the Base64 code with that format, just thank you in advance

8 – Views modify custom text field per row

I have a view that shows the content types of events. Users can request events and see other applicants after clicking on the link. I'm looking for a way to alter the & # 39; View applicants & # 39; so users can see how many applicants have already submitted their application. See images below.

I've already tried with preprocess_views_view_field Y views_pre_render in a custom module but I can't find a way to get to the & # 39; see requestors & # 39; field.

This is the view at the moment.
result now
This is the result I am looking for.
desired result

Apply Y See applicants they are custom text fields with a url.

The field I am looking for is called nothing_1. I have managed to change it with a views_pre_render I like this:

function frontview_general_views_pre_render(ViewExecutable &$view) {

  if ($view->current_display === 'accreditaties_overzicht' && $view->id() === 'evenementen') {

    $results = $view->result;
    if (empty($results)) {
      return;
    }
    foreach ($results as $row) {
      $accreditaties = $row->_entity->get('field_accreditaties');
      $accreditaties = $accreditaties->getValue('list');
      $amount = count($accreditaties); 
    }
   $view->field('nothing_1')->options('alter')('text') = 'View Applicants ('. $amount .')';
  }
}

This alters the field but uses the same value for all rows. I am looking for a way to alter it by row. I can't seem to find the field per row.

If you know how to do this or can point me in the right direction, please help me.

Thanks in advance!

* Drupal 8

visual studio code – How do I modify the Shorcuts of widnows 7?

When using visual studio code there are keyboard shortcuts that use the simultaneous keys: alt + shift(which is the same alt + shift), but when you press them windows 7 also changes the keyboard language, there is some way to disable this shorcut in windows 7 to use visual studio code more comfortably

computational geometry – Algorithm design – Modify a polygon so that all its lines are at a multiple of k degrees, maximizing the intersection on the union

I have been trying for some time to think of an algorithm as follows:

Entry: List of line segments (x1, y1, x2, y2) that form a closed polygon. points x / y do not need to be integers, the polygon does not need to be convex.

Output: another list of line segments that form a closed polygon, with the property that:

a) Relative to the horizontal, each line segment is exactly a multiple of k degrees, that is, if k = 60 there are only 6 possible angles that a line could take.

b) The intersection on the union between the output polygon and the input polygon is maximized.


The greedy algorithm would be:

For each line segment, rotate it around its midpoint to align it with the nearest multiple of k degrees, changing the start / end point of neighboring lines to keep the polygon closed.

Choose the line segment that is not yet aligned for which this alignment causes the highest IOU relative to the previous iteration, and commit to that move.

Repeat until all lines fit.


However, I don't think this will produce the best possible result: when trying to change a line whose endpoints have already been changed by moving other lines, it might not produce as good an answer as an algorithm that considers all lines together.

1) Does the greedy algorithm produce the optimal response? (I hope not)

2) Can you help me design an algorithm that produces the optimal response?

xpath – Delete or modify an xml element with xslt

I work with xml documents with very high granularity tagging (we often tag at letter level). Sometimes, it is necessary to modify an xml element or delete it, but keeping all its content (which becomes its ancestor's content). For example, I have certain individually labeled letters within certain words and I want to remove the label, but keep the letter.

A simple example would be this:

        
           Nunuſaitmirzherdurchdiwant·.‹
           Maistermaister,eziſtnihtſogewant·.‹
        

I want to remove the tag inside the tag and keep its content intact. With xpath I can locate all those tags (// reg / hi) and remove them later manually. But I figure there has to be a simpler way, probably with xslt, to remove them all. Or to modify them if that were the case. Someone knows?

You need a developer who can modify glype

Hi
Anyone here who can modify the free Glype proxy script
I have two demos that are made exactly the same and they created the site

pm so that I can share that I don't want to share in public
Let me know if you are interested in working on the project