Yahoo网站可以通过浏览器中的2081端口打开(在Firefox中为HTTP和HTTPS设置代理端口2081)。端口 2081 提供 HTTP(S) 代理。
2080端口提供SOCKS5代理服务:
url="https://query1.finance.yahoo.com/v7/finance/download/MSFT"
curl --socks5-hostname 127.0.0.1:2080 $url -o msft.txt
Run Code Online (Sandbox Code Playgroud)
我现在可以下载 Yahoo 数据,并希望通过此代理使用yfinance库。
尝试方法1:
import yfinance as yf
msft = yf.Ticker("MSFT")
msft.history(proxy="http://127.0.0.1:2081")
msft.history(proxy="https://127.0.0.1:2081")
msft.history(proxy="socks5://127.0.0.1:2080")
Run Code Online (Sandbox Code Playgroud)
它们都不起作用!它们具有相同的输出:
MSFT: No price data found, symbol may be delisted (period=1mo)
Empty DataFrame
Columns: [Open, High, Low, Close, Adj Close, Volume]
Index: []
Run Code Online (Sandbox Code Playgroud)
尝试方法2:
MSFT: No price data found, symbol may be delisted (period=1mo)
Empty DataFrame
Columns: [Open, High, Low, Close, Adj Close, Volume]
Index: []
Run Code Online (Sandbox Code Playgroud)
输出:
cd ~
export …Run Code Online (Sandbox Code Playgroud) 我正在用简单的 Javascript 为 HTML/CSS/js 构建一个小型且最小的代码编辑器。在其中写入文本时出现问题。问题是我无法自由地在任何我想要的地方写入文本,因为无论我在哪里写入/编辑,鼠标指针都会自动传输到第三行,而不是保持在我正在写入的位置。
例如,如果我将鼠标指向编辑器中的某处并写入一个单词,则鼠标指针立即返回到另一行(始终位于第三行的开头)。所以它阻止我把这个词写在我想要的地方,而这个词会写在其他地方。就好像行中的某些点有块阻止您书写,而我将无法写到我想要写的地方。
错误:最初,我认为错误出在 HTML 中,然后他们指出问题出在applyColor()函数中,也许是将光标位置设置为文本代码末尾,我不知道。事实上,如果我删除该applyColor()功能,那么问题就解决了,但结果是文本不再着色。但我需要这段代码(或类似的代码),因为它是为文本着色的函数的一部分。因此,我推断问题出在 applyColor() 函数上,尽管我不能 100% 确定。所以这应该是一个JavaScript问题:
// CHANGE COLOR
function changeColor() {
var editor = document.getElementById("html");
applyColoring(editor);
// Set cursor position to the end of text
var child = editor.children;
var range = document.createRange();
var sel = window.getSelection();
range.setStart(child[child.length - 1], 1);
range.collapse(true);
sel.removeAllRanges();
sel.addRange(range);
editor.focus();
}
Run Code Online (Sandbox Code Playgroud)
问题演示:我将向您展示问题何时发生。在每种情况下,鼠标指针都会被带到其他地方,我将无法在我想要的地方书写。我相信,通过解决函数中的独特applyColor()问题,那么所有问题都会自动解决,因为它们都依赖于相同的独特问题。
为什么不能返回 Rust 中临时对象的引用?激励性的例子是:
fn what<'cellref, 'cell: 'cellref>(x: &f64) -> &'cellref CellValue<'cell> {
&CellValue::Number(*x)
}
Run Code Online (Sandbox Code Playgroud)
人们可能认为编译器可以推断只要引用存在,该对象就需要存在,因此使其保持活动状态,直到引用被删除。为什么编译器不能推断出这一点?
根据要求,这是 MRE。它说明了一个简单的问题:假设 API 需要一个&T. 您将其存放在哪里,T以便其可以按照需要的时间持续使用&T?
pub enum CellValue<'a> {
String(&'a String),
Number(f64),
Boolean(bool),
// ... many more types ...
}
pub enum Array<'a> {
ArrayGeneric(ndarray::Array2<CellValue<'a>>),
ArrayF64(ndarray::Array2<f64>),
ArrayString(ndarray::Array2<f64>),
// .. many more types ...
}
impl Array<'a> {
pub fn generic_iter() -> Iterator<Item = &CellValue> {
// ?
}
}
Run Code Online (Sandbox Code Playgroud)
与许多 Rust 用例一样,目标是零成本的抽象。
作为动机,假设您有一个 Excel 电子表格,并且您正在定义一个可以在 Excel 函数之间传递的单元格“数组”。有时,这实际上是电子表格中的值范围。在其他时候,您可能已经应用了转换,例如ABS(...),现在您拥有了一系列单元格的绝对值的数组。在前一种情况下,您只需要存储完整的电子表格和一些 …
我在 SQL Server 中编写了一个存储过程来检查数据是否存在于几个表中,如果不存在则查询将失败,但如果数据存在则它将在表 3 中插入一些数据。但我看到我得到了一个我通过变量传递的数据库名称错误。以下是错误消息。
消息 208,级别 16,状态 1,第 65 行
无效的对象名称“EMR-Integration-DEV.dbo.EMR_ADF_Variables_test”
这是我的存储过程:
CREATE PROCEDURE InsertData
@Client_Id INT,
@EMR_Id INT,
@Client_Name NVARCHAR(255),
@EMR_Name NVARCHAR(255),
@DB_Name NVARCHAR(255)
AS
BEGIN
DECLARE @Full_Table_name NVARCHAR(255);
SET @Full_Table_name = @DB_Name + '.dbo.Variable_Table_Name';
-- Check if values exist in tables in the Reference database
IF NOT EXISTS (SELECT 1 FROM Dim.Client_table WHERE ClientId = @Client_Id AND StagedName = @Client_Name)
BEGIN
PRINT 'Error: Client does not exist.';
RETURN;
END
IF NOT EXISTS (SELECT 1 FROM [dbo].[EMR] …Run Code Online (Sandbox Code Playgroud) 我不想追加也不想截断现有数据。我想覆盖现有数据。例如,以下代码使 test.txt 文件包含“hello”,但我希望该文件包含“hello6789”。
try(
FileWriter fw = new FileWriter("test.txt"); ){
fw.write("123456789");
}
try(
FileWriter fw = new FileWriter("test.txt"); ){
fw.write("hello");
}
Run Code Online (Sandbox Code Playgroud)
是否可以?
我想在 tvos 中使用 uitableview 来显示字符串数据列表,但编译器在生成的标头中遇到以下错误:
"No type or protocol named 'UITableViewDataSource'"
And "Attempting to use the forward class 'UITableView' as superclass of 'TWOSSelectionTableTVOS'"
Run Code Online (Sandbox Code Playgroud)
即使这段代码正在工作ios。
我的代码结构如下:
选择表.swift:
import UIKit
class TWOSSelectionTableTVOS : UITableView
{
private var vDataSrc:[String]!
func SetDataSrc (_ pDataSrc:[String])
{
self.vDataSrc = pDataSrc
}
func UpdateDataSrc (_ pStringList:[String])
{
self.vDataSrc += pStringList
}
func GetDataSrc () -> [String]
{
return self.vDataSrc
}
}
Run Code Online (Sandbox Code Playgroud)
PaintUI.swift:
import UIKit
@objc
class PaintUI: NSObject,UITableViewDelegate, UITableViewDataSource {
static let uShared = PaintUI …Run Code Online (Sandbox Code Playgroud) 如果删除析构函数,编译器还会隐式生成默认构造函数吗?
GCC可以编译以下代码:
struct A
{
~A() = delete;
int x;
int y;
virtual void foo()
{
}
};
int main()
{
A *pmc = new A; // Allowed by the compiler GCC, but causes memory leak
return 0;
}
Run Code Online (Sandbox Code Playgroud)
这表明 GCC 认为在这种情况下它可以隐式生成默认构造函数。默认构造函数的汇编代码也可以在Godbolt上查看:
A::A() [base object constructor]:
push rbp
mov rbp, rsp
mov QWORD PTR [rbp-8], rdi
mov edx, OFFSET FLAT:vtable for A+16
mov rax, QWORD PTR [rbp-8]
mov QWORD PTR [rax], rdx
nop
pop rbp
ret
Run Code Online (Sandbox Code Playgroud)
然而,当检查类型特征时,答案是否定的:
A::A() [base object …Run Code Online (Sandbox Code Playgroud) 在 MDN JavaScript 参考页的for...of语句中看到了这段简短的段落,在描述部分的末尾,它说:
您可以使用解构来分配多个局部变量,或使用属性访问器(如for (xy of iterable))将值分配给对象属性。
这是什么意思?您不能使用在语句中x.y定义局部变量的for...of语法。我使用节点在一个简短的脚本文件中逐字地尝试了这一点。错误消息是ReferenceError: x is not defined
我错过了什么?
在 mac m2 max 上,我使用安装了 podman brew intsall podman,然后运行podman machine init --disk-size 150,然后运行podman start。它卡在“正在等待虚拟机...”上。我从 qemu 看到此错误:同步异常位于 0x00000000BC562000
我正在尝试使用 Parsec 在 Haskell 中编写一个简单的解析器,但我的输入“Hello World”从未被正确解析。
我的代码如下所示:
parser = p1 <|> p2
p1 = string "Hello"
p2 = string "Hello World"
Run Code Online (Sandbox Code Playgroud)
如果我运行它,我会收到错误unexpected whitespace
javascript ×2
c++ ×1
constructor ×1
css ×1
destructor ×1
dynamic-sql ×1
for-of-loop ×1
haskell ×1
html ×1
ios ×1
java ×1
macos ×1
node.js ×1
parsec ×1
parsing ×1
podman ×1
proxy ×1
python-3.x ×1
qemu ×1
rust ×1
sql ×1
sql-server ×1
swift ×1
t-sql ×1
tvos ×1
yfinance ×1