小编hil*_*arl的帖子

我忘记了在postgres安装过程中输入的密码

我忘了或错误输入(在安装过程中)密码给Postgres的默认用户.我似乎无法运行它,我收到以下错误:

psql: FATAL:  password authentication failed for user "hisham"
hisham-agil: hisham$ psql 
Run Code Online (Sandbox Code Playgroud)

是否有重置密码或如何创建具有超级用户权限的新用户?

我是Postgres的新手,刚刚第一次安装它.我正在尝试使用它与Rails,我正在运行Mac OS X Lion.

postgresql forgot-password postgresql-9.1

185
推荐指数
8
解决办法
36万
查看次数

在angular.js上使用HTML5 pushstate

我正在尝试实现html5的pushstate而不是Angularjs使用的#navigation.我试过搜索谷歌的答案,并尝试了角度irc聊天室,但没有运气.

这是我的controllers.js:

function PhoneListCtrl($scope, $http) {
    $http.get('phones/phones.json').success(function(data) {
        $scope.phones = data;
    });
}

function PhoneDetailCtrl($scope, $routeParams) {
  $scope.phoneId = $routeParams.phoneId;
}

function greetCntr($scope, $window) {
    $scope.greet = function() {
    $("#modal").slideDown();
    }
}
Run Code Online (Sandbox Code Playgroud)

app.js

angular.module('phoneapp', []).
    config(['$routeProvider', function($routeProvider){
        $routeProvider.
            when('/phones', {
                templateUrl: 'partials/phone-list.html',
                controller: PhoneListCtrl
            }).
            when('/phones/:phoneId', {
                templateUrl: 'partials/phone-detail.html',
                controller: PhoneDetailCtrl
            }).
            otherwise({
                redirectTo: '/phones'
            });
    }])
Run Code Online (Sandbox Code Playgroud)

javascript angularjs

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

传递类名以反应组件

我试图将一个类名传递给一个react组件来改变它的样式,似乎无法正常工作:

class Pill extends React.Component {

  render() {

    return (
      <button className="pill {this.props.styleName}">{this.props.children}</button>
    );
  }

}

<Pill styleName="skill">Business</Pill>
Run Code Online (Sandbox Code Playgroud)

我试图通过传递具有相应风格的类的名称来改变药丸的风格.我是React的新手,所以也许我没有以正确的方式做到这一点.谢谢

javascript reactjs

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

获取TypeError:在ReactJs上未定义this.props

我正在尝试做教程:https://facebook.github.io/react/docs/tutorial.html

import React, { PropTypes } from 'react';
import classnames from 'classnames';
import styles from './CommentBox.css';
import withStyles from '../../decorators/withStyles';
import Link from '../../utils/Link';
import $ from 'jquery';

@withStyles(styles)
class CommentBox extends React.Component {

    constructor() {
        super();
        this.state = {data: []};
    }

    loadCommentsFromServer() {
        $.ajax({
            url: this.props.url,
            dataType: 'json',
            cache: false,
            success: function(data) {
                this.setState({data: data});
            }.bind(this),
            error: function(xhr, status, err) {
                console.error(this.props.url, status, err.toString());
            }.bind(this)
        })
    }

    componentDidMount() {
        this.loadCommentsFromServer();
        setInterval(this.loadCommentsFromServer, this.props.pollInterval);
    }

