Welcome, this is Dr. Cu.

Lonely in the Dessert.

Hands-on Review on M$ Band

作为穿戴手环的早期用户,从开始基本只可以记步的nike fuelband到后来可以测睡眠的fitbit,一直都觉得这玩意挺lame的,成本低的一逼,使用体验弱的一叉。所以自从我的flex丢在大峡谷,就没在考虑这个。本想着Apple Watch可以重新定义这类产品的新标准,结果丑的一坨,更牛逼的是价格。。这玩意价格不控制在200以内你要抢钱啊,不过不排除果粉尤其女果粉的继续追捧。 虽然除了xbox,不用微软家的东西好多年,但是一直信赖软家的工艺水准,从上大学时候的大白鲨小白鲨鼠标到后来革了wii命的kinect。另外,199.99(不包括税)的价格也基本能接受。所以release当天跑到phx唯一一家microsoft store弄到一个,还送了跳绳一个。。。有好多朋友问我觉得这东西咋样,我就总结下。 使用体验目前是比较满意,刚开始会觉得不太舒服,可能是这个手环略沉,带子略硬的原因。但是工艺水准远超其他各种手环几条街。戴了两三天后,基本就很适应了,完全体会不太到存在感。和其他带显示屏的手环不一样,这个band的显示屏是朝手腕内的,一开始觉得别扭,后来发现这个更方便的多,尤其跑步的时候,看自己的心率和距离的时候非常方便。但也是这个原因,建议大家贴个显示屏膜,原因有两个。(1)用键盘打字的时候会经常摩擦摩擦(又要哼起来,药不能停)。。(2)这个屏幕特别爱出油,尤其手指头chu了几下完全不能看了,贴了膜后也不出油了,心情好好哒。买这个band,会送一个配套的贴膜,可以自己贴。很简单,我这么手笨的都一点问题都没有。 对于显示屏还有个问题,就是手指滑动操作的时候不够smooth,有点像早期配置低的android,或者升级到ios6的爱疯4。。但还是可以接受的范围内。毕竟大部风时间用这个手环都是一些消息pop up出来,你看看点下dismiss就好了。 功能上,可能M$的band可以干翻所有市面其他手环,heart rate, gps, sleep tracking, steps, distances, alarm, calorie。除了这个,最让我满意的是可以和爱疯同步,比如来电,短信,邮件,reminder,手机上的闹钟都会及时现在手环上震动并在显示屏popup。据说和安卓也没问题,但是不确定,大家可以自己网上搜下。无限好用的是可以和ios notification center 同步所以即使是微信,twitter,facebook什么的都可以把消息popup。一个问题就是,不支持中文还。但至少你知道谁发的邮件或者短信或者打的电话,你掏出手机看就好了,对于不重要的你可以暂时不理会,怎么也可以省不少手机电不是。对于我来说最重要的三个功能,是心率,睡眠和g p s的监测,我觉得完全ok,尤其是gps,第一次用的时候找卫星信号有点慢,我特么跑了一公里出去才locate到,但是后来都超快,瞬间连接。我的建议就是跑步的时候把g p s打开,没事就关掉,不然很费电。至于电池,微软说是48hours,我觉得一点问题没有。但是如果天天跑步开gps的话,可能要每天充电,戴过gps watch的都知道,这个确实太费电。还有个比较fancy的功能是,你可以甩手环买starbucks了,在美帝是可以,不知道国内是不是支持。我在琢磨是用iphone 6 plus甩起来帅一点还是把手轻柔的伸过去更帅,下午去试试。 需要吐槽的是手机端的app,做的实在有点配不上这个手环。。同步起来慢得一逼。 有人把这个定义成第三代手环,我觉得还是算了,我觉得之前那两代也就算是玩具,把这个band当作以后同类产品的标准不过分。”你会推荐给朋友么?” 答案是会,可以入手。

Postcards as Promised

海风映着夕阳,一位蓬头垢面的老头儿用光了最后一个便士买了个明信片,呆呆地凝向地平线,他不知道曾经心爱的女人如今在世界哪个角落,他只知道她正幸福地生活,也许膝边簇拥着她的孙子孙女,还有暖暖的炉火,画面朦胧着,唯有那面庞清晰还有她引为骄傲的弯弯的眼眉,纵使皱纹爬上了脸庞。趁落日还有余晖点亮那海面,他缓缓地将明信片小心地放入身旁那尊孤独的邮筒。地址是空白。

Trips to the Grand Canyon and Petrified National Forest Park

It’s a late homework, before it’s too late. In the end of May, our lab headed for the Grand Canyon for our trips. It’s a long way from here Phoenix, but it’s definitely worth it when you stand by the side of the canyon. You can feel the strength of nature as a tiny human being. it’s a pity though for me not to hike down all the way to the Colorado river due to limited time. But I still caught its beauty and power through my camera.

