Allseas – Innovation opens beers

Toying with an industrial robot at the office ūüėČ

R&D Eindhoven (a.k.a. Inspection & Robotics) opens the Friday “borrel” beers with their new Fanuc M-710iC/45M Robot in combination with a Cognex In-Sight 2000 Vision Sensor.

R&D Eindhoven is part of the Innovation Department of Allseas Engineering B.V.

Allseas – Promoted to Unit Head Innovations

Got promoted to Unit Head Innovations (managing the Eindhoven office) at the Innovations Department of¬†Allseas Engineering B.V.¬†ūüôā

Allseas Logo

The Swiss-based Allseas Group is a global leader in offshore pipeline installation, heavy lift and subsea construction. We employ over 2500 people worldwide and operate a versatile fleet of specialised heavy-lift, pipelay and support vessels, designed and developed in-house.

Around the world in 90 days

Traveling around the¬†world in 90 days with my pregnant wife ūüôā See you later alligator!

AMS-LHR, LHR-YVR, YVR-LAX, LAX-HNL, HNL-NRT, NRT-TPE, TPE-HKG, HKG-PNH, REP-KUL, KUL-SYD, SYD-CNS, ASP-CNS, CNS-HKG, HKG-AMS
AMS-LHR, LHR-YVR, YVR-LAX, LAX-HNL, HNL-NRT, NRT-TPE, TPE-HKG, HKG-PNH, REP-KUL, KUL-SYD, SYD-CNS, ASP-CNS, CNS-HKG, HKG-AMS

Canada, Hawaii, Japan, Taiwan, Cambodia,¬†Malaysia, and Australia…

AMS LHR 258¬į (W) 256¬į (W) 371 km
LHR YVR 324¬į (NW) 324¬į (NW) 7,601 km
YVR LAX 165¬į (S) 149¬į (SE) 1,739 km
LAX HNL 261¬į (W) 249¬į (W) 4,113 km
HNL NRT 299¬į (NW) 290¬į (W) 6,146 km
NRT TPE 242¬į (SW) 250¬į (W) 2,182 km
TPE HKG 249¬į (W) 254¬į (W) 807 km
HKG PNH 220¬į (SW) 223¬į (SW) 1,533 km
REP KUL 191¬į (S) 192¬į (S) 1,202 km
KUL SYD 133¬į (SE) 133¬į (SE) 6,579 km
SYD CNS 343¬į (N) 330¬į (NW) 1,966 km
ASP CNS 060¬į (NE) 056¬į (NE) 1,454 km
CNS HKG 320¬į (NW) 314¬į (NW) 5,553 km
HKG AMS 324¬į (NW) 327¬į (NW) 9,290 km

Total: 50,537 km

Duck Hunt VR (for the HTC Vive)

My first little Unity 3D Virtual Reality project, inspired by my old friend the Nintendo Entertainment System. Please keep in mind the I have never used Unity 3D before, so this is my first sandbox application…

Download link to DuckHuntVR Alpha 04: http://tinyurl.com/hb3u42x

This Alpha 04 release incorporated a lot of used feedback from the Vive subreddit: https://www.reddit.com/r/Vive/

In particular the feedback gathered during this live coding session: https://www.reddit.com/r/Vive/comments/4pbx4x/duck_hunt_vr_for_the_htc_vive_alpha_03_this_is_a/

Campus Party Europe in The Netherlands

Elske and I spend two full days and one night at the Campus Party in the Jaarbeurs Utrecht. I even managed to get on the stage to give a little talk about: How to start with Virtual Reality game development ūüôā

Overview of the stage and work area.
Me doing an unofficial talk about starting with virtual reality game development.
2000 tents, a little refugees camp for nerds.

C# – MutableWhen Extension for the Task Parallel Library (TPL)

This is a lillte playfull MutableWhenAny and MutableWhenAll extension for the Task Parallel Library (TPL), using a ObservableCollection.

The extension makes it possible to add or removed tasks to/from an ObservableCollection<Task> while the MutableWhenAny or MutableWhenAll is used to wait on the tasks in this (mutable) collection.

: https://github.com/okmer/MutableWhen

It’s not super useful in practice, but a nice little exercise that combines to cool C# features into a fun¬†asynchronous “magic” trick.

using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.Threading;
using System.Threading.Tasks;
 
namespace Com.Okmer.Extensions.ObservableCollectionOfTask
{
    public static class ObservableCollectionOfTaskExtention
    {
        private const int INFINITE = -1;
 
        public static async Task MutableWhenAll(this ObservableCollection<Task> collection)
        {
            await MutableWhenSomething(collection, Task.WhenAll);
        }
 
        public static async Task MutableWhenAny(this ObservableCollection<Task> collection)
        {
            await MutableWhenSomething(collection, Task.WhenAny);
        }
 
        private static async Task MutableWhenSomething(this ObservableCollection<Task> collection, Func<IEnumerable<Task>, Task> whenSomething)
        {
            Task waitAllTask = null;
            Task helperTask = null;
 
            bool isCollectionChanged = false;
 
            do
            {
                //Cancellation on collection changed event
                var cts = new CancellationTokenSource();
                var cancelActionHandler = (sender, arg) => cts.Cancel(false);
                collection.CollectionChanged += cancelActionHandler;
 
                //Current collection
                waitAllTask = whenSomething(collection);
 
                //Wait on current collection or collection changed event
                try
                {
                    helperTask = Task.Delay(INFINITE, cts.Token);
                    await Task.WhenAny(waitAllTask, helperTask);
                }
                finally
                {
                    isCollectionChanged = cts.IsCancellationRequested;
                    cts.Cancel(false);
                    cts.Dispose();
                    collection.CollectionChanged -= cancelActionHandler;
                }
            }
            while (isCollectionChanged);
 
            //Return the WaitAll on collection results
            await waitAllTask;
        }
    }
}

A simple example application that demonstrates the MutableWhenAll extension on an observable collection of tasks. The longest running task is added to the observable collection after MutableWhenAll is called, but the MutableWhenAll will complete only when all tasks (included this longest running task) are completed.

using System;
using System.Collections.ObjectModel;
using System.Threading.Tasks;
 
using Com.Okmer.Extensions.ObservableCollectionOfTask;
 
namespace MutableWhenAllTest
{
    class Program
    {
        static void Main(string[] args)
        {
            ObservableCollection<Task> tasks = new ObservableCollection<Task>();
 
            Task t1 = Task.Run(async () => { await Task.Delay(1000); Console.WriteLine("t1"); });
            Task t2 = Task.Run(async () => { await Task.Delay(2000); Console.WriteLine("t2"); });
            Task t3 = Task.Run(async () => { await Task.Delay(3000); Console.WriteLine("t3"); });
 
            tasks.Add(t1);
            tasks.Add(t2);
 
            Task a1 = tasks.MutableWhenAll();
 
            tasks.Add(t3);
 
            a1.ContinueWith(t =>
            {
                if (t.IsCanceled)
                {
                    Console.WriteLine("Canceled");
                }
 
                if (t.IsFaulted)
                {
                    Console.WriteLine("Faulted");
                }
 
                if (t.IsCompleted)
                {
                    Console.WriteLine("Completed");
                }
            });
 
            a1.Wait();
 
            Console.ReadLine();
        }
 
    }
}