问题列表 - 第47944页

@synthesize window = _window做什么?

我知道@synthesize window;结合@property'自动创建'你的setter和getter,但我不确定当你分配一个像这样的值时会发生什么

 @synthesize searchBar = _searchBar;
Run Code Online (Sandbox Code Playgroud)

这是否意味着我可以简单地在我的方法中使用_searchBar而不是说self.searchBar?

是否使用此委托方法防止ivar名称的冲突:

- (void) searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText
Run Code Online (Sandbox Code Playgroud)

它是否相当于self.searchBar而不是searchBar或者那两个相同?

iphone objective-c

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

始终在WPF应用程序中使用MVVM,还是替代模式仍然实用/有用?

Microsoft .NET Architecting Applications for the Enterprise一书中的第374页上,有一个关于表示层模式演变及其对平台影响的图表(图7-14).

除了展示从最初的MVC模式到更现代的变体的演变之外,该图表还显示以下现代模式可以应用于以下技术:

  1. Model2(MVC)
    • 仅限网络
  2. 被动视图(MVP)
    • 卷筒纸
    • 的WinForms
    • WPF
  3. 监督控制器(MVP)
    • 卷筒纸
    • 的WinForms
    • WPF
  4. MVVM(演示模型)
    • 仅限WPF

注意:最近没有出现在另一个最近感兴趣的模式是Presenter First(MVP),它被设想为更加适应TDD.


根据我的理解,如果使用WPF开发,那么MVVM模式是事实上的选择(类似于Model2用于Web开发).也就是说,似乎没有什么能阻止人们在WPF应用程序中使用Passive View,Supervising ControllerPresenter First.这种方法会导致应用程序无法真正关心前端是WPF,WinForms还是Web.看来这些MVP变体允许更大的灵活性.

但是,针对UI平台无关的灵活性(可能不需要)的目的是使WPF开发变得更加困难并且失去WPF提供的部分功能/功能吗?这么多,成本超过了收益?

换句话说,MVVM是如此之大,以至于人们不应该考虑WPF应用程序中的其他替代方案?

.net wpf mvp design-patterns mvvm

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

使用jQuery在td字段中将连字符插入phone#

我有一个表,其中包含从数据库中查询的一堆电话号码.我想在电话号码中插入连字符,而不是:"0000000000",用户将看到:"000-000-0000".在正则表达式上不是很好,但这是我到目前为止所尝试的:

  $('.views-field-phone').each(function(){
      $(this).insertAfter(/(.{3})/g,"-1-")
      $(this).insertAfter(/(.{7})/g,"-1-")
  });
Run Code Online (Sandbox Code Playgroud)

string jquery

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

我得到的资源不在项目的构建路径上

我正在尝试"组织导入"或尝试访问任何类属性时,资源不在项目的构建路径上.我正在使用ant构建我的项目.我试图在javabuilpath - > Projects中配置我的buildpath但它没有向我显示我的src文件夹.我无法使用快速辅助(ctrl + space)和类相关的属性,因为同样的原因,当我编写代码时,它也没有显示任何语法错误.

请帮我.

谢谢

java eclipse buildpath project-settings

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

如何在WCF调用的服务端获取用户名和密码?

当我使用以下代码在客户端提供凭据时:

myChannelFactory.Credentials.UserName.UserName = "username";
myChannelFactory.Credentials.UserName.Password = "password";
Run Code Online (Sandbox Code Playgroud)

然后在服务器端,我看到这些凭据可用

operationContext.IncomingMessageHeaders[1]
Run Code Online (Sandbox Code Playgroud)

但是有没有更方便的方法来获取UserName和密码?我所看到的OperationContext只是混乱的属性和无类型列表,我无法找到任何表明我可以得到它的东西.

.net wcf wcf-security

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

包括tr1 :: shared_ptr

我已经包含#include </usr/include/c++/4.4.3/tr1/shared_ptr.h>在我的类文件中,当我尝试编译我的类时,我得到以下错误:

> In file included from account.h:16:0:
/usr/include/c++/4.4.3/tr1/shared_ptr.h:61:46: error: '_Lock_policy' has not been declared
/usr/include/c++/4.4.3/tr1/shared_ptr.h:63:30: error: expected template-name before '<' token
/usr/include/c++/4.4.3/tr1/shared_ptr.h:63:30: error: expected '{' before '<' token
/usr/include/c++/4.4.3/tr1/shared_ptr.h:63:30: error: expected unqualified-id before '<' token
/usr/include/c++/4.4.3/tr1/shared_ptr.h:89:12: error: '_Lock_policy' has not been declared
/usr/include/c++/4.4.3/tr1/shared_ptr.h:89:31: error: '__default_lock_policy' was not declared in this scope
/usr/include/c++/4.4.3/tr1/shared_ptr.h:100:12: error: '_Lock_policy' has not been declared
/usr/include/c++/4.4.3/tr1/shared_ptr.h:100:31: error: '__default_lock_policy' was not declared in this scope
/usr/include/c++/4.4.3/tr1/shared_ptr.h:209:7: error: '_Sp_counted_base' does not name a type
/usr/include/c++/4.4.3/tr1/shared_ptr.h: In …
Run Code Online (Sandbox Code Playgroud)

