Pete was complaining that teaching his friends Java through screen sharing was not very efficient, since you can share your screen to one other person at a time. He also said that video chatting using Skype can only work with one other person, too. If you want to have video conference with more than one party, you have to pay for it. I certainly am not ready to pay to teach lessons, yet.
After having thought about the efficient ways to deliver the lessons, I realized that we can use Google+ hangout for multi-party video conferences. And video from screen capture should be a clear way to deliver a programming tutorial. I have seen many tutorials from Youtube, but have never done it myself. I went searching and found Ksnapshot for Linux among other apps, and several other free apps for windows. I tried out Ksnapshot and really liked it. Pete will find a Windows app he likes.
So, with a blog for the text part of material, a screen video capture tool for video tutorials, and Google+ hangout for video conferences, we are all set for the exciting Java programming lessons to come, I think.
Wednesday, March 7, 2012
Tuesday, March 6, 2012
iRobot + Kinect + Java
A while back I bought iRobot Create, the vacuum cleaner without the cleaning part, under the pretense that Pete will learn to do more interesting programming with it. Secretly, I myself wanted to do a little programming with a robot, and didn't want to start from scratch. The vacuum cleaner seams to be the right equipment to start. We got the command module with iRobot and was able to program it to do simple things. But we wanted more. We want it be able to see with a webcam, or maybe Kinect.
iRobot has a serial port the can communicate with outside world, say, a light laptop. The choice of programming language is Java. I decided that C++ is unnecessarily difficult for a teenager as a starting programming language. I have to confess that I prefer Java to C++ for my day job, too. We got a laptop running Windows XP to communicate with it.
The laptop can detect simple printed signs, such as "L30", "R90", for "turning left 30 degree" and "turning right 90 degree", respectively. The programming using simple computer vision algorithms which I develop for my day job.
I really want get away from Windows, and use Linux, instead. The combination of Linux+Java+serial port was not easy at first. After many long searches, I settled with RXTX, an open source package for Java serial port programming. It turns out that you don't have compile the package from the source. It's ready to be installed for Ubuntu. My combination of Linux+Java+serial is working smoothly now.
I got Kinect working under Windows 7 Ubuntu 10.10 with OpenNI, but I am running Ubuntu 11.10. I am not sure I should wait for Kinect with OpenNI ready for 11.10, or downgrade to 10.10. So many things to do, so little time.
iRobot has a serial port the can communicate with outside world, say, a light laptop. The choice of programming language is Java. I decided that C++ is unnecessarily difficult for a teenager as a starting programming language. I have to confess that I prefer Java to C++ for my day job, too. We got a laptop running Windows XP to communicate with it.
The laptop can detect simple printed signs, such as "L30", "R90", for "turning left 30 degree" and "turning right 90 degree", respectively. The programming using simple computer vision algorithms which I develop for my day job.
I really want get away from Windows, and use Linux, instead. The combination of Linux+Java+serial port was not easy at first. After many long searches, I settled with RXTX, an open source package for Java serial port programming. It turns out that you don't have compile the package from the source. It's ready to be installed for Ubuntu. My combination of Linux+Java+serial is working smoothly now.
I got Kinect working under Windows 7 Ubuntu 10.10 with OpenNI, but I am running Ubuntu 11.10. I am not sure I should wait for Kinect with OpenNI ready for 11.10, or downgrade to 10.10. So many things to do, so little time.
Monday, March 5, 2012
Java IDE: Netbeans or Eclipse?
I started my Java programming using Netbeans about five years ago, and it has been my favorite IDE ever since. Netbeans is always compared with Eclipse. Both IDEs has their loyal followings. I like Eclipse, too. As a matter of fact, I started using Eclipse about 10 years ago, when I was programming with Python.
When Nokia released Symbian SDK, programming for smart phone become possible. With it, come many possibilities. I started developing applications for Nokia 6681, and later N81, N95. The only practical IDE was Eclipse. For our applications, processing speed was, and still is, critical. So, we always using C++. Unfortunately, Nokia's version of Eclipse/SDK left a lot to be desired, and developing for Symbian was a painful process.
Then came Android, for which Eclipse has been the only practical IDE. This time, coding was much more pleasant. To have simple application with live video working, you only need one file, two classes, and under 100 lines of code together. For extra speed, you can put CPU intensive code in C++. Everything is just perfect. But for algorithm development, with happens on desktop/laptop, I still prefer Netbeans.
Netbeans comes with palette, with makes simple GUI programming a breeze. You can simply drag/drop panels, menus, buttons, and so on. You can build an events-driven application with GUI very quickly. I have been very happy with it for many years, until a couple of weeks ago, when I need to make the application I have been developing more professionally looking.
Netbeans' drag and drop GUI programming, while easy, is always awkward to use. The layout is always difficult to get precise. The end result is always amateur looking. I do mind at all when I was only concerned with algorithm development. This time, the application I am developing is going to be used by many low-vision doctors and other professionals in the low vision field. All of a sudden, the appearance become very important.
I was searching for a better tool for Java GUI programming and finally came across WindowBuilder plugin for Eclipse, donated by Google. After working with it for a couple of days, I am hooked. Like Netbeans, you drag/drop GUI components, unlike Netbeans, you can manually edit the generated code, and the new edits will be picked up by WindowBuilder. So the it a two-way tools. The generated GUI code by Netbeans cannot be edited. After many trials, I got the exact layout I want for my application.
When Nokia released Symbian SDK, programming for smart phone become possible. With it, come many possibilities. I started developing applications for Nokia 6681, and later N81, N95. The only practical IDE was Eclipse. For our applications, processing speed was, and still is, critical. So, we always using C++. Unfortunately, Nokia's version of Eclipse/SDK left a lot to be desired, and developing for Symbian was a painful process.
Then came Android, for which Eclipse has been the only practical IDE. This time, coding was much more pleasant. To have simple application with live video working, you only need one file, two classes, and under 100 lines of code together. For extra speed, you can put CPU intensive code in C++. Everything is just perfect. But for algorithm development, with happens on desktop/laptop, I still prefer Netbeans.
Netbeans comes with palette, with makes simple GUI programming a breeze. You can simply drag/drop panels, menus, buttons, and so on. You can build an events-driven application with GUI very quickly. I have been very happy with it for many years, until a couple of weeks ago, when I need to make the application I have been developing more professionally looking.
Netbeans' drag and drop GUI programming, while easy, is always awkward to use. The layout is always difficult to get precise. The end result is always amateur looking. I do mind at all when I was only concerned with algorithm development. This time, the application I am developing is going to be used by many low-vision doctors and other professionals in the low vision field. All of a sudden, the appearance become very important.
I was searching for a better tool for Java GUI programming and finally came across WindowBuilder plugin for Eclipse, donated by Google. After working with it for a couple of days, I am hooked. Like Netbeans, you drag/drop GUI components, unlike Netbeans, you can manually edit the generated code, and the new edits will be picked up by WindowBuilder. So the it a two-way tools. The generated GUI code by Netbeans cannot be edited. After many trials, I got the exact layout I want for my application.
Additional Info for 2nd Lesson
The following should be added to class Point. The test function should become the tradition for every class to be coded in the future.
void drawCross(Graphics g){
int sz = 3;
g.drawLine(x-sz, y, x+sz, y);
g.drawLine(x, y-sz, x, y+sz);
}
static void test0(String path){
BufferedImage img = new BufferedImage(100,80,BufferedImage.TYPE_INT_RGB);
Point p1 = new Point(10,10);
Point p2 = new Point(20,30);
Graphics g = img.getGraphics();
g.setColor(Color.gray );
g.fillRect ( 0, 0, img.getWidth(), img.getHeight() );
g.setColor(Color.red );
p1.drawCross(g);
p2.drawCross(g);
try {
ImageIO.write(img, "PNG", new File(path));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
void drawCross(Graphics g){
int sz = 3;
g.drawLine(x-sz, y, x+sz, y);
g.drawLine(x, y-sz, x, y+sz);
}
static void test0(String path){
BufferedImage img = new BufferedImage(100,80,BufferedImage.TYPE_INT_RGB);
Point p1 = new Point(10,10);
Point p2 = new Point(20,30);
Graphics g = img.getGraphics();
g.setColor(Color.gray );
g.fillRect ( 0, 0, img.getWidth(), img.getHeight() );
g.setColor(Color.red );
p1.drawCross(g);
p2.drawCross(g);
try {
ImageIO.write(img, "PNG", new File(path));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
Sunday, March 4, 2012
Simpler 2nd Lesson?
Maybe the 2nd lesson I suggested was a little too ambitious. So I decided put the following task before that:
class Point{
int x, y;
Point(){...} // default constructor
Point(int x, int y){...} // another constructor
Point(Point p){...} // copy constructor
float getDistance(Point p){...}
void draw(Graphics g){..} //draw a cross, or a circle?
}
class Line{
Point p1, p2;
Line(int x1, int y1, int x2, int y2){...}
float getLength(){...}
void draw(Graphics g) {...}
}
class Point{
int x, y;
Point(){...} // default constructor
Point(int x, int y){...} // another constructor
Point(Point p){...} // copy constructor
float getDistance(Point p){...}
void draw(Graphics g){..} //draw a cross, or a circle?
}
class Line{
Point p1, p2;
Line(int x1, int y1, int x2, int y2){...}
float getLength(){...}
void draw(Graphics g) {...}
}
Subscribe to:
Posts (Atom)