我正在学习AS3,对于静态变量或方法的作用,或者它与没有此关键字的方法或变量的区别,我感到有点困惑.我认为这应该足够简单回答.
我正在尝试安装一个名为Scrapy的模块.我用它安装了它
pip install Scrapy
Run Code Online (Sandbox Code Playgroud)
我在/usr/local/lib/python2.7/site-packages中看到了'scrapy'文件夹,但是当我尝试在Python程序中导入它时,表示没有该名称的模块.关于为什么会发生这种情况的任何想法?
编辑:这是pip命令的输出:
Downloading/unpacking Scrapy
Downloading Scrapy-0.20.0.tar.gz (745kB): 745kB downloaded
Running setup.py egg_info for package Scrapy
no previously-included directories found matching 'docs/build'
Requirement already satisfied (use --upgrade to upgrade): Twisted>=10.0.0 in /usr/local/lib/python2.7/site-packages (from Scrapy)
Requirement already satisfied (use --upgrade to upgrade): w3lib>=1.2 in /usr/local/lib/python2.7/site-packages (from Scrapy)
Requirement already satisfied (use --upgrade to upgrade): queuelib in /usr/local/lib/python2.7/site-packages (from Scrapy)
Requirement already satisfied (use --upgrade to upgrade): lxml in /usr/local/lib/python2.7/site-packages (from Scrapy)
Requirement already satisfied (use --upgrade to upgrade): …
Run Code Online (Sandbox Code Playgroud) 我想对我刚刚移植到processing.js的草图进行测试.当我加载网页时,我从Chrome中的javascript控制台收到以下错误:
XMLHttpRequest无法加载file:///Users/aoeuaoeu/Desktop/projects/local%20site%20files/_/ee.pde.Access-Control-Allow-Origin不允许使用null.processing.js:27未捕获错误:NETWORK_ERR:XMLHttpRequest异常101
这是我正在加载的页面的来源:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Earnest Emporium</title>
<!--Contact: earnestemporium@gmail.com-->
<script src="processing.js"></script>
<canvas data-processing-sources="ee.pde"></canvas>
</head>
<body>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
ee.pde和processing.js与html文件在同一目录中,所以我不确定发生了什么.我还应该指出,我正在本地测试这个,当我上传到我的ftp服务器上加载页面时出现了不同的错误.(也许它是chrome?我得到一个黑盒子,一旦它上传到ftp服务器就不会出现在firefox上的chrome上.它在firefox本地工作正常)
/processing.js:17946Uncaught SyntaxError: Unexpected token <
Processing.Sketch.attach/processing.js:17946
Processing.Processing.executeSketch/processing.js:16209
Processing/processing.js:16237
init/processing.js:17991
window.addEventListener.i
Run Code Online (Sandbox Code Playgroud) 我正在将一些代码从Processing转移到Java,我遇到的一个问题是处理的预编译器将任何双精度转换为浮点数.但是在Eclipse中,我必须显式地将我的值转换为float.尽管如此,我还是得到了一些我不理解的错误.例如,不应该在此语句的末尾添加一个f来修复类型不匹配(类型不匹配:无法从double转换为float)?
springing[n] = .05*(.17*(n+1))f;
Run Code Online (Sandbox Code Playgroud)
即使是像这样简单的陈述,我也会遇到类型不匹配的问题.我究竟做错了什么?
float theta = .01f;
Run Code Online (Sandbox Code Playgroud) 所以我现在已经在Processing工作了几个星期,虽然我没有编程方面的经验,但我已经转向了更复杂的项目.我正在编程一个进化模拟器,它会生成具有随机属性的生物.
最终,我将添加复制品,但截至目前,这些生物只是漂浮在屏幕周围,并且稍微跟着鼠标.它与来自线路的声音相互作用,但我对这些部分进行了评论,以便可以在画布上查看,它不应该真正改变问题,我只是想我会指出它.
截至目前,帧速率对我来说远非理想,随着更多生物的产生,它逐渐降低.我是否犯了一些基本错误,或者我只是每帧运行太多功能?
这里的源代码,你可以在浏览器中玩它在这里:
//import ddf.minim.*;
//import ddf.minim.signals.*;
//import ddf.minim.analysis.*;
//import ddf.minim.effects.*;
//Minim minim;
//AudioInput in;
boolean newCreature = true;
boolean matured[];
int ellipses[];
int hair[];
int maxCreatureNumber = 75;
//int volume;
//int volumeTolerance = 1;
int creatureIndex = -1;
int creatureX[];
int creatureY[];
float strokeWeightAttribute[];
float creatureSize[];
float creatureEndSize[];
float creatureXIncrement[];
float creatureYIncrement[];
float bubbleSize;
float easing = 0.05;
float angle = 0.00;
color colorAttribute[];
void setup() {
background(0);
size(1000,500);
noFill();
//minim = new Minim(this); …
Run Code Online (Sandbox Code Playgroud) 我目前正在使用Processing Kinect库来提供深度图.如果可能的话,我想知道如何将其用于创建2D骨架.这里没有寻找任何代码,只是我可以用来实现这些结果的一般过程.
另外,鉴于到目前为止我们已经在几个Kinect游戏中看到了这一点,难以同时运行多个骷髅吗?
我正在寻找Unity的玻璃着色器,它只能折射它背后的物体,或者想要如何修改现有的玻璃着色器来做到这一点.
此屏幕截图显示了在曲面网格上使用FX/Glass/Stained BumpDistort时会发生什么.
如您所见,玻璃着色器折射网格前面的球体和网格后面的地面.我正在寻找一个只能折射它背后的物体的着色器.
以下是该着色器的代码,供参考:
// Per pixel bumped refraction.
// Uses a normal map to distort the image behind, and
// an additional texture to tint the color.
Shader "FX/Glass/Stained BumpDistort" {
Properties {
_BumpAmt ("Distortion", range (0,128)) = 10
_MainTex ("Tint Color (RGB)", 2D) = "white" {}
_BumpMap ("Normalmap", 2D) = "bump" {}
}
Category {
// We must be transparent, so other objects are drawn before this one.
Tags { "Queue"="Transparent" "RenderType"="Opaque" }
SubShader {
// This …
Run Code Online (Sandbox Code Playgroud) 我试图创建一个指向文件的字符串,并收到此错误:
... / testApp.cpp:75:错误:类型为'const char *'和'const char [5]'的无效操作数为二进制'operator +'
这是有问题的行:
string path = "images/" + i + ".png";
Run Code Online (Sandbox Code Playgroud)
这似乎是一个相当简单的问题,但令我困惑。我还包括了字符串标题:
#include <string>
using namespace std
Run Code Online (Sandbox Code Playgroud) 在我当前的项目中,我有一个PVList的ArrayList,它存储3d点的xyz坐标.我将ArrayList传递给另一个操作它的类,但是,这样做时我得到一个NullPointerException.我假设其中一个PVectors为null,但我通过将任何空对象分配给(0,0,0)并且我仍然收到错误来检查这一点.此外,拥有一系列PVectors或一个ArrayList of PVectors更有效吗?无论哪种方式,我仍然得到错误.这是产生它的线.
trip.pass(pointCoordinates);
Run Code Online (Sandbox Code Playgroud)
这是主要课程
import org.openkinect.*;
import org.openkinect.processing.*;
Kinect kinect;
Trip trip;
boolean tripOn;
int w = 640;
int h = 480;
int distance = 5;
float[] depthLookUp = new float[2048];
ArrayList pointCoordinates = new ArrayList();
float factor = 400;
float a = 0;
float angle = 0;
float frequency = .05;
void setup() {
size(800,600,P3D);
kinect = new Kinect(this);
kinect.start();
kinect.enableDepth(true);
kinect.processDepthImage(false);
stroke(255);
for (int i = 0; i < depthLookUp.length; i++) {
depthLookUp[i] = rawDepthToMeters(i);
}
for(int …
Run Code Online (Sandbox Code Playgroud)