Sutff Fibre怎么样/评测

SutffFibre应该是目前性价比最高的千兆光纤,用这个链接注册,前6个月半价,折每个月才$67刀,在别家这个价钱最多也就是个100M光纤。

已经用了三个月,没有超出预期,但是绝对够用。据我所知在北岛,奥克兰和惠灵顿有接入点,其它地方的流量都是接入到这两个点。对上网和视频影响不大,游戏的话,可能会有影响,但是极其细微,延迟上的影响也是10ms以内的。

送的华硕路由器很赞,超稳,很良心。之前用的2Degress家送的Fritz Box经常不明原因断网,这个情况在华硕身上从来没有出现,而且华硕路由器可玩性比较高。

Stuff Fibre还支持静态IP,只要一次性支付$50,这也是绝无仅有了。其它家大部分都是收月费,10刀起。如果想在家搭个网站,或者有远程查看监控视频这种需求,搞一个也是蛮好的。当然,不搞的话,配置个DDNS也问题不大。

来吧,搞起

 

新西兰最便宜的电力公司 – Cheapest power companies in New Zealand

好吧,我承认我是想赚点佣金,但是下面讲的绝对是实话  😀

Powershop – www.powershop.co.nz

新西兰的电真心贵,之前用过Energy Online,略贵,后来换成Powershop。最近原本想看看哪家更便宜,然后对比了一下,还是Powershop最便宜。听说Electric Kiwi比较便宜,然后就去看了一下。他们提供一个比价的工具,一对比,竟然说,You are already on a good deal…  也是够实诚的。

三口之家,冬天晚上开电暖气,白天经常开空调,一个月大概$180上下。夏天,不经常开空调,一般都在$90以下。感觉三口之家用low user(年用电9000度以下)的费率就好了,虽然每度电贵一些,但是日租一般只有30 cents – 不然后话,日租要$2左右,顶不少度电了。

Powershop家还提供好多打折的电费包可以提前买,还可以额外多省出一部分。来吧,同学们,用这个链接新注册还可以得到$150的credit,超合算有没有。要想省点电费,还是得一两年换一家啊!

Fix! Unable to Remove bluetooth devices/mouse/keyboard/speaker issue for Windows 10

This is the only working solution for me. Enjoy.

My symptoms:
– Previously working bluetooth speaker (UE BOOM 2 in my case) stops connecting
– Windows 10 ‘Bluetooth and other devices’ menu shows the device as Paired
– Pressing connect makes it attempt to connect but fails then it goes back to Paired
– Remove device hides the device from the menu, but as soon as you turn bluetooth on and off, or restart the computer, the device comes back
– You pull your hair out.

Solution that worked for me after much, much unsuccessful internet trawling and one system restore:
– Download this 7 year old command line bluetooth toolset: Bluetooth command line tools – work with bluetooth from the command line
– Install it, make sure you enable the option to “Add Bluetooth Command Line Tools directory to path”
– Open Powershell
– Put your device that isn’t working properly into pairing mode
WARNING: THE FOLLOWING COMMAND WILL UNPAIR ALL BLUETOOTH DEVICES
– type in “btpair -u”
– Boom, all of a sudden Windows asks me if I want to allow pairing to my device that isn’t working
– Hit yes, successfully connected again
– Cry tears of joy

God I hope that helps someone else.

Credits: xzion .

Example of Sending SMS in PHP Using AWS SNS

$client = AWS::createClient('Sns');
$sms = [
	'Message' => 'sms_content',
	'PhoneNumber' => 'sms_recipient',
	'MessageAttributes' => [
		'AWS.SNS.SMS.SenderID' => [
			'DataType' => 'String',
			'StringValue' => 'AD'
		],
		'AWS.SNS.SMS.SMSType' => [
			'DataType' => 'String',
			'StringValue' => 'Transactional'
		],
	]
];
$result = $client->publish($sms);

[CI] Bulb Switcher

 

There are n bulbs that are initially off. You first turn on all the bulbs. Then, you turn off every second bulb. On the third round, you toggle every third bulb (turning on if it’s off or turning off if it’s on). For the nth round, you only toggle the last bulb. Find how many bulbs are on after n rounds.

