Tuesday, August 28, 2018

Marshalling/unmarshalling struct containing array of structs

While handling a change request I stumbled into this very peculiar scenario. I had a structure which had array of structs and I had to read/write this in a file. So to and from buffer conversions, I knew marshalling will be most effective.
I had previously used it very effectively for CAN communication.
So I had to google a bit n found how to handle this peculiar case. Below is the code.

[StructLayout(LayoutKind.Sequential)]
public struct tagX
{
public UInt32 a;
public UInt32 b;
}

[StructLayout(LayoutKind.Sequential)]
public struct tagY
{
public UInt32 x;
public UInt32 y;
[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.Struct, SizeConst = 20)]
public tagX[] stX;
}

To initialize this:

tagY stY = new tagY();
StY.stX = new tagX[20]; // Ensure size of array is equal to size const supplied in marshalAs directive.

Then on this object we can run marshalling / unmarshalling routines.

Monday, August 13, 2018

Adventure with ZTE Blade C (ZTE V807)

Got hold of the ZTE Blade C after almost couple of years. Last thing I remember doing with this phone is flashing shit load of custom roms and then none of them working out the way I wanted. Every ROM had some issues. The last one I flashed was called PNG v5 and had a battery bug - but that may have creeped due to some other offbeat roms I flashed earlier. Anyway, coming back, what I wanted to do was to get this phone back to Stock state. 
 
Unfortunately being 4Year old I could not get anything. First I started with ZTE's official website, but it's down due to US sanctions. Actually I had almost all the tools but stupidly I deleted about six months back. 
 
Anyway so I started digging around to find a stock ROM. Needrom came through and I found someone's ROM backup there. To download that I'll need SP Flash tools and since I formatted my laptop a year or so back, will need MTK USB and MTK PreLoader drivers. Ok, took me couple of days of hunting around the net to get that. To flash the backup - tedious procedure, install all the drivers, thhen start SP Flash Tools and load scatter, then change any settings needed and start Download. Then plug in the phone in off state, and MTK preloader shall kick in and start flashing. Damn! On first day I ran into number of driver issues, and had to reinstall the drivers couple of times and reboot laptop a few times. 
 
Then when the preloader situation sorted out I found out about error 8083 - which means scatter mismatch. Problem is I had changed system partition to 2GB so does not match default scatter. Anyway, coming back I dug MTK Droid Tools and and created a scatter. Then sorting out more settings, I finally got the stock loaded. 
 
Now later what? I checked out the battery percentage and some basic things - everything seemed to be working fine. I had earlier also prepared the backup of existing ROM for future use if this adventure fails. Anway, so coming back, with 512MB system partition, the phone is not usable, so I once again looked around the net and tried to find the MTK65xx_repartition_EN apk, using which I had earlied changed the data partition size. This time no luck - all the paths were dead, and one place I did find the APK. But it won't work, then I remembered that I need root. So further search was for framaroot/ vroot etc but nothing worked and I almost gave up. Anyway, coming back I found some zip file which promised 2GB system partition. I was totally sceptical but it did work out fine. Anyway so now the phone is usable. Lets see what I can actually use it for!
 
Cheers!!!

Paytm games

I am not on any digital payment bandwagon. In fact I started using debit card only when the merchants stopped charging the stupid 2% transaction charge. And since I'm cautious about my money I have stayed away from payment wallets and the new app based payment methods. 
I primarily use cash for small payments. And shop where the merchants don't charge extra for using debit card. Anyway last week I tried to use Paytm app. It's a popular payment app. Many of my friends do use it for small payments. My feedback from them was positive, so I decide to take plunge. Also another major reason was - paytm food wallet. 
In india we get about 50Rs per day tax free out of salary for food. This you can collect monthly as Sodexo coupons. If you don't take sodexo coupons then this becomes taxable and you lose 10/20/30% depending on your income bracket. 
Anyway, coming back to Paytm, I tried to install the app. My poor panasonic was not a match - google play store said - device not compatible. Ok. Got hold of an APK and installed it, worked fine. Then created an account and logged in. So far so good!
Now comes the hard part - in India, now Reserve bank of India has made mandatory for wallet apps for user KYC. So I had to register one of my unique identity docs - like Adhaar or PAN card etc. No such option in App.
Then I went to website and logged in - and a popup asked me to give my Adhaar or other identity details. I filled it in and alas - error - please select proper option!!! WTF!!!
I retried number of times and even used different browsers. There were few posts going so far as giving some very complex directions to reach offline kyc, and too complex for me! Searched a number of forums etc. and even raised a support request. And the reply was - our systems are busy now- we will get back to you later!!!
Well, that did it in - I logged out, deleted the paytm app, and thought about this. The guys who can not handle a simple user kyc, cannot handle my money!! Alas!

