Mentor for Startup Weekend Bintulu

I’m very honored to be one of the mentors for the first ever Startup Weekend organized in Bintulu. This event is made possible by Techstars, Google for Startups, Tabung Ekonomi Gagasan Anak Bumiputera Sarawak (TEGAS), Grab, Sarawak Multimedia Authority (SMA), MaGIC, University Putra Malaysia (UPM) Bintulu Campus and The Founders Club.

My role during this event was to check out the progress of the teams and question them on every aspect of their startup ideas. This would make them think deeper and take their idea further into the next level. I also shared some of my experience in regard to product design, marketing and most importantly — everything about startup. Hopefully this have inspired them and changed their perspective.

I also met a ton of awesome people from all over the country, such as the guys from the Founders Club, MaGIC, and even senior lecturers from University Putra Malaysia (UPM). Most importantly, I’ve met so many people who are passionate with their startup ideas and this is really unprecedented in Bintulu!

Hopefully this event (and other events that are similar) can be carried out more frequently in Bintulu so that we can help more people to build their startups, at the same time enhancing the startup ecosystem for Bintulu.

Unity3D Introductory Course

I have recently co-organized an introductory course for Unity3D software together with SMA (Sarawak Multimedia Authority) and TEGAS (Tabung Ekonomi Gagasan Anak Bumiputera Sarawak).

Attendance was considerably well for such a technically in-depth course. I really hope that similar activity should be carried out in frequent manner to nurture more talents for the local creative industry.

Below is the end result produced during the course:

MoU Signing Ceremony with TEGAS

I recently signed a Memorandum of Understanding (MoU) with TEGAS for working together as strategic partners. The MoU signing ceremony was witnessed by YB Datuk Haji Talib Zulpilip and Datuk Len Talif Salleh. The state government aims to develop digital ecosystem throughout the state through collaborations between government and private sectors. I’m really excited to be part of this, and hopefully this will yield many fruitful results in the coming years.

Shell STEM School Geek-a-thon Competition

I feel very honored to be invited to become the industry technical judge for Shell’s STEM School Geek-a-thon Competition, which was held in my hometown, Bintulu.

10 teams of students of different academic levels were taking part in this competition. They had to come out with creative solutions that incorporate arduino and android applications to solve common domestic and environmental problems and try making the world a better place to live in.

My main role was to check out their prototype, especially the coding that they wrote; and making sure that it is both functional and without plagiarism. Overall, most the projects were really cool and creative!

At the end of the competition, 2 teams were chosen to represent their school to take part in state-level competition in Kuching in 2 months time. I wish the students well, and hope that they will continue to uphold their passion and dreams. Can’t wait to see what they can achieve in coming years!

New Book Published

I have recently published another book with Packt Publishing, entitled “Hands-On GUI Programming with C++ and Qt5“. This is the 3rd book I’ve written so far, and hopefully the content quality is improving more this time.

If you’re using Kindle for reading ebooks, you can get this book from Amazon. Otherwise, you can get the ebook and printed copy at Packtpub. You can also get all the source files used in this book at the Github page.

Killing MySQL Processes

Once in a while you might face problems related to MySQL being not responding. Most of the time it’s due to large database size or you’re running a select query on an un-indexed table. Instead of waiting for the process to complete (which may take hours), you can cancel the stalling processes using the following method.

First, open up another MySQL session and call the following query:

SHOW PROCESSLIST;

Next, you will see results like this:

+—-+—————–+———–+——+———+——+————————+——————+———-+
| Id | User | Host | db | Command | Time | State | Info | Progress |
+—-+—————–+———–+——+———+——+————————+——————+———-+
| 254772 | event_scheduler | localhost | NULL | Daemon | 2693 | Waiting on empty queue | NULL | 0.000 |
| 435342 | root | localhost | NULL | Query | 0 | Table lock | SHOW PROCESSLIST | 0.000 |
+—-+—————–+———–+——+———+——+————————+——————+———-+

Look for the ID of the query which you wish to terminate and use it in the following query, for example:

KILL 435342;

That’s it, the process will then be terminated by MySQL. Hope it helps.

Prevent Direct Execution of EXE

Back in early 2000s was the time when MMOs were very very very poppular in Asian countries. That was also the time when I was crazy about Ragnarok Online, one of the most famous korean MMORPGs of all time. Besides playing the game (which cost around US$10 per month, a large sum for a middle school student like me), I also went into modding the game and ran it on an emulator (private server running locally).

One thing that I noticed was the existence of a mysterious EXE file in its installation directory called “Ragexe.exe” which can never be executed; it will show you an error message whenever you double click on it.

Years later when I started to learn C/C++ programming I finally understood what the hell was that EXE file for; in-fact, it’s the actual game executable and not the other EXE that has the game icon on it, the other EXE is actually the updater client, nothing else.

So finally, the mystery has been solved. However, the question is: How can we re-create this for our own programs/games? What if we also want our users to run the updater first and not directly execute the main program? It turns out, it’s pretty easy to achieve. In the following example I will be using C/C++ and Qt but it should be pretty similar in other programming languages and platforms as well.

The sample code here is pretty simple:

#include "mainwindow.h"
#include 

int main(int argc, char *argv[])
{
	QApplication a(argc, argv);

	if (argc <= 1)
	{
		QMessageBox::critical(0, "Application Error", "Please run MyGame.exe instead.");
		return 0;
	}
	else
	{
		if (argv[1] != "yourpassword")
		{
			QMessageBox::critical(0, "Application Error", "Please run MyGame.exe instead.");
			return 0;
		}
	}

	MainWindow w;
	w.show();

	return a.exec();
}

In the example above, your EXE will simply pop out an error message that says "Please run MyGame.exe instead." if you double click on it directly. This is because the argc variable is either 0 or 1 (depending on platform, which means no additional input argument during launch) if you run it directly.

However, if there is one or more arguments being dumped to the program during launch, check (within the argv array) whether the second argument (the first argument is usually the program's name) matches your secret phrase or password before allowing the program to launch. Usually there will be input arguments if the user drag one or more files to the EXE to make it launch, as this is very useful for programs like text editors or image editors. That's why we must check if the argument matches your password or not.

Now that your program can no longer be run directly, what about the updater? How to ask the updater to execute your main program with an input argument? It's actually pretty easy as well. In the following example I will be using C/C++ and Qt, but it should be similar across different programming languages and platforms:

QProcess *process = new QProcess(this);
process->setNativeArguments("yourpassword");
process->startDetached("MyGame.exe");
delete process;

exit(EXIT_SUCCESS);

In the code above, I simply declared a QProcess object and set the native argument before starting the main program and close the updater client.

That's all, it's very simple to achieve. The tutorial above is by no mean professional: Technical names and phrases are not necessarily accurate, and the method used is not necessarily the standard way. I'm just trying to share what I know and what I did with my own projects. Peace.