我坚持这个非常简单的脚本.它不像我期望的那样工作.
declare
st VARCHAR(1024);
begin
for x in (SELECT sequence_name FROM USER_SEQUENCES) loop
st := 'ALTER SEQUENCE ' || x.sequence_name || ' INCREMENT BY 1000';
execute immediate st;
st := 'select ' || x.sequence_name || '.nextval from dual';
execute immediate st;
st := 'ALTER SEQUENCE ' || x.sequence_name || ' INCREMENT BY 1';
execute immediate st;
end loop;
end;
/
Run Code Online (Sandbox Code Playgroud)
当我运行它时它似乎根本不起作用 - 我的所有序列都保持不变,并且它们没有被动态语句增加一千.如果我nextval在匿名阻止之前和之后检查,差异只有1,而不是1001.
如果我更换execute immediate用dbms_output.put_line,并执行生成的命令手动序列被改变,因为我想.
我错过了什么?
这是我做的:
输出:
Buildfile: C:\cygwin\home\Jean\zookeeper-3.4.6\contrib\ZooInspector\build.xml
BUILD FAILED
C:\cygwin\home\user\zookeeper-3.4.6\contrib\ZooInspector\build.xml:19: Cannot find C:\cygwin\home\user\zookeeper-3.4.6\contrib\build-contrib.xml imported from C:\cygwin\home\user\zookeeper-3.4.6\contrib\ZooInspector\build.xml
Total time: 0 seconds
Run Code Online (Sandbox Code Playgroud)
这使我没有.cmd或.sh文件来执行.为什么build-contrib.xml文件不存在?
另外,我注意到似乎有一个已编译的ZooInspector JAR文件:zookeeper-3.4.6-ZooInspector.jar.但是,尝试使用以下命令运行它也会导致失败:
$ java -cp zookeeper-3.4.6-ZooInspector.jar:lib/* org.apache.zookeeper.inspector.ZooInspector
Error: Could not find or load main class org.apache.zookeeper.inspector.ZooInspector
Run Code Online (Sandbox Code Playgroud)
这有点令人沮丧 - 设置ZooKeeper服务器很简单,但由于某种原因,我无法弄清楚如何运行这个独立的GUI.我错过了什么?
阅读文档:
del:删除目标列表会从左到右递归删除每个目标。
您能否阐明为什么此代码可以正常工作?
a = [1,2,3]
c = a[:]
del c
print a
del a[:]
print a
Run Code Online (Sandbox Code Playgroud)
打印:
[1, 2, 3]
[]
Run Code Online (Sandbox Code Playgroud)
如果切片是指向原始列表中相同元素的新列表,那么为什么删除切片的变量赋值不会使之为a空,以及为什么删除未引用的切片会删除的元素a?
UPD
# -*- coding: utf-8 -*-
a = [1,2,3]
c = a[:]
def list_info(lst):
print "list id: {}".format(id(lst))
print "list of item ids:"
for item in lst:
print "id: {}; value: {}".format(id(item), item)
print ""
list_info(a)
list_info(c)
list_info(a[:])
Run Code Online (Sandbox Code Playgroud)
印刷品:
list id: 26945296
list of item ids:
id: 23753600; value: 1
id: 23753588; value: …Run Code Online (Sandbox Code Playgroud) 这是我的程序代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace YourGold
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Welcome to YourGold App! \n------------------------");
Console.WriteLine("Inesrt your gold: ");
int gold;
while (!int.TryParse(Console.ReadLine(), out gold))
{
Console.WriteLine("Please enter a valid number for gold.");
Console.WriteLine("Inesrt your gold: ");
}
Console.WriteLine("Inesrt your time(In Hours) played: ");
float hours;
while (!float.TryParse(Console.ReadLine(), out hours))
{
Console.WriteLine("Please enter a valid number for hours.");
Console.WriteLine("Inesrt your hours played: ");
}
float time = ((int)hours) * 60 …Run Code Online (Sandbox Code Playgroud) 大家.
我想我在ruby正则表达式中缺少一些东西.
似乎我不能使用,%r/match code/s因为Ruby只有/m,这不允许我搜索我的匹配线忽略新的线符号.
我现在需要的是:
line 1 : a b c
line 2 : a b
line 3 : c
line 4 : a
line 5 : b c
Run Code Online (Sandbox Code Playgroud)
我需要在这里找到三场比赛
1. a b c
2. a b (new line) c
3. a ( new line ) b c
Run Code Online (Sandbox Code Playgroud)
这可以通过使用/ s标志来完成,但是/ s标志用于Ruby中的编码,而/ m标志只是给了我这一个与所有文本的匹配
a b c
a b ( new line ) c
a ( new line ) b c
Run Code Online (Sandbox Code Playgroud)
当我搜索这样的表达式时 %r/a.*c/m
我将不胜感激任何信息.
我已经在String类中替换了一个方法to_s,但正如我所看到的,当我运行时puts "string",ruby调用的不是to_s方法.
def add_method(cls)
cls.class_eval do
def initialize
self.new('you hacked')
end
def to_s
'you hacked'
end
end
end
add_method String
puts "zxzxzzx"
puts "zxzxzzx".to_s
Run Code Online (Sandbox Code Playgroud)
哪个输出:
>> zxzxzzx
>> you hacked
Run Code Online (Sandbox Code Playgroud)
如何替换这种隐式初始化?