我正在实现一个插入的触发器,我正在考虑使用ORIGINAL_LOGIN函数来捕获当前正在执行的用户.我想知道使用ORIGINAL_LOGIN进行审计的利弊.在什么情况下SYSTEM_USER提供了更好的ORIGINAL_LOGIN替代方案?
我正在使用npoi来生成excel文档.我需要向单元格添加图像.使用以下代码,我可以将图像插入到我的文档中.然而,图像跨越许多细胞.我怎样才能确保图像恰好适合一次细胞.
public ActionResult NPOICreate()
{
try
{
FileStream fs = new FileStream(Server.MapPath(@"\Content\NPOITemplate.xls"), FileMode.Open, FileAccess.ReadWrite);
HSSFWorkbook templateWorkbook = new HSSFWorkbook(fs, true);
var sheet = templateWorkbook.GetSheet("Sheet1");
var patriarch = sheet.CreateDrawingPatriarch();
HSSFClientAnchor anchor;
anchor = new HSSFClientAnchor(0, 0, 0, 0, (short)4, 2, (short)6, 5);
anchor.AnchorType = 2;
var picture = patriarch.CreatePicture(anchor, LoadImage(@"D:\dev\Website/HumpbackWhale.jpg", templateWorkbook));
picture.Resize();
picture.LineStyle = HSSFPicture.LINESTYLE_DASHDOTGEL;
sheet.ForceFormulaRecalculation = true;
MemoryStream ms = new MemoryStream();
templateWorkbook.Write(ms);
TempData["Message"] = "Excel report created successfully!";
return File(ms.ToArray(), "application/vnd.ms-excel", "NPOINewFile.xls");
}
catch (Exception ex)
{ …Run Code Online (Sandbox Code Playgroud) 我有一个清理脚本,根据文件的扩展名将文件移动到适当的预设位置.
例如,扩展名为.xls的文件将移动到〜\ XLS文件夹,.sql移动到〜\ SQL等.这是我的剧本.
$dirtyfolder = "\\server\c$\Documents and Settings\user\Desktop\"
$org = "\\BACKUPS\users\"
dir $dirtyfolder -fil *.doc | mv -dest "$($org)ORG\doc"
dir $dirtyfolder -fil *.txt | mv -dest "$($org)ORG\txt"
dir $dirtyfolder -fil *.sql | mv -dest "$($org)ORG\sql"
dir $dirtyfolder -fil *.log | mv -dest "$($org)ORG\log"
dir $dirtyfolder -fil *.zip | mv -dest "$($org)ORG\zip"
dir $dirtyfolder -fil *.7z | mv -dest "$($org)ORG\zip"
dir $dirtyfolder -fil *.png | mv -dest "$($org)ORG\img"
dir $dirtyfolder -fil *.jpg | mv -dest "$($org)ORG\img"
dir $dirtyfolder -fil *.mp3 …Run Code Online (Sandbox Code Playgroud) 我目前正在研究一些脚本,这些脚本可以自动化很多东西并且中等大小.我已经开始关注某些事情,使我的脚本具有通用性和可移植性,如:
我最感兴趣的是知道是否有任何标准的脚本技术和指南,旨在使脚本开发人员生活简单.我在perl和powershell上工作,所以更受欢迎和赞赏的是更广泛的建议.
在此先感谢您的帮助.
steeluser
这是我正在做的简化版本.
我创建了一个包含公司数据的视图模型.该公司有3个地址.因此,为了聪明,我创建了一个AddressViewModel和一个_address部分.
我遇到的问题是,虽然我可以将AddressViewModel传递给partial,但它呈现的地址我现在在HTML中有重复的ID ...所以现在表单上有三个"Line1"输入字段,当然不会回复正确.
我该如何解决这个问题.是真正展平ViewModel的唯一方法,
MainAddressLine1 MailAddressLine1 BillAddressLine1
在公司视图模型?而且,如果我这样做,我还能以某种方式使用_address部分吗?
我是SQL Server的新手,我想在那里创建我的第一个表.
create table Employee
(
ID smallint not null
)
Run Code Online (Sandbox Code Playgroud)
我使用SQL Server 2008 R2和Windows身份验证.
当我执行时,它说:
CREATE TABLE permission denied in database 'master'.
Run Code Online (Sandbox Code Playgroud)
谢谢!
昨天在工作中我开始着手如何在不使用库方法的情况下对数字进行排序Array.Sort.我在时间允许的情况下上班和下班,最后能够在今天结束时提出基本的工作算法.它可能是相当愚蠢和最慢的方式,但我满足于我有一个有效的代码.
但是逻辑中有一些错误或缺失,导致输出在打印行之前挂起: Numbers Sorted. (12/17/2011 2:11:42 AM)
此延迟与阵列中元素的数量成正比.具体来说,输出只是挂在我将波浪号放在下面结果部分的位置.在明显延迟之后打印波尔德之后的内容.
以下是执行排序的代码:
while(pass != unsortedNumLen)
{
for(int i=0,j=1; i < unsortedNumLen-1 && j < unsortedNumLen; i++,j++)
{
if (unsorted[i] > unsorted[j])
{
pass = 0;
swaps++;
Console.Write("Swapping {0} and {1}:\t", unsorted[i], unsorted[j]);
tmp = unsorted[i];
unsorted[i] = unsorted[j];
unsorted[j] = tmp;
printArray(unsorted);
}
else pass++;
}
}
Run Code Online (Sandbox Code Playgroud)
结果:
Numbers unsorted. (12/17/2011 2:11:19 AM)
4 3 2 1
Swapping 4 and 3: 3 4 2 1
Swapping 4 and 2: 3 …Run Code Online (Sandbox Code Playgroud) 我有一个.ml文件,我想它的产生.cmo,.cmx,.cmi并.mli通过为最命令越好,任何人都可以帮助吗?
当我尝试创建一个webapp时,我得到了这个yeoman.
/usr/local/lib/node_modules/yo/node_modules/insight/node_modules/configstore/configstore.js:66
throw err;
^
Error: EACCES, permission denied '/root/.config/configstore/insight-yo.yml'
You don't have access to this file.
at Object.fs.openSync (fs.js:436:18)
at Object.fs.writeFileSync (fs.js:975:15)
at Object.create.all.set (/usr/local/lib/node_modules/yo/node_modules/insight/node_modules/configstore/configstore.js:56:8)
at Object.Configstore (/usr/local/lib/node_modules/yo/node_modules/insight/node_modules/configstore/configstore.js:19:11)
at new Insight (/usr/local/lib/node_modules/yo/node_modules/insight/lib/insight.js:23:34)
at process.<anonymous> (/usr/local/lib/node_modules/yo/node_modules/insight/lib/push.js:11:16)
at process.emit (events.js:98:17)
at handleMessage (child_process.js:322:10)
at Pipe.channel.onread (child_process.js:349:11)
Run Code Online (Sandbox Code Playgroud)
我用谷歌搜索,我尝试了以下的事情,但它没有帮助:
chown root /root/.config/configstore/insight-yo.yml
chown myusername /root/.config/configstore/insight-yo.yml
Run Code Online (Sandbox Code Playgroud)
安装npm-sudo-fix并运行它,但没有运气.
我在Debian Wheezy,并且有npm 1.4.4.
我试图了解async/await并编写以下控制台应用程序以下载给定URL的页面内容(基于来自dotnetperls 的httpclient示例)
什么都没有写入文件.我在这做错了什么?
static void Main()
{
AsyncExample();
}
static async void AsyncExample()
{
Task<string> task = DownloadPageAsync();
string result = await task;
WriteToFile(result, someFileName);
}
static async Task<string> DownloadPageAsync()
{
string page = "http://en.wikipedia.org/wiki/Asynchronous_I/O";
string result = string.Empty;
using(HttpClient client = new HttpClient())
using(HttpResponseMessage response = await client.GetAsync(page))
using(HttpContent content = response.Content)
{
result = await content.ReadAsStringAsync();
}
return result;
}
Run Code Online (Sandbox Code Playgroud) c# ×2
powershell ×2
sql-server ×2
.net ×1
asp.net-mvc ×1
async-await ×1
auditing ×1
compilation ×1
node.js ×1
npoi ×1
ocaml ×1
perl ×1
scripting ×1
shell ×1
sorting ×1
sql ×1
triggers ×1
viewmodel ×1
yeoman ×1