问题列表 - 第12328页

仅为根UIViewController隐藏UINavigationBar

我正在使用UINavigationController(旁注:在UITabBar中),默认情况下,它在顶部提供了一个UINavigationBar.如果我通过IB隐藏了这个栏,那么这个栏不仅对于根UIViewController而且对于我推入堆栈的所有控制器都消失了.让我没有(自动)方式回弹.

那么如何才能在根UIViewController上隐藏UINavigtionBar.临时打开/关闭"navigationBarHidden"不起作用,因为动画看起来很尴尬.

还有其他想法吗?

iphone cocoa-touch

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

重置CSS背景图片

我正在尝试使用以下JQUERY创建一个手风琴类型菜单:

function initMenu() {
    $('#menu ul').hide();
        $('#menu li a').click(
            function() {
                $(this).next().slideToggle('normal');
                $(this).css("background", "url(customnav_selected.png) top right");
            }
        );
}
$(document).ready(function() {initMenu();});
Run Code Online (Sandbox Code Playgroud)

这是有用的,当我点击它扩展的菜单链接和菜单标题背景更改.

但是,当我再次单击它以折叠菜单时,我希望它能够更改回来.

有人可以帮忙吗?

css jquery

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

WPF CustomControl:在PropertyChangedCallback之后调用的OnApplyTemplate

我正在创建一个WPF CustomControl,它具有PropertyChangedCallback的依赖属性.在那个Callback方法中,我尝试使用GetTemplateChild()方法设置我从OnApplyMethod检索的某些控件部分的值.

问题是PropertyChangedCallback(在某些系统上)在OnApplyTemplate之前调用,因此控件部分仍为空.

我目前使用的解决方法是将PropertyChangedCallback中的e.NewValue保存到成员变量,然后在OnApplyTemplate()中调用SetValue(dp,_savedValue).

处理这个问题的正确方法是什么,或者我已经使用了最佳解决方案?

wpf custom-controls propertychanged

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

JavaFX是Java Applets的替代品吗?

用于构建富Internet应用程序(RIA)的JavaFX技术Java Applet的直接替代品吗?

java applet javafx

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

Rails中的多个数据库连接

我正在使用active_delegate在Rails中进行多个连接.这里我使用mysql作为master_database用于某些模型,而postgresql用于其他一些模型.

问题是,当我尝试访问mysql模型时,我收到以下错误!堆栈跟踪显示,它仍然使用postgresql适配器来访问我的mysql模型!

RuntimeError: ERROR C42P01  Mrelation "categories" does not exist   P15 F.\src\backend\parser\parse_relation.c  L886    RparserOpenTable: SELECT * FROM "categories" 

STACKTRACE
===========
d:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract_adapter.rb:212:in `log'
d:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/postgresql_adapter.rb:507:in `execute'
d:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/postgresql_adapter.rb:985:in `select_raw'
d:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/postgresql_adapter.rb:972:in `select'
d:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `select_all_without_query_cache'
d:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/query_cache.rb:60:in `select_all'
d:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/query_cache.rb:81:in `cache_sql'
d:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/query_cache.rb:60:in `select_all'
d:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/base.rb:661:in `find_by_sql'
d:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/base.rb:1553:in `find_every'
d:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/base.rb:615:in `find'
D:/ROR/Aptana/dedomenon/app/models/category.rb:50:in `get_all_with_exclusive_scope'
D:/ROR/Aptana/dedomenon/app/models/category.rb:50:in `get_all_with_exclusive_scope'
D:/ROR/Aptana/dedomenon/app/controllers/categories_controller.rb:48:in `index'
Run Code Online (Sandbox Code Playgroud)

这是我的database.yml档案

postgre: &postgre
  adapter: postgresql
  database: codex
  host: localhost
  username: postgres
  password: root
  port: 5432  

mysql: &mysql
  adapter: mysql
  database: project
  host: localhost
  username: root
  password: root
  port: 3306  

development: …
Run Code Online (Sandbox Code Playgroud)

mysql postgresql ruby-on-rails multiple-databases

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

在MFC中检测模式对话框

如何以编程方式检测我的MFC应用程序当前是否正在显示模式对话框或属性表?目前,我正在使用以下内容,但我认为代码还会触发无模式对话框。

bool HasModalDialog(const CWnd* pWnd)
{
   const CWnd* pChildWnd = pWnd ? pWnd->GetNextWindow(GW_HWNDPREV) : NULL;
   while (pChildWnd)
   {
      if (pWnd == pChildWnd->GetTopLevelParent() &&
         (pChildWnd->IsKindOf(RUNTIME_CLASS(CDialog)) ||
         pChildWnd->IsKindOf(RUNTIME_CLASS(CPropertySheet))))
      {
         return true;
      }

      pChildWnd = pChildWnd->GetNextWindow(GW_HWNDPREV);
   }

   return false;
}
Run Code Online (Sandbox Code Playgroud)

