I'm trying to setup processing in eclipse under Linux following this
tutorial, but I can't add the core.jar
I know close to nothing about eclipse, only done some test with java.
I have an .pde applet that writes bash files (.sh) to automate some tasks in other software under ubuntu. The problem is I can't make them automatically executable using chmod, so when I call from the applet with open() the script opens in a text editor instead of executing in the terminal.
Is there any simple way to control the terminal using processing?
In the
open() documentation recomend to "Be sure to make the file executable before attempting to open it (chmod +x)." But even making the .sh executable it does not executes in the terminal but opens in gedit. Any ideas??
This is part of a larger script, that's why I need the array plus the class (it may seem too much in this script).
What I'm trying to do here is to move the black circle down, but I can't get why there are two circles...
I'm sure it should be very simple, but I just can't solve it.
The main script:
Move objMove;
int cols = 11; int rows = 11; int[][] dotMatrix = new int[cols][rows];
Is there any tutorial on how to use this library, the web has lots of examples and a great reference, but is there anything around that shows a basic intro?
Hi
This might be a dumb question but, here it goes:
Is there any simple way to control "external" application with processing?
I mean, for example running a python script for getting its input later?
Is there any good tutorial for software interaction?
I'm trying to transform some data stored in a 2d array into an .html (the idea is to print this so other program can read it).
I have a 2d Array with a set of numbers:
arrayMatrix[i][j] = { {0,1,0,0,0},
{0,1,0,1,1},
{0,0,0,0,0},
{0,0,0,1,0},
{0,1,0,0,1} };
And I need to print them in an .html ordered like:
0,1,0,0,0,
0,1,0,1,1,
0,0,0,0,0,
0,0,0,1,0,
0,1,0,0,1
I'm changing the numbers into strings and printing with saveString:
for (int i = 0; i <= 5; i = i+1) {
for (int j = 0; j <= 5; j = j+1) {
arrayMatrix[i][j] = rowData; // << this is clearly wrong...
textMatrix = Integer.toString(rowData);
saveStrings("2dMatrix.html", textMatrix);
}
}
Clearly is not possible to convert an array into an integer (line 3), neither is possible to print the complete array with saveString... maybe changing the array into a string would do it, but how? and how to cut the rows?? (sorry I don't have a sscce code). Any ideas?
I'm working with 2d matrix movement and I haven't been able to fix a problem, the idea is to move some "dots" manipulating a 10x10 matrix.
For the moment I'm working with a 200x200 array (I have to fix it) but I have other "newbie" problems:
1. When the dots start to move the bottom row is not included, and I can't get why...
2. The movement doesn't start with the first click of the mouse, only with the second, and that brings me other further problems when extending the code.
3. The idea is to do one movement per click, but the loop is so quick that with every click the dots move 3 or 4 spaces.
Here is a functional short extract:
int[][] dotMatrix;
void setup() {
size(200,200);
background(200);
noStroke();
smooth();
dotMatrix = new int[200][200]; // matrix size (to fix)
dotMatrix[70][70] = 1; // feed matrix
dotMatrix[90][70] = 1;
dotMatrix[70][90] = 1;
matrix();
}
void matrix() { // draw main matrix
for (int i = 10; i <= 200; i = i+20) {
for (int j = 10; j <= 200; j = j+20) {
ellipse (i, j, 18, 18);
}
}
}
void transpUp() { // movement operation
int translator = 20;
for (int o = 10; o <= 190; o = o+translator) {
for (int p = 10; p <= 190; p = p+translator) {
int control = p;
if (dotMatrix[o][p] == 1) {
fill(255);
ellipse(o,p,18,18);
if (control <= 10) {
control = control + 200;
}
int pp = control-translator;
dotMatrix[o][pp] = 1;
ellipse(o,p,18,18);
dotMatrix[o][p] = 0;
}
}
}
}
void draw(){
for (int i = 10; i <= 190; i = i+20) {
for (int j = 10; j <= 190; j = j+20) {
if (dotMatrix[i][j] == 1) {
fill(200);
ellipse(i,j,18,18);
} else {
dotMatrix[i][j] = 0;
}
}
}
if ((mousePressed)) { // active movement with mouse
I'm working with a 2d array of points to draw a 2d "grid" of points, to get something like this:
00000
00000
00000
00000
then I feed the array so i can have some figures inside it, like this
00000
00110
01100
00000
and I'm trying to translate the info of the array so I can move the figure to the left, like this
00000
11000
10001
00000
doing this: (the matrix is 10 x 10 circles, each one size 18)
void moveLeft() {
int trans = 20;
for (int i = 10; i <= 190; i = i+trans) {
for (int j = 10; j <= 190; j = j+trans) {
int cont = i;
if (matrix[i][j] == 1) {
if (i <= 10) {
cont = cont + 200;
}
matrix[cont-trans][j] = 1;
fill(50);
ellipse(i,j,18,18);
matrix[i][j] = 0;
}
}
}
}
the problem is that the first time I apply the function moveLeft() the circles are redrawn in the same location, only the second time it changes position, and the when I apply moveUp() [similar function, but working with j ] the circles move left first and then up... I can't get why!!! Any help?
The other problem is I can't figure out how to move the circles to the other side, I mean Right and Down... it should be easy but I cant find the way.