ALSA USB Audio Softvol asound.conf Configuration: always & # 39; Unknown PCM "softvol" & # 39; pick up

I'm trying to add a preamp control to my USB audio to compensate for the relatively low volume. Whatever I try, I keep getting error messages saying that this is unknown.

I started with:

pcm.!default {
    type hw
    card 1
}

ctl.!default {
    type hw
    card 1
}

But that did not work at all, so that became:

pcm.!default {
    type plug
    slave {
        pcm "hw:1,0"
    }
}

ctl.!default {
    type hw
    card 1
}

What works, but is rather quiet, is event at maximum (100%) volume.
I drew this from one side:

pcm.!default {
    type plug
    slave.pcm "softvol"
}

pcm.softvol {
    type softvol
    slave {
        pcm "dmix"
    }
    control {
        name "Pre-Amp"
        card 1
    }
    min_dB -5.0
    max_dB 38.0
    resolution 6
}

But the attempt to play sounds with it, only gives the error:

    ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM “softvol”
    aplay: main:828: audio open error: No such file or directory

I tried several other variations, but always get the above error if softvol is in use and alsamixer never shows the new control.

The latest thing I tried was from a different angle:

ctl.!default {
    type hw
    card 1
}
pcm.!default {
     type asym
     playback.pcm “plug:softvol”
     capture.pcm “plug:dsnoop”
}

pcm.softvol {
    type softvol
    slave.pcm “dmix:1”
    control { 
        name “PCM”
        card 1
    }
    max_dB 32.0
}

The only thing that has changed is that the & # 39; softvol & # 39; in error by & # 39; plug.softvol & # 39; was replaced.

