How to delete stucked Route53 zone created by ECS service discovery

It happens when I tried to delete the NS that created by ECS service directory, then this error shows up:

The resource hostedzone/Z1OWcan only be managed through servicediscovery.amazonaws.com (arn:aws:servicediscovery:us-east-1:561660628307:namespace/ns-c6lvlchj2gbcsobc)

If there are services hanging around the in the NS you can’t delete then you could try:

$ aws servicediscovery list-services
$ aws servicediscovery delete-service --id=
$ aws servicediscovery delete-namespace --id=

pip error after upgrade: ImportError: cannot import name ‘main’

Sometimes pip can be really sucks, after upgrade the pip version, then you call it afterwards, it will fail somehow.

$ pip install --user --upgrade pip
Collecting pip
  Using cached https://files.pythonhosted.org/packages/0f/74/ecd13431bcc456ed390b44c8a6e917c1820365cbebcb6a8974d1cd045ab4/pip-10.0.1-py2.py3-none-any.whl
Installing collected packages: pip
Successfully installed pip-8.1.1
You are using pip version 8.1.1, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
ImportError: cannot import name 'main'
$ pip
Traceback (most recent call last):
  File "/usr/bin/pip3", line 9, in 
    from pip import main
ImportError: cannot import name 'main'

The problem is easily can be resolved by doing this:

$ hash -d pip

Linux machine Failed to hibernate, “system via logind: Sleep verb not supported”

So after using fedora 28 for a while. I tried to configure my power management using xfce power management system.

Looking at these power management settings, are very simple explanation. I set my machine to hibernate or sleep mode when inactive for 16 minutes.

Saved the settings. then I closed the laptop lid, so it started to be inactive until the next 16 minutes. Supposed to be hibernated.

But it did not, instead…

I opened up my laptop, and there is this error:

System via logind: Sleep verb not supported...

It turns out that the states of the machine are not available for hibernate. You can check them out with this simple command:

$ sudo cat /sys/power/disk
[disabled]

Now, that’s a problem. The machine cannot be hibernate, nor suspend if the output is disabled.

The solution is quite simple. Reboot the machine, then enter BIOS mode. This one is requires the BIOS setting, secure boot to be disabled.

Secure boot setting in BIOS

Switch the secure boot in BIOS setting to Disabled. Then reboot the system.

After I rebooted the system with secure boot disabled, the output of /sys/power/disk now is contains more than one, including suspend/hibernate.

$ cat /sys/power/disk 
[platform] shutdown reboot suspend test_resume

The machine’s power management system now can run the machine with hibernate mode.

WordPress still cannot Establishing a Database Connection – Error

Have you ever experiencing this problem like this? after your install wordpress, setup anything, webserver, database, everything is completed. Yet, wordpress still cannot establishing your database connection.

Eventhough you’ve already make sure that your database is up and running (I’m using MySQL) and your port is already open, though.

Trust me! I’ve done anything properly, I spent hours just to figure out what the root cause was and after some googling and stackoverflowing, I found this problem was due to SE in linux.

$ sudo setsebool -P httpd_can_network_connect_db=1

Thanks in advance SElinux!

Fix google gms services version conflict

So, this error showed up when I tried to update gms google services for push notifications.

Error:Execution failed for task ':app:processDebugGoogleServices'.
> Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 9.0.0.

Currently, I compiled android.gms:play-services with version 8.3.0 which is not allowed at this time cause I have different version level within my build.gradle file. To fix this, you just need to update com.google.gms:google-services version inside both build.gradle files.

build.gradle file in project level :

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.1'
        classpath 'com.android.tools.build:gradle:2.2.0'
        classpath 'com.google.gms:google-services:3.0.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

inside the build.grade app level file, I added compile ‘com.google.android.gms:play-services:9.0.0’ inside dependencies tag and apply plugin: ‘com.google.gms.google-services’ at the end of lines. So, it looks like this:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "com.myLambdaapp.myLambdaapp"
        minSdkVersion 14
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'
    compile 'com.google.android.gms:play-services:9.0.0'
}
apply plugin: 'com.google.gms.google-services'

Django table is marked as crashed and should be repaired

My django app is showing 500 because one of the tables in database marked crashed and should be repaired.

InternalError at /

(145, "Table './dbname/django_session' is marked as crashed and should be repaired")

I thought it was just an usual error from mysql and needed to restart but it wasn’t.

Solutions:

 Login to mysql, select your dbname, and use this command:

USE user_base;
REPAIR TABLE TABLE;