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.

Advertisements
Posted in Uncategorized | Leave a comment

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.

Posted in Uncategorized | Leave a comment

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.

Several useful links on flask:

 

Posted in Uncategorized | Leave a comment

Healthy meal for muscle

Today I want to share some new revelation about cooking. After joining the Chinese e-commerce company for half a year, I have consumed some 200 odd lunch boxes in the Chinese street style, not to mention the extra ones I brought home for my family. While my wife seems totally complacent about the recipes, I start questioning its long term sustainability and impact on health. Some of my colleagues already reported various vital metrics at alert levels, conceivably attributable to diet. Since about a month ago, I had been taking to jogging as a way to counter the high fat/calories in the company catering. But then my left knee gave in consistently for 2 mile daily routine and I started to have some serious lifestyle change, namely little to no exercise. To be fair, I tried swimming in cold water once, and more recently I have been picking up on ab wheel, which was not a bad turn of fate either, as we shall see later. In addition, my para-radiologist for kidney CT explained to me how asian food is replete with salt, which makes joint wear hard to recover, unless I drink plenty of water. Now I am not a believer in more water the better, but rather that one should take in what’s needed. Instead of solving the salt problem with dilution, I’d rather fix the source of the problem.

Now as a father of two, husband of a shrew, I rarely have time to experiment with lifestyle outside the one prescribed by my partner, who holds deeply the belief that genetics trumps life-style and that one should carpe diem. Her own grandma exemplified this doctrine by living to the ripe age of 95 while serial-smoking until 75, and eating preserved presumably carcinogenic dried meat all throughout her life. My own grandma on my father’s side just passed away last month, at age 85, which certainly makes me more cognizant of longevity related issues than her.

After rolling out my ab wheel for a few days, I decided to do more research into the science of muscle building, and soon realize that the celebrated six-pack is a result not of muscle growth alone, but the shedding of belly fat as well. So long story short, I decided to try all chicken breast meals. On this auspicious Christmas Day evening, I finally had the opportunity to cook my own meal once, with kids and wife’s family gone for tasty Chinese food on Castro. So here comes my recipe:

  1. Prepare two pieces of chicken breasts (inorganic is fine), cut into small slices of any convenient shape
  2. Put half a teaspoon of avacado oil in a non-sticky pan and once fizzling, dump the chicken slices in with the oil, and stir until no blood is showing. Ladle out in a big dish for later reheating.
  3. Prepare the following vegetables in separate containers (feel free to swap out any with available kinds):
    1. 8 leaves of Napa, cut into thin slices
    2. one enoki mushrooms, with root discarded and the rest cut into 1 inch pieces
    3. one tomato sliced conveniently
  4. Cut two pieces of garlic into small chunks, and dump along with half a teaspoon of avacado oil, into the same empty pan, until the garlic smell comes out.
  5. Dump the enoki mushroom first into the pan, then Napa, then tomato.
  6. After vegetables look reasonable well-cooked, dump the earlier half-cooked breast in, and sprinkle some black pepper.
  7. Finally if time permit, add sprinkles of green onions, before turning off the stove in 10 seconds.

The final result is at least visually impressive, thanks to my years of experience cooking the real greasy/ingredient-rich Chinese food. I ended up eating about 3/5 of the hodge-podge, and minimal number of dirty dishes. Also don’t forget to add some carb (in my case noodle) for practical reason, and chilly pepper sauce is also imperative.

Posted in Uncategorized | Leave a comment

poetry

离离山火燎加北,

风烟南下半岛衰。

今朝喜得及时雨,

感恩难忘异乡泪。

Posted in Uncategorized | Leave a comment

on financial security

Recently I have moved out of google inc and joined jd.com. This afforded me some precious opportunity to experience both oriental and occidental cultures in depths. One thing I started thinking about is which side is the future of humanity. This is a pretty heavy topic that I cannot be completely unbiased on given my ethnic upbringing. Today I would like instead to elaborate on a small sliver of the subject, namely financial security.

There was a recent film that came out called “crazy rich asians”, as I learned on NPR. I haven’t bothered watching it. But the title caught my attention. Why are Asians known to be filthy rich? There was a story about a Beijing retiree who got hospitalized for pneumonia during the smog winter season, whose medical bill eventually cost the family all their wealth, including 2 apartment homes they owned, and all savings. By American standards, that family is already pretty well-off, at least a middle class family. On the other hands, most Americans don’t have much savings, and yet seem to live a reasonably happy life of 80 years. In China, life insurance is recently gaining popularity, because employers rarely offer coverage. From that extreme story, it seems medical bill can easily consumes a middle income family’s entire saving. The social safety net is fragile, even though normal hospital visit is much cheaper than the US.

Is US a socialist country then? By no means. But US does have better environment and much lower popularity density, even in money hubs like the Bay Area. The living space generally feels less oppressive. Financially hospital bills can usually be forgiven, unlike college loans. There are probably fewer superbugs than in China. That made up for the net worth difference with Chinese middle class.