aplay -L also displays softvol as one of the options (it's a raspberry Pi, with built-in BCM audio and USB audio (USB headset)), as well as the various controls for the two sound cards:

null
    Discard all samples (playback) or generate zero samples (capture)
default
softvol
sysdefault:CARD=ALSA
    bcm2835 ALSA, bcm2835 ALSA
    Default Audio Device
dmix:CARD=ALSA,DEV=0
    bcm2835 ALSA, bcm2835 ALSA
    Direct sample mixing device
dmix:CARD=ALSA,DEV=1
    bcm2835 ALSA, bcm2835 IEC958/HDMI
    Direct sample mixing device
dmix:CARD=ALSA,DEV=2
    bcm2835 ALSA, bcm2835 IEC958/HDMI1
    Direct sample mixing device
dsnoop:CARD=ALSA,DEV=0
    bcm2835 ALSA, bcm2835 ALSA
    Direct sample snooping device
dsnoop:CARD=ALSA,DEV=1
    bcm2835 ALSA, bcm2835 IEC958/HDMI
    Direct sample snooping device
dsnoop:CARD=ALSA,DEV=2
    bcm2835 ALSA, bcm2835 IEC958/HDMI1
    Direct sample snooping device
hw:CARD=ALSA,DEV=0
    bcm2835 ALSA, bcm2835 ALSA
    Direct hardware device without any conversions
hw:CARD=ALSA,DEV=1
    bcm2835 ALSA, bcm2835 IEC958/HDMI
    Direct hardware device without any conversions
hw:CARD=ALSA,DEV=2
    bcm2835 ALSA, bcm2835 IEC958/HDMI1
    Direct hardware device without any conversions
plughw:CARD=ALSA,DEV=0
    bcm2835 ALSA, bcm2835 ALSA
    Hardware device with all software conversions
plughw:CARD=ALSA,DEV=1
    bcm2835 ALSA, bcm2835 IEC958/HDMI
    Hardware device with all software conversions
plughw:CARD=ALSA,DEV=2
    bcm2835 ALSA, bcm2835 IEC958/HDMI1
    Hardware device with all software conversions
sysdefault:CARD=Audio
    USB Audio, USB Audio
    Default Audio Device
front:CARD=Audio,DEV=0
    USB Audio, USB Audio
    Front speakers
surround21:CARD=Audio,DEV=0
    USB Audio, USB Audio
    2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=Audio,DEV=0
    USB Audio, USB Audio
    4.0 Surround output to Front and Rear speakers
surround41:CARD=Audio,DEV=0
    USB Audio, USB Audio
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=Audio,DEV=0
    USB Audio, USB Audio
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=Audio,DEV=0
    USB Audio, USB Audio
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=Audio,DEV=0
    USB Audio, USB Audio
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=Audio,DEV=0
    USB Audio, USB Audio
    IEC958 (S/PDIF) Digital Audio Output
dmix:CARD=Audio,DEV=0
    USB Audio, USB Audio
    Direct sample mixing device
dsnoop:CARD=Audio,DEV=0
    USB Audio, USB Audio
    Direct sample snooping device
hw:CARD=Audio,DEV=0
    USB Audio, USB Audio
    Direct hardware device without any conversions
plughw:CARD=Audio,DEV=0
    USB Audio, USB Audio
    Hardware device with all software conversions

I spent about 8 hours with it so I really need some help here …

8 – WebDriverTestBase can not place / display the block configuration in an AJAX text

I write a bump test that checks the output of a page when a user has a particular cookie. Based on this cookie I have a block operated by Ajax Block which inserts the personalized block content for this user.

I tried to write the test first before implementing the implementation. From what I read, I have to use WebDriverTestBase because I'm testing AJAX behavior. Here's the beginning of the test:

class UserGreetingTest extends WebDriverTestBase {

  /**
   * {@inheritdoc}
   */
  protected static $modules = ('node', 'block', 'block_ajax', 'user', 'mymodule', 'twig_tweak', 'system');

  /**
   * {@inheritdoc}
   */
  protected function setUp() {
    parent::setUp();

    $this->container->get('module_installer')->uninstall(('page_cache'));
    $this->container->get('theme_installer')->install(('mytheme'));
    $this->container->get('config.factory')->getEditable('system.theme')->set('default', 'mytheme')->save();

    $this->drupalPlaceBlock('user_greeting', ('region' => 'user_section', 'theme' => 'mytheme'));

    $this->createContentType(('type' => 'page'));
    $this->drupalCreateNode(('type' => 'page'));
  }

  /**
   * Test the output of the block.
   */
  public function testUserGreeting() {
    $this->drupalGet('/node/1');

When calling drupalGet, the test fails and terminates with the following command:

There was 1 error:

1) Drupal Tests mymodule Functional DetectCookieTest :: testUserGreeting Undefined index: ajaxId

I could not really say what was going on, so I implemented my block for the first time anyway. The block works.

My block:

/**
 * Provides a 'Greeting' block.
 *
 * @Block(
 *  id = "user_greeting",
 *  admin_label = @Translation("User Greeting"),
 * )
 */
class HelloUser extends AjaxBlockBase {

  /**
   * The cookie we are looking for in a client session.
   */
  const COOKIE_NAME = 'CUSTOM_COOKIE';

  /**
   * {@inheritdoc}
   */
  public function build() : array {
    $build = parent::build();
    $request = Drupal::request();
    $cookie = $request->cookies->get(self::COOKIE_NAME);
    $has_session = FALSE;

    $username = NULL;
    $greeting = NULL;
    $login_url = 'https://site/login';

    if (isset($cookie)) {
      $url = Url::fromUri($login_url);
      $greeting = Link::fromTextAndUrl('Welcome, ' . $cookie, $url)->toRenderable();
      $has_session = TRUE;
    }

    $build += (
      '#theme' => 'user_greeting',
      '#greeting' => $greeting,
      '#login_url' => $login_url,
      '#has_session' => $has_session,
      '#username' => $username,
      '#cache' => (
        'max-age' => 0,
      )
    );

    return $build;

Looks pretty normal to me.

I can not really say why the test fails because the implementation works. I can manually call the site in different browsers, and those with the cookie will show the right thing I want to see, and the content will be retrieved via Ajax Block.

It seems like Ajax Block functional works, why should my test fail if the block lacks a configuration value that it should automatically have when placing it? How do you begin to debug why a test like this fails?

The BlockCreationTrait has this task:

Add support for creating custom block instances.

Could that be the culprit?

magento 1 – set memory configuration (system configuration)

We can get system configuration values ​​as well

Mage::getStoreConfig($xmlPath);

But how can we programmatically set such a configuration field? I would expect a method like that

Mage::setStoreConfig($xmlPath, $val);

But the next thing I see is

Mage::app()
    ->getStore()
    ->setConfig($xmlPath, $val);
    ->save();

However, this does not update the configuration value. Thank you for your time and your help.

iptables – security aspects of IPv4 forwarding and 1: 1 NAT configuration

I have a Raspbian box that I use for a site-to-site VPN tunnel. It gets internet via a lte modem and PPPD and the VPN is over OpenVPN.

I have not made any changes to iptables except to add a 1: 1 NAT over the tun0 interface. I also enabled IPv4 forwarding (net.ipv4.ip_forward).

My question is: Apart from access via the VPN module, is there any potential for users to access systems on the network using the lte adapter?

Beyond configuration, allowing pattern-based flexibility per service call

For example, say you have an ecommerce app and you have an API call to create an order.
OrderService.create (…);

Job creation is a complicated process. Many things will happen as a result of this call:

  1. Cart items are used to create an order and order details
  2. E-mail sent to the customer
  3. Stock levels adjusted
  4. Billing and shipping objects created and status changes
  5. etc.

Now let's say I just wanted to do a subset of the steps from # 1,2,3,4 or 5.

One approach would be a configuration setting that applies to ALL calls to OrderService.create, regardless of who makes the call.

I want a design pattern or design that lets me choose what to do based on a PER call.

Is there a design pattern for this type of behavior? This is a new system and I would like to find out about possible approaches.

Web – Nginx configuration does not work with Magento2 and Mautic

I want to use magento2 and mautic with subsites (localserverip / magento and localserverip / mautic). If I want to use / magento, the site will download index.php files and / mautic will not work because I get "ERR_INVALID_RESPONSE"
"Error.
It's my configuration

server {
listen 80;
listen (::):80;
server_name www.example.com;
root /var/www/html/magento;
index index.html index.htm index.php;

charset utf-8;

location /magento {
    try_files $uri $uri/ /index.php?$query_string;
}

location /mautic {
    root /var/www/html/mautic;
}

access_log off;
error_log  /var/log/nginx/www.example.com-error.log error;

error_page 404 /index.php;
}

Thank you for your help and apology for my English: D

magento2 – Magento Nginx configuration

I'm trying to set up a Magento Nginx configuration, but I've never used Nginx before, and I was hoping somebody could help with the configuration files.

This is my pre-made Plesk file

#ATTENTION!
#
#DO NOT MODIFY THIS FILE BECAUSE IT WAS GENERATED AUTOMATICALLY,
#SO ALL YOUR CHANGES WILL BE LOST THE NEXT TIME THE FILE IS GENERATED.

server {
    listen my.ip.address:443 ssl http2;

    server_name mydomain.co.uk;
    server_name www.mydomain.co.uk;
    server_name ipv4.mydomain.co.uk;

    ssl_certificate             /usr/local/psa/var/certificates/scfv2B5NG;
    ssl_certificate_key         /usr/local/psa/var/certificates/scfv2B5NG;
    ssl_client_certificate      /usr/local/psa/var/certificates/scfhnqwkh;

    client_max_body_size 128m;

    proxy_read_timeout 300;

    root "/var/www/vhosts/mydomain.co.uk/httpdocs";
    access_log "/var/www/vhosts/system/mydomain.co.uk/logs/proxy_access_ssl_log";
    error_log "/var/www/vhosts/system/mydomain.co.uk/logs/proxy_error_log";

    #extension letsencrypt begin
    location ^~ /.well-known/acme-challenge/ {
        root /var/www/vhosts/default/htdocs;

        types { }
        default_type text/plain;

        satisfy any;
        auth_basic off;
        allow all;

        location ~ ^/.well-known/acme-challenge.*/. {
            deny all;
        }
    }
    #extension letsencrypt end

    location / {
        proxy_pass https://my.ip.address:7081;
        proxy_set_header Host             $host;
        proxy_set_header X-Real-IP        $remote_addr;
        proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for;
        proxy_set_header X-Accel-Internal /internal-nginx-static-location;
        access_log off;

    }

    location /internal-nginx-static-location/ {
        alias /var/www/vhosts/mydomain.co.uk/httpdocs/;
        internal;
    }

    add_header X-Powered-By PleskLin;

    include "/var/www/vhosts/system/mydomain.co.uk/conf/vhost_nginx.conf";
}

server {
    listen my.ip.address:80;

    server_name mydomain.co.uk;
    server_name www.mydomain.co.uk;
    server_name ipv4.mydomain.co.uk;

    client_max_body_size 128m;

    proxy_read_timeout 300;

    return 301 https://$host$request_uri;
}

I can not change the Plesk file so I need to change the Magento file

## Example configuration:
# upstream fastcgi_backend {
#    # use tcp connection
#    # server  127.0.0.1:9000;
#    # or socket
#    server   unix:/var/run/php/php7.0-fpm.sock;
# }
# server {
#    listen 80;
#    server_name mage.dev;
#    set $MAGE_ROOT /var/www/magento2;
#    set $MAGE_DEBUG_SHOW_ARGS 1;
#    include /vagrant/magento2/nginx.conf.sample;
# }
#
## Optional override of deployment mode. We recommend you use the
## command 'bin/magento deploy:mode:set' to switch modes instead.
##
## set $MAGE_MODE default; # or production or developer
##
## If you set MAGE_MODE in server config, you must pass the variable into the
## PHP entry point blocks, which are indicated below. You can pass
## it in using:
##
## fastcgi_param  MAGE_MODE $MAGE_MODE;
##
## In production mode, you should uncomment the 'expires' directive in the /static/ location block

root $MAGE_ROOT/pub;

index index.php;
autoindex off;
charset UTF-8;
error_page 404 403 = /errors/404.php;
#add_header "X-UA-Compatible" "IE=Edge";


# Deny access to sensitive files
location /.user.ini {
    deny all;
}

# PHP entry point for setup application
location ~* ^/setup($|/) {
    root $MAGE_ROOT;
    location ~ ^/setup/index.php {
        fastcgi_pass   fastcgi_backend;

        fastcgi_param  PHP_FLAG  "session.auto_start=off n suhosin.session.cryptua=off";
        fastcgi_param  PHP_VALUE "memory_limit=756M n max_execution_time=600";
        fastcgi_read_timeout 600s;
        fastcgi_connect_timeout 600s;

        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }

    location ~ ^/setup/(?!pub/). {
        deny all;
    }

    location ~ ^/setup/pub/ {
        add_header X-Frame-Options "SAMEORIGIN";
    }
}

# PHP entry point for update application
location ~* ^/update($|/) {
    root $MAGE_ROOT;

    location ~ ^/update/index.php {
        fastcgi_split_path_info ^(/update/index.php)(/.+)$;
        fastcgi_pass   fastcgi_backend;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        fastcgi_param  PATH_INFO        $fastcgi_path_info;
        include        fastcgi_params;
    }

    # Deny everything but index.php
    location ~ ^/update/(?!pub/). {
        deny all;
    }

    location ~ ^/update/pub/ {
        add_header X-Frame-Options "SAMEORIGIN";
    }
}

location / {
    try_files $uri $uri/ /index.php$is_args$args;
}

location /pub/ {
    location ~ ^/pub/media/(downloadable|customer|import|theme_customization/.*.xml) {
        deny all;
    }
    alias $MAGE_ROOT/pub/;
    add_header X-Frame-Options "SAMEORIGIN";
}

location /static/ {
    # Uncomment the following line in production mode
    # expires max;

    # Remove signature of the static files that is used to overcome the browser cache
    location ~ ^/static/version {
        rewrite ^/static/(versiond*/)?(.*)$ /static/$2 last;
    }

    location ~* .(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2|json)$ {
        add_header Cache-Control "public";
        add_header X-Frame-Options "SAMEORIGIN";
        expires +1y;

        if (!-f $request_filename) {
            rewrite ^/static/(versiond*/)?(.*)$ /static.php?resource=$2 last;
        }
    }
    location ~* .(zip|gz|gzip|bz2|csv|xml)$ {
        add_header Cache-Control "no-store";
        add_header X-Frame-Options "SAMEORIGIN";
        expires    off;

        if (!-f $request_filename) {
           rewrite ^/static/(versiond*/)?(.*)$ /static.php?resource=$2 last;
        }
    }
    if (!-f $request_filename) {
        rewrite ^/static/(versiond*/)?(.*)$ /static.php?resource=$2 last;
    }
    add_header X-Frame-Options "SAMEORIGIN";
}

location /media/ {
    try_files $uri $uri/ /get.php$is_args$args;

    location ~ ^/media/theme_customization/.*.xml {
        deny all;
    }

    location ~* .(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ {
        add_header Cache-Control "public";
        add_header X-Frame-Options "SAMEORIGIN";
        expires +1y;
        try_files $uri $uri/ /get.php$is_args$args;
    }
    location ~* .(zip|gz|gzip|bz2|csv|xml)$ {
        add_header Cache-Control "no-store";
        add_header X-Frame-Options "SAMEORIGIN";
        expires    off;
        try_files $uri $uri/ /get.php$is_args$args;
    }
    add_header X-Frame-Options "SAMEORIGIN";
}

location /media/customer/ {
    deny all;
}

location /media/downloadable/ {
    deny all;
}

location /media/import/ {
    deny all;
}
location /errors/ {
    location ~* .xml$ {
        deny all;
    }
}

# PHP entry point for main application
location ~ ^/(index|get|static|errors/report|errors/404|errors/503|health_check).php$ {
    try_files $uri =404;
    fastcgi_pass   fastcgi_backend;
    fastcgi_buffers 1024 4k;

    fastcgi_param  PHP_FLAG  "session.auto_start=off n suhosin.session.cryptua=off";
    fastcgi_param  PHP_VALUE "memory_limit=756M n max_execution_time=18000";
    fastcgi_read_timeout 600s;
    fastcgi_connect_timeout 600s;

    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    include        fastcgi_params;
}

gzip on;
gzip_disable "msie6";

gzip_comp_level 6;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_proxied any;
gzip_types
    text/plain
    text/css
    text/js
    text/xml
    text/javascript
    application/javascript
    application/x-javascript
    application/json
    application/xml
    application/xml+rss
    image/svg+xml;
gzip_vary on;

# Banned locations (only reached if the earlier PHP entry point regexes don't match)
location ~* (.php$|.phtml$|.htaccess$|.git) {
    deny all;
}

I have no idea where to start to remove duplicate entries and make it work if someone could help

Thank you very much

magento2 – To implement a method for retrieving the configuration value in the store and in the default scope: Magento 2

In Magento 1 a call to Mage::getStoreConfig('section/group/field') could retrieve a configuration of the current memory. For example, if we called it from a front panel, it retrieved the configuration value of the current memory, and when we called it from an admin block, it retrieved the value of admin memory (id=0).

Is it still possible in Magento 2 to have such a method?

For example, I created a helper with the following content:

namespace VendorNameModuleNameHelper;

use MagentoStoreModelScopeInterface;
use MagentoFrameworkAppHelperAbstractHelper;
use MagentoFrameworkAppHelperContext;

class Config extends AbstractHelper
{
    const XML_PATH_FEATURE_ENABLED = 'section/group/my_feature_enabled';

    /**
     * Get enabled config
     * @param int|null $storeId
     * @return mixed
     */
    public function isEnabled($storeId = null)
    {     
            return $this->scopeConfig->getValue(
                self::XML_PATH_FEATURE_ENABLED,
                ScopeInterface::SCOPE_STORE,
                $storeId
            );
        }
    }
}

For information: In my test environment, I only have one store view.
My core_config_data Table looks like this:

scope   |  scope_id |                path               |    value 
default |    0      | section/group/my_feature_enabled  |      0
stores  |    1      | section/group/my_feature_enabled  |      1

When I call it from the frontend area, it works as expected (returns) 1). But when I call it from the administrator, it does not return the default administrator value: it is returned 1 to …

If I change ScopeInterface::SCOPE_STORE by default by doing isEnabled Method, it always returns the default value (admin value), but it does not return the good front-end value …

So, what is the Magento 2 method to achieve the same result as the Magento 1? Mage::getStoreConfig Method?