问题列表 - 第21085页

条件Sql查询

我正在显示下表中的属性.现在我要做的是,在相同的位置找到属性(假设我的属性位于sec-19,匹配sec-19,如果没有找到那里,那么搜索整个城市)具有以下条件:它应该在10天前发布,或者如果没有在10天后发布,则比30天后的结果更新.

我有下面提到的表(属性):

ID | Propertyid | Userid | Projectid | .. |价格| ... |上市时间| ... http://www.freeimagehosting.net/uploads/1e5ee2e2ad.jpg

现在我要从这个表中检索的是那些列出时间少于10天的属性的'Propertyid'和'Average Price',如果它们都不少于10天,那么返回结果的时间少于30天.

任何人都可以帮我解决这个问题.提前致谢.

或者只是任何身体都可以在没有位置匹配的情况下回答

我需要从10天前发布的房产计算'平均价格',如果10天前没有贴出房产,那就把它当作30天前.像这样的东西:

Select AVG(Price) As Average_Price from Properties where (DATEDIFF(day,listingtime,getdate())<30 or DATEDIFF(day,listingtime,getdate())<10)
Run Code Online (Sandbox Code Playgroud)

但在这里,我只得到一个字段'平均价格',这里我也没有检查过滤它是在10天前还是30天前发布的.Knidly Recheck并尝试解决我的问题.提前致谢.

sql database sql-server-2008

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

INotifyPropertyChanged和计算属性

假设我有一个简单的类Order,它有一个TotalPrice计算属性,可以绑定到WPF UI

public class Order : INotifyPropertyChanged
{
  public decimal ItemPrice 
  { 
    get { return this.itemPrice; }
    set 
    {
       this.itemPrice = value;
       this.RaisePropertyChanged("ItemPrice");
       this.RaisePropertyChanged("TotalPrice");
    }
  }

  public int Quantity 
  { 
    get { return this.quantity; }
    set 
    {
       this.quantity= value;
       this.RaisePropertyChanged("Quantity");
       this.RaisePropertyChanged("TotalPrice");
    }
  }

  public decimal TotalPrice
  {
    get { return this.ItemPrice * this.Quantity; }    
  }
}
Run Code Online (Sandbox Code Playgroud)

在影响TotalPrice计算的属性中调用RaisePropertyChanged("TotalPrice")是一个好习惯吗?刷新TotalPrice属性的最佳方法是什么?当然这样做的另一个版本是改变这样的属性

