code
stringlengths
4
1.01M
language
stringclasses
2 values
jsonp({"cep":"13487064","logradouro":"Rua Jo\u00e3o Geraldello","bairro":"Jardim Manoel Francisco","cidade":"Limeira","uf":"SP","estado":"S\u00e3o Paulo"});
Java
jsonp({"cep":"07955020","logradouro":"Rua Cinquenta e Cinco","bairro":"Jardim Vassouras","cidade":"Francisco Morato","uf":"SP","estado":"S\u00e3o Paulo"});
Java
<!DOCTYPE html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="Expires" content="-1"> <meta http-equiv="Pragma" content="no-cache"> <meta http-equiv="Cache-Control" content="no-cache"> <title>105年第十四任總統副總統及第九屆立法委員選舉</title> <link href="../css/style.css" rel="stylesheet" type="text/css"> <link href="../css/style2.css" rel="stylesheet" type="text/css"> <script type="text/javascript" src="../js/ftiens4.js"></script> <script type="text/javascript" src="../js/ua.js"></script> <script type="text/javascript" src="../js/func.js"></script> <script type="text/javascript" src="../js/treeP1.js"></script> <script type="text/javascript" src="../js/refresh.js"></script> </head> <body id="main-body"> <div id="main-header"> <div id="main-top"> <a class="main-top-logo" href="#">中央選舉委員會</a> <ul class="main-top-list"> <li class="main-top-item"><a class="main-top-link main-top-link-home" href="../index.html">回首頁</a></li> <li class="main-top-item"><a class="main-top-link main-top-link-cec" href="http://2016.cec.gov.tw">中選會網站</a></li> <li class="main-top-item"><a class="main-top-link main-top-link-english" href="../../en/index.html">English</a></li> </ul> </div> </div> <div id="main-wrap"> <div id="main-banner"> <div class="slideshow"> <img src="../img/main_bg_1.jpg" width="1024" height="300" alt="background" title="background"> </div> <div class="main-deco"></div> <div class="main-title"></div> <a class="main-pvpe main-pvpe-current" href="../IDX/indexP1.html">總統副總統選舉</a> <a class="main-le" href="../IDX/indexT.html">立法委員選舉</a> </div> <div id="main-container"> <div id="main-content"> <table width="1024" border="1" cellpadding="0" cellspacing="0"> <tr> <td width="180" valign="top"> <div id="divMenu"> <table border="0"> <tr> <td><a style="text-decoration:none;color:silver" href="http://www.treemenu.net/" target=_blank></a></td> </tr> </table> <span class="TreeviewSpanArea"> <script>initializeDocument()</script> <noscript>請開啟Javascript功能</noscript> </span> </div> </td> <td width="796" valign="top"> <div id="divContent"> <!-- 修改區塊 --> <table width="100%" border="0" cellpadding="0" cellspacing="4"> <tr> <td><img src="../images/search.png" alt="候選人得票數" title="候選人得票數">&nbsp;<b>總統副總統選舉&nbsp;候選人在 嘉義市 西區得票數&nbsp;</b></td> </tr> <tr valign="bottom"> <td> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr valign="bottom"> <td class="fontNumber">&nbsp;<img src="../images/nav.gif" alt="候選組數" title="候選組數">&nbsp;<img src="../images/nav.gif" alt="候選組數" title="候選組數">&nbsp;候選組數:3&nbsp;&nbsp;<img src="../images/nav.gif" alt="應選組數" title="應選組數">&nbsp;<img src="../images/nav.gif" alt="應選組數" title="應選組數">&nbsp;應選組數:1</td> <td align="right"> <select name="selector_order" class="selectC" tabindex="1" id="orderBy" onChange="changeOrder();"> <option value="n">依號次排序</option> <option value="s">依得票排序</option> </select> </td> </tr> </table> </td> </tr> <tr valign="top"> <td> <table width="100%" border="0" cellpadding="6" cellspacing="1" class="tableT"> <tr class="trHeaderT"> <td>註記</td> <td>號次</td> <td><table><tr><td>總統</td><td rowspan=2> 候選人姓名</td></tr><td>副總統</td></table></td> <td>性別</td> <td>得票數</td> <td>得票率%</td> <td>登記方式</td> </tr> <tr class="trT"> <td>&nbsp;</td> <td>1</td> <td>朱立倫<br>王如玄</td> <td>男<br>女</td> <td class="tdAlignRight">8,667</td> <td class="tdAlignRight">25.9654</td> <td>中國國民黨&nbsp; 推薦</td> </tr> <tr class="trT"> <td>&nbsp;</td> <td>2</td> <td>蔡英文<br>陳建仁</td> <td>女<br>男</td> <td class="tdAlignRight">20,697</td> <td class="tdAlignRight">62.0061</td> <td>民主進步黨&nbsp; 推薦</td> </tr> <tr class="trT"> <td>&nbsp;</td> <td>3</td> <td>宋楚瑜<br>徐欣瑩</td> <td>男<br>女</td> <td class="tdAlignRight">4,015</td> <td class="tdAlignRight">12.0285</td> <td>親民黨&nbsp; 推薦</td> </tr> <tr class="trFooterT"> <td colspan="7" align="right">投開票所數 已送/應送:&nbsp;48/96&nbsp;</td> </tr> </table> </td> </tr> <tr valign="top"> <td> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="10"></td> <td valign="top" class="fontNote"> <table> <tr> <td>註記說明:</td> <td align="center">◎</td> <td>自然當選</td> </tr> <tr> <td></td> <td align="center">?</td> <td>同票待抽籤</td> </tr> </table> </td> <td valign="top" class="fontTimer"><img src="../images/clock2.png" alt="Sat, 16 Jan 2016 19:00:12 +0800" title="Sat, 16 Jan 2016 19:00:12 +0800">&nbsp;資料更新時間:&nbsp;01/16&nbsp;19:00:06&nbsp;<br>(網頁每3分鐘自動更新一次)</td> </tr> <tr> <td colspan="3" class="fontNote"></td> </tr> </table> </td> </tr> </table> <!-- 修改區塊 --> </div> </td> </tr> </table> </div> <div class="main-footer"></div> <div id="divFooter" align=center>[中央選舉委員會] </div> <!--main-content--> </div><!--main-container--> </div><!--END main-wrap--> <script>setOrder();</script> <script>setMenuScrollPosY();</script> </body> </html>
Java
<!DOCTYPE html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="Expires" content="-1"> <meta http-equiv="Pragma" content="no-cache"> <meta http-equiv="Cache-Control" content="no-cache"> <title>105年第十四任總統副總統及第九屆立法委員選舉</title> <link href="../css/style.css" rel="stylesheet" type="text/css"> <link href="../css/style2.css" rel="stylesheet" type="text/css"> <script type="text/javascript" src="../js/ftiens4.js"></script> <script type="text/javascript" src="../js/ua.js"></script> <script type="text/javascript" src="../js/func.js"></script> <script type="text/javascript" src="../js/treeP1.js"></script> <script type="text/javascript" src="../js/refresh.js"></script> </head> <body id="main-body"> <div id="main-header"> <div id="main-top"> <a class="main-top-logo" href="#">中央選舉委員會</a> <ul class="main-top-list"> <li class="main-top-item"><a class="main-top-link main-top-link-home" href="../index.html">回首頁</a></li> <li class="main-top-item"><a class="main-top-link main-top-link-cec" href="http://2016.cec.gov.tw">中選會網站</a></li> <li class="main-top-item"><a class="main-top-link main-top-link-english" href="../../en/index.html">English</a></li> </ul> </div> </div> <div id="main-wrap"> <div id="main-banner"> <div class="slideshow"> <img src="../img/main_bg_1.jpg" width="1024" height="300" alt="background" title="background"> </div> <div class="main-deco"></div> <div class="main-title"></div> <a class="main-pvpe main-pvpe-current" href="../IDX/indexP1.html">總統副總統選舉</a> <a class="main-le" href="../IDX/indexT.html">立法委員選舉</a> </div> <div id="main-container"> <div id="main-content"> <table width="1024" border="1" cellpadding="0" cellspacing="0"> <tr> <td width="180" valign="top"> <div id="divMenu"> <table border="0"> <tr> <td><a style="text-decoration:none;color:silver" href="http://www.treemenu.net/" target=_blank></a></td> </tr> </table> <span class="TreeviewSpanArea"> <script>initializeDocument()</script> <noscript>請開啟Javascript功能</noscript> </span> </div> </td> <td width="796" valign="top"> <div id="divContent"> <!-- 修改區塊 --> <table width="100%" border="0" cellpadding="0" cellspacing="4"> <tr> <td><img src="../images/search.png" alt="候選人得票數" title="候選人得票數">&nbsp;<b>總統副總統選舉&nbsp;候選人在 苗栗縣 銅鑼鄉得票數&nbsp;</b></td> </tr> <tr valign="bottom"> <td> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr valign="bottom"> <td class="fontNumber">&nbsp;<img src="../images/nav.gif" alt="候選組數" title="候選組數">&nbsp;<img src="../images/nav.gif" alt="候選組數" title="候選組數">&nbsp;候選組數:3&nbsp;&nbsp;<img src="../images/nav.gif" alt="應選組數" title="應選組數">&nbsp;<img src="../images/nav.gif" alt="應選組數" title="應選組數">&nbsp;應選組數:1</td> <td align="right"> <select name="selector_order" class="selectC" tabindex="1" id="orderBy" onChange="changeOrder();"> <option value="n">依號次排序</option> <option value="s">依得票排序</option> </select> </td> </tr> </table> </td> </tr> <tr valign="top"> <td> <table width="100%" border="0" cellpadding="6" cellspacing="1" class="tableT"> <tr class="trHeaderT"> <td>註記</td> <td>號次</td> <td><table><tr><td>總統</td><td rowspan=2> 候選人姓名</td></tr><td>副總統</td></table></td> <td>性別</td> <td>得票數</td> <td>得票率%</td> <td>登記方式</td> </tr> <tr class="trT"> <td>&nbsp;</td> <td>1</td> <td>朱立倫<br>王如玄</td> <td>男<br>女</td> <td class="tdAlignRight">4,407</td> <td class="tdAlignRight">45.4705</td> <td>中國國民黨&nbsp; 推薦</td> </tr> <tr class="trT"> <td>&nbsp;</td> <td>2</td> <td>蔡英文<br>陳建仁</td> <td>女<br>男</td> <td class="tdAlignRight">3,647</td> <td class="tdAlignRight">37.6290</td> <td>民主進步黨&nbsp; 推薦</td> </tr> <tr class="trT"> <td>&nbsp;</td> <td>3</td> <td>宋楚瑜<br>徐欣瑩</td> <td>男<br>女</td> <td class="tdAlignRight">1,638</td> <td class="tdAlignRight">16.9005</td> <td>親民黨&nbsp; 推薦</td> </tr> <tr class="trFooterT"> <td colspan="7" align="right">投開票所數 已送/應送:&nbsp;16/16&nbsp;</td> </tr> </table> </td> </tr> <tr valign="top"> <td> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="10"></td> <td valign="top" class="fontNote"> <table> <tr> <td>註記說明:</td> <td align="center">◎</td> <td>自然當選</td> </tr> <tr> <td></td> <td align="center">?</td> <td>同票待抽籤</td> </tr> </table> </td> <td valign="top" class="fontTimer"><img src="../images/clock2.png" alt="Sat, 16 Jan 2016 19:15:12 +0800" title="Sat, 16 Jan 2016 19:15:12 +0800">&nbsp;資料更新時間:&nbsp;01/16&nbsp;19:15:06&nbsp;<br>(網頁每3分鐘自動更新一次)</td> </tr> <tr> <td colspan="3" class="fontNote"></td> </tr> </table> </td> </tr> </table> <!-- 修改區塊 --> </div> </td> </tr> </table> </div> <div class="main-footer"></div> <div id="divFooter" align=center>[中央選舉委員會] </div> <!--main-content--> </div><!--main-container--> </div><!--END main-wrap--> <script>setOrder();</script> <script>setMenuScrollPosY();</script> </body> </html>
Java
<!DOCTYPE html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="Expires" content="-1"> <meta http-equiv="Pragma" content="no-cache"> <meta http-equiv="Cache-Control" content="no-cache"> <title>105年第十四任總統副總統及第九屆立法委員選舉</title> <link href="../css/style.css" rel="stylesheet" type="text/css"> <link href="../css/style2.css" rel="stylesheet" type="text/css"> <script type="text/javascript" src="../js/ftiens4.js"></script> <script type="text/javascript" src="../js/ua.js"></script> <script type="text/javascript" src="../js/func.js"></script> <script type="text/javascript" src="../js/treeT.js"></script> <script type="text/javascript" src="../js/refresh.js"></script> </head> <body id="main-body"> <div id="main-header"> <div id="main-top"> <a class="main-top-logo" href="#">中央選舉委員會</a> <ul class="main-top-list"> <li class="main-top-item"><a class="main-top-link main-top-link-home" href="../index.html">回首頁</a></li> <li class="main-top-item"><a class="main-top-link main-top-link-cec" href="http://2016.cec.gov.tw">中選會網站</a></li> <li class="main-top-item"><a class="main-top-link main-top-link-english" href="../../en/index.html">English</a></li> </ul> </div> </div> <div id="main-wrap"> <div id="main-banner"> <div class="slideshow"> <img src="../img/main_bg_2.jpg" width="1024" height="300" alt="background" title="background"> </div> <div class="main-deco"></div> <div class="main-title"></div> <a class="main-pvpe" href="../IDX/indexP1.html">總統副總統選舉</a> <a class="main-le main-le-current" href="../IDX/indexT.html">立法委員選舉</a> </div> <div id="main-container"> <div id="main-content"> <table width="1024" border="1" cellpadding="0" cellspacing="0"> <tr> <td width="180" valign="top"> <div id="divMenu"> <table border="0"> <tr> <td><a style="text-decoration:none;color:silver" href="http://www.treemenu.net/" target=_blank></a></td> </tr> </table> <span class="TreeviewSpanArea"> <script>initializeDocument()</script> <noscript>請開啟Javascript功能</noscript> </span> </div> </td> <td width="796" valign="top"> <div id="divContent"> <!-- 修改區塊 --> <table width="100%" border="0" cellpadding="0" cellspacing="4"> <tr> <td><img src="../images/search.png" alt="候選人得票數" title="候選人得票數">&nbsp;<b>區域立法委員選舉&nbsp;臺北市&nbsp;第6選舉區&nbsp;候選人得票數&nbsp;</b></td> </tr> <tr valign="bottom"> <td> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr valign="bottom"> <td class="fontNumber">&nbsp;<img src="../images/nav.gif" alt="候選人數" title="候選人數">&nbsp;<img src="../images/nav.gif" alt="候選人數" title="候選人數">&nbsp;候選人數:12&nbsp;&nbsp;<img src="../images/nav.gif" alt="應選人數" title="應選人數">&nbsp;<img src="../images/nav.gif" alt="應選人數" title="應選人數">&nbsp;應選人數:1&nbsp;&nbsp; <!--<img src="../images/nav.gif" alt="應有婦女當選名額" title="應有婦女當選名額">&nbsp; <img src="../images/nav.gif" alt="應有婦女當選名額" title="應有婦女當選名額">&nbsp;應有婦女當選名額:0--> </td> <td align="right"> <select name="selector_order" class="selectC" tabindex="1" id="orderBy" onChange="changeOrder();"> <option value="n">依號次排序</option> <option value="s">依得票排序</option> </select> </td> </tr> </table> </td> </tr> <tr valign="top"> <td> <table width="100%" border="0" cellpadding="6" cellspacing="1" class="tableT"> <tr class="trHeaderT"> <td>註記</td> <td>號次</td> <td>姓名</td> <td>性別</td> <td>得票數</td> <td>得票率%</td> <td>推薦之政黨</td> </tr> <tr class="trT"> <td>&nbsp;</td> <td>1</td> <td>陳家宏</td> <td>男</td> <td class="tdAlignRight">1,986</td> <td class="tdAlignRight">1.2369</td> <td>樹黨</td> </tr> <tr class="trT"> <td>&nbsp;</td> <td>2</td> <td>范雲</td> <td>女</td> <td class="tdAlignRight">56,766</td> <td class="tdAlignRight">35.3550</td> <td>綠黨社會民主黨聯盟</td> </tr> <tr class="trT"> <td>&nbsp;</td> <td>3</td> <td>龎維良</td> <td>男</td> <td class="tdAlignRight">2,963</td> <td class="tdAlignRight">1.8454</td> <td>無</td> </tr> <tr class="trT"> <td>&nbsp;</td> <td>4</td> <td>趙衍慶</td> <td>男</td> <td class="tdAlignRight">3,212</td> <td class="tdAlignRight">2.0005</td> <td>無</td> </tr> <tr class="trT"> <td>&nbsp;</td> <td>5</td> <td>林珍妤</td> <td>女</td> <td class="tdAlignRight">1,328</td> <td class="tdAlignRight">0.8271</td> <td>台灣獨立黨</td> </tr> <tr class="trT"> <td>&nbsp;</td> <td>6</td> <td>周芳如</td> <td>女</td> <td class="tdAlignRight">4,120</td> <td class="tdAlignRight">2.5660</td> <td>無</td> </tr> <tr class="trT"> <td>&nbsp;</td> <td>7</td> <td>蔣慰慈</td> <td>女</td> <td class="tdAlignRight">271</td> <td class="tdAlignRight">0.1688</td> <td>無</td> </tr> <tr class="trT"> <td>&nbsp;</td> <td>8</td> <td>鄭村棋</td> <td>男</td> <td class="tdAlignRight">4,927</td> <td class="tdAlignRight">3.0686</td> <td>人民民主陣線</td> </tr> <tr class="trT"> <td>&nbsp;</td> <td>9</td> <td>曾獻瑩</td> <td>男</td> <td class="tdAlignRight">4,826</td> <td class="tdAlignRight">3.0057</td> <td>信心希望聯盟</td> </tr> <tr class="trT"> <td>◎</td> <td>10</td> <td>蔣乃辛</td> <td>男</td> <td class="tdAlignRight">74,015</td> <td class="tdAlignRight">46.0980</td> <td>中國國民黨</td> </tr> <tr class="trT"> <td>&nbsp;</td> <td>11</td> <td>古文發</td> <td>男</td> <td class="tdAlignRight">184</td> <td class="tdAlignRight">0.1146</td> <td>大愛憲改聯盟</td> </tr> <tr class="trT"> <td>&nbsp;</td> <td>12</td> <td>吳旭智</td> <td>男</td> <td class="tdAlignRight">5,962</td> <td class="tdAlignRight">3.7133</td> <td>民國黨</td> </tr> <tr class="trFooterT"> <td colspan="7" align="right">投開票所數 已送/應送:&nbsp;188/188&nbsp;</td> </tr> </table> </td> </tr> <tr valign="top"> <td> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="10"></td> <td valign="top" class="fontNote"> <table> <tr> <td>註記說明:</td> <td align="center">◎</td> <td>當選註記</td> </tr> <tr> <td></td> <td align="center">?</td> <td>同票待抽籤</td> </tr> </table> </td> <td valign="top" class="fontTimer"><img src="../images/clock2.png" alt="Sat, 16 Jan 2016 22:54:10 +0800" title="Sat, 16 Jan 2016 22:54:10 +0800">&nbsp;資料更新時間:01/16&nbsp;22:54:06&nbsp;<br>(網頁每3分鐘自動更新一次)</td> </tr> <tr> <td colspan="3" class="fontNote"></td> </tr> </table> </td> </tr> </table> <!-- 修改區塊 --> </div> </td> </tr> </table> </div> <div class="main-footer"></div> <div id="divFooter">[中央選舉委員會] </div> <!--main-content--> </div><!--main-container--> </div><!--END main-wrap--> <script>setOrder();</script> <script>setMenuScrollPosY();</script> </body> </html>
Java
# Be sure to restart your server when you modify this file. Rails.application.config.session_store :cookie_store, key: '_lost-found_session'
Java
/****************************************************************************** * AUTHOR: Alexander Casal * FILE: game.cpp * DESCRIPTION: Demonstrate the use of the Strategy Design Pattern through * a very simple game which allows the user to select different * weapons. Each weapon has a different characteristic, changing * the way the player attacks. *****************************************************************************/ #include "game.h" #include "largesword.h" #include "smallsword.h" #include "bow.h" #include <memory> #include <limits> #include <iostream> /** * Constructor * * When we create the game we initialize playing to true so our game * loop runs. */ Game::Game() { playing = true; } /** * play * * Control the game loop allowing the player to select various * options. The function changeWeapon allows us to use the strategy * pattern to change which strategy we are using at runtime. */ void Game::play() { std::cout << "Welcome to the Strategy Pattern Game!\n"; showOptions(); while (playing) { switch (getOption()) { case 1: player.changeWeapon(std::make_unique<LargeSword>()); break; case 2: player.changeWeapon(std::make_unique<SmallSword>()); break; case 3: player.changeWeapon(std::make_unique<Bow>()); break; case 4: player.attack(); break; case 5: playing = false; break; } } } /** * getOption * * Prompt the user to enter an option and retrieve it. We do some simple * error checking to validate the user has entered a value between 1 and 5 * inclusive. */ int Game::getOption() { bool valid = false; int input = 0; do { std::cout << "> "; // Validate the user has entered valid data if (std::cin >> input) { valid = true; if (input <= 0 || input > 5) { std::cout << "Please enter an option between 1 and 5\n"; valid = false; } } else { std::cin.clear(); std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n'); std::cout << "Plese enter an option between 1 and 5\n"; } } while (!valid); return input; } /** * showOptions * * Display a list of possible options the user can input for their next * action. */ void Game::showOptions() { std::cout << "\nPlease type an option from the menu (ex: > 4)\n"; std::cout << "1.) Select large sword\n2.) Select small sword\n"; std::cout << "3.) Select bow\n4.) Attack\n5.) Quit\n"; }
Java
jsonp({"cep":"21515001","logradouro":"Avenida Brasil","bairro":"Barros Filho","cidade":"Rio de Janeiro","uf":"RJ","estado":"Rio de Janeiro"});
Java
jsonp({"cep":"88318435","logradouro":"Rua Vicente Policarpo de Borba Filho","bairro":"Campeche","cidade":"Itaja\u00ed","uf":"SC","estado":"Santa Catarina"});
Java
jsonp({"cep":"76913650","logradouro":"Rua J\u00falio Prestes","bairro":"S\u00e3o Pedro","cidade":"Ji-Paran\u00e1","uf":"RO","estado":"Rond\u00f4nia"});
Java
jsonp({"cep":"26021310","logradouro":"Rua Bicuiba","bairro":"Vila S\u00e3o Teodoro","cidade":"Nova Igua\u00e7u","uf":"RJ","estado":"Rio de Janeiro"});
Java
# 1874 Nickel ## Shield ### Type 2 - No Rays
Java
jsonp({"cep":"44004016","logradouro":"Travessa 28 de Fevereiro","bairro":"Ch\u00e1cara S\u00e3o Cosme","cidade":"Feira de Santana","uf":"BA","estado":"Bahia"});
Java
jsonp({"cep":"91787790","logradouro":"Rua Doutor Jos\u00e9 Sanfelice Neto","bairro":"Restinga","cidade":"Porto Alegre","uf":"RS","estado":"Rio Grande do Sul"});
Java
jsonp({"cep":"69092130","logradouro":"Avenida Madre Tereza","bairro":"Nova Cidade","cidade":"Manaus","uf":"AM","estado":"Amazonas"});
Java
jsonp({"cep":"38444322","logradouro":"Rua Dezesseis","bairro":"Santiago","cidade":"Araguari","uf":"MG","estado":"Minas Gerais"});
Java
jsonp({"cep":"27970650","logradouro":"Rua Dez","bairro":"S\u00e3o Jos\u00e9 do Barreto","cidade":"Maca\u00e9","uf":"RJ","estado":"Rio de Janeiro"});
Java
jsonp({"cep":"74445080","logradouro":"Pra\u00e7a Odarcino Dutra de Oliveira","bairro":"Vila Jo\u00e3o Vaz","cidade":"Goi\u00e2nia","uf":"GO","estado":"Goi\u00e1s"});
Java
jsonp({"cep":"99050270","logradouro":"Rua Giuseppe Marchi","bairro":"Petr\u00f3polis","cidade":"Passo Fundo","uf":"RS","estado":"Rio Grande do Sul"});
Java
jsonp({"cep":"40254380","logradouro":"2\u00aa Avenida Salustiano","bairro":"Cosme de Farias","cidade":"Salvador","uf":"BA","estado":"Bahia"});
Java
jsonp({"cep":"66065090","logradouro":"Passagem Ant\u00f4nio Monteiro","bairro":"Condor","cidade":"Bel\u00e9m","uf":"PA","estado":"Par\u00e1"});
Java
jsonp({"cep":"36774156","logradouro":"Rua Ana \u00c1vila Thome","bairro":"Thom\u00e9","cidade":"Cataguases","uf":"MG","estado":"Minas Gerais"});
Java
jsonp({"cep":"60330165","logradouro":"Rua Joaquim Machado da Ponte","bairro":"Barra do Cear\u00e1","cidade":"Fortaleza","uf":"CE","estado":"Cear\u00e1"});
Java
jsonp({"cep":"40050126","logradouro":"Vila Escada do Toror\u00f3","bairro":"Toror\u00f3","cidade":"Salvador","uf":"BA","estado":"Bahia"});
Java
jsonp({"cep":"89095970","logradouro":"Rua Josef Woerner","bairro":"Vila Itoupava","cidade":"Blumenau","uf":"SC","estado":"Santa Catarina"});
Java
jsonp({"cep":"06653460","logradouro":"Rua Dora","bairro":"Jardim Julieta","cidade":"Itapevi","uf":"SP","estado":"S\u00e3o Paulo"});
Java
jsonp({"cep":"07811130","logradouro":"Rua Ilha","bairro":"Jardim das Colinas","cidade":"Franco da Rocha","uf":"SP","estado":"S\u00e3o Paulo"});
Java
jsonp({"cep":"16027213","logradouro":"Rua Alice Raimundo Cini","bairro":"Ch\u00e1caras de Recreio Monteiro","cidade":"Ara\u00e7atuba","uf":"SP","estado":"S\u00e3o Paulo"});
Java
jsonp({"cep":"71615220","logradouro":"Quadra SHIS QI 7 Conjunto 2","bairro":"Setor de Habita\u00e7\u00f5es Individuais Sul","cidade":"Bras\u00edlia","uf":"DF","estado":"Distrito Federal"});
Java
jsonp({"cep":"82030262","logradouro":"Jardinete Professora P\u00f3rcia Guimar\u00e3es Alves","bairro":"Santa Felicidade","cidade":"Curitiba","uf":"PR","estado":"Paran\u00e1"});
Java
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.6"/> <title>My Project: File List</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="search/search.js"></script> <script type="text/javascript"> $(document).ready(function() { searchBox.OnSelectItem(0); }); </script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">My Project </div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.6 --> <script type="text/javascript"> var searchBox = new SearchBox("searchBox", "search",false,'Search'); </script> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main&#160;Page</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> <li> <div id="MSearchBox" class="MSearchBoxInactive"> <span class="left"> <img id="MSearchSelect" src="search/mag_sel.png" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" alt=""/> <input type="text" id="MSearchField" value="Search" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/> </span><span class="right"> <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a> </span> </div> </li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li class="current"><a href="files.html"><span>File&#160;List</span></a></li> <li><a href="globals.html"><span>File&#160;Members</span></a></li> </ul> </div> </div><!-- top --> <!-- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> <a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a></div> <!-- iframe showing the search results (closed by default) --> <div id="MSearchResultsWindow"> <iframe src="javascript:void(0)" frameborder="0" name="MSearchResults" id="MSearchResults"> </iframe> </div> <div class="header"> <div class="headertitle"> <div class="title">File List</div> </div> </div><!--header--> <div class="contents"> <div class="textblock">Here is a list of all documented files with brief descriptions:</div><div class="directory"> <table class="directory"> <tr id="row_0_" class="even"><td class="entry"><img src="ftv2node.png" alt="o" width="16" height="22" /><a href="face_8h_source.html"><img src="ftv2doc.png" alt="*" width="24" height="22" /></a><b>face.h</b></td><td class="desc"></td></tr> <tr id="row_1_"><td class="entry"><img src="ftv2node.png" alt="o" width="16" height="22" /><a href="light_8h_source.html"><img src="ftv2doc.png" alt="*" width="24" height="22" /></a><a class="el" href="light_8h.html" target="_self">light.h</a></td><td class="desc">A simple <a class="el" href="classLight.html">Light</a> class to facilitate light control in the scene </td></tr> <tr id="row_2_" class="even"><td class="entry"><img src="ftv2node.png" alt="o" width="16" height="22" /><img src="ftv2doc.png" alt="*" width="24" height="22" /><a class="el" href="main_8cpp.html" target="_self">main.cpp</a></td><td class="desc">Summer 2015 Assignment #2 </td></tr> <tr id="row_3_"><td class="entry"><img src="ftv2node.png" alt="o" width="16" height="22" /><a href="material_8h_source.html"><img src="ftv2doc.png" alt="*" width="24" height="22" /></a><b>material.h</b></td><td class="desc"></td></tr> <tr id="row_4_" class="even"><td class="entry"><img src="ftv2node.png" alt="o" width="16" height="22" /><a href="meshmodel_8h_source.html"><img src="ftv2doc.png" alt="*" width="24" height="22" /></a><a class="el" href="meshmodel_8h.html" target="_self">meshmodel.h</a></td><td class="desc">Base class for all mesh models for which we will read data from files </td></tr> <tr id="row_5_"><td class="entry"><img src="ftv2node.png" alt="o" width="16" height="22" /><a href="model_8h_source.html"><img src="ftv2doc.png" alt="*" width="24" height="22" /></a><a class="el" href="model_8h.html" target="_self">model.h</a></td><td class="desc">Base class for all models </td></tr> <tr id="row_6_" class="even"><td class="entry"><img src="ftv2node.png" alt="o" width="16" height="22" /><a href="normal_8h_source.html"><img src="ftv2doc.png" alt="*" width="24" height="22" /></a><b>normal.h</b></td><td class="desc"></td></tr> <tr id="row_7_"><td class="entry"><img src="ftv2node.png" alt="o" width="16" height="22" /><a href="object_8h_source.html"><img src="ftv2doc.png" alt="*" width="24" height="22" /></a><b>object.h</b></td><td class="desc"></td></tr> <tr id="row_8_" class="even"><td class="entry"><img src="ftv2node.png" alt="o" width="16" height="22" /><a href="objmodel_8h_source.html"><img src="ftv2doc.png" alt="*" width="24" height="22" /></a><a class="el" href="objmodel_8h.html" target="_self">objmodel.h</a></td><td class="desc">Class that handles models described in .obj files </td></tr> <tr id="row_9_"><td class="entry"><img src="ftv2node.png" alt="o" width="16" height="22" /><a href="teapot_8h_source.html"><img src="ftv2doc.png" alt="*" width="24" height="22" /></a><a class="el" href="teapot_8h.html" target="_self">teapot.h</a></td><td class="desc">Simple example of a subclass created from <a class="el" href="classModel.html">Model</a> class </td></tr> <tr id="row_10_" class="even"><td class="entry"><img src="ftv2node.png" alt="o" width="16" height="22" /><a href="turntable_8h_source.html"><img src="ftv2doc.png" alt="*" width="24" height="22" /></a><a class="el" href="turntable_8h.html" target="_self">turntable.h</a></td><td class="desc">A simple extention of <a class="el" href="classModel.html">Model</a> class to create a circular turntable on which the models will be placed </td></tr> <tr id="row_11_"><td class="entry"><img src="ftv2lastnode.png" alt="\" width="16" height="22" /><a href="vertex_8h_source.html"><img src="ftv2doc.png" alt="*" width="24" height="22" /></a><b>vertex.h</b></td><td class="desc"></td></tr> </table> </div><!-- directory --> </div><!-- contents --> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> Generated on Tue Jul 7 2015 22:51:36 for My Project by &#160;<a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.6 </small></address> </body> </html>
Java
jsonp({"cep":"72578240","logradouro":"Ch\u00e1cara Ch\u00e1caras 14","bairro":"N\u00facleo Rural Hortigranjeiro de Santa Maria","cidade":"Bras\u00edlia","uf":"DF","estado":"Distrito Federal"});
Java
<!DOCTYPE html> <div class="ngdialog-message ngdialog-sm" md-theme="modal"> <md-toolbar class="md-accent"> <div class="md-toolbar-tools"> <h3 class="modal-title" style="width: 100%; text-align: center;"> ACEPTAR TRANSFERENCIA </h3> </div> </md-toolbar> <md-content flex> <md-content class="md-padding" flex> <md-whiteframe class="md-whiteframe-24dp" style="min-height: 250px;" layout layout-align="center center"> <form style="text-align: center;"> <div flex class="md-padding"> <span style="font-size: medium;">¿Estas seguro de que quieres continuar?</span> </div> <div flex class="md-padding"> <button class="btn btn-md btn-success" style="width: 50px;" ng-click="confirmarAceptarTransferencia()">Si</button> <button class="btn btn-md btn-danger" style="width: 50px;" ng-click="closeThisDialog(0)">No</button> </div> </form> </md-whiteframe> </md-content> </md-content> </div>
Java
<!DOCTYPE html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="Expires" content="-1"> <meta http-equiv="Pragma" content="no-cache"> <meta http-equiv="Cache-Control" content="no-cache"> <title>105年第十四任總統副總統及第九屆立法委員選舉</title> <link href="../css/style.css" rel="stylesheet" type="text/css"> <link href="../css/style2.css" rel="stylesheet" type="text/css"> <script type="text/javascript" src="../js/ftiens4.js"></script> <script type="text/javascript" src="../js/ua.js"></script> <script type="text/javascript" src="../js/func.js"></script> <script type="text/javascript" src="../js/treeP1.js"></script> <script type="text/javascript" src="../js/refresh.js"></script> </head> <body id="main-body"> <div id="main-header"> <div id="main-top"> <a class="main-top-logo" href="#">中央選舉委員會</a> <ul class="main-top-list"> <li class="main-top-item"><a class="main-top-link main-top-link-home" href="../index.html">回首頁</a></li> <li class="main-top-item"><a class="main-top-link main-top-link-cec" href="http://2016.cec.gov.tw">中選會網站</a></li> <li class="main-top-item"><a class="main-top-link main-top-link-english" href="../../en/index.html">English</a></li> </ul> </div> </div> <div id="main-wrap"> <div id="main-banner"> <div class="slideshow"> <img src="../img/main_bg_1.jpg" width="1024" height="300" alt="background" title="background"> </div> <div class="main-deco"></div> <div class="main-title"></div> <a class="main-pvpe main-pvpe-current" href="../IDX/indexP1.html">總統副總統選舉</a> <a class="main-le" href="../IDX/indexT.html">立法委員選舉</a> </div> <div id="main-container"> <div id="main-content"> <table width="1024" border="1" cellpadding="0" cellspacing="0"> <tr> <td width="180" valign="top"> <div id="divMenu"> <table border="0"> <tr> <td><a style="text-decoration:none;color:silver" href="http://www.treemenu.net/" target=_blank></a></td> </tr> </table> <span class="TreeviewSpanArea"> <script>initializeDocument()</script> <noscript>請開啟Javascript功能</noscript> </span> </div> </td> <td width="796" valign="top"> <div id="divContent"> <!-- 修改區塊 --> <table width="100%" border="0" cellpadding="0" cellspacing="4"> <tr> <td><img src="../images/search.png" alt="候選人得票數" title="候選人得票數">&nbsp;<b>總統副總統選舉&nbsp;候選人在 嘉義縣 太保市得票數&nbsp;</b></td> </tr> <tr valign="bottom"> <td> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr valign="bottom"> <td class="fontNumber">&nbsp;<img src="../images/nav.gif" alt="候選組數" title="候選組數">&nbsp;<img src="../images/nav.gif" alt="候選組數" title="候選組數">&nbsp;候選組數:3&nbsp;&nbsp;<img src="../images/nav.gif" alt="應選組數" title="應選組數">&nbsp;<img src="../images/nav.gif" alt="應選組數" title="應選組數">&nbsp;應選組數:1</td> <td align="right"> <select name="selector_order" class="selectC" tabindex="1" id="orderBy" onChange="changeOrder();"> <option value="n">依號次排序</option> <option value="s">依得票排序</option> </select> </td> </tr> </table> </td> </tr> <tr valign="top"> <td> <table width="100%" border="0" cellpadding="6" cellspacing="1" class="tableT"> <tr class="trHeaderT"> <td>註記</td> <td>號次</td> <td><table><tr><td>總統</td><td rowspan=2> 候選人姓名</td></tr><td>副總統</td></table></td> <td>性別</td> <td>得票數</td> <td>得票率%</td> <td>登記方式</td> </tr> <tr class="trT"> <td>&nbsp;</td> <td>1</td> <td>朱立倫<br>王如玄</td> <td>男<br>女</td> <td class="tdAlignRight">3,726</td> <td class="tdAlignRight">22.7334</td> <td>中國國民黨&nbsp; 推薦</td> </tr> <tr class="trT"> <td>&nbsp;</td> <td>2</td> <td>蔡英文<br>陳建仁</td> <td>女<br>男</td> <td class="tdAlignRight">10,666</td> <td class="tdAlignRight">65.0763</td> <td>民主進步黨&nbsp; 推薦</td> </tr> <tr class="trT"> <td>&nbsp;</td> <td>3</td> <td>宋楚瑜<br>徐欣瑩</td> <td>男<br>女</td> <td class="tdAlignRight">1,998</td> <td class="tdAlignRight">12.1904</td> <td>親民黨&nbsp; 推薦</td> </tr> <tr class="trFooterT"> <td colspan="7" align="right">投開票所數 已送/應送:&nbsp;26/29&nbsp;</td> </tr> </table> </td> </tr> <tr valign="top"> <td> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="10"></td> <td valign="top" class="fontNote"> <table> <tr> <td>註記說明:</td> <td align="center">◎</td> <td>自然當選</td> </tr> <tr> <td></td> <td align="center">?</td> <td>同票待抽籤</td> </tr> </table> </td> <td valign="top" class="fontTimer"><img src="../images/clock2.png" alt="Sat, 16 Jan 2016 19:36:12 +0800" title="Sat, 16 Jan 2016 19:36:12 +0800">&nbsp;資料更新時間:&nbsp;01/16&nbsp;19:36:06&nbsp;<br>(網頁每3分鐘自動更新一次)</td> </tr> <tr> <td colspan="3" class="fontNote"></td> </tr> </table> </td> </tr> </table> <!-- 修改區塊 --> </div> </td> </tr> </table> </div> <div class="main-footer"></div> <div id="divFooter" align=center>[中央選舉委員會] </div> <!--main-content--> </div><!--main-container--> </div><!--END main-wrap--> <script>setOrder();</script> <script>setMenuScrollPosY();</script> </body> </html>
Java
jsonp({"cep":"08473580","logradouro":"Travessa Jos\u00e9 C\u00e2ndido de Andrade Murici","bairro":"Conjunto Habitacional Barro Branco II","cidade":"S\u00e3o Paulo","uf":"SP","estado":"S\u00e3o Paulo"});
Java
jsonp({"cep":"58400976","logradouro":"Rua Antenor Navarro","bairro":"Prata","cidade":"Campina Grande","uf":"PB","estado":"Para\u00edba"});
Java
jsonp({"cep":"66085110","logradouro":"Travessa Curuzu","bairro":"Pedreira","cidade":"Bel\u00e9m","uf":"PA","estado":"Par\u00e1"});
Java
jsonp({"cep":"41280610","logradouro":"Rua Ant\u00f4nio Carlista","bairro":"Marechal Rondon","cidade":"Salvador","uf":"BA","estado":"Bahia"});
Java
jsonp({"cep":"29167016","logradouro":"Rua Fortaleza","bairro":"Alterosas","cidade":"Serra","uf":"ES","estado":"Esp\u00edrito Santo"});
Java
jsonp({"cep":"65916480","logradouro":"Travessa Dois","bairro":"Parque do Buriti","cidade":"Imperatriz","uf":"MA","estado":"Maranh\u00e3o"});
Java
jsonp({"cep":"54767770","logradouro":"Rua Jos\u00e9 Clementino Melo","bairro":"Santa M\u00f4nica","cidade":"Camaragibe","uf":"PE","estado":"Pernambuco"});
Java
jsonp({"cep":"07113210","logradouro":"Rua Sargento J. Donz\u00edlio dos Santos","bairro":"Vila Edgar","cidade":"Guarulhos","uf":"SP","estado":"S\u00e3o Paulo"});
Java
// Joe Presbrey <presbrey@mit.edu> // 2007-07-15 // 2010-08-08 TimBL folded in Kenny's WEBDAV // 2010-12-07 TimBL addred local file write code const docpart = require('./uri').docpart const Fetcher = require('./fetcher') const graph = require('./data-factory').graph import IndexedFormula from './indexed-formula' const namedNode = require('./data-factory').namedNode const Namespace = require('./namespace') const Serializer = require('./serializer') const uriJoin = require('./uri').join const Util = require('./util') var UpdateManager = (function () { var sparql = function (store) { this.store = store if (store.updater) { throw new Error("You can't have two UpdateManagers for the same store") } if (!store.fetcher) { // The store must also/already have a fetcher new Fetcher(store) } store.updater = this this.ifps = {} this.fps = {} this.ns = {} this.ns.link = Namespace('http://www.w3.org/2007/ont/link#') this.ns.http = Namespace('http://www.w3.org/2007/ont/http#') this.ns.httph = Namespace('http://www.w3.org/2007/ont/httph#') this.ns.ldp = Namespace('http://www.w3.org/ns/ldp#') this.ns.rdf = Namespace('http://www.w3.org/1999/02/22-rdf-syntax-ns#') this.ns.rdfs = Namespace('http://www.w3.org/2000/01/rdf-schema#') this.ns.rdf = Namespace('http://www.w3.org/1999/02/22-rdf-syntax-ns#') this.ns.owl = Namespace('http://www.w3.org/2002/07/owl#') this.patchControl = [] // index of objects fro coordinating incomng and outgoing patches } sparql.prototype.patchControlFor = function (doc) { if (!this.patchControl[doc.uri]) { this.patchControl[doc.uri] = [] } return this.patchControl[doc.uri] } // Returns The method string SPARQL or DAV or LOCALFILE or false if known, undefined if not known. // // Files have to have a specific annotaton that they are machine written, for safety. // We don't actually check for write access on files. // sparql.prototype.editable = function (uri, kb) { if (!uri) { return false // Eg subject is bnode, no known doc to write to } if (!kb) { kb = this.store } if (uri.slice(0, 8) === 'file:///') { if (kb.holds( kb.sym(uri), namedNode('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'), namedNode('http://www.w3.org/2007/ont/link#MachineEditableDocument') )) { return 'LOCALFILE' } var sts = kb.statementsMatching(kb.sym(uri), undefined, undefined) console.log('sparql.editable: Not MachineEditableDocument file ' + uri + '\n') console.log(sts.map(function (x) { return x.toNT() }).join('\n')) return false // @@ Would be nifty of course to see whether we actually have write acess first. } var request var definitive = false var requests = kb.each(undefined, this.ns.link('requestedURI'), docpart(uri)) // Hack for the moment @@@@ 2016-02-12 if (kb.holds(namedNode(uri), this.ns.rdf('type'), this.ns.ldp('Resource'))) { return 'SPARQL' } var i var method for (var r = 0; r < requests.length; r++) { request = requests[r] if (request !== undefined) { var response = kb.any(request, this.ns.link('response')) if (request !== undefined) { var acceptPatch = kb.each(response, this.ns.httph('accept-patch')) if (acceptPatch.length) { for (i = 0; i < acceptPatch.length; i++) { method = acceptPatch[i].value.trim() if (method.indexOf('application/sparql-update') >= 0) return 'SPARQL' } } var author_via = kb.each(response, this.ns.httph('ms-author-via')) if (author_via.length) { for (i = 0; i < author_via.length; i++) { method = author_via[i].value.trim() if (method.indexOf('SPARQL') >= 0) { return 'SPARQL' } if (method.indexOf('DAV') >= 0) { return 'DAV' } } } var status = kb.each(response, this.ns.http('status')) if (status.length) { for (i = 0; i < status.length; i++) { if (status[i] === 200 || status[i] === 404) { definitive = true // return false // A definitive answer } } } } else { console.log('sparql.editable: No response for ' + uri + '\n') } } } if (requests.length === 0) { console.log('sparql.editable: No request for ' + uri + '\n') } else { if (definitive) { return false // We have got a request and it did NOT say editable => not editable } } console.log('sparql.editable: inconclusive for ' + uri + '\n') return undefined // We don't know (yet) as we haven't had a response (yet) } // ///////// The identification of bnodes sparql.prototype.anonymize = function (obj) { return (obj.toNT().substr(0, 2) === '_:' && this._mentioned(obj)) ? '?' + obj.toNT().substr(2) : obj.toNT() } sparql.prototype.anonymizeNT = function (stmt) { return this.anonymize(stmt.subject) + ' ' + this.anonymize(stmt.predicate) + ' ' + this.anonymize(stmt.object) + ' .' } // A list of all bnodes occuring in a statement sparql.prototype._statement_bnodes = function (st) { return [st.subject, st.predicate, st.object].filter(function (x) { return x.isBlank }) } // A list of all bnodes occuring in a list of statements sparql.prototype._statement_array_bnodes = function (sts) { var bnodes = [] for (var i = 0; i < sts.length; i++) { bnodes = bnodes.concat(this._statement_bnodes(sts[i])) } bnodes.sort() // in place sort - result may have duplicates var bnodes2 = [] for (var j = 0; j < bnodes.length; j++) { if (j === 0 || !bnodes[j].sameTerm(bnodes[j - 1])) { bnodes2.push(bnodes[j]) } } return bnodes2 } sparql.prototype._cache_ifps = function () { // Make a cached list of [Inverse-]Functional properties // Call this once before calling context_statements this.ifps = {} var a = this.store.each(undefined, this.ns.rdf('type'), this.ns.owl('InverseFunctionalProperty')) for (var i = 0; i < a.length; i++) { this.ifps[a[i].uri] = true } this.fps = {} a = this.store.each(undefined, this.ns.rdf('type'), this.ns.owl('FunctionalProperty')) for (i = 0; i < a.length; i++) { this.fps[a[i].uri] = true } } // Returns a context to bind a given node, up to a given depth sparql.prototype._bnode_context2 = function (x, source, depth) { // Return a list of statements which indirectly identify a node // Depth > 1 if try further indirection. // Return array of statements (possibly empty), or null if failure var sts = this.store.statementsMatching(undefined, undefined, x, source) // incoming links var y var res for (var i = 0; i < sts.length; i++) { if (this.fps[sts[i].predicate.uri]) { y = sts[i].subject if (!y.isBlank) { return [ sts[i] ] } if (depth) { res = this._bnode_context2(y, source, depth - 1) if (res) { return res.concat([ sts[i] ]) } } } } // outgoing links sts = this.store.statementsMatching(x, undefined, undefined, source) for (i = 0; i < sts.length; i++) { if (this.ifps[sts[i].predicate.uri]) { y = sts[i].object if (!y.isBlank) { return [ sts[i] ] } if (depth) { res = this._bnode_context2(y, source, depth - 1) if (res) { return res.concat([ sts[i] ]) } } } } return null // Failure } // Returns the smallest context to bind a given single bnode sparql.prototype._bnode_context_1 = function (x, source) { // Return a list of statements which indirectly identify a node // Breadth-first var self = this for (var depth = 0; depth < 3; depth++) { // Try simple first var con = this._bnode_context2(x, source, depth) if (con !== null) return con } // If we can't guarantee unique with logic just send all info about node return this.store.connectedStatements(x, source) // was: // throw new Error('Unable to uniquely identify bnode: ' + x.toNT()) } sparql.prototype._mentioned = function (x) { return (this.store.statementsMatching(x).length !== 0) || // Don't pin fresh bnodes (this.store.statementsMatching(undefined, x).length !== 0) || (this.store.statementsMatching(undefined, undefined, x).length !== 0) } sparql.prototype._bnode_context = function (bnodes, doc) { var context = [] if (bnodes.length) { this._cache_ifps() for (var i = 0; i < bnodes.length; i++) { // Does this occur in old graph? var bnode = bnodes[i] if (!this._mentioned(bnode)) continue context = context.concat(this._bnode_context_1(bnode, doc)) } } return context } /* Weird code does not make sense -- some code corruption along the line -- st undefined -- weird sparql.prototype._bnode_context = function(bnodes) { var context = [] if (bnodes.length) { if (this.store.statementsMatching(st.subject.isBlank?undefined:st.subject, st.predicate.isBlank?undefined:st.predicate, st.object.isBlank?undefined:st.object, st.why).length <= 1) { context = context.concat(st) } else { this._cache_ifps() for (x in bnodes) { context = context.concat(this._bnode_context_1(bnodes[x], st.why)) } } } return context } */ // Returns the best context for a single statement sparql.prototype._statement_context = function (st) { var bnodes = this._statement_bnodes(st) return this._bnode_context(bnodes, st.why) } sparql.prototype._context_where = function (context) { var sparql = this return (!context || context.length === 0) ? '' : 'WHERE { ' + context.map(function (x) { return sparql.anonymizeNT(x) }).join('\n') + ' }\n' } sparql.prototype._fire = function (uri, query, callback) { if (!uri) { throw new Error('No URI given for remote editing operation: ' + query) } console.log('sparql: sending update to <' + uri + '>') var xhr = Util.XMLHTTPFactory() xhr.options = {} xhr.onreadystatechange = function () { // dump("SPARQL update ready state for <"+uri+"> readyState="+xhr.readyState+"\n"+query+"\n") if (xhr.readyState === 4) { var success = (!xhr.status || (xhr.status >= 200 && xhr.status < 300)) if (!success) { console.log('sparql: update failed for <' + uri + '> status=' + xhr.status + ', ' + xhr.statusText + ', body length=' + xhr.responseText.length + '\n for query: ' + query) } else { console.log('sparql: update Ok for <' + uri + '>') } callback(uri, success, xhr.responseText, xhr) } } xhr.open('PATCH', uri, true) // async=true xhr.setRequestHeader('Content-type', 'application/sparql-update') xhr.send(query) } // This does NOT update the statement. // It returns an object whcih includes // function which can be used to change the object of the statement. // sparql.prototype.update_statement = function (statement) { if (statement && !statement.why) { return } var sparql = this var context = this._statement_context(statement) return { statement: statement ? [statement.subject, statement.predicate, statement.object, statement.why] : undefined, statementNT: statement ? this.anonymizeNT(statement) : undefined, where: sparql._context_where(context), set_object: function (obj, callback) { var query = this.where query += 'DELETE DATA { ' + this.statementNT + ' } ;\n' query += 'INSERT DATA { ' + this.anonymize(this.statement[0]) + ' ' + this.anonymize(this.statement[1]) + ' ' + this.anonymize(obj) + ' ' + ' . }\n' sparql._fire(this.statement[3].uri, query, callback) } } } sparql.prototype.insert_statement = function (st, callback) { var st0 = st instanceof Array ? st[0] : st var query = this._context_where(this._statement_context(st0)) if (st instanceof Array) { var stText = '' for (var i = 0; i < st.length; i++) stText += st[i] + '\n' query += 'INSERT DATA { ' + stText + ' }\n' } else { query += 'INSERT DATA { ' + this.anonymize(st.subject) + ' ' + this.anonymize(st.predicate) + ' ' + this.anonymize(st.object) + ' ' + ' . }\n' } this._fire(st0.why.uri, query, callback) } sparql.prototype.delete_statement = function (st, callback) { var st0 = st instanceof Array ? st[0] : st var query = this._context_where(this._statement_context(st0)) if (st instanceof Array) { var stText = '' for (var i = 0; i < st.length; i++) stText += st[i] + '\n' query += 'DELETE DATA { ' + stText + ' }\n' } else { query += 'DELETE DATA { ' + this.anonymize(st.subject) + ' ' + this.anonymize(st.predicate) + ' ' + this.anonymize(st.object) + ' ' + ' . }\n' } this._fire(st0.why.uri, query, callback) } // Request a now or future action to refresh changes coming downstream // // This is designed to allow the system to re-request the server version, // when a websocket has pinged to say there are changes. // If thewebsocket, by contrast, has sent a patch, then this may not be necessary. // This may be called out of context so *this* cannot be used. sparql.prototype.requestDownstreamAction = function (doc, action) { var control = this.patchControlFor(doc) if (!control.pendingUpstream) { action(doc) } else { if (control.downstreamAction) { if (control.downstreamAction === action) { return } else { throw new Error("Can't wait for > 1 differnt downstream actions") } } else { control.downstreamAction = action } } } // We want to start counting websockt notifications // to distinguish the ones from others from our own. sparql.prototype.clearUpstreamCount = function (doc) { var control = this.patchControlFor(doc) control.upstreamCount = 0 } sparql.prototype.getUpdatesVia = function (doc) { var linkHeaders = this.store.fetcher.getHeader(doc, 'updates-via') if (!linkHeaders || !linkHeaders.length) return null return linkHeaders[0].trim() } sparql.prototype.addDownstreamChangeListener = function (doc, listener) { var control = this.patchControlFor(doc) if (!control.downstreamChangeListeners) control.downstreamChangeListeners = [] control.downstreamChangeListeners.push(listener) var self = this this.setRefreshHandler(doc, function(doc){ // a function not a method self.reloadAndSync(doc) }) } sparql.prototype.reloadAndSync = function (doc) { var control = this.patchControlFor(doc) var updater = this if (control.reloading) { console.log(' Already reloading - stop') return // once only needed } control.reloading = true var retryTimeout = 1000 // ms var tryReload = function () { console.log('try reload - timeout = ' + retryTimeout) updater.reload(updater.store, doc, function (ok, message, xhr) { control.reloading = false if (ok) { if (control.downstreamChangeListeners) { for (var i = 0; i < control.downstreamChangeListeners.length; i++) { console.log(' Calling downstream listener ' + i) control.downstreamChangeListeners[i]() } } } else { if (xhr.status === 0) { console.log('Network error refreshing the data. Retrying in ' + retryTimeout / 1000) control.reloading = true retryTimeout = retryTimeout * 2 setTimeout(tryReload, retryTimeout) } else { console.log('Error ' + xhr.status + 'refreshing the data:' + message + '. Stopped' + doc) } } }) } tryReload() } // Set up websocket to listen on // // There is coordination between upstream changes and downstream ones // so that a reload is not done in the middle of an upsteeam patch. // If you usie this API then you get called when a change happens, and you // have to reload the file yourself, and then refresh the UI. // Alternative is addDownstreamChangeListener(), where you do not // have to do the reload yourslf. Do mot mix them. // // kb contains the HTTP metadata from prefvious operations // sparql.prototype.setRefreshHandler = function (doc, handler) { var wssURI = this.getUpdatesVia(doc) // relative // var kb = this.store var theHandler = handler var self = this var updater = this var retryTimeout = 1500 // *2 will be 3 Seconds, 6, 12, etc var retries = 0 if (!wssURI) { console.log('Server doies not support live updates thoughUpdates-Via :-(') return false } wssURI = uriJoin(wssURI, doc.uri) wssURI = wssURI.replace(/^http:/, 'ws:').replace(/^https:/, 'wss:') console.log('Web socket URI ' + wssURI) var openWebsocket = function () { // From https://github.com/solid/solid-spec#live-updates var socket if (typeof WebSocket !== 'undefined') { socket = new WebSocket(wssURI) } else if (typeof Services !== 'undefined') { // Firefox add on http://stackoverflow.com/questions/24244886/is-websocket-supported-in-firefox-for-android-addons socket = (Services.wm.getMostRecentWindow('navigator:browser').WebSocket)(wssURI) } else if (typeof window !== 'undefined' && window.WebSocket) { socket = window.WebSocket(wssURI) } else { console.log('Live update disabled, as WebSocket not supported by platform :-(') return } socket.onopen = function () { console.log(' websocket open') retryTimeout = 1500 // reset timeout to fast on success this.send('sub ' + doc.uri) if (retries) { console.log('Web socket has been down, better check for any news.') updater.requestDownstreamAction(doc, theHandler) } } var control = self.patchControlFor(doc) control.upstreamCount = 0 // https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent // // 1000 CLOSE_NORMAL Normal closure; the connection successfully completed whatever purpose for which it was created. // 1001 CLOSE_GOING_AWAY The endpoint is going away, either // because of a server failure or because the browser is navigating away from the page that opened the connection. // 1002 CLOSE_PROTOCOL_ERROR The endpoint is terminating the connection due to a protocol error. // 1003 CLOSE_UNSUPPORTED The connection is being terminated because the endpoint // received data of a type it cannot accept (for example, a text-only endpoint received binary data). // 1004 Reserved. A meaning might be defined in the future. // 1005 CLOSE_NO_STATUS Reserved. Indicates that no status code was provided even though one was expected. // 1006 CLOSE_ABNORMAL Reserved. Used to indicate that a connection was closed abnormally ( // // socket.onclose = function (event) { console.log('*** Websocket closed with code ' + event.code + ", reason '" + event.reason + "' clean = " + event.clean) retryTimeout *= 2 retries += 1 console.log('Retrying in ' + retryTimeout + 'ms') // (ask user?) setTimeout(function () { console.log('Trying websocket again') openWebsocket() }, retryTimeout) } socket.onmessage = function (msg) { if (msg.data && msg.data.slice(0, 3) === 'pub') { if ('upstreamCount' in control) { control.upstreamCount -= 1 if (control.upstreamCount >= 0) { console.log('just an echo: ' + control.upstreamCount) return // Just an echo } } console.log('Assume a real downstream change: ' + control.upstreamCount + ' -> 0') control.upstreamCount = 0 self.requestDownstreamAction(doc, theHandler) } } } // openWebsocket openWebsocket() return true } // This high-level function updates the local store iff the web is changed successfully. // // - deletions, insertions may be undefined or single statements or lists or formulae. // (may contain bnodes which can be indirectly identified by a where clause) // // - callback is called as callback(uri, success, errorbody, xhr) // sparql.prototype.update = function (deletions, insertions, callback) { try { var kb = this.store var ds = !deletions ? [] : deletions instanceof IndexedFormula ? deletions.statements : deletions instanceof Array ? deletions : [ deletions ] var is = !insertions ? [] : insertions instanceof IndexedFormula ? insertions.statements : insertions instanceof Array ? insertions : [ insertions ] if (!(ds instanceof Array)) { throw new Error('Type Error ' + (typeof ds) + ': ' + ds) } if (!(is instanceof Array)) { throw new Error('Type Error ' + (typeof is) + ': ' + is) } if (ds.length === 0 && is.length === 0) { return callback(null, true) // success -- nothing needed to be done. } var doc = ds.length ? ds[0].why : is[0].why var control = this.patchControlFor(doc) var startTime = Date.now() var props = ['subject', 'predicate', 'object', 'why'] var verbs = ['insert', 'delete'] var clauses = { 'delete': ds, 'insert': is } verbs.map(function (verb) { clauses[verb].map(function (st) { if (!doc.sameTerm(st.why)) { throw new Error('update: destination ' + doc + ' inconsistent with delete quad ' + st.why) } props.map(function (prop) { if (typeof st[prop] === 'undefined') { throw new Error('update: undefined ' + prop + ' of statement.') } }) }) }) var protocol = this.editable(doc.uri, kb) if (!protocol) { throw new Error("Can't make changes in uneditable " + doc) } var i var newSts var documentString var sz if (protocol.indexOf('SPARQL') >= 0) { var bnodes = [] if (ds.length) bnodes = this._statement_array_bnodes(ds) if (is.length) bnodes = bnodes.concat(this._statement_array_bnodes(is)) var context = this._bnode_context(bnodes, doc) var whereClause = this._context_where(context) var query = '' if (whereClause.length) { // Is there a WHERE clause? if (ds.length) { query += 'DELETE { ' for (i = 0; i < ds.length; i++) { query += this.anonymizeNT(ds[i]) + '\n' } query += ' }\n' } if (is.length) { query += 'INSERT { ' for (i = 0; i < is.length; i++) { query += this.anonymizeNT(is[i]) + '\n' } query += ' }\n' } query += whereClause } else { // no where clause if (ds.length) { query += 'DELETE DATA { ' for (i = 0; i < ds.length; i++) { query += this.anonymizeNT(ds[i]) + '\n' } query += ' } \n' } if (is.length) { if (ds.length) query += ' ; ' query += 'INSERT DATA { ' for (i = 0; i < is.length; i++) { query += this.anonymizeNT(is[i]) + '\n' } query += ' }\n' } } // Track pending upstream patches until they have fnished their callback control.pendingUpstream = control.pendingUpstream ? control.pendingUpstream + 1 : 1 if ('upstreamCount' in control) { control.upstreamCount += 1 // count changes we originated ourselves console.log('upstream count up to : ' + control.upstreamCount) } this._fire(doc.uri, query, function (uri, success, body, xhr) { xhr.elapsedTime_ms = Date.now() - startTime console.log(' sparql: Return ' + (success ? 'success' : 'FAILURE ' + xhr.status) + ' elapsed ' + xhr.elapsedTime_ms + 'ms') if (success) { try { kb.remove(ds) } catch (e) { success = false body = 'Remote Ok BUT error deleting ' + ds.length + ' from store!!! ' + e } // Add in any case -- help recover from weirdness?? for (var i = 0; i < is.length; i++) { kb.add(is[i].subject, is[i].predicate, is[i].object, doc) } } callback(uri, success, body, xhr) control.pendingUpstream -= 1 // When upstream patches have been sent, reload state if downstream waiting if (control.pendingUpstream === 0 && control.downstreamAction) { var downstreamAction = control.downstreamAction delete control.downstreamAction console.log('delayed downstream action:') downstreamAction(doc) } }) } else if (protocol.indexOf('DAV') >= 0) { // The code below is derived from Kenny's UpdateCenter.js documentString var request = kb.any(doc, this.ns.link('request')) if (!request) { throw new Error('No record of our HTTP GET request for document: ' + doc) } // should not happen var response = kb.any(request, this.ns.link('response')) if (!response) { return null // throw "No record HTTP GET response for document: "+doc } var content_type = kb.the(response, this.ns.httph('content-type')).value // prepare contents of revised document newSts = kb.statementsMatching(undefined, undefined, undefined, doc).slice() // copy! for (i = 0; i < ds.length; i++) { Util.RDFArrayRemove(newSts, ds[i]) } for (i = 0; i < is.length; i++) { newSts.push(is[i]) } // serialize to te appropriate format sz = Serializer(kb) sz.suggestNamespaces(kb.namespaces) sz.setBase(doc.uri) // ?? beware of this - kenny (why? tim) switch (content_type) { case 'application/rdf+xml': documentString = sz.statementsToXML(newSts) break case 'text/n3': case 'text/turtle': case 'application/x-turtle': // Legacy case 'application/n3': // Legacy documentString = sz.statementsToN3(newSts) break default: throw new Error('Content-type ' + content_type + ' not supported for data write') } // Write the new version back var candidateTarget = kb.the(response, this.ns.httph('content-location')) var targetURI if (candidateTarget) { targetURI = uriJoin(candidateTarget.value, targetURI) } var xhr = Util.XMLHTTPFactory() xhr.options = {} xhr.onreadystatechange = function () { if (xhr.readyState === 4) { // formula from sparqlUpdate.js, what about redirects? var success = (!xhr.status || (xhr.status >= 200 && xhr.status < 300)) if (success) { for (var i = 0; i < ds.length; i++) { kb.remove(ds[i]) } for (i = 0; i < is.length; i++) { kb.add(is[i].subject, is[i].predicate, is[i].object, doc) } } callback(doc.uri, success, xhr.responseText) } } xhr.open('PUT', targetURI, true) // assume the server does PUT content-negotiation. xhr.setRequestHeader('Content-type', content_type) // OK? xhr.send(documentString) } else { if (protocol.indexOf('LOCALFILE') >= 0) { try { console.log('Writing back to local file\n') // See http://simon-jung.blogspot.com/2007/10/firefox-extension-file-io.html // prepare contents of revised document newSts = kb.statementsMatching(undefined, undefined, undefined, doc).slice() // copy! for (i = 0; i < ds.length; i++) { Util.RDFArrayRemove(newSts, ds[i]) } for (i = 0; i < is.length; i++) { newSts.push(is[i]) } // serialize to the appropriate format documentString sz = Serializer(kb) sz.suggestNamespaces(kb.namespaces) sz.setBase(doc.uri) // ?? beware of this - kenny (why? tim) var dot = doc.uri.lastIndexOf('.') if (dot < 1) { throw new Error('Rewriting file: No filename extension: ' + doc.uri) } var ext = doc.uri.slice(dot + 1) switch (ext) { case 'rdf': case 'owl': // Just my experence ...@@ we should keep the format in which it was parsed case 'xml': documentString = sz.statementsToXML(newSts) break case 'n3': case 'nt': case 'ttl': documentString = sz.statementsToN3(newSts) break default: throw new Error('File extension .' + ext + ' not supported for data write') } // Write the new version back // create component for file writing console.log('Writing back: <<<' + documentString + '>>>') var filename = doc.uri.slice(7) // chop off file:// leaving /path // console.log("Writeback: Filename: "+filename+"\n") var file = Components.classes['@mozilla.org/file/local;1'] .createInstance(Components.interfaces.nsILocalFile) file.initWithPath(filename) if (!file.exists()) { throw new Error('Rewriting file <' + doc.uri + '> but it does not exist!') } // { // file.create( Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 420) // } // create file output stream and use write/create/truncate mode // 0x02 writing, 0x08 create file, 0x20 truncate length if exist var stream = Components.classes['@mozilla.org/network/file-output-stream;1'] .createInstance(Components.interfaces.nsIFileOutputStream) // Various JS systems object to 0666 in struct mode as dangerous stream.init(file, 0x02 | 0x08 | 0x20, parseInt('0666', 8), 0) // write data to file then close output stream stream.write(documentString, documentString.length) stream.close() for (i = 0; i < ds.length; i++) { kb.remove(ds[i]) } for (i = 0; i < is.length; i++) { kb.add(is[i].subject, is[i].predicate, is[i].object, doc) } callback(doc.uri, true, '') // success! } catch (e) { callback(doc.uri, false, 'Exception trying to write back file <' + doc.uri + '>\n' // + tabulator.Util.stackString(e)) ) } } else { throw new Error("Unhandled edit method: '" + protocol + "' for " + doc) } } } catch (e) { callback(undefined, false, 'Exception in update: ' + e + '\n' + $rdf.Util.stackString(e)) } } // wnd update // This suitable for an inital creation of a document // // data: string, or array of statements // sparql.prototype.put = function (doc, data, content_type, callback) { var documentString var kb = this.store if (typeof data === typeof '') { documentString = data } else { // serialize to te appropriate format var sz = Serializer(kb) sz.suggestNamespaces(kb.namespaces) sz.setBase(doc.uri) switch (content_type) { case 'application/rdf+xml': documentString = sz.statementsToXML(data) break case 'text/n3': case 'text/turtle': case 'application/x-turtle': // Legacy case 'application/n3': // Legacy documentString = sz.statementsToN3(data) break default: throw new Error('Content-type ' + content_type + ' not supported for data PUT') } } var xhr = Util.XMLHTTPFactory() xhr.options = {} xhr.onreadystatechange = function () { if (xhr.readyState === 4) { // formula from sparqlUpdate.js, what about redirects? var success = (!xhr.status || (xhr.status >= 200 && xhr.status < 300)) if (success && typeof data !== 'string') { data.map(function (st) { kb.addStatement(st) }) // kb.fetcher.requested[doc.uri] = true // as though fetched } if (success) { delete kb.fetcher.nonexistant[doc.uri] delete kb.fetcher.requested[doc.uri] // @@ later we can fake it has been requestd if put gives us the header sand we save them. } callback(doc.uri, success, xhr.responseText, xhr) } } xhr.open('PUT', doc.uri, true) xhr.setRequestHeader('Content-type', content_type) xhr.send(documentString) } // Reload a document. // // Fast and cheap, no metaata // Measure times for the document // Load it provisionally // Don't delete the statemenst before the load, or it will leave a broken document // in the meantime. sparql.prototype.reload = function (kb, doc, callback) { var startTime = Date.now() // force sets no-cache and kb.fetcher.nowOrWhenFetched(doc.uri, {force: true, noMeta: true, clearPreviousData: true}, function (ok, body, xhr) { if (!ok) { console.log(' ERROR reloading data: ' + body) callback(false, 'Error reloading data: ' + body, xhr) } else if (xhr.onErrorWasCalled || xhr.status !== 200) { console.log(' Non-HTTP error reloading data! onErrorWasCalled=' + xhr.onErrorWasCalled + ' status: ' + xhr.status) callback(false, 'Non-HTTP error reloading data: ' + body, xhr) } else { var elapsedTime_ms = Date.now() - startTime if (!doc.reloadTime_total) doc.reloadTime_total = 0 if (!doc.reloadTime_count) doc.reloadTime_count = 0 doc.reloadTime_total += elapsedTime_ms doc.reloadTime_count += 1 console.log(' Fetch took ' + elapsedTime_ms + 'ms, av. of ' + doc.reloadTime_count + ' = ' + (doc.reloadTime_total / doc.reloadTime_count) + 'ms.') callback(true) } }) } sparql.prototype.oldReload = function (kb, doc, callback) { var g2 = graph() // A separate store to hold the data as we load it var f2 = fetcher(g2) var startTime = Date.now() // force sets no-cache and f2.nowOrWhenFetched(doc.uri, {force: true, noMeta: true, clearPreviousData: true}, function (ok, body, xhr) { if (!ok) { console.log(' ERROR reloading data: ' + body) callback(false, 'Error reloading data: ' + body, xhr) } else if (xhr.onErrorWasCalled || xhr.status !== 200) { console.log(' Non-HTTP error reloading data! onErrorWasCalled=' + xhr.onErrorWasCalled + ' status: ' + xhr.status) callback(false, 'Non-HTTP error reloading data: ' + body, xhr) } else { var sts1 = kb.statementsMatching(undefined, undefined, undefined, doc).slice() // Take a copy!! var sts2 = g2.statementsMatching(undefined, undefined, undefined, doc).slice() console.log(' replacing ' + sts1.length + ' with ' + sts2.length + ' out of total statements ' + kb.statements.length) kb.remove(sts1) kb.add(sts2) var elapsedTime_ms = Date.now() - startTime if (sts2.length === 0) { console.log('????????????????? 0000000') } if (!doc.reloadTime_total) doc.reloadTime_total = 0 if (!doc.reloadTime_count) doc.reloadTime_count = 0 doc.reloadTime_total += elapsedTime_ms doc.reloadTime_count += 1 console.log(' fetch took ' + elapsedTime_ms + 'ms, av. of ' + doc.reloadTime_count + ' = ' + (doc.reloadTime_total / doc.reloadTime_count) + 'ms.') callback(true) } }) } return sparql })() module.exports = UpdateManager
Java
package tb.common.block; import tb.common.item.ItemNodeFoci; import tb.common.tile.TileNodeManipulator; import tb.init.TBItems; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; public class BlockNodeManipulator extends BlockContainer{ public BlockNodeManipulator() { super(Material.rock); } @Override public TileEntity createNewTileEntity(World w, int meta) { return new TileNodeManipulator(); } public boolean isOpaqueCube() { return false; } public boolean renderAsNormalBlock() { return false; } public int getRenderType() { return 0x421922; } public boolean onBlockActivated(World w, int x, int y, int z, EntityPlayer p, int side, float vecX, float vecY, float vecZ) { if(p.getCurrentEquippedItem() != null) { ItemStack current = p.getCurrentEquippedItem(); if(current.getItem() instanceof ItemNodeFoci) { if(w.getBlockMetadata(x, y, z) != 0) { int meta = w.getBlockMetadata(x, y, z); ItemStack stk = new ItemStack(TBItems.nodeFoci,1,meta-1); EntityItem itm = new EntityItem(w,x+0.5D,y,z+0.5D,stk); if(!w.isRemote) w.spawnEntityInWorld(itm); } w.setBlockMetadataWithNotify(x, y, z, current.getItemDamage()+1, 3); p.destroyCurrentEquippedItem(); return true; } }else { if(w.getBlockMetadata(x, y, z) != 0) { int meta = w.getBlockMetadata(x, y, z); ItemStack stk = new ItemStack(TBItems.nodeFoci,1,meta-1); EntityItem itm = new EntityItem(w,x+0.5D,y,z+0.5D,stk); if(!w.isRemote) w.spawnEntityInWorld(itm); } w.setBlockMetadataWithNotify(x, y, z, 0, 3); } return true; } @Override public void breakBlock(World w, int x, int y, int z, Block b, int meta) { if(meta > 0) //Fix for the manipulator not dropping the foci. { ItemStack foci = new ItemStack(TBItems.nodeFoci,1,meta-1); EntityItem itm = new EntityItem(w,x+0.5D,y+0.5D,z+0.5D,foci); if(!w.isRemote) w.spawnEntityInWorld(itm); } super.breakBlock(w, x, y, z, b, meta); } }
Java
jsonp({"cep":"12510524","logradouro":"Rua Otto Schellenberg","bairro":"Jardim Fran\u00e7a I","cidade":"Guaratinguet\u00e1","uf":"SP","estado":"S\u00e3o Paulo"});
Java
jsonp({"cep":"29146576","logradouro":"Rua Benedito Ces\u00e1rio","bairro":"Campo Grande","cidade":"Cariacica","uf":"ES","estado":"Esp\u00edrito Santo"});
Java
<!DOCTYPE html> <!--[if IE 7]> <html class="ie ie7" lang="en-US"> <![endif]--> <!--[if IE 8]> <html class="ie ie8" lang="en-US"> <![endif]--> <!--[if !(IE 7) | !(IE 8) ]><!--> <html lang="en-US"> <!--<![endif]--> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width"> <title>09 | January | 2009 | mind the explanatory gap</title> <link rel="profile" href="http://gmpg.org/xfn/11"> <!--[if lt IE 9]> <script src="http://explanatorygap.net/wp-content/themes/twentythirteen/js/html5.js"></script> <![endif]--> <link rel="alternate" type="application/rss+xml" title="mind the explanatory gap &raquo; Feed" href="http://explanatorygap.net/wp-content/plugins/really-static/static/feed/" /> <link rel='stylesheet' id='wpcf-css' href='http://explanatorygap.net/wp-content/plugins/wp-contact-form/wpcf.css?ver=20110218' type='text/css' media='all' /> <link rel='stylesheet' id='twentythirteen-fonts-css' href='//fonts.googleapis.com/css?family=Source+Sans+Pro%3A300%2C400%2C700%2C300italic%2C400italic%2C700italic%7CBitter%3A400%2C700&#038;subset=latin%2Clatin-ext' type='text/css' media='all' /> <link rel='stylesheet' id='genericons-css' href='http://explanatorygap.net/wp-content/themes/twentythirteen/fonts/genericons.css?ver=2.09' type='text/css' media='all' /> <link rel='stylesheet' id='twentythirteen-style-css' href='http://explanatorygap.net/wp-content/themes/twentythirteen/style.css?ver=2013-07-18' type='text/css' media='all' /> <!--[if lt IE 9]> <link rel='stylesheet' id='twentythirteen-ie-css' href='http://explanatorygap.net/wp-content/themes/twentythirteen/css/ie.css?ver=2013-07-18' type='text/css' media='all' /> <![endif]--> <script type='text/javascript' src='http://explanatorygap.net/wp-includes/js/jquery/jquery.js?ver=1.11.0'></script> <script type='text/javascript' src='http://explanatorygap.net/wp-includes/js/jquery/jquery-migrate.min.js?ver=1.2.1'></script> <script type='text/javascript' src='http://explanatorygap.net/wp-content/plugins/google-analyticator/external-tracking.min.js?ver=6.4.7.3'></script> <meta name="generator" content="WordPress 3.9.1 - really-static 0.5" /> <link rel="stylesheet" href="http://explanatorygap.net/wp-content/plugins/source-code-syntax-highlighting-plugin-for-wordpress/geshi.css" type="text/css" /> <style type="text/css" id="twentythirteen-header-css"> .site-header { background: url(http://explanatorygap.net/wp-content/themes/twentythirteen/images/headers/star.png) no-repeat scroll top; background-size: 1600px auto; } </style> <!-- Google Analytics Tracking by Google Analyticator 6.4.7.3: http://www.videousermanuals.com/google-analyticator/ --> <script type="text/javascript"> var analyticsFileTypes = ['']; var analyticsSnippet = 'enabled'; var analyticsEventTracking = 'enabled'; </script> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-719433-1']); _gaq.push(['_addDevId', 'i9k95']); // Google Analyticator App ID with Google _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> </head> <body class="archive date single-author"> <div id="page" class="hfeed site"> <header id="masthead" class="site-header" role="banner"> <a class="home-link" href="http://explanatorygap.net/wp-content/plugins/really-static/static/" title="mind the explanatory gap" rel="home"> <h1 class="site-title">mind the explanatory gap</h1> <h2 class="site-description">many a slip &#039;twixt mind and lip&#8230;</h2> </a> <div id="navbar" class="navbar"> <nav id="site-navigation" class="navigation main-navigation" role="navigation"> <h3 class="menu-toggle">Menu</h3> <a class="screen-reader-text skip-link" href="#content" title="Skip to content">Skip to content</a> <div class="nav-menu"><ul><li class="page_item page-item-2"><a href="http://explanatorygap.net/wp-content/plugins/really-static/static/about/">About/Contact</a></li><li class="page_item page-item-278"><a href="http://explanatorygap.net/wp-content/plugins/really-static/static/os-x-puppet-pkgs/">OS X Puppet pkgs</a></li></ul></div> <form role="search" method="get" class="search-form" action="http://explanatorygap.net/wp-content/plugins/really-static/static/"> <label> <span class="screen-reader-text">Search for:</span> <input type="search" class="search-field" placeholder="Search &hellip;" value="" name="s" title="Search for:" /> </label> <input type="submit" class="search-submit" value="Search" /> </form> </nav><!-- #site-navigation --> </div><!-- #navbar --> </header><!-- #masthead --> <div id="main" class="site-main"> <div id="primary" class="content-area"> <div id="content" class="site-content" role="main"> <header class="archive-header"> <h1 class="archive-title">Daily Archives: January 9, 2009</h1> </header><!-- .archive-header --> <article id="post-174" class="post-174 post type-post status-publish format-standard hentry category-macosxserver"> <header class="entry-header"> <h1 class="entry-title"> <a href="http://explanatorygap.net/wp-content/plugins/really-static/static/2009/01/09/macworld-2009-puppet-on-mac-os-x/" rel="bookmark">Macworld 2009: Puppet on Mac OS X</a> </h1> <div class="entry-meta"> <span class="date"><a href="http://explanatorygap.net/wp-content/plugins/really-static/static/2009/01/09/macworld-2009-puppet-on-mac-os-x/" title="Permalink to Macworld 2009: Puppet on Mac OS X" rel="bookmark"><time class="entry-date" datetime="2009-01-09T11:39:23+00:00">January 9, 2009</time></a></span><span class="categories-links"><a href="http://explanatorygap.net/wp-content/plugins/really-static/static/category/macosxserver/" title="View all posts in macosxserver" rel="category tag">macosxserver</a></span><span class="author vcard"><a class="url fn n" href="http://explanatorygap.net/wp-content/plugins/really-static/static/author/nigelkersten/" title="View all posts by nigel kersten" rel="author">nigel kersten</a></span> </div><!-- .entry-meta --> </header><!-- .entry-header --> <div class="entry-content"> <p><iframe src='http://docs.google.com/EmbedSlideshow?docid=dg382zb7_1cd4bwhg9' frameborder='0' width='410' height='342'></iframe></p> </div><!-- .entry-content --> <footer class="entry-meta"> <div class="comments-link"> <a href="http://explanatorygap.net/wp-content/plugins/really-static/static/2009/01/09/macworld-2009-puppet-on-mac-os-x/#comments" title="Comment on Macworld 2009: Puppet on Mac OS X">View all 2 comments</a> </div><!-- .comments-link --> </footer><!-- .entry-meta --> </article><!-- #post --> <article id="post-172" class="post-172 post type-post status-publish format-standard hentry category-macosxserver"> <header class="entry-header"> <h1 class="entry-title"> <a href="http://explanatorygap.net/wp-content/plugins/really-static/static/2009/01/09/macworld-2009-python-for-system-administration/" rel="bookmark">Macworld 2009: Python for System Administration</a> </h1> <div class="entry-meta"> <span class="date"><a href="http://explanatorygap.net/wp-content/plugins/really-static/static/2009/01/09/macworld-2009-python-for-system-administration/" title="Permalink to Macworld 2009: Python for System Administration" rel="bookmark"><time class="entry-date" datetime="2009-01-09T11:38:30+00:00">January 9, 2009</time></a></span><span class="categories-links"><a href="http://explanatorygap.net/wp-content/plugins/really-static/static/category/macosxserver/" title="View all posts in macosxserver" rel="category tag">macosxserver</a></span><span class="author vcard"><a class="url fn n" href="http://explanatorygap.net/wp-content/plugins/really-static/static/author/nigelkersten/" title="View all posts by nigel kersten" rel="author">nigel kersten</a></span> </div><!-- .entry-meta --> </header><!-- .entry-header --> <div class="entry-content"> <p>Presentation here:</p> <p><iframe src='http://docs.google.com/EmbedSlideshow?docid=dg382zb7_24hmmztnf5' frameborder='0' width='410' height='342'></iframe></p> </div><!-- .entry-content --> <footer class="entry-meta"> <div class="comments-link"> <a href="http://explanatorygap.net/wp-content/plugins/really-static/static/2009/01/09/macworld-2009-python-for-system-administration/#comments" title="Comment on Macworld 2009: Python for System Administration">View all 4 comments</a> </div><!-- .comments-link --> </footer><!-- .entry-meta --> </article><!-- #post --> </div><!-- #content --> </div><!-- #primary --> </div><!-- #main --> <footer id="colophon" class="site-footer" role="contentinfo"> <div id="secondary" class="sidebar-container" role="complementary"> <div class="widget-area"> <aside id="pages-2" class="widget widget_pages"><h3 class="widget-title">Pages</h3> <ul> <li class="page_item page-item-2"><a href="http://explanatorygap.net/wp-content/plugins/really-static/static/about/">About/Contact</a></li> <li class="page_item page-item-278"><a href="http://explanatorygap.net/wp-content/plugins/really-static/static/os-x-puppet-pkgs/">OS X Puppet pkgs</a></li> </ul> </aside><aside id="search-2" class="widget widget_search"><form role="search" method="get" class="search-form" action="http://explanatorygap.net/wp-content/plugins/really-static/static/"> <label> <span class="screen-reader-text">Search for:</span> <input type="search" class="search-field" placeholder="Search &hellip;" value="" name="s" title="Search for:" /> </label> <input type="submit" class="search-submit" value="Search" /> </form></aside><aside id="tweetbox" class="widget tweetbox_widget"><h3 class="widget-title">Latest Tweets</h3><script type="text/javascript" src="http://explanatorygap.net/wp-content/plugins/tweetbox/tweetbox.js"></script><script>getTweets('nigelkersten', 3, '')</script><div id="tweetboxtweets">Fetching latest tweets...</div></aside><aside id="categories-1" class="widget widget_categories"><h3 class="widget-title">Categories</h3> <ul> <li class="cat-item cat-item-5"><a href="http://explanatorygap.net/wp-content/plugins/really-static/static/category/nix/" title="View all posts filed under *nix">*nix</a> </li> <li class="cat-item cat-item-6"><a href="http://explanatorygap.net/wp-content/plugins/really-static/static/category/macosx/" title="View all posts filed under macosx">macosx</a> </li> <li class="cat-item cat-item-3"><a href="http://explanatorygap.net/wp-content/plugins/really-static/static/category/macosxserver/" title="View all posts filed under macosxserver">macosxserver</a> </li> <li class="cat-item cat-item-13"><a href="http://explanatorygap.net/wp-content/plugins/really-static/static/category/puppet/" title="View all posts filed under puppet">puppet</a> </li> <li class="cat-item cat-item-15"><a href="http://explanatorygap.net/wp-content/plugins/really-static/static/category/python/" title="View all posts filed under python">python</a> </li> <li class="cat-item cat-item-4"><a href="http://explanatorygap.net/wp-content/plugins/really-static/static/category/ramblings/" title="View all posts filed under ramblings">ramblings</a> </li> <li class="cat-item cat-item-2"><a href="http://explanatorygap.net/wp-content/plugins/really-static/static/category/snippets/" title="Snippets">Snippets</a> </li> <li class="cat-item cat-item-7"><a href="http://explanatorygap.net/wp-content/plugins/really-static/static/category/software-and-scripts/" title="View all posts filed under software and scripts">software and scripts</a> </li> <li class="cat-item cat-item-1"><a href="http://explanatorygap.net/wp-content/plugins/really-static/static/category/uncategorized/" title="View all posts filed under Uncategorized">Uncategorized</a> </li> </ul> </aside><aside id="meta-2" class="widget widget_meta"><h3 class="widget-title">Meta</h3> <ul> <li><a href="http://explanatorygap.net/wp-content/plugins/really-static/static/wp-login.php">Log in</a></li> <li><a href="http://explanatorygap.net/wp-content/plugins/really-static/static/feed/" title="Syndicate this site using RSS 2.0">Entries <abbr title="Really Simple Syndication">RSS</abbr></a></li> <li><a href="http://explanatorygap.net/wp-content/plugins/really-static/static/comments/feed/" title="The latest comments to all posts in RSS">Comments <abbr title="Really Simple Syndication">RSS</abbr></a></li> <li><a href="https://wordpress.org/" title="Powered by WordPress, state-of-the-art semantic personal publishing platform.">WordPress.org</a></li> </ul> </aside><aside id="linkcat-10" class="widget widget_links"><h3 class="widget-title">Mac Dev Blogs</h3> <ul class='xoxo blogroll'> <li><a href="http://ridiculousfish.com/blog/">Ridiculous Fish</a></li> <li><a href="http://www.theocacao.com/" title="Scott Stevenson&#8217;s blog">theocacao.com</a></li> </ul> </aside> <aside id="linkcat-8" class="widget widget_links"><h3 class="widget-title">Mac Tech Blogs</h3> <ul class='xoxo blogroll'> <li><a href="http://bynkii.com/" title="John C. Welch&#8217;s blog&#8230; the reason God invented the middle finger&#8230;">bynkii.com</a></li> <li><a href="http://arstechnica.com/staff/fatbits.ars" title="John Siracusa&#8217;s Journal">fatbits</a></li> <li><a href="http://iamleeg.blogspot.com/" title="Graham Lee&#8217;s blog&#8230; lots of Darwin and Openstep.">i am leeg</a></li> <li><a href="http://managingosx.wordpress.com/" title="Greg Neagle&#8217;s Managing OS X blog">managing os x</a></li> <li><a href="http://northstarlabs.net" title="Jeff McCune&#8217;s sysadmin blog">northstarlabs.net</a></li> <li><a href="http://www.radiotope.com/writing/" title="Edward Marczak&#8217;s blog&#8230; the oneness of tech..">tech zendo</a></li> <li><a href="http://www.dreness.com/blog/" title="Andre&#8217;s Mac geek blog&#8230;">the bits</a></li> <li><a href="http://yourmacguy.wordpress.com/" title="Peter Bukowinski&#8217;s blog">Your Mac Guy</a></li> </ul> </aside> <aside id="linkcat-9" class="widget widget_links"><h3 class="widget-title">Mac Technical Sites</h3> <ul class='xoxo blogroll'> <li><a href="http://www.afp548.com" title="We put the M in RTFM&#8230;">AFP548.com</a></li> <li><a href="http://www.macenterprise.org" title="The MacEnterprise project is a community of IT professionals sharing information and solutions to support Macs in an enterprise.">MacEnterprise.org</a></li> <li><a href="http://xsanity.com/">xsanity</a></li> </ul> </aside> <aside id="linkcat-12" class="widget widget_links"><h3 class="widget-title">Social</h3> <ul class='xoxo blogroll'> <li><a href="http://yumamino.com/" title="Tane Potaka&#8217;s blog">Yumamino</a></li> </ul> </aside> </div><!-- .widget-area --> </div><!-- #secondary --> <div class="site-info"> <a href="http://wordpress.org/" title="Semantic Personal Publishing Platform">Proudly powered by WordPress</a> </div><!-- .site-info --> </footer><!-- #colophon --> </div><!-- #page --> <script type='text/javascript' src='http://explanatorygap.net/wp-includes/js/masonry.min.js?ver=3.1.2'></script> <script type='text/javascript' src='http://explanatorygap.net/wp-includes/js/jquery/jquery.masonry.min.js?ver=3.1.2'></script> <script type='text/javascript' src='http://explanatorygap.net/wp-content/themes/twentythirteen/js/functions.js?ver=2013-07-18'></script> </body> </html> <!-- Dynamic Page Served (once) in 0.265 seconds -->
Java
jsonp({"cep":"74490190","logradouro":"Estrada S\u00e3o de Paulo","bairro":"Parque Bom Jesus","cidade":"Goi\u00e2nia","uf":"GO","estado":"Goi\u00e1s"});
Java
title: "leetcode-291-Word-Pattern-II" date: 2014-03-11 00:33:34 tags: [algorithms, leetcode, ] --- ### 描述 === 这里是描述 <!--more--> ### 分析 === 这里是分析 ### 解决方案1(C++) === ### 解决方案2(Java) === ### 解决方案3(Python) === ### 相关问题 === ### [题目来源](https://leetcode.com/problems/word-pattern-ii/)
Java
jsonp({"cep":"73751271","logradouro":"Quadra 14 MR 1","bairro":"Setor Norte","cidade":"Planaltina de Goi\u00e1s","uf":"GO","estado":"Goi\u00e1s"});
Java
jsonp({"cep":"64009295","logradouro":"Rua Miguel Furtado Bacellar","bairro":"Memorare","cidade":"Teresina","uf":"PI","estado":"Piau\u00ed"});
Java
jsonp({"cep":"74863070","logradouro":"Rua Cruzeiro do Sul","bairro":"Jardim Bela Vista","cidade":"Goi\u00e2nia","uf":"GO","estado":"Goi\u00e1s"});
Java
jsonp({"cep":"29706320","logradouro":"Rua Jos\u00e9 de Anchieta","bairro":"Vila Am\u00e9lia","cidade":"Colatina","uf":"ES","estado":"Esp\u00edrito Santo"});
Java
jsonp({"cep":"06320170","logradouro":"Rua Pedro Lobas","bairro":"Jardim das Belezas","cidade":"Carapicu\u00edba","uf":"SP","estado":"S\u00e3o Paulo"});
Java
jsonp({"cep":"57601322","logradouro":"Rua Tabeli\u00e3o Luiz Vieira de Barros","bairro":"S\u00e3o Crist\u00f3v\u00e3o","cidade":"Palmeira dos \u00cdndios","uf":"AL","estado":"Alagoas"});
Java
jsonp({"cep":"73805345","logradouro":"Rua Virg\u00edlio Alves Ferreira","bairro":"Setor Pampulha","cidade":"Formosa","uf":"GO","estado":"Goi\u00e1s"});
Java
jsonp({"cep":"14178057","logradouro":"Rua Hugo Gaiofatto","bairro":"Jardim Campo Belo","cidade":"Sert\u00e3ozinho","uf":"SP","estado":"S\u00e3o Paulo"});
Java
jsonp({"cep":"13256566","logradouro":"Rua Angelo Capeletto","bairro":"Loteamento Residencial Terra Nova","cidade":"Itatiba","uf":"SP","estado":"S\u00e3o Paulo"});
Java
* {margin:0;padding:0;} html {height:100%;overflow-y:scroll;font-family:Verdana,Georgia,Serif;} body {height:100%;font-size:12px;line-height:22px; display:flex;flex-direction: column; color:#1b1e1d;background-color:#fbfbfb;} .container {margin: 0 auto;flex: 1 0 auto;} .wrap {max-width:800px;margin: 0 auto;padding:0 40px} .rftd {display: flex;align-items: center;justify-content: center} .footer {margin: 0 auto;flex-shrink: 0;} #mainmenu{padding:48px 0} h1, h2, h3 {font-family:'Vollkorn',Verdana,Georgia,serif;font-weight:normal;} h1 {font-size:48px;line-height:46px;padding: 0 32px 0 0;color:#e10009;} h2 {font-size:28px;line-height:26px;color:#e10009;} h3 {font-size:16px;line-height:22px;} h1, h1 a, h2, h2 a {font-weight:normal;letter-spacing:-0.04em} span {padding:0 3em} hr {clear:both;border:none} a{outline:none;text-decoration:underline;color:#33342f} a img{outline:none} a:hover{color:#1b1e1d;text-decoration:none} a:visited{text-decoration:none} img {-webkit-user-select:none;-moz-user-select: none;user-select: none;} img.fleft{float:left;margin:9px 32px 0 0} img.fright{float:right;margin:9px 0 0 64px} .chapter {padding: 3em 0} .logo {float:left;padding-right: 6em} .bigspacer{height:66px} p {padding: 1em 0 0} table {border: 1px solid #777;border-collapse: collapse;clear:both;float:left;margin:1rem 0;width:98%;} table td {-moz-hyphens: auto;word-break: break-all;word-wrap: break-word;border: 1px solid #d7d7d7;padding:1rem;vertical-align: baseline;} ::selection{background:#33342f;color:#fbfbfb} ::-moz-selection{background:#33342f;color:#fbfbfb} ::-webkit-selection{background:#33342f;color:#fbfbfb}
Java
/*!CK:906623253!*//*1432615303,*/ ._9jo a.navSubmenu,._9jo li.navSubmenu{color:#141823;display:block;max-width:200px;padding:0 22px;text-decoration:none}._9jo .uiLinkButton input{color:#141823;display:block;line-height:22px;padding:0 22px;text-decoration:none}._9jo ._54ne .uiLinkButton input,._9jo ._54ne a.navSubmenu,._9jo li.navSubmenu._54ne a,._9jo li._54ne{background-color:#42599e;color:#fff;text-decoration:none}._9jo .uiSideNavCount{margin-top:3px}._9jo li.navSubmenu a{color:#141823;display:block;text-decoration:none}#logoutMenu ._khf{right:-6px} #profile_minifeed .reportHide{display:none} #bootloader_1KeRQ { height: 42px; } .bootloader_1KeRQ { display:block !important; }
Java
jsonp({"cep":"02254030","logradouro":"Pra\u00e7a Ataliba da Costa Vida","bairro":"Vila Nivi","cidade":"S\u00e3o Paulo","uf":"SP","estado":"S\u00e3o Paulo"});
Java
jsonp({"cep":"74391150","logradouro":"Rua Desembargador Em\u00edlio Fleury de Brito","bairro":"Jardim Marques de Abreu","cidade":"Goi\u00e2nia","uf":"GO","estado":"Goi\u00e1s"});
Java
#### 更新依赖   在执行build、compile等任务时会解析项目配置的依赖并按照配置的仓库去搜寻下载这些依赖。默认情况下,Gradle会依照Gradle缓存->你配置的仓库的顺序依次搜寻这些依赖,并且一旦找到就会停止搜索。如果想要忽略本地缓存每次都进行远程检索可以通过在执行命令时添加`--refresh-dependencies`参数来强制刷新依赖。 ```bash gradle build --refresh-dependencies ```   当远程仓库上传了相同版本依赖时,有时需要为缓存指定一个时效去检查远程仓库的依赖笨版本,Gradle提供了`cacheChangingModulesFor(int, java.util.concurrent.TimeUnit)` ,`cacheDynamicVersionsFor(int, java.util.concurrent.TimeUnit) `两个方法来设置缓存的时效 ```groovy configurations.all { //每隔24小时检查远程依赖是否存在更新 resolutionStrategy.cacheChangingModulesFor 24, 'hours' //每隔10分钟.. //resolutionStrategy.cacheChangingModulesFor 10, 'minutes' // 采用动态版本声明的依赖缓存10分钟 resolutionStrategy.cacheDynamicVersionsFor 10*60, 'seconds' } dependencies { // 添加changing: true compile group: "group", name: "module", version: "1.1-SNAPSHOT", changing: true //简写方式 //compile('group:module:1.1-SNAPSHOT') { changing = true } } ``` #### 缓存管理 ##### 缓存位置管理   Gradle在按照配置的仓库去搜寻下载依赖时,下载的依赖默认会缓存到USER_HOME/.gradle/caches目录下,当然也可以手工修改这个位置。   具体可以参考如下三种方式: - 通过添加系统变量 GRADLE_USER_HOME - 设置虚拟机参数 org.gradle.user.home 属性 - 通过命令行-g或者 --gradle-user-home 参数设置 ##### 离线模式(总是采用缓存内容)   Gradle提供了一种离线模式,可以让你构建时总是采用缓存的内容而无需去联网检查,如果你并未采用动态版本特性且可以确保项目中依赖的版本都已经缓存到了本地,这无疑是提高构建速度的一个好选择。开启离线模式只需要在执行命令时候添加`--offline`参数即可。当然,采用这种模式的也是有代价的,如果缓存中搜寻不到所需依赖会导致构建失败。 ```bash gradle build --offline ```
Java
<!DOCTYPE html> <html lang="en"> <meta charset="utf-8"> <title>-wei</title> <link type="text/css" rel="stylesheet" href="../../style.css"> <h1 lang="art-Latn-x-osv-0010"> -wei </h1> <dl> <dt>Etymology: <dd>From VIV <i lang="art-Latn-x-osv-0009">*-auei</i> <small>«do»</small>. </dl> <h2>affix</h2> <aside>positive: <i lang="art-Latn-x-osv-0010">-wai</i></aside> <p> perfective aspect
Java
jsonp({"cep":"12214425","logradouro":"Rua Quatro","bairro":"Condom\u00ednio Villagio Fazend\u00e3o","cidade":"S\u00e3o Jos\u00e9 dos Campos","uf":"SP","estado":"S\u00e3o Paulo"});
Java
jsonp({"cep":"02721200","logradouro":"Avenida Deputado Em\u00edlio Carlos","bairro":"Lim\u00e3o","cidade":"S\u00e3o Paulo","uf":"SP","estado":"S\u00e3o Paulo"});
Java
jsonp({"cep":"08140438","logradouro":"Travessa Jonatas Batista","bairro":"Jardim Benfica","cidade":"S\u00e3o Paulo","uf":"SP","estado":"S\u00e3o Paulo"});
Java
jsonp({"cep":"25250439","logradouro":"Travessa Jos\u00e9 Zito Santana","bairro":"Mantiquira","cidade":"Duque de Caxias","uf":"RJ","estado":"Rio de Janeiro"});
Java
// Global Vars to set var musicas = new Array(11); musicas[0] = 0; // Wheel A musicas[1] = 0; // Whell B musicas[2] = "0;"; // A1 musicas[3] = "0;"; // A2 musicas[4] = "0;"; // A3 musicas[5] = "0;"; // A4 musicas[6] = "0;"; // B1 musicas[7] = "0;"; // B2 musicas[8] = "0;"; // B3 musicas[9] = "0;"; // B4 musicas[10] = 0; // Sings function ativa_facebook(){ alert('Aguarde...'); FB.api('/me', function(response) { // console.log(response); // NORMAL ACTION $.post('getUser.php', { facebookId: response.id}, function(data){ if(data.success){ //INSERE APENAS BATIDA $.post('salva_som.php?opc=1', { m1: musicas[0], m2: musicas[1], m3: musicas[2]+musicas[3]+musicas[4]+musicas[5]+musicas[6]+musicas[7]+musicas[8]+musicas[9], m4: musicas[10], usuario: data.usuario }, function(data){ if(data.success){ var image = Math.floor((Math.random()*3)+1); FB.api('/me/feed', 'post', { message: 'Sinta o sabor da minha batida no FLAVOR DJ: o gerador de som exclusivo do BH DANCE FESTIVAL. BH Dance Festival. A CIDADE NA PISTA.', link: 'https://apps.facebook.com/flavordj/?minhaBatida='+data.batida, picture: 'https://lit-castle-9930.herokuapp.com/img/share/flavor'+image+'.jpg' }, function(response) { if (!response || response.error) { alert('Error occured'); } else { alert('Sua batida foi compartilhada com sucesso!'); } }); } }, 'json'); }else{ //INSERE BATIDA E USUARIO $.post('salva_som.php?opc=2', { m1: musicas[0], m2: musicas[1], m3: musicas[2]+musicas[3]+musicas[4]+musicas[5]+musicas[6]+musicas[7]+musicas[8]+musicas[9], m4: musicas[10], facebookId: response.id, nome: response.name, email: response.email, sexo: response.gender, cidade: '' }, function(data){ if(data.success){ var image = Math.floor((Math.random()*3)+1); FB.api('/me/feed', 'post', { message: 'Sinta o sabor da minha batida no FLAVOR DJ: o gerador de som exclusivo do BH DANCE FESTIVAL. BH Dance Festival. A CIDADE NA PISTA.', link: 'https://apps.facebook.com/flavordj/?minhaBatida='+data.batida, picture: 'https://lit-castle-9930.herokuapp.com/img/share/flavor'+image+'.jpg' }, function(response) { if (!response || response.error) { alert('Error occured'); } else { alert('Sua batida foi compartilhada com sucesso!'); } }); } }, 'json'); } }, 'json'); }); } function computa_voto(batida){ FB.api('/me', function(response) { //console.log(response); // NORMAL ACTION $.post('getVoto.php', { facebookId: response.id}, function(data){ if(data.success){ alert('Você já votou em uma batida, obrigado por participar!'); }else{ //INSERE NO BD $.post('computa_voto.php', { facebookId: response.id, batida: batida }, function(data){ if(data.success){ } }, 'json'); } }, 'json'); }); } function login() { alert('Você ainda não tem o aplicativo do Flavor DJ. Instale-o primeiro para compartilhar sua batida.'); FB.login(function(response) { if (response.authResponse) { ativa_facebook(); } else { } }, {scope: 'email, publish_stream'}); } function desativaetp1(){ $('.audio1').jPlayer("stop"); $('.audio2').jPlayer("stop"); $('.audio3').jPlayer("stop"); $('.audio4').jPlayer("stop"); musicas[0] = "0;"; $('.etapa1, .guide .etapa1 div, .etapa1 li').removeClass('ativo'); $('.etapa1').css('z-index', 2); } function desativaetp2(){ $('.audio5').jPlayer("stop"); $('.audio6').jPlayer("stop"); $('.audio7').jPlayer("stop"); $('.audio8').jPlayer("stop"); musicas[1] = "0;"; $('.etapa2, .guide .etapa2 div, .etapa2 li').removeClass('ativo'); $('.etapa2').css('z-index', 2); } function desativaetpr(idPlayer, cod){ musicas[cod] = "0;"; $('.audio'+idPlayer).jPlayer("stop"); $('.etapa3').css('z-index', 2); } function desativaetp5(){ $('.audio17').jPlayer("stop"); $('.audio18').jPlayer("stop"); $('.audio19').jPlayer("stop"); $('.audio20').jPlayer("stop"); musicas[10] = "0;"; $('.etapa5, .guide .etapa5 div, .etapa5 li').removeClass('ativo'); $('.etapa5').css('z-index', 2); } function ativa_anima(){ $('.whel1 div.a').delay(300).animate({ height: '0px' }, 1000); $('.whel1 div.b').delay(300).animate({ height: '0px' }, 1000, function(){ $('.whel2 div.a').delay(300).animate({ width: '0px' }, 1000); $('.whel2 div.b').delay(300).animate({ width: '0px' }, 1000); }); } $(document).ready(function(){ //login_start(); $('.etapa1').click(function(){ if($(this).hasClass('ativo')){ desativaetp1(); }else{ desativaetp1(); $(this).addClass('ativo'); $(this).css('z-index', 1); var audioPlayer = $(this).attr('href'); musicas[0] = audioPlayer; $('.guide .etapa1 div.p'+audioPlayer).addClass('ativo'); $('.visor .etapa1 li.p'+audioPlayer).addClass('ativo'); $(".audio"+audioPlayer).jPlayer("play", 0); } return false; }) $('.etapa2').click(function(){ if($(this).hasClass('ativo')){ desativaetp2(); }else{ desativaetp2(); $(this).addClass('ativo'); $(this).css('z-index', 1); var audioPlayer = $(this).attr('href'); musicas[1] = audioPlayer; $('.guide .etapa2 div.p'+audioPlayer).addClass('ativo'); $('.visor .etapa2 li.p'+audioPlayer).addClass('ativo'); $(".audio"+audioPlayer).jPlayer("play", 0); } return false; }) $('.etapa3').click(function(){ var audioPlayer = $(this).attr('href'); var codigo = $(this).data('codigo'); if($(this).hasClass('ativo')){ desativaetpr(audioPlayer,codigo); $('.guide .etapa3 div.p'+audioPlayer).removeClass('ativo'); $('.visor .etapa3 li.p'+audioPlayer).removeClass('ativo'); $(this).removeClass('ativo'); }else{ $(this).addClass('ativo'); $('.guide .etapa3 div.p'+audioPlayer).addClass('ativo'); $('.visor .etapa3 li.p'+audioPlayer).addClass('ativo'); $(this).css('z-index', 1); musicas[codigo] = audioPlayer+";"; $(".audio"+audioPlayer).jPlayer("play", 0); } return false; }) $('.etapa4').click(function(){ var audioPlayer = $(this).attr('href'); var cod = $(this).data('codigo'); if($(this).hasClass('ativo')){ desativaetpr(audioPlayer, cod); $('.guide .etapa4 div.p'+audioPlayer).removeClass('ativo'); $('.visor .etapa4 li.p'+audioPlayer).removeClass('ativo'); $(this).removeClass('ativo'); }else{ $(this).addClass('ativo'); $('.guide .etapa4 div.p'+audioPlayer).addClass('ativo'); $('.visor .etapa4 li.p'+audioPlayer).addClass('ativo'); musicas[cod] = audioPlayer+";"; $(".audio"+audioPlayer).jPlayer("play", 0); } return false; }) $('.etapa5').click(function(){ if($(this).hasClass('ativo')){ desativaetp5(); }else{ desativaetp5(); $(this).addClass('ativo'); var audioPlayer = $(this).attr('href'); musicas[10] = audioPlayer; $('.guide .etapa5 div.p'+audioPlayer).addClass('ativo'); $('.visor .etapa5 li.p'+audioPlayer).addClass('ativo'); $(".audio"+audioPlayer).jPlayer("play", 0); } return false; }) $(".audio1").jPlayer({ ready: function (event) { $(this).jPlayer("setMedia", { oga: "https://lit-castle-9930.herokuapp.com/sounds/pct1/1.ogg", mp3: "https://lit-castle-9930.herokuapp.com/sounds/pct1/1.mp3" } )}, swfPath: "js", supplied: "oga, mp3", wmode: "window", loop: true, preload: 'auto' }); $(".audio2").jPlayer({ ready: function (event) { $(this).jPlayer("setMedia", { oga: "https://lit-castle-9930.herokuapp.com/sounds/pct1/2.ogg", mp3: "https://lit-castle-9930.herokuapp.com/sounds/pct1/2.mp3" } )}, swfPath: "js", supplied: "oga, mp3", wmode: "window", loop: true, preload: 'auto' }); $(".audio3").jPlayer({ ready: function (event) { $(this).jPlayer("setMedia", { oga: "https://lit-castle-9930.herokuapp.com/sounds/pct1/3.ogg", mp3: "https://lit-castle-9930.herokuapp.com/sounds/pct1/3.mp3" } )}, swfPath: "js", supplied: "oga, mp3", wmode: "window", loop: true, preload: 'auto' }); $(".audio4").jPlayer({ ready: function (event) { $(this).jPlayer("setMedia", { oga: "https://lit-castle-9930.herokuapp.com/sounds/pct1/4.ogg", mp3: "https://lit-castle-9930.herokuapp.com/sounds/pct1/4.mp3" } )}, swfPath: "js", supplied: "oga, mp3", wmode: "window", loop: true, preload: 'auto' }); $(".audio5").jPlayer({ ready: function (event) { $(this).jPlayer("setMedia", { oga: "https://lit-castle-9930.herokuapp.com/sounds/pct2/1.ogg", mp3: "https://lit-castle-9930.herokuapp.com/sounds/pct2/1.mp3" } )}, swfPath: "js", supplied: "oga, mp3", wmode: "window", loop: true, preload: 'auto' }); $(".audio6").jPlayer({ ready: function (event) { $(this).jPlayer("setMedia", { oga: "https://lit-castle-9930.herokuapp.com/sounds/pct2/2.ogg", mp3: "https://lit-castle-9930.herokuapp.com/sounds/pct2/2.mp3" } )}, swfPath: "js", supplied: "oga, mp3", wmode: "window", loop: true, preload: 'auto' }); $(".audio7").jPlayer({ ready: function (event) { $(this).jPlayer("setMedia", { oga: "https://lit-castle-9930.herokuapp.com/sounds/pct2/3.ogg", mp3: "https://lit-castle-9930.herokuapp.com/sounds/pct2/3.mp3" } )}, swfPath: "js", supplied: "oga, mp3", wmode: "window", loop: true, preload: 'auto' }); $(".audio8").jPlayer({ ready: function (event) { $(this).jPlayer("setMedia", { oga: "https://lit-castle-9930.herokuapp.com/sounds/pct2/4.ogg", mp3: "https://lit-castle-9930.herokuapp.com/sounds/pct2/4.mp3" } )}, swfPath: "js", supplied: "oga, mp3", wmode: "window", loop: true, preload: 'auto' }); $(".audio9").jPlayer({ ready: function (event) { $(this).jPlayer("setMedia", { oga: "https://lit-castle-9930.herokuapp.com/sounds/pct3/1.ogg", mp3: "https://lit-castle-9930.herokuapp.com/sounds/pct3/1.mp3" } )}, swfPath: "js", supplied: "oga, mp3", wmode: "window", loop: true, preload: 'auto' }); $(".audio10").jPlayer({ ready: function (event) { $(this).jPlayer("setMedia", { oga: "https://lit-castle-9930.herokuapp.com/sounds/pct3/2.ogg", mp3: "https://lit-castle-9930.herokuapp.com/sounds/pct3/2.mp3" } )}, swfPath: "js", supplied: "oga, mp3", wmode: "window", loop: true, preload: 'auto' }); $(".audio11").jPlayer({ ready: function (event) { $(this).jPlayer("setMedia", { oga: "https://lit-castle-9930.herokuapp.com/sounds/pct3/3.ogg", mp3: "https://lit-castle-9930.herokuapp.com/sounds/pct3/3.mp3" } )}, swfPath: "js", supplied: "oga, mp3", wmode: "window", loop: true, preload: 'auto' }); $(".audio12").jPlayer({ ready: function (event) { $(this).jPlayer("setMedia", { oga: "https://lit-castle-9930.herokuapp.com/sounds/pct3/4.ogg", mp3: "https://lit-castle-9930.herokuapp.com/sounds/pct3/4.mp3" } )}, swfPath: "js", supplied: "oga, mp3", wmode: "window", loop: true, preload: 'auto' }); $(".audio13").jPlayer({ ready: function (event) { $(this).jPlayer("setMedia", { oga: "https://lit-castle-9930.herokuapp.com/sounds/pct4/1.ogg", mp3: "https://lit-castle-9930.herokuapp.com/sounds/pct4/1.mp3" } )}, swfPath: "js", supplied: "oga, mp3", wmode: "window", loop: true, preload: 'auto' }); $(".audio14").jPlayer({ ready: function (event) { $(this).jPlayer("setMedia", { oga: "https://lit-castle-9930.herokuapp.com/sounds/pct4/2.ogg", mp3: "https://lit-castle-9930.herokuapp.com/sounds/pct4/2.mp3" } )}, swfPath: "js", supplied: "oga, mp3", wmode: "window", loop: true, preload: 'auto' }); $(".audio15").jPlayer({ ready: function (event) { $(this).jPlayer("setMedia", { oga: "https://lit-castle-9930.herokuapp.com/sounds/pct4/3.ogg", mp3: "https://lit-castle-9930.herokuapp.com/sounds/pct4/3.mp3" } )}, swfPath: "js", supplied: "oga, mp3", wmode: "window", loop: true, preload: 'auto' }); $(".audio16").jPlayer({ ready: function (event) { $(this).jPlayer("setMedia", { oga: "https://lit-castle-9930.herokuapp.com/sounds/pct4/4.ogg", mp3: "https://lit-castle-9930.herokuapp.com/sounds/pct4/4.mp3" } )}, swfPath: "js", supplied: "oga, mp3", wmode: "window", loop: true, preload: 'auto' }); $(".audio17").jPlayer({ ready: function (event) { $(this).jPlayer("setMedia", { oga: "https://lit-castle-9930.herokuapp.com/sounds/pct5/1.ogg", mp3: "https://lit-castle-9930.herokuapp.com/sounds/pct5/1.mp3" } )}, swfPath: "js", supplied: "oga, mp3", wmode: "window", loop: true, preload: 'auto' }); $(".audio18").jPlayer({ ready: function (event) { $(this).jPlayer("setMedia", { oga: "https://lit-castle-9930.herokuapp.com/sounds/pct5/2.ogg", mp3: "https://lit-castle-9930.herokuapp.com/sounds/pct5/2.mp3" } )}, swfPath: "js", supplied: "oga, mp3", wmode: "window", loop: true, preload: 'auto' }); $(".audio19").jPlayer({ ready: function (event) { $(this).jPlayer("setMedia", { oga: "https://lit-castle-9930.herokuapp.com/sounds/pct5/3.ogg", mp3: "https://lit-castle-9930.herokuapp.com/sounds/pct5/3.mp3" } )}, swfPath: "js", supplied: "oga, mp3", wmode: "window", loop: true, preload: 'auto' }); $(".audio20").jPlayer({ ready: function (event) { $(this).jPlayer("setMedia", { oga: "https://lit-castle-9930.herokuapp.com/sounds/pct5/4.ogg", mp3: "https://lit-castle-9930.herokuapp.com/sounds/pct5/4.mp3" } )}, swfPath: "js", supplied: "oga, mp3", wmode: "window", loop: true, preload: 'auto' }); $('body').queryLoader2( { onLoadComplete: ativa_anima() } ); function login_start() { //alert('Você ainda não tem o aplicativo do Flavor DJ. Instale-o primeiro para compartilhar sua batida.'); FB.login(function(response) { if (response.authResponse) { // ativa_facebook(); } else { } }, {scope: 'email, publish_stream'}); } // Share var cont = 0 var i = 0; $('a.share').click(function(){ cont = 0; for(i = 0; i<11; i++){ if((musicas[i] == "0;") || (musicas[i] == 0)){ cont++; } } if(cont == 11){ alert('Você precisa selecionar pelo menos um ingrediente para sua batida.'); }else{ FB.getLoginStatus(function(response) { // console.log(response); if (response.status === 'connected') { // NORMAL ACTION ativa_facebook(); } else if (response.status === 'not_authorized') { login(); window.location.reload(); } else { login(); window.location.reload(); } }); } return false; }); $('.votarBatida').click(function(){ var batida = $(this).attr('href'); FB.getLoginStatus(function(response) { if (response.status === 'connected') { // NORMAL ACTION computa_voto(batida); } else if (response.status === 'not_authorized') { FB.login(function(response) { if (response.authResponse) { // NORMAL ACTION computa_voto(batida); } else { // console.log('Sua batida não foi compartilhada.'); } }, {scope: 'email, publish_stream'}); } else { FB.login(function(response) { if (response.authResponse) { // NORMAL ACTION computa_voto(batida); } else { //console.log('Sua batida não foi compartilhada.'); } }, {scope: 'email, publish_stream'}); } }); }); });
Java
jsonp({"cep":"61610135","logradouro":"Rua Santo Ant\u00f4nio","bairro":"Padre Julio Maria","cidade":"Caucaia","uf":"CE","estado":"Cear\u00e1"});
Java
jsonp({"cep":"24745360","logradouro":"Rua Expedicion\u00e1rio Aprigio Jos\u00e9 Vieira","bairro":"Coelho","cidade":"S\u00e3o Gon\u00e7alo","uf":"RJ","estado":"Rio de Janeiro"});
Java
# 香肠和腊肠 ## 在线分析 [在线计算](https://jsfiddle.net/quanbinn/f6y5jb8p/) -------------------- ### 广东白油肠 ![广东白油肠](/images/加工食品的分析/香肠和腊肠/广东白油肠.jpg) ![广东白油肠_营养标签](/images/加工食品的分析/香肠和腊肠/广东白油肠_营养标签.jpg) 注明: - 这是2008年左右在美国超市里销售的一款xxxxxxx品牌的照片,现在的这种品牌的营养含量大都会这种不相同,一切以销售时产品的营养标签为准。 ### 分析结果 这种食品的能量: 480卡路里, 这种食品的总脂肪: 38克, 这种食品的饱和脂肪: 14克, 这种食品的胆固醇: 95毫克, 这种食品的钠: 1590毫克, 这种食品的钙: 0毫克。 占卡路里每天需求总量的:24%, 占总脂肪每天需求总量的:58%, 占饱和脂肪每天需求总量的:56%, 占饱和脂肪每天需求总量的:56%, 占胆固醇每天需求总量的:32%, 占钠每天需求总量的:66%, 占钙每天需求总量的:0%。 总脂肪占比/卡路里占比:2.4, 饱和脂肪占比/卡路里占比:2.3, 胆固醇占比/卡路里占比:1.3, 钠占比/卡路里占比:2.8, 钙占比/卡路里占比:0.0。 - 从总脂肪含量来看,这种食品含有**超高脂肪**。 - 从饱和脂肪含量来看,这种食品含有**超高饱和脂肪**。 - 从胆固醇含量来看,这种食品含有**含量适中的胆固醇**。 - 从钠含量来看,这种食品含有**高钠**。 - 从钙含量来看,这种食品含有**零钙**。 ### 与预防癌症的饮食建议的关联 ### 与预防高血压的饮食建议的关联 ### 与预防功能性消化不良的饮食建议的关联 ### 与控制体重的饮食建议的关联 ### 你应该怎么做 --------------------- ### 湖南腊肉 ![湖南腊肉](/images/加工食品的分析/香肠和腊肠/湖南腊肉.jpg) ![湖南腊肉_营养标签](/images/加工食品的分析/香肠和腊肠/湖南腊肉_营养标签.jpg) ### 分析结果 这种食品的能量: 340卡路里, 这种食品的总脂肪: 25克, 这种食品的饱和脂肪: 8克, 这种食品的胆固醇: 95毫克, 这种食品的钠: 2020毫克。 占卡路里每天需求总量的:17%, 占总脂肪每天需求总量的:38%, 占饱和脂肪每天需求总量的:32%, 占饱和脂肪每天需求总量的:32%, 占胆固醇每天需求总量的:32%, 占钠每天需求总量的:84%。 总脂肪占比/卡路里占比:2.2, 饱和脂肪占比/卡路里占比:1.9, 胆固醇占比/卡路里占比:1.9, 钠占比/卡路里占比:4.9。 - 从总脂肪含量来看,这种食品含有**超高脂肪**。 - 从饱和脂肪含量来看,这种食品含有**高饱和脂肪**。 - 从胆固醇含量来看,这种食品含有**高胆固醇**。 - 从钠含量来看,这种食品含有**超高钠**。 ### 与预防癌症的饮食建议的关联 ### 与预防高血压的饮食建议的关联 ### 与预防功能性消化不良的饮食建议的关联 ### 与控制体重的饮食建议的关联 ### 你应该怎么做 --------------------- ### Jumbo_Beef_Franks ![Jumbo_Beef_Franks](/images/加工食品的分析/香肠和腊肠/Jumbo_Beef_Franks.jpg) ![Jumbo_Beef_Franks_营养标签](/images/加工食品的分析/香肠和腊肠/Jumbo_Beef_Franks_营养标签.jpg) ### 分析结果 这种食品的能量: 330卡路里, 这种食品的总脂肪: 30.5克, 这种食品的饱和脂肪: 14克, 这种食品的胆固醇: 60毫克, 这种食品的钠: 910毫克, 这种食品的钙: 20毫克。 占卡路里每天需求总量的:17%, 占总脂肪每天需求总量的:47%, 占饱和脂肪每天需求总量的:56%, 占饱和脂肪每天需求总量的:56%, 占胆固醇每天需求总量的:20%, 占钠每天需求总量的:38%, 占钙每天需求总量的:2%。 总脂肪占比/卡路里占比:2.8, 饱和脂肪占比/卡路里占比:3.3, 胆固醇占比/卡路里占比:1.2, 钠占比/卡路里占比:2.2, 钙占比/卡路里占比:0.1。 - 从总脂肪含量来看,这种食品含有**超高脂肪**。 - 从饱和脂肪含量来看,这种食品含有**超高饱和脂肪**。 - 从胆固醇含量来看,这种食品含有**含量适中的胆固醇**。 - 从钠含量来看,这种食品含有**高钠**。 - 从钙含量来看,这种食品含有**低钙**。 ### 与预防癌症的饮食建议的关联 ### 与预防高血压的饮食建议的关联 ### 与预防功能性消化不良的饮食建议的关联 ### 与控制体重的饮食建议的关联 ### 你应该怎么做 --------------------- ### kosher_Beef_Salami ![kosher_Beef_Salami](/images/加工食品的分析/香肠和腊肠/kosher_Beef_Salami.jpg) ![kosher_Beef_Salami_营养标签](/images/加工食品的分析/香肠和腊肠/kosher_Beef_Salami_营养标签.jpg) ### 分析结果 这种食品的能量: 160卡路里, 这种食品的总脂肪: 15克, 这种食品的饱和脂肪: 6克, 这种食品的胆固醇: 25毫克, 这种食品的钠: 450毫克, 这种食品的钙: 20毫克。 占卡路里每天需求总量的:8%, 占总脂肪每天需求总量的:23%, 占饱和脂肪每天需求总量的:24%, 占饱和脂肪每天需求总量的:24%, 占胆固醇每天需求总量的:8%, 占钠每天需求总量的:19%, 占钙每天需求总量的:2%。 总脂肪占比/卡路里占比:2.9, 饱和脂肪占比/卡路里占比:3.0, 胆固醇占比/卡路里占比:1.0, 钠占比/卡路里占比:2.4, 钙占比/卡路里占比:0.3。 - 从总脂肪含量来看,这种食品含有**超高脂肪**。 - 从饱和脂肪含量来看,这种食品含有**超高饱和脂肪**。 - 从胆固醇含量来看,这种食品含有**含量适中的胆固醇**。 - 从钠含量来看,这种食品含有**高钠**。 - 从钙含量来看,这种食品含有**低钙**。 ### 与预防癌症的饮食建议的关联 ### 与预防高血压的饮食建议的关联 ### 与预防功能性消化不良的饮食建议的关联 ### 与控制体重的饮食建议的关联 ### 你应该怎么做 ---------------------
Java
jsonp({"cep":"87114166","logradouro":"Rua 11","bairro":"Jardim Ouro Verde II","cidade":"Sarandi","uf":"PR","estado":"Paran\u00e1"});
Java
jsonp({"cep":"02846010","logradouro":"Estrada L\u00e1zaro Am\u00e2ncio de Barros","bairro":"Vila Itaberaba","cidade":"S\u00e3o Paulo","uf":"SP","estado":"S\u00e3o Paulo"});
Java
jsonp({"cep":"96506661","logradouro":"Rua Batista Carlos","bairro":"Barcelos","cidade":"Cachoeira do Sul","uf":"RS","estado":"Rio Grande do Sul"});
Java
jsonp({"cep":"35171331","logradouro":"Rua Rio Branco","bairro":"Amaro Lanari","cidade":"Coronel Fabriciano","uf":"MG","estado":"Minas Gerais"});
Java
jsonp({"cep":"25730410","logradouro":"Avenida Country Club","bairro":"Nogueira","cidade":"Petr\u00f3polis","uf":"RJ","estado":"Rio de Janeiro"});
Java
jsonp({"cep":"70377070","logradouro":"Quadra SQS 114 Bloco G","bairro":"Asa Sul","cidade":"Bras\u00edlia","uf":"DF","estado":"Distrito Federal"});
Java
jsonp({"cep":"36070570","logradouro":"Rua Jo\u00e3o Surerus J\u00fanior","bairro":"Lourdes","cidade":"Juiz de Fora","uf":"MG","estado":"Minas Gerais"});
Java
$(document).ready( function () { // Add return on top button $('body').append('<div id="returnOnTop" title="Retour en haut">&nbsp;</div>'); // On button click, let's scroll up to top $('#returnOnTop').click( function() { $('html,body').animate({scrollTop: 0}, 'slow'); }); }); $(window).scroll(function() { // If on top fade the bouton out, else fade it in if ( $(window).scrollTop() == 0 ) $('#returnOnTop').fadeOut(); else $('#returnOnTop').fadeIn(); });
Java
jsonp({"cep":"40060240","logradouro":"Rua do Sodr\u00e9","bairro":"Dois de Julho","cidade":"Salvador","uf":"BA","estado":"Bahia"});
Java
<!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Re: [Partido Pirata] Res: Reunião do Partido Pirat a</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="apple-touch-icon" sizes="114x114" href="https://www.mail-archive.com/apple-touch-icon-114x114.png"> <link rel="apple-touch-icon" sizes="72x72" href="https://www.mail-archive.com/apple-touch-icon-72x72.png"> <link rel="apple-touch-icon" sizes="57x57" href="https://www.mail-archive.com/apple-touch-icon-57x57.png"> <link rel="shortcut icon" href="https://www.mail-archive.com/favicon.ico"> <link rel="contents" href="https://www.mail-archive.com/listapirata@listas.partidopirata.org/thrd2.html#00751" id="c"> <link rel="index" href="https://www.mail-archive.com/listapirata@listas.partidopirata.org/maillist.html#00751" id="i"> <link rel="prev" href="msg00750.html" id="p"> <link rel="next" href="msg00752.html" id="n"> <link rel="alternate" title="listapirata RSS" href="msg00751.html#" type="application/rss+xml"> <link rel="canonical" href="msg00751.html"> <link rel="stylesheet" href="https://www.mail-archive.com/normalize.css" media="screen"> <link rel="stylesheet" href="https://www.mail-archive.com/master.css" media="screen"> <!--[if lt IE 9]> <link rel="stylesheet" href="/ie.css" media="screen"> <![endif]--> </head> <body> <script language="javascript" type="text/javascript"> document.onkeydown = NavigateThrough; function NavigateThrough (event) { if (!document.getElementById) return; if (window.event) event = window.event; if (event.target.tagName == 'INPUT') return; var link = null; switch (event.keyCode ? event.keyCode : event.which ? event.which : null) { case 74: case 80: link = document.getElementById ('p'); break; case 75: case 78: link = document.getElementById ('n'); break; case 73: link = document.getElementById ('i'); break; case 67: link = document.getElementById ('c'); break; case 69: link = document.getElementById ('e'); break; } if (link && link.href) document.location = link.href; } </script> <div itemscope itemtype="http://schema.org/Article" class="container"> <div class="skipLink"> <a href="msg00751.html#nav">Skip to site navigation (Press enter)</a> </div> <div class="content" role="main"> <div class="msgHead"> <h1> <span class="subject"><a href="https://www.mail-archive.com/search?l=listapirata@listas.partidopirata.org&amp;q=subject:%22Re%5C%3A+%5C%5BPartido+Pirata%5C%5D%09Res%5C%3A+Reuni%C3%A3o+do+Partido+Pirat%09a%22&amp;o=newest" rel="nofollow"><span itemprop="name">Re: [Partido Pirata] Res: Reunião do Partido Pirat a</span></a></span> </h1> <p class="darkgray font13"> <span class="sender pipe"><a href="https://www.mail-archive.com/search?l=listapirata@listas.partidopirata.org&amp;q=from:%22Igor+Thiago%22" rel="nofollow"><span itemprop="author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">Igor Thiago</span></span></a></span> <span class="date"><a href="https://www.mail-archive.com/search?l=listapirata@listas.partidopirata.org&amp;q=date:20101229" rel="nofollow"><span itemprop="datePublished" content="2010-12-29T10:05:10-0800">Wed, 29 Dec 2010 10:05:10 -0800</span></a></span> </p> </div> <div itemprop="articleBody" class="msgBody"> <!--X-Body-of-Message--> <pre>&quot;Se for começar com baixaria, vou pedir pra todo mundo vestir a roupa e ir embora!&quot;</pre><pre> AHEUHAUHeAUhuaheuahuHAUHEuAHEUHAUEHuahuHAUEHeahuahuhUAHeuHAue -- Igor Thiago Vulcão da Silva Bach. em Ciência da Computação *Programador Java WEB Designer* Contato: (91) 8120-1949 E-mail: vulcaodevelo...@gmail.com MSN: thiagortven...@hotmail.com </pre><pre>_______________________________________________ Lista de discussão do Partido Pirata listapirata@listas.partidopirata.org <a rel="nofollow" href="http://listas.partidopirata.org/cgi-bin/mailman/listinfo/listapirata">http://listas.partidopirata.org/cgi-bin/mailman/listinfo/listapirata</a> <a rel="nofollow" href="http://listas.partidopirata.org/cgi-bin/mailman/listinfo">http://listas.partidopirata.org/cgi-bin/mailman/listinfo</a></pre> </div> <div class="msgButtons margintopdouble"> <ul class="overflow"> <li class="msgButtonItems"><a class="button buttonleft " accesskey="p" href="msg00750.html">Mensagem anterior</a></li> <li class="msgButtonItems textaligncenter"><a class="button" accesskey="c" href="https://www.mail-archive.com/listapirata@listas.partidopirata.org/thrd2.html#00751">Exibir por discuss&#0227;o</a></li> <li class="msgButtonItems textaligncenter"><a class="button" accesskey="i" href="https://www.mail-archive.com/listapirata@listas.partidopirata.org/maillist.html#00751">Exibir por data</a></li> <li class="msgButtonItems textalignright"><a class="button buttonright " accesskey="n" href="msg00752.html">Pr&#0243;xima mensagem</a></li> </ul> </div> <a name="tslice"></a> <div class="tSliceList margintopdouble"> <ul class="icons monospace"> <li class="icons-email"><span class="subject"><a href="msg00610.html">[Partido Pirata] Res: Reunião do Parti...</a></span> <span class="sender italic">Raphael S. Lapa</span></li> <li class="icons-email"><span class="subject"><a href="msg00611.html">Re: [Partido Pirata] Res: Reunião do Pa...</a></span> <span class="sender italic">Simone Vollbrecht</span></li> <li class="icons-email"><span class="subject"><a href="msg00617.html">Re: [Partido Pirata] Res: Reunião do Pa...</a></span> <span class="sender italic">Alessandro Delgado</span></li> <li class="icons-email"><span class="subject"><a href="msg00620.html">Re: [Partido Pirata] Res: Reunião do Pa...</a></span> <span class="sender italic">Felipe Barros</span></li> <li class="icons-email"><span class="subject"><a href="msg00738.html">Re: [Partido Pirata] Res: Reunião do Pa...</a></span> <span class="sender italic">Diogo Leal</span></li> <li class="icons-email"><span class="subject"><a href="msg00739.html">Re: [Partido Pirata] Res: Reunião do Pa...</a></span> <span class="sender italic">Arteiro Marcial</span></li> <li class="icons-email"><span class="subject"><a href="msg00744.html">Re: [Partido Pirata] Res: Reunião do Pa...</a></span> <span class="sender italic">Igor Thiago</span></li> <li class="icons-email"><span class="subject"><a href="msg00747.html">Re: [Partido Pirata] Res: Reunião do Pa...</a></span> <span class="sender italic">cinco</span></li> <li class="icons-email"><span class="subject"><a href="msg00748.html">Re: [Partido Pirata] Res: Reunião do Pa...</a></span> <span class="sender italic">Luiz Felipe</span></li> <li class="icons-email"><span class="subject"><a href="msg00750.html">Re: [Partido Pirata] Res: Reunião do Pa...</a></span> <span class="sender italic">Ricardo da Costa Lima</span></li> <li class="icons-email tSliceCur"><span class="subject">Re: [Partido Pirata] Res: Reunião do Pa...</span> <span class="sender italic">Igor Thiago</span></li> <li class="icons-email"><span class="subject"><a href="msg00752.html">Re: [Partido Pirata] Res: Reunião do Pa...</a></span> <span class="sender italic">Luiz Felipe</span></li> <li class="icons-email"><span class="subject"><a href="msg00753.html">Re: [Partido Pirata] Res: Reunião do Pa...</a></span> <span class="sender italic">Igor Thiago</span></li> <li class="icons-email"><span class="subject"><a href="msg00755.html">Re: [Partido Pirata] Res: Reunião do Pa...</a></span> <span class="sender italic">Luiz Felipe</span></li> <li class="icons-email"><span class="subject"><a href="msg00756.html">Re: [Partido Pirata] Res: Reunião do Pa...</a></span> <span class="sender italic">Luiz Felipe</span></li> <li class="icons-email"><span class="subject"><a href="msg00760.html">Re: [Partido Pirata] Res: Reunião do Pa...</a></span> <span class="sender italic">Daniel Siqueira - debatevisual.com</span></li> <li class="icons-email"><span class="subject"><a href="msg00749.html">[Partido Pirata] Res: Res: Reunião do ...</a></span> <span class="sender italic">Raphael S. Lapa</span></li> </ul> </ul> </ul> </ul> </ul> </ul> </ul> </ul> </div> <div class="overflow msgActions margintopdouble"> <div class="msgReply" > <h2> Responder a </h2> <form method="POST" action="https://www.mail-archive.com/mailto.php"> <input type="hidden" name="subject" value="Re: [Partido Pirata] Res: Reunião do Partido Pirat a"> <input type="hidden" name="msgid" value="AANLkTikH9hnLKUoFtf28-h06P2RU=HbCdW_B9G4Lm6=N@mail.gmail.com"> <input type="hidden" name="relpath" value="listapirata@listas.partidopirata.org/msg00751.html"> <input type="submit" value=" Igor Thiago "> </form> </div> </div> </div> <div class="aside" role="complementary"> <div class="logo"> <a href="https://www.mail-archive.com/"><img src="https://www.mail-archive.com/logo.png" width=247 height=88 alt="The Mail Archive"></a> </div> <form class="overflow" action="https://www.mail-archive.com/search" method="get"> <input type="hidden" name="l" value="listapirata@listas.partidopirata.org"> <label class="hidden" for="q">Search the site</label> <input class="submittext" type="text" id="q" name="q" placeholder="Pesquisar listapirata"> <input class="submitbutton" name="submit" type="image" src="https://www.mail-archive.com/submit.png" alt="Submit"> </form> <div class="nav margintop" id="nav" role="navigation"> <ul class="icons font16"> <li class="icons-home"><a href="https://www.mail-archive.com/">In&#0237;cio do Arquivo de Correio</a></li> <li class="icons-list"><a href="index.html" title="c">listapirata - Todas as mensagens</a></li> <li class="icons-about"><a href="https://www.mail-archive.com/listapirata@listas.partidopirata.org/info.html">listapirata - Acerca da lista</a></li> <li class="icons-expand"><a href="https://www.mail-archive.com/search?l=listapirata@listas.partidopirata.org&amp;q=subject:%22Re%5C%3A+%5C%5BPartido+Pirata%5C%5D%09Res%5C%3A+Reuni%C3%A3o+do+Partido+Pirat%09a%22&amp;o=newest&amp;f=1" title="e" id="e">Expandir</a></li> <li class="icons-prev"><a href="msg00750.html" title="p">Mensagem anterior</a></li> <li class="icons-next"><a href="msg00752.html" title="n">Pr&#0243;xima mensagem</a></li> </ul> </div> <div class="listlogo margintopdouble"> <a href="msg00751.html#"><img src="https://www.mail-archive.com/listapirata@listas.partidopirata.org/logo.png" alt="listapirata"></a> </div> <div class="margintopdouble"> </div> </div> </div> <div class="footer" role="contentinfo"> <ul> <li><a href="https://www.mail-archive.com/">In&#0237;cio do Arquivo de Correio</a></li> <li><a href="https://www.mail-archive.com/faq.html#newlist">Adicione a sua lista de discuss&#0227;o</a></li> <li><a href="https://www.mail-archive.com/faq.html">Perguntas Mais Frequentes</a></li> <li><a href="https://www.mail-archive.com/faq.html#support">Apoio</a></li> <li><a href="https://www.mail-archive.com/faq.html#privacy">Privacidade</a></li> <li class="darkgray">AANLkTikH9hnLKUoFtf28-h06P2RU=HbCdW_B9G4Lm6=N@mail.gmail.com</li> </ul> </div> </body> </html>
Java
jsonp({"cep":"08671155","logradouro":"Rua Luciano de Godoi","bairro":"Jardim M\u00e1rcia","cidade":"Suzano","uf":"SP","estado":"S\u00e3o Paulo"});
Java
jsonp({"cep":"80820132","logradouro":"Jardinete Aline de Souza Thomaszeck","bairro":"Vista Alegre","cidade":"Curitiba","uf":"PR","estado":"Paran\u00e1"});
Java
jsonp({"cep":"07176635","logradouro":"Rua Jo\u00e3o Garcia e Garcia","bairro":"Jardim \u00c1lamo","cidade":"Guarulhos","uf":"SP","estado":"S\u00e3o Paulo"});
Java
const electron = require('electron') const app = electron.app const BrowserWindow = electron.BrowserWindow const {ipcMain} = require('electron') const {dialog} = require('electron') const {Menu} = require('electron') import {enableLiveReload} from 'electron-compile' const path = require('path') const url = require('url') const fs = require('fs') enableLiveReload() //Window Creation var windowArray = [] exports.windowCount = 0 function createWindow () { // Create the new browser window. windowArray.push( new BrowserWindow({width: 800, height: 600}) ) exports.windowCount = windowArray.length var newWindow = windowArray[exports.windowCount-1] // windowArray[windowCount-1].maximize() // and load the index.html of the app. newWindow.loadURL(url.format({ pathname: path.join(__dirname, 'html/index.html'), protocol: 'file:', slashes: true })) // Emitted when the window is closed. newWindow.on('closed', function () { newWindow = null }) } app.on('ready', createWindow) app.on('window-all-closed', function () { if (process.platform !== 'darwin') { app.quit() } }) // app.on('activate', function () { // // On OS X it's common to re-create a window in the app when the // // dock icon is clicked and there are no other windows open. // if (mainWindow === null) { // createWindow() // } // }) //Menus var template = [ { label: 'File', submenu: [ {label: 'New Project'}, {label: 'Open Project'}, {label: 'Import File'}, {type: 'separator'}, {label: 'Save'}, {label: 'Save As'}, {label: 'Settings'} ] }, { label: 'Edit', submenu: [ {role: 'undo'}, {role: 'redo'}, {type: 'separator'}, {role: 'cut'}, {role: 'copy'}, {role: 'paste'}, {role: 'delete'}, {role: 'selectall'} ] }, { label: 'Window', submenu: [ {label: 'New Window', click: createWindow}, {role: 'minimize'}, {type: 'separator'}, {role: 'toggledevtools'}, {role: 'close'} ] }, ] var mainMenu = Menu.buildFromTemplate(template) Menu.setApplicationMenu(mainMenu) //File Functions function importFile (event) { dialog.showOpenDialog({properties: ['openFile', 'multiSelections']}, (filePaths) => { console.log(filePaths) event.sender.send('importer', filePaths) }) } //IPC Functions ipcMain.on('window-manager', (event, arg) => { console.log(arg) if (arg == "New Window") { //Create new window createWindow() } }) ipcMain.on('file-manager', (event, arg) => { console.log(arg) if (arg == "Import Files") { importFile(event) } })
Java
from cStringIO import StringIO from struct import pack, unpack, error as StructError from .log import log from .structures import fields class DBFile(object): """ Base class for WDB and DBC files """ @classmethod def open(cls, file, build, structure, environment): if isinstance(file, basestring): file = open(file, "rb") instance = cls(file, build, environment) instance._readHeader() instance.setStructure(structure) instance._rowDynamicFields = 0 # Dynamic fields index, used when parsing a row instance._readAddresses() return instance def __init__(self, file=None, build=None, environment=None): self._addresses = {} self._values = {} self.file = file self.build = build self.environment = environment def __repr__(self): return "%s(file=%r, build=%r)" % (self.__class__.__name__, self.file, self.build) def __contains__(self, id): return id in self._addresses def __getitem__(self, item): if isinstance(item, slice): keys = sorted(self._addresses.keys())[item] return [self[k] for k in keys] if item not in self._values: self._parse_row(item) return self._values[item] def __setitem__(self, item, value): if not isinstance(item, int): raise TypeError("DBFile indices must be integers, not %s" % (type(item))) if isinstance(value, DBRow): self._values[item] = value self._addresses[item] = -1 else: # FIXME technically we should allow DBRow, but this is untested and will need resetting parent raise TypeError("Unsupported type for DBFile.__setitem__: %s" % (type(value))) def __delitem__(self, item): if item in self._values: del self._values[item] del self._addresses[item] def __iter__(self): return self._addresses.__iter__() def __len__(self): return len(self._addresses) def _add_row(self, id, address, reclen): if id in self._addresses: # Something's wrong here log.warning("Multiple instances of row %r found in %s" % (id, self.file.name)) self._addresses[id] = (address, reclen) def _parse_field(self, data, field, row=None): """ Parse a single field in stream. """ if field.dyn > self._rowDynamicFields: return None # The column doesn't exist in this row, we set it to None ret = None try: if isinstance(field, fields.StringField): ret = self._parse_string(data) elif isinstance(field, fields.DataField): # wowcache.wdb length = getattr(row, field.master) ret = data.read(length) elif isinstance(field, fields.DynamicMaster): ret, = unpack("<I", data.read(4)) self._rowDynamicFields = ret else: ret, = unpack("<%s" % (field.char), data.read(field.size)) except StructError: log.warning("Field %s could not be parsed properly" % (field)) ret = None return ret def supportsSeeking(self): return hasattr(self.file, "seek") def append(self, row): """ Append a row at the end of the file. If the row does not have an id, one is automatically assigned. """ i = len(self) + 1 # FIXME this wont work properly in incomplete files if "_id" not in row: row["_id"] = i self[i] = row def clear(self): """ Delete every row in the file """ for k in self.keys(): # Use key, otherwise we get RuntimeError: dictionary changed size during iteration del self[k] def keys(self): return self._addresses.keys() def items(self): return [(k, self[k]) for k in self] def parse_row(self, data, reclen=0): """ Assign data to a DBRow instance """ return DBRow(self, data=data, reclen=reclen) def values(self): """ Return a list of the file's values """ return [self[id] for id in self] def setRow(self, key, **values): self.__setitem__(key, DBRow(self, columns=values)) def size(self): if hasattr(self.file, "size"): return self.file.size() elif isinstance(self.file, file): from os.path import getsize return getsize(self.file.name) raise NotImplementedError def update(self, other): """ Update file from iterable other """ for k in other: self[k] = other[k] def write(self, filename=""): """ Write the file data on disk. If filename is not given, use currently opened file. """ _filename = filename or self.file.name data = self.header.data() + self.data() + self.eof() f = open(_filename, "wb") # Don't open before calling data() as uncached rows would be empty f.write(data) f.close() log.info("Written %i bytes at %s" % (len(data), f.name)) if not filename: # Reopen self.file, we modified it # XXX do we need to wipe self._values here? self.file.close() self.file = open(f.name, "rb") class DBRow(list): """ A database row. Names of the variables of that class should not be used in field names of structures """ initialized = False def __init__(self, parent, data=None, columns=None, reclen=0): self._parent = parent self._values = {} # Columns values storage self.structure = parent.structure self.initialized = True # needed for __setattr__ if columns: if type(columns) == list: self.extend(columns) elif type(columns) == dict: self._default() _cols = [k.name for k in self.structure] for k in columns: try: self[_cols.index(k)] = columns[k] except ValueError: log.warning("Column %r not found" % (k)) elif data: dynfields = 0 data = StringIO(data) for field in self.structure: _data = parent._parse_field(data, field, self) self.append(_data) if reclen: real_reclen = reclen + self._parent.row_header_size if data.tell() != real_reclen: log.warning("Reclen not respected for row %r. Expected %i, read %i. (%+i)" % (self.id, real_reclen, data.tell(), real_reclen-data.tell())) def __dir__(self): result = self.__dict__.keys() result.extend(self.structure.column_names) return result def __getattr__(self, attr): if attr in self.structure: return self._get_value(attr) if attr in self.structure._abstractions: # Union abstractions etc field, func = self.structure._abstractions[attr] return func(field, self) if "__" in attr: return self._query(attr) return super(DBRow, self).__getattribute__(attr) def __int__(self): return self.id def __setattr__(self, attr, value): # Do not preserve the value in DBRow! Use the save method to save. if self.initialized and attr in self.structure: self._set_value(attr, value) return super(DBRow, self).__setattr__(attr, value) def __setitem__(self, index, value): if not isinstance(index, int): raise TypeError("Expected int instance, got %s instead (%r)" % (type(index), index)) list.__setitem__(self, index, value) col = self.structure[index] self._values[col.name] = col.to_python(value, row=self) def _get_reverse_relation(self, table, field): """ Return a list of rows matching the reverse relation """ if not hasattr(self._parent, "_reverse_relation_cache"): self._parent._reverse_relation_cache = {} cache = self._parent._reverse_relation_cache tfield = table + "__" + field if tfield not in cache: cache[tfield] = {} # First time lookup, let's build the cache table = self._parent.environment.dbFile(table) for row in table: row = table[row] id = row._raw(field) if id not in cache[tfield]: cache[tfield][id] = [] cache[tfield][id].append(row) return cache[tfield].get(self.id, None) def _matches(self, **kwargs): for k, v in kwargs.items(): if not self._query(k, v): return False return True def _query(self, rel, value=None): """ Parse a django-like multilevel relationship """ rels = rel.split("__") if "" in rels: # empty string raise ValueError("Invalid relation string") first = rels[0] if not hasattr(self, first): if self._parent.environment.hasDbFile(first): # Handle reverse relations, eg spell__item for item table remainder = rel[len(first + "__"):] return self._get_reverse_relation(first, remainder) raise ValueError("Invalid relation string") ret = self rels = rels[::-1] special = { "contains": lambda x, y: x in y, "exact": lambda x, y: x == y, "icontains": lambda x, y: x.lower() in y.lower(), "iexact": lambda x, y: x.lower() == y.lower(), "gt": lambda x, y: x > y, "gte": lambda x, y: x >= y, "lt": lambda x, y: x < y, "lte": lambda x, y: x <= y, } while rels: if rels[-1] in special: if len(rels) != 1: # icontains always needs to be the last piece of the relation string raise ValueError("Invalid relation string") return special[rels[-1]](value, ret) else: ret = getattr(ret, rels.pop()) return ret def _set_value(self, name, value): index = self.structure.index(name) col = self.structure[index] self._values[name] = col.to_python(value, self) self[index] = value def _get_value(self, name): if name not in self._values: raw_value = self[self.structure.index(name)] self._set_value(name, raw_value) return self._values[name] def _raw(self, name): """ Returns the raw value from field 'name' """ index = self.structure.index(name) return self[index] def _save(self): for name in self._values: index = self.structure.index(name) col = self.structure[index] self[index] = col.from_python(self._values[name]) def _field(self, name): """ Returns the field 'name' """ index = self.structure.index(name) return self.structure[index] def _default(self): """ Change all fields to their default values """ del self[:] self._values = {} for col in self.structure: char = col.char if col.dyn: self.append(None) elif char == "s": self.append("") elif char == "f": self.append(0.0) else: self.append(0) def dict(self): """ Return a dict of the row as colname: value """ return dict(zip(self.structure.column_names, self)) def update(self, other): for k in other: self[k] = other[k] @property def id(self): "Temporary hack to transition between _id and id" return self._id
Java
<!DOCTYPE html> <html lang="" xml:lang=""> <head> <meta charset="utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <title>Chapter 8 Statistical significance and p-values | APS 240: Data Analysis and Statistics with R</title> <meta name="description" content="Course book for Data Analysis and Statistics with R (APS 240) in the Department of Animal and Plant Sciences, University of Sheffield" /> <meta name="generator" content="bookdown 0.21 and GitBook 2.6.7" /> <meta property="og:title" content="Chapter 8 Statistical significance and p-values | APS 240: Data Analysis and Statistics with R" /> <meta property="og:type" content="book" /> <meta property="og:description" content="Course book for Data Analysis and Statistics with R (APS 240) in the Department of Animal and Plant Sciences, University of Sheffield" /> <meta name="github-repo" content="dzchilds/stats-for-bio" /> <meta name="twitter:card" content="summary" /> <meta name="twitter:title" content="Chapter 8 Statistical significance and p-values | APS 240: Data Analysis and Statistics with R" /> <meta name="twitter:description" content="Course book for Data Analysis and Statistics with R (APS 240) in the Department of Animal and Plant Sciences, University of Sheffield" /> <meta name="author" content="Dylan Z. Childs, Bethan J. Hindle and Philip H. Warren" /> <meta name="date" content="2021-01-14" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="apple-mobile-web-app-capable" content="yes" /> <meta name="apple-mobile-web-app-status-bar-style" content="black" /> <link rel="prev" href="sampling-error.html"/> <link rel="next" href="statistical-comparisons.html"/> <script src="libs/header-attrs-2.5/header-attrs.js"></script> <script src="libs/jquery-2.2.3/jquery.min.js"></script> <link href="libs/gitbook-2.6.7/css/style.css" rel="stylesheet" /> <link href="libs/gitbook-2.6.7/css/plugin-table.css" rel="stylesheet" /> <link href="libs/gitbook-2.6.7/css/plugin-bookdown.css" rel="stylesheet" /> <link href="libs/gitbook-2.6.7/css/plugin-highlight.css" rel="stylesheet" /> <link href="libs/gitbook-2.6.7/css/plugin-search.css" rel="stylesheet" /> <link href="libs/gitbook-2.6.7/css/plugin-fontsettings.css" rel="stylesheet" /> <link href="libs/gitbook-2.6.7/css/plugin-clipboard.css" rel="stylesheet" /> <link href="libs/anchor-sections-1.0/anchor-sections.css" rel="stylesheet" /> <script src="libs/anchor-sections-1.0/anchor-sections.js"></script> <style type="text/css"> .warning-box { border: 3px solid #e60000; margin: 25px; padding: 10px 10px 5px 10px; border-radius: 6px 6px 6px 6px; } .advanced-box { border: 3px solid #268bd2; margin: 25px; padding: 10px 10px 5px 10px; border-radius: 6px 6px 6px 6px; } .do-something { border: 3px solid #803e00; margin: 25px; padding: 10px 10px 5px 10px; border-radius: 6px 6px 6px 6px; } </style> <style type="text/css"> pre > code.sourceCode { white-space: pre; position: relative; } pre > code.sourceCode > span { display: inline-block; line-height: 1.25; } pre > code.sourceCode > span:empty { height: 1.2em; } code.sourceCode > span { color: inherit; text-decoration: inherit; } pre.sourceCode { margin: 0; } @media screen { div.sourceCode { overflow: auto; } } @media print { pre > code.sourceCode { white-space: pre-wrap; } pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; } } pre.numberSource code { counter-reset: source-line 0; } pre.numberSource code > span { position: relative; left: -4em; counter-increment: source-line; } pre.numberSource code > span > a:first-child::before { content: counter(source-line); position: relative; left: -1em; text-align: right; vertical-align: baseline; border: none; display: inline-block; -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; padding: 0 4px; width: 4em; color: #aaaaaa; } pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; } div.sourceCode { } @media screen { pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; } } code span.al { color: #ff0000; font-weight: bold; } /* Alert */ code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */ code span.at { color: #7d9029; } /* Attribute */ code span.bn { color: #40a070; } /* BaseN */ code span.bu { } /* BuiltIn */ code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */ code span.ch { color: #4070a0; } /* Char */ code span.cn { color: #880000; } /* Constant */ code span.co { color: #60a0b0; font-style: italic; } /* Comment */ code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */ code span.do { color: #ba2121; font-style: italic; } /* Documentation */ code span.dt { color: #902000; } /* DataType */ code span.dv { color: #40a070; } /* DecVal */ code span.er { color: #ff0000; font-weight: bold; } /* Error */ code span.ex { } /* Extension */ code span.fl { color: #40a070; } /* Float */ code span.fu { color: #06287e; } /* Function */ code span.im { } /* Import */ code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */ code span.kw { color: #007020; font-weight: bold; } /* Keyword */ code span.op { color: #666666; } /* Operator */ code span.ot { color: #007020; } /* Other */ code span.pp { color: #bc7a00; } /* Preprocessor */ code span.sc { color: #4070a0; } /* SpecialChar */ code span.ss { color: #bb6688; } /* SpecialString */ code span.st { color: #4070a0; } /* String */ code span.va { color: #19177c; } /* Variable */ code span.vs { color: #4070a0; } /* VerbatimString */ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */ </style> <link rel="stylesheet" href="style.css" type="text/css" /> </head> <body> <div class="book without-animation with-summary font-size-2 font-family-1" data-basepath="."> <div class="book-summary"> <nav role="navigation"> <ul class="summary"> <li><a href="./">APS 240</a></li> <li class="divider"></li> <li class="chapter" data-level="1" data-path="index.html"><a href="index.html"><i class="fa fa-check"></i><b>1</b> Course information and overview</a> <ul> <li class="chapter" data-level="1.1" data-path="index.html"><a href="index.html#why-data-analysis"><i class="fa fa-check"></i><b>1.1</b> Why do a data analysis course?</a></li> <li class="chapter" data-level="1.2" data-path="index.html"><a href="index.html#overview"><i class="fa fa-check"></i><b>1.2</b> Course overview</a> <ul> <li class="chapter" data-level="1.2.1" data-path="index.html"><a href="index.html#aims"><i class="fa fa-check"></i><b>1.2.1</b> Aims</a></li> <li class="chapter" data-level="1.2.2" data-path="index.html"><a href="index.html#objectives"><i class="fa fa-check"></i><b>1.2.2</b> Objectives</a></li> <li class="chapter" data-level="1.2.3" data-path="index.html"><a href="index.html#assumed-background"><i class="fa fa-check"></i><b>1.2.3</b> Assumed background</a></li> <li class="chapter" data-level="1.2.4" data-path="index.html"><a href="index.html#methods"><i class="fa fa-check"></i><b>1.2.4</b> Methods</a></li> <li class="chapter" data-level="1.2.5" data-path="index.html"><a href="index.html#what-do-you-need-to-learn"><i class="fa fa-check"></i><b>1.2.5</b> What do you need to learn?</a></li> <li class="chapter" data-level="1.2.6" data-path="index.html"><a href="index.html#what-is-required-of-you"><i class="fa fa-check"></i><b>1.2.6</b> What is required of you?</a></li> </ul></li> <li class="chapter" data-level="1.3" data-path="index.html"><a href="index.html#how-to-use-the-teaching-material"><i class="fa fa-check"></i><b>1.3</b> How to use the teaching material</a> <ul> <li class="chapter" data-level="1.3.1" data-path="index.html"><a href="index.html#printed-material"><i class="fa fa-check"></i><b>1.3.1</b> The online course book</a></li> <li class="chapter" data-level="1.3.2" data-path="index.html"><a href="index.html#how-to-make-best-use-of-it"><i class="fa fa-check"></i><b>1.3.2</b> How to make best use of the teaching material</a></li> <li class="chapter" data-level="1.3.3" data-path="index.html"><a href="index.html#conventions"><i class="fa fa-check"></i><b>1.3.3</b> Conventions used in the course material</a></li> <li class="chapter" data-level="1.3.4" data-path="index.html"><a href="index.html#feedback"><i class="fa fa-check"></i><b>1.3.4</b> Feedback</a></li> <li class="chapter" data-level="1.3.5" data-path="index.html"><a href="index.html#overall"><i class="fa fa-check"></i><b>1.3.5</b> Overall…</a></li> </ul></li> <li class="chapter" data-level="1.4" data-path="index.html"><a href="index.html#health-and-safety"><i class="fa fa-check"></i><b>1.4</b> Health and safety using display screen equipment</a></li> </ul></li> <li class="chapter" data-level="2" data-path="expected-learning.html"><a href="expected-learning.html"><i class="fa fa-check"></i><b>2</b> Expected learning outcomes</a> <ul> <li class="chapter" data-level="2.1" data-path="expected-learning.html"><a href="expected-learning.html#collecting-and-using-data"><i class="fa fa-check"></i><b>2.1</b> Collecting and using data</a></li> <li class="chapter" data-level="2.2" data-path="expected-learning.html"><a href="expected-learning.html#statistical-concepts"><i class="fa fa-check"></i><b>2.2</b> Statistical Concepts</a></li> <li class="chapter" data-level="2.3" data-path="expected-learning.html"><a href="expected-learning.html#simple-parametric-statistics"><i class="fa fa-check"></i><b>2.3</b> Simple parametric statistics</a></li> <li class="chapter" data-level="2.4" data-path="expected-learning.html"><a href="expected-learning.html#regression-and-anova"><i class="fa fa-check"></i><b>2.4</b> Regression and ANOVA</a></li> <li class="chapter" data-level="2.5" data-path="expected-learning.html"><a href="expected-learning.html#doing-more-with-models"><i class="fa fa-check"></i><b>2.5</b> Doing more with models</a></li> <li class="chapter" data-level="2.6" data-path="expected-learning.html"><a href="expected-learning.html#experimental-design"><i class="fa fa-check"></i><b>2.6</b> Experimental design</a></li> <li class="chapter" data-level="2.7" data-path="expected-learning.html"><a href="expected-learning.html#beyond-simple-models"><i class="fa fa-check"></i><b>2.7</b> Beyond simple models</a></li> <li class="chapter" data-level="2.8" data-path="expected-learning.html"><a href="expected-learning.html#frequency-data-and-non-parameteric-tests"><i class="fa fa-check"></i><b>2.8</b> Frequency data and non-parameteric tests</a></li> </ul></li> <li class="chapter" data-level="3" data-path="prerequisites.html"><a href="prerequisites.html"><i class="fa fa-check"></i><b>3</b> Programming prerequisites</a> <ul> <li class="chapter" data-level="3.1" data-path="prerequisites.html"><a href="prerequisites.html#starting-a-learnr-tutorial"><i class="fa fa-check"></i><b>3.1</b> Starting a <strong>learnr</strong> tutorial</a></li> <li class="chapter" data-level="3.2" data-path="prerequisites.html"><a href="prerequisites.html#using-packages"><i class="fa fa-check"></i><b>3.2</b> Using packages</a></li> <li class="chapter" data-level="3.3" data-path="prerequisites.html"><a href="prerequisites.html#reading-data-into-r"><i class="fa fa-check"></i><b>3.3</b> Reading data into R</a></li> </ul></li> <li class="part"><span><b>I Collecting and Using Data</b></span></li> <li class="chapter" data-level="4" data-path="scientific-process.html"><a href="scientific-process.html"><i class="fa fa-check"></i><b>4</b> The scientific process</a> <ul> <li class="chapter" data-level="4.1" data-path="scientific-process.html"><a href="scientific-process.html#stages-scientific-process"><i class="fa fa-check"></i><b>4.1</b> Stages in the scientific process</a> <ul> <li class="chapter" data-level="4.1.1" data-path="scientific-process.html"><a href="scientific-process.html#stages-observations"><i class="fa fa-check"></i><b>4.1.1</b> Observations</a></li> <li class="chapter" data-level="4.1.2" data-path="scientific-process.html"><a href="scientific-process.html#stages-questions"><i class="fa fa-check"></i><b>4.1.2</b> Questions</a></li> <li class="chapter" data-level="4.1.3" data-path="scientific-process.html"><a href="scientific-process.html#stages-hypotheses"><i class="fa fa-check"></i><b>4.1.3</b> Hypotheses</a></li> <li class="chapter" data-level="4.1.4" data-path="scientific-process.html"><a href="scientific-process.html#stages-predictions"><i class="fa fa-check"></i><b>4.1.4</b> Predictions</a></li> </ul></li> <li class="chapter" data-level="4.2" data-path="scientific-process.html"><a href="scientific-process.html#an-example"><i class="fa fa-check"></i><b>4.2</b> An example</a></li> <li class="chapter" data-level="4.3" data-path="scientific-process.html"><a href="scientific-process.html#hypothesis-testing"><i class="fa fa-check"></i><b>4.3</b> Hypothesis testing</a></li> <li class="chapter" data-level="4.4" data-path="scientific-process.html"><a href="scientific-process.html#are-we-sure"><i class="fa fa-check"></i><b>4.4</b> Don’t we ever know anything for sure?</a></li> </ul></li> <li class="chapter" data-level="5" data-path="data-variables.html"><a href="data-variables.html"><i class="fa fa-check"></i><b>5</b> Data and variables</a> <ul> <li class="chapter" data-level="5.1" data-path="data-variables.html"><a href="data-variables.html#observations-on-material-and-obvious-things"><i class="fa fa-check"></i><b>5.1</b> “Observations on material and obvious things”</a></li> <li class="chapter" data-level="5.2" data-path="data-variables.html"><a href="data-variables.html#var-types"><i class="fa fa-check"></i><b>5.2</b> Revision: Types of variable</a> <ul> <li class="chapter" data-level="5.2.1" data-path="data-variables.html"><a href="data-variables.html#nominal-categorical-variables"><i class="fa fa-check"></i><b>5.2.1</b> Nominal (categorical) variables</a></li> <li class="chapter" data-level="5.2.2" data-path="data-variables.html"><a href="data-variables.html#ordinal-categorical-data"><i class="fa fa-check"></i><b>5.2.2</b> Ordinal (categorical) data</a></li> <li class="chapter" data-level="5.2.3" data-path="data-variables.html"><a href="data-variables.html#ratio-scale-numeric-variables"><i class="fa fa-check"></i><b>5.2.3</b> Ratio scale (numeric) variables</a></li> <li class="chapter" data-level="5.2.4" data-path="data-variables.html"><a href="data-variables.html#interval-scale-numeric-variables"><i class="fa fa-check"></i><b>5.2.4</b> Interval scale (numeric) variables</a></li> <li class="chapter" data-level="5.2.5" data-path="data-variables.html"><a href="data-variables.html#why-does-the-distinction-matter"><i class="fa fa-check"></i><b>5.2.5</b> Why does the distinction matter?</a></li> <li class="chapter" data-level="5.2.6" data-path="data-variables.html"><a href="data-variables.html#which-is-best"><i class="fa fa-check"></i><b>5.2.6</b> Which is best?</a></li> </ul></li> <li class="chapter" data-level="5.3" data-path="data-variables.html"><a href="data-variables.html#accuracy-precision"><i class="fa fa-check"></i><b>5.3</b> Accuracy and precision</a> <ul> <li class="chapter" data-level="5.3.1" data-path="data-variables.html"><a href="data-variables.html#what-do-they-mean"><i class="fa fa-check"></i><b>5.3.1</b> What do they mean?</a></li> <li class="chapter" data-level="5.3.2" data-path="data-variables.html"><a href="data-variables.html#implied-precision-significant-figures"><i class="fa fa-check"></i><b>5.3.2</b> Implied precision – significant figures</a></li> <li class="chapter" data-level="5.3.3" data-path="data-variables.html"><a href="data-variables.html#how-precise-should-measurements-be"><i class="fa fa-check"></i><b>5.3.3</b> How precise should measurements be?</a></li> <li class="chapter" data-level="5.3.4" data-path="data-variables.html"><a href="data-variables.html#error-bias-and-prejudice"><i class="fa fa-check"></i><b>5.3.4</b> Error, bias and prejudice</a></li> </ul></li> </ul></li> <li class="chapter" data-level="6" data-path="learning-from-data.html"><a href="learning-from-data.html"><i class="fa fa-check"></i><b>6</b> Learning from data</a> <ul> <li class="chapter" data-level="6.1" data-path="learning-from-data.html"><a href="learning-from-data.html#populations"><i class="fa fa-check"></i><b>6.1</b> Populations</a></li> <li class="chapter" data-level="6.2" data-path="learning-from-data.html"><a href="learning-from-data.html#learning-about-populations"><i class="fa fa-check"></i><b>6.2</b> Learning about populations</a></li> <li class="chapter" data-level="6.3" data-path="learning-from-data.html"><a href="learning-from-data.html#morph-example"><i class="fa fa-check"></i><b>6.3</b> A simple example</a></li> <li class="chapter" data-level="6.4" data-path="learning-from-data.html"><a href="learning-from-data.html#now-what"><i class="fa fa-check"></i><b>6.4</b> Now what?</a></li> </ul></li> <li class="part"><span><b>II Statistical Concepts</b></span></li> <li class="chapter" data-level="7" data-path="sampling-error.html"><a href="sampling-error.html"><i class="fa fa-check"></i><b>7</b> Sampling error</a> <ul> <li class="chapter" data-level="7.1" data-path="sampling-error.html"><a href="sampling-error.html#sampling-error-1"><i class="fa fa-check"></i><b>7.1</b> Sampling error</a></li> <li class="chapter" data-level="7.2" data-path="sampling-error.html"><a href="sampling-error.html#sampling-distributions"><i class="fa fa-check"></i><b>7.2</b> Sampling distributions</a></li> <li class="chapter" data-level="7.3" data-path="sampling-error.html"><a href="sampling-error.html#the-effect-of-sample-size"><i class="fa fa-check"></i><b>7.3</b> The effect of sample size</a></li> <li class="chapter" data-level="7.4" data-path="sampling-error.html"><a href="sampling-error.html#the-standard-error"><i class="fa fa-check"></i><b>7.4</b> The standard error</a></li> <li class="chapter" data-level="7.5" data-path="sampling-error.html"><a href="sampling-error.html#what-is-the-point-of-all-this"><i class="fa fa-check"></i><b>7.5</b> What is the point of all this?</a></li> </ul></li> <li class="chapter" data-level="8" data-path="statistical-significance-and-p-values.html"><a href="statistical-significance-and-p-values.html"><i class="fa fa-check"></i><b>8</b> Statistical significance and <em>p</em>-values</a> <ul> <li class="chapter" data-level="8.1" data-path="statistical-significance-and-p-values.html"><a href="statistical-significance-and-p-values.html#bootstrap"><i class="fa fa-check"></i><b>8.1</b> Estimating a sampling distribution</a> <ul> <li class="chapter" data-level="8.1.1" data-path="statistical-significance-and-p-values.html"><a href="statistical-significance-and-p-values.html#bootstrap-overview"><i class="fa fa-check"></i><b>8.1.1</b> Overview of bootstrapping</a></li> <li class="chapter" data-level="8.1.2" data-path="statistical-significance-and-p-values.html"><a href="statistical-significance-and-p-values.html#doing-it-for-real"><i class="fa fa-check"></i><b>8.1.2</b> Doing it for real</a></li> </ul></li> <li class="chapter" data-level="8.2" data-path="statistical-significance-and-p-values.html"><a href="statistical-significance-and-p-values.html#statistical-significance"><i class="fa fa-check"></i><b>8.2</b> Statistical significance</a> <ul> <li class="chapter" data-level="" data-path="statistical-significance-and-p-values.html"><a href="statistical-significance-and-p-values.html#carrying-out-the-assessment"><i class="fa fa-check"></i>Carrying out the assessment</a></li> <li class="chapter" data-level="" data-path="statistical-significance-and-p-values.html"><a href="statistical-significance-and-p-values.html#interpreting-the-p-value"><i class="fa fa-check"></i>Interpreting the p-value</a></li> </ul></li> <li class="chapter" data-level="8.3" data-path="statistical-significance-and-p-values.html"><a href="statistical-significance-and-p-values.html#concluding-remarks"><i class="fa fa-check"></i><b>8.3</b> Concluding remarks</a></li> </ul></li> <li class="chapter" data-level="9" data-path="statistical-comparisons.html"><a href="statistical-comparisons.html"><i class="fa fa-check"></i><b>9</b> Statistical comparisons</a> <ul> <li class="chapter" data-level="9.1" data-path="statistical-comparisons.html"><a href="statistical-comparisons.html#making-comparisons"><i class="fa fa-check"></i><b>9.1</b> Making comparisons</a> <ul> <li class="chapter" data-level="9.1.1" data-path="statistical-comparisons.html"><a href="statistical-comparisons.html#morph-weights-eg"><i class="fa fa-check"></i><b>9.1.1</b> A new example</a></li> <li class="chapter" data-level="9.1.2" data-path="statistical-comparisons.html"><a href="statistical-comparisons.html#examine-the-data"><i class="fa fa-check"></i><b>9.1.2</b> Examine the data</a></li> </ul></li> <li class="chapter" data-level="9.2" data-path="statistical-comparisons.html"><a href="statistical-comparisons.html#constructing-a-test"><i class="fa fa-check"></i><b>9.2</b> Constructing a test</a> <ul> <li class="chapter" data-level="9.2.1" data-path="statistical-comparisons.html"><a href="statistical-comparisons.html#permutation-tests"><i class="fa fa-check"></i><b>9.2.1</b> Permutation tests</a></li> <li class="chapter" data-level="9.2.2" data-path="statistical-comparisons.html"><a href="statistical-comparisons.html#carrying-out-a-permutation-test"><i class="fa fa-check"></i><b>9.2.2</b> Carrying out a permutation test</a></li> <li><a href="statistical-comparisons.html#calculating-the-p-value">Calculating the <em>p</em>-value</a></li> </ul></li> <li class="chapter" data-level="9.3" data-path="statistical-comparisons.html"><a href="statistical-comparisons.html#what-have-we-learned"><i class="fa fa-check"></i><b>9.3</b> What have we learned?</a></li> </ul></li> <li class="chapter" data-level="10" data-path="hypotheses-and-p-values.html"><a href="hypotheses-and-p-values.html"><i class="fa fa-check"></i><b>10</b> Hypotheses and <em>p</em>-values</a> <ul> <li class="chapter" data-level="10.1" data-path="hypotheses-and-p-values.html"><a href="hypotheses-and-p-values.html#a-few-words-about-the-null-hypothesis"><i class="fa fa-check"></i><b>10.1</b> A few words about the null hypothesis</a> <ul> <li class="chapter" data-level="10.1.1" data-path="hypotheses-and-p-values.html"><a href="hypotheses-and-p-values.html#hypotheses-and-null-hypotheses"><i class="fa fa-check"></i><b>10.1.1</b> Hypotheses and null hypotheses</a></li> <li class="chapter" data-level="10.1.2" data-path="hypotheses-and-p-values.html"><a href="hypotheses-and-p-values.html#report-the-null-hypothesis"><i class="fa fa-check"></i><b>10.1.2</b> Report the null hypothesis?</a></li> </ul></li> <li class="chapter" data-level="10.2" data-path="hypotheses-and-p-values.html"><a href="hypotheses-and-p-values.html#interpreting-and-reporting-p-values"><i class="fa fa-check"></i><b>10.2</b> Interpreting and reporting <em>p</em>-values</a> <ul> <li class="chapter" data-level="10.2.1" data-path="hypotheses-and-p-values.html"><a href="hypotheses-and-p-values.html#careful-with-those-p-values"><i class="fa fa-check"></i><b>10.2.1</b> Careful with those <em>p</em>-values</a></li> <li class="chapter" data-level="10.2.2" data-path="hypotheses-and-p-values.html"><a href="hypotheses-and-p-values.html#presenting-p-values"><i class="fa fa-check"></i><b>10.2.2</b> Presenting <em>p</em>-values</a></li> </ul></li> <li class="chapter" data-level="10.3" data-path="hypotheses-and-p-values.html"><a href="hypotheses-and-p-values.html#biological-vs.-statistical-significance"><i class="fa fa-check"></i><b>10.3</b> Biological vs. statistical significance</a></li> </ul></li> <li class="part"><span><b>III Simple Statistics</b></span></li> <li class="chapter" data-level="11" data-path="parametric-statistics.html"><a href="parametric-statistics.html"><i class="fa fa-check"></i><b>11</b> Parametric statistics</a> <ul> <li class="chapter" data-level="11.1" data-path="parametric-statistics.html"><a href="parametric-statistics.html#introduction"><i class="fa fa-check"></i><b>11.1</b> Introduction</a></li> <li class="chapter" data-level="11.2" data-path="parametric-statistics.html"><a href="parametric-statistics.html#math-models"><i class="fa fa-check"></i><b>11.2</b> Mathematical models</a></li> <li class="chapter" data-level="11.3" data-path="parametric-statistics.html"><a href="parametric-statistics.html#parametric-stats"><i class="fa fa-check"></i><b>11.3</b> The normal distribution</a> <ul> <li class="chapter" data-level="11.3.1" data-path="parametric-statistics.html"><a href="parametric-statistics.html#standard-error-of-the-mean"><i class="fa fa-check"></i><b>11.3.1</b> Standard error of the mean</a></li> <li class="chapter" data-level="11.3.2" data-path="parametric-statistics.html"><a href="parametric-statistics.html#the-t-distribution"><i class="fa fa-check"></i><b>11.3.2</b> The <em>t</em> distribution</a></li> </ul></li> </ul></li> <li class="chapter" data-level="12" data-path="one-sample-t-tests.html"><a href="one-sample-t-tests.html"><i class="fa fa-check"></i><b>12</b> One sample <em>t</em>-tests</a> <ul> <li class="chapter" data-level="12.1" data-path="one-sample-t-tests.html"><a href="one-sample-t-tests.html#when-do-we-use-one-sample-t-test"><i class="fa fa-check"></i><b>12.1</b> When do we use one-sample <em>t</em>-test?</a></li> <li class="chapter" data-level="12.2" data-path="one-sample-t-tests.html"><a href="one-sample-t-tests.html#how-does-the-one-sample-t-test-work"><i class="fa fa-check"></i><b>12.2</b> How does the one-sample <em>t</em>-test work?</a> <ul> <li class="chapter" data-level="12.2.1" data-path="one-sample-t-tests.html"><a href="one-sample-t-tests.html#assumptions-of-the-one-sample-t-test"><i class="fa fa-check"></i><b>12.2.1</b> Assumptions of the one-sample <em>t</em>-test</a></li> <li class="chapter" data-level="12.2.2" data-path="one-sample-t-tests.html"><a href="one-sample-t-tests.html#evaluating-the-assumptions"><i class="fa fa-check"></i><b>12.2.2</b> Evaluating the assumptions</a></li> </ul></li> <li class="chapter" data-level="12.3" data-path="one-sample-t-tests.html"><a href="one-sample-t-tests.html#carrying-out-a-one-sample-t-test-in-r"><i class="fa fa-check"></i><b>12.3</b> Carrying out a one-sample <em>t</em>-test in R</a> <ul> <li class="chapter" data-level="12.3.1" data-path="one-sample-t-tests.html"><a href="one-sample-t-tests.html#visualising-the-data-and-checking-the-assumptions"><i class="fa fa-check"></i><b>12.3.1</b> Visualising the data and checking the assumptions</a></li> <li class="chapter" data-level="12.3.2" data-path="one-sample-t-tests.html"><a href="one-sample-t-tests.html#carrying-out-the-test"><i class="fa fa-check"></i><b>12.3.2</b> Carrying out the test</a></li> <li class="chapter" data-level="12.3.3" data-path="one-sample-t-tests.html"><a href="one-sample-t-tests.html#summarising-the-result"><i class="fa fa-check"></i><b>12.3.3</b> Summarising the result</a></li> </ul></li> </ul></li> <li class="chapter" data-level="13" data-path="two-sample-t-test.html"><a href="two-sample-t-test.html"><i class="fa fa-check"></i><b>13</b> Two-sample <em>t</em>-test</a> <ul> <li class="chapter" data-level="13.1" data-path="two-sample-t-test.html"><a href="two-sample-t-test.html#when-do-we-use-a-two-sample-t-test"><i class="fa fa-check"></i><b>13.1</b> When do we use a two-sample <em>t</em>-test?</a></li> <li class="chapter" data-level="13.2" data-path="two-sample-t-test.html"><a href="two-sample-t-test.html#how-does-the-two-sample-t-test-work"><i class="fa fa-check"></i><b>13.2</b> How does the two-sample <em>t</em>-test work?</a> <ul> <li class="chapter" data-level="13.2.1" data-path="two-sample-t-test.html"><a href="two-sample-t-test.html#assumptions-of-the-two-sample-t-test"><i class="fa fa-check"></i><b>13.2.1</b> Assumptions of the two-sample <em>t</em>-test</a></li> <li class="chapter" data-level="13.2.2" data-path="two-sample-t-test.html"><a href="two-sample-t-test.html#evaluating-the-assumptions-1"><i class="fa fa-check"></i><b>13.2.2</b> Evaluating the assumptions</a></li> <li class="chapter" data-level="13.2.3" data-path="two-sample-t-test.html"><a href="two-sample-t-test.html#what-about-the-equal-variance-assumption"><i class="fa fa-check"></i><b>13.2.3</b> What about the <em>equal variance</em> assumption?</a></li> </ul></li> <li class="chapter" data-level="13.3" data-path="two-sample-t-test.html"><a href="two-sample-t-test.html#carrying-out-a-two-sample-t-test-in-r"><i class="fa fa-check"></i><b>13.3</b> Carrying out a two-sample <em>t</em>-test in R</a> <ul> <li class="chapter" data-level="13.3.1" data-path="two-sample-t-test.html"><a href="two-sample-t-test.html#visualising-the-data-and-checking-the-assumptions-1"><i class="fa fa-check"></i><b>13.3.1</b> Visualising the data and checking the assumptions</a></li> <li class="chapter" data-level="13.3.2" data-path="two-sample-t-test.html"><a href="two-sample-t-test.html#carrying-out-the-test-1"><i class="fa fa-check"></i><b>13.3.2</b> Carrying out the test</a></li> <li class="chapter" data-level="13.3.3" data-path="two-sample-t-test.html"><a href="two-sample-t-test.html#summarising-the-result-1"><i class="fa fa-check"></i><b>13.3.3</b> Summarising the result</a></li> </ul></li> </ul></li> <li class="chapter" data-level="14" data-path="a-correlation-test.html"><a href="a-correlation-test.html"><i class="fa fa-check"></i><b>14</b> A correlation test</a> <ul> <li class="chapter" data-level="14.1" data-path="a-correlation-test.html"><a href="a-correlation-test.html#pearsons-product-moment-correlation"><i class="fa fa-check"></i><b>14.1</b> Pearson’s product-moment correlation</a> <ul> <li class="chapter" data-level="14.1.1" data-path="a-correlation-test.html"><a href="a-correlation-test.html#pearsons-correlation-test"><i class="fa fa-check"></i><b>14.1.1</b> Pearson’s correlation test</a></li> </ul></li> <li class="chapter" data-level="14.2" data-path="a-correlation-test.html"><a href="a-correlation-test.html#pearsons-product-moment-correlation-coefficient-in-r"><i class="fa fa-check"></i><b>14.2</b> Pearson’s product-moment correlation coefficient in R</a> <ul> <li class="chapter" data-level="14.2.1" data-path="a-correlation-test.html"><a href="a-correlation-test.html#visualising-the-data-and-checking-the-assumptions-2"><i class="fa fa-check"></i><b>14.2.1</b> Visualising the data and checking the assumptions</a></li> <li class="chapter" data-level="14.2.2" data-path="a-correlation-test.html"><a href="a-correlation-test.html#doing-the-test"><i class="fa fa-check"></i><b>14.2.2</b> Doing the test</a></li> <li class="chapter" data-level="14.2.3" data-path="a-correlation-test.html"><a href="a-correlation-test.html#reporting-the-result"><i class="fa fa-check"></i><b>14.2.3</b> Reporting the result</a></li> </ul></li> <li class="chapter" data-level="14.3" data-path="a-correlation-test.html"><a href="a-correlation-test.html#next-steps"><i class="fa fa-check"></i><b>14.3</b> Next steps</a></li> </ul></li> <li class="part"><span><b>IV Regression and ANOVA</b></span></li> <li class="chapter" data-level="15" data-path="relationships-and-regression.html"><a href="relationships-and-regression.html"><i class="fa fa-check"></i><b>15</b> Relationships and regression</a> <ul> <li class="chapter" data-level="15.1" data-path="relationships-and-regression.html"><a href="relationships-and-regression.html#introduction-1"><i class="fa fa-check"></i><b>15.1</b> Introduction</a></li> <li class="chapter" data-level="15.2" data-path="relationships-and-regression.html"><a href="relationships-and-regression.html#what-does-linear-regression-do"><i class="fa fa-check"></i><b>15.2</b> What does linear regression do?</a></li> <li class="chapter" data-level="15.3" data-path="relationships-and-regression.html"><a href="relationships-and-regression.html#how-does-simple-linear-regression-work"><i class="fa fa-check"></i><b>15.3</b> How does simple linear regression work?</a> <ul> <li class="chapter" data-level="15.3.1" data-path="relationships-and-regression.html"><a href="relationships-and-regression.html#finding-the-best-fit-line"><i class="fa fa-check"></i><b>15.3.1</b> Finding the best fit line</a></li> </ul></li> <li class="chapter" data-level="15.4" data-path="relationships-and-regression.html"><a href="relationships-and-regression.html#what-do-you-get-out-of-a-regression"><i class="fa fa-check"></i><b>15.4</b> What do you get out of a regression?</a> <ul> <li class="chapter" data-level="15.4.1" data-path="relationships-and-regression.html"><a href="relationships-and-regression.html#interpreting-a-regression"><i class="fa fa-check"></i><b>15.4.1</b> Interpreting a regression</a></li> <li class="chapter" data-level="15.4.2" data-path="relationships-and-regression.html"><a href="relationships-and-regression.html#evaluating-hypotheses-inference"><i class="fa fa-check"></i><b>15.4.2</b> Evaluating hypotheses (‘inference’)</a></li> </ul></li> <li class="chapter" data-level="15.5" data-path="relationships-and-regression.html"><a href="relationships-and-regression.html#correlation-or-regression"><i class="fa fa-check"></i><b>15.5</b> Correlation or regression?</a></li> </ul></li> <li class="chapter" data-level="16" data-path="simple-regression-in-r.html"><a href="simple-regression-in-r.html"><i class="fa fa-check"></i><b>16</b> Simple regression in R</a> <ul> <li class="chapter" data-level="16.1" data-path="simple-regression-in-r.html"><a href="simple-regression-in-r.html#regression-in-R"><i class="fa fa-check"></i><b>16.1</b> Carrying out a simple linear regression in R</a></li> <li class="chapter" data-level="16.2" data-path="simple-regression-in-r.html"><a href="simple-regression-in-r.html#first-steps"><i class="fa fa-check"></i><b>16.2</b> First steps</a> <ul> <li class="chapter" data-level="16.2.1" data-path="simple-regression-in-r.html"><a href="simple-regression-in-r.html#visualising-the-data"><i class="fa fa-check"></i><b>16.2.1</b> Visualising the data</a></li> </ul></li> <li class="chapter" data-level="16.3" data-path="simple-regression-in-r.html"><a href="simple-regression-in-r.html#model-fitting-and-significance-tests"><i class="fa fa-check"></i><b>16.3</b> Model fitting and significance tests</a> <ul> <li class="chapter" data-level="16.3.1" data-path="simple-regression-in-r.html"><a href="simple-regression-in-r.html#extracting-a-little-more-information"><i class="fa fa-check"></i><b>16.3.1</b> Extracting a little more information</a></li> </ul></li> <li class="chapter" data-level="16.4" data-path="simple-regression-in-r.html"><a href="simple-regression-in-r.html#present-results"><i class="fa fa-check"></i><b>16.4</b> Presenting results</a> <ul> <li class="chapter" data-level="16.4.1" data-path="simple-regression-in-r.html"><a href="simple-regression-in-r.html#plotting-the-fitted-line-and-the-data"><i class="fa fa-check"></i><b>16.4.1</b> Plotting the fitted line and the data</a></li> </ul></li> <li class="chapter" data-level="16.5" data-path="simple-regression-in-r.html"><a href="simple-regression-in-r.html#regression-causation"><i class="fa fa-check"></i><b>16.5</b> What about causation?</a></li> </ul></li> <li class="chapter" data-level="17" data-path="introduction-to-one-way-anova.html"><a href="introduction-to-one-way-anova.html"><i class="fa fa-check"></i><b>17</b> Introduction to one-way ANOVA</a> <ul> <li class="chapter" data-level="17.1" data-path="introduction-to-one-way-anova.html"><a href="introduction-to-one-way-anova.html#intro"><i class="fa fa-check"></i><b>17.1</b> Introduction</a></li> <li class="chapter" data-level="17.2" data-path="introduction-to-one-way-anova.html"><a href="introduction-to-one-way-anova.html#why-do-we-need-anova-models"><i class="fa fa-check"></i><b>17.2</b> Why do we need ANOVA models?</a></li> <li class="chapter" data-level="17.3" data-path="introduction-to-one-way-anova.html"><a href="introduction-to-one-way-anova.html#how-does-anova-work"><i class="fa fa-check"></i><b>17.3</b> How does ANOVA work?</a> <ul> <li class="chapter" data-level="17.3.1" data-path="introduction-to-one-way-anova.html"><a href="introduction-to-one-way-anova.html#degrees-of-freedom"><i class="fa fa-check"></i><b>17.3.1</b> Degrees of freedom</a></li> <li class="chapter" data-level="17.3.2" data-path="introduction-to-one-way-anova.html"><a href="introduction-to-one-way-anova.html#mean-squares-variance-ratios-and-f-tests"><i class="fa fa-check"></i><b>17.3.2</b> Mean squares, variance ratios, and F-tests</a></li> </ul></li> <li class="chapter" data-level="17.4" data-path="introduction-to-one-way-anova.html"><a href="introduction-to-one-way-anova.html#different-kinds-of-anova-model"><i class="fa fa-check"></i><b>17.4</b> Different kinds of ANOVA model</a></li> <li class="chapter" data-level="17.5" data-path="introduction-to-one-way-anova.html"><a href="introduction-to-one-way-anova.html#questions"><i class="fa fa-check"></i><b>17.5</b> Some common questions about ANOVA</a> <ul> <li class="chapter" data-level="17.5.1" data-path="introduction-to-one-way-anova.html"><a href="introduction-to-one-way-anova.html#can-anova-only-be-applied-to-experimental-data"><i class="fa fa-check"></i><b>17.5.1</b> Can ANOVA only be applied to experimental data?</a></li> <li class="chapter" data-level="17.5.2" data-path="introduction-to-one-way-anova.html"><a href="introduction-to-one-way-anova.html#do-we-need-equal-replication"><i class="fa fa-check"></i><b>17.5.2</b> Do we need equal replication?</a></li> <li class="chapter" data-level="17.5.3" data-path="introduction-to-one-way-anova.html"><a href="introduction-to-one-way-anova.html#can-anova-be-done-with-only-two-treatments"><i class="fa fa-check"></i><b>17.5.3</b> Can ANOVA be done with only two treatments?</a></li> </ul></li> </ul></li> <li class="chapter" data-level="18" data-path="one-way-anova-in-r.html"><a href="one-way-anova-in-r.html"><i class="fa fa-check"></i><b>18</b> One-way ANOVA in R</a> <ul> <li class="chapter" data-level="18.1" data-path="one-way-anova-in-r.html"><a href="one-way-anova-in-r.html#introduction-2"><i class="fa fa-check"></i><b>18.1</b> Introduction</a></li> <li class="chapter" data-level="18.2" data-path="one-way-anova-in-r.html"><a href="one-way-anova-in-r.html#factors-in-r"><i class="fa fa-check"></i><b>18.2</b> Factors in R</a></li> <li class="chapter" data-level="18.3" data-path="one-way-anova-in-r.html"><a href="one-way-anova-in-r.html#visualising-the-data-1"><i class="fa fa-check"></i><b>18.3</b> Visualising the data</a></li> <li class="chapter" data-level="18.4" data-path="one-way-anova-in-r.html"><a href="one-way-anova-in-r.html#fitting-the-anova-model"><i class="fa fa-check"></i><b>18.4</b> Fitting the ANOVA model</a></li> <li class="chapter" data-level="18.5" data-path="one-way-anova-in-r.html"><a href="one-way-anova-in-r.html#interpreting-the-results"><i class="fa fa-check"></i><b>18.5</b> Interpreting the results</a></li> <li class="chapter" data-level="18.6" data-path="one-way-anova-in-r.html"><a href="one-way-anova-in-r.html#summarise-results"><i class="fa fa-check"></i><b>18.6</b> Summarising and presenting the results of ANOVA</a></li> </ul></li> <li class="part"><span><b>V Experimental Design</b></span></li> <li class="chapter" data-level="19" data-path="principles-experimental-design.html"><a href="principles-experimental-design.html"><i class="fa fa-check"></i><b>19</b> Principles of experimental design</a> <ul> <li class="chapter" data-level="19.1" data-path="principles-experimental-design.html"><a href="principles-experimental-design.html#introduction-3"><i class="fa fa-check"></i><b>19.1</b> Introduction</a></li> <li class="chapter" data-level="19.2" data-path="principles-experimental-design.html"><a href="principles-experimental-design.html#jargon-busting"><i class="fa fa-check"></i><b>19.2</b> Jargon busting</a></li> <li class="chapter" data-level="19.3" data-path="principles-experimental-design.html"><a href="principles-experimental-design.html#replication"><i class="fa fa-check"></i><b>19.3</b> Replication</a> <ul> <li class="chapter" data-level="19.3.1" data-path="principles-experimental-design.html"><a href="principles-experimental-design.html#independence"><i class="fa fa-check"></i><b>19.3.1</b> Independence and pseudoreplication</a></li> </ul></li> <li class="chapter" data-level="19.4" data-path="principles-experimental-design.html"><a href="principles-experimental-design.html#controls"><i class="fa fa-check"></i><b>19.4</b> Controls</a></li> <li class="chapter" data-level="19.5" data-path="principles-experimental-design.html"><a href="principles-experimental-design.html#confounded-and-noisy-experiments"><i class="fa fa-check"></i><b>19.5</b> Confounded and noisy experiments</a> <ul> <li class="chapter" data-level="19.5.1" data-path="principles-experimental-design.html"><a href="principles-experimental-design.html#confounding"><i class="fa fa-check"></i><b>19.5.1</b> Confounding</a></li> <li class="chapter" data-level="19.5.2" data-path="principles-experimental-design.html"><a href="principles-experimental-design.html#noise"><i class="fa fa-check"></i><b>19.5.2</b> Noise</a></li> </ul></li> <li class="chapter" data-level="19.6" data-path="principles-experimental-design.html"><a href="principles-experimental-design.html#dealing-with-confounding-effects-and-noise"><i class="fa fa-check"></i><b>19.6</b> Dealing with confounding effects and noise</a> <ul> <li class="chapter" data-level="19.6.1" data-path="principles-experimental-design.html"><a href="principles-experimental-design.html#randomisation"><i class="fa fa-check"></i><b>19.6.1</b> Randomisation</a></li> <li class="chapter" data-level="19.6.2" data-path="principles-experimental-design.html"><a href="principles-experimental-design.html#blocking"><i class="fa fa-check"></i><b>19.6.2</b> Blocking</a></li> <li class="chapter" data-level="19.6.3" data-path="principles-experimental-design.html"><a href="principles-experimental-design.html#experimental-control"><i class="fa fa-check"></i><b>19.6.3</b> Experimental control</a></li> <li class="chapter" data-level="19.6.4" data-path="principles-experimental-design.html"><a href="principles-experimental-design.html#additional-treatments-designing-in-unwanted-variation"><i class="fa fa-check"></i><b>19.6.4</b> Additional treatments: ‘designing in’ unwanted variation</a></li> </ul></li> <li class="chapter" data-level="19.7" data-path="principles-experimental-design.html"><a href="principles-experimental-design.html#ethics-and-practicality"><i class="fa fa-check"></i><b>19.7</b> Ethics and practicality</a></li> <li class="chapter" data-level="19.8" data-path="principles-experimental-design.html"><a href="principles-experimental-design.html#further-reading"><i class="fa fa-check"></i><b>19.8</b> Further reading</a></li> </ul></li> <li class="chapter" data-level="20" data-path="paired-sample-t-test.html"><a href="paired-sample-t-test.html"><i class="fa fa-check"></i><b>20</b> Paired-sample t-test</a> <ul> <li class="chapter" data-level="20.1" data-path="paired-sample-t-test.html"><a href="paired-sample-t-test.html#when-do-we-use-a-paired-sample-t-test"><i class="fa fa-check"></i><b>20.1</b> When do we use a paired-sample <em>t</em>-test?</a></li> <li class="chapter" data-level="20.2" data-path="paired-sample-t-test.html"><a href="paired-sample-t-test.html#why-do-we-use-a-paired-sample-design"><i class="fa fa-check"></i><b>20.2</b> Why do we use a paired-sample design?</a></li> <li class="chapter" data-level="20.3" data-path="paired-sample-t-test.html"><a href="paired-sample-t-test.html#how-do-you-carry-out-a-t-test-on-paired-samples"><i class="fa fa-check"></i><b>20.3</b> How do you carry out a <em>t</em>-test on paired-samples?</a> <ul> <li class="chapter" data-level="20.3.1" data-path="paired-sample-t-test.html"><a href="paired-sample-t-test.html#assumptions-of-the-paired-sample-t-test"><i class="fa fa-check"></i><b>20.3.1</b> Assumptions of the paired-sample <em>t</em>-test</a></li> </ul></li> <li class="chapter" data-level="20.4" data-path="paired-sample-t-test.html"><a href="paired-sample-t-test.html#carrying-out-a-paired-sample-t-test-in-r"><i class="fa fa-check"></i><b>20.4</b> Carrying out a paired-sample <em>t</em>-test in R</a> <ul> <li class="chapter" data-level="20.4.1" data-path="paired-sample-t-test.html"><a href="paired-sample-t-test.html#using-the-paired-true-argument"><i class="fa fa-check"></i><b>20.4.1</b> Using the <code>paired = TRUE</code> argument</a></li> </ul></li> </ul></li> <li class="chapter" data-level="21" data-path="anova-for-randomised-block-designs.html"><a href="anova-for-randomised-block-designs.html"><i class="fa fa-check"></i><b>21</b> ANOVA for randomised block designs</a> <ul> <li class="chapter" data-level="21.1" data-path="anova-for-randomised-block-designs.html"><a href="anova-for-randomised-block-designs.html#randomized-complete-block-designs"><i class="fa fa-check"></i><b>21.1</b> Randomized Complete Block Designs</a></li> <li class="chapter" data-level="21.2" data-path="anova-for-randomised-block-designs.html"><a href="anova-for-randomised-block-designs.html#designs-without-replication"><i class="fa fa-check"></i><b>21.2</b> Designs without replication</a></li> <li class="chapter" data-level="21.3" data-path="anova-for-randomised-block-designs.html"><a href="anova-for-randomised-block-designs.html#analysing-an-rcbd-experiment"><i class="fa fa-check"></i><b>21.3</b> Analysing an RCBD experiment</a></li> <li class="chapter" data-level="21.4" data-path="anova-for-randomised-block-designs.html"><a href="anova-for-randomised-block-designs.html#carrying-out-the-analysis-with-r"><i class="fa fa-check"></i><b>21.4</b> Carrying out the analysis with R</a> <ul> <li class="chapter" data-level="21.4.1" data-path="anova-for-randomised-block-designs.html"><a href="anova-for-randomised-block-designs.html#multiple-comparisons-anyone"><i class="fa fa-check"></i><b>21.4.1</b> Multiple comparisons anyone?</a></li> </ul></li> <li class="chapter" data-level="21.5" data-path="anova-for-randomised-block-designs.html"><a href="anova-for-randomised-block-designs.html#are-there-disadvantages-to-randomised-block-designs"><i class="fa fa-check"></i><b>21.5</b> Are there disadvantages to randomised block designs?</a></li> <li class="chapter" data-level="21.6" data-path="anova-for-randomised-block-designs.html"><a href="anova-for-randomised-block-designs.html#multiple-blocking-factors"><i class="fa fa-check"></i><b>21.6</b> Multiple blocking factors</a></li> </ul></li> <li class="part"><span><b>VI Doing More with Models</b></span></li> <li class="chapter" data-level="22" data-path="assumptions-diagnostics.html"><a href="assumptions-diagnostics.html"><i class="fa fa-check"></i><b>22</b> Assumptions and diagnostics</a> <ul> <li class="chapter" data-level="22.1" data-path="assumptions-diagnostics.html"><a href="assumptions-diagnostics.html#understanding-data"><i class="fa fa-check"></i><b>22.1</b> Understanding data</a></li> <li class="chapter" data-level="22.2" data-path="assumptions-diagnostics.html"><a href="assumptions-diagnostics.html#assumptions-of-regression"><i class="fa fa-check"></i><b>22.2</b> Assumptions of regression</a></li> <li class="chapter" data-level="22.3" data-path="assumptions-diagnostics.html"><a href="assumptions-diagnostics.html#regres-diagnose"><i class="fa fa-check"></i><b>22.3</b> Regression diagnostics</a> <ul> <li class="chapter" data-level="22.3.1" data-path="assumptions-diagnostics.html"><a href="assumptions-diagnostics.html#fitted-values"><i class="fa fa-check"></i><b>22.3.1</b> Fitted values</a></li> <li class="chapter" data-level="22.3.2" data-path="assumptions-diagnostics.html"><a href="assumptions-diagnostics.html#checking-the-linearity-assumption"><i class="fa fa-check"></i><b>22.3.2</b> Checking the linearity assumption</a></li> <li class="chapter" data-level="22.3.3" data-path="assumptions-diagnostics.html"><a href="assumptions-diagnostics.html#checking-the-normality-assumption"><i class="fa fa-check"></i><b>22.3.3</b> Checking the normality assumption</a></li> <li class="chapter" data-level="22.3.4" data-path="assumptions-diagnostics.html"><a href="assumptions-diagnostics.html#checking-the-constant-variance-assumption"><i class="fa fa-check"></i><b>22.3.4</b> Checking the constant variance assumption</a></li> </ul></li> <li class="chapter" data-level="22.4" data-path="assumptions-diagnostics.html"><a href="assumptions-diagnostics.html#assumptions-of-one-way-anova"><i class="fa fa-check"></i><b>22.4</b> Assumptions of one-way ANOVA</a></li> </ul></li> <li class="chapter" data-level="23" data-path="regression-diagnostics.html"><a href="regression-diagnostics.html"><i class="fa fa-check"></i><b>23</b> Regression diagnostics in R</a> <ul> <li class="chapter" data-level="23.1" data-path="regression-diagnostics.html"><a href="regression-diagnostics.html#introduction-4"><i class="fa fa-check"></i><b>23.1</b> Introduction</a></li> <li class="chapter" data-level="23.2" data-path="regression-diagnostics.html"><a href="regression-diagnostics.html#diagnostics-for-regression"><i class="fa fa-check"></i><b>23.2</b> Diagnostics for regression</a></li> <li class="chapter" data-level="23.3" data-path="regression-diagnostics.html"><a href="regression-diagnostics.html#diagnostics-for-one-way-anova"><i class="fa fa-check"></i><b>23.3</b> Diagnostics for one-way ANOVA</a> <ul> <li class="chapter" data-level="23.3.1" data-path="regression-diagnostics.html"><a href="regression-diagnostics.html#aside-formal-test-of-equality-of-variance"><i class="fa fa-check"></i><b>23.3.1</b> Aside: formal test of equality of variance</a></li> </ul></li> </ul></li> <li class="chapter" data-level="24" data-path="data-transformations.html"><a href="data-transformations.html"><i class="fa fa-check"></i><b>24</b> Data transformations</a> <ul> <li class="chapter" data-level="24.1" data-path="data-transformations.html"><a href="data-transformations.html#transforms-introduction"><i class="fa fa-check"></i><b>24.1</b> Data that violate ANOVA assumptions</a></li> <li class="chapter" data-level="24.2" data-path="data-transformations.html"><a href="data-transformations.html#ant-eg"><i class="fa fa-check"></i><b>24.2</b> Data transformation: ANOVAs and <em>t</em>-tests</a> <ul> <li class="chapter" data-level="24.2.1" data-path="data-transformations.html"><a href="data-transformations.html#the-dataforaging-in-ants"><i class="fa fa-check"></i><b>24.2.1</b> The data—foraging in ants</a></li> <li class="chapter" data-level="24.2.2" data-path="data-transformations.html"><a href="data-transformations.html#fit-the-model-and-checking-the-assumptions"><i class="fa fa-check"></i><b>24.2.2</b> Fit the model and checking the assumptions</a></li> </ul></li> <li class="chapter" data-level="24.3" data-path="data-transformations.html"><a href="data-transformations.html#carry-on"><i class="fa fa-check"></i><b>24.3</b> Carrying on anyway</a></li> <li class="chapter" data-level="24.4" data-path="data-transformations.html"><a href="data-transformations.html#transform"><i class="fa fa-check"></i><b>24.4</b> Transforming the data</a> <ul> <li class="chapter" data-level="24.4.1" data-path="data-transformations.html"><a href="data-transformations.html#the-logarithmic-transformation"><i class="fa fa-check"></i><b>24.4.1</b> The logarithmic transformation</a></li> <li class="chapter" data-level="24.4.2" data-path="data-transformations.html"><a href="data-transformations.html#presenting-results-from-analyses-of-transformed-data"><i class="fa fa-check"></i><b>24.4.2</b> Presenting results from analyses of transformed data</a></li> </ul></li> <li class="chapter" data-level="24.5" data-path="data-transformations.html"><a href="data-transformations.html#trans-types"><i class="fa fa-check"></i><b>24.5</b> Types of transformations</a> <ul> <li class="chapter" data-level="24.5.1" data-path="data-transformations.html"><a href="data-transformations.html#logarithms"><i class="fa fa-check"></i><b>24.5.1</b> Logarithms</a></li> <li class="chapter" data-level="24.5.2" data-path="data-transformations.html"><a href="data-transformations.html#square-roots"><i class="fa fa-check"></i><b>24.5.2</b> Square roots</a></li> <li class="chapter" data-level="24.5.3" data-path="data-transformations.html"><a href="data-transformations.html#arcsine-square-root"><i class="fa fa-check"></i><b>24.5.3</b> Arcsine square root</a></li> <li class="chapter" data-level="24.5.4" data-path="data-transformations.html"><a href="data-transformations.html#squaring"><i class="fa fa-check"></i><b>24.5.4</b> Squaring</a></li> <li class="chapter" data-level="24.5.5" data-path="data-transformations.html"><a href="data-transformations.html#situations-which-cannot-be-dealt-with-by-transformations"><i class="fa fa-check"></i><b>24.5.5</b> Situations which cannot be dealt with by transformations</a></li> </ul></li> <li class="chapter" data-level="24.6" data-path="data-transformations.html"><a href="data-transformations.html#what-about-other-kinds-of-models"><i class="fa fa-check"></i><b>24.6</b> What about other kinds of models?</a></li> <li class="chapter" data-level="24.7" data-path="data-transformations.html"><a href="data-transformations.html#final-thoughts"><i class="fa fa-check"></i><b>24.7</b> Final thoughts</a></li> </ul></li> <li class="chapter" data-level="25" data-path="multiple-comparison-tests.html"><a href="multiple-comparison-tests.html"><i class="fa fa-check"></i><b>25</b> Multiple comparison tests</a> <ul> <li class="chapter" data-level="25.1" data-path="multiple-comparison-tests.html"><a href="multiple-comparison-tests.html#introduction-5"><i class="fa fa-check"></i><b>25.1</b> Introduction</a></li> <li class="chapter" data-level="25.2" data-path="multiple-comparison-tests.html"><a href="multiple-comparison-tests.html#mult-comp-R"><i class="fa fa-check"></i><b>25.2</b> Tukey’s HSD in R</a></li> <li class="chapter" data-level="25.3" data-path="multiple-comparison-tests.html"><a href="multiple-comparison-tests.html#how-to-summarise-multiple-comparison-results"><i class="fa fa-check"></i><b>25.3</b> How to summarise multiple-comparison results</a></li> <li class="chapter" data-level="25.4" data-path="multiple-comparison-tests.html"><a href="multiple-comparison-tests.html#doing-it-the-easy-way"><i class="fa fa-check"></i><b>25.4</b> Doing it the easy way…</a></li> <li class="chapter" data-level="25.5" data-path="multiple-comparison-tests.html"><a href="multiple-comparison-tests.html#summarise"><i class="fa fa-check"></i><b>25.5</b> Summarising and presenting the results of a Tukey test</a></li> <li class="chapter" data-level="25.6" data-path="multiple-comparison-tests.html"><a href="multiple-comparison-tests.html#significant-anova-but-no-differences-in-a-tukey-test"><i class="fa fa-check"></i><b>25.6</b> Significant ANOVA but no differences in a Tukey test?</a></li> </ul></li> <li class="part"><span><b>VII Beyond Simple Models</b></span></li> <li class="chapter" data-level="26" data-path="two-way-anova-intro.html"><a href="two-way-anova-intro.html"><i class="fa fa-check"></i><b>26</b> Introduction to two-way ANOVA</a> <ul> <li class="chapter" data-level="26.1" data-path="parametric-statistics.html"><a href="parametric-statistics.html#introduction"><i class="fa fa-check"></i><b>26.1</b> Introduction</a></li> <li class="chapter" data-level="26.2" data-path="two-way-anova-intro.html"><a href="two-way-anova-intro.html#degrees-of-freedom-mean-squares-and-f-statistics"><i class="fa fa-check"></i><b>26.2</b> Degrees of freedom, mean squares, and <em>F</em>-statistics</a></li> <li class="chapter" data-level="26.3" data-path="two-way-anova-intro.html"><a href="two-way-anova-intro.html#multiple-comparison-tests-1"><i class="fa fa-check"></i><b>26.3</b> Multiple comparison tests</a></li> <li class="chapter" data-level="26.4" data-path="two-way-anova-intro.html"><a href="two-way-anova-intro.html#beyond-two-way-anova"><i class="fa fa-check"></i><b>26.4</b> Beyond two-way ANOVA</a></li> </ul></li> <li class="chapter" data-level="27" data-path="two-way-anova-in-r.html"><a href="two-way-anova-in-r.html"><i class="fa fa-check"></i><b>27</b> Two-way ANOVA in R</a> <ul> <li class="chapter" data-level="27.1" data-path="two-way-anova-in-r.html"><a href="two-way-anova-in-r.html#introduction-6"><i class="fa fa-check"></i><b>27.1</b> Introduction</a></li> <li class="chapter" data-level="27.2" data-path="two-way-anova-in-r.html"><a href="two-way-anova-in-r.html#competition-between-calluna-and-festuca"><i class="fa fa-check"></i><b>27.2</b> Competition between <em>Calluna</em> and <em>Festuca</em></a></li> <li class="chapter" data-level="27.3" data-path="two-way-anova-in-r.html"><a href="two-way-anova-in-r.html#visualising-the-data-2"><i class="fa fa-check"></i><b>27.3</b> Visualising the data</a></li> <li class="chapter" data-level="27.4" data-path="two-way-anova-in-r.html"><a href="two-way-anova-in-r.html#fitting-the-anova-model-1"><i class="fa fa-check"></i><b>27.4</b> Fitting the ANOVA model</a></li> <li class="chapter" data-level="27.5" data-path="two-way-anova-in-r.html"><a href="two-way-anova-in-r.html#diagnostics"><i class="fa fa-check"></i><b>27.5</b> Diagnostics</a></li> <li class="chapter" data-level="27.6" data-path="two-way-anova-in-r.html"><a href="two-way-anova-in-r.html#interpreting-the-results-1"><i class="fa fa-check"></i><b>27.6</b> Interpreting the results</a> <ul> <li class="chapter" data-level="27.6.1" data-path="two-way-anova-in-r.html"><a href="two-way-anova-in-r.html#understanding-the-model-graphically"><i class="fa fa-check"></i><b>27.6.1</b> Understanding the model graphically</a></li> </ul></li> <li class="chapter" data-level="27.7" data-path="two-way-anova-in-r.html"><a href="two-way-anova-in-r.html#multiple-comparison-tests-2"><i class="fa fa-check"></i><b>27.7</b> Multiple comparison tests</a></li> <li class="chapter" data-level="27.8" data-path="two-way-anova-in-r.html"><a href="two-way-anova-in-r.html#drawing-conclusions-and-presenting-results"><i class="fa fa-check"></i><b>27.8</b> Drawing conclusions and presenting results</a> <ul> <li class="chapter" data-level="27.8.1" data-path="two-way-anova-in-r.html"><a href="two-way-anova-in-r.html#a-little-more-customisation"><i class="fa fa-check"></i><b>27.8.1</b> A little more customisation</a></li> </ul></li> <li class="chapter" data-level="27.9" data-path="two-way-anova-in-r.html"><a href="two-way-anova-in-r.html#balanced-or-orthogonal-designs"><i class="fa fa-check"></i><b>27.9</b> Balanced or orthogonal designs</a></li> </ul></li> <li class="chapter" data-level="28" data-path="introduction-to-ancova.html"><a href="introduction-to-ancova.html"><i class="fa fa-check"></i><b>28</b> Introduction to ANCOVA</a> <ul> <li class="chapter" data-level="28.1" data-path="parametric-statistics.html"><a href="parametric-statistics.html#introduction"><i class="fa fa-check"></i><b>28.1</b> Introduction</a></li> <li class="chapter" data-level="28.2" data-path="introduction-to-ancova.html"><a href="introduction-to-ancova.html#why-do-we-need-ancova-models"><i class="fa fa-check"></i><b>28.2</b> Why do we need ANCOVA models?</a></li> <li class="chapter" data-level="28.3" data-path="introduction-to-ancova.html"><a href="introduction-to-ancova.html#how-does-ancova-work"><i class="fa fa-check"></i><b>28.3</b> How does ANCOVA work?</a></li> <li class="chapter" data-level="28.4" data-path="introduction-to-ancova.html"><a href="introduction-to-ancova.html#degrees-of-freedom-mean-squares-and-f-statistics-1"><i class="fa fa-check"></i><b>28.4</b> Degrees of freedom, mean squares and F-statistics</a></li> <li class="chapter" data-level="28.5" data-path="introduction-to-ancova.html"><a href="introduction-to-ancova.html#assumptions-of-ancova"><i class="fa fa-check"></i><b>28.5</b> Assumptions of ANCOVA</a></li> </ul></li> <li class="chapter" data-level="29" data-path="two-way-ancova-in-r.html"><a href="two-way-ancova-in-r.html"><i class="fa fa-check"></i><b>29</b> Two-way ANCOVA in R</a> <ul> <li class="chapter" data-level="29.1" data-path="two-way-ancova-in-r.html"><a href="two-way-ancova-in-r.html#introduction-7"><i class="fa fa-check"></i><b>29.1</b> Introduction</a></li> <li class="chapter" data-level="29.2" data-path="two-way-ancova-in-r.html"><a href="two-way-ancova-in-r.html#visualising-the-data-3"><i class="fa fa-check"></i><b>29.2</b> Visualising the data</a></li> <li class="chapter" data-level="29.3" data-path="two-way-ancova-in-r.html"><a href="two-way-ancova-in-r.html#fitting-an-ancova"><i class="fa fa-check"></i><b>29.3</b> Fitting an ANCOVA</a></li> <li class="chapter" data-level="29.4" data-path="two-way-ancova-in-r.html"><a href="two-way-ancova-in-r.html#diagnostics-1"><i class="fa fa-check"></i><b>29.4</b> Diagnostics</a></li> <li class="chapter" data-level="29.5" data-path="two-way-ancova-in-r.html"><a href="two-way-ancova-in-r.html#interpreting-the-results-2"><i class="fa fa-check"></i><b>29.5</b> Interpreting the results</a></li> <li class="chapter" data-level="29.6" data-path="two-way-ancova-in-r.html"><a href="two-way-ancova-in-r.html#presenting-the-results"><i class="fa fa-check"></i><b>29.6</b> Presenting the results</a></li> </ul></li> <li class="part"><span><b>VIII Frequency Data and Non-parametric Tests</b></span></li> <li class="chapter" data-level="30" data-path="working-with-frequencies.html"><a href="working-with-frequencies.html"><i class="fa fa-check"></i><b>30</b> Working with frequencies</a> <ul> <li class="chapter" data-level="30.1" data-path="working-with-frequencies.html"><a href="working-with-frequencies.html#introduction-8"><i class="fa fa-check"></i><b>30.1</b> Introduction</a></li> <li class="chapter" data-level="30.2" data-path="working-with-frequencies.html"><a href="working-with-frequencies.html#a-new-kind-of-distribution"><i class="fa fa-check"></i><b>30.2</b> A new kind of distribution</a></li> <li class="chapter" data-level="30.3" data-path="working-with-frequencies.html"><a href="working-with-frequencies.html#types-of-test"><i class="fa fa-check"></i><b>30.3</b> Types of test</a> <ul> <li class="chapter" data-level="30.3.1" data-path="working-with-frequencies.html"><a href="working-with-frequencies.html#chi2-goodness-of-fit-test"><i class="fa fa-check"></i><b>30.3.1</b> <span class="math inline">\(\chi^{2}\)</span> goodness of fit test</a></li> <li class="chapter" data-level="30.3.2" data-path="working-with-frequencies.html"><a href="working-with-frequencies.html#chi2-contingency-table-test"><i class="fa fa-check"></i><b>30.3.2</b> <span class="math inline">\(\chi^{2}\)</span> contingency table test</a></li> <li class="chapter" data-level="30.3.3" data-path="working-with-frequencies.html"><a href="working-with-frequencies.html#the-assumptions-and-requirements-of-chi2-tests"><i class="fa fa-check"></i><b>30.3.3</b> The assumptions and requirements of <span class="math inline">\(\chi^{2}\)</span> tests</a></li> </ul></li> </ul></li> <li class="chapter" data-level="31" data-path="goodness-of-fit-tests.html"><a href="goodness-of-fit-tests.html"><i class="fa fa-check"></i><b>31</b> Goodness of fit tests</a> <ul> <li class="chapter" data-level="31.1" data-path="goodness-of-fit-tests.html"><a href="goodness-of-fit-tests.html#when-do-we-use-a-chi-square-goodness-of-fit-test"><i class="fa fa-check"></i><b>31.1</b> When do we use a chi-square goodness of fit test?</a></li> <li class="chapter" data-level="31.2" data-path="goodness-of-fit-tests.html"><a href="goodness-of-fit-tests.html#how-does-the-chi-square-goodness-of-fit-test-work"><i class="fa fa-check"></i><b>31.2</b> How does the chi-square goodness of fit test work?</a> <ul> <li class="chapter" data-level="31.2.1" data-path="goodness-of-fit-tests.html"><a href="goodness-of-fit-tests.html#assumptions-of-the-chi-square-goodness-of-fit-test"><i class="fa fa-check"></i><b>31.2.1</b> Assumptions of the chi-square goodness of fit test</a></li> </ul></li> <li class="chapter" data-level="31.3" data-path="goodness-of-fit-tests.html"><a href="goodness-of-fit-tests.html#carrying-out-a-chi-square-goodness-of-fit-test-in-r"><i class="fa fa-check"></i><b>31.3</b> Carrying out a chi-square goodness of fit test in R</a> <ul> <li class="chapter" data-level="31.3.1" data-path="goodness-of-fit-tests.html"><a href="goodness-of-fit-tests.html#summarising-the-result-2"><i class="fa fa-check"></i><b>31.3.1</b> Summarising the result</a></li> <li class="chapter" data-level="31.3.2" data-path="goodness-of-fit-tests.html"><a href="goodness-of-fit-tests.html#a-bit-more-about-goodness-of-fit-tests-in-r"><i class="fa fa-check"></i><b>31.3.2</b> A bit more about goodness of fit tests in R</a></li> <li class="chapter" data-level="31.3.3" data-path="goodness-of-fit-tests.html"><a href="goodness-of-fit-tests.html#doing-it-the-long-way"><i class="fa fa-check"></i><b>31.3.3</b> Doing it the long way…</a></li> </ul></li> <li class="chapter" data-level="31.4" data-path="goodness-of-fit-tests.html"><a href="goodness-of-fit-tests.html#determining-appropriate-expected-values"><i class="fa fa-check"></i><b>31.4</b> Determining appropriate expected values</a></li> </ul></li> <li class="chapter" data-level="32" data-path="contingency-tables.html"><a href="contingency-tables.html"><i class="fa fa-check"></i><b>32</b> Contingency tables</a> <ul> <li class="chapter" data-level="32.1" data-path="contingency-tables.html"><a href="contingency-tables.html#when-do-we-use-a-chi-square-contingency-table-test"><i class="fa fa-check"></i><b>32.1</b> When do we use a chi-square contingency table test?</a></li> <li class="chapter" data-level="32.2" data-path="contingency-tables.html"><a href="contingency-tables.html#how-does-the-chi-square-contingency-table-test-work"><i class="fa fa-check"></i><b>32.2</b> How does the chi-square contingency table test work?</a> <ul> <li class="chapter" data-level="32.2.1" data-path="contingency-tables.html"><a href="contingency-tables.html#assumptions-of-the-chi-square-contingency-table-test"><i class="fa fa-check"></i><b>32.2.1</b> Assumptions of the chi-square contingency table test</a></li> </ul></li> <li class="chapter" data-level="32.3" data-path="contingency-tables.html"><a href="contingency-tables.html#carrying-out-a-chi-square-contingency-table-test-in-r"><i class="fa fa-check"></i><b>32.3</b> Carrying out a chi-square contingency table test in R</a> <ul> <li class="chapter" data-level="32.3.1" data-path="contingency-tables.html"><a href="contingency-tables.html#step-1.-getting-the-data-into-the-correct-format"><i class="fa fa-check"></i><b>32.3.1</b> Step 1. Getting the data into the correct format</a></li> <li class="chapter" data-level="32.3.2" data-path="contingency-tables.html"><a href="contingency-tables.html#step-2.-doing-the-test"><i class="fa fa-check"></i><b>32.3.2</b> Step 2. Doing the test</a></li> <li class="chapter" data-level="32.3.3" data-path="contingency-tables.html"><a href="contingency-tables.html#summarising-the-result-3"><i class="fa fa-check"></i><b>32.3.3</b> Summarising the result</a></li> </ul></li> <li class="chapter" data-level="32.4" data-path="contingency-tables.html"><a href="contingency-tables.html#working-with-larger-tables"><i class="fa fa-check"></i><b>32.4</b> Working with larger tables</a></li> </ul></li> <li class="chapter" data-level="33" data-path="non-parametric-tests.html"><a href="non-parametric-tests.html"><i class="fa fa-check"></i><b>33</b> Non-parametric tests</a> <ul> <li class="chapter" data-level="33.1" data-path="non-parametric-tests.html"><a href="non-parametric-tests.html#what-is-non-par"><i class="fa fa-check"></i><b>33.1</b> What is a non-parametric test?</a></li> <li class="chapter" data-level="33.2" data-path="non-parametric-tests.html"><a href="non-parametric-tests.html#non-par-intro"><i class="fa fa-check"></i><b>33.2</b> How does a non-parametric test work?</a></li> <li class="chapter" data-level="33.3" data-path="non-parametric-tests.html"><a href="non-parametric-tests.html#non-parametric-equivalents"><i class="fa fa-check"></i><b>33.3</b> Non-parametric equivalents</a></li> <li class="chapter" data-level="33.4" data-path="non-parametric-tests.html"><a href="non-parametric-tests.html#wilcoxon-signed-rank-test"><i class="fa fa-check"></i><b>33.4</b> Wilcoxon signed-rank test</a> <ul> <li class="chapter" data-level="33.4.1" data-path="non-parametric-tests.html"><a href="non-parametric-tests.html#leaf-damage-plant-defences-and-feeding-by-winter-moth-larvae"><i class="fa fa-check"></i><b>33.4.1</b> Leaf damage, plant defences and feeding by winter moth larvae</a></li> </ul></li> <li class="chapter" data-level="33.5" data-path="non-parametric-tests.html"><a href="non-parametric-tests.html#mann-whitney"><i class="fa fa-check"></i><b>33.5</b> The Mann-Whitney <em>U</em>-test</a> <ul> <li class="chapter" data-level="33.5.1" data-path="non-parametric-tests.html"><a href="non-parametric-tests.html#ant-foraging"><i class="fa fa-check"></i><b>33.5.1</b> Ant foraging</a></li> </ul></li> <li class="chapter" data-level="33.6" data-path="non-parametric-tests.html"><a href="non-parametric-tests.html#the-kruskal-wallis-test"><i class="fa fa-check"></i><b>33.6</b> The Kruskal-Wallis test</a> <ul> <li class="chapter" data-level="33.6.1" data-path="non-parametric-tests.html"><a href="non-parametric-tests.html#learning-in-cuttlefish"><i class="fa fa-check"></i><b>33.6.1</b> Learning in cuttlefish</a></li> </ul></li> <li class="chapter" data-level="33.7" data-path="non-parametric-tests.html"><a href="non-parametric-tests.html#spearmans-rank-correlation"><i class="fa fa-check"></i><b>33.7</b> Spearman’s rank correlation</a> <ul> <li class="chapter" data-level="33.7.1" data-path="non-parametric-tests.html"><a href="non-parametric-tests.html#grouse-lekking"><i class="fa fa-check"></i><b>33.7.1</b> Grouse lekking</a></li> </ul></li> <li class="chapter" data-level="33.8" data-path="non-parametric-tests.html"><a href="non-parametric-tests.html#why-when"><i class="fa fa-check"></i><b>33.8</b> Why use non-parametric tests … and when?</a> <ul> <li class="chapter" data-level="33.8.1" data-path="non-parametric-tests.html"><a href="non-parametric-tests.html#what-are-the-advantages"><i class="fa fa-check"></i><b>33.8.1</b> What are the advantages?</a></li> <li class="chapter" data-level="33.8.2" data-path="non-parametric-tests.html"><a href="non-parametric-tests.html#what-are-the-disadvantages"><i class="fa fa-check"></i><b>33.8.2</b> What are the disadvantages?</a></li> <li class="chapter" data-level="33.8.3" data-path="non-parametric-tests.html"><a href="non-parametric-tests.html#parting-words"><i class="fa fa-check"></i><b>33.8.3</b> Parting words</a></li> </ul></li> </ul></li> <li class="appendix"><span><b>Supplementary Material</b></span></li> <li class="chapter" data-level="A" data-path="choosing-models-and-tests.html"><a href="choosing-models-and-tests.html"><i class="fa fa-check"></i><b>A</b> Choosing models and tests</a> <ul> <li class="chapter" data-level="A.1" data-path="introduction-to-one-way-anova.html"><a href="introduction-to-one-way-anova.html#intro"><i class="fa fa-check"></i><b>A.1</b> Introduction</a> <ul> <li class="chapter" data-level="A.1.1" data-path="choosing-models-and-tests.html"><a href="choosing-models-and-tests.html#do-we-need-to-carry-out-a-statistical-analysis"><i class="fa fa-check"></i><b>A.1.1</b> Do we need to carry out a statistical analysis?</a></li> </ul></li> <li class="chapter" data-level="A.2" data-path="choosing-models-and-tests.html"><a href="choosing-models-and-tests.html#getting-started"><i class="fa fa-check"></i><b>A.2</b> Getting started…</a></li> <li class="chapter" data-level="A.3" data-path="choosing-models-and-tests.html"><a href="choosing-models-and-tests.html#a-key-to-choosing-statistical-models-and-tests"><i class="fa fa-check"></i><b>A.3</b> A key to choosing statistical models and tests</a></li> <li class="chapter" data-level="A.4" data-path="choosing-models-and-tests.html"><a href="choosing-models-and-tests.html#four-questions"><i class="fa fa-check"></i><b>A.4</b> Four main types of question</a></li> <li class="chapter" data-level="A.5" data-path="choosing-models-and-tests.html"><a href="choosing-models-and-tests.html#qu1"><i class="fa fa-check"></i><b>A.5</b> Question 1 –- Comparison of group means or medians</a> <ul> <li class="chapter" data-level="A.5.1" data-path="choosing-models-and-tests.html"><a href="choosing-models-and-tests.html#question-1-how-many-groups"><i class="fa fa-check"></i><b>A.5.1</b> Question 1 How many groups?</a></li> <li class="chapter" data-level="A.5.2" data-path="choosing-models-and-tests.html"><a href="choosing-models-and-tests.html#question-1-single-group"><i class="fa fa-check"></i><b>A.5.2</b> [Question 1] Single group</a></li> <li class="chapter" data-level="A.5.3" data-path="choosing-models-and-tests.html"><a href="choosing-models-and-tests.html#question-1-two-groups"><i class="fa fa-check"></i><b>A.5.3</b> [Question 1] Two groups</a></li> <li class="chapter" data-level="A.5.4" data-path="choosing-models-and-tests.html"><a href="choosing-models-and-tests.html#question-1-more-than-two-groups"><i class="fa fa-check"></i><b>A.5.4</b> [Question 1] More than two groups</a></li> </ul></li> <li class="chapter" data-level="A.6" data-path="choosing-models-and-tests.html"><a href="choosing-models-and-tests.html#qu2"><i class="fa fa-check"></i><b>A.6</b> Question 2 – Associations between two variables?</a> <ul> <li class="chapter" data-level="A.6.1" data-path="choosing-models-and-tests.html"><a href="choosing-models-and-tests.html#question-2-testing-y-as-a-function-of-x-or-an-association-between-x-and-y"><i class="fa fa-check"></i><b>A.6.1</b> [Question 2] Testing <span class="math inline">\(y\)</span> as a function of <span class="math inline">\(x\)</span>, or an association between <span class="math inline">\(x\)</span> and <span class="math inline">\(y\)</span>?</a></li> </ul></li> <li class="chapter" data-level="A.7" data-path="choosing-models-and-tests.html"><a href="choosing-models-and-tests.html#qu4"><i class="fa fa-check"></i><b>A.7</b> Question 3 -– Frequencies of categorical data</a></li> <li class="chapter" data-level="A.8" data-path="choosing-models-and-tests.html"><a href="choosing-models-and-tests.html#var-cat"><i class="fa fa-check"></i><b>A.8</b> Variables or categories?</a> <ul> <li class="chapter" data-level="A.8.1" data-path="choosing-models-and-tests.html"><a href="choosing-models-and-tests.html#anova-vs.-regression"><i class="fa fa-check"></i><b>A.8.1</b> ANOVA vs. regression</a></li> <li class="chapter" data-level="A.8.2" data-path="choosing-models-and-tests.html"><a href="choosing-models-and-tests.html#making-categories-out-of-continuous-measures"><i class="fa fa-check"></i><b>A.8.2</b> Making categories out of continuous measures</a></li> </ul></li> </ul></li> <li class="chapter" data-level="B" data-path="writing-a-scientific-report.html"><a href="writing-a-scientific-report.html"><i class="fa fa-check"></i><b>B</b> Writing a scientific report</a> <ul> <li class="chapter" data-level="B.1" data-path="writing-a-scientific-report.html"><a href="writing-a-scientific-report.html#introduction-9"><i class="fa fa-check"></i><b>B.1</b> Introduction</a></li> <li class="chapter" data-level="B.2" data-path="writing-a-scientific-report.html"><a href="writing-a-scientific-report.html#the-structure-of-a-scientific-report"><i class="fa fa-check"></i><b>B.2</b> The structure of a scientific report</a> <ul> <li class="chapter" data-level="B.2.1" data-path="writing-a-scientific-report.html"><a href="writing-a-scientific-report.html#title"><i class="fa fa-check"></i><b>B.2.1</b> Title</a></li> <li class="chapter" data-level="B.2.2" data-path="writing-a-scientific-report.html"><a href="writing-a-scientific-report.html#abstract-or-summary"><i class="fa fa-check"></i><b>B.2.2</b> Abstract or Summary</a></li> <li class="chapter" data-level="B.2.3" data-path="writing-a-scientific-report.html"><a href="writing-a-scientific-report.html#introduction-10"><i class="fa fa-check"></i><b>B.2.3</b> Introduction</a></li> <li class="chapter" data-level="B.2.4" data-path="writing-a-scientific-report.html"><a href="writing-a-scientific-report.html#methods-1"><i class="fa fa-check"></i><b>B.2.4</b> Methods</a></li> <li class="chapter" data-level="B.2.5" data-path="writing-a-scientific-report.html"><a href="writing-a-scientific-report.html#results"><i class="fa fa-check"></i><b>B.2.5</b> Results</a></li> <li class="chapter" data-level="B.2.6" data-path="writing-a-scientific-report.html"><a href="writing-a-scientific-report.html#discussion"><i class="fa fa-check"></i><b>B.2.6</b> Discussion</a></li> <li class="chapter" data-level="B.2.7" data-path="writing-a-scientific-report.html"><a href="writing-a-scientific-report.html#acknowledgements"><i class="fa fa-check"></i><b>B.2.7</b> Acknowledgements</a></li> <li class="chapter" data-level="B.2.8" data-path="writing-a-scientific-report.html"><a href="writing-a-scientific-report.html#literature-cited-references"><i class="fa fa-check"></i><b>B.2.8</b> Literature cited / References</a></li> <li class="chapter" data-level="B.2.9" data-path="writing-a-scientific-report.html"><a href="writing-a-scientific-report.html#appendices"><i class="fa fa-check"></i><b>B.2.9</b> Appendices</a></li> </ul></li> <li class="chapter" data-level="B.3" data-path="writing-a-scientific-report.html"><a href="writing-a-scientific-report.html#presenting-species-names"><i class="fa fa-check"></i><b>B.3</b> Presenting species names</a> <ul> <li class="chapter" data-level="B.3.1" data-path="writing-a-scientific-report.html"><a href="writing-a-scientific-report.html#a-last-piece-of-advice"><i class="fa fa-check"></i><b>B.3.1</b> A last piece of advice…</a></li> </ul></li> <li class="chapter" data-level="B.4" data-path="writing-a-scientific-report.html"><a href="writing-a-scientific-report.html#further-reading-1"><i class="fa fa-check"></i><b>B.4</b> Further reading</a></li> </ul></li> <li class="chapter" data-level="C" data-path="one-two-tailed-tests.html"><a href="one-two-tailed-tests.html"><i class="fa fa-check"></i><b>C</b> One-tailed vs. two-tailed tests</a> <ul> <li class="chapter" data-level="C.1" data-path="one-two-tailed-tests.html"><a href="one-two-tailed-tests.html#introduction-11"><i class="fa fa-check"></i><b>C.1</b> Introduction</a></li> <li class="chapter" data-level="C.2" data-path="one-two-tailed-tests.html"><a href="one-two-tailed-tests.html#an-example-of-a-one-tailed-hypothesis"><i class="fa fa-check"></i><b>C.2</b> An example of a one-tailed hypothesis</a></li> <li class="chapter" data-level="C.3" data-path="one-two-tailed-tests.html"><a href="one-two-tailed-tests.html#so-how-do-we-perform-a-one-tailed-t-test"><i class="fa fa-check"></i><b>C.3</b> So how do we perform a one-tailed <em>t</em>-test?</a> <ul> <li class="chapter" data-level="C.3.1" data-path="one-two-tailed-tests.html"><a href="one-two-tailed-tests.html#carrying-out-one-tailed-t-tests-in-r"><i class="fa fa-check"></i><b>C.3.1</b> Carrying out one-tailed <em>t</em>-tests in R</a></li> <li class="chapter" data-level="C.3.2" data-path="one-two-tailed-tests.html"><a href="one-two-tailed-tests.html#when-to-use-and-not-to-use-one-tailed-t-tests"><i class="fa fa-check"></i><b>C.3.2</b> When to use, and not to use, one-tailed <em>t</em>-tests</a></li> </ul></li> </ul></li> <li class="divider"></li> <li><a href="https://github.com/rstudio/bookdown" target="blank">Published with bookdown</a></li> </ul> </nav> </div> <div class="book-body"> <div class="body-inner"> <div class="book-header" role="navigation"> <h1> <i class="fa fa-circle-o-notch fa-spin"></i><a href="./">APS 240: Data Analysis and Statistics with R</a> </h1> </div> <div class="page-wrapper" tabindex="-1" role="main"> <div class="page-inner"> <section class="normal" id="section-"> <div id="statistical-significance-and-p-values" class="section level1" number="8"> <h1><span class="header-section-number">Chapter 8</span> Statistical significance and <em>p</em>-values</h1> <p>Frequentist statistics works by asking <em>what would have happened</em> if we were to repeat a data collection exercise many times, <em>assuming that the population remains the same</em> each time. This is the basic idea we used to generate sampling distributions in the last chapter. The details of this procedure depend on what kind of question we are asking, which varies from one situation to another.</p> <p>What is common to every frequentist technique is that we ultimately have to work out what some kind of sampling distribution looks like. Once we’ve done that we can evaluate how likely a particular result is. This naturally leads onto the most important ideas in frequentist statistics: <em>p</em>-values and statistical significance.</p> <div id="bootstrap" class="section level2" number="8.1"> <h2><span class="header-section-number">8.1</span> Estimating a sampling distribution</h2> <p>Let’s carry on with the plant polymorphism example. Our ultimate goal is to find out if the purple morph frequency is likely to be greater than 25% in the new study population. The suggestion above is that we will need to work out what the sampling distribution of the purple morph frequency estimate looks like to get to this point.</p> <p>At first glance this seems an impossible task in the real world because we would only have access to a single sample? The solution to this problem is surprisingly simple: use the one sample to approximate the population in some way, then work out what the sampling distribution of our estimate should look like by ‘taking samples’ from this approximation.</p> <p>We’ll unpack this idea a bit more before we try it out for real.</p> <div id="bootstrap-overview" class="section level3" number="8.1.1"> <h3><span class="header-section-number">8.1.1</span> Overview of bootstrapping</h3> <p>There are many ways to use a sample to approximate the population it came from. One of the simplest is to <em>pretend the sample is the true population</em>. All we then have to do to get at a sampling distribution is draw new samples from this pretend population. This may sound like ‘cheating’ but it turns out this is a perfectly valid way to construct approximate sampling distributions.</p> <p>We’ll try to get a sense of how this works using a physical analogy based on our plant morph example. Imagine that we have written down the colour of every sampled plant on a different piece of paper and then placed these bits of paper into in a hat. We then do the following:</p> <ol style="list-style-type: decimal"> <li>Pick a piece of paper at random, record its value (purple or green), put the paper back into the hat, and shake the hat about to mix up the bits of paper.</li> </ol> <p>(The shaking here is meant to ensure that each piece of paper has an equal chance of being picked.)</p> <ol start="2" style="list-style-type: decimal"> <li><p>Now pick another piece of paper (we might get the same one), record its value, put that one back into the hat, and shake everything up again.</p></li> <li><p>Repeat this process until we have a recorded new sample of colours that is the same size as the real sample. We have now have generated a ‘new sample’ from the original one.</p></li> </ol> <p>(This process is called ‘sampling with replacement.’ Each artificial sample is called a ‘bootstrapped sample.’)</p> <ol start="4" style="list-style-type: decimal"> <li><p>For each bootstrapped sample, calculate whatever quantity is of interest. In our example, this is the proportion of purple plants sampled.</p></li> <li><p>Repeat steps 1-4 until we have generated a large number of bootstrapped samples. About 10000 is sufficient for most problems.</p></li> </ol> <p>Although it seems like cheating this procedure really does approximate the sampling distribution of the purple plant frequency. It is called <strong>bootstrapping</strong> (or ‘the bootstrap’).</p> <p>The bootstrap is quite a sophisticated technique developed by statistician <a href="https://en.wikipedia.org/wiki/Bradley_Efron">Bradley Efron</a>. We’re not going to use it to solve real data analysis problems and there’s no need to learn how to do it. We’re introducing bootstrapping because it provides a reasonably intuitive way to understand how frequentist methodology works without having to get stuck into any difficult mathematics.</p> </div> <div id="doing-it-for-real" class="section level3" number="8.1.2"> <h3><span class="header-section-number">8.1.2</span> Doing it for real</h3> <p>No one carries out bootstrapping using bits of paper and hat. Generating 10000 bootstrapped samples via such a method would obviously take a very long time! Luckily, computers are very good at carrying out repetitive tasks quickly. We’re going to work through how to implement the bootstrap for our hypothetical example.</p> <div class="do-something"> <p> The best way to understand what follows is to actually work through the example. You are strongly encouraged to do this! </p> </div> <div id="set-up-and-read-the-data" class="section level4 unnumbered"> <h4>Set up and read the data</h4> <p>Assume we had sampled 250 individuals from the new plant population. A data set representing this situation is stored in the Comma Separated Value (CSV) file called ‘MORPH_DATA.CSV.’ Using the template project for the book examples, run through the following steps in your script:</p> <ul> <li><p>Read the data into an R data frame, assigning it the name <code>morph_data</code>.</p></li> <li><p>Use functions like <code>glimpse</code> / <code>str</code> to inspect <code>morph_data</code>.</p></li> <li><p>Use the <code>View</code> function to inspect the data with RStudio.</p></li> </ul> <p>Make sure you can answer the following questions:</p> <ul> <li><p>How many observations are in the data set?</p></li> <li><p>How many variables are in the data set? What are their names?</p></li> <li><p>What kind of variables are they?</p></li> <li><p>What values do the different variables take?</p></li> </ul> <p>The point of all this is to check that we understand our data. <strong>Always examine a dataset after reading it into R</strong>. If we don’t understand how our data is organised and what variables we are working with we are bound to make otherwise avoidable mistakes.</p> <p>What you should have found is that <code>morph_data</code> contains 250 rows and two columns/variables: <code>Colour</code> and <code>Weight</code>. <code>Colour</code> is a categorical variable and <code>Weight</code> is a numeric variable. The <code>Colour</code> variable contains the colour of each plant in the sample.</p> <p>What is that <code>Weight</code> variable all about? Actually… we don’t need this now—we’ll use it in the next chapter.</p> </div> <div id="running-the-bootstrap" class="section level4 unnumbered"> <h4>Running the bootstrap</h4> <p>Now that we understand the data we’re ready to implement bootstrapping. We are going to use a few R programming tricks that you may not have come across before. We’ll explain these as we go but there’s really no need to learn them. Focus on the ‘why’—the logic of what we’re doing—rather than the ‘how.’</p> <p>We want to construct an approximate sampling distribution for the frequency of purple morphs. That means the variable that matters is <code>Colour</code>. Rather than work with this inside the <code>morph_data</code> data frame, we’re going to pull it out using the <code>$</code> operator and assign it a name (<code>plant_morphs</code>):</p> <div class="sourceCode" id="cb9"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb9-1"><a href="statistical-significance-and-p-values.html#cb9-1" aria-hidden="true" tabindex="-1"></a><span class="co"># pull out the &#39;Colour&#39; variable</span></span> <span id="cb9-2"><a href="statistical-significance-and-p-values.html#cb9-2" aria-hidden="true" tabindex="-1"></a>plant_morphs <span class="ot">&lt;-</span> morph_data<span class="sc">$</span>Colour </span></code></pre></div> <p>Next, we’ll take a quick look at the values of <code>plant_morphs</code>:</p> <div class="sourceCode" id="cb10"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb10-1"><a href="statistical-significance-and-p-values.html#cb10-1" aria-hidden="true" tabindex="-1"></a><span class="co"># what is the set of values &#39;plant_morphs&#39; can take?</span></span> <span id="cb10-2"><a href="statistical-significance-and-p-values.html#cb10-2" aria-hidden="true" tabindex="-1"></a><span class="fu">unique</span>(plant_morphs)</span></code></pre></div> <pre><code>## [1] &quot;Green&quot; &quot;Purple&quot;</code></pre> <div class="sourceCode" id="cb12"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb12-1"><a href="statistical-significance-and-p-values.html#cb12-1" aria-hidden="true" tabindex="-1"></a><span class="co"># show the first 100 values</span></span> <span id="cb12-2"><a href="statistical-significance-and-p-values.html#cb12-2" aria-hidden="true" tabindex="-1"></a><span class="fu">head</span>(plant_morphs, <span class="dv">50</span>) </span></code></pre></div> <pre><code>## [1] &quot;Green&quot; &quot;Green&quot; &quot;Green&quot; &quot;Purple&quot; &quot;Green&quot; &quot;Green&quot; &quot;Green&quot; &quot;Green&quot; ## [9] &quot;Green&quot; &quot;Green&quot; &quot;Green&quot; &quot;Green&quot; &quot;Green&quot; &quot;Purple&quot; &quot;Green&quot; &quot;Green&quot; ## [17] &quot;Purple&quot; &quot;Purple&quot; &quot;Green&quot; &quot;Green&quot; &quot;Green&quot; &quot;Green&quot; &quot;Green&quot; &quot;Purple&quot; ## [25] &quot;Green&quot; &quot;Green&quot; &quot;Green&quot; &quot;Green&quot; &quot;Purple&quot; &quot;Purple&quot; &quot;Green&quot; &quot;Green&quot; ## [33] &quot;Green&quot; &quot;Purple&quot; &quot;Purple&quot; &quot;Green&quot; &quot;Green&quot; &quot;Green&quot; &quot;Green&quot; &quot;Purple&quot; ## [41] &quot;Green&quot; &quot;Purple&quot; &quot;Green&quot; &quot;Green&quot; &quot;Purple&quot; &quot;Purple&quot; &quot;Green&quot; &quot;Green&quot; ## [49] &quot;Green&quot; &quot;Green&quot;</code></pre> <p>The last line printed out the first 50 values of <code>plant_morphs</code>. This shows that <code>plant_morphs</code> is a simple character vector with two categories describing the plant colour morph information.</p> <p>Next, we calculate and store the sample size (<code>samp_size</code>) and the point estimate of purple morph frequency (<code>mean_point_est</code>) from the sample:</p> <div class="sourceCode" id="cb14"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb14-1"><a href="statistical-significance-and-p-values.html#cb14-1" aria-hidden="true" tabindex="-1"></a><span class="co"># get the sample size form the length of &#39;plant_morphs&#39;</span></span> <span id="cb14-2"><a href="statistical-significance-and-p-values.html#cb14-2" aria-hidden="true" tabindex="-1"></a>samp_size <span class="ot">&lt;-</span> <span class="fu">length</span>(plant_morphs)</span> <span id="cb14-3"><a href="statistical-significance-and-p-values.html#cb14-3" aria-hidden="true" tabindex="-1"></a>samp_size</span></code></pre></div> <pre><code>## [1] 250</code></pre> <div class="sourceCode" id="cb16"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb16-1"><a href="statistical-significance-and-p-values.html#cb16-1" aria-hidden="true" tabindex="-1"></a><span class="co"># estimate the frequency of purple plants as a %</span></span> <span id="cb16-2"><a href="statistical-significance-and-p-values.html#cb16-2" aria-hidden="true" tabindex="-1"></a>mean_point_est <span class="ot">&lt;-</span> <span class="dv">100</span> <span class="sc">*</span> <span class="fu">sum</span>(plant_morphs <span class="sc">==</span> <span class="st">&quot;Purple&quot;</span>) <span class="sc">/</span> samp_size</span> <span id="cb16-3"><a href="statistical-significance-and-p-values.html#cb16-3" aria-hidden="true" tabindex="-1"></a>mean_point_est</span></code></pre></div> <pre><code>## [1] 30.8</code></pre> <p>The code in the point estimate calculation says “add up all the cases where <code>plant_morphs</code> is equal to ‘purple,’ divide that total by the sample size to get the proportion of purple plants in the sample, then multiply th eproprtion by 100 to turn it into a percentage.” So… we find that 30.8% of plants were purple among our sample of 250 plants.</p> <p>Now we’re ready to start bootstrapping. For convenience, we’ll store the number of bootstrapped samples we want in <code>n_samp</code> (i.e. 10000 in this case):</p> <div class="sourceCode" id="cb18"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb18-1"><a href="statistical-significance-and-p-values.html#cb18-1" aria-hidden="true" tabindex="-1"></a><span class="co"># number of bootstrapped samples we want</span></span> <span id="cb18-2"><a href="statistical-significance-and-p-values.html#cb18-2" aria-hidden="true" tabindex="-1"></a>n_samp <span class="ot">&lt;-</span> <span class="dv">10000</span></span></code></pre></div> <p>Next we need to work out how to resample the values in the <code>plant_morphs</code> vector. The <code>sample</code> function can do this for us:</p> <div class="sourceCode" id="cb19"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb19-1"><a href="statistical-significance-and-p-values.html#cb19-1" aria-hidden="true" tabindex="-1"></a><span class="co"># resample the plant colours</span></span> <span id="cb19-2"><a href="statistical-significance-and-p-values.html#cb19-2" aria-hidden="true" tabindex="-1"></a>samp <span class="ot">&lt;-</span> <span class="fu">sample</span>(plant_morphs, <span class="at">replace =</span> <span class="cn">TRUE</span>)</span> <span id="cb19-3"><a href="statistical-significance-and-p-values.html#cb19-3" aria-hidden="true" tabindex="-1"></a><span class="co"># show the first 50 values of the bootstrapped sample</span></span> <span id="cb19-4"><a href="statistical-significance-and-p-values.html#cb19-4" aria-hidden="true" tabindex="-1"></a><span class="fu">head</span>(samp, <span class="dv">50</span>) </span></code></pre></div> <pre><code>## [1] &quot;Purple&quot; &quot;Green&quot; &quot;Green&quot; &quot;Green&quot; &quot;Green&quot; &quot;Purple&quot; &quot;Purple&quot; &quot;Green&quot; ## [9] &quot;Green&quot; &quot;Purple&quot; &quot;Purple&quot; &quot;Green&quot; &quot;Green&quot; &quot;Green&quot; &quot;Green&quot; &quot;Green&quot; ## [17] &quot;Green&quot; &quot;Green&quot; &quot;Green&quot; &quot;Purple&quot; &quot;Purple&quot; &quot;Purple&quot; &quot;Purple&quot; &quot;Green&quot; ## [25] &quot;Green&quot; &quot;Green&quot; &quot;Purple&quot; &quot;Green&quot; &quot;Green&quot; &quot;Purple&quot; &quot;Green&quot; &quot;Purple&quot; ## [33] &quot;Green&quot; &quot;Green&quot; &quot;Green&quot; &quot;Purple&quot; &quot;Purple&quot; &quot;Green&quot; &quot;Purple&quot; &quot;Green&quot; ## [41] &quot;Purple&quot; &quot;Purple&quot; &quot;Purple&quot; &quot;Green&quot; &quot;Green&quot; &quot;Purple&quot; &quot;Green&quot; &quot;Green&quot; ## [49] &quot;Purple&quot; &quot;Green&quot;</code></pre> <p>The <code>replace = TRUE</code> ensures that we sample with replacement—this is the ‘putting the bits of paper back in the hat’ part of the process.</p> <p>The new <code>samp</code> variable now contains exactly one bootstrapped sample of th 250 plants in the real sample. We only need to extract one number from this—the frequency of purple morphs:</p> <div class="sourceCode" id="cb21"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb21-1"><a href="statistical-significance-and-p-values.html#cb21-1" aria-hidden="true" tabindex="-1"></a><span class="co"># calculate the purple morph frequencyin the bootstrapped sample</span></span> <span id="cb21-2"><a href="statistical-significance-and-p-values.html#cb21-2" aria-hidden="true" tabindex="-1"></a>first_bs_freq <span class="ot">&lt;-</span> <span class="dv">100</span> <span class="sc">*</span> <span class="fu">sum</span>(samp <span class="sc">==</span> <span class="st">&quot;Purple&quot;</span>) <span class="sc">/</span> samp_size</span></code></pre></div> <p>That’s one bootstrapped value of the purple morph frequency. Fine, but we need <span class="math inline">\(10^{4}\)</span> values. We don’t want to have to keep doing this over an over ‘by hand’—making <code>second_bs_freq</code>, <code>third_bs_freq</code>, and so on—because this would be very slow and boring to do.</p> <p>As we said earlier, computers are very good at carrying out repetitive tasks. The <code>replicate</code> function can replicate any R code many times and return the set of results. Here is some R code that repeats what we just did <code>n_samp</code> times, storing the resulting bootstrapped values of purple morph frequency in a numeric vector called <code>boot_out</code>:</p> <div class="sourceCode" id="cb22"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb22-1"><a href="statistical-significance-and-p-values.html#cb22-1" aria-hidden="true" tabindex="-1"></a>boot_out <span class="ot">&lt;-</span> <span class="fu">replicate</span>(n_samp, {</span> <span id="cb22-2"><a href="statistical-significance-and-p-values.html#cb22-2" aria-hidden="true" tabindex="-1"></a> samp <span class="ot">&lt;-</span> <span class="fu">sample</span>(plant_morphs, <span class="at">replace =</span> <span class="cn">TRUE</span>)</span> <span id="cb22-3"><a href="statistical-significance-and-p-values.html#cb22-3" aria-hidden="true" tabindex="-1"></a> <span class="dv">100</span> <span class="sc">*</span> <span class="fu">sum</span>(samp <span class="sc">==</span> <span class="st">&quot;Purple&quot;</span>) <span class="sc">/</span> samp_size</span> <span id="cb22-4"><a href="statistical-significance-and-p-values.html#cb22-4" aria-hidden="true" tabindex="-1"></a>})</span></code></pre></div> <p>The <code>boot_out</code> vector now contains a bootstrapped sample of frequency estimates. Here are the first 30 values rounded to 1 decimal place:</p> <div class="sourceCode" id="cb23"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb23-1"><a href="statistical-significance-and-p-values.html#cb23-1" aria-hidden="true" tabindex="-1"></a><span class="fu">head</span>(boot_out, <span class="dv">30</span>) <span class="sc">%&gt;%</span> <span class="fu">round</span>(<span class="dv">1</span>)</span></code></pre></div> <pre><code>## [1] 31.6 24.0 26.8 29.2 32.8 26.4 34.4 27.6 33.2 32.8 33.6 26.0 34.0 29.6 29.6 ## [16] 31.2 29.6 30.4 29.6 27.2 30.8 28.8 29.6 30.4 32.8 30.0 31.6 35.6 34.4 32.0</code></pre> <p>(We used the pipe <code>%&gt;%</code> to make a code a bit more readable—remember, this won’t work unless the <strong>dplyr</strong> package is loaded.)</p> </div> <div id="making-sense-of-the-bootstrapped-sample" class="section level4 unnumbered"> <h4>Making sense of the bootstrapped sample</h4> <p>What has all this achieved? The numbers in <code>boot_out</code> represent the values of purple morph frequency we can expect to find if we repeated the data collection exercise many times, under the assumption that the purple morph frequency is equal to that of the actual sample. This is a bootstrapped sampling distribution!</p> <p>We can use this bootstrapped sampling distribution in a number of ways. Let’s plot it first get a sense of what it looks like. A histogram is OK here because we have a reasonably large number of possible cases:</p> <div class="figure" style="text-align: center"><span id="fig:boot-samp-dist"></span> <img src="stats-for-bio_files/figure-html/boot-samp-dist-1.png" alt="Bootstrapped sampling distribution of purple morph frequency" width="75%" /> <p class="caption"> Figure 8.1: Bootstrapped sampling distribution of purple morph frequency </p> </div> <p>What the most common values in our bootstrapped sample? The centre of the distribution looks to be round about 30%. We can be a bit more precise by calculating its mean:</p> <div class="sourceCode" id="cb25"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb25-1"><a href="statistical-significance-and-p-values.html#cb25-1" aria-hidden="true" tabindex="-1"></a><span class="fu">mean</span>(boot_out) <span class="sc">%&gt;%</span> <span class="fu">round</span>(<span class="dv">1</span>)</span></code></pre></div> <pre><code>## [1] 30.8</code></pre> <p>This is essentially the same as the point estimate of purple morph frequency from the true sample. In fact, it is guaranteed to be the same if we construct a large enough sample because we’re just resampling the data used to estimate that frequency.</p> <p>A more useful quantity is the standard error (SE) of our estimate. This is <em>defined</em> as being the standard deviation of the sampling distribution. We can calculate that by applying the <code>sd</code> function to the bootstrapped sample:</p> <div class="sourceCode" id="cb27"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb27-1"><a href="statistical-significance-and-p-values.html#cb27-1" aria-hidden="true" tabindex="-1"></a><span class="fu">sd</span>(boot_out) <span class="sc">%&gt;%</span> <span class="fu">round</span>(<span class="dv">1</span>)</span></code></pre></div> <pre><code>## [1] 2.9</code></pre> <p>The standard error is a very useful quantity. Remember, it is a measure of the precision of an estimate. For example, a large SE implies that our sample size was too small to reliably estimate the population mean; a small SE means we have a reliable estimate. Once we have the point estimate of a population parameter its standard error we’re able to start asking questions like, “is the true value likely to be different from 25%.”</p> <p>It is standard practice include the standard error when we report a point estimate of some quantity. Whenever we report a point estimate, we really should also report its standard error, like this:</p> <blockquote> <p>The frequency of purple morph plants (n = 250) was 30.8% (s.e. ± 2.9).</p> </blockquote> <p>Notice we also report the sample size. More on that later in the book.</p> </div> </div> </div> <div id="statistical-significance" class="section level2" number="8.2"> <h2><span class="header-section-number">8.2</span> Statistical significance</h2> <p>Now back to the question that motivated all the work in the last few chapters. Is the purple morph frequency greater than 25% in the new study population? The first thing to realise is that we can never answer a question like this definitively from a sample. We have to carry out some kind of probabilistic assessment instead. To make this assessment, we’re going to do something that looks odd at first glance.</p> <div class="do-something"> <p> <strong>Don’t panic! This stuff is hard.</strong> </p> <p> The ideas in this next section are very abstract and you may not understand them straight away. That’s fine. Don’t worry—these ideas take time to absorb and understand. </p> </div> <div id="carrying-out-the-assessment" class="section level3 unnumbered"> <h3>Carrying out the assessment</h3> <p>We need to make two assumptions to arrive at our probabilistic assessment of whether or not the purple morph frequency greater than 25%:</p> <ol style="list-style-type: decimal"> <li><p>Assume the true value of the purple morph frequency in our new study population is 25%, i.e. we’ll assume the population parameter of interest is the same as that of the original population that motivated this work. In effect, we’re pretending there is really no difference between the populations.</p></li> <li><p>Assume that the form of sampling distribution that we just generated would have been the same if the ‘equal population’ hypothesis were true. That is, the expected ‘shape’ of the sampling distribution would not change if the purple morph frequency really was 25%.</p></li> </ol> <p>That first assumption is an example of a <strong>null hypothesis</strong>. The null hypothesis is an hypothesis of ‘no effect’ or ‘no difference.’ We’re going to revisit this idea many times in future chapters.</p> <p>The second assumption is necessary for the reasoning below to work. In fact, this can be shown to be a pretty reasonable assumption in many situations. We don’t want to get lost in the details though so you will have to trust us on this one.</p> <p>Now we ask a question: if the purple morph frequency in the population really is 25%, what would its corresponding sampling distribution look like? This is called the <strong>null distribution</strong>—the distribution expected under the null hypothesis.</p> <p>If the second assumption is valid, we can actually construct the null distribution from our bootstrapped distribution as follows:</p> <div class="sourceCode" id="cb29"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb29-1"><a href="statistical-significance-and-p-values.html#cb29-1" aria-hidden="true" tabindex="-1"></a>null_dist <span class="ot">&lt;-</span> boot_out <span class="sc">-</span> <span class="fu">mean</span>(boot_out) <span class="sc">+</span> <span class="dv">25</span></span></code></pre></div> <p>All we did here was shift the bootstrapped sampling distribution along until the mean is at 25%. Here’s what that null distribution looks like, along with the original observed estimate of the purple morph frequency:</p> <div class="figure" style="text-align: center"><span id="fig:boot-samp-dist-25"></span> <img src="stats-for-bio_files/figure-html/boot-samp-dist-25-1.png" alt="Sampling distribution of purple morph frequency under the null hypothesis" width="75%" /> <p class="caption"> Figure 8.2: Sampling distribution of purple morph frequency under the null hypothesis </p> </div> <p>The red line shows where the point estimate from the true sample lies. What does this tells us? It looks like the observed purple morph frequency would be quite unlikely to have arisen through sampling variation if the population frequency really was 25%. We can say this because the observed frequency (red line) lies at the end of one ‘tail’ of the sampling distribution over on the right.</p> <p>We need to be able to make a more precise statement than this though. Instead of ‘eyeballing’ the distribution, we can quantify how often the values of the bootstrapped null distribution ended up greater than the observed estimate:</p> <div class="sourceCode" id="cb30"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb30-1"><a href="statistical-significance-and-p-values.html#cb30-1" aria-hidden="true" tabindex="-1"></a>p_value <span class="ot">&lt;-</span> <span class="fu">sum</span>(null_dist <span class="sc">&gt;</span> mean_point_est) <span class="sc">/</span> n_samp</span> <span id="cb30-2"><a href="statistical-significance-and-p-values.html#cb30-2" aria-hidden="true" tabindex="-1"></a>p_value</span></code></pre></div> <pre><code>## [1] 0.0246</code></pre> <p>This number (generally denoted ‘<em>p</em>’) is called a <strong><em>p</em>-value</strong>.</p> </div> <div id="interpreting-the-p-value" class="section level3 unnumbered"> <h3>Interpreting the p-value</h3> <p>What are we supposed to do with the finding <em>p</em> = 0.0246? This is the probability of obtaining a result equal to, or ‘more extreme,’ than that which was actually observed, <em>assuming that the hypothesis under consideration (the null hypothesis) is true</em>. The null hypothesis is one of no effect (or no difference), and so a low <em>p</em>-value can be interpreted as evidence for an effect being present. It’s worth reading that a few times…</p> <p>In our example, it appears that the purple morph frequency we observed is fairly unlikely to occur if its frequency in the new population really was 25%. In biological terms, we take the low <em>p</em>-value as evidence for a difference in purple morph frequency among the populations, i.e. the data supports the prediction that the purple morph is present at a frequency greater than 25% in the new study population.</p> <p>One important question remains: How small does a <em>p</em>-value have to be before we are happy to conclude that the effect we’re interested in is probably present? In practice, we do this by applying a threshold, called a <strong>significance level</strong>. If the <em>p</em>-value is less than the chosen significance level we say the result is said to be <strong>statistically significant</strong>. Most often (in biology at least), we use a significance level of <em>p</em> &lt; 0.05 (5%).</p> <p>Why do we use a significance level of <em>p</em> &lt; 0.05? The short answer is that this is just a convention. Nothing more. There is nothing special about the 5% threshold, other than the fact that it’s the one most often used. Statistical significance has nothing to do with biological significance. Unfortunately, many people are very uncritical about the use of this arbitrary threshold, to the extent that it can be very hard to publish a scientific study if it doesn’t contain ‘statistically significant’ results.</p> </div> </div> <div id="concluding-remarks" class="section level2" number="8.3"> <h2><span class="header-section-number">8.3</span> Concluding remarks</h2> <p>We just carried out a type of statistical test called a <strong>significance test</strong>. It was a bit convoluted reasoning, but the chain of reasoning we just employed underlies all the significance tests we use in this book. The precise details of how to construct such tests will vary from one problem to the next, but ultimately, when using frequentist ideas we always…</p> <ol style="list-style-type: decimal"> <li><p>assume that there is actually no ‘effect’ (the <strong>null hypothesis</strong>), where an effect is expressed in terms of one or more population parameters,</p></li> <li><p>construct the corresponding <strong>null distribution</strong> of the estimated parameter by working out what would happen if we were to take frequent samples in the ‘no effect’ situation,</p></li> </ol> <p>(This is why the word ‘frequentist’ is used to describe this flavour of statistics.)</p> <ol start="3" style="list-style-type: decimal"> <li>then compare the estimated population parameter to the null distribution to arrive at a <strong><em>p</em>-value</strong>, which evaluates how frequently the result, or a more extreme result, would be observed under the hypothesis of no effect.</li> </ol> <p>We used the bootstrap to operationalise that process for our example. Bootstrapping is certainly a useful tool but it is also quite an advanced technique that can be difficult to apply in many settings. We won’t use it any more—the bootstrap was introduced here to demonstrate how frequentist reasoning works.</p> <p>We will focus on simple, ‘off-the-shelf’ statistical tools in this book. The good news is we don’t need to understand the low-level details to use these tools effectively. As long as we’re able to identify the null hypothesis and understand how to interpret the associated <em>p</em>-values we should be in a good position to apply them. These two ideas—null hypotheses and <em>p</em>-values—are so important, we’re going consider them in much greater detail over the next two chapters.</p> </div> </div> </section> </div> </div> </div> <a href="sampling-error.html" class="navigation navigation-prev " aria-label="Previous page"><i class="fa fa-angle-left"></i></a> <a href="statistical-comparisons.html" class="navigation navigation-next " aria-label="Next page"><i class="fa fa-angle-right"></i></a> </div> </div> <script src="libs/gitbook-2.6.7/js/app.min.js"></script> <script src="libs/gitbook-2.6.7/js/lunr.js"></script> <script src="libs/gitbook-2.6.7/js/clipboard.min.js"></script> <script src="libs/gitbook-2.6.7/js/plugin-search.js"></script> <script src="libs/gitbook-2.6.7/js/plugin-sharing.js"></script> <script src="libs/gitbook-2.6.7/js/plugin-fontsettings.js"></script> <script src="libs/gitbook-2.6.7/js/plugin-bookdown.js"></script> <script src="libs/gitbook-2.6.7/js/jquery.highlight.js"></script> <script src="libs/gitbook-2.6.7/js/plugin-clipboard.js"></script> <script> gitbook.require(["gitbook"], function(gitbook) { gitbook.start({ "sharing": { "github": false, "facebook": true, "twitter": true, "linkedin": false, "weibo": false, "instapaper": false, "vk": false, "all": ["facebook", "twitter", "linkedin", "weibo", "instapaper"] }, "fontsettings": { "theme": "white", "family": "sans", "size": 2 }, "edit": { "link": "https://github.com/dzchilds/stats-for-bio/edit/master/2_02_significance_p-values.Rmd", "text": "Edit" }, "history": { "link": null, "text": null }, "view": { "link": null, "text": null }, "download": null, "toc": { "collapse": "section" }, "split_by": "section" }); }); </script> <!-- dynamically load mathjax for compatibility with self-contained --> <script> (function () { var script = document.createElement("script"); script.type = "text/javascript"; var src = "true"; if (src === "" || src === "true") src = "https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-MML-AM_CHTML"; if (location.protocol !== "file:") if (/^https?:/.test(src)) src = src.replace(/^https?:/, ''); script.src = src; document.getElementsByTagName("head")[0].appendChild(script); })(); </script> </body> </html>
Java
# GyroSpiro <strong> <blue> A Digital Whirlygig written in C </blue> </strong> ## Materials (1) [An Arduino](www.arduino.cc)<br> ![Uno](https://upload.wikimedia.org/wikipedia/commons/thumb/9/9d/UnoConnections.jpg/220px-UnoConnections.jpg) <br>(2) A single LED<br> ![LED](http://www.topledlight.com/images/l/201009/12844380890.jpg) <br>(3) The Arduino IDE<br> <em>The Arduino Integrated Development Environment is simple and easy to use! Download it [here](https://www.arduino.cc/en/Main/OldSoftwareReleases)</em> ## Setup * If you're an Arduino first-timer, follow the setup instructions for your partiular operating system [here](https://www.arduino.cc/en/Guide/HomePage). * (...[HERE](https://www.arduino.cc/en/Guide/MacOSX) is a handy set of installation info for Mac OS X) * With Arduino board in hand, push one metallic 'leg' of the LED light into DIGITAL PIN 13 and let the other 'leg' pop into the neighboring pin. * Make sure your Arduino is tethered to your laptop via USB connector, and that the Ardunio IDE is open. Hit Cmd+N to create NEW instructions for it, and paste the Gyro code in! * Hit UPLOAD and watch the magic! ### Details The Arduino has input channels, output channels, and power. The input channels, or PINs, are conductive metallic pins awaiting electronic data - in this case in binary 1111101010100101010. We can send 0 and 1 signals using C with the commands digitalWrite LOW and digitalWrite HIGH. The LED receives these as Off and On signals. When we send these Off/On signals at a certain pace, the LED gives us the illusion of spinning like a gyroscope does. ![Oh So Gyro](https://upload.wikimedia.org/wikipedia/commons/d/d5/Gyroscope_operation.gif) <p xmlns:dct="http://purl.org/dc/terms/"> <a rel="license" href="http://creativecommons.org/publicdomain/mark/1.0/"> <img src="http://i.creativecommons.org/p/mark/1.0/88x31.png" style="border-style: none;" alt="Public Domain Mark" /> </a> <br /> This work (<span property="dct:title">Gyro</span>, by <a href="https://github.com/DhiMalo/GyroSpiro" rel="dct:creator"><span property="dct:title">Aheri Stanford-Asiyo</span></a>), is free of known copyright restrictions. </p>
Java
// npm var chalk = require('chalk') // local var Copper = require('../copper') var copper = new Copper var util = require('../util') module.exports = function (config, wallet, keys, args) { var abort = false var name if (args._.length > 0) { name = args._.join(' ') } var key = copper.newKey() console.log(' pub:', chalk.green(key.pub)) console.log('priv:', chalk.blue(key.priv)) var wkey = {pub: key.pub, priv: key.priv, date: new Date()} if (name) { var keynames = wallet.keys.map(function (k) {return k.name}) if (keynames.indexOf(name) > -1) { console.log('abort!', chalk.red('key named', name, 'already exists')) abort = true } else { wkey.name = name console.log('name:', JSON.stringify(wkey.name)) } } if (!abort) { wallet.keys.push(wkey) util.saveJSON(config.wallet.file, wallet) } }
Java
html, body{ height: 100%; overflow: hidden; } .present{ background-color: #00838F; } md-divider{ margin-top: 5px; } md-list{ padding: 0px; } #listInfo{ color: white; background-color: #263238; } #logo_placeholder{ border-radius: 100%; background-color: #455A64; width:200px; height:200px; margin-bottom: 16px; line-height: 200px; text-align: center; vertical-align: middle; } .md-button:not(.md-fab) { min-width: 10em; } .centerH{ margin: auto; text-align: center; } .active{ background-color: #00838F; }
Java
/* file "ia64/instr.cpp" */ /* Copyright (c) 2002 The President and Fellows of Harvard College All rights reserved. This software is provided under the terms described in the "machine/copyright.h" include file. */ #include <machine/copyright.h> #ifdef USE_PRAGMA_INTERFACE #pragma implementation "ia64/instr.h" #endif #include <machine/machine.h> #include <ia64/opcodes.h> #include <ia64/reg_info.h> #include <ia64/instr.h> #ifdef USE_DMALLOC #include <dmalloc.h> #define new D_NEW #endif using namespace ia64; /* ---------------- is_* helper routines ------------------- */ bool is_ldc_ia64(Instr *mi) { int o = get_opcode(mi); int s = get_stem(o); return ((s == MOV_IMM) || (s == MOVL)); } /* * Unconditional register-to-register copy within a single register file. */ bool is_move_ia64(Instr *mi) { int o = get_opcode(mi); int s = get_stem(o); if (((s == MOV_GR) || (s == MOV_FR)) && !is_predicated(mi)) return true; else return false; } bool is_cmove_ia64(Instr *mi) { int o = get_opcode(mi); int s = get_stem(o); if ((s >= MOV_AR) && (s <= MOVL) && is_predicated(mi)) return true; else return false; } bool has_qpred(Instr *mi) { if (srcs_size(mi) < 1) return false; int loc = srcs_size(mi) - 1; Opnd predOpnd = get_src(mi, loc); if (is_preg(predOpnd)) return true; else return false; } /* * Set qualifying predicate * This routine adds a qualifying predicate to the instruction * i.e. (qp) mov dst = src */ void set_qpred(Instr *mi, Opnd qp) { claim(is_preg(qp), "Attempting to add qp that isn't a preg"); if (has_qpred(mi)) set_src(mi, (srcs_size(mi)-1), qp); else append_src(mi, qp); } /* * Returns the qualifying predicate of the instruction or an error */ Opnd get_qpred(Instr *mi) { Opnd predOpnd; if (has_qpred(mi)) predOpnd = get_src(mi, (srcs_size(mi)-1)); else claim(false, "Oops, no predicate set on instruction!"); return predOpnd; } bool is_predicated_ia64(Instr *mi) { if (!has_qpred(mi)) return false; Opnd predOpnd = get_qpred(mi); if (predOpnd != opnd_pr_const1) return true; else return false; } bool is_line_ia64(Instr *mi) { int o = get_opcode(mi); int s = get_stem(o); return (s == LN); } bool is_ubr_ia64(Instr *mi) { int o = get_opcode(mi); int s = get_stem(o); return (((s == BR) || (s == BRL)) && !is_predicated(mi) && !is_call_ia64(mi) && !is_return_ia64(mi) && !is_mbr(mi)); } bool is_cbr_ia64(Instr *mi) { int o = get_opcode(mi); int s = get_stem(o); return (((s == BR) || (s == BRL)) && is_predicated(mi) && !is_call_ia64(mi) && !is_return_ia64(mi) && !is_mbr(mi)); } bool is_call_ia64(Instr *mi) { int o = get_opcode(mi); int s = get_stem(o); if ((s == BR) || (s == BRL)) { if (get_br_ext(o, 1) == BTYPE_CALL) return true; } return false; } bool is_return_ia64(Instr *mi) { int o = get_opcode(mi); int s = get_stem(o); if ((s == BR) || (s == BRL)) { if (get_br_ext(o, 1) == BTYPE_RET) return true; } else if (s == RFI) return true; return false; } bool is_triary_exp_ia64(Instr *mi) { int o = get_opcode(mi); int s = get_stem(o); switch (s) { case FMA: case FMS: case FNMA: case FPMA: case FPMS: case FPNMA: case FSELECT: case PSHLADD: case PSHRADD: case SHLADD: case SHLADDP4: case SHRP: case XMA: return true; default: return false; } } bool is_binary_exp_ia64(Instr *mi) { int o = get_opcode(mi); int s = get_stem(o); switch (s) { case ADD: case ADDP4: case AND: case ANDCM: case CMP: case CMP4: case CMPXCHG: case FADD: case FAMAX: case FAMIN: case FAND: case FANDCM: case FCMP: case FMAX: case FMERGE: case FMIN: case FMIX: case FMPY: case FNMPY: case FOR: case FPACK: case FPAMAX: case FPAMIN: case FPCMP: case FPMAX: case FPMERGE: case FPMIN: case FPMPY: case FPNMPY: case FPRCPA: case FRCPA: case FSUB: case FSWAP: case FSXT: case FXOR: case MIX: case OR: case PACK: case PADD: case PAVG: case PAVGSUB: case PCMP: case PMAX: case PMIN: case PMPY: case PROBE: case PSAD: case PSHL: case PSHR: case PSUB: case SHL: case SHR: case SUB: case TBIT: case UNPACK: case XMPY: case XOR: return true; default: return false; } } bool is_unary_exp_ia64(Instr *mi) { int o = get_opcode(mi); int s = get_stem(o); switch (s) { case CZX: case FABS: case FCVT_FX: case FCVT_XF: case FCVT_XUF: case FNEG: case FNEGABS: case FNORM: case FPCVT_FX: case FPNEG: case FPNEGABS: case FPRSQRTA: case FRSQRTA: case GETF: case POPCNT: case SETF: case SXT: case TAK: case THASH: case TNAT: case TPA: case TTAG: case ZXT: return true; default: return false; } } bool is_commutative_ia64(Instr *mi) { int opc = get_opcode(mi); int st = get_stem(opc); switch (st) { case ADD: case ADDP4: case AND: case OR: /* The above have an immediate form that cannot be reversed */ return !is_immed(get_src(mi, 1)); case CMP: case CMP4: /* The next set have relational operators that can only be reversed if they are set to "EQUAL" */ return (get_ext(opc, 1) == CREL_EQ); case FCMP: case FPCMP: return (get_ext(opc, 1) == FREL_EQ); case PCMP: return (get_ext(opc, 1) == PREL_EQ); case FADD: case FAMAX: case FAMIN: case FAND: case FMAX: case FMIN: case FMPY: case FNMPY: case FOR: case FPAMAX: case FPAMIN: case FPMAX: case FPMIN: case FPMPY: case FPNMPY: case FXOR: case PADD: case PAVG: case PMAX: case PMIN: case PMPY: case PSAD: case XMPY: case XOR: return true; default: return false; } } bool is_two_opnd_ia64(Instr *instr) { return false; } bool reads_memory_ia64(Instr *instr) { int o = get_opcode(instr); int s = get_stem(o); switch (s) { case CMPXCHG: case FETCHADD: case LD: case LDF: case LDFP: case LFETCH: case XCHG: return true; default: return false; } } bool writes_memory_ia64(Instr *instr) { int o = get_opcode(instr); int s = get_stem(o); switch (s) { case ST: case STF: return true; default: return false; } }
Java
/******************************************************************************* * Copyright (c) 2021 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package com.ibm.ws.jpa.tests.spec10.entity; import org.junit.ClassRule; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; import com.ibm.ws.jpa.tests.spec10.entity.tests.AbstractFATSuite; import com.ibm.ws.jpa.tests.spec10.entity.tests.Entity_EJB; import com.ibm.ws.jpa.tests.spec10.entity.tests.Entity_Web; import componenttest.rules.repeater.FeatureReplacementAction; import componenttest.rules.repeater.RepeatTests; @RunWith(Suite.class) @SuiteClasses({ Entity_EJB.class, Entity_Web.class, componenttest.custom.junit.runner.AlwaysPassesTest.class }) public class FATSuite extends AbstractFATSuite { @ClassRule public static RepeatTests r = RepeatTests.with(FeatureReplacementAction.EE9_FEATURES()); }
Java
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--NewPage--> <HTML> <HEAD> <!-- Generated by javadoc (build 1.6.0_18) on Fri Dec 23 08:32:56 PST 2011 --> <TITLE> SerialBTDevice.InvalidBluetoothAddressException </TITLE> <META NAME="date" CONTENT="2011-12-23"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="SerialBTDevice.InvalidBluetoothAddressException"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <!-- ========= START OF TOP NAVBAR ======= --> <A NAME="navbar_top"><!-- --></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/SerialBTDevice.InvalidBluetoothAddressException.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;<A HREF="../../../../com/t2/biofeedback/device/SerialBTDevice.DeviceNotBondedException.html" title="class in com.t2.biofeedback.device"><B>PREV CLASS</B></A>&nbsp; &nbsp;NEXT CLASS</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../index.html?com/t2/biofeedback/device/SerialBTDevice.InvalidBluetoothAddressException.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="SerialBTDevice.InvalidBluetoothAddressException.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#methods_inherited_from_class_java.lang.Throwable">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;METHOD</FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <!-- ========= END OF TOP NAVBAR ========= --> <HR> <!-- ======== START OF CLASS DATA ======== --> <H2> <FONT SIZE="-1"> com.t2.biofeedback.device</FONT> <BR> Class SerialBTDevice.InvalidBluetoothAddressException</H2> <PRE> java.lang.Object <IMG SRC="../../../../resources/inherit.gif" ALT="extended by ">java.lang.Throwable <IMG SRC="../../../../resources/inherit.gif" ALT="extended by ">java.lang.Exception <IMG SRC="../../../../resources/inherit.gif" ALT="extended by ">java.lang.RuntimeException <IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><B>com.t2.biofeedback.device.SerialBTDevice.InvalidBluetoothAddressException</B> </PRE> <DL> <DT><B>All Implemented Interfaces:</B> <DD>java.io.Serializable</DD> </DL> <DL> <DT><B>Enclosing class:</B><DD><A HREF="../../../../com/t2/biofeedback/device/SerialBTDevice.html" title="class in com.t2.biofeedback.device">SerialBTDevice</A></DD> </DL> <HR> <DL> <DT><PRE>public class <B>SerialBTDevice.InvalidBluetoothAddressException</B><DT>extends java.lang.RuntimeException</DL> </PRE> <P> <DL> <DT><B>See Also:</B><DD><A HREF="../../../../serialized-form.html#com.t2.biofeedback.device.SerialBTDevice.InvalidBluetoothAddressException">Serialized Form</A></DL> <HR> <P> <!-- ======== CONSTRUCTOR SUMMARY ======== --> <A NAME="constructor_summary"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Constructor Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><B><A HREF="../../../../com/t2/biofeedback/device/SerialBTDevice.InvalidBluetoothAddressException.html#SerialBTDevice.InvalidBluetoothAddressException(java.lang.String)">SerialBTDevice.InvalidBluetoothAddressException</A></B>(java.lang.String&nbsp;msg)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> </TABLE> &nbsp; <!-- ========== METHOD SUMMARY =========== --> <A NAME="method_summary"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Method Summary</B></FONT></TH> </TR> </TABLE> &nbsp;<A NAME="methods_inherited_from_class_java.lang.Throwable"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left"><B>Methods inherited from class java.lang.Throwable</B></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE>fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString</CODE></TD> </TR> </TABLE> &nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait</CODE></TD> </TR> </TABLE> &nbsp; <P> <!-- ========= CONSTRUCTOR DETAIL ======== --> <A NAME="constructor_detail"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> <B>Constructor Detail</B></FONT></TH> </TR> </TABLE> <A NAME="SerialBTDevice.InvalidBluetoothAddressException(java.lang.String)"><!-- --></A><H3> SerialBTDevice.InvalidBluetoothAddressException</H3> <PRE> public <B>SerialBTDevice.InvalidBluetoothAddressException</B>(java.lang.String&nbsp;msg)</PRE> <DL> </DL> <!-- ========= END OF CLASS DATA ========= --> <HR> <!-- ======= START OF BOTTOM NAVBAR ====== --> <A NAME="navbar_bottom"><!-- --></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_bottom_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/SerialBTDevice.InvalidBluetoothAddressException.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;<A HREF="../../../../com/t2/biofeedback/device/SerialBTDevice.DeviceNotBondedException.html" title="class in com.t2.biofeedback.device"><B>PREV CLASS</B></A>&nbsp; &nbsp;NEXT CLASS</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../index.html?com/t2/biofeedback/device/SerialBTDevice.InvalidBluetoothAddressException.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="SerialBTDevice.InvalidBluetoothAddressException.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#methods_inherited_from_class_java.lang.Throwable">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;METHOD</FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> </BODY> </HTML>
Java
<?xml version='1.0' encoding='utf-8'?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html lang="en" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="copyright" content="(C) Copyright 2010" /> <meta name="DC.rights.owner" content="(C) Copyright 2010" /> <meta name="DC.Type" content="concept" /> <meta name="DC.Title" content="Defensive Programming" /> <meta name="DC.Relation" scheme="URI" content="GUID-35D7EEFC-B2E4-5444-8875-2A24790E08C2.html" /> <meta name="DC.Relation" scheme="URI" content="index.html" /> <meta name="DC.Relation" scheme="URI" content="GUID-35D7EEFC-B2E4-5444-8875-2A24790E08C2.html" /> <meta name="DC.Format" content="XHTML" /> <meta name="DC.Identifier" content="GUID-D5FD665E-333B-50FF-A46F-6B22C0877285" /> <meta name="DC.Language" content="en" /> <link rel="stylesheet" type="text/css" href="commonltr.css" /> <title> Defensive Programming </title> <link type="text/css" rel="stylesheet" href="css/common.css" media="screen"/> <link type="text/css" rel="stylesheet" href="css/sdl.css" media="screen"/> <!--[if IE]> <link href="css/iefix.css" rel="stylesheet" type="text/css" media="screen" /> <![endif]--> <link rel="stylesheet" type="text/css" href="nokiacxxref.css" /> </head> <body id="GUID-D5FD665E-333B-50FF-A46F-6B22C0877285"> <a name="GUID-D5FD665E-333B-50FF-A46F-6B22C0877285"> <!-- --> </a> <?php include_once (CURRENT_SKIN_PATH.'/sdl_header.html'); ?> <div id="sdl_container"> <div id="leftMenu"> <div id="expandcontractdiv"> <a id="collapseTree" href="javascript:tree.collapseAll()"> Collapse all </a> <a id="index" href="index.html"> Symbian^3 Application Developer Library </a> </div> <iframe style="border:none" height="800" width="300" src="index-toc.html"></iframe> <div id="treeDiv1"> &#160; </div> <script type="text/javascript"> var currentIconMode = 0; window.name="id1197760 "; YAHOO.util.Event.onDOMReady(buildTree, this,true); </script> </div> <div id="sdl_content"> <div class="breadcrumb"> <a href="index.html" title="Symbian^3 Application Developer Library"> Symbian^3 Application Developer Library </a> &gt; <a href="GUID-35D7EEFC-B2E4-5444-8875-2A24790E08C2.html"> Essential Idioms </a> &gt; </div> <h1 class="topictitle1"> Defensive Programming </h1> <div> <p> To help Symbian developers identify potential problems early in development, macros are provided to test for error conditions in functions (asserts) and objects (class invariants). Casting is one well known source of hard-to-find errors. <a href="GUID-D5FD665E-333B-50FF-A46F-6B22C0877285.html#GUID-D5FD665E-333B-50FF-A46F-6B22C0877285__GUID-A0253DF3-098C-5427-9B45-3CEC4F4875AB"> Casting </a> discusses its use. </p> <div class="section" id="GUID-D5FD665E-333B-50FF-A46F-6B22C0877285__GUID-55EB9D07-65F1-572B-8F36-9A442F69B9C2"> <a name="GUID-D5FD665E-333B-50FF-A46F-6B22C0877285__GUID-55EB9D07-65F1-572B-8F36-9A442F69B9C2"> <!-- --> </a> <h2 class="sectiontitle"> Testing conditions with asserts and invariants </h2> <p> One method of catching errors early is to identify conditions that should be true at the beginning and end of functions, and raise errors if they are not. </p> <p> Two mechanisms support this programming style. </p> <ul> <li id="GUID-D5FD665E-333B-50FF-A46F-6B22C0877285__GUID-620C4F53-5465-5A53-9880-7DC27EF752FF"> <a name="GUID-D5FD665E-333B-50FF-A46F-6B22C0877285__GUID-620C4F53-5465-5A53-9880-7DC27EF752FF"> <!-- --> </a> <p> asserts </p> </li> <li id="GUID-D5FD665E-333B-50FF-A46F-6B22C0877285__GUID-9A1881EA-4C72-5359-9D16-553806070556"> <a name="GUID-D5FD665E-333B-50FF-A46F-6B22C0877285__GUID-9A1881EA-4C72-5359-9D16-553806070556"> <!-- --> </a> <p> class invariants </p> </li> </ul> <p> <strong> Asserts </strong> </p> <p> Two macros are supplied for asserting specific conditions in functions: </p> <ul> <li id="GUID-D5FD665E-333B-50FF-A46F-6B22C0877285__GUID-9481684E-5E9D-54B1-87E0-3539F4A29157"> <a name="GUID-D5FD665E-333B-50FF-A46F-6B22C0877285__GUID-9481684E-5E9D-54B1-87E0-3539F4A29157"> <!-- --> </a> <p> <samp class="codeph"> __ASSERT_ALWAYS </samp> to catch run-time invalid input, for both release and debug builds </p> </li> <li id="GUID-D5FD665E-333B-50FF-A46F-6B22C0877285__GUID-4BAF939D-03D4-5D1E-A1BD-79537D930E93"> <a name="GUID-D5FD665E-333B-50FF-A46F-6B22C0877285__GUID-4BAF939D-03D4-5D1E-A1BD-79537D930E93"> <!-- --> </a> <p> <samp class="codeph"> __ASSERT_DEBUG </samp> to catch programming errors, for debug builds only </p> </li> </ul> <p> <strong> Class Invariants </strong> </p> <p> Class invariants are used to test that an object is in a valid state. They are used only in debug builds. </p> <ul> <li id="GUID-D5FD665E-333B-50FF-A46F-6B22C0877285__GUID-F79328BA-61FD-5CB6-9D09-4C4DF6A2459B"> <a name="GUID-D5FD665E-333B-50FF-A46F-6B22C0877285__GUID-F79328BA-61FD-5CB6-9D09-4C4DF6A2459B"> <!-- --> </a> <p> Define class invariants for non-trivial classes using <samp class="codeph"> __DECLARE_TEST </samp> . The class must supply functions that specify its allowed stable states. </p> </li> <li id="GUID-D5FD665E-333B-50FF-A46F-6B22C0877285__GUID-541758DE-21E9-5599-A12B-0208867240CA"> <a name="GUID-D5FD665E-333B-50FF-A46F-6B22C0877285__GUID-541758DE-21E9-5599-A12B-0208867240CA"> <!-- --> </a> <p> To ensures that the object is in a stable state prior to executing the function, call the invariant at the start of all public functions using <samp class="codeph"> __TEST_INVARIANT </samp> . </p> </li> <li id="GUID-D5FD665E-333B-50FF-A46F-6B22C0877285__GUID-20FFC383-0371-5494-8887-D0B3888162EE"> <a name="GUID-D5FD665E-333B-50FF-A46F-6B22C0877285__GUID-20FFC383-0371-5494-8887-D0B3888162EE"> <!-- --> </a> <p> For non-const functions, you can ensure that the object has been left in a stable state by also calling the invariant at the end of the function. </p> </li> </ul> </div> <div class="section" id="GUID-D5FD665E-333B-50FF-A46F-6B22C0877285__GUID-A0253DF3-098C-5427-9B45-3CEC4F4875AB"> <a name="GUID-D5FD665E-333B-50FF-A46F-6B22C0877285__GUID-A0253DF3-098C-5427-9B45-3CEC4F4875AB"> <!-- --> </a> <h2 class="sectiontitle"> Casting </h2> <p> Casts, as in other operating systems, should be used with caution. If a cast seems to be needed, check that this does not reflect a design weakness. </p> <p> The C++ <samp class="codeph"> dynamic_cast </samp> operator should not be used because the Symbian platform does not use C++ exceptions in user code. </p> <p> Note that in early versions of the OS (pre v6.0), the GCC compiler did not support the C++ casting operators. The idiom was then to use instead one of the macros <samp class="codeph"> REINTERPRET_CAST </samp> , <samp class="codeph"> STATIC_CAST </samp> , <samp class="codeph"> CONST_CAST </samp> , and <samp class="codeph"> MUTABLE_CAST </samp> , which were defined as simple C style casts for that compiler. </p> </div> </div> <div> <div class="familylinks"> <div class="parentlink"> <strong> Parent topic: </strong> <a href="GUID-35D7EEFC-B2E4-5444-8875-2A24790E08C2.html"> Essential Idioms </a> </div> </div> </div> <p class="copyright">Copyright &#169;2010 Nokia Corporation and/or its subsidiary(-ies).<br /> All rights reserved. Unless otherwise stated, these materials are provided under the terms of the <a href=" http://www.eclipse.org/legal/epl-v10.html"> Eclipse Public License v1.0</a>.</p> </div> </div> <?php include_once (CURRENT_SKIN_PATH.'/sdl_footer.html'); ?> </body> </html>
Java
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>TB9.2 Example Applications: SemaphoreExample</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css"/> <link type="text/css" rel="stylesheet" href="../css/common.css" media="screen"/> <link type="text/css" rel="stylesheet" href="../css/sdl.css" media="screen"/> <!--[if IE]> <link href="../css/iefix.css" rel="stylesheet" type="text/css" media="screen" /> <![endif]--> </head> <body class="kernelguide"> <?php include_once (CURRENT_SKIN_PATH.'/sdl_header.html'); ?> <div id="sdl_container"> <div id="leftMenu"> <div id="expandcontractdiv"> <a id="collapseTree" href="javascript:tree.collapseAll()"> Collapse all </a> <a id="index" href="index.html"> Symbian^3 Product Developer Library </a> </div> <iframe style="border:none" height="800" width="300" src="index-toc.html"></iframe> <div id="treeDiv1"> &#160; </div> <script type="text/javascript"> var currentIconMode = 0; YAHOO.util.Event.onDOMReady(buildTree, this,true); </script> </div> <div id="sdl_content"> <!-- Generated by Doxygen 1.6.2 --> <div class="contents"> <h1><a class="anchor" id="guid-34775913-c5c2-41ba-a591-827039bbe7af">SemaphoreExample </a></h1><p>Source files:</p> <ul> <li><a href="_base_2_semaphore_example_2group_2_bld_8inf_source.html">group\bld.inf</a></li> <li><a href="_semaphore_example_8mmp_source.html">group\SemaphoreExample.mmp</a></li> <li><a href="_c_database_8h_source.html">inc\CDatabase.h</a></li> <li><a href="_semaphore_example_8h_source.html">inc\SemaphoreExample.h</a></li> <li><a href="_c_database_8cpp_source.html">src\CDatabase.cpp</a></li> <li><a href="_semaphore_example_8cpp_source.html">src\SemaphoreExample.cpp</a> </li> </ul> </div> <hr size="1"/><address style="text-align: right;"><small>Generated by&nbsp; <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.2 </small></address> <p class="copyright">Copyright &#169;2010 Nokia Corporation and/or its subsidiary(-ies).<br /> All rights reserved. Unless otherwise stated, these materials are provided under the terms of the <a href=" http://www.eclipse.org/legal/epl-v10.html"> Eclipse Public License v1.0</a>.</p> </div> </div> <?php include_once (CURRENT_SKIN_PATH.'/sdl_footer.html'); ?> </body> </html>
Java
/* * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ package org.opendaylight.controller.config.manager.testingservices.parallelapsp; import javax.management.ObjectName; import org.opendaylight.controller.config.api.annotations.ServiceInterfaceAnnotation; @ServiceInterfaceAnnotation(value = TestingParallelAPSPConfigMXBean.NAME, osgiRegistrationType = TestingAPSP.class) public interface TestingParallelAPSPConfigMXBean { static final String NAME = "apsp"; ObjectName getThreadPool(); void setThreadPool(ObjectName threadPoolName); String getSomeParam(); void setSomeParam(String s); // for reporting. this should be moved to runtime jmx bean Integer getMaxNumberOfThreads(); }
Java
/* * (C) Copyright 2017 Netcentric AG. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html */ package biz.netcentric.cq.tools.actool.configreader; import java.util.Map; import biz.netcentric.cq.tools.actool.configmodel.AceBean; import biz.netcentric.cq.tools.actool.configmodel.AuthorizableConfigBean; import biz.netcentric.cq.tools.actool.validators.exceptions.AcConfigBeanValidationException; /** Subclass of YamlConfigReader only used for unit tests. Overrides bean setup-methods from YamlConfigReader to set up TestAceBean and * TestAuthorizableConfigBean in order to set the assertedExceptionString set in test yaml files for later evaluation in unit tests. Also * overrides getNewAceBean() and getNewAuthorizableConfigBean() to return the correct testing type in order to make the downcast in * overridden setup-methods possible. * * @author jochenkoschorke */ public class TestYamlConfigReader extends YamlConfigReader { protected final String ASSERTED_EXCEPTION = "assertedException"; @Override protected void setupAceBean(final String principal, final Map<String, ?> currentAceDefinition, final AceBean tmpAclBean, String sourceFile) { super.setupAceBean(principal, currentAceDefinition, tmpAclBean, sourceFile); ((TestAceBean) tmpAclBean).setAssertedExceptionString(getMapValueAsString( currentAceDefinition, ASSERTED_EXCEPTION)); } @Override protected void setupAuthorizableBean( final AuthorizableConfigBean authorizableConfigBean, final Map<String, Object> currentPrincipalDataMap, final String authorizableId, boolean isGroupSection) throws AcConfigBeanValidationException { super.setupAuthorizableBean(authorizableConfigBean, currentPrincipalDataMap, authorizableId, isGroupSection); ((TestAuthorizableConfigBean) authorizableConfigBean).setAssertedExceptionString(getMapValueAsString( currentPrincipalDataMap, ASSERTED_EXCEPTION)); } @Override protected AceBean getNewAceBean() { return new TestAceBean(); } @Override protected AuthorizableConfigBean getNewAuthorizableConfigBean() { return new TestAuthorizableConfigBean(); } }
Java
/** * Created by visual studio 2010 * User: xuheng * Date: 12-3-6 * Time: 下午21:23 * To get the value of editor and output the value . */ using System; using System.Web; namespace FineUI.Examples { public class getContent : IHttpHandler { public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/html"; //获取数据 string content = context.Server.HtmlEncode(context.Request.Form["myEditor"]); string content1 = context.Server.HtmlEncode(context.Request.Form["myEditor1"]); //存入数据库或者其他操作 //------------- //显示 context.Response.Write("<script src='../uparse.js' type='text/javascript'></script>"); context.Response.Write( "<script>uParse('.content',{" + "'highlightJsUrl':'../third-party/SyntaxHighlighter/shCore.js'," + "'highlightCssUrl':'../third-party/SyntaxHighlighter/shCoreDefault.css'" + "})" + "</script>"); context.Response.Write("第1个编辑器的值"); context.Response.Write("<div class='content'>" + context.Server.HtmlDecode(content) + "</div>"); context.Response.Write("<br/>第2个编辑器的值<br/>"); context.Response.Write("<textarea class='content' style='width:500px;height:300px;'>" + context.Server.HtmlDecode(content1) + "</textarea><br/>"); } public bool IsReusable { get { return false; } } } }
Java
/******************************************************************************* * Copyright (c) 2004 Actuate Corporation. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Actuate Corporation - initial API and implementation * Ing. Gerd Stockner (Mayr-Melnhof Karton Gesellschaft m.b.H.) - modifications * Christian Voller (Mayr-Melnhof Karton Gesellschaft m.b.H.) - modifications * CoSMIT GmbH - publishing, maintenance *******************************************************************************/ package com.mmkarton.mx7.reportgenerator.sqledit; import java.sql.Types; import java.text.Bidi; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.eclipse.datatools.connectivity.oda.IParameterMetaData; import org.eclipse.datatools.connectivity.oda.IResultSetMetaData; import org.eclipse.datatools.connectivity.oda.OdaException; import org.eclipse.datatools.connectivity.oda.design.DataSetParameters; import org.eclipse.datatools.connectivity.oda.design.DesignFactory; import org.eclipse.datatools.connectivity.oda.design.ParameterDefinition; import org.eclipse.datatools.connectivity.oda.design.ParameterMode; import org.eclipse.datatools.connectivity.oda.design.ResultSetColumns; import org.eclipse.datatools.connectivity.oda.design.ResultSetDefinition; import org.eclipse.datatools.connectivity.oda.design.ui.designsession.DesignSessionUtil; import com.mmkarton.mx7.reportgenerator.engine.SQLQuery; import com.mmkarton.mx7.reportgenerator.jdbc.ResultSetMetaData; import com.mmkarton.mx7.reportgenerator.wizards.BIRTReportWizard; /** * The utility class for SQLDataSetEditorPage * */ public class SQLUtility { /** * save the dataset design's metadata info * * @param design */ public static SQLQuery getBIRTSQLFields(String sqlQueryText) { MetaDataRetriever retriever = new MetaDataRetriever( addDummyWhere(sqlQueryText)); IResultSetMetaData resultsetMeta = retriever.getResultSetMetaData( ); IParameterMetaData paramMeta = retriever.getParameterMetaData( ); return saveDataSetDesign( resultsetMeta, paramMeta ,sqlQueryText); } public static SQLQuery saveDataSetDesign( IResultSetMetaData meta, IParameterMetaData paramMeta, String sqlQueryText ) { try { setParameterMetaData( paramMeta ); // set resultset metadata return setResultSetMetaData(meta, sqlQueryText ); } catch ( OdaException e ) { return null; } } /** * Set parameter metadata in dataset design * * @param design * @param query */ private static void setParameterMetaData(IParameterMetaData paramMeta ) { try { // set parameter metadata mergeParameterMetaData( paramMeta ); } catch ( OdaException e ) { // do nothing, to keep the parameter definition in dataset design // dataSetDesign.setParameters( null ); } } /** * solve the BIDI line problem * @param lineText * @return */ public static int[] getBidiLineSegments( String lineText ) { int[] seg = null; if ( lineText != null && lineText.length( ) > 0 && !new Bidi( lineText, Bidi.DIRECTION_LEFT_TO_RIGHT ).isLeftToRight( ) ) { List list = new ArrayList( ); // Punctuations will be regarded as delimiter so that different // splits could be rendered separately. Object[] splits = lineText.split( "\\p{Punct}" ); // !=, <> etc. leading to "" will be filtered to meet the rule that // segments must not have duplicates. for ( int i = 0; i < splits.length; i++ ) { if ( !splits[i].equals( "" ) ) list.add( splits[i] ); } splits = list.toArray( ); // first segment must be 0 // last segment does not necessarily equal to line length seg = new int[splits.length + 1]; for ( int i = 0; i < splits.length; i++ ) { seg[i + 1] = lineText.indexOf( (String) splits[i], seg[i] ) + ( (String) splits[i] ).length( ); } } return seg; } /** * Return pre-defined query text pattern with every element in a cell. * * @return pre-defined query text */ public static String getQueryPresetTextString( String extensionId ) { String[] lines = getQueryPresetTextArray( extensionId ); String result = ""; if ( lines != null && lines.length > 0 ) { for ( int i = 0; i < lines.length; i++ ) { result = result + lines[i] + ( i == lines.length - 1 ? " " : " \n" ); } } return result; } /** * Return pre-defined query text pattern with every element in a cell in an * Array * * @return pre-defined query text in an Array */ public static String[] getQueryPresetTextArray( String extensionId ) { final String[] lines; if ( extensionId.equals( "org.eclipse.birt.report.data.oda.jdbc.SPSelectDataSet" ) ) lines = new String[]{ "{call procedure-name(arg1,arg2, ...)}" }; else lines = new String[]{ "select", "from" }; return lines; } /** * merge paramter meta data between dataParameter and datasetDesign's * parameter. * * @param dataSetDesign * @param md * @throws OdaException */ private static void mergeParameterMetaData( IParameterMetaData md ) throws OdaException { if ( md == null) return; DataSetParameters dataSetParameter = DesignSessionUtil.toDataSetParametersDesign( md, ParameterMode.IN_LITERAL ); if ( dataSetParameter != null ) { Iterator iter = dataSetParameter.getParameterDefinitions( ) .iterator( ); while ( iter.hasNext( ) ) { ParameterDefinition defn = (ParameterDefinition) iter.next( ); proccessParamDefn( defn, dataSetParameter ); } } //dataSetDesign.setParameters( dataSetParameter ); } /** * Process the parameter definition for some special case * * @param defn * @param parameters */ private static void proccessParamDefn( ParameterDefinition defn, DataSetParameters parameters ) { if ( defn.getAttributes( ).getNativeDataTypeCode( ) == Types.NULL ) { defn.getAttributes( ).setNativeDataTypeCode( Types.CHAR ); } } /** * Set the resultset metadata in dataset design * * @param dataSetDesign * @param md * @throws OdaException */ private static SQLQuery setResultSetMetaData(IResultSetMetaData md, String sqlQueryText ) throws OdaException { SQLQuery query=null; ResultSetColumns columns = DesignSessionUtil.toResultSetColumnsDesign( md ); if ( columns != null ) { query=new SQLQuery(); ResultSetDefinition resultSetDefn = DesignFactory.eINSTANCE.createResultSetDefinition( ); resultSetDefn.setResultSetColumns( columns ); int count=resultSetDefn.getResultSetColumns().getResultColumnDefinitions().size(); query.setSqlQueryString(sqlQueryText); for (int i = 0; i < count; i++) { int columntype=-1; String columname=""; try { ResultSetMetaData dataset=(ResultSetMetaData)md; columname=dataset.getColumnName(i+1); columntype=dataset.getColumnType(i+1); } catch (Exception e) { return null; } query.setFields(columname, columntype); } } return query; } private static String addDummyWhere(String sqlQueryText) { if (sqlQueryText==null) { return null; } String tempsql = sqlQueryText.toUpperCase(); String sql_query=""; int where_pos = tempsql.toUpperCase().indexOf("WHERE"); if (where_pos > 0) { sql_query = tempsql.substring(0,where_pos ); } else { sql_query = tempsql; } return sql_query+" Where 1=2"; } }
Java