Man YeeGeology ParkBondi Beach at 45.3C!Summer Palace - BeiJingMykonosLotus purpleLotus pinkLotus pink yellow

       水泛金光 萬宜水庫

中國香港世界地質公園

Hong Kong Global Geopark of China

45.3°C @Bondi Beach!

日落 頤和園-北京

The Unforgettable @Mykonos

紫蓮•迪欣湖

Secret of Mounting USB Storage on Cisco Linksys Router

Issue:

Using either Dolphin File Manager or ftp, copying a directory of around 70GB to an USB storage formatted in NTFS stopped mid-way without notification at less than 10GB copied.

Checking the system log (/var/log/messages), the following was supposed to be relevant:

  • quiet_error: 20 callbacks suppressed
  • Buffer I/O error on device sdc1
  • lost page write due to I/O error on sdc1

Though it's not easy to figure out what went wrong, I think it's the front USB port/channel issue on my HP. The source directory is another USB drive connected to the rear USB port. I have tried the rear USB port to test if it's the port issue. 

Solution:

  1. remove the USB storage and connect it to the router's USB port 
  2. Mount the USB storage as samba 

Config:

  • OpenSUSE       12.3
  • Dolphin              2.2
  • KDE                  4.10.5
  • Router              Linksys  EA6700
  • FileZilla             3.7

Tricks:

  1. Even after using a Windows 7 PC to full format the USB drive, fault still happened.
  2. Merely typing smb://192.168.1.1 on Dolphin may see the samba share content but cannot write on any samba directory
  3. Mounting the samba share requires stating the share directory in the command
  4. To let non-root user to write on the samba share, it's not permitted to mount the samba share from non-root user, chmod to 0777 had no change to directory permission state, but rather mount it by root and state in the option the uid of the linux user, i.e.

mount -t cifs -o uid=[userid], rw //192.168.1.1/[share] /[mount_pt]

Though the transfer speed between the PC and router fluctuated a lot from 7MB/s to 36MB/s (using USB2.0 instead of USB3.0), it's better to have it done eventually than using the USB port on the PC with stable transfer speed around 25MB/s and then I/O died down quietly. 

Using NTFS as the USB file system as it's good to be share among Linux and Mac as it's mature and both Linux and Mac have ntfs-3g utility to read and write NTFS drive. exFAT may be an alternative but not easy to find a way to deploy this Windows proprietary file system.

Blog tags: 

Mac Mini Must Read! Cheap & Nice Way to Cool Down

Issue:

Mac Mini' s over heat problem has been known for a while. Though the chassis is metallic, the components are closely packed and ventilation fan is small, over 90°C is quite common when processing graphics or encoding video files. My case was that the Mac Mini (mid 2011) would hang after CPU over-heating for a while even boosting the internal fan speed to over 5000rpm. Worst situation is not bootable for a while.

Solution:

Instead of placing the chassis horizontally, place it on a HK$65 metallic-like stand slightly tilted. Now on average CPU temperature is around 40°C even the fan speed is less than 3000 rpm, and around 70°C on heavy loading.

Configuration:

Mac Mini:  Quad-core 2GHz i7 CPU, 256GB SSD

Tricks:

There are many stands suitable for this task, but many of them are more expensive than this stand.

 

Blog tags: 

iPhone WhatsApp Intermittent Missing Message Input Window

Issue:

Suddently found that the message input window was missing. Instead there're only labels as Earlier and Later appearing at the bottom of screen, and you cannot find a way to input your message to send out.

Solution:

  1. Drag to the top of the message history
  2. Click "Info" at top right corner
  3. Drag to bottom of the screen
  4. Click "Send Message"

Config:

  • iOS 7.1
  • WhatsApp 2.11.8

Tricks:

WhatsApp is supposed to be a user-friendly app, but it's frustrating that when you want to send out message immediately as a reply to a friend, you cannot find a way to input any message.

Blog tags: 

zPanel Webmail Password Change

Issue:

zPanel is using RoundCube as the webmail frontend. It's clean and user-friendly. However, if it is going to be used by ordinary mailbox users without zPanel admin access, users cannot change their own password through RoundCube. Deploying the Password plugin is not easy for zPanel as RoundCube is an open source webmail software, and it is not dedicated for zPanel.

