我真的很喜欢Xml来保存数据,但什么时候sqlite/database成为更好的选择?例如,当xml有多于x项或大于y MB时?
我正在编写一个rss阅读器,我相信我在sqlite数据库上使用xml来存储所有 feed项的缓存时做出了错误的选择.有哪些一个月后有〜1MB一个XML文件,一些饲料,另外有超过700个项目,而大部分只是后具有约30项,并在〜50KB大小数个月.
我目前没有计划实施上限,因为我希望能够搜索所有内容.
所以,我的问题是:
更新(更多信息)
每次在GUI中选择一个订阅源时,我都会重新加载该订阅源xml文件中的所有项目.
我还需要修改读取/未读状态,当我循环遍历xml中的所有节点以查找项目然后将其设置为已读/未读时,这似乎非常黑客.
有问题的"点击声音"实际上是系统范围的偏好,因此我只希望在我的应用程序具有焦点时禁用它,然后在应用程序关闭/失去焦点时重新启用它.
最初,我想在stackoverflow上问这个问题,但我还没有进入测试阶段.因此,在谷歌搜索答案并找到一点信息后,我想出了以下内容,并决定在此处发布,因为我已经进入测试版.
using System;
using Microsoft.Win32;
namespace HowTo
{
class WebClickSound
{
/// <summary>
/// Enables or disables the web browser navigating click sound.
/// </summary>
public static bool Enabled
{
get
{
RegistryKey key = Registry.CurrentUser.OpenSubKey(@"AppEvents\Schemes\Apps\Explorer\Navigating\.Current");
string keyValue = (string)key.GetValue(null);
return String.IsNullOrEmpty(keyValue) == false && keyValue != "\"\"";
}
set
{
string keyValue;
if (value)
{
keyValue = "%SystemRoot%\\Media\\";
if (Environment.OSVersion.Version.Major == 5 && Environment.OSVersion.Version.Minor > 0)
{
// XP
keyValue += "Windows XP Start.wav";
}
else if (Environment.OSVersion.Version.Major …
Run Code Online (Sandbox Code Playgroud) 对于我的C#应用程序,我不想总是在应用程序启动时提示提升,但如果他们选择了受UAC保护的输出路径,那么我需要请求提升.
那么,如何检查路径是否受UAC保护,然后如何请求提升执行中?
我正在尝试在我的RSS阅读器中添加对stackoverflow提要的支持,但SelectNodes和SelectSingleNode没有任何效果.这可能与我还不了解的ATOM和xml命名空间有关.
我已经通过从feed标签中删除所有属性来实现它,但这是一个黑客,我想正确地做到这一点.那么,你如何使用带有原子馈送的SelectNodes?
这是一个饲料片段.
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" xmlns:thr="http://purl.org/syndication/thread/1.0">
<title type="html">StackOverflow.com - Questions tagged: c</title>
<link rel="self" href="http://stackoverflow.com/feeds/tag/c" type="application/atom+xml" />
<subtitle>Check out the latest from StackOverflow.com</subtitle>
<updated>2008-08-24T12:25:30Z</updated>
<id>http://stackoverflow.com/feeds/tag/c</id>
<creativeCommons:license>http://www.creativecommons.org/licenses/by-nc/2.5/rdf</creativeCommons:license>
<entry>
<id>http://stackoverflow.com/questions/22901/what-is-the-best-way-to-communicate-with-a-sql-server</id>
<title type="html">What is the best way to communicate with a SQL server?</title>
<category scheme="http://stackoverflow.com/feeds/tag/c/tags" term="c" /><category scheme="http://stackoverflow.com/feeds/tag/c/tags" term="c++" /><category scheme="http://stackoverflow.com/feeds/tag/c/tags" term="sql" /><category scheme="http://stackoverflow.com/feeds/tag/c/tags" term="mysql" /><category scheme="http://stackoverflow.com/feeds/tag/c/tags" term="database" />
<author><name>Ed</name></author>
<link rel="alternate" href="http://stackoverflow.com/questions/22901/what-is-the-best-way-to-communicate-with-a-sql-server" />
<published>2008-08-22T05:09:04Z</published>
<updated>2008-08-23T04:52:39Z</updated>
<summary type="html"><p>I am going to …
Run Code Online (Sandbox Code Playgroud) 我已经通过visual studio designer将图像导入到项目资源文件中.其中一些图像不再使用,我想删除它们.
但是,我之前尝试通过解决方案资源管理器删除图像文件然后<data>
从.resx文件中删除相应的元素来删除资源图像.但是,这会导致VS设计人员发生恐慌攻击并开始抛出异常,说它无法找到我刚删除的文件,即使它们没有被引用到任何地方.
从资源文件中删除图像的正确方法是什么?
当RSS客户端遇到具有相同guid /标识符的多个项目的订阅源时,它应具有的正确响应是什么?
目前在我的应用程序中,任何使用现有guid的项目都不会被缓存或显示,因为它认为它已经拥有该项目.
在此示例Feed中,许多项目共享此ID:
tag:blizzard.com,2010-10-22:diablo3:feed:en-us:1
Run Code Online (Sandbox Code Playgroud)