根据维基百科咖啡是采经过烘焙过程的咖啡豆(咖啡属植物的种子)所制作冲泡的饮料,是人类社会流行范围最为广泛的饮料之一。咖啡中咖啡因对人体有刺激的作用,人们在学习、阅读和思考等脑力活动时经常用来提神。大部分的研究建议,适度饮用咖啡是有益的,甚或有利于健康的成年人。

咖啡的种植首次发现于非洲埃塞俄比亚,最早的可信证据出现于 15 世纪也门的伊斯兰教苏菲派(Sufism),在非洲之角及也门,咖啡被用于当地的宗教仪式。17世纪咖啡的种植和生产一直为阿拉伯人所垄断,在欧洲价格不菲,只有欧洲上层人物才能饮用咖啡。大航海时代由欧洲殖民者扩散到东南亚与南美洲殖民地,因大量生产而价格下降的咖啡开始成为欧洲人的重要饮料。

简介完毕,下面分别讲讲各种常见的咖啡形式。

Read More

When you want to setup proxy to debug network traffic as you do in developing native apps, you will find there’s no traffic comming through. The reason why this happens is that the proxy configuration in Andorid or iOS Wifi network settings don’t affect Flutter.

So we have to set up the proxy in our Flutter app. Luckly it’s just a piece of cake with the code below:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
class MyProxyHttpOverride extends HttpOverrides {

String _ipAddress;

MyProxyHttpOverride(String ip, String port) {
_ipAddress = '$ip:$port';
}

@override
HttpClient createHttpClient(SecurityContext context) {
return super.createHttpClient(context)
..findProxy = (uri) {
return "PROXY $_ipAddress;";
}
..badCertificateCallback =
(X509Certificate cert, String host, int port) => true;
}
}

void main() {
HttpOverrides.global = MyProxyHttpOverride("192.168.1.xxx", "8888");
runApp(MyApp());
}

Important things to know:

  1. HttpOverrides.global must be set before using any HTTP methods
  2. If proxy configuration (IP or port) is changed during using, the app has to be killed and relaunched for the new configuration to take effect
  3. For HTTPS, certificates are loaded from the OS, same as native apps

When you are searching for AWS Cognito SDK that can be used in Flutter, you will soon be shocked that there’s no official support yet. According to a thread in AWS forum, one guy says:

I work on the AWS SDK team. I am not aware of any plans to support Flutter at this point. I will take this to my team as a feature request and will post back on this thread/or through a general forum announcement if our plans change in the future.

This is still true as of TODAY (October 2019).

So there are two community packages out there, which are amazon_cognito_identity_dart and flutter_cognito_plugin. The former is a pure Dart one translated from AWS official Javascript SDK, with good examples, but last active date was 7 months ago. The latter uses native Android and iOS AWS SDK by wrapping them into MethodChannels, still activily in development.

TL;DR

I chose amazon_cognito_identity_dart out of its pureness in Dart, the first try was successful. But later on found 2 major issues, all fixed in my fork. If you are not interested in the details, you can check that out and follow the usage there.

Read More

Situation: I have an existing iOS app and an Android counterpart, and will be moving to Flutter to leverage the cross-platform ability. But there’s a new feature has to be added on time, is there a future-proof solution that I can avoid re-writing the same feature later on?

The answer is YES, IF it does not rely too much on communication with existing apps. So we can do:

  • Develop the new feature using Flutter
  • Add the new Flutter module into existing native Android and iOS apps
  • Write platform specific code in Flutter, and/or add bridging code to Flutter and/or native apps as required
  • Reuse this Flutter module in the future unified Flutter app

Read More

宝宝出生对每个家庭来说都是一件大事,新手爸妈没有经验更可能手忙脚乱不知所措。这里预习一下在新西兰的医院生孩子的流程是啥,从中也能看看西方发达国家的一些人性化的关怀。

怀孕前期

怀孕前三个月归家庭医生 GP 管,平时看家庭医生是需要一定费用的,有的便宜诊所可能十几刀,贵的有六七十刀,但是怀孕期间完全免费。一般自己在家里用验孕棒两个星期左右都是阳性就可以确定怀孕,这时可以预约家庭医生,医生会做一些基本检查,还有告诉你简单的怀孕期间需要注意的事项,特别是食品安全方面的;告诉你要找助产士,怀孕 3 个月以后主要由助产士负责。还会给你一个本地 bounty.co.nz 怀孕知识网站赠送的怀孕小礼包,主要有一本书按怀孕周数写着实用小知识的手册 Your Pregnency,还有产后妊娠纹修复霜(palmer’s)、宝宝屁屁霜(sudocrem)的试用装。

Read More

UPDATED: Updated for Flutter v1.9.1.

TL;DR: this guide gives a real example (which is a minimized version that comes from our real project) when you follow the Official wiki: Add Flutter to existing apps, covering some common issues you might have. Check out the full FlutterHybridExample in Github to see what it looks like when done.