    render() {

        let …
Run Code Online (Sandbox Code Playgroud)

javascript reactjs

25
推荐指数
3
解决办法
5万
查看次数

在一个滑块中创建多个范围滑动手柄

我正在尝试向jQuery UI滑块小部件添加多个句柄,如在一个滑块中的2个或3个或更多范围滑块中.

我试过在谷歌搜索并找到一篇文章,展示如何修改它有多个句柄,但我需要它们作为范围滑块.

反正有没有让这项工作?

$("#slider-range").slider({
    range: true,
    min: 0,
    max: 1439,
    values: [540, 1020],
    animate: true,
    slide: slideTime
});
Run Code Online (Sandbox Code Playgroud)

谢谢

javascript jquery jquery-ui

14
推荐指数
3
解决办法
3万
查看次数

创建一个模态窗口以使用AngularJS加载数据

我一直在尝试使用AngularJS在模态窗口中加载数据,但我不知道该怎么做.我还需要在单击链接时更改URL以及在模式窗口内加载数据而不是加载新页面.

我尝试过使用jQuery Facebox插件,但它似乎没有用,我也使用了twitter bootstrap模态组件.

以下是我的代码:

<div class="subnav span12" id="post-main-container" ng-controller="PostsController">
  <div class="btn-group pull-left span5" id="sort-nav">
    <a class="btn active">Popular</a>
    <a class="btn">Recent</a>
    <a class="btn">Favorite</a>
  </div>
  <div class="btn-group pull-right " id="view-nav">
    <a class="btn" id="2col"><i class="icon-th-large"></i></a>
    <a class="btn active" id="4col"><i class="icon-th"></i></a>
    <a class="btn" id="6col"><i class="icon-th-list"></i></a>
  </div>
  <div class="btn-group pull-right">
    <a id="reload" class="btn"><i class="icon-refresh"></i></a>
    <a class="btn"><i class="icon-random"></i></a>
  </div>
  <div class="row-fluid span12" id="img-container">
    <ul class="unstyled" id="image-container">
      <li class="post-container box2" ng-repeat="post in posts">
        <div class="post-btns" style="display:none;">
          <a class="btn btn-mini" href="#">Share</a>
          <a class="btn btn-mini" href="#">Add</a>
        </div>
        <a href="#/posts/{{post.id}}"> …
Run Code Online (Sandbox Code Playgroud)

javascript angularjs

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

更改jquery ui进度条的值

我试图更改进度条小部件的值,以接受我得到的json字符串,如下所示:

{
  'totalDays' : 31,
  'daysTaken' : 20
}
Run Code Online (Sandbox Code Playgroud)

所以我希望'totalDays'是进度条的总值(总长度)和'daysTaken'来填充进度条.

根据默认文档,只有填充值可以更改:

$(document).ready(function() {
  $("#progressbar").progressbar({ value: 37 });
});
Run Code Online (Sandbox Code Playgroud)

javascript jquery jquery-ui

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

AngularJs模板未在Internet Explorer 8中加载

我无法在Internet Explorer 8中呈现AngularJs模板,我已经遵循了几个在Internet Explorer中使用AngularJs的建议,但我仍然无法使其工作.下面是我的页面的html代码,包括我使用过的脚本.是否有可能指出我是否使用任何可能使代码无法在Internet Explorer中运行的东西?如果有人想知道其他详细信息,我可以上传其他文件的详细信息.一切都适用于所有其他浏览器,但只是Internet Explorer.

<!doctype html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html xmlns:ng="http://angularjs.org" id="ng-app" ng-app="tripApp" class="no-js"> <!--<![endif]-->
  <head>
  <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title></title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- Place favicon.ico and apple-touch-icon.png in the root directory -->

        <!-- build:css({.tmp,app}) styles/main.css -->
        <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css">
        <link href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet">
        <link rel="stylesheet" href="styles/main.css"> …
Run Code Online (Sandbox Code Playgroud)

html javascript internet-explorer angularjs angular-ui

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

得到一个错误,"错误:无法连接到服务器127.0.0.1 shell/mongo.js"&尝试在mac osx狮子上运行mongodb

我正在使用Mac OS X Lion,我刚刚使用macports进行了全新的MongoDB安装,当我第一次尝试运行mongodb时出现以下错误

MongoDB shell version: 2.0.5
connecting to: test
Fri Jun  1 11:20:33 Error: couldn't connect to server 127.0.0.1 shell/mongo.js:84
exception: connect failed
Run Code Online (Sandbox Code Playgroud)

任何人都可以帮忙吗?谢谢

当我运行mongod我得到:

hisham-agil:~ hisham$ mongod
mongod --help for help and startup options
Fri Jun  1 11:24:47 [initandlisten] MongoDB starting : pid=53452 port=27017 dbpath=/data/db/ 64-bit host=hisham-agil.local
Fri Jun  1 11:24:47 [initandlisten] db version v2.0.5, pdfile version 4.5
Fri Jun  1 11:24:47 [initandlisten] git version: nogitversion
Fri Jun  1 11:24:47 [initandlisten] build info: Darwin gamma.local 11.3.0 Darwin …
Run Code Online (Sandbox Code Playgroud)

mongodb

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

无法安装react-addons-transition-group

我在使用npm安装"react-addons-transition-group"时遇到问题.根据反应网站:

插件也已经转移到单独的包中:react-addons-clone-with-props,react-addons-create-fragment,react-addons-css-transition-group,react-addons-linked-state-mixin,react- addons-pure-render-mixin,react-addons-shallow-compare,react-addons-transition-group,react-addons-update,以及react-dom中的ReactDOM.unstable_batchedUpdates.- https://facebook.github.io/react/blog/2015/07/03/react-v0.14-beta-1.html

我试过了:

npm install react-addons-transition-group
npm install react-addons-css-transition-group
Run Code Online (Sandbox Code Playgroud)

但我得到了:

npm ERR! notarget No compatible version found: react-addons-transition-group@'*'
npm ERR! notarget Valid install targets:
npm ERR! notarget ["0.14.0-beta1","0.14.0-beta2","0.14.0-beta3","0.14.0-rc1"]
npm ERR! notarget 
npm ERR! notarget This is most likely not a problem with npm itself.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
Run Code Online (Sandbox Code Playgroud)

我在用:

"react": "^0.14.0-rc1",
"react-dom": "0.14.0-rc1"
Run Code Online (Sandbox Code Playgroud)

所以我不确定为什么它会抛出错误.0.14.0-rc1在兼容版本列表中.

我的npm版本是2.11.3,节点是0.12.7

知道是什么原因引起的吗?

javascript node.js npm reactjs

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