小编Rad*_*FID的帖子

在Ubuntu Zesty 17.04上安装Node 6.9

我想安装的最新版本NodeJSUbuntu Zesty 17.04.但无论是使用apt-get还是尝试从nodesource ppa下载它,我总是拥有版本4.7.2.

apt-get的

sudo apt-get update
sudo apt-get install nodejs npm
Run Code Online (Sandbox Code Playgroud)

节点PPA

curl -sL https://deb.nodesource.com/setup_6.x | sudo bash -
sudo apt-get update
apt-get install nodejs npm
Run Code Online (Sandbox Code Playgroud)

结果

$> node -v
v4.7.2
Run Code Online (Sandbox Code Playgroud)

我怎样才能获得NodeJS的6.9版本?

javascript ubuntu node.js npm angular-cli

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

Spring启动yml ResourceBundle文件

我正在使用MessageSourceSpring从.properties类路径中的文件加载错误消息.我的属性尊重某个"模板",例如{Object}.{field}.{unrespectedConstraint}:

userRegistrationDto.password.Size= Le mot de passe doit avoir au minimum 6 caractères.
userRegistrationDto.email.ValidEmail= Merci de saisir une addresse mail valide.
Run Code Online (Sandbox Code Playgroud)

在重构的情况下(例如,更改类的名称),我必须在几个地方更改我的属性文件.

有没有办法使用yaml文件(messages.yml)作为ResourceBundle来获取类似的东西:

userRegistrationDto:
  password:
    Size: Le mot de passe doit avoir au minimum 6 caractères.
  email:
    ValidEmail: Merci de saisir une addresse mail valide.
Run Code Online (Sandbox Code Playgroud)

spring resourcebundle properties-file spring-boot

11
推荐指数
2
解决办法
4333
查看次数

Angular 2(Angular-cli):未捕获的ReferenceError:未定义google

我一直在努力尝试在我使用的Angular 2项目中制作googlemaps 工作几个小时.PlaceResultAngular-cli

我必须googlemaps使用@types 进行安装并将其添加到配置文件的属性"types"tsconfig.json.

{
    ...
    "types": [
      "google-maps"
    ]
  }
}
Run Code Online (Sandbox Code Playgroud)

google.maps.places.PlaceResult只需导入它即可成功使用我的Angular 2 Component!

import { ActivatedRoute, Params } from "@angular/router";
import { MapsAPILoader } from "angular2-google-maps/core";

import PlaceResult = google.maps.places.PlaceResult;
import GeocoderRequest = google.maps.GeocoderRequest;
...
Run Code Online (Sandbox Code Playgroud)

几个小时之后,我不得不一起工作google.maps.Marker,它与PlaceResult和的定义文件相同GeocoderRequest.所以我只需将其导入如下:

[Line 12] import PlaceResult = google.maps.places.PlaceResult;
[Line 13] import GeocoderRequest = google.maps.GeocoderRequest;
[Line 14] import Marker = google.maps.Marker;
[Line 15] import LatLng = google.maps.LatLng; …
Run Code Online (Sandbox Code Playgroud)

google-maps typescript angular-cli angular2-google-maps angular

10
推荐指数
1
解决办法
9485
查看次数

ImportError:没有名为'paramiko'的模块

我已经在网上完成了其他问题,我觉得我的不同,足以保证一个新的问题.

所以我有一个Centos 6 box,为我运行一个小网站,充当办公室git服务器,我正在尝试配置Python3它.

所以我按照以下步骤python3在服务器上进行了设置.但似乎我无法将paramiko导入我的脚本.

我下载了paramiko rpm然而我得到这条消息:

当我尝试导入paramiko时,我得到:

[root@GIT Python-3.4.2]# rpm -ivh /usr/lib/Python-3.4.2/Modules/python-paramiko-1.7.5-2.1.el6.noarch.rpm
Preparing...                ########################################### [100%]
package python-paramiko-1.7.5-2.1.el6.noarch is already installed
Run Code Online (Sandbox Code Playgroud)

当我直接运行python3时:

[root@GIT inserv_health_check]# python3
Python 3.4.2 (default, Jan 21 2015, 06:28:04)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-11)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import paramiko
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'paramiko'
>>>
Run Code Online (Sandbox Code Playgroud)

我确信这个问题有一个简单的解决方案,也许路径是错误的,或者我应该在某个地方放置一个符号链接.任何帮助,将不胜感激 :)

在有人询问之前,哪个python输出:

