The combination of touchscreen and NFC module is quite useful for many situations. For example, you may build a simple signup system or an advanced billing system which is a little more complex.

Here we’ll use Waveshare 3.5″ Touchscreen and ITEAD PN532 NFC Module. Both the prices of the two components are pretty fare and they can basically meet most of our requirements.

The Waveshare touchscreen comes with a DVK512 chip which doesn’t support SPI master-slave architecture. This means we cannot use the PN532 with SPI at the same time. Fortunately, ITEAD PN532 provides various interfaces including SPI, I2C and UART. I’ll show you how to make PN532 over I2C work with Waveshare touchscreen together.

続きを読む

Different from Windows 7, there isn’t an efficient way to manage Network Locations in Windows 8.1.
This problem can sometimes be quite annoying. For example, there may be an increasing number after your network name such as “My Network 2”, “My Network 3″… However you usually won’t use the legacy profiles once again so the storage of the configurations just becomes redundant.

I finally found the solution at Microsoft Technet, it’s quite easy and I’ll just do a memo here.

1. Run Registry Editor. (press Windows button + R, type regedit, click OK)
2. Go to this folder: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Profiles.

The Profiles folder will eventually give you all the network locations (past or recent) that you have used. Each network location is represented by a subfolder.

If you want to set up again the network locations when the network adapter connects to the network, delete all the subfolders of Profiles folder.

If you want to rename the network location, click on the right subfolder and edit the key named ProfileName and input the name you desire for the network location.

Thank Shiva Sharma for sharing.

phpMyAdminがSourceForgeから撤退した以上、今新しいphpMyAdminの更新スクリプトは必要になる。
この前にもごく簡単なスクリプトを利用してアップデートしたけど、今phpMyAdmin自身のサイトはhttp://xxxx/latest/downloadという固定型の更新リンクを対応してないから、今回の新しい方はアップデートチェックやバージョンの比較も対応しなきゃいけない。
さて、閑話休題、早速新しいスクリプトを紹介しよう。

.
├── current
├── latest
└── update_phpmyadmin.sh

初めての利用する前にはcurrentというファイルに今phpMyAdminのバージョンを書き込まなきゃ、じゃないとこのスクリプトは正常にバージョンの比較できなくなる。

user@host:~/scripts/phpmyadmin$ cat current
4.4.11

$PHPMYADMIN_HOMEと$VERSION_CHKこの2つの変数を変更することを忘れずにね

#!/bin/bash
SCRIPT_HOME=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
PHPMYADMIN_HOME="/var/www/phpmyadmin"
TIMESTAMP=`date "+%s%N"`
VERSION_CHK="https://domain.com/phpmyadmin/version_check.php?&_nocache=""$TIMESTAMP"

vercomp () {
    if [[ $1 == $2 ]]
    then
        return 0
    fi
    local IFS=.
    local i ver1=($1) ver2=($2)
    # fill empty fields in ver1 with zeros
    for ((i=${#ver1[@]}; i<${#ver2[@]}; i++))
    do
        ver1[i]=0
    done
    for ((i=0; i<${#ver1[@]}; i++))
    do
        if [[ -z ${ver2[i]} ]]
        then
            # fill empty fields in ver2 with zeros
            ver2[i]=0
        fi
        if ((10#${ver1[i]} > 10#${ver2[i]}))
        then
            return 1
        fi
        if ((10#${ver1[i]} < 10#${ver2[i]}))
        then
            return 2
        fi
    done
    return 0
}

if [[ `whoami` != "root" ]]; then
    echo "Please run as root"
    exit 1
fi

cd $SCRIPT_HOME
curl "$VERSION_CHK" 2>/dev/null | sed -r "s/.*version\":\"([0-9\\.]*)\".*/\\1/" > latest
CURRENT=`cat current`
LATEST=`cat latest`
echo "The current version is: $CURRENT"
echo "The latest  version is: $LATEST"
vercomp $CURRENT $LATEST
case $? in
    0) echo "No updates"; exit 0;;
    1) echo "You are ahead of the latest one?!"; exit 1;;
    2) echo "Updating to $LATEST from $CURRENT, are your sure? [y/n]";;
esac
read CONTINUE
if [[ $CONTINUE != "y" ]]; then
    exit 0
fi

wget --content-disposition "https://files.phpmyadmin.net/phpMyAdmin/$LATEST/phpMyAdmin-$LATEST-all-languages.tar.xz"
TAR_FILE=`find $SCRIPT_HOME -name "phpMyAdmin-*.tar.xz" -print`
if [[ -z $TAR_FILE ]]; then
    echo "Download failed"
else
    echo "$TAR_FILE is successfully download"
    tar Jxvf $TAR_FILE
    TAR_DIRECTORY=`find $SCRIPT_HOME -name "phpMyAdmin-*" -type d -print`
    cp "$PHPMYADMIN_HOME/config.inc.php" "$TAR_DIRECTORY/"
    rm -rf "$PHPMYADMIN_HOME"
    mv "$TAR_DIRECTORY" "$PHPMYADMIN_HOME"
    #do a chown if you need
    #chown user:group "$PHPMYADMIN_HOME" -R
    echo "phpMyAdmin successfully updated"
    rm $TAR_FILE
    echo $LATEST > current
    echo "All done"
fi