Tuesday, October 25, 2016

First try to port a Qt application to Sailfish

So last week I prepared v0.3 and put it to git. Yesterday I tried to port it to Sailfish as was the original plan. I went at it as below: 
I used an existing test application to get the required files and project settings. I added them to my project. This part included copying various tidbits to the .pro file. Also included is copying over folders for RPM, translations, icons etc. 
Then I went through the files and updated the file names wherever needed to reflect my app. This gave me a build which built successfully using the mer-arm toolchain.
Now to get it running on the device. I plugged in the Aqua Fish to Laptop with microUSB cord, and enabled debugging. Then tried to debug-run the app. First problem - debug-run doesn't work. I got error as - gdbserver not found. On googling for this, found out I need gdbserver installed on device and it will probably take a while since I'm not familiar with this functionality of Sailfish. So I decided to skip debug-run, and go with only run. 
This worked fine but the app won't launch and I got some qml errors on console. After going through them I learned couple of things - 1. Sailfish SDK doesn't yet have support for Qt Quick Controls, confirmed this by going to SDK's qml folder and found only Quick 2.0 qml's there. 2. Debugging QML's is a real pain. There were times when I wanted to give up. Going through the errors one by one, finding dependencies and then fixing it, and then verifying the fix, it's exhausting. One problem which was my doing, was not checking in advance what QML things are supported on Sailfish. 
Anyway after couple of hours of hair pulling and redoing the code, the app did launch on AquaFish. One major deployment related issue is I need to figure out the location for the database, because it's not getting deployed right now. Other major issue is UI related. My app used flexible positioning but Sailfish UI expects some stuff like padding and widths according to theme guidelines and so these all need change. Plus most of the screen looked white with barely visible gray fonts - this also needs fixing. I wish I had a screenshot to post here to show how bad it looks, but it's just some stuff that needs fixing. 
So well that's my experience porting my app to Sailfish OS. It was good experience, in that I got some hands on the various files related to packaging the app, and I got more hands on Silica Controls. So my goal is to get the app working and push a Sailfish OS compatible v0.4 to git. Lets see if I can nail it!

Wednesday, October 19, 2016

E-Governance experiences in India

For last few years computerization has become common in all government departments and we can do a number of tasks online. 
Last few days I had different encounters with a few government systems here around. I'll summarize my experience as below. 

1. Online Tenant Registration

I'm living at present in a rented apartment. Recently I was looking at a new vehicle purchase and one condition was the tenant should be registered at nearest police station. Being lazy, I looked up if there is anything online for this. Funnily enough, there is a website: http://tenantreg.in. It was started two years back on the outset of "German Bakery Blasts" and "26/11 Mumbai Attacks". The website when I tried to access was down. I tracked the registration and found out one probitysoft maintaining it. I found mail of the registering person and fired an email to that person. I didn't get any reply or acknowledgment, but the website miraculously came online. I went through the options and checked the various operations. 
It looked functional enough, but me being the pessimistic type decided to go visit the police station. It didn't turn out that exciting but anyway this is one story of eGovernance.

2. Online Tax Payment and RTS queries

This is from KalyanDombivali Municipal Corporation website. They had an old system 4 years back which was okay'ish. But the payment options were dreadful with only 2-3 banks supported. So couple of years back they revitalized the whole thing and computerized a number of departments. 
The new system is up to date, is easy to use and is not an eyesore. For this I must give credit to the developers and the corporate admins who helped put this together. 
The payment part now uses two payment processors techprocess and billdesk which means anybody - I mean totally anybody can perform an online payment. I have been using this system to pay property taxes for one of my properties there and it's worked fine. A good example of eGovernance. 
But that's just one part. Recently I have to use their RTS functionality - this one for getting online No-Dues certificate. The process is straightforward. You fill an online form, pay 15Rs online, and you get a ticket whose status you can see online. 
You get an SMS on your registered phone no when the request is processed, then you can download the certificate from the website. As simple as that. If you have any dues, you can pay them right away and continue to filling the form. 
Brilliant. I got the certificate within two days as promised. This is a really good example of eGovernance. 
To look at it this way, since I do not live in the city it would have taken me one leave, about INR 500/- for travel and a lot of physical discomfort to get this done. But with this online facility, it's all saved. 

So from these experiences you can see that more and more eGovernance is needed. Lets hope the government puts more and more functionality on the computers.

Update on Intex AquaFish

