Category Archives: Uncategorized

房子 – 厨房sink堵塞问题之终极篇

厨房sink堵塞在美国并不少见,郁闷的时候你会因为这个问题考虑换房。先说解决方案,再说预防。这些信息来自一手经验+很多朋友的分享,这篇文章的目标是终极篇,如果有你碰到的情况没有被cover,麻烦告诉我

解决

很多时候堵塞是油脂积累,相对容易一些,不少情况下用化学品(如drano)+热水 或 只用热水可以搞定,可以反复试几次,也可以试试plunger,但如果用了化学品用plunger时得小心,因为容易溅出来。如果不行,拆开下面p-strap清理看能不能解决。如果还不行,用手动蛇或t租电动蛇(譬如RIDGID K-400这一款),最好带sewer gloves/ugly gloves(至少带手套),手动蛇因为没有动力可能走不远。用snake前,建议用wet/dry vaccum把sink里的水吸走,然后拆开管道时慢慢拧开,用一个桶接住,同时准备毛巾吸溅出来的水,没有经验的话场面会比较喜人。

如果不是油脂堵塞,而是starchy food (面粉、米饭、土豆等),化学品和热水可能没多大用,基本上要靠蛇。

不少情况情况可以DIY,但需要请人时不要犹豫,这个比换房便宜很多:-)。plumber工具好而且有经验,既快也好。有些专门做水的华人师傅也能解决大部分问题,跟普通老美plumber差不多。但如果有很难解决的问题,建议找专业的公司,有的公司既快(譬如说2小时内到)也能解决复杂问题,但会比较贵。另外,有些情况要去crawl space疏通,特别是厨房与厕所一起堵上的话。家里的管道宽度一般是2 inch,到下面是3 inch。

问题:能用开水灌sink么?这里有一篇比较深入的技术讨论https://diy.stackexchange.com/questions/88476/should-i-run-the-tap-while-dumping-boiling-water。 我个人经验是只要不是大量持续灌没问题,但每个人情况可能不一样

