iso

Where can I find a list of language + region codes?

独自空忆成欢 提交于 2019-11-28 20:03:57
I have googled (well, DuckDuckGo'ed, actually) till I'm blue in the face, but cannot find a list of language codes of the type en-GB or fr-CA anywhere. There are excellent resources about the components, in particular the W3C I18n page , but I was hoping for a simple alphabetical listing, fairly canonical if possible (something like this one ). Cannot find. Can anyone point me in the right direction? Many thanks! Jukka K. Korpela There are several language code systems and several region code systems, as well as their combinations. As you refer to a W3C page, I presume that you are referring

How to convert country names to ISO 3166-1 alpha-2 values, using python

一个人想着一个人 提交于 2019-11-28 19:24:02
I have a list of countries like: countries=['American Samoa', 'Canada', 'France'...] I want to convert them like this: countries=['AS', 'CA', 'FR'...] Is there any module or any way to convert them? alecxe There is a module called pycountry . Here's an example code: import pycountry input_countries = ['American Samoa', 'Canada', 'France'] countries = {} for country in pycountry.countries: countries[country.name] = country.alpha_2 codes = [countries.get(country, 'Unknown code') for country in input_countries] print(codes) # prints ['AS', 'CA', 'FR'] Ashwini Chaudhary You can use this csv file :

Convert JSON date string to Python datetime

笑着哭i 提交于 2019-11-28 19:13:33
When translating dates to JSON, javascript is saving dates in this format: 2012-05-29T19:30:03.283Z However, I am not sure how to get this into a python datetime object. I've tried these: # Throws an error because the 'Z' isn't accounted for: datetime.datetime.strptime(obj[key], '%Y-%m-%dT%H:%M:%S.%f') # Throws an error because '%Z' doesn't know what to do with the 'Z' # at the end of the string datetime.datetime.strptime(obj[key], '%Y-%m-%dT%H:%M:%S.%f%Z') I believe that javascript is saving the string in official ISO format, so it seems that there should be a way to get python's datetime

javascript regex iso datetime

让人想犯罪 __ 提交于 2019-11-28 18:21:27
问题 does anyone have a good regex pattern for matching iso datetimes? ie: 2010-06-15T00:00:00 回答1: For the strict, full datetime, including milliseconds, per the W3C's take on the spec .: //-- Complete precision: /\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z)/ //-- No milliseconds: /\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)/ //-- No Seconds: /\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)/ //-- Putting it all together: /(\d{4}-[01]

Android Countries list with flags and availability of getting iso mobile codes

让人想犯罪 __ 提交于 2019-11-28 17:59:57
Needed Example of project showing all countries with flags and availability for getting countries mobile codes. You can download the project from here . We need files with codes described below. class MainActivity package com.example.countrieswithflags; import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.widget.ListView; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); String[] recourseList=this.getResources()

ISO 8859-1 filename not decoding

左心房为你撑大大i 提交于 2019-11-28 13:51:34
I'm extracting files from MIME messages in a python milter and am running across issues with files named as such: =?ISO-8859-1?Q?Certificado=5FZonificaci=F3n=5F2010=2Epdf?= I can't seem to decode this name into UTF. In order to solve a prior ISO-8859-1 issue, I started passing all filenames to this function: def unicodeConvert(self, fname): normalized = False while normalized == False: try: fname = unicodedata.normalize('NFKD', unicode(fname, 'utf-8')).encode('ascii', 'ignore') normalized = True except UnicodeDecodeError: fname = fname.decode('iso-8859-1')#.encode('utf-8') normalized = True

UIViewControllerHierarchyInconsistencyException异常

北城余情 提交于 2019-11-28 12:37:33
IOS中的MVC MVC模式是一种经典的软件架构模式,基本上懂程序设计的人都了解或应用过MVC模式。多数面向对象的程序设计架构都得益于MVC模式来有效的划分程序中的对象的角色,组织对象之间的耦合关系(MVC的具体定义和描述可以参见 维基百科 ),Cocoa Touch提供了IOS的开发环境,包含了诸多基础类库和框架,其中UIKit框架提供并实现了MVC模式。在IOS中UIViewController表示控制器,UIView代表视图。每一个UIViewController对象中都拥有一个view属性用以管理一组UIView对象。做过IOS开发的人都知道,一个Application的记载过程都伴随着两个对象树结构的生成,一个是控制器树形结构,另一个是视图树形结构,在UIViewController的viewDidLoad方法中,我们可以创建多个子控制器,并将子控制器下的view对象添加至父控制器的view对象中,这样依次迭代最终会完成两个对象树的创建。如图 其实,做过前端开发的人都看的出来,图中的controller的树结构和view的树结构,单独拿出一个来都和DOM的树结构类似,都是父与子,兄弟与兄弟之间的关系。 异常的出现 前面简单的描述了一下controller树和view树,其实这里面是有一点规定的,即:controller的树节点必须与view的树节点在层次结构上保持一致

Windows Phone character-encoding

蹲街弑〆低调 提交于 2019-11-28 11:39:47
My code is Encoding.GetEncoding("iso-8859-9"); in my Windows Phone project. But "iso-8859-9" is not supported on Windows Phone. How can I fix this problem? http://www.hardcodet.net/2010/03/silverlight-text-encoding-class-generator I also found this link but I don't know how to use it. To use the program, just type the encoding name and it will generate the class like so: Then make a file for the class somewhere (Copypaste the code generated from the program) and start using it: //Instead of Encoding enc = Encoding.GetEncoding("iso-8859-9"); //do this Encoding enc = new ISO88599Encoding(); /

What does the [Note] in undefined behavior paragraph in C++ standard mean?

只愿长相守 提交于 2019-11-28 10:56:00
问题 As user Tony points out there's a [Note] in paragraph 1.3.12 of C++ standard saying permissible undefined behavior ranges from ignoring the situation completely with unpredictable results, to behaving during translation or program execution in a documented manner characteristic of the environment... Doesn't this contradict the definition of UB saying that ...this International Standard imposes no requirements ? I mean they say "no requirements" and then say "permissible UB" - right in the

Why is getcwd() not ISO C++ compliant?

馋奶兔 提交于 2019-11-28 08:21:58
This MSDN article states that getcwd() has been deprecated and that the ISO C++ compatible _getcwd should be used instead, which raises the question: what makes getcwd() not ISO-compliant? Functions not specified in the standard are supposed to be prefixed by an underscore as an indication that they're vendor-specific extensions or adhere to a non-ISO standard. Thus the "compliance" here was for Microsoft to add an underscore to the name of this specific function since it's not part of the ISO standard. Johannes Schaub - litb There is a good discussion about that. P.J. Plauger answers to this