Saturday, November 29, 2014

.Net 4.5 Async Await for a more responsive design

Writing this so I'll remember the details. There is a good resource on the Await and Async keywords in MSDN: http://msdn.microsoft.com/en-us/library/hh191443.aspx

The key thing is that the execution is released back to the event loop until the async method is executed and completed. So there is no blocking of the event loop causing rendering problems in the GUI.

There is a lot of arrows in the sample in MSDN but the summary is that code will go back and resume executing the "continuation" after the async method has completed. This is great for long-running processes like downloading resources.

Saturday, November 22, 2014

Installing the Android Studio Beta

Google is moving to new IDE, Android Studio. it's only in Beta right now but when released it will be the preferred IDE and you will need to merge from Eclipse.

You have to install the java development kit 6 (JDK 6) the 32-bit and the 64-bit version, it that can be found here: http://www.oracle.com/technetwork/java/javase/downloads/index.html

Installer for the Android Studio can be downloaded here http://developer.android.com/sdk/installing/studio.html
Unzip

After installing the Android studio you have to add the JDK JAVA_HOME Environment variable setting if the installer script failed to do so, follow the instructions on the site. (the path should be to 32-bit or 64-bit depending on if studio.exe or studio64.exe will be used)

Also install the Android SDK, by downloading "Get the SDK for an existing IDE" http://developer.android.com/sdk/index.html Start the SDK Manager and download according to the instructions on the web site.

Start the Studio.exe in the Android Studio unzipped folder. Set the path to the Android SDK by clicking configure | project setting | project platform and setting the path.


Now you will be able to start a New project... By creating a project you start the IDE:


Found a tutorial that describe the Android Studio here: http://youtu.be/bJ_2_AQboc0

The UX when installing the Android Studio is really bad, hopefully it will be a lot easier to install with all the dependencies when released.

Sunday, November 02, 2014

Compiling Qt code gave: multiple definition of ...

Got an error when compiling our code:

In Windows 7 and visual studio, I at first did not notice the problem, but it was giving a warning:
LNK4042: object specified more than once; extras ignored

In Linux and gcc it gave an error, so I could not compile the code:
multiple definition of `<constructor of class>'
collect2: ld returned 1 exit status

I took som time to figure it out, but turned out to be a bad merge in subversion, 
the *.pro file had the same class twice in

HEADERS += \ Class1.h /
                         Class1.h
SOURCES += \ Class1.cpp /
                         Class1.cpp

Rremoving the second time the class name where entered in the *.pro file solved the problem. See http://stackoverflow.com/questions/4722400/qt-compiler-warning-overriding-commands-for-target-ignoring-old-commands-for 

Friday, October 03, 2014

Been to a lunch seminar about Internet of Things

Went to Sogeti Internet of Things seminar on Wednesday lunch.
I made some notes:

Presenter was: @dagpetersson  

Devices:
  • Electric IMP. Computer, WiFi, inputs for sensors. Very small.
  • iBecon. Localication, triangulation, water resistant.
  • LightBlue Bean. Test card, Temperature sensor, Accelerometer, iBecon. In and output.

IBM MessageSight, uses MQTT protocol. Can support up to 1 miljon devices.

We where also able to test Google glass, very interesting experience.  

Thursday, October 02, 2014

Qt and collect2 ld returned exit status 1

Got this error when building a unit test project:
collect2 ld returned exit status 1

The linker complained on my newly added class in the implementation project.

It took a while to figure it out, but the problem was that the old *.so file was left in Build folder when I tried to compile the lib file that was used by the unit test project.

The solution to the problem was to remove all files in the implementation project build folder. Followed by a rebuild of the implementation project and unit tests project could be built without any linker errors.

Sunday, September 21, 2014

Use Pomodoro Technique and instrumental music to get into the zone quickly

Was listening to Mark Seeman on .Net Rocks, talking about Getting into the zone.

Got some good advice's, Instrumental music tends to be better to listen to than lyrics or someone is talking when trying to get "into the zone" or flow.
I usually had a podcast or a radio station on while working. But I get it now, listening and processing when someone is talking and in the same time as I'm working with my brain is reducing the mental performance. After changing to classical or instrumental music in my playlist at work, I can feel that it's faster to get into coding quicker when interrupted.

I also picked up the Pomodoro technique mentioned in the show, after reading up on the technique developed by Francesco Cirillo and setting a timer on 25 minutes when working and 5 minutes of rest between every "pomodoro"/work session, I can say it works for me, getting more done every day.

Saturday, September 06, 2014

Solved: error: C2248: 'QObject::QObject' : cannot access private member declared in class 'QObject'

Added two classes A and B both inheriting QObject.

#include <QObject>
#include "b.h"

class A : public QObject
{
    Q_OBJECT
public:
    explicit A(QObject *parent = 0);

    QList<B> doStuff();

signals:

public slots:


};





#include <QObject>

class B : public QObject
{
    Q_OBJECT
public:
    explicit B(QObject *parent = 0);


signals:

public slots:

};

But when adding implementation for A:

QList<GUIContainer> A::doStuff()
{
    QList<B> list;
    return list;

}


The compiler started complaining:
error: C2248: 'QObject::QObject' : cannot access private member declared in class 'QObject'


It complains because:
"The values stored in the various containers can be of any assignable data type. To qualify, a type must provide a default constructor, a copy constructor, and an assignment operator."
http://qt-project.org/doc/qt-4.8/containers.html


Solved the error by changing the QList to be a list of QSharedPointer:
QList<QSharedPointer<B> > doStuff();