Wednesday, March 26, 2014

SQLite error code list

#define SQLITE_OK           0   /* Successful result */
/* beginning-of-error-codes */
#define SQLITE_ERROR        1   /* SQL error or missing database */
#define SQLITE_INTERNAL     2   /* Internal logic error in SQLite */
#define SQLITE_PERM         3   /* Access permission denied */
#define SQLITE_ABORT        4   /* Callback routine requested an abort */
#define SQLITE_BUSY         5   /* The database file is locked */
#define SQLITE_LOCKED       6   /* A table in the database is locked */
#define SQLITE_NOMEM        7   /* A malloc() failed */
#define SQLITE_READONLY     8   /* Attempt to write a readonly database */
#define SQLITE_INTERRUPT    9   /* Operation terminated by sqlite3_interrupt()*/
#define SQLITE_IOERR       10   /* Some kind of disk I/O error occurred */
#define SQLITE_CORRUPT     11   /* The database disk image is malformed */
#define SQLITE_NOTFOUND    12   /* NOT USED. Table or record not found */
#define SQLITE_FULL        13   /* Insertion failed because database is full */
#define SQLITE_CANTOPEN    14   /* Unable to open the database file */
#define SQLITE_PROTOCOL    15   /* NOT USED. Database lock protocol error */
#define SQLITE_EMPTY       16   /* Database is empty */
#define SQLITE_SCHEMA      17   /* The database schema changed */
#define SQLITE_TOOBIG      18   /* String or BLOB exceeds size limit */
#define SQLITE_CONSTRAINT  19   /* Abort due to constraint violation */
#define SQLITE_MISMATCH    20   /* Data type mismatch */
#define SQLITE_MISUSE      21   /* Library used incorrectly */
#define SQLITE_NOLFS       22   /* Uses OS features not supported on host */
#define SQLITE_AUTH        23   /* Authorization denied */
#define SQLITE_FORMAT      24   /* Auxiliary database format error */
#define SQLITE_RANGE       25   /* 2nd parameter to sqlite3_bind out of range */
#define SQLITE_NOTADB      26   /* File opened that is not a database file */
#define SQLITE_ROW         100  /* sqlite3_step() has another row ready */
#define SQLITE_DONE        101  /* sqlite3_step() has finished executing */ 

Sunday, March 23, 2014

[節錄] 如果有 App 讓你 90 分鐘內讀完一本小說,你會想下載嗎?

你覺得閱讀就只能看書、看螢幕然後逐句閱讀嗎?
閱讀的模式即將改變。
波士頓的軟體開發商 Spritz 這三年來偷偷摸摸的在打造一種程式。但現在,Spritz 要現身了!他們與 Samsung 的穿戴式科技結合。
雖然之前就有滿多類似這種「快速視覺顯示」的軟體能夠方便手機閱讀,也能增加閱讀速度。
但是,Spritz 做得更酷、更特別。他們確切排列字體的呈現,排列的方式是符合眼球在閱讀時的自然投影。
Spritz 團隊利用一個原理,做出他們的產品:每個英文單字都有一個 Optimal Recognition Point(ORP:最佳識別點),就是單字裡的核心字母,通常讀者理解一個單字的意思不需要完全讀過單字裡的每個字母,通常 ORP 偏一個單字的左邊,所以他們把每個單字的 ORP 用紅色標示出來,之後用一樣的速度跳出每個單字和它們的 ORP,而大腦就可以快速的處理閃跳過去的單字,而減少眼球移動的時間。
傳統閱讀,我們的眼球都要跟著每個字走,但藉由這個軟體,眼球不需要移動,因此,大腦就可以瞬間的處理所看到的資訊。
現在你們可以自己實驗看看閱讀是不是更快速了呢?
一分鐘 250 個字:
一分鐘 350 個字:
一分鐘 500 個字:

[節錄] 準備考托福練寫作?這個社交平台讓全世界幫你改文章

Hassan Siddiq,《36kr》 之前報導過的 Dailythem.es 的創辦人,最近參加中國創投 10X10,因而來到了中國。巧合的是,他所參加的活動正好在 《36kr》 辦公的 Tech Temple 舉辦,因而有機會可以和 Hassan Siddiq 坐下來面對面地聊聊,聊聊他做 DailyThem.es 的原因。
在訪談一開始,Hassan 拿了我的筆記本,在上面寫了 Tongji、Fudan 以及 English Club 這樣的單詞,然後笑著跟我說道:
我去了同濟大學和復旦大學,參加他們的英語俱樂部。他們 (大學生) 的英語都非常好。並且我意識到,中國的新一代,就像你們這個年紀的人們,非常樂於與別人交流,特別是使用英語,特別是與新的人認識。
  • 中國想要融入世界,但語言是一個障礙
在 Hassan Siddiq 看來,中國是一個生機勃勃的國家,充滿著發展的力量,並且越來越多的中國人有這樣的需求,他們希望與更多的人分享他們的生活,希望更多地參與到世界中去,但語言似乎成為了他們最直接的障礙,因而 DailyThem.es 給了他們這樣一個工具,來幫助他們更快的融入到這個世界裡去。
正如我們在此前報導中說的那樣:
Dailythem.es 搭建了一個微型部落客平台,幫助希望練習英文寫作水平的同學相互交流。你可以每天在上面寫篇 100-125 詞的英文文章,讓別的用戶閱讀,並指出其中不好的句子進行修改。同時你也可以為別人的文章提出自己的意見。
這種鼓勵用戶之間來相互修改文章的概念很棒。用戶在相互分享自己生活日常或是心情的同時,就提高了自己的寫作水平。
但 Dailythem.es 僅僅能夠幫助人們訓練寫作技巧。在我看來,掌握一門語言,僅僅是能夠寫漂亮的文章自然是遠遠不夠的,而 Hassan 有個讓我耳目一新的看法。
相信我,你不會總是介意你是在寫,還是在說,你所掌握的都是語言。比如像今天,我們約在一起聊天,幾年前你會怎麼做?你會打電話給我約時間,而我到達之後也會打給你。但今天我們怎麼做的?我們沒有打一通電話,你也沒有。是的,我們用了微信。再比如你想約一個你喜歡的女孩子出來,你會怎麼做?打電話?不,你不會的,你會發個訊息。
雖然我並不否認口頭交流的重要性,但我意識到世界正在慢慢的變化,從說 (speaking) 到寫 (writing),你會發現,使用直接的語言交流正變得越來越少,反倒是文字變得越來越重要。你一定想不到,我們中的用戶也有來自美國的,他們口語很棒,但他們完全不清楚應該怎麼寫英語文章,這都是為什麼人們會需要 Dailythem.es。
  • 中國學英文只為考試,而不是拿來活用
