Hi i wanted to rearrange numbers with every possible combinations,
for example:
i key in 123 and i want to find every other possible combination from this number like
132
213
231
312
321
below are my code and i'm able to do it, but sometimes it doesn't works, and is there a much more simple way to do it? i believe there is much simple code than mine.
ArrayList<String> combinations = new ArrayList<String>();
class n {
int number;
boolean used;
n(int x) {
number = x;
used = false;
}
}
int counter = 0;
n[] num = new n[4]; // 4 means 4 digit number like 8134 which have 24 combination
String com = "";
for (int i = 0 ; i != num.length; i++) {
num[i] = new n(round(random(9)));
com += num[i].number;
}
combinations.add(com);
com = "";
int rounds = 0;
while ( rounds != 23 ) { //23 means the number of possible combination
I want to create an animation with n numbers of button, and when i hit Right or left the button will move according to the direction.
My problem is that, lets say i hit left and the button starts to move left and after it dissappear from the screen i want it to come back from the right into the screen.
There's no problem with moving left, but moving right i have some problem and it have to do with the highlighted part, but i don't know how to solve it.
currently i use checkPos(array) to set the location of the circle. the center button is always 0 in the checkpos.
For example;
[0] [1] [2] [3] [4] (Button)
0 1 2 3 -1 (Position)
1 2 3 -1 0 (Position after right click)
Position for 0 means center, -1 left from the center button, 1 right to the center button
so on my 1st right click, button of position more than width, needs to be set to a new position, so button 3 and 2 are > width, thus 3 have to be set to
width/2 - 2*spacing - 2*dia; before it will move to the right, but now for button 3 it's set to width/2 - checkPos[i]*spacing - checkPos[i]*dia; checkPos[i] = 3 while for button it's 2 while it suppose to be 3.
Hi, i'm doing a program which requires me to load lots of pictures, however the pictures that i load are in big Pixels, thus loading the image slows down my program alot and requires lots of memory, is there a way to overcome this problem?
i've some mathematics question, i'm trying to come up with a formula which is dynamic.
now i'm trying to insert n number of pictures with the same width, and same spacing in between them, i'm trying to make sure that the pictures are position in the center, which means if i have 4 pictures, i want the 1st picture to the last to be sort of as 1 picture and position in the center.
for example:
4 Pic
---(img)--(img)--(img)--(img)---
3 Pic
----(img)--(img)--(img)----
the picture will as a whole will always be at the center of the scree
hi, i did an animation however the animation gets slower and slower, i think it have to do with memory, would like to ask if anyone face such problem and how to solve it?
image(a, position.x, position.y);
movement = (height/100)*sin(theta);
position.x = initialPosition.x + movement;
theta += 0.07;
the movement speed of the animation should be constant, however it gets slower and slower, is it because of the image?
would like to ask if anyone knows a way to insert special characters in mysql?
below is the code,
msql.execute("INSERT INTO testing (message) VALUES ('"+msg+"');" );
There will be error occur when i insert a message that contains character like ', ", and ; i know these got to do with sql injection but i don't want to remove those special character, and would like to insert the message to the database the way it is.
I've a chunk of text and i'd managed to split it up and detect which is a link using regex, the problem i have here is how am i to make that link clickable?
if i use link(), it will open the url for me automatically, but i want it to open when i click it.
Currently i have a JDC browser on my application, and "frame.setLayout(new GridLayout(x,y));" is the code which sets the browser to appear in my application, the problem is it's always occupying half the size of the application no matter how i alter the number x and y.
Besides that whenever i set frame.setResizable(true); it won't display the browser and sometimes there will be this error "illegalArgumentException: Width(116) and Height(0) cannot be <=0