是否有现有的C#库可用于解析驾驶执照中的信息?我希望直接从刷卡阅读器解析数据,因此需要将其分解为其组件的长字符串.我知道这是一个很大的请求,所以我对数字的验证甚至许可ID本身都不感兴趣,我真的只想解析名字和姓氏.我最终对所有50个州都感兴趣,但我希望首先看到AZ和CA.
我已经设置了一个小例子,我将程序集加载到一个没有任何Permission的新AppDomain中.这样工作正常,程序集无法访问文件系统而无法侦听套接字.
但是我想要阻止另一件事:线程创建.为什么?理论上这个程序集可以创建一个线程,创建更多线程并充斥我的记忆.
我想到了(在我看来)最好的方法:限制AppDomain的内存.这可能吗?如果没有,我该怎么做才能避免创建线程?
使用此代码创建线程
Thread t = new Thread(this.DoWork);
t.Start();
Run Code Online (Sandbox Code Playgroud)
这个代码适用于AppDomain
PermissionSet set = new PermissionSet(PermissionState.None);
set.AddPermission(new SecurityPermission(SecurityPermissionFlag.Execution));
set.AddPermission(new FileIOPermission(FileIOPermissionAccess.Read |
FileIOPermissionAccess.PathDiscovery,
this.path));
AppDomainSetup info = new AppDomainSetup { ApplicationBase = this.path };
this.domain = AppDomain.CreateDomain("Sandbox", null, info, set, null);
Run Code Online (Sandbox Code Playgroud)
(好吧,我在我要加载程序集的文件夹中访问了文件系统,这只是因为StrongName fullTrustAssembly = typeof(SecureInstance).Assembly.Evidence.GetHostEvidence<StrongName>();对我来说也不起作用.
希望s/o可以提供帮助.(:
我是HTMLayout的新手,只是了解nabu库,并且不知道如何使用nabu库创建基于html的表单,是否有人可以提供在.Net设置中使用HTMLayout的示例或开源应用程序?
declare
type yy is table of t12.name%type index by binary_integer;
y yy;
n number:=1;
begin
execute immediate 'create table rat1 ( name varchar2(10) )';
commit;
select name bulk collect into y from t12;
for i in (select id,name from t12)
loop
dbms_output.put_line(y(n));
n:=n+1;
end loop;
forall i in y.first..y.last
insert into rat1 values(y(i));
end;
Run Code Online (Sandbox Code Playgroud)
它的给予ora-00942.我检查了一下...在某个网站上提到你必须提供以下特权...
grant select on sys.v_$paramenter to abc
Run Code Online (Sandbox Code Playgroud)
我也无法做到这一点.任何人都可以帮助我
我有一个ogg vorbis文件,我必须用它做两个操作:
如何在C#中实现这两个操作?
因此,这与处理大对象堆并尝试最小化实例化byte []的次数有关.基本上,我有OutOfMemoryExceptions,我觉得这是因为我们实例化了太多的字节数组.当我们处理几个文件时,程序工作正常,但它需要扩展,目前它不能.
简而言之,我有一个从数据库中提取文档的循环.目前,它一次拉一个文档然后处理文档.文件的范围可以从小于1兆欧卡到400欧元不等.(因此我为什么一次处理一个).以下是伪代码,在我进行优化之前.
所以我正在做的步骤是:
调用数据库以查找最大文件大小(然后将其乘以1.1)
var maxDataSize = new BiztalkBinariesData().GetMaxFileSize();
maxDataSize = (maxDataSize != null && maxDataSize > 0)
? (long)(maxDataSize * 1.1)
: 0;
var FileToProcess = new byte[maxDataSize];
Run Code Online (Sandbox Code Playgroud)然后我进行另一个数据库调用,从数据库中提取所有文档(没有数据)并将它们放入IEnumerable中.
UnprocessedDocuments =
claimDocumentData.Select(StatusCodes.CurrentStatus.WaitingToBeProcessed);
foreach (var currentDocument in UnprocessDocuments)
{
// all of the following code goes here
}
Run Code Online (Sandbox Code Playgroud)然后我从外部源填充我的byte []数组:
FileToProcess = new BiztalkBinariesData()
.Get(currentDocument.SubmissionSetId, currentDocument.FullFileName);
Run Code Online (Sandbox Code Playgroud)这是个问题.将currentDocument(IClaimDocument)传递给其他要处理的方法会更加清晰.因此,如果我将currentDocument的数据部分设置为预格式化的数组,那么这将使用现有的引用吗?或者这会在大对象堆中创建一个新数组吗?
currentDocument.Data = FileToProcess;
Run Code Online (Sandbox Code Playgroud)在循环结束时,我会清除FileToProcess
Array.Clear(FileToProcess, 0, FileToProcess.length);
Run Code Online (Sandbox Code Playgroud)那清楚了吗?如果没有,我会尽力清理它.
也许我错过了一些明显的东西,但有没有更简单的方法来检查一个字符是否是一个基本的拉丁字母(az),而不是转换为字符串并使用正则表达式?:例如:
public static bool IsBasicLetter(Char c) {
return Regex.IsMatch(c.ToString(), "[a-z]", RegexOptions.IgnoreCase);
}
Run Code Online (Sandbox Code Playgroud)
Char.IsLetter匹配来自许多字母表的数百个字母字符.我可以直接检查代码点,但这感觉很粗略:
public static bool IsBasicLetter(Char c) {
int cInt = c;
return !(cInt < 65 || cInt > 122 || (cInt > 90 & cInt < 97));
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用c#和asp.net动态创建树视图.
我使用populate ondemand属性创建了一个延迟加载树视图.
> <asp:TreeView ID="treeView1" runat="server"
> OnTreeNodePopulate="treeview1_TreeNodePopulate"></asp:TreeView>
Run Code Online (Sandbox Code Playgroud)
在代码后面我已经加载了我的数据,但最初我填充了父节点.我想要实现的是当我点击父节点我然后做一个回发然后填充它的孩子然后再次填充它的孩子,所以现在.我有数千个数据,所以我不希望由于性能而填充所有数据.这就是为什么我只想根据所选节点填充节点子节点的原因.见下面的例子:
>Peter
- - >user1
- - >user2
- - >user3
- - >userPassword
- - >userId
>john
>david
>Jack
- - >user1
- - >user2
- - >userpassword
- - >userId
- - >Permissions
>Laura
- - > admin
- - > permissions
-- > user1
-- > user2
- - >userpassword
- - >userId
- - >Permissions
>...
>...
>...
Run Code Online (Sandbox Code Playgroud)
如您所见,可以有多个父节点和多个层.这些将根据我传递给DB的内容进行动态填充.每次我点击节点,它将展开节点并使用回发填充其子节点,然后当您再次单击它的子节点时,它将进行回发并再次填充其子节点等.所以我想要如何创建动态树视图的帮助.
C# :
private void LoadTreeview()
{
//Load data …Run Code Online (Sandbox Code Playgroud) 这是JSfiddle:http://jsfiddle.net/buyC9/128/
我想清除时只清除文件上传字段.
我的HTML:
<h1>Upload image:</h1>
<input type="file" name="blog[opload]" id="blog_opload" class="imagec">
<input type="url" size="50" name="blog[url]" id="blog_url" class="imagec">
<div id="preview">
</div>
Run Code Online (Sandbox Code Playgroud)
我的Jquery:
$('input').change(function() {
var el = $(this);
if (this.value === "") {
$('.imagec').prop('disabled', false);
this.disabled = false;
$('#preview').hide();
} else {
$('.imagec').prop('disabled', true);
el.prop('disabled', false);
alert(el.val());
if (el.attr('type') == 'url') {
$('#preview').show().html('<img src=' + '"' + el.val() + '"' + ' />');
}
}
});
function reset_html(id) {
$('.' + id).html( $('.' + id).html() );
}
var imagec_index …Run Code Online (Sandbox Code Playgroud) 我正在创建一个带有NetTcpBinding服务和一个应用程序的应用程序BasicHttpBinding.通过这些服务,客户端向应用程序发送请求:这些请求必须放入一个Queue对象,即入站请求的队列.
我可以使用ConcurrencyMode.Multiple,可以同时进行如此多的调用.但是,这并不能保证对队列的并发访问.我应该把两个ServiceHost放在两个不同的线程中吗?例如:
NetTcpBinding服务并将新请求排入队列.此外,它通过回调发送任何回复.BasicHttpBinding服务并将新请求排入队列.这是我的想法.由于我几乎是一个新手,如果你能给我一些建议,我将不胜感激.也许我应该开始编写三个并发访问队列的线程:目前前两个线程可能会将随机请求排入队列,而第三个线程会消耗这些请求.
c# ×8
.net ×3
asp.net ×2
architecture ×1
audio ×1
bytearray ×1
c#-3.0 ×1
char ×1
javascript ×1
jquery ×1
lazy-loading ×1
ogg ×1
oracle ×1
oracle10g ×1
oracle11g ×1
permissions ×1
plsql ×1
regex ×1
swipe ×1
treeview ×1
validation ×1
wcf ×1
winforms ×1