React 16.3.0已经发布,Context API不再是实验特性。Dan Abramov (Redux的创造者)对此写了一篇很好的评论,但当时Context还只是一个实验性功能。

我的问题是,在你的观点/经验中,我什么时候应该使用React Context而不是React Redux,反之亦然?

我试图弄清楚如何使用boto3进行正确的错误处理。

我正在尝试创建一个IAM用户:

def create_user(username, iam_conn):
    try:
        user = iam_conn.create_user(UserName=username)
        return user
    except Exception as e:
        return e

当调用create_user成功时,我得到一个整洁的对象,其中包含API调用的http状态代码和新创建用户的数据。

例子:

{'ResponseMetadata': 
      {'HTTPStatusCode': 200, 
       'RequestId': 'omitted'
      },
 u'User': {u'Arn': 'arn:aws:iam::omitted:user/omitted',
           u'CreateDate': datetime.datetime(2015, 10, 11, 17, 13, 5, 882000, tzinfo=tzutc()),
           u'Path': '/',
           u'UserId': 'omitted',
           u'UserName': 'omitted'
          }
}

这很有效。但是当这个失败时(比如如果用户已经存在),我只得到一个botocore.exceptions.ClientError类型的对象,其中只有文本告诉我哪里出错了。

例子: ClientError('调用CreateUser操作时发生错误(EntityAlreadyExists):省略名称的用户已经存在。')

这(AFAIK)使得错误处理非常困难,因为我不能只是打开结果的http状态代码(409用户已经存在根据AWS API文档的IAM)。这让我觉得我一定是做错了什么。最优的方法是boto3永远不抛出异常,但juts总是返回一个反映API调用如何进行的对象。

有没有人能在这个问题上给我一些启发,或者给我指出正确的方向?

我尝试使用“ng destroy component foo”,它告诉我“Angular-CLI不支持销毁命令”

如何使用Angular CLI正确地删除组件?

当我试图访问react组件中的存储时,@connect工作得很好。但我该如何在其他代码中访问它呢。例如:让我们说我想使用授权令牌来创建我的axios实例,可以在我的应用程序中全局使用,实现这一点的最佳方法是什么?

这是我的api。js

// tooling modules
import axios from 'axios'

// configuration
const api = axios.create()
api.defaults.baseURL = 'http://localhost:5001/api/v1'
api.defaults.headers.common['Authorization'] = 'AUTH_TOKEN' // need the token here
api.defaults.headers.post['Content-Type'] = 'application/json'

export default api

现在我想从我的商店访问一个数据点,这是什么样子,如果我试图在一个react组件中使用@connect获取它

// connect to store
@connect((store) => {
  return {
    auth: store.auth
  }
})
export default class App extends Component {
  componentWillMount() {
    // this is how I would get it in my react component
    console.log(this.props.auth.tokens.authorization_token) 
  }
  render() {...}
}

有什么见解或工作流模式吗?

尝试从首选项->设置->键盘映射它,但“键”组合框只有“向前删除”,但没有“删除”。另一方面,我的键盘上只有“删除”,没有“向前删除”!

除了偏好,还有别的方法吗?

我想在我的Mac上运行一些PHP,没有注释httpd.conf,激活网络共享,安装MySQL等。 我似乎找不到我的PHP文件,最重要的是,PHP.ini。

在我的旧机器上,它位于/usr/local/php5/lib 但是php5目录在/usr/local中不存在。

我需要取包裹吗?还是我找错地方了?

运行OS X 10.7.3, PHP 5.3.8, Apache/2.2.21

重新启动我的Mac,我得到了可怕的Postgres错误:

psql: could not connect to server: No such file or directory
 Is the server running locally and accepting
 connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

发生这种情况的原因是由于一个无关的问题,我的macbook完全死机了,我不得不使用电源按钮进行硬重启。重启后,由于这个错误,我无法启动Postgres。

当有人谈到给物体补水时,这是什么意思?

我在网上看到一个名为Hydrate的Java项目,它在不同的表示形式(RDMS到OOPS到XML)之间转换数据。这就是物体水化的一般意义吗?在表示之间转换数据?这是否意味着从存储的表示中重构对象层次结构?

我在Linux上运行Eclipse的Helios EE包,我添加了颠覆性的插件,m2e Maven集成和Trac的Mylin连接器。在过去的几个星期里,我一直在尝试安装更新,每次我都收到这样的消息

No repository found containing <something or other>

最新的一个是

An error occurred while collecting items to be installed
session context was:(profile=epp.package.jee, phase=org.eclipse.equinox.internal.p2.engine.phases.Collect, operand=, action=).
No repository found containing: osgi.bundle,org.eclipse.team.svn,0.7.9.I20110318-1700
No repository found containing: osgi.bundle,org.eclipse.team.svn.core,0.7.9.I20110523-1700
No repository found containing: osgi.bundle,org.eclipse.team.svn.help,0.7.9.I20110318-1700
No repository found containing: osgi.bundle,org.eclipse.team.svn.mylyn,0.7.9.I20110318-1700
No repository found containing: osgi.bundle,org.eclipse.team.svn.ui,0.7.9.I20110523-1700
No repository found containing: org.eclipse.update.feature,org.eclipse.team.svn,0.7.9.I20110523-1700
No repository found containing: org.eclipse.update.feature,org.eclipse.team.svn.mylyn,0.7.9.I20110523-1700
No repository found containing: org.eclipse.update.feature,org.eclipse.team.svn.resource.ignore.rules.jdt,0.7.9.I20110523-1700

这一切意味着什么,我该如何解决?如果Eclipse能够联系存储库来检查新文件,为什么它不能从这些存储库下载这些文件呢?或者错误消息意味着完全不同的东西?