我正在尝试创建一个简单的 RSS 提要。我使用此服务表单 w3.org验证我的 rss 。这是我的提要的样子:
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>example.com RSS</title>
<link>https://www.example.com/</link>
<description>A cool website</description>
<item>
<title>Cool Article</title>
<link>https://www.example.com/cool-article</link>
<guid>https://www.example.com/cool-article</guid>
<pubDate>Sun, 10 Dec 2017 05:00:00 GMT</pubDate>
<description>My cool article description</description>
</item>
</channel>
</rss>
Run Code Online (Sandbox Code Playgroud)
但我从提要验证器收到此错误:
此提要是有效的,但可以通过实施以下建议来改进与最广泛提要阅读器的互操作性。
第 14 行,第 4 列:缺少 atom:link with rel="self" [帮助]
所以我点击[help]并得到这个:
如果您还没有这样做,请在您的提要顶部声明 Atom 命名空间,因此:
然后在频道部分插入一个 atom:link 到您的提要。下面是一个帮助您入门的示例。请务必将 href 属性的值替换为您的供稿网址。
<atom:link href="http://dallas.example.com/rss.xml" rel="self" type="application/rss+xml" />
好的,首先我试图验证 rss,而不是Atom,但他们似乎试图将我引向 Atom 的方向。好的,我无论如何都会尝试。
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>example.com RSS</title> …
Run Code Online (Sandbox Code Playgroud) 我有my-template.docx
我my-report.docx
用 OpenXml转换成,然后my-report.pdf
用:
soffice --headless --convert-to pdf my-report.docx
Run Code Online (Sandbox Code Playgroud)
我不得不说这个功能非常受欢迎。无论如何,我无法在此处(cli 文档)或此处(与 MS Office 比较)或我的其他帖子中找到答案的一件事是,LibreOffice 是否可以安全进行自动化。
请参阅Microsoft 的这篇文章,其中指出不要将 Word 用于服务器端自动化。这就引出了一个问题,即 LibreOffice 对服务器端自动化是否安全?基本上,我将使用 C# 来运行soffice --headless --convert-to pdf my-report.docx
任何收到报告请求的时间。
那安全吗?
*假设没有其他人试图阅读 my-report.docx
我使用以下意图来允许用户选择文件的保存位置:
// https://developer.android.com/guide/topics/providers/document-provider
var intent = new Intent(Intent.ActionCreateDocument);
intent.AddCategory(Intent.CategoryOpenable);
intent.SetType("image/png");
intent.PutExtra(Intent.ExtraTitle, "myfile");
StartActivityForResult(Intent.CreateChooser(intent, "Select Save Location"), 43);
Run Code Online (Sandbox Code Playgroud)
它创建文件并返回文件的 uri:
content://com.android.providers.downloads.documents/document/436
Run Code Online (Sandbox Code Playgroud)
但是现在我被搁置了,因为文档的那部分以
创建新文档后,您可以在 onActivityResult() 中获取其 URI,以便您可以继续写入。
我不知道该怎么做。由于我的结果是使用该content
方案,因此我不能将其视为常规Java.IO.File
并将其写入磁盘。那么如何将文件保存到我拥有的内容 uri 中呢?
android xamarin.android android-contentprovider xamarin filesavepicker
我希望这些方程式对齐,以便所有变量和运算符都直接向下移动。我尝试了几种不同的技术,但未能使其正常工作。
不:
\begin{align*}
x+y+z=1 \\
x+y+z=\frac{5}{2} \\
x+y+z=5
\end{align*}
Run Code Online (Sandbox Code Playgroud)
摆弄。
所以只是为了清楚起见,我花了几个小时在谷歌上搜索东西,但这些都不起作用。这不是一个“低努力的帖子”。
这是我一直在尝试的代码示例。它不起作用。做这样的响应response.headers=[{Location:"foo"}]
或response.headers=[{location:"foo"}]
我尝试过的其他八种方式都没有。
exports.handler = (event, context, callback) => {
if(request.uri === "/") {
var response = {
statusCode: 301,
headers: {
"location" : [{
key: "Location",
value: "foo"
}]
},
body: null
};
callback(null, response);
}
Run Code Online (Sandbox Code Playgroud)
我试过以下链接:
这是在 iPhone 6s 上的 iOS 12.1.4 上。通常Geolocation.GetLastKnownLocationAsync()
有效,但有时无效。这是完全相同的代码,但如果我坐在这里一遍又一遍地按下“获取纬度和经度”按钮,最终会Geolocation.GetLastKnownLocationAsync()
吐出一个空值。
你知道为什么会发生这种情况以及我该如何处理吗?也许把它放在一个循环中,尝试十次,在每次尝试之间等待一秒钟?
var location = await Essentials.Geolocation.GetLastKnownLocationAsync(); // works most of the time but sometimes it doesn't work.
Run Code Online (Sandbox Code Playgroud)
这是我建议的解决方法:
Essentials.Location location = null;
for(var i = 0; i < 10; i++)
{
location = await Essentials.Geolocation.GetLastKnownLocationAsync();
if(location == null)
{
Thread.Sleep(1000);
}
else
{
break;
}
}
Run Code Online (Sandbox Code Playgroud) 尽管这是一个简单的问题,但我无法在google或stackoverflow上找到答案。
当我使用以下代码时,我得到这个结果//com.android.externalstorage.documents/tree/primary:Podcasts
var intent = new Intent(Intent.ActionOpenDocumentTree);
intent.PutExtra("android.content.extra.SHOW_ADVANCED", true);
intent.PutExtra("android.content.extra.FANCY", true);
intent.PutExtra("android.content.extra.SHOW_FILESIZE", true);
Run Code Online (Sandbox Code Playgroud)
你能帮我理解我的结果的各个部分吗?
我发誓我曾经记得 Visual Studio 刚刚中断了一个异常。它会直接带您到引发异常的行,并允许您只需将鼠标悬停在变量上即可检查变量。
或许那是一个梦。或者也许这是一场噩梦。
但这实际上不是问题,对吧,因为现在你需要做的不是让它正常工作,而是去Debug > Windows > Exception Settings
你遇到混乱的地方。
其中存在许多明显的问题。例如:
哦,还有,单击此复选框绝对不会执行任何操作
以前它只能工作。有可能回到原来那样吗?
很遗憾我什至不得不说这件事。信不信由你,我已经尝试找到这个问题的答案。
如何关闭 GNOME(特别是 Ubuntu 18.04)中的工作区?
我在按钮单击事件处理程序中创建并启动一个线程.该线程执行一些同步工作,并通过触发事件通知UI线程进度.
问题是这会锁定UI线程,我不知道为什么.
public partial class MainPage : ContentPage
{
private event EventHandler<double> ProgressChanged;
public MainPage()
{
InitializeComponent();
button.Clicked += Button_Clicked;
ProgressChanged += MainPage_ProgressChanged;
}
private void Button_Clicked(object sender, EventArgs e)
{
new Thread(() =>
{
for (double i = 0; i <= 1; i += .00001)
{
ProgressChanged.Invoke(this, i);
}
}).Start();
}
private void MainPage_ProgressChanged(object sender, double e)
{
Device.BeginInvokeOnMainThread(() =>
{
progressBar.Progress = e;
});
}
}
Run Code Online (Sandbox Code Playgroud) 我有一个叫做CottonCandy的物品.CottonCandy有一些属性:
如果我可以向CottonCandy添加一些内容以便我可以检索这样的属性,那将是多么伟大的事情:
var colors = cottonCandy["Colors"];
Run Code Online (Sandbox Code Playgroud)
从阅读本文看起来你可以获得价值:
cottonCandy.GetType().GetProperty("Colors").GetValue(cottonCandy, null);
Run Code Online (Sandbox Code Playgroud)
你可以轻松地将其包装在一个方法中:
var colors = cottonCandy.GetPropertyValue("Colors");
Run Code Online (Sandbox Code Playgroud)
但我真的更喜欢键/值语法cottonCandy["Colors"]
.有没有办法让这种情况发生?
我的意思是我有一个这样的方法:
public static void CrossThreadUpdate<T1, T2, T3>(this Form form, Action<T1, T2, T3> action, object[] parms)
{
form.BeginInvoke(action, parms);
}
Run Code Online (Sandbox Code Playgroud)
但我不想创建相同的功能,因为<T1>, <T1, T2>, <T1, T2, T3>, <T1, T2, T3, T4>, etc.
我正在想象类似于Foo(params string[] bar)
.
xamarin ×5
c# ×3
android ×2
android-file ×1
aws-lambda ×1
gnome ×1
latex ×1
libreoffice ×1
mathjax ×1
reporting ×1
rss ×1
ubuntu-18.04 ×1