Lesson learned: Do Not Store rvalue Reference Outlive its Declaration

I am building a custom operator overloading structures in C++, and was really seduced with what rvalue promises: the lifetime of rvalue reference is bound to the expression of its context.

Rvalue references can be used to extend the lifetimes of temporary objects (cppreference.com)

I was building a combination of operators which accepts a lot of literals and temporary objects including lambda. So for instance:

auto res = ObjectA() * ObjectB() + ObjectC() * ObjectD();

Based on the precedence rules, ObjectA will be ‘multiplied’ with ObjectB, then ObjectC will be ‘multiplied’ with ObjectD, then the result object of those two will be ‘added’. Notes that the order of multiplication is decided by compiler.

So the thing is, inside the overloaded multiplication operator, I want to store the temporary ObjectD, for instance, then carry it over on the addition operator later on when executing the ‘add’ operator. To achieve the “efficiency”, I store the ObjectD temporary inside an rvalue reference so it can be accessed “efficiently” during the execution of the ‘add’ operator.

Continue reading “Lesson learned: Do Not Store rvalue Reference Outlive its Declaration”

Tizen Studio on Other Than Ubuntu

It’s pain in the ass. Really. If you can stick to Ubuntu or its derivatives, please do that.

I kinda hate how Tizen Studio is developed to only support Ubuntu out-of-the-box. A software should not dictate what Linux distro it should be installed on. Distro is just like a religion for some people, and some people are like me, who doesn’t like Ubuntu and its bloatware.

Personally I use OpenSUSE on my home workstation, and Fedora on my office workstation. Both distros are RPM based and it is really difficult to install Tizen Studio which is tied to Ubuntu (which relies on Debian Package).

Installing Tizen Studio in Fedora and OpenSUSE is basically similar: it nags every single time. Firstly, Tizen Studio requires Oracle JDK. So for a system with OpenJDK by default installed, you have to install Oracle JDK then change the default Java to Oracle JDK. I am not sure why Tizen Studio forces us to go for Oracle JDK instead of OpenJDK as there might be only subtle differences between those two. Even this Stack Overflow thread said so.

Continue reading “Tizen Studio on Other Than Ubuntu”

Weird std::thread bug on GCC 4.9 on ARM target

I have been dealing with Tizen development since about last year, and since then I have been learning of utilizing C++11 features on my codes. Currently I am developing a some kind of component to help performing message pump in threading, so you can dispatch a function to a queue to be performed in separate thread.

It is a simple components actually. You can take a look at GitHub. DispatchQueue class basically accepts functions to be queued to be executed in another thread. I uses std::deque to queue the tasks, and std::function to store lambda or other callable objects. To support the threading, I uses std::mutex for synchronization, as well as std::condition_variable to suspend thread during empty queue.

The code compiles flawlessly, but when I tried to run a Tizen native app using this component, the app directly crashed upon starting the DispatchQueue class. The worst part was that the call stack in crash log does not show that it was crashing in user code, but it shown that the signal was SIGABRT so it might be caused by an unhandled exception.
Continue reading “Weird std::thread bug on GCC 4.9 on ARM target”

GPS Library for Windows 10 IoT and Raspberry Pi

I am tinkering with Raspberry Pi 3 (RasPi) and Windows 10 IoT Core. I was thinking how to build an IoT device with GPS functionality in RasPi. Many IoT projects employ GPS module but they use it mostly with Arduino to build quadcopter. Some people tried it with RasPi, but they use it in Raspbian OS. No one seems tried to build directly with RPi and Windows.

So, I made my own implementation, a library to connect Windows apps with GPS device. Long story short, you can make Windows app running on RasPi which utilize GPS, and you can code it on C#.

Check the code on GitHub. The library is licensed under GNU Lesser General Public License v3. You may use it in your project while retaining the license and credit to me. 🙂

How To Use

You just simply to download the binary release, or compile it on your own. Then add reference to Heliosky.IoT.GPS.dll in your project.

To use the library, you can add usings below to simplify the class resolution.

Continue reading “GPS Library for Windows 10 IoT and Raspberry Pi”

Old Notes Unpublished: Start Up Spending and Gojek Phenomenon

I read this link

https://www.techinasia.com/silicon-valley-spends-money-people-asia-spends-marketing/

Yes. See how Gojek spend millions just to market their product, while their product itself are made by fifth grader.

Okay this is a very long post

Once I was interviewed for a new start up, Snapcart. I met the founder, which has a long hours of experiences, beginning from working in consumer product industry for 6+ years, then moving on to boutique consultants, which introduced him to communication industries, and then moving on to run a big online marketplace which was acquired by OLX.

They were looking for someone who can run the tech team to develop and support their products, as a level of CTO. Certainly with me having only experience in consulting industry with 3+ years experience in only the same project all over the time, doing the same job which it has become a routines, was not a perfect person to sit on CTO chair.