Last one week I explored AquaFish more. Found some nifty things too. PC Connection is great and working fine. I can send files to and from AquaFish well enough. Most of my media plays fine on AquaFish. 
I checked the events view and there were some options regarding to customizing the Quick Toggles or the WiFi/BlueTooth etc buttons. I added brightness control there since it seems like the natural needed option there. 
Besides this I successfully enabled developer mode and managed to connect the phone to installed Sailfish SDK and managed to run coupe of examples on the phone. One problem I faced was the SDK won't connect the phone when I tried connecting the SSH thingie(???) over USB itself. But then I connected both my laptop and AquaFish to WiFi and used the WiFi IP of AquaFish in Sailfish SDK, and debugging worked fine then. Don't know what the real issue is. 
Anyway, going forward I side-loaded some APK's and tried to install few Android Apps like Flipkart, Amazon, WPS Office (I use this for PDF reading, the night mode is blessing), 7Zipper, MXPlayer etc. Out of these MXPlayer and 7Zip failed to install. Others installed and worked fine enough for my small use.
Overall I'm having continued good experience here. Hoping it lasts in the future.
My goal is to port my newly developed Income/Expense Tracking app to Sailfish. Lets see.

Tuesday, October 18, 2016

Using Git with github

For last couple of weeks I am working on a small Income/Expense tracking application. It's a small pet project of mine. It's main purpose is for me to get familiar with latest features in QML and code for various scenarios in a live app.
Recently I put together another point release for this - a version 0.3. Now I needed somewhere to keep track of it's development and manage changes better than a desktop folder and datewise backups. So I thought I should setup a Git repository for this.
So I created a github account and created a repository. To import my project into this, I tried to use a GUI Client, gitg which I thought would be easier to use than stumbling around the commands. 
Unfortunately gitg gave an error regarding .gitg-config something file. I didn't have time to shoot it down, so I used the five-six commands shown in github repository page to setup empty repository on PC. 

The commands are:

$echo "# UIApp" >> README.md
$git init
Initialized empty Git repository in /home/vaibhav/Work/.git/
$git commit -m "first commit"

*** Please tell me who you are.

Run

  git config --global user.email "you@example.com"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got 'vaibhav@HP-Elite-7100-Microtower-PC.(none)')

$git config --global user.email "xxx@xxx.com"
$git commit -m "first commit"
$git push -u origin master

After going through these commands, I checked the repository on github, the first commit was visible. 
OK. Now I copied project files from other folder. Then opened repository with gitg.
Now gitg showed it correctly. The new files were shown as unstaged. So I added them to staged and tried to commit. Gitg asked for updated author info. I went to Author info dialog and updated my name. After this I tried to commit again. This time commit was done. But this was a local commit, and I couldn't find anyway from github to sync this to github master repository.
So I tried following command, it worked and it was synced with master branch at github.

$git push -u origin master

Now my project is on GitHub at: https://github.com/vaibhavsdlv/UIApp.git

Thursday, October 13, 2016

1 Year Anniversary of Nubia Z9 Mini

Right a year back this time I was frustrated with my Redmi 1S for not getting through the day. So much frustrated that I sold it to a friend's friend. To add to the cash-pile I sold my four year old Samsung Omnia W on Quickr. And then put in some more hard earned monies, and got this beauty on Amazon Sale with 33% discount. 
It was a risk. Nubia as a brand was not well known. But I have used ZTE's back then and knew them to be solid devices. So I went for it. And now a year later, I'm still happy for that decision. The phone came with Android 5.0.3 with Nubia UI which I found to be crap, but the Camera was top notch. I have since shot more than 2000 photos with it and many of them are just superb. So much so that it convinced me to invest in a tripod. Another good investment.
Anyway, couple of months in I ditched Nubia UI for Mokee ROM and haven't looked back since. Used Mokee 5.1 for a while, then moved to Mokee 6.0 and been using it so far. The phone's solid though, the battery still goes more than a day, it has seen half-dozen falls but still working fine. The screen's provided guard has bellyful of scratches, but I I think I should replace it now after a year. The display is crisp and no issue with anything else. 
This reminds me of the Samsung Omnia W. It also was a solid phone and a joy to use. Maybe more so because it had WinPhone OS and an OLED screen. I miss that OLED screen, but by end of first year, it had developed burn-in spots near top. Nothing like that here in Nubia. 
Well such solid gadgets are few to come by. Especially sad when they explode like recent Sammy Note 7's!!!

Tuesday, October 11, 2016

Thinking in terms of API