談到英語的學習,我提到了新東方,我提到了CET4,但 Hassan 顯得很不以為然。
有趣太重要了。我知道你們中國學生學習英語很大程度上都是為了高考,或者別的考試。但英語是一門技能,是用來使用的技能,而不是拿來對付考試的籌碼。誠然考試很重要。Dailythem.es 目前已經有超過 5000 用戶,並且越來越多的新用戶開始使用 Dailythem.es。
更重要的是,會有很多老用戶不斷地回來繼續使用 Dailythem.es,我相信這正是因為 Dailythem.es 很有趣。我讓你每天寫一篇英文短文,你肯定不願意,因為這太煩了,但在 Dailythem.es 上不一樣,你每寫一次,就會有不同的用戶為你評論,他們可能和你一樣來自中國,或是印度,或者是美國、澳大利亞,任何國家都有可能,你們與世界上其他地方的人們彼此分享生活,並且自然而然的提高了寫作的技巧。我想這正是 Dailythem.es 的魅力所在。
  • 唯有挑戰自己,才能提升英語水平
然後,我又問 Hassan 怎樣提升英語水平這個問題,他談了一些自己的想法——
無論如何基礎很重要,就像你在學校學習的詞彙、語法,這些是你掌握一門語言很基本的規則。這些是非常必要的,但僅僅擁有這些完全不夠,你必須要有足夠多的練習,比如寫,比如說,你必須持續不斷的進行練習,才能看到一些前進。
同時,你必須得清楚這是一個很長的過程,耐心是必要的。但你得知道,你選擇了學習新東西,就是選擇了挑戰自己。你只有挑戰自己,才能到達更高的層次,否則你因為種種原因懼怕挑戰,那你就只能停在你現在的層次上。
不懼怕挑戰,這話似乎很符合 Hassan 本人的個性,他在耶魯大學主修經濟學畢業,在畢業後進入了花旗銀行,成為一名投資銀行家。還曾在香港工作兩年、新加坡工作一年,並為YaleGlobalOutlook India 以及 The South China Morning Post 撰寫文章。按理來說,他的人生是順風順水、怡然自得的,但他卻選擇辭職創辦 Dailythem.es。你知道銀行家甚麼的,就是坐在那而不停地敲鍵盤,太無聊了。我得做點別的,能改變一些什麼的事情。Hassan 認真地說著。
最後,Hassan 表示他們的移動客戶端正在開發中,會盡快推出。他們也正在架設中國的服務器,以解決訪問速度的問題。
延伸閱讀:
(本文轉載自合作媒體《36Kr》)

[節錄] 新創公司沒錢打廣告?13 個技巧教你如何不花一毛錢行銷

原文作者為 synup.com 的創辦人 Ashwin Ramesh,他向新創公司分享 13 個不用花大錢的技巧,與具有雄厚資金的公司競爭
技巧一: Quora 是你的好朋友
很多人會在 Quora 上發問,因此若是你說話很有技巧,就可以偷偷為自己的公司打廣告,但又不會聽起來很討人厭。 你還可以請朋友擔任樁腳,請他們到 Quora 提出「什麼軟體最適合用來…」等問題,然後去回答他們的問題。
技巧二:寫部落格時,要像個瘋子一樣
想要 SEO,就要持續產出內容,才能獲得較好的排名。若是不知道要寫什麼,可以到 Google Suggest 看看。
或是到 Quora 去看看有沒有尚未解答的問題
技巧三:使用 Google Alerts 來搶頭香
Google Alerts 可以輕鬆追蹤最新發布的文章,因此就能搶先去重要的部落格留言。不見得每次留言都要幫自己打廣告,因為只要有留言,就多少能吸到一點流量。
若你有辦法不著痕跡幫自己打廣告的話,也可以這麼做:
技巧四: 為其它平台撰稿
若是市面上已有類似性質的知名部落格,那麼與其自己從零開始吸引人潮,還不如先為這類部落格撰稿,直到建立起自己的知名度。
技巧五: 參與論壇,並加入討論
知名論壇通常臥虎藏龍,且大都關心同一領域議題,因此可以在短時間內讓許多同行看見自己。除了寫出讓人刮目相看的回覆,務必記得在簽名檔處加上自己網頁的連結。
技巧六: Google+ 其實沒有想像中那麼糟
Google+ 其實有不少有意義的社群,加入它們並積極參與回應吧。
技巧七: 建立免費工具來解決小問題
找出你的產業中的一個小問題,並建立一個免費工具來解決這個問題。這是 SynupMoz 和Hubspot  最主要的流量來源,所以這對你來說一定也會很有用。
技巧八: 在知名折扣網站上提供優惠
F6SRewardli等網站讓公司提供各種優惠,可以藉此吸引到不少使用者。若想輕鬆一點,也可以試試門檻較低的 AppSumo 或是 Groupon
技巧九:像隻老鷹一樣緊盯 Twitter
我會在 TweetDeck 上緊盯競爭對手們的 Twitter 頁面。只要有人對競爭對手的產品或服務感到不滿意,或是想要尋找其他類似的服務,我就會俯衝下去抓住這隻獵物。
技巧十:邀請知名部落客撰寫產品心得
向部落客邀稿,除了可以為自己提升 SEO 排名、吸引使用者及合作夥伴,也能為他們增加部落格的文章數及流量,可說是雙贏的局面。訣竅在於,可以去邀請已經撰寫過類似產品的心得的部落客來撰寫,過程就會比較有效率。
技巧十一: 善用 HARO 讓自己登上新聞版面
HARO 是個又棒又免費的曝光機會。只要留意它們想要採用的內容,就有機會賺到免費的報導,大大提升產品知名度。
技巧十二: 善用 Google AdWords 免費關鍵字
Google 有時會免費贈送關鍵字廣告,若你不幸沒有參與到,可以考慮去 Fiverr 向別人購買。這項服務能夠以極低的價格,獲得極高的廣告效益。我的秘訣是:向知名競爭對手偷關鍵字來用。結果就是,對方砸大錢為自己打廣告,但消費者在搜尋競爭對手時,除了看見對方的廣告,也會看見自家的廣告。
技巧十三: 為競爭對手撰寫使用說明
若你的競爭對手知名度高、資金雄厚,又已經擁有成千上萬的用戶,那麼不妨為他們的產品撰寫使用說明吧,因為他們可能一天到晚忙著數錢,根本不在意其實使用者不太知道該怎麼使用他們的產品。當人們開始注意到你,財神或許也才開始注意到你。
延伸閱讀:
(資料來源:Medium;圖片來源:401(K) 2013, CC Licensed)

[節錄] Android 手機個人化時代來臨,Apple 你繼續僵化可以嗎?