I was interviewed by their venture, Ardent Labs. Funnily the one who interviewed me which was actually looking for a CTO, in the end became the CTO itself, as I heard that they failed to get the person they wanted. During interview, I was shown their prototype design, their ideas, and I saw how solid their idea is. They aimed to develop a fully sophisticated product with perfect quality.

Certainly they spent a lot to hire their CTO, which was a senior employee (years of experience overseas, and he is actually a foreigner too) in Ardent labs to run their plans. They are also hiring good tech person to fill the position as a team leader in their development team. And now you can compare how the quality of their product compared with Gojek which spent a lot of cash to market their product using discount.

Although the CEO and so-called Brand Director of Gojek has also long running experiences, was from consulting industries too, I can infer that they has a flaw in their business.

First, I peeked on the CEO/Co-Founder CV on linked in, and they said that they have been working on it since 2011. And guess when they release the app? 2015. 4 years of developing and the app is still buggy? Compared to Traveloka which starts a bit later than Gojek, has a way better products than Gojek, and we can see that Traveloka has evolved to a mature ecosystem. No wonder, Traveloka was developed by a Standford graduates, although he was young and at my age.

I heard from my friend that Traveloka is actually heading towards increasing their hitcount on their website then they can sell it in a very high price. But when I was interviewed by Traveloka, which was looking for person to fill the team of Product Manager, I saw different things. They are actually really evolving their products, and of course, their goal might not merely be only sell and dump like Disdus now Groupon, DealKeren then LivingSocial now IDontKnowWhatItsName. In their office, I saw what you can call it Googleplex in Slipi. A lot of tech team involved in their company, which surely no wonder that Traveloka apps either web or the mobile apps one are very freshly baked.

Guess how long Snapcart develop the app? When I was interviewed around April 2015, they said they have been developing about around 2/3 months, and they set to release about 2 months from April. The news covered the release about August 2015. So basically they only have 6 months to bake their app, yet their app is very freshly baked.

So I don’t know what happened behind Gojek company, but certainly I assume that they took wrong way to expand their business.

This article was written a year ago, way before the Gojek scandals with Go-Pay account brought up to the public recently. I sometimes use Gojek too in case Grab application doesn’t work/no driver available. But I’d rather not use the Go-Pay service as it seems very not-secure.

The Faith on Our Journey

I visited Baduy village at Banten last weekend. It was one of the most remote village in Java, we have to walk for more than 5 hours one way (I took 7 hours), climb and descend more than 4 hills just to reach there. There’s one thing I learned from my journey there:

We have to keep strong on our way to our destination no matter how hard the obstacles are in front of us.

It was very challenging trip to Baduy. I had to walk muddy and slippery paths, climb a very cliffy hills, all under rainfall. There is no easier shortcut and every road we take always have very hard obstacles I had to face.

There is also no point of return. Once you walk, you have to continue to your destination. Unlike game which has checkpoint, when you face a hard obstacle, you can retry again from beginning, or even avoid that obstacle. But not in real life.

During my journey, I had to step on muddy path, it made my shoes full of mud. I was raged on why the path was so muddy, why the rain was not stopping. Then I realized that that was not right, because you were angry to your own condition, angry to God for what He guided you so far.

Continue reading “The Faith on Our Journey”

Appreciation

Appreciation is one of things you can do to other people for free. It gives spirit and motivation to them which can bright their life. It is one of keys to a good workplace environment.

I have friends who are complaining on how unappreciative their peers or bosses are. This made me reflect to myself on how do I feel with my peers and bosses. I am really fortunate to have a very supportive peers and bosses, which makes myself in a very comfort zone.

How do I define a good peers and bosses?

Continue reading “Appreciation”

Adventure Style Photography

I have been interested with photography especially when I was finally able to purchase my own DSLR. So I am going to share some tricks on how I take pictures.

I love travelling, and I love taking photos while travelling. One of my friends once asked me after seeing Angkor Wat photo below: “how come you could come to Angkor Wat and it was not that crowded? It feels like you were having an adventure in a real ruin”

Continue reading “Adventure Style Photography”

Your Environment is The One Who Built You Up

I was researching my target university. One thing that I did was watching the commencement event and listen to the speeches by the president and honorable alumni. It was very interesting to watch the event, and I gained lot of information about the culture in the university.

I learned interesting knowledge from one of the speech:

Your environment is the one who built you up

The speaker said that the influence of people around you is the crucial factor that determines  what you’re going to be. You tend to follow your community into certain common characteristic. For instance, if you spend your time more with slackers, you will tend to become a slacker too. In the other hand, if you are within a circle of motivated people, they will surely motivate you toward good things.

The speech continued to his experience and his decision which changed his life

Continue reading “Your Environment is The One Who Built You Up”