小编Red*_*ket的帖子

该怎么做"java.library.path中没有ocijdbc11"SQL Developer错误

我试图在我的Mac笔记本电脑(OS X 10.9.5)上的SQL Developer中创建一个TNS连接.我得到这个错误no ocijdbc11 in java.library.path我google了,发现我需要安装oracle的即时客户端.我在这里找到了实例客户端文件:

http://www.oracle.com/technetwork/topics/intel-macsoft-096467.html

这些文件只是您需要下载并提取到某处的zip文件.然后我找到了实际告诉你如何处理zip文件的说明:

https://docs.oracle.com/cd/E11882_01/install.112/e38228/inst_task.htm#BABHEBIG

说明说:

将环境变量DYLD_LIBRARY_PATHNLS_LANG环境变量设置为instantclient_11_2目录的完整路径.例如,如果您在/bin/oracle 目录中解压缩Instant Client zip文件,则将DYLD_LIBRARY_PATH环境变量设置为 /bin/oracle/instantclient_11_2.

指令没有告诉我的是如何永久设置环境变量以及如何使SQL开发人员等GUI工具可以访问环境变量.

有没有人让SQL Developer使用instantclient?

macos oracle-sqldeveloper

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

django update_or_create获取“重复的键值违反唯一约束”

也许我误解了Django的update_or_create Model方法的目的。

这是我的模特:

from django.db import models
import datetime
from vc.models import Cluster

class Vmt(models.Model):
    added = models.DateField(default=datetime.date.today, blank=True, null=True)
    creation_time = models.TextField(blank=True, null=True)
    current_pm_active = models.TextField(blank=True, null=True)     
    current_pm_total = models.TextField(blank=True, null=True)
    ... more simple fields ...
    cluster = models.ForeignKey(Cluster, null=True)


    class Meta:
        unique_together = (("cluster", "added"),)
Run Code Online (Sandbox Code Playgroud)

这是我的测试:

from django.test import TestCase
from .models import *
from vc.models import Cluster
from django.db import transaction


# Create your tests here.
class VmtModelTests(TestCase):
    def test_insert_into_VmtModel(self):
        count = Vmt.objects.count()
        self.assertEqual(count, 0)

        # create …
Run Code Online (Sandbox Code Playgroud)

django django-models django-tests

5
推荐指数
2
解决办法
4165
查看次数

npm install -g @angular/cli 因语法错误而失败

我有一个在 centos 7 容器上运行的 jenkins 工作。一旦容器启动,jenkins 作业就会运行一个脚本来执行

 npm install -g @angular/cli
Run Code Online (Sandbox Code Playgroud)