Consider this situation, you have an app that works for both Android and iOS platforms, you developed them in a native way to get the best performance and user experience possible. Then one day you need to add a new feature to make it more attractive, which means the same thing has to be done twice, one for each platform. You heard of fancy and shinny stuff - Flutter that promises to work for both platforms and claims to bring native performance. But you can’t afford the time in totally rebuild the app, you still need to keep things running for existing users, just like doing an open heart surgery. So my answer is:

  • Develop the new feature using Flutter
  • Add the new Flutter module into existing native Android and iOS apps
  • Write platform specific code in Flutter, and/or add bridging code to Flutter and/or native apps as required

Read More

总评分:4.5/5 设定合理,剧情紧凑、一波三折,主角神演技,镜头构图佳

社畜友好指数:5/5 看完充满正能量,搬砖力量+10086

鸡汤指数:5/5 营养全面,纯天然鸡血不尴尬

《陆王》是日本商业小说家池井户润的一部小说,故事开头是老年企业家在时代大潮下原来从事的行业越来越不景气,导致员工流失、订单不断减少、银行融资断绝,不得不再次裁员……

池井户润早年在日本最大之一的三菱银行工作,所以对金融、银行有比较深的了解,善于包装金融知识融入小说剧情中,有些甚至来源于真人真事,能做到保持一定合理性的同时有很强的戏剧性。代表作是《半泽直树》系列,特点是结局一定是喜剧,但过程绝对一波三折,跌宕起伏,明知他是套路你却有欲罢不能,最适合社畜阅读解气,剧中名句是“加倍奉还”。

1. 老年危机悄然降临

主角宫泽紘(hong2)一是一个五十多岁的大叔,有一个大学刚毕业的儿子和一个还在读高中的女儿。经营着一家有着 20 名员工的小型乡镇家族企业——小钩屋,比起全盛时期 200 名员工仅余十分之一,作为百年老店的第三代继承者的宫泽大叔生意一直没什么起色,仅仅是勉强维持生计。而且公司产品足袋,也就是日式二趾袜,是一种传统商品,年轻消费者嫌老土,销量逐年下降。就像温水煮青蛙,危机一步一步的开始降临这家百年老店;公司独特的合脚缝纫技术也无用武之地,如同石器时代结束不是因为石头采光,而是不在需要石头了。主角也就等待着企业在自己这一代慢慢凋零,甚至让自己儿子不要继承家业,自己出去闯荡。要知道日本人对家业看得很重,当作是自己家族荣耀的。

社长奔跑的背影贯穿全剧,一直在救火一直在奔走

Read More

The problem

Starting from at least version 3.1.3 of Android Sutdio, the local jar/aar library refresh mechanism seems to be broken.

The situation is I have a local aar library named my-lib.aar, which is my product, placed under $project_root/app/libs. Whenever I change the code I will compile a new aar library and replace the old one with the new. It was awesom before Android Studio 3.0.0, the IDE can recognize the library has changed and load it automatically, so what I need to do is just hiting the run button then a new app with my new library will get built and run. However, with 3.1.3 and it is still broken in the latest 3.1.4 released August 2018, the aforementioned process will end up with the app built with the old library.

The fix

After experimenting a while, the easiest workaround is to delete the IDEA cache config file for that library, which is $project_root/.idea/libraries/Gradle__your_package_name_version.xml. Optinally, you can also delete cache file at ~/.gradle/caches/transforms-1/files-1.1/your_lib_name.aar, which just eat up a bit of your storage but won’t mess up your build. Tested with MacOS, should also work for Linux OS.

关于新西兰的信息有点割裂,用现在的话说是“精分现场”。在来之前查到的移民、留学介绍说得像天堂一样美好,什么“从摇篮到坟墓的福利”,免费医疗、免费教育不用花一分钱,还有各种福利补贴。等到过来后直呼上当,当地自媒体微信公众号总是渲染医疗又贵又慢、医生技术差,到处都有劫匪抢劫,学校教育懒散等等。前后描述的似乎不是同一个地方。这是因为前者为了做成生意,夸大宣传,故意隐瞒了领取福利的条件;后者为了吸引眼球骗点击,故意渲染事件严重性,把个案说成普遍现象,一直看这种媒体会有种吃枣药丸的感觉。其实这两个极端的信息都是不准确的,对于真正有困难的人来说,例如残疾、孩子特别多的家庭,福利确实比国内好很多;而对于勤劳工作的普通中产阶层,福利接近于无

其实问题核心是权利和义务对等,常识是一个国家福利水平高那税收肯定也高,所谓取之于民用之于民;福利低的国家税收也低,更有利于人民发挥创造力,谋求个人发展。就算不考虑贪污腐败,如米尔顿·弗里德曼所说,“拿自己的钱替自己办事,最为经济;那自己的钱替别人办事,最为有效(注:例如送礼给人总倾向于送好的,经常超出接收人需求);拿别人的钱替别人办事,最为浪费”,政府属于最浪费那种“拿别人的钱替别人办事”中间还要收佣金。对于信奉自由派市场主义观点的人来说,福利来源于你我缴纳的税,低福利才是符合常识的,意味着更低的税负水平,但同时遇到意外变故时又有基本的有尊严的生活保障。

Read More