Solution:

  1. Open /etc/zpanel/configs/roundcube/main.inc.php
  2. Deploy password plugin by modifying: $rcmail_config['plugins'] = array() -> $rcmail_config['plugins'] = array('password')
  3. change dir to /etc/zpanel/panel/etc/apps/webmail/plugins/password/
  4. Copy config.inc.php.dist to config.inc.php
  5. Change the line: $rcmail_config['password_driver'] = 'sql' -> $rcmail_config['password_driver'] = 'zpmail'
  6. Add the following driver contributed by setris.
  7. Name it as zpmail.php and put it under directory ../plugins/password/drivers/:

<?php

/**
 * ZpanelX SQL Password Driver
 *
 * Driver for passwords stored in SQL database
 *
 * @version 1.1
 * @author 
 *
*/
class rcube_zpmail_password
{
    function save($curpass, $passwd)
    {
        $rcmail = rcmail::get_instance();
        $local_part  = $rcmail->user->get_username('local');
        $domain_part = $rcmail->user->get_username('domain');
        $username    = $_SESSION['username'];
        $host        = $_SESSION['imap_host'];
        // convert domains to/from punnycode
        if ($rcmail->config->get('password_idn_ascii')) {
            $domain_part = rcube_idn_to_ascii($domain_part);
            $username    = rcube_idn_to_ascii($username);
            $host        = rcube_idn_to_ascii($host);
        }
        else {
            $domain_part = rcube_idn_to_utf8($domain_part);
            $username    = rcube_idn_to_utf8($username);
            $host        = rcube_idn_to_utf8($host);
        }
        $sql = 'SELECT password FROM mailbox WHERE username="'.$username.'"';
        $host = "DBHOST"; // Usually localhost
        $dbName = "zpanel_postfix"; // your ZPanelX postfix database. Default value here
        $dbUser = "DBUSERNAME";
        $dbPass = "DBPASSWORD";
        try {
            $db = new PDO("mysql:host={$host};dbname={$dbName}", $dbUser, $dbPass);
            $db->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING );
        } catch (PDOException $e) {
            //echo 'Database error: '. $e->getMessage() . '';
            return PASSWORD_CONNECT_ERROR;
        }
        $res = $db->query($sql);
        $result = $res->fetch();$pass = $result["password"];
        $hash = str_replace("{PLAIN-MD5}", "", $pass);
        if (md5($curpass) != $hash)
        {
            // echo "Password mismatch error";
            return PASSWORD_ERROR;
        }
        $pass = "{PLAIN-MD5}".md5($passwd);
        $sql = 'UPDATE mailbox SET password="'.$pass.'" WHERE username="'.$username.'"';
        $res = $db->query($sql);
        if ($res) {
                return PASSWORD_SUCCESS;
        }
        return PASSWORD_ERROR;
    }
}
Don't forget to change parameters: $host, $db_User, $db_Pass above appropriately.
Config:
  • zPanel   10.1.1
  • RoundCube   0.9.5
  • Password plugin  3.2
Tricks:
There are many drivers in Password plugin inlcuding the default: sql, but none of them works with zPanel. That is the reason why we need to create new driver for the plugin.
 

WordPress qTranslate Add Language Select on Header

Issue:

qTranslate is the best free multilingual plugin of WordPress, but its standard method to include language selector is adding widget. One deficiency of WordPress is that most themes do not provide many defined widget areas (same as regions in other CMS). In case the language select is to be displayed on the header, then some codes modification has to be done.

Solution:

1.  Create child theme (if not yet available)

2.  Copy header.php from mother theme to child theme

3.  Include the following codes before </div></div></header> of file header.php under child theme

<div style="float:left; margin-top:25px; margin-left:40px;">

<?php qtrans_generateLanguageSelectCode('both'); ?>

</div>
4.  To remove the bullet points at the front of each language, add the following codes at the end of file style.css under child theme:
.qtrans_language_chooser { list-style-type:none }
.qtrans_flag { border:1px solid #b6b6b6 }
#qtranslate-chooser li {
margin-bottom: -3px;
}
Config:
  • WordPress    3.8.2
  • qTranslate    2.5.39
  • shopifiq theme 2.0.8

 

Correct Pricing Tables Ready Plugin's Currency Position

Issue:

Ready! Pricing Tables is a great free plugin for making price tables in WordPress, but its gray template has a weird behaviour that the currency sign appear after the price instead of leading the price.

Solution:

Open the file under the plugins directory:  pricing-table-ready/constructor/gray/column.php

Change line 2 from:

...{prt Price} {prtCurrency}...

to become:

...{prtCurrency}{prtPrice}...

Trick:

Under WordPress admin panel, the file to be modified does not appear when you click "edit" to the plugin Pricing Tables Ready.

Pages