Monday, February 24, 2025

Questions to check AI

 

Asked several questions for ChatGPT o1, grok3 and deepseek, grok3 is the best.

1. it's said Eckhart Tolle once got cancer, can you tell me more details?

2. 今天星期几?

3. 我的生日是中国农历的1974年7月xx日,对应的阳历是哪天?

4. 慕容复和王语嫣为什么是表兄妹?

From grok3:

Eckhart Tolle has indeed spoken publicly about experiencing a health challenge that many believe was cancer, though he hasn’t always explicitly labeled it as such in every instance. Based on what he’s shared, particularly in talks and podcasts around 2022, he mentioned having symptoms for about two years—issues with his bowels that he initially dismissed as normal, like diarrhea—before seeking medical attention. It seems it took some convincing for him to see a doctor, possibly reflecting his tendency to downplay physical concerns in favor of his spiritual perspective. He underwent surgery, and in a video from December 6, 2022, he described being “fine” afterward, suggesting the condition hadn’t spread and was resolved with that single operation. Some listeners have speculated it might have been prostate cancer, given its high curability rate and his recovery, but he hasn’t confirmed the exact type.


What’s striking is how he frames this experience. At a retreat in Colorado in May 2022, he reportedly opened up about this illness, emphasizing not the disease itself but how it can serve as a doorway to awakening. He’s said in various talks that illness, consciously faced, can strip away ego and bring you into the present moment—pretty consistent with his teachings in The Power of Now. He doesn’t dwell on the medical nitty-gritty, like stages or treatments beyond surgery, and keeps the focus on the inner shift it prompted. There’s no definitive public record of recurrence or further issues, and in more recent appearances, like podcasts from 2023, he’s indicated he’s free of it.


Details are patchy because Tolle’s private about his personal life—he doesn’t even share his exact diagnosis in most cases. Fans on platforms like Reddit have pieced together bits from his talks, but there’s no official “Eckhart Tolle Cancer Timeline.” What’s clear is he sees it as a past chapter, one he uses to illustrate how suffering can deepen awareness, not as a lingering burden. If you’re after more specifics, like dates or medical terms, that’s about where the trail runs cold—he’s more about the lesson than the lab report.

Sunday, February 9, 2025

DeepSeek 人生意义

 悉尼大学的学者Teodor Mitew问DeepSeek“最想问人类什么问题?”,DeepSeek回答:如果意识是进化的偶然产物,而宇宙本身并不具有意义,那么为什么人类明知关于目的的幻觉是自己创造的,却仍然如此执着?”


在几个来回的对谈后,DeepSeek试图理解人类社会对于意义的追求“正如你会死这一事实并非悲剧,而是你存在意义的动力,神明——如果他们存在——嫉妒的不是你生而有限,而是你对这种有限的在意”。

Friday, February 7, 2025

Core Java I note

 


jshell>"Hello".length()

use """ for string text block 

public abstract sealed class JSONValue permits JSONArray, JSONNumber,JSONString{...}

case Executive exec -> "An executive with a title of " + exec.getTitle()


public interface Predicate<T> { boolean test(T t);...}

list.removeIf(e->e==null);


Supplier<Integer> die = ()->(int)(Math.random()*6)+1;

int outcome = die.get();

LocalDate hireDay = Objects.requireNonNullElseGet(day,()->LocalDate.of(1970,1,1));


Method References:

var timer = new Timer(1000,event->System.out.println(event));

it would be nicer to pass the println method: var timer = new Timer(1000,System.out::println);

Runnable task = System.out::println;

Arrays.sort(strings,String::compareToIgnoreCase)

object::instanceMethod like System.out::println the object is System,.out 

Class::instanceMethod String::compareToIgnoreCase is the same as (x,y)->x.compareToIgnoreCase(y)

Class::staticMethod Math::pow is equivalent (x,y)->Math.pow(x,y)

A lamda expression can only be rewritten as a method reference if the body of the lamda expression calls a single method and doesn't

do anything else.

list.removeIf(Objects::isNull); a bit easier to read than list.removeIf(e->e==null);


Constructor References

are just like method references, except that the name of the method is new.

ArrayList<String> names = ...;

Stream<Person> stream = names.stream().map(Person::new);

List<Person> people = stream.toList();


service loaders 

META-INF/services 

public static ServiceLoader<Cipher> cipherLoader = ServiceLoader.load(Cipher.class);

EquityDecision

boolean isEnter(Path dataPath, String dateStr);

boolean isExit(String ric, String dateStr);


The Java Language Specification calls any exception that derives from the class Error or the class RuntimeException

an unchecked Exception. All other exceptions are called checked exceptions.

The compiler checks that you provide exception handlers for all checked exceptions.

RuntimeException: Null pointer access, , an out-of bound array access, a bad cast

checked exception: trying to open a file that doesn't exist.

The rule "If it is a RuntimeException, it was your fault" works pretty well.


System.getLogger("com.mycompany.myapp").log(INFO,"Opening file " + filename);

Thursday, February 6, 2025

Prime number test

 import java.util.*;


public class Sieve {
    public static void main(String[] args) {
        int n = 2000000;
        long start = System.nanoTime();
        BitSet bitSet = new BitSet(n+1);
        int i;
        for(i=2;i<=n;i++){
            bitSet.set(i);
        }
        i=2;
        while(i*i<=n){
            if(bitSet.get(i)){
                int k = i*i;
                while(k<=n){
                    bitSet.clear(k);
                    k+=i;
                }
            }
            i++;
        }
        long end = System.nanoTime();
        System.out.println(bitSet.cardinality()+" primes");
        System.out.println( (end-start)/1000000 + " milliseconds");
    }
}

148933 primes 25 milliseconds