c++ gcc g++

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

mod重写搜索表单GET vs POST ACTION

您好,感谢您抽出时间来解决这个问题.

我正在使用jQuery进行实时搜索的搜索表单.搜索栏位于我网站的每个页面上,工作正常.现在我想扩展它.当人们点击Enter键时,我希望他们被重定向到搜索页面,在那里他们获得所有结果.

唯一的问题是Get方法不起作用.我的表格看起来像这样:

<form action="search/search" id="Searchform" method="GET">
<p><input type="text" name="SearchInput" id="SearchInput" value=""  onkeyup="lookup(this.value);" /></p>
<div class="clear"></div>
<div id="suggestions"></div>
</form>
Run Code Online (Sandbox Code Playgroud)

我的.htaccess文件包含搜索页面的重写规则:

RewriteRule ^search/([^/]*)$ search.php?mode=$1 [L]
Run Code Online (Sandbox Code Playgroud)

Evey时间我点击Enter按钮我得到了这个:

search/search?SearchInput=moonwalker
Run Code Online (Sandbox Code Playgroud)

使用GET方法我似乎无法获得SearchInput的值.

使用POST方法时一切正常.但我在不同的文章中读到,我真的应该使用GET方法进行搜索.

所以我的问题是:为什么我要将GET方法用于搜索页面?如果我决定使用POST而不是GET方法,有什么大的优势吗?

我知道我可以使用重定向等来完成这个GET方法,但我只是想知道为什么POST在搜索表单中被认为是不好的做法.

在此先感谢您的帮助!

html php mod-rewrite

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

如何在返回多种类型XML的URL上使用Spring RestTemplate和JAXB编组

我需要对返回a <job/>或an <exception/>和always状态代码的服务进行Rest POST 200.(蹩脚的第三方产品!).

我的代码如下:

Job job = getRestTemplate().postForObject(url, postData, Job.class);
Run Code Online (Sandbox Code Playgroud)

我的applicationContext.xml看起来像:

<bean id="restTemplate" class="org.springframework.web.client.RestTemplate">
    <constructor-arg ref="httpClientFactory"/>

    <property name="messageConverters">
        <list>
            <bean class="org.springframework.http.converter.xml.MarshallingHttpMessageConverter">
                <property name="marshaller" ref="jaxbMarshaller"/>
                <property name="unmarshaller" ref="jaxbMarshaller"/>
            </bean>
            <bean class="org.springframework.http.converter.FormHttpMessageConverter"/>
            <bean class="org.springframework.http.converter.StringHttpMessageConverter"/>
        </list>
    </property>
</bean>

<bean id="jaxbMarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
    <property name="classesToBeBound">
        <list>
            <value>domain.fullspec.Job</value>
            <value>domain.fullspec.Exception</value>
        </list>
    </property>
</bean>
Run Code Online (Sandbox Code Playgroud)

当我尝试拨打此电话并且服务失败时,我得到:

 Failed to convert value of type 'domain.fullspec.Exception' to required type 'domain.fullspec.Job'
Run Code Online (Sandbox Code Playgroud)

在postForObject()调用中,我要求一个Job.class而不是一个,它正在变得烦恼.

我想我需要能够做一些事情:

Object o = getRestTemplate().postForObject(url, postData, Object.class);
if (o instanceof Job.class) {
   ...
else if (o …
Run Code Online (Sandbox Code Playgroud)

java jaxb resttemplate

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

Drupal 7:如何创建在站点导航中不显示的菜单/路线项目

如何在Drupal中创建一个不会自动呈现导航链接的新路径/菜单?

我正在尝试在Drupal中创建一个没有显示在导航菜单中的简单页面回调.

我有一个名为的模块helloworld.

.module文件包含以下内容

function _helloword_page_callback()
{
    return array('#markup'=>'The quick brown fox says hello, and the lazy dogs thanks you
    for following conventions.');
}

function helloworld_menu()
{
    $items['helloworld'] = array(
      'title'               => 'Hello World',
      'page callback'       => '_helloword_page_callback',
      'access arguments'    => array('content'),
      'type'                => MENU_CALLBACK
    );
    return $items;
}
Run Code Online (Sandbox Code Playgroud)

这成功地在网站上公开了一个URL

http://example.drupal.com/helloworld
Run Code Online (Sandbox Code Playgroud)

但是,我仍然在左手(Bartik)导航菜单中获得了一个链接,尽管使用了

'type'              => MENU_CALLBACK
Run Code Online (Sandbox Code Playgroud)

那么,为什么这不起作用?我正确配置菜单项吗?更可能的问题:我如何误解菜单类型常量/系统的使用?是否有其他缓存来清除它

drush cc all
Run Code Online (Sandbox Code Playgroud)

会不会照顾?我可以采取哪些其他步骤进行调试?

drupal drupal-7 drupal-routes

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

在哪里可以找到Windows 7 UX指南中推荐的图标/动画?

Windows 7 UX指南有很好的插图和图标示例,但我真的无法在SDK中找到它们.他们藏在哪里,或者他们没有?

windows icons user-experience windows-7

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