text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="給自己一個機會,做沒做過的事、不敢做的事,走出舒適圈;發現沒見過的臺大,原來臺大還可以這樣玩;去找朋友、夥伴、情人,重建情感關係吧!">
    <meta name="author" content="國立臺灣大學學生會">
    <meta property="og:image" content="https://ntustudents.org/mission/img/mission-share.png">

    <title>NTU Mission 臺大總動員</title>

    <link href="css/bootstrap.min.css" rel="stylesheet">

    <link href="css/grayscale.css" rel="stylesheet">
    <link href="css/mission.css" rel="stylesheet">

    <link href="font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    <link href="http://fonts.googleapis.com/css?family=Lora:400,700,400italic,700italic" rel="stylesheet" type="text/css">
    <link href="http://fonts.googleapis.com/css?family=Montserrat:400,700" rel="stylesheet" type="text/css">

                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-main-collapse">

                </button>

                      NTU Mission

                        活動介紹

                    任務內容

                            議題

                            校園

                            生活

                            趣味

                            情感

                        特別任務

                        獎品清單

                        排名

                        聯絡我們

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntui1()">

        </button>

#NTUI01

你對轉型正義了解嗎?來打卡並瞭解相關議題吧!(拍照上傳)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntui2()">

        </button>

#NTUI02

由學生會學術部舉辦,報名資訊請上粉專。(參加並拍照上傳)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntui3()">

        </button>

#NTUI03

有沒有好奇活大的飄揚歌聲是哪來的呢?5/10、5/12,一起來活大禮堂戶外木板區聽音樂吧!(拍照上傳)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntui4()">

        </button>

#NTUI04

最喜歡花火的哪篇文章呢,分享並截圖讓我們知道!(截圖上傳)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntui5()">

        </button>

#NTUI05

花火的實體雜誌散佈在校園各個角落,你找得到嗎?(找到並拍照上傳)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntui6()">

        </button>

#NTUI06

學代會每兩週都會開會討論學校中的大小事務,想了解嗎?來旁聽看看吧!(旁聽學代會並拍照上傳)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntui7()">

        </button>

#NTUI07

什麼你不知道!?原來買保險套這麼方便,找到這些地點,一起宣揚安全性行為的觀念吧!(與保險套/指險套販賣機合照)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntui8()">

        </button>

#NTUI08

你對性別意識了解嗎?找一本書來閱讀吧!(與一本性別相關的書籍拍照上傳)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntui9()">

        </button>

#NTUI09

由臺大學生會性別工作坊舉辦,報名資訊請上活動粉專。(參加並拍照上傳)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntui10()">

        </button>

#NTUI10

由臺大學生會性別工作坊舉辦,報名資訊請上活動粉專。(參加並拍照上傳)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntui11()">

        </button>

#NTUI11

用行動支持熊米屋吧!(拍照上傳)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntui12()">

        </button>

#NTUI12

把發票捐給需要的人吧!(拍照上傳)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntui13()">

        </button>

#NTUI13

小心!有動物!你有注意過校園中的告示牌嗎?(拍照上傳)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntui14()">

        </button>

#NTUI14

你瞭解臺大的鳥類嗎?嘗試拍下他們吧!(拍照上傳)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntui15()">

        </button>

#NTUI15

你瞭解臺大的動物嗎?嘗試拍下他們吧!(拍照上傳)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntui16()">

        </button>

#NTUI16

由學生會學術部舉辦,報名資訊請上粉專。(參加並拍照上傳)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntui17()">

        </button>

#NTUI17

5/6 10:00 詳請見:https://goo.gl/Rt6Xzw

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntui18()">

        </button>

#NTUI18

5/6 15:00 詳請見:https://goo.gl/Rt6Xzw

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntui19()">

        </button>

#NTUI19

5/6 16:15 詳請見:https://goo.gl/Rt6Xzw

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntuc1()">

        </button>

#NTUC01

找到指定的地點並做一個動作拍照

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntuc2()">

        </button>

#NTUC02

找到指定的地點並做一個動作拍照

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntuc3()">

        </button>

#NTUC03

找到指定的地點並做一個動作拍照

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntuc4()">

        </button>

#NTUC04

找到指定的地點並做一個動作拍照

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntuc5()">

        </button>

#NTUC05

找到指定的地點並做一個動作拍照

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntuc6()">

        </button>

#NTUC06

找到指定的地點並做一個動作拍照

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntuc7()">

        </button>

#NTUC07

找到指定的地點並做一個動作拍照

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntuc8()">

        </button>

#NTUC08

找到指定的地點並做一個動作拍照

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntuc9()">

        </button>

#NTUC09

找到指定的地點並做一個動作拍照

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntuc10()">

        </button>

#NTUC10

找到指定的地點並做一個動作拍照

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntuc11()">

        </button>

#NTUC11

找到指定的地點並做一個動作拍照

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntuc12()">

        </button>

#NTUC12

找到指定的地點並做一個動作拍照

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntuc13()">

        </button>

#NTUC13

找到指定的地點並做一個動作拍照

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntuc14()">

        </button>

#NTUC14

找到指定的地點並做一個動作拍照

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntuc15()">

        </button>

#NTUC15

找到指定的地點並做一個動作拍照

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntuc16()">

        </button>

#NTUC16

臺大共有10棟博物館,分別為:校史館、人類學博物館、地質標本館、物理文物廳、檔案館、昆蟲標本館、農業陳列館、植物標本館、動物博物館、醫學人文博物館,找到當中的3棟拍照並上傳於同篇貼文中,即可完成任務。

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntuc17()">

        </button>

#NTUC17

臺大有總圖書館、社科院、醫學院二所學院圖書分館,以及物理、數學、化學、大氣、海洋、生化與圖資等7個系所圖書室。任選其中三處,拍照並上傳於同篇貼文中,即可完成任務。

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntuc18()">

        </button>

#NTUC18

藝術季開幕活動將在5/6(五)18:30在振興草皮舉行,當天至開幕活動現場,拍下自己在現場的照片上傳。

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntuc19()">

        </button>

#NTUC19

長興附近的夜市是住宿生的天堂,身為臺大生的你怎麼能不去一探究竟?到男一夜市中選擇一項自己喜愛的宵夜,並將自己吃得經津津有味的樣子記錄下來吧!(拍照上傳)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntuc20()">

        </button>

#NTUC20

在臺大中想必你上過不少的課程,哪門課的老師最深的你心呢?用這次臺大總動員的機會,鼓起勇氣跟教授合照吧!(拍照上傳)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntuc21()">

        </button>

#NTUC21

在總圖的某層樓中藏著看電影的地方,你是否有去過呢?若是沒有,何不藉這這次的機會讓自己前往一探究竟!(拍照上傳)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntuc22()">

        </button>

#NTUC22

你是否看不慣亂停的腳踏車?是否深深覺得水源阿伯每日搬腳踏車十分辛苦,同時維持臺大腳踏車停車的秩序相當帥氣呢?協助水源阿伯吧,成為維護校園的搬車小助手。(拍照或影片上傳)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntuc23()">

        </button>

#NTUC23

臺大中其實藏著蒸飯箱你知道嗎?找到他們並帶著自己的便當使用看看吧!(拍照上傳)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntuc24()">

        </button>

#NTUC24

亂停的腳踏車經常是臺大校園中的亂象,為了讓我們的校園變得更加美麗,伸出援手吧!將那些混亂化為秩序,讓我們的校園回歸原有的美麗。(拍照或影片上傳)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntuc25()">

        </button>

#NTUC25

望著醫學院大廳角落的那台鋼琴,你是否曾經蠢蠢欲動想坐在琴台前演奏動人音樂卻裹足不前呢?別猶疑,快坐上鋼琴台前為大家演奏一曲吧!(注意事項:使用時間為平日早上六點到八點、下午五點到晚上十一點、假日下午六點至晚上十一點。)(照片或影片上傳)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntuc26()">

        </button>

#NTUC26

位於總區小福與臺大醫院下的理髮部有著與現代髮廊不同的復古風味,身為一名臺大生在離校前都該進去給阿姨設計一次頭髮,留做紀念!

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntuc27()">

        </button>

#NTUC27

傳說中,如果一群人在短時間內一直數傅鐘21饗就可以破除魔咒,讓我們還驗證傳奇吧!

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntuc28()">

        </button>

#NTUC28

AED(Automated External Defibrillator),稱為「自動體外心臟電擊去顫器」,是一台能夠自動偵測傷病患心律脈搏、並施以電擊使心臟恢復正常運作的儀器,在緊急時刻是相當重要又便利的急救器具。請在校內找到三個AED吧!

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntuc29()">

        </button>

#NTUC29

白天的椰林大道、夜晚的椰林大道你或許走過,那你有看過在椰林大道的日出嗎?跟大家分享吧!

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntuc30()">

        </button>

#NTUC30

校園內有許多默默服務著我們的人,不論是警衛室內的伯伯、阿姨說,或是跟校內的職工、清潔阿姨叔叔,跟他們說一聲辛苦了表達謝意吧!

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntuc31()">

        </button>

#NTUC31

找到指定的地點並做一個動作拍照

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntuc32()">

        </button>

#NTUC32

找到指定的地點並做一個動作拍照

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntuc33()">

        </button>

#NTUC33

找到指定的地點並做一個動作拍照

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntuc34()">

        </button>

#NTUC34

找到指定的地點並做一個動作拍照

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntuc35()">

        </button>

#NTUC35

找到指定的地點並做一個動作拍照

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntuc36()">

        </button>

#NTUC36

找到指定的地點並做一個動作拍照

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntuc37()">

        </button>

#NTUC37

找到指定的地點並做一個動作拍照

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntuc38()">

        </button>

#NTUC38

找到指定的地點並做一個動作拍照

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntuc39()">

        </button>

#NTUC39

找到指定的地點並做一個動作拍照

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntuc40()">

        </button>

#NTUC40

找到指定的地點並做一個動作拍照

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntuc41()">

        </button>

#NTUC41

找到指定的地點並做一個動作拍照

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntuc42()">

        </button>

#NTUC42

找到指定的地點並做一個動作拍照

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntul1()">

        </button>

#NTUL01

多久沒有早起運動了!動動身體燒燒熱量吧!(拍照上傳)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntul2()">

        </button>

#NTUL02

所有系所每年都會有的共通回憶,自己系或別人系的之夜,去參加吧!(一張有自己的照片)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntul3()">

        </button>

#NTUL03

最喜歡臺大哪裡呢?po出美的瞬間或是感動人心的一幕吧。(上傳照片或影片)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntul4()">

        </button>

#NTUL04

三餐都在外,動手做做便當、蛋糕、餅乾給自己吃吧!(拍照上傳)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntul5()">

        </button>

#NTUL05

每餐都大魚大肉嗎?吃點健康的蔬果吧!(拍照上傳)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntul6()">

        </button>

#NTUL06

愛惜環保、友善環境,用自己的餐具吃飯吧!(拍照上傳)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntul7()">

        </button>

#NTUL07

進入自己的系所有什麼收穫或體悟想要跟別人說的嗎?用三句話介紹自己的系吧!(上傳三段文字)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntul8()">

        </button>

#NTUL08

拍下至金色三麥用餐的合照,即可過關!

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntul9()">

        </button>

#NTUL09

每個週都有自己的風格與特色,一起來看看吧!

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntul10()">

        </button>

#NTUL10

tag 5個沒玩過朋友並跟他說這個活動有多好玩!

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntuf1()">

        </button>

#NTUF01

校園安全你我有責,戴全罩式安全帽保護頭部,提醒大家注意校園安全!(拍照上傳)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntuf2()">

        </button>

#NTUF02

點餐是一件再自然不過的事情了,嘗試使用中文與英文以外的語言點餐吧,並錄影記錄下來讓我們知道!(影片上傳)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntuf3()">

        </button>

#NTUF03