iOS 的使用者,只能在手機的首頁上改變一些表面的原件。但在 Android,Launcher 的 App 卻可以讓使用者不只在視覺上,還有在使用者行為上達到完全不同的體驗。
像是不同的動態效果、資訊組合,或是跳過「桌面」,直接在首頁置入使用者最想得到的動態資訊(如 Facebook、Twitter、Line、購物資料和論壇內容等),讓使用者可以在開機畫面中就一覽無遺。這對消費者來說是更方便和豐富的體驗,對廠商來說,也可以深化消費者對產品的連結。
行動裝置分析公司 Flurry,透過觀察 Google Play 上 4500 支個人化 Launcher App,發現在 2013 年的第四季到 2014 年的第一季,Android 個人化 Launcher App 的使用量成長了兩倍。
Flurry 指出現在美國每個月大約有 3000 萬個使用者,雖然比例不高,但是跟之前比也算有明顯的成長。
Android launcher 在 2013 年第四季的使用量大增
從圖表可以看出,Android launcher 在 2013 年的第二季,出現了大成長。很難說是哪一個 App 造成這個結果,但是很有可能和 Facebook Home 有關,因為 Facebook Home 就恰巧在去年的四月推出。
  • Facebook Home 先聲奪人,但不叫好也不叫座
但我們都知道, Facebook Home 是一個雷聲大雨點小的產品,消費者沒有因為喜歡 Facebook 而把它設置於桌面。
儘管如此,Facebook 還是沒有把 Home App 從 Google Play 下架的打算。
Jocelyn Goldfein,Facebook 的行動部門大頭在 2 月時對《VentureBeat》說道: 「我們對 Facebook Home 這個產品還是非常樂觀。我們在 Home 的實驗還沒結束,我想消費者需要時間來習慣,因為我們推出的是天才般的破壞式創新產品。」
沒錯,在 Facebook Home 推出後,很多網路公司看到他們的失敗,並沒有怯步,反而也加入 Home 的產品計畫。
  • Google、Mozilla、Yahoo 也加入戰場
像 Google 也發布了他們的 Google Now launcher,他們把聲控搜尋置入在行動裝置的首頁。在 2 月之前,這個 App 只能在最新版的 Nexus 和 Google Play edition(搭配純淨的 Android 原生系統產品)上使用。
Mozilla 也推出了 Android 版的 Firefox launcher他訴求可以透過網頁瀏覽的時間,和歷史紀錄來預測使用者喜歡的 App,而 Yahoo 也買下了 Aviate,強項也是預測預測使用者喜歡的 App,
隨者這些資訊大頭的努力,未來市場上將可以看到更多的首頁設計,而消費者也正在習慣這樣的使用方式。
到時候誰能佔有消費者的首頁,將可以主導消費者的使用行為,而從中得到巨大的商機(例如從推薦的 App、內容和服務抽成),就像在網路時代占領瀏覽器的首頁一樣。
  • 延伸閱讀
(資料來源:Mashable;圖片來源:FlurryNeKo chan,CC licensed)

Re: Facebook Introduces ‘Hack,’ the Programming Language of the Future

18 個小時之前開發 Hack 的臉書工程師才在 Facebook 上公布了 Hack, 與此同時他們還宣布將 Hack 開源
現在 Hack 可是支撐著幾乎所有 Facebook 網站的營運,也就是說擁有 12 億用戶的 Facebook 就是靠它在跑的。
原本建構 Facebook 的程式語言是 PHP,不過據他們所說 PHP 雖然擁有無數優點,但容易將一些簡單的任務變得笨重、複雜,甚至有些問題是有些功能上線後才能偵測到的。而現在 Hack 解決了這些缺點。
看來對 Coding 有興趣的人,又有一項挑戰的目標了。

Jon Snyder/WIRED
Jon Snyder/WIRED
Facebook engineers Bryan O’Sullivan, Julien Verlaguet, and Alok Menghrajani spent the last few years building a programming language unlike any other.
Working alongside a handful of others inside the social networking giant, they fashioned a language that lets programmers build complex websites and other software at great speed while still ensuring that their software code is precisely organized and relatively free of flaws — a combination that few of today’s languages even approach. In typical Facebook fashion, the new language is called Hack, and it already drives almost all of the company’s website — a site that serves more than 1.2 billion people across the globe.
“We can say with complete assurance that this has been as battle-tested as it can possibly be,” says O’Sullivan, a veteran of iconic tech companies Sun Microsystems and Linden Lab who has long played an important role in a popular language called Haskell.
O’Sullivan and company publicly revealed their new language this morning, and at the same time, they “open sourced” it, sharing the technology with the world at large and encouraging others not only to use it, but to help improve it.
The software world is littered with programming languages, and new ones appear all the time. But according to some who have used it or who know the past work of those who built it, Hack has a design and a pedigree that immediately set it apart. “If Bryan O’Sullivan built it,” says programming guru David Pollak, who only yesterday heard about the new language, “I would walk across hot coals to use it.”

In the Beginning

When Mark Zuckerberg started work on Facebook in late 2003 — a moment recreated to such great effect in the Hollywood film The Social Network — he used a programming language called PHP. It was one of the most popular web languages of the day — a language that let you build and rebuild sites with extreme speed. PHP is what’s called a dynamically typed language. Basically, this means you needn’t take the time to define specific parameters for each and every routine in your code, and once you finish a piece of code, you can almost instantly run it — without taking additional time to compile it into another form. The code essentially compiles in the background, as you write it.
The new language is called Hack, and it already drives almost all of the company’s website — a site that serves more than 1.2 billion people across the globe.
For the next decade, Zuckerberg and his rapidly growing company continued to build their site with PHP. It suited “The Hacker Way,” the Zuckerberg coding philosophy that encourages engineers to constantly look for ways of improving the technology at hand. But eventually, as Facebook expanded to hundreds of millions of people, the language started to show its limitations. As a PHP site grows, you need far more computer servers to run the thing than you would with other languages, and it can be difficult to manage all your code and keep it free of bugs.
At a certain size, you’re better off with statically typed languagessuch as Java, where you’re required to carefully define your variable types. You can’t move as fast with these languages — you have to compile code before running it — but you need fewer servers to run your code, and in the long run, it’s easier to manage what you’ve built.
Last year, after a brainstorm from three top engineers, Facebook solved the server problem by running all its PHP code on a new software creation called HHVM, short for Hip Hop Virtual Machine. HHVM was a new foundation for the Facebook website, letting the company run its site on significantly fewer machines. Now, with Hack, their new programming language, Bryan O’Sullivan and his tiny team have solved the other problem. Hack makes it easier to manage code and eliminate errors.
“It arose out of a desire to improve the efficiency of our developers,” says the Irish-born O’Sullivan. “As our engineering team grew, their own jobs were becoming more complicated because PHP is a dynamically typed language. It made it harder for them to easily apprehend the consequences of some of the work they were doing.”

The New PHP

