这是我的情况.项目的目标是将一些附件迁移到另一个系统.
这些附件将位于父文件夹中,让我们说" Folder 0"(请参阅此问题的图表以便更好地理解),它们将被压缩/压缩.
我希望像这样调用我的批处理脚本:
BatchScript.bat "c:\temp\usd\Folder 0"
Run Code Online (Sandbox Code Playgroud)
我正在使用7za.exe命令行提取工具.
我希望我的批处理脚本要做的是遍历Folder 0""的子文件夹,并将所有包含的ZIP文件解压缩到各自的文件夹中.
提取的文件必须与各自的ZIP文件位于同一文件夹中.因此," File 1.zip"中包含" "中包含的文件Folder 1,等等.
我已经阅读了关于FOR...DO命令的内容Windows XP Professional Product Documentation - Using Batch Files.
这是我的脚本:
@ECHO OFF
FOR /D %folder IN (%%rootFolderCmdLnParam) DO
FOR %zippedFile IN (*.zip) DO 7za.exe e %zippedFile
Run Code Online (Sandbox Code Playgroud)
我想我还需要在调用7za.exe e%zippedFile进行文件提取之前更改实际目录,但我无法弄清楚如何在这个批处理文件中(通过我知道如何在命令行中,即使我知道它是相同的指令"cd").
编辑#1
我已经收到了关于ServerFault同一问题的一些提示.请在此链接中查看答案.
但是,它从根(C :)中提取,而不是从参数文件夹中的给定中提取.
有人有想法吗?
编辑#2
似乎批处理脚本不能充分处理包含空格字符的文件夹和文件名.谁能证实我的想法?
编辑#3
我需要它完全递归,因为我不知道将使用它的目录结构.
编辑#4.a
有了@ aphoria的解决方案,我几乎就在那里!唯一的问题是,它需要说
File5.zip,只检索文件名获取File5,创建一个子文件夹File5并提取 …
摘要
我将数据上下文中的城市加载到两个不同的列表中,并将它们绑定到各自的DropDownList控件.
虽然两者的代码相同,但只有数据和显然控件的名称不同,数据绑定似乎不适用于其中一个.它不显示城市名称,而是显示其ID,即仅用于第一个选项!
代码隐藏
我们有两个DropDownList控件:
DestinationDropDownList;OriginDropDownList.然后,我填充他们.
public partial class MyControl : UserControl {
protected void Page_Load(object sender, EventArgs e) {
if (!IsPostBack) {
var instruction = new City() {
CityId = Guid.Empty,
CityName = "- Select a city -"
};
var destinations = context.Cities.ToList();
destinations = destinations.OrderBy(c => c.CityName).ToList();
destinations.Insert(0, instruction);
DestinationDropDownList.DataSource = destinations;
DestinationDropDownList.DataTextField = "CityName";
DestinationDropDownList.DataValueField = "CityId";
DestinationDropDownList.DataBind();
var origins = context.Cities.ToList();
origins = origins.OrderBy(c => c.CityName).ToList();
origins.Insert(0, instruction);
OriginDropDownList.DataSource = origins;
OriginDropDownList.DataTextField …Run Code Online (Sandbox Code Playgroud) 在我正在研究的项目中,当我在Ninject上拍摄时,我最近遇到了一堵砖墙.
我经历了各种各样的问题,系统地要求我的设计和架构,以支持依赖注入.
经过几个小时,几个小时和几个小时的搜索,我看到Justin Etheredge撰写的文章,他谈到了他的静态DIFactory课程.
我现在想知道,是不是使用静态DI工厂让事情变得像魔术一样?
我想听听在实际应用中使用静态DI工厂的优缺点.
此外,IoC和DI是相同的,还是它们非常相似,虽然有些不同?
我正在构建VBNET 2.0中的Active Directory包装器(以后不能使用.NET),其中包含以下内容:
这些接口在内部类(VBNET中的Friend)中实现,因此我想实现一个façade,以便将每个接口与其内部类一起发送.这将使架构具有更好的灵活性等.
现在,我想在同一解决方案中的不同项目中测试这些类(Utilisateur,Groupe,UniteOrganisation).但是,这些类是内部的.我希望能够在不经过我的外观的情况下实例化它们,但仅限于这些测试,仅此而已.
这是一段代码来说明它:
public static class DirectoryFacade {
public static IGroupe CreerGroupe() {
return new Groupe();
}
}
// Then in code, I would write something alike:
public partial class MainForm : Form {
public MainForm() {
IGroupe g = DirectoryFacade.CreerGroupe();
// Doing stuff with instance here...
}
}
// My sample interface:
public interface IGroupe {
string Domaine { get; set; }
IList<IUtilisateur> Membres { get; }
}
internal class Groupe : IGroupe …Run Code Online (Sandbox Code Playgroud) 我希望熟悉最近发布的.NET Framework 4.0及其版本Covariance and Contravariance in Generics.
即使我已经阅读了引用链接中的内容,但我无法理解它应该如何使用,何时不应该使用.
我们赞赏一个简短的解释和一个简单的真实世界的代码示例.
谢谢!=)
将ObjectiveC类绑定到C#问题
monotouch项目描述了如何绑定Objective-C类型以与MonoTouch一起使用.我们没有为AdMob库执行此操作(另请参阅sabonrai dot wordpress dot com上的monotouch-binding-for-admob博客.
所以我们决定创建尽可能小的测试项目.我们用两个简单的方法编写了一个简单的objc类,一个返回一个字符串,另一个返回一个整数.
这是TstLib.h:
#import <Cocoa/Cocoa.h>
@interface TstCls : NSObject {
}
- (NSString *) Version;
- (int) GimmeAnInt;
@end
Run Code Online (Sandbox Code Playgroud)
和TstLib.m文件:
#import "TstCls.h"
@implementation TstCls
- (NSString *) Version {
return @"I ain't got a version, I'm a poor lonesome cowboy...";
}
- (int) GimmeAnInt {
return 110646;
}
@end
Run Code Online (Sandbox Code Playgroud)
我们有一个小的objc控制台项目来验证这个库.这是代码:
#import <Cocoa/Cocoa.h>
#import "../TstLib/TstCls.h"
int main(int argc, char *argv[])
{
TstCls* tstCls = [[TstCls alloc] init];
NSLog(@"version = %@", [tstCls Version]); …Run Code Online (Sandbox Code Playgroud) 我写了一些单元测试,这取决于配置文件.这file.config将部署到bin\Debug我的测试项目的目录中.但是,它似乎没有被复制到测试实际发生的输出测试结果目录中.
我搜索并发现了这些:
TFS UnitTesting在构建服务器测试项目和配置文件时没有部署本地副本程序集来测试目录
第一个链接让我了解如何将配置文件部署到我的测试项目bin\Debug目录中.
第二个提出了一个可行的解决方案,虽然我发现它对我的需求有点过分,更不用说我自己添加了一个类来测试等等.所以,我更喜欢一种更简单的方法,它可以让我拥有这个配置文件自动复制到我的测试结果目录中.
编辑#1
我正在使用:
我的配置文件如下所示:
<configuration>
<configSections>
<section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</configSections>
<dataConfiguration defaultDatabase="Tests" />
<connectionStrings>
<add name="Tests" connectionString="Database=Tests;Server=(local)\SQLEXPRESS;Integrated Security=SSPI"
providerName="System.Data.SqlClient" />
</connectionStrings>
</configuration>
Run Code Online (Sandbox Code Playgroud)
并命名为:Tests.config.
现在,我的项目设置包含一个DefaultSource参数,该参数包含默认的源名称,即为其创建连接和数据库对象的参数.此设置的值为Tests.
所以,当我创建一个新连接时,我只是这样做:
public static IDbConnection CreateConnection(string source) {
return new DatabaseProviderFactory(new FileConfigurationSource(
string.Format("{0}\{1}.config", AppDomain.CurrentDomain.BaseDirectory, source)
).CreateDefault().CreateConnection();
}
Run Code Online (Sandbox Code Playgroud)
现在,由于AppDomain.CurrentDomain.Basedirectory返回的值,在单元测试时这是不能正常工作的.由于此属性不会返回程序集构建目录 …
我不知道这是否与许多人遇到的错误相同:
如何修复:未捕获的类型错误:$(...).summernote 不是函数 #2087
jquery: Uncaught TypeError: $(...).error 不是函数
但我就像鞋底下的口香糖一样被它卡住了。
这是我的 Chrome 开发人员工具上的实际错误。
我只想从具有此 @ 符号错误的旧版本更新 Summernote。
不能使用 AltGr + @ 组合或 Ctrl + Alt +@Combination 写 @ #1406
但是,对于 0.8.0 的较新版本,似乎 $(...).code() 函数不再可用。任何人都知道我应该带来哪些改变才能使其发挥作用?
无论我是否使用XTextFormatter,我都得到关于LayoutRectangle的高度为0或类似的错误.
new PdfSharp.Drawing.Layout.XTextFormatter(_gfx).DrawString(text
, new PdfSharp.Drawing.XFont(fontName, fontSize, (PdfSharp.Drawing.XFontStyle)fontStyle)
, new PdfSharp.Drawing.XSolidBrush(PdfSharp.Drawing.XColor.FromArgb(foreColour))
, new PdfSharp.Drawing.XRect(new PdfSharp.Drawing.XPoint(xPos, yPos), new PdfSharp.Drawing.XPoint(xLimit, yLimit))
, PdfSharp.Drawing.XStringFormats.Default);
Run Code Online (Sandbox Code Playgroud)
fontStyle的类型为System.Drawing.FontStyle foreColour的类型为System.Drawing.Color我已经从PdfPage预定义_gfx,Orientation = Landscape,Size = Letter xPos和yPos是double类型的参数,与xLimit和yLimit相同.
我得到运行时错误,LayoutRectangle的高度必须为零(0)...
根据定义,矩形意味着具有高度,否则称为线!我不明白!...
我直接尝试使用XGraphics.DrawString()方法,我得到了同样的错误.似乎我不能使用LayoutRectangle,但必须手动管理文本适合所需区域.
var textFont = new PdfSharp.Drawing.XFont(fontName, fontSize, (PdfSharp.Drawing.XFontStyle)fontStyle);
while (xPos + _gfx.MeasureString(text, textFont).Width > xLimit)
textFont = new PdfSharp.Drawing.XFont(fontName, --fontSize, (PdfSharp.Drawing.XFontStyle)fontStyle);
while (yPos + _gfx.MeasureString(text, textFont).Height > yLimit && fontSize > 0)
textFont = …Run Code Online (Sandbox Code Playgroud) c# ×3
.net-4.0 ×2
c#-4.0 ×2
unit-testing ×2
.net ×1
.net-2.0 ×1
7zip ×1
admob ×1
architecture ×1
asp.net ×1
batch-file ×1
covariance ×1
data-binding ×1
dos ×1
drawstring ×1
extract ×1
generics ×1
internals ×1
iphone ×1
javascript ×1
jquery ×1
layout ×1
objective-c ×1
pdf ×1
pdfsharp ×1
summernote ×1
testing ×1
tuples ×1
vb.net ×1
vb.net-2010 ×1
webforms ×1
xamarin.ios ×1