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

How to fix OneDrive crashes and manually reset its index

I am using OneDrive to store all my photos, documents, some portable software, PowerShell scripts, and many other things.

I was quite happy with it (especially the Smart File features where I can see and manage all my files on my small tablet) until I realized that my files were not synchronized any more. I then opened Task Manager trying to monitor the OneDrive Sync Engine (named SkyDrive.exe) and saw it kept crashing shortly after being launched.

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