magento 1.9 – Attachement Upload (Uncaught SyntaxError: Unexpected token

If I want to insert a file, into the product, I get the following error message in the console.

Uncaught SyntaxError: Unexpected token < in JSON at position 0
    at JSON.parse (<anonymous>)
    at String.parseJSON (as evalJSON) (prototype.js:720)
    at klass.onFileSuccess (instance.js:359)
    at d.<anonymous> (prototype.js:391)
    at d.<anonymous> (flow.min.js:2)
    at k (flow.min.js:2)
    at d.fire (flow.min.js:2)
    at e.chunkEvent (flow.min.js:2)
    at f.event (flow.min.js:2)
    at XMLHttpRequest.doneHandler (flow.min.js:2)

I use the Aitdownloadablefiles extension for attachments, but I don’t think that’s because it is the same with other extensions that do the same thing.

Magento Version 1.9.4.5, PHP 7.2

matlab – Unexpected good performance

Currently I’m working on a NARX model with neural network with one-step ahead prediction on MATLAB using deep learning/neural network toolbox to predict the behavior of a rigid pendulum, showing that it can be used to model non-linear systems.

Training and Validation data

First, I trained my model with oscilations without a complete loop, but it goes to very high angles, well over 90 degrees, as shown in the figure above. And it worked really well when we apply similar testes (i.e. oscilations without a complete loop), it isn’t shown here.

Test data

However the unexpected part is when I apply a torque that completes a loop (i.e. it goes over 360 deg and stabilizes on 540 deg) as shown in the figure above, it works really well too. As if it was trained for it and as if it can reproduce the behavior a sine function, as shown in the figure below. Even the “bad” model (in red) predicted very well the behavior, such as frequency, damping, etc. But I can’t find a plausible explanation for this behavior, because tecnically it wasn’t trained for.

Results of the test and comparisons with the input

Does anyone has the insight of what it could be? Which properties of either NARX models or one-step ahead predictions made this possible?

javascript – Erro com arquivo.js: Unexpected identifier

Estou com um problema no código quando inicializa (linha 176, marquei com um *)

var tabuleiro = document.getElementById('tab')
var espacos = document.getElementsByName('espacos')
var botao_reiniciar = document.getElementById('botao_reiniciar')

var Menu_Versus_X = document.getElementById('Menu_Versus_X')             //menu, para mudar a cor, desing indicativo de quem vai jogar
var Menu_Versus_O = document.getElementById('Menu_Versus_O')

var pontos_X = 0
var pontos_O = 0
var vitoria = false                       
var placar = document.getElementById('placar')
var contagem_para_empate = 0
//----------Variável nescessária para a condição de quem esta jogando (Quem_Joga)(Condição 1*) e escolha aleatória de quem comeca--------

var opcoes = ("X","O");
var Quem_Joga = ((opcoes(Math.random() < 0.5 ? 0 : 1)));
window.alert(`'${Quem_Joga}' começa! O jogo vai até 3 pontos!`)

//----------------------------------------------------------------------------------------

function Selecionar_Espaco(){  //(JOGO SE BASEA NESSA FUNCTION)
    
    if (vitoria == false) {                  //se a vitória for false, continue o jogo, se vitoria for true, ele acaba
        
        var espaco_selecionado = event.target   //Identificação de qual div (a1, a2...) o jogador esta clicando

         //------------------------ERRO se a casa clicada ja estiver selecionada-----------------------------------------------------
        if (espaco_selecionado.innerHTML == 'X' || espaco_selecionado.innerHTML == 'O' || espaco_selecionado == tabuleiro){  
            window.alert('Casa já selecionada!')
            return
        }
        //------------------------------------------------------------------------------------------------------

        contagem_para_empate += 1                //se ela ficar = 9 o progama da empate (9 quadrados) (*3)

        //----------------------------------QUEM TA JOGANDO X--------------------------------------

        if (Quem_Joga == 'X'){ //(1*)       //Jogador1: marcação da casa e analise de qual jogador vai jogar
            Menu_Versus_X.style.color = 'black'
            Menu_Versus_O.style.color = 'greenyellow'
            espaco_selecionado.innerHTML = 'X'
            Quem_Joga = 'O'                //Quando o jogador1 jogar, tal recebe 'O' (quer dizer que a proxima condicao(1*) sera falsa, passando a vez para o jogador2(2*)) 

//----------------------------------------------------CONDICOES DE VITORIA JOGADOR X---------------------------------------------------------
        if ((a1.innerHTML == 'X' && a2.innerHTML == 'X' && a3.innerHTML == 'X') || (b1.innerHTML == 'X' &&  b2.innerHTML == 'X' && b3.innerHTML == 'X') || (c1.innerHTML == 'X' && c2.innerHTML == 'X' && c3.innerHTML == 'X') || (a1.innerHTML == 'X' && b2.innerHTML == 'X' && c3.innerHTML == 'X') || (a3.innerHTML == 'X' && b2.innerHTML == 'X' && c1.innerHTML == 'X') || (a1.innerHTML == 'X' && b1.innerHTML == 'X' && c1.innerHTML == 'X') || (a2.innerHTML == 'X' && b2.innerHTML == 'X' && c2.innerHTML == 'X') || (a3.innerHTML == 'X' && b3.innerHTML == 'X' && c3.innerHTML == 'X')){     

            if (pontos_X < 2){     
                pontos_X += 1
                contagem_para_empate = 0
                window.alert(` Rodada ganhada pelo jogador1 ( X ) ! `)
                espacos.forEach(function(n){
                    n.innerHTML = '';
                })

            }else{           //Se o ponto de X for NÃO for menor que dois (quer dizer q vai ser  = 3) entao ele ganha (vai ate 3 pontos)
                window.alert('VITORIA DO JOGADOR1 ( X )')
                pontos_X += 1
                vitoria = true
                Menu_Versus_O.style.color = 'red'
                Menu_Versus_X.style.color = 'blue'
            }

        }
        //------------------------------------------------------------------------------------------------------------------------------------

            //----------------------------------QUEM TA JOGANDO O--------------------------------------
        }else{ //(2*)  
            espaco_selecionado.innerHTML = 'O'        //Jogador2
            Quem_Joga = 'X'
            Menu_Versus_O.style.color = 'black'
            Menu_Versus_X.style.color = 'greenyellow'

            //------------------------------------------CONDICOES DE VITORIA JOGADOR O---------------------------------------------------------
            if ((a1.innerHTML == 'O' && a2.innerHTML == 'O' && a3.innerHTML == 'O') || (b1.innerHTML == 'O' &&  b2.innerHTML == 'O' && b3.innerHTML == 'O') || (c1.innerHTML == 'O' && c2.innerHTML == 'O' && c3.innerHTML == 'O') || (a1.innerHTML == 'O' && b2.innerHTML == 'O' && c3.innerHTML == 'O') || (a3.innerHTML == 'O' && b2.innerHTML == 'O' && c1.innerHTML == 'O') || (a1.innerHTML == 'O' && b1.innerHTML == 'O'  && c1.innerHTML == 'O') || (a2.innerHTML == 'O' && b2.innerHTML == 'O' && c2.innerHTML == 'O') || (a3.innerHTML == 'O' && b3.innerHTML == 'O' && c3.innerHTML == 'O')){     

                if (pontos_O < 2){     
                    pontos_O += 1
                    window.alert(` Rodada ganhada pelo jogador1 ( O ) ! `)
                    contagem_para_empate = 0
*                    espacos.forEach(function(n){
                        n.innerHTML = '';
                    })

                }else{
                    window.alert('VITORIA DO JOGADOR1 ( O )')
                    pontos_O += 1
                    vitoria = true
                    Menu_Versus_X.style.color = 'red'
                    Menu_Versus_O.style.color = 'blue'
                }

            }
            //------------------------------------------------------------------------------------------------------------------------------
        }

        placar.innerHTML = `<fieldset>${pontos_X} X ${pontos_O}</fieldset>` //mudanca do placar se tiver vitoria (esta dentro do bloco (if vitoria = false))

        //--------------------------------------EMPATE---------------------------------------------------
        if (contagem_para_empate == 9){  //(*3)
                window.alert('EMPATE')
                contagem_para_empate = 0

                espacos.forEach(function(n){
                    n.innerHTML = '';
                })
            }
        //------------------------------------------------------------------------------------------
        
    }   

}

//----------Reinicia pontos, placar, contagem_empate - coloca vitora como false novamente - escolhe um player - limpa a tabela---------------
function reiniciar(){
    espacos.forEach(function(n){
        n.innerHTML = '';
    });

    pontos_O = 0
    pontos_X = 0
    contagem_para_empate = 0
    vitoria = false

    Quem_Joga = ((opcoes(Math.random() < 0.5 ? 0 : 1)));
    window.alert(`'${Quem_Joga}' começa! O jogo vai até 3 pontos!`)

    placar.innerHTML = `<fieldset>${pontos_X} X ${pontos_O}</fieldset>`
    Menu_Versus_O.style.color = 'black'
    Menu_Versus_X.style.color = 'black'
}

8 – D8 update: ‘The website encountered an unexpected error. Please try again later.’ error

I recently updated my Drupal 8 installation, and for some crazy reason my site now displays a white screen and this line of text when I go to it:

The website encountered an unexpected error. Please try again later.

I have no idea why. It’s driving me absolutely crazy. When I check my site’s error log, I see the following error. Anyone have any clue how to fix this? I’ve been trying to find answers to an entire day now:

> Additional uncaught exception thrown while handling exception.
> Original
> SymfonyComponentDependencyInjectionExceptionServiceNotFoundException:
> The service "commerce_cart.cart_subscriber" has a dependency on a
> non-existent service "messenger". in
> SymfonyComponentDependencyInjectionCompilerCheckExceptionOnInvalidReferenceBehaviorPass->processReferences()
> (line 58 of
> /home/oowxas5qe9i2/public_html/shop/vendor/symfony/dependency-injection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php).
>     
>     SymfonyComponentDependencyInjectionCompilerCheckExceptionOnInvalidReferenceBehaviorPass->processReferences(Array)
> (Line: 42)
> SymfonyComponentDependencyInjectionCompilerCheckExceptionOnInvalidReferenceBehaviorPass->processDefinition(Object)
> (Line: 36)
> SymfonyComponentDependencyInjectionCompilerCheckExceptionOnInvalidReferenceBehaviorPass->process(Object)
> (Line: 102)
> SymfonyComponentDependencyInjectionCompilerCompiler->compile(Object)
> (Line: 587)
> SymfonyComponentDependencyInjectionContainerBuilder->compile()
> (Line: 1284) DrupalCoreDrupalKernel->compileContainer() (Line: 873)
> DrupalCoreDrupalKernel->initializeContainer() (Line: 18)
> DrupalCoreInstallerInstallerKernel->initializeContainer() (Line:
> 465) DrupalCoreDrupalKernel->boot() (Line: 414)
> install_begin_request(Object, Array) (Line: 114)
> install_drupal(Object) (Line: 44) Additional
> SymfonyComponentDependencyInjectionExceptionServiceNotFoundException:
> You have requested a non-existent service "theme.manager". in
> SymfonyComponentDependencyInjectionContainerBuilder->getDefinition()
> (line 817 of
> /home/oowxas5qe9i2/public_html/shop/vendor/symfony/dependency-injection/ContainerBuilder.php).
>     
>     SymfonyComponentDependencyInjectionContainerBuilder->getDefinition('theme.manager')
> (Line: 455)
> SymfonyComponentDependencyInjectionContainerBuilder->get('theme.manager')
> (Line: 674) Drupal::theme() (Line: 22)
>     _drupal_maintenance_theme() (Line: 710) drupal_maintenance_theme() (Line: 967) install_display_output(Array, Array, Array) (Line: 264)
>     _drupal_log_error(Array, 1) (Line: 570)
>     _drupal_exception_handler(Object)

got an unexpected keyword argument ‘id’

I’m trying to do a query when the object has the status = ‘Opened’. And display in a table where I will have a button to give a solution for my form and change status=’Pending’. But when I click in the button I get this error.

What I’d like to do for really is display was a form for each data, but when I do a for loop for each one form my data insnt show

url:

 path('manutencao_os_status/<int:id>', views.manutencao_ordem_de_servico, name='manutencao_os_status'),
    path('manutencao_ordem_de_servico/', views.manutencao_ordem_de_servico, name='manutencao_ordem_de_servico'),

views.py

def manutencao_ordem_de_servico(request):
    ordem_servico = OrdemServico.objects.filter(status='Aberto').order_by('id')
    form = FormOrdemServico(ordem_servico)

    if request.method != 'POST':
        return render(request, 'ordemservico/manutencao_ordem_de_servico.html', {
            'form': form,
            'ordem_servico': ordem_servico
        })

    form = FormOrdemServico(request.POST, ordem_servico)

    if not form.is_valid():
        return render(request, 'ordemservico/manutencao_ordem_de_servico.html', {
            'form': form,
            'ordem_servico': ordem_servico
        })

    ordem_servico.save()

    return redirect('ordemservico:manutencao_ordem_de_servico')


def manutencao_os_status(request, id):
    ordem_servico = OrdemServico.objects.get(pk=id)
    ordem_servico.status = 'Em Aprovação'

    ordem_servico.save()

    return redirect('ordemservico:manutencao_os_status')

html:

 {%extends 'base.html' %}
    
    {%block conteudo %}
    <h1>Ordens de Serviço</h1>
    
    <section class="content">
        <div class="container-fluid">
            <div class="row">
                <div class="card card-primary">
                    <div class="table table-bordered">
    
                        <table class="table table-bordered">
                            <thead>
                            <tr>
                                <td>Condition:</td>
                                <td>ID:</td>
                                <td>Name:</td>
                                <td>Status:</td>
                                <td>Solution:</td>
                            </tr>
                            </thead>
                            <tbody>
                            {% for os in ordem_servico %}
                            <tr>
                                <td>
                               <a href="{% url 'ordemservico:manutencao_os_status' os.id %}"
                               class="btn btn-success">Aprovar</a>
                                </td>
                                <td>{{os.id}}</td>
                                <td><a href="{% url 'ordemservico:editar_ordem_de_servico' os.id %}"> {{os.name}}</a></td>
                               
                                <td>{{os.status}}</td>
                                
                                <td>{{os.solution}}</td>
    
                            </tr>
                            {%endfor%}
                            </tbody>
                        </table>
        
        
                        </div>
                    </div>
                </div>
            </div>
        </section>
        
        {% endblock %}

wireshark – Unexpected gratuitous ARP request for 0.0.0.0

I’m trying to understand all facets of MAC address spoofing by testing it on real world implementations. I have Kali set up in VMWare using bridged mode on Windows over LAN. I used Ettercap’s port-stealing feature to port-steal my smartphone (Samsung Galaxy S10).

I expected the switch in my router to be tricked into thinking that my Kali VM is my phone so that the switch forwards all traffic intended to go to my phone to my Kali VM. Instead, Wireshark displays an endless train of ARP requests from all of the devices in my network. Here is an extract:

Wireshark image 1

Every single ARP packet looks like this:

Wireshark image 2

Why does this happen and what is the purpose of this ARP request?

(0.0561158) ACPI: SPCR: Unexpected SPCR Access Width Error on Boot

Stack Exchange Network


Stack Exchange network consists of 177 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

An unexpected I/O error has occurred

Computer been off for days, and when I turned it on, it showed error shown below. Will changing window be any good?

This is the error I am getting whenever I run system repair

This is the error I am getting whenever I run system repair

.desktop – Unexpected closing of all opened programs

i use newest wersion of for desktop.
I want to ask if any of you have encountered a similar problem.
It happened to me several times when I clicked on the clock, everything froze for about half a second, the screen moved as if a new workspace was opening and all my programs closed without being asked to save active files.
I don’t know what causes this. I don’t load the laptop too much. I have enough ram and processing power and I don’t think it’s a crash.

graphics – Unexpected data about function GraphDistanceMatrix

Graph

This is a weighted undirected graph generated from Excel table data.

DATA=Import["MathData/xx.xlsx"][[1]]//IntegerPart;
edgelist=UndirectedEdge[#1,#2]&@@@ DATA
edgew=#3&@@@ DATA
G=Graph[edgelist,EdgeWeight->edgew,VertexLabels->"Name",EdgeLabels->"EdgeWeight"]
WAdj=WeightedAdjacencyMatrix[G]
GraphDistanceMatrix[G] // MatrixForm

This is part of the result of GraphDistanceMatrix:

This is part of the result of GraphDistanceMatrix

I want to get a shortest distance matrix. Official documentation shows that GraphDistanceMatrix returns the shortest distance matrix, but it is clearly not the case. For example, FindShortestPath[G,5,1], the result is {5,4,2,1}, then the distance should be 910, and 630 is given. I don’t know what matrix this is.
Am I using something wrong or is this not the shortest distance matrix? Is there a way to get the shortest distance matrix?