我的应用程序使用标准的app.config来存储公共配置数据.但是,仍然有一些其他数据不公开,但它们仍然必须始终可访问,持久性,可以从应用程序之外更改,以及在出现某些问题时手动更改.
例如,假设应用程序将某些许可信息存储在一个不能公开可用的文件中.但是,管理员必须能够使用记事本或类似程序(没有任何特殊编辑器)编辑此文件,因此加密不在游戏中.
你会使用独立存储吗?你有其他建议吗?由于应用程序不使用任何数据库,因此请不要考虑使用数据库作为选项进行存储.
所以问题是如何存储应用程序数据,以便不像app.config那样容易手动修改,但仍然可以轻松地为高级用户编辑.
>>> sample7 = """including 'quote1' "quote2" and 'quote3" """
>>> sample7
'including \'quote1\' "quote2" and \'quote3" '
>>> print sample7
including 'quote1' "quote2" and 'quote3"
Run Code Online (Sandbox Code Playgroud)
这里,字符串中的引号sample7被三重引号正确转义.但,
>>> sample4 = """c:\ntext\text\file.rtf"""
>>> sample4
'c:\ntext\text\x0cile.rtf'
>>> print sample4
c:
text extile.rtf
Run Code Online (Sandbox Code Playgroud)
sample4三重报价未正确转义反斜杠.这是为什么?应该怎么做才能自动逃脱.就像是,
String file = @"c:\ntext\text\file.rtf";
Run Code Online (Sandbox Code Playgroud)
在C#中.
PS.另外,我怎么得到\x0cile.rtf而不是\file.rtf?
谢谢.
我有textview.xml,这是微调器的项目样式.
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="left|center_horizontal"
android:textSize="18sp">
</TextView>
Run Code Online (Sandbox Code Playgroud)
我知道可以指定两者(Gravity.LEFT | Gravity.CENTER_HORIZONTAL),但在xml中不起作用 - 文本仅移动到左侧.
我认识的人在跑'时遇到问题lmutil'所以我问过他们strace -f lmutil.为什么execve失败的"没有这样的文件"!!! 这是没有意义的,因为我正在stra同一个文件!到底是怎么回事?
strace -f /home/tabitha/Starprogram/FLEXlm_11.7/linux-x86_64-2.3.4/bin/lmutil
Run Code Online (Sandbox Code Playgroud)
输出:
execve("/home/tabitha/Starprogram/FLEXlm_11.7/linux-x86_64-2.3.4/bin/lmutil", ["/home/tabitha/Starprogram/FLEXlm"...], [/* 38 vars */]) = -1 ENOENT (No such file or directory)
dup(2) = 3
fcntl(3, F_GETFL) = 0x8002 (flags O_RDWR|O_LARGEFILE)
fstat(3, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 1), ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fd7cb8b0000
lseek(3, 0, SEEK_CUR) = -1 ESPIPE (Illegal seek)
write(3, "strace: exec: No such file or di"..., 40strace: exec: No such file or directory
) = 40
close(3) = …Run Code Online (Sandbox Code Playgroud) Kinect有哪些手势识别库(如果有的话)?现在我正在使用OpenNI来记录骨架运动,但我不确定如何从那里开始触发离散动作.
我的问题可能就像姿势检测一样简单,但它也可能像基于时间的运动一样复杂(即,检测它们何时将手移动到圆圈中),具体取决于它的难度.我见过的用于姿势检测的例子非常特别 - 这是因为通用算法难以做到吗?
我想制作一个带有alpha和标签的UIView.
但是我希望UILabel能像这样:
怎么做?
这里的代码:
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor redColor];
UILabel *lbl = [[UILabel alloc] initWithFrame:CGRectMake(20, 20, 200, 20)];
lbl.text = @"AAAAAA";
lbl.backgroundColor = [UIColor clearColor];
UIView *v = [[UIView alloc] initWithFrame:CGRectMake(50, 210, 230, 50)];
v.backgroundColor = [UIColor greenColor];
v.alpha = 0.5;
[v addSubview:lbl];
[self.view addSubview:v];
}
Run Code Online (Sandbox Code Playgroud)
绿色视图与alpha 0.5 ...像文本一样,这是错误的!
谢谢.
如何向下转换对象列表,以便将列表中的每个对象向下转换为派生类的对象?
这就是场景.
我有一个基类和一个基类的基类List,以及从它继承的两个类:
public class BaseClass
{
public List<BaseItem> items;
protected BaseClass()
{
// some code to build list of items
}
}
public class DerivedClass : BaseClass
{
public DerivedClass : base() {}
}
public class AnotherDerivedClass : BaseClass
{
public AnotherDerivedClass : base() {}
}
public class BaseItem {}
public class DerivedItem : BaseItem {}
public class AnotherDerivedItem : BaseItem {}
Run Code Online (Sandbox Code Playgroud)
我们的想法是不必复制构建项目列表所需的代码.在BaseItem拥有所有基本的东西,我需要,我可以一直低垂BaseItem到派生项目之一.
当我列出它们时会出现问题.在Listof BaseItem中声明,BaseClass因为所有派生类都必须拥有它.但是在运行时访问它时,我似乎无法向传播类转发.
我有一个大型数据集,我想阅读特定列或删除所有其他列.
data <- read.dta("file.dta")
Run Code Online (Sandbox Code Playgroud)
我选择了我不感兴趣的列:
var.out <- names(data)[!names(data) %in% c("iden", "name", "x_serv", "m_serv")]
Run Code Online (Sandbox Code Playgroud)
而且我想做的事情如下:
for(i in 1:length(var.out)) {
paste("data$", var.out[i], sep="") <- NULL
}
Run Code Online (Sandbox Code Playgroud)
删除所有不需要的列.这是最佳解决方案吗?
我已经和SSE合作了一段时间了,我已经看到了我的对齐问题.然而,这超出了我的理解:
无论我是使用F5(调试)运行程序还是在调试器外运行它(Ctrl + F5),我都会得到不同的对齐方式!
一些背景信息:我正在使用包装器来启用SSE数据类型 - 使用重载运算符和自定义分配器(重载new和delete运算符使用_mm_malloc和_mm_free).但是在下面的例子中,我已经设法进一步减少问题,即即使我不使用自定义分配器也会发生问题.
如下所示,在main()中,我在堆上动态分配一个TestClass对象,该对象包含一个SSEVector类型对象.我正在使用一个虚拟float[2]成员变量来"错位"堆栈.
当我使用F5运行时,我获得以下输出:
object address 00346678
_memberVariable1 address 00346678
_sseVector address 00346688
Run Code Online (Sandbox Code Playgroud)
如果我使用Ctrl + F5运行:
object address 00345B70
_memberVariable1 address 00345B70
_sseVector address 00345B80
Run Code Online (Sandbox Code Playgroud)
如您所见,当我在调试器中运行它时,对齐方式是不同的(即不是16字节).使用Ctrl-F5时对齐是否正确只是巧合?我正在使用带有新项目的Visual Studio 2010(默认设置).
如果我在堆栈上声明对象,即TestClass myObject;,此问题不会出现.使用__declspec(align(16))也无济于事.
我用来重现问题的代码:
#include <iostream>
#include <string>
#include <xmmintrin.h> // SSE
//#include "DynAlignedAllocator.h"
//////////////////////////////////////////////////////////////
class SSEVector /*: public DynAlignedAllocator<16>*/
{
public:
SSEVector() { }
__m128 vec;
};
class TestClass
{
public:
TestClass() { …Run Code Online (Sandbox Code Playgroud)