我想在.NET中使用NTFS压缩来压缩文件夹.我找到了这篇文章,但它不起作用.它抛出异常("无效参数").
DirectoryInfo directoryInfo = new DirectoryInfo( destinationDir );
if( ( directoryInfo.Attributes & FileAttributes.Compressed ) != FileAttributes.Compressed )
{
string objPath = "Win32_Directory.Name=" + "\"" + destinationDir + "\"";
using( ManagementObject dir = new ManagementObject( objPath ) )
{
ManagementBaseObject outParams = dir.InvokeMethod( "Compress", null, null );
uint ret = (uint)( outParams.Properties["ReturnValue"].Value );
}
}
Run Code Online (Sandbox Code Playgroud)
有谁知道如何在文件夹上启用NTFS压缩?
我有一个在Linux上运行的Java应用程序,它有很多围绕时间和日期的事件和业务逻辑.
对于测试,是否有可能更快地调整某些东西.比方说,在一小时的墙上时间完成计算机一年的完成?
我正在使用cstring函数,该函数应该比较两个字符串MyString和m2的值.我有#include所以它绝对不是那样的.这些是我的错误.
(74) : error C2275: 'MyString' : illegal use of this type as an expression
(74) : error C2660: 'MyString::length' : function does not take 1 arguments
(76) : error C2275: 'MyString' : illegal use of this type as an expression
Run Code Online (Sandbox Code Playgroud)
这是我从中获取它们的代码.
bool MyString::operator ==(const MyString &m2) const
{
int temp = 0;
if (length(MyString) = length(m2)) // 74
{
if (strcmp(MyString, m2)) // 76
{
temp = 1;
}
else
{
temp = 2;
}
}
if(temp = 2) …Run Code Online (Sandbox Code Playgroud) Linux:在执行umount时哪个进程导致"设备忙"?
我有一个产品图像类.这是一个具有重复使用潜力的对象,可用于图像的一般工作(例如,用于产品,用于处理图像的CMS等).它将让我设置文件的标题,并使用标准的.NET类以简单的方式编辑图像.
我可以使用一个结构,这意味着如果我在5个不同的地方使用结构,那就是5个不同的内存位置,但彼此都是相互独立的.更改这些内存位置的状态不会影响其他内存位置(这是所需的行为).在要求对象时它将被装箱.
该对象是基于实例的.因此,每个产品都会使用产品对象并使用图像(例如编辑其标题等).
如果我创建一个静态类,那就是指向一个对象的五个不同位置.所以我需要处理线程同步.我不能只写一个变量,因为另一个访问可能会覆盖变量,无论我如何同步访问此共享资源.所以我总是需要返回新的变量.此外,如果我使用许多不同调用方法使用的静态类,则会导致队列访问共享资源.因为实用程序类是静态的,它们只是 - 实用程序 - 它们将在我的代码库中被许多类使用.在这种情况下使用静态类可能不明智吗?
正如MSDN文档所解释的那样,我将只为全局实体使用静态类.所以一个类封装了我的代码库的详细信息 - 只有一个代码库,这个类将包含行数等的详细信息.这不是基于实例的,比如订单类(1个客户-1订单-1或更多订单) ).
在这种情况下,或许使用结构代码是一个很好的设计决策吗?
为了首先给出这个问题的一些背景知识,我正在重写一些当前循环遍历某些xml的代码,在每个循环结束时对一个表进行插入 - 用一个带有xml参数的sp替换并在一个中插入一个go,'将xml'粉碎成表.
主Shred已成功完成,但目前其中一列用于存储整个节点.我已经能够计算出这个(几乎)所需的查询,但它错过了节点的根部分.我得出的结论是,我的查询和我能得到的一样好,而且我正在寻找一种方法然后执行更新语句以将根节点恢复到那里.
所以我的xml是形式的;
<xml>
<Items>
<Item>
<node1>...</node1><node2>..<node2>.....<noden>...<noden>
<Item>
<Item>
<node1>...</node1><node2>..<node2>.....<noden>...<noden>
<Item>
<Item>
<node1>...</node1><node2>..<node2>.....<noden>...<noden>
<Item>
......
<Items>
</xml>
Run Code Online (Sandbox Code Playgroud)
因此,基本的碎化将node1中的值放入column1,node2放入column2等.insert语句看起来像;
INSERT INTO mytable col1, col2,...etc.....,wholenodecolumn
Select
doc.col.value('node1[1]', 'int') column1,
doc.col.value('node2[1]', 'varchar(50)') column2,
....etc......,
doc.col.query('*')--this is the query for getting the whole node
FROM @xml.nodes('//Items/Item') doc(col)
Run Code Online (Sandbox Code Playgroud)
最终在整个字节列中的XML是形式的;
<node1>...</node1><node2>..<node2>.....<noden>...<noden>
Run Code Online (Sandbox Code Playgroud)
但我需要它的形式
<Item><node1>...</node1><node2>..<node2>.....<noden>...<noden></Item>
Run Code Online (Sandbox Code Playgroud)
现有代码(很多代码)依赖于此列中的xml具有正确的形式.
那么有人可能会看到如何修改doc.col.query('*')以获得所需的结果?
无论如何,我放弃了修改查询,并试图想出其他方法来完成最终结果.我现在看的是插入后的更新 - 类似于;
update mytable set wholenodecolumn.modify('insert <Item> as first before * ')
Run Code Online (Sandbox Code Playgroud)
如果我可以这样做
.modify('insert </Item> as last after * ')
Run Code Online (Sandbox Code Playgroud)
这样会很好,但一次做1不是一个选项,因为XML无效
XQuery [mytable.wholenodecolumn.modify()]: Expected end tag …Run Code Online (Sandbox Code Playgroud) 我试图通过java.nio.ByteBuffer读取UTF8字符串.大小是一个unsinged int,当然,Java没有.我已经把这个值读成了很长的一段时间,所以我有了价值.
我的下一个问题是我不能用long创建一个字节数组,并且他长期回到int会导致它被签名.
我也尝试在缓冲区上使用limit(),但是再次使用int不长.
我正在做的具体事情是从类文件中读取UTF8字符串,因此缓冲区中只有UTF8字符串.
关于如何从ByteBuffer读取具有潜在长度的unsigned int的UTF8字符串的任何想法.
编辑:
SourceDebugExtension_attribute {
u2 attribute_name_index;
u4 attribute_length;
u1 debug_extension[attribute_length];
}
attribute_name_index
The value of the attribute_name_index item must be a valid index into the constant_pool table. The constant_pool entry at that index must be a CONSTANT_Utf8_info structure representing the string "SourceDebugExtension".
attribute_length
The value of the attribute_length item indicates the length of the attribute, excluding the initial six bytes. The value of the attribute_length item is thus the number of bytes …Run Code Online (Sandbox Code Playgroud) 我广泛使用了继承,多态,封装,但我才意识到我不知道对象范围与变量的以下行为.差异最好用代码显示:
public class Obj
{
public string sss {get; set;}
public Obj()
{
sss = "0";
}
}
public partial class testScope : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Obj a = new Obj();
String sss = "0";
Context.Response.Write(sss); // 0
FlipString(sss);
FlipString(a.sss);
Context.Response.Write(sss + a.sss); // 0 0
FlipObject(a);
Context.Response.Write(a.sss); // 1
Context.Response.End();
}
public void FlipString(string str)
{ str = "1"; }
public void FlipObject(Obj str)
{ str.sss = "1"; }
}
Run Code Online (Sandbox Code Playgroud)
所以我认为当变量传递给方法时,更改仅限于方法的范围.但似乎如果一个对象被传递给一个更改为它的方法,那么它的属性将超出该方法.
我可以接受这个,如果规则是这个行为存在于对象而不是变量,但在.net中,一切都是一个对象,一个字符串(就像示例中的那个是System.String)那么规则怎么样,我怎么能预测我传入方法的参数范围?
我正在努力建立自己的iPhone自由职业者,目前正与一家初创公司就一个更大的项目进行谈判.他们表示他们希望我签署一份不竞争协议,这样我就不会被允许为在同一地域市场上竞争的公司开发类似的产品.不用说,我真的不喜欢这个.
这是一种常见做法吗?如果是这样,有多常见?你会签名吗?