You can think of Hack as a new version of PHP. It too runs on the Hip Hop Virtual Machine, but it lets coders use both dynamic typing and static typing. This is what’s called gradual typing, and until now, it has mostly been an academic exercise. Facebook, O’Sullivan says, is the first to bring gradual typing to a “real, industrial strength” language.
What this means is that Facebook was able to gradually replace its existing PHP code with Hack — move from the old dynamically typed system to a statically typed arrangement. “It allows you to slide the dial yourself on the continuum between dynamic types and statics — so you can start out with dynamically typed code and then gradually add more statically typed code, benefiting from each little bit of work you do as you go along,” O’Sullivan says.
In doing so, he explains, Facebook built much more precise code — code with fewer flaws. Hack provides a kind of safety net for developers. What’s more, engineers can more easily understand code when they revisit it. Static typing acts a lot like documentation.
But the big trick is that Hack provides these benefits without slowing down the developer: Unlike other statically type languages, Hack can run without compiling. “You edit a file and you reload a webpage and you immediately get the feedback of: Here’s what the page looks like after I made that change. There is no delay,” O’Sullivan says. “You get both safety and speed.”
hack screen
Nils Adermann, a software engineer and the co-founder of a company called Forumatic, has used the language, and he says he knows of nothing else quite like it. James Miller and Simon Welsh, engineers at a company called PocketRent, who have also used Hack, agree. The closest thing, they say, is Haskell, a statically typed language that provides a way of executing code relatively quickly. But Hack, they indicate, takes the idea much further.
Hack will be particularly attractive, Adermann says, to existing PHP shops. “Ironically,” he says, “its chief advantage is how little it differs from PHP.” Like Facebook, these shops can gradually move their operations from one language to the another. But Adermann also believes that some developers will adopt the language even if they’re not already using PHP. “While PHP is the most widely used language on the web, it’s unpopular in many places because of its inconsistencies,” he says. “Hack addresses these … and thereby makes the language more attractive to users of other languages.”
But the biggest endorsement for the new language is that Facebook already uses it to run its own site, the world’s most popular social network. It’s not every day that a new language debuts with such an impressive track record. Some, however, question whether Hack should really be called a new programming language. There’s a fine line here between an update to PHP and a replacement for PHP. Where does Facebook draw that line? “That,” Sullivan says, “is a good question to discuss late at night over whiskeys.”

Friday, March 14, 2014

[節錄] 手機App撳錢


【無卡提款】
NCR公司研發無卡提款技術,市民預先在手機應用程式輸入銀行密碼及設定提款金額,再用手機在自動櫃員機掃描二維碼(QR Code)或以手機的NFC近場通訊技術「嘟一嘟」,可在10秒內完成程序,較傳統入卡需時30至45秒更快。NCR指不擔心保安問題,因銀行可要求顧客 用手機確認後,再輸入密碼作雙重保險。
NCR香港及台灣地區金融行業總經理區萬康指,本港自動櫃員機保安紀錄良好,甚少被「爆機攞錢」,加上手機目前已廣泛用作網上銀行服務,相信保安問題不大,銀行亦可再研究保安監察問題。
區 萬康指改裝成本輕微,預計下半年在本港試用,未來櫃員機有一角落設有二維碼標籤,亦預留位置讓擁有NFC近場通訊系統的手機使用,提款後電子收據會自動傳 送至用戶手機應用程式。他又補充無卡提款的櫃員機亦保留原有功能,但不會擁有視像通話功能,而視像櫃員機亦不設無卡提款。
《蘋果》記者

[節錄] IT人才荒 高層年薪達150萬

IT職位年薪百萬

IT人才荒 高層年薪達150萬

9成企業擬增聘 跳槽料加薪1成

臨近加薪季度,有人力調查機構公布2014年薪酬指南,科技業招聘意慾強勁,近9成管理層看好前景、有意「招兵買馬」。
然而行內出現人才荒,首席技術官(Chief Technology Officer,簡稱CTO)及首席資訊官(Chief Information Officer,簡稱CIO)吃香,年薪高達150萬元,成功跳槽更可獲至少一成加薪。
有科技企業歎人才難聘,惟有從印度等地輸入專才開發項目。
招聘顧問公司Robert Half發布2014年亞洲薪酬指南,訪問了香港150名資深金融服務業領袖、150名財務總監和104名資訊科技總監有關招聘及加薪意慾。
電訊及金融服務業搶人
按行業來劃分,科技業的招聘意慾最為強勁,89%受訪香港資訊科技總監,對其公司未來一年的增長前景感樂觀,均有意增聘人手;其中電訊和金融服務業對資訊科技人才需要最強勁,掌握網絡行政、資料庫管理及Java等程式語言的專才,最為吃香。
中原人力資源顧問有限公司董事總經理周綺萍指出,企業愈來愈重視CTO及CIO的職位,因為近年經濟尚未明朗,擅於分析市場數據的CTO、CIO,有助公司制定政策,加上社交平台、手機應用程式近年愈來愈盛行,公司為了搶攻市場,亟需借助相關人才,以研究有關數據。
須實戰經驗 如App雲端
周又指出,要成為行內搶手人才,必須具大量新科技的實戰經驗,例如手機App、雲端等。
報告指出,CTO及CIO今年加薪幅度達7%,年薪達150萬元以上。Manpower大中華區董事總經理徐玉珊指,自雷曼事件後,銀行對網上產品的監管 更嚴謹,極有需要聘請相關人才,惟香港正缺相關人才,而且僱主多要求人才,兼備帶領多地區IT團隊,因而造就高薪挖角情況,不少跳槽者更可獲至少一成的加 薪,為公司開發新項目者更可獲獎金。
報告又指出,本港商界今年營商信心樂觀,近5成財務與會計業管理層將增聘會計人員。
Robert Half香港區總裁安柏菲預計,健康護理、資訊科技服務及零售業的財務分析師及核數師需求上升。
其中財務策劃與分析經理及董事極具前景,年薪可高達150萬元以上。
至於去年多次傳出裁員消息的銀行與金融服務業,超過9成受訪資深金融服務業管理層,對公司增長有信心,46%僱主有意於未來半年增聘人手。
安柏菲表示,香港金融服務着重監管要求,故預期銀行及金融機構,需增聘更多員工應付風險管理及法規問題,其中信貸風險專業人員年薪可達149萬元,她估計保險、私募基金、銀行及資產管理的人才需要尤為高企。
撰文:林卓昕、沈怡、陳韻文

Source: 
http://www.hket.com/eti/article/43f71c8f-a4f3-4677-8f02-190259220acc-084565?ref=facebook

Monday, March 10, 2014

[OCEJWCD ] Topic #1 - Introduction to Java Servlets

Describe web applications, CGI, and the role of Java

Java Web application:

Web application is an computer application which is then deployed on the web server, the user can access that application via the Internet or an intranet using a browser. Java has strong support for building web applications using Java Enterprise technology. A Java web application is a collection of  HTML pages, XML files, webservices, servlets, JSPs Java classes and jars to create dynamic web project.

