小编Non*_*biz的帖子

访问settings.settings时"配置系统无法初始化"

自从删除原始settings.settings文件以来,我遇到了无穷无尽的问题,让设置正常运行.我收到get或set方法的"配置系统初始化失败"错误.有任何想法吗?谢谢.

    public static Settings Default {
        get {
            return defaultInstance;
        }
    }

    [global::System.Configuration.UserScopedSettingAttribute()]
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    [global::System.Configuration.DefaultSettingValueAttribute("Keywords.log")]
    public string KeywordsLog {
        get {
            return ((string)(this["KeywordsLog"]));
        }
        set {
            this["KeywordsLog"] = value;
        }
    }
Run Code Online (Sandbox Code Playgroud)

问题位于Settings.Designer.cs中

阿德里安班克斯,我怕我不知道如何进一步调试?它已经打破了错误.给出的框的标题是"ConfigurationErrorsException",如果这有任何帮助.

我道歉,我没有意识到你可以在VS中看到更多细节.

System.Configuration.ConfigurationErrorsException was unhandled
  Message="Configuration system failed to initialize"
  Source="System.Configuration"
  BareMessage="Configuration system failed to initialize"
  Line=0
  StackTrace:
       at System.Configuration.ClientConfigurationSystem.EnsureInit(String configKey)
       at System.Configuration.ClientConfigurationSystem.PrepareClientConfigSystem(String sectionName)
       at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.RefreshConfig(String sectionName)
       at System.Configuration.ConfigurationManager.RefreshSection(String sectionName)
       at System.Configuration.ClientSettingsStore.ReadSettings(String sectionName, Boolean isUserScoped)
       at System.Configuration.LocalFileSettingsProvider.GetPropertyValues(SettingsContext context, SettingsPropertyCollection properties)
       at System.Configuration.SettingsBase.GetPropertiesFromProvider(SettingsProvider provider)
       at System.Configuration.SettingsBase.GetPropertyValueByName(String propertyName)
       at System.Configuration.SettingsBase.get_Item(String …
Run Code Online (Sandbox Code Playgroud)

c# settings visual-studio-2008

7
推荐指数
2
解决办法
2万
查看次数

如何为我的触摸板编写软件?

我对触控板有一些改进的想法,从底部水平滚动的滚动,右击的分区到更复杂的.但我不知道从哪里开始?我正在使用Windows 7家庭高级版,它是一台华硕笔记本电脑,而且我没有这些选项供我原生使用.无论如何,我想写一些任何人都可以使用的东西.

我从哪里开始?

(用c ++编写会很好吗?可能吗?这里的要求是什么?推荐使用哪种语言?)

device-driver touch touchpad windows-7

5
推荐指数
1
解决办法
2003
查看次数

使用多个面板设计Windows.Form - >如何隐藏一个面板(如PS层)

如何在Visual Studio 2008表单设计器中隐藏一个面板,如PS中的图层?否则,有人可以推荐另一种更好的方法来设计必须由用户点击的多个"屏幕"吗?

panel layer visual-studio-2008 windows-forms-designer winforms

4
推荐指数
1
解决办法
1万
查看次数

C++如何遍历结构列表并访问其属性

我知道我可以遍历这样的字符串列表:

list<string>::iterator Iterator;
 for(Iterator = AllData.begin(); 
   Iterator != AllData.end();
   Iterator++)
 {
  cout << "\t" + *Iterator + "\n";
 }
Run Code Online (Sandbox Code Playgroud)

但我怎么能这样做呢?

list<CollectedData>::iterator Iterator;
 for(Iterator = AllData.begin(); 
   Iterator != AllData.end();
   Iterator++)
 {
  cout << "\t" + *Iterator.property1 + "\n";
  cout << "\t" + *Iterator.property2 + "\n";
 }
Run Code Online (Sandbox Code Playgroud)

或者,如果有人可以通过for_each循环解释如何执行此操作,那将非常有用,但从我读过的内容看起来更复杂.

非常感谢

c++ foreach struct loops list

4
推荐指数
1
解决办法
1万
查看次数

C++如何将字符串转换为char*

我需要将字符串转换为char*以便在strtok_s中使用,并且无法弄明白.c_str()转换为const char*,它是不兼容的.

此外,如果有人可以向我解释为什么第二个strtok_s函数(在循环内)是必要的,这将是一个很大的帮助.为什么我需要明确地推进令牌而不是例如它所处的while循环,它隐式地连续地获取文件的每一行.

while( getline(myFile, line) ) { // Only one line anyway. . . is there a better way?
    char * con = line.c_str();
    token = strtok_s( con, "#", &next_token);
    while ((token != NULL))
    {
        printf( " %s\n", token );
        token = strtok_s( NULL, "#", &next_token);
    }
}
Run Code Online (Sandbox Code Playgroud)

相关问题.

c++ casting strtok

4
推荐指数
3
解决办法
7319
查看次数

PyNotify不能从cron工作?

我编写了一个使用pynotify发出警报的脚本.当我运行它时,它工作得很好(python script.py),但是当从cron运行时00 * * * * myname python ~/scripts/script.py,它不起作用!我不知道为什么.这是片段:

        if os.path.isfile(os.path.expanduser('~/.thumbnails/normal')+'/'+thumbnail):
            n = pynotify.Notification(video_file[0], 'finished download', os.path.expanduser('~/.thumbnails')+'/'+thumbnail)
        else:
            n = pynotify.Notification(video_file[0], 'finished download', '/usr/share/icons/gnome/48x48/mimetypes/gnome-mime-application-x-shockwave-flash.png')
        print n
        n.show()
Run Code Online (Sandbox Code Playgroud)

将输出定向到〜/ log.file给出:<pynotify.Notification object at 0x16d4e60 (NotifyNotification at 0x13804e0)>并且没有错误,所以我不确定在哪里看.

python cron pynotify

4
推荐指数
1
解决办法
730
查看次数

Python - 求解y的多项式

我正在接受一个函数(例如y = x**2)并需要求解x.我知道我可以手动解决这个问题,但我试图找到一种方法来使用.我已经浏览了numpy,scipy和sympy,但似乎无法找到我正在寻找的东西.目前我正在从函数中创建一个lambda,所以如果我能够保留该方法的格式,那将是很好的,但不是必需的.

谢谢!

python lambda equation

4
推荐指数
1
解决办法
6580
查看次数

将不正确的值类型分配给struct属性时的笑脸!

我有点想知道我是否会失去理智,但我发誓,这段代码输出笑脸作为.name值!世界上发生了什么?到目前为止,它似乎仅在值为1时起作用,其他任何正确的错误.

我意识到代码存在缺陷 - >我不需要帮助.

#include <iostream>
#include <fstream>
#include <regex>
#include <string>
#include <list>

using namespace std;
using namespace tr1;


struct CollectedData
{
public:
    string name;
    float grade;

};

int main()
{
    string line;
    list<CollectedData> AllData;
    int count;

    ifstream myFile("test_data.txt");
    if (myFile.fail()) {cout << "Error opening file"; return 0;}
    else
    {
        cout << "File opened... \n";
        while( getline(myFile, line) ) {
            CollectedData lineData;
            lineData.name = 1;
            lineData.grade = 2;
            AllData.push_back(lineData);
        }
    }

    cout << "\n\n File contents: \n";

    list<CollectedData>::iterator Iterator; …
Run Code Online (Sandbox Code Playgroud)

c++ struct types variable-assignment

3
推荐指数
3
解决办法
6627
查看次数

C++将对象存储在文件中

我有一个对象列表,我希望将其存储在尽可能小的文件中,以便以后检索.我一直在仔细阅读本教程,并开始(我认为)理解,但有几个问题.这是我正在使用的代码片段:

    static bool writeHistory(string fileName)
{
    fstream historyFile;
    historyFile.open(fileName.c_str(), ios::binary);
    if (historyFile.good())
    {
        list<Referral>::iterator i;
        for(i = AllReferrals.begin(); 
                i != AllReferrals.end();
                i++)
        {
            historyFile.write((char*)&(*i),sizeof(Referral));
        }
        return true;
    } else return false;
}
Run Code Online (Sandbox Code Playgroud)

现在,这是从片段改编而来的

file.write((char*)&object,sizeof(className));
Run Code Online (Sandbox Code Playgroud)

取自教程.现在我相信它正在做的是将对象转换为指针,获取值和大小并将其写入文件.但如果这样做,为什么还要费心去做转换呢?为什么不从头开始接受价值?为什么它需要大小?此外,根据我的理解,为什么呢

historyFile.write((char*)i,sizeof(Referral));
Run Code Online (Sandbox Code Playgroud)

不编译?我是一个迭代器(并不是一个迭代器指针?).或者干脆

historyFile.write(i,sizeof(Referral));
Run Code Online (Sandbox Code Playgroud)

为什么我还需要搞乱地址呢?我不是将数据存储在文件中吗?如果地址/值持续存在,为什么我不能只存储以纯文本形式分隔的地址而不是稍后获取它们的值?

我还应该使用.txt扩展吗?<edit>然后我应该使用什么?我试过.dtb并且无法创建文件.</ edit>我实际上甚至无法使用ios :: binary标志打开文件而不会出错.我也无法传递文件名(作为字符串类字符串,由c_str()转换回来,它编译但出错).

很抱歉这么多小问题,但这基本上总结了如何有效地将对象存储在文件中?

c++ binary storage fstream object

3
推荐指数
1
解决办法
7024
查看次数

Python(SymPy,SciPy),从字符串创建符号lambda

我一直在努力获取方程的文本输入并将其评估为一个明确的积分.我需要一个可调用的函数来传递给scipy.integrate.

eq = "x**2"
func = lambda x: eq
func(2)

# outputs:
# x**2


# but if I:

func = lambda x: x**2
func(2)

# outputs:
# 4
Run Code Online (Sandbox Code Playgroud)

python lambda integral scipy

3
推荐指数
1
解决办法
3146
查看次数