Can we make a copy-cat-glass as a cellphone accessory

I’m so surprised by the idea of Pebble . Suck a cool watch can do everything combining the power of smartphone and the portability of watch.

Well, I think Google Glass is the same idea.

So an idea just occurs to me : Can we make a copy-cat-glass as a cellphone accessory?

I think it could be possible. If yes, the Glass should be easier to made to combine a bluetooth headset and a small transparent screen like this( Oh, I forget the camera) :

So what we can do via our quick copy-cat-Glass?

1. Voice control ?

Yes. But we need to erasure noise except your voice and send it back to your IPhone or Android.Please don’t talk to yourself balabala.

2. Make a call ?

Definitely. Our bluetooth headset can finish this challenge.

3.Take photos , Video Chat?

Yes, let just open corresponding App when you need that…. instagram for photos, FaceTime(google hangouts) for video chat .中国用户?出门左转找疼讯

4. App Integrations with clean background?

No. Don’t even think about that. I hate UI work while I like beautiful UI when I don’t need to develop them.

Come on, you have played all your attentions to our Glass and App, you will not see the road even we clean the screen background, just Enjoy the App and play a bumper car game on the freeway.

Besides, dev a program to integrate with thousands of Apps? OMG!

Maybe we can change all Apps into browser with HTML5 so integration could be done in a general way.

conclusion

The possibility to make a copy-cat-Glass with limited Service and high traffic accident risk is above zero.

PS:

Please keep that in your garage or don’t tell others you get this copy-cat idea from me…

I don’t want be in jail.

 

Posted in 吐槽文 | Leave a comment

(log (try lein2/plugin))

When I was reading the 《 Clojure世界:静态代码分析 》, I tried

lein plugin install jonase/kibit 0.0.2

in Lein2, but never worked.
So I checked the documentation of lein2 and found that the management for lein plugin has been changed.
All you need to do is to edit the file :~/.lein/profiles.clj

 {:user {:plugins [[jonase/kibit "0.0.2"]]}} 

and next time when you run lein, it will be installed automatically.
It’s so simple and just like you editing the dependencies in your project.clj. This change will help us to avoid the conflict between different version of the same plugin in lein.
And then you can locate to root directory of your project and analyze your code:

 lbt05@zoe:~/code$ cd slacker/
lbt05@zoe:~/code/slacker$ lein kibit
== slacker.aclmodule.authorize ==
== slacker.aclrules ==
== slacker.client ==
== slacker.client.cluster ==
== slacker.client.common ==
== slacker.client.pool ==
== slacker.common ==
== slacker.interceptor ==
== slacker.interceptors.exectime ==
== slacker.interceptors.logargs ==
== slacker.interceptors.slowwatchdog ==
== slacker.interceptors.stats ==
== slacker.protocol ==
== slacker.serialization ==
[45] Consider (str (.decode (Charset/forName "UTF-8") data)) instead of (.toString (.decode (Charset/forName "UTF-8") data))
[66] Consider (str (.decode (Charset/forName "UTF-8") data)) instead of (.toString (.decode (Charset/forName "UTF-8") data))
== slacker.server ==
[35] Consider (str e) instead of (.toString e)
== slacker.server.cluster ==
== slacker.server.http ==
[14] Consider (str (.decode (Charset/forName "UTF-8") bb)) instead of (.toString (.decode (Charset/forName "UTF-8") bb))
== slacker.utils ==

And now we can see the analysis result as expected.

Enjoy!

Posted in clojure | Tagged , | Leave a comment

( log (try lein2 ))

Read the 《My favorite feature in leiningen 2》 from Sunng yesterday , so tried  by myself.

lbt05@zoe:~/bin$ lein repl
Welcome to REPL-y!
Clojure 1.3.0
    Exit: Control+D or (exit) or (quit)
Commands: (help)
    Docs: (doc function-name-here)
          (find-doc "part-of-name-here")
  Source: (source function-name-here)
          (sourcery function-name-here)
 Javadoc: (javadoc java-object-or-class-here)
Examples from clojuredocs.org:
          (clojuredocs name-here)
          (clojuredocs "ns-here" "name-here")
