问题列表 - 第45006页

Delphi 2009 - Bug?将所谓的无效值添加到集合中

首先,我不是一个非常有经验的程序员.我正在使用Delphi 2009并且一直在处理集合,这些集合似乎表现得非常奇怪甚至不一致.我想这可能是我,但以下看起来显然有些不对劲:

unit test;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;

type
TForm1 = class(TForm)
  Button1: TButton;
  Edit1: TEdit;
  procedure Button1Click(Sender: TObject);
private
    test: set of 1..2;
end;

var Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
  test := [3];
  if 3 in test then
    Edit1.Text := '3';
end;

end.
Run Code Online (Sandbox Code Playgroud)

如果您运行该程序并单击该按钮,那么,当然,它将在文本字段中显示字符串"3".但是,如果您使用100之类的数字尝试相同的事情,则不会显示任何内容(在我看来应该如此).我错过了什么或者这是某种错误吗?建议将不胜感激!

编辑:到目前为止,我的观察似乎并不孤单.如果有人对此有一些了解,我会很高兴听到这个消息.此外,如果有人使用Delphi 2010(甚至是Delphi XE),如果你能对这个甚至是一般设置行为(例如"test:set of 256..257")进行一些测试,我将不胜感激.有趣的是看看在新版本中是否有任何变化.

delphi set delphi-2009

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

MP3不会与JMF流式传输

基本思想是访问.mp3文件并通过RTP流将其发送给其他想要播放该歌曲的客户端.

这是RTPServer.java,我在网上找到并根据自己的喜好进行了修改. __CODE____CODE__窗口上获取整个屏幕的设备上下文,并可以通过调用来跟进__CODE__:

    package server;

import java.net.InetAddress;
import javax.media.rtp.*;
import javax.media.rtp.rtcp.*;
import javax.media.*;
import javax.media.protocol.*;
import javax.media.control.*;

public class RTPServer implements ControllerListener, Runnable {
    private boolean realized = false;
    private boolean configured = false;
    private String ipAddress;
    Processor p;
    MediaLocator src;

    public static void main (String[] args) {
        RTPServer rtp = new RTPServer("192.168.1.101", "04 - Blue.mp3");
        Thread t = new Thread(rtp);
        t.start();
    }

    public RTPServer(String ip, String song) {
        ipAddress = ip;
 String srcFile = …
Run Code Online (Sandbox Code Playgroud)

java audio streaming mp3 jmf

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

Kohana 3 Command line output buffering?

I am using Kohana 3 and I have a controller that extends Kohana_Controller. I call it from the command line using:

php /path/to//index.php --uri="url/path"
Run Code Online (Sandbox Code Playgroud)

It works just fine, but this particular script takes a long time and during the execution I am echoing status messages (echo 'status message';) but none of the messages appear until after the script has completed executing.

I want to see the status messages as they are echoed, can anyone tell me how to do it? …

php kohana kohana-3

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

how to import correctly the commons.apache.math libraries for my own project

I want to use the commons.apache.maths classes for my own project but I don't know how to correctly import them into eclipse. I have visited the download page for the package mentioned above http://commons.apache.org/math/download_math.cgi but I don't know if the jar file which i want to import is on the binaries zip files or the source zip files. I tried the binaries ones first and when I do the import i just get a list of empty packages. Could somebody …

java eclipse import jar apache-commons

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

当我告诉它时,如何使用Django的记录器记录回溯?

try:
    print blah
except KeyError:
    traceback.print_exc()
Run Code Online (Sandbox Code Playgroud)

我曾经像这样调试.我打印到控制台.现在,我想记录所有内容而不是打印,因为Apache不允许打印.那么,如何记录整个回溯?

python django logging traceback

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

如何在运行时将IL注入方法

标题或多或少都说明了一切.根据这篇文章,我想出了这个:

public static unsafe void Replace(this MethodBase destination, MethodBase source)
{
    IntPtr srcHandle = source.MethodHandle.GetFunctionPointer();
    IntPtr dstHandle = destination.MethodHandle.GetFunctionPointer();

    int* dstPtr = (int*)dstHandle.ToPointer();
    *dstPtr = srcHandle.ToInt32();
}
Run Code Online (Sandbox Code Playgroud)

这实际上有效...偶尔--.-

例如,这是有效的.

public static class Program
{
    public static void Main(string[] args)
    {
        MethodInfo methodA = typeof(Program).GetMethod("A", BindingFlags.Public | BindingFlags.Static);
        MethodInfo methodB = typeof(Program).GetMethod("B", BindingFlags.Public | BindingFlags.Static);

        methodA.Replace(methodB);

        A();
        B();
    }

    public static void A()
    {
        Console.WriteLine("Hai World");
    }

    public static void B()
    {
        Console.WriteLine("Bai World");
    }
}
Run Code Online (Sandbox Code Playgroud)

但是,这不是(SEHException).我所做的就是改变定义函数的顺序.

public static …
Run Code Online (Sandbox Code Playgroud)

.net c# il code-injection

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

如何确保字符串匹配某种格式?

如何检查字符串是否与某种格式匹配?例如,如何检查字符串是否与IP地址,代理地址(或任何自定义格式)的格式匹配?

我找到了这段代码,但我无法理解它的作用.请帮我理解匹配字符串创建过程.

string pattern = @"^([1-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\.
    ([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3}$";
            //create our Regular Expression object
Run Code Online (Sandbox Code Playgroud)

c# regex

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

string.replace('the','')正在留下空格

我有一个字符串,它是我从MP3 ID3标签获得的艺术家的名字

sArtist = "The Beatles"
Run Code Online (Sandbox Code Playgroud)

我想要的是改变它

sArtist = "Beatles, the"
Run Code Online (Sandbox Code Playgroud)

我遇到了两个不同的问题.我的第一个问题是我似乎在为''换取''.

if sArtist.lower().find('the') == 0:
    sArtist = sArtist.lower().replace('the','')
    sArtist = sArtist + ", the"
Run Code Online (Sandbox Code Playgroud)

我的第二个问题是因为我必须检查"The"和"the"我使用sArtist.lower().然而,这将我的结果从"甲壳虫乐队"改为"披头士乐队".为了解决这个问题,我刚刚删除了.lower并添加了第二行代码来明确查找这两种情况.

if sArtist.lower().find('the') == 0:
    sArtist = sArtist.replace('the','')
    sArtist = sArtist.replace('The','')
    sArtist = sArtist + ", the"
Run Code Online (Sandbox Code Playgroud)

所以我真正需要解决的问题是为什么我用' <SPACE>而不是'代替'' <NULL>.但如果有人有更好的方法来做到这一点我会很高兴教育:)

python string mp3 id3

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

H1-H6在jsFiddle中不起作用?

我注意到在jsFiddle中,标题标记(<h1>- <h6>)不会按预期"放大"(或以其他方式设置)文本.

例如:http://jsfiddle.net/Bubby4j/KURKp/

我期待看到更大的文字,但它看起来像普通文本.我怎样才能恢复正常行为?

html jsfiddle

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

使用CoffeeScript列表推导进行过滤

CoffeeScript文档声明列表推导应该能够执行选择/过滤操作:

它们应该能够处理大多数你将使用循环,每个/ forEach,map或select/filter的地方.

你可以想象你可以在一条线上做点什么,result = item for item in list if item % 2 == 0 但是我能来的最近

list = [1,2,3,4]
result = []
for item in list
  if item % 2 == 0 then result.push item
Run Code Online (Sandbox Code Playgroud)

什么是最简洁的方法来过滤CoffeeScript中的列表?

list-comprehension coffeescript

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