Soon I'll be completing seven years of career in IT. I have worked as a software engineer, then a senior software engineer, and for last one and half year as a team leader. And during all this time, I have encountered a number of problems. I have seen code of various quality, code that looked like spaghetti,  totally unmaintained and terror to make any changes to. I have also seen well maintained, well architectured code. I have seen C, C++, .Net, Java, JavaScript, PHP, SQL Procedures and shell scripts. I think I have seen more than enough.
So while reflecting on all this and trying to apply my previous experience to my current work which is in embedded systems, I thought I need to think about API's and how to apply them to my work. Actually it shouldn't be a debate, API's are needed. To avoid mixing of various different functionalities, you need API'fied layers and clear separation between the various functions.
But from what I've seen in embedded applications, it's peoples style to liberally use globals, externs, and with a big application like a complex HVAC system, or a motor ECU, it turns into an unholy mess. You end up with a bunch of static, globals, extern functions and other bits that makes understanding and maintaining such a code a pain in the a**.
That's where API's come in. You are actually formalizing the functionality, and coding the prototypes for that module accordingly. This way you separate functionality into that module and hide all that away from other modules/functions etc.
Consider following example:
Recently I was working on a UDS client. This client communicates with UDS server on a vehicle, it creates UDS queries using UDS over CAN, and writes/reads the queries and response. Now, a quick and dirty hack would have been to hardcode the few, about 4 UDS queries and read off their responses. It would have been easy. But I thought about the utility and possible use cases for this little app. I came to the conclusion that there is a chance of this utility needing future functionality additions. So I tried to mudularize it. That means it got architectured into following three layers.
1. Application layer: Here we create a UDS query and send it to the next layer.
2. Service layer: Here we implement the transport layer for the UDS over CAN functionality.
3. Device layer: Here we implement a virtual CAN device and abstract its read/ write functions.
I had to think hard on the data passing between layers. Also how to maintain the logical separation. Took me about 30% more time but it was worth it. Because next week I was told to make this utility compatible with another CAN device. And with this code I just had to create another derived CANDevice class and implement the read/write functions according to this new device's API's.
Such is the use of API's for code maintainability. And such code is totally applicable to embedded applications. This would address the logical separation and readability aspects of embedded code.
The other pain aspect of embedded code is extern functins and global variables. Having application level global buffers and passing them by reference to lower layers would solve the problem of readability. It would make function prototypes a bit long but then you wouldn't have to hunt the globals around. It would also clarify data passing since all data used.in the function would be visible in its prototype.
Well, this approach does looks promising. Lets see how it works out in real life.
Cheers.

Thursday, October 6, 2016

Adventures trying to share Laptop/PC internet to Sailfish

Well, I got hold of a high speed USB Dongle which I could connect to my laptop/desktop. But I couldn't use it's internet with Aqua Fish. So I thought I would try to share the internet and see how it works out. 

1. Make laptop WiFi hotspot - normally it's effortless with apps like Conenctify,but on this current laptop I don't have admin access. Which means I can't do this using windows. But I have Linux on this too. So I rebooted and googled about WiFi hotspot on Linux. Got some decent instructions too. But it wasn't working. So after changing the WiFi driver twice, following three different tutorials, and finally finding out that this laptop's WiFi doesn't have any driver that supports AP functionality, I was disappointed. 

2. Try USB Reverse tether on Jolla: The instructions were there. But people threw a number of disclaimers so I thought my phone's brand new. Don't wanna break it so early. Which means this was also a no no. 

3. Try USB tether on android and make it WiFi hot spot: Well, getting reverse tether to work was an experience in frustration. Mainly because somewhere between android 5.0 and 6.0, they changed a number of networking commands and thus invalidating all those simple 3-4 command tutorials. 
Finally after trawling the web for couple of hours I found what one lucky soul had posted regarding Android 6.0. I followed that tutorial but somewhere between 7th or 9th command I got lost. 
Not so easily giving up, I found another option: An App in Play Store called Reverse Tethering NoRoot Free. Following their instructions I installed companion app on desktop. And fired it all up. I did get reverse tether working with this. But when I tried to turn on WiFi hot spot so that I could share this hard earned internetz to Aqua Fish, it just wouldn't work. 

Well, they say third time's the charm. For me three tries are more than enough. 
Summary: I changed laptop WiFi Linux drivers thrice. Trawled internet for more than four hours. Installed Linux ADB Driver. Fired about 4 dozen commands in ADB Shell. Fired twice that commands in terminal. And managed to get Android Reverse Tethering working with a ready-made app from play store. 
Some days are just so bleak...

Wednesday, October 5, 2016

Aqua Fish update

Two issues I noticed:
One due to WiFi not connecting to WPA Enterprise network, I had the cellphone reset. After reset I entered my Jolla account credentials.
After that I got notification for update. Except this is one update I had already applied. So Sailfish update may not be working well. Don't know.
Second issue is seen when using the Android app store. I tried to update the apps but the download keeps getting interrupted. Don't know again whether its network issue or store issue or something else.

Tuesday, October 4, 2016

Intex aqua fish review

[Updates]
---------------------------
5-Oct: Just found out Sailfish doesn't support WPA Enterprise. So no office WiFi for me!
Although it connects to plain WPA router. I checked this with my Tata DoCoMo WiFi dongle.
---------------------------

Introduction

