Where to go now that xiaomi.eu EOL’ed Redmi 2 or How to make the global rom work on 2014813 wt88047

xiaomi.eu was a good rom until it EOL’ed my phone. I thought, why not use the global rom from now on? My phone is compatible with Global, right?

Wrong! It boots all right but you won’t have service because the rom doesn’t support the phone’s modem.

If Global won’t work, China rom will, right?

Wrong! This rom doesn’t support the modem either.

WTH!? Turns out there are different versions of the phone for different Chinese carriers, this phone is for China Mobile, and none of the roms on en.miui.com is compatible with the phone.

What’s the solution? Use fastboot to flash only the modem support package (driver?). It should work, right?

Partially wrong. You get service all right but settings won’t open and any attempt to uninstall an application will reboot the phone. What’s wrong?
The modem support package is wrong, that’s it. I don’t know why but all the packages I found online were incompatible with the phone.

The solution:
Take the modem support package from the xiaomi.eu rom (thanks a lot for the file guys) and use this command to flash the file:
fastboot flash modem NON-HLOS.bin

To put the phone in fastboot mode turn it off and then on when volume down is held until the phone vibrates.
Here is the file extracted from the xiaomi.eu rom.

Everything works now. Took me a day of fiddling but it was kinda fun. Hope it helps.

Plum Keyboard KB84 KB87 and KB108 Programming Application and User Manual

I bought a really nice keyboard called Plum 87EC-S which is similar to Noppoo and Royal Kludge offerings. It has adjustable capacitive key switches and it is fully programmable.

Since it was very hard to find the programming application and English user manual of the keyboard I’m putting them up here for others to use:

KB84
KB87
KB108

Thanks go to Steven Dong from EZ MANDARIN SHOPPERS on Aliexpress for finding the software behind the Chinese firewall 🙂

Disk Usage Analyzer for Linux *command line* or Where has all my space gone?

Pick a directory you want to analyze and run ncdu . Yes, with the dot. It should look like that:
ncdu screenshot from the application's website
If you don’t have ncdu installed, install it.
If you can’t, you can use the simpler standard utility du like that: du -hs *
-h makes the output humanly readable, -s tells du that you want to see the total size of items without listing every directory in the file system tree, and * says that you want du to operate on all of the items in the current directory.

The output will be something like:
xxM some_directory
xxM some_file
xxG another_directory

Repeat if necessary for sub-directories.

How to make Windows command line (cmd.exe) resizable the quick way

Windows command line window is resizable only vertically. If you want to resize it horizontally you have to change its settings, which takes time and is permanent.
A simple and quick trick will enable a command line window to be resized for one session:

  1. Run wmic
  2. Resize the window
  3. Press Ctrl+C

If you don’t skip step 2 your window will stay resizable.

How to install XBCD on Windows 10 or any other unsigned driver

XBCD allows using the original Xbox Controller S on Windows. Windows 10 doesn’t allow installing unsigned drivers and XBCD has an unsigned driver. In order to instruct Windows to allow the installation you’ll have to:

  1. Press Start
  2. Click on Power
  3. Hold down Shift and press Restart
  4. Navigate to Troubleshoot -> Advanced options -> Startup Settings and press Restart
  5. Wait for Windows to restart and when prompted press 7 for Disable driver signature enforcement and wait for Windows to come up
  6. Install XBCD and allow it to install the driver
  7. Restart

Windows 8.1 update fails repeatedly with error 800F0922

Took me a while to figure this one out.

The reason for the error was insufficient space in the Windows System Reserved partition. I had to shrink my C drive and expand the System Reserved partition. (I used GParted from Linux, you can use a boot CD like PartedMagic or whatever method works for you).

Windows boot might break because of this. You’ll get error 0xc0000225.

You’ll have to boot from a Windows 8(.1) installation media, get to the command line and then:

  1. Run diskpart
  2. Type select disk 0 (0 is the number of the drive)
  3. Type list partition to see make sure this is the right drive and to find the system reserved partition number.
  4. Type select partition 1 (change 1 to the reserved partition number)
  5. Type active
  6. Type exit to close the tool
  7. Run bcdboot C:\Windows (change C to the partition where Windows in installed).

Windows should boot now. You can use EasyBCD to remove the old unbootable BCD entry.