After visiting the grand canyon, we went to the Petrified National Forest Park. It’s a total different beauty, and I believe ti will not lose to the Grand Canyon. All the woods you see is acturally stones, which were gradually petrified from the woods during perhaps a span of millions of years. The colors are beautiful, almost the same you will see in the photos I shot. If you have time, I strongly recommend this amazing park. There seems much less people knowing this place, and the visitors are also much less compared to the grand canyon.

So far I have visited all 3 national parks in Arizona.

A Fantastic Hiking, Camping and Climbing Weekend

We packed up and drove to Sedona in the early morning on Sat. The “red rock” mountains are gorgeous. I didn’t bring the cameras but left them in the car. But I still got some before the hike. We picked the Secret canyon loop trail and there is a rather rugged path to go before reaching the trail head from the road. This 6-mile path even killed us, and it took nearly 40 minutes. I highly recommend you drive a SUV or Jeep if you want to get there.

Then, we drove north to Flagstaff where we luckily came across a lovely small local concert. After dinner, we escaped from the civilization and camped in the forest. The sky was dark and clear, and we could see the shining stars and the galaxy. After setting up the camera to capture the star trail, we drank beer and shared stories as usual. After 2 hours when the temperature went down, we slipped into the tents to get some sleep for the bouldering next morning.

I waked up early in the morning, and I always do when camping. The air was so fresh, and birds were singing around. I hiked further into the forest alone, and that was an almost isolated world. After my couple friends waked, we cook some noodles, collected the garbage and left for the climbing site.

The rocks are so sharp. My hands felt like being cut by knives. But it’s still fun to climb with my friends and even strangers.

For more photos, please go to here.

2014世界杯怀旧发骚

那天和july简单逗了两句贫,作为看球早就很少投入感情且会毫无人性嘲笑因为男模队回家强说愁思少女眼泪的老鸟儿,思绪却恍惚到了那个会轻易动容的年代。在教学楼二层角落的教室,一群孩子和一个足球仿佛是每天的主题,那是红白机过气玩街机看起来已经不够屌看毛片儿还被斥下流的时代,没网络,没手机,简单美好。偶尔会有个别女生坐在我们除了铃其他部分都响还没挡泥板的自行车后座,不经意甩下一向政教处拿哥们儿没办法的长头发哼哼那句“我踢球你介意么”,然后粗鲁不等人家回答便感觉特牛逼地狂蹬向夕阳下的麦子地,对,只是踢球没别的。。我们奔跑着,吹着牛逼,骂着街,糟蹋着庄稼,喝着冰镇汽水,连我现在都想不明白,那会烟都会作两口为啥没碰过啤酒,我现在想可能是因为少年还是喜欢甜的吧,就像我们那会一致喜欢清纯的姑娘,胸不能太大。等回过神我又不确信那是个夕阳下的午后,但确定画面是发黄的,也可能那些孩子确实有点黄的原因吧。再粗糙的人心里都还是会保留很多脆弱的小记忆,就像碎片不经意间重新组合起来,可能在刚喝完酒或者正戴着耳麦发呆的时候。我始终觉得作为一个老爷们儿,要在班主任政教处家长的围追堵截下来(1+)段轰轰烈烈的早恋,更要永远有一支属于你自己的球队,他们总会在某个时间突然就带你回去看看,还是那个午后。也许你会对后座那个姑娘的容颜逐渐模糊(骗领导必须这样),但是球队里的每个人都会记忆清晰,尽管那时我们崇拜卡尼吉亚罗伯特巴乔巴蒂斯图塔,但是现在在我心里我的那些小伙伴们才是永远的球星,虽然大部分如今都水桶腰走路都喘个不停了吧。一不留神就苍老了一段年华。

Team Hiking @ Saguaro National Park

This is the 1st time I spend the Chinese lunar new year abroad, and miss the warm atmosphere of family union in the past. My wife didn’t come back to Beijing neither, and she is still in Hong Kong. As my grandma said over the phone, four people four places for my family (My father was quite busy last year, and only came back to Beijing once for several weeks). Hope I can find some time to rush back soon.

A good thing for me is, the team I just joined at ASU is fantastic. People in the lab are very nice, and I love the working environment where every one is trying their best. Last weekend, we went for a hike at a nearby national park (“Saguaro National Park”, around two hours’ drive south). To be honest, the view is a little bit disappointing as all the plants there are some kind of cactus, too boring. Of course, the special one is always the saguaros. But on the whole, it’s an interesting hike, and we are planning to have some camping somewhere next time.

Here are some photos.

Wireless Failure After Upgrading Ubuntu on a Macbook Air

It feels really nasty when you find the wireless down after rebooting from an upgrade. A simple command will secure the situation by reverting back to the original driver. A lesson from this is: never touch the wireless driver especially when your laptop has only one network card to use.

1
sudo modprobe brcmsmac

Clean Code

What is clean code?

Here are some words quoted from famous guys.

    "I like my code to be elegant and efficient. The logic should be straightforward to make it hard for bugs to hide, the dependencies minimal to ease maintenance, error handling complete according to an articulated strategy and performance close to optimal so as not to tempt people to make the code messy with unprincipled optimizations. Clean code does one thing well."