Java CGI - Common Gateway Interface:

CGI is a script to receive the request and generate a response for transferring dynamic information between server and client. A CGI program can be written in any language, including Java, that can be executed by your Web server. CGI programs are commonly used to add search engines, guest-book applications, database-query engines, interactive-user forums, and other interactive applications to Web sites. Most of the input to a CGI program is passed into it through environment variables.

Role of Java:

Following different roles are divided based on the Servlet performance:
  • Receive the explicit data sent by the client. 
  • Receive the implicit HTTP request data sent by the browser. 
  • Generate the results.
  • Dispatch the explicit information to the client and Dispatch the implicit HTTP response data.

[OCEJWCD ] Topic #2 - Introduction to Java Server Pages

Describe why Servlets are not the whole solution

  • Development on the Servlet requires to know many high level concepts, so difficult to learn and use.
  • Developing on the complex business logic makes the application more difficult to understand. So it is very difficult for enhancement and bug fixing.
  • Important thing is, to run a servlet on the server it requires Java Run time environment.
  • The servlet technology require more steps to develop, servlet require too long time for development.
  • CGI script produces an entirely new process that takes a lot of time to execute, whereas a servlet creates only a new thread.
  • Too much overhead in development cycle
  • Limited productivity.
  • Complicated syntax.


Describe essentials of JSPs

  • Coding JSPs very simple compare with coding on Java servlets.
  • Very simple to create and enables a clean separation of business logic from presentation.
  • No need to compile and register it in deployment descriptor web.xml.
  • This greatly simplifies the creation and maintenance of web contents.
  • Reuse of components and tag libraries - The dynamic contents can be provided by re-usable components such as JavaBean, Enterprise JavaBean (EJB) and tag libraries.
  • Java's power and portability.
  • Easy to create a modern web development style.
  • Simple syntax.
  • Simplify development-packaging-deployment process. 


Understand the fundamentals and reasons for MVC architecture

  • A single request will result in multiple substantially different looking results.
  • You have a large development team with different team members doing the Web development and the business logic.
  • You perform complicated data processing, but have a relatively fixed layout.

Source: 
http://java.dzone.com/articles/ocejwcd-6-tutorial-0

Sunday, March 9, 2014

1Z0-899 Sample Questions (Q1 ~ Q40)

Question: 1
Given the element from the web application deployment descriptor:
<jsp – property – group>
<url – pattern>/main/page1.jsp</url – pattern>
<scripting – invalid>true</scripting – invalid>
</jsp—property—group>

And given that /main/page1.jsp contains:
<% int i = 12; %>
<b> <%= i %> </b>

What is the result?

A. <b> <b>
B. <b> l2 </b>
C. The JSP fails to execute.
D. <% int i = 12 %>
<b> <%= i % > < b>

Answer: C


Question: 2

A web application allows the HTML title banner to be set using a context initialization parameter called titlestr. Which two properly set the title in the scenario? (Choose two)

A. <title> $ {titlestr} </title>
B. <title> $ {initparam.titlestr}</title>
C. <title> $ {param [0]. titlestr} </title>
D. <title> $ {paramValues.titleStr} </title>
E. <title> $ {initParam [‘titleStr’] } </title>
F. <title> $ {servletParams.titleStr} </title>
G. <title> $ {request.get (“titleStr”) } </title>

Answer: B & E


Question: 3

Given:
11. <%
12.          request.setAttribute (“vals”, new String[] {“1”, “2”, “3”, “4”});
13.          request.setAttribute (“index”, “2”);
14. %>
15. <% - - insert code here - - %>

Which three EL expressions, inserted at line 15, are valid and evaluate to “3”? (Choose three)
A. ${vals.2}
B. ${vals [“2”] }
C. ${vals.index}
D. ${vals[index] }
E. ${vals} [index]
F. ${vals. (vals.index) }
G. ${vals [vals[index-1]] }
Answer: B & D & G

Question : 4

Which three EL expressions, inserted at line 16, are valid and evaluate to “d”? (Choose three)

A. ${map.c}
B. ${map.[c]}
C. ${map.[“c”]}
D. ${map.map.b}
E. ${map.[map.b]}
F. ${map. (map.b)}

Answer: A & C & E


Question: 5

You are building a dating service web site. Part of the form to submit a client's profile is a group of radio buttons for the person's hobbies:
20. <input type  = ‘radio’ name = ‘hobbyEnum’ value = ‘HIKING’> Hiking <br>
21. <input type  = ‘radio’ name = ‘hobbyEnum’ value = ‘SKING’> Sking <br>
22. <input type  = ‘radio’ name = ‘hobbyEnum’ value = ‘SCUBA’> SCUBA <br>
23. <! - - and more options - - >>

After the user submits this form, a confirmation screen is displayed with these hobbies listed. Assume that an application-scoped hobbies, holds a map between the hobby enumerated type and the display name. Which EL code snippet will display Nth element of the user's selected hobbles?

