问题列表 - 第34604页

异步回发不会导致document.ready执行

我必须对几页中使用的用户控件实施一些更改.用户控件包含一些JQuery来处理分页任务(显示3个月的数据并一次隐藏9个).加载控件后,它将自动显示当前季度并在$(document).ready()中执行此代码.

我遇到的问题是,在其中一个页面中使用了用户控件,该控件在页面加载时不可见.异步回发用于更改可见性,但这不执行ready().

我找到了一个片段,允许托管页面拦截部分回发的EndResponse,但我仍然无法在usercontrol中执行该功能.

有没有人有什么建议?

干杯

戴夫

asp.net jquery

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

有没有办法获得小数的"有效数字"?

更新

好的,经过一番调查,并且在很大程度上要归功于Jon和Hans提供的有用答案,这就是我能够把它放在一起的.到目前为止,我认为它似乎运作良好.当然,我不打赌我的生活完全正确.

public static int GetSignificantDigitCount(this decimal value)
{
    /* So, the decimal type is basically represented as a fraction of two
     * integers: a numerator that can be anything, and a denominator that is 
     * some power of 10.
     * 
     * For example, the following numbers are represented by
     * the corresponding fractions:
     * 
     * VALUE    NUMERATOR   DENOMINATOR
     * 1        1           1
     * 1.0      10          10
     * 1.012    1012        1000
     * 0.04     4           100
     * 12.01    1201        100
     * …
Run Code Online (Sandbox Code Playgroud)

.net precision decimal significant-digits

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

布局与动态位置

我的布局可能有点不寻常.结构如下:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <org.CustomSurfaceView
        android:id="@+id/page_flip"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_marginBottom="20dip" />

    <org.customRelativeLayout
        android:id="@+id/note"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:visibility="gone" />
</FrameLayout>
Run Code Online (Sandbox Code Playgroud)

XML底部的customRelativeLayout也有XML布局:

<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="200dp"
    android:layout_height="200dp"
    android:background="@drawable/my_background"
    android:id="@+id/note_layout">
    <TextView android:id="@+id/note"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:singleLine="false"
        android:layout_margin="5dp"
        android:textColor="#000000" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

我的CustomRelativeLayout:

public class CustomRelativeLayout extends RelativeLayout implements OverlayView {

    private TextView mNoteText;
    private LinearLayout mLinearLayout;
    public int mX = 0;
    public int mY = 0;
    public boolean mShow;

    public CustomRelativeLayout(Context context, AttributeSet attrs) {
        super(context, attrs);

        LayoutInflater li = …
Run Code Online (Sandbox Code Playgroud)

layout android surfaceview ontouchlistener

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

如何使用SupressMessage抑制FxCop规则'DoNotCatchGeneralExceptionTypes'?

我有代码捕获所有内容并记录它.我通常不会这样做,但我正在编写HTTP处理程序并希望返回适当的HTTP代码.无论如何,我在我的方法的顶部放置以下内容:

[SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "We just log the exception and return an HTTP code")]

FxCop似乎忽略了这一点,这非常令人沮丧.特别是因为它也忽略了我所有的复合词覆盖!

知道为什么这样做吗?我正在使用FxCop 10,它是Windows 7/.NET 4 SDK的一部分.

fxcop

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

错误运算符new []:函数不带1个参数

我有重载运算符的代码new.下面的代码在Linux(gcc4x)下运行正常,但不适用于Windows(Visual C++ 2008 Express Edition)

Visual Studio 2008 Express Edition下的代码报告

错误C2660:operator new []:函数不带1个参数

class dummy{};
void* operator new[] (size_t size, dummy gcp)
{
  return ::operator new[](size);   //error
}

int main()
{
    dummy dummyobj;
    dummy* ptr = new (dummyobj) dummy[5];
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

c++ new-operator visual-c++-2008

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

逃离MySQL通配符

在我使用的旧服务器上,我无法使用预准备语句,我目前正在尝试完全转义用户输入,然后再将其发送到MySQL.为此我使用PHP函数mysql_real_escape_string.

由于这个函数没有逃脱MySQL通配符%和_我也用它addcslashes来逃避这些.

当我发送类似的东西:

test_test " ' 
Run Code Online (Sandbox Code Playgroud)

到数据库然后读回数据库显示:

test\_test " ' 
Run Code Online (Sandbox Code Playgroud)

看着这个我无法理解为什么_有一个前面的反斜杠但是'和'没有.因为它们全部用\ _确定_'并且"应该都显示相同,即所有都具有转义字符可见或一切都没有可见.

是否会自动筛选转义

有谁能解释一下?

php mysql escaping

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

NSMutableArray addObject不影响计数?

任何人都可以告诉我为什么登录[self.giftees count]仍然返回0,即使我正在添加对象?

标题:

#import <UIKit/UIKit.h>

@interface Test2AppDelegate : NSObject <UIApplicationDelegate>  
{
    UIWindow *window;
    NSMutableArray *giftees;
}

@property (nonatomic, retain) UIWindow *window;
@property (nonatomic, retain) NSMutableArray *giftees;

@end
Run Code Online (Sandbox Code Playgroud)

从didFinishLaunchingWithOptions调用:

- (void)bootstrapGiftees
{
    NSArray *gifteeNames = [NSArray arrayWithObjects:@"Jesse",,nil];

    for (NSString *gifteeName in gifteeNames)
    {
        GifteeModel *g = [[GifteeModel alloc] init];
        g.name = gifteeName;

        [self.giftees addObject:g];
        NSLog(@"giftees count = %d", [self.giftees count]);
        [g release];
}
}
Run Code Online (Sandbox Code Playgroud)

objective-c nsmutablearray

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

c ++和actionscript 3之间的通信

是否可以使用任何IPC机制从Adobe Flash actionscript调用c ++ api?有什么好例子吗?

更新:我现在主要想要它用于桌面应用程序,即Adobe的/或任何其他人的桌面运行时

c++ actionscript-3 flex4

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

QNetworkRequest和默认SSL配置

我正在使用以下代码与服务器发出HTTPS请求.

QNetworkRequest request;

//request.setSslConfiguration(QSslConfiguration::defaultConfiguration());
request.setUrl(QUrl("https://www.someurl.com/"));

QNetworkReply *reply = manager->get(request);
Run Code Online (Sandbox Code Playgroud)

一切似乎与我的测试服务器上的工作,但我想知道如果要推荐它来设置defaultConfiguration(取消注释第二行)或没有网络API使用SSL时自动检查所有defaultConfigurations?如果它检查,如果我添加一个自定义配置,它也会这样做吗?我的意思是,是否需要将自定义配置附加到默认配置列表中?例如:

QSslConfiguration SslConfiguration(QSslConfiguration::defaultConfiguration());

QList<QSslCertificate> certificates = SslConfiguration.caCertificates();
certificates.append(QSslCertificate::fromData(certificate.toAscii(), QSsl::Pem));
SslConfiguration.setCaCertificates(certificates);

request.setSslConfiguration(SslConfiguration);
Run Code Online (Sandbox Code Playgroud)

编辑:我想补充一点,我正在使用Symbian平台.

ssl qt qnetworkaccessmanager qnetworkrequest

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

如何获得堆栈面板的实际当前高度?

你好,

我想在 WPF 中制作一个自定义的堆栈面板,它会根据面板的高度自动将他的孩子调整到一定的大小。但是面板高度是动态的,因为它延伸到他的父母。当我想获得高度时(我尝试了所有可能性,请参阅代码),它始终为 0 或未定义,尽管在构建解决方案中它绝对不是 0。这是代码:

XAML:

<my:AutoSizeButtonStackPanel HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>

代码隐藏:

public class AutoSizeButtonStackPanel : StackPanel
{
    public void AddChild(Button newButton)
    {
        double getPanelHeight;
        getPanelHeight = this.ActualHeight; //is 0
        getPanelHeight = this.ViewportHeight; //is 0
        getPanelHeight = this.Height; //is n. def.
        getPanelHeight = this.DesiredSize.Height; //is 0
        getPanelHeight = this.RenderSize.Height; //is 0

        newButton.Height = getPanelHeight / 2;

        this.Children.Add(newButton);
    }
}
Run Code Online (Sandbox Code Playgroud)

wpf xaml panel stackpanel

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