问题列表 - 第47774页

划分SQL Server

在SQL Server 2005 Express中,结果如下

SELECT 100/15 - 结果6

但我想得到近似值7(就像使用计算器)

100/15 = 6.6666 ..

如何在SQL Server中创建它?

sql-server-2005 divide

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

android webview是否支持html5视频播放?

可能重复:
WebView和HTML5 <video>

嗨任何人都可以告诉我android webview是否支持html5视频播放?如果是,你能告诉我怎么样?

android

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

在非交互式运行时,PsExec卡在许可证提示上

我有一个Hudson构建脚本调用SysInternals PsExec实用程序.通常,当给定用户第一次运行PsExec时,它会弹出一个对话框,要求用户接受许可.构建代理作为服务运行,我可以看到构建卡在PsExec上.Process Explorer显示PsExec正在运行,因此我强烈怀疑它正在显示相同的提示,但由于它以非交互方式运行,因此无法接受提示.有没有办法解决这个愚蠢的限制?在Windows Server 2008 R2 x64上运行.

windows-services psexec sysinternals

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

jquery选择器,用于获取所选的特定值的所有选择下拉列表

如何使用jQuery选择器选择所有选择框,其中选择的值为"A1"?

样品选择框:

<select name="accesslevel">
<option value="A1">A1 Access</option>
<option value="A2">A2 Access</option>
</select>
Run Code Online (Sandbox Code Playgroud)

我必须使用选择器来执行以下操作:

.parent().nextAll('td[id^="A1Access"]').show();
.parent().nextAll('td[id^="A2Access"]').hide();
Run Code Online (Sandbox Code Playgroud)

有人可以帮忙吗?

html jquery jquery-selectors

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

是否可以在运行时更改Android中的布局宽度和高度?

我有两个相对布局.两者都具有填充父级的宽度和100个倾角的高度.我的要求是,当我点击第一个布局时,它应缩小到50dip高度,另一个扩展到150dip高度.这样做我得到了例外.请帮我如何在运行时更改布局宽度和高度.

    final LinearLayout RLChange = new LinearLayout(this);        
    RLChange.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,
                                             LayoutParams.FILL_PARENT)); 
    RLChange.setOrientation(LinearLayout.VERTICAL);

    final LinearLayout RLGreen = new LinearLayout(this);        
    RLGreen.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,
                                             300));
    RLGreen.setBackgroundColor(Color.GREEN);
    RLGreen.setOrientation(LinearLayout.HORIZONTAL);

    Button btnClick = new Button(this);        
    btnClick.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,
            LayoutParams.WRAP_CONTENT));
    btnClick.setBackgroundColor(Color.RED);

    RLGreen.addView(btnClick);


    final LinearLayout RLYellow = new LinearLayout(this);        
    RLYellow.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,
                                             200));
    RLYellow.setBackgroundColor(Color.YELLOW);


    btnClick.setOnClickListener(new View.OnClickListener() {            
        public void onClick(View view) {  
                    Toast.makeText(getApplicationContext(), "click", Toast.LENGTH_SHORT).show();
                    RLGreen.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,
                            LayoutParams.FILL_PARENT));  
        }
     });  

    RLChange.addView(RLGreen);
    RLChange.addView(RLYellow);
    setContentView(RLChange);




Log Cat


03-10 11:01:35.328: INFO/NotificationService(574): enqueueToast pkg=Changewidth.com callback=android.app.ITransientNotification$Stub$Proxy@43948648 duration=0
03-10 11:01:35.388: DEBUG/AndroidRuntime(1505): Shutting down VM
03-10 11:01:35.388: WARN/dalvikvm(1505): threadid=3: …
Run Code Online (Sandbox Code Playgroud)

android

18
推荐指数
2
解决办法
5万
查看次数

WCF在运行时更改端点地址

我的第一个WCF示例正在运行.我有一个网站上的主机有很多绑定.因此,我已将此添加到我的web.config中.

<serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
Run Code Online (Sandbox Code Playgroud)

这是我的默认绑定http://id.web,它使用以下代码.

EchoServiceClient client = new EchoServiceClient();
litResponse.Text = client.SendEcho("Hello World");
client.Close();
Run Code Online (Sandbox Code Playgroud)

我现在正在尝试在运行时设置端点地址.即使它与上述代码的地址相同.

EchoServiceClient client = new EchoServiceClient();
client.Endpoint.Address = new EndpointAddress("http://id.web/Services/EchoService.svc"); 

litResponse.Text = client.SendEcho("Hello World");
client.Close();
Run Code Online (Sandbox Code Playgroud)

我得到的错误是:

The request for security token could not be satisfied because authentication failed. 
Run Code Online (Sandbox Code Playgroud)

请建议我如何在运行时更改端点地址?

