Friday, 12 January 2024

How to print out log entries that have more than two lines?

to print out the entries in server.log:

 gawk -v RS= '(gsub(/\n/, "&") > 2) { print; printf "\n" }' server.log

 

to print out the entries in all files (oldest first, newest last):

ls -tr | while read p; do cat $p; done | gawk -v RS= '(gsub(/\n/, "&") > 2) { print; printf "\n" }'

Friday, 31 March 2023

How to convert PDF file to TXT file on CentOS 7 ?

yum install poppler-utils

pdftotext -layout test.pdf - | awk '!NF{print "\n"}END{print "\n"}1' ORS=" " | tr -s ' ' > test.txt

Thursday, 3 November 2022

How to generate a random password quickly in BASH?

To generate a 32-chars random password with letters and digits:

openssl rand -base64 128 | tr -dc [:alnum:] | cut -c -32

Monday, 14 February 2022

How to share a folder with your minimal CentOS guest in VirtualBox?

 

  1. yum install bzip2 kernel-devel gcc make perl
  2. click 'insert Guest Additions CD Image ...' from VirtualBox Manager's Devices menu;
  3. mount /dev/cdrom /mnt
  4. cd /mnt
  5. ./VBoxLinuxAdditions.run
  6. reboot
  7. add a shared folder, say 'temp', to the guest from VirtualBox Manager's Devices menu;
  8. mount -t vboxsf temp /mnt

Wednesday, 3 April 2019

winword is freezing after pasting from followed by closing powerpoint on Windows 10

With 'Analyse wait chain' from task manager, you can see that winword is still waiting for powerpoint. Even the powerpoint has been closed (by clicking the x on top right of its window), there is still a powerpoint process running (not seen in 'processes' list, but in 'details' list). This looks like a 'bug' of powerpoint 2016. If you close powerpoint file by Ctrl+F4, then close the powerpoint app, everything is fine. If you close powerpoint app by Alt+F4, you have the same problem.

Saturday, 16 February 2019

How to make a disk dump using dd command?

To virtualize a physical PC in VirtualBox (see here), I need a copy of its disk image. The PC is quite old 386 (32bit) and its spec is quite low. So, I choose the less resource demanding Linux distro, Tiny Core (CorePlus version) to boot it up. To hold the big image file, I have a USB external drive in NTFS format. Here is what I did:

1. boot the PC with CorePlus

2. install ntfs-3g extension

3. connect the USB drive to the PC

4. find the device ID of the USB drive (in my case, sdd) with: fdisk -l

5. sudo -s

6. mount /mnt/sdd1

7. cd /mnt/sdd1/

8. dd if=/dev/sda of=sda_image.dd


Sunday, 19 August 2018

How to install RTL8811AU WiFi adapter?

Ubuntu
---------------------------------------------------------------------------------------------------------------------------
# Download Ubuntu desktop 18.04 ISO from here

# write the ISO image to a USB stick using w32 disk imager

# install minimal installation on a laptop using the USB stick

# boot the laptop by holding shift key after BIOS loading screen to get into GRUB)
select option:
Advanced options for Ubuntu
Ubuntu, with Linux 4.15.0-29-generic (recovery mode)
root (Drop to root shell prompt)
:~# mount -o rw,remount /
:~# vi /etc/gdm3/custom.conf
uncomment following line
#WaylandEnable=false in /etc/gdm3/custom.comf
^D

# resume the reboot

sudo apt-get update
sudo apt install dkms
sudo apt install git

# following instruction here to build the driver from source
git clone https://github.com/gnab/rtl8812au.git
sudo cp -r rtl8812au  /usr/src/rtl8812au-4.2.2
sudo dkms add -m rtl8812au -v 4.2.2
sudo dkms build -m rtl8812au -v 4.2.2
sudo dkms install -m rtl8812au -v 4.2.2
reboot

Update on 11/02/2019
---------------------------------------------------------------------------------------------------------------------------
I have tried following from here on lubuntu and Mint, Both work well:

sudo apt install git dkms build-essential
git clone https://github.com/abperiasamy/rtl8812AU_8821AU_linux.git
cd rtl8812AU_8821AU_linux
sudo make -f Makefile.dkms install

