目前我们的Ops团队必须重新打包我们使用特定于实例的配置发布的war文件.他们要求我们将配置文件(log4j.properties,environment.properties,jrf.properties,quartz.properties)外部化为war文件.这将使部署更容易.
我们在Tomcat 7中使用Tomcat 7和VirtualWebappLoader看起来像是一个非常酷的功能,可以在war文件之外外化配置.
Tomcat的6文件明确指出,"这并不意味着用于生产,其意在缓和与IDE的开发,而无需完全重新发布在WEB-INF/lib目录罐子"?
Tomcat 7文档没有这么说.
是否可以在生产环境中使用VirtualWebappLoader功能?
谢谢,Ashish
http://tomcat.apache.org/tomcat-7.0-doc/config/context.html#Virtual_webapp
http://tomcat.apache.org/tomcat-7.0-doc/api/org/apache/catalina/loader/VirtualWebappLoader.html
我正在学习Go.
我的程序应该从stdin读取数据,直到我输入一个句点的行.
package main
import (
"os"
"fmt"
"bufio"
)
func main(){
in := bufio.NewReader(os.Stdin)
input := ""
for input != "." {
input, err := in.ReadString('\n')
if err != nil {
panic(err)
}
}
}
Run Code Online (Sandbox Code Playgroud)
我应该如何修改for循环,以便在输入单个点时停止程序?
我尝试使用for语句实现while循环,我的方法有问题,条件是错误的,还是ReadString搞乱了我的数据?
有人可以解释我有什么不同的赌注.Encoding.UTF8.GetBytes和UTF8Encoding.Default.GetBytes?实际上我正在尝试将XML字符串转换为流对象,现在发生的是每当我使用这一行时:
MemoryStream stream = new MemoryStream(UTF8Encoding.Default.GetBytes(xml));
Run Code Online (Sandbox Code Playgroud)
它给我一个错误"System.Xml.XmlException:给定编码中的无效字符"
但是,当我使用这一行时它工作正常:
**MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(xml));**
Run Code Online (Sandbox Code Playgroud)
尽管在两种情况下它似乎都是UTF8编码,但是其中一种方式不起作用?
在页面加载时,我有一个调用服务的控制器,然后将返回的数据绑定到某些$ scope.objects:
app.controller("MainController", function($scope, $http, serviceGetData) {
serviceGetData.getData(function(data) {
$scope.LoginCount = data.LoginCount;
$scope.ProductInfo = data.ProductInfo;
$scope.ProfileInfo = data.ProfileInfo;
// Delayed binding
$scope.OrderHistory = { History: [] };
}
$scope.populateModel = function(model, values) {
var isArray = $.isArray(values);
$.each(values, function(key, value) {
if (isArray) {
key = this.key;
value = this.value;
}
if (model[key] !== value) {
model[key] = value;
}
});
};
}
Run Code Online (Sandbox Code Playgroud)
在我的HTML中,我尝试通过以下方式绑定$ scope.OrderHistory:
<h1><a href="#" ng-click="populateModel(OrderHistory , { History: OrderEntries })" >View order details</a></h1>
Run Code Online (Sandbox Code Playgroud)
这在笔记本电脑/台式机上观看时很好,但在平板电脑和移动设备(如iphone/ipad)中无法正常工作
我需要为在Action委托中调用的方法获取MethodInfo以便检查Action中调用的方法是否具有MyCustomAttibute
public void Foo( Action action )
{
if(Attribute.GetCustomAttributes(action.Method, typeof(MyCustomAttribute)).Count() == 0)
{
throw new ArgumentException("Invalid action");
}
}
Run Code Online (Sandbox Code Playgroud)
应该能够调用Foo方法如下:
Foo(() =>
{
instanceOfFooClass.Method1().Method2();
});
Run Code Online (Sandbox Code Playgroud)
在Foo方法中,我想确保Method1和Method2具有MyCustomAttribute.但是action.Method给了我MethodInfo,这是委托的动作,当使用lambda表达式时会发生.有没有办法获得Method1和Method2 MethodInfo?
我有变数 WCHAR sDisplayName[1024];
如何检查是否sDisplayName包含字符串"example"?
我msbuild.exe用来从命令行自动化我的构建.
我执行以下步骤.
这是我的目标
第一个编译
<Target Name="BuildProjects" DependsOnTargets="BeforeBuild">
<ItemGroup>
<BuildProjectFiles Include="**\MyCompany.Project1\MyCompany.Project1.csproj" />
<BuildProjectFiles Include="**\MyCompany.Project2\MyCompany.Project2.csproj" />
<BuildProjectFiles Include="**\MyCompany.Project2\MyCompany.Project2-CE.csproj" />
... and some more
</ItemGroup>
<MSBuild Projects="@(BuildProjectFiles)" Properties="AllowUnsafeBlocks=true;Configuration=$(Configuration);OutputPath=$(MSBuildProjectDirectory)\Deploy\bin\%(BuildProjectFiles.FileName)">
<Output TaskParameter="TargetOutputs"
ItemName="BuildProjectsOutputFiles" />
</MSBuild>
</Target>
Run Code Online (Sandbox Code Playgroud)
现在是将每个已编译项目压缩到其一个文件的目标.
<Target Name="ZipProjects" DependsOnTargets="BuildProjects">
<CreateItem
Include="@(BuildProjectOutputFiles)"
AdditionalMetadata="AssemblyName=%(Filename);ProjectName=%(RelativeDir)">
<Output TaskParameter="Include" ItemName="BuildProjectsOutputFiles123"/>
</CreateItem>
<CreateItem Include="%(BuildProjectsOutputFiles123.RelativeDir)*" AdditionalMetadata="OutputFileName=$(MSBuildProjectDirectory)\Deploy\dist\$(Configuration)\%(BuildProjectsOutputFiles123.AssemblyName)-$(MajorNumber).$(MinorNumber).$(ReleaseNumber).zip;WorkingDirectory=%(BuildProjectsOutputFiles123.RelativeDir)">
<Output TaskParameter="Include" ItemName="BuildProjectsOutputFiles456"/>
</CreateItem>
<Zip Files="@(BuildProjectsOutputFiles456)"
WorkingDirectory="%(BuildProjectsOutputFiles456.WorkingDirectory)"
ZipFileName="%(BuildProjectOutputFiles456.OutputFileName)" />
<!-- ZipLevel="9"/> -->
</Target>
Run Code Online (Sandbox Code Playgroud)
所以会发生的是我指定的每个项目BuildProjectFiles都被编译到文件夹中<rootdir>\deploy\bin\<name of the csproj file without extension\
在第二步中,我使用MSBuild.Community.TasksZip-Task压缩每个项目并将其复制到<rootdir>\deploy\dist\release\<assemblyname>-<version>.zip
所以基本上程序集project1.exe及其依赖项project1-2.4.7.zip …
我正在使用带有appengine的谷歌云sql.
com.google.apphosting.api.ApiProxy$RequestTooLargeException: The request to API call datastore_v3.Put() was too large.尽管我没有使用Datasotre API ,但我得到了.
我认为根据文档https://developers.google.com/appengine/docs/java/cloud-sql/developers-guide#access_limits,数据大小限制是在60秒内提供16MB.
我的数据大小约为1 MB,我的响应肯定不到1分钟.如果我尝试使用较小的数据,一切正常.
那么,为什么会抛出异常呢?问题是什么 ?这是谷歌应用引擎中的错误吗?或者是否有尺寸限制,在哪里记录?或者是什么 ?
我正在使用iTextSharp从图像生成pdf-a文档.到目前为止,我还没有成功.
编辑:我正在使用iTextSharp生成PDF
我所做的就是用一些图像制作一个pdf文件(1a或1b,无论适合什么).这是我到目前为止提出的代码,但是当我尝试使用pdf-tools或validatepdfa验证它们时,我一直遇到错误.
这是我从pdf-tools获得的错误(使用PDF/A-1b验证): 编辑:MarkInfo和Color Space尚未运行.剩下的还可以
Validating file "0.pdf" for conformance level pdfa-1a
The key MarkInfo is required but missing.
A device-specific color space (DeviceRGB) without an appropriate output intent is used.
The document does not conform to the requested standard.
The document contains device-specific color spaces.
The document doesn't provide appropriate logical structure information.
Done.
Run Code Online (Sandbox Code Playgroud)
主流
var output = new MemoryStream();
using (var iccProfileStream = new FileStream("ToPdfConverter/ColorProfiles/sRGB_v4_ICC_preference_displayclass.icc", FileMode.Open))
{
var document = new Document(new Rectangle(PageSize.A4.Width, …Run Code Online (Sandbox Code Playgroud) 我有2个应用程序,program.exe和updater.exe,都是用Delphi5编写的.程序在没有admin-rights(并且没有manifest)的情况下运行,updater有一个带有"requireAdministrator"的清单,因为他必须能够在Program-Folder中写入以更新program.exe.
问题是启动更新程序,让他等到程序关闭.我在网上找到了不同的方式,但都没有用(大多数情况下,第一个应用程序启动第二个应用程序并等待第二个应用程序的结束,在我的情况下,第二个应用程序应该等待第一个应用程序的结束).
更新程序应该等待,这很容易
updater.exe
{$R manifest.res}
label.caption:='Wait for program.exe closing';
repeat
sleep(1000);
until File is not open
ProgramHandle := Read Handle from File
WaitForSingleObject(ProgramHandle,INFINITE);
label.caption:='program.exe CLOSED';
Do updates
Run Code Online (Sandbox Code Playgroud)
方法1
使用CreateProcess启动更新程序:
program.exe
FillChar(siInfo, SizeOf(siInfo), 0);
siInfo.cb := SizeOf(siInfo);
saProcessAttributes.nLength := SizeOf(saProcessAttributes);
saProcessAttributes.lpSecurityDescriptor := nil;
saProcessAttributes.bInheritHandle := TRUE;
saThreadAttributes.nLength := SizeOf(saThreadAttributes);
saThreadAttributes.lpSecurityDescriptor := nil;
saThreadAttributes.bInheritHandle := True;
if CreateProcess(nil,
PChar('updater.exe'),
@saProcessAttributes,
@saThreadAttributes,
TRUE, NORMAL_PRIORITY_CLASS, nil,
PChar(ExtractFilePath(Application.ExeName)),
siInfo, piInfo) then
begin
DuplicateHandle(GetCurrentProcess, GetCurrentProcess,
piInfo.hProcess, @MyHandle,
PROCESS_QUERY_INFORMATION, TRUE,
DUPLICATE_SAME_ACCESS) then
Write MyHandle in a …Run Code Online (Sandbox Code Playgroud) delphi createprocess handle waitforsingleobject shellexecuteex