Tag Archives: ProgrammerAH

AttributeError: ‘NoneType‘ object has no attribute ‘append‘

Python error:
attributeerror: ‘nonetype’ object has no attribute ‘append’

a=[]
b=[1,2,3,4]
a = a.append(b)

After one execution, the type of a changes to nonetype
the above errors will appear in the next execution.

This is because append modifies a itself and returns none. The return value cannot be reassigned to a.

terms of settlement:

Change the variable name:
C =]
b = [1,2,3,4]
C = A. append (b)
problem solving.

Or
change a = a.append (b) to a.append (b)

React create project error

npm ERR! code 1
npm ERR! path /Users/tangwenjing/Html/imooc/my-app1/node_modules/canvas
npm ERR! command failed
npm ERR! command sh -c node-gyp rebuild
npm ERR! /bin/sh: pkg-config: command not found
npm ERR! gyp: Call to 'pkg-config pixman-1 --libs' returned exit status 127 while in binding.gyp. while trying to load binding.gyp
npm ERR! gyp ERR! configure error 
npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
npm ERR! gyp ERR! stack     at ChildProcess.onCpExit (/Users/tangwenjing/Html/imooc/my-app1/node_modules/node-gyp/lib/configure.js:351:16)
npm ERR! gyp ERR! stack     at ChildProcess.emit (events.js:376:20)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
npm ERR! gyp ERR! System Darwin 20.4.0
npm ERR! gyp ERR! command "/usr/local/bin/node" "/Users/tangwenjing/Html/imooc/my-app1/node_modules/.bin/node-gyp" "rebuild"
npm ERR! gyp ERR! cwd /Users/tangwenjing/Html/imooc/my-app1/node_modules/canvas
npm ERR! gyp ERR! node -v v14.17.0
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/tangwenjing/.npm/_logs/2021-06-03T09_55_42_223Z-debug.log

Solution: install nodejs installation package directly because of the NPM version problem

Property or field ‘Title‘ cannot be found on object of type

Do is a post function, post can be displayed after the details, the error is in the post after clicking the error
first of all, the meaning of the question is that the “title” attribute cannot be found in the list class, which means that the data is queried, but the title attribute cannot be found
after re checking one side of the code, it is found that there is no problem, that is, the method return type of the POJO class in the Dao layer is not written correctly. I wrote the list type at that time, but all I want to display is a message. List is a collection type, which can’t be found. Therefore, you can change the list type to the entity type consult.

Webpack Pack and compress ES6 files with errors: ERROR in js/xxxxxx.js from UglifyJs Unexpected token punc ()

Build project, the following error appears

ERROR in js/xxxxxx.js from UglifyJs
Unexpected token: [xxxx.js], expected: punc

It was found that uglifyjs could not resolve the problem of ES6

Solutions:

Upgrade uglifyjs version and modify package.json

  "uglifyjs-webpack-plugin": "^1.0.0-beta.3",

Prod.conf.js

var UglifyJSPlugin = require('uglifyjs-webpack-plugin')
# Modify the plugin in plugins
        new UglifyJSPlugin({
          uglifyOptions: {
            compress: {
              drop_debugger: true, // Note debugger
              drop_console: true, // Note console
              pure_funcs:['console.log'] // remove console
            },
          },
          sourceMap: false,   // Removing the .map file generated after packaging
          parallel: true,
        }),


Runnpm run build, Done!

Installing VB6.0 under win7 (error accessing the ole Registry)

Some time ago, after the installation of vb6.0 in the flagship version of Win7, when opening the vb development environment, “OLE registry error access” (Chinese error description forgot to make a record) prompt error, after referring to the article reproduced below to install, after the completion of the installation, can normally run under Win7 vb development (I also had some small problems during the installation process, see the note in red at the end of the article), now the original article is recorded for future use.

 

There are thousands of legacy applications that need support, and people like me who speak VB6 need to install tools on our workstations in order to implement and test updates to these legacy applications and so on. It is also helpful when I need a quick tool to use in my daily work.

