小编dou*_*lix的帖子

使用ufunc bitwise_xor输入TypeError

在我的程序中追踪粒子的路径,我得到以下错误:

Traceback (most recent call last):
  File "C:\Users\Felix\Google Drive\Research\particles.py", line 154, in <module>
    bfield += b_X(r_p(r,pos[2]))*(r_p(r,pos[2])/r)   
   *((r-r_p(r,pos[2]))**2+pos[2]**2)^(-1/2)*np.array
   ([(1-r_p(r,pos[2])/r)*pos[0],(1-r_p(r,pos[2])/r)*pos[1],pos[2]])

TypeError: ufunc 'bitwise_xor' not supported for the input types, 
and the inputs could not be safely coerced to any supported types 
according to the casting rule ''safe''
Run Code Online (Sandbox Code Playgroud)

我似乎无法找到正在发生的事情.我没有xor的任何实例(虽然我想它可能在if/else语句中编码).

python if-statement numpy typeerror

14
推荐指数
2
解决办法
4万
查看次数

#(contentscript.js匹配)后,Chrome扩展程序无法识别URL的一部分

我正在为特定网站(我不拥有)编写扩展程序,其网址仅在/#/之后变化。

示例:从URL开始

.../#/PF/charts/patients/419d3081-5e20-4347-a852-52b2c333ce85/summary
Run Code Online (Sandbox Code Playgroud)

点击“时间轴”链接会转到下一个网址

.../#/PF/charts/patients/419d3081-5e20-4347-a852-52b2c333ce85/timeline/encounter
Run Code Online (Sandbox Code Playgroud)

...但是当尝试匹配url以加载我的内容脚本时,匹配中不包括#和之后的所有内容,因此它认为这些页面是同一页面。另外,查看控制台会发现,即使我单击链接,整个页面的内容更改以及/#/之后的网址不同,它甚至都看不到任何新页面加载。

如果常规工具(在清单中设置“ content_scripts”)不起作用,如何使我的contentscript.js仅在需要的地方运行?或者,我可以以某种方式使/#/之后的url可见吗?

任何节俭的解决方案将不胜感激!

javascript url google-chrome google-chrome-extension

4
推荐指数
1
解决办法
1249
查看次数

Eclipse中意外缺少{花括号

Eclipse发现了一个缺失的{花括号,但它应该没有.具体来说:"令牌上的语法错误";",{此符号之后的预期".

要么我缺少一些愚蠢的东西,要么我有一些新的东西要学习Java.这是有问题的课程:

class usedCars{
    Random r = new Random();

    String[] allColors = {"red", "orange", "yellow", "green", "blue", "indigo", "violet"};
    String[] allMakes  = {"honda", "mercedes", "rolls-royce", "audi"};

    String[] colorList = new String[10];
    String[] makeList  = new String[10];
    int[] yearList  = new int[10];
    int[] speedList = new int[10]; //here is the error mentioned above

    //fill the lists
    for(int i=0; i<10; i++) { 

        this.colorList[i] = this.allColors[this.r.nextInt(this.allColors.length)]; }
} //usedCars class
Run Code Online (Sandbox Code Playgroud)

我的最后一行代码也有一个缺失的闭括号}.

怎么了?

java eclipse

0
推荐指数
1
解决办法
489
查看次数