[root@GIT …
Run Code Online (Sandbox Code Playgroud)

python paramiko python-3.x

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

Ansible:在模块“copy”中使用正则表达式

上下文

我正在尝试构建一个continuous-integration平台,并在 a 中Ansible playbook使用maven-dependency-plugin:get来从masterNexus上的a 下载工件,该工件将使用module部署在远程服务器上。Ansiblecopy

为了制作一个轻量级和通用的剧本,我定义了一个名为的变量app_version,如果定义了,我下载给定的版本,如果没有,我从存储库下载最新版本Nexus。工件下载到给定目录 ( /tmp/delivery/) 中。在我的Ansible任务下面:

- hosts: local
  tasks:
    - name: "Downloading the war"
      shell: >
           mvn org.apache.maven.plugins:maven-dependency-plugin:2.10:get -DgroupId=App-DartifactId=App-Dversion={{ app_version if app_version is defined else 'LATEST' }} -Dpackaging=war -DrepositoryId=my-nexus -Ddest=/tmp/delivery/
Run Code Online (Sandbox Code Playgroud)


我的问题

为了确保剧本的通用性,我需要在Ansible模块中编写一个正则表达式copy来选择具有该模式的工件,app*.war但该模块似乎不提供此功能。在我的复制任务下方:

- hosts: agir
  tasks:
    - name: "Copying the war"
      copy: src=/tmp/delivery/app*.war dest=/folder/app.war  owner=user group=group mode=0755
Run Code Online (Sandbox Code Playgroud)

如何在模块中使用正则表达式copy …

continuous-integration ansible ansible-playbook ansible-1.x

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

Angular:指定路由器插座上的相对导航

我有以下Angular Route配置

const appRoutes: Routes = [
    {
      path: '',
      component: DirectoryComponent
    },
    {
      path: 'manage/:type/:id',
      component: ManageComponent,
      outlet: 'manage',
      children: [
        {
          path: '',
          component: PreviewComponent,
          pathMatch: 'full'
        },
        {
          path: 'add/:elementType',
          component: EditComponent,
        }
      ]
    }
  ];
Run Code Online (Sandbox Code Playgroud)

ManageComponent是一个沙箱组件PreviewComponent,EditComponent将在其中呈现.

用户用例重定向http://localhost:4200/#/(manage:manage/bar/12762)与预览组件匹配的用户.一切都还可以.

PreviewComponent当上一个按钮,用户点击,我希望做一个相对导航的EditComponent有,当导航结束,http://localhost:4200/#/(manage:manage/bar/12762/add/foo)

我试过了

this.router.navigate([{outlets: {manage: ['add', 'foo']}}],{relativeTo: this.route});
Run Code Online (Sandbox Code Playgroud)

this.router.navigate([{outlets: {manage: ['add', 'foo']}}]);
Run Code Online (Sandbox Code Playgroud)

但每次,用户都被重定向到http://localhost:4200/#/add/foo.

我该怎么做这个导航?

router-outlet angular angular-router

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

Angular 5:请求不同布局的多种语言

我有Angular 5一个默认语言法语的应用程序.我必须添加需要更改全局布局的阿拉伯语(必须从右到左显示内容......).

我想知道是否有一种方法只使用一个组件并进行条件模板选择.例如 :

--my-compenent_ar.html
--my-compenent_fr.html
--my-component.ts

And in my @Component({
    moduleId: module.id,
    templateUrl: ==> condition here
    styleUrls: ['./sign-in.component.scss']
})
export class MyComponent
Run Code Online (Sandbox Code Playgroud)

当前版本的Angular(5)本身不支持这种情况.

有什么好办法吗?


我想要做的是

--my-compenent_ar.html
--my-compenent_fr.html
--my-component.ts
--my-component.ar.ts

@Component({
    moduleId: module.id,
    templateUrl: './my-compenent_fr.html'
    styleUrls: ['./sign-in.component.scss']
})
export class MyComponent {
....
}

@Component({
    moduleId: module.id,
    templateUrl: './my-compenent_ar.html'
    styleUrls: ['./sign-in.component.scss']
})
export class MyComponentAR extends MyComponent {}
Run Code Online (Sandbox Code Playgroud)

使用此配置,FR语言环境将导航到MyComponent并定位ARMyComponentAR.

这很冗长.你有干净的方法吗?

locale angular-template angular

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

Angular 与 Domino 的通用:获取“instanceof”的右侧不是一个对象

我正在使用 Angular Universal 和 domino 在 Express 服务器上“伪造”DOM 服务器端。一切都工作正常,直到出现npm cache clean --force,然后出现 anpm install

\n\n

我收到以下错误:

\n\n
/path/to/app/src/gui/dist/server/server.js:2378\n */(s),2))[0],l=i[1]),this.engine.listen(this.namespaceId,a,s,l,function(e){var t=e._data||-1;o.factory.scheduleListenerCallback(t,n,e)})}return this.delegate.listen(e,t,n)},t}(h);var g=function(e){function t(t,n,r){return e.call(this,t.body,n,r)||this}return Object(r.c)(t,e),t=Object(r.b)([Object(i.Injectable)(),Object(r.e)(0,Object(i.Inject)(l.DOCUMENT)),Object(r.d)("design:paramtypes",[Object,s.AnimationDriver,s["\xc9\xb5AnimationStyleNormalizer"]])],t)}(s["\xc9\xb5AnimationEngine"]);function v(){return Object(s["\xc9\xb5supportsWebAnimations"])()?new s["\xc9\xb5WebAnimationsDriver"]:new s["\xc9\xb5CssKeyframesDriver"]}function y(){return new s["\xc9\xb5WebAnimationsStyleNormalizer"]}function b(e,t,n){return new f(e,t,n)}var w=new i.InjectionToken("AnimationModuleType"),_=[{provide:a.AnimationBuilder,useClass:u},{provide:s["\xc9\xb5AnimationStyleNormalizer"],useFactory:y},{provide:s["\xc9\xb5AnimationEngine"],useClass:g},{provide:i.RendererFactory2\n\nTypeError: Right-hand side of \'instanceof\' is not an object\n    at bt (/path/to/app/src/gui/dist/server/server.js:2378:180688)\n    at yt (/path/to/app/src/gui/dist/server/server.js:2378:180563)\n    at ir (/path/to/app/src/gui/dist/server/server.js:2378:203358)\n    at We.insertToken (/path/to/app/src/gui/dist/server/server.js:2378:179949)\n    at /path/to/app/src/gui/dist/server/server.js:2378:183251\n    at kt (/path/to/app/src/gui/dist/server/server.js:2378:183266)\n    at Xe (/path/to/app/src/gui/dist/server/server.js:2378:178211)\n    at Object.parse (/path/to/app/src/gui/dist/server/server.js:2378:177177)\n    at Object.t.createDocument (/path/to/app/src/gui/dist/server/server.js:2833:9750)\n    at Object.t.createWindow (/path/to/app/src/gui/dist/server/server.js:2833:10129)\n
Run Code Online (Sandbox Code Playgroud)\n\n

错误发生在domino的HTMLParser.js中,第2177行,位于以下几行:

\n\n …

javascript webpack angular-universal angular

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

如果Dto使用MapStruct具有ID,则将dto映射到从数据库检索到的实体

我正在使用MapStruct进行dto <-> entity映射。相同的映射器用于从dto 创建 更新实体。完成dto的id验证以了解是否必须创建一个新实体(id == null)还是应该从数据库中检索它(id!= null)。

我实际上正在使用MapperDecorator作为解决方法。范例:

映射器

@Mapper
@DecoratedWith(UserAccountDecorator.class)
public interface UserAccountMapper {

    UserAccountDto map(User user);

    User map(UserAccountDto dto);

    User map(UserAccountDto dto, @MappingTarget User user);
}
Run Code Online (Sandbox Code Playgroud)

装饰器

public abstract class UserAccountDecorator implements UserAccountMapper {

    @Autowired
    @Qualifier("delegate")
    private UserAccountMapper delegate;

    @Autowired
    private UserRepository userRepository;

    @Override
    public User map(UserAccountDto dto) {
        if (dto == null) {
            return null;
        }

        User user = new User();
        if (dto.getId() != null) {
            user = …
Run Code Online (Sandbox Code Playgroud)

java mapping data-transfer-objects mapstruct

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

Mapstruct :使用 annotationProcessorPaths 在 intelliJ 中生成源

我使用EclipseIDE 开发了一个使用的应用程序,Mapstruct我现在正在IntelliJ继续开发。

在 Eclipse 上一切正常,但由于使用了annotationProcessorPaths.

我的配置如下:

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
    <annotationProcessorPaths>
        <path>
            <groupId>org.mapstruct</groupId>
            <artifactId>mapstruct-processor</artifactId>
            <version>${mapstruct.version}</version>
        </path>
    </annotationProcessorPaths>
    <source>${java.version}</source>
    <target>${java.version}</target>
    <compilerArgs>
        <compilerArg>
            -Amapstruct.defaultComponentModel=${mapstruct.defaultComponentModel}
        </compilerArg>
        <compilerArg>
            -Aorg.hibernate.jpamodelgen.JPAMetaModelEntityProcessor
        </compilerArg>
    </compilerArgs>
</configuration>
Run Code Online (Sandbox Code Playgroud)

在 IntelliJ 上,当我启动 Maven 全新安装时,我得到了生成的源代码:

@Component

public class FieldMapperImpl implements FieldMapper {

    @Autowired

    private FieldMapperResolver fieldMapperResolver;

...
}
Run Code Online (Sandbox Code Playgroud)

但是当我运行/调试我的 Spring Boot 应用程序时,我得到的生成源是:

public class FieldMapperImpl implements FieldMapper {

    private final FieldMapperResolver fieldMapperResolver = new FieldMapperResolver();
    ...
    }
Run Code Online (Sandbox Code Playgroud)

我怎么解决这个问题 ?

intellij-idea maven annotation-processing mapstruct

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