Monthly Archives: March 2019

Python – how to set default value for unavailable property

You can use getattr(): getattr(a, ‘property’, ‘default value’); Here ‘a’ is the object you want to get ‘property’ from.

Posted in Uncategorized | Leave a comment

Google App Script – stringify form submit event object

Here is an example of the object. I post it here because I can reference it quickly when I need it. {“authMode”:{},”values”:[“3/15/2019 8:41:57″,”Jimmy”,”test@yahoo.com”,”sum”,”loc”,”Computer”,”1″,”3/27/2019″,”details”],”namedValues”:{“Priority”:[“1″],”Email address”:[“test@yahoo.com”],”Location of problem”:[“loc”],”Summary”:[“sum”],”Equipment and Items to Move”:[“Computer”],”Timestamp”:[“3/15/2019 8:41:57″],”More details”:[“details”],”Due date”:[“3/27/2019″],”Name”:[“Jimmy”]},”range”:{“columnStart”:1,”rowStart”:22,”rowEnd”:22,”columnEnd”:10},”source”:{},”triggerUid”:”579782″} If the trigger was triggered when it … Continue reading

Posted in Uncategorized | Leave a comment

Google spreadsheet – how to add unique id?

This formula is what you want: =arrayformula(if(row(A1:A)=1,”UNIQUE ID”,if(len(A1:A)>0,98+row(A1:A),iferror(1/0))) Do not try to use ScriptProperties. It is very problematic and you’ll regret.

Posted in Uncategorized | Leave a comment

投资房报税的基础知识–写给初入门的小地主

转自: http://bbs.wenxuecity.com/bbs/tzlc/1305590.html 本人业余地主一枚,难免有错漏之处,请见谅微笑 收入是房租;cost包括:维修,地税,贷款利息,HOA,折旧,travel, mileage,meal (50%),广告费用,保险等。如果收入减cost算出来是正的,就是有净收入,按Ordinary Income报税;但是如果算出来是负的,不能从ordinary income里抵 (两种情况例外:1.real estate professional可以deduct所有rental loss, 2.收入比较低可以deduct up to $25000 rental loss),只能carry over到出租房盈利的时候从盈利中抵扣,直到deduct完全部的rental loss;如果卖了房,loss还没有deduct完,可以从卖房的property gain里deduct;如果卖房的property gain 还不够deduct 以前的rental loss,可以从卖房那一年的ordinary income里deduct;如果卖房那一年的ordinary income都扣完了还没有deduct完,可以从下一年的ordinary income继续扣。如果你要抬扛说,到死了还没deduct完,我很遗憾的告诉你,不能延续到你娃让你娃接着deduct 关于QBI (Qualified Business Income),如果投资房有盈利(收入减cost后大于0),可以考虑用QBI, 头20%免税,但是要求每年至少有250小时花在投资房上,2018年不需要记录这250小时,2018年后需要记录;并且收入不超过41万5 。QBI从31万5开始phase out,到41万5完全phase out (numbers are for couple,single减半) … Continue reading

Posted in Uncategorized | Leave a comment