Use base class as template’s type in C++

I have a base class and two classes on top of it, and another template class like below.

class Base {}
class A : Base {}
class B : Base {}

template <typename T>
class C {}

I need to have a variable in instance of either C or C. I am wondering if there is any way I can have the variable in type of C. I tried to assign C or C to C, but it got an error “no conversion from C to C”. Any suggestions will be appreciated!

entities – How do I create configurations which describe a list of changes to make to an entity, varying by type and bundle?

I have several kind of content (different Entity Types, possibly different bundles). I have a kind of editorial workflow in which I want to make several changes to a piece of content (an instance implementing ContentEntityinterface). What actual changes I’ll make (which fields, which values) and how (“edit and replace” / “create revision” / “clone to new entity”) will depend on.

  • The entity type of provided content (and ideally bundle, although I could cope with a switch)
  • The “kind” of operation in a business perspective (publish / unpublish / revert / clone as draft / etc)
  • Ideally, the “operating mode” (replace/revision/clone), but if that would bring asinine complexity I can circumvent by making different operations for each variation.

Because that configuration may ultimately be managed by non-technical users, and the new values will be “relative to context”, if I follow through with the idea of describing changes, values will have to be “human keywords” that will translate in code to a specific method (ex “publication_date: tomorrow”, “publication_author: site_author)

Finally, while there are specificities to each kind, there are also some “common fields” that will be changed the same way in all kind of entities. Sadly, for reasons, they don’t have the same name.

*For the sake of easing exchanges, let’s say I have the following “entitytype:bundle” available: ‘node:doc’, ‘node:news’, ‘media:image’. I have an operation “publish” which in all entities, affects the following metadata: “publication_date”, “author”, “version number” (business counter unrelated to technical ids), “editorial_state” (unrelated to the Drupal ‘status’).

My very first attempt at structuring configuration made it clear I couldn’t manage with just Simple configuration API.

publication__related_fields:
  - processus_management:
      - node: 'field_moderations_content'
      - media: 'moderation_media'
  - publication_date:
      - node:  'field_begin'
      - media: 'field_begin'
  - publication_author:
      - node:  'uid'
      - media: 'uid'

# Placeholder because later we may actually make some "replace" operations or "new revision" ones.
# For now "copy" translates to "create duplicate of Entity" (yeah, I know... :/)
publication__mode: 'copy'

data_changes_on_publication:
  publication_date: 'today'
  publication_author: 'current_user'

It quickly became obvious to me that I could need to “traverse” configuration either “from operation” or “from entity type” at least. So describing every use-case in a single file would cause headaches one moment or another.

Seems to me it’s a perfect use-case for configuration entities, but while I get the theory of things, I have much trouble wrapping my head around it.

Questions

Could I have configuration entities that would be structured like
mymodule.OPERATION.ENTITY_TYPE.BUNDLE.yml (or maybe ENTITY_TYPE.BUNDLE.OPERATION if you feel it’s more logical)?

How can I then tell to Drupal it has to use this scheming name for the files?
And how can I immediately throw an error and gracefully stop process if provided entity does not have an adequate configuration entity in base?

magento2 – Magento 2 config CDN for specific file type only

Magento 2 allow to add another url for static views file, but all static file types will be requested to this url.

enter image description here

I want to some only file types be served using that url. Example *.js and *.css files are served via CDN, and all other file type are served from my server. Is that possible?

If I get it right, require.js is using baseUrl on very beginning of each pages to resolve static url, so may be I can ‘tweak’ it?

24x7technicalsupport.net | Your Servers Are Safe | cPanel VMware SolusVM Virtualizor | All Type of Server Management | Free Server Monitoring | $29 | | Proxies-free

24×7 Technical Support provides outsourced Webhosting support and server management services to web hosting providers and IT companies. We provide support services using commonly used the medium of communication as helpdesk, live chat and email support. Our plans provide real 24×7 human support with customized service options to choose from. We provide custom solutions specifically designed to meet client requirement to give you assurance and peace of mind when opting for our services. Apart from web hosting technical support the other services that we provide are server management, data migration and scripts installation.
==================================================
Our Unique Strengths!

Affordable Pricing “Always”
Best Security and “Top Quality”
Response Times “Guaranteed”
Scalable Support “On demand”
==================================================
Pricing:
Cpanel Server Management: $29/Month/server
Server Security and Harderning: 49/one time charges
VPS Server Management: $29/Month/server
Plesk Server Management: $29/Month/server
DirectAdmin Server Management: $29/Month/server
SolusVM Management: $69/month (Includes One master and One Slave)
Windows Server Management: $49/month/server (with or without control panel)
Plain Server Management : $49/month/server
Cloud Management : Starts @ $99/node
VMWare Server Management: Starting @ $49
Zimbra Management: Starting @ $49/node
=====================================================
Contact Us:
Email:
(email protected)
Skype: (email protected)
Live Chat
=====================================================
Our Server Management services include management and monitoring of your VPS, Dedicated Servers or even cloud servers. We specialize in Managing OpenStack and CloudStack Clusters with full support including instance level management.
=======================================================
All Plans include 24×7 Monitoring coverage worth $10.99/month without any cost.
We also specialize in application server management for Jboss/Tomcat as well as ready to use Cloudstack/Openstack Setups and other tailor-made setups.
Checkout Our Site Now!! and Get in Touch with us for promotional pricing.
========================================================
|| Tecsys Solutions LLC | Outperforming the Performers!! ||
|| Outsourced Server Management and Technical Support Solutions ||
|| Now Offering Secure Managed VPS and Dedicated Servers specially setup for Hosting Providers ||
|| https://www.24x7TechnicalSupport.net ||

