小编Tam*_*mpa的帖子

使用ubuntu upstart来停止守护进程

我正在使用upstart为生成的nginx python fastcgi脚本创建一个守护进程.如果我使用下面的工作:

sudo start myserver
Run Code Online (Sandbox Code Playgroud)

什么不起作用是:

sudo stop myserver
stop: Unknown instance:
Run Code Online (Sandbox Code Playgroud)

下面是我的conf文件,其中包含停止进程的命令.我假设杀死hte proccess的命令是在停止前脚本?

#!upstart
description "myserver"
author      "Test"

start on startup
stop on shutdown
respawn
#instance

script
    export HOME="/root"

    echo $$ > /var/run/myerver.pid
    exec spawn-fcgi -d /home/ubuntu/workspace/rtbopsConfig/myserver/ -f /home/ubuntu/workspace/rtbopsConfig/myserver/index.py -a 127.0.0.1 -p 9001 >> /var/log/myserver.sys.log 2>&1
end script

pre-start script
    # Date format same as (new Date()).toISOString() for consistency
    echo "[`date -u +%Y-%m-%dT%T.%3NZ`] (sys) Starting" >> /var/log/myserver.sys.log
end script

pre-stop script
    rm /var/run/myserver.pid
    sudo kill `sudo lsof -t …
Run Code Online (Sandbox Code Playgroud)

ubuntu daemon upstart

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

我的数据库在哪里用postgres?

postgres拒绝工作.我正在使用9.2和一个新手.

我创建了一个数据库.我列出了它不在那里?没有错误!它去了哪里?有没有创造过?

postgres-# creatdb test
postgres-# \list
                                  List of databases
   Name    |  Owner   | Encoding |   Collate   |    Ctype    |   Access privileges   
-----------+----------+----------+-------------+-------------+-----------------------
 postgres  | postgres | UTF8     | en_PH.UTF-8 | en_PH.UTF-8 | 
 template0 | postgres | UTF8     | en_PH.UTF-8 | en_PH.UTF-8 | =c/postgres          +
           |          |          |             |             | postgres=CTc/postgres
 template1 | postgres | UTF8     | en_PH.UTF-8 | en_PH.UTF-8 | =c/postgres          +
           |          |          |             |             | postgres=CTc/postgres
(3 rows)

postgres-# 



postgres@ubuntu:/home/ubuntu$ psql -h 127.0.0.1 -U postgres -d test …
Run Code Online (Sandbox Code Playgroud)

postgresql-9.2

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

没有名为scipy.stats的模块 - 为什么尽管安装了scipy

如何使用python和scipy来获得一个poissio随机变量?哇..我安装scipy并根据文档我得到没有模块名为scipy.stats?我在ubuntu 12.04.所以......去看看

http://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.poisson.html

ubuntu@ubuntu:~/Downloads$ sudo apt-get install python-scipy
Reading package lists... Done
Building dependency tree       
Reading state information... Done
python-scipy is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 482 not upgraded.
ubuntu@ubuntu:~/Downloads$ python
Python 2.7.3 (default, Apr 10 2013, 06:20:15) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from scipy.stats import poisson
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named scipy.stats
Run Code Online (Sandbox Code Playgroud)

python scipy

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

cassandra -tokens和org.apache.cassandra.exceptions.ConfigurationException:对于输入字符串:

什么是与卡桑德拉的交易?

从具有2个节点的令牌工具和第二个集群上我得到以下错误.

   initial_token: 85070591730234615865843651857942052864

INFO [main] 2014-02-25 01:15:39,670 CassandraDaemon.java (line 130) Logging initialized
 INFO [main] 2014-02-25 01:15:39,716 YamlConfigurationLoader.java (line 76) Loading settings from file:/etc/cassandra/cassandra.yaml
 INFO [main] 2014-02-25 01:15:40,407 DatabaseDescriptor.java (line 141) Data files directories: [/var/lib/cassandra/data]
 INFO [main] 2014-02-25 01:15:40,408 DatabaseDescriptor.java (line 142) Commit log directory: /var/lib/cassandra/commitlog
 INFO [main] 2014-02-25 01:15:40,409 DatabaseDescriptor.java (line 182) DiskAccessMode 'auto' determined to be mmap, indexAccessMode is mmap
 INFO [main] 2014-02-25 01:15:40,409 DatabaseDescriptor.java (line 196) disk_failure_policy is stop
 INFO [main] 2014-02-25 01:15:40,417 DatabaseDescriptor.java (line 266) Global …
Run Code Online (Sandbox Code Playgroud)

cassandra

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

如何在python中不带引号转储json

这是我如何转储文件

with open('es_hosts.json', 'w') as fp:
  json.dump(','.join(host_list.keys()), fp)
Run Code Online (Sandbox Code Playgroud)

结果是

 "a,b,c"
Run Code Online (Sandbox Code Playgroud)

我想要:

 a,b,c
Run Code Online (Sandbox Code Playgroud)

谢谢

python json python-2.7

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

Typescript - 参数'u'隐式具有'any'类型

我将此代码转换为最新的Angular 2. authentication.service.ts

代码应该是什么样的?

app/auth/auth.service.ts(30,40): error TS7006: Parameter 'u' implicitly has an 'any' type.

// services/auth.service.ts
import {Injectable} from '@angular/core';
import {Router} from '@angular/router';

//http://4dev.tech/2016/03/login-screen-and-authentication-with-angular2/
//https://github.com/leonardohjines/angular2-login
export class User {
  constructor(
    public email: string,
    public password: string) { }
}

var users:any = [
  new User('admin@admin.com','adm9'),
  new User('user1@gmail.com','a23')
];

@Injectable()
export class AuthenticationService {

  constructor(
    private _router: Router){}

  logout() {
    localStorage.removeItem("user");
    this._router.navigate(['Login']);
  }

  login(user:any){
    var authenticatedUser = users.find(u => u.email === user.email);
    if (authenticatedUser){
      localStorage.setItem("user", authenticatedUser);
      this._router.navigate(['Home']);      
      return true;
    } …
Run Code Online (Sandbox Code Playgroud)

typescript angular

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

angular2不会根据true或false条件禁用输入

我有一个基于以下输入框:

如果更改收音机,我会看到该值对于false更改为true:

<pre> {{model_parameters_general.estimationmethod=='ew'}} </pre>
Run Code Online (Sandbox Code Playgroud)

那么哇为什么输入框会因为false而被禁用?

<input [disabled]="model_parameters_general.estimationmethod=='ew'" [(ngModel)]="model_parameters_general.lambda" 
                           formControlName="lambda" type="text" class="form-control">
Run Code Online (Sandbox Code Playgroud)

编辑:

在日志中,我得到了这个:

It looks like you're using the disabled attribute with a reactive form directive. If you set disabled to true
      when you set up this control in your component class, the disabled attribute will actually be set in the DOM for
      you. We recommend using this approach to avoid 'changed after checked' errors.

  Example: 
  form = new FormGroup({
    first: new FormControl({value: 'Nancy', disabled: true}, Validators.required),
    last: new …
Run Code Online (Sandbox Code Playgroud)

angular

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

新的angular2 karma测试 - 将app.module添加到TestBed.configureTestingModule

我正在使用angular-cli with angular2 v4.0 with angular material.

伙计......所有的错误都是什么?我正在努力学习业力,如果我运行npm测试,我会得到34个与材料相关的失败...例如

Can't bind to 'routerLinkActive' since it isn't a known property of 'a'
Can't bind to 'md-menu-trigger-for' since it isn't a known property of 'button'
Can't bind to 'md-menu-trigger-for' since it isn't a known property of 'button'

If 'md-menu' is an Angular component, then verify that it is part of this module.
Run Code Online (Sandbox Code Playgroud)

等等

如何使角度物质与业力相得益彰?

我的应用程序工作正常,但如果达到业力......将是一场彻底的灾难.

谢谢

编辑:

我有很多!app.module.ts文件中的@NgModule中的声明,entryComponents,导入和提供程序.看来我必须在我的dashboard.component.spec.ts文件中添加每一个.我一个接一个地添加,并没有变得愚蠢.我真的不想添加不相关的组件.我怎样才能导入app.module.ts文件?我有50多个要导入...

这是我得到的错误类型:

Failed: Uncaught (in promise): Error: Component BlankComponent is not part of any NgModule or …
Run Code Online (Sandbox Code Playgroud)

karma-jasmine angular

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

使用提交按钮时不要使用CanDeactivate保护

这是我的canDeactivate防护装置,它有效。但是,当我使用“提交”按钮时,我不想叫守卫。仅当我通过任何其他方式导航时。怎么样?

import { Injectable } from '@angular/core';
import { Router, CanDeactivate } from '@angular/router';
import { FormGroup } from '@angular/forms';

export interface FormComponent {
    myForm: FormGroup;
}

@Injectable()
export class DirtyGuard implements CanDeactivate<FormComponent>  {
  constructor(private router: Router) {}

  canDeactivate(component: FormComponent) {
      console.log(component.myForm)
        if (component.myForm.dirty ){
            return confirm('You have unsaved changes. Are you sure you want to navigate away?');
        }
        return true;
  }
}

 <button md-raised-button [disabled]="!myForm.valid" type="submit" color="primary">
                            <i class="material-icons">arrow_forward</i>
                            Exposures: Currencies
                        </button>
Run Code Online (Sandbox Code Playgroud)

angular

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

chef - STDERR:python_package资源需要pip> = 6.1.0,目前是10.0.0

我正在尝试引导服务器.我曾经使用"recipe [poise-python]"来推送安装包.现在我得到以下错误.如何修复?

* python_package[setuptools] action upgrade

    ================================================================================
    Error executing action `upgrade` on resource 'python_package[setuptools]'
    ================================================================================

    Mixlib::ShellOut::ShellCommandFailed
    ------------------------------------
    Expected process to exit with [0], but received '1'
    ---- Begin output of ["/usr/bin/python", "-", "setuptools"] ----
    STDOUT: 
    STDERR: The python_package resource requires pip >= 6.1.0, currently 10.0.0
    ---- End output of ["/usr/bin/python", "-", "setuptools"] ----
    Ran ["/usr/bin/python", "-", "setuptools"] returned 1

    Cookbook Trace:
    ---------------
    /var/chef/cache/cookbooks/poise-languages/files/halite_gem/poise_languages/command/mixin.rb:207:in `tap'
    /var/chef/cache/cookbooks/poise-languages/files/halite_gem/poise_languages/command/mixin.rb:207:in `language_command_shell_out!'
    /var/chef/cache/cookbooks/poise-languages/files/halite_gem/poise_languages/command/mixin.rb:222:in `block in language_command_mixin'
    /var/chef/cache/cookbooks/poise-python/files/halite_gem/poise_python/resources/python_package.rb:317:in `pip_command'
    /var/chef/cache/cookbooks/poise-python/files/halite_gem/poise_python/resources/python_package.rb:341:in `pip_outdated'
    /var/chef/cache/cookbooks/poise-python/files/halite_gem/poise_python/resources/python_package.rb:209:in `check_package_versions'
    /var/chef/cache/cookbooks/poise-python/files/halite_gem/poise_python/resources/python_package.rb:189:in `load_current_resource'

    Resource Declaration: …
Run Code Online (Sandbox Code Playgroud)

chef-infra chef-recipe chef-solo

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