我目前正在尝试使用ASP.Net配置文件来存储有关在我们网站上注册的用户的其他用户信息.
相关示例代码:
UserProfile.cs
public class UserProfile: System.Web.Profile.ProfileBase
{
public static UserProfile GetUserProfile(string username)
{
return Create(username) as UserProfile;
}
public static UserProfile GetUserProfile()
{
return GetUserProfile(Membership.GetUser().UserName);
}
public string FacebookUid
{
get
{
return base["FacebookUid"] as string;
}
set
{
base["FacebookUid"] = value;
}
}
}
Run Code Online (Sandbox Code Playgroud)
Web.config文件
<profile enabled="true" inherits="WIF.Web.STS.Classes.UserProfile" defaultProvider="XmlProfileProvider" >
<properties>
<add name="FacebookUid" />
</properties>
<providers>
<add name="XmlProfileProvider" type="Artem.Web.Security.XmlProfileProvider, Artem.Web.Security.Xml" applicationName="/" fileName="Profiles.xml" folder="~/App_Data/"/>
</providers>
</profile>
Run Code Online (Sandbox Code Playgroud)
Register.aspx.cs
profile = WIF.Web.STS.Classes.UserProfile.GetUserProfile(emailAddress);
profile.FacebookUid = "";
Run Code Online (Sandbox Code Playgroud)
当我离开web.config中定义的FacebookUid时; 我从web.config收到此错误:
Configuration Error: This profile …Run Code Online (Sandbox Code Playgroud) 我在父pom.xmlSpring支持中激活使用
<activation>
<file>
<exists>src/main/resources/*beans.xml</exists>
</file>
</activation>
Run Code Online (Sandbox Code Playgroud)
这很好用.
当我尝试使用时激活配置文件中的CucumberJVM内容
<activation>
<file>
<exists>src/test/resources/**/*.feature</exists>
</file>
</activation>
Run Code Online (Sandbox Code Playgroud)
然而,这拒绝工作.所以我猜**在这种情况下会忽略通配符.
这是正常的,是否有解决方法在.feature文件存在时激活此配置文件?
我有一个mavenized Android应用程序,客户希望在构建时支持皮肤.
例如:mvn clean install -P Developer,mvn clean install -P Customer1,mvn clean install -P Customer2
换句话说,不同的客户需要一点点不同的图像集,不同的字符串(appName,版权等),而且,布局中的一些元素应该被隐藏或显示(开发者配置文件),因此也有不同的布局.
我的第一个想法是将res-customer1,res-customer2等文件夹与标准res目录并行执行,并在pom.xml中执行swap配置文件定义,并将其重命名为res,但这似乎不起作用.我总是将原始res文件夹放入构建中,在这种情况下,重复错误.
这是否意味着应该在res内部进行交换?我没有在android maven插件的配置中指定resourceDirectory.
我一直在谷歌搜索,但到目前为止,我没有发现任何人有同样的问题.怎么解决?这有什么一般模式吗?
提前谢谢了
我有2个配置文件的maven pom:dev和production
我的项目中有一些xml文件.例如persistence.xml.开发和生产环境的设置不同
我需要一种在开发和生产程序集中拥有正确文件的方法
也许可以拥有每个xml文件的2个副本并将其放入程序集中?或者也许可以在xml文件中使用pom文件中的设置?
还有其他想法或最佳做法吗?
用户配置文件是否适合存储在选定的自定义网格用户中每页的项目数等内容?(我可以将它存储在视图中,但不是每个用户都这样).
我的第一个问题是将这些设置存储在用户配置文件中,但是以编程方式创建用户配置文件属性的访问权限存在问题,要么必须在SSP中为每个用户提供"管理员用户配置文件"权限,要么必须运行应用程序域用户下的池,而不是NETWORK SERVICE.这两种情况对我来说都是不现实的,所以我现在正在寻找另一种存储这种"每用户"设置的方法.
谢谢!
编辑:我现在正在考虑使用附加数据库来存储用户属性的ASP.NET配置文件机制.
给定三个 POM 文件:
下面包含完整的源代码和构建输出供您查看。
这是 A 的 POM:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.foo</groupId>
<artifactId>A</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<name>A</name>
<repositories>
<repository>
<id>foo releases</id>
<name>libs-releases-local</name>
<layout>default</layout>
<url>http://foo.net/artifactory/libs-releases-local</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.eclipse.swt</groupId>
<artifactId>swt</artifactId>
<classifier>${swt.classifier}</classifier>
<version>3.6.1</version>
</dependency>
</dependencies>
<profiles>
<profile>
<id>windows-x86</id>
<properties>
<swt.classifier>win32-x86</swt.classifier>
</properties>
</profile>
</profiles>
</project>
Run Code Online (Sandbox Code Playgroud)
这是 B 的 POM:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.foo</groupId>
<artifactId>A</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../A</relativePath>
</parent>
<artifactId>B</artifactId>
<packaging>jar</packaging>
<name>B</name>
<profiles>
<profile>
<id>windows-x86</id>
<properties>
<swt.classifier>win32-x86</swt.classifier>
</properties>
</profile> …Run Code Online (Sandbox Code Playgroud) 我正在开发一个需要用户表的快速项目,并且希望他们能够存储配置文件数据。当我意识到用户将永远只有一个配置文件时,我已经接触到ASP.NET配置文件提供程序。
我意识到,频繁更改的数据会影响诸如索引和内容之类的性能,但是太频繁了又太频繁了?
如果我每个月每个用户要更改1000个用户的个人资料,那么很多吗?
还是我们说的更像是用户每小时更改一次个人资料数据?
我意识到这不是一门精确的科学,但是我正在尝试确定阈值在何时达到峰值,并且由于我的用户个人资料数据可能很少改变,如果我应该费心额外的工作或仅等待几十年的时间成为一个问题。
我有一个 Maven 项目 - 它是 jenkins 的插件。它的父级应该是:
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>1.414</version>
</parent>
Run Code Online (Sandbox Code Playgroud)
但同时这个插件也可以用于hudson,无需更改任何代码行。但它的父项目应该是:
<parent>
<groupId>org.jvnet.hudson.plugins</groupId>
<artifactId>hudson-plugin-parent</artifactId>
<version>2.0.1</version>
</parent>
Run Code Online (Sandbox Code Playgroud)
我可以为此指定 2 个不同的配置文件并使用它们相应地为 jenkins 或 hudson 构建插件吗?所以我这样称呼:
mvn package -P jenkins
Run Code Online (Sandbox Code Playgroud)
或者
mvn package -P hudson
Run Code Online (Sandbox Code Playgroud)
我尝试在配置文件中指定属性,但这些属性不会被<parent>标记内的值替换。那么是否有其他可能性为两者构建插件,但使用尽可能多的通用代码和文件?
补充:那么,如果我不能这样做,我该怎么办?如何重构?新的结构应该是什么样的?
我有一个带子模块的项目a:jar,需要一组不同的依赖项,具体取决于它编译的平台.所有平台的代码都是相同的.例如,在Android上,httpcomponents库已经与操作系统捆绑在一起,而我必须将其包含在J2SE环境的构建中.我还有另一个子模块,它将几个子模块及其依赖项组装到一个存档中.如何可靠地配置程序集子模块,获取为各个平台编译的所有子模块及其适用于该平台的依赖项?
我尝试使用配置文件来创建a:jar:android和a:jar:j2se.但是,声明对其中一个的依赖会导致程序集中出现奇怪的依赖关系.即,dependency:tree汇编项目有时会包含依赖关系a:jar:j2se(无论我是否声明在组件中使用a:jar:androidor a:jar:j2se),有时还包括另一个.在我更新a本地存储库中的jar后,它经常更改.切换装配项目还使用配置文件.
我可以通过将相同的依赖项应用于各个子模块配置文件所需的程序集项目的配置文件来解决这个问题.但是,由于我必须在POM中重复自己,所以可能还有更多的方法来实现这一目标.因为我对maven很新,我想知道它是什么?我不想复制代码(因为代码保持不变会更加重复)并且我不喜欢复制POM的部分因为版本升级而改变它们会变得复杂.
一些具体材料:来自a:jarPOM的依赖:
<dependencies>
.....
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>4.0.1</version>
<scope>compile</scope>
<!-- Exclusion in the common part, they are provided in the profiles from different sources -->
<exclusions>
<exclusion>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</exclusion>
....
</exclusions>
</dependency>
</dependencies>
<profiles>
<profile>
<id>android</id>
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>1.6_r2</version>
<scope>provided</scope>
</dependency>
</dependencies>
</profile>
<profile>
<id>java</id>
<dependencies>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.0.1</version>
<scope>compile</scope>
</dependency>
<dependency> …Run Code Online (Sandbox Code Playgroud) 我正在寻找一种以编程方式在jetty中设置spring配置文件的方法,以便服务器上的war文件使用给定配置文件的应用程序,这是我的代码:
final WebAppContext context = new WebAppContext();
context.setLogUrlOnStart(true);
context.setWar("target/deployables/myapp-rest/myapp-rest.war");
context.setContextPath("/" + TEST_APP_CONTEXT);
context.setParentLoaderPriority(true);
server.setHandler(context);
server.start();
Run Code Online (Sandbox Code Playgroud)
我尝试了几件事,但似乎都没有工作......我需要通过 -Dspring.profiles.active=myProfile