Category Archives: Programming

Programming related posts, c++, c#, java, javascript, python

Setting up Kinect-Assisted Java project in Eclipse – Part 2

In this second article on how to develop kinect assisted applications with java, we will be implementing OpenNI java wrapper into Eclipse and make a simple project for starters.

First add all libraries you use for graphics rendering. Lately I’m familiar with LibGDX for doing graphics in Java so i will be adding its jar files into my project then i will include them in Java Build Path -> Libraries. Anyway i will not go into detail in this part because everybody has their choice of graphics library.

Now, let’s show Eclipse where is our Kinect wrappers and native libraries.
In Eclipse:
1- Click Projects -> Java Build Path -> Libraries
2- Click Add External JARs add select org.OpenNI.jar which is located in “C:Program FilesOpenNISamplesBinRelease”
3- Click Arrow button near Jar file we have just added to expand menu.
4- Double-Click on Native library location and select Jar path which is “C:Program FilesOpenNISamplesBinRelease”

At this stage, we are done with implementing the wrapper. But we need some sample code to test it , right?

Continue reading

Setting up Kinect-Assisted Java project on Windows – Part 1

In this article, we are going to setup a java project for kinect assisted software development. Last summer, i worked on kinect and developed a couple of games, a framework and an eclipse plugin allows you to control debugger by moving your hands.

Most time consuming part of kinect-assisted development is just the beginning, where you
have to setup kinect libraries and java wrapper. The rest is plain simple, API is just great. You dont need to code a single line of computer vision stuff, all that is taken care of for you in the background. API features gesture & pose detection and access to 3D coordinate for each joint. API I am talking about is OpenNI, which i chose instead of OpenKinect, because it has a Java Wrapper. But if you are going to use another language i’d recommend OpenKinect. Because OpenKinect also supports motor control.

So let’s start by downloading required drivers & files.

Continue reading

Javascript Closures

I’ve been working on a web application project for about a year now.Seven months ago i switched to object-oriented javascript due to complexity of the project.It increased productivity in a way that i can not express with words , you just have to experience it.

As i switched to object oriented javascript i learned some new tricks in javascript that i’ve never needed or used before.One of them was closures.I dont think i’m yet an expert on javascript or its closures but i want to share my experiences with it. I perceive closures as parameterized callback functions that you can pass arguments into the function.

So when it becomes useful you ask?
It becomes very useful when you are using Jquery & OOP javascript together. Let me give you an example:

  • Content 1
  • Content 2
  • Content 3

This will not work as expected because second “this” pointer becomes current $(‘li’) element.
So how you gonna handle it?
You can fix it by editing it to:

$(this).html(obj.counter);

But wait that’s against OOP approach to assume object name is always going to be “obj”.I wish it was just that , but it will also make it impossible to declare and use more than one instance of that class in one document which can be solved by using seperate documents and showing them in one page within iframe elements.But dont you think it is quite unprofessional?

So that’s where we use Javascript Closures.By using a closure we can pass object pointer keyword “this” into “each()” function of JQuery.
for working example click : http://jsfiddle.net/C7yen/

  • Content 1
  • Content 2
  • Content 3

PS:
Some of the JQuery functions such as “.bind()” allows you to pass arguments.In those cases you dont need closures.But those functions are very few , maybe its only “.bind()” function , because it’s only one i know.

    ;
  • Content 1
  • Content 2
  • Content 3