我使用带有而不是插入触发器的表时遇到问题.
我创建的表包含一个标识列.我需要在此表上使用而不是插入触发器.我还需要在触发器中查看新插入的标识的值,这需要在触发器中使用OUTPUT/INTO.问题是执行INSERT的客户端无法看到插入的值.
例如,我创建了一个简单的表:
CREATE TABLE [MyTable](
[MyID] [int] IDENTITY(1,1) NOT NULL,
[MyBit] [bit] NOT NULL,
CONSTRAINT [PK_MyTable_MyID] PRIMARY KEY NONCLUSTERED
(
[MyID] ASC
))
Run Code Online (Sandbox Code Playgroud)
接下来我创建一个简单而不是触发器:
create trigger [trMyTableInsert] on [MyTable] instead of insert
as
BEGIN
DECLARE @InsertedRows table( MyID int,
MyBit bit);
INSERT INTO [MyTable]
([MyBit])
OUTPUT inserted.MyID,
inserted.MyBit
INTO @InsertedRows
SELECT inserted.MyBit
FROM inserted;
-- LOGIC NOT SHOWN HERE THAT USES @InsertedRows
END;
Run Code Online (Sandbox Code Playgroud)
最后,我尝试执行插入并检索插入的值:
DECLARE @tbl TABLE (myID INT)
insert into MyTable
(MyBit)
OUTPUT inserted.MyID
INTO @tbl
VALUES (1) …Run Code Online (Sandbox Code Playgroud) 当我调用时execvp,例如execvp(echo, b),其中b是命令a的参数数组,稍后更改此数组会影响先前执行的execvp调用吗?当我尝试调用execp(echo,b)时,它最终打印出来(null)而不是b中的内容.任何人都可以指出为什么以及我必须做什么才能正确传递参数?
背景:我正在调查匿名递归,我正在接受实现前奏的挑战而不使用任何命名的递归只是为了帮助它在我的脑海中完美地存在.我还没到那里,一路上我遇到了一些无关但仍然有趣的东西.
map1 = \f -> \x -> if (tail x) == []
then [f (head x)]
else f (head x) : (map1 f (tail x))
map2 f x = if (tail x) == []
then [f (head x)]
else f (head x) : (map2 f (tail x))
map3 f (x:xs) = if xs == [] then [f x] else f x : (map3 f xs)
map4 f (x:[]) = [f x]
map4 f (x:xs) = f x : map4 f …Run Code Online (Sandbox Code Playgroud) 我需要将一些值传递给fseek()C中的方法,该值大于signed long类型的最大值(2147483647).但如果我喜欢下面结果的值是-1,这是不成功的.无论如何我能做到这一点吗?
//fp is the pointer to fopen method
unsigned long long index=2147483648;
int status = fseek(fp, index, SEEK_SET);
Run Code Online (Sandbox Code Playgroud) 好吧,也许标题有点令人困惑,但我想要做的是有这样的功能:f (a:b:c:d:is) = ...但能够参考a:b:c:d而不再写它.事实证明,我不能做类似的事情e@(a:b:c:d):is并获得预期的结果.有任何想法吗?
我试过这段代码:
D3DXMatrixRotationX(&matRotate, rx);
D3DXMatrixRotationY(&matRotate, ry);
D3DXMatrixRotationZ(&matRotate, rz);
d3ddev->SetTransform(D3DTS_WORLD, &matRotate);
Run Code Online (Sandbox Code Playgroud)
但它似乎总是只旋转最后一个旋转(Z轴).
如何同时旋转所有XYZ轴的对象?我试图找到OpenX等效的OpenX旋转:
glRotatef(rx, 1, 0, 0);
glRotatef(ry, 0, 1, 0);
glRotatef(rz, 0, 0, 1);
Run Code Online (Sandbox Code Playgroud)
编辑: 看起来我自己想通了:
D3DXMATRIX matRotateX;
D3DXMATRIX matRotateY;
D3DXMATRIX matRotateZ;
D3DXMatrixRotationX(&matRotateX, rx);
D3DXMatrixRotationY(&matRotateY, ry);
D3DXMatrixRotationZ(&matRotateZ, rz);
D3DXMATRIX matRotate = matRotateX*matRotateY*matRotateZ;
d3ddev->SetTransform(D3DTS_WORLD, &matRotate);
Run Code Online (Sandbox Code Playgroud)
如果没有,请评论.我不能把它作为答案发布,直到8个小时过去了!(需要+7声望才能做到).
这是我第一次使用 python,我一直遇到错误 183。我创建的脚本在网络中搜索所有“.py”文件并将它们复制到我的备份驱动器。请不要嘲笑我的剧本,因为这是我的第一个剧本。
有什么线索可以告诉我我在脚本中做错了什么吗?
import os
import shutil
import datetime
today = datetime.date.today()
rundate = today.strftime("%Y%m%d")
for root,dirr,filename in os.walk("p:\\"):
for files in filename:
if files.endswith(".py"):
sDir = os.path.join(root, files)
dDir = "B:\\Scripts\\20120124"
modname = rundate + '_' + files
shutil.copy(sDir, dDir)
os.rename(os.path.join(dDir, files), os.path.join(dDir, modname))
print "Renamed %s to %s in %s" % (files, modname, dDir)
Run Code Online (Sandbox Code Playgroud) 我正试图解决平衡括号问题.我不想做连续的IO,宁愿只调用getLine并解析生成的字符串.因此,解决问题的函数将处理两种不同的状态:输入字符串的未消耗部分和括号堆栈.
我想设置一些操作堆栈的函数:
type Stack = String
pop :: Stack -> (Char,Stack)
pop (x:xs) = (x,xs)
push :: Char -> Stack -> ((),Stack)
push a xs = ((),a:xs)
Run Code Online (Sandbox Code Playgroud)
如果我在州monad运营,那就好了,不过我在StateT monad运营
balanced :: StateT Stack (State String) Bool
Run Code Online (Sandbox Code Playgroud)
我知道我被告知不要在堆栈中有重复的monad.我这样做是因为我喜欢它如何简化推送和流行定义.
两个问题:
这是代码的其余部分
next :: String -> (Maybe Char,String)
next "" = (Nothing,[])
next (x:xs) = (Just x,xs)
balanced = do
c <- lift (state next)
case c of
Nothing -> return True
Just c -> if elem c open
then (push …Run Code Online (Sandbox Code Playgroud)