Unboxing hardware

The box looks good. Opening it you find a book like design which is delight to open. The box contains handset, 2500mAh battery, in ear type headphones, a power brick and a USB to micro-USB cable. It comes with an orange colored back plate which can be removed by lifting one corner. Intex
has helpfully provided a sticker at the corner. The phone has quite a bit of footprint but is light in hand. Removing the backplate shows the dual Sim slots and the dedicated SD Card slot and battery slot. The battery is removable. But you need to remove the battery to insert SIM/SD cards.

Display, connectivity, battery life

The display is specified as an IPS HD display. It doesn't have any kind of glass protection though. The covering plastic is bit shiny which causes glare when brightness is set to low. The display can get quite bright and so we shouldn't have any problem with sunlight visibility. Adaptive brightness is supported however I found that it's not as responsive as I like. The brightness adjustments happen slowly. The display is good enough for the price though and touch response is fine.

User interface

Intex aqua fish comes with Sailfish OS. The version is 2.0.2.51 after a small update. Updates are directly available from Jolla. The interface is touch driven. It supports the usual elements like a
Home screen, Notification tray with Quick launch buttons, an app drawer, theming support via ambiances etc. It supports all major accounts like Google, Yahoo, Facebook, Twitter along with VK, Dropbox, OneDrive etc.

For apps you have Jolla store which provides native Sailfish apps. Plus baked in is Android apps support. This means many of your android apps also work on this device. For Android apps a Store application is provided which lists a number of popular applications. You wont find a lot of applications in the Jolla store and with android apps also you may not find all your day-to-day apps. So hardcore app users may be disappointed.

The interface uses what termed as Pulley menus and gestures for navigation. The keyboard doesn't support swipes but otherwise is precise and is fast to type. The menus are easy to use and intuitive. The interface is fast and doesn't show any lag. Perhaps the 2GB RAM is the reason for such
smooth interface. But then Sailfish OS is fairly light. On the home screen you see all your current running apps. The android apps are also seen here. They are displayed as tiles. The tiles may have quick buttons. These may perform some activity in respective app. E.g. Weather app has a refresh button which refreshes the tile.

The settings provide almost all option you will find in android. There's brightness, display, accounts, apps, network settings, personalization security etc settings. It covers the configuration needs for a modern smart phone well. The notification tray is available at left home screen. Its functionality is very similar to android notification tray. But some options like clearing the tray, and swipe to dismiss are not yet available.

Performance

I have not gone into the thorough analysis of performance of Sailfish, mainly because the hardware is very entry level. When you consider the Snapdragon 212 SoC, there's not much to benchmark. So lets consider the real world usage only. As I said earlier, Sailfish OS is lightweight. So your average usage reflects that. Navigation between menus is fast. Apps can be switched fast. Apps are slow to load though. Maybe if they provided a pinning option like androids pinned apps in recents menu, then we may avoid opening and closing high usage apps like dialler.

Telephony, messaging, loudspeaker

The dialler and contact apps work well. The UI is intuitive and easy to use. The search is fast. The apps have accessibility features like automatically including the name of contact in message which is neat. The copy-pasting is equally neat. When you select the text by long-pressing a word, it smoothly zooms in which is pleasant to see. I checked both Sims and the calling options etc are similar to
Android. The call volume is decent and loudspeaker is loud enough, but of average clarity.

Gallery, media players, audio quality

Again, the Gallery and media player are similar to android. I checked a number of files and formats and they played well enough. The video player is a bit too basic for my liking. The media gallery is similar. A bit spartan and without advanced options. But it manages to cover all the basic operations. Audio quality is good. The sounds feel natural and not artificial as some low end Mediatech chipsets sound. Overall I would say its a good media device.

Camera

Both the cameras are average as expected. The camera app provides a lot of options and it works out giving you a good amount of control over the photos. In daylight you can fiddle around the settings and capture some decent photos. At night though the single LED flash just wont help much. Still the 8MP auto focus camera is decent for the price. Front 2MP camera is similar and it serves the function. but for an entry level smart phone its more than enough.

Conclusion

Overall I would say that Intex Aqua Fish is a fresh breath in a sea of droids. It provides good value for money. The hardware is more than decent. The OS is intuitive and provides good amount of smart phone functionality. Android app compatibility is a good feature. Although average android users may not like the limited availability of native apps and they may not like the lack of their latest and greatest apps. But there's a market for such a device. And choice is always good. So if you are tired of your android and iOS, you can spend ~INR 4500 i.e. ~$80 and get your Sailfish fix.

Saturday, October 1, 2016

Why I hate windows

When you have a itty-bitty mail to send with your 100kbps connection, some godforsaken program crops up and gobbles all your little bandwidth starving your browser and making that mail a half-an-hour wait.