Kinect on Windows v2 keeps restarting

I have been playing with the Kinect for Windows v2 for a while, but I met a strange problem in the recent months: the Kinect kept restarting after 5 or 6 seconds. The RBG and depth channel looked fine in the Kinect Studio and Kinect Evolution, but the video stream kept running for 5-6 seconds then hung for 1-2 seconds (i.e. no new frame was received and the connection from the Kinect was actually lost). I have tried to reinstall the driver and SDK several times without much lucks. I though that it might be a problem with my Kinect, so I left it there until I can test with another Kinect.

Yesterday I tried to search for that problem on the Internet and found that several people also got the same issue. Someone on Microsoft’s forum suggested to disable Kinect audio and some other suggested to enable the audio device, so I decided to give it another try. It turned out that I have disabled Kinect Microphone Array. Re-enabling it fixed the strange problem.

It is a weird issue and does not seems to happen on older driver, and it is unfortunate that Kinect Studio could not give a better error message. I really hope that Microsoft would address that in a later version of driver and SDK, although I doubt that they will do that anytime soon.

First take on MongoDB

Recently, I have looked around for a good NoSQL database for my new project. I have been using MSSQL for a while but there seems to be more and more complexity as the data models are no longer table-compatible with sub-items and array and a volatile schema.

I have considered DocumentDB on Microsoft Azure on its very interesting indexing capability and the fully managed environment of Azure. However the current price is too expensive for me: 20 USD/month/collection. Some people suggested to put every type into a collection and use a field to distinguish them, but I feel that it is quite messy, especially for NoSQL starter like me. So I went back to some other popular choices such as RavenDB and MongoDB. RavenDB seemed to be a great fit at first as it seems to have very good interface for .NET (C# is my language of choice at the moment) and an awesome web interface, but I then realized that the free version actually has a lot of limit, and I did not plan to incur too much cost on this project.

So I decided to go with MongoDB, which is hugely popular NoSQL database, and seemed to be totally free for my need.

Read More

Python in Visual Studio

Visual Studio is a pretty capable IDE for writing Python. In this post, I am writing down some simple first steps to enable Python support in Visual Studio, and some benefits that you can get from Visual Studio when writing in Python.

Installation

1. Download Visual Studio from the website. You can use either the FREE versions as well.

http://www.visualstudio.com/downloads/download-visual-studio-vs

If you are looking for the free version, you can choose either Visual Studio Express 2013 for Web or Visual Studio Express 2013 for Windows Desktop.

2. Download Python Tools for Visual Studio (from Microsoft)

http://pytools.codeplex.com/

Usage

1. Create new project

New Project

2. Write codes

3. Run

Run

Something you can get when writing Python in Visual Studio

Intellisense

Intellisense works with both built-in Python functions and external packages (of course you will have to install the package first).

Python Intellisense in Visual Studio

Full debugging experience

  • Compile error listing & highlighting
  • Break on exception

Break on Exception in Visual Studio

  • Breakpoint, step through code
  • View/Edit local variable

Locals window

Immediate window to write in interpreter mode

Immediate Window

Install new packages (e.g. Theano, nltk, scipy, numpy) directly inside the IDE using pip, easy_install or conda

Those package installation tools also handle automatic dependency discovery (e.g. installing Theano will also install scipy).

Installing Python packages in Visual Studio

Source-control integration (e.g. TFS, Git, SVN)

You can view your change list, diff each files, update, commit, pull, push, etc. directly inside Visual Studio.

Python Source Control in Visual Studio

 

More information

http://www.i-programmer.info/news/216-python/7888-python-tools-for-visual-studio-gets-new-focus.html

How to access current logged in user information outside of Drupal

If you are writing PHP code in Drupal and would like to access basic user information (e.g. UID, username), you can simply define the global variable $user and get the data from there:

However, it would be more complicated when you want to access the same information outside of Drupal system (but still in the same domain). For instance, you want to implement a PHP page to provide data to your JavaScript (AJAX or Web API style), and you want to have access to the current Drupal user directly inside your PHP code instead of passing the UID around (which is quite insecure in my opinion).

My problem is briefly demonstrated in the diagram below:

Access Drupal user from the outside

Read More

Rethink database design with Microsoft Azure

I am definitely not a database expert, so what I am writing here is only from my experience migrating all my applications to Microsoft Azure. If you think that I am doing something wrong or you know a better way, please feel free to leave a comment, so that I can learn more about living in the Cloud.

In this blog post I will write a little bit about what I have been using for a very long time before moving to Azure. Then I will write about my experience with SQL Azure and Azure Table Storage, specifically the problems that I have when migrating from SQL Azure (or MS SQL in general) to Table Storage. You can go directly to the last part if you would like.

Read More