问题列表 - 第43250页

具有数据源部署的Tomcat 6 webapp

在开发环境和生产环境中使用数据源部署应用程序的最佳方法是什么?

建议使用META-INF/context.xml指定Tomcat上下文,但我不明白如何在context.xml中指定数据源:

  1. 将数据库密码放在context.xml中是不安全的,所有人都可以查看;

  2. 如何为生产和开发模式维护两个不同的数据源?

你怎么解决这个问题?

tomcat datasource context.xml

6
推荐指数
2
解决办法
2314
查看次数

具有正确重力和单线的提示和文本视图

我已经打开了一个错误,但我想知道是否有人遇到过这个问题,并且知道一个解决方法.如果你定义一个带有提示的文本视图,给它正确的重力(android:gravity ="right")然后如果你定义android:singleLine = true或android:maxLines ="1"或android:scrollHorizo​​natally ="true"你没有看到提示.移除正确的重力将提示返回到左侧,移除上面提到的所有树参数将提示放在右侧.我希望我的提示在右边,但我需要一条水平线......

这是不显示提示的示例布局:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:padding="5dp">
            <EditText android:layout_width="fill_parent"
                android:layout_gravity="center_vertical|right"
                android:layout_height="wrap_content"
                android:layout_margin="6dp"
                android:textSize="16sp"
                android:paddingRight="5dp"
                android:id="@+id/c"
                android:gravity="right"
                android:hint="hello!!!"
                android:scrollHorizontally="true"
                android:maxLines="1"
                android:singleLine="true"/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

我检查了1.6和2.1模拟器,它再现100%,我是prettysure它是一个错误,我没有看到单行和提示之间的连接....更多的提示得到它自己的TextView布局(如果文本长度为0,则在onDraw中存在mLayout和mHintLayout,如果mHint不为null则使用mHintLayout).

android hint textview

8
推荐指数
2
解决办法
1万
查看次数

ASP.Net repeater item.DataItem为null

在网页中,在加载时,我用两个表填充数据集,其中包含这些表之间的关系,然后将数据加载到具有嵌套转发器的转发器中.用户单击按钮后也会发生这种情况.数据从SQL数据库加载,并且在回发后将转发器数据源设置为数据集.但是,当ItemDataBound发生时,Item.Dataitem始终为null.

为什么会这样?

这是数据绑定代码:

        this.rptCustomSpaList.DataSource = ds;
        this.rptCustomSpaList.DataBind();
Run Code Online (Sandbox Code Playgroud)

这是ItemDataBound代码:

        RepeaterItem item = e.Item; 

        Repeater ChildRepeater = (Repeater)item.FindControl("rptCustomSpaItem");
        DataRowView dv = e.Item.DataItem as DataRowView;
        ChildRepeater.DataSource = dv.CreateChildView("sparelation");
        ChildRepeater.DataBind();
Run Code Online (Sandbox Code Playgroud)

下面是我的HTML转发器代码

<asp:Repeater ID="rptCustomSpaList" runat="server" 
 onitemdatabound="rptCustomSpaList_ItemDataBound">
    <HeaderTemplate></HeaderTemplate>
    <ItemTemplate>
        <table>
            <tr>
                <td><asp:Label ID="Label3" runat="server" Text="Spa Series:"></asp:Label></td>
                <td><asp:Label ID="Label4" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "SPASERIESVALUE") %>'></asp:Label></td>
            </tr>
            <tr>
                <td><asp:Label ID="Label5" runat="server" Text="Spa Model:"></asp:Label></td>
                <td><asp:Label ID="Label6" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "SPAMODELVALUE") %>'></asp:Label></td>
            </tr>
            <tr>
                <td><asp:Label ID="Label9" runat="server" Text="Acrylic Color:"></asp:Label></td>
               <td><asp:Label ID="Label10" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "ACRYLICCOLORVALUE") %>'></asp:Label></td>
            </tr>
            <tr>
  <td>
   <asp:Label ID="Label11" runat="server" Text="Cabinet Color:"></asp:Label> …
Run Code Online (Sandbox Code Playgroud)

asp.net null repeater dataitem

4
推荐指数
1
解决办法
2万
查看次数

WP7 - 尝试在代码隐藏中选择和使用应用程序静态资源不起作用(找不到资源)

在Windows Phone 7中,我试图在代码隐藏中动态添加控件和对象,并将StaticResource应用于新控件.

Xaml文件样本:

<phone:PhoneApplicationPage.Resources>
  <ControlTemplate x:Key="PushpinControlTemplateBlue" TargetType="my2:Pushpin">
  ...
  </ControlTemplate>
</phone:PhoneApplicationPage.Resources>
Run Code Online (Sandbox Code Playgroud)

Codebehind示例:

>Pushpin myPush = new Pushpin();
>myPush.Location = new GeoCoordinate(52.569593, -0.9261151403188705);
>myPush.Content = "";
>myPush.Template = (ControlTemplate)Application.Current.Resources["PushpinControlTemplateBlue"];
>mapMain.Children.Add(myPush);
Run Code Online (Sandbox Code Playgroud)

当我调试并查看"Application.Current.Resources"时,集合中没有项目,因此该项目被添加到控件列表中,但由于没有内容而未显示.

有什么简单的我做错了吗?如何正确访问资源?

windows-phone-7

1
推荐指数
1
解决办法
2432
查看次数

WCF:无法调用自己的WCF服务

我有我的WCF服务,我已经从MSTest项目创建了它的引用.以下是我如何调用服务方法的示例:

IEnrollmentService serviceClient = ChannelFactory<IEnrollmentService>
    .CreateChannel(new BasicHttpBinding(),
                   new EndpointAddress("http://localhost/EnrollmentService.svc"));

