我正在尝试将我的node.js应用程序停靠.构建容器时,我希望它运行一个git clone然后启动节点服务器.因此,我将这些操作放在.sh脚本中.并在ENTRYPOINT中将脚本作为单个命令运行:
FROM ubuntu:14.04
RUN apt-get update && apt-get install -y build-essential libssl-dev gcc curl npm git
#install gcc 4.9
RUN apt-get install -y software-properties-common python-software-properties
RUN add-apt-repository -y ppa:ubuntu-toolchain-r/test
RUN apt-get update
RUN apt-get install -y libstdc++-4.9-dev
#install newst nodejs
RUN curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
RUN apt-get install -y nodejs
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
ADD package.json /usr/src/app/
RUN npm install
ADD docker-entrypoint.sh /usr/src/app/
EXPOSE 8080
ENTRYPOINT ["/usr/src/app/docker-entrypoint.sh"]
Run Code Online (Sandbox Code Playgroud)
我的docker-entrypoint.sh看起来像这样:
git clone git@<repo>.git …Run Code Online (Sandbox Code Playgroud) 假设我有一个类型为Mailtype的打字稿对象,如下所示:
export class Mailtype {
constructor(
public name?: string,
public locale?: string,
public email?: string,
public properties? : Property[]
) { }
}
Run Code Online (Sandbox Code Playgroud)
其"属性"字段是属性类型的数组:
export class Property {
constructor(
public name?: string,
public type?: string,
public example?: string,
public required?: boolean,
public masked?: boolean
) { }
}
Run Code Online (Sandbox Code Playgroud)
现在在我的组件中我有一个Mailtype对象,html有一个表单元素,用于编辑和添加到Mailtype的属性数组:
<form>
<tr *ngFor="let property of model.properties; let i=index">
<td>
<input type="text" [(ngModel)]="property.name" required>
</td>
</tr>
<button (click)="onAddProperty()">Add property</button>
</form>
Run Code Online (Sandbox Code Playgroud)
零件:
export class MailtypeComponent {
model : Mailtype;
constructor() {
this.model = …Run Code Online (Sandbox Code Playgroud) 我正在创建一个需要使用python2.7.6的Django应用。我的系统已安装python3.4.1,因此我必须使用安装了python2.7的virtualenv。我使用Pycharm安装了一个virtualenv,并将其命名为django_python_2.7,但是当我在终端中将其激活并运行“ python”时,它仍然表明它正在使用系统的python3.4.1:这是我所做的:
激活环境:
source django_python_2.7/bin/activate
运行python,它显示:
Python 3.4.1 (v3.4.1:c0e311e010fc, May 18 2014, 00:54:21) --->这是系统级别的python,而不是virtualenv中安装的一个
但是,当我运行时which python,它显示了指向virtualenv的python版本的正确路径:
/Users/calvinmwhu/....../django_python_2.7/bin/python
Run Code Online (Sandbox Code Playgroud)
当我显式运行该virtualenv中安装的python版本时:
django_python_2.7/bin/python
Run Code Online (Sandbox Code Playgroud)
它显示正确的版本:
Python 2.7.6 (default, Sep 9 2014, 15:04:36)
Run Code Online (Sandbox Code Playgroud)
我不知道是怎么回事。我正在Pycharm IDE中开发此应用程序,但我真的很喜欢在终端中执行命令。但是在终端中,virtualenv没有使用正确版本的python。为什么为什么在virtualenv中运行简单的“ python”命令仍然默认为系统的python?
有人可以提供一些提示吗?是否有必要更改PATH变量以使其包含virtualenv的python的路径?
我正在 Visual Studio 2013 中编写一个简单的多媒体应用程序,我需要枚举连接到我的计算机的相机设备并创建一个媒体源对象以链接到其中之一。我使用 Media Foundation SDK 并尝试在此处运行指南:https://msdn.microsoft.com/en-us/library/windows/desktop/dd940326(v =vs.85) .aspx :
#include <Mfapi.h>
#include <mfidl.h>
#include <mfobjects.h>
#include <iostream>
#pragma comment(lib, "Mfplat")
#pragma comment(lib, "Mf")
template <class T> void SafeRelease(T **ppT) {
if (*ppT) {
(*ppT)->Release();
*ppT = NULL;
}
}
HRESULT CreateVideoDeviceSource(IMFMediaSource **ppSource) {
*ppSource = NULL;
IMFMediaSource *pSource = NULL;
IMFAttributes *pAttributes = NULL;
IMFActivate **ppDevices = NULL;
// Create an attribute store to specify the enumeration parameters.
HRESULT hr = MFCreateAttributes(&pAttributes, 1);
if (FAILED(hr))
{ …Run Code Online (Sandbox Code Playgroud) 我有一个关于COM智能指针类的用法的问题CComPtr.我下面从一个实例文档,它似乎代码不调用CoCreateInstance()上CComPtr(它只是分配给它的值之前声明它).
所以我写了一个这样的测试程序:
#include "stdafx.h"
#include "atlbase.h"
#include <iostream>
int _tmain(int argc, _TCHAR* argv[])
{
CComPtr<int> myint = nullptr;
if (myint == nullptr) {
std::cout << "yes" << std::endl;
}
return 0;
}
Run Code Online (Sandbox Code Playgroud)
它在visual-studio 2013中出现以下错误:
------ Build started: Project: ConsoleApplication2, Configuration: Debug Win32 ------
ConsoleApplication2.cpp
c:\program files (x86)\microsoft visual studio 12.0\vc\atlmfc\include\atlcomcli.h(177): error C2227: left of '->Release' must point to class/struct/union/generic type
type is 'int *'
c:\program files (x86)\microsoft visual studio 12.0\vc\atlmfc\include\atlcomcli.h(175) : … c++ ×2
angular ×1
bash ×1
com ×1
docker ×1
python ×1
python-2.7 ×1
shell ×1
typescript ×1
virtualenv ×1