半城柳色半声笛

文章 评论 浏览 26

半城柳色半声笛 2024-12-16 11:38:05

我想你可以尝试检查我的 gem,我已经开始它了,因为我对 sambala 也有同样的问题

https:// github.com/revilo/rsmbclient

I think you could try to check my gem, i've started it cause i've same issues with sambala

https://github.com/reivilo/rsmbclient

Ruby读Samba分享

半城柳色半声笛 2024-12-16 06:29:16

System.Data.SQLite 怎么样?

What about System.Data.SQLite?

有适用于 .NET 的 DBM 吗?

半城柳色半声笛 2024-12-16 05:52:49

为什么索引需要这么长时间?任何预处理步骤需要时间吗?因为这似乎通常需要很长时间。
这些是数据库记录还是丰富的文档?
您如何对数据建立索引?您是否经常进行提交或优化?
系统内存、CPU、空间表现如何?
可能需要重新访问 solrconfig.xml 中的一些设置

如果以上所有内容看起来都不错,那么您可以尝试一个选项 -
创建单独的核心并运行并行作业来索引数据。索引完成后,您可以合并索引或使用分布式搜索

Any reason why the indexing takes so much time ? any preprocessing steps taking time ? cause this seem to be taking a usually high time.
Are these database records or rich documents ?
How are you indexing the data ? are you running frequent commits or optimization ?
Hows the system memory, cpu, space behaving ?
Might want to revisit some settings in solrconfig.xml

If all of the above seems fine, you can try an option -
Create seperate cores and run parallel jobs to index the data. After the index completes you can either merge the index or use distributed search.

Solr 索引花费的时间太长

半城柳色半声笛 2024-12-16 05:34:18

认为一个更好:

if(eform[funcName] !== undefined && eform[funcName].init !== undefined){
  //some code
}

如果第一个条件为假,则不会检查第二个条件。

think that one is better:

if(eform[funcName] !== undefined && eform[funcName].init !== undefined){
  //some code
}

if the first condition is false than the second condition wont be checked.

寻找一种更简单的方法来检查是否有多个属性&对象中的方法未定义

半城柳色半声笛 2024-12-16 05:32:29

根据您需要对用户清楚的程度,您可以使用控件的微妙颜色突出显示(前色、背景色)来指示错误。如果他们试图忽略警告,则使用消息框。

Depending on how clear you need to be to the user, you could use subtle color highlighting of the control (forecolor, backcolor) to indicate an error. Then use the message box for if they try to ignore the warning.

限制 C# DatePicker

半城柳色半声笛 2024-12-16 01:51:56

当 RemoteCertificateValidationCallback、X509Certificate 和 X509Chain 似乎没有给我任何可用的东西时,如何仅使用 CA 的公共证书文件而不使用 Windows 证书存储或 WCF 来验证证书是否已由我的特定 CA 签名?< /p>

以下代码将避开 Windows 证书存储并验证链。它与 JB 的代码略有不同,尤其是在标志的使用方面。下面的代码不需要 AllowUnknownCertificateAuthority (但它确实使用 X509ReplicationMode.NoCheck 因为我没有 CRL)。

函数的名称并不重要。下面,VerifyServerCertificateSslStream 类中的 RemoteCertificateValidationCallback 是相同的回调。您还可以将其用于 ServicePointManager 中的 ServerCertificateValidationCallback

static bool VerifyServerCertificate(object sender, X509Certificate certificate,
    X509Chain chain, SslPolicyErrors sslPolicyErrors)
{
    try
    {
        String CA_FILE = "ca-cert.der";
        X509Certificate2 ca = new X509Certificate2(CA_FILE);

        X509Chain chain2 = new X509Chain();
        chain2.ChainPolicy.ExtraStore.Add(ca);

        // Check all properties
        chain2.ChainPolicy.VerificationFlags = X509VerificationFlags.NoFlag;

        // This setup does not have revocation information
        chain2.ChainPolicy.RevocationMode = X509RevocationMode.NoCheck;

        // Build the chain
        chain2.Build(new X509Certificate2(certificate));

        // Are there any failures from building the chain?
        if (chain2.ChainStatus.Length == 0)
            return true;

        // If there is a status, verify the status is NoError
        bool result = chain2.ChainStatus[0].Status == X509ChainStatusFlags.NoError;
        Debug.Assert(result == true);

        return result;
    }
    catch (Exception ex)
    {
        Console.WriteLine(ex);
    }

    return false;
}