PublishResult res = serviceClient.PublishEnrollmentProfile(...);
Run Code Online (Sandbox Code Playgroud)

而不是执行我有以下错误:

内容类型application/xml; 响应消息的charset = utf-8与绑定的内容类型不匹配(text/xml; charset = utf-8).如果使用自定义编码器,请确保正确实现IsContentTypeSupported方法.响应的前710个字节是:__CODE__由于EndpointDispatcher上的ContractFilter不匹配,无法在接收方处理"带有Action的消息".这可能是由于合同不匹配(发送方与接收方之间的操作不匹配)或发送方与接收方之间的绑定/安全性不匹配.检查发件人和收件人是否具有相同的合同和相同的绑定(包括安全要求,例如消息,传输,无).---> System.Net.WebException:远程服务器返回错误:(500)内部服务器错误..

据我所知,ContractFilter和EndpointDispatcher之间存在一些问题.我曾试图改善,但发现没什么可以理解的......

我也试过用另一种方式调用wcf服务方法:

EnrollmentServiceClient serviceClient = new EnrollmentServiceClient("http://localhost/EnrollmentService.svc");

PublishResult res = serviceClient.PublishEnrollmentProfile(...);
Run Code Online (Sandbox Code Playgroud)

这又回来了另一个错误:

找不到名为" http://localhost/McActivation/EnrollmentService.svc "的端点元素,并在ServiceModel客户端配置部分中收缩"EnrollmentServiceReference.IEnrollmentService".这可能是因为没有为您的应用程序找到配置文件,或者因为在客户端元素中找不到与此名称匹配的端点元素.

问题1:

什么是实例化wcf服务客户端的正确方法?

Questions2:

我的情况有什么问题?

非常感谢.

PS有些问题我可以使用WcfTestClient连接到服务,更多细节在这里: WCF服务:不能通过'WebHttpBinding'端点调用方法

PPS这是服务器端WCF服务配置:

<system.serviceModel>
<services>
  <service name="McActivationApp.EnrollmentService" behaviorConfiguration="McActivationApp.EnrollmentServicBehavior">
    <endpoint address="" binding="webHttpBinding" contract="McActivationApp.IEnrollmentService"/>
    <endpoint address="mex" binding="mexHttpBinding" contract="McActivationApp.IEnrollmentService" />
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="McActivationApp.EnrollmentServicBehavior">
      <serviceMetadata httpGetEnabled="True"/>
      <serviceDebug includeExceptionDetailInFaults="False" />
    </behavior>
  </serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
</system.serviceModel>
Run Code Online (Sandbox Code Playgroud)

.net wcf wcfserviceclient

4
推荐指数
1
解决办法
4728
查看次数

if(mask&VALUE)或if((mask&VALUE)== VALUE)?

您可能熟悉enum位掩码方案,例如:

enum Flags {
    FLAG1 = 0x1,
    FLAG2 = 0x2,
    FLAG3 = 0x4,
    FLAG4 = 0x8,

    NO_FLAGS = 0,
    ALL_FLAGS = FLAG1 | FLAG2 | FLAG3 | FLAG4
};

f(FLAG2 | FLAG4);
Run Code Online (Sandbox Code Playgroud)

我已经看过很多代码,然后在掩码中测试一下

if ((mask & FLAG3) == FLAG3)
Run Code Online (Sandbox Code Playgroud)

但这不等于这个吗?

if (mask & FLAG3)
Run Code Online (Sandbox Code Playgroud)

有没有理由使用第一个版本?在我看来,第二个较短的版本更清晰.

也许C程序员的剩余习惯应该转换为真正的价值观1?(即使在那里,较长的版本在赋值或return语句中比在条件语句测试中更有意义.)

c++ bitmask

36
推荐指数
1
解决办法
3万
查看次数

从一个单词中获取一封信

a = ['cat','dog']

random.choice(a)
Run Code Online (Sandbox Code Playgroud)

我怎样才能选择一个随机单词并拔出一个字母?我已经搜索和试验了诸如此类但无法找到答案的内容.谢谢.

我不想要一个随机的字母,例如我希望它选择一个单词,cat.然后我希望有人猜猜ca或t.有点像刽子手

python

0
推荐指数
2
解决办法
2493
查看次数

我想有效地将​​正则表达式应用于整个文件

我有一个复杂的正则表达式,我想将它与整个巨大文件的内容相匹配.主要关注的是效率,因为文件确实非常大并且内存不足是一种明显的可能性.

有没有办法我可以通过正则表达式匹配器以某种方式"缓冲"内容?

java regex

7
推荐指数
1
解决办法
2363
查看次数

如何为用户实现有限的功能部署(语言不可知)?

我想了解一些将新网站功能推广到用户群的选定组的常见或最佳实践.

例如,用户可能仅基于总体用户群的百分比(10%).部署应该是可自定义的(可配置的)并支持任意数量的功能.将转出关联到特定用户角色或特权(ACL)也很有用.

那么,从本质上讲,什么是可以合理扩展的架构?

至于语言不可知部分,您可以提供伪代码,一般概念或想法,或者使用您首选语言的片段来表达您的观点.

欢迎链接到任何示例或教程.

deployment user-experience rollout limited-user

20
推荐指数
2
解决办法
1618
查看次数

自定义字体样式与图形

我有以下字体列表: 字体列表

我没有使用它们的问题

new Font("XXXX Sans", 21, FontStyle.Bold, GraphicsUnit.Pixel)
Run Code Online (Sandbox Code Playgroud)

但是,当我需要使用像光这样的非标准字体样式时,我该怎么办?所提供的只是一个枚举,这是不合适的.

.net c# windows fonts gdi+

1
推荐指数
1
解决办法
2135
查看次数