Hope it helps.

Windows 8 and 8.1 don’t shutdown

One day my Windows 8.1 stopped shutting down. Restart works but shutdown seems to just turn off the screen after writing “Shutting down”. Clicking the mouse wakes the computer up at once.

This bug seems to be a feature, weirdly, a counter useful one in my opinion. It makes sure that you can turn the computer back on quickly by not shutting down. I can see the use in tablets but this is a PC. Really stupid decision.

Anyway, you can turn it off.

  • Press ‘start’
  • Start typing ‘Change what the power buttons do’ and when it appears click it
  • Click ‘Change settings that are currently unavailable’
  • Untick ‘Turn on fast startup (recommended)’

In my opinion, turning this on by default on PC’s is a stupid decision.

How to sync a Sandisk Sansa without a music manager

I’ve had enough of music managers. One supports only iPhones, one syncs only playlists, one doesn’t detect devices, one can’t cancel an accidental whole drive sync, etc. I know they sometimes work, I also used them in the past but this time they simply refused to work as I wanted.

I tried MediaMonkey, MusicBee, Windows Media Player and a few others, until I thought, why not use a simple sync application? You know, from the same category as rsync.

I looked what is available for Windows and found something interesting from Microsoft: Microsoft Sync Toy.

It allows you to select two folders, choose if you want to just copy or also delete from the destination folder and that’s about it. No hassles, simple, just as I like.
Note that you have to set your music player to connect as an MSC device instead of MTP. This means connect as a drive instead of a media device.

This is what it looks like:
sync_toy

Admit that you haven’t thought of it 🙂

Android – how to make UI values survive rotation

When programming for Android, you have to take into account that your application will be killed, paused and recreated without your consent. This is because of the nature of phones which have less memory and move from one task to another without the ability to support everything at the same time.

The example I’m going to take is screen rotation. When the screen rotates, the visible activity gets recreated. How do I know that? I have two Spinners on it, one with an adapter that changes according to the other’s selection. With each rotation I lost the current selection of the second Spinner. I added some Toasts to the code and found that onCreate() is being called upon orientation change. The first thing that comes to mind is to save the selection somewhere and restore it after the recreation.

There is a facility for that. Have you seen the parameter that your onCreate() gets?
protected void onCreate(Bundle savedInstanceState)
This savedInstanceState is a ‘bundle’ which means a space that Android gives your application to save some info between recreations of your activities. There are also two methods you can use to put the save and restore code in:

@Override
public void onSaveInstanceState(Bundle savedInstanceState)
{
    super.onSaveInstanceState(savedInstanceState);
    savedInstanceState.putInt("numberOfThings", num);
    savedInstanceState.putInt("anotherNumber", numnum);
}

@Override
public void onRestoreInstanceState(Bundle savedInstanceState)
{
    super.onRestoreInstanceState(savedInstanceState);
    num = savedInstanceState.getInt("numberOfThings");
    numnum = savedInstanceState.getInt("anotherNumber");
}

This didn’t help me completely because it was only then that I realized that onCreate is called for every rotation and in onCreate I initialized my UI elements to their default values. I tried putting num = savedInstanceState.getInt("numberOfThings") in onCreate to load the previous values but got a null reference exception on the first run because savedInstanceState is not initialized if this is the first run. The complete solution was to ditch onRestoreInstanceState and use only onCreate(). I set the default values in variables, and then did:

if (savedInstanceState != null)
{
    // Load variables here and overrite the default values
}

The rest of the initialization stayed as it was.

So the complete solution is:

  • Save the values you need in class members using onSaveInstanceState
  • In onCreate() restore the values if savedInstanceState != null and use them for initialization

That’s all folks.

How to create a Windows 8 / 8.1 / 10 bootable USB drive installation media

If your computer doesn’t have an optical (DVD) drive, how do you install Windows?

  • Go to another computer with a DVD drive.
  • Use ImgBurn to create an .ISO file from your Windows installation DVD. (you can use an alternative application if you want)
  • Don’t bother with Windows 7 USB/DVD download tool. Use Rufus. It’s perfect. You give it the .ISO file and a flash drive (your USB drive) and it will turn your flash drive into a Windows installation media.
  • Boot from the flash drive and install Windows.

Rufus