=========================================================

Creating a TYPE that is an Array within a Function (or a predefined Array TYPE) in PostgreSQL

all, First Post.

I am researching migration of a major system from Oracle to PostgreSQL. Getting into coding Functions now, and am looking to see if there is a compatible object in PostgreSQL where, dynamically within a Function I can create a TYPE as an array.

The syntax in Oracle is:

TYPE VAR_STRING IS VARRAY(10) VARCHAR2(30);

This creates a 10 element array TYPE named VAR_STRING to hold 10 strings of 30 characters.

I am playing with PG 9.6, and even in the Create Type dialog, it is not obvious to me to make a pre-defined TYPE that can be an array.

Any help is appreciated.
Thanks!

I’m a developer, trying to land a job at an exchange. What type of software would an exchange need? Want to build something to use as a resume

I think there are few values that every exchange is looking for.

  • ability to work with multiple coins (exchanges = shitcoin casinos)
  • ability to generate the addresses and manage them securely on-scale within organization
  • knowledge of API interfaces

Regarding second point (as it’s a bitcoin-related board) I’d advise looking at few projects that you can work on yourself, copying the ideas:

Although it relates to bigger exchanges only, as smaller ones use external order books and usually work only on the frontend.

8 – How can I add classes to the rendered “body” field on a content type?

Preface: I don’t often work with Drupal, so I may not be using the correct terminology or fully understand the stack. Please bear with me, I’ll do my best to be as clear as possible.

I want to filter the rendered output of the primary “Body” field on a “Basic Page” (or “Article,” any content type really) to add some classes to various elements. This would be the field labeled “Body” at /node/add/page. I’d like to achieve this using DOMDocument in my .theme file, but I’m having trouble figuring out what the correct “hook” is to tie in to.

So ultimately the goal would be a function something like the following (which is partially psuedo code):

function my_theme_body_alter(&$content) {
    $DOM = new DOMDocument();

    $DOM->loadHTML(mb_convert_encoding($content, "HTML-ENTITIES", "UTF-8"), LIBXML_HTML_NODEFDTD);

    $anchors = $DOM->getElementsByTagName("a");

    foreach ($anchors as $anchor) {
        $existing_classes = $anchor->getAttribute("class") ? $anchor->getAttribute("class") : "";

        $anchor->setAttribute("class", "button {$existing_classes}");
    }

    $content = $DOM->saveHTML($content);

    return $content;
}

To be absolutely clear, I want to modify the output (on the front end) of this field:

example

What is the name of the hook I’m looking for, or how can I locate it myself?

Dependency Injection (di.xml) – (virtualType vs type) Magento 2 xsi:type=’object’

Can someone please explain when you would use <type/> or <virtualType in your di.xml file?

I want to make sure I understand it correctly..
At the moment, this is what I sort of think the difference is, especially with xsi:type='object' as arguments.

Type:

    <type name='SomeFileObject'>
       <arguments>
          <argument name="someText" xsi:type="string">String Value for This Arg</argument>
          <argument name="someArg" xsi:type="object">SomeObjectArgForThisArg</argument>
       </arguments>
    </type>

Virtual Type:

<virtualType name='instance1' type='SomeFileObject'>
   <arguments>
      <argument name="someArg" xsi:type="object">SomeObjectArgForThisArg</argument>
   </arguments>
</virtualType>
<virtualType name='instance2' type='SomeFileObject'>
   <arguments>
      <argument name="someArg" xsi:type="object">SomeOtherObjectArgForThisArg</argument>
   </arguments>
</virtualType>
  • So the questions I guess: – This is what I think it does:

    1. <type/> vs </virtualType> usage:

      • <type/> : This is a singular instance, and everywhere Magento 2 references this type, would it replace the argument given for every other class that use this object (argument)?
      • <virtualType/> : These ones you are able to call by name=, (in my example instance1, or instance2) to differentiate their usage at different places. I then call them and give them different argument values, so they do not interact with each other?
    2. Is this how you would use type and virtualType…. one/more objects and then ‘override’ them for use in other places that do not have any dependency on each other. For example: creating different log files, Magento has the main xsi:type=object referenced somewhere, then using virtualTypes I call them using the name?

    3. Do I do this (based on instance1 or instance2 above) example usage:

Use Type

   <type name='SomeOtherObjectB'>
       <arguments>
            <argument name="ObjectInstance" xsi:type='object'>instance1</argument>
       </arguments>
   </type>
   <type name='SomeOtherObjectB'>
       <arguments>
            <argument name="ObjectInstance" xsi:type='object'>instance2</argument>
       </arguments>
   </type>

OR
VirtualType:

   <virtualType name='SomeOtherObjectB'>
       <arguments>
            <argument name="ObjectInstance" xsi:type='object'>instance1</argument>
       </arguments>
   </virtualType>
   <virtualType name='SomeOtherObjectB'>
       <arguments>
            <argument name="ObjectInstance" xsi:type='object'>instance2</argument>
       </arguments>
   </virtualType>

I think the confusion is when do I use <virtualType/> elements do I use them in conjunction with AND / OR , especially when I want to use multiple virtualTypes with just arguments different (log files for sake of this discussion)