Google Lighthouse gives a warning that the Module.css files in my DotNetNuke (DNN) modules are render blocking resources

How can I fix my DotNetNuke modules from causing render blocking?

enter image description here

magento2 – REST API: Consumer is not authorized to access %resources

I’m in the middle of finishing a Magento 2 store for a client. The last I had on my to-do list, was connect Magento to their accounting software through the REST API.

However, apparently there’s some serious issue when it comes to the REST API in the Magento installation. No matter what I do I’m always given a “Consumer is not authorized to access %resources” error, such as:

{
    "message": "Consumer is not authorized to access %resources",
    "parameters": {
        "resources": "Magento_Sales::sales"
    }
}

POSTMAN Settings:enter image description here

I’m using an Access Token created through Admin > System > Integrations. The created Integration has resource access set to ALL.

System:

  • CentOS 7
  • WHM/cPanel
  • PHP 7.3.27
  • PHP Handler SuPHP
  • Magento 2.4.1
  • Webserver: Apache (port 8080)
  • Cache: Varnish (port 80)
  • SSL: Nginx as reverse proxy for SSL (port 443)

Things I’ve tried based on similar questions:

  • Change PHP handler from CGI to SuPHP (source)
  • Enable individual API resource access instead of setting to ‘ALL’ (source)
  • Tested without Varnish between client and server
  • Tested without Nginx proxy between client and server

I really can’t seem to figure out what I’m doing wrong here. Does anybody have an idea what might be causing this? An option would be to do a fresh installation, but that’d be my very last option as I’ve been working on this Magento environment (theme, thouuuusands of products, …) for many months.

java – Robolectric Resources$NotFoundException can’t find librarr (aar) resources

I have looked quite a bit for a solution for this (few days) and have not come to a solution yet. Basically, for my unit tests using Robolectric, I keep getting Resources$NotFoundException when trying to inflate resources from a dependency (pulled in as an aar). Heres the setup:

build.gradle (project level)

// Top Level
buildscript {
    apply from: "${System.getenv('MY_REPOS')}", to: buildscript
    println("REPOS: ${repositories.names}")
    dependencies {
        classpath "com.android.tools.build:gradle:3.3.2"
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

build.gradle (app)

plugins {
    id 'com.android.application'
}

android {
    compileSdkVersion 28

    defaultConfig {
        applicationId "com.me.myapplication"
        minSdkVersion 18
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    testOptions {
        animationsDisabled true
        unitTests {
            includeAndroidResources = true
        }
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {

    implementation 'com.me.android:thewidget:4.0.0' // pulled from private repo

    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'com.google.android.material:material:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.navigation:navigation-fragment:2.2.2'
    implementation 'androidx.navigation:navigation-ui:2.2.2'

    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

    implementation("com.google.guava:guava:27.0-jre") {
        exclude group: 'com.google.guava', module: 'failureaccess'
    }

    //UnitTests
    testImplementation 'junit:junit:4.13'
    testImplementation 'org.robolectric:robolectric:4.3.1'
    testImplementation 'org.robolectric:android-all:9-robolectric-4913185-2'
}

I am using distributionUrl=https://services.gradle.org/distributions/gradle-4.10.3-all.zip in my gradle-wrapper.properties

and my gradle properties:

org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
android.useAndroidX=true
android.enableJetifier=true
android.enableUnitTestBinaryResources = true //tried with and without this set
android.enableAapt2 = false // same here with and without this here

Then its the default blank activity template that comes in Android Studio 4.1.2. So the only thing touched is the main main activity:

package com.me.myapplication;

import android.os.Bundle;

import com.me.thewidget.MyOtherView;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.snackbar.Snackbar;

import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;

import android.view.View;

import android.view.Menu;
import android.view.MenuItem;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Toolbar toolbar = findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);



        FloatingActionButton fab = findViewById(R.id.fab);
        fab.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                        .setAction("Action", null).show();
            }
        });
    }

    public void testDialogSetup() {
        MyOtherView myView = new MyOtherView(this);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.menu_main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        //noinspection SimplifiableIfStatement
        if (id == R.id.action_settings) {
            return true;
        }

        return super.onOptionsItemSelected(item);
    }
}

So the issue is with the MyOtherView and when it inflates the view inside this class. So in MyOtherView it throws the exception in the test when it hits this line:

...
inflater.inflate(layout.my_view, this);
...

As for the test itself:

package com.me.myapplication;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.Robolectric;
import org.robolectric.RobolectricTestRunner;

import static org.junit.Assert.*;

/**
 * Example local unit test, which will execute on the development machine (host).
 *
 * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
 */
@RunWith(RobolectricTestRunner.class)
public class ExampleUnitTest {

    MainActivity activity;

    @Before
    public void setup() {
        this.activity = Robolectric.buildActivity(MainActivity.class).get();
    }

    @Test
    public void simpleTest() {
        activity.testDialogSetup(); // not doing anything yet since it throws the error here
    }
}

I’ve tried invalidating/restarting, clearing cache, I’ve tried different versions of gradle build tools and with the distribution. Everything I read shows to just have the includeAndroidResources flag set to true but I have that, and I have already tried with/without enableUnitTestBinaryResources as well as enableAapt2

