Tuesday, January 8, 2013

Android App "Contacts' Urgency"

I just published an Android app on Google Play Store, named "Contacts' Urgency".

https://play.google.com/store/apps/details?id=com.xgjonathan.contactsUrgency

This app allows you to set five different vibration patterns for your contacts' incoming call or SMS. These patterns represent five urgent priorities from one (lowest) to five (highest).

You may get confused and may ask the following questions:

Q1: How do you design these vibration patterns?

A1: Basically, for common smartphones, the strength of vibrator is fixed, and what we can change is when to turn it on and when to turn it off. Therefore, we define the vibration patterns as different combinations of four units: short on, short off, long on, long off.

Q2: How many levels of urgency can users distinguish? Why five? Why is one pattern more urgent than another?

A2: We conducted experiments to answer these questions, as shown in the following video.



For more details, please refer to our CSCW 2013 paper, "Designing an Effective Vibration-Based Notification Interface for Mobile Phones".

If you are interested in this app, please give it a try. Any comment or suggestion is welcome.

Monday, January 16, 2012

Memory from last Spring

A railway near our campus
This is one of my favorite photos from last year. Some people said it is sorrowful, while some others felt warm. What is your feeling?

Thursday, April 21, 2011

using macbook

  • using chrome on macbook
    • switch among different tabs: cmd + alt + arrows
    • open the link page in a new tab: cmd + mouse click / cmd + enter
  • hotkeys on macbook
    • open a file: cmd + o

Wednesday, April 20, 2011

using Ubuntu

  • copy files from your local host to a server
    • scp PATHNAME_HERE  target-host:/PATHNAME_THERE
    • scp -rp user1@host1:/filepath1 user2@host2:/filepath2
  • if you can not get "apt-get" done, that may be because your selected ubuntu mirror server is down. So what you need to do is change the mirror server. 
    • Go to: System->Administration->Update Manager->Settings->Ubuntu Software->Download from, and check the active mirror servers and choose one.
  • search files for some contents in a certain directory
    • find . -type f|xargs grep -e "content"
    • find file-path file-type | xargs grep "content"
  • to see if some application has been installed or not
    • command: $ type <package-name>
    • command: $ apt-cache policy <package-name>
  • setup sharing folder between Ubuntu(guest) and MacOS(host) using VirtualBox
    • step 1: on your host OS, go to VirtualBox -> machine -> settings -> Shared Folders, add the folder, say folder1, you want to share with your guest OS (leave auto-mount default)
    • step 2: on Ubuntu, create a new folder "folder2", and edit /etc/fstab file by adding the following line:
      • folder1 /home/xxx/folder2 vboxsf auto,rw,gid=1000,uid=1000 0 0
      • what must be noted is the second parameter should be an absolute path
    • then reboot your guest OS

Tuesday, April 19, 2011

Emacs commands

  1. Search
    • forward searching: C-s
    • backward searching: C-r
    • quit searching: ret or C-a
    • finding the next/previous: repeat C-s or C-r
  2. How to use emacs to compile and run C/C++ files
    1. compile the source code: "M-x compile", first; and then "g++ hello.cpp -o hello"
    2. open the shell window to run: "M-x shell" or "M-x eshell"; and then "./hello"
    3. go back to the source code window: "C-x b"
    4. get away of the minibuffer: "C-g"
    5. clear some minibuffer: "C-x k"
    6. only keep the window where the cursor is: "C-x 1"
    7. switch between windows: "C-x o"
  3. How to use etags
    • generate the TAGS file: $ etags `find . -name "*.c" -o -name "*.cpp" -o -name "*.h"`
    • let emacs know about this TAGS file: M-x visit-tag-table [location of the TAGS file]

Friday, April 15, 2011

How to install libpcap on latest Ubuntu

I haven't used libpcap since I posted this blog last time (2011). But many people may not get it work following the old steps below. Therefore, I tried to install libpcap myself on the latest Ubuntu 12.10.

Here are the steps:
  1. Download libpcap-1.3.0.tar.gz from http://www.tcpdump.org/ and decompress it;
  2. Download flex-2.5.37.tar.gz from http://flex.sourceforge.net/ and decompress it;
  3. Download bison-2.7.tar.gz from ftp://ftp.gnu.org/gnu/bison/ and decompress it;
  4. Download m4-1.4.16.tar.gz from ftp://ftp.gnu.org/gnu/m4/ and decompress it;
  5. Then, enter into directories m4-1.4.16, bison-2.7, flex-2.5.37 and libpcap-1.3.0 in order, and execute the following commands:
    1. $ sudo ./configure
    2. $ sudo make
    3. $ sudo make install
  6. ** Basically, just find the latest version from these websites to download.
Until now, installation is finished. You may test it with the following code (test.c):

    #include <stdio.h>
    #include <pcap.h>

    int main(int argc, char *argv[])
    {
        char *dev, errbuf[PCAP_ERRBUF_SIZE];

        dev = pcap_lookupdev(errbuf);
        if (dev == NULL) {
            fprintf(stderr, "Couldn't find default device: %s\n", errbuf);
            return(2);
        }
        printf("Device: %s\n", dev);
        return(0);
    }


Commands to compile and execute this program:
  1. $ gcc test.c -lpcap
  2. $ sudo ./a.out
  3. ** use sudo to execute the program, because of permission required
Expected output should be like this:
                                                          Device: eth0

One problem you may come across during running the program:

"error while loading shared libraries: libpcap.so.1: cannot open shared object file: No such file or directory"

This is because we have installed using .tar.gz, then library is installed in /usr/local/lib directory.

Solution:

Open /etc/ld.so.conf as root, and add the following two lines to it:

/usr/local/lib
/usr/lib

Then execute command:

$ sudo ldconfig

Now compile and run test.c again, and you may get the result.

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

Old Version:

Libpcap is a portable C/C++ library for network traffic capture. Although libpcap is primarily a packet-capturing tool, it also can create and manipulate packets from saved files, which can then be used in the wide variety of tools that support the libpcap format.

In this article, I will show how to install libpcap on Ubuntu.

  1. Download libpcap-1.0.0.tar.gz (512.0KB) from www.tcpdump.org, and decompress it (tar zxvf libpcap-1.0.0.tar.gz) to your self-defined directory;
  2. Download flex-2.5.35.tar.gz (1.40MB) from flex.sourceforge.net, and decompress it (tar zxvf flex-2.5.35.tar.gz) to your self-defined directory;
  3. Download bison-2.4.1.tar.gz (1.9MB) from ftp.gnu.org/gnu/bison/, and decompress it (tar zxvf bison-2.4.1.tar.gz) to your self-defined directory;
  4. Download  m4-1.4.13.tar.gz (1.2MB) from ftp.gnu.org/gnu/m4/, and decompress it (tar zxvf m4-1.4.13.tar.gz) to your self-defined directory;
  5. Then, enter into the directories m4-1.4.13, bison-2.4.1, flex-2.5.35, libpcap-1.0.0 in the order, and execute the following commands:
    1. (sudo) ./configure
    2. (sudo) make
    3. (sudo) make install
Now, everything should work well. And you can get a .c file to test your installation.

Notice: installing libpcap and running your programs should have an access to your root priority.
Good Luck! ^_^