校園內的建築物在閉館時總是撥放著臺大校歌,聽到此曲響起是否激起了你的愛校之心呢?拍下自己對嘴唱校歌的影片吧!並且用誇張動作提醒同學,該離館囉!(拍下影片、需有誇張表情)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntuf4()">

        </button>

#NTUF04

你是不是下課看見黑板上的字就會不自覺想要往上衝呢?不要忽略自我內心的衝動,上吧,你就是臺大最佳板哥/姊!(拍照上傳)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntuf5()">

        </button>

#NTUF05

「我可能不會唱,但很會演。」錄下一段自拍對嘴的影片吧!(影片上傳)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntuf6()">

        </button>

#NTUF06

有沒有覺得每天照鏡子髮型好像就那麼幾個,把頭髮理成跟NTU有關的髮型吧!讓你成為眾人注目的焦點!(拍照上傳)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntuf7()">

        </button>

#NTUF07

「欸欸快到了嗎」「嗚嗚我遲到了」「我用跑的都比你腳踏車快」,等等,你知道你用跑的多久才可以跑完嗎?來挑戰吧!(錄一段影片)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntuf8()">

        </button>

#NTUF08

到底舟山路有多長呢,用腳程來測試吧!(錄一段影片)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntuf9()">

        </button>

#NTUF09

有沒有遇過很認真備課,很喜歡教學風格的老師呢?對他表達感謝之情吧!(錄一段影片)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntuf10()">

        </button>

#NTUF10

把自己做成可愛的貼圖給朋友看看吧。(錄一段影片)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntuf11()">

        </button>

#NTUF11

「呦呦鹿鳴,食野之苹。我有嘉賓,鼓瑟吹笙。」(影片上傳)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntuf12()">

        </button>

#NTUF12

「怎麼這麼巧,我與你真有緣。」,找到和自己名字一樣的人吧!(拍照上傳)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntuf13()">

        </button>

#NTUF13

學霸,是你?po出一張期中、期末考的考卷或是學期成績。(照片上傳)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntuf14()">

        </button>

#NTUF14

放鬆一下,跳支舞吧!(影片上傳)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntuf15()">

        </button>

#NTUF15

「我也跟你太有緣了吧!」找到另外兩個學號跟自己一樣的人!(照片上傳)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntuf16()">

        </button>

#NTUF16

(限公館、台大店)限時10分鐘內吃完浩克吃的堡套餐,若挑戰成功,餐點免費招待,失敗則需付費(原價790元)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntuf17()">

        </button>

#NTUF17

霍格華茲臺大分校:拿起你的魔棒,對路人練習魔法,大喊「整整—石化」(上傳影片)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntuf18()">

        </button>

#NTUF18

