调试

如何在让调试可控

  • Syntax errors: These are spelling errors in your code that actually cause the program not to run, like the Rust error shown above. These are usually easy to fix as long as you are familiar with the language’s syntax and know what the error messages mean.
  • Logic errors: These are errors where the syntax is actually correct, but the code is not what you intended it to be, meaning that the program runs incorrectly. These are often harder to fix than syntax errors, as there isn’t an error message to direct you to the source of the error.
  • 王工的debug标准流程

    • overview
    • 确定做的事情可以work.
    • 没有看div的style,其将div高度射为固定的;div设置的高度设为固定的
    • 王工开始计算高度(自适应),发现做了之后不work。通过鼠标调整某个div的padding/margin之后,发现问题并没有得到解决。这说明调整这个问题不能解决
  • 通过不断地删除代码,找到最小可运行代码。
    • CSS position设置错误,导致 图标显示不出来。通过不断地删除代码进行排查。(症状为 内容在页面上面看不到)
    • 另一种解决方式是在页面上通过调试判断DOM元素是否存在,如果存在那么程序就正确渲染了这部分。
  • debug echarts不重新刷新的bug.

    描述:出现两个质量模型,点击了第一个质量模型并弹出分析结果页;此时点击第二个分析结果页,内容不更新并且最下部分的图像不重新刷!

​ 经过debug,发现用到的time_range(处于state)中并没有改变。 => time_range在哪里修改的? => 在那个地方发生了什么?【最终发现是因为调用接口失败,并没有成功设置 state中time_range变量】

    • 未设置echarts容纳块的高度,导致图像显示不出来。
  • …{filtericon: }
    • 没报错,但是这一段代码就是有问题
    • 未import,导致变量找不到。
  • Chrome调试技巧
  • Intellij调试技巧

高效学习(Effective Learning)-MDN

It is great that you are putting some time into learning a new set of skills, but there are good practices to employ that will make your learning more effective. There also are times when you’ll get stuck and feel frustrated — even professional web developers feel like this regularly — and it pays to know about the most effective ways to try and get help so you can progress in your work. This article provides some hints and tips in both of these areas that will help you get more out of learning web development, as well as further reading so you can find out more information about each sub-topic should you wish..

阅读更多

思考的工具

思考的工具

tools of thinking

templateview raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <iostream>

//函数模板
template < class T >
void swap(T& x, T& y){
T temp = x;
x = y;
y = temp;
}

// class T, parameterized type name 参数化的类型名
// inside swap, using T as if it's a type name
//
int main(){
std::cout << "hello jack"<< std::endl;
return 0;
}
helloworldview raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <iostream>

//函数模板
template < class T >
void swap(T& x, T& y){
T temp = x;
x = y;
y = temp;
}

// class T, parameterized type name 参数化的类型名
// inside swap, using T as if it's a type name
//
int main(){
std::cout << "hello jack"<< std::endl;
return 0;
}