注意:我已经考虑了Radix排序,桶排序,计数排序.
反正有没有实现大O(n)?
我在比较UIColors时遇到了问题.我有一个图像,我已成功提取用户点击的图像上的颜色.现在我想将这种颜色与其他颜色进行比较,但是我得到了一些奇怪的结果.这是我尝试过的:
CGColorRef pixelColor = [[buttonImage colorAtPixel:point] CGColor];
UIColor* color = [UIColor colorWithCGColor:pixelColor];
UIColor* aqua = [UIColor colorWithRed:0.521569 green:0.768627 blue:0.254902 alpha:1];
if (CGColorEqualToColor(color.CGColor, aqua.CGColor)) {
DLog(@"Apparently, it works");
}
DLog(@"%@", color.CGColor);
DLog(@"%@", aqua.CGColor);
Run Code Online (Sandbox Code Playgroud)
输出:
2011-05-21 19:48:27.144 Coffee[66860:207] -[DescriptorsViewController touchesEnded:withEvent:] <CGColor 0x4d1eb80> [<CGColorSpace 0x4d1a070> (kCGColorSpaceDeviceRGB)] ( 0.521569 0.768627 0.254902 1 )
2011-05-21 19:48:27.145 Coffee[66860:207] -[DescriptorsViewController touchesEnded:withEvent:] <CGColor 0x4d1f750> [<CGColorSpace 0x4d1a070> (kCGColorSpaceDeviceRGB)] ( 0.521569 0.768627 0.254902 1 )
Run Code Online (Sandbox Code Playgroud)
看起来CGColor地址不同,但CGColorSpaces是一样的,但我无法弄清楚如何比较CGColorSpaces
我也试过这个:
CGColorRef pixelColor = [[buttonImage colorAtPixel:point] CGColor];
UIColor* color = [UIColor colorWithCGColor:pixelColor];
UIColor* aqua …
Run Code Online (Sandbox Code Playgroud) 在页面加载时,我看到“ hi2”。当我单击按钮时,什么也没有发生。我也尝试过setUser
。
我怀疑我只是在编辑道具本身,而可观察的物体却没有触发?
在全新的rails / react环境中查看它的示例代码在这里不起作用:https : //github.com/bufordtaylor/mobxtest
======================
更新:
我将其简化为基本形式,消除了可能的导入错误,提供程序错误或构造函数错误。
这里是
import React from 'react'
import ReactDOM from 'react-dom'
import { observable, action, computed } from 'mobx';
import { Provider, inject, observer } from 'mobx-react';
class UserStore {
@action setUser(val) {
console.log(val);
this.user = val;
}
@observable user = "default";
}
const userStore = new UserStore();
@observer
class Hello extends React.Component {
render() {
return (
<div>
hi2 {this.props.userStore.user} …
Run Code Online (Sandbox Code Playgroud) 我似乎无法在我的Mac OS X 10.8系统上安装Nokogiri.我知道这个解决方案有一个解决方法,解决方法是:
NOKOGIRI_USE_SYSTEM_LIBRARIES=1 bundle install
Run Code Online (Sandbox Code Playgroud)
但我宁愿解决它,因为每次我做一个捆绑,它都会失败.这是问题所在:
$ gem install nokogiri
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
/Users/buf/.rvm/rubies/ruby-2.0.0-p195/bin/ruby extconf.rb
Extracting libxml2-2.8.0.tar.gz into tmp/x86_64-apple-darwin12.5.0/ports/libxml2/2.8.0... OK
Running 'configure' for libxml2 2.8.0... ERROR, review 'tmp/x86_64-apple-darwin12.5.0/ports/libxml2/2.8.0/configure.log' to see what happened.
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration …
Run Code Online (Sandbox Code Playgroud)