用法:

HasModalDialog(AfxGetMainWnd())
Run Code Online (Sandbox Code Playgroud)

有人有检测模态对话框的另一种方法吗?

mfc modal-dialog

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

打印WPF WebBrowser的内容

我正在尝试打印WPF WebBrowser控件的内容,以便不显示打印对话框,但我没有运气.

我尝试了以下内容,并确信它确实有效:

PrintDialog printDialog = new PrintDialog();
printDialog.PrintDocument(((IDocumentPaginatorSource)browser.Document).DocumentPaginator, "My App");
Run Code Online (Sandbox Code Playgroud)

但由于某种原因,我现在得到以下例外:

无法将类型为"mshtml.HTMLDocumentClass"的COM对象强制转换为接口类型"System.Windows.Documents.IDocumentPaginatorSource".此操作失败,因为对于具有IID"{2C0C27DF-282F-3225-ADCD-CEC68F890EEB}"的接口的COM组件的QueryInterface调用由于以下错误而失败:不支持此类接口(HRESULT异常:0x80004002(E_NOINTERFACE)) .

在我的电脑上,我唯一能想到的就是我自上次尝试过以来安装了IE8,但这真的会破坏它吗?

browser printing wpf

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

LINQ to SQL手动选择相关的表数据(SELECT N + 1问题)

数据库示例:

图像 - ImageTag - 标记

图像可以有多个标签.关系设置很好,但我遇到了性能问题.

我有许多不同的查询,根据不同的标准选择图像.它们工作正常,但是不会使用这些查询选择标记的数据.

这意味着如果我遍历10个图像的列表并尝试访问其标记对象(通过ImageTag),则在我的数据库上为每个图像执行新的查询.

<%foreach (LINQRepositories.Image i in Model)
  { %>

   <li><%=i.title%>
    <ul>
        <%foreach(ImageTag t in i.ImageTags){ %>
            <li><%=t.Tag.name%></li>
        <%} %>
    </ul>
   </li> 

<%} %>
Run Code Online (Sandbox Code Playgroud)

这显然不太理想.有没有办法强制LINQ to SQL查询某些数据?

以下是我的一个查询示例

public static IQueryable<Image> WithTags(this IQueryable<Image> qry, IEnumerable<Tag> tags)
{
    return
        from i in qry
        from iTags in i.ImageTags
        where tags.Contains(iTags.Tag)
        select i;
}
Run Code Online (Sandbox Code Playgroud)

编辑

尝试dataload选项后,这是一个生成的示例查询

{SELECT [t0].[id],[t0].[title],[t0].[legend],[t0].[dateAdded],[t0].[删除],[t0].[averageRating], [t0].[numberOfVotes],[t0].[imageOfTheWeek],[t0].[copyright],[t0].[copyrightText],[t0].[areaOfInterest],[t0].[typeId],[t0 ].[authorId],[t0].[editorialStatusId],[t0].[comments] FROM [dbo].[Image] AS [t0] CROSS JOIN([dbo].[ImageTag] AS [t1] INNER JOIN [ dbo].[Tag] AS [t2] ON [t2].[id] = …

c# linq performance linq-to-sql

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

Qt不会在Linux中的调试/发布文件夹中创建输出文件

当我在Ubuntu上构建Qt应用程序时,它将输出文件放在主解决方案文件夹中,而不是像在Windows上那样放置/调试文件夹.

这是有问题的,因为有时输出文件需要作为构建过程的一部分运行(例如,运行单元测试).

我知道这与qmake.conf文件有关,但我不确定该怎么做.

所以我的问题是:

  1. 为什么存在这种差异(它可能只是我吗?)
  2. 我应该如何确保我的应用程序在Windows和Ubuntu上都能正确构建?

linux ubuntu qt

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

春天的全球物业

是否可以在spring上下文文件中定义,以及可以在<bean>元素中访问的一个或多个属性.

下面的例子说明了我最需要的东西 - 我想要定义属性FOO一次,然后在我的各种<bean>定义中多次引用它:

<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="
      http://www.springframework.org/schema/beans
      http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
  <properties>
    <property name="FOO" value="BAR">
  </properties>

  <bean name="TEST" class="mytest">
    <property name="MYFOO" value="${FOO}"/>
  </bean>
  <bean name="TEST1" class="mytest1">
    <property name="MYFOO" value="${FOO}"/>
  </bean>

</beans>
Run Code Online (Sandbox Code Playgroud)

任何输入都将非常感激.
谢谢,凯文.

spring

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