我正在尝试删除字符串中的部分路径.我有路径:
/path/to/file/drive/file/path/
Run Code Online (Sandbox Code Playgroud)
我想删除第一部分/path/to/file/drive并生成输出:
file/path/
Run Code Online (Sandbox Code Playgroud)
注意:我在while循环中有几个路径,/path/to/file/drive所有路径都相同,但我只是在寻找删除所需字符串的"方法".
我找到了一些例子,但我无法让它们起作用:
echo /path/to/file/drive/file/path/ | sed 's:/path/to/file/drive:\2:'
echo /path/to/file/drive/file/path/ | sed 's:/path/to/file/drive:2'
Run Code Online (Sandbox Code Playgroud)
\2 作为字符串的第二部分,我显然做错了...也许有一种更简单的方法?
我将 PDF 文档作为二进制存储在我的表中,存储 PDF 字节的列是 type varbinary(max)。我想update在 SQL Studio 中使用更新的文档记录一个记录,我尝试完成此操作的方式如下
UPDATE table
SET file_bytes=CONVERT(varbinary(max),'JVBERi0xLjYNCiW2JqDQo8PC9UeX...0YNCg==') --this is a base64 string
WHERE id='73c75254-ad86-466e-a881-969e2c6e7a04';
Run Code Online (Sandbox Code Playgroud)
查询运行,但是当我尝试下载文档(通过网站)时,它会抛出一条错误消息,内容为 PDF header signature not found.
这种转换甚至可能吗?
我正在使用 Firebase 对 GitHub、Twitter 和 Facebook 进行身份验证,我知道我可以像这样通过身份验证获得提供者访问令牌
firebase.auth().signInWithPopup(provider).then(function(result) {
// This gives you a Facebook Access Token. You can use it to access the Facebook API.
var token = result.credential.accessToken;
// The signed-in user info.
var user = result.user;
// ...
}
Run Code Online (Sandbox Code Playgroud)
但是,在使用 React Router 4 进行身份验证后,我将用户重定向到安全区域,在此安全区域中,我需要检索提供程序的访问令牌,以便我可以访问 GitHub、Twitter 和 Facebook API(对于 Twitter,我还需要获取“秘密”细绳)。
我可以在安全区域设置一个身份验证状态观察器(如下)以获取基本的用户详细信息,甚至用户链接了哪些提供者,但是这并没有给我连接到相应提供者 API 所需的访问令牌
firebase.auth().onAuthStateChanged(function(user) {
if (user) {
// User is signed in.
var displayName = user.displayName;
var providerData = user.providerData;
// ...
}
Run Code Online (Sandbox Code Playgroud)
我应该提到我允许用户链接多个身份验证提供程序,因此我需要所有访问令牌(https://firebase.google.com/docs/auth/web/account-linking)
谢谢
我想从格式为YYYYMMDDHH的给定时间戳中查找超过N天的文件
我可以使用以下命令找到超过2天的文件,但是这会查找具有当前时间的文件:
find /path/to/dir -mtime -2 -type f -ls
Run Code Online (Sandbox Code Playgroud)
让我们说我timestamp=2011093009要输入我想要查找2011093009之前2天以上的文件.
一直在做我的研究,但似乎无法搞清楚.
我刚刚迁移到 .NET Core 3.1,在我必须更新的不同内容中,我无法让我的 ajax 调用工作。
当我进行 ajax 调用时,没有任何数据绑定到我的操作中的对象参数。
这就是我在剃须刀页面中拨打电话的方式
fetch('/Administration/UpdateUserStatus', {
method: 'POST',
credentials: 'include',
headers: {
'Content-Type': 'application/json',
'RequestVerificationToken': $('input[name="__RequestVerificationToken"]').val()
},
body: JSON.stringify(data)
})
Run Code Online (Sandbox Code Playgroud)
我的控制器动作
[HttpPost]
public IActionResult UpdateUserStatus([FromBody]User user) {
...
}
Run Code Online (Sandbox Code Playgroud)
在我上面的示例代码中,调试我可以看到user作为传入的代码null,因此来自 ajax 调用的数据不会绑定到User对象。
如果我删除[FromBody],user不会再进来null,但数据仍然没有绑定。所有属性为 null 或默认值。
在 .NET Core 2.1 中一切正常。
这是我需要添加的东西Startup.cs吗?也许我缺少一个新配置?
谢谢
我在 C# 中显示 PictureBox 时遇到问题。我有两种形式。在我的主窗体中,我调用 PictureBox 所在的另一个窗体。
这就是我调用第二种形式的方式:
frmODeck oDeck = new frmODeck();
oDeck.Show();
Run Code Online (Sandbox Code Playgroud)
现在,这是我的第二个表单,其中 PictureBox 位于主表单中
namespace Shuffle_Cards
{
public partial class frmODeck : Form
{
private PictureBox picBox;
private Image image;
public frmODeck()
{
InitializeComponent();
}
private void frmODeck_Load(object sender, EventArgs e)
{
image = Image.FromFile("C:\\C2.jpg");
picBox = new PictureBox();
picBox.Location = new Point(75, 20);
picBox.Image = image;
picBox.Show();
}
public void getCards()
{
}
}
}
Run Code Online (Sandbox Code Playgroud)
我做错了什么,或者我错过了什么?
谢谢
我在弄清楚如何获取错误输出并将其存储在 ksh 中的变量或文件中时遇到了一些麻烦。所以在我的脚本中我有cp -p source.file destination一个while循环。
当我收到以下错误时
cp: source.file: The file access permissions do not allow the specified action.
Run Code Online (Sandbox Code Playgroud)
我想抓取它并将其存储在变量或文件中。
谢谢
shell ×3
unix ×3
.net-core ×1
ajax ×1
asp.net-core ×1
asp.net-mvc ×1
base64 ×1
c# ×1
fetch-api ×1
find ×1
firebase ×1
image ×1
javascript ×1
ksh ×1
pdf ×1
permissions ×1
picturebox ×1
reactjs ×1
scripting ×1
sed ×1
sql ×1
sql-server ×1
varbinary ×1
winforms ×1