问题列表 - 第165664页

如何在swift中的app delegate中添加UIView?

视图对象没有进入addsubview括号

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool
    {
            // Override point for customization after application launch.
            UIApplication.sharedApplication().setStatusBarHidden(true, animated: true);
            var myView = UIView(frame:CGRectMake(0, 200, 320, 100));
            myView.backgroundColor = UIColor.redColor()
            self.window.?.addSubview(myView)


            return true
    }
Run Code Online (Sandbox Code Playgroud)

swift

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

如何add_custom_target取决于"make install"

我想添加一个名为"package"的自定义目标,它取决于安装目标.当我运行make package它应该首先运行make install,然后运行我的自定义命令来创建一个包.

我尝试了以下DEPENDS install但它不起作用.

我收到错误消息:没有规则来制作目标CMakeFiles/install.dir/all,需要CMakeFiles/package.dir/all

install(FILES
        "module/module.pexe"
        "module/module.nmf"
        DESTINATION "./extension")

add_custom_target(package
    COMMAND "chromium-browser" "--pack-extension=./extension"
    DEPENDS install)    
Run Code Online (Sandbox Code Playgroud)

编辑:我尝试过DEPENDS install关键字,add_dependencies(package install)但它们都不起作用.

根据http://public.kitware.com/Bug/view.php?id=8438 ,无法向内置目标添加依赖项,例如installtest

cmake

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

两秒后删除信息消息

我有这个代码,它在页面顶部提供用户信息消息,目前它在那里,直到用户点击X按钮,我的问题是,如果用户有一种方法可以删除,如果用户在2秒后自动淡出此消息不点击X?

   function addessage(message) {
        $messages.html("<div class='alert alert-info'><strong>Information : </strong>" + message + "<button type='button' class='close' aria-hidden='true'>&times;</button></div>");
    }
Run Code Online (Sandbox Code Playgroud)

html javascript jquery

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

Xcode 6中的"嵌入式内容包含Swift代码"构建设置有什么作用?

这是"构建选项"下的新设置.它有什么作用?我似乎无法找到任何有关它的文档.我的猜测是:它是否必须YES在混合的Objective-C/Swift应用程序中设置为告诉Xcode链接Swift运行时?

xcode swift xcode6 ios-app-extension

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

JQuery鼠标悬停功能多次触发

我一直在使用这种方法为整个类(按钮等)设置事件:

$("div.bigButton").mouseover(function() { this.style.backgroundColor = '#dfdfdf'; });
Run Code Online (Sandbox Code Playgroud)

然而,在进行一些测试时,我注意到当将鼠标移动到这些对象上时,该功能会激发3次!这在改变像backgroundColor这样的东西时是不明显的,但是如果我添加一个警报就很明显了.

我有什么想法我做错了吗?我担心这可能会对以后的性能产生影响.

谢谢

编辑:对不起,错过"风格"关闭是一个错字

HTML是:

<div class="bigButton">
Test</div>
Run Code Online (Sandbox Code Playgroud)

javascript css jquery

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

html5输入货币/货币

我似乎无法弄清楚用什么来接受表格上的货币价值.

我试过了...

<input type="number" min="0" max="10000" step="1" name="Broker_Fees" id="broker_fees" required="required">
Run Code Online (Sandbox Code Playgroud)

但那时便不允许便士入境.

我希望增量按钮控制以磅为单位增加,但仍然希望能够输入便士.

谁想要使用一次移动1p的增量按钮?

也许我使用了错误的控制,但我找不到钱/货币控制?

有人可以建议使用HTML5接受货币价值(包括逗号,小数位和货币符号)的最佳方式吗?

谢谢,1DMF

html5 currency-formatting

65
推荐指数
5
解决办法
17万
查看次数

如何使用 MEF 获取 Visual Studio 扩展中的当前 ActiveDocument?

我正在使用 MEF 开发 Visual Studio 2013 扩展,同时尝试读取 Active Document 内容类型和代码。目前,它仅在编辑器中打开文档/项目项时读取。一旦打开它们,每当我们在打开的文档选项卡之间切换时,它就不会再次读取它们。

要求:我希望此扩展能够读取当前活动文档的内容类型和代码文本。

更新:
问题:我知道,使用 EnvDTE80.DTE2.ActiveWindow,我可以获得当前聚焦的文档,但我在这里很困惑如何调用此代码来读取当前活动文档/窗口的内容?假设我们有 10 个文档,则活动文档(获得当前焦点)需要由 this 扩展读取。这里,只有当我们打开一个新文档或创建文本视图之前关闭的文档时,才会调用 VsTextViewCreated 。它不会被调用已经打开的文档(即已经创建的文本视图),因此当我们将焦点移到其他已经打开的文档上时,我们将无法获得更新的 wpfTextView 对象。我很困惑如何使用 DTE2.ActiveDocument 或 DTE2.ActiveWindow 事件处理程序来调用它。

