Getting wireless to stop disconnecting on HP ProBook 430 G2 on Ubuntu 14.04 (Linux)

The default wireless driver settings for the HP ProBook 430 G2 on Ubuntu Linux 14.04 makes the internet connection drop frequently and the wireless connection first works again when the machine has been rebooted (or the wireless netcard driver has been removed and added again). The solution is to change the driver settings (disable e.g. power save mode) – here is a guide for your convenience and such that I don’t forget how to do it 🙂

This guide is only made for “HP ProBook 430 G2”. It might work for other computers, but the wireless netcard driver probably has a different name and different settings. Please tell me if you get it to work for other models 🙂

1. Find the wireless netcard model – open a terminal using CTRL+ALT+T and write the following command:
ls /sys/class/net/wlan0/device/driver/module/drivers

Mine says “pci:rtl8723be”, where “rtl8723be” is the driver name. If you have a different driver, then you need to replace “rtl8723be” in the rest of this guide with whatever your terminal outputs after the colon (pci:).

Now we need to check the driver settings – this requires the program sysutils that is not installed by default – try to write the following command in the terminal:
sudo apt-get install sysfsutils

Write the following command in the terminal to get the current driver settings (replace “rtl8723be” if you use a different driver):
systool -v -m rtl8723be

In the “Parameters:” section, there should be a number of settings. Look at the value that is written next to the power save settings “fwlps” and “ips” – if it says “Y” or “1” then that is probably the reason why your internet connection gets disrupted.

You can see what the two settings means by writing the following in the terminal (replace “rtl8723be” if you use a different driver):
modinfo rtl8723be

Disable power save by writing the following in a terminal (replace “rtl8723be” if you use a different driver):
echo 'options rtl8723be ips=0' | sudo tee -a /etc/modprobe.d/rtl8723be.conf
echo 'options rtl8723be fwlps=0' | sudo tee -a /etc/modprobe.d/rtl8723be.conf

Remove and add the wireless netcard driver by writing this in a terminal (replace “rtl8723be” if you use a different driver):
sudo rmmod rtl8723be && sudo modprobe rtl8723be

Verify the new settings by once again writing this in a terminal (replace “rtl8723be” if you use a different driver):
systool -v -m rtl8723be

In the “Parameters:” section, “fwlps” and “ips” should now be “N” and your internet connection should stop crashing. Feel free to post a comment 🙂

MySQL/PHP character encoding errors (e.g. æ,ø,å) – import, connection, table encoding and html meta header

Today I’ve got four hints that usually solves the character encoding errors I encounter with MySQL and PHP (usually triggered by the special Danish vowels æ,ø,å):

  • PhpMyAdmin import: use the official import function rather than executing crude sql inserts – because then you can specify the character encoding instead of using the default one which is NOT UTF-8.
  • Set encoding for PHP-MySQL connection: Here is an example:
    $conn = mysql_connect('localhost', 'mysql_user', 'mysql_password');
    mysql_set_charset('utf8',$conn);

    Link to php.net reference.

    If you use the (much better) PDO db access layer, then you can just add an argument to the connection call:
    $conn = new PDO('mysql:host=' . $hostname . ';dbname=' . $dbname, $username, $password, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));

  • Make sure that the MySQL database and tables are UTF-8 encoded: Use the following SQL-commands:
    ALTER DATABASE db_name
    CHARACTER SET utf8
    DEFAULT CHARACTER SET utf8
    COLLATE utf8_general_ci
    DEFAULT COLLATE utf8_general_ci;

    ALTER TABLE tbl_name
    DEFAULT CHARACTER SET utf8
    COLLATE utf8_general_ci;

  • (x)HTML meta header character encoding: add this in the head section of the HTML code:
    <meta http-equiv="Content-type" value="text/html; charset=UTF-8" />

If you have got a question or more tips then please post it below, then I will update my post 🙂