Derek Zeng

Loneliness is the gift of life

45 posts.

A brief history of time - my understanding of spacetime

I've been thinking about this for quite some time. The very meaning of stopping time is to stop the movement of everything. Thus, the definition of time has to be relative to the positions of things. If you want to slow down the time, really all you need is just to slow down the speed things move. The "things" here refers is every single particle that constitutes the space. The particle specifically ...

Read more

Comparison of change detection of top 3 frontend framework

I have written about VueJs's change detection before. Recently, I created a simplified version here. In my opinion, it's an exemplary usage of observer/observable pattern in the frontend. In this article, I want to talk about change detection in other frameworks, namely angular and react. React React doesn't do any active detection of changes. It's just a view layer. Its view components forms a tree ...

Read more

A case on performance optimization

One task I finished recently was to optimize the loading time of table of content(ToC). ToC is the most important API we are using. Currently, it loads the entire table of content before the initialization of the app. This obviously creates quite a bit of lag when the course is huge and it is not uncommon for Teachers to create large course that contains thousands of items. Our previous version of ...

Read more

Solving cross browser scrolling issue

An interesting task I was assigned recently was to fix the app in RTL mode. Our app is an react app built using webpack. When it's working in the RTL mode, the react app will be under <body dir='rtl'>. When coding the styles, I need to take that into consideration. The first approach I did was to apply override when it's in [dir=rtl]. This incurs least change to our project. Since we are using ...

Read more

Python built-in tools that you must know

This is a study note about Python basics. (based on python 3.6) itertools Helper functions returns iterator. import itertools as it Infinite sequence count, cycle, repeat c = it.count(10) print(next(c)) # 10 print(next(c)) # 11 print(next(c)) # 12 increment_count = map(lambda co: co+1, c) print(next(increment_count)) # 14 print(next(increment_count)) # 15 print(next(increment_count)) # 16 For ...

Read more

Vue 2.0 - 2 way data binding more in-depth analysis

This is a review on https://github.com/DDFE/DDFE-blog/issues/7 based on vue 2.0. (Courtesy of https://vuejs.org) In the original article, the author did talk about different participants of 2 way binding, but what he has not explained clearly is how they interacted. Specifically, I have the following questions: what will happen when the observed object is changed. when and how the change propages ...

Read more

Angular, Redux, ngrx and complexity management

Having a proper way to manage complexity is crucially important in software development. It leads an established way of adding featurs and fixing bugs, so the software can grow as big as you wish while still maintaining the basic simple structure that is easy to reason about. This also ensures that software can be used reliably for a long period of time. In the past few weeks, while I am working ...

Read more

Angular data model and Redux

We know that Angular uses component based architecture. Each component is an independent piece of UI that consists of its own state management, styles and templates. A component can be composed of other components. Descendent components may inherit styles from ancestor component due to the use of shadow DOM. The key idea is simple. We should keep the component as independent as possible, like pure ...

Read more

Play with Reactive programming (1)

Rxjs is a popular library now. I used it when working on my Radio Player project. The Angular uses it as a way to pass data between components. Because the data passed can be async and continuous, it's quite important to have a consistent way to handle them together with ordinary data source. With Rxjs, the data source can be packaged as an observable object and passed around. The data source could ...

Read more

Top command is actaully pretty useful

After I switched to ubuntu, I discovered quite a few useful commandline utilities. Top is one of them that I underestimated for a long time. In the past, whenever I want to check system resource usage, I'll open system monitor GUI. But top is entirely capable of doing everything system monitor has to do even inside terminal window and it does it better. Here is a screenshot of top showing my processes ...

Read more

1 2 3 4 5