|
|
Member 10535056 wrote: i am using so many code to detect the motion
Well, fine! Then tell us about it or otherwise you might get advice you already tried out.
Member 10535056 wrote: but its fails so kindly help me thank in advance
Wow, now that was really informative.
Would you mind telling us how it failed and in which ways?
What did you expect and what did the tools/libraries deliver and foremost why do you consider it as a failure.
And please do yourself a favor and read the sticky notes on top of the forum.
Cheers!
"I had the right to remain silent, but I didn't have the ability!"
Ron White, Comedian
|
|
|
|
|
Basic java chat app means like one here,
A Java Chat Application[^]
I want to secure the the client server communication. How to achieve so ? Where to start from ? Any good tutorials ?
|
|
|
|
|
anonymous.dude6969 wrote: Any good tutorials ? Have you tried Google?
Veni, vidi, abiit domum
|
|
|
|
|
hi i can learn english well with you
|
|
|
|
|
What you are asking for is in fact very basic and a quick Google Search[^] would have brought you tons of results.
Veni, vidi, caecus | Everything summarizes to Assembly code
|
|
|
|
|
how to generate reports using java servlets
|
|
|
|
|
Probably by writing some code, but without some detailed information of the problem it is impossible to suggest more. BTW please leave your questions at the default font size.
Veni, vidi, abiit domum
|
|
|
|
|
I am sure you wanted to enter that somewhere else[^]
Veni, vidi, caecus | Everything summarizes to Assembly code
|
|
|
|
|
I've used both JFreeChart[^] and Jasper Reports. The former had issues though in that it was not thread safe. The latter is no longer freely available it seems. I just did a quick search and it now seems to be a commercial product, which is really a shame as it was really a great tool when I tried it 2006 - 2007.
Cheers!
"I had the right to remain silent, but I didn't have the ability!"
Ron White, Comedian
|
|
|
|
|
i've basic knowledge about programming
now i have to learn java in 3 months or 4 months if needed
have to do java certification
i've all my day dedicated to this
need valuable advices
i know one can learn programming best by doing.. so going to do that
i may do things that waste time like concentrating on insignificant things... i hope you guys will guide me correctly as i will post what i've learned and practiced daily
if there is any blog or thread like this.. plz refer it to me..
suggest me valuable resources to start with like thinking in java
|
|
|
|
|
found a valuable one
http://www.daniweb.com/software-development/java/threads/99132/starting-java-java-tutorials-resources-faq
|
|
|
|
|
Hi,
is there a reliable tool which can convert completely a C code to Java. C code contains only bit operations such AND, OR ... XOR, addition, subtraction and like and is not dependent on particular library. The tool should convert the code completely i.e. without my intervention after translation.
|
|
|
|
|
Kujtim Hyseni wrote: The tool should convert the code completely i.e. without my intervention after translation. It is unlikely that any tool is capable of doing that since there are enough subtle differences in the languages, and coding style to confuse it. If you want a selection of tools that you can try for yourself then Google is your friend.
Veni, vidi, abiit domum
|
|
|
|
|
When I translate the C code to C# it works fine because in both C and C# there is unsigned 8 bit integer type "byte" (values from 0 to 255) while in Java "byte" is signed 8 bit integer (values from -128 to 127). What operations might have effect when signed used instead of unsigned?
|
|
|
|
|
If you use arithmetic operations on them then you will get incorrect results.
Veni, vidi, abiit domum
|
|
|
|
|
How do you mean, can you explain me more ?
|
|
|
|
|
Try this code:
public static void main(String[] args) throws Exception {
byte b1 = (byte)129;
byte b2 = 4;
byte b3 = (byte)(b1 + b2);
System.out.println("b1 is: " + b1);
System.out.println("b2 is: " + b2);
System.out.println("b3 is: " + b3);
If the byte values were unsigned you would expect the answer to be 133 , but in fact you will get -123 , since the 'real' value of b1 is, as you see, -127 .
Veni, vidi, abiit domum
|
|
|
|
|
Yes, but I am receiving un-correlated values, how to get 133 instead of -123 - I mean what modifications or things I have to do at the end?
|
|
|
|
|
You have to get the value as an integer and then mask off the low order 8 bits, to make it into an unsigned value, like this:
public static void main(String[] args) throws Exception {
byte b1 = (byte)129;
byte b2 = 4;
int i1 = b1;
int i2 = i1 & 0xFF;
int i3 = i2 + b2;
System.out.println("i1 is: " + i1);
System.out.println("i2 is: " + i2);
System.out.println("i3 is: " + i3);
}
[edit]Fixed typo; I meant low order 8 bits.[/edit]
Veni, vidi, abiit domum
modified 14-Jan-14 11:02am.
|
|
|
|
|
You can't expect 100% automatic conversion. Even commercial products offers only 95-99% conversion.
In Google you could find few free converters. Ex. C To Java Converter[^]
There's a better way if you have more time & resources. Code Rewrite[^]
thatrajaCode converters | Education Needed
No thanks, I am all stocked up. - Luc Pattyn
When you're wrestling a gorilla, you don't stop when you're tired, you stop when the gorilla is - Henry Minute
|
|
|
|
|
I wouldn't think that would work at all for any non-trivial business application.
And once translated it would be so mucked up that it would be significantly more costly to maintain.
|
|
|
|
|
Ok, here is the code to resize one rectangle.
I would like to display several rectangles and resize them independantly, so the best way is to create an arraylist, right ? I have modified the code (see at the bottom), but it displays only the rectangles. No error messages when I test the program, but impossible to resize them.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Resizing extends JPanel {
Rectangle rect = new Rectangle(100,100,150,150);
protected void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2 = (Graphics2D)g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
g2.setPaint(Color.blue);
g2.draw(rect);
}
public static void main(String[] args) {
Resizing test = new Resizing();
Resizer resizer = new Resizer(test);
test.addMouseListener(resizer);
test.addMouseMotionListener(resizer);
JFrame f = new JFrame();
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.add(test);
f.setSize(400,400);
f.setLocation(100,100);
f.setVisible(true);
}
}
class Resizer extends MouseAdapter {
Resizing component;
boolean dragging = false;
final int PROX_DIST = 3;
public Resizer(Resizing r) {
component = r;
}
public void mousePressed(MouseEvent e) {
if(component.getCursor() != Cursor.getDefaultCursor()) {
dragging = true;
}
}
public void mouseReleased(MouseEvent e) {
dragging = false;
}
public void mouseDragged(MouseEvent e) {
if(dragging) {
Point p = e.getPoint();
Rectangle r = component.rect;
int type = component.getCursor().getType();
int dx = p.x - r.x;
int dy = p.y - r.y;
switch(type) {
case Cursor.N_RESIZE_CURSOR:
int height = r.height - dy;
r.setRect(r.x, r.y+dy, r.width, height);
break;
case Cursor.S_RESIZE_CURSOR:
height = dy;
r.setRect(r.x, r.y, r.width, height);
break;
default:
System.out.println("unexpected type: " + type);
}
component.repaint();
}
}
public void mouseMoved(MouseEvent e) {
Point p = e.getPoint();
if(!isOverRect(p)) {
if(component.getCursor() != Cursor.getDefaultCursor()) {
component.setCursor(Cursor.getDefaultCursor());
}
return;
}
int outcode = getOutcode(p);
Rectangle r = component.rect;
switch(outcode) {
case Rectangle.OUT_TOP:
if(Math.abs(p.y - r.y) < PROX_DIST) {
component.setCursor(Cursor.getPredefinedCursor(
Cursor.N_RESIZE_CURSOR));
}
break;
case Rectangle.OUT_BOTTOM:
if(Math.abs(p.y - (r.y+r.height)) < PROX_DIST) {
component.setCursor(Cursor.getPredefinedCursor(
Cursor.S_RESIZE_CURSOR));
}
break;
default:
component.setCursor(Cursor.getDefaultCursor());
}
}
private int getOutcode(Point p) {
Rectangle r = (Rectangle)component.rect.clone();
r.grow(-PROX_DIST, -PROX_DIST);
return r.outcode(p.x, p.y);
}
private boolean isOverRect(Point p) {
Rectangle r = (Rectangle)component.rect.clone();
r.grow(PROX_DIST, PROX_DIST);
return r.contains(p);
}
}
MODIFIED CODE
import java.awt.*;
import java.awt.event.*;
import java.awt.geom.Path2D;
import java.awt.geom.Rectangle2D;
import java.util.ArrayList;
import javax.swing.*;
class Resizing extends JPanel {
ArrayList paths = new ArrayList();
public Resizing() {
paths.add(wrap(new Rectangle2D.Double(100, 100, 75, 50)));
paths.add(wrap(new Rectangle2D.Double(250, 100, 75, 50)));
}
private Path2D.Double wrap(Shape s) {
return new Path2D.Double(s);
}
<a href="/Members/override">@Override</a>
protected void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2 = (Graphics2D)g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
g2.setPaint(Color.blue);
for(int j = 0; j < paths.size(); j++) {
Path2D.Double path = (Path2D.Double)paths.get(j);
g2.draw(path);
}
}
public static void main(String[] args) {
JFrame f = new JFrame();
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.add(new Resizing());
f.setSize(400,400);
f.setLocation(100,100);
f.setVisible(true);
}
class Resizer extends MouseAdapter {
Resizing component;
boolean dragging = false;
final int PROX_DIST = 3;
Path2D.Double selectedPath;
public Resizer(Resizing rz) {
component = rz;
component.addMouseListener(this);
component.addMouseMotionListener(this);
}
public void mousePressed(MouseEvent e) {
if(component.getCursor() != Cursor.getDefaultCursor()) {
dragging = true;
}
}
public void mouseReleased(MouseEvent e) {
dragging = false;
}
public void mouseDragged(MouseEvent e) {
if(dragging) {
Point p = e.getPoint();
ArrayList list = component.paths;
for(int j = 0; j < list.size(); j++) {
Path2D.Double path = (Path2D.Double)list.get(j);
selectedPath = path;
Rectangle r = selectedPath.getBounds();
int type = component.getCursor().getType();
int dx = p.x - r.x;
int dy = p.y - r.y;
switch(type) {
case Cursor.N_RESIZE_CURSOR:
int height = r.height - dy;
r.setRect(r.x, r.y+dy, r.width, height);
break;
case Cursor.S_RESIZE_CURSOR:
height = dy;
r.setRect(r.x, r.y, r.width, height);
break;
default:
System.out.println("unexpected type: " + type);
}
component.repaint();
}}
}
public void mouseMoved(MouseEvent e) {
Point p = e.getPoint();
if(!isOverRect(p)) {
if(component.getCursor() != Cursor.getDefaultCursor()) {
component.setCursor(Cursor.getDefaultCursor());
}
return;
}
int outcode = getOutcode(p);
ArrayList list = component.paths;
Rectangle r = selectedPath.getBounds();
switch(outcode) {
case Rectangle.OUT_TOP:
if(Math.abs(p.y - r.y) < PROX_DIST) {
component.setCursor(Cursor.getPredefinedCursor(
Cursor.N_RESIZE_CURSOR));
}
break;
case Rectangle.OUT_BOTTOM:
if(Math.abs(p.y - (r.y+r.height)) < PROX_DIST) {
component.setCursor(Cursor.getPredefinedCursor(
Cursor.S_RESIZE_CURSOR));
}
break;
default:
component.setCursor(Cursor.getDefaultCursor());
}}
private int getOutcode(Point p) {
Rectangle r = (Rectangle)component.paths.clone();
r.grow(-PROX_DIST, -PROX_DIST);
return r.outcode(p.x, p.y);
}
private boolean isOverRect(Point p) {
Rectangle r = (Rectangle)component.paths.clone();
r.grow(PROX_DIST, PROX_DIST);
return r.contains(p);
}
}}
|
|
|
|
|
i am making an educational application using java technology.
where i need to send password on user's mobile in forgot password condition.
would you plz send me its code?
|
|
|
|
|
Here you go: Teh codez[^]
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|