Watir-webdriver - can't access nested frame by id - nested

The webpage has a nested frame structure. The frame FCCBMain is nested in frame Main. I can access it this way:
browser.frame(:id => "FCCBMain").frames[0]
=> #<Watir::Frame:0x504e155578d49f34 located=false selector={:index=>0}>
browser.frame(:id => "FCCBMain").frames[0].id
=> "MainLeft"
But not this way:
brwoser.frame(:id => "FCCBMain").frame(:id => "MainLeft").id
Selenium::WebDriver::Error::StaleElementReferenceError: Element belongs to a different frame than the current one - switch to its containing frame to use it
from [remote server] resource://fxdriver/modules/web_element_cache.js:5634:in `unknown'
from [remote server] file:///tmp/webdriver-profile20120816-21551-1a8xyvv/extensions/fxdriver#googlecode.com/components/driver_component.js:5329:in `unknown'
from [remote server] file:///tmp/webdriver-profile20120816-21551-1a8xyvv/extensions/fxdriver#googlecode.com/components/driver_component.js:6623:in `unknown'
from [remote server] file:///tmp/webdriver-profile20120816-21551-1a8xyvv/extensions/fxdriver#googlecode.com/components/command_processor.js:9924:in `unknown'
...
I thought these two ways are very similar. Why doesn't the later work?
(if it helps, here is the webpage I'm working on)

First I think you have a typo with "brwoser.frame"
Second if you are going to access the frames with the chain you have to include ALL frames and framesets in the path IE: browser.frame(:id => "FCCBMain").frameset.frameset.frame(:id => "MainLeft").id
The reason your second solution was not working is because it was looking for an immediate child of frame(FCCBMain) to have the id of "MainLeft". Frame(FCCBMain) only has a frameset child and the frameset does not have an ID. If the frameset had an ID of "MainLeft" AND was a frame(not a frameset) then the line, browser.frame(:id => "FCCBMain").frame(:id => "MainLeft").id, would work.

Related

Issues with Python Lambda with filter() function

Using multiple if conditions to filter a list works. However, I am looking for a better alternative. As a beginner Python user, I fail to make the filter() and lambda () functions work even after using this resource: https://www.geeksforgeeks.org/python-filter-list-of-strings-based-on-the-substring-list/. Any help will be appreciated.
The following code block (Method 1) works.
mylist = ['MEPS HC-226: MEPS Panel 23 Three-Year Longitudinal Data File',
'HC-203: 2018 Jobs File',
'HC-051H 2000 Home Health',
'NHC-001F Facility Characteristics Round 1',
'HC-IC Linked Data 1999',
'HC-004 1996 Employment Data/Family-Level Weight (HC-004 replaced by HC-012)',
'HC-030 1998 MEPS HC Survey Data (CD-ROM)']
sublist1 = []
for element in mylist:
if element.startswith(("MEPS HC", "HC")):
if "-IC" not in element:
if "replaced" not in element:
if "CD-ROM" not in element:
sublist1.append(element)
print(sublist1)
(Output below)
['MEPS HC-226: MEPS Panel 23 Three-Year Longitudinal Data File', 'HC-203: 2018 Jobs File', 'HC-051H 2000 Home Health']
However, issues are with the following code block (Method 2).
sublist2 = []
excludes = ['-IC', 'replaced', 'CD-ROM']
for element in mylist:
if element.startswith(("MEPS HC", "HC")):
sublist2 = mylist(filter(lambda x: any(excludes in x for exclude in excludes), mylist))
sublist2.append(element)
print(sublist2)
TypeError: 'list' object is not callable
My code block with multiple if conditions (Method 1) to filter the list works. However, I could not figure out why the code block with filter() and lambda functions (Method 2) does not work. I was expecting the same results I got from Method 1. I am open to other solutions as an alternative to Method 1.

How to get a list of all supported timezones?

How can we get a list of all supported timezones in NodeJs at runtime?
use-cases:
we want to implement a check when the application starts to make sure that the main timezone (set via env-var) is correct).
we want to show a list to the user so that they can select only valid time-zones
The nodejs docs mention that node can be used with different ICU settings, so a hardcoded list (like timezones.json) will not work.
I found some related questions, but none seems to answer this (simple?) question...
e.g. Where does Node.js get the Timezone data from?
I think that currently there is no easy way to get the list of supported timezones in node.js at runtime:
JavaScript Internationalization Api:
The specification does not provide a way to get the list of supported timezones
NodeJs:
NodeJs also does not provide a way go get the list of supported timezones
Workaround
A workaround is to somehow get a list of timezones and test each one separately.
There are many predefined timezone lists:
IANA Timezone database
Wikipedia: List of tz database time zones
Json Timezone List
Csv Timezone List
However, since we have a database application, we first get the list of all timezones supported by the database - see PostgreSql docs:
SELECT name
FROM pg_timezone_names
ORDER BY name;
and then check for each one if it is supported by nodejs (here's some typescript pseudo code):
try {
new Intl.DateTimeFormat('en-US', {
timeZone
})
// timezone is valid - add to the valid list
} catch (e) {
// timezone is invalid - maybe write a log msg
}
Stackblitz Test
Now we have a list of all timezones that are valid in the database and in NodeJs.
There are currently (PostgreSql 12, NodeJs 14):
547 valid timezones
49 invalid timezones (i.e. known by PostgreSql, but not by NodeJs): e.g. America/Argentina/ComodRivadavia, US/Alaska, ..
If you need a detailed JSON file, check out https://github.com/dmfilipenko/timezones.json/blob/master/timezones.json.
However, if you just need the names (e.g. America/Los_Angeles) in a JSON array, the following 3-liner script in Node.js would work to get that from timezones.json.
const namesSet = new Set();
require("timezones.json").forEach((tzDefinition) => tzDefinition.utc.forEach((tzName) => namesSet.add(tzName)));
console.log(JSON.stringify([...namesSet].sort()));
Output on 2021/11/14 from "timezones.json": "1.5.3":
["Africa/Abidjan","Africa/Accra","Africa/Addis_Ababa","Africa/Algiers","Africa/Asmera","Africa/Bamako","Africa/Bangui","Africa/Banjul","Africa/Bissau","Africa/Blantyre","Africa/Brazzaville","Africa/Bujumbura","Africa/Cairo","Africa/Casablanca","Africa/Ceuta","Africa/Conakry","Africa/Dakar","Africa/Dar_es_Salaam","Africa/Djibouti","Africa/Douala","Africa/El_Aaiun","Africa/Freetown","Africa/Gaborone","Africa/Harare","Africa/Johannesburg","Africa/Juba","Africa/Kampala","Africa/Khartoum","Africa/Kigali","Africa/Kinshasa","Africa/Lagos","Africa/Libreville","Africa/Lome","Africa/Luanda","Africa/Lubumbashi","Africa/Lusaka","Africa/Malabo","Africa/Maputo","Africa/Maseru","Africa/Mbabane","Africa/Mogadishu","Africa/Monrovia","Africa/Nairobi","Africa/Ndjamena","Africa/Niamey","Africa/Nouakchott","Africa/Ouagadougou","Africa/Porto-Novo","Africa/Sao_Tome","Africa/Tripoli","Africa/Tunis","Africa/Windhoek","America/Anchorage","America/Anguilla","America/Antigua","America/Araguaina","America/Argentina/La_Rioja","America/Argentina/Rio_Gallegos","America/Argentina/Salta","America/Argentina/San_Juan","America/Argentina/San_Luis","America/Argentina/Tucuman","America/Argentina/Ushuaia","America/Aruba","America/Asuncion","America/Bahia","America/Bahia_Banderas","America/Barbados","America/Belem","America/Belize","America/Blanc-Sablon","America/Boa_Vista","America/Bogota","America/Boise","America/Buenos_Aires","America/Cambridge_Bay","America/Campo_Grande","America/Cancun","America/Caracas","America/Catamarca","America/Cayenne","America/Cayman","America/Chicago","America/Chihuahua","America/Coral_Harbour","America/Cordoba","America/Costa_Rica","America/Creston","America/Cuiaba","America/Curacao","America/Danmarkshavn","America/Dawson","America/Dawson_Creek","America/Denver","America/Detroit","America/Dominica","America/Edmonton","America/Eirunepe","America/El_Salvador","America/Fortaleza","America/Glace_Bay","America/Godthab","America/Goose_Bay","America/Grand_Turk","America/Grenada","America/Guadeloupe","America/Guatemala","America/Guayaquil","America/Guyana","America/Halifax","America/Havana","America/Hermosillo","America/Indiana/Knox","America/Indiana/Marengo","America/Indiana/Petersburg","America/Indiana/Tell_City","America/Indiana/Vevay","America/Indiana/Vincennes","America/Indiana/Winamac","America/Indianapolis","America/Inuvik","America/Iqaluit","America/Jamaica","America/Jujuy","America/Juneau","America/Kentucky/Monticello","America/Kralendijk","America/La_Paz","America/Lima","America/Los_Angeles","America/Louisville","America/Lower_Princes","America/Maceio","America/Managua","America/Manaus","America/Marigot","America/Martinique","America/Matamoros","America/Mazatlan","America/Mendoza","America/Menominee","America/Merida","America/Mexico_City","America/Moncton","America/Monterrey","America/Montevideo","America/Montreal","America/Montserrat","America/Nassau","America/New_York","America/Nipigon","America/Nome","America/Noronha","America/North_Dakota/Beulah","America/North_Dakota/Center","America/North_Dakota/New_Salem","America/Ojinaga","America/Panama","America/Pangnirtung","America/Paramaribo","America/Phoenix","America/Port-au-Prince","America/Port_of_Spain","America/Porto_Velho","America/Puerto_Rico","America/Rainy_River","America/Rankin_Inlet","America/Recife","America/Regina","America/Resolute","America/Rio_Branco","America/Santa_Isabel","America/Santarem","America/Santiago","America/Santo_Domingo","America/Sao_Paulo","America/Scoresbysund","America/Sitka","America/St_Barthelemy","America/St_Johns","America/St_Kitts","America/St_Lucia","America/St_Thomas","America/St_Vincent","America/Swift_Current","America/Tegucigalpa","America/Thule","America/Thunder_Bay","America/Tijuana","America/Toronto","America/Tortola","America/Vancouver","America/Whitehorse","America/Winnipeg","America/Yakutat","America/Yellowknife","Antarctica/Casey","Antarctica/Davis","Antarctica/DumontDUrville","Antarctica/Macquarie","Antarctica/Mawson","Antarctica/McMurdo","Antarctica/Palmer","Antarctica/Rothera","Antarctica/Syowa","Antarctica/Vostok","Arctic/Longyearbyen","Asia/Aden","Asia/Almaty","Asia/Amman","Asia/Anadyr","Asia/Aqtau","Asia/Aqtobe","Asia/Ashgabat","Asia/Baghdad","Asia/Bahrain","Asia/Baku","Asia/Bangkok","Asia/Beirut","Asia/Bishkek","Asia/Brunei","Asia/Calcutta","Asia/Chita","Asia/Choibalsan","Asia/Colombo","Asia/Damascus","Asia/Dhaka","Asia/Dili","Asia/Dubai","Asia/Dushanbe","Asia/Hong_Kong","Asia/Hovd","Asia/Irkutsk","Asia/Jakarta","Asia/Jayapura","Asia/Jerusalem","Asia/Kabul","Asia/Kamchatka","Asia/Karachi","Asia/Kathmandu","Asia/Khandyga","Asia/Kolkata","Asia/Krasnoyarsk","Asia/Kuala_Lumpur","Asia/Kuching","Asia/Kuwait","Asia/Macau","Asia/Magadan","Asia/Makassar","Asia/Manila","Asia/Muscat","Asia/Nicosia","Asia/Novokuznetsk","Asia/Novosibirsk","Asia/Omsk","Asia/Oral","Asia/Phnom_Penh","Asia/Pontianak","Asia/Pyongyang","Asia/Qatar","Asia/Qyzylorda","Asia/Rangoon","Asia/Riyadh","Asia/Saigon","Asia/Sakhalin","Asia/Samarkand","Asia/Seoul","Asia/Shanghai","Asia/Singapore","Asia/Srednekolymsk","Asia/Taipei","Asia/Tashkent","Asia/Tbilisi","Asia/Tehran","Asia/Thimphu","Asia/Tokyo","Asia/Ulaanbaatar","Asia/Urumqi","Asia/Ust-Nera","Asia/Vientiane","Asia/Vladivostok","Asia/Yakutsk","Asia/Yekaterinburg","Asia/Yerevan","Atlantic/Azores","Atlantic/Bermuda","Atlantic/Canary","Atlantic/Cape_Verde","Atlantic/Faeroe","Atlantic/Madeira","Atlantic/Reykjavik","Atlantic/South_Georgia","Atlantic/St_Helena","Atlantic/Stanley","Australia/Adelaide","Australia/Brisbane","Australia/Broken_Hill","Australia/Currie","Australia/Darwin","Australia/Hobart","Australia/Lindeman","Australia/Melbourne","Australia/Perth","Australia/Sydney","CST6CDT","EST5EDT","Etc/GMT","Etc/GMT+1","Etc/GMT+10","Etc/GMT+11","Etc/GMT+12","Etc/GMT+2","Etc/GMT+3","Etc/GMT+4","Etc/GMT+5","Etc/GMT+6","Etc/GMT+7","Etc/GMT-1","Etc/GMT-10","Etc/GMT-11","Etc/GMT-12","Etc/GMT-13","Etc/GMT-2","Etc/GMT-3","Etc/GMT-4","Etc/GMT-5","Etc/GMT-6","Etc/GMT-7","Etc/GMT-8","Etc/GMT-9","Europe/Amsterdam","Europe/Andorra","Europe/Astrakhan","Europe/Athens","Europe/Belgrade","Europe/Berlin","Europe/Bratislava","Europe/Brussels","Europe/Bucharest","Europe/Budapest","Europe/Busingen","Europe/Chisinau","Europe/Copenhagen","Europe/Dublin","Europe/Gibraltar","Europe/Guernsey","Europe/Helsinki","Europe/Isle_of_Man","Europe/Istanbul","Europe/Jersey","Europe/Kaliningrad","Europe/Kiev","Europe/Kirov","Europe/Lisbon","Europe/Ljubljana","Europe/London","Europe/Luxembourg","Europe/Madrid","Europe/Malta","Europe/Mariehamn","Europe/Minsk","Europe/Monaco","Europe/Moscow","Europe/Nicosia","Europe/Oslo","Europe/Paris","Europe/Podgorica","Europe/Prague","Europe/Riga","Europe/Rome","Europe/Samara","Europe/San_Marino","Europe/Sarajevo","Europe/Simferopol","Europe/Skopje","Europe/Sofia","Europe/Stockholm","Europe/Tallinn","Europe/Tirane","Europe/Ulyanovsk","Europe/Uzhgorod","Europe/Vaduz","Europe/Vatican","Europe/Vienna","Europe/Vilnius","Europe/Volgograd","Europe/Warsaw","Europe/Zagreb","Europe/Zaporozhye","Europe/Zurich","Indian/Antananarivo","Indian/Chagos","Indian/Christmas","Indian/Cocos","Indian/Comoro","Indian/Kerguelen","Indian/Mahe","Indian/Maldives","Indian/Mauritius","Indian/Mayotte","Indian/Reunion","MST7MDT","PST8PDT","Pacific/Apia","Pacific/Auckland","Pacific/Efate","Pacific/Enderbury","Pacific/Fakaofo","Pacific/Fiji","Pacific/Funafuti","Pacific/Galapagos","Pacific/Guadalcanal","Pacific/Guam","Pacific/Honolulu","Pacific/Johnston","Pacific/Kosrae","Pacific/Kwajalein","Pacific/Majuro","Pacific/Midway","Pacific/Nauru","Pacific/Niue","Pacific/Noumea","Pacific/Pago_Pago","Pacific/Palau","Pacific/Ponape","Pacific/Port_Moresby","Pacific/Rarotonga","Pacific/Saipan","Pacific/Tahiti","Pacific/Tarawa","Pacific/Tongatapu","Pacific/Truk","Pacific/Wake","Pacific/Wallis"]
Pretty-printed:
// 434 entries extracted from "timezones.json#1.5.3" package at 2021-11-14T20:03:29.078Z
[
"Africa/Abidjan",
"Africa/Accra",
"Africa/Addis_Ababa",
"Africa/Algiers",
"Africa/Asmera",
"Africa/Bamako",
"Africa/Bangui",
"Africa/Banjul",
"Africa/Bissau",
"Africa/Blantyre",
"Africa/Brazzaville",
"Africa/Bujumbura",
"Africa/Cairo",
"Africa/Casablanca",
"Africa/Ceuta",
"Africa/Conakry",
"Africa/Dakar",
"Africa/Dar_es_Salaam",
"Africa/Djibouti",
"Africa/Douala",
"Africa/El_Aaiun",
"Africa/Freetown",
"Africa/Gaborone",
"Africa/Harare",
"Africa/Johannesburg",
"Africa/Juba",
"Africa/Kampala",
"Africa/Khartoum",
"Africa/Kigali",
"Africa/Kinshasa",
"Africa/Lagos",
"Africa/Libreville",
"Africa/Lome",
"Africa/Luanda",
"Africa/Lubumbashi",
"Africa/Lusaka",
"Africa/Malabo",
"Africa/Maputo",
"Africa/Maseru",
"Africa/Mbabane",
"Africa/Mogadishu",
"Africa/Monrovia",
"Africa/Nairobi",
"Africa/Ndjamena",
"Africa/Niamey",
"Africa/Nouakchott",
"Africa/Ouagadougou",
"Africa/Porto-Novo",
"Africa/Sao_Tome",
"Africa/Tripoli",
"Africa/Tunis",
"Africa/Windhoek",
"America/Anchorage",
"America/Anguilla",
"America/Antigua",
"America/Araguaina",
"America/Argentina/La_Rioja",
"America/Argentina/Rio_Gallegos",
"America/Argentina/Salta",
"America/Argentina/San_Juan",
"America/Argentina/San_Luis",
"America/Argentina/Tucuman",
"America/Argentina/Ushuaia",
"America/Aruba",
"America/Asuncion",
"America/Bahia",
"America/Bahia_Banderas",
"America/Barbados",
"America/Belem",
"America/Belize",
"America/Blanc-Sablon",
"America/Boa_Vista",
"America/Bogota",
"America/Boise",
"America/Buenos_Aires",
"America/Cambridge_Bay",
"America/Campo_Grande",
"America/Cancun",
"America/Caracas",
"America/Catamarca",
"America/Cayenne",
"America/Cayman",
"America/Chicago",
"America/Chihuahua",
"America/Coral_Harbour",
"America/Cordoba",
"America/Costa_Rica",
"America/Creston",
"America/Cuiaba",
"America/Curacao",
"America/Danmarkshavn",
"America/Dawson",
"America/Dawson_Creek",
"America/Denver",
"America/Detroit",
"America/Dominica",
"America/Edmonton",
"America/Eirunepe",
"America/El_Salvador",
"America/Fortaleza",
"America/Glace_Bay",
"America/Godthab",
"America/Goose_Bay",
"America/Grand_Turk",
"America/Grenada",
"America/Guadeloupe",
"America/Guatemala",
"America/Guayaquil",
"America/Guyana",
"America/Halifax",
"America/Havana",
"America/Hermosillo",
"America/Indiana/Knox",
"America/Indiana/Marengo",
"America/Indiana/Petersburg",
"America/Indiana/Tell_City",
"America/Indiana/Vevay",
"America/Indiana/Vincennes",
"America/Indiana/Winamac",
"America/Indianapolis",
"America/Inuvik",
"America/Iqaluit",
"America/Jamaica",
"America/Jujuy",
"America/Juneau",
"America/Kentucky/Monticello",
"America/Kralendijk",
"America/La_Paz",
"America/Lima",
"America/Los_Angeles",
"America/Louisville",
"America/Lower_Princes",
"America/Maceio",
"America/Managua",
"America/Manaus",
"America/Marigot",
"America/Martinique",
"America/Matamoros",
"America/Mazatlan",
"America/Mendoza",
"America/Menominee",
"America/Merida",
"America/Mexico_City",
"America/Moncton",
"America/Monterrey",
"America/Montevideo",
"America/Montreal",
"America/Montserrat",
"America/Nassau",
"America/New_York",
"America/Nipigon",
"America/Nome",
"America/Noronha",
"America/North_Dakota/Beulah",
"America/North_Dakota/Center",
"America/North_Dakota/New_Salem",
"America/Ojinaga",
"America/Panama",
"America/Pangnirtung",
"America/Paramaribo",
"America/Phoenix",
"America/Port-au-Prince",
"America/Port_of_Spain",
"America/Porto_Velho",
"America/Puerto_Rico",
"America/Rainy_River",
"America/Rankin_Inlet",
"America/Recife",
"America/Regina",
"America/Resolute",
"America/Rio_Branco",
"America/Santa_Isabel",
"America/Santarem",
"America/Santiago",
"America/Santo_Domingo",
"America/Sao_Paulo",
"America/Scoresbysund",
"America/Sitka",
"America/St_Barthelemy",
"America/St_Johns",
"America/St_Kitts",
"America/St_Lucia",
"America/St_Thomas",
"America/St_Vincent",
"America/Swift_Current",
"America/Tegucigalpa",
"America/Thule",
"America/Thunder_Bay",
"America/Tijuana",
"America/Toronto",
"America/Tortola",
"America/Vancouver",
"America/Whitehorse",
"America/Winnipeg",
"America/Yakutat",
"America/Yellowknife",
"Antarctica/Casey",
"Antarctica/Davis",
"Antarctica/DumontDUrville",
"Antarctica/Macquarie",
"Antarctica/Mawson",
"Antarctica/McMurdo",
"Antarctica/Palmer",
"Antarctica/Rothera",
"Antarctica/Syowa",
"Antarctica/Vostok",
"Arctic/Longyearbyen",
"Asia/Aden",
"Asia/Almaty",
"Asia/Amman",
"Asia/Anadyr",
"Asia/Aqtau",
"Asia/Aqtobe",
"Asia/Ashgabat",
"Asia/Baghdad",
"Asia/Bahrain",
"Asia/Baku",
"Asia/Bangkok",
"Asia/Beirut",
"Asia/Bishkek",
"Asia/Brunei",
"Asia/Calcutta",
"Asia/Chita",
"Asia/Choibalsan",
"Asia/Colombo",
"Asia/Damascus",
"Asia/Dhaka",
"Asia/Dili",
"Asia/Dubai",
"Asia/Dushanbe",
"Asia/Hong_Kong",
"Asia/Hovd",
"Asia/Irkutsk",
"Asia/Jakarta",
"Asia/Jayapura",
"Asia/Jerusalem",
"Asia/Kabul",
"Asia/Kamchatka",
"Asia/Karachi",
"Asia/Kathmandu",
"Asia/Khandyga",
"Asia/Kolkata",
"Asia/Krasnoyarsk",
"Asia/Kuala_Lumpur",
"Asia/Kuching",
"Asia/Kuwait",
"Asia/Macau",
"Asia/Magadan",
"Asia/Makassar",
"Asia/Manila",
"Asia/Muscat",
"Asia/Nicosia",
"Asia/Novokuznetsk",
"Asia/Novosibirsk",
"Asia/Omsk",
"Asia/Oral",
"Asia/Phnom_Penh",
"Asia/Pontianak",
"Asia/Pyongyang",
"Asia/Qatar",
"Asia/Qyzylorda",
"Asia/Rangoon",
"Asia/Riyadh",
"Asia/Saigon",
"Asia/Sakhalin",
"Asia/Samarkand",
"Asia/Seoul",
"Asia/Shanghai",
"Asia/Singapore",
"Asia/Srednekolymsk",
"Asia/Taipei",
"Asia/Tashkent",
"Asia/Tbilisi",
"Asia/Tehran",
"Asia/Thimphu",
"Asia/Tokyo",
"Asia/Ulaanbaatar",
"Asia/Urumqi",
"Asia/Ust-Nera",
"Asia/Vientiane",
"Asia/Vladivostok",
"Asia/Yakutsk",
"Asia/Yekaterinburg",
"Asia/Yerevan",
"Atlantic/Azores",
"Atlantic/Bermuda",
"Atlantic/Canary",
"Atlantic/Cape_Verde",
"Atlantic/Faeroe",
"Atlantic/Madeira",
"Atlantic/Reykjavik",
"Atlantic/South_Georgia",
"Atlantic/St_Helena",
"Atlantic/Stanley",
"Australia/Adelaide",
"Australia/Brisbane",
"Australia/Broken_Hill",
"Australia/Currie",
"Australia/Darwin",
"Australia/Hobart",
"Australia/Lindeman",
"Australia/Melbourne",
"Australia/Perth",
"Australia/Sydney",
"CST6CDT",
"EST5EDT",
"Etc/GMT",
"Etc/GMT+1",
"Etc/GMT+10",
"Etc/GMT+11",
"Etc/GMT+12",
"Etc/GMT+2",
"Etc/GMT+3",
"Etc/GMT+4",
"Etc/GMT+5",
"Etc/GMT+6",
"Etc/GMT+7",
"Etc/GMT-1",
"Etc/GMT-10",
"Etc/GMT-11",
"Etc/GMT-12",
"Etc/GMT-13",
"Etc/GMT-2",
"Etc/GMT-3",
"Etc/GMT-4",
"Etc/GMT-5",
"Etc/GMT-6",
"Etc/GMT-7",
"Etc/GMT-8",
"Etc/GMT-9",
"Europe/Amsterdam",
"Europe/Andorra",
"Europe/Astrakhan",
"Europe/Athens",
"Europe/Belgrade",
"Europe/Berlin",
"Europe/Bratislava",
"Europe/Brussels",
"Europe/Bucharest",
"Europe/Budapest",
"Europe/Busingen",
"Europe/Chisinau",
"Europe/Copenhagen",
"Europe/Dublin",
"Europe/Gibraltar",
"Europe/Guernsey",
"Europe/Helsinki",
"Europe/Isle_of_Man",
"Europe/Istanbul",
"Europe/Jersey",
"Europe/Kaliningrad",
"Europe/Kiev",
"Europe/Kirov",
"Europe/Lisbon",
"Europe/Ljubljana",
"Europe/London",
"Europe/Luxembourg",
"Europe/Madrid",
"Europe/Malta",
"Europe/Mariehamn",
"Europe/Minsk",
"Europe/Monaco",
"Europe/Moscow",
"Europe/Nicosia",
"Europe/Oslo",
"Europe/Paris",
"Europe/Podgorica",
"Europe/Prague",
"Europe/Riga",
"Europe/Rome",
"Europe/Samara",
"Europe/San_Marino",
"Europe/Sarajevo",
"Europe/Simferopol",
"Europe/Skopje",
"Europe/Sofia",
"Europe/Stockholm",
"Europe/Tallinn",
"Europe/Tirane",
"Europe/Ulyanovsk",
"Europe/Uzhgorod",
"Europe/Vaduz",
"Europe/Vatican",
"Europe/Vienna",
"Europe/Vilnius",
"Europe/Volgograd",
"Europe/Warsaw",
"Europe/Zagreb",
"Europe/Zaporozhye",
"Europe/Zurich",
"Indian/Antananarivo",
"Indian/Chagos",
"Indian/Christmas",
"Indian/Cocos",
"Indian/Comoro",
"Indian/Kerguelen",
"Indian/Mahe",
"Indian/Maldives",
"Indian/Mauritius",
"Indian/Mayotte",
"Indian/Reunion",
"MST7MDT",
"PST8PDT",
"Pacific/Apia",
"Pacific/Auckland",
"Pacific/Efate",
"Pacific/Enderbury",
"Pacific/Fakaofo",
"Pacific/Fiji",
"Pacific/Funafuti",
"Pacific/Galapagos",
"Pacific/Guadalcanal",
"Pacific/Guam",
"Pacific/Honolulu",
"Pacific/Johnston",
"Pacific/Kosrae",
"Pacific/Kwajalein",
"Pacific/Majuro",
"Pacific/Midway",
"Pacific/Nauru",
"Pacific/Niue",
"Pacific/Noumea",
"Pacific/Pago_Pago",
"Pacific/Palau",
"Pacific/Ponape",
"Pacific/Port_Moresby",
"Pacific/Rarotonga",
"Pacific/Saipan",
"Pacific/Tahiti",
"Pacific/Tarawa",
"Pacific/Tongatapu",
"Pacific/Truk",
"Pacific/Wake",
"Pacific/Wallis",
]
Note that any mapping from "Name" to anything (even text) wouldn't be unique -- e.g. America/Los_Angeles appears in two entries for with and without DST here.
The output of this can be dumped into a JSON5 file (last line has comment) and stored in your repo. You can run this script every now and then to get updated list.
A more detailed script that I wrote and I am actually going to store for generating this code is avaiable at: https://gist.github.com/eyedean/18f2611624c8f9624f8bc6a3b74e9dba

Sub_block base_address override?

Is there a way to assign a different base_address to the sub_blocks of a sub_block?
I have a case where I have something like this:
dut.rb:
sub_block ipBlock base_address: 0x11000000
and so the registers at this level all start with 0x110000000
But ipBlock also has its own sub_blocks:
ipblock.rb:
sub_block subIPBlock base_address: 0x0
with its own registers that due to an interface difference require a 0 base_address.
Unfortunately, when I add registers to subIPBlock they still have the base address of the top-level ipBlock:
sub_ipblock.rb:
add_reg :reg0, 0x0, 16, reset: 0xFFFF ...
Is there is a way to easily reassign the base address of the sub_block of a sub_block?
I believe you can use sub-block domains to achieve what you want.
sub_block :subx2, class_name: "SubX", base_address: { ips: 0x2000_0000, ahb: 0x3000_0000 }
dut.subx1.reg1.address(domain: :ips) # => 0x2000_0200
dut.subx1.reg1.address(domain: :ahb) # => 0x3000_0200
regards
In addition to the other answer, also note that reg.offset will return the block relative address, which it sounds like you want here.
All Origen drivers should override the register's address when an :address option is given, so within your model you could implement a read/write register method to add an :address option:
def write_register(reg, options = {})
if your_criteria_to_use_local_address
options[:address] = reg.offset
end
dut.write_register(reg, options) # Handover for original write
end
You could also force/override the base address within your model by implementing the following method:
def reg_base_address(options = {})
0
end
Finally, note that when using the domains per #rchitect-of-info's answer, you can define two domains when you instantiate a parent sub-block, then when you instantiate a child of that sub-block you can pick which of the available domains it is assigned to.
See this example from the documentation linked to in the other answer:
$dut.subx2.suby1.reg1.address # => 0x2000_0300
$dut.subx2.suby2.reg1.address # => 0x3000_0300

Origen::Parameter sets getting erased upon $dut re-init

I create many test interface parameters during the $dut initialization. The app inits the model in either 'load' or 'import' mode, as we get many sources of info from 3rd parties. For parameters, the source is native Ruby so regardless of the init method (load or import) the code is required like this:
send modeling_method, model_path # load_params or import_params
Here is that method(s):
def load_params(path)
Origen.log.info("PPEKit: Modeling parameters from #{path}")
require path.to_s.chomp('.rb')
Origen.log.info("PPEKit: Modeling of parameters complete")
end
alias_method 'import_params', 'load_params'
Here is the content of the file required above:
Origen.top_level.define_params :default do |params|
params.bist.override = 1
params.bist.lev_equ_set = 1
params.bist.lev_spec_set = 1
params.bist.levset = 1
params.bist.seqlbl = 'mbist_cpu_hr_vnom_burst'
params.bist.override_tim_spec_set = 'bist_25Mhz'
params.bist.override_timset = '1,1,1,1,1,1,1,1'
params.bist.site_control = 'parallel:'
params.bist.site_match = 2
end
I can see them at the end of my $dut initialization during execution of the command 'origen p myflowfile.rb':
[5] pry(#<PPEKit::Product>)> $dut.params
=> {:bist=>
{:override=>1,
:lev_equ_set=>1,
:lev_spec_set=>1,
:levset=>1,
:seqlbl=>"mbist_cpu_hr_vnom_burst",
:override_tim_spec_set=>"bist_25Mhz",
:override_timset=>"1,1,1,1,1,1,1,1",
:site_control=>"parallel:",
:site_match=>2}}
However, when Origen transitions to the test interface code, the params are not accessible:
[1] pry(#<STP::Interface>)> $dut.params
=> #<Origen::Parameters::Missing:0x002aaab22dc378
#owner=<Model/Controller: PPEKit::Product:23456337817000/PPEKit::ProductController:23456355062960>>
I can, however, see other parts of the $dut model such as pins and sub_blocks:
[2] pry(#<STP::Interface>)> $dut.sub_blocks
=> {"block0"=><Model: PPEKit::Product::Block0:23456336916760>,
"block1"=><Model: PPEKit::Product::Block1:23456336907380>,
"block2"=><Model: PPEKit::Product::Block2:23456336841100>,
It just seems like they are getting erased sometime between the model init and the test flow generation. So I put a breakpoint in the 'on_load_target' callback, and saw different results each time the breakpoint was hit. On the first break, the params were there and on subsequent breaks they were not.
75: def on_load_target
=> 76: binding.pry
77: to_origen(path: vendor_path.to_s, instantiate_level: :sub_block) if #import
78: end
[1] pry(#<PPEKit::Product>)> $dut.params
=> {:bist=>
{:override=>1,
:lev_equ_set=>1,
:lev_spec_set=>1,
:levset=>1,
:seqlbl=>"mbist_ccx_hr_vnom_burst",
:override_tim_spec_set=>"bist_25Mhz",
:override_timset=>"1,1,1,1,1,1,1,1",
:site_control=>"parallel:",
:site_match=>2}}
[2] pry(#<PPEKit::Product>)>
Frame number: 0/25
From: /users/user/origen/ppekit/lib/ppekit/product.rb # line 76 PPEKit::Product#on_load_target:
75: def on_load_target
=> 76: binding.pry
77: to_origen(path: vendor_path.to_s, instantiate_level: :sub_block) if #import
78: end
[1] pry(#<PPEKit::Product>)> $dut.params
=> #<Origen::Parameters::Missing:0x002aaab9f3ad48
#owner=<Model/Controller: PPEKit::Product:23456377300040/PPEKit::ProductController:23456379739240>>
I believe there could be 2 issues here:
1) The repeated initialization of the $dut during test flow generation, documented here
2) The emptying of the parameter set hash, which is due to issue #1 (and some Parameter set initialization code
I believe it has something to do with the parameter #owner being defined as the $dut instance during the parameter definition and #owner being re-defined as the $dut ProductController instance on subsequent queries of the parameters.
thx
The problem here is that the parameters are ultimately getting loaded by calling require 'some_file.rb'.
Whenever the target is internally re-loaded, Ruby hits the line again but does not do anything since it knows that it has already required that file and effectively skips over that line.
Changing it to load 'some_file.rb' will force it to execute the file every time.

How to get All thread ids and names of a process

I wrote a program using c# that list all running process in window, i want to list all running process in window, and in each process, i want to list all running thread (both name and id). i can't find any function on Window Api to list thread name, how can i do it ?
Example: plz look at this picture:
lh4.googleusercontent.com/HwP6dpts5uRPJIElH7DgUd3x95aQKO36tynkfsaDMBbM=w607-h553-no
in the image, i want to list
FireFox ID: 123
Google Chorme ID 456
...
Explorer ID 789
Documents ID 654
Temp ID 231
...
Thankyou !
You can use the Systems.Diagnostic namespace and then use:
Process[] processlist = Process.GetProcesses();
foreach(Process theprocess in processlist){
Console.WriteLine(“Process: {0} ID: {1}”, theprocess.ProcessName, theprocess.Id);
}
Source
More info

Resources