By Roger Cheng These were some of the biggest embarrassments and snafus in the tech world in the year gone by. How many had a personal impact on you?
Monthly Archives: November 2015
Here’s a Reminder Why You Shouldn’t Bother Doing Dumb Facebook Quizes
When everyone around you is Facebook quizzing, sometime’s it can be hard to resist the lure joining in yourself. But next time, breathe deeply and move on—remembering the privacy implications we’re about to remind you of.
…
What Police Can Learn From a Terrorist’s Discarded Mobile Phone
The dramatic raid on an apartment in the Paris suburb of Saint Denis that …
What Police Can Learn From a Terrorist’s Discarded Mobile Phone
The dramatic raid on an apartment in the Paris suburb of Saint Denis that …
How to vibrate with Qt/QML on Android?
Short answer – pretty simple. Thanks to QtAndroidExtras
First we need to add to your .pro file:
android: QT += androidextras
then add simple class to your codebase. Header:
#ifndef VIBRATOR_H #define VIBRATOR_H #include <QObject> #if defined(Q_OS_ANDROID) #include <QAndroidJniEnvironment> #include <QAndroidJniObject> #endif class Vibrator : public QObject { Q_OBJECT public: explicit Vibrator(QObject *parent = 0); signals: public slots: void vibrate(int milliseconds); private: #if defined(Q_OS_ANDROID) QAndroidJniObject vibratorService; #endif }; #endif // VIBRATOR_H
and the code:
#include "vibrator.h" #include <QDebug> Vibrator::Vibrator(QObject *parent) : QObject(parent) { #if defined(Q_OS_ANDROID) QAndroidJniObject vibroString = QAndroidJniObject::fromString("vibrator"); QAndroidJniObject activity = QAndroidJniObject::callStaticObjectMethod("org/qtproject/qt5/android/QtNative", "activity", "()Landroid/app/Activity;"); QAndroidJniObject appctx = activity.callObjectMethod("getApplicationContext","()Landroid/content/Context;"); vibratorService = appctx.callObjectMethod("getSystemService", "(Ljava/lang/String;)Ljava/lang/Object;", vibroString.object<jstring>()); #endif } #if defined(Q_OS_ANDROID) void Vibrator::vibrate(int milliseconds) { if (vibratorService.isValid()) { jlong ms = milliseconds; jboolean hasvibro = vibratorService.callMethod<jboolean>("hasVibrator", "()Z"); vibratorService.callMethod<void>("vibrate", "(J)V", ms); } else { qDebug() << "No vibrator service available"; } } #else void Vibrator::vibrate(int milliseconds) { Q_UNUSED(milliseconds); } #endif
now you have to expose the class to QML:
#include "vibrator.h" ... Vibrator vibrator; engine.rootContext()->setContextProperty("Vibrator", &vibrator);
voila! its ready to use!
Vibrator.vibrate(500)
Enjoy
Is Amazon Secretly Flying Its Own Cargo Planes?
New tech can boost smartphone resolution to 4K without hindering battery life – CNET
By Adam Bolton Software technology being developed in Japan is able to improve smartphone screen resolution to 4K while not drastically effecting battery life.
Ahmed the Clock Kid wants $15 million from city and school – CNET
By Chris Matyszczyk Technically Incorrect: Ahmed Mohamed, the 14-year-old who was arrested for bringing a homemade clock to school and then became a hero at Google and Facebook, is now demanding compensation and an apology.
This Antarctic Water Animation Was Made On Australia’s Most Powerful Supercomputer
By Campbell Simpson – Gizmodo Australia
The movement of the densest and coldest water in the world makes a big difference to the planet’s climate, but we don’t know much about it. Australia’s most powerful supercomputer, Raijin — named for the Shinto god of thunder, lightning and storms — has been used to model an incredibly detailed look at the underwater currents around the Antarctic landmass, and the flow-on effects that movement has on temperatures and eddies around Earth.
…
Microsoft's female workforce shrank 2 percent last year – CNET
By Steven Musil The company’s workforce diversity efforts suffer a setback due to job cuts at overseas factories — jobs held by a high percentage of women.