这已经工作了大约一年,但今天它开始失败:

 /usr/bin/ng -> /usr/lib/node_modules/@angular/cli/bin/ng
 > @angular/cli@8.0.4 postinstall /usr/lib/node_modules/@angular/cli
 > node ./bin/postinstall/script.js
 /usr/lib/node_modules/@angular/cli/bin/postinstall/analytics-prompt.js:8
 (async () => {
 ^
 SyntaxError: Unexpected token (
 at createScript (vm.js:56:10)
 at Object.runInThisContext (vm.js:97:10)
 at Module._compile (module.js:549:28)
 at Object.Module._extensions..js (module.js:586:10)
 at Module.load (module.js:494:32)
 at tryModuleLoad (module.js:453:12)
 at Function.Module._load (module.js:445:3)
 at Module.require (module.js:504:17)
 at require (internal/module.js:20:19)
 at Object.<anonymous> (/usr/lib/node_modules/@angular/cli/bin/postinstall/script.js:5:1)
 npm ERR! Linux 3.10.0-957.1.3.el7.x86_64
 npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "-g" "@angular/cli"
 npm ERR! node v6.16.0
 npm ERR! …
Run Code Online (Sandbox Code Playgroud)

npm angular-cli

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

我的eval是错误的还是我不理解Perl中的eq vs ==

我无法理解的eval也许我不明白eqVS ==.我有这个简短的Perl脚本:

[red@tools-dev1 ~]$ cat so.pl
#!/usr/local/bin/perl -w
use strict;

while(<DATA>) {
    chomp;
    my ($arg1, $arg2, $op ) = split /,/;
    if ( $op eq '=' ) {
        $op = 'eq';
    }
    my $cmd = "$arg1 $op $arg2";
    print "[$cmd]\n";
    my $rc = eval $cmd || 0;
    print "rc is [$rc]\n";
}

__DATA__
cat,cat,=
Run Code Online (Sandbox Code Playgroud)

当我执行它时,我得到:

[red@tools-dev1 ~]$ ./so.pl
[cat eq cat]
rc is [0]
Run Code Online (Sandbox Code Playgroud)

有人会认为你会......

[cat eq cat]
rc is [1]
Run Code Online (Sandbox Code Playgroud)

...因为"猫"等于"猫",对吧?

perl

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

是否有一个等同于android提示的CSS?

在Android布局xml文件中,可以执行以下操作...

<EditText android:id="@+id/username"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:hint="@string/username" />
<EditText android:id="@+id/password"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:inputType="textPassword"
    android:hint="@string/password" />
Run Code Online (Sandbox Code Playgroud)

这导致GUI看起来像这样: 截图

如何使用CSS为HTML表单创建相同的效果?

css android

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

为什么我的getpwent()调用返回错误的用户?

我总是忘记在Perl中如何做到这一点.这是我的脚本:

#!/usr/local/bin/perl -w
use strict;
use Data::Dumper;

my @got = getpwent();
my $username    = ${[getpwent()]}[0];

print Dumper( @got );
print "username is [$username]\n";
Run Code Online (Sandbox Code Playgroud)

......这是它产生的输出......

$VAR1 = 'root';
$VAR2 = 'xxxxxxxxxxxxxxxxxx';
$VAR3 = 0; 
$VAR4 = 0;
$VAR5 = ''; 
$VAR6 = '';
$VAR7 = 'myhost root';
$VAR8 = '/root';
$VAR9 = '/bin/bash';
username is [bin]
Run Code Online (Sandbox Code Playgroud)

...我的问题是,为什么用户名等于'bin'而不是'root'?

perl

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

为什么要把'#!Perl模块中的/ usr/bin/false`?

我正在查看CPAN Perl模块的源代码,Digest::Perl::MD5并注意到它有她的爆炸#! /usr/bin/false.这是Digest/Perl/MD5.pm...... 的前几行......

#! /usr/bin/false
#
# $Id: MD5.pm,v 1.19 2004/02/14 02:25:32 lackas Exp $
#

package Digest::Perl::MD5;
use strict;
use integer;
use Exporter;
use vars qw($VERSION @ISA @EXPORTER @EXPORT_OK);
Run Code Online (Sandbox Code Playgroud)

...为什么Digest :: Perl :: MD5的作者会使用#! /usr/bin/false?如果我的系统没有/usr/bin/false/bin/false反过来怎么办?

perl cpan

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

如何让sed做非贪婪的比赛?

我似乎无法弄清楚如何为我的bash命令行提出正确的正则表达式.这就是我在做的事情:

echo "XML-Xerces-2.7.0-0.tar.gz" | sed -e's/^\(.*\)-[0-9].*/\1/g'
Run Code Online (Sandbox Code Playgroud)

这给了我......的输出

XML-Xerces-2.7.0
Run Code Online (Sandbox Code Playgroud)

...但我希望我需要输出...

XML-Xerces
Run Code Online (Sandbox Code Playgroud)

......我猜我能做到这一点......

 echo "XML-Xerces-2.7.0-0.tar.gz" | sed -e's/^\(.*\)-[0-9].*/\1/g' | sed -e's/^\(.*\)-[0-9].*/\1/g'
Run Code Online (Sandbox Code Playgroud)

...但我想知道如何sed更好地理解正则表达式.

更新:

我试过这个......

echo "XML-Xerces-2.7.0-0.tar.gz" | sed -e's/^\([^-]*\)-[0-9].*/\1/g'
Run Code Online (Sandbox Code Playgroud)

......作为建议但是产出 XML-Xerces-2.7.0-0.tar.gz

regex bash sed

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

为什么我的 angular 组件会忽略我的 css 文件?

我有一个具有此文件结构的角度组件:

.
|____custom-d3-tree.component.css
|____custom-d3-tree.component.spec.ts
|____custom-d3-tree.component.ts
|____custom-d3-tree.module.ts
|____custom-d3-tree.service.spec.ts
|____custom-d3-tree.service.ts
|____tree.dendo.model.ts
Run Code Online (Sandbox Code Playgroud)

该文件tree.denco.model.ts定义:

export class TreeModel {
Run Code Online (Sandbox Code Playgroud)

它实现了一个 d3 树。树中的节点在其中foreignObject定义了包含订单列表的 's。这是将 foreignObject 添加到矩形节点的代码:

    nodeEnter.append('foreignObject')
      .attr('x', function(d) { if(d.data.component_type) { return 5; } return 0; })
      .attr('y', function(d) { if(d.data.component_type) { return 5; } return 0; })
      .attr('width', this.rect_width)
      .attr('height', this.rect_height)
      .style('overflow', 'auto')
      .append('xhtml')
      .style("font", "10px 'Helvetica Neue'")
      .html(function (d) {
        if( d.data.component_type ) {
          return '<div style="width: ' + (d.width - 10) + 'px; height: '
            + (d.height - …
Run Code Online (Sandbox Code Playgroud)

html javascript css d3.js angular

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

为什么我的事件桥规则不执行我的 Lambda 函数?

我正在尝试创建一个事件桥规则,该规则将每 30 分钟运行一次 Lambda 函数。我的代码基于我在 SO Use terraform to set up a lambda functiontriggered by a Scheduled event source上找到的答案

这是我的地形代码:

监控/main.tf:

...

module "cloudwatch_event_rule" {
  source = "./cloudwatch_event_rule"
  extra_tags = local.extra_tags
}

module "lambda_function" {
  source = "./lambda_functions"
  extra_tags = local.extra_tags
  alb_names = var.alb_names
  slack_webhook_url = var.slack_webhook_url
  environment_tag = local.environment_tag
}

module "cloudwatch_event_target" {
  source = "./cloudwatch_event_target"
  lambda_function_arn = module.lambda_function.detect_bad_rejects_on_alb_lambda_arn
  cloudwatch_event_rule_name = module.cloudwatch_event_rule.cloudwatch_event_rule_name
  extra_tags = local.extra_tags
}
Run Code Online (Sandbox Code Playgroud)

监控/lambda_functions/main.tf:

resource "aws_lambda_function" "detect_bad_rejects_on_alb" {
  filename         = var.filename
  function_name    = var.function_name
  role             = …
Run Code Online (Sandbox Code Playgroud)

amazon-web-services aws-lambda terraform aws-event-bridge

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