Living in a financially stressed environment is not just bad for personal satisfaction, it affects people’s ability to do honest work. Recently NYU is giving all its junior and senior medical school students free tuition, saving each student about 200k total. I think a big  motivation is that medical students have to carry their debt into too many of their productive years, usually something like age 40, before they can breathe freely like other professions. This naturally leads to prioritizing money over satisfaction from their actual job. Corruptible behaviors easily result, such as getting paid to use certain drugs, a practice that’s common in both US and China, and being ultra-conservative (to the point of being useless) in diagnosis to avoid lawsuits. The latter is arguably universal rational behavior, but having peer doctors who went through financial distress can only make one even more cautious. After all doctors should aim for both precision and recall.

Providing a social safety net is not easy, even in a country like US. Cultural tradition plays another important role in how much one values money. In more advanced cultures like China or Jewish societies, people have grown used to the importance of money as a universal measure of success and safety, so that all biological resources tend to be devoted to its accumulation. In other words, the threshold for reaching a psychologically safe level of net-worth or income is much higher than other societies. The social cost of this is obvious: people require hoarding a much larger portion of the collective wealth in order to function properly in their roles. Such momenta can catapult certain exceptional individuals into the rank of billionaires, at which point their rudimentary yet critical functions as individual contributors in labor production inevitably get replaced by management or other leveraging roles. Thus it is very rare to find highly paid individual contributing software engineers or scientist in China. Outside google it is also rare even in the US, but I at least know quite a few individuals. All of this hierarchical spiral of productivity death is attributable to how society distracts its members from money. Christianity, academic pursuit, etc all played important roles in this distractive effort. Equally important is the ability of the society to grant its members the free will to pursue a subject of true interest, rather than based on planned economic need. Of course not all career paths should be equally profitable, but there should be a sufficient variety of them each of sufficient quantity, that can meet basic living standards free from existential worry. This is currently absent in China, and arguably also in the US, such as liberal arts majors. Perhaps the ultimate direction is for everyone to have leisure for two careers, one making serious money, another for pure personal interest. Those who truly excel at the latter should be rewarded to pursue one exclusively, while the amount of time allowed to spend on the latter should not be pro-rated by the profit it generates.

Posted in Uncategorized | Leave a comment

What can life do to me now?

I am pretty pissed by life these days. Just bought an expensive house for no good reason, only to realize there are several major problems with the new home. Now I am locked up for the next 30 years with a monthly debt close to 10k. Not exactly happy with how my career is advancing. Even though I appear productive, I do all the menial work without good understanding of the fundamentals. I am treated as an cheap overtime labor. I am probably somewhat stupid, given my defective long/short term memory. I often can’t recall things happening more than a week ago, no matter how major. I have big trouble coming up with creativity and appropriate things to say or put into slides. I have so much self-doubt that I keep postponing decision making towards the end of every project, leaving a litter of experimental flags. I wish I can study deep things more regularly and not just read the headlines, but kids and other family obligations keep me from doing that, and wife’s chastise is the main catalyst. I was never confident of my english/presentation skill anyway. I can pretend to be fluent or well-versed in front of novices or unsuspecting subjects, but get crushed instantly by people of intellectual swiftness and criticality.

Not exactly happy with my family. There is very little common things I can talk to my wife about. She isn’t into politics. Both of us have been driven to 997 work schedule due to the financial burden and sheer workload in the tech industry. Yesterday I thought about leaving the bay area, but then I will miss my dad, who is my main source of consolation.  Kid is way too hyperactive for me to handle. I cant’ even muster enough energy to save my own ass, let alone chasing kids around.

I don’t know if I am in a pit of depression at the moment. My confidence is certainly low, but that’s a perennial problem. I am swamped by the breadth and depth of multitasking imposed on me. I felt sold into a slave market that I never imagined myself getting into. I and my wife buy stuff without the ability to properly organize them. My memoryless trait often makes me buy the same thing two to three times. I never write code without copy/paste entire blocks from somewhere. I cannot retain stream of consciousness any more sometimes when I read novels, or technical report. These are worrisome signs of aging, and destroy me weekends and nights because I always have to put in extra miles than others to get things done. Never did I manage to make progress on first attempt.

So in retrospect, I made three poor decisions: 1. having kids, 2. buying that expensive house, 3. getting my parents and wife into the feud they are in now. If the 3rd one didn’t exist, I could have avoided 2 by talking to my parents before the purchase, and 1 could be solved easily by living together and taking advantage of their help. But now it’s all too late.

I know others also struggle similarly to me. But my lack of confidence and good decision making skill distinguishes myself from all the rest, since I can’t even easily communicate my problem to the outside world. On the other hand, if I get emboldened to decide on impulse always, I might have ended up in a jail already. Bankruptcy, felony charge, auto accidents. These things just seem not too far from me any more. I need some serious therapy.

Posted in Uncategorized | 1 Comment