没有弄清楚如何默认使用这个链(下面的chain2),这样就不需要回调了。也就是说,将其安装在 ssl 套接字上,连接将“正常工作”。我还没有弄清楚如何安装它以便将其传递到回调中。也就是说,我必须为回调的每次调用构建链。我认为这些是 .Net 中的架构缺陷,但我可能会遗漏一些明显的东西。

How can I verify a certificate has been signed by my specific CA just by using the CA's public certificate file without using Windows certificate store or WCF when RemoteCertificateValidationCallback, X509Certificate and X509Chain don't seem to give me anything to work with?

The following code will avoid the Windows certificate stores and validate the chain. Its a little different than JB's code, especially in the use of flags. The code below does not require AllowUnknownCertificateAuthority (but it does use X509RevocationMode.NoCheck since I don't have a CRL).

The name of the function does not matter. Below, VerifyServerCertificate is the same callback as RemoteCertificateValidationCallback in SslStream class. You can also use it for the ServerCertificateValidationCallback in ServicePointManager.

static bool VerifyServerCertificate(object sender, X509Certificate certificate,
    X509Chain chain, SslPolicyErrors sslPolicyErrors)
{
    try
    {
        String CA_FILE = "ca-cert.der";
        X509Certificate2 ca = new X509Certificate2(CA_FILE);

        X509Chain chain2 = new X509Chain();
        chain2.ChainPolicy.ExtraStore.Add(ca);

        // Check all properties
        chain2.ChainPolicy.VerificationFlags = X509VerificationFlags.NoFlag;

        // This setup does not have revocation information
        chain2.ChainPolicy.RevocationMode = X509RevocationMode.NoCheck;

        // Build the chain
        chain2.Build(new X509Certificate2(certificate));

        // Are there any failures from building the chain?
        if (chain2.ChainStatus.Length == 0)
            return true;

        // If there is a status, verify the status is NoError
        bool result = chain2.ChainStatus[0].Status == X509ChainStatusFlags.NoError;
        Debug.Assert(result == true);

        return result;
    }
    catch (Exception ex)
    {
        Console.WriteLine(ex);
    }

    return false;
}

I have not figured out how to use this chain (chain2 below) by default such that there's no need for the callback. That is, install it on the ssl socket and the connection will "just work". And I have not figured out how install it such that its passed into the callback. That is, I have to build the chain for each invocation of the callback. I think these are architectural defects in .Net, but I might be missing something obvious.

使用 CA 证书文件验证远程服务器 X509Certificate

半城柳色半声笛 2024-12-16 00:48:30
$('img').live('load', function ()
{
    alert("image loaded: "+this.src);
});

使用 jquery live 方法来跟踪负载。

$('img').live('load', function ()
{
    alert("image loaded: "+this.src);
});

Use jquery live method to track load.

每次图像加载完成时运行一个函数

半城柳色半声笛 2024-12-15 23:20:57

升级到 VS 2010 将解决您的问题。从新的上下文菜单中选择“表...”:

在此处输入图像描述

会产生以下选择,这些选择比2008 版本:

在此处输入图像描述

Upgrading to VS 2010 will solve your problem. Selecting Table... from the new context menu:

enter image description here

yields the following selections, which are much more helpful than the 2008 versions:

enter image description here

Visual Studio 2008 数据库项目中更智能的上下文菜单

半城柳色半声笛 2024-12-15 21:36:14

Jon Skeet的答案更好! (即,如果可以的话,只需将时间戳更改为 ISO 8601 格式。)

但是如果您无法更改格式,您可以执行以下操作:(

#!/usr/bin/perl -w
use strict;

my %h;

while(<DATA>) {
    chomp;
    $h{$_}++;
}

sub iso_8601 {
    $_ = shift;
    if (/(\d+):(\d+):(\d+) (\d+):(\d+):(\d+)/) {
        return "$3:$2:$1:$4:$5:$6";
    }    
}

foreach my $key (sort {iso_8601($a) cmp iso_8601($b)} keys %h) { 
    print "$key -- $h{$key}\n";
}

__DATA__
21:01:2011 16:51:09
21:01:2011 16:49:54
26:01:2011 11:02:55
26:01:2011 11:01:40
05:04:2011 11:51:13
05:04:2011 11:51:13
05:04:2011 11:48:37
05:04:2011 11:48:37

重复的时间戳我假设您有自己的逻辑要处理。通过对它们进行散列,对重复项进行计数,我只是打印它们的计数.. .)

