我有一个简单的程序,根据每行的单词长度对文本文件进行排序这个程序在我的基于xp的旧机器上运行没问题现在我在我的新win7/intel核心i5机器上运行这个程序,它冻结整个系统并恢复正常在完成它的工作之后.
我侵犯了代码,发现导致冻结的行
这是特定的路线......
caption := IntToStr(i) + '..' + IntTostr(ii);
Run Code Online (Sandbox Code Playgroud)
我把它改成了
caption := IntTostr(ii); //slow rate change
Run Code Online (Sandbox Code Playgroud)
而且没有冻结
然后我改变它
caption := IntTostr(i); //fast rate change
Run Code Online (Sandbox Code Playgroud)
然后又冻结了
我的程序代码是
var tword : widestring;
i,ii,li : integer;
begin
tntlistbox1.items.LoadFromFile('d:\new folder\ch.txt');
tntlistbox2.items.LoadFromFile('d:\new folder\uy.txt');
For ii := 15 Downto 1 Do //slow change
Begin
For I := 0 To TntListBox1.items.Count - 1 Do //very fast change
Begin
caption := IntToStr(i) + '..' + IntTostr(ii); //problemetic line
tword := TntListBox1.items[i];
LI := Length(tword);
If lI = …Run Code Online (Sandbox Code Playgroud) 如何在virtualenv中安装numpy ...
easy_install numpy抛出错误..我不能使用二进制安装程序,因为这将在python主安装中安装numpy而不是virtualenv ..
谢谢
我尝试过其他方法从URL下载信息,但需要更快的方法.我需要下载并解析大约250个单独的页面,并希望该应用程序看起来不会显得非常慢.这是我目前用于检索单个页面的代码,任何洞察都会很棒.
try
{
URL myURL = new URL("http://www.google.com");
URLConnection ucon = myURL.openConnection();
InputStream inputStream = ucon.getInputStream();
BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream);
ByteArrayBuffer byteArrayBuffer = new ByteArrayBuffer(50);
int current = 0;
while ((current = bufferedInputStream.read()) != -1) {
byteArrayBuffer.append((byte) current);
}
tempString = new String(byteArrayBuffer.toByteArray());
}
catch (Exception e)
{
Log.i("Error",e.toString());
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试构建Dynamics CRM 4查询,以便我可以获取名为"事件A"或"事件B"的日历事件.
QueryByAttribute似乎没有完成这项工作,因为我无法指定"event_name"="事件B"的"event_name"="Event A"字段.
使用QueryExpression时,我发现FilterExpression适用于引用实体.我不知道FilterExpression是否可以在Referenced Entity上使用.下面的示例类似于我想要实现的内容,尽管这将返回一个空结果集,因为它将在名为"my_event_response"的实体中查找"name"属性.它开始看起来我需要运行几个查询才能得到这个,但这比我一次提交所有内容的效率低.
ColumnSet columns = new ColumnSet();
columns.Attributes = new string[]{ "event_name", "eventid", "startdate", "city" };
ConditionExpression eventname1 = new ConditionExpression();
eventname1.AttributeName = "event_name";
eventname1.Operator = ConditionOperator.Equal;
eventname1.Values = new string[] { "Event A" };
ConditionExpression eventname2 = new ConditionExpression();
eventname2.AttributeName = "event_name";
eventname2.Operator = ConditionOperator.Equal;
eventname2.Values = new string[] { "Event B" };
FilterExpression filter = new FilterExpression();
filter.FilterOperator = LogicalOperator.Or;
filter.Conditions = new ConditionExpression[] { eventname1, eventname2 };
LinkEntity link = new LinkEntity(); …Run Code Online (Sandbox Code Playgroud) 所以,我想将图像调整为FIXED宽度,但比例高度.
我一直在尝试各种各样的运营商:
380x242#380x242> 380!x242 380x242 <
它们都没有达到预期的效果.有帮助吗?我希望它填充或调整宽度为380,然后调整高度/缩小高度所用的相同因子,将图像缩小或调整为380宽.
我正在围绕Win32 FILETIME结构编写一个简单的包装器.boost::datetime有我想要的大部分内容,除了我需要的任何日期类型,我最终使用Windows API插入没有问题.
为此,我决定为此做自己的事情 - 大多数操作都不是那么复杂.我现在正在实现类似TimeSpan的类型,但我不确定如何实现FileTimeToSystemTime.我可以使用系统的内置FileTimeToSystemTime函数,但FileTimeToSystemTime无法处理负日期 - 我需要能够表示类似"-12秒"的内容.
应该如何实施这样的事情?
Billy3
我正在尝试为multipart/relatedC++/Qt 实现一个基本的MIME解析器.
到目前为止,我一直在为头文件编写一些基本的解析器代码,我正在阅读RFC以了解如何尽可能接近规范来完成所有操作.不幸的是,RFC中有一部分让我感到困惑:
来自RFC882第3.1.1节:
每个标题字段可以被视为ASCII字符的单个逻辑行,包括字段名称和字段主体.为方便起见,该概念实体的场体部分可以分成多线表示; 这被称为"折叠".一般规则是,只要存在线性白空间(不仅仅是LWSP-chars),就可以替换地插入紧接着一个LWSP-char的CRLF.因此,单行
好吧,所以我简单地解析一个头字段,如果一个CRLF跟随线性空格,我只是以有用的方式连接它们以产生一个标题行.我们继续......
来自RFC2045第5.1节:
在RFC 822的Augmented BNF表示法中,Content-Type头字段值定义如下:
Run Code Online (Sandbox Code Playgroud)content := "Content-Type" ":" type "/" subtype *(";" parameter) ; Matching of media type and subtype ; is ALWAYS case-insensitive.[...]
Run Code Online (Sandbox Code Playgroud)parameter := attribute "=" value attribute := token ; Matching of attributes ; is ALWAYS case-insensitive. value := token / quoted-string token := 1*<any (US-ASCII) CHAR except SPACE, CTLs, or tspecials>
好的.所以,如果您想要指定Content-Type带参数的标头,只需这样做:
Content-Type: multipart/related; foo=bar; something=else
Run Code Online (Sandbox Code Playgroud)
...并且相同标题的折叠版本看起来像这样:
Content-Type: multipart/related;
foo=bar; …Run Code Online (Sandbox Code Playgroud) 我在Windows操作系统上安装了ActivePerl.我已按照以下URL过程进行安装
完成后,我试图在命令行上运行"perl -v".但它报告以下错误.
系统无法执行指定的程序
我需要做些什么才能解决这些问题?
我需要从VBA函数触发(返回)错误事件,然后该函数的调用函数可以触发On Error Go来调用.例如
function Test()
On Error Go to myError:
TestErr()
Exit Function
myerror:
Test = "Error Triggered"
End Function
Function TestErr()
?? 'How to Trigger error here
End Function
Run Code Online (Sandbox Code Playgroud)
谢谢
如果这听起来有点愚蠢,我真的很抱歉.我刚读完K&R并参与了一些练习.今年夏天,对于我的项目,我正在考虑重新实现一个linux实用程序,以进一步扩展我对C的理解,所以我下载了GNU tar和sed的源代码,因为它们看起来都很有趣.但是,我无法理解它的起始位置,主要实现的位置,所有奇怪的宏来自哪里,等等.
我有很多时间,所以这不是一个真正的问题.我是否应该首先熟悉GNU工具链(即make,binutils,..)才能理解程序?或者也许我应该从更小的东西开始(如果有这样的事情)?
如果重要的话,我对Java,C++和python有一点经验.
谢谢!