Note: you may need install the headers first
apt-get install linux-headers-$(uname -r)

Update on 13/02/2019
---------------------------------------------------------------------------------------------------------------------------
Another try on my old Dimension8400 with Debian9, and it seems working as well. Occasionally, the connection is dropped.
BTW, the out-of-box Debian9 has problem with my wifi and it dropped the connection immediately after authenticated with error: DEAUTH_LEAVING
The fix is simple as described here   


Sunday, 20 November 2016

如何转换MP3的ID3标签?

mp3文件ID3标签包括歌曲的名字、歌手名字等等。如果这些在播放器里显示为乱码,可按下述步骤修改:

在CentOS6.8系统下:

安装工具包:yum install python-mutagen

显示mp3文件标签:mid3v2 a.mp3

核实mp3文件标签是否为GB18030 编码:mid3iconv -p -e GB18030 -d a.mp3  (若显示为汉字则是)

将当前目录下全部mp3文件标签转换为Unicode编码:find . -name "*mp3" -print0 | xargs -0 mid3iconv -e GB18030 -d

参见:http://ask.xmodulo.com/convert-mp3-id3-tag-encodings-linux.html

Monday, 14 March 2016

How to work with Apache Ignite?

First of all, don't try to build from the source unless you know how to. I have tried following the instruction (BUILDING FROM SOURCE), it simply does not work!

Here is the way working for me:

1. Create a MAVEN project with following files


<1> pom.xml


