Guowei Lv

3 minute read

Do you think Computer Science equals building websites and mobile apps? Are you feeling that you are doing repetitive and not so intelligent work? Are you feeling a bit sick about reading manuals and copy-pasting code and keep poking around until it works all day long? Do you want to understand the soul of Computer Science? If yes, read SICP!!! We are building a simulator program for digital circuits, using the Object Oriented view of the world, in Scheme Lisp.

Hand Made Hero Day 1

A following along for HMH day 1

Guowei Lv

2 minute read

Project Setup Use the command subst to create an alias to the working directory: subst w: C:\Users\lv\work Our project is actually created inside the work directory like this: \work\handmadehero. Inside handmadehero, create two folders misc and code. Inside code, create file win32_handmade.cpp. Windows Entry Point All windows program has a entry point as follows, just put it in our code. int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { return 0; } How to Build We build our project from command line.

Guowei Lv

4 minute read

Do you think Computer Science equals building websites and mobile apps? Are you feeling that you are doing repetitive and not so intelligent work? Are you feeling a bit sick about reading manuals and copy-pasting code and keep poking around until it works all day long? Do you want to understand the soul of Computer Science? If yes, read SICP!!! A Table to the Rescue In previous article, we see that it becomes quite annoying that each and every one of the generic selectors of the complex number has to do a cond on the types.

Where to Put observeOn in Rxjava2

Where to put observeOn matters!

Guowei Lv

1 minute read

Me: Why I have put the observeOn(AndroidSchedulars.mainThread()) but still onNext() is NOT called in android main thread?! Rx Master: Show me your code. Me: Here you are my master. I just want to wait for 5 seconds then call an api: override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) fun networkObservable(): Observable<String> { return Observable.just("test").subscribeOn(Schedulers.io()) } Observable.timer(5, TimeUnit.SECONDS) .observeOn(AndroidSchedulers.mainThread()) .flatMap { _ -> networkObservable() } .subscribe(Consumer { Log.d("testtest", it) Log.d("testtest", Thread.

Guowei Lv

3 minute read

Do you think Computer Science equals building websites and mobile apps? Are you feeling that you are doing repetitive and not so intelligent work? Are you feeling a bit sick about reading manuals and copy-pasting code and keep poking around until it works all day long? Do you want to understand the soul of Computer Science? If yes, read SICP!!! Tagged Data At the end of previous post, we identified one problem of our current complex number system, which is given a complex number, there is no way to tell whether it is implemented in rectangular form or polar form.