结果:

21:01:2011 16:49:54 -- 1
21:01:2011 16:51:09 -- 1
26:01:2011 11:01:40 -- 1
26:01:2011 11:02:55 -- 1
05:04:2011 11:48:37 -- 2
05:04:2011 11:51:13 -- 2

编辑

好的,如果您关心效率,(sort {iso_8601($a) cmp iso_8601($b)} keys %h) 不是 < em>最好,因为每个哈希元素都会多次调用 iso_8601() 函数。

对于“Schwartzian Transform”的形式,您可以执行

print join("\n",
    map { $_->[0].' -- '.$h{$_->[0]} }
    sort { $a->[1] cmp $b->[1] }
    map {[$_,iso_8601($_)]} 
        keys %h);

以下 操作:与上面相同的输出。然后,每个哈希键仅调用 iso_8601() 一次,而不是多次...

要剖析它(它从右到左,从下到上):

keys %h                         # list of all the keys of the hash
map {[$_,iso_8601($_)]}         # create anon array with 2 elements:
                                # original stamp and ISO 8601 stamp
sort { $a->[1] cmp $b->[1] }    # list sorted on the ISO 8601 stamp
map { $_->[0].' -- '.$h{$_->[0]} }  # a list of strings with original stamp
                                    # and hash count
join("\n",                      # join the list into a string with a "\n"

编辑 2

我很难理解你想要什么。试试这个:

#!/usr/bin/perl -w
use strict;

my %h;
my $i=0;

while(<DATA>) {
    chomp;
    $h{$_}++;
}

sub iso_8601 {
    $_ = shift;
    if (/(\d+):(\d+):(\d+) (\d+):(\d+):(\d+)$/) {
        $i++;
        return "$3-$2-$1 $4:$5:$6";
    }    
}

foreach my $key (sort {iso_8601($b) cmp iso_8601($a)} keys %h) { 
    print iso_8601($key).":\t\t"."$key -- $h{$key}\n";
}

print "\n";

输出:

YYYY-MM-DD HH:MM:SS                 your record... 
2011-09-01 10:48:18:        MGH_2631        MGH_2631        90(8)   90(8)   90      100.00  211     Male(Unknown)   200943  01:09:2011 10:48:18 -- 1
2011-09-01 10:48:18:        MGH_2101        MGH_2101        80(18)  80(18)  80      100.00  359     Male(Unknown)   200943  01:09:2011 10:48:18 -- 1
2011-08-25 10:20:16:        MGH_2101        MGH_2101        80(18)  80(18)  80      100.00  359     Unknown(Unknown)        200944  25:08:2011 10:20:16 -- 1
2011-08-25 10:20:16:        MGH_2631        MGH_2631        90(8)   90(8)   90      100.00  211     Unknown(Unknown)        200944  25:08:2011 10:20:16 -- 1
2011-08-25 10:19:05:        MGH_2631        MGH_2631        90(8)   90(8)   90      100.00  211     Unknown(Unknown)        200945  25:08:2011 10:19:05 -- 1
2011-08-25 10:19:05:        MGH_2101        MGH_2101        80(18)  80(18)  80      100.00  359     Unknown(Unknown)        200945  25:08:2011 10:19:05 -- 1
2011-08-25 10:17:26:        MGH_2101        MGH_2101        80(18)  80(18)  80      100.00  359     Male(Unknown)   200946  25:08:2011 10:17:26 -- 1
2011-08-25 10:17:26:        MGH_2631        MGH_2631        90(8)   90(8)   90      100.00  211     Male(Unknown)   200946  25:08:2011 10:17:26 -- 1
2011-07-01 16:13:55:        WGA_PD7124a WGA_PD7124a     95(2)   95(2)   95      100.00  193     Unknown(Unknown)        192654  01:07:2011 16:13:55 -- 1
2011-07-01 16:11:23:        WGA_PD7124a     WGA_PD7124a     95(2)   95(2)   95      100.00  193     Unknown(Unknown)        192655  01:07:2011 16:11:23 -- 1
2011-07-01 11:04:26:        WGA_PD7124a     WGA_PD7124a     95(2)   95(2)   95      100.00  193     Male(Unknown)   192656  01:07:2011 11:04:26 -- 1
2011-05-04 17:35:52:        WGA_PD6355b     WGA_PD6355b     96(1)   96(1)   96      100.00  388     Unknown(Unknown)        184558  04:05:2011 17:35:52 -- 1
2011-05-04 17:35:52:        WGA_PD6355b     WGA_PD6355a     96(1)   66(31)  66      95.45   388     Unknown(Unknown)        184558  04:05:2011 17:35:52 -- 1
2011-05-04 17:34:27:        WGA_PD6355b     WGA_PD6355b     96(1)   96(1)   96      100.00  388     Unknown(Unknown)        184557  04:05:2011 17:34:27 -- 1
2011-05-04 17:34:27:        WGA_PD6355b     WGA_PD6355a     96(1)   66(31)  66      95.45   388     Unknown(Unknown)        184557  04:05:2011 17:34:27 -- 1
2011-03-23 10:03:23:        PD4294c PD4294c 95(2)   95(2)   95      100.00  221     Unknown(Unknown)        179502  23:03:2011 10:03:23 -- 1
2011-03-23 10:02:30:        PD4294c PD4294c 95(2)   95(2)   95      100.00  221     Unknown(Unknown)        179470  23:03:2011 10:02:30 -- 1
2011-02-15 09:24:31:        3074    3074    87(10)  87(10)  87      100.00  109     Unknown(Unknown)        174878  15:02:2011 09:24:31 -- 1
2011-02-15 09:21:19:        3074    3074    87(10)  87(10)  87      100.00  109     Unknown(Unknown)        174970  15:02:2011 09:21:19 -- 1
2011-02-15 09:16:32:        3074    3074    87(10)  87(10)  87      100.00  109     Female(Unknown) 174860  15:02:2011 09:16:32 -- 1
2011-02-09 09:54:48:        CHP-212 CHP-212 94(3)   94(3)   94      100.00  269     Unknown(Unknown)        173382  09:02:2011 09:54:48 -- 1
2011-02-09 09:54:48:        3163    3163    90(7)   90(7)   90      100.00  176     Unknown(Unknown)        173382  09:02:2011 09:54:48 -- 1
2011-02-09 09:51:02:        3163    3163    90(7)   90(7)   90      100.00  176     Unknown(Unknown)        173284  09:02:2011 09:51:02 -- 1
2011-02-09 09:51:02:        CHP-212 CHP-212 94(3)   94(3)   94      100.00  269     Unknown(Unknown)        173284  09:02:2011 09:51:02 -- 1

这是你的想法吗?它解析行尾的时间戳并按降序对这些记录进行排序。这有什么问题吗?

Jon Skeet's answer is better! (i.e., just change your time stamp, if you can, to the ISO 8601 format.)

But if you can't change the format, you could do something like:

#!/usr/bin/perl -w
use strict;

my %h;

while(<DATA>) {
    chomp;
    $h{$_}++;
}

sub iso_8601 {
    $_ = shift;
    if (/(\d+):(\d+):(\d+) (\d+):(\d+):(\d+)/) {
        return "$3:$2:$1:$4:$5:$6";
    }    
}

foreach my $key (sort {iso_8601($a) cmp iso_8601($b)} keys %h) { 
    print "$key -- $h{$key}\n";
}

__DATA__
21:01:2011 16:51:09
21:01:2011 16:49:54
26:01:2011 11:02:55
26:01:2011 11:01:40
05:04:2011 11:51:13
05:04:2011 11:51:13
05:04:2011 11:48:37
05:04:2011 11:48:37

(The duplicate time stamps I assume you have your own logic to deal with. By hashing them, the duplicates are counted, and I am just printing their count...)

Result:

21:01:2011 16:49:54 -- 1
21:01:2011 16:51:09 -- 1
26:01:2011 11:01:40 -- 1
26:01:2011 11:02:55 -- 1
05:04:2011 11:48:37 -- 2
05:04:2011 11:51:13 -- 2

Edit

OK, if you are concerned about efficiency, the (sort {iso_8601($a) cmp iso_8601($b)} keys %h) is not the best since the iso_8601() function is called many times per hash element.

For a form of "Schwartzian Transform" you can do:

print join("\n",
    map { $_->[0].' -- '.$h{$_->[0]} }
    sort { $a->[1] cmp $b->[1] }
    map {[$_,iso_8601($_)]} 
        keys %h);

Which will produce the same output as above. Then you are calling iso_8601() only once per hash key, not multiple times...

To dissect that (it goes right to left, bottom to top):

keys %h                         # list of all the keys of the hash
map {[$_,iso_8601($_)]}         # create anon array with 2 elements:
                                # original stamp and ISO 8601 stamp
sort { $a->[1] cmp $b->[1] }    # list sorted on the ISO 8601 stamp
map { $_->[0].' -- '.$h{$_->[0]} }  # a list of strings with original stamp
                                    # and hash count
join("\n",                      # join the list into a string with a "\n"

EDIT 2

I am having a hard time understanding what you want. Try this:

#!/usr/bin/perl -w
use strict;

my %h;
my $i=0;

while(<DATA>) {
    chomp;
    $h{$_}++;
}

sub iso_8601 {
    $_ = shift;
    if (/(\d+):(\d+):(\d+) (\d+):(\d+):(\d+)$/) {
        $i++;
        return "$3-$2-$1 $4:$5:$6";
    }    
}

foreach my $key (sort {iso_8601($b) cmp iso_8601($a)} keys %h) { 
    print iso_8601($key).":\t\t"."$key -- $h{$key}\n";
}

print "\n";

Output:

YYYY-MM-DD HH:MM:SS                 your record... 
2011-09-01 10:48:18:        MGH_2631        MGH_2631        90(8)   90(8)   90      100.00  211     Male(Unknown)   200943  01:09:2011 10:48:18 -- 1
2011-09-01 10:48:18:        MGH_2101        MGH_2101        80(18)  80(18)  80      100.00  359     Male(Unknown)   200943  01:09:2011 10:48:18 -- 1
2011-08-25 10:20:16:        MGH_2101        MGH_2101        80(18)  80(18)  80      100.00  359     Unknown(Unknown)        200944  25:08:2011 10:20:16 -- 1
2011-08-25 10:20:16:        MGH_2631        MGH_2631        90(8)   90(8)   90      100.00  211     Unknown(Unknown)        200944  25:08:2011 10:20:16 -- 1
2011-08-25 10:19:05:        MGH_2631        MGH_2631        90(8)   90(8)   90      100.00  211     Unknown(Unknown)        200945  25:08:2011 10:19:05 -- 1
2011-08-25 10:19:05:        MGH_2101        MGH_2101        80(18)  80(18)  80      100.00  359     Unknown(Unknown)        200945  25:08:2011 10:19:05 -- 1
2011-08-25 10:17:26:        MGH_2101        MGH_2101        80(18)  80(18)  80      100.00  359     Male(Unknown)   200946  25:08:2011 10:17:26 -- 1
2011-08-25 10:17:26:        MGH_2631        MGH_2631        90(8)   90(8)   90      100.00  211     Male(Unknown)   200946  25:08:2011 10:17:26 -- 1
2011-07-01 16:13:55:        WGA_PD7124a WGA_PD7124a     95(2)   95(2)   95      100.00  193     Unknown(Unknown)        192654  01:07:2011 16:13:55 -- 1
2011-07-01 16:11:23:        WGA_PD7124a     WGA_PD7124a     95(2)   95(2)   95      100.00  193     Unknown(Unknown)        192655  01:07:2011 16:11:23 -- 1
2011-07-01 11:04:26:        WGA_PD7124a     WGA_PD7124a     95(2)   95(2)   95      100.00  193     Male(Unknown)   192656  01:07:2011 11:04:26 -- 1
2011-05-04 17:35:52:        WGA_PD6355b     WGA_PD6355b     96(1)   96(1)   96      100.00  388     Unknown(Unknown)        184558  04:05:2011 17:35:52 -- 1
2011-05-04 17:35:52:        WGA_PD6355b     WGA_PD6355a     96(1)   66(31)  66      95.45   388     Unknown(Unknown)        184558  04:05:2011 17:35:52 -- 1
2011-05-04 17:34:27:        WGA_PD6355b     WGA_PD6355b     96(1)   96(1)   96      100.00  388     Unknown(Unknown)        184557  04:05:2011 17:34:27 -- 1
2011-05-04 17:34:27:        WGA_PD6355b     WGA_PD6355a     96(1)   66(31)  66      95.45   388     Unknown(Unknown)        184557  04:05:2011 17:34:27 -- 1
2011-03-23 10:03:23:        PD4294c PD4294c 95(2)   95(2)   95      100.00  221     Unknown(Unknown)        179502  23:03:2011 10:03:23 -- 1
2011-03-23 10:02:30:        PD4294c PD4294c 95(2)   95(2)   95      100.00  221     Unknown(Unknown)        179470  23:03:2011 10:02:30 -- 1
2011-02-15 09:24:31:        3074    3074    87(10)  87(10)  87      100.00  109     Unknown(Unknown)        174878  15:02:2011 09:24:31 -- 1
2011-02-15 09:21:19:        3074    3074    87(10)  87(10)  87      100.00  109     Unknown(Unknown)        174970  15:02:2011 09:21:19 -- 1
2011-02-15 09:16:32:        3074    3074    87(10)  87(10)  87      100.00  109     Female(Unknown) 174860  15:02:2011 09:16:32 -- 1
2011-02-09 09:54:48:        CHP-212 CHP-212 94(3)   94(3)   94      100.00  269     Unknown(Unknown)        173382  09:02:2011 09:54:48 -- 1
2011-02-09 09:54:48:        3163    3163    90(7)   90(7)   90      100.00  176     Unknown(Unknown)        173382  09:02:2011 09:54:48 -- 1
2011-02-09 09:51:02:        3163    3163    90(7)   90(7)   90      100.00  176     Unknown(Unknown)        173284  09:02:2011 09:51:02 -- 1
2011-02-09 09:51:02:        CHP-212 CHP-212 94(3)   94(3)   94      100.00  269     Unknown(Unknown)        173284  09:02:2011 09:51:02 -- 1

Is this what you are thinking? It parses the time stamp at the end of line and sorts those records in descending order. What is the issue with this?

如何在 Perl 中以 dd:mm:yyyy hh24:mi:ss 格式按降序对时间戳进行排序?

半城柳色半声笛 2024-12-15 19:41:09

您需要为顶部的变量分配一个值,即使它只是 null

FileStream   file     = null;
StreamReader file_in  = null;
StreamWriter file_out = null;

You need to assign a value to your variables at the top, even if its just null

FileStream   file     = null;
StreamReader file_in  = null;
StreamWriter file_out = null;

文件流、流读取器和流写入器的问题

半城柳色半声笛 2024-12-15 17:31:29

我几周前就这么做了。

此链接是您的最佳选择:

http://code.google.com/apis/ maps/articles/phpsqlsearch.html

即使您不使用他们的 API,他们的 PHP 和 SQL 查询也能提供很好的帮助。

I did this a few weeks ago.

This link is your best bet:

http://code.google.com/apis/maps/articles/phpsqlsearch.html

Even if you don't use their API, their PHP and SQL query helped really well.

如何在php中计算纬度/经度的距离?

半城柳色半声笛 2024-12-15 16:23:10

我认为对此没有什么可做的。虽然 IE 默认情况下使用 ClearType 字体(可以在“工具”>“Internet 选项”>“高级”(选项卡)>“多媒体”(设置选项)>“始终使用 ClearType for HTML”(复选框)中关闭此字体),请将其关闭似乎并没有改变 IE 呈现文本的方式与 FF、Chrome、Opera 等略有不同的事实。即使它确实解决了这个问题,它也是一个客户端选项,所以你仍然会运气不好。

所以,是的,您在基于浏览器的文本渲染方面遇到了一些差异。

不过,您可以尝试 google 的网络字体:

http://www.google.com/webfonts#ChoosePlace: select

它们在跨浏览器上看起来非常相似,尽管我发现 IE8 和 FF5 之间略有不同。

另外,它们看起来非常酷,您无需将它们安装在系统上即可使用它们。

I don't think there is anything to be done about this. While IE does use ClearType fonts by default (this can be turned off in Tools > Internet Options > Advanced (tab) > Multimedia (settings option) > "Always use ClearType for HTML" (checkbox) ), turning it off doesn't seem to change the fact that IE will render text slightly differently than FF, Chrome, Opera etc. Even if it did fix it, it's a client-side option so you'd still be out of luck.

So, yeah you're stuck with some difference in text rendering based on the browser.

HOWEVER, you can try google's web fonts:

http://www.google.com/webfonts#ChoosePlace:select

They seem to look very similar cross-browser, though I see a slight difference between IE8 and FF5.

Plus, they look pretty cool and you don't need to install them on your system to use them.

使 chrome/FF 渲染文本像 IE 一样好

半城柳色半声笛 2024-12-15 10:54:18

通过运行循环来更好地控制任务,您可以在循环中读取数据、检查是否超时等:

while ([task isRunning])
{
    NSData* data = [[pipe fileHandleForReading] availableData];
    if ([data length] > 0)
    {
        //process the data
    }

    // Run current runloop in default mode; check the timeout; interrupt the task if needed
}

Get more control on the task by running a loop where you can read the data, check if it's timed out , etc.:

while ([task isRunning])
{
    NSData* data = [[pipe fileHandleForReading] availableData];
    if ([data length] > 0)
    {
        //process the data
    }

    // Run current runloop in default mode; check the timeout; interrupt the task if needed
}

NSTask 未返回

半城柳色半声笛 2024-12-15 10:37:17

嗯,我只会给你一个提示,

 String stuff = "<Schedule> save kittens </Schedule> " +
                             "<Schedule> and puppies </Schedule>" ;

 String [] result = stuff.split("<Schedule>");
 for(int i = 0; i < result.length; i++)
 {
          if(result[i].length() > 0)
            Log.d("TODO", " - " + result[i].substring(0, result[i].indexOf("<")));
 }

Umm I'll only give you a hint,

 String stuff = "<Schedule> save kittens </Schedule> " +
                             "<Schedule> and puppies </Schedule>" ;

 String [] result = stuff.split("<Schedule>");
 for(int i = 0; i < result.length; i++)
 {
          if(result[i].length() > 0)
            Log.d("TODO", " - " + result[i].substring(0, result[i].indexOf("<")));
 }

如何将一串数据拆分到不同的列表视图中?

半城柳色半声笛 2024-12-15 06:34:57

[:] 对于制作列表的深层副本也很有用。

def x(l):
    f=l[:]
    g=l
    l.append(8)
    print "l", l
    print "g", g
    print "f", f

l = range(3)

print l
 #[0, 1, 2]

x(l)
 #l [0, 1, 2, 8]
 #g [0, 1, 2, 8]
 #f [0, 1, 2]

print l
#[0, 1, 2, 8]

对 l 的修改反映在 g 中(因为,两者都指向同一个列表,事实上,g 和 l 都只是 python 中的名称),而不是反映在 f 中(因为,它是 l 的副本)

但是,在你的情况下,它没有任何区别。 (不过,我没有资格评论这两种方法的任何内存使用情况。)

编辑

h = range(3)
id(h) #141312204 
h[:]=range(3)
id(h) #141312204 
h=range(3)
id(h) #141312588 

list[:] = range(100) 更新列表
list = range(100) 创建新列表。

@agf:感谢您指出我的错误

[:] is also useful to make a deep copy of the list.

def x(l):
    f=l[:]
    g=l
    l.append(8)
    print "l", l
    print "g", g
    print "f", f

l = range(3)

print l
 #[0, 1, 2]

x(l)
 #l [0, 1, 2, 8]
 #g [0, 1, 2, 8]
 #f [0, 1, 2]

print l
#[0, 1, 2, 8]

Modification to l is get reflected in g (because, both point to same list, in fact, both g and l are just names in python), not in f(because, it's a copy of l)

But, in your case, It doesn't make any difference. (Though, I'm not eligible to comment on any memory usage of both methods.)

Edit

h = range(3)
id(h) #141312204 
h[:]=range(3)
id(h) #141312204 
h=range(3)
id(h) #141312588 

list[:] = range(100) updates the list
list = range(100) creates new list.

@agf: thanks for pointing my error

使用 [:] 列出分配

更多

推荐作者

jsonder

文章 0 评论 0

給妳壹絲溫柔

文章 0 评论 0

北笙凉宸

文章 0 评论 0

国产ˉ祖宗

文章 0 评论 0

月下客

文章 0 评论 0

梦行七里

文章 0 评论 0

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文