Thursday, June 14, 2018

Sailfish OS update v2.2.0.29 Mouhijoki released

I installed the update yesterday. I had to go via ssu re and version --dup route since its not yet available for AquaFish.
Anyway the download was having issues. It gave up the first time after downloading about half the things after nine tries. I once again fired upbthe same command. And this time it was done.
I rebooted the phone. And on restart I was on 2.2. Overall there are not many big changes -mostly bug fixes and enhancements. Only bigger change is with fullscreen view of gallery items. Now they open in a new popup and you can swipe left right in this same popup to see next or previous image/video in fullscreen. I noticed slight lagging when the new image is displayed. But overall the usability improvement is good.
There are many other small improvements that polish the apps further. I did not notice any slowdown or performance issues in this one day. Lets hope it keeps going as smoothly.
Thats it for now. Adios!

Sunday, June 10, 2018

About the three kind-of crappy phones I have...

I actually have four phones with me right now. They are in order of age - Nokia C5-00 5MP, Karbonn Titanium S1 (re-badge of Cherry Mobile S1), Panasonic T44 and Intex Aquafish.

Sometimes I think that if I sold these all, then I can afford a decent mid-range mobile. But they each have their own character points due to which I find hard (or in case of Carbonn Titanium S1, since it's junk,) impossible to part with.

I mentioned 3 in title because, the Nokia I can't use anymore even though it supports 3G and can technically still be used, is not smart. it does not have whatsapp or any other apps for that matter. Google contacts can almost not be synced with it. And ultimately it's just a glorified MP3 player right now.

As to the Karbonn Titanium S1, it's a phone that I bought in I think Oct 2013. It's not dead yet is a miracle. Though looking at its current condition - power button almost dead, screen with white lines and it's ancient Qualcomm S4 play chipset is just not cutting it any more. But I have replaced it's dead battery and now I can use it for GPS Navigation on outdoor trips. It works fine for this single use.

Coming to the next two phones - I use them alternatively these days. The Panasonic T44 is very entry level phone - but it manages to kick some serious ass when it comes to value for money. This Rs 3200/- (about $50) phone gets me a full day's battery life, the UI is smooth and responsive, and it lets me do almost everything non-work that I want to do on my smartphone. Badass!!!

Intex Aquafish is not badass. But its damn special in it's own way. It's got Sailfish OS!!! And it's so intuitive, such pleasure to use, it just can't be expressed in words. It's not perfect - can't connect to my office wifi thanks to crappy enterprise WiFi support. But using it just feels much better than using Android! I bought this one for merely 5000Rs (about $77), and with 5" HD IPS display, 2GB RAM, 16GB Rom it's plenty value for money. And thanks to Sailfish OS being so light, the snapdragon 200 feels like a Snapdragon 615 for sure. In it's earlier versions there were a number of features missing, but it's been getting updates continuously. And so has achieved quite a bit of feature parity with Android. Just couple of weeks ago there was another update that shall take the version to 2.2. And there is talk of Sailfish OS 3.0 which will add more features. I love this about Jolla. Their first Jolla phone is still getting updates, years after it's release.

So none of these phones are great on their own but they all are special for me. And so I keep using them.

ZTE is not shutting down anymore....

Apparently Donald Trump cares more about Chinese jobs than American, and so in exchange for a dowry of about a Billion $s, ZTE is being allowed to keep the shop open!!! Three cheers for capitalism!!!

Thursday, May 10, 2018

ZTE is shutting down due to sanctions...

It was a striking news. ZTE is indeed shutting down major operations due to US sanctions. We have a Nubia Z9 mini in house. So I'm thinking what effect could it have on this phone?

Thankfully it's already served us about 2.5Yrs and with recent reset of stock firmware, it's going well as my sister conveyed. I have also given my sister a flip cover for decent protection. So it looks like the phone should last another year. I had doubts about the internal battery, but so far it's going decent. The health is around 80% which is not bad at all.

But this is a good lesson in purchasing hardware. I guess I'm not buying any Huawei hardware anymore, since they are also named in a number of spying and data theft scandals. Thankfully with the vibrant phone ecosystem, that still leaves us a number of options like Samsung, LG, Sony etc. And then there are smaller players like OnePlus etc. I'm thinking what about Xiaomi? Has anybody found if they are spying on the customers? I don't know! Lets google!!!

Monday, May 7, 2018

An Upgrade report on Ubuntu 18.04

I had Ubuntu 17.10 on my Office Laptop. And I managed to get couple of hours of free time on my hands. So decided to upgrade it. I had 2-3 DE's on it i.e Unity, Gnome, Mate etc.

The upgrade went well. It downloaded ~2300 packages and took about 45 minutes to wrap up everything. Of course I had quite a few things installed. Then I rebooted and used it for 3-4 hours. I am pleased to tell that almost everything works fine.

It has even retained Unity and it's working fine via Unity session. The Ubuntu session loads Unity themes Gnome. It's mouse movement is a bit wild, but it's smooth. Of course not as smooth as Unity but still good enough.

Everything else is good. Congrats Canonical on another solid release!

My favourite websites

1. ArsTechnica
2. The Verge
3. GSMArena
4. Fonearena
5. eSakal
6. Maharashtra Times
7. Distrowatch
8. Anandtech
9. LiveMint
10. Phoronix
11. Slashdot
12. Engadget
13. OMGUbuntu

Saturday, May 5, 2018

The search for a better phone

There are so many great phones around at some great price-points right now. My current android phone Panasonic T44 is a totally budget affair. I got it for INR3200/- That's about $50. Thing is - it's quite enough for me right now. I can't game on it, nor it can do any heavy duty office work and because of it's limitations I just don't bother.
The main issue is - because it's such a low end phone, I just can't think of using it for some things like taking photos when I'm out riding or use it for navigation(because it does not have inbuilt GPS). Anyway, the thing is with a better phone I could do all these things and more. I could game, could edit docs on the phone, basically do a lot more. And therein lies the problem. The mid-range phones don't do all these things well enough. And the phones that do all these things cost much more. 
Plus there's the other issue of getting replacement batteries. With non-replaceable battery a phone is dead as soon as the battery is dead, which happens in about two years. And that sucks!!! Because you are spending so much on the phone hardware which will become useless in about two years!!! Does not make sense to spend so much money. If you are spending so much money then the things should last more. And therein lies the rub. There are no phones in mid/ mid-high range in my budget with removable battery and the one's with removable battery are in low end like my Panasonic T44.
because of these things I have just put phone shopping on a pause. And I think it is going to stay on pause till all my phones die. Thankfully I have two that can work for me for 2-3 Yrs if they don't get stolen. And if I could not decide on any then I can use the old Nokia for couple years more.
Maybe by then phone's as we know them will vanish and morph into personal assistants like seen in Sci-Fi movies. That would be cool!!!

Tuesday, May 1, 2018

Tips to optimize the battery life of your Android Phone


Battery life of your phone is almost always a pressing issue. That's why these days phone batteries have reached 4-5000mAh from the measly 500-600mAh back in the days of Symbian phones. Android is a heavy, feature-rich OS, but it sure is not battery friendly. Android was quite crappy in battery department till v4. But from then Lollypop and Marshmallow brought great changes in reigning hungry apps and bringing down overall power consumption of the Software part of the equation. These changes, coupled with modern hardware with efficient modems, and big batteries means the battery problem is almost non-existent these days. You can expect a days battery life from your android phones these days.
But batteries do degrade, and it's not always possible to get a replacement and quickly move to normal battery performance due to availability of spares and/ or non-removable batteries. So it pays to keep a look at some ways  you can optimize the battery life you already have. E.g.One of my friends is very attached to his 2014 xiaomi flagship. It will complete 4 Yrs soon and the original battery is almost dead. But my friend loves this phone, but can't get replacement battery. One - no original available and two - the phone's unibody construction makes it very difficult to even replace the original.
Anyway so lets see some ways we can all get some more battery life out of the battery we have on our Android phones:

1. Use battery Status settings page and check what's sucking most energy. You should see Screen, Android System, Android OS, Cell Standby, Play Services etc. If you see any feature or App you don't use often, get rid of it. Get rid of apps that you can do without. These apps are sucking out your battery. Kick them out!

2. Turn unnecessary hardware radios off. Modern phones have Bluetooth, WiFi, NFC, GPS etc etc. But you rarely need all activated all the time. Use notification quick toggles to shut down the ones not required. You will save a lot of battery, since when these are ON, they are almost always scanning for networks/other hardware/ nearby android devices etc. So just turn them on for work and then turn them off as soon as you are done. This will help you save quite some power. This is true especially in case of Location Service.

3. Use extra power saving mode if you have it. These days almost all phones come with some some form of power saving mode. These usually turn down CPU speed, turn off fancy animations, and put the phone in battery sipping mode. It can be automatically launched by system when battery reaches some predefined percentage like 15%. Its great for new phones, but as battery becomes old, you will start finding that it reaches 20% and then the phone will just die on you. That's LiIon battery for you. As it becomes old and worn out, it will just stop working at 20/30% as per age. So for old batteries it makes sense to just keep the power saving mode always on. That will help much with old batteries. Just ensure to go through the mode settings and change anything that may affect your favourite apps like Manual Syncing or push services etc.

4. Dump unnecessary home screens/widgets etc. All these consume precious system resources and power. If you can do without them, get rid of them. Also keep no of home screens to minimum.

5. Turn down the brightness and turn off Automatic Brightness. It's probably obvious at this point, but you'll be surprised by how much this one alone helps to improve battery life.

6. Update your apps. Applications often get updated to use less battery power, so you should make sure your apps are up to date. Even if you configured the phone for automatic updates, some apps still require that you manually install updates. Check for app updates in Google Play by hitting the menu key and going to My Apps.

7. Keep an eye on signal strength. If you're in an area with poor cellular coverage, the phone will work harder to latch onto a strong-enough signal. This has an adverse effect on battery life. There's not much you can do about this one, but keep in mind that this could be the culprit behind a seemingly weak battery; it's worth popping the phone into Airplane mode if you don't need data or voice calls.

8. Check the reviews. The battery review results vary widely between handsets, even on the same network. When choosing a phone, make sure that real world talk time is sufficient. You can't go by what the manufacturer says; reviewers have seen variances on the order of several hours of usage in both directions on a regular basis.

9. Buy a battery case or larger extended battery. Battery cases combine a hardware enclosure, which protects your phone, with an extended battery that can double your phone's endurance. You can find models compatible with popular Android phones from a variety of manufacturers.

10. Check your accounts. You may be able to save battery life by having your email or other accounts poll for new messages/data less frequently.  Each account will appear under the "Accounts" section in "Settings." "Email" will allow you to access however many email accounts are set up on your device.

11. Reduce your dependency on cloud access. Ah, the cloud, the cloud, the cloud.  It handles our backups, it syncs our documents, and it delivers us news, entertainment and information.  It also requires lots of bandwidth and makes our devices go the extra mile when everything we own data-wise resides in the cloud.
I love my Dropbox account, but it can chew up battery life on my Droid since it has to download stuff I access.  You can set it to sync only while your Android is using Wi-Fi (Dropbox, "Settings," "How to Upload") but another good option is to store all files locally if you can so you can reduce the amount of back-and-forth needed by pulling data down from the cloud.

12. Black wallpaper can increase battery. If your phone has an AMOLED screen (like most Samsung devices), use a dark-colored background. Black wallpaper can increase battery life because AMOLED screens only illuminate the colored pixels. Black pixels are unlit, so the more black pixels you have, or the more darker pixels, the less power is needed to light them up.

13. Use Doze Mode. Doze mode has been around since Android Marshmallow, but with Nougat, it's been much improved. Before, Doze would only work when the smartphone has been stationary for a while. But now, it can also work when it's being moved around (in your bag or pocket while you're on the go, for example). The screen just needs to be off to work.

14. Turn off Google hotwords. Stop your phone from always listening. Google's OK Google voice searching is a fantastic and often very functional feature. The problem is that it can wreak havoc with your battery. Especially if you don't actually use it or only use it occasionally.
Go into Google settings from your app drawer and tap Voice heading. On the next page, select OK Google detection. In this menu, the best option for battery life would be to untick all the boxes, but if you are a fan of OK Google, just tick the From the Google app box to ensure your device is only listening when you're in the Google app.

15. Turn off vibrate and haptic feedback to save battery. Switch off vibrate. Unless you really need that added awareness, turn off vibration alerts for incoming calls. It actually takes more power to vibrate your phone than it does to ring it. Turn off haptic feedback too (that buzz you get from typing on the keyboard). Sure it feels cool, but it doesn't really add anything to your experience, and it's another battery drainer.

16. Set your 'Do Not Disturb' or 'sleep' schedule. Set sleep times or blocking mode to switch off Wi-Fi and mobile data when you don't need them. If your phone is basically off limits at work, set your device to not ring, vibrate or connect to the internet while you're at work. Many phones have a Do Not Disturb setting for just this purpose.
Likewise, you can set your phone to airplane mode when you're asleep or use sleep or blocking modes to set up limits for what your phone does during certain times of the day, whether that's while you're asleep, at work or in a meeting. Cool apps such as IFTTT let you create rules that can help you save battery life too.

17. Don't fall into the auto-sync trap. Turn off auto-syncing for Google accounts. If you don't need every single Google account updated every 15 minutes, just go into Settings and Google account and turn off auto-sync for those apps you don't need constantly updated.
Some apps – like email – let you manually refresh when you launch them, rather than running multiple auto-refreshes throughout the day when you may not need them to. The same goes for Twitter, Reddit and co. Unless you need constant updates or push notifications (like for Facebook or your calendar) just sync when you actually use the app.

18. Disable location reporting and history. GPS is a huge battery hog, as it harnesses data from the phone's GPS chip, cell phone towers, and Wi-Fi hotspots to find your location. The more a phone surveys your location, the more battery it uses. And that goes beyond just Google Maps.
Location reporting and location history are two GPS-based services with somewhat unclear motives. According to a Google Help page, the services can be used in conjunction with any other Google Apps, and may be used to improve your experience.
Chances are you can probably live without them, so disable these two features by going to Settings > Location > Google Location Reporting.

19. Turn off automatic Wi-Fi scanning. It's well-known that when Wi-Fi is left enabled, more energy is used. However, on Android, even when Wi-Fi is disabled, a phone could still be searching for networks.
To make sure this isn't happening, head to Wi-Fi settings > Advanced. Here, uncheck the option for Wi-Fi scanning.
Going forward, you'll have to connect to Wi-Fi manually, but you'll get a longer battery life in return.

20. Turn off any animations to avoid wasting precious battery.
This may or may not be something that you notice often, but every time an action is performed on your device, there is an animation that also occurs. Many times we have recommended speeding up these animations to give our devices a faster feel.
However, the truth is that reducing these animations also saves you battery life. In order to reduce these animations, you'll need to access a secret menu which is found in the Settings app of every Android device.

    Open the Settings app
    Scroll down and select About phone
    Tap Software info
    Scroll down and tap Build Number 7 times
    "You are now a developer" message will appear
    Go back into the main settings and you'll see a new option: Developer options
Once you have activated this secret menu, follow the steps below to either reduce or remove the various animations on your device:

    Open Developer options
    Scroll down select Window animation and choose .5x
    Select Transition animation and choose .5x
    Select Animator duration scale and choose .5x
You won't have to restart for these changes to take effect, instead, you should immediately see the differences. The reduced animations will help you save battery life, bit by bit, although the benefits of these changes won't be reflected in your battery life right away.


Thursday, April 5, 2018

C#.Net Static Linking Adventures

My app uses two DLLs - say Lib1 and Lib2 from a CommonDll folder.

With normal linking these DLL's also need to be placed with App executable. But previously we have been providing only App exe only.
Hence to keep the compatibility and to lessen deployment headaches, the above 2 DLLs will be statically linked in the executable.

In .Net world this not so straightforward as setting a static linking flag in linker.

Here we need to provide following steps. I have added the rationale for each step alongwith.

1. Add the DLL's to project as resources - preferably in a Resources folder. Go into these DLLs properties and change "Build Action" from "Content" to "Embedded Resource". Now the DLLs shall get embedded in the exe.

2. Provide a handler for AssemblyResolve event. This new handler looks for assemblies in Resources and if found, loads them there.
This handler is like below:

private static Assembly ResolveEventHandler(Object sender, ResolveEventArgs args)
{
    String dllName = new AssemblyName(args.Name).Name + ".dll";
    var assem = Assembly.GetExecutingAssembly();
    String resourceName = assem.GetManifestResourceNames().FirstOrDefault(rn => rn.EndsWith(dllName));
    if (resourceName == null) return null; // Not found, maybe another handler will find it
    using (var stream = assem.GetManifestResourceStream(resourceName))
    {
        Byte[] assemblyData = new Byte[stream.Length];
        stream.Read(assemblyData, 0, assemblyData.Length);
        return Assembly.Load(assemblyData);
    }
}

To add this to your program add first line as:
AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler( ResolveEventHandler);

3. Add a preBuild step where you will copy the latest DLLs from CommonDll folder to your Resources folder.
For this go to Project Properties > Build Events > Pre-Build Event Command Line

call "$(DevEnvDir)..\Tools\vsvars32.bat"
copy "$(SolutionDir)CommonDll\Lib1.dll" "$(ProjectDir)Resources"
copy "$(SolutionDir)CommonDll\Lib2.dll" "$(ProjectDir)Resources"

This ensures you have latest version of assemblies. Incidently we have been putting all solution dependent lib assemblies in CommonDll folder.

4. Above three steps are not sufficient because of the nature of loading of assemblies. CLR tries to load all dependent assemblies at start of function. So with normal main code with the handler override at start, won't work. Because CLR would be looking for dependent assemblies at start of Main and before executing our AssemblyResolve handler registration.

To handle this - in main() provide two functions:
void Main()
{
    Initialise();
    RealMain();
}

void Initialise()
{
    AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler( ResolveEventHandler);
}

and

Void RealMain()
{
    // Your actual Main code here
}

This way the assembly hander is registered before any assembly calls are made.

5. Now when you build the project you will find the Lib1 and Lib2 dll's in bin/Debug folder. But we don't want them here, dont we? Ok. To fix this - go to References - Right Click on Lib1 > click on Properties. Here change "Copy Local" to "False". Also make the same change for Lib2. Now delete the dll's from bin/Debug and rebuild the project. Now you will find only App exe there.

This way we are providing single App exe with all common code from Lib1 and Lib2 dlls.

Tuesday, April 3, 2018

ROM adventures on Nubia Z9 mini

Remember this one I gave to my Sis last year... Well since last month it started giving problems. What happened was the phone would get stuck in starting apps phase and zombie out. Only way to bring it back from zombie mode is to factory reset from recovery. But after a few days, some things related to Google Play Services would update and the phone would zombie out again. Sister got fed up and gave me the phone to fix.
So I went through a number of hoops to fix this issue and it's still not fixed.
To start with, the phone ran Mokee ROM v6.0 - marshmallow based with open gapps. Now all this is about two years old - things from 2016. And it all worked fine for last two years.
So what I did was reflashed everything and tried to see what's wrong. Worked fine till play services are updated. as soon as play services are updated, phone zombies out.
Ok. Get new version of gApps. Got it but after clean flashing that too, no change. Same issue. So maybe the Rom is gone.
So I download latest version of mokee marshmallow release Rom. Clean flash that with latest gapps. Phone works fine for a while but then craps out after installing gmail etc.
Ok. Can I revert to stock rom? Downloaded a version from Nubia website - turns out its real pain in the ass trying to install it. It needed latest recovery. And after installing that I found out the file I downloaded was corrupted. unfortunately nubia website does not provide checksums or anything. So got to hunt forums for stock rom download.
So after some more search got hold of couple of stock roms. The people on xda did say that these roms are installable with twrp 2.8.7.0. But found out that's not the case. There's a twrp 3 version present. But I'm really fed up of going through the hoops.
So going to try Mokee 5.1.1 with compatible gapps. If it works, then will stick with it.
Some time later......
Pulling hairs.... Did not work! Seemed to work. Gmail worked, GMaps worked, but as soon as I installed whatsapp, it zombied out again with crashes all around! Not even settings would work!
Anyway, so trying a different approach now. Got couple of good zips of official update. The guys say I have to get stock recovery and on of these good images would work fine.
I don't have one click recovery tool here on this laptop and I can't install it since I don't have admin access. So I googled if one can use TWRP to flash stock recovery. Google says yes. So doing that I got to Stock recovery. Now I'm trying the stockest stock firmware that I have downloaded from Nubia official website.
The recovery has accepted this image too. Lets see if it works or not! Fingers crossed!
Some more time later...
Okay! Flashing successful! Lets see if it loads and is stable!
Hmm what's this? Stuck at Be yourself for like 10 mins. Google google. Hmmm, it's okay - phone is optimizing apps. Okay!
Some more time later...
Hmm phone is alive with Nubia UI 4 and Android Lollypop. Feels smoother too! Lollypop is definitely lighter than Marshmallow! By this logic Android Z will need a a supercomputer! Huh, logged in to google, connected WiFi, installed whatsapp - no dreaded app stopped dialogs yet!
Lets update all google apps and see. Looks okay. nd in Accounts section there's a button to remove google account too!! Cool!!! Alright then, my experiment is successful!!!
Cheers!!!

Thursday, March 15, 2018

.Net Solutions, DLL's, Build orders etc

Got to learn some new thinigs about Visual Studio today. Basically I wanted to build a library and integrate it into an existing solution. 
Steps: 1. Open Solution, Add new project of type "Class Library". Then create namespaces, classes, static library functions etc. Build it. Build OK, DLL ready.
Step 2: In other project ( where DLL is to be used), Add reference, Browse, Select Newly created DLL. Add using for DLL namespace. Call function in DLL. Call OK. Build this project. 
Hiccup! Issue no 1: DLL project was using newer .Net version while other project (Lets say App project) was using slightly older version and so it's build was giving error - Type or namespace for Library namespace not found. 
Bit of googling gave me solution. So set Lib's .Net version to same as App. Build OK. 
Next step: Verify solution is building correctly. For this there's something called build order to consider. For this in VS there's a setting - "Project Build Order...". This can be reached after right clicking on Solution in Solution Explorer. 
This opens a small dialog box where you can setup project dependencies and with correct dependencies appropriate build order is prepared. Here I set the app project to be dependent on Lib and the build order was updated accordingly. Voilla! 
So I rebuilt the solution and it all worked out great! 
Feels good when things work without much fuss!!!
Cheers!!!

Monday, March 5, 2018

Maybe nothing can fix it [SailfishOS Enterprise WiFi]

So yesterday I re-updated my AquaFish from 2.0.4.3 to 2.0.5.6 and then to 2.1.3.7. This halfway update was because 2.0.5.6 is a major update and we can't directly update from 2.0.4.3 to 2.1.3.7. So instead we have to update in steps. 
Anyway, just reached office and checked the connection. Sadly nothing! I checked dmesg output and there was a boatload of vos_malloc errors. So looks like there's some bug somewhere where something critically dies and the connection fails. 
Anyway my curiosity is satisfied. Maybe the one working connection instance I observed was a fluke, a mere chance, an aberration and looks like the universe has fixed it! 
Alas! Sometimes we can do with some error! Cheers!

Wednesday, February 28, 2018

Jolla Recovery - last resort for Enterprize WiFi bug

So today I decided to take the plunge and completely reset my Aquafish to recovery image to see if I can get the enterprize WiFi working.
A bit of background: SFOS did not support Enterprize WiFi using TLS etc back in 2.0.5.6. In 3.1.2 I guess, they added support for that. I have Work WiFi at office that uses TLS with MSChapV2. And on 3.1.2(or whatever that release was), I did manage to connect to my Work WiFi once. The Captive portal login appeared in SFOS browser, I logged in and was able to access the internet. But after that one time it never connected.
So I reset Jolla, upgraded once again and tried but to no avail. Now Recovery image reset is something else. It does not just reset the settings. But rather wipes out the partitions and writes partitions from recovery image.
The process is straight forward. Remove the battery and after inserting use [power] + [vol+] button to power device in Recovery Mode. The phone displays message to conenct to PC using USB cable and ssh to it's recovery IP.
I used ubuntu for this and it worked brilliantly. The phone is reset to 2.0.5.6. Lets update and see if Enterprize WiFi works or not! Cheers!

(Meld, Gnome, Crap) All in one sentence

I have been using Meld for about 3 yrs. And it has been solid. Until today! Actually what happened is I have not been using Linux and Meld for last 3-4 months. Today I required some code merging in Linux. So I fired up Meld and started going at it. I was about halfway, when suddenly my laptop hung. Wait! Ubuntu never hangs! So after struggling to open a System Monitor windows for five minutes I went through the apps and voilla. It is meld! WTF!
Then I saw that Meld has opened separate threads for all the docs I have opened and merged and closed. But it conveniently forgot to kill those threads and each thread was eating about 120MB memory and there were about 30+ of them. Gods!
Anyway, I killed Meld and the system recovered from the butchery. Then just to coonfirm I opened the folders in merge and confirmed that my analysis is correct that indeed for each opened file a new thread is getting created and when file is closed it's not getting closed. Ok, I check the version - it's 3.18. I go to the development site to file a bug. Found a link. That took me to a gitlab.gnome.org site needing login. I tried G+ login - does not work. Tried to register - Email is not from allowed domain. Tried five different EMails - same error. No way to report registration error. And so by proxy, no way to report the bug! Great Gnome and Meld people.
Frustrated, I opened terminal and ran below command:
sudo apt purge meld
Then I installed Kompare. It installed 65MB of kde crapware libs. And Kompare is a pain in the ass to use. Thanks for the so superb unintuitive interface. I mean I could not find a keyboard shortcut for merging text. Guys!!!
Still with pain in my neck - I was done after taking three times the time and efforts that would a working Meld have saved! Alas!
Does gnome infect other nearby projects with its crap? god knows!!! 

Tuesday, February 27, 2018

SFOS new update, SFOS 3 and new tablet in family

Last week a new update for SFOS is released to early subscribers. Thats v2.1.4 Lapuanjoki. I have been using v2.1.3 kymijoki on my Intex Aquafish for a while as my main phone. And I think SFOS is god enough for daily use. I have a few android apps like - WhatsApp for communication, WPS Office for PDF EBooks, A Better Camera as better Camera app, todoist as TODO app and that's it. I'm getting decent battery life on an average of two days. Of course I had to shoot down couple of problems of errant android apps and downgrade Play Services version. So now the android apps display an annoying pop-up for upgrading Play Services, but they work fine beside this. The upgrade breaks a lots of things - causes battery drain, instability etc etc. So I'm better off with older version and few annoying pop-ups. 
Of course I can always get rid of android apps, but right now that's not possible, so I live with compromises. On system front the few things I miss are - apps should be able to be pinned to desktop so that close all won't close these apps. But that's something trivial. And SAILFISH 3!!! I'm excited! Lets see when it gets out and when my humble Aqua Fish gets it. 
New tablet - wife got this Alcatel Pop 4 tablet for her German Language study. Apparently the lingo apps hog a lot of her phone memory and we were thinking of getting a tablet anyway. It's a decent tablet, 10 inches, with decent octa core processor, 2GB RAM and 16GB ROM. Good enough. Detail specs below:
Model: Alcatel Pop 4 10 4G Tablet
Weight: 449g
Display: 10 Inch (1920 x 1280) IPS LCD Capacitive Touchscreen (Full Lamination), Scratch Resistant
CPU: 1.4GHz Octa Core Qualcomm Snapdragon 430, with Adreno 505 GPU
RAM: 2GB RAM with 16GB ROM expandable to 32GB more with SD Card slot.
Android 6.0 (Marshmallow)
Cameras: 8MP Fixed Focus Rear, 5MP Fixed Focus Front
Battery: 5830mAh Li-Ion 
Network: 4G LTE, WCDMA, GSM with single Nano SIM slot.
Other features: Dual front speakers with Waves MaxxAudio, FM Radio, Miracast Support, 3.5mm headphone jack, supports USB-OTG.

Wednesday, February 14, 2018

Case of issues with Google Play Services on Sailfish

So few days back I started using my Intex Aquafish as my daily driver. The phone is great at a basic phone. Calling and internet works fine. Whatsapp also works fine and so does Google Drive. That's almost all the use cases for me.
But something threw a spanner in the works. I tried installing few more apps, and they get stuck at Installing screen. Then couple of days back I started seeing large battery drains by gms.persisttent.
After a lot of googling and searching I did not find much. But then today I hit the lottery. Found out that I someday mistakenly upgraded Google Play Services and that caused all this. Anyway, how to revert back. Big question. After fiddling out here and there, I found out that I have to search for Google Play Services in Store app, and from there I could downgrade Play Services.
Once that done and after testing half a dozen installs and checking battery draws in Battery Log app, I confirmed that this indeed fixes the works! Cheers!!!

Saturday, January 20, 2018

Using an Android phone with busted power button

I have a number of old phones. Mostly they just hang around in a box of all other computer hardware. I have two smartphones, one feature phone and one dumb phone. 
First one is Intex Aquafish. Great phone, but since it can't connect to my office network (Crazy!!!), can't really use it. 
Next one is Karbonn S1 Plus which is ancient now. Gifted this to sister, she used it for 2.5Yrs., and by then it was quite busted. Battery gone, frame cracked, power button barely working, and horizontal white lines on screen. I gifted another phone to sister. But this phone is not totally dead. I replaced the battery for 300Rs and reset the phone. Turns out it works fine as a standalone GPS navigator. So that's it. Its hanging around like that. 
Next one is a Nokia C5. This was the first phone I gifted to sister, before the Karbonn. It works fine, but no it's quite obsolete. No wifi, Symbian etc etc. But the thing is it's still a fine phone. I use this as mp3 player these days. Works great. 
I also have a Nokia 1280 dumbphone. But it's battery is dead and keyboard has all letters peeled off. So it's resting in the junk box. That's it. 

Coming back to the Karbonn S1 Plus. It's power button is almost dead. So I thought to see if there's something to be done on software side. After going through some links I found a nice app called Volume button to Power button. This triggers power button press on volume button press. It's not instant, but quite okay. And that means my main use case of unlocking the phone via power button is satisfied. 
There are a few other use cases like reboot and power on when phone is shut down. Few solution are provided for these too. Seem like it will work. Let's see. 

Friday, January 19, 2018

Not using Firefox anymore

Never thought I'll say bye bye to Firefox ever. But this week I did say bye bye. 
On pc Firefox is too slow and often unresponsive. Clearing profile and fresh install didn't help. 
On the other end, Vivaldi is so much more responsive, fast and light. Damn good. 
On mobile Firefox often won't connect to net. Don't know why. I'm using dolphin browser. Not as polished and with some weird preferences. But it works faster and is much lighter. 

So that's it. Adios Firefox. 

Wednesday, January 3, 2018

The case of a slow browser

I am an exclusive user of Firefox. Recently I got the Quantum upgrade. Firefox seems to have become faster. But it seems to have become more bloated. On my 1GB RAM entry level android, it often seems to be crawling. Same situation is on my laptop with 2GB RAM. The sites load fine but it just gets unresponsive once in a while. I have only one plugin - that is uBlock origin. And it's a necessity.
So I have decided to try other browser - something that's light and doesn't eat away the RAM like it's donated freely.
Lets see if I find anything.
The first one I tried out is Vivaldi. It's from Opera's former team. And it looks promising. I loaded gmail and google drive. It loaded quickly since I have good internet here. And the browser did not seem to be all that slow. Then I opened my tech blog and later opened one planning sheet which has quite a few excel formulas. At this point Firefox starts hitting RAM ceiling and starts getting slow. No such thing for Vivaldi. The RAM is peaked at 1.6GB out of 1.75GB. 
Well, I'm going to use this for a while and see how well it works out. 
Cheers!!!

Happy new year 2018

Not many posts for Dec 17. Well, 2017 was a good year for tech in my perspective. Not many things broke. The Lenovo G580 is still going strong, so is Sennheiser HD439. The pair of Soundmagic ES10's is holding out. Damn! They are one of the best cans I got hold of. These days I use them with an old Nokia C5 and they work beautifully.
So that's it! Bye bye 2017. Resolutions for 2018? Well, a lot of things need to change. I need to fix my health. That means getting couple of festering health issues treated. And start exercising. Well that's all for now. Adios!