processing

New window in Processing

◇◆丶佛笑我妖孽 提交于 2020-01-04 14:20:54
问题 Yesterday I found the following code for creating a second window in Processing import javax.swing.JFrame; PFrame f; secondApplet s; void setup() { size(600, 340); } void draw() { background(255, 0, 0); fill(255); } void mousePressed(){ PFrame f = new PFrame(); } public class secondApplet extends PApplet { public void setup() { size(600, 900); noLoop(); } public void draw() { fill(0); ellipse(400, 60, 20, 20); } } public class PFrame extends JFrame { public PFrame() { setBounds(0, 0, 600, 340

Processing Java servlet 'javax.servlet' package not found

末鹿安然 提交于 2020-01-04 07:28:24
问题 Not a very common implementation, but using Processing as a Java Servlet has been discussed in previous posts before (1, 2). I have been developing a program in Processing to use as a Java servlet. However, when I have code (such as like the first linked example) in a Processing sketch, I get the error message The package 'javax.servlet' does not exist. You might be missing a library. I have Tomcat 5.5 service running on XP, and my environment variables are as follows CLASSPATH = C:\tomcat

Efficient javascript equivalent of Processing functions

孤街浪徒 提交于 2020-01-03 01:17:28
问题 I tweaked a Processing sketch to produce a variant of a TV static effect I need for a web app. Now I want to convert this effect into JS/canvas. What are the pure javascript/canvas equivalents of loadPixels() , copyArray() , updatedPixels() , and draw() as given in the following Processing code, or how best to go about the conversion given that, probably, JS/canvas are not as efficient as Processing/Java? int[] ppx; Random generator = new Random(); void setup() { size(640,480); loadPixels();

Processing+代码本色 chap3 振荡

断了今生、忘了曾经 提交于 2020-01-02 21:04:04
弹力 介绍 弹簧的弹力可以根据胡克定律计算得到,胡克定律以英国物理学家罗伯特·胡克命名,他在1660年发明了这个公式。胡克最初是用拉丁文描述这个公式的——“Ut tensio,sic vis”, 这句话的意思是“力如伸长(那样变化)”。我们可以这么理解它:弹簧的弹力与弹簧的伸长量成正比。 先用胡克定律计算弹力的大小。我们需要知道k和x的值:k很简单,它只是一个常量,我们可以随意选择一个数。 float k = 0.1 ; x可能会更复杂,我们需要知道“当前长度和静止长度的差”。可以用restLength表示静止长度, PVector dir = PVector . sub ( bob , anchor ) ; 由枢轴点指向摆锤的向量,它告诉我们弹簧的当前长度 float currentLength = dir . mag ( ) ; float x = restLength - currentLength ; 方向计算 float k = 0.1 ; 按照胡克定律计算得到的弹力 PVector force = PVector . sub ( bob , anchor ) ; float currentLength = dir . mag ( ) ; float x = restLength - currentLength ; force . normalize ( ) ;

Exporting a QuickTime movie with Ruby-Processing

僤鯓⒐⒋嵵緔 提交于 2020-01-01 19:16:19
问题 I'm using Ruby-Processing to make a Processing app. How do I export a QuickTime movie of my app? I've tried the following: load_library 'video' import 'processing.video.MovieMaker' def setup # stuff... @mm = MovieMaker.new(WIDTH, HEIGHT, "drawing.mov", 30, MovieMaker.H263, MovieMaker.HIGH) end def draw # stuff... @mm.add_frame end def mouse_pressed @mm.finish_movie end But this doesn't seem to work, and I get this error: java.lang.reflect.InvocationTargetException at java.awt.EventQueue

Yum自动下载RPM包及其所有依赖的包

谁都会走 提交于 2020-01-01 00:33:01
前几天我尝试去创建一个仅包含我们经常在 CentOS 7 下使用的软件的本地仓库。当然,我们可以使用 curl 或者 wget 下载任何软件包,然而这些命令并不能下载要求的依赖软件包。你必须去花一些时间而且手动的去寻找和下载被安装的软件所依赖的软件包。然而,我们并不是必须这样。在这个简短的教程中,我将会带领你以两种方式下载软件包及其所有依赖包。我已经在 CentOS 7 下进行了测试,不过这些相同的步骤或许在其他基于 RPM 管理系统的发行版上也可以工作,例如 RHEL,Fedora 和 Scientific Linux。 方法1利用"Downloadonly"插件下载 RPM 软件包及其所有依赖包 我们可以通过 yum 命令的 “Downloadonly” 插件下载 RPM 软件包及其所有依赖包, 为了安装 Downloadonly 插件,以 root 身份运行以下命令: yum install yum-plugin-downloadonly   现在,运行以下命令去下载一个 RPM 软件包 yum install --downloadonly <package-name> 默认情况下,这个命令将会下载并把软件包保存到 /var/cache/yum/ 的 rhel-{arch}-channel/packageslocation 目录,不过,你也可以下载和保存软件包到任何位置

centos7 安装mysql 5.7

喜你入骨 提交于 2020-01-01 00:30:00
CentOS 7的yum源中貌似没有正常安装 MySQL 时的mysql-sever文件。需要去官网下载 1、配置YUM源 去 MySQL 官网下载MySQL的rpm安装包,点击下载地址: 下载地址 如果是直接在 Linux 中下载,则使用: [plain] view plain copy # wget http://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm 如果是在windows下下载,使用winSCP或者其他工具将其移动到Linux中即可。 2、本地安装YUM源 [plain] view plain copy # yum install mysql57-community-release-el7-8.noarch.rpm 3、安装MySQL # yum install mysql-community-server 4、启动MySQL并加入开机启动 [plain] view plain copy # systemctl start mysqld # systemctl enable mysqld # systemctl daemon-reload 5、修改root密码 MySQL安装完成之后,在/var/log/mysqld.log文件中为root用户生成了一个随机的默认密码。可以通过以下方式查看

1 Processing入门简介

為{幸葍}努か 提交于 2019-12-31 02:40:22
1 Processing入门简介 1.1 Before you start Processing是一个为开发面向图形的应用( visually oriented application)而生的简单易用的编程语言和编程环境。Processing的创造者将它看作是一个代码素描本。它尤其擅长算法动画和即时交互反馈,所以近年来在交互动画,复杂数据可视化,视觉设计,原型开发和制作方向越发流行,大家都喜欢这个可爱贴心,简洁好用的编程工具。 Processing基于Java,其语法规则和Java是一致的,但是即使你熟悉Java编程,也请暂时忘记这一点,因为Processing不同于Java,它更为简单,并且已经演化出了它自己的一套"工作习惯"。 本文将简洁地向你描述Processing的下载、配置、使用方法和编程思路,希望本文能给你打开一扇通向自由创造的大门。 Processing官方网址: https://processing.org 网站包含了Processing的作品展示,对象/函数文档和应用示例,背景介绍,相关链接(论坛、维基、FAQ等等)。 如果你想获得详细的、最新的Processing资讯,请访问该网站;如果你有足够的英文水平和精力,请停止向下继续阅读,访问该网站,因为那上有能满足你的更多更丰富和权威的资讯。 1.2 Equip yourself 开始旅程之前

ubuntu14.04 upgrade fail initramfs-tools

和自甴很熟 提交于 2019-12-30 12:24:54
fedorayang@ynlhost:~$ sudo apt-get dist-upgrade Reading package lists... Done Building dependency tree Reading state information... Done Calculating upgrade... Done 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 7 not fully installed or removed. After this operation, 0 B of additional disk space will be used. Do you want to continue? [Y/n] y Setting up initramfs-tools (0.103ubuntu4.7) ... update-initramfs: deferring update (trigger activated) Setting up linux-image-3.13.0-113-generic (3.13.0-113.160) ... Running depmod. update-initramfs: deferring update (hook will be called

Create more than one window of a single sketch in Processing

∥☆過路亽.° 提交于 2019-12-30 09:06:07
问题 How to create more than one window of a single sketch in Processing? Actually I want to detect and track a particular color (through webcam) in one window and display the detected co-ordinates as a point in another window.Till now I'm able to display the points in the same window where detecting it.But I want to split it into two different windows. 回答1: You need to create a new frame and a new PApplet... here's a sample sketch: import javax.swing.*; SecondApplet s; void setup() { size(640,