How to confront phone scammers

Today I received another one of those SSN admin fake phone calls. I did not do a good job scaring them away because as usual my ad-hoc performance sucks. So I decided to write a blurb for future reference:

1. Are you aware that this is illegal?
2. which country are you calling from?
3. Do you have family? Do you want to be recognized by your family as a scam artist? A criminal? A parasite of society?
4. How many people have you scammed in the past month? Do you understand that your victims are the most vulnerable sector of society, and that they can be your parents, your grandparents, and your children as well?
5. I understand that your line of business is very lucrative. Even if you only snatch up 1% of victims, you can walk away with a lot of money at the end of the day. Use that money wisely.

Flu Tips

It was never fun to have a flu, especially after duly getting the flu shot at the earliest opportunity. a week after my China trip, however, I finally fell for it on the 24th of January this year, and it’s not too surprising: I was sitting next to a coughly colleague for 12 hours on the plane. He even reported having fevers for several days prior to that, and had sickness lasting after we returned to the US together.

Anyway a few tips I learned along the way of recovery that should help with future speedy recovery:
1. do not worry about electricity bills from heating, it’s well worth it especially at night in the bay area. Several times I woke up with a sore throat and frozen limbs, and wished I had turned the heater on all night. A cheaper alternative is to wear down jacket and ski suites to bed, but it’s simply easier to crank up the heat.

2. Stay hydrated, especially before bed.

3. Don’t stay up late and leave plenty of time before bed for entertainment, like 2 hours for a regular movie.

4. Try ibuprofen to keep temperature in check, and not wait til the fever has taken a toll on the judgment.

Fortunately I was paying attention to number 1-3 in the second half of my recovery phase, so I didn’t have to suffer too much from the lingering cough when the fever subsided. But I wish I had remember the importance of staying warm from the very beginning to avoid the fever altogether. Better revisit the notes next time.

When faced with dire uncertainty, Lord is the best/only friend

I am deciding whether to leave a comfortable 6 & 1/2 figure salary to pursue a startup. Some of my most capable friends seem unsure. I don’t have a stellar track record in terms of judgment: think gold hype, bitcoin bubble, housing peak. But invariably every time I let greed take over reason, and most importantly perhaps, I never consulted with our Lord in those situations. On a micro scale, I suspect if I prayed to the Lord every time I consume a meal, my GI woes would also be mitigated at least. There is no denying that the biological me is an extremely irresponsible, reptilian creature with no sense of long term purpose. The pursuit of math, for example, is a mere satisfaction of spontaneous curiosity and intellectual hubris. The vexation over some tricky coding bug,  similarly results from the bedeviling by hubris and control-freakdom. If my brain is truly wired like a neural net, the lack of divine guidance can be viewed as a supervised learning exercise with the objective given by whatever the environment happens to offer: think food, hubris arousal, money temptation, anger, etc. While the true purpose of life maybe cleverly hidden from us mortals, its vicissitudes of embodiment are readily accessible at strategic checkpoints of life.  It is our mortals to pay attention and discover such divine offerings and realize our fuller potentials.

How to deal with GI woes

It has become a habit of late that I would suffer from GI issues (either diarrhea or indigestion) on a weekly basis. This is clearly no fun as the stomach can take up resource from the brain. Further, it limits my stamina up side because fasting can solve the problem temporarily but with the dire consequence of lost productivity.

My wife as usual complains about my lethargy in looking after the obnoxious kids. My excuse of stomach ill is habitually greeted with contempt, callousness and antipathy. I perfectly understand how passive I appear on family matters, but I simply have a far more cruel inner master to appease.

After no seriously detectable symptoms from decade long repeated hospital visits and struggling of recurring episodic suicidal thoughts, I finally feel determined to trust my own guts on this matter. It’s not that what I eat is terribly western or contaminated by despicable Chinese food vendors, since people around me are doing fine most of the time (granted my company did get involved relatively recently in a food poisoning incident that went viral on wechat). The crux of my curse is that it takes physical energy and leisure (time) to properly digest food. So it is not surprising that I get diarrhea from time to time after eating in front of my computer, especially if I also happen to overeat, and if the food is somewhat irritating (e.g. mildly spicy).

While food poisoning in the bay area is unfortunately still an existential threat, the fact that people eating the same food around me are not complaining as much indicates scientifically that my own predisposition is to blame. Just because colleagues eat at their desk doesn’t mean I need to follow the suit. My current job is comfortable enough to avoid such peer pressure, and I should exploit other occasions for longer work hours instead of the precious time after meal reserved for my organs.

Interesting findings of the week

A. This morning reading through colleague’s weekly report, I see this figure 5kw and got initially puzzled. Then it became clear that k stands for 1,000 and w for 10,000 (the Chinese convention of powers of 10 of course). Sometimes people don’t realize how creative they get with everyday mundane work.

B. After talking to a former classmate and near-miss colleague of mine, I realize that the reason of my current dissatisfaction in life could well be one of the following:

1. I don’t know what I truly want in terms of priority, and therefore don’t know which ones to sacrifice.

2. I am not learning enough from people around me.

