How to use name class

Best Quick code snippet using name

languages.php

Source:languages.php Github

copy

Full Screen

...703 'isoName' => 'Venda',704 'nativeName' => 'Tshivenḓa',705 ],706 'vi' => [707 'isoName' => 'Vietnamese',708 'nativeName' => 'Tiếng Việt',709 ],710 'vo' => [711 'isoName' => 'Volapük',712 'nativeName' => 'Volapük',713 ],714 'wa' => [715 'isoName' => 'Walloon',716 'nativeName' => 'Walon',717 ],718 'cy' => [719 'isoName' => 'Welsh',720 'nativeName' => 'Cymraeg',721 ],...

Full Screen

Full Screen

LanguageCodes.php

Source:LanguageCodes.php Github

copy

Full Screen

1<?php2namespace Grav\Common\Language;3/**4 * Language and translation functionality for Grav5 */6class LanguageCodes7{8 protected static $codes = [9 "ab" => [10 "name" => "Abkhaz",11 "nativeName" => "аҧсуа"12 ],13 "aa" => [14 "name" => "Afar",15 "nativeName" => "Afaraf"16 ],17 "af" => [18 "name" => "Afrikaans",19 "nativeName" => "Afrikaans"20 ],21 "ak" => [22 "name" => "Akan",23 "nativeName" => "Akan"24 ],25 "sq" => [26 "name" => "Albanian",27 "nativeName" => "Shqip"28 ],29 "am" => [30 "name" => "Amharic",31 "nativeName" => "አማርኛ"32 ],33 "ar" => [34 "name" => "Arabic",35 "nativeName" => "العربية"36 ],37 "an" => [38 "name" => "Aragonese",39 "nativeName" => "Aragonés"40 ],41 "hy" => [42 "name" => "Armenian",43 "nativeName" => "Հայերեն"44 ],45 "as" => [46 "name" => "Assamese",47 "nativeName" => "অসমীয়া"48 ],49 "av" => [50 "name" => "Avaric",51 "nativeName" => "авар мацӀ"52 ],53 "ae" => [54 "name" => "Avestan",55 "nativeName" => "avesta"56 ],57 "ay" => [58 "name" => "Aymara",59 "nativeName" => "aymar aru"60 ],61 "az" => [62 "name" => "Azerbaijani",63 "nativeName" => "azərbaycan dili"64 ],65 "bm" => [66 "name" => "Bambara",67 "nativeName" => "bamanankan"68 ],69 "ba" => [70 "name" => "Bashkir",71 "nativeName" => "башҡорт теле"72 ],73 "eu" => [74 "name" => "Basque",75 "nativeName" => "euskara"76 ],77 "be" => [78 "name" => "Belarusian",79 "nativeName" => "Беларуская"80 ],81 "bn" => [82 "name" => "Bengali",83 "nativeName" => "বাংলা"84 ],85 "bh" => [86 "name" => "Bihari",87 "nativeName" => "भोजपुरी"88 ],89 "bi" => [90 "name" => "Bislama",91 "nativeName" => "Bislama"92 ],93 "bs" => [94 "name" => "Bosnian",95 "nativeName" => "bosanski jezik"96 ],97 "br" => [98 "name" => "Breton",99 "nativeName" => "brezhoneg"100 ],101 "bg" => [102 "name" => "Bulgarian",103 "nativeName" => "български език"104 ],105 "my" => [106 "name" => "Burmese",107 "nativeName" => "ဗမာစာ"108 ],109 "ca" => [110 "name" => "Catalan",111 "nativeName" => "Català"112 ],113 "ch" => [114 "name" => "Chamorro",115 "nativeName" => "Chamoru"116 ],117 "ce" => [118 "name" => "Chechen",119 "nativeName" => "нохчийн мотт"120 ],121 "ny" => [122 "name" => "Chichewa",123 "nativeName" => "chiCheŵa"124 ],125 "zh" => [126 "name" => "Chinese",127 "nativeName" => "中文"128 ],129 "cv" => [130 "name" => "Chuvash",131 "nativeName" => "чӑваш чӗлхи"132 ],133 "kw" => [134 "name" => "Cornish",135 "nativeName" => "Kernewek"136 ],137 "co" => [138 "name" => "Corsican",139 "nativeName" => "corsu"140 ],141 "cr" => [142 "name" => "Cree",143 "nativeName" => "ᓀᐦᐃᔭᐍᐏᐣ"144 ],145 "hr" => [146 "name" => "Croatian",147 "nativeName" => "hrvatski"148 ],149 "cs" => [150 "name" => "Czech",151 "nativeName" => "česky"152 ],153 "da" => [154 "name" => "Danish",155 "nativeName" => "dansk"156 ],157 "dv" => [158 "name" => "Divehi",159 "nativeName" => "ދިވެހި"160 ],161 "nl" => [162 "name" => "Dutch",163 "nativeName" => "Nederlands"164 ],165 "en" => [166 "name" => "English",167 "nativeName" => "English"168 ],169 "eo" => [170 "name" => "Esperanto",171 "nativeName" => "Esperanto"172 ],173 "et" => [174 "name" => "Estonian",175 "nativeName" => "eesti"176 ],177 "ee" => [178 "name" => "Ewe",179 "nativeName" => "Eʋegbe"180 ],181 "fo" => [182 "name" => "Faroese",183 "nativeName" => "føroyskt"184 ],185 "fj" => [186 "name" => "Fijian",187 "nativeName" => "vosa Vakaviti"188 ],189 "fi" => [190 "name" => "Finnish",191 "nativeName" => "suomi"192 ],193 "fr" => [194 "name" => "French",195 "nativeName" => "Français"196 ],197 "ff" => [198 "name" => "Fula",199 "nativeName" => "Fulfulde"200 ],201 "gl" => [202 "name" => "Galician",203 "nativeName" => "Galego"204 ],205 "ka" => [206 "name" => "Georgian",207 "nativeName" => "ქართული"208 ],209 "de" => [210 "name" => "German",211 "nativeName" => "Deutsch"212 ],213 "el" => [214 "name" => "Greek",215 "nativeName" => "Ελληνικά"216 ],217 "gn" => [218 "name" => "Guaraní",219 "nativeName" => "Avañeẽ"220 ],221 "gu" => [222 "name" => "Gujarati",223 "nativeName" => "ગુજરાતી"224 ],225 "ht" => [226 "name" => "Haitian",227 "nativeName" => "Kreyòl ayisyen"228 ],229 "ha" => [230 "name" => "Hausa",231 "nativeName" => "هَوُسَ"232 ],233 "he" => [234 "name" => "Hebrew",235 "nativeName" => "עברית"236 ],237 "hz" => [238 "name" => "Herero",239 "nativeName" => "Otjiherero"240 ],241 "hi" => [242 "name" => "Hindi",243 "nativeName" => "हिन्दी"244 ],245 "ho" => [246 "name" => "Hiri Motu",247 "nativeName" => "Hiri Motu"248 ],249 "hu" => [250 "name" => "Hungarian",251 "nativeName" => "Magyar"252 ],253 "ia" => [254 "name" => "Interlingua",255 "nativeName" => "Interlingua"256 ],257 "id" => [258 "name" => "Indonesian",259 "nativeName" => "Bahasa Indonesia"260 ],261 "ie" => [262 "name" => "Interlingue",263 "nativeName" => "Interlingue"264 ],265 "ga" => [266 "name" => "Irish",267 "nativeName" => "Gaeilge"268 ],269 "ig" => [270 "name" => "Igbo",271 "nativeName" => "Asụsụ Igbo"272 ],273 "ik" => [274 "name" => "Inupiaq",275 "nativeName" => "Iñupiaq"276 ],277 "io" => [278 "name" => "Ido",279 "nativeName" => "Ido"280 ],281 "is" => [282 "name" => "Icelandic",283 "nativeName" => "Íslenska"284 ],285 "it" => [286 "name" => "Italian",287 "nativeName" => "Italiano"288 ],289 "iu" => [290 "name" => "Inuktitut",291 "nativeName" => "ᐃᓄᒃᑎᑐᑦ"292 ],293 "ja" => [294 "name" => "Japanese",295 "nativeName" => "日本語"296 ],297 "jv" => [298 "name" => "Javanese",299 "nativeName" => "basa Jawa"300 ],301 "kl" => [302 "name" => "Kalaallisut",303 "nativeName" => "kalaallisut"304 ],305 "kn" => [306 "name" => "Kannada",307 "nativeName" => "ಕನ್ನಡ"308 ],309 "kr" => [310 "name" => "Kanuri",311 "nativeName" => "Kanuri"312 ],313 "ks" => [314 "name" => "Kashmiri",315 "nativeName" => "कश्मीरी"316 ],317 "kk" => [318 "name" => "Kazakh",319 "nativeName" => "Қазақ тілі"320 ],321 "km" => [322 "name" => "Khmer",323 "nativeName" => "ភាសាខ្មែរ"324 ],325 "ki" => [326 "name" => "Kikuyu",327 "nativeName" => "Gĩkũyũ"328 ],329 "rw" => [330 "name" => "Kinyarwanda",331 "nativeName" => "Ikinyarwanda"332 ],333 "ky" => [334 "name" => "Kirghiz",335 "nativeName" => "кыргыз тили"336 ],337 "kv" => [338 "name" => "Komi",339 "nativeName" => "коми кыв"340 ],341 "kg" => [342 "name" => "Kongo",343 "nativeName" => "KiKongo"344 ],345 "ko" => [346 "name" => "Korean",347 "nativeName" => "한국어"348 ],349 "ku" => [350 "name" => "Kurdish",351 "nativeName" => "كوردی‎"352 ],353 "kj" => [354 "name" => "Kwanyama",355 "nativeName" => "Kuanyama"356 ],357 "la" => [358 "name" => "Latin",359 "nativeName" => "latine"360 ],361 "lb" => [362 "name" => "Luxembourgish",363 "nativeName" => "Lëtzebuergesch"364 ],365 "lg" => [366 "name" => "Luganda",367 "nativeName" => "Luganda"368 ],369 "li" => [370 "name" => "Limburgish",371 "nativeName" => "Limburgs"372 ],373 "ln" => [374 "name" => "Lingala",375 "nativeName" => "Lingála"376 ],377 "lo" => [378 "name" => "Lao",379 "nativeName" => "ພາສາລາວ"380 ],381 "lt" => [382 "name" => "Lithuanian",383 "nativeName" => "lietuvių kalba"384 ],385 "lu" => [386 "name" => "Luba-Katanga",387 "nativeName" => "Luba-Katanga"388 ],389 "lv" => [390 "name" => "Latvian",391 "nativeName" => "latviešu valoda"392 ],393 "gv" => [394 "name" => "Manx",395 "nativeName" => "Gaelg"396 ],397 "mk" => [398 "name" => "Macedonian",399 "nativeName" => "македонски јазик"400 ],401 "mg" => [402 "name" => "Malagasy",403 "nativeName" => "Malagasy fiteny"404 ],405 "ms" => [406 "name" => "Malay",407 "nativeName" => "بهاس ملايو‎"408 ],409 "ml" => [410 "name" => "Malayalam",411 "nativeName" => "മലയാളം"412 ],413 "mt" => [414 "name" => "Maltese",415 "nativeName" => "Malti"416 ],417 "mi" => [418 "name" => "Māori",419 "nativeName" => "te reo Māori"420 ],421 "mr" => [422 "name" => "Marathi",423 "nativeName" => "मराठी"424 ],425 "mh" => [426 "name" => "Marshallese",427 "nativeName" => "Kajin M̧ajeļ"428 ],429 "mn" => [430 "name" => "Mongolian",431 "nativeName" => "монгол"432 ],433 "na" => [434 "name" => "Nauru",435 "nativeName" => "Ekakairũ Naoero"436 ],437 "nv" => [438 "name" => "Navajo",439 "nativeName" => "Diné bizaad"440 ],441 "nb" => [442 "name" => "Norwegian Bokmål",443 "nativeName" => "Norsk bokmål"444 ],445 "nd" => [446 "name" => "North Ndebele",447 "nativeName" => "isiNdebele"448 ],449 "ne" => [450 "name" => "Nepali",451 "nativeName" => "नेपाली"452 ],453 "ng" => [454 "name" => "Ndonga",455 "nativeName" => "Owambo"456 ],457 "nn" => [458 "name" => "Norwegian Nynorsk",459 "nativeName" => "Norsk nynorsk"460 ],461 "no" => [462 "name" => "Norwegian",463 "nativeName" => "Norsk"464 ],465 "ii" => [466 "name" => "Nuosu",467 "nativeName" => "ꆈꌠ꒿ Nuosuhxop"468 ],469 "nr" => [470 "name" => "South Ndebele",471 "nativeName" => "isiNdebele"472 ],473 "oc" => [474 "name" => "Occitan",475 "nativeName" => "Occitan"476 ],477 "oj" => [478 "name" => "Ojibwe, Ojibwa",479 "nativeName" => "ᐊᓂᔑᓈᐯᒧᐎᓐ"480 ],481 "cu" => [482 "name" => "Church Slavic",483 "nativeName" => "ѩзыкъ словѣньскъ"484 ],485 "om" => [486 "name" => "Oromo",487 "nativeName" => "Afaan Oromoo"488 ],489 "or" => [490 "name" => "Oriya",491 "nativeName" => "ଓଡ଼ିଆ"492 ],493 "os" => [494 "name" => "Ossetian",495 "nativeName" => "ирон æвзаг"496 ],497 "pa" => [498 "name" => "Panjabi",499 "nativeName" => "ਪੰਜਾਬੀ"500 ],501 "pi" => [502 "name" => "Pāli",503 "nativeName" => "पाऴि"504 ],505 "fa" => [506 "name" => "Persian",507 "nativeName" => "فارسی"508 ],509 "pl" => [510 "name" => "Polish",511 "nativeName" => "polski"512 ],513 "ps" => [514 "name" => "Pashto",515 "nativeName" => "پښتو"516 ],517 "pt" => [518 "name" => "Portuguese",519 "nativeName" => "Português"520 ],521 "qu" => [522 "name" => "Quechua",523 "nativeName" => "Runa Simi"524 ],525 "rm" => [526 "name" => "Romansh",527 "nativeName" => "rumantsch grischun"528 ],529 "rn" => [530 "name" => "Kirundi",531 "nativeName" => "kiRundi"532 ],533 "ro" => [534 "name" => "Romanian",535 "nativeName" => "română"536 ],537 "ru" => [538 "name" => "Russian",539 "nativeName" => "Русский"540 ],541 "sa" => [542 "name" => "Sanskrit",543 "nativeName" => "संस्कृतम्"544 ],545 "sc" => [546 "name" => "Sardinian",547 "nativeName" => "sardu"548 ],549 "sd" => [550 "name" => "Sindhi",551 "nativeName" => "सिन्धी"552 ],553 "se" => [554 "name" => "Northern Sami",555 "nativeName" => "Davvisámegiella"556 ],557 "sm" => [558 "name" => "Samoan",559 "nativeName" => "gagana faa Samoa"560 ],561 "sg" => [562 "name" => "Sango",563 "nativeName" => "yângâ tî sängö"564 ],565 "sr" => [566 "name" => "Serbian",567 "nativeName" => "српски језик"568 ],569 "gd" => [570 "name" => "Scottish Gaelic",571 "nativeName" => "Gàidhlig"572 ],573 "sn" => [574 "name" => "Shona",575 "nativeName" => "chiShona"576 ],577 "si" => [578 "name" => "Sinhala",579 "nativeName" => "සිංහල"580 ],581 "sk" => [582 "name" => "Slovak",583 "nativeName" => "slovenčina"584 ],585 "sl" => [586 "name" => "Slovene",587 "nativeName" => "slovenščina"588 ],589 "so" => [590 "name" => "Somali",591 "nativeName" => "Soomaaliga"592 ],593 "st" => [594 "name" => "Southern Sotho",595 "nativeName" => "Sesotho"596 ],597 "es" => [598 "name" => "Spanish",599 "nativeName" => "Español"600 ],601 "su" => [602 "name" => "Sundanese",603 "nativeName" => "Basa Sunda"604 ],605 "sw" => [606 "name" => "Swahili",607 "nativeName" => "Kiswahili"608 ],609 "ss" => [610 "name" => "Swati",611 "nativeName" => "SiSwati"612 ],613 "sv" => [614 "name" => "Swedish",615 "nativeName" => "svenska"616 ],617 "ta" => [618 "name" => "Tamil",619 "nativeName" => "தமிழ்"620 ],621 "te" => [622 "name" => "Telugu",623 "nativeName" => "తెలుగు"624 ],625 "tg" => [626 "name" => "Tajik",627 "nativeName" => "тоҷикӣ"628 ],629 "th" => [630 "name" => "Thai",631 "nativeName" => "ไทย"632 ],633 "ti" => [634 "name" => "Tigrinya",635 "nativeName" => "ትግርኛ"636 ],637 "bo" => [638 "name" => "Tibetan",639 "nativeName" => "བོད་ཡིག"640 ],641 "tk" => [642 "name" => "Turkmen",643 "nativeName" => "Türkmen"644 ],645 "tl" => [646 "name" => "Tagalog",647 "nativeName" => "Wikang Tagalog"648 ],649 "tn" => [650 "name" => "Tswana",651 "nativeName" => "Setswana"652 ],653 "to" => [654 "name" => "Tonga",655 "nativeName" => "faka Tonga"656 ],657 "tr" => [658 "name" => "Turkish",659 "nativeName" => "Türkçe"660 ],661 "ts" => [662 "name" => "Tsonga",663 "nativeName" => "Xitsonga"664 ],665 "tt" => [666 "name" => "Tatar",667 "nativeName" => "татарча"668 ],669 "tw" => [670 "name" => "Twi",671 "nativeName" => "Twi"672 ],673 "ty" => [674 "name" => "Tahitian",675 "nativeName" => "Reo Tahiti"676 ],677 "ug" => [678 "name" => "Uighur",679 "nativeName" => "Uyƣurqə"680 ],681 "uk" => [682 "name" => "Ukrainian",683 "nativeName" => "українська"684 ],685 "ur" => [686 "name" => "Urdu",687 "nativeName" => "اردو"688 ],689 "uz" => [690 "name" => "Uzbek",691 "nativeName" => "zbek"692 ],693 "ve" => [694 "name" => "Venda",695 "nativeName" => "Tshivenḓa"696 ],697 "vi" => [698 "name" => "Vietnamese",699 "nativeName" => "Tiếng Việt"700 ],701 "vo" => [702 "name" => "Volapük",703 "nativeName" => "Volapük"704 ],705 "wa" => [706 "name" => "Walloon",707 "nativeName" => "Walon"708 ],709 "cy" => [710 "name" => "Welsh",711 "nativeName" => "Cymraeg"712 ],713 "wo" => [714 "name" => "Wolof",715 "nativeName" => "Wollof"716 ],717 "fy" => [718 "name" => "Western Frisian",719 "nativeName" => "Frysk"720 ],721 "xh" => [722 "name" => "Xhosa",723 "nativeName" => "isiXhosa"724 ],725 "yi" => [726 "name" => "Yiddish",727 "nativeName" => "ייִדיש"728 ],729 "yo" => [730 "name" => "Yoruba",731 "nativeName" => "Yorùbá"732 ],733 "za" => [734 "name" => "Zhuang",735 "nativeName" => "Saɯ cueŋƅ"736 ]737 ];738 public static function getName($code)739 {740 return static::get($code, 'name');741 }742 public static function getNativeName($code)743 {744 if (strlen($code) == 2) {745 return static::get($code, 'nativeName');746 } else {747 return static::get(substr($code, 0, 2), 'nativeName') . ' (' . substr($code, -2) . ')';748 }749 }750 public static function getNames(array $keys)751 {752 $results = [];753 foreach ($keys as $key) {754 if (isset(static::$codes[$key])) {...

Full Screen

Full Screen

WorkDAO.swift

Source:WorkDAO.swift Github

copy

Full Screen

...38// account_id,39// updated_at,40// synced_at,41// party_id,42// first_name,43// middle_name,44// last_name,45// title,46// gender_id47// ) VALUES48// """49//50// for person in people {51// var genderId: Int? = nil52// if let gender = person.gender {53// genderId = gender.genderId54// }55//56// sql += "("57// sql += getSql(val: person.personId, postfix: ", ")58// sql += getSql(val: account.accountId, postfix: ", ")59// sql += getSql(val: Date(), postfix: ", ")60// sql += getSql(val: Date(), postfix: ", ")61// sql += getSql(val: person.party.partyId, postfix: ", ")62// sql += getSql(val: person.firstName, postfix: ", ")63// sql += getSql(val: person.middleName, postfix: ", ")64// sql += getSql(val: person.lastName, postfix: ", ")65// sql += getSql(val: person.title, postfix: ", ")66// sql += getSql(val: genderId, postfix: "")67// sql += "), "68// }69//70// sql = getCleanedSql(sql)71//72// do {73// try executeInsert(table: table, numRows: people.count, sql: sql)74// }75// catch SQLiteError.Prepare(let message) {76// var errMsg = "Failed to compile the SQL to insert rows into the person table. "77// errMsg += "SQLite error message: " + message78// throw DbError.Db(message: errMsg)79// }80// catch SQLiteError.Step(let message) {81// var errMsg = "Failed to execute the SQL to insert rows into the person table. "82// errMsg += "SQLite error message: " + message83// throw DbError.Db(message: errMsg)84// }85// }86// func updatePerson(account: Account, person: PersonDTO) throws {87// var sql = "UPDATE person SET "88//89// sql += getUpdateSql(column: "updated_at", val: Date(), postfix: ", ")90// sql += getUpdateSql(column: "synced_at", val: Date(), postfix: ", ")91// sql += getUpdateSql(column: "first_name", val: person.firstName, postfix: ", ")92// sql += getUpdateSql(column: "middle_name", val: person.middleName, postfix: ", ")93// sql += getUpdateSql(column: "last_name", val: person.lastName, postfix: ", ")94// sql += getUpdateSql(column: "title", val: person.title, postfix: ", ")95// sql += getUpdateSql(column: "gender_id", val: person.gender?.genderId, postfix: " ")96// sql += "WHERE person_id = \(person.personId) AND account_id = \(account.accountId);"97//98// do {99// try executeNonQuery(sql: sql)100// }101// catch SQLiteError.Prepare(let message) {102// var errMsg = "Failed to compile the SQL to update person. "103// errMsg += "SQLite error message: " + message104// throw DbError.Db(message: errMsg)105// }106// catch SQLiteError.Step(let message) {107// var errMsg = "Failed to update a row in the person table. "108// errMsg += "SQLite error message: " + message109// throw DbError.Db(message: errMsg)110// }111// }112// func getAll() -> [Work] {113// var works = [Work]()114//115// let sql = """116// select117// w.id as work_id,118// w.title,119// a.id as author_id,120// a.first_name,121// a.middle_name,122// a.last_name123// from124// work w125// left outer join126// work_author wa on wa.work_id = w.id127// left outer join128// author a on a.id = wa.author_id129// order by130// w.sort_by_title, w.id, a.last_name, a.first_name;131// """132//133// var stmt: OpaquePointer?134//135// do {136// if sqlite3_prepare_v2(conn, sql, -1, &stmt, nil) == SQLITE_OK {137// var prevWorkId = -1;138// var currWorkId = -1;139// var authors = [Author]()140// var work = Work(id: -1, title: "", authors: authors, awards: [])141//142// while sqlite3_step(stmt) == SQLITE_ROW {143// let currWorkId = getInt(stmt: stmt, colIndex: 0)144// let authorId = getInt(stmt: stmt, colIndex: 2)145// let firstName = try getString(stmt: stmt, colIndex: 3)146// let middleName = try getString(stmt: stmt, colIndex: 4)147// let lastName = try getString(stmt: stmt, colIndex: 5)148//149// if currWorkId != prevWorkId {150// if let firstName = firstName, let lastName = lastName {151// authors.append(Author(id: authorId,152// firstName: firstName,153// middleName: middleName,154// lastName: lastName))155// }156//157// if let title = try getString(stmt: stmt, colIndex: 1) {158// works.append(Work(id: currWorkId,159// title: title,160// authors: authors,161// awards: []))162// authors = [Author]()163// }164// }165// else {166// if let firstName = firstName, let lastName = lastName {167// authors.append(Author(id: authorId,168// firstName: firstName,169// middleName: middleName,170// lastName: lastName))171// }172// }173//174// prevWorkId = currWorkId175// }176// }177// } catch {178// print(error)179// }180//181// return works182// }183 184 func getHugoWinnersOnly() -> [Work] {185 var works = [Work]()186 187 let sql = """188 SELECT189 w.id AS work_id,190 w.title AS work_title,191 w.image_name,192 aw.name AS award_name,193 ac.year AS award_year,194 ac.name AS award_category,195 CASE WHEN wac.status = 1 THEN 'Winner'196 WHEN wac.status = 2 THEN 'Finalist'197 END AS award_status,198 a.id AS author_id,199 a.first_name AS author_first_name,200 a.middle_name AS author_middle_name,201 a.last_name AS author_last_name,202 s.id AS series_id,203 s.name AS series_name,204 ws.ordinal_name AS series_ordinal_name205 FROM206 work w207 INNER JOIN208 work_award_category wac ON wac.work_id = w.id209 INNER JOIN210 award_category ac ON ac.id = wac.award_category_id211 INNER JOIN212 award aw ON aw.id = ac.award_id213 LEFT OUTER JOIN214 work_author wa ON wa.work_id = w.id215 LEFT OUTER JOIN216 author a ON a.id = wa.author_id217 LEFT OUTER JOIN218 work_series ws ON ws.work_id = w.id219 LEFT OUTER JOIN220 series s ON s.id = ws.series_id221 WHERE222 aw.name = 'Hugo Award' and223 ac.name = 'Best Novel'224 ORDER BY225 ac.year DESC,226 wac.status,227 w.title;228 """229 230 var stmt: OpaquePointer?231 do {232 if sqlite3_prepare_v2(conn, sql, -1, &stmt, nil) == SQLITE_OK {233 var prevWorkId = -1;234 var currWorkId = -1;235 var authors = [Author]()236// var work = Work(id: -1, title: "", imageName: "", authors: authors, awards: [])237 238 while sqlite3_step(stmt) == SQLITE_ROW {239 let currWorkId = getInt(stmt: stmt, colIndex: 0)240 let awardYear = getInt(stmt: stmt, colIndex: 4)241 let authorId = getInt(stmt: stmt, colIndex: 7)242 let firstName = try getString(stmt: stmt, colIndex: 8)243 let middleName = try getString(stmt: stmt, colIndex: 9)244 let lastName = try getString(stmt: stmt, colIndex: 10)245 if currWorkId != prevWorkId {246 if let firstName = firstName, let lastName = lastName {247 authors.append(Author(id: authorId,248 firstName: firstName,249 middleName: middleName,250 lastName: lastName))251 }252 253 if let awardStatus = try getString(stmt: stmt, colIndex: 6) {254 let award = Award(id: 1,255 type: "Hugo",256 name: "Best Novel",257 year: awardYear,258 status: awardStatus)259 260 if let title = try getString(stmt: stmt, colIndex: 1),261 let imageName = try getString(stmt: stmt, colIndex: 2) {262 263 if let seriesName = try getString(stmt: stmt, colIndex: 12) {264 let seriesId = getInt(stmt: stmt, colIndex: 11)265 let seriesOrdinalName = try getString(stmt: stmt, colIndex: 13)266 let series = Series(id: seriesId, name: seriesName)267 268 works.append(Work(id: currWorkId,269 title: title,270 imageName: imageName,271 authors: authors,272 awards: [award],273 series: series,274 seriesOrdinalName: seriesOrdinalName))275 }276 else {277 works.append(Work(id: currWorkId,278 title: title,279 imageName: imageName,280 authors: authors,281 awards: [award]))282 }283 authors = [Author]()284 }285 }286 }287 else {288 if let firstName = firstName, let lastName = lastName {289 authors.append(Author(id: authorId,290 firstName: firstName,291 middleName: middleName,292 lastName: lastName))293 }294 }295 296 prevWorkId = currWorkId297 }298 }299 } catch {300 print(error)301 }302 303 return works304 }305 306 func getHugoWinners() -> [Work] {307 var works = [Work]()308 309 let sql = """310 select311 aw.name as award_name,312 ac.year as award_year,313 ac.name as award_category,314 w.id as work_id,315 w.title as work_title,316 case when wac.status = 1 then 'Winner'317 when wac.status = 2 then 'Finalist'318 end as award_status,319 a.id as author_id,320 a.first_name as author_first_name,321 a.middle_name as author_middle_name,322 a.last_name as author_last_name323 from324 award aw325 left outer join326 award_category ac on ac.award_id = aw.id327 left outer join328 work_award_category wac on wac.award_category_id = ac.id329 left outer join330 work w on w.id = wac.work_id331 left outer join332 work_author wa on wa.work_id = w.id333 left outer join334 author a on a.id = wa.author_id335 where336 aw.name = 'Hugo Award' and337 ac.name = 'Best Novel'338 order by339 ac.year,340 wac.status,341 w.title;342 """343 344 var stmt: OpaquePointer?345 do {346 if sqlite3_prepare_v2(conn, sql, -1, &stmt, nil) == SQLITE_OK {347 var prevWorkId = -1;348 var currWorkId = -1;349 var authors = [Author]()350 351 while sqlite3_step(stmt) == SQLITE_ROW {...

Full Screen

Full Screen

LogicGame.swift

Source:LogicGame.swift Github

copy

Full Screen

...41 42 43 }44 45 func elementAddAuxNode(name : String, node : SKNode){46 auxNodeDor = SKSpriteNode(imageNamed: name)47 auxNodeDor?.position = node.position48 auxNodeDor?.name = node.name49 auxNodeDor?.zPosition = 350 addChild(auxNodeDor!)51 }52 public func movePlayer(points : CGPoint, name: String){53 54 if name == "player1" {55 player1.position = points56 57 for var p in modelPlayerList.players! {58 if modelPlayerList.players?.first?.stateDungeon == 0 {59 player1.isHidden = false60 }61 p.position = points62 63 }64 65 66 67 }else if name == "player2"{68 player2.position = points69 for var p in modelPlayerList.players! {70 p.position = points71 }72 }73 74 75 76 77 }78 79 override public func touchesBegan ( _ touches: Set<UITouch>, with event: UIEvent?) {80 81 if let location = touches.first?.location(in: self){82 print(location)83 player1.position = location84 85 }}86 87 override func update(_ currentTime: TimeInterval) {88 89 90 91 }92 93 94 95 96 97 98 public func didBegin(_ contact: SKPhysicsContact) {99 100 guard let nodeA = contact.bodyA.node else {return}101 guard let nodeB = contact.bodyB.node else { return}102 103 104 if((nodeA.name == "player1" && nodeB.name == "dorEsq") ||105 (nodeA.name == "dorEsq" && nodeB.name == "player1")){106 print("porta Esquerda")107 108// dorBack.position = dorDir.position109 modelPlayerList.players?[0].stateDungeon = 1110// createNodes.removeAllNodes(scene: self)111// createNodes.createCorInDuengeonEsq(scene: self)112// createNodes.createGroundEsq(scene: self, nodo: groundDors)113 player1.isHidden = true114 115 }116 117 if((nodeA.name == "player1" && nodeB.name == "dorDir") ||118 (nodeA.name == "dorDir" && nodeB.name == "player1")){119 120 print("porta Direita")121 122 modelPlayerList.players?[0].stateDungeon = 3123 player1.isHidden = true124 125 }126 127 128 if((nodeA.name == "player1" && nodeB.name == "dorBaixo") ||129 (nodeA.name == "dorBaixo" && nodeB.name == "player1")){130 print("porta Baixo")131 132 133 134 modelPlayerList.players?[0].stateDungeon = 2135 player1.isHidden = true136 137 }138 139 if((nodeA.name == "player1" && nodeB.name == "dorCima") ||140 (nodeA.name == "dorCima" && nodeB.name == "player1")){141 //emitir alerta142 143 if modelPlayerList.players?.first?.key == true {144 self.player1.removeAllActions()145 self.player1.removeFromParent()146 }147 148 if((nodeA.name == "player1" && nodeB.name == "dorBack") ||149 (nodeA.name == "dorBack" && nodeB.name == "player1")){150 151 print("Encontou na porta de volta")152 153 154 155 }156 157 if((nodeA.name == "player1" && nodeB.name == "itemRed") ||158 (nodeA.name == "itemRed" && nodeB.name == "player1")){159 print("Encontou o vermelho")160 corDor.removeFromParent()161 modelPlayerList.players?[0].cores = 2162 }163 164 if((nodeA.name == "player1" && nodeB.name == "itemBlue") ||165 (nodeA.name == "itemBlue" && nodeB.name == "player1")){166 print("Pegou a cor azul")167 corDor.removeFromParent()168 modelPlayerList.players?[0].cores = 1169 }170 171 if((nodeA.name == "player1" && nodeB.name == "itemPurple") ||172 (nodeA.name == "itemPurple" && nodeB.name == "player1")){173 print("pegou o purple")174 corDor.removeFromParent()175 modelPlayerList.players?[0].cores = 3176 177 }178 179 if((nodeA.name == "player1" && nodeB.name == "itemYellow") ||180 (nodeA.name == "itemYellow" && nodeB.name == "player1")){181 print("Encontou na porta de volta")182 }183 184 if((nodeA.name == "player1" && nodeB.name == "itemGreen") ||185 (nodeA.name == "itemGreen" && nodeB.name == "player1")){186 187 print("pegou o verde")188 }189 190 191 192 193 194 if((nodeA.name == "player1" && nodeB.name == "misturador") ||195 (nodeA.name == "misturador" && nodeB.name == "player1")){196 //print de duvidas197 print("Misturador")198 }199 200 if((nodeA.name == "player1" && nodeB.name == "corJoin") ||201 (nodeA.name == "corJoin" && nodeB.name == "player1")){202 203 204 205 print("corJoin")206 }207 208 if((nodeA.name == "player1" && nodeB.name == "key") ||209 (nodeA.name == "key" && nodeB.name == "player1")){210 modelPlayerList.players?[0].key = true211 212 }213 //--------------- p2214 215 if((nodeA.name == "player2" && nodeB.name == "dorEsq") ||216 (nodeA.name == "dorEsq" && nodeB.name == "player2")){217 print("porta Esquerda")218 219 modelPlayerList.players?[1].stateDungeon = 1220 player2.isHidden = true221 }222 223 if((nodeA.name == "player2" && nodeB.name == "dorDir") ||224 (nodeA.name == "dorDir" && nodeB.name == "player2")){225 226 modelPlayerList.players?[1].stateDungeon = 3227 228 }229 230 231 if((nodeA.name == "player2" && nodeB.name == "dorBaixo") ||232 (nodeA.name == "dorBaixo" && nodeB.name == "player2")){233 print("porta Baixo")234 235 236 modelPlayerList.players?[1].stateDungeon = 2237 player2.isHidden = true238 239 }240 241 if((nodeA.name == "player2" && nodeB.name == "dorCima") ||242 (nodeA.name == "dorCima" && nodeB.name == "player2")){243 //emitir alerta244 245 if modelPlayerList.players?.last?.key == true {246 self.player2.removeAllActions()247 self.player2.removeFromParent()248 }249 250 }251 252 if((nodeA.name == "player2" && nodeB.name == "dorBack") ||253 (nodeA.name == "dorBack" && nodeB.name == "player2")){254 255 print("Encontou na porta de volta")256 257 258 player2.isHidden = true259 }260 261 if((nodeA.name == "player2" && nodeB.name == "itemRed") ||262 (nodeA.name == "itemRed" && nodeB.name == "player2")){263 print("Encontou o vermelho")264 corDor.removeFromParent()265 modelPlayerList.players?[1].cores = 2266 }267 268 if((nodeA.name == "player2" && nodeB.name == "itemBlue") ||269 (nodeA.name == "itemBlue" && nodeB.name == "player2")){270 print("Pegou a cor azul")271 corDor.removeFromParent()272 modelPlayerList.players?[1].cores = 1273 }274 275 if((nodeA.name == "player2" && nodeB.name == "itemPurple") ||276 (nodeA.name == "itemPurple" && nodeB.name == "player2")){277 print("pegou o purple")278 corDor.removeFromParent()279 modelPlayerList.players?[1].cores = 3280 281 }282 283 if((nodeA.name == "player2" && nodeB.name == "itemYellow") ||284 (nodeA.name == "itemYellow" && nodeB.name == "player2")){285 print("Encontou na porta de volta")286 }287 288 if((nodeA.name == "player2" && nodeB.name == "itemGreen") ||289 (nodeA.name == "itemGreen" && nodeB.name == "player2")){290 291 292 }293 294 295 296 297 298 if((nodeA.name == "player2" && nodeB.name == "misturador") ||299 (nodeA.name == "misturador" && nodeB.name == "player2")){300 //print de duvidas301 print("Misturador")302 }303 304 if((nodeA.name == "player2" && nodeB.name == "corJoin") ||305 (nodeA.name == "corJoin" && nodeB.name == "player2")){306 307 308 309 print("corJoin")310 }311 312 if((nodeA.name == "player2" && nodeB.name == "key") ||313 (nodeA.name == "key" && nodeB.name == "player2")){314 modelPlayerList.players?[1].key = true315 key.removeFromParent()316 print("pegou a key")317 }318 319 320 }}}...

Full Screen

Full Screen

Contents.swift

Source:Contents.swift Github

copy

Full Screen

1import UIKit2class Person:CustomStringConvertible{3 var firstName:String4 var lastName:String5 var age:Int6 var value:String7 enum gender:String{8 case male = "男"9 case female = "女"10 };11 init(firstName:String,lastName:String,age:Int){12 self.firstName = firstName13 self.lastName = lastName14 self.age = age15 self.value = "男"16 }17 init(firstName:String,lastName:String,age:Int,value:String){18 self.firstName = firstName19 self.lastName = lastName20 self.age = age21 if value == gender.male.rawValue{22 self.value = value23 }24 else if value == gender.female.rawValue{25 self.value = value26 }27 else{28 self.value = "错误"29 print("性别错误!!")30 }31 }32 var description:String{33 return "fullName:\(self.fullName()) age:\(age) gender:\(value)"34 }35 func fullName() -> String{36 return firstName+lastName37 }38 39 static func ==(person:Person,person1:Person) -> Bool{40 return (person1.fullName() == person.fullName() && person1.age == person.age && person1.value == person.value )41 }42 static func !=(person:Person,person1:Person) -> Bool{43 return (person1.fullName() != person.fullName() || person1.age != person.age || person1.value != person.value )44 }45}46class Teacher:Person{47 var title:String48 init(firstName:String,lastName:String,age:Int,value:String,title:String){49 self.title = title50 super.init(firstName:firstName,lastName:lastName,age:age,value:value)51 }52 override var description:String{53 return "\(super.description) title:\(title)"54 }55}56class Student:Person{57 var stuNo:String58 init(firstName:String,lastName:String,age:Int,value:String,stuNo:String){59 self.stuNo = stuNo60 super.init(firstName:firstName,lastName:lastName,age:age,value:value)61 }62 override var description:String{63 return "\(super.description) stuNo:\(stuNo)"64 }65}66var Array_people = [Person]()67var per = Person(firstName:"张",lastName:"三",age:22,value:"男")68var per1 = Person(firstName:"王",lastName:"四",age:25,value:"女")69var per2 = Person(firstName:"李",lastName:"五",age:23,value:"男")70var tea = Teacher(firstName:"张",lastName:"军",age:21,value:"男",title:"语文")71var tea1 = Teacher(firstName:"冯",lastName:"雨",age:20,value:"男",title:"数学")72var tea2 = Teacher(firstName:"周",lastName:"蓉",age:22,value:"女",title:"英语")73var stu = Student(firstName:"王",lastName:"林",age:22,value:"男",stuNo:"14100951")74var stu1 = Student(firstName:"郑",lastName:"大",age:21,value:"男",stuNo:"14110921")75var stu2 = Student(firstName:"孙",lastName:"二",age:24,value:"女",stuNo:"14110823")76print(per)77if(per == per1){78 print("两人相同")79}80if(per != per1){81 print("两人不同")82}83print(tea)84print(stu)85Array_people.append(per)86Array_people.append(per1)87Array_people.append(per2)88Array_people.append(tea)89Array_people.append(tea1)90Array_people.append(tea2)91Array_people.append(stu)92Array_people.append(stu1)93Array_people.append(stu2)94print("输出数组内容:")95print(Array_people) //Person、Teacher和Student对象,并将这些对象存入同一个数组中并输出;96var dic = ["Person":0,"Teacher":0,"Student":0] //将Person、Teacher和Student对象,并将这些对象个数存入字典中并输出;97for i in Array_people{98 if i is Student{99 dic["Student"]! += 1100 }101 else if i is Teacher{102 dic["Teacher"]! += 1103 }else{104 dic["Person"]! += 1105 }106}107print("输出字典内容:")108print(dic)109//按age排序110print("按age排序")111Array_people.sort{(x,y) in112 return x.age < y.age113}114print(Array_people)115//按fullName排序116print("按fullName排序")117Array_people.sort{118 return ($0.fullName() < $1.fullName())119}120print(Array_people)121//按gender+age排序122print("按gender+age排序")123Array_people.sort{124 return ($0.value < $1.value) && ($0.age < $1.age)125}126print(Array_people)...

Full Screen

Full Screen

name

Using AI Code Generation

copy

Full Screen

1let name = QuickSort()2let name = MergeSort()3let name = InsertionSort()4let name = SelectionSort()5let name = BubbleSort()6let name = QuickSort()7let name = MergeSort()8let name = InsertionSort()9let name = SelectionSort()10let name = BubbleSort()11let name = QuickSort()12let name = MergeSort()13let name = InsertionSort()14let name = SelectionSort()15let name = BubbleSort()16let name = QuickSort()17let name = MergeSort()18let name = InsertionSort()19let name = SelectionSort()20let name = BubbleSort()21let name = QuickSort()22let name = MergeSort()23let name = InsertionSort()24let name = SelectionSort()25let name = BubbleSort()26let name = QuickSort()27let name = MergeSort()28let name = InsertionSort()

Full Screen

Full Screen

name

Using AI Code Generation

copy

Full Screen

1import Foundation2class QuickSort {3 func quickSort(_ array: [Int]) -> [Int] {4 guard array.count > 1 else { return array }5 let less = array.filter { $0 < pivot }6 let equal = array.filter { $0 == pivot }7 let greater = array.filter { $0 > pivot }8 return quickSort(less) + equal + quickSort(greater)9 }10 func quickSort(_ array: [String]) -> [String] {11 guard array.count > 1 else { return array }12 let less = array.filter { $0 < pivot }13 let equal = array.filter { $0 == pivot }14 let greater = array.filter { $0 > pivot }15 return quickSort(less) + equal + quickSort(greater)16 }17 func quickSort(_ array: [Double]) -> [Double] {18 guard array.count > 1 else { return array }19 let less = array.filter { $0 < pivot }20 let equal = array.filter { $0 == pivot }21 let greater = array.filter { $0 > pivot }22 return quickSort(less) + equal + quickSort(greater)23 }24}25import Foundation26class MergeSort {27 func mergeSort(_ array: [Int]) -> [Int] {28 guard array.count > 1 else { return array }29 let leftArray = mergeSort(Array(array[0..<middleIndex]))30 let rightArray = mergeSort(Array(array[middleIndex..<array.count]))31 return merge(leftPile: leftArray, rightPile: rightArray)32 }33 func merge(leftPile: [Int], rightPile: [Int]) -> [Int] {34 var orderedPile = [Int]()35 while leftIndex < leftPile.count && rightIndex < rightPile.count {36 if leftPile[leftIndex] < rightPile[rightIndex] {37 orderedPile.append(leftPile

Full Screen

Full Screen

name

Using AI Code Generation

copy

Full Screen

1import UIKit2import QuickLook3class ViewController: UIViewController, QLPreviewControllerDataSource {4 var quickLook = QLPreviewController()5 override func viewDidLoad() {6 super.viewDidLoad()7 self.present(quickLook, animated: true, completion: nil)8 }9 func numberOfPreviewItems(in controller: QLPreviewController) -> Int {10 }11 func previewController(_ controller: QLPreviewController, previewItemAt index: Int) -> QLPreviewItem {12 let path = Bundle.main.path(forResource: "test", ofType: "pdf")13 let url = URL(fileURLWithPath: path!)14 }15}16import UIKit17import QuickLook18class ViewController: UIViewController, QLPreviewControllerDataSource {19 var quickLook = QLPreviewController()20 override func viewDidLoad() {21 super.viewDidLoad()22 self.present(quickLook, animated: true, completion: nil)23 }24 func numberOfPreviewItems(in controller: QLPreviewController) -> Int {25 }26 func previewController(_ controller: QLPreviewController, previewItemAt index: Int) -> QLPreviewItem {27 let path = Bundle.main.path(forResource: "test", ofType: "pdf")28 let url = URL(fileURLWithPath: path!)29 }30}31import UIKit32import QuickLook33class ViewController: UIViewController, QLPreviewControllerDataSource {34 var quickLook = QLPreviewController()35 override func viewDidLoad() {36 super.viewDidLoad()37 self.present(quickLook, animated: true, completion: nil)38 }39 func numberOfPreviewItems(in controller: QLPreviewController) -> Int {40 }41 func previewController(_ controller: QLPreviewController, previewItemAt index: Int) -> QLPreviewItem {42 let path = Bundle.main.path(forResource: "test", ofType: "pdf")

Full Screen

Full Screen

name

Using AI Code Generation

copy

Full Screen

1import QuickSort2let sortedArray = QuickSort().quickSort(array)3print(sortedArray)4import QuickSort5let sortedArray = QuickSort.quickSort(array)6print(sortedArray)7import QuickSort8let sortedArray = quickSort(array)9print(sortedArray)10import QuickSort11let sortedArray = QuickSort.quickSort(array)12print(sortedArray)13import QuickSort14let sortedArray = quickSort(array)15print(sortedArray)16import QuickSort17let sortedArray = QuickSort.quickSort(array)18print(sortedArray)19import QuickSort20let sortedArray = QuickSort.quickSort(array)21print(sortedArray)22import QuickSort

Full Screen

Full Screen

name

Using AI Code Generation

copy

Full Screen

1import Foundation2class QuickSort {3 func quickSort(_ array: [Int]) -> [Int] {4 if array.isEmpty {5 }6 let left = array.filter { $0 < pivot }7 let middle = array.filter { $0 == pivot }8 let right = array.filter { $0 > pivot }9 return quickSort(left) + middle + quickSort(right)10 }11}12var quickSort = QuickSort()13print(quickSort.quickSort(array))14import Foundation15class MergeSort {16 func mergeSort(_ array: [Int]) -> [Int] {17 if array.count <= 1 {18 }19 let left = mergeSort(Array(array[0..<middle]))20 let right = mergeSort(Array(array[middle..<array.count]))21 return merge(left, right)22 }23 func merge(_ left: [Int], _ right: [Int]) -> [Int] {24 while leftIndex < left.count && rightIndex < right.count {

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Quick automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Most used methods in name

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful