问题列表 - 第17897页

混合数字和文字标识符的最佳哈希函数

出于性能原因,我需要将一组由字符串标识的对象拆分为组.对象可以通过数字或字符串以前缀(限定)形式标识,其中点分隔标识符的各个部分:

12
323
12343
2345233
123123131
ns1:my.label.one
ns1:my.label.two
ns1:my.label.three
ns1:system.text.one
ns2:edit.box.grey
ns2:edit.box.black
ns2:edit.box.mixed
Run Code Online (Sandbox Code Playgroud)

数字标识符从1到数百万.文本标识符最有可能以相同的名称空间前缀(ns1 :)和相同的路径前缀(edit.box.)开头.

为此目的,最好的哈希函数是什么?如果我能根据对象标识符统计以某种方式预测存储桶的大小,那将是很好的.是否有一些基于某些统计信息构建良好哈希函数的好文章?

有数百万个这样的标识符,但目的是基于散列函数将它们分成1-2千组.

algorithm hash-function

6
推荐指数
1
解决办法
864
查看次数

如何将Eclipse中的XSD链接到XML文件?

如何将Eclipse中的XSD链接到XML文件?

我正在编辑的xml文件与xsd文件不在同一目录中,但两者都在工作区中.

xml eclipse

9
推荐指数
1
解决办法
6916
查看次数

是否有可能使用MSMQ MessageQueue.Peek丢失消息并超时?

我目前遇到丢失消息的问题.这个错误很少发生,但经常发生,这很烦人.以下是该问题的背景:

  • 我已经打开了goldmine_service_queue上的消息日志,这是Windows 2003服务器上的MSMQ.
  • 我可以证明消息正在插入goldmine_service_queue,因为消息出现在消息日志中.此信息提供有关消息何时消失的计时信息.
  • 日志记录功能使用http://logging.apache.org/log4net/index.html
  • 日志不显示错误.
  • worker函数(如下所示)在Windows服务的一个线程中执行.它负责从队列中查看消息(工作项)并处理它们.
  • 从日志中,我强烈怀疑我的问题可能与MessageQueue.Peek和超时行为有关.