It’s quite a interesting problem and more like a math problem than a coding one. The direct solution is do the swith round by round and we can get the result at the final round. The time complexity of the direct solution is O(n2). The example code is as follows,

public int bulbSwitch(int n) {
		int[] lights = new int[n];
		int cnt = 0;
		int i = 0;
		// initailize the array
		for (i = 0; i < n; i++) {
			lights[i] = 0;
		}
		// do the round toggle
		for (i = 0; i < n; i++) {
			for (int j = i; j < n; j += i + 1) {
				lights[j] = lights[j] == 0 ? 1 : 0;
			}
		}
		// get the result
		for (i = 0; i < n; i++) {
			cnt += lights[i];
		}
		return cnt;
}

Seems like a perfect answer which definitely is not. When I submitted the above code on LeetCode OJ, the platform threw out an error of RUNNING TIME OUT. So it’s time to get the code optimized.
As you can see, each one of the bulb is turned on or off for n times which is the number of divisors. But still this cannot solve our problem for the time complexity is O(n2) too! What about printing the result to see whether there is a pattern? Let do it.
when n=40, the result is 1001000010000001000000001000000000010000 . And when n=60, the result is 100100001000000100000000100000000001000000000000100000000000 .
What do you see, guys? Yes, the mumber of each group which has only one 1 is an Arithmetic sequence. So we can get the final result without any toggling rounds. A half but passed solution is as follows,

public int bulbSwitch(int n) {
		int cnt = 0;
		for (int i = 3; n > 0; i += 2) {
			n -= i;
			cnt++;
		}
		return cnt;
}

That’s it.
The time complexity of the above code is O(n) and the code can pass the OJ’s test. But is this the most optimized one? No, of course. If you know more maths, the above code can be optimized to the time complexity of O(1) which means there is some formula to get the final result. Can you figure it out, buddy?
By the way, the Ultimate answer is  SQRT(n).
source page: https://leetcode.com/problems/bulb-switcher/

健身计划一期(2015.8.28-2015.10.31)

大家相互监督、相互鼓励,把身体练好!
目标
体重不做高要求,减10斤左右即可,关键是脂肪减下去,肌肉长起来
人员
jasper, bill, xinli
一期周期
2015.8.28-2015.10.31
时间
每周保证四天,每天中午至少一小时
流程
11:40出发,健身完毕后洗澡,吃饭
健身流程

  • 跑步30min以上
    • 慢跑,心率140-160 beat/min
  • 柔韧5min
    • 压腿
    • 扭腰
    • 胳膊
  •  力量15min,包括
    • 臂力:选择合适重量,每组15个,至少两组,做到不能做为止
    • 腹肌:仰卧起坐或够腿,每组15个,做到不能做为止
    • 卧推:选择合适重量,每组20个,至少两组,做到不能做为止
  • 放松活动10min

饮食

  • 健身时多饮水
  • 多吃蛋白质,如蛋清、瘦肉、鸡肉、豆制品、脱脂奶等
  • 少吃碳水化合物,如米饭、馒头、面条等主食,糖类等
  • 不吃油炸、肥肉、坚果等高脂肪含量的食物
  • 不喝饮料(0热量的可以)
  • 晚饭少吃
  • 保证睡眠,良好的睡眠是最轻松的减肥方式

面试程序题-二分查找(1)

一个数组,大小先减后增,请找到增减部分的分界点,要求算法时间复杂度O(logN)。
下面给出了一个递归实现的版本。
这个问题还可以让查找其中的某个元素,也是二分,思路一样。

#include <iostream>
#define MAX 13
using namespace std;
void findBreakpoint(int* a, int starti, int endi){
int i = (endi-starti)/2+starti;
if(starti==i){
cout<<i<<endl;
return;
}
if(a[i]<a[i+1]){
findBreakpoint(a, starti, i);
}else{
findBreakpoint(a, i+1, endi);
}
}
int main(){
int a[MAX] = {12, 11, 10, 8, 5, 6, 7, 9, 11, 12, 13, 20, 50};
findBreakpoint(a, 0, MAX-1);
return 0;
}

一面在准备一些基础的算法,一面在准备语言相关,泛技术渣太苦逼了,在准备两种语言PHP和Java,而我最近一直在做是却是C++,是不是相当奇葩。。。