Saturday, May 21, 2005

[Life] Something buried in memory, ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEAvkSIZSV4P9HNO3MeX
7HaFc2G9CmnZTWoDH9s=, 1024 35 141087622604984352947073823381669525561182271

Unforgettable! Those old days!

Wednesday, May 11, 2005

[Java] anonymous inner class issue

It seems that if an anonymous inner class implements an interface ,then its constructor can't have argument。If really need arguments, theorectically two solutions:

  1. define a method which takes arguments (must be "final"). The method does nothing but return an anonymous class, which uses the method's arguments。

  2. public Destination dest(final String dest) {
    return new Destination() {
    private String label = dest;
    public String readLabel() { return label; }

  3. see the exmaple below:

  4. import*;
    import java.util.*;

    abstract class NewFilenameFilter implements FilenameFilter{
    protected String start, end;
    NewFilenameFilter(String s, String e){
    start = s;
    end = e;

    public class NameFilter{
    public static void main(String argv[]){
    if(argv.length != 1){
    System.out.println("must have one argument!");
    File f = new File(argv[0]);
    if( !f.exists()){
    System.out.println(argv[0] + " does not exists");

    String s[] = f.list(new NewFilenameFilter("u", "c"){
    public boolean accept(File dir, String filename){
    boolean isMatch = true;
    isMatch &= filename.startsWith(start);
    isMatch &= filename.endsWith("." + end);
    return isMatch;
    /* print s */

However, if the class has the possibility to be used somewhere else, better give it a name。

Friday, May 06, 2005

[Java] Some thing about inner classes

  • If you’re defining an anonymous inner class and want to use an object that’s defined outside the anonymous inner class, the compiler requires that the outside object be final.
  • If you don’t need a connection between the inner class object and the outer class object, then you can make the inner class static. So, it means:
    1. You don’t need an outer-class object in order to create an object of a static inner class.
    2. You can’t access an outer-class object from an object of a static inner class.
  • Non-static inner classes cannot have static data, static fields, or static inner classes. However, static inner classes can have all of these.
  • Normally an interface can't have any code, but static inner class can be part of an interface.
  • It’s not possible to create an object of the inner class unless you already have an object of the outer class. This is because the object of the inner class is quietly connected to the object of the outer class that it was made from. However, if you make a static inner class, then it doesn’t need a reference to the outer class object.
  • An example demonstrates how to inherit from an inner class and how to refer to an enclosing class from within an inner class:

  • class WithInner {
    private int i;
    WithInner(int i){
    this.i = i;
    class Inner {
    public String toString(){
    return WithInner.this.toString();
    public String toString() {
    return "WithInner " + i;

    public class InheritInner extends WithInner.Inner {
    //! InheritInner() {} // Won't compile
    InheritInner(WithInner wi) {
    public static void main(String[] args) {
    WithInner wi = new WithInner(1);
    InheritInner ii = new InheritInner(wi);

Tuesday, May 03, 2005

upgrade to gnome-volume-manager 1.2.0

My previous hacking still works.
However, I find an interesting thing.
It only works for removable device, such as external usb disk, doesn't work for any partition in /dev/hda.
I am trying to figure out the reason.

In the latter situation, I find in src/manager.c:841
the "g_slist_find_custom()" returns NULL.
As a result, gvm_device_autorun() won't be executed
I find a link talking about "glib singly linked list"

I will pick up here next time.

Monday, May 02, 2005

I openned a new blog

Not bad here, uh?
I do like the look and feel of
However it's not an ideal place for my blog.
I can't talk about certain topics there.
You know the reason.
What's worse, there are a lot of rubbish on its index page.
Here is better, I think, haha!