ANY help is appreciated since I have been killing myself trying to get this working. I would think its something simple but… I’m lost here. Its like it can’t see the dependency (com.me.android:thewidget:4.0.0, MyOtherView) resources at all.

dnd 5e – How to protect myself against Divination with the least amount of resources

Cast Mordenkainen’s Private Sanctum every day in the same place for a year. Among the effects you can choose when you cast the spell are:

  • Sensors created by divination spells can’t appear inside the protected area or pass through the barrier at its perimeter.
  • Creatures in the area can’t be targeted by divination spells.

The most important feature of the spell, for this question’s purposes, is this line:

Casting this spell on the same spot every day for a year makes this effect permanent.

Now, obviously using a fourth level (or higher, if you want a larger area) spell slot every day for a year is not an insignificant effort, but there are no material components consumed by casting the spell, so it only takes time to set it up, and nothing to sustain after the year is done. It might be a worthwhile project if your character has a long period of downtime between his high-level adventures. You may not have many uses for your spell slots on boring non-adventure days!

The biggest downside of course is that it’s limited to a single location that you pick in advance. If you need to be protected from divination everywhere you go, this doesn’t help you. But if you’re a high-level wizard, you probably have the means to teleport yourself across the world reasonably easily, so you might be able to tolerate doing your most secret stuff only in your own wizard tower (or wherever it is you chose to cast the spell so many times). And you can still cast the spell as a one-off if you need to protect some other place for just a single day, when teleportation isn’t an option.

Design RDF resources

I’m working on expressing data I have in RDF. One example here would be

:Bob :hasEMail :bob@mail.com

A person can have multiple accounts associated with them. Those account information can look quite differently, but is always unique. Only Bob can ever have the bob@mail.com address, only Bob can ever have a certain telephone number, etc.

I think that such accounts like an email address would qualify as a resource. But on the other hand, since they are so closely linked, having those as literals does also make sense to me.

Are there some guidelines/best practices what information should become a resource?

PS: Actually I decided on using RDF*.

python – Classes – something ive found a ton of resources about, but cannot understand this specific bit

to preface this, I have searched and read so much, I understand (I think….) methods, classes and functions.

What I am trying to wrap myhead around is… a class is essentially a blueprint…? using humans as an example, I create a Human class, and within this class I have different functions based on name, age and height.

class Human():

    def __init__ (self):
        return

    def name(self,name):
        self.name

    def age(self, age):
        self.age

    def height(self,height):
        self.height

    def person (self,name,age,height):
        return f'Hello, my name is {self.name}, I am {self.age} and {self.height} Tall'

Then I want to create two (or as many as I want) humans. So i create an instance of the human class as the blueprint….

import mod

people = mod.Human()

so now I want to create my two people (that are humans and should have a name, age and height associated with them)…

Liam = people.person('liam', 28, "6'" '2"')
Tori = people.person('Tori', 29, "5'" '8"')

So at this point, is my understanding of classes/functions and my utlization of them correct?

print(Liam)

When I print this out I get;

Hello, my name is <bound method Human.name of <mod.Human object at 0x0353E628>>, I am <bound method Human.age of <mod.Human object at 0x0353E628>> and <bound method Human.height of <mod.Human object at 0x0353E628>> Tall

I had this bit working earlier when I created my person through two lines of code instead of one. But this isnt what I was after (one line per person created is what I am after).

class Human:

    def __init__(self, name, age, height):
        self.name = name
        self.age = age
        self.height = height

    def person (self):
        return f'Hello, my name is:  {self.name}, I am {self.age} and {self.height} Tall'

import mod

liam = mod.Human('liam', 28, "6'" '2"')
LiamFull = liam.person()

print(LiamFull)

Hello, my name is:  liam, I am 28 and 6'2" Tall

Resources for connections between dependent type theory and LCCC

Can someone recommend introductory articles/papers on the connections between dependent type theory and locally cartesian closed category? Many Thanks!

proxy – Setup ssh tunnleing to access private resources using client side javascript

I want a js code to run on the browser and access a private resource on the client machine behind ssh proxy, a few software does this such as MongoDB compass allows you to setup ssh if the MongoDB server is not publically accesssible. Is this possible to make an ssh tunnel just by using js and route further XHR calls through that tunnel?

startup – Resources and advice for staring a software company

I am a senior undergraduate, a former intern of a web application startup and now working as a freelancer. After internship of few months, I have gained some experience about how things work at a startup. After leaving the job, I wanted to learn about machine learning and find an internship or any other job in that industry. However, I have received advise from couple of my connections who have been working as high roles in big companies that i should go towards entrepreneurship and start my own company. I am looking forward to join online meetups of local startups but since its online there is very little engagement except chat although i may be able to meet someone personally to get advice for them but i am not sure what questions i would be asking them. I searched through stack-exchange and found this answer and this answer but they are quite general and not related to Machine Learning and are pretty old (there’s great advice in them tho). I have very limited time to decide which path to follow but as mentioned my interest is towards my own business. I would appreciate if anyone could guide me how to start my journey.

Note: I wanted to post this question on workplace SE but due to its more workplace related nature i didn’t and since similar questions have been asked here so i decided to put it up here.