预防

  1. 切记不要扔starchy food (面粉类、米饭、土豆等)
  2. 很油脂的东西不要扔,盘子上有很多油脂用paper towel先擦掉
  3. 买一个小点的桶套上绿色回收垃圾袋(costco有卖),专门放厨余,之后放yard waste。这一条非常推荐,否则放垃圾桶会导致垃圾桶很臭
  4. Garbage disposal: 建议少用,甚至可以当做不存在。可以买kitchen sink strainer放在garbage disposal口上 (譬如https://www.amazon.com/gp/product/B01CWXLMB8)

P.S.

Compostable bags at Costco

手动蛇

小电动蛇

大电动蛇,下面是RIDGID K-400,Home Depot可以租另一款

贷款 – 找银行做贷款

Jumbo loans只能找银行,conforming loans找银行得非常注意,体验好的肯定有,我在这里分享一些我知道的情况。另外一般来说除了jumbo loans,银行的利率比不上mortgage brokers.

Chase

一位朋友结婚前买的房子,结婚后refinance,说了把配偶加到Title里,结果没加。还好第2次在我这里做refinance发现并纠正了。

另一位微软朋友,很简单的w-2, primary house refinance,花了3个月还没做完

First Tech

一位朋友买房找的first tech,做refinance时银行说让在网上拿报价,但网上报价不清楚没人解释。找一个能报价并解释的人就这么难。

贷款 – wire transfer

Wire transfer在网上很容易做,但第一次做可能不觉得容易。这里简单介绍一下,每家银行都不一样,但大同小异。有些网上银行(e.g. discover bank)需要打电话才能做wire transfer,有个别银行甚至不提供wire transfer

  1. 拿到escrow company发的wire instructions / wire information,注意发件人以免fraud
  2. 在贷款申请时提交过statements的银行网站上点Wire Transfer / Wire Money -> Add a recipient,有的银行要验证码
  3. 填写相关信息:
    • Routing Number, Account Number, Recipient Name
    • 如果需要地址,填escrow company地址,在文档右上角
    • 如果需要Account Type,填Checking
    • Message to recipient 和 Message to recipient bank 填 Escrow No.,这个用来定位一笔wire transfer属于哪个客户
    • 具体金额,escrow company会发邮件告诉你
  4. 提交完成。Wire transfer一般当天或者下一个business day就可以到。做完后不需要跟escrow company确认是否收到。

贷款 – 要闻及利率变化

2/26/2021 Thurs
今天Mortgage Bonds被大量抛售,最后跌了117bp。10年期国债收盘1.515,最高1.614。利率又涨了一些。股市也有一些恐慌性抛售,纳指跌3.56%。

2/22/2021
Mortgage Bonds今天跌了44bp,贷款利率再次上涨。10年期国债涨了2bp到1.367。 Fed Chair Jerome Powell 明天会发言。

2/16/2021
昨天是Presidents’ day长周末,周末还给几位朋友发了quotes,利率很不错,打算今天lender一上班就锁定。结果一大早就收到利率变差很多的短信和邮件。利率跌的程度可以跟股市道指暴跌5%-10%相比,下面有UMBS(Uniform Mortgage Backed Securities)曲线图。给两个具体的例子(为了简化特意省略了其它参数)。同一个lender,一位$660k贷款(非jumbo loan)的朋友,上周五2.75% no cost,今天要近$5000的cost。另一位$950k贷款(jumbo loan)的朋友,上周五是2.75%,今天3.25%,说明一下,jumbo loan有点特殊,别的lender不一定有这么大的变化幅度。

这种情况过去出现过几次,但没有这次跌幅这么大。利率很难预测,目前只能等等看利率能不能变好一些。之前锁定的利率不受影响。

UMBS 30yr 2.0%

与此同时,10年期国债收益率上涨了不少

道指DJI今天创新高31,522.75

12/11/2020
好消息。conforming loan limit已经从2020年的$510,400涨到2021年$548,250,high balance loan limit从$741,750涨到$776,250 (King, Snohomish and Pierce)。这意味着一部分high balance loan成为conforming loan,一部分jumbo loan成为high balance loan,利率可能会更好。不少lender本周末开始接受新的贷款额度。过去几个月一些朋友不得不多还款来争取更好的利率,现在可能不用了

Repurposing my blog

My original idea was to make this a purely technical blog. When I was working on building the core infrastructure in Azure I thought that I could write something about how it was built. However I couldn’t write much because most of the time I was working on confidential projects. Cloud computing is a very competitive area as you may know. The 2nd reason is that there is already so much useful info on technologies and I wouldn’t be able to provide the best value by focusing on only technical stuff.

Anyway I have decided to write whatever I think can provide more value. The audience is people in the United States. I will write in Chinese most of the time since there is less info in Chinese. The main focus will be IT and Real Estate.

Solving CORS issue became easy

// If you don’t have time just jump to the last section – takeaway. If you do that solving CORS issue will be easy.

CORS stands for cross origin resource sharing. Let me use a simple example to explain the basics.
Say that you have a web site http://foo.com and it has a client side javascript which uses AJAX to call http://bar.com to get some info. That is a CORS request. To make the request successfully the server needs some change to allow CORS requests.

What is considered cross origin? Use http://foo.com as an example the below urls are considered as different origins.
Https://foo.com (different scheme)
Https://foo.com:8080 (different port)
Https://api.foo.com (different subdomain)
Https://bar.com (different domain)

In some cases a complaint browser may send a preflight request before it allows the request to be sent. Let me use a real case to explain.
Scenario: Client side uses token authentication to get info from server side

1. The client side javascript sends a POST request to https://localhost:44300/Account with token (basically http header “Authorizattion”:”Bearer aAbdkkixlkid…”)

2. The browser determines a preflight request is needed and it sends preflight request
3. The server has to respond with status code 2XX AND with required headers. In this case Access-Control-Allow-Origin cannot be *. Access-Control-Allow-Headers has to contain Authorization.
4. The browser then sends the actual request.

preflight request

actual_request

Actual request

preflight_request

Takeaway

I spent a lot of time solving my particular case and read tens of links. In the end it I found that it could be much simpler and quicker if I knew the below two things.
1. Read just one link https://msdn.microsoft.com/en-us/magazine/dn532203.aspx
2. Do check the console message when useing developer tools in browser. I didn’t check the console message. Otherwise it could have saved me a lot of time. The below is a screenshot from Chrome. It tells exactly what went wrong. It makes trouble shooting much easier.

chrome_console

Big Bonus if you are using ASP.NET Web API

Web API presents a unique challenge that the “/Token” service is different from the normal Web API controllers and the nuget cors package only works for web API. Some people suggest adding the below in web.config. It will work for “/Token” service but NOT web api especially when you are using https. The chrome browser does not allow “*” in Access-Control-Allow-Origin.

<add name=”Access-Control-Allow-Origin” value=”*” />

The solution is adding the below code at the top in IdentityConfig.cs.

if (string.Equals(context.Request.Uri.PathAndQuery, “/Token”, StringComparison.OrdinalIgnoreCase))
{
context.Response.Headers.Add(“Access-Control-Allow-Origin”, new[] { “http://foobar.com” });
}

 

 

TF401189: The source branch has been modified since the last merge attempt

If you are using Visual Studio Online and setup your project using TFS doing a code review is straightforward in visual studio.

However ff you are using Visual Studio Online and setup your project Git you might wonder how you can conduct a code review. You may do a quick search and then try ‘new pull request’ . You might get a weird error message you don’t understand.

TF401189: The source branch has been modified since the last merge attempt

Then you do another search (bing or google) you won’t find anything useful.

After trial and error I found that the root cause is that I didn’t use a topic branch. It is that simple.

Two useful links as below

https://www.visualstudio.com/get-started/code/git/pullrequest
https://blogs.msdn.microsoft.com/visualstudioalm/2014/06/10/conduct-a-git-pull-request-on-visual-studio-online/ (unfortunately all the images are missing)

Debugging a weird process crash issue

I recently debugged a very interesting process crash issue. The code was running in the cloud so I could not just attach the debugger as easily as on my dev box. Besides using debugger should be the last option in my opinion. So I logged on to the machine. Well before that I had to go a through a process to get permission and get the environment ready for security/compliance reason. I observed that the process was recycling by using taskmgr. So I did the below things
1. Checked the logs. No exceptions. No errors. No logs related to the crash
2. Checked crash dump files. No files were there
3. Checked OS eventlog. No crash events. Normally for any process crash there is at least one event

I never saw a process crash like this. But I knew the related code which caused this. It was a background task kicked off by calling Task.Run(). I thought that there must be some unhandled exceptions but I checked the code. There was already a catch block which caught all exceptions. However it was still possible that the catch block might throw exception. So I put another catch all inside the catch block to make sure that no unhandled exception was thrown.

However it did not work. The process was still crashing. I asked around about how a process could crash since I was relatively new to the code base. I got some pointers but none of them could match what I observed.

Then I had to turn to the last option. I copied windbg to all the nodes (remember that this is distributed system and there are multiple replicas) and hooked it up with the process. Boom! I got an exception in the debugger and then the process crashed.

I looked at the exception which was a normal .net exception. I could not think of a reason how it could cause crash. Then I looked into the call stack and saw the below line.
000007f9`8538bb27 : 0000001b`9c29cf80 0000001c`2c50c880 0000001c`2c50c888 0000001c`2c50c890 : mscorlib_ni!System.Environment.Exit(Int32)+0x7b

That was really weird. My code was calling a library from another team. So I got the tool ILSpy (I don’t use .net reflector anymore btw) and looked into the code. Man the code was calling Environment.Exit() when a certain exception threw! That explained everything. As for why the coding was doing so this was a new library and I guess that the piece of code was copied from somewhere else.

From the above text it looked that it didn’t take much time. In reality two days passed.

StackOverflow Exception, Long time no see

I have not seen a stackoverflow exception for a long time. Today I happened to bump into one in random test code. I will explain how it happened. What the code is used for and why it was written this way are not interesting to me and are not in the scope of this post.

    public class ChildClass : BaseClass
    {
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                base.Dispose();
                //DO something
            }
        }
    }

    public class BaseClass
    {
        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        protected virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                //DO something
            }
        }
    }

As you can see the stackoverflow exception will happen as the below
1. Child.Dispose(bool)
2. Base.Dispose()
3. Child.Dispose(bool)
4. Base.Dispose()