首先,我不是一个非常有经验的程序员.我正在使用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")进行一些测试,我将不胜感激.有趣的是看看在新版本中是否有任何变化.
基本思想是访问.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) 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? …
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 …
try:
print blah
except KeyError:
traceback.print_exc()
Run Code Online (Sandbox Code Playgroud)
我曾经像这样调试.我打印到控制台.现在,我想记录所有内容而不是打印,因为Apache不允许打印.那么,如何记录整个回溯?
标题或多或少都说明了一切.根据这篇文章,我想出了这个:
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) 如何检查字符串是否与某种格式匹配?例如,如何检查字符串是否与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) 我有一个字符串,它是我从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>.但如果有人有更好的方法来做到这一点我会很高兴教育:)
我注意到在jsFiddle中,标题标记(<h1>- <h6>)不会按预期"放大"(或以其他方式设置)文本.
例如:http://jsfiddle.net/Bubby4j/KURKp/
我期待看到更大的文字,但它看起来像普通文本.我怎样才能恢复正常行为?
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中的列表?