Monthly Archives: September 2013

Getting started with Enginio on Windows

If your application ever needs a persistent storage on a server or if you need to share data between lots of users or that data is changed often and the user really needs the latest and best data, well then using cloud storage of some kind can really be helpful.

So why Enginio, why not one of the others? Well, if you are using Qt, then it is super easy to implement the connection to the Enginio cloud and make use of its API. I have been working a good deal with Windows Azure, and it is really powerful, but it is more work to implement in a Qt Client than using Enginio.

0. Computer setup

I am using Windows 8 Pro 64-bit as my OS. But I guess most of the stuff will be the same regardless if using Mac or any Linux OS. Let me know of any major differences and I will write it down.

1. Create an Engionio account

Its free!

https://dashboard.engin.io/#register

Then create an empty backend With a name of your Choice:

Create new backend

You will then see the Dashboard that will look something like this:

Dashboard

2. Download all the necessary files

!IMPORTANT! : Do not run any downloads yet, we will do that later, just download the installers.

First off you need Qt, at the time of writing the latest Version is 5.1.1:

http://qt-project.org/downloads

I would get Qt Online Installer for Windows (13 MB), because then I can get all the packages I need. Do not run the installer yet, we will do that later.

You also need OpenSSL installed on your computer since Enginio is using https for communications between client and server. You can find the binaries at: http://slproweb.com/products/Win32OpenSSL.html

Now for the Choice: 32-bit or 64-bit?

32: Win32 OpenSSL v1.0.1e Light

64: Win64 OpenSSL v1.0.1e Light

You will most likely do fine with 32-bit even on 64-bit system (I have not tested, but if you do, please let me know). I chose the 64-bit version.

You will, most likely, need the Visual C++ redistributables as well.

32: Visual C++ 2008 Redistributables

64: Visual C++ 2008 Redistributables (x64)

This choice between 32 and 64 bit is important, because this will dictate which versions of the other SW you need to download and install.

Now download the Enginio package from the Enginio dashboard.

Enginio Packages

I downloaded the Windows MSVC2012 x86_64 package due to two reasons:

1. I chose the 64-bit option above.

2. MSVC2012 is better than MSVC2010 😀

Since Enginio do not have any MinGW packages, we need to download MS Visual Studio 2012 Express. I chose the Express for Desktop Version. I hope they will add MinGW support to Enginio soon. If you have Mac or Linux this is of course not needed.

http://www.microsoft.com/visualstudio/eng/downloads#d-express-windows-desktop

3. Install software

You can start by installing Visual Studio Express, it should not take that long. You do not need to register (yet) or even start it up after install. You might need to restart the computer after install is done.

Next step is to run the Visual C++ 2008 Redistributable.

Next is the OpenSSL. Select “Windows system Directory” when you get the question for where to copy OpenSSL DLLs.

OpenSSL

Next is Qt and I usually put it in C:\Qt\ and these are the packages I install:

Qt Install

Not everything is needed for you, but I like to have these options for different settings.

Now, sit back and relax, take a cup of coffee or watch some telly, this gonna take a few minutes.

Next is installing the Enginio package. Now you will need to locate the folder where you have your qmake.exe file.

Enginio install

Rest is just Next, Next, Next.

4. Test out Enginio

Follow this: https://engin.io/documentation/qt/enginio-qml.html

Or

Start Qt Creator and create a New Project Qt Quick 2 Application (Built-in Types), name it whatever you want.

Make sure you check the MSVC2012 64-bit Project.

New Project

Now in the main.qml you will Write:


import QtQuick 2.0
import Enginio 1.0

Rectangle {
width: 360
height: 360
Text {
text: qsTr(“Hello World”)
anchors.centerIn: parent
}
MouseArea {
anchors.fill: parent
onClicked: {
Qt.quit();
}
}

Enginio{
id: client
backendId: “123456789abcdef”
backendSecret: “123456789abcdef”

Component.onCompleted: {
var city = {
objectType: “objects.city”,
name: “Helsinki”,
population: 606000
};
client.create(city);

}
}
}

Just remember to pick your backendId and backendSecret from your Enginio Dashboard.

When you run it you should automatically create a New Object (a city Object) and it should be uploaded to the cloud. Go to your Dashboard and you should see the result.

Object View

5. Conclusion

That was getting started With Enginio, but I will try to make another post later with some more Enginio Magic.

Advertisements