小编Age*_*bra的帖子

如何用自制软件安装早期版本的mongodb?

我在osx6.8上并且需要安装早期版本的Mongodb,如何使用HomeBrew安装早期版本?以下不起作用:(

dream-2:app2 star$ brew install mongodb-2.6.10
Error: No available formula for mongodb-2.6.10 
Searching formulae...
Searching taps...
dream-2:app2 star$ 
Run Code Online (Sandbox Code Playgroud)

(((编辑:我收到一条消息,解释这篇文章与另一篇文章相比是如何独特的,嗯,另一个问题的答案是超长且复杂的,它特定于postgresql,并没有真正回答我题.)))

homebrew mongodb

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

React Native:可能未处理的承诺拒绝

我收到以下错误: Possible unhandled promise rejection (id:0: Network request failed

这是承诺代码,我不知道这里有什么问题,任何想法?

  return fetch(url)
    .then(function(response){
      return response.json();
    })
    .then(function(json){
      return {
        city: json.name,
        temperature: kelvinToF(json.main.temp),
        description: _.capitalize(json.weather[0].description)
      }
    })
    .catch(function(error) {
    console.log('There has been a problem with your fetch operation: ' + error.message);
    });
}
Run Code Online (Sandbox Code Playgroud)

**编辑:我添加了一个catch函数并得到了更好的错误 You passed an undefined or null state object; instead, use forceUpdate(). index.ios.js:64 undefined

这是index.ios.js代码.网址很好,并给我正确的json数据.我可以用控制台日志中都可以看到region.latitude,并region.longitude处于可用Api(region.latitude, region.longitude).但是data未定义.我仍然不确定发生了什么,为什么会出现问题data以及为什么它未定义.

// var React = require('react-native'); --deprecated

// updated
import React from …
Run Code Online (Sandbox Code Playgroud)

react-native

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

动态调整pixi阶段的大小,并调整窗口大小和窗口加载的内容

我正试图在窗口调整大小时动态调整pixi阶段(画布和内容)的大小.并且它最初加载到浏览器窗口的大小而不改变比率.

我正在使用以下内容将初始大小设置为window.innerWidth&window.innerHeight- 但它正在做一些奇怪的事情,它以较小的尺寸加载(但不是html中指定的画布的大小)然后它正在扩展以适应窗口.

var w;
var h;

window.onload = function() {
    var w = window.innerWidth;
    var h = window.innerHeight;

    //this part resizes the canvas but keeps ratio the same
    renderer.view.style.width = w + "px";
    renderer.view.style.height = h + "px"

//  init();
}; 
Run Code Online (Sandbox Code Playgroud)

这是我的onresize函数 - 它正在调整画布大小,但不是内容.我认为它正在更新renderer.view,它会调整内容的大小,但它没有这样做 - 我如何调整内容的stage/renderer.view内容?

window.onresize = function (event){
    var w = window.innerWidth;
    var h = window.innerHeight;

    //this part resizes the canvas but keeps ratio the same
    renderer.view.style.width = w …
Run Code Online (Sandbox Code Playgroud)

javascript jquery canvas pixi.js

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

具有长内容的角度注入页面使整个页面加载到页面顶部之下,从而切断页面标题

看看下面的插件如何,当你点击link one或者link three,页面没有加载到页面顶部以便你看不到时page title,你必须实际向上滚动才能看到页面标题.为什么是这样?如何将其加载到顶部,就像常规网页一样?

这是掠夺者.

这是我的js:

var routerApp = angular.module('routerApp', ['ui.router','ui.bootstrap']);

routerApp.config(function($stateProvider, $urlRouterProvider, $locationProvider) {

    $urlRouterProvider.otherwise('/home');
    $locationProvider.html5Mode(false).hashPrefix("");
    $stateProvider


        // HOME VIEW ========================================
        .state('home', {
            url: '/home',
            templateUrl: 'partial-home.html'
         //   onEnter: scrollContent
        })

        // ONE VIEW ========================================
        .state('one', {
            url: '/one',
            templateUrl: 'partial-one.html' 
        })

        // TWO VIEW ========================================
        .state('two', {
            url: '/two',
            templateUrl: 'partial-two.html'
        })

          // THREE VIEW ========================================
        .state('three', {
            url: '/three',
            templateUrl: 'partial-three.html'
        })
});
Run Code Online (Sandbox Code Playgroud)

这是我的html(参见上面注入页面的plunker链接).

<!DOCTYPE html>
<html>
  <head>
    <!-- CSS …
Run Code Online (Sandbox Code Playgroud)

html javascript angularjs

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

React-native IOS:网络请求失败

我正在测试一个react本机应用程序(在xcode模拟器v9.2/xcode 7.2.1中的OS X Yosemite上).我收到Network request failed以下代码的错误.具有正确appid的实际url在浏览器中运行良好,并以json格式提供正确的信息,并且promise/api调用看起来很好.

我不在防火墙后面.我已经尝试对连接进行故障排除,并Allow HTTP Services在开发人员设置中激活,但我仍然收到错误.

知道这里的问题是什么吗?实际错误如下:

-- There has been a problem with your fetch operation: Network request failed
-- Api call error =  Network request failed
Run Code Online (Sandbox Code Playgroud)

这是api.js代码:

var _ = require('lodash');
var rootUrl = 'http://api.openweathermap.org/data/2.5/weather?APPID=xxxxxxxxxxxxxxxxxxxxxx';

var kelvinToF = function(kelvin) {
  return Math.round((kelvin - 273.15) * 1.8 + 32) + ' ?F'
};

var kelvinToC = function(kelvin) {
  return Math.round(kelvin - 273.15) + ' ?C'
};  

module.exports = function(latitude, longitude) {
  var …
Run Code Online (Sandbox Code Playgroud)

xcode react-native xcode7

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

Meteor/MongoDB:在表单提交时插入整数而不是字符串

我正在http://meteortips.com/上完成David关于Meteor的教程.

如何在表单提交时插入整数而不是字符串?

我认为以下几行需要澄清它是一个整数,但我不确定如何.

var playerScoreVar = event.target.playerScore.value;
Run Code Online (Sandbox Code Playgroud)

这是我的整个代码.

 Template.addPlayerForm.events({

  'submit form': function(event){
      event.preventDefault();
      var playerNameVar = event.target.playerName.value;
      var playerScoreVar = event.target.playerScore.value;
      PlayersList.insert({
          name: playerNameVar,
          score: playerScoreVar,
      });
      event.target.playerName.value = ""
      event.target.playerScore.value = ""
  }
});
Run Code Online (Sandbox Code Playgroud)

forms insert submit mongodb meteor

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

如何在phaser.js中向组sprite添加动画?

如何为已添加到组中的精灵设置动画?

这是我的spritesheet:

game.load.spritesheet('enemyBullet', 'assets/games/invaders/enemy-bullet.png', 11, 19);
Run Code Online (Sandbox Code Playgroud)

这是小组:

// The enemy's bullets
enemyBullets = game.add.group();
enemyBullets.enableBody = true;
enemyBullets.physicsBodyType = Phaser.Physics.ARCADE;
enemyBullets.createMultiple(30, 'enemyBullet');
enemyBullets.setAll('anchor.x', 0.5);
enemyBullets.setAll('anchor.y', 1);
enemyBullets.setAll('outOfBoundsKill', true);
enemyBullets.setAll('checkWorldBounds', true);
Run Code Online (Sandbox Code Playgroud)

这是我认为我应该添加的代码.

enemyBullets.animations.add('fly3', [ 0, 1, 2, 3], 20, true);
enemyBullets.play('fly3');
Run Code Online (Sandbox Code Playgroud)

但是,如果我在上面的组代码块中的任何地方添加它,我会收到错误'enemyBullets.animations'.undefined'.

有任何想法吗?

animation sprite phaser-framework

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

为什么我没有看到"抛出新错误"的堆栈跟踪?

在节点服务器上进行测试时,为什么我使用下面这个简单的代码会出现以下错误?

code/app2/i.js:35
        throw new Error("here")
              ^
Error: here
Run Code Online (Sandbox Code Playgroud)

我实际上期望按照"Smashing node.js"一书看到堆栈跟踪(相关第35页的图片):

* node uncaught-http-js

/uncaught-http.js:4
  throw new Error("here");
        ^
Error: This will be uncaught
    at Server.<anonymous> (/uncaught-http.js:4:9)
    at Server.emit(events.js:70:17)
    at HttpParser.onIncoming(http.js:1514:12)
    at HttpParser.onHeadersComplete(http.js:102:31)
    at Socket.andata (http.js:1410:22)
    at TCP.onread(net.js:354:27)
Run Code Online (Sandbox Code Playgroud)

但那并没有发生.

这是代码.

function c () {
    b();
};
function b () {
    a();
};

function a () {
    setTimeout(function () {
        throw new Error('here');
    }, 10);
};

c();
Run Code Online (Sandbox Code Playgroud)

javascript node.js

4
推荐指数
2
解决办法
1252
查看次数

如何随机生成-​​0.5和0.5范围内的数字?

在javascript中如何随机生成介于-0.5和0.5之间的数字?以下似乎只给出正数,没有负数.

Math.random(-0.15, 0.15)
Run Code Online (Sandbox Code Playgroud)

javascript random

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

pixi.js:如何在网站flashvhtml.com上完成滚动?

如何在flashvhtml.com上创建页面滚动?如何通过顶部的链接触发滚动以及其他"子动画"事件如何与滚动背景相关联?

animation pixi.js

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