有没有人知道Objective-c的模糊搜索匹配的快速实现?(levenshtein距离算法).
我发现了这个:https://github.com/thetron/StringScore/blob/master/NSString%2BScore.m - 但不幸的是它很慢.我需要将它与大约200个字符串进行比较,并且它是连续的 - 每次键入新键击.
有任何想法吗?
这是我的代码:
int columns 3;
int columnWidth = self.layer.bounds.size.width / 3;
for (int c = 1; c < columns; c++) {
CALayer *layer = [CALayer layer];
layer.frame = (CGRectMake(columnWidth * c + 0.5, 0.5, 1, self.layer.bounds.size.height));
layer.backgroundColor = myColor;
[grid addSublayer:layer];
}
Run Code Online (Sandbox Code Playgroud)
我知道我必须移动x和y 0.5像素,这是我所做的,但它仍然显示为2像素行而不是1.

我想要一个样式列表,在第一级没有留下余量..但是后续的,水平的子列表..任何人都知道如何做到这一点?
<ul>
<li>no margin</li>
<li>
<ul>
<li>yes margin</li>
</ul>
</li>
</ul>
Run Code Online (Sandbox Code Playgroud)
(不将css类添加到第一级ul或更改任何代码)
我正在请求带有ajax的URL,导致HTTP头代码500.我希望这会触发错误函数:
$.ajax({
url: "http://xxx",
dataType: "jsonp",
crossDomain: true,
success: function( data ) {
alert('success');
},
error: function () {
alert('error');
}
});
Run Code Online (Sandbox Code Playgroud)
这适用于safari,但在chrome和firefox中失败.
我究竟做错了什么?
这是最新的jquery 1.4.X,因为我无法升级到更高版本..
响应发送HTTP代码500,内容类型application/json和内容:
jsonp1310063232212({"error":{"reason":"User not found"}})
是否有方法可以像在Firefox中一样注册带有谷歌浏览器扩展的自定义协议:
const kSIMPLEURI_CONTRACTID = "@mozilla.org/network/simple-uri;1";
const kIOSERVICE_CONTRACTID = "@mozilla.org/network/io-service;1";
const nsISupports = Components.interfaces.nsISupports;
const nsIIOService = Components.interfaces.nsIIOService;
const nsIProtocolHandler = Components.interfaces.nsIProtocolHandler;
const nsIURI = Components.interfaces.nsIURI;
Run Code Online (Sandbox Code Playgroud)
我想要协议:
XYZ:
不是xyz://
这可能吗?
所以我知道你现在可以使用data-target + href来加载远程内容,但是,我从ajax响应中得到的是json(我不能改变那个服务器端),所以我首先要做的是处理它.
我想展示一个微调器,我有CSS,但也希望已经淡化了将"fade"类添加到模态div时发生的背景.
有谁知道如何手动启动,并确保在我显示模态时不重复动画?
看这个演示
我正在使用这里提供的fixedheadertable插件
由于某些原因,我的示例表不滚动,我做错了什么?
初始化在javascript代码的底部完成:
$("#fixed").fixedHeaderTable();
$("#fixed").fixedHeaderTable("show");
Run Code Online (Sandbox Code Playgroud) 如何添加填充NSTableCellView?
我希望内容的填充量为10px,类似于纯HTML中的内容.(所有面).文本应在中间垂直居中.
目前我正在NSTextFieldCell的子类中执行此操作.但这似乎不正常.
编辑文本时,编辑文本字段不使用textfieldcell中的填充.
图2:


这是我目前的代码,(子类NSTextFieldCell)
- (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView {
NSRect titleRect = [self titleRectForBounds:cellFrame];
NSAttributedString *aTitle = [self attributedStringValue];
if ([aTitle length] > 0) {
[aTitle drawInRect:titleRect];
}
}
- (NSRect)titleRectForBounds:(NSRect)bounds
{
NSRect titleRect = bounds;
titleRect.origin.x += 10;
titleRect.origin.y = 2;
NSAttributedString *title = [self attributedStringValue];
if (title) {
titleRect.size = [title size];
} else {
titleRect.size = NSZeroSize;
}
// We don't want the width of the string going outside the cell's …Run Code Online (Sandbox Code Playgroud) 我正在调用这样的函数:
myfunc($tab, {'top-left', 'bottom-left'}, defaults.tabRounded);
Run Code Online (Sandbox Code Playgroud)
功能定义是:
function myfunc(obj, properties, value) {
Run Code Online (Sandbox Code Playgroud)
然而,我收到错误"无效的对象初始化程序".这是因为json参数吗?或者是其他东西?
请检查一下:
http://users.telenet.be/prullen/grid.html
这在safari中具有正常速度,但在Firefox中缩放效果非常慢.
有趣的是,如果我添加:
.item {
width:100px;
height:100px;
}
Run Code Online (Sandbox Code Playgroud)
它似乎加速了一点(仍然不完全流利).但这不是我的图像的大小,所以它看起来搞砸了:
http://users.telenet.be/prullen/grid2.html
如果我将项目宽度/高度设置为我的图像大小,则事情会再次减慢:
.item {
width:160px;
height:160px;
}
Run Code Online (Sandbox Code Playgroud)
http://users.telenet.be/prullen/grid3.html
任何想法,因为这是什么原因?我没有想法,我删除/添加了陈述,但似乎没有任何帮助.这是在不同版本10的firefox版本中测试的.
谢谢,韦斯利
css ×4
jquery ×4
cocoa ×3
javascript ×3
objective-c ×3
ajax ×1
callback ×1
css3 ×1
exception ×1
firefox ×1
function ×1
fuzzy-search ×1
html-lists ×1
list ×1
margin ×1
nstableview ×1
performance ×1
search ×1
xcode ×1