public decimal TotalPrice
{
    get { return this.ItemPrice * this.Quantity; } 
    protected set 
    {
        if(value >= 0) 
            throw ArgumentException("set method can be used …
Run Code Online (Sandbox Code Playgroud)

c# wpf inotifypropertychanged

7
推荐指数
2
解决办法
4144
查看次数

(PHP)如何在CRYPT_BLOWFISH中使用crypt()?

首先,我看到要使用CRYPT_BLOWFISH,我需要使用以$ 2a $开头的16个char盐.但是,crypt()php.net文档说某些系统不支持CRYPT_BLOWFISH.这种情况多久一次?

接下来,从他们在docs上的例子中,我看到我使用crypt()如下:

<?php
$password = crypt('mypassword'); // let the salt be automatically generated

/* You should pass the entire results of crypt() as the salt for comparing a
   password, to avoid problems when different hashing algorithms are used. (As
   it says above, standard DES-based password hashing uses a 2-character salt,
   but MD5-based hashing uses 12.) */
if (crypt($user_input, $password) == $password) {
   echo "Password verified!";
}
?>
Run Code Online (Sandbox Code Playgroud)

为了使用CRYPT_BLOWFISH,我唯一需要修改的是第一行来使它像这样;

crypt('mypassword', '$2a$07$usesomesillystringforsalt$')
Run Code Online (Sandbox Code Playgroud)

然后剩下的线路都很好吗?

php crypt

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

NETWORK_ERROR:XMLHttpRequest异常101

我收到此错误

NETWORK_ERROR:XMLHttpRequest异常101

尝试从一个站点获取XML内容时.这是我的代码

    var xmlhttp; 
    if(window.XMLHttpRequest) { 
        xmlhttp = new XMLHttpRequest();
    }

    if (xmlhttp==null) {
        alert ("Your browser does not support XMLHTTP!");
        return;
    }

    xmlhttp.onReadyStateChange=function() {
        if(xmlhttp.readyState==4) {
            var value =xmlhttp.responseXML;
            alert(value);
        }
    }
    xmlhttp.open("GET",url,false);
    xmlhttp.send();
    //alert(xmlhttp.responseXML);
}

xmlhttp.open("GET",url,false);
xmlhttp.send(null);
Run Code Online (Sandbox Code Playgroud)

有没有人有办法解决吗?

ajax xmlhttprequest

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

WCF - 如何通过HTTP(S)以二进制编码创建编程自定义绑定

我想将我当前的HTTP/HTTPS WCF绑定设置转换为使用二进制消息编码,我需要在代码中进行 - 而不是在XML配置中.AFAIK有必要创建CustomBinding对象并设置正确的BindingElements,但我无法弄清楚我的场景中应该使用哪些元素.

我的WCF配置的要点是:

  • 根据配置使用HTTP或HTTPS传输(在app.config中)
  • 使用用户名消息安全
  • todo:添加二进制编码而不是默认文本

我当前设置绑定的代码(工作,但没有二进制编码):

var isHttps = Settings.Default.wcfServiceBaseAddress.StartsWith("https://", StringComparison.InvariantCultureIgnoreCase);
var binding = new WSHttpBinding(isHttps ? SecurityMode.TransportWithMessageCredential : SecurityMode.Message);
binding.Security.Message.ClientCredentialType = MessageCredentialType.UserName;
Run Code Online (Sandbox Code Playgroud)

我正在尝试此代码,但它不起作用 - 我不知道如何为用户名消息安全设置消息安全元素:

var custBinding = new CustomBinding();
custBinding.Elements.Add(new BinaryMessageEncodingBindingElement());
//Transport Security (Not Required)
if (isHttps)
{
    custBinding.Elements.Add(SecurityBindingElement.CreateUserNameForSslBindingElement());
}
//Transport (Required)
custBinding.Elements.Add(isHttps ?
    new HttpsTransportBindingElement() :
    new HttpTransportBindingElement());
Run Code Online (Sandbox Code Playgroud)

有谁知道如何设置它?我试图搜索类似的问题/解决方案,但没有成功...

security wcf binding

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

如果没有结束调用close()或崩溃,会导致自发EPIPE错误的原因是什么?

我有一个由两个进程组成的应用程序(让我们称之为A和B),通过Unix域套接字相互连接.大多数情况下它工作正常,但有些用户报告以下行为:

  1. A向B发送请求.这有效.A现在开始阅读B的回复.
  2. B向A发送回复.相应的write()调用返回EPIPE错误,结果B关闭()套接字.然而,A并没有关闭()的插座,也没有崩溃.
  3. A的read()调用返回0,表示文件结束.A认为B过早地关闭了连接.

用户还报告了此行为的变化,例如:

  1. A向B发送请求.这部分工作,但在发送整个请求之前A的write()调用返回EPIPE,结果是一个close()套接字.但是B没有关闭()套接字,也没有崩溃.
  2. B读取部分请求然后突然获得EOF.

问题是我无法在本地重现此行为.我试过OS X和Linux.用户使用各种系统,主要是OS X和Linux.

我已经尝试过并考虑过的事情:

  • 双close()错误(在同一文件描述符上调用close()两次):可能不会导致EBADF错误,但我还没有看到它们.
  • 增加最大文件描述符限制.一位用户报告说这对他有用,其余用户报告说没有.

还有什么可能导致这样的行为?我肯定知道A和B都不会过早地关闭()套接字,并且我肯定地知道它们都没有崩溃,因为A和B都能够报告错误.好像内核突然决定出于某种原因从插座拔出插头.

unix sockets posix ipc

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

如何从字符串中获取AZ和0-9?

如何从"Lörumipsäm1"获得"Lrumipsm1"?

所以我需要的是只使用php从字符串中获取az和0-9.

php string preg-replace

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

解析NSStrings以确保在XCode中正确形成JSON字符串

我正在从PLIST读取字符串数据,我正在使用它创建一个JSON字符串(顺便在Facebook Connect中使用).

NSString *eventLink = [eventDictionary objectForKey:EVENT_FIND_OUT_MORE_KEY];
NSString *eventLinkEscaped = [eventLink stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSString *eventName = [eventDictionary objectForKey:EVENT_NAME_KEY];
NSString *eventDescription = [eventDictionary objectForKey:@"Description"];
NSString *eventImageAddress = [eventDictionary valueForKey:@"Image URL"];
if ([eventImageAddress length] == 0)
{
    eventImageAddress = NO_EVENT_IMAGE_URL;
}
// Publish a story to the feed using the feed dialog
FBStreamDialog *facebookStreamDialog = [[[FBStreamDialog alloc] init] autorelease];
    facebookStreamDialog.delegate = self;
    facebookStreamDialog.userMessagePrompt = @"Publish to Facebook";
    facebookStreamDialog.attachment =[NSString stringWithFormat: @"{\"name\":\"%@\",\"href\":\"%@\",\"description\":\"%@\",\"media\":[{\"type\":\"image\",\"src\":\"%@\",\"href\":\"%@\"}]}", eventName, eventLinkEscaped, eventDescription, eventImageAddress, eventLinkEscaped];
[facebookStreamDialog show];
Run Code Online (Sandbox Code Playgroud)

所有这些都很有效,但是对话框中显示的某些事件描述(大约150个中的4个)是空白的.我找到了明显的候选者,即描述包含"例如字符或版权符号.我的问题是,是否有一个简单的方法调用,例如stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding,它将确保任何狡猾的字符被转义或忽略?

提前致谢,

戴夫

iphone json fbconnect

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

JavaScript中的URL帮助器

我正在使用jQuery Lightbox作为我的图片库.
按钮图像的 URL是' ' 如果我的URL是../../Content/Lightbox/lightbox-btn-next.gif'
那么工作正常localhost/Something1/Somtehing2'
如果我使用其他路线' localhost/Something1/Something2/Something3''那么URL按钮图像是不正确的.
我可以使用Url.Action()里面的.js文件吗?
这就是我调用.js文件的方式:

<script type="text/javascript" src="<%= Url.Content("~/Scripts/jquery.lightbox-0.5.js") %>"></script>
Run Code Online (Sandbox Code Playgroud)

asp.net-mvc jquery url-routing

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

如何使用jboss与maven

我已经成功构建了我的项目.我的战争位于目标目录,我试图在jboss上运行战争这里是pom.xml的一部分,说jboss在哪里寻找战争..

<build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>jboss-maven-plugin</artifactId>
                <version>1.4</version>
                <configuration>
                    <jbossHome>C:\jboss-4.2.2.GA</jbossHome>
                    <serverName>all</serverName>
                    <fileName>target/0.0.1-SNAPSHOT.war</fileName>
                </configuration>
            </plugin>
        </plugins>
    </build>
Run Code Online (Sandbox Code Playgroud)

现在我用maven开始吧这里是消息:

[INFO] [jboss:start]
[INFO] Starting JBoss...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
Run Code Online (Sandbox Code Playgroud)

但是当地人没有工作,我忘了怎么办?

java eclipse maven-2

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