(從耳熟能詳的Lucy,到國高中的健康操你還記得哪些呢?動一動身體吧!(影片上傳)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntue1()">

        </button>

#NTUE01

與好友們拍攝可愛逗趣的鬼臉照吧,找出誰才是真正的鬼臉大師!(拍照上傳)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntue2()">

        </button>

#NTUE02

社團為大學三大學分之一,在社團中你學習到了什麼?社團中又有什麼值得分享的社課呢?拍下照片介紹你的社團吧!(拍照上傳)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntue3()">

        </button>

#NTUE03

還記得當年是什麼樣的契機使你加入系隊嗎?新生盃?直屬的推薦?或是你原本對此就有興趣呢?不管怎樣,相信在系隊或許都在你的大學生活中佔有一部份的回憶吧!分享一張系隊練習或比賽的照片吧!(拍照上傳)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntue4()">

        </button>

#NTUE04

你多久沒有對一個人表達你的心意,送禮物和小卡給一個重要的人,記錄下那溫馨的一刻並讓我們知道吧!(拍照或影片上傳)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntue5()">

        </button>

#NTUE05

家人陪伴著我們數十年,或許日常生活中有些小磨合,或許有些重要溫暖的時刻,嘗試打電話給家人說聲我愛你吧,並開擴音讓我們知道他們的反應!(需要開擴音)(影片上傳)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntue6()">

        </button>

#NTUE06

忙碌的課業與活動塞滿了你的生活,在你多久沒回家坐在餐桌上與家人一同吃飯了呢?找一天回家跟家人吃飯吧,並跟我們分享那溫暖的畫面。(拍一張和家人吃飯的照片)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntue7()">

        </button>

#NTUE07

過去的他/她是否許久不見了?曾經最了解彼此的你們是否還有些話想說說呢?吃個飯吧!或許這次的契機可以讓彼此對感情更有收穫。(拍照上傳)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntue8()">

        </button>

#NTUE08

當兩個在你生命歷程中都很重要的人與你一起見面,會有什麼火花呢?面對感情,讓我們都變成更好的人吧。(拍照上傳)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntue9()">

        </button>

#NTUE09

還記得童年時候的你嗎?與現在相差無幾,或是男女大十八變呢?分享一張你小時候的照片吧,讓我們一同見證你從過去至今的變化。(一張有自己的照片)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntue10()">

        </button>

#NTUE10

你想要變成怎樣的自己,做什麼事情?把你的夢想勇敢的說出來,激勵自己努力實踐吧!(影片上傳)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntue11()">

        </button>

#NTUE11

是什麼讓你不斷成長,又是什麼讓你不斷謹惕自己,告訴我們影響你最深的一句話吧!(拍照上傳)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntue12()">

        </button>

#NTUE12

大學、研究所生涯匆匆就過去了,為自己留下一張課堂的照片吧!(拍照上傳)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntue13()">

        </button>

#NTUE13

有什麼朋友一直擺著沒有使用讓你看不下去的東西嗎?使用KKTOWN軟體,拍一段影片介紹這個產品並上架賣出,將影片po在活動頁面吧!(需徵得朋友同意)(影片上傳)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntue14()">

        </button>

#NTUE14

有什麼是爸媽送的但卻用不到的東西?使用KKTOWN軟體,拍一段影片介紹這個產品並上架賣出,將影片po在活動頁面吧!(影片上傳)

        <button type="button" class="btn btn-default" aria-label="Left Align" style="border-color: black;color: black;" onclick="rntue15()">

        </button>

#NTUE15

有什麼是前男女朋友送的東西讓你看了就想賣掉?使用KKTOWN軟體,拍一段影片介紹這個產品並上架賣出,將影片po在活動頁面吧!(影片上傳)

 議題 Issue

#NTUI01

與陳文成事件紀念廣場立牌拍照

難度: 進階

#NTUI02

5/4學術部言論自由講座

難度: 挑戰

#NTUI03

聽一場光合作用

難度: 一般

#NTUI04

分享花火一篇最愛的文章

難度: 一般

#NTUI05

和花火實體雜誌拍照

難度: 一般

#NTUI06

旁聽學代會

難度: 一般

#NTUI07

找到販賣保險套/指險套的地點

難度: 一般

#NTUI08

在圖書館找一本性別相關的書籍

難度: 進階

#NTUI09

5/2突破 — 台海兩岸同志運動對談

難度: 挑戰

#NTUI10

【愛自在】性別友善廁所工作坊

難度: 挑戰

#NTUI11

購買熊米屋愛心餅乾

難度: 進階

#NTUI12

捐發票

難度: 一般

#NTUI13

找到臺大中與野生動物有關的告示

難度: 進階

#NTUI14

拍到校園中三種鳥類

難度: 進階

#NTUI15

拍到三種外來種動物

難度: 進階

#NTUI16

5/11 原住民與國家法體制

難度: 進階

#NTUI17

國立台灣大學植物培育溫室新建工程 說明會

難度: 挑戰

#NTUI18

舊機械工程館指定為歷史建築及工綜新館新建工程設計調整 說明會

難度: 挑戰

#NTUI19

瑠公圳舊址復原及小椰林道段渠道景觀工程第一期細部設計公聽會

難度: 挑戰

 校園 Campus

#NTUC01

神秘地點1

難度: 進階

#NTUC02

神秘地點2

難度: 挑戰

#NTUC03

神秘地點3

難度: 進階

#NTUC04

神秘地點4

難度: 挑戰

#NTUC05

神秘地點5

難度: 進階

#NTUC06

神秘地點6

難度: 進階

#NTUC07

神秘地點7

難度: 進階

#NTUC08

神秘地點8

難度: 進階

#NTUC09

神秘地點9

難度: 進階

#NTUC10

神秘地點10

難度: 挑戰

#NTUC11

神秘地點11

難度: 挑戰

#NTUC12

神秘地點12

難度: 進階

#NTUC13

神秘地點13

難度: 挑戰

#NTUC14

神秘地點14

難度: 進階

#NTUC15

神秘地點15

難度: 挑戰

#NTUC16

探索博物館(3)

難度: 挑戰

#NTUC17

探索圖書館(5)

難度: 挑戰

#NTUC18

參加藝術季開幕式

難度: 挑戰

#NTUC19

長興夜市最愛料理

難度: 一般

#NTUC20

跟教授合照

難度: 一般

#NTUC21

在總圖看電影

難度: 一般

#NTUC22

協助水源阿伯

難度: 進階

#NTUC23

使用蒸飯箱

難度: 進階

#NTUC24

把腳踏車排好

難度: 進階

#NTUC25

醫學院彈鋼琴

難度: 一般

#NTUC26

到理髮部剪髮

難度: 進階

#NTUC27

數完傅鐘21響

難度: 進階

#NTUC28

在校內找到3個AED

難度: 進階

#NTUC29

在椰林大道看日出

難度: 挑戰

#NTUC30

跟警衛或清潔阿姨叔叔表達感謝

難度: 一般

#NTUC31

神秘地點16

難度: 一般

#NTUC32

神秘地點17

難度: 一般

#NTUC33

神秘地點18

難度: 一般

#NTUC34

神秘地點19

難度: 挑戰

#NTUC35

神秘地點20

難度: 一般

#NTUC36

神秘地點21

難度: 挑戰

#NTUC37

神秘地點22

難度: 進階

#NTUC38

神秘地點23

難度: 一般

#NTUC39

神秘地點24

難度: 一般

#NTUC40

神秘地點25

難度: 進階

#NTUC41

神秘地點26

難度: 一般

#NTUC42

神秘地點27

難度: 進階

 生活 Life

#NTUL01

早上9點前去運動

難度: 進階

#NTUL02

參與1場之夜

難度: 一般

#NTUL03

po一張最喜歡臺大的照片或影片

難度: 一般

#NTUL04

吃自己做的食物

難度: 進階

#NTUL05

一餐吃五種顏色的蔬果

難度: 挑戰

#NTUL06

外食自帶餐具(碗跟筷子)

難度: 進階

#NTUL07

介紹自己的系

難度: 一般

#NTUL08

「金」天來吃吧!

難度: 挑戰

#NTUL09

上傳一張週的打卡照

難度: 一般

#NTUL10

跟朋友介紹這個活動

難度: 進階

 趣味 Fun

#NTUF01

戴全罩安全帽騎腳踏車

難度: 進階

#NTUF02

用英文和中文以外的語言點餐

難度: 進階

#NTUF03

閉館時跟著唱校歌

難度: 進階

#NTUF04

一下課就衝上講台幫老師擦黑板

難度: 進階

#NTUF05

自拍對嘴影片並放上網

難度: 進階

#NTUF06

理髮成跟臺大有關

難度: 挑戰

#NTUF07

7分鐘內從臺大正門跑到法律系霖澤館

難度: 挑戰

#NTUF08

5分鐘內從舟山路的頭跑到長興街上的警衛室

難度: 挑戰

#NTUF09

下課後揪到共三個人一起起立立正謝謝老師

難度: 挑戰

#NTUF10

模仿FB動態貼圖動作

難度: 進階

#NTUF11

在鹿鳴堂前面學鹿叫

難度: 進階

#NTUF12

找到與自己相同名字的人

難度: 進階

#NTUF13

100分考卷

難度: 挑戰

#NTUF14

在學習開放空間跳無聲舞

難度: 挑戰

#NTUF15

找到3個學號末兩碼跟自己一樣的人

難度: 挑戰

#NTUF16

去發福廚房挑戰「浩克吃的堡」

難度: 挑戰

#NTUF17

對路人大喊「整整—石化」

難度: 挑戰

#NTUF18

在小福前跳健康操(至少一分鐘)

難度: 挑戰

 情感 Emotion

#NTUE01

好友鬼臉照

難度: 一般

#NTUE02

社團分享

難度: 一般

#NTUE03

系隊分享

難度: 一般

#NTUE04

送小禮給朋友

難度: 一般

#NTUE05

跟家人說我愛你

難度: 進階

#NTUE06

回家跟家人吃飯

難度: 進階

#NTUE07

和前男/女友一起吃飯

難度: 進階

#NTUE08

前男/女友+現任一起吃飯

難度: 挑戰

#NTUE09

po小時候的照片

難度: 一般

#NTUE10

在校門大喊夢想

難度: 進階

#NTUE11

寫下座右銘

難度: 一般

#NTUE12

坐第一排跟全班自拍

難度: 挑戰

#NTUE13

一個想幫朋友賣的東西

難度: 挑戰

#NTUE14

賣一個爸媽送的東西

難度: 挑戰

#NTUE15

賣一個前男女朋友送的東西

難度: 挑戰

Contact NTU Student Association

ntusamailbox@gmail.com

                         Facebook

Copyright © Ang Fu 2016


text:
package com.amazonaws.services.auditmanager.model.transform;

import java.math.*;

import javax.annotation.Generated;

import com.amazonaws.services.auditmanager.model.*;
import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*;
import com.amazonaws.transform.*;

import com.fasterxml.jackson.core.JsonToken;
import static com.fasterxml.jackson.core.JsonToken.*;

/**
 * Settings JSON Unmarshaller
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class SettingsJsonUnmarshaller implements Unmarshaller<Settings, JsonUnmarshallerContext> {

    public Settings unmarshall(JsonUnmarshallerContext context) throws Exception {
        Settings settings = new Settings();

        int originalDepth = context.getCurrentDepth();
        String currentParentElement = context.getCurrentParentElement();
        int targetDepth = originalDepth + 1;

        JsonToken token = context.getCurrentToken();
        if (token == null)
            token = context.nextToken();
        if (token == VALUE_NULL) {
            return null;
        }

        while (true) {
            if (token == null)
                break;

            if (token == FIELD_NAME || token == START_OBJECT) {
                if (context.testExpression("isAwsOrgEnabled", targetDepth)) {
                    context.nextToken();
                    settings.setIsAwsOrgEnabled(context.getUnmarshaller(Boolean.class).unmarshall(context));
                }
                if (context.testExpression("snsTopic", targetDepth)) {
                    context.nextToken();
                    settings.setSnsTopic(context.getUnmarshaller(String.class).unmarshall(context));
                }
                if (context.testExpression("defaultAssessmentReportsDestination", targetDepth)) {
                    context.nextToken();
                    settings.setDefaultAssessmentReportsDestination(AssessmentReportsDestinationJsonUnmarshaller.getInstance().unmarshall(context));
                }
                if (context.testExpression("defaultProcessOwners", targetDepth)) {
                    context.nextToken();
                    settings.setDefaultProcessOwners(new ListUnmarshaller<Role>(RoleJsonUnmarshaller.getInstance())

                    .unmarshall(context));
                }
                if (context.testExpression("kmsKey", targetDepth)) {
                    context.nextToken();
                    settings.setKmsKey(context.getUnmarshaller(String.class).unmarshall(context));
                }
                if (context.testExpression("evidenceFinderEnablement", targetDepth)) {
                    context.nextToken();
                    settings.setEvidenceFinderEnablement(EvidenceFinderEnablementJsonUnmarshaller.getInstance().unmarshall(context));
                }
            } else if (token == END_ARRAY || token == END_OBJECT) {
                if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {
                    if (context.getCurrentDepth() <= originalDepth)
                        break;
                }
            }
            token = context.nextToken();
        }

        return settings;
    }

    private static SettingsJsonUnmarshaller instance;

    public static SettingsJsonUnmarshaller getInstance() {
        if (instance == null)
            instance = new SettingsJsonUnmarshaller();
        return instance;
    }
}

redpajama_set_name: RedPajamaGithub


text:
from numpy import corrcoef, clip

from lambdaimage.rdds.series import Series

class SpatialSeries(Series):
    """
    Distributed collection of 1d array data with spatial coordinates.

    Backed by an RDD of key-value pairs where the
    key is a tuple identifying a spatial coordinate (e.g. x,y,z),
    and the value is a one-dimensional array.

    Parameters
    ----------
    rdd : RDD of (tuple, array) pairs
        RDD containing the series data

    index : array-like or one-dimensional list
        Values must be unique, same length as the arrays in the input data.
        Defaults to arange(len(data)) if not provided.

    dims : Dimensions
        Specify the dimensions of the spatial coordinate keys (min, max, and count),
        can avoid computation if known in advance

    See also
    --------
    Series : base class for Series data
    """
    # use superclass __init__

    @property
    def _constructor(self):
        return SpatialSeries

    def mapToNeighborhood(self, neighborhood):
        """
        Flat map records to key-value pairs where the
        key is neighborhood identifier
        """

        def toNeighbors(ind, v, sz, mn, mx):
            """Create a list of key value pairs with multiple shifted copies
            of each record over a region specified by sz
            """
            import itertools
            xrng = range(-sz, sz+1, 1)
            yrng = range(-sz, sz+1, 1)
            out = list()
            # build list of pairs with new indices and the value
            for x, y in itertools.product(xrng, yrng):
                xnew = clip(ind[0] + x, mn[0], mx[0])
                ynew = clip(ind[1] + y, mn[1], mx[1])
                key = (xnew, ynew)
                out.append((key, v))
            # append third index if present
            if len(ind) > 2:
                out = map(lambda (k, v): ((k[0], k[1], ind[2]), v), out)
            return out

        dims = self.dims
        rdd = self.rdd.flatMap(lambda (k, v): toNeighbors(k, v, neighborhood, dims.min[0:2], dims.max[0:2]))

        return self._constructor(rdd).__finalize__(self)

    def localCorr(self, neighborhood):
        """
        Correlate every signal to the average of its local neighborhood.

        This algorithm computes, for every spatial record, the correlation coefficient
        between that record's series, and the average series of all records within
        a local neighborhood with a size defined by the neighborhood parameter.
        For data with three spatial keys, only neighborhoods in x and y
        currently supported.

        Parameters
        ----------
        neighborhood : integer
            Size of neighborhood, describes extent in either direction, so
            total neighborhood will be 2n + 1.
        """

        if len(self.dims.max) not in [2, 3]:
                raise NotImplementedError('keys must have 2 or 3 dimensions to compute local correlations')

        # flat map to key value pairs where the key is neighborhood identifier and value is time series
        neighbors = self.mapToNeighborhood(neighborhood)

        # reduce by key to get the average time series for each neighborhood
        means = neighbors.rdd.reduceByKey(lambda x, y: x + y).mapValues(lambda x: x / ((2*neighborhood+1)**2))

        # join with the original time series data to compute correlations
        result = self.rdd.join(means)

        # get correlations
        corr = result.mapValues(lambda x: corrcoef(x[0], x[1])[0, 1])

        # sort output because we expect shuffling to change ordering
        return Series(corr, index='correlation').__finalize__(self).sortByKey()


text: Highlight source code syntax with highlight.js.


text:
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
     android:interpolator="@android:anim/accelerate_interpolator"
     android:shareInterpolator="true">
    <translate
        android:duration="@android:integer/config_shortAnimTime"
        android:fromXDelta="0%"
        android:toXDelta="100%"/>
    <alpha
        android:duration="@android:integer/config_shortAnimTime"
        android:fromAlpha="1"
        android:toAlpha="0"/>
</set>


text:
/*global define*/
define([
    './arrayRemoveDuplicates',
    './BoundingSphere',
    './Cartesian3',
    './Check',
    './ComponentDatatype',
    './CoplanarPolygonGeometryLibrary',
    './defaultValue',
    './defined',
    './Geometry',
    './GeometryAttribute',
    './GeometryAttributes',
    './GeometryInstance',
    './GeometryPipeline',
    './IndexDatatype',
    './PolygonGeometryLibrary',
    './PolygonPipeline',
    './PrimitiveType'
], function(
    arrayRemoveDuplicates,
    BoundingSphere,
    Cartesian3,
    Check,
    ComponentDatatype,
    CoplanarPolygonGeometryLibrary,
    defaultValue,
    defined,
    Geometry,
    GeometryAttribute,
    GeometryAttributes,
    GeometryInstance,
    GeometryPipeline,
    IndexDatatype,
    PolygonGeometryLibrary,
    PolygonPipeline,
    PrimitiveType) {
    'use strict';

    function createGeometryFromPositions(positions){
        var length = positions.length;
        var flatPositions = new Float64Array(length * 3);
        var indices = IndexDatatype.createTypedArray(length, length * 2);

        var positionIndex = 0;
        var index = 0;

        for (var i = 0; i < length; i++) {
            var position = positions[i];
            flatPositions[positionIndex++] = position.x;
            flatPositions[positionIndex++] = position.y;
            flatPositions[positionIndex++] = position.z;

            indices[index++] = i;
            indices[index++] = (i + 1) % length;
        }

        var attributes = new GeometryAttributes({
            position: new GeometryAttribute({
                componentDatatype : ComponentDatatype.DOUBLE,
                componentsPerAttribute : 3,
                values : flatPositions
            })
        });

        return new Geometry({
            attributes : attributes,
            indices : indices,
            primitiveType : PrimitiveType.LINES
        });
    }

    /**
     * A description of the outline of a polygon composed of arbitrary coplanar positions.
     *
     * @alias CoplanarPolygonOutlineGeometry
     * @constructor
     *
     * @param {Object} options Object with the following properties:
     * @param {PolygonHierarchy} options.polygonHierarchy A polygon hierarchy that can include holes.
     *
     * @see CoplanarPolygonOutlineGeometry.createGeometry
     *
     * @example
     * var polygonOutline = new Cesium.CoplanarPolygonOutlineGeometry({
     *   positions : Cesium.Cartesian3.fromDegreesArrayHeights([
     *      -90.0, 30.0, 0.0,
     *      -90.0, 30.0, 1000.0,
     *      -80.0, 30.0, 1000.0,
     *      -80.0, 30.0, 0.0
     *   ])
     * });
     * var geometry = Cesium.CoplanarPolygonOutlineGeometry.createGeometry(polygonOutline);
     */
    function CoplanarPolygonOutlineGeometry(options) {
        options = defaultValue(options, defaultValue.EMPTY_OBJECT);
        var polygonHierarchy = options.polygonHierarchy;
        //>>includeStart('debug', pragmas.debug);
        Check.defined('options.polygonHierarchy', polygonHierarchy);
        //>>includeEnd('debug');

        this._polygonHierarchy = polygonHierarchy;
        this._workerName = 'createCoplanarPolygonOutlineGeometry';

        /**
         * The number of elements used to pack the object into an array.
         * @type {Number}
         */
        this.packedLength = PolygonGeometryLibrary.computeHierarchyPackedLength(polygonHierarchy) + 1;
    }

    /**
     * A description of a coplanar polygon outline from an array of positions.
     *
     * @param {Object} options Object with the following properties:
     * @param {Cartesian3[]} options.positions An array of positions that defined the corner points of the polygon.
     * @returns {CoplanarPolygonOutlineGeometry}
     */
    CoplanarPolygonOutlineGeometry.fromPositions = function(options) {
        options = defaultValue(options, defaultValue.EMPTY_OBJECT);

        //>>includeStart('debug', pragmas.debug);
        Check.defined('options.positions', options.positions);
        //>>includeEnd('debug');

        var newOptions = {
            polygonHierarchy : {
                positions : options.positions
            }
        };
        return new CoplanarPolygonOutlineGeometry(newOptions);
    };

    /**
     * Stores the provided instance into the provided array.
     *
     * @param {CoplanarPolygonOutlineGeometry} value The value to pack.
     * @param {Number[]} array The array to pack into.
     * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements.
     *
     * @returns {Number[]} The array that was packed into
     */
    CoplanarPolygonOutlineGeometry.pack = function(value, array, startingIndex) {
        //>>includeStart('debug', pragmas.debug);
        Check.typeOf.object('value', value);
        Check.defined('array', array);
        //>>includeEnd('debug');

        startingIndex = defaultValue(startingIndex, 0);

        startingIndex = PolygonGeometryLibrary.packPolygonHierarchy(value._polygonHierarchy, array, startingIndex);

        array[startingIndex] = value.packedLength;

        return array;
    };

    var scratchOptions = {
        polygonHierarchy : {}
    };
    /**
     * Retrieves an instance from a packed array.
     *
     * @param {Number[]} array The packed array.
     * @param {Number} [startingIndex=0] The starting index of the element to be unpacked.
     * @param {CoplanarPolygonOutlineGeometry} [result] The object into which to store the result.
     * @returns {CoplanarPolygonOutlineGeometry} The modified result parameter or a new CoplanarPolygonOutlineGeometry instance if one was not provided.
     */
    CoplanarPolygonOutlineGeometry.unpack = function(array, startingIndex, result) {
        //>>includeStart('debug', pragmas.debug);
        Check.defined('array', array);
        //>>includeEnd('debug');

        startingIndex = defaultValue(startingIndex, 0);

        var polygonHierarchy = PolygonGeometryLibrary.unpackPolygonHierarchy(array, startingIndex);
        startingIndex = polygonHierarchy.startingIndex;
        delete polygonHierarchy.startingIndex;
        var packedLength = array[startingIndex];

        if (!defined(result)) {
            result = new CoplanarPolygonOutlineGeometry(scratchOptions);
        }

        result._polygonHierarchy = polygonHierarchy;
        result.packedLength = packedLength;

        return result;
    };

    /**
     * Computes the geometric representation of an arbitrary coplanar polygon, including its vertices, indices, and a bounding sphere.
     *
     * @param {CoplanarPolygonOutlineGeometry} polygonGeometry A description of the polygon.
     * @returns {Geometry|undefined} The computed vertices and indices.
     */
    CoplanarPolygonOutlineGeometry.createGeometry = function(polygonGeometry) {
        var polygonHierarchy = polygonGeometry._polygonHierarchy;

        var outerPositions = polygonHierarchy.positions;
        outerPositions = arrayRemoveDuplicates(outerPositions, Cartesian3.equalsEpsilon, true);
        if (outerPositions.length < 3) {
            return;
        }
        var isValid = CoplanarPolygonGeometryLibrary.validOutline(outerPositions);
        if (!isValid) {
            return undefined;
        }

        var polygons = PolygonGeometryLibrary.polygonOutlinesFromHierarchy(polygonHierarchy, false);

        if (polygons.length === 0) {
            return undefined;
        }

        var geometries = [];

        for (var i = 0; i < polygons.length; i++) {
            var geometryInstance = new GeometryInstance({
                geometry : createGeometryFromPositions(polygons[i])
            });
            geometries.push(geometryInstance);
        }

        var geometry = GeometryPipeline.combineInstances(geometries)[0];
        var boundingSphere = BoundingSphere.fromPoints(polygonHierarchy.positions);

        return new Geometry({
            attributes : geometry.attributes,
            indices : geometry.indices,
            primitiveType : geometry.primitiveType,
            boundingSphere : boundingSphere
        });
    };

    return CoplanarPolygonOutlineGeometry;
});


text:
namespace EnergyTrading.Mdm.Contracts.Rules
{
    using System;

    using EnergyTrading.Validation;

    public class PredicateRule<TEntity> : Rule<TEntity>
    {
        private Predicate<TEntity> check;
        private string messageOnInvalid;

        public PredicateRule(Predicate<TEntity> check, string messageOnInvalid)
        {
            this.check = check;
            this.messageOnInvalid = messageOnInvalid;
        }

        public override bool IsValid(TEntity entity)
         {
            var valid = check(entity);
            if (!valid)
            {
                this.Message = messageOnInvalid;
            }

            return valid;
        }
    }
}


text:
/*
 * Almost all MIPS CPUs define 8 interrupt sources.  They are typically
 * level triggered (i.e., cannot be cleared from CPU; must be cleared from
 * device).  The first two are software interrupts which we don't really
 * use or support.  The last one is usually the CPU timer interrupt if
 * counter register is present or, for CPUs with an external FPU, by
 * convention it's the FPU exception interrupt.
 *
 * Don't even think about using this on SMP.  You have been warned.
 *
 * This file exports one global function:
 *	void mips_cpu_irq_init(void);
 */
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>

#include <asm/irq_cpu.h>
#include <asm/mipsregs.h>
#include <asm/mipsmtregs.h>
#include <asm/system.h>

static inline void unmask_mips_irq(unsigned int irq)
{
	set_c0_status(0x100 << (irq - MIPS_CPU_IRQ_BASE));
	irq_enable_hazard();
}

static inline void mask_mips_irq(unsigned int irq)
{
	clear_c0_status(0x100 << (irq - MIPS_CPU_IRQ_BASE));
	irq_disable_hazard();
}

static struct irq_chip mips_cpu_irq_controller = {
	.name		= "MIPS",
	.ack		= mask_mips_irq,
	.mask		= mask_mips_irq,
	.mask_ack	= mask_mips_irq,
	.unmask		= unmask_mips_irq,
	.eoi		= unmask_mips_irq,
};

/*
 * Basically the same as above but taking care of all the MT stuff
 */

#define unmask_mips_mt_irq	unmask_mips_irq
#define mask_mips_mt_irq	mask_mips_irq

static unsigned int mips_mt_cpu_irq_startup(unsigned int irq)
{
	unsigned int vpflags = dvpe();

	clear_c0_cause(0x100 << (irq - MIPS_CPU_IRQ_BASE));
	evpe(vpflags);
	unmask_mips_mt_irq(irq);

	return 0;
}

/*
 * While we ack the interrupt interrupts are disabled and thus we don't need
 * to deal with concurrency issues.  Same for mips_cpu_irq_end.
 */
static void mips_mt_cpu_irq_ack(unsigned int irq)
{
	unsigned int vpflags = dvpe();
	clear_c0_cause(0x100 << (irq - MIPS_CPU_IRQ_BASE));
	evpe(vpflags);
	mask_mips_mt_irq(irq);
}

static struct irq_chip mips_mt_cpu_irq_controller = {
	.name		= "MIPS",
	.startup	= mips_mt_cpu_irq_startup,
	.ack		= mips_mt_cpu_irq_ack,
	.mask		= mask_mips_mt_irq,
	.mask_ack	= mips_mt_cpu_irq_ack,
	.unmask		= unmask_mips_mt_irq,
	.eoi		= unmask_mips_mt_irq,
};

void __init mips_cpu_irq_init(void)
{
	int irq_base = MIPS_CPU_IRQ_BASE;
	int i;

	/* Mask interrupts. */
	clear_c0_status(ST0_IM);
	clear_c0_cause(CAUSEF_IP);

	/*
	 * Only MT is using the software interrupts currently, so we just
	 * leave them uninitialized for other processors.
	 */
	if (cpu_has_mipsmt)
		for (i = irq_base; i < irq_base + 2; i++)
			set_irq_chip(i, &mips_mt_cpu_irq_controller);

	for (i = irq_base + 2; i < irq_base + 8; i++)
		set_irq_chip_and_handler(i, &mips_cpu_irq_controller,
					 handle_level_irq);
}


text:
neo_hubway
==========

Hubway Challenge dataset into a Neo4j graph database

Installation
----------------

    git clone git@github.com:maxdemarzi/neo_hubway.git
    bundle install
    rake neo4j:install
    rake neo4j:start
    rackup

On Heroku
---------

    git clone git@github.com:maxdemarzi/neo_hubway.git
    heroku apps:create neohubway
    heroku addons:add neo4j
    git push heroku master

See it running live at http://neohubway.heroku.com

![Screenshot](https://raw.github.com/maxdemarzi/neo_hubway/master/screen_shot.png)


text:
A wrapper around [Ngrok](https://ngrok.com/) providing a secure tunnel to localhost for demoing your Elixir/Phoenix web application or testing webhook integrations.

Once installed, ex_ngrok will manage starting and stopping Ngrok with your application and expose Ngrok's settings to your application.

## Dependencies

- **[Ngrok](https://ngrok.com/) 2.x** Install it on OSX with:

        $ brew cask install ngrok

## Installation

Add ex_ngrok to your `mix.exs` dependencies...

from Hex:

```elixir
def deps do
  [{:ex_ngrok, "~> 0.3.0", only: [:dev]}]
end
```

or, from Github:

```elixir
def deps do
  [{:ex_ngrok, github: "joshuafleck/ex_ngrok", only: [:dev]}]
end
```

Include :ex_ngrok as an application dependency:

```elixir
# We really only want to run Ngrok in development, so
# we only start :ex_ngrok when the env is dev.
# Otherwise, it can be started manually with: Application.start(:ex_ngrok)
def application do
  [ applications: env_specific_applications(Mix.env) ]
end

def env_specific_applications(:dev) do
  [:ex_ngrok]
end

def env_specific_applications(_) do
  []
end
```

## Configuration

The default configurations may be overridden by setting any
of the following in your `config/config.exs` file:

```elixir
config :ex_ngrok,
  # The name of the Ngrok executable
  executable: "ngrok",
  # The type of tunnel (http, https, tcp, or tls)
  protocol: "http",
  # The port to which Ngrok will forward requests
  port: "4000",
  # The URL of Ngrok's API (used to retrieve its settings)
  api_url: "http://localhost:4040/api/tunnels",
  # The amount of sleep (in ms) to put between attempts to connect to Ngrok
  sleep_between_attempts: 200,
  # Any other tunneling options that will be passed directly to Ngrok
  options: ""
```

## Usage

### Retrieving your public URL

Ngrok will create a public URL that tunnels to your development machine.
The URL will change every time Ngrok starts, but you can retrieve the URL
by running the following:

```elixir
Ngrok.public_url # => http://(.*).ngrok.io/
```


text:
<?php

/**
 * Application main configuration
 */

use SMOOF\Application;

$cfg = new Application;

/**
 * Set The Server Displayed Name
 * and url root
 */
$cfg->server->name = 'MEDIADRIVE';
$cfg->server->root = '/';
$cfg->server->timezone = 'Europe/Paris';

/**
 * Set the prefix
 * to find controllers and models
 */
$cfg->controllers->prefix = sprintf('%s\\Controllers\\',$cfg->namespace);
$cfg->models->prefix = sprintf('%s\\Models\\',$cfg->namespace);

/**
 * Set the Data folder (sqlite database, cache ...)
 * /!\ That folder must be writeable
 */
$cfg->data_folder = realpath(dirname(__DIR__).'/Data');

/**
 * Cache folder
 * will be created if not exists
 */
$cfg->cache_folder = $cfg->data_folder.'/Cache';
//$cfg->cache_folder = '/tmp/smoof/cache';


text:
from __future__ import unicode_literals

import datetime
from django.db import migrations, models
import django.db.models.deletion
from django.utils.timezone import utc

class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Club',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('Name', models.CharField(max_length=200)),
                ('Country', models.CharField(blank=True, max_length=200, null=True)),
                ('Address1', models.CharField(blank=True, max_length=200, null=True)),
                ('Address2', models.CharField(blank=True, max_length=200, null=True)),
                ('City', models.CharField(blank=True, max_length=200, null=True)),
                ('State', models.CharField(blank=True, max_length=200, null=True)),
                ('Zip', models.CharField(blank=True, max_length=200, null=True)),
                ('LastUpdated', models.DateTimeField(default=datetime.datetime(2017, 2, 4, 22, 37, 21, 16800, tzinfo=utc))),
            ],
        ),
        migrations.CreateModel(
            name='Person',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('FirstName', models.CharField(default='FirstName', max_length=200)),
                ('LastName', models.CharField(default='LastName', max_length=200)),
                ('Hand', models.CharField(default='Hand', max_length=200)),
                ('YearStarted', models.IntegerField(null=True)),
                ('Gender', models.CharField(blank=True, max_length=200, null=True)),
                ('LastUpdated', models.DateTimeField()),
                ('Club', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='curling.Club')),
            ],
        ),
        migrations.CreateModel(
            name='Rock',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('RockLocalID', models.CharField(max_length=200)),
                ('Color', models.CharField(max_length=200)),
                ('Diameter', models.FloatField(default=292.1)),
                ('LastUpdated', models.DateTimeField()),
                ('Club', models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='curling.Club')),
            ],
        ),
        migrations.CreateModel(
            name='Session',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('Initiated', models.DateTimeField(default=datetime.datetime(2017, 2, 4, 22, 37, 21, 30340, tzinfo=utc))),
                ('Club', models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.CASCADE, to='curling.Club')),
            ],
        ),
        migrations.CreateModel(
            name='SessionPerson',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('RFID', models.CharField(blank=True, max_length=200, null=True)),
                ('Person', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='curling.Person')),
                ('Session', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='curling.Session')),
            ],
        ),
        migrations.CreateModel(
            name='SessionRock',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('RFID', models.CharField(blank=True, max_length=200, null=True)),
                ('Rock', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='curling.Rock')),
                ('Session', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='curling.Session')),
            ],
        ),
        migrations.CreateModel(
            name='Sheet',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('SheetLocalID', models.FloatField(blank=True, max_length=200, null=True)),
                ('Width', models.FloatField(default=150)),
                ('Club', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='curling.Club')),
            ],
        ),
        migrations.CreateModel(
            name='Shot',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('TeeTripMasterTime', models.DateTimeField(null=True)),
                ('HogTripMasterTime', models.DateTimeField(null=True)),
                ('TeeTripDuration', models.IntegerField(null=True)),
                ('HogTripDuration', models.IntegerField(null=True)),
                ('TempC', models.FloatField(null=True)),
                ('Humidity', models.FloatField(null=True)),
                ('TeePingTime', models.IntegerField(null=True)),
                ('TeeDistance', models.FloatField(null=True)),
                ('HogPingTime1', models.IntegerField(null=True)),
                ('HogPingTime2', models.IntegerField(null=True)),
                ('HogDistance1', models.FloatField(null=True)),
                ('HogDistance2', models.FloatField(null=True)),
                ('BroomPingTime', models.IntegerField(null=True)),
                ('BroomDistance', models.FloatField(null=True)),
                ('BroomInputMethod', models.FloatField(blank=True, max_length=200, null=True)),
                ('Person', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='curling.Person')),
                ('Rock', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='curling.Rock')),
                ('Session', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='curling.Session')),
            ],
        ),
        migrations.AddField(
            model_name='rock',
            name='Sheet',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='curling.Sheet'),
        ),
    ]


