Fix InnoDB error: The InnoDB memory heap is disabled

160826 14:07:30 mysqld_safe Number of processes running now: 0
160826 14:07:30 mysqld_safe mysqld restarted
160826 14:07:30 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
160826 14:07:30 [Note] /usr/sbin/mysqld (mysqld 5.5.50) starting as process 24167 ...
160826 14:07:30 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
160826 14:07:30 [Note] Plugin 'FEDERATED' is disabled.
160826 14:07:30 InnoDB: The InnoDB memory heap is disabled
160826 14:07:30 InnoDB: Mutexes and rw_locks use GCC atomic builtins
160826 14:07:30 InnoDB: Compressed tables use zlib 1.2.8
160826 14:07:30 InnoDB: Using Linux native AIO
160826 14:07:30 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137363456 bytes) failed; errno 12
160826 14:07:30 InnoDB: Completed initialization of buffer pool
160826 14:07:30 InnoDB: Fatal error: cannot allocate memory for the buffer pool
160826 14:07:30 [ERROR] Plugin 'InnoDB' init function returned error.
160826 14:07:30 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
160826 14:07:30 [ERROR] Unknown/unsupported storage engine: InnoDB
160826 14:07:30 [ERROR] Aborting

160826 14:07:30 [Note] /usr/sbin/mysqld: Shutdown complete

160826 14:07:30 mysqld_safe mysqld from pid file /var/run/mysqld/ ended
160826 14:07:47 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql

If you have something like this, add this entry innodb_use_sys_malloc = 0 into the my.cnf and restarted the MySQL.

How to set locale variables automatically

On macOS of course, because in Ubuntu and other distro you probably already have. So… open terminal and create a new file:

sudo nano ~/.profile

Then paste this two line and save:

export LC_ALL=en_US.UTF-8  
export LANG=en_US.UTF-8

You need to have the mark on “Set locale environment variables on startup” like in the screenshot.

How to make Xiaomi gateway compatible with HomeKit

This is very simple and there are a lot of way to do so. You need:

– Raspberry Pi (3 or Zero it’s the same, you just need to install Raspbian)
Xiaomi gateway (of course)
– iPhone or iPad (well it’s the purpose)

First of all, connect ssh to it with:

ssh pi@raspberrypi.local

Then do the update and install the dependence:

sudo apt update
sudo apt upgrade
sudo apt install libavahi-compat-libdnssd-dev

Now install homebridge:

npm install -g homebridge

And then the plugin:

npm install -g homebridge-aqara

Ok now it’s ready, open the app Mi Home and enable the developer mode (save your username and password). Edit this file with:

sudo nano ~/.homebridge/config.json

And paste (with your sid and password):

 "platforms": [
   "platform": "AqaraPlatform",
   "sid": ["6409802da3b3"],
   "password": ["02i44k56zrgg578b"]

That’s it! Run homebridge from the terminal and go to the Home app from your iPhone, add Homebridge (with the password that the terminal shows you few second ago).

If you have any questions, feel free to ask in the comment’s section.

How to install Raspbian

It’s so easy nnowadays that you can even image how difficult was (for the noobs, the pro are already pro).

Go here and download the last version of NOOBS: and when it’s finished, unzip the archive.

Than insert the microSD (or SD if you have a old one) in your computer, format in FAT32 and rename it just BOOT (all capital).

Now copy and paste all the folder and file that was in the zip archive… and it’s done! You can safely remove the memory and insert into your Raspberry Pi.

Follow the instruction at screen and you are ready to go!

How to read and write file in Swift

In Swift 3 the syntax is a just a few different than the 1 or 2 version:

let file = "file.txt" //this is the file. we will write to and read from it

let text = "some text" //just a text

if let dir = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first {

    let path = dir.appendingPathComponent(file)

    // writing
    do {
        try text.write(to: path, atomically: false, encoding: String.Encoding.utf8)
    catch {/* error handling here */}

    do {
        let text2 = try String(contentsOf: path, encoding: String.Encoding.utf8)
    catch {/* error handling here */}


How to sniff iPhone web traffic with Wireshark

Open Xcode and click on top Devices like in the image below:

Devices from Xcode

Copy the identifier (in the black row):

Identifier iPhone from Xcode

Now open the terminal and paste:

rvictl -s idcopyed

If it show:

Starting device identifiercopiato [SUCCEEDED] with interface rvi0

Open Wireshark and start sniffing from rvi0. Voilà!

How to delete cache and free space on Xcode

If something goes wrong or the simple Clean and rebuild does not work, you must delete the contents of these folders right now (carefully).

~/Library/Developer/Xcode/iOS DeviceSupport
~/Library/Application Support/MobileSync/Backup

Thanks to the source.