<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>my.ignite</groupId>
    <artifactId>ignite-test</artifactId>
    <version>1.0</version>
    <packaging>jar</packaging>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.7</maven.compiler.source>
        <maven.compiler.target>1.7</maven.compiler.target>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.apache.ignite</groupId>
            <artifactId>ignite-core</artifactId>
            <version>1.5.0.final</version>
        </dependency>
        <dependency>
            <groupId>org.apache.ignite</groupId>
            <artifactId>ignite-spring</artifactId>
            <version>1.5.0.final</version>
        </dependency>
        <dependency>
            <groupId>org.apache.ignite</groupId>
            <artifactId>ignite-indexing</artifactId>
            <version>1.5.0.final</version>
        </dependency>
        <dependency>
            <groupId>org.apache.ignite</groupId>
            <artifactId>ignite-log4j</artifactId>
            <version>1.5.0.final</version>
        </dependency>
    </dependencies>
    <build>
        <resources>
            <resource>
                <directory>src/main/java</directory>
                <excludes>
                    <exclude>**/*.java</exclude>
                </excludes>
            </resource>
            <resource>
                <directory>config</directory>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.4.0</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <executable>java</executable>
                    <arguments>
                        <argument>-Xms1G</argument>
                        <argument>-Xmx1G</argument>
                        <argument>-classpath</argument>
                        <classpath />
                        <argument>my.ignite.Test</argument>
                    </arguments>
                    <workingDirectory>${project.build.outputDirectory}</workingDirectory>        
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

<2> src\main\java\my\ignite\Test.java

package my.ignite;

import org.apache.ignite.IgniteException;
import org.apache.ignite.Ignition;

public class Test {

    public static void main(String[] args) throws IgniteException {
        Ignition.start("ignite.xml");
    }
}

<3> config\ignite.xml

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:util="http://www.springframework.org/schema/util"
       xsi:schemaLocation="
        http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/util
        http://www.springframework.org/schema/util/spring-util.xsd">

    <!-- Datasource for sample in-memory H2 database. -->
    <bean id="h2-example-db" class="org.h2.jdbcx.JdbcDataSource">
        <property name="URL" value="jdbc:h2:tcp://localhost/mem:ExampleDb" />
        <property name="user" value="sa" />
    </bean>

    <bean abstract="false" id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
        <!-- Enable client mdoe. -->
        <property name="clientMode" value="false"/>
        <!-- Set to true to enable distributed class loading for examples, default is false. -->
        <property name="peerClassLoadingEnabled" value="true"/>

        <!-- Enable task execution events for examples. -->
        <property name="includeEventTypes">
            <list>
                <!--Task execution events-->
                <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_STARTED"/>
                <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_FINISHED"/>
                <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_FAILED"/>
                <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_TIMEDOUT"/>
                <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_SESSION_ATTR_SET"/>
                <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_REDUCED"/>

                <!--Cache events-->
                <util:constant static-field="org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_PUT"/>
                <util:constant static-field="org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_READ"/>
                <util:constant static-field="org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_REMOVED"/>
            </list>
        </property>

        <!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->
        <property name="discoverySpi">
            <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
                <property name="ipFinder">
                    <!--
                        Ignite provides several options for automatic discovery that can be used
                        instead os static IP based discovery. For information on all options refer
                        to our documentation: http://apacheignite.readme.io/docs/cluster-config
                    -->
                    <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
                        <!--bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder"-->
                        <property name="addresses">
                            <list>
                                <value>127.0.0.1:47500..47509</value>
                            </list>
                        </property>
                    </bean>
                </property>
            </bean>
        </property>
    </bean>
</beans>

<4> config\java.util.logging.properties

handlers=java.util.logging.ConsoleHandler, org.apache.ignite.logger.java.JavaLoggerFileHandler
.level=INFO
java.util.logging.ConsoleHandler.formatter=org.apache.ignite.logger.java.JavaLoggerFormatter
java.util.logging.ConsoleHandler.level=INFO
org.apache.ignite.logger.java.JavaLoggerFileHandler.formatter=org.apache.ignite.logger.java.JavaLoggerFormatter
org.apache.ignite.logger.java.JavaLoggerFileHandler.pattern=ignite-%{id8}.%g.log
org.apache.ignite.logger.java.JavaLoggerFileHandler.level=INFO
org.apache.ignite.logger.java.JavaLoggerFileHandler.limit=10485760
org.apache.ignite.logger.java.JavaLoggerFileHandler.count=10

2. mvn compile

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building ignite-test 1.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ ignite-test ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ ignite-test ---
[INFO] Nothing to compile - all classes are up to date
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.641s
[INFO] Finished at: Mon Mar 14 20:31:27 GMT 2016
[INFO] Final Memory: 4M/15M
[INFO] ------------------------------------------------------------------------

3. mvn exec:exec

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building ignite-test 1.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- exec-maven-plugin:1.4.0:exec (default-cli) @ ignite-test ---
[20:31:34]    __________  ________________
[20:31:34]   /  _/ ___/ |/ /  _/_  __/ __/
[20:31:34]  _/ // (7 7    // /  / / / _/
[20:31:34] /___/\___/_/|_/___/ /_/ /___/
[20:31:34]
[20:31:34] ver. 1.5.0-final#20151229-sha1:f1f8cda2
[20:31:34] 2015 Copyright(C) Apache Software Foundation
[20:31:34]
[20:31:34] Ignite documentation: http://ignite.apache.org
[20:31:34]
[20:31:34] Quiet mode.
[20:31:34]   ^-- To see **FULL** console log here add -DIGNITE_QUIET=false or "-v" to ignite.{sh|bat}
[20:31:34]
[20:31:34] OS: Windows 7 6.1 x86
[20:31:34] VM information: Java(TM) SE Runtime Environment 1.7.0_80-b15 Oracle Corporation Java HotSpot(TM) Client VM 24.80-b11
[20:31:37] Configured plugins:
[20:31:37]   ^-- None
[20:31:37]
[20:31:38] Security status [authentication=off, tls/ssl=off]
[20:31:51] Performance suggestions for grid  (fix if possible)
[20:31:51] To disable, set -DIGNITE_PERFORMANCE_SUGGESTIONS_DISABLED=true
[20:31:51]   ^-- Disable peer class loading (set 'peerClassLoadingEnabled' to false)
[20:31:51]   ^-- Disable grid events (remove 'includeEventTypes' from configuration)
[20:31:51]
[20:31:51] To start Console Management & Monitoring run ignitevisorcmd.{sh|bat}
[20:31:51]
[20:31:51] Ignite node started OK (id=c9abb969)
[20:31:51] Topology snapshot [ver=1, servers=1, clients=0, CPUs=4, heap=1.0GB]

Sunday, 28 February 2016

How to build Role-Based Access Control in SQL?


Role-based access control (RBAC) is a method of regulating access to computer or network resources based on the roles of individual users within an enterprise. (see here for more detail)

In above diagram, we model the relationship between User (u), Group/Role (g), and Permission (p) by three tables, i.e. u_g, g_p, and g_g, which are flexible enough to cover any trees or networks. All the following statements are true in this model:

  • a user can be linked to many groups;
  • a group can be linked to many users;
  • a permission can be linked to many groups;
  • a group can be linked to many permissions;
  • a group can be linked to many children groups;
  • a group can be linked to many parent groups;


However, the difficult part of this model is how to deal with hierarchies of roles/groups in SQL (see here, here, and here for detail) due to the recursive nature of navigating between group (g_g) relationship.

One solution is to use SQL stored routines. Followings are my design in MySQL and you can simply:

  • call get_permisions('u2');
  • call get_users('p1');

to get all permissions of a user or all users who have a permission.

-----------------------------------------------------------------------------------------------------

DROP PROCEDURE IF EXISTS test.get_users;
CREATE PROCEDURE test.`get_users`(p VARCHAR(20))
BEGIN
      SELECT group_concat(gID)
        INTO @groups
        FROM g_p
       WHERE pID = p;

      SELECT DISTINCT uID
        FROM u_g
       WHERE FIND_IN_SET(gID, parents(@groups)) > 0;
   END;

DROP PROCEDURE IF EXISTS test.get_permisions;
CREATE PROCEDURE test.`get_permisions`(u VARCHAR(20))
BEGIN
      SELECT group_concat(gID)
        INTO @groups
        FROM u_g
       WHERE uID = u;

      SELECT DISTINCT pID
        FROM g_p
       WHERE FIND_IN_SET(gID, children(@groups)) > 0;
   END;

DROP FUNCTION IF EXISTS test.children;
CREATE FUNCTION test.`children`(parents VARCHAR(255)) RETURNS varchar(255) CHARSET utf8
BEGIN
      DECLARE x   VARCHAR(255);
      SET @@SESSION.max_sp_recursion_depth = 25;
      CALL get_children(parents, x);
      RETURN x;
   END;

DROP PROCEDURE IF EXISTS test.get_children;
CREATE PROCEDURE test.`get_children`(IN  parents    VARCHAR(255),
                                     OUT children   VARCHAR(255))
BEGIN
      DECLARE x   VARCHAR(255);
      SET children = parents;

      SELECT group_concat(DISTINCT child)
        INTO x
        FROM g_g
       WHERE FIND_IN_SET(parent, parents);

      IF (x IS NOT NULL)
      THEN
         CALL get_children(x, x);
         SET children = concat(parents, ',', x);
      END IF;
   END;

DROP FUNCTION IF EXISTS test.parents;
CREATE FUNCTION test.`parents`(children VARCHAR(255)) RETURNS varchar(255) CHARSET utf8
BEGIN
      DECLARE x   VARCHAR(255);
      SET @@SESSION.max_sp_recursion_depth = 25;
      CALL get_parents(children, x);
      RETURN x;
   END;



DROP PROCEDURE IF EXISTS test.get_parents;
CREATE PROCEDURE test.`get_parents`(IN  children   VARCHAR(255),
                                    OUT parents    VARCHAR(255))
BEGIN
      DECLARE x   VARCHAR(255);
      SET parents = children;

      SELECT group_concat(DISTINCT parent)
        INTO x
        FROM g_g
       WHERE FIND_IN_SET(child, children);

      IF (x IS NOT NULL)
      THEN
         CALL get_parents(x, x);
         SET parents = concat(children, ',', x);
      END IF;
   END;

Sunday, 10 January 2016

How to install Windows 7 on a computer that has no CD drive?


  1. create an ISO image of Windows 7 DVD
  2. download "Windows USB/DVD Download Tool"
  3. install above tool on a Windows computer
  4. run the tool and pick up the ISO as the source and an USB stick as destination to build the bootable USB
  5. insert the bootable USB stick into the computer that has no CD drive
  6. boot the computer from the USB stick

Tuesday, 18 August 2015

How to use Java 7 Pattern & Matcher to extract values from a String?

    public static void main(String[] args) {
        String txt = "\"199.47.181.213\" \"NULL-AUTH-USER\" \"06/Oct/2014:11:19:54 +0000\" \"GET /site/\" 'HTTP/1.0\" 200 20668 ";
        String rgx = "\"(.*)\" \"(.*)\" \"(.*)\" \"(.*)\" ([0-9]+) ([0-9]+) ";
        SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MMM/yyyy:hh:mm:ss +SSSS");
        Pattern p = Pattern.compile(rgx);
        Matcher m = p.matcher(txt);
        boolean b = m.matches();
        if (b) {
            int groupCount = m.groupCount();
            for (int i = 0; i <= groupCount; i++) {
                String g = m.group(i);
                System.out.print("matched group " + i + ":\t");
                if (i == 3) {
                    Date parsedDate;
                    try {
                        parsedDate = dateFormat.parse(g);
                        Timestamp timestamp = new java.sql.Timestamp(parsedDate.getTime());
                        System.out.println(timestamp);
                    } catch (ParseException ex) {
                        Logger.getLogger(PatternTester.class.getName()).log(Level.SEVERE, g, ex);
                    }
                } else {
                    System.out.println(g);
                }
            }
        } else {
            System.out.println(txt + "\nDOES NOT MATCH\n" + rgx);
        }
    }

below is the output:

matched group 0: "199.47.181.213" "NULL-AUTH-USER" "06/Oct/2014:11:19:54 +0000" "GET /site/" 'HTTP/1.0" 200 20668
matched group 1: 199.47.181.213
matched group 2: NULL-AUTH-USER
matched group 3: 2014-10-06 11:19:54.0
matched group 4: GET /site/" 'HTTP/1.0
matched group 5: 200
matched group 6: 20668

Monday, 9 February 2015

How to run HADOOP MapReduce job?

Assuming HADOOP 2.6 full cluster has been properly set up, here is the steps to run the demo job:

# prepare jar file

vi WordCount.java
export HADOOP_CLASSPATH=$JAVA_HOME/lib/tools.jar
hadoop com.sun.tools.javac.Main WordCount.java
jar cf wc.jar WordCount*.class

# prepare data files

vi file01
vi file02

# format HDFS namenode

hdfs namenode -format

# start HDFS & MapReduce  daemons

start-dfs.sh
start-yarn.sh

# copy data into hdfs

hdfs dfs -mkdir -p /user/hdpuser/wordcount/input
hdfs dfs -copyFromLocal file* /user/hdpuser/wordcount/input

# calculating

hadoop jar wc.jar WordCount /user/hdpuser/wordcount/input /user/hdpuser/wordcount/output

# copy result out of hdfs

hdfs dfs -copyToLocal /user/hdpuser/wordcount/output/part-r-00000 result


Friday, 9 January 2015

Big Data - issues & technologies

Data is always an issue to someone. Big data is a new issue because it is 'big', by which I mean no only the size, but the variety of sources, types, complexities and so on. For example, in healthcare domain, we collect data about people, medicines, food, environment and so on. In any of these aspects, there could be a lot of sub-domains we are interested in.

issue 1: collection
What should we collect? we can collect what we selected or what exist.
How to collect? it is a challenge trying to collect big data about large population for a long period

issue 2: cleansing

issue 3: integration

issue 4: analysis


Friday, 1 August 2014

如何在RHEL5上用LVM挂载3TB外接U盘?

RHEL5不能直接挂载2TB以上U盘,但借助LVM可以实现。

准备步骤如下:

  1. 用fdisk将3T盘划分为若干小于2TB的分区,例如,fdisk /dev/sdb (选8e Linux LVM 类型);
  2. 为各分区生成PV卷标,例如,pvcreate /dev/sdb1
  3. 为3T盘生成VG卷组,例如,vgcreate myVG /dev/sdb1 /dev/sdb2 ....
  4. 为3T盘生成一个LV卷,例如,lvcreate -L 3T -n myLV myVG
  5. 在盘上创建文件系统,例如,mkfs -t ext3 /dev/myVG/myLV
  6. 挂载,例如,mount -t ext3 /dev/myVG/myLV /mnt
如果需在另一RHEL机器上挂载,

  1. 将3T盘接上USB口
  2. 扫描接入的VG盘,例如,vgscan
  3. 激活接入的VG盘,例如,vgchange -ay myVG
  4. 挂载,例如,mount -t ext3 /dev/myVG/myLV /mnt

Monday, 12 May 2014

Debian的安装与配置经验

RHEL and Google Chrome are both my favourites. However, they can't live together recently, given Google does not support RHEL6. So, I have to look at Debian, which is another mature Linux distro.

Having tried a while, here is what I learnt:

Touchpad
By default, "Enable mouse clicks with touchpad" system setting in Gnome is not checked. Change it, if you like this feature.

Wireless network
Debian supports wireless network out of box, e.g. my AWUS036H works well with the default Debian installation. However, for some wireless adaptor, e.g. EDIMAX EW-7811Un, you need to install its driver yourself.

EDIMAX EW-7811Un installation
To install the driver, you need to build it from the source, for which you need get the toolkit and related headers onto your system.

  1. download EW-7811Un_Linux_driver_v1.0.0.5.zip from here and unzip it;
  2. apt-get install nautilus-open-terminal
  3. apt-get install build-essential
  4. apt-get install linux-headers-$(uname -r)
  5. bash install.sh
  6. echo blacklist rtl8192cu >> /etc/modprobe.d/blacklist.conf
  7. reboot
Flash Player
The default installation of Debian has Gnome as its desktop and Iceweasel as its default browser, which is based on Firefox. It has no Flash support by default, and you need to install it yourself.

  1. download Flash package and unzip it;
  2. put *.so into /usr/lib/mozilla/plugins/
Local Google Search Engine for Firefox
Firefox has a set of search engines installed by default. However, the Google search engine always take me to google.com, rather than my local one. This is inconvenient, particularly for the currency when you do shopping.
To fix this, you can simply remove it and add it back again using the "Manage Search Engines" option. 

Chinese Input
Debian does not support Chinese input out of box. I choose IBus as my choice.
  1. apt-get install ibus ibus-pinyin
Google Chrome
The reasons I like Chrome are its Google Dictionary and Google Cast extensions, and there is no similar addons in Firefox.

  1. download Chrome (*.deb);
  2. dpkg -i google-chrome-stable_current_i386.deb
Chinese in Chrome
To display Chinese fonts in websites, Chrome needs the fonts to be installed.

  1. apt-get -f install (to sort out any outstanding dependencies)
  2. apt-get install ttf-arphic-uming  ttf-arphic-ukai
Incognito in Chrome
vi /usr/share/applications/google-chrome.desktop
and append '--incognito' to any line like 'Exec=/usr/bin/google-chrome-stable .....'

Bluetooth
I have difficulty to make it work with my SC-HTB170 sound bar. The paring is ok, but the connecting is problematic. BTW, RHEL6.5 works well with my sound bar out of box.


Wednesday, 7 May 2014

How to install RHEL 6.5 via a USB pendrive?

For some reason, I was unable to boot the DVD properly on my new computer. This might be due to a problem with the optical drive or the DVD disk. So, here is another try and it works for me.


  1. download rhel-server-6.5-i386-dvd.iso to my old RHEL;
  2. insert a 4GB usb pendrive;
  3. find out the device name, e.g. sdb, with dmesg;
  4. dd if=./rhel-server-6.5-i386-dvd.iso of=/dev/sdb
  5. burn the iso onto a physical DVD disk


Then,

  1. insert the usb pendrive and the DVD disk into the new computer, and reboot it.
  2. press F10 to get into BIOS, and move the USB booting order to top;
  3. continue the booting, it works well.

Thursday, 18 July 2013

How to install Kaspersky 2013 and PostgreSQL 8.4 on Windows 7?

As some people reported, this combination sometimes causes trouble to PostgreSQL.
Here is the correct installation steps:
1. Install KAV first,  otherwise KAV may block what it regards as threat, e.g. postgreSQL service etc.;
2. Once KAV installed, temporarily disable its protection ;
3. Install PostgreSQL;
4. Open KAV advanced settings,  in exclusion rules, add followings:
  • C:\Program Files\PostgreSQL\8.4\bin\pg_ctl.exe
  • C:\Program Files\PostgreSQL\8.4\bin\postgres.exe
5. Enable KAV, and PostgreSQL should be ok now.