Assembly – Compute the instruction bytes fetched and the memory data bytes transferred

I got an imaginary ISA like this:

• Use the command format with two addresses.
• All operations take place between a single general-purpose register and a storage location.
• There are 8 general purpose registers and register specifiers are 3 bits long.

and have to accept as follows:
• The opcode is 1 byte (8 bits).
• All memory addresses are 4 bytes (32 bits).
• All data operands are 8 bytes (64 bits).
• All instructions have an integer number of bytes.

I have no problem with the code, but I don't know how to calculate the instructions retrieved and the memory data bytes transferred. Based on my research, I have found a few ways that are somewhat confusing. How do I find them from this code, for example?

Mov EAX,B   ; EAX<- B
Add EAX, C  ; EAX <- EAX + C
Mov A, EAX  ; A<- EAX

8 – The "content type" of a current page must be transferred to a node.html.twig template (for a different content type) when the page is loaded AND after an Ajax call

I'm trying to get the content type value of a node page (which the user is currently visiting – let's call it CT-1) … and enter this value as a variable in the node.html.twig template of a DIFFERENT content type (CT-2). This CT-2 template is used in a view output that is displayed on a CT-1 page. Here is my code …

function custom_mods_preprocess_node(array &$variables, $hook) {
   if ($node = Drupal::request()->attributes->get('node')) {
     $variables('pageNodeType') = $node->getType();
   }
 }

Then I print the variable pageNodeType into the node.html.twig template from CT-2 as follows …

{% if pageNodeType == 'TYPE' %}
TEST
{% endif %}

All of this works perfectly when the page loads. However, if the view output is filtered with AJAX (through an exposed filter), pageNodeType becomes NULL, and therefore the "if statement" breaks with the CT-2 template.

What can I do to keep this variable active after an Ajax update?

I tried to use ..

Drupal::request()->headers->get('referer');

..to pull the previous page, but it seemed quite a task to get the content type through this approach. Is there a better way?

Thanks a lot!!

Google Cloud Platform – Git Push could not be transferred to the GCP source repository

Git Push has been failing for a few days:

$ git push -v
Pushing to https://source.developers.google.com/p/xxxxxxx
Counting objects: 6546, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (3171/3171), done.
POST git-receive-pack (chunked)
error: RPC failed; HTTP 500 curl 22 The requested URL returned error: 500 Internal Server Error
fatal: The remote end hung up unexpectedly
Writing objects: 100% (6546/6546), 4.28 GiB | 44.99 MiB/s, done.
Total 6546 (delta 2676), reused 5369 (delta 1598)
fatal: The remote end hung up unexpectedly

It is systematic. The repository is heavy (19Gi) and contains many files.
Worked well for years.
It is not an authorization problem (pull works).
Does somebody has any idea?

Thanks a lot

The Internet cannot be transferred from the MacBook to the iPhone using a USB cable. Option not available

This is not a double question asked here or here.

I cannot connect the Internet from my MacBook Pro to my iPhone using a USB cable. The option to do this is simply not available (see screenshot). The device that I use as a gateway to the Internet is my MacBook, which is connected to the Internet via Ethernet. I don't want to use Bluetooth or WiFi to share the internet.
I can usually access my iPhone through the Finder (i.e. my MacBook recognizes the device). My previous MacBook had one iPhone USB Option in the To computers using: List that my current MacBook is missing.

My devices:

  • MacBook Pro (16-inch, 2019), macOS Catalina, version 10.15.4

  • iPhone 7 iOS 13.3.1

Enter the image description here

Network – How do I monitor the bytes transferred in an internet connection?

When I connect to the Internet in Xubuntu 19.04, there is an item in the "Network Connections" menu in the upper right corner of the desktop called "Connection Information", but it does not indicate how many bytes have been sent or received. Is there any way to get this information? (For reference, you can click the link for your Internet connection in the Network and Sharing Center in Windows. The window that appears shows the total number of bytes sent and received that are sent and received on both sides of the small terminal pair when data is displayed Move back and forth.) My internet connection is being measured and it would be good to know how much of my allocated bandwidth I am burning while the connection is active. I can do that easily in Windows; I haven't figured out how in Xubuntu yet.

Any suggestions offered would be greatly appreciated.

Thanks a lot,

Pete

How to find the corresponding ID for parameters that have been transferred to a new page for saving via the Sharepoint API

Overnight, using this forum, I figured out how to save a parameter that was passed to my Sharepoint API call for "Surname"Field. I want to take this step one step further and instead of saving"Surname"I want to save this"I would"that corresponds to"Surname". I know that "Surname"is a search field in my list.

The line of code I'm struggling with is:

var siteIdFromParameter =   getSiteParam('Site', _spPageContextInfo.webAbsoluteUrl)?$Id="/_api/web/lists(guid'')"

Here is all my code:

        function getSiteVars() {
             var vars = {};
                var parts = window.location.href.replace(/(?&)+((^=&)+)=((^&)*)/gi, function(m,key,value) {
                vars(key) = value;
                });
            return vars;
        }

        function getSiteParam(parameter, defaultvalue){
            var siteparameter = defaultvalue;
            if(window.location.href.indexOf(parameter) > -1){
            siteparameter = getSiteVars()(parameter);
        }
            return getSiteParam;
    }


    function addFeatureSuggestion() {

        var siteNameFromParameter = getSiteParam('Site', _spPageContextInfo.webAbsoluteUrl);
        var siteIdFromParameter =   getSiteParam('Site', _spPageContextInfo.webAbsoluteUrl)?$Id="/_api/web/lists(guid'')"

        var item = {
            "__metadata": { "type": "SP.Data.AddListItem" },
            "SiteId": siteIdFromParameter,
            "Title": $('#inputTitle').val()
        };



Amazon Linux 2 Apache: Resource interpreted as a style sheet, but transferred with MIME type text / html

As an Amazon Linux Apache web server, I installed WordPress.

In the WordPress dashboard, the content area is not displayed properly, and the Chrome console shows 14 times Resource interpreted as Stylesheet but transferred with MIME type text/html,

In addition, the front end has no CSS formatting.

I checked this answer and edited httpd.conf to add it

AddType text/css .css
AddType text/javascript .js

to the Section and restarted Apache, but the problem remains.

I look in httpd.conf under there is a line:

TypeConfig /etc/mime.types and in this file css & js are listed.

I have also added

AddType text/css .css
AddType text/javascript .js

to /etc/httpd/conf.d/php.conf, Apache restarted, but the problem persists.

Help appreciated.

respond – How is data from the response headers transferred to the ApolloProvider using SSR?

I am working with an application created with Nextjs and Apollo. I get a token in the Graphql response header. I can read this token on the server side and have to pass it on to the Apollo provider on the client side.

cache.writeData({
    data: {
        isLoggedIn: false
    }
});

const afterwareLink = new ApolloLink((operation, forward) => {  
    return forward(operation).map(response => {
        const context = operation.getContext();
        const {
            response: { headers },
        } = context;

        if (headers) {
            const authorization = headers.get('authorization');

            if (authorization) {
                console.log(authorization);
                // what to do next? I need some how set isLoggedIn to true...
            }
        }
        return response;
    });
});

const link = ApolloLink.from((
    afterwareLink,
    new RetryLink(),
    httpLink
));

const client = new ApolloClient({  
    link,
    cache
});

function App({ children }){
    return (
        
            {children}
        
    );
}

I tried to set the context in ApolloLink:

    operation.setContext({ isLoggedIn: true });

I cannot write directly to the cache because the page is rendered on the server side.