问题:
在 MEF 中这是否可能,而不使用 DTE?
VS 编辑器中是否存在处理 TextView 的接口?

这是我的代码:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Threading.Tasks;
using Microsoft.VisualStudio.Text.Tagging;
using Microsoft.VisualStudio.Text.Editor;

using System.ComponentModel.Composition;
using Microsoft.VisualStudio.Utilities;
using Microsoft.VisualStudio.Editor;
using Microsoft.VisualStudio.TextManager.Interop;
using Microsoft.VisualStudio.OLE.Interop;
using System.Diagnostics;

namespace VSIXProject_Test
{
    [Export(typeof(IVsTextViewCreationListener))]
    [ContentType("code")]
    [TextViewRole(PredefinedTextViewRoles.Editable)]
    class VsTextViewCreationListener : IVsTextViewCreationListener
    {
        [Import]
        IVsEditorAdaptersFactoryService AdaptersFactory = null; …
Run Code Online (Sandbox Code Playgroud)

mef visual-studio visual-studio-extensions

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

UIApplicationSignificantTimeChangeNotification 未在日期更改时触发

我在我的 AppDelegate 中设置了一个重要的时间更改通知 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(timeChange) name:UIApplicationSignificantTimeChangeNotification object:nil];

timeChange当我在手机上手动更改日期时,即使将应用程序置于前台,也不会调用该函数。

我也尝试过- (void)applicationSignificantTimeChange:(UIApplication *)application方法,但也没有被调用。

我在这里做错了吗?

ios

6
推荐指数
0
解决办法
1296
查看次数

如何在Spring Boot中启用HTTP响应缓存

我使用Spring Boot 1.0.2实现了一个REST服务器.我无法阻止Spring设置禁用HTTP缓存的HTTP标头.

我的控制器如下:

@Controller
public class MyRestController {
    @RequestMapping(value = "/someUrl", method = RequestMethod.GET)
    public @ResponseBody ResponseEntity<String> myMethod(
            HttpServletResponse httpResponse) throws SQLException {
        return new ResponseEntity<String>("{}", HttpStatus.OK);
    }
}
Run Code Online (Sandbox Code Playgroud)

所有HTTP响应都包含以下标头:

Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Expires: 0
Pragma: no-cache
Run Code Online (Sandbox Code Playgroud)

我已尝试以下方法删除或更改这些标头:

  1. 呼叫setCacheSeconds(-1)控制器.
  2. 呼叫httpResponse.setHeader("Cache-Control", "max-age=123")控制器.
  3. 定义我调用的@Bean返回值.WebContentInterceptorsetCacheSeconds(-1)
  4. 将属性设置spring.resources.cache-period为-1或正值application.properties.

以上都没有任何影响.如何在Spring Boot中为所有或单个请求禁用或更改这些标头?

java spring spring-mvc spring-security spring-boot

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

Perl比较2个数组阵列需要太长时间

我在perl中开发了一个比较器工具,它从2个CSV文件中获取数据,并根据一组唯一键进行比较,并生成一个excel报告.只要我有20k-30k行,每个CSV文件有10列,这个工具工作得很好,但比较算法所花费的时间过高,目前我在每个CSV文件中运行98k行并且它已经被现在跑了4个多小时,我觉得还有更长的时间.

我使用的算法是:

  1. 循环第一个数组
  2. 使用标识为唯一键的索引和第一个数组中的数据来grep第二个数组
  3. 将匹配的数组推送到一个新数组并将其从原始数组中删除,这样最后我获得在新数组中匹配的行,并且无法匹配的行保留在原始数组中.

以下是我的比较代码:

# Actual comparison
# Matched rows will go to @finalMatchedArray1 and @finalMatchedArray2
# Unmatched arrays will stay in the original arrays
for ( my $j=0; $j<=$#matchArray1; $j++ ) {
    my @result = map {$_}
        grep { "@{ $matchArray2[$_] }[@mapKeyArray2]" eq "@{ $matchArray1[$j] }[@mapKeyArray1]" }
        0 .. $#matchArray2;

    if ( defined $result[0] ) {
        push @finalMatchedArray1,$matchArray1[$j];
        push @finalMatchedArray2,$matchArray2[$result[0]];
        splice ( @matchArray2,$result[0],1 );
        splice ( @matchArray1,$j,1 );
        $j--;
    }
}
Run Code Online (Sandbox Code Playgroud)

以下是数据:

$matchArray1   = [[qw(a b c)], …
Run Code Online (Sandbox Code Playgroud)

perl

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