迈克尔·李维(Michael Levi)的建议,它在我的项目中对我有用,并在导入JSON文件时以这种方式应用了它:
import * as fs from 'fs';
import * as path from 'path';
const filePath = path.join(process.cwd(), './src/api/send-message/conf/conf.json');
const configFIle = fs.readFileSync(filePath, 'utf-8').toString();
export const config = JSON.parse(configFIle);
您应该能够使用pyproj的 /code> 类,这是Metpy在引擎盖下用来计算Eg lat_lon_grid_deltas
的方法。我认为这样的事情会起作用:
import pyproj
geod = pyproj.Geod(ellps='sphere')
_, _, dist = geod.inv(cross['longitude'][0], cross['latitude'][0],
cross['longitude'], cross['latitude'])
我实际上还没有尝试过该代码,因此您可能需要将Xarray dataArray
s转换为numpy Plain阵列。
看起来您的范围是空的。您可能需要在范围参数中添加OpenID和配置文件才能获取ID令牌。
如果您也可以显示您的授权请求(该指南中的步骤1),这将有所帮助。
然后,Ya,Umakanth对刷新令牌说了什么。需要将Offline_access添加到范围。
包括offline_access获取刷新令牌(请确保在应用程序设置中启用了允许离线访问字段)。
现在,您可以使用迈克尔·米尔顿(Michael Milton)(@多聚元素)要在Python中进行ID映射,请参见公告。该软件包还可以与Uniprot在2022 REST API中的新产品配合使用。
示例在原始帖子中使用Unipredsed:
from unipressed import IdMappingClient
request = IdMappingClient.submit(
source="UniProtKB_AC-ID", dest="PDB", ids={"A0A0M3KKX3"}
)
list(request.each_result())
结果:
[{'from': 'A0A0M3KKX3', 'to': '4U7N'},
{'from': 'A0A0M3KKX3', 'to': '4U7O'},
{'from': 'A0A0M3KKX3', 'to': '4ZKI'}]
请参阅使用它进行三个人类基因的ID映射到Uniprot标识符/登录代码在这里。该帖子还具有链接,以获取有关未经许可的软件包的更多信息,以及用于锻炼 source
和目标( dest
)详细信息的建议。
查看更多示例使用Unipredsed访问Uniprot的新REST API 和在底部来自“从 - 到”结果的熊猫数据框。
更新:我做了一个存储库,允许在浏览器中运行此和其他未经许可的示例,而无需在计算机上安装任何内容。首先,Go 在这里,然后单击任何'启动binder
'徽章。
创建一个状态变量:
import React ,{useState} from "react";
[visible,setVisible]=useState(false);
根据您想要的事件进行更改
我已更新了我的nodejs版本18.18,然后发生了此错误。我将WebPack与5版本的版本和7版一起使用。但是我没有SASS模块。
对我来说,解决方案是安装SASS。
npm i sass-save-dev
您的排序功能可能是将空字符分类为0。
这不是进行身份验证的最佳方法,因为MERN开发人员相反,您最好使用cookie从首先获得请求中获取身份验证信息,
您可以在Passport.js的帮助下轻松执行此操作,
祝你好运...
您有以下选项:
-
配置
bsondefaults.guidrepresentationmode = guidrePresentationMode.v3;
。在这种情况下,您将使用文档中指定的子类型(或通过属性在最后查看文档)。如果是csuuid
- ,那么子类型为3,uuid
-4。 -
配置
guidserialization.unspecified
。例如,在收集期间创建:db.getCollection< bsondocument>( “ coll”, new Mongocollectionsettings(){guidRepresentation = guidRepresentation.unspecified});
这种情况类似于#1,我们从文档中获得了子类型,但仅适用于特定集合
-
配置
guid> guidserialization.standard
强迫使用此特定集合的子类型
,无论subtype
在文档中提供:var coll = db.getCollection< bsondocument>(“ coll”,new mongocollectionsettings(){guidrePresentation = guidrepresentation.standard}); var testjson =“ [{'_id':csuuID('609e26f6-dbad-4dba-ba37-4e37-4e35f0e348ec'),'name':'data1'},{'_ id'} 4E35F0E348FF'),'名称':'data2'}]”; Coll.InsertMany(bsonserializer.deserialize< bsondocument []>(testjson)); //插入子类型为4(UUID/标准)
您还可以在全球范围内配置GuidRepresentation: bsondefaults.guidrepresentation = guidrepresentation.standard;
。在这种情况下,您将默认情况下强制使用此表示形式(对于guidrepresentationmode.v2默认模式),
您可以找到详细信息在这里
原因:
简单地说,现在不支持。
您正在使用运行时变量。
但是运行时间变量不支持服务连接或Azure订阅。该变量将在运行时间初始化。
您可以按照下面的方法进行使用以使用不同的服务连接:
但仍然需要点,在管道运行之前,参数会扩展,硬码不可避免,这是设计。
在此官方文件中也很明显:
C ++ 20和C ++ 23
对于感兴趣的人,我将从现代C ++的角度提供完整的答案。
C ++ 20和C ++ 23之间只有很小的差异。
为什么我们需要模板
和 typename
?
基本问题是,没有其他提示,编译器无法理解C ++。正式地,C ++语法是上下文敏感的,您需要提供其他disamuguators。
int x, y;
template <typename T>
void f() {
T::type * x;
// if 'type' is a type, then this is declaring 'x' as a pointer to 'T::type'
// if 'type' is a static data member, this is multiplying 'x' with 'T::type'
typename T::type* x; // unambiguous
T::templ<0>> y;
// if 'templ' is a template, then this is ( (T::templ<0>) > y) )
// if 'templ' is a static data member, this is ((T::templ < 0) >> y)
T::template templ<0>> y; // unambiguous
}
如您所见,问题是 t
可以是任何类型,因此 t ::类型
和 t :: Templ
可以是任何东西:静态数据成员,类型别名,模板,成员函数模板,非模板成员函数等。
这是因为 t :: Type
和 t :: Templ
是相关类型,取决于模板参数 t
。
C ++通过将 t ::某物
作为数据成员或成员函数来解决这种歧义。您指定 template
或 typename
是
被解释为类型或模板的东西。
依赖类型和表达式
概括术语的
- :
t :: Type
之类的类型是依赖性模板参数t
。 -
(x+y)
之类的表达 - 依赖性如果x
或y
依赖于模板类型参数。 -
(x+y)
之类的表达 - 依赖性如果x
或y
依赖于非类型模板参数。
通常,当涉及依赖类型时, typename
template 是必要的。如果从依赖的表达式形成依赖类型,例如 decltype(x + y)::类型
也可能发生这种情况。
模板
和 typename
关键字如何工作?
这些关键字有时被称为Disamamutorator,并告知编译器您需要类型或模板而不是数据成员/成员函数。
typename
disambuator
typename
被准备到 typename特定词,并适用于需要歧义的名字。例如:
typename T::type // interpreted as type
│ ▲
└────────┘
typename T::type::type // interpreted as type
│ ▲
└──────────────┘
typename T::templ<0>::type // interpreted as non-type
│ ▲
└────────┘
typename T::template templ<0>::type // interpreted as a type
│ ▲
└───────────────────────────┘
template
disambiguator
template
在合格 - id ,使其如此&lt;
不是被解释为不太少的操作员,而是一个开始 template-argument-list 。
T::templ<0> // '<' is interpreted as less-than
T::template templ<0> // '<0>' is interpreted as template-argument-list
T::template templ<0>::templ<1> // '<1' is interpreted as less than 1
typename T::templ<0> // '<0>' is interpreted as template-argument-list
│ ▲ // due to type-only context
└────────┘
如上一个示例所示, typename
可以使模板
不必要,因为 templ&lt;
只能将其解释为a template-argument-list 如果 templ
必须是一种类型。
模板
有另一种(现在已弃用)的使用,即提供template-template参数:
template <template <typename> typename TT>
void f();
template <typename T>
void g() { f<T::template templ>(); }
此用途已被弃用,因为始终很明显&lt; ...&gt;
是a template-argument-list 在此上下文中和模板
是毫无意义的。
C ++ 20和C ++ 23放松是多少?
模板
和 typename
的许多用途现已变得不必要。如上所述, typename
有时制作模板
不必要。更一般地, typename
和模板
可以省略仅类型的上下文。
例如:
using T = T::type; // OK
static_cast<T::type>(...); // OK
std::is_const_v<T::type>; // OK
void f(T::type t); // OK
这些用途和其他用途将在C ++ 20之前被不良形成。 C ++ 23添加了 template
和 typename
之间的交互,这消除了进一步的用途。
相关建议是:
- typename !(C ++ 20)
- p1787:声明和在哪里可以找到它们(C ++ 23)
,通常会努力消除 typename
and code>和模板的所有位置
并不是真正必要的。
请注意, template
和 typename
并不总是需要歧义,而只是有助于解析。例如:
typename T::a::b::c::d::e::f::g::h::i::j x,
在这里,我们仍然需要 typename
,尽管明确是声明。否则,知道 a
是一种类型和 a ::
是有效的。
因此,在这种情况下, typename
不太可能成为可选的。
也许以下是您需要的。我对Sec.Gov不熟悉,因此您必须
根据您对该网站的经验(例如文档ID)提供输入和编辑。我添加了一种方法,可以根据我在Chrome的调试器控制台的响应标头中看到的cookie来获取cookie。 This is the cookie I got back that expires in about 8 hours (ak_bmsc=5EF62DAF005C6A95904F7ED7CCED9D78~000000000000000000000000000000~YAAQFC0tF+cmqpSBAQAAGJavoxCRBM3XBiKPn8e24CgXNLo+q6fI5C4VOJAkqdQdlHpsf2p08VHMcp10NI9rhpcoiI1i8CFQEvrR9b1SyCA9wN6sCAhoioLMvuqsYCwvVr21+AXb+XTvs65Kc70n5P7bEDYsvvWAFC5L+jdAQ+mLlcDTWF7twH2Lg1vYQAbxcje8OnbTDSldM2IGsWltH4ii1h73ZYPqlcTMWf/uh9AbKAlk+x50YQ1bUkTGdl+HZgulE6crPxHOqy4Q2PbXi2QwgylnYG9VTkmMzCnLi+clfWFQVuTz1i85x+YO9B4/eV3VHTYgFFk/SEmerp0kZbmzhT/RdFneLSaOOjg0KfHFR0tsKrlY1Ys= ;),这就是为什么每次执行这些请求的一批时都希望获得新的cookie的原因。我在在线Regex测试仪上测试了它,因此应该可以使用。
; GET COOKIE IDEA (EDIT)
Global reqCookie
secReq := getReq("www.sec.gov")
If (foundCookie := regexMatch(secReq.getAllResponseHeaders(), "U)Set\-?Cookie:[\s\r\n]+\K(\S+\;)", cookie)) {
reqCookie := cookie1
} Else {
Msgbox, Didn't find a cookie!
Return
}
itWorked := urlDownloadToFileSEC(A_Desktop . "\SEC Download.xml", "1548527/000154852712000001")
Msgbox % (itWorked ? "It Worked!" : "Something went wrong")
Return
urlDownloadToFileSEC(FilePath, docID, timeoutMS=60000, bAsync=false)
r := comObjCreate("WinHttp.WinHttpRequest.5.1")
r.Open("GET", "https://www.SEC.gov/Archives/edgar/data/" . docID . "/xslFormDX01/primary_doc.xml", bAsync)
r.SetTimeouts(timeoutMS, timeoutMS, timeoutMS, timeoutMS)
r.SetRequestHeader("User-Agent", "Sample Company Name AdminContact@<sample company domain>.com")
; DO NOT KNOW WHAT YOU WOULD ACTUALLY WANT TO PUT IN THE ABOVE USER AGENT.
r.SetRequestHeader("Accept-Encoding", "gzip, deflate")
r.SetRequestHeader("Host", "www.sec.gov")
r.SetRequestHeader("cookie", reqCookie)
r.Send()
if (bAsync) {
Return r
; you have to use WaitForResponse method to check for it later.
}
if (r.Status="200") {
fileText := r.ResponseText
fileAppend, %fileText%, %filePath%
} ; ERRORLEVEL CONTAINS WRITE SUCCESS.
Return (r.Status="200" ? true : false)
; NEW FUNCTION!
getReq(URL, bAsync=false, timeouts=60000, reqHeadersMap="") {
Req := comObjCreate("WinHttp.WinHttpRequest.5.1")
Req.Open("GET", URL, bAsync)
Req.SetTimeouts(timeouts, timeouts, timeouts, timeouts)
if (isObject(reqHeadersMap)) {
For key, value in reqHeadersMap {
Req.SetRequestHeader(Key, Value)
}
}
Req.Send()
if (bAsync) {
Return Req
}
ErrorLevel := (Req.Status==200 ? true : false)
Return Req
}
这是一种可能的方法 - 仅根据索引替换文本,并在出现后不断更改索引。
Tested with Xcode 13.4 / iOS 15.5
Main part:
private func next() {
var next = textIndex + 1
if next == texts.count {
next = 0
}
withAnimation(Animation.linear(duration: 2)) {
textIndex = next
}
DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
self.next()
}
}
and text itself
Text(texts[textIndex]).bold()
.font(.title).id(textIndex)
.onAppear(perform: {
next()
})
您可以通过替换对象(因此与范围的领带)来解决这个问题:
丑陋,但可以使用。
You can get round this by replacing the object (and therefore the tie with the scope):
Ugly, but it works.
&quot“至少惊讶”和可变的默认论点