Wednesday, September 23, 2020

Say 'Yes'

I have a little meditation this morning. My mind is contemplating what to focus of the meditation topic, not on "who  recite the buddha's name",  as by my master in cttb originally said you have to find a good question to contemplate a few years ago. As I go though divine comedy of Dante (mostly in inferno), James Joyce, and Joseph Campell. There's some words from Joe, "I have say no all my live...", then I have a little thought of that say 'yes'. After meditation, is breakfast time, toast and coffee. I've chance to open Ulysses, the last page and the last section, to read. That is the start of my day. And a good day. Yes.

Thursday, December 29, 2016

isleapyear by Java


public class LeapYear {
    public static final int LEAP = 1;
    public static final int COMMON = 0;
    public static int isLeapYear(int d) {
        if(d%400 == 0) return 1;
        if(d%100 == 0) return 0;
        if(d%4 == 0) return 1;
       
        return 0;
    }
}


import org.junit.*;
import static org.junit.Assert.*;
public class LeapYearTest {
    @Test
    public void test_1996_is_leap_year() {
        int actual = LeapYear.isLeapYear(1996);
        assertEquals(LeapYear.LEAP, actual);
    }
    @Test
    public void test_2001_is_common_year() {
        int actual = LeapYear.isLeapYear(2001);
        assertEquals(LeapYear.COMMON, actual);
    }
    @Test
    public void test_1900_is_common_year() {
        int actual = LeapYear.isLeapYear(1900);
        assertEquals(LeapYear.COMMON, actual);
    }
    @Test
    public void test_2000_is_leap_year() {
        int actual = LeapYear.isLeapYear(2000);
        assertEquals(LeapYear.LEAP, actual);
    }

}

Friday, May 27, 2011

macbook pro alsa information

I install fedora 14 to my macbook pro. Alsa information (alsa-info) is located at

http://www.alsa-project.org/db/?f=fbe5944331a383db3659bae2cd06659142f28af4

Tuesday, July 27, 2010

a script to replace extention of files

Suppose the file extension is "foo".


#!/bin/bash

for f in `find . -name "*.foo" -type f`
do
newname=`echo "$f" | sed "s/\.foo$//"`
mv $f $newname
echo "mv $f to $newname"
done

exit 0

Monday, July 5, 2010

vmware fusion -- network no connection

The following tip can fix "network bridge device on /dev/vmnet0 is not running" failure.


$ sudo /Library/Application\ Support/VMWare Fusion/boot.sh –-restart

Wednesday, June 30, 2010

unlock android emulator

$ adb devices (to find port number 5554)
$ telnet localhost 5554
event send EV_KEY:KEY_MENU:1

ubuntu 10.04 notes

1 install vmware-tools

$ uname -a -> to find linux header version
$ sudo apt-get install linux-headers-2.6.32-21-generic
$ sudo apt-get install build-essential
$ sudo ./vmware-install.pl


2 build android 2.2

$ sudo apt-get install gcc-multilib g++-multilib zlib1g-dev gperf
$ sudo aptitude install libncurses-dev
$ sudo apt-get install bison flex git-core curl
$ sudo apt-get install openjdk-6-jdk
$ repo init -u git://android.git.kernel.org/platform/manifest.git -b
android-2.2_r1
$ repo sync
$ vim ./build/core/main.mk change 1.5 to 1.6
$ source ./build/envsetup.sh
$ lunch 1
$ make -j8