A. ${hobbies [hobbyEnum[N]}
B. ${hobbies [paramValues.hobbyEnum[N]]}
C. ${hobbies [paramValues @ ‘hobbyEnum’ @N]
D. ${hobbies.get(paramValues.hobbyEnum[N]) }
E. ${hobbies [paramValues.hobbyEnum.get(N)] }

Answer: B

Question: 6

Given:
1.  <% int[] nums = {42,420,4200};
2.  request.setAttribute("foo", nums); %>
3.  ${5 + 3 It 6}
4.  S(requestScope['foo'][0] ne 10 div0>
5.  ${10 div 0}

What is the result?
A. true  true
B. false  true
C. false  true  0
D. true  true  Infinity
E. false  true  Infinity
F. An exception is thrown
G. Compilation or translation fails

Answer: E


Question: 7

You are building a web application with a scheduling component. On the JSP, you need to show the current date, the date of the previous week, and the date of the next week. To help you present this information, you have created the following EL functions in the ‘d’ namespace:
            Name : curData; signature: java.util.utilDate CurrentDate()
            Name : curData; signature: java.util.utilDate addweek (java.util.Date, int)
            Name: dateString; signature: java.util.String getDataString (jave.util.Data)

Which EL code snippet will generate the string for the previous week?
A. ${d:dateString(affWeek(curDate(), -1)) }
B. ${d:dateString [addWeek[curDate[], - ]] }
C. ${d:dateString [d:addWeek[d:curDate[], - 1]] }
D. ${d:dateString (d:addWeek(d:curDate(), -1)) }

Answer: D 

Question: 8

Given a header in an HI IP request:
X-Retries: 4

A Which two retrieve the value of the header from a given HttpServletRequest request? (Choose two)
A. request-getHeader("X-Retries")
B. request.getlntHeader("X-Retries")
C. request.getRequestHeader("X-Retries")
D. request.getHeaders{"X-Retries").get(0)
E. request.getRequestHeaders("X-Retries").get(0)

Answer: A & B

Question: 9

Given an HttpServletRequestrequest and HttpResponseresponse, which sets a cookie “username” with the value “joe” in a servlet?
A. request.addCookie("username", "joe")
B. request.setCookie("username", "joe")
C. response.addCookie("username", "joe")
D. request.addHeader(new Cookie("username", "joe"))
E. request.addCookie(new Cookie("username", "joe"))
F. response.addCookie(new Cookie("username", "joe"))
G. response.addHeader(new Cookie("username", "joe"))

Answer: F


Question: 10

Which annotation enables a servlet to efficiently process requests of typo multipart/form-data that involve large files being uploaded by the client?
A. @AcceptMultipart
B. @MultiPartConfig
C. @MultiPartFormData
D. @WebServlet (multipart = true)

Answer: B


Question: 11
APIs for dynamically registering servlets and filters can be called at:
A. Context initialization time
B. Any time
C. There is no way to dynamically register servlets and filters
D. Context destruction time
E. Injected into a servlet context

Answer: A


Question: 12

ServletRegistration.Dynamic can be used to configure (Choose two)
A. Filter mappings
B. add init params
C. set asyncSupported to true
D. add Listeners
Answer: A & B



Question: 13


A web application wants to register a new servlet at runtime using one of theservletContext.addServlet methods.In the implementation of which method is it legal to perform this operation?

A. AsyncListner.oncomplete
B. Servlet.init
C. ServletContextListener.contextInitialize
D. ServletrequestListener.contextInitialize
 

Answer: C



Question: 14


You want to create a filter for your web application and your filter will implement.servlet.Filter.Which two statements are true? (Choose two)
 

A. Your filter class must implement an init method and a destroy method.
B. Your filter class must also implement javax.sarvlat.FilterChain.
C. When your filter chains to the next filter, it should pass the same arguments it received in itsdoFilter method.
D. The method that your filter invokes on the object it received that implements javax – servlet.Filterchain can invoke either another filter or a servlet.
E. Your filter class must implement a doFilter method that takes, among other things, anHttpServletRequest object and an HttpServletresponse object.
 

Answer: A,D



Question: 15

You have a simple wpb application that has a single Front Controller servlet that dispatches toJSPs generate a variety of views. Several of these views require further database processing toretrieve the necessary order object using the orderID request parameter. To do this additionalprocessing, you pass the request first to a servlet that is mapped to the URL pattern /WEB – INF / retrieveOrder.do. in the deployment descriptor. This servlet takes two request parameters, theordered and the jspID and the jspURL. It handles the database calls to retrieve and build thecomplex order objects and then it dispatches to the jspURL.

Which code snippet in the Front Controller servlet dispatches the request to the order retrievalservlet?
 

A. reques.setAttribute (“orderID”, orderIS);
request.setAttribute(“jspURL”, jspURL);
= context.getRequestDispathcher (“/WEB – INF / retrieveOrder.do”);
view.forward(request, response)

B. reques.setAttribute (“orderID”, orderIS);
request.setAttribute(“jspURL”, jspURL);
Dispatcher view= request.getDispatcher (“.WEB – INF / retrieveOrder.do”);
View.forwardRequest (request, response);
 

C. String T= “/WEB – INF / retrieveOrder.do?orderID = %d&jspURl = %s”;
String url = String.format (T, ordered, jspURL);
= context.getRequestDispatcher (url);
View.forward (request, response) ;
 

D. String T= “/WEB – INF / retrieveOrder.do?orderID = %d&jspURl = %s”;
String url = String.format (T, ordered, jspURL);
= context.getRequestDispatcher (url);
View.forwardRequest (request, response) ;

Answer: C




Question: 16 
In ServletContext.getNamedDispatcher(string arg0) arg0 is the


A. url of a servlet relative to the ServletRequest
B. url of a servlet relative to the Context
C. name of a servlet

D.absolute url to any servlet in any Context

Answer: B



Question: 17

When using Servlet asynchronous API if you want to dispatch the request back to a particular url -"/url" within the same Servlet Context which of the following API would you use?


A. ASyncContext.dispatch();
B. AsyncContext.dispatch("/url");
C. AsyncContext.dispatch(servletContext, "/url");
D. AsyncContext.start(runnable);
E. RequestDispatcher.fotward("/url");
F. RequestDispatcher.forward(servletContext, "/url");
G. RequestDispatcher.include("/url");

Answer: A,C

Reference:http://blogs.oracle.com/enterprisetechtips/entry/asynchronous_support_in_servlet_3(Topic: AsyncContext Class, third paragraph)



Question: 18

Which describes a trigger that causes a call to an AsyncListener?


A. Completion of processing
B. Receipt of a new request from the same client
C. Addition of a new filter to the processing stream for this request
D. Completion of each timer interval

Answer: B



Question: 19
 
Refer to the Exhibit.

A servletsets a session-scoped attribute product with an instance of com.example.product anforwardto a JSP.Which two output the name of the product in the response? (Choose two)

A. <%= product.getName() %>
B. <jsp:useBean id="product" class="com.example.Product" /><%= product.getName() %>
C. <jsp:useBean id="com.example.Product" scope="page"><%= product.getName() %></jsp:useBean>
D. <jsp:useBean id="product" type="com.example.Product"scope="page" /><%= product.getName() %>
E. <jsp:useBean id="product" type="com.example.Product">
<%= product.getName() %>
</jsp:useBean>

Answer: B,D



Question: 20
 
Click the Exhibit button.Given the HTML form:


1. <html>
2. <body>
3. <form action="submit.jsp">
4. Name: <input type="text" name="i1"><br>
5. Price: <input type="text" name="i2"><br>
6. <input type="submit">
7. </form>
8. </body>
9. </html>

Assume the product attribute does NOT yet exist in any scope.

Which code snippet, in submit.jsp, instantiates an instance of com.example.Product that containsthe results of the form submission?



A. <jsp:useBean id="com.example.Product" />
<jsp:setProperty name="product" property="*" />
B. <jsp:useBean id="product" class="com.example.Product" />
${product.name = param.i1}${product.price = param.i2}
C. <jsp:useBean id="product" class="com.example.Product">
<jsp:setProperty name="product" property="name"param="i1" />
<jsp:setProperty name="product" property="price"param="i2" />
</jsp:useBean>
D. <jsp:useBean id="product" type="com.example.Product">
<jsp:setProperty name="product" property="name"value="<%= request.getParameter( "i1" ) %>" />
<jsp:setProperty name="product" property="price"value="<%= request.getParameter( "i2" ) %>" />
</jsp:useBean>


Answer: C



Question: 21
You need to create a JavaBean object that is used only within the current ISP page. It must NOTbe accessible to any other page including those that this page might import.Which JSP standard action < .in accomplish this goal?
A. <jsp:useBean id = ‘pageBean’ type = ‘com.example.MyBean’ />
B. <jsp:useBean id = ‘pageBean’ class = ‘com.example.MyBean’ />
C. <jsp:makeBean id = ‘pageBean’ type = ‘com.example.MyBean’ />
D. <jsp:makeBean id = ‘pageBean’ class = ‘com.example.MyBean’ />
E. <jsp:useBean id = ‘pageBean’ class = ‘com.example.MyBean’ />
F. <jsp:makeBean id = ‘pageBean’ class = ‘com.example.MyBean’ />

Answer: B



Question : 22
 
Given the JavaBean class:

public class MyBean {
private Boolean roasted = false;
public MyBean () {}
public Boolean isRoasted ()
{

returned roasted
}

public void setRoasted (Boolean roasted) {
this.roasted = roasted; ]
}

Assume a controller has created an instance of this bean, called setRoasted (true), and insertedthe bean into the application scope using the name “myBean”.

A JSP contains these two tags:



<jsp: useBean id = “aBean” class = “MyBean” scope = “page” \ />
<jsp: getProprty name = “aBean” property = “roasted” \ />Which is true?
 

A. the page will include the output false
B. the page will include the output
C. the page will report that the property roasted does not exist
D. the page will report that the syntax of the useBean tag is incorrect
E. the page will report that the syntax of the getProperty tag ls incorrect

Answer: E

Reference:http://www.emacao.gov.mo/documents/18/06/exam.pdf(4th table from the top)




Question: 23

A developer chooses to avoid using singieThreadModel but wants to ensure that data If; updatedin a thread safe manner.Which two can support this design goal? (Choose two)


A. Store the data in a local variable.
B. Store the data in an instance variable.
C. Store the data in the Httpsession object.
D. Store the data in the sarvletContext object.
E. Store the data in the ServletRequest object.

Answer: A,E



Question: 24


You have a use in your web application that adds several session-scoped attributes. At the end ofthe use case, one of these objects, the manage attribute, is removed and then it needs to decidewhich of the other session-scoped attributes to remove.

How can this goal be accomplished?

A. The object of the manager attribute should implement the HttpSessionBindingListener and itshould call the removeAttribute method on the appropriate session attributes.
B. The object of the manager attribute should implement the HttpSessionListenar and it should callthe removeAttribute method on the appropriate session attributes.
C. The object of the manager attribute should implement the HttpSessionBindingListener rind itshould call the deleteAttribute method on the appropriate session attributes.
D. The object of the manager attribute should implement the HttpsessionListener and it should callthe deleteAttribute method on the appropriate session attributes.

Answer: A



Question: 25

The Squeaky Beans Inc. shopping application was initially developed for a non-distributedenvironment. The company recently purchased the Acme Application Server, which supportsdistributed Httpsession objects. When deploying the application to the server, the doployer marksit as distributable in the web application deployment descriptor to take advantage of this feature.Given this scenario, which two must be true? (Choose two)


A. The J2EE web container must support migration of objects that implement serializable.
B. The J2EE web container must use the native JVM Serialization mechanism for distributingHttpSesaion objects.
C. As per the specification, the J2EE web container ensures that distributed Httpsassion objectswill be stored in a database.
D. Storing references to Enterprise JavaBeans components in the HttpSession object might NOTsupported by J2EE web contain.

Answer: A,D




Question: 26
 
Given an HttpServletRequest request and an httpServletResponse response:
41. HttpSession session = null;
42. // insert code here
43. if (session = = null) {
44. // do something if session does not exist
45. } else {
46. // do something if session exists
47. }

To implement the design intent, which statement must be inserted at line 42?

A. session = response.getSession ();
B. session = request.getSession ();
C. session = request.getSession (true);
D. session = request.getSession (false);
E. session = request.getSession (“jsessionid”);

Answer: D



Question: 27

Users of your web application have requested that they should be able to set the duration of theirsessions. So for example, one user might want a webapp to stay connected for an hour ratherthan the webapp's default of fifteen minutes; another user might want to stay connected for awhole day.Furthermore, you have a special login servlet that performs user authentication and retrieves theobject from the database. You want to augment this code to set up the user's specified sessionduration.Which code snippet in the login servlet will accomplish this goal?


A. User user = //retrieves the user objects object from the database

session.setDurationInterval (user.getSessionDuration());
B. User user = / / retrieves the User objects from the database

session.setInactiveInterval (user.getSessionDuration());
C. User user = / / retrieves the user objects object from the database

session.setInactiveInterval (user.get.SessionDuration());
D. User user = / / retrieves the user objects object from the database

session.setDuration (user.getSessionDuration());
E. User user = / / retrieves the user objects object from the database

session.setMaxInactiveInterval (user.getSessionDuration());
F. User user = / / retrieves the user objects object from the database

session.setMaxDurationInterval (user.getSessionDuration());

Answer: E



Question: 28
 

Which interface must a class implement so that instances of the class are notified after any objectadded to a session?

A. javax.servlet.http.HttpSessionListener
B. javax.servlet.http.HttpSessionValueListener
C. javax.servlet.http.HttpSessionBindingListener
D. javax.servlet.http.HttpSessionAttributeListener

Answer: D



Question: 29
 
Which statement is true about web container session management?
A. Access to session-scoped attributes is guaranteed to be thread-safe by the web container.
B. To activate URL rewriting, the developer must use the HttpServletResponse.setURLRewritingmethod.

C. If the web application uses HTTPS, then the web container may use the data on the HTTPSrequest stream to identify the client.
D. The JSESSIONID cookie is stored permanently on the client so that a user may return to theweb application and the web container will rejoin that session.

Answer: C
 



Question: 30

A method call inside your servlet has thrown an IOException resulting from a lost networkconnection to a necessary resource. The servlet has determined that it will be unable to operatesuccessfully fen few minutes, but expects to be able to resume operation after that period. Howshould this situation handled?

A. The servlet should re-throw the exception to the web container.
B. The servlet should throw a servletException to the web container.
C. The servlet should throw an unavailableException to the web container.
D. The servlet should redirect to an error page that reports the exception message.
E. The servlet should retry the request until the method returns successfully.

Answer: C

Reference:
http://jcp.org/aboutJava/communityprocess/first/jsr053/servlet23_PFD.pdf(page 26,topic: 2.3.3.2, first paragraph)



Question: 31


During initialization, a servlet finds that the database connection it requires is unavailable. As thesystem designer, you know that the database start up completes several minutes after the web-container initializes the servlet. How should this be handled?

A. Retry the connection until it is successful, then allow the init () method to complete.
B. Throw a ServletException
C. Throw the IOException
D. Throw an UnavailableException

Answer: D

Reference:http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/Servlets6.html


Question: 32


A servlet wishes to indicate that it is unable to initialize at the present time, but that the initializationmight succeed at some future time. Which is true?

A. This cannot be expressed. A servlet either initializes correctly or fails.
B. This expression is not necessary. If a servlet fails to initialize, the container will try again latereach time a request is received that attempts to invoke that servlet.
C. The servlet should delay until it is ready to complete initialization successfully.
D. The servlet should throw an UnavailableException
E. The servlet should throw a servletException

Answer: E



Question: 33

You are implementing a model component. You realize that an IOException might arise if you loseconnection to the database. How should you address this?
A. Implement multipathing to provide redundant connectivity to the database, thereby avoiding thatrisk of connection failure.
B. Provide an error handler page, and use the page directive in the invoking ISP to redirect to thatpage if the error arises.
C. Use the JSTL <c:catch> tag to take control if the exception arises.
D. Surround the problem area with a try/catch block and implement appropriate recovery orfallback behavior.

Answer: C


Reference:http://www.ibm.com/developerworks/java/library/j-jstl0318/(topic: exception handling)



Question: 34

Which is a valid value for the enum EmptyRoleSemantic in Javax.servlet.annotation.ServletSecurity?

A.ADMIT
B. PERMIT
C. EXCLUDE
D. DENYALL
E. ALLOWALL

Answer: B

 
Reference:http://tomcat.apache.org/tomcat-7.0-doc/servletapi/javax/servlet/annotation/ServletSecurity.EmptyRoleSemantic.html
 



Question: 35
 
Given the annotation for MyServlet:@WebServlet{"/abc")
 @ServletSecurity (value=@HttpConstraint)public class Myservlet extends Httpservlet {Which two are true? (Choose two)

A. No protection of user data must be performed by the transport.
B. All user data must be encrypted by the transport.
C. Access is to be denied independent of authentication state and identity.
D. Only authenticated users are to be permitted.
E. Access is to be permitted independent of authentication state and identity.

Answer: B,C





Question: 36

Which of the following annotations relate to security in a servlet?


(i) @WebSecurity
(ii) @RolesAllowed
(iii) @WebConstraint
(iv) @HttpConstraint(v) @Servletsecurity

A. (i) only
B. (i) and (iii)
C. (iv) and (v)
D. (iii) and (v)
E. (ii) and (iv)

Answer: C





Question: 37
Which element of a web application deployment descriptor <web-resource-collection> element is used to specify a HTTP method to which the corresponding <security-constraint> will not apply?

A. <exclude-http-method>
B. <neglect-http-method>
C. <http-method-omission>
D. <http-method-excluded>
E. <exceptional-http-method>

Answer: C

Reference:
http://java.sun.com/xml/ns/javaee/web-common_3_0.xsd(search http-method-omission



Question: 38

Which two statements are true about the security-related tags in a valid Java EE deploymentdescriptor? (Choose two)

A. Every <security-constraint> tag must have at least one <http-method> tag.
B. A <security-constraint> tag can have many <web-resource-collection> tags.
C. A given <auth-constraint> tag can apply to only one <web-resource-collection> tag.
D. A given <web-resource-collection> tag can contain from zero to many <url-pattern> tags.
E. It is possible to construct a valid <security-constraint> tag such that, for a given resource userroles can access that resource.

Answer: B,E


Question: 39

 
A cookie may be set to be an HttpOnly cookie. Setting a cookie to be HttpOnly results in (Choosetwo)

A. Client to not expose the cookie to client side scripting code
B. Does not work with https protocol
C. prevent certain types of cross-site scripting attacks
D. There is no such thing as an HttpOnly cookie

Answer: A,C


Reference:http://docs.oracle.com/javaee/6/api/javax/servlet/http/Cookie.html





Question: 40
 
A popular Ajax framework and its companion widget library contain several hundreds of files ofdifferent types (.js, .ess, .html). Your company has mandated that all its web applications use onlyspecific versions of this framework approved by IT and repackaged internally as jar files.Furthermore, web applications should only include the entire jar, without subsetting ormodification.Where should the framework's files be placed inside a jar file to enable this kind of reuse?

A. under resources
B. under META-INF/resources
C. under META-INF/web-contents
D. under WEB-INF/resources

Answer: B


Reference:http://ocpsoft.com/opensource/create-common-facelets-jar/(check the box with theupdate)



Question: 41
 
Which two actions protect a resource file from direct HTTP access within a web application?(Choose two)


A. placing it in the /secure directory
B. placing it in the /WEB-INF directory
C. placing it in the /META-INF/secure directory
D. creating a <web-resource> element within the deployment descriptor
E. creating a <secure-resource> element within the deployment descriptor

Answer: B,C



Question: 42

In which two locations can library dependencies be defined for a web application? (Choose two)

A. the web application deployment descriptor
B. the /META-INF/dependencies.xml file
C. the /META-INF/MANIFEST.MF manifest file
D. the /META-INF/MANIFEST.MF manifest of a JAR in the web application classpath

Answer: C,D





Question: 43
 
The jquery_1_3_2.jar file contains the JQuery Ajax framework in its META-INF/ resourcesdirectory. Where should the jar file be placed inside the web application to ensure the resources itcontains are accessible by clients?

A. WEB-INF/classes
B. WEB-INF/jar
C. WEB-INF/lib
D. WEB INF/resources

Answer: C

Reference:http://www.ibm.com/developerworks/websphere/library/techarticles/0112_deboer/deboer.html(topic: web modules, third paragraph)

Question: 44

Given a jar file packaged with three web fragments with names X, Y and Z respectively.Which of the following deployment descriptor, web.xml, snippets correspond to the web fragmentprocessing orders of X, Y, Z?
 

(i) <absolute-ordering>
<name>X</name><name>Y</name>
<name>Z</name>
</absolute-ordering>
 

(ii) <absolute-ordering>
<name>X</name><name>Y</name>
</absolute-ordering>
 

(iii) <absolute-ordering></others>
<name>Y</name><name>Z</name>
</absolute-ordering>
 

(iv) <absolute-ordering>
<name>X</name></others>
<name>Z</name>
</absolute-ordering>
 

(v) <absolute-ordering>
<name>X</name>
<name>Y</name>
</others></absolute-ordering>

A. (i) only
B. (i) and (ii)
C. (i) and (iv)
D. (i), (iii), (iv) and (v)

Answer: C









Reference:http://blogs.oracle.com/swchan/entry/servlet_3_0_web_fragment



Explanation:
Reference:


Source: 
http://examcertifyblog.blogspot.hk/2013/07/1z0-899-e-books.html
http://www.scribd.com/doc/115744012/Best-Oracle-1Z0-899-Exam-Questions-for-FREE 
http://www.scribd.com/doc/108002815/OCEJWCD-6-test