—Bjarne Stroustrup

    "Clean code is simple and direct. Clean code reads like well-written prose. Clean code never observes the designer's intent but rather is full of crisp abstractions and straightforward lines of control."

—Grady Booch

    "Clean code can be read, and enhanced by a developer other than its original author. It has unit and acceptance tests. It has meaningful names. It provides one way rather than many ways for doing one thing. It has minimal dependencies, which are explicitly defined, and provides a clear and minimal API. Code should be literate since depending on the language, not all necessary information can be expressed clearly in code alone."

—Dave Thomas

    "In recent years I begin, and nearly end, with Beck's rules of simple code. In priority order, simple code: (a) Runs all the tests (b) Contains no duplication (c) Expresses all the design ideas that are in the system (d) Minimizes the number of entities such as classes, methods, functions, and the like."

—Ron Jeffries

My Hands-on Review on Blackberry Q10

After using my brand new Blackberry Q10 for a few days, I really feel that RIM has done great jobs on this device with the classic qwerty keyboard.

Blackberry Q10Blackberry Q10

For the hardware, Q10 is absolutely sturdy. At first sight when it was rolled out, I thought it seemed like a “downgrade” from the bold 9900 which I love a lot. But when you get hands on it, you can immediately sense the quality and the classic blackberry flavour. Though I prefer the curve keyboard on bold 9900, Q10 definitely wins out on the whole, e.g., the screen, the battery and the craftwork. But two things I should mention, (1) the back of the device is really ugly…(2) don’t expect too much on the battery. It’s much better than bold 9900 (2100mah v.s. 1200 mah), but you still need to take an extra power bank when you are in trip. It will get drained more quickly on 4G connectivity, 5 hours or so.

For the software, Q10 totally blows me away. The brand new operating system (blackberry os 10) is totally different, if not created from scratch. Running more smoothly, partly due to the high performance hardware (dual core 1.5Ghz cpu, etc.), this new operating system is cleaner and easier to use, and the gestures will definitely boost the productivity in your every day life. For example, I love the browser a lot, there are quite a lot short-cut keys (r, t, b, p, n, l….) you should try out. But it seems blackberry has kept disappointing people for a long time, and both users and developers haven’t paid too much attention on this phone, and I think it’s unfair. I can grab most of the everyday apps I need from the app world, but there are still some apps you can’t install as of writing this post. (i) Ironically, you can’t use QQ (an IM app popular among Chinese people) (ii) there is no “fiend-zone/moments” in the wechat. I talked with a guy working in tencent, who said wechat in Blackberry platform is developed by a separate team, and they seem to lag behind a lot. (iii) Some others, like flickr, etc. Of course you can install those apps by sideloading a bar file, but most of the time it will let you down.

Another thing for BB OS 10, you don’t need a dedicated BB plan anymore, instead, you can use the phone with any data plan. It just works. I will say “yes” to this phone, especially you prefer high-rate productivity and the qwerty keyboard. If you need an entertainment phone, this will not be your choice.

About Inheritance in C++

As a general rule, a derived class / subclass can freely access all of base class / superclass’s public and protected members, but not the private ones. In C++, you can specifically indicate the styles how derived classes inheritates the members, in terms of three different kinds of inheritance.

Grammar of inheritances
1
2
3
class DerivedClass : public BaseClass{};
class DerivedClass : protected BaseClass{};
class DerivedClass : private BaseClass{};
  • Public Inheritance Inheritated members (public, protected) of base classes remain public and protected.
  • Protected Inheritance Inheritated members (public, protected) of base classes are both changed to protected.
  • Private Inheritance Inheritated members (public, protected) of base classes are both changed to private.

Public Inheritance is used most often. Private Inheritance is also used to implement one class in terms of another class. However, protected inheritance is rarely used.

If you are familiar with Java, you should benefit a lot from the Interface concept which facilitates software engineerings. In C++, abstract class without data members serve more or less (not exactly the same) similar functions.

Generally speaking, abstract base class contains at least one virtual method htat has no implementations (pure virtual functions). Implicitly, those derived classes that don’t implement all of the pure virtual methods are also abstract base classes and can’t instantiate any instances.

Constructors cannot be virtual, and therefore can’t be pure, so the abstract class can provide the constructor implementations. For the destructors, they can’t be pure, because they will be invoked by derived classes even only empty bodies are provided. In addition, virtual destructors are recommended. If you have any doubts on this statement, please consider this example.

A function which destroys an object from heap memory
1
2
3
4
5
void release()
{
    BaseClass* p = new DerivedClass();
    delete p;
}

To summerize, an abstract class is:

  • Contains at least one pure virtual method.
  • Defines a niminum interface for its descendants.
  • No instances.
  • Provides no implementations except for the destructors and accessors for private data members.
  • Must implement any virtual methods that are not pure. They serve as default implementations if derived classes choose not to supply their own.