mandag 16. januar 2017

OnePlus 3T - get your nougat

Some countries lag in the update cycle of the infamous phone OnePlus 3T (also the OnePlus 3).

In a few easy steps you can get Nougat (Android 7) today!

  1. Download Opera VPN from Google Play Store
  2. Activate said VPN
  3. Set region to oh Canada
  4. Search for update in menu
  5. Start update
  6. Pause update
  7. Disable VPN
  8. Resume update
Steps 6-8 are optional, yet will speed up the download of said update.

onsdag 13. april 2016

Android app for weather and local air quality - now updated with feedback UI!

For my BA project I'm making a contextual app for Android 2.3+ that targets the users context (time and place). It shows the forecast and weather now as well as local air quality.

Weather is shown for the entire globe where as the air quality is limited to stations in Norway. It uses my service bus that runs on a LEMP server with Redis for key/value storage.

My App asks my servicebus for the closest stations, the service bus runs geospatial queries and then query the API's if it's not already stored in Redis.

The user can then enrichen the data by submitting how the local weather is, as some times it's not the closest station that is most correct (maybe you live at a different elevation, maybe there is a mountain between you and the closest station or other factors that would mean that other stations should be weighted above the closest ones.).

Current data sources:

onsdag 9. mars 2016

Android app for hacked robot vacuum

I tried the third party Android app for my IoT hacked robot vacuum and I really like it.

Thank you the german hackers and of course LG that uses linux!

Here are some pics from alfa release.

If you want to try the app, look at my previous blog post: LG Hom Bot Square Wi-Fi mod

LG Hom Bot Square WiFi MOD

LG Hom Bot Square now with Wi-Fi :-)

This is a very nice Internet Of Things modification to the LG robot vacuum!

After completing the guide here: I went to the german robot hacking forums where I found out that they also made an Android APP. Will have to download the APK and maybe the source too.

This is how the robot views the world!

The Android APP can be downloaded from here:

This is what a robot map looks like

Related german links:

tirsdag 8. mars 2016

Sony Z5 series getting Android Marshmellow

Sony Z5 series now has marshmellow rolled out in Norway. If you have yet to get it OTA you can try to connect a USB cable to your PC (having Sony PC Companion installed).

mandag 29. februar 2016

Redis service bus for API calls

Redis service bus for API calls means that I can store the
users context (geo fence) as a time+place context.
Instead of having all the users query the same API calls for the same context, why not geo fence the API queries and let redis act as a remote storage for the results? That's what I asked my self in my undergoing bachelors project.

My Android app "Kontekst" (Norwegian for Context) will query data sources like YR and NILU – Norsk institutt for luftforskning.

The context of the user shold show data relevant for the user and the user should not have to wait for the same data delivered to other users in the same context. There is the dimension place (location) and there is time. Time doesent stand still even though the user does and after 10 minutes, the data is considered stale when it comes to air quality and the local weather situation.

Yet there are hundreds of thousands of inhabitants, even in the city of Bergen, Norway! So why not use the contexts and harvest the great powers of Redis?

søndag 7. februar 2016

Redis, put your socks on!

Instead of handling connections via the TCP connection, one of the most important yields of Redis performance enhancment would have to be getting the sockets up and running.

On unbuntu server 14.04 you have the settings by doing like so:
sudo su
vi /etc/redis/redis.conf

Find the socket by searching in vim:
:/unixsocket <enter>

When you find the line with redis socket, just uncomment it, so it becomes:
unixsocket /var/run/redis/redis.sock
unixsocketperm 755

Then write and quit vim.

Then you need to reload the redis server, you can do it like so:
service redis-server restart

You can of course try to force a reload instead of doing a restart, but I find redis to often need a restart where Nginx often have enough with a reload. 

So, what are the gains my dear sir?
I did some benchmarks on my 5$ VPS.

First look at redis without socks (TCP):
root@xxxx:/var/www/kontekst# redis-benchmark -q -n 10000
PING_INLINE: 57471.27 requests per second
PING_BULK: 54347.82 requests per second
SET: 24038.46 requests per second
GET: 25974.03 requests per second
INCR: 26315.79 requests per second
LPUSH: 25641.03 requests per second
LPOP: 40650.41 requests per second
SADD: 65789.48 requests per second
SPOP: 44247.79 requests per second
LPUSH (needed to benchmark LRANGE): 43290.04 requests per second
LRANGE_100 (first 100 elements): 24570.02 requests per second
LRANGE_300 (first 300 elements): 11185.68 requests per second
LRANGE_500 (first 450 elements): 6997.90 requests per second
LRANGE_600 (first 600 elements): 6930.01 requests per second
MSET (10 keys): 37735.85 requests per second

Then the next one is looking at socks for less overhead:

(Remember to change your sock location!)
root@xxxx:/var/www/kontekst# redis-benchmark -q -n 10000 -s /.../.../.../redis.sock

PING_INLINE: 108695.65 requests per second
PING_BULK: 112359.55 requests per second
SET: 109890.11 requests per second
GET: 111111.11 requests per second
INCR: 90090.09 requests per second
LPUSH: 128205.12 requests per second
LPOP: 129870.13 requests per second
SADD: 67114.09 requests per second
SPOP: 61728.39 requests per second
LPUSH (needed to benchmark LRANGE): 60606.06 requests per second
LRANGE_100 (first 100 elements): 23752.97 requests per second
LRANGE_300 (first 300 elements): 9149.13 requests per second
LRANGE_500 (first 450 elements): 8361.20 requests per second
LRANGE_600 (first 600 elements): 5896.23 requests per second
MSET (10 keys): 56497.18 requests per second

So the socks connection gives: 53497.18 - 37735.85 = 15761,33 increase in requests per second!
This is completely free and takes you 2 lines of configuration... So why not do it? Even if your Redis handles it's IO today, you will of course put less strain on CPU and Memory too.