nil
user=>  (use '[cemerick.pomegranate :o nly (add-dependencies)])
nil
user=> (add-dependencies :coordinates '[[perforate "0.1.1"]]
:repositories (merge cemerick.pomegranate.aether/maven-central
 {"clojars" "http://clojars.org/repo"}))
{[criterium "0.2.0"] nil, [org.clojure/clojure "1.4.0-beta5"] nil,
 [perforate "0.1.1"] #{[criterium "0.2.0"] [org.clojure/clojure "1.4.0-beta5"]}}
user=> (use '[perforate.core])
nil
user=> (doc benchmark)
-------------------------
perforate.core/benchmark
([doc-string & opts])
  First argument is a doc string or otherwise human readable name to use in
   reporting. The rest of the arguments are key/value pairs, of which the
   following are used:

      :setup  - Specifies a function to call before every test. Its return
                value will be applied to the test-case spawn function.
      :cases  - A vector of benchmark-case maps. These are easily generated by
                the benchmark-case function.
nil

Finally I can test code with external libraries in my lovely REPL.
That’s so  cool
Thanks to leiningen team.

Posted in clojure | Leave a comment

第一次Presentation就这么跪了

上周末参加了clojure-cn的第二次聚会,简单(真心简单)地介绍了《Tdd in Midje》。

暴露了不少的问题:
1.背景资料的了解并不充分。
2.太紧张了,很多准备好的段子和详细的介绍都漏掉了。
3.介绍太多的停留在表面了,没有做深入的思考。

由于以上的原因,导致最终的presetation很失败,至少没有达到自己的期望。
看来还是有不少的东西要学习的。

下一阶段,需要多参与一些项目,并且多做一些思考。
参与Open source的目的并不是为了完成Task,而是为了学习和锻炼自己

Posted in 吐槽文, 工作体验 | Leave a comment

macro collection

I found macro is so hard to understand and write… So I would like to collect some examples I see from the network and record here.

; Macro.

(defmacro def-fields [struct-name & fields]
  (let [field-symbol-vector (->> fields (map name) (map symbol) vec)
        arg (gensym)
        body (gensym)
        macro-name (symbol (str "let-" struct-name))]
    `(defmacro ~macro-name [~arg & ~body]
      `(let [{:keys ~'~field-symbol-vector} ~~arg] ~@~body))))

; How to use it.

(def-fields person :first-name :last-name :city)

(defn print-person [p]
  (let-person p
    (println "First name:" first-name)
    (println "Last name:" last-name)
    (println "City:" city)))

(def person1 {:first-name "John" :last-name "Smith" :city "San Francisco"})
(print-person person1) 

another macro from slacker which I’m working with Sunng

 
(defmacro defn-remote
  "Define a facade for remote function. You have to provide the
  connection and the function name. (Argument list is not required here.)"
  [sc fname & {:keys [remote-name async? callback]
               :o r {remote-name nil async? false callback nil}}]
  `(defn ~fname [& args#]
     (with-slackerc ~sc
       [(or ~remote-name (name '~fname))
        (into [] args#)]
       :async? ~async?
       :callback ~callback)))
Posted in Uncategorized | Leave a comment

2012.1.18

今天学到了2个事情

1.UnitTest一定要做好,尽量能够覆盖全。

2.单一原则,尤其是在FL里面,尤为重要。

Posted in 琐事 | Leave a comment

自省 2011.12.2

最近想了很多关于自己的事情,总是没有勇气写出来,总是在害怕些什么,今天看了一些文章突然间觉得,虽然自己是如此不靠谱的人,但是如果没有面对现实的勇气,那么一辈子都只能是这样一个不靠谱的人,诚实的面对自己是一个很重要的开始,于是开始写这篇文章。

最早的时候我对自己的认识还是很人道的,我认为我身上存在的问题是大部分都存在的普遍问题,那就是:知易行难。但是我发现,虽然这是一个普遍存在的问题,但是为什么别人是如此的靠谱而我却是如此地不靠谱,而且不靠谱的程度还在不断地加大。

于是我尝试着进一步地去了解自己,去诊断自己到底是怎么了,以至于我的生活越来越糟糕。

关于惰性

总是在这个时候,回忆会如同病毒般侵蚀着我的大脑,我突然想起曾经有一个老师曾经批评过我:总是耍一些小聪明,将来是要吃亏的。

我想问题并不是小聪明,而是长期依赖于这种小聪明而带来的惰性。随之而来的是我做人做事时所缺乏的那种坚韧不拔的韧性。随着时间的推移和社交范围的扩大,我渐渐意识我曾经引以为傲的小聪明已经完全不占据任何优势了,也许曾经在一个小范围短时间内,它给予过我一些便利和一些无关紧要的优越感,但是不管它曾经以什么样的姿态出现在我的生活中,我知道它已经不复存在了,而我仍然没有能够适应这样的日子,这样的自己。

而当我意识在这个问题时,我尝试着各种方法去改变自己的惰性时,我曾经为自己制定了很多很多的计划,而他们无一例外地因为我缺乏长期贯彻的韧性而作古在我追求安逸享乐的分分秒秒内。我像是一个不懂事儿的孩子,开始时总是信誓旦旦地制定着各种计划,决心要改变自己,而最后我总是像是玩腻了自己所创造的玩具一样,将自己的计划和自己可见的未来都丢弃到一边,放任自己在惰性和无知中不断地堕落。

关于取舍

人生的道路似乎对我来说一帆风顺,即便家庭条件一直是贫下中农的水品,但是我很平和地上完了我的初中,高中,然后考上了一个还算可以的大学,在一个相对不算明朗的就业形势下找到了一份还算过得去的工作,甚至早早地就找到了人生的伴侣。

一切都是来的那么理所当然,那么轻而易举,让我一直没有发现一个本应该是在很多年以前就应该被我发现的问题:取舍。

在那个阳光灿烂的日子里,似乎自己是那么地富有,学习成绩想要就能拥有;朋友,用心就能去得到;疑难的问题,奇怪的现象,只要想懂就能查到。我贪婪地拥有和霸占着出现在我生命中的一切美好,直到有一天我来到了一个更大的世界,这个世界是如此之大,而一切的事物都带着她美好而又光鲜的面具向我扑面而来,我被这种如同轰炸般的冲击给打败了,随之而来的是被膨胀的欲望破坏殆尽的柔弱内心。

直到很多事情发生以后我才渐渐地明白原来在这个世界中,我是如此的渺小和卑微,我如同这个世界上大部分人一样不配拥有全部的这些;而同样渺小的还有我的精力。当自己发现自己已经不在那么年轻的时候,面对着内心深处满满当当的欲望,我尝试着从他们那拥挤而又窄小的罅隙间寻找一个我能够为之奋斗终身的目标或者像是《10 items or less》里所说的那样去甄选出人生最重要的10样或者更少的东西时,我是那么地迷茫和无措,迷茫并带着惶恐,因为我知道我那有限地精力已经不再经得起我如此不知节制地挥霍了。

可是我无助地发现我不知道什么是我生命中最重要的,我不知道如何去取舍我的世界。

关于明天

仿佛是一个痛苦的轮回,你所浪费的今天,是昨天死去的人奢望的明天。你所厌恶的现在,是未来的你回不去的曾经。

即便我并没有宗教的信仰,我也相信因果循环的道理。我不相信来世,我却相信我在一遍又一遍地重复着自己曾经的生活,痛恨着如此的自己却如同无法自控般地重新上演。

面对这个问题的老话太多了,我甚至都不想提及他们。我想我需要做的是尽快地找到自己平衡的位置和自己该做的事情,并且为之付诸长期的努力从不改变。那么时光的流逝,岁月的痕迹,对我来说就是多年后可以观瞻的美丽沉淀,如年轮般自然的含蓄和优雅,而不是一杯自斟自饮的苦酒。

如果时间的流逝中,我们注定要重复,那么尽量让自己保持去重复正确的事情,这是我想告诫自己的。

未完待续

人生未尽,自省未完。

Posted in 自省 | Leave a comment

convert all http request to https request[failed]

I was working on PCI problem, my boss wanted me to convert all request to https. So I searched on google and then tried the code below:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

but a problem occurrd to me and nobody even mentioned that: it will change the requestMethod from POST to GET so that the post data will be missed and this is explained as this rewrite will be considered as external redirection which should be GET method….
So somebody says that we can use Proxy to deal with this requirement.

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [P]

But I felt so disappointed when apache gave an internal error to me when I made this modification.

T_T

Posted in 工作体验 | Tagged , , | Leave a comment

apache 2.2.8的Header edit的bug

今天一天都给apache2.2.8的这个个bug给坑了。。。其实说2.2.8的bug是不正确的,其实这个bug存在在2.2.10前的多个版本,直到2.2.10才被修正。

在官方change中如下描述

 *) mod_headers: Prevent Header edit from processing only the first header
     of possibly multiple headers with the same name and deleting the
     remaining ones. PR 45333.  [Ruediger Pluem]

我的还原代码为

 

Header edit Set-Cookie ^(((?!Secure).)*)$ $1;Secure

当Set-Cookie有多项值时,只有第一项值会被处理,之后的所有数据都会被丢失。对于严重依赖cookie的应用,这将是一个很严重的bug。
唯一的劝解是:升级或者不要太过于依赖cookie

Posted in 琐事 | Tagged , , | Leave a comment

安卓手机无法登陆gmail等google服务

如果您不是天朝人士或者生活在天朝的人士,请忽略本文,因为它不会对您有多大的用处;如果您是,恭喜你,本文可能有用。至于为什么,反正大家都知道就不说了。

有很多种方法可以使用,这里只是告知大家如何去更改host文件

$su
# mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
#echo "74.125.224.73 android.clients.google.com" >> /etc/hosts
#mount -o remount,ro -t yaffs2 /dev/block/mtdblock3 /system

如果发现还是不行,大家可以重新获取android.clients.google.com 的新IP。。。当然有一天可能会把所有的IP都封掉,那就只能设代理或者VPN。

最后吐槽句,就这吊情况,雷布斯你的生意还做不做了。。。。。。 你太幼稚了,人家都是有自带的market的。。。

 

——2012/04/05—————

似乎74.125.224.73 IP 挂了,同时google service is back。。所以我又把这句给删除了

Posted in 琐事 | Tagged , , | Leave a comment