超时和消息接收是否可能同时发生?有没有更好的方法来处理服务停止检查以帮助避免此错误?

        private void workerFunction()
    {

        logger.Info("Connecting to queue: " + Settings.Default.goldmine_service_queue);
        MessageQueue q = new MessageQueue(Settings.Default.goldmine_service_queue);
        q.Formatter = new ActiveXMessageFormatter();

        while (serviceStarted)
        {

            Message currentMessage = null;

            try
            {
                currentMessage = q.Peek(new TimeSpan(0,0,30));
            }
            catch (System.Messaging.MessageQueueException mqEx)
            {
                if (mqEx.ToString().Contains("Timeout for the requested operation has expired"))
                {
                    logger.Info("Check for service stop request");
                }
                else
                {
                    logger.Error("Exception while peeking into MSMQ: " + mqEx.ToString());
                }
            }
            catch (Exception e)
            {
                logger.Error("Exception while …
Run Code Online (Sandbox Code Playgroud)

c# windows-services msmq

5
推荐指数
1
解决办法
8072
查看次数

如何创建云图?

我已经看到这些图表被称为标签云,任务云和云图,但是任何人都可以推荐一个纯JavaScript(没有Flash请求)库或实用程序,可以生成云图吗?非常感谢.

javascript

5
推荐指数
1
解决办法
1万
查看次数

正则表达式验证管道分隔项的数量

我有一个字符串管道'|' 分隔.我需要一个正则表达式来根据管道字符验证项目数.所以正则表达式将执行以下操作:

如果项目的最大数量为三:

asdfasdf | asdfasdf | asdfasdf =有效

asdfasdf | asdfasdf | asdfasdf | asdfasf =无效

此外,此字符串可能为空.

任何帮助将非常感激

问候

regex

2
推荐指数
1
解决办法
5236
查看次数

visual studio 2008探查器是否可以使用非托管C++?

我知道VS 2008 Team Edition有一个分析器,但我也知道他们最近在微软完全无视非托管语言的趋势(最后一次非托管C++在IDE中有什么好看的东西?!).例如我知道IDE"单元测试"和"代码指标"功能不适用于非托管代码.

我试图谷歌但没有找到任何信息; 那么,有谁知道它是否有效?

c++ visual-studio-2008 visual-studio

1
推荐指数
1
解决办法
296
查看次数

MYSQL删除所有具有count(*)= 1的结果

我有一个表有两个字段sesskey(varchar32,index)和产品(int11)的表,现在我必须删除所有具有group by sesskey count(*)= 1的行.我正在尝试一些方法,但都失败了.

例:

delete from taged where sesskey in (select sesskey from taged group by sesskey having count(*) = 1)
Run Code Online (Sandbox Code Playgroud)

sesskey字段不能成为主键,因为它重复了.

mysql group-by sql-delete

7
推荐指数
1
解决办法
8664
查看次数

是否有必要提供距离过滤器以获得最佳位置?

我在我的应用程序中使用位置管理器,我的位置不准确.我使用下面的代码来获取位置

locationManager.delegate = self;
locationManager.desiredAccuracy = kCLLocationAccuracyBest;
Run Code Online (Sandbox Code Playgroud)

在didupdatetolocation方法我正在使用此代码.

LatitudeData = [[NSString alloc] initWithFormat:@"%f",newLocation.coordinate.latitude];
    LongitudeData = [[NSString alloc] initWithFormat:@"%f",newLocation.coordinate.longitude];
    [UIApplication sharedApplication].networkActivityIndicatorVisible=NO;
    [self insertNewLocationInDataBase];
Run Code Online (Sandbox Code Playgroud)

我需要设置distancefilter吗?我如何获得准确的位置?我想获得准确的位置然后将在数据库中插入位置.

objective-c core-location iphone-sdk-3.0

1
推荐指数
1
解决办法
2786
查看次数

使用respondsToSelector时,禁止"'...'被弃用"

我通过在运行时选择最新的API来支持10.4+:

if ([fileManager respondsToSelector:@selector(removeItemAtPath:error:)])
    [fileManager removeItemAtPath:downloadDir error:NULL];
else
    [fileManager removeFileAtPath:downloadDir handler:nil];
Run Code Online (Sandbox Code Playgroud)

在这种情况下,10.5和up将使用removeItemAtPath:error:,10.4将使用removeFileAtPath:handler:.很好,但我仍然得到旧方法的编译器警告:

warning: 'removeFileAtPath:handler:' is deprecated [-Wdeprecated-declarations]
Run Code Online (Sandbox Code Playgroud)

是否有一种语法if([… respondsToSelector:@selector(…)]){ … } else { … }暗示编译器(Clang)不会在该行上发出警告?

如果没有,有没有办法标记该行被忽略-Wdeprecated-declarations


在看到一些答案之后,让我澄清一下,混淆编译器而不知道我在做什么并不是一个有效的解决方案.

xcode cocoa objective-c clang

56
推荐指数
4
解决办法
2万
查看次数

jquery.动画不同的速度

我在Jquery中使用.animate函数.我有一个div使用marginLeft滑过,但我也需要它淡入,但我需要它比marginLeft效果慢.使用.animate,我似乎只能应用一个速度参数.

<script type="text/javascript">
 $(document).ready(function(){
 $(".topFrameAnim").css("opacity", "0.0");
  $(".topFrameAnim").animate({
  marginLeft: "0",
    }, 500 );

    $(".topFrameAnim").animate({
  opacity: "1",
    }, 1000 ); // Need this effect to be applied at the same time, at a different speed.




    });


</script>
Run Code Online (Sandbox Code Playgroud)

jquery effects

3
推荐指数
1
解决办法
4027
查看次数