This process has been tested on Windows 7, both 32-bit and 64-bit with no problems. Here is how I installed visualbasic6 on my Windows 7 machine.

      1. Close the UAC.
      1. Insert the Visual Studio 6 CD.
      1. Exit the autorun setup.
      1. Browse to the root folder of the VS6 CD.
      1. Right-click on Setup.EXE and select Run as Administrator.
      1. For a warning about this and other program compatibility helpers, click Run Program.
      1. Click Next.
      1. Click “I accept the agreement” and then Next.
      1. Enter the name and company information and click Next.
      1. Select Custom Settings and click Next.
      1. Click Continue, and then OK.
      1. The installation will “think for itself” for about 2 minutes. You can verify the processing by launching Task Manager and checking the CPU usage of ACMSETUP.EXE.
      1. In the list of options, select the following:
      1. Microsoft Visual Basic 6.0ActiveXData AccessGraphics
      1. All other options should be unchecked. Click “Continue” and the installation process will continue.
      1. Finally, a Successful Completion dialog box will appear, where you can click Ok. At this point, Visual Basic 6 is installed.
      1. If you do not have the MSDN CD, clear the checkboxes in the next dialog box and click Next. You will receive a warning that MSDN is missing, but simply click Yes to accept it.
      1. Click Next to skip the Installshield installation. This is a very old version that you don’t want anyway.
      1. Click Next again to skip the installation of BackOffice, VSS, and SNA Server. Not required!
      1. In the next dialog box, clear the Register Now checkbox, and then click Finish

.The wizard will exit and you are done. You can find VB6 under Start, All program, Microsoft Visual Studio 6. Enjoy!

Update

You may notice that after successfully installing VB6 on Windows 7, working in the IDE is a bit slow. For example, resizing objects on a form can be a real pain.

After installing VB6, you will want to change the compatibility settings for the IDE executable.

Using Windows Explorer, browse to the location where you installed VB6. By default, the path is C:\Program Files\Microsoft Visual Studio\VB98\ Right-click on the VB6.exe program file and select properties from the context menu. click the Compatibility tab. Add a checkbox to each of the checkboxes:
Run this program in Windows XP compatibility mode (Service Pack 3) Disable visual themes Disable desktop combinations Disable display scaling High DPI settings

After changing these settings and starting the IDE, things should return to normal and the IDE should no longer be sluggish

Declarative development tab in Vue

Tab case

First, CSS style

* {
      margin: 0;
      padding: 0;
    }

    .tab ul {
      overflow: hidden;
      padding: 0;
      margin: 0;
    }

    .tab ul li {
      box-sizing: border-box;
      padding: 0;
      float: left;
      width: 100px;
      height: 45px;
      line-height: 45px;
      list-style: none;
      text-align: center;
      border-top: 1px solid blue;
      border-right: 1px solid blue;
      cursor: default
    }

    .tab ul li:first-child {
      border-left: 1px solid blue;
    }

    .tab ul li.active {
      background-color: orange;
    }

    .tab div {
      width: 500px;
      height: 300px;
      display: none;
      text-align: center;
      font-size: 30px;
      line-height: 300px;
      border: 1px solid blue;
      border-top: 0px;
    }

    .tab div.current {
      display: block;
    }

Second, structure

<div id="app">
    <div class="tab">
      <ul>
        <li class="active">apple</li>
        <li>orange</li>
        <li>lemon</li>
      </ul>
      <div class="current">
        <img src="img/apple.png">
      </div>
      <div>
        <img src="img/orange.png">
      </div>
      <div>
        <img src="img/lemon.png">
      </div>
    </div>
  </div>

Third: JS logic

var vm = new Vue({
      el: '#app',
      data: {
      },
    methods: {
     }
)}

The following is the result of the HTML structure and JS code

1. HTML structure

<div id="app">
    <div class="tab">
      <!--  tab  -->
      <ul>
        <!-- dynamically bound class with active class name highlighted without active not highlighted-->
        <li @click="change(index)" :class='currentIndex==index?"active":""' v-for="(item, index) in list"
          :key="item.id">
          {{item.title}}</li>
      </ul>
      <!--  Corresponding displayed images -->
      <! -- dynamically bound class with current class name shown without current hidden-->
      <div :class="currentIndex==index?'current':''" v-for="(item, index) in list" :key="item.id"><img :src="item.path">
      </div>
    </div>
  </div>

2. JS logic

let vm = new Vue({
      el: '#app',
      data: {
        currentIndex: 0,// The current index of the tab defaults to 0  
        list: [{
          id: 1,
          title: 'apple',
          path: 'img/apple.png'
        },
        {
          id: 2,
          title: 'orange',
          path: 'img/orange.png'
        },
        {
          id: 3,
          title: 'lemon',
          path: 'img/lemon.png'
        }]
      },
      methods: {
        // The currentIndex is equal to the clicked index value by passing in the index 
        // thus controlling the class name    
        change(index) {
          this.currentIndex = index
        }
      }
    })

Tab view