2014年5月5日

[訊真科技技術園地] 新的Java寫法 : Java 8 新增的 API

新的Java寫法,好陌生啊~~~



文章轉摘自 http://ingramchen.io/blog/2014/04/java-8-new-api-tips.html




本文介紹 Java 8 新增的 API,以及使用的技巧,內容大多環繞在 Stream/Lambda API 上,不過這一篇並不是 Stream/Lambda 的教學。建議先練習運用 Stream 一下,再來看本文比較好吸收。

For loop with index

//Java 8 之前原本的寫法
for (int i = 0 ; i < 10000 ; i++) {
  System.out.print(i);
}

//Java 8 新的寫法
IntStream.range(0, 10_000).forEach(i -> System.out.print(i));
IntStream.rangeClosed(0, 9_999).forEach(i -> System.out.print(i));
第一題是最常見的 for loop,改成用 IntStream.range()。新的寫法肯定是耗較多的資源的,但除非是很特別的運算,不然是沒什麼差。採用 IntStream 的寫法很容易就是一行搞定,有別於原來的三行,也不用管 i 的那些 加加減減和大於小於。而且等到 loop 裡面開始加上邏輯,使用 Stream 的寫法就會越來越有優勢。
IntStream 上還有 average()boxed(), 等等有趣的 method,建議可以查查。
眼尖的你發現了嗎? 10_000 和 9_999 含底線的數字。其實這是 Java 7 就有的新功能,因為很少人知道,就再介紹給大家認識一下。

更多內容請看  http://ingramchen.io/blog/2014/04/java-8-new-api-tips.html

2014年5月2日

[訊真科技技術園地] Java吃CPU很高:Identifying which Java Thread is consuming most CPU


最近遇到Java吃CPU很高可是一直無法確認是甚麼Thread造成的,
於是上網找了一下追蹤的方法,發現這篇文章不錯有興趣大家可以參考看看! 

此文大意是:

1. top -H   => 可以看到process中的threads

2. threaddump  =>  利用tas的指令即可

3. 比對  =>  將可疑的thread其id轉成16進位碼, 再去dump出來的檔案搜尋, 就一目了然了)



2014年4月24日

[訊真科技技術園地] 十個UI發展史

The Incremental Design, 10 Surprising MVPs and Their Current Versions


文章摘自 http://designmodo.com/incremental-design-mvp/

1. Mac OS 1984 vs. Now

Mac OS was a revolution right from the start. After 30 years, the design looks surprisingly consistent with the newest version of Mac OS X. This consistency suggests how mature the design process must have been at Apple back in 1984. Setting standards for 30 years? That’s extremely impressive. Still, the arrival of Spotlight, Dock and hundreds of other features makes Mac OS what it is today – probably the best operating system on the market. The number of design iterations that Apple team went through is certainly close to ‘countless’.
mac os at launch design
Mac OS 1.0, 1984
macos design today
Mac OS 10.9.2, 2014

2. Ebay 1997 vs. Now

From a simple listing of products available on auctions to the biggest community-based marketplaces on Earth. From a greyish nightmare to the beautiful current version of eBay. The eBay team has undeniably learned many lessons about their customers over the past 17 years.
eBay, Homepage, 1997
eBay, Homepage, 1997
ebay design today
eBay, Homepage, 2014
更多內容請參考    http://designmodo.com/incremental-design-mvp/

2014年4月23日

[訊真科技技術園地] 別為了互動而互動:互動是過程而非目的

心得分享

"互動是過程而非目的", 在我之前的經驗, 很常聽到為了要做社交類型的服務而硬是加上了不適合的互動功能, 也許應該換個方向思考, 不是要做什麼互動功能, 而是在功能上加上適合(貼心)的互動設計.


文章摘自 http://taiwan.chtsai.org/2013/05/09/bie_weile_hudong_er_hudong/



2014年4月17日

[訊真科技技術園地] 話題:ember有比angular強大嗎?

問問大家:ember有比angular強大嗎?



[訊真科技技術園地] Linux top VIRT RES SHR SWAP DATA内存参数详解

關於 top 指令顯示的 VIRT 與 RES 的說明.

主要差異就是:

VIRT:virtual memory usage。是 process 宣告要求的 memory 數目. 但可能要了但還沒實際使用.

RES:resident memory usage。才是 process 真正使到的記憶體.

詳細的內容. 可以參考這篇說明.


=================
总结:
VIRT 虚拟内存中含有共享库、共享内存、栈、堆,所有已申请的总内存空间。
RES  是进程正在使用的内存空间(栈、堆),申请内存后该内存段已被重新赋值。
SHR  是共享内存正在使用的空间。
SWAP 交换的是已经申请,但没有使用的空间,包括(栈、堆、共享内存)。
DATA 是进程栈、堆申请的总空间。
=================

文章摘自  http://goo.gl/1scb8h


[訊真科技技術園地] Unix and Linux shortcut keys

文章摘自  http://www.computerhope.com/ushort.htm

分享實用的shortcuts, example: ctrl + u , ctrl + w 


Keyboard shortcut keys

CTRL+BMoves the cursor backward one character.
CTRL+CCancels the currently running command.
CTRL+DLogs out of the current session.
CTRL+FMoves the cursor forward one character.
CTRL+HErase one character. Similar to pressing backspace.
CTRL+PPaste previous line(s).
CTRL+SStops all output on screen (XOFF).
CTRL+QTurns all output stopped on screen back on (XON).
CTRL+UErases the complete line.
CTRL+WDeletes the last word typed in. For example, if you typed 'mv file1 file2' this shortcut would delete file2.
CTRL+ZCancels current operation, moves back a directory or takes the current operation and moves it to the background. See bg command for additional information about background.

Command line shortcuts

In addition to the below command line shortcuts, it is also helpful to use the alias command that allows you to specify a keyword for frequently used commands or mistakes.
 ~Moves to the user's home directory.
!!Repeats the line last entered at the shell. See history command for previous commands.
!$Repeats the last argument for the command last used. See history command for previous commands.
resetResets the terminal if terminal screen is not displaying correctly.
shutdown -h nowRemotely or locally shuts the system down.