text:
[![Build Status](https://travis-ci.org/Eagerod/html-cruncher.svg?branch=master)](https://travis-ci.org/Eagerod/html-cruncher)

html-cruncher is a light-weight, dependency-free package for parsing HTML documents.
It was born out of the necessity to have an easy interface for finding certain elements in a page's DOM.

## Usage

Start out by installing html-cruncher using npm:

    npm install html-cruncher

Set up your node project to use the html-cruncher:

```javascript
var request = require("request");
var HTMLElement = require("html-cruncher");

request("http://www.google.com", function(err, response, body) {
	var document = HTMLElement.fromString(body);
})
```

### Features

Once you've gotten a parsed DOM, you can search against it using the same methods
that you'd typically use in browser-side JavaScript.

- `getElementById`
- `getElementsByClassName`
- `getElementsByTagName`

There's also a small subset of XPath available through the `xpath` method on `HTMLElement`.
You can select elements in a DOM by providing some simple xpath commands:

- Element selection, direct child and full DOM.
- Predicates
    - Select node at index.
    - Only select text nodes.
    - Attribute equality.

More will be added as needs arise, but for now, this is all that's needed all uses of this package I've been informed of.


text:
#include "IdGeneratorTest.h"

#include <activemq/util/IdGenerator.h>

#include <decaf/lang/Thread.h>

using namespace activemq;
using namespace activemq::util;

using namespace decaf;
using namespace decaf::lang;

////////////////////////////////////////////////////////////////////////////////
namespace {

    class CreateIdThread : public Thread {
    public:

        bool failed;

        CreateIdThread() : failed( false ) {}

    public:

        virtual void run() {

            try{
                IdGenerator idGen;

                CPPUNIT_ASSERT( idGen.generateId() != "" );
                CPPUNIT_ASSERT( idGen.generateId() != "" );

                std::string id1 = idGen.generateId();
                std::string id2 = idGen.generateId();

                CPPUNIT_ASSERT( id1 != id2 );

                std::size_t idPos = id1.find("ID:");

                CPPUNIT_ASSERT( idPos == 0 );

                std::size_t firstColon = id1.find(':');
                std::size_t lastColon = id1.rfind(':');

                CPPUNIT_ASSERT( firstColon != lastColon );
                CPPUNIT_ASSERT( ( lastColon - firstColon ) > 1 );
            }
            catch(...) {
                failed = true;
            }
        }

    };

}

////////////////////////////////////////////////////////////////////////////////
IdGeneratorTest::IdGeneratorTest() {
}

////////////////////////////////////////////////////////////////////////////////
IdGeneratorTest::~IdGeneratorTest() {
}

////////////////////////////////////////////////////////////////////////////////
void IdGeneratorTest::testConstructor1() {

    IdGenerator idGen;

    CPPUNIT_ASSERT( idGen.generateId() != "" );
    CPPUNIT_ASSERT( idGen.generateId() != "" );
}

////////////////////////////////////////////////////////////////////////////////
void IdGeneratorTest::testConstructor2() {

    IdGenerator idGen( "TEST-PREFIX" );

    std::string id = idGen.generateId();
    std::size_t pos = id.find( "TEST-PREFIX" );

    CPPUNIT_ASSERT( pos != std::string::npos );
}

////////////////////////////////////////////////////////////////////////////////
void IdGeneratorTest::testCompare() {

    IdGenerator idGen;

    std::string id1 = idGen.generateId();
    std::string id2 = idGen.generateId();

    CPPUNIT_ASSERT( IdGenerator::compare( id1, id1 ) == 0 );
    CPPUNIT_ASSERT( IdGenerator::compare( id1, id2 ) < 0 );
    CPPUNIT_ASSERT( IdGenerator::compare( id2, id1 ) > 0 );
}

////////////////////////////////////////////////////////////////////////////////
void IdGeneratorTest::testThreadSafety() {

    bool failed = false;

    static const int COUNT = 50;

    std::vector<CreateIdThread*> threads;

    for( int i = 0; i < COUNT; i++ ) {
        threads.push_back( new CreateIdThread );
    }

    for( int i = 0; i < COUNT; i++ ) {
        threads[i]->start();
    }

    for( int i = 0; i < COUNT; i++ ) {
        threads[i]->join();
    }

    for( int i = 0; i < COUNT; i++ ) {
        if( !failed ) {
            threads[i]->failed ? failed = true : failed = false;
        }
        delete threads[i];
    }

    CPPUNIT_ASSERT_MESSAGE( "One of the Thread Tester failed", !failed );
}


text:
typedef VCG::Color Color;
typedef VCG::TextMode TextMode;
typedef VCG::Shape Shape;
typedef VCG::Algorithm Algorithm;

//////////////////////////////////////////////////////////////////////////////
//
//  Predefined colors
//
//////////////////////////////////////////////////////////////////////////////

VCG::Color  VCG::black          = VCG::Color("black"),
            VCG::blue           = VCG::Color("blue"),
            VCG::red            = VCG::Color("red"),
            VCG::green          = VCG::Color("green"),
            VCG::yellow         = VCG::Color("yellow"),
            VCG::magenta        = VCG::Color("magenta"),
            VCG::cyan           = VCG::Color("cyan"),
            VCG::white          = VCG::Color("white"),
            VCG::darkgrey       = VCG::Color("darkgrey"),
            VCG::darkblue       = VCG::Color("darkblue"),
            VCG::darkred        = VCG::Color("darkred"),
            VCG::darkgreen      = VCG::Color("darkgreen"),
            VCG::darkyellow     = VCG::Color("darkyellow"),
            VCG::darkmagneta    = VCG::Color("darkmagneta"),
            VCG::darkcyan       = VCG::Color("darkcyan"),
            VCG::gold           = VCG::Color("gold"),
            VCG::lightgrey      = VCG::Color("lightgrey"),
            VCG::lightblue      = VCG::Color("lightblue"),
            VCG::lightred       = VCG::Color("lightred"),
            VCG::lightgreen     = VCG::Color("lightgreen"),
            VCG::lightyellow    = VCG::Color("lightyellow"),
            VCG::lightmagenta   = VCG::Color("lightmagenta"),
            VCG::lightcyan      = VCG::Color("lightcyan"),
            VCG::lilac          = VCG::Color("lilac"),
            VCG::turquoise      = VCG::Color("turquoise"),
            VCG::aquamarine     = VCG::Color("aquamarine"),
            VCG::khaki          = VCG::Color("khaki"),
            VCG::purple         = VCG::Color("purple"),
            VCG::yellowgreen    = VCG::Color("yellowgreen"),
            VCG::pink           = VCG::Color("pink"),
            VCG::orange         = VCG::Color("orange"),
            VCG::orchid         = VCG::Color("orchid")
;

//////////////////////////////////////////////////////////////////////////////
//
//  Predefined textmodes
//
//////////////////////////////////////////////////////////////////////////////

VCG::TextMode
      VCG::center        = VCG::TextMode("center"),
      VCG::left_justify  = VCG::TextMode("left_justify"),
      VCG::right_justify = VCG::TextMode("right_justify")
;

//////////////////////////////////////////////////////////////////////////////
//
//  Predefined shapes
//
//////////////////////////////////////////////////////////////////////////////

VCG::Shape
      VCG::box      = VCG::Shape("box"),
      VCG::rhomb    = VCG::Shape("rhomb"),
      VCG::ellipse  = VCG::Shape("ellipse"),
      VCG::triangle = VCG::Shape("triangle")
;

//////////////////////////////////////////////////////////////////////////////
//
//  Predefined algorithms
//
//////////////////////////////////////////////////////////////////////////////

VCG::Algorithm  VCG::maxdepth = VCG::Algorithm("Algorithm  VCG::maxdepth"),
		VCG::mindepth = VCG::Algorithm("mindepth"),
		VCG::maxdepthslow = VCG::Algorithm("maxdepthslow"),
		VCG::mindepthslow = VCG::Algorithm("mindepthslow"),
		VCG::maxdegree = VCG::Algorithm("maxdegree"),
		VCG::mindegree = VCG::Algorithm("mindegree"),
		VCG::maxindegree = VCG::Algorithm("maxindegree"),
		VCG::minindegree = VCG::Algorithm("minindegree"),
	        VCG::maxoutdegree = VCG::Algorithm("maxoutdegree"),
		VCG::minoutdegree = VCG::Algorithm("minoutdegree"),
		VCG::minbackward = VCG::Algorithm("minbackward"),
		VCG::dfs = VCG::Algorithm("dfs"),
		VCG::tree = VCG::Algorithm("tree");

VCG::LineStyle VCG::continuous = VCG::LineStyle("continuous"),
	       VCG::dashed = VCG::LineStyle("dashed"),
	       VCG::dotted = VCG::LineStyle("dotted"),
	       VCG::invisible = VCG::LineStyle("invisible")
;

VCG::ArrowStyle VCG::solid = VCG::ArrowStyle("solid"),
		VCG::line = VCG::ArrowStyle("line"),
		VCG::none = VCG::ArrowStyle("none")
;

//////////////////////////////////////////////////////////////////////////////
//
//  Hashing and equality functions for nodes
//
//////////////////////////////////////////////////////////////////////////////

static int hash(VCG::Node x) { return (int)x; }
static Bool equal(VCG::Node x, VCG::Node y) { return x == y; }

#include <AD/hash/lhash.h>
//////////////////////////////////////////////////////////////////////////////
//
//  Internal representation of a node
//
//////////////////////////////////////////////////////////////////////////////

struct VCG_Node
{
  int        title;  // unique node title in VCG
  static int next_title;
  VCG::Node  a;
  Bool       visited;
  VarStack<VCG_Node *> children; // children of node
  VarStack<char *>     attribs;  // attributes of node

  VCG_Node() : a(0), visited(false) {}
  virtual ~VCG_Node() {}
  VCG_Node(VCG::Node n)
     :	title(++next_title),
	    a(n), visited(false),
       children(0), attribs(0) {}
  virtual Bool is_node()  const { return true; }
  virtual Bool is_graph() const { return false; }
  virtual Bool is_edge()  const { return false; }
  virtual PrettyOStream& print_GDL_on(PrettyOStream& f) const;
protected:
  virtual const char * kind() const
     { return children.size() > 0 ? "graph" : "node"; }
  PrettyOStream& print_header(PrettyOStream& f) const;
  PrettyOStream& print_footer(PrettyOStream& f) const;
  PrettyOStream& print_attrib(PrettyOStream& f) const;
  PrettyOStream& print_children(PrettyOStream& f) const;
};

int VCG_Node::next_title = 0;

//////////////////////////////////////////////////////////////////////////////
//
//  Internal representation of
//
//////////////////////////////////////////////////////////////////////////////
struct VCG_Graph : public VCG_Node
{
  VCG_Graph() {}
  VCG_Graph(VCG::Graph n) : VCG_Node(n) {}
  virtual Bool is_node()  const { return false; }
  virtual Bool is_graph() const { return true; }
  virtual Bool is_edge()  const { return false; }
  virtual const char * kind() const { return "graph"; }
  virtual PrettyOStream& print_GDL_on(PrettyOStream& f) const;
};

//////////////////////////////////////////////////////////////////////////////
//
//  Internal representation of an edge
//
//////////////////////////////////////////////////////////////////////////////
struct VCG_Edge : public VCG_Node
{
  VCG::Node b;
  VCG::EdgeType edge_type;
  VCG_Node * src, * dest;
  VCG_Edge() : b(0), src(0), dest(0) {}
  VCG_Edge(VCG::Node x,VCG::Node y, VCG::EdgeType e,
	    VCG_Node * s = 0, VCG_Node * d = 0)
     : VCG_Node(x), b(y), edge_type(e), src(s), dest(d) {}
  friend int hash(const VCG_Edge* a) { return ::hash(a->a) + ::hash(a->b) * 9; }
  friend Bool equal(const VCG_Edge* a, const VCG_Edge* b)
     { return a->a == b->a && a->b == b->b; }
  virtual const char * kind() const { return "edge"; }
  virtual Bool is_node()  const { return false; }
  virtual Bool is_graph() const { return false; }
  virtual Bool is_edge()  const { return true; }
  virtual PrettyOStream& print_GDL_on(PrettyOStream& f) const;
};

//////////////////////////////////////////////////////////////////////////////
//
//  Print GDL on a pretty printing stream
//
//////////////////////////////////////////////////////////////////////////////

PrettyOStream& VCG_Node::print_header(PrettyOStream& f) const
{
  f << tab << kind() << ':' << '{' << newline << indent
    << tab << "title: \"" << nospace << title << nospace << "\"" << newline;
  return f;
}

PrettyOStream& VCG_Node::print_footer(PrettyOStream& f) const
{
  return f << unindent << tab << '}' << newline;
}

PrettyOStream& VCG_Node::print_attrib(PrettyOStream& f) const
{
  foreach (i,attribs)
  {
    const char * text = attribs(i);
    f << tab << text << newline;
  }
  return f;
}

PrettyOStream& VCG_Node::print_children(PrettyOStream& f) const
{
  foreach (i,children) // print nodes
  {
    VCG_Node * node = children(i);
    if (!node->is_edge())
      node->print_GDL_on(f);
  }
  foreach (j,children) // print edges
  {
    VCG_Node * edge = children(j);
    if (edge->is_edge())
      edge->print_GDL_on(f);
  }
  return f;
}

PrettyOStream& VCG_Node::print_GDL_on(PrettyOStream& f) const
{
  print_header(f);
  print_attrib(f);
  print_footer(f);
  return f;
}

PrettyOStream& VCG_Graph::print_GDL_on(PrettyOStream& f) const
{
  print_header(f);
  print_attrib(f);
  print_children(f);
  print_footer(f);
  return f;
}

PrettyOStream& VCG_Edge::print_GDL_on(PrettyOStream& f) const
{
  f << tab;
  switch (edge_type)
  {
    case VCG::NORMAL_EDGE:    f << "edge"; break;
    case VCG::BACK_EDGE:      f << "backedge"; break;
    case VCG::NEAR_EDGE:      f << "nearedge"; break;
    case VCG::BENT_NEAR_EDGE: f << "bentnearedge"; break;
  }
  f << ':' << '{' << newline << indent;
  f << tab << "sourcename: \"" << nospace << src->title
    << nospace << "\"" << newline
    << tab << "targetname: \"" << nospace
    << dest->title << nospace << "\"" << newline;
  print_attrib(f);
  print_children(f);
  print_footer(f);
  return f;
}

//////////////////////////////////////////////////////////////////////////////
//
// Internal representation of VCG
//
//////////////////////////////////////////////////////////////////////////////

class VCG_Internal
{
  VCG_Internal(const VCG_Internal&);
  void operator = (const VCG_Internal&);
public:
  LHashTable<VCG::Node, VCG_Node *> object_table; // table of visited objects
  LHashTable<VCG_Edge *, VCG_Edge *> edge_table; // table of visited edges
  StringPool pool;    // string pool
  VarStack<VCG_Node *> obj_stack; // stack of unresolved objects
  VarStack<VCG_Node *> graph_stack; // stack of graphs
  VCG_Node * root_node;
  const char * default_prefix;

  VCG_Internal() : root_node(0), default_prefix(0) {}
 ~VCG_Internal() { cleanup(); }

  VCG_Node* create_node( VCG::Node n) // create new node
  {
    if (object_table.contains(n))
      return object_table[n];
    VCG_Node * node = new VCG_Node(n);
    object_table.insert(n,node);
    return node;
  }

  VCG_Node* create_graph( VCG::Graph G) // create new graph
  {
    if (object_table.contains(G))
      return object_table[G];
    VCG_Graph * graph = new VCG_Graph(G);
    object_table.insert(G,graph);
    return graph;
  }

  // create new edge
  VCG_Node* create_edge( VCG::Node a, VCG::Node b, VCG::EdgeType e)
  {
    VCG_Edge E(a,b,e);
    VCG_Node * src  = create_node(a);
    VCG_Node * dest = create_node(b);
    Ix i;
    if ((i = edge_table.lookup(&E)))
      return edge_table.value(i);
    VCG_Edge * edge = new VCG_Edge(a,b,e,src,dest);
    return edge;
  }

  void cleanup() // remove all nodes and edges created
  {
    foreach(i,object_table)
      { delete object_table.value(i); }
    foreach(j,edge_table)
      { delete edge_table.value(j); }
  }
};

//////////////////////////////////////////////////////////////////////////////
//
//  Constructor and destructor
//
//////////////////////////////////////////////////////////////////////////////

VCG::VCG() : impl(new VCG_Internal) {}
VCG::~VCG() { delete impl; }

//////////////////////////////////////////////////////////////////////////////
//
//  Methods to check whether a node or an edge has been visited.
//
//////////////////////////////////////////////////////////////////////////////

Bool VCG::visited(Node n) const
{
  Ix i = impl->object_table.lookup(n);
  if (i == 0) return false;
  return impl->object_table.value(i)->visited;
}
Bool VCG::visited(Node a, Node b) const
{
  VCG_Edge E(a,b,NORMAL_EDGE);
  return impl->edge_table.contains(&E);
}

//////////////////////////////////////////////////////////////////////////////
//
//  Error handling method
//
//////////////////////////////////////////////////////////////////////////////

VCG& VCG::error(const char * message,...)
{
  std::cerr << "VCG error: " << message << '\n';
  std::exit(1);
  return *this;
}

//////////////////////////////////////////////////////////////////////////////
//
//  Insert a new graph
//
//////////////////////////////////////////////////////////////////////////////

VCG& VCG::begin_graph(Graph G)
{
  VCG_Node * graph = impl->create_graph(G);
  if (impl->graph_stack.is_empty())
  {
    if (impl->root_node == 0)
      impl->root_node = graph;
  }
  else
  {
    VCG_Node * PG = impl->graph_stack.top();
    PG->children.push(graph);
  }
  impl->graph_stack.push(graph);
  impl->obj_stack.push(graph);
  graph->visited = true;
  return *this;
}

VCG& VCG::end_graph(Graph G)
{
  if (impl->obj_stack.is_empty())
    error("object stack is empty in VCG::end_graph");
  VCG_Node * obj = impl->obj_stack.pop();
  if (obj->is_edge())
    error("expecting VCG::end_graph");
  if (obj->a != G)
    error("mismatch graph in VCG::begin_graph and VCG::end_graph");

  impl->graph_stack.pop(); // pop graph
  return *this;
}

//////////////////////////////////////////////////////////////////////////////
//
//  Insert a new node
//
//////////////////////////////////////////////////////////////////////////////

VCG& VCG::begin_node(Node n)
{
  if (impl->graph_stack.is_empty())
    error("no graph has been defined in VCG::begin_node");
  VCG_Node * G = impl->graph_stack.top();
  VCG_Node * N = impl->create_node(n);
  N->visited = true;
  G->children.push(N);
  impl->obj_stack.push(N);
  return *this;
}

VCG& VCG::end_node(Node n)
{
  if (impl->obj_stack.is_empty())
    error("object stack is empty in VCG::end_node");
  VCG_Node * obj = impl->obj_stack.pop();
  if (! obj->is_node())
    error("expecting VCG::end_node");
  if (obj->a != n)
    error("mismatch node in VCG::begin_node and VCG::end_node");
  return *this;
}

VCG& VCG::node(Node n) { begin_node(n); end_node(n); return *this; }

//////////////////////////////////////////////////////////////////////////////
//
//  Insert a new edge
//
//////////////////////////////////////////////////////////////////////////////

VCG& VCG::begin_edge(Node a, Node b, EdgeType edgeType)
{
  if (impl->graph_stack.is_empty())
    error("no graph has been defined in VCG::begin_node");
  VCG_Node * G = impl->graph_stack.top();
  VCG_Node * e = impl->create_edge(a,b,edgeType);
  e->visited = true;
  G->children.push(e);
  impl->obj_stack.push(e);
  return *this;
}

VCG& VCG::begin_backedge(Node a, Node b) { return begin_edge(a,b,BACK_EDGE); }
VCG& VCG::begin_nearedge(Node a, Node b) { return begin_edge(a,b,NEAR_EDGE); }
VCG& VCG::begin_bentnearedge(Node a, Node b)
  { return begin_edge(a,b,BENT_NEAR_EDGE); }

VCG& VCG::end_edge(Node a, Node b)
{
  if (impl->obj_stack.is_empty())
    error("object stack is empty in VCG::end_edge");
  VCG_Node * obj = impl->obj_stack.pop();
  if (! obj->is_edge())
    error("expecting VCG::end_edge");
  VCG_Edge * edge = (VCG_Edge*)obj;
  if (edge->a != a || edge->b != b)
    error("mismatch edge in VCG::begin_edge and VCG::end_edge");
  return *this;
}

VCG& VCG::edge(Node a, Node b, EdgeType edgeType)
{
  begin_edge(a,b,edgeType);
  end_edge(a,b);
  return *this;
}

//////////////////////////////////////////////////////////////////////////////
//
//  Print graph as GDL new graph
//
//////////////////////////////////////////////////////////////////////////////

VCG& VCG::print_GDL_on(std::ostream& f)
{
  if (impl->root_node == 0)
    error("root node has not been defined in VCG::print_GDL_on");
  if (! impl->graph_stack.is_empty())
    error("graph stack is non-empty in VCG::print_GDL_on");
  if (! impl->obj_stack.is_empty())
    error("object stack is non-empty in VCG::print_GDL_on");
  PrettyOStream S(f);
  impl->root_node->print_GDL_on(S);
  return *this;
}

//////////////////////////////////////////////////////////////////////////////
//
//  Insert attributes
//
//////////////////////////////////////////////////////////////////////////////

VCG& VCG::begin_node_default() { impl->default_prefix = "node."; return *this; }
VCG& VCG::begin_edge_default() { impl->default_prefix = "edge."; return *this; }
VCG& VCG::end_default()        { impl->default_prefix = 0; return *this; }

VCG& VCG::attrib(VCG::String name, VCG::String attrib)
{
  if (impl->obj_stack.is_empty())
    error("object stack is empty in VCG::attrib");
  VCG_Node * obj = impl->obj_stack.top();
  char buffer[4096];
  buffer[0] = '\0';
  if (impl->default_prefix)
    std::strcpy(buffer,impl->default_prefix);
  std::strcat(buffer,name);
  std::strcat(buffer,": ");
  std::strcat(buffer,attrib);
  char * new_attr = impl->pool[buffer];
  obj->attribs.push(new_attr);
  return *this;
}

VCG& VCG::attrib_quoted(VCG::String name, VCG::String s)
{
  char buffer[4096];
  buffer[0] = '"';
  char * p = quote_string(buffer+1,s);
  p[0] = '"';
  p[1] = '\0';
  attrib(name,buffer);
  return *this;
}

VCG& VCG::attrib_int(VCG::String name, int i)
{
  char buffer[256];
  std::ostrstream S(buffer,sizeof(buffer));
  S << i << std::ends;
  attrib(name,S.str());
  return *this;
}

VCG& VCG::attrib_bool(VCG::String name, Bool b)
{
  return attrib(name,b ? "yes" : "no");
}

//////////////////////////////////////////////////////////////////////////////
//
//  Common attributes
//
//////////////////////////////////////////////////////////////////////////////

VCG& VCG::label(Label l)       { return attrib_quoted("label", l); }
VCG& VCG::label(int i)
{
  char buffer[256];
  std::ostrstream S(buffer,sizeof(buffer));
  S << i << std::ends;
  return label(S.str());
}

VCG& VCG::color(Color c)       { return attrib("color",String(c)); }
VCG& VCG::textcolor(Color c)   { return attrib("textcolor",String(c)); }
VCG& VCG::textmode(TextMode m) { return attrib("textmode",String(m)); }
VCG& VCG::shape(Shape s)       { return attrib("shape",String(s)); }
VCG& VCG::width(int i)         { return attrib_int("width",i); }
VCG& VCG::height(int i)        { return attrib_int("heigth",i); }
VCG& VCG::borderwidth(int i)   { return attrib_int("borderwidth",i); }
VCG& VCG::x(int i)             { return attrib_int("x", i); }
VCG& VCG::y(int i)             { return attrib_int("y", i); }
VCG& VCG::folding(int i)          { return attrib_int("folding", i); }
VCG& VCG::shrink(int i)           { return attrib_int("shrink", i); }
VCG& VCG::stretch(int i)          { return attrib_int("stretch", i); }
VCG& VCG::vertical_order(int i)   { return attrib_int("vertical_order",i); }
VCG& VCG::horizontal_order(int i) { return attrib_int("horizontal_order",i); }
VCG& VCG::xmax(int i)             { return attrib_int("xmax",i); }
VCG& VCG::ymax(int i)             { return attrib_int("ymax",i); }
VCG& VCG::xbase(int i)            { return attrib_int("xbase",i); }
VCG& VCG::ybase(int i)            { return attrib_int("ybase",i); }
VCG& VCG::xlspace(int i)          { return attrib_int("xlspace",i); }
VCG& VCG::xspace(int i)           { return attrib_int("xspace",i); }
VCG& VCG::yspace(int i)           { return attrib_int("yspace",i); }
VCG& VCG::xlraster(int i)         { return attrib_int("xlraster",i); }
VCG& VCG::ylraster(int i)         { return attrib_int("ylraster",i); }
VCG& VCG::hidden(int i)           { return attrib_int("hidden",i); }
VCG& VCG::classname(String s)     { return attrib_quoted("classname",s); }
VCG& VCG::infoname(String s)      { return attrib_quoted("infoname",s); }
VCG& VCG::layoutalgorithm(Algorithm a) { return attrib("layoutalgorithm",String(a)); }
VCG& VCG::layout_downfactor(int i)  { return attrib_int("layout_downfactor",i); }
VCG& VCG::layout_upfactor(int i)    { return attrib_int("layout_upfactor",i); }
VCG& VCG::layout_nearfactor(int i)  { return attrib_int("layout_nearfactor",i); }
VCG& VCG::layout_splinefactor(int i){ return attrib_int("layout_splinefactor",i); }

VCG& VCG::late_edge_labels(Bool i)
  { return attrib_bool("late_edge_labels",i); }
VCG& VCG::display_edge_labels(Bool i)
  { return attrib_bool("display_edge_labels",i); }
VCG& VCG::dirty_edge_labels(Bool i)
  { return attrib_bool("dirty_edge_labels",i); }
VCG& VCG::finetuning(Bool i)
  { return attrib_bool("finetuning",i); }

VCG& VCG::thickness(int i) { return attrib_int("thickness",i); }
VCG& VCG::linestyle(LineStyle s) { return attrib("linestyle",String(s)); }
VCG& VCG::arrowstyle(ArrowStyle s) { return attrib("arrowstyle",String(s)); }
VCG& VCG::backarrowstyle(ArrowStyle s)
  { return attrib("backarrowstyle",String(s)); }
VCG& VCG::arrowsize(int i) { return attrib_int("arrowsize",i); }
VCG& VCG::backarrowsize(int i) { return attrib_int("backarrowsize",i); }
VCG& VCG::arrowcolor(Color c) { return attrib("arrowcolor",String(c)); }
VCG& VCG::backarrowcolor(Color c)
   { return attrib("backarrowcolor",String(c)); }
VCG& VCG::priority(int i) { return attrib_int("priority",i); }
VCG& VCG::anchor(int i) { return attrib_int("anchor",i); }


text:
#ifndef NEARESTNEIGHBOR_PROTREE_H
#define NEARESTNEIGHBOR_PROTREE_H

#include "ProQuantization.hh"
/*! \file  ProTree.hh
 \brief implements a two-layer tree of product quantization
 */

#define NUM_DISTSEQ 65536
#define NUM_NEIGHBORS 3

#define NUM_ANISO_DIR 10
#define ANISO_BASE 1.2f

namespace pqt {

inline __host__      __device__ uint getCBIdx(uint _p, uint _c, uint _nClusters,
		uint _vl, uint _nClusters2) {
	return (_p * _nClusters + _c) * _vl * _nClusters2;

}

inline __device__ uint calcIdxSequential(volatile uint *_idx, uint _p,
		uint _nClusters, uint _nClusters2, uint _c1scale) {

	uint idx = _idx[0];

	for (int k = 1; k < _p; k++) {
		idx = (idx * _nClusters * _nClusters2) + _idx[k];
	}

	return idx;

}

/** \class ProTree ProTree.hh
 implements a two-layer tree of product quantization */

class ProTree: public ProQuantization {

public:

	/** default constructor */
	ProTree(uint _dim, uint _p, uint _p2, uint _groupParts);
	ProTree(uint _dim, uint _p, uint _p2);

	~ProTree();

	/** prepares a sequence that traverses the _p-dimensional integer spaces according to distance to the origin, i.e. for _p == 3
	 *
	 *   000
	 *
	 *   001
	 *   010
	 *   100
	 *
	 *   002
	 *   011
	 *   020
	 *   110
	 *   200
	 *
	 *   003
	 *   ...
	 */
	void prepareDistSequence(int _dim, int _groupParts);

	/* only prepares 2D sequence as above. Multiple sequences are preapared for different potential slopes */
	void prepare2DDistSequence(int _dim);

	uint locateInSequence(uint _bins);

	std::vector<std::pair<uint, uint> >& getDistSeq() {
		return d_distSeqH;
	}

	/** produces a two-layer product quantization tree with _k basis vectors on each layer */
	void createTree(uint _k, uint _k2, const float* _A, uint _N);

	/** produces a two-layer product quantization tree with _k basis vectors on each layer given the trainings data _A
	 * After the first layer is build, the algorithm detects the Layer-1 bins that are most dense (contain the most elements).
	 * The creation of the Layer-2 codebook is constructed based only on vectors that
	 *     falls into the sparser bins: _sparse == true
	 *     falls into the denser bins:  _sparse == false
	 */
	void createTreeSplitSparse(uint _nClusters1, uint _nClusters2,
			const float* _A, uint _N, float _percent, bool _sparse);

	/** extract segment _p from all vectors of _A that are assigned to cluster _c in segment _p) */
	uint groupVectorSegments(float* _seg, const float* _A, uint _N, uint _p,
			uint _c, uint* _assign);

	/** same as above just considering the vectors that are marked sparse:
	 * _sparseVec[i] == _sparse.
	 */
	uint groupVectorSegmentsSparse(float* _seg, const float* _A, uint _N,
			uint _p, uint _c, uint* _assign, const uint *_sparseVec,
			bool _sparse);

	/** finds all neighbor cells */

	/** takes all vectors an _A and sorts their index into the corresponding leaf */
	void buildDB(const float* _A, uint _N);

	/** sort all _N vectors of _A into each DB of the individual groups */
	void buildMultiDB(const float* _A, uint _N);

	void fakeDB(const float* _A, uint _N);

	/** does the assignment of the second level */
	void getAssignment2(uint *_assign2, const float* _A, const float* _B,
			uint _Arows, uint _Brows, const uint *_assign1,
			uint _nClusters1) const;

	/** outputs the best bins */
	void getKBestAssignment2(float *_assignVal, uint *_assignIdx,
			const float* _A, const float* _B, uint _Arows, uint _Brows,
			const uint *_assign1, uint _nClusters1, uint _k1) const;

	/** produces as list of finals bin sorted by proximity to the query vector.
	 * It assembles the list of potential bins by an n-dimensional Dijkstra.
	 * assignVal and assignIdx are assumed to be generated by getKBestAssignment2
	 * _k1 is the number of bins visited on the first layer, _k2 the number of  vectors intended to be visited
	 * _maxBins is the maximum number of bins to be visited
	 * The output is the bin ids as well as how many bins have been selected for each of the _N query vectors
	 */
	void getBins(uint *_bins, uint *_nBins, const float *_assignVal,
			const uint *_assignIdx, uint _N, uint _k1, uint _k2, uint _maxBins);

	void getMultiBins(uint *_bins, uint *_nBins, const float *_assignVal,
			const uint *_assignIdx, uint _N, uint _k1, uint _k2, uint _maxBins,
			uint _groupParts, uint _nDBs);

	/** looks up all vectors in the proximity bins, computes the distance to the query vectors, sorts them and outputs the first _k
	 *
	 */
	void getKBestVectors(float *_bestDist, uint *_bestIdx, const uint *_bins,
			const uint *_nBins, uint _maxBins, const float* _Q, uint _QN,
			uint _k);

	/* new multi-DB structure */
	void getMultiKBestVectors(float *_bestDist, uint *_bestIdx,
			const uint *_bins, const uint *_nBins, uint _maxBins,
			const float* _Q, uint _QN, uint _k);

	/** looks for some nearest neighbors */
	void testKNN(const float* _Q, uint _QN);

	void testMultiKNN(const float* _Q, uint _QN);

	void testLevel1(const float* _Q, uint _QN);

	/** some initial testing */
	void testSort();
	void testScan();

	void writeTreeToFile(const std::string& _name);
	void readTreeFromFile(const std::string& _name);

//    void writeDBToFile( const std::string& _name );
//    void readDBFromFile( const std::string& _name );

	uint getGroupParts() const {
		return d_groupParts;
	}

	uint getClusters2() const {
		return d_nClusters2;
	}

	uint getNClusters() const {
		return d_nClusters;
	}

	float* getCodebook1() const {
		return d_codeBook;
	}

protected:

	void countBins(uint* _bins, const uint* _assign, uint* _assign2, uint _N);

	void countMultiBins(uint* _bins, const uint* _assign, const uint* _assign2,
			uint _N, uint _groupParts, uint _nDBs);

	void scan(uint *_prefixSum, const uint *_ptr, uint _n, bool _inclusive);

	void sortIdx(uint* _dbIdx, const uint* _assign, const uint* _assign2,
			uint _N);

	void sortMultiIdx(uint* _dbIdx, const uint* _assign, const uint* _assign2,
			uint _N, uint _groupParts, uint _nDBs);

	/** computes and outputs a histogram of the counted bins */
	void histogram(uint _nBins) const;

	/** computes the Histogram for bins formed by the coarse level codebook.
	 * The bins are sorted by their occupancy.
	 * The bins containing the densest _percent samples are marked as false in _sparseBin.
	 */
	void calcL1Histogram(uint* _sparseBin, const uint* assignd, uint _N,
			float _percent);

	/** given the marked sparse bins, all vectors that are in the sparse / dense bins are marked
	 * _sparse == false - mark vectors in dense areas as true
	 * _sparse == true  - mark vectors in sparse areas as true
	 */
	void markSparseVectors(uint* _sparseVec, const uint* _sparseBin,
			const uint* assignd, uint _N, bool _sparse) const;

	uint d_nClusters2; // cluster center on the second level

	uint d_groupParts;  // number of parts creating one group
	uint d_nDBs; 		// number of resulting databases

	uint d_p2; // number of parts on second level (should be the same as d_p
	uint d_vl2;

	uint d_nBins;  // number of leafs in final tree

	// living the the GPU
	uint* d_count;
	float* d_codeBook2;

	uint d_NdbVec;   // number of total vectors in data base
	const float* d_dbVec; // pointer to the original vectors in the data base (will not be freed when calling the destructor)

	uint* d_binPrefix;
	uint* d_binCounts;
	uint* d_dbIdx;

	uint* d_distSeq; // array storing the traversal order for the k nearest clusters

	uint d_numDistSeq; // number of reasonable vectors in distance sequence
	uint d_distCluster; // number of clusters to be visited in each part

	uint* d_sparseBin; // array on device storing the indicator array for the first level bins

	std::vector<std::pair<uint, uint> > d_distSeqH;
}
;

} /* namespace */

#endif /* NEARESTNEIGHBOR_PROTREE_H */


text:
<?php

if (!defined('_PS_VERSION_'))
	exit;

class StatsVisits extends ModuleGraph
{
	private $_html = '';
	private $_query = '';
	private $_query2 = '';
	private $_option;

	function __construct()
	{
		$this->name = 'statsvisits';
		$this->tab = 'analytics_stats';
		$this->version = 1.0;
		$this->author = 'PrestaShop';
		$this->need_instance = 0;

		parent::__construct();

		$this->displayName = $this->l('Visits and Visitors');
		$this->description = $this->l('Display statistics about your visits and visitors.');
	}

	public function install()
	{
		return (parent::install() AND $this->registerHook('AdminStatsModules'));
	}

	public function getTotalVisits()
	{
		return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
		SELECT COUNT(c.`id_connections`)
		FROM `'._DB_PREFIX_.'connections` c
		WHERE c.`date_add` BETWEEN '.ModuleGraph::getDateBetween());
	}

	public function getTotalGuests()
	{
		return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
		SELECT COUNT(DISTINCT c.`id_guest`)
		FROM `'._DB_PREFIX_.'connections` c
		WHERE c.`date_add` BETWEEN '.ModuleGraph::getDateBetween());
	}

	public function hookAdminStatsModules($params)
	{
		$totalVisits = $this->getTotalVisits();
		$totalGuests = $this->getTotalGuests();
		if (Tools::getValue('export'))
			$this->csvExport(array('layers' =>2, 'type' => 'line', 'option' => 3));
		$this->_html = '
		<fieldset class="width3"><legend>name.'/logo.gif" /> '.$this->displayName.'</legend>

				'.$this->l('A visit corresponds to an internet user coming to your shop. Until the end of their session, only one visit is counted.').'
				'.$this->l('A visitor is an unknown person, who has not registered or logged on, surfing on your shop. A visitor can come and visit your shop many times.').'

'.$this->l('Total visits:').' '.$totalVisits.'

'.$this->l('Total visitors:').' '.$totalGuests.'

			'.($totalVisits ? ModuleGraph::engine(array('layers' => 2, 'type' => 'line', 'option' => 3)).'
'.$this->l('CSV Export').'
' : '').'

		</fieldset>

		<fieldset class="width3"><legend> '.$this->l('Guide').'</legend>

'.$this->l('Determine the interest of a visit').'

				'.$this->l('The visitors\' evolution graph strongly resembles the visits\' graph, but provides additional information:').'

'.$this->l('If this is the case, congratulations, your website is well planned and pleasing.').'

'.$this->l('Otherwise, the conclusion is not so simple. The problem can be aesthetic or ergonomic, or else the offer is not sufficient. It is also possible that these visitors mistakenly came here without particular interest for your shop; this phenomenon often happens with the search engines.').'

				'.$this->l('This information is mostly qualitative: you have to determine the interest of a disjointed visit.').'

		</fieldset>';

		return $this->_html;
	}

	public function setOption($option, $layers = 1)
	{
		switch ($option)
		{
			case 3:
				$this->_titles['main'][0] = $this->l('Number of visits and unique visitors');
				$this->_titles['main'][1] = $this->l('Visits');
				$this->_titles['main'][2] = $this->l('Visitors');
				$this->_query[0] = '
					SELECT date_add, COUNT(`date_add`) as total
					FROM `'._DB_PREFIX_.'connections`
					WHERE `date_add` BETWEEN ';
				$this->_query[1] = '
					SELECT date_add, COUNT(DISTINCT `id_guest`) as total
					FROM `'._DB_PREFIX_.'connections`
					WHERE `date_add` BETWEEN ';
				break;
		}
	}

	protected function getData($layers)
	{
		$this->setDateGraph($layers, true);
	}

	protected function setAllTimeValues($layers)
	{
		for ($i = 0; $i < $layers; $i++)
		{
			$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($this->_query[$i].$this->getDate().' GROUP BY LEFT(date_add, 4)');
			foreach ($result AS $row)
				$this->_values[$i][(int)(substr($row['date_add'], 0, 4))] = (int)($row['total']);
		}
	}

	protected function setYearValues($layers)
	{
		for ($i = 0; $i < $layers; $i++)
		{
			$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($this->_query[$i].$this->getDate().' GROUP BY LEFT(date_add, 7)');
			foreach ($result AS $row)
				$this->_values[$i][(int)(substr($row['date_add'], 5, 2))] = (int)($row['total']);
		}
	}

	protected function setMonthValues($layers)
	{
		for ($i = 0; $i < $layers; $i++)
		{
			$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($this->_query[$i].$this->getDate().' GROUP BY LEFT(date_add, 10)');
			foreach ($result AS $row)
				$this->_values[$i][(int)(substr($row['date_add'], 8, 2))] = (int)($row['total']);
		}
	}

	protected function setDayValues($layers)
	{
		for ($i = 0; $i < $layers; $i++)
		{
			$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($this->_query[$i].$this->getDate().' GROUP BY LEFT(date_add, 13)');
			foreach ($result AS $row)
				$this->_values[$i][(int)(substr($row['date_add'], 11, 2))] = (int)($row['total']);
		}
	}
}


text:
define(function(require) {

    'use strict';

    var DynamicGeometry = require('../DynamicGeometry');
    var glMatrix = require('../dep/glmatrix');
    var vec3 = glMatrix.vec3;
    var vec2 = glMatrix.vec2;
    var BoundingBox = require('../math/BoundingBox');

    /**
     * @constructor qtek.geometry.Sphere
     * @extends qtek.DynamicGeometry
     * @param {Object} [opt]
     * @param {number} [widthSegments]
     * @param {number} [heightSegments]
     * @param {number} [phiStart]
     * @param {number} [phiLength]
     * @param {number} [thetaStart]
     * @param {number} [thetaLength]
     * @param {number} [radius]
     */
    var Sphere = DynamicGeometry.derive(
    /** @lends qtek.geometry.Sphere# */
    {
        /**
         * @type {number}
         */
        widthSegments: 20,
        /**
         * @type {number}
         */
        heightSegments: 20,

        /**
         * @type {number}
         */
        phiStart: 0,
        /**
         * @type {number}
         */
        phiLength: Math.PI * 2,

        /**
         * @type {number}
         */
        thetaStart: 0,
        /**
         * @type {number}
         */
        thetaLength: Math.PI,

        /**
         * @type {number}
         */
        radius: 1

    }, function() {
        this.build();
    },
    /** @lends qtek.geometry.Sphere.prototype */
    {
        /**
         * Build sphere geometry
         */
        build: function() {
            var positions = this.attributes.position.value;
            var texcoords = this.attributes.texcoord0.value;
            var normals = this.attributes.normal.value;

            positions.length = 0;
            texcoords.length = 0;
            normals.length = 0;
            this.faces.length = 0;

            var x, y, z,
                u, v,
                i, j;
            var normal;

            var heightSegments = this.heightSegments;
            var widthSegments = this.widthSegments;
            var radius = this.radius;
            var phiStart = this.phiStart;
            var phiLength = this.phiLength;
            var thetaStart = this.thetaStart;
            var thetaLength = this.thetaLength;
            var radius = this.radius;

            for (j = 0; j <= heightSegments; j ++) {
                for (i = 0; i <= widthSegments; i ++) {
                    u = i / widthSegments;
                    v = j / heightSegments;

                    // X axis is inverted so texture can be mapped from left to right
                    x = -radius * Math.cos(phiStart + u * phiLength) * Math.sin(thetaStart + v * thetaLength);
                    y = radius * Math.cos(thetaStart + v * thetaLength);
                    z = radius * Math.sin(phiStart + u * phiLength) * Math.sin(thetaStart + v * thetaLength);

                    positions.push(vec3.fromValues(x, y, z));
                    texcoords.push(vec2.fromValues(u, v));

                    normal = vec3.fromValues(x, y, z);
                    vec3.normalize(normal, normal);
                    normals.push(normal);
                }
            }

            var i1, i2, i3, i4;
            var faces = this.faces;

            var len = widthSegments + 1;

            for (j = 0; j < heightSegments; j ++) {
                for (i = 0; i < widthSegments; i ++) {
                    i2 = j * len + i;
                    i1 = (j * len + i + 1);
                    i4 = (j + 1) * len + i + 1;
                    i3 = (j + 1) * len + i;

                    faces.push(vec3.fromValues(i1, i2, i4));
                    faces.push(vec3.fromValues(i2, i3, i4));
                }
            }

            this.boundingBox = new BoundingBox();
            this.boundingBox.max.set(radius, radius, radius);
            this.boundingBox.min.set(-radius, -radius, -radius);
        }
    });

    return Sphere;
});


text:
class Unit {
  constructor(entity, properties){
    this.entity = entity;
    this.properties = properties || {};
  }

  set(property, value){
    return this.properties[property] = value;
  }

  unset(property){
    return delete this.properties[property];
  }

  has(property){
    return Object.prototype.hasOwnProperty.call(this.properties, property); // Why won't a direct hasOwnProperty check work??
  }

  get(property){
    return this.properties[property];
  }

  toString(){
    return [this.constructor.name, '(', this.entity, ' ', JSON.stringify(this.properties), ')x'].join('');
  }
}