3. I fantasize too much about a life burdened with research OKRs, and have not had enough opportunity simply building things from scratch.

I currently don’t have a method to address any of these. But perhaps will in a few months. In addition, I have some major complaint leveled against my current company food. At least the overtime meal feels like a bare minimum of starch and protein, with negligible amount of flora. It can take a toll on health in the long term. Buffet style food, no matter how poorly cooked, is still a luxury in comparison.

C. One mysterious debugging trick: often I run into a bug that has no reason to exist, and spend half an hour or so deliberating where to insert the print statement, only to find out that the bug is not reproducible, that is, it disappears on second attempt. This does not mean I should be less careful with the debugging process, but only that better editor sync is needed.

Amazing breakthrough in theory of computation

I learned from a colleague at JD.com that a professor Huang Hao from Emory math department made breakthrough just weeks ago in the following conjecture of Gotsman and Linial:

Given any induced subgraph $G$ of the hypercube graph $Q_n$, with $V(G) \geq 2^{n-1} + 1$, its maximum degree is at least $\sqrt{n}$. This by itself is already a big deal since the previous best result by famous people like Fan Chung was on the order of $\log(n)$, and presumably not obvious either.

Since the prof is Chinese, it was well advertised in the Chinese blogging community, though not to the extent of Yitang Zhang’s prime gap result.

The connection to other areas of complexity theory is even more remarkable, and well-exposed in the author’s original paper. In fact, I found that the subsequent advertising blogs by other mathematicians and journalists to be largely not adding much expository value.

A notion of complexity is given by the so-called sensitivity $s$. For a boolean function $f: F_2^n \to F_2^1$, where $F_2 := \{0, 1\}$ viewed as a set, the sensitivity function is defined by $s(f, x) := |\{i \in [n]: f(x^{\{i\}}) \neq f(x)\}|$, where $x^{\{i\}}$ stands for the binary vector $x$ with the $i$-th coordinate flipped. In other words, point-wise sensitivity is the number of ways the function $f$ can be perturbed by a single coordinate, or more metaphorically, the co-dimension of its null tangent space at $x$. Global sensitivity of $f$ is simply $s(f) := \max \{s(f, x): x \in F_2^n\}$. This is a natural measure of complexity of $f$ since if $f$ is constant, sensitivity is clearly $0$. But maybe it’s not fundamental enough to let us tackle P versus NP because for a simple function like the parity function $f(x) := |\{i \in [n]: x_i = 0\}| % 2$, $s(f) = n$ already achieves maximum sensitivity.

Now the connection between sensitivity and maximum degree is proved by Gotsman and Linial in a quarter-page proof, so I encourage everyone to read it. But here is my digested version:

The following two statements are equivalent:

1. The max degree of $G$ and the induced subgraph on $Q_n \setminus G$ is bounded below by $h(n)$, provided $|V(G)| \neq 2^{n-1}$.
2. The sensitivity of a boolean function $f: F_2^n \to F_2$ with $d(f) = n$ satisfies $s(f) >= h(d(f))$ where $d(f)$ is the degree of $f$, viewed as a polynomial. More precisely, $\max \{|\{i \in [n]: x_i = 1\}|: f(x) = 1\}$.

To see the equivalence, simply consider the indicator function $g$ of $V(G)$ with domain $F_2^n$, multiplied by the parity function $p$. The degree of $gp$ at $x \in Q_n$ is clearly related to its sensitivity at $x \in F_2^n$. Indeed the parity makes so that neighbors in the original graph $G$ change the function value.

The requirement of  $|V(G)| \neq 2^{n-1}$ corresponds to $\mathbb{E} g \neq 0$, which in turn corresponds to $d(f) = n$. The rest should be pretty straightforward.

Statement 2 can be equivalently relaxed to the case where $d(f) < n$. The reason, as pointed out to me by Gil Kalai, is that given a function of degree $d < n$, there is a monomial $x_1 \ldots x_d$ of exactly $d$ variables. Let $g(x_1, \ldots, x_d) = f(x_1, \ldots, x_d, 0, \ldots 0)$. Then $g$ has degree $d$ and sensitivity less than or equal to that of $f$. But $g$ has full degree (equal to the dimension of its domain), so 2 applies. And we get

$s(f) \geq s(g) \geq h(d(g)) = h(d) = h(d(f)).$

I will devote another post for Huang’s actual proof.

Click a form button to open a new tab in flask

Unfortunately online support for flask is somewhat limited. It is not treated as a mature web programming language. But I use it mainly for internal demo purpose, and it simplifies things tremendously. The trick is often that a technique is not specific to flask, but html in general.

It is relatively easy to redirect to a new tab with a hyperlink in html:

<a href=”google.com” target=”_blank”> my awesome link </a>

will do that.

With forms, target is a top level attribute that controls rendering of the entire form

<form target=”_blank”> … <input type=”submit” value=”submit”> … </form>

To redirect to new tab for an individual button within the form, try

<form> … <input type=”submit” value=”submit” formtarget=”_blank” > … </form>

I also found that POST actions do not support Ctrl + Click, since the target url cannot infer the POST parameters directly.