另外这里是我的客户配置,由Ladislav Mrnka提出要求

 <system.serviceModel>
        <bindings>
            <wsHttpBinding>
                <binding name="WSHttpBinding_IEchoService" closeTimeout="00:01:00"
                    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                    bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
                    maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                    messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
                    allowCookies="false">
                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                    <reliableSession ordered="true" inactivityTimeout="00:10:00"
                        enabled="false" />
                    <security mode="None" /> …
Run Code Online (Sandbox Code Playgroud)

c# wcf wcf-binding wcf-client

38
推荐指数
4
解决办法
12万
查看次数

Python:模拟一个模块而不导入它或需要它存在

我开始使用python 模拟库进行测试.我想模拟一个在被测模块的命名空间中导入的模块,而不是实际导入它或要求它首先存在(即抛出一个ImportError).

假设存在以下代码:

foo.py

 import helpers
 def foo_func():
    return helpers.helper_func()
Run Code Online (Sandbox Code Playgroud)

目标是在'helpers.py'不存在于任何地方时测试foo_func(),如果确实存在,则表现为不行.

首先尝试使用超酷的@patch装饰器:

from mock import patch, sentinel
import foo
@patch("foo.helpers")
def foo_test(mock):
    mock.helper_func.return_value = sentinel.foobar
    assert foo.foo_func() == sentinel.foobar
Run Code Online (Sandbox Code Playgroud)

如果可以导入"帮助程序"模块,则此方法有效.如果它不存在,我会得到一个ImportError.

下一次尝试补丁,没有装饰者:

from mock import patch, sentinel, Mock
import foo
helpers_mock = patch("foo.helpers")
helpers_mock.start()

def foo_test():
    helpers_mock.helper_func = Mock('helper_func')
    helpers_mock.helper_func.return_value = sentinel.foobar
    assert foo.foo_func() == sentinel.foobar
Run Code Online (Sandbox Code Playgroud)

同样,如果缺少"助手",这不起作用......如果存在,则断言失败.不确定为什么会这样.

第三次尝试,当前解决方案

import sys
helpers_mock = Mock(name="helpers_mock", spec=['helper_func'])
helpers_mock.__name__ = 'helpers'
sys.modules['helpers'] = helpers_mock
import foo
def foo_test():
    helpers_mock.helper_func.return_value = sentinel.foobar
    assert foo.foo_func() == …
Run Code Online (Sandbox Code Playgroud)

python import module mocking

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

即使在添加观察者之前设置了文本,TextWatcher也会调用

在Android活动中,我首先恢复EditText中的文本,然后向其添加TextWatcher.

private static int WC = 0;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.e("TextWatcherTest", "onCreate:\t" +CLASS_NAME);
setContentView(R.layout.main);

EditText et = (EditText)findViewById(R.id.editText);
Log.e("TextWatcherTest", "Set text xyz");
et.setText("xyz");

et.addTextChangedListener(new TextWatcher() {
    @Override
    public void onTextChanged(CharSequence s, int start, int before, int count) { }
    @Override
    public void beforeTextChanged(CharSequence s, int start, int count, int after) { }
    @Override
    public void afterTextChanged(Editable s) {
        Log.e("TextWatcherTest", "afterTextChanged:\t" +s.toString());
    }
});
}
Run Code Online (Sandbox Code Playgroud)

但是当我运行活动时,即使在设置文本后添加了Watcher本身,也会调用afterTextChanged方法.所以日志输出是这样的

onCreate:    LifecycleMain
Set text xyz
// screen rotation
onCreate:    LifecycleMain
Set text …

android textwatcher

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

如何将https://example.com/重定向到https://www.example.com/

我在我的.htaccess文件中有这个代码,如下所示.

RewriteEngine On
RewriteCond %{HTTPS} off 
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
Run Code Online (Sandbox Code Playgroud)

添加此选项是为了将http重定向到https,因此整个站点现在都是https版本.

现在我想从非www重定向到www.当我输入example.com时,我应该被重定向到https://www.example.com/

我怎么用.htaccess文件做到这一点?

apache mod-rewrite redirect

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

两个分屏(水平或垂直)

我正在尝试构建一个屏幕,当在横向和横向时纵向分割在中间.我尝试了以下,但它不像我期望的那样工作.任何帮助将不胜感激!

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal" android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <LinearLayout android:layout_width="wrap_content"
        android:layout_height="fill_parent" android:layout_gravity="left"
        android:orientation="horizontal">
        <ListView android:layout_width="fill_parent" android:id="@+id/lvChoices"
            android:layout_gravity="left" android:layout_height="fill_parent" />
    </LinearLayout>
    <LinearLayout android:layout_width="fill_parent"
        android:layout_height="fill_parent" android:orientation="horizontal">
        <ListView android:layout_width="fill_parent" android:id="@+id/lvOptions"
            android:layout_gravity="right" android:layout_height="fill_parent" />
    </LinearLayout>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

android android-layout

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