半城柳色半声笛

文章 评论 浏览 26

半城柳色半声笛 2024-12-14 22:50:39

使用下面的代码更改您的 viewDidLoad 它将起作用

- (void)viewDidLoad {
     [super viewDidLoad];

     NSString *rootPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)objectAtIndex:0];      
     path = [rootPath stringByAppendingPathComponent:[NSString stringWithFormat:@"currency.archive"]]; 
     banks = [[NSDictionary alloc] initWithDictionary:[NSKeyedUnarchiver unarchiveObjectWithFile:path]];
     keys = [[NSArray alloc] initWithArray:[banks allKeys]];
     // set date for last update 
     dayMonthYear.text = [banks objectForKey:@"Last Updated"];
 }

Change your viewDidLoad with below code it will work

- (void)viewDidLoad {
     [super viewDidLoad];

     NSString *rootPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)objectAtIndex:0];      
     path = [rootPath stringByAppendingPathComponent:[NSString stringWithFormat:@"currency.archive"]]; 
     banks = [[NSDictionary alloc] initWithDictionary:[NSKeyedUnarchiver unarchiveObjectWithFile:path]];
     keys = [[NSArray alloc] initWithArray:[banks allKeys]];
     // set date for last update 
     dayMonthYear.text = [banks objectForKey:@"Last Updated"];
 }

滚动 TableView 时应用程序崩溃

半城柳色半声笛 2024-12-14 18:00:53

我遇到了同样的问题,在尝试了一些之后认为以下两个步骤可以解决问题:

  1. 使用 这个问题
  2. 从其文件夹中运行 netbeans,并使用上一步的结果指定 jdkhome:

~/netbeans-XX/bin/netbeans --jdkhome /usr/lib/jvm/java-7-openjdk-amd64/

I had the same problem, after trying some thinks the following two steps solve the problem:

  1. Locate the java folder, using this question
  2. Run the netbeans from its folder, specifying the jdkhome with the result of the previous step:

~/netbeans-X.X/bin/netbeans --jdkhome /usr/lib/jvm/java-7-openjdk-amd64/

Netbeans 禁用了所有功能 &当我中断插件升级过程时,它变成了一个简单的文本编辑器

半城柳色半声笛 2024-12-14 15:09:37
DesiredCapabilities ieCapabilities = DesiredCapabilities.internetExplorer();
ieCapabilities.setCapability(
    InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS,
    true
); 
WebDriver dr = new InternetExplorerDriver(ieCapabilities);
DesiredCapabilities ieCapabilities = DesiredCapabilities.internetExplorer();
ieCapabilities.setCapability(
    InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS,
    true
); 
WebDriver dr = new InternetExplorerDriver(ieCapabilities);

IE 的 Selenium 脚本

半城柳色半声笛 2024-12-14 10:59:58

您可以更改代码以使用不同的方法执行:

public class DeleteItemCommand: BaseCommand
{
    public int ItemId {get; set;}
    public override void Execute()
    {
        PrivateExecute(ItemId);
    }

    private void PrivateExecute(int itemId)
    {
        Contract.Requires<VeryBadThingHappendException>(itemId != default(int));

        var rep = AnyKindOfFactory.GetItemRepository();
        rep.DeleteItem(itemId);
    }
}

You could change the code to perform the execution in a different method:

public class DeleteItemCommand: BaseCommand
{
    public int ItemId {get; set;}
    public override void Execute()
    {
        PrivateExecute(ItemId);
    }

    private void PrivateExecute(int itemId)
    {
        Contract.Requires<VeryBadThingHappendException>(itemId != default(int));

        var rep = AnyKindOfFactory.GetItemRepository();
        rep.DeleteItem(itemId);
    }
}

代码契约、继承和里氏原则

半城柳色半声笛 2024-12-14 09:13:00

该解决方案可能与您的问题不符,但这将为完成您的任务提供一个想法。

XUL 文本框:

<textbox id="textbox" type="search" oncommand="SearchKeyword(this)"/>

Js:

function SearchKeyword(oElem) // Function for search for the characters
        {
         var filter = document.getElementById("textbox");
         filter.setAttribute("value", oElem.value);
         document.getElementById("myTodoListTree").builder.rebuild();
      }

This solution is mayn't corresponding to your problem but this will give an idea to finsh your task.

XUL Textbox:

<textbox id="textbox" type="search" oncommand="SearchKeyword(this)"/>

Js:

function SearchKeyword(oElem) // Function for search for the characters
        {
         var filter = document.getElementById("textbox");
         filter.setAttribute("value", oElem.value);
         document.getElementById("myTodoListTree").builder.rebuild();
      }

搜索按钮点击事件

半城柳色半声笛 2024-12-14 05:57:14

将下拉列表中的 AppendDataBoundItems 属性设置为 true,数据源中的项目将显示在您在标记中添加的任何 ListItems 之后,例如

<asp:DropDownList ID="classInstructor" runat="server" DataSourceID="SqlDataSource3" 
    DataTextField="InstrName" DataValueField="InstrName" AppendDataBoundItems="true">
    <asp:ListItem Value="Default" Text="Default" Selected="True"/>
</asp:DropDownList>

Set the AppendDataBoundItems property to true on the dropdown list and the items from the data source will appear after any ListItems you add in the markup e.g.

<asp:DropDownList ID="classInstructor" runat="server" DataSourceID="SqlDataSource3" 
    DataTextField="InstrName" DataValueField="InstrName" AppendDataBoundItems="true">
    <asp:ListItem Value="Default" Text="Default" Selected="True"/>
</asp:DropDownList>

填充下拉列表

半城柳色半声笛 2024-12-14 02:07:00

我会尝试删除突出显示和取消突出显示方法,并在验证设置中简单地指定 errorClass 选项。由于您所做的只是添加和删除类,因此您可以让验证框架为您完成此操作。您可以在此处查看有关 errorClass 选项的更多信息: http://docs.jquery.com/Plugins /验证/validate#options

I would try removing your highlight and unhighlight methods and simply specify an errorClass option in your validation setup. Since all you are doing is adding and removing a class you can let the validation framework do this for you. You can see more about the errorClass option here: http://docs.jquery.com/Plugins/Validation/validate#options

jQuery Validate 和 Ajax - 失败后重置验证

半城柳色半声笛 2024-12-14 00:16:50

您的基本问题是您不了解 XPath。 (您的同伴很好;XPath 相当令人困惑。)您的选择器根本不匹配您认为它们匹配的内容。特别是那个爆炸的

*/img

应该是

//img

或者类似的东西。

现在,由于 xpath 选择器不匹配任何内容,因此该 Ruby 语句的值为

block.at_xpath("*/img")

nil。并且 nil 不支持 [],因此当您尝试对其调用 ["width"] 时,Ruby 会抱怨 nil 的 未定义方法 [] :NilClass 错误。

至于为什么只有当你将它分配给一个变量时它才会爆炸......是的,这实际上并不是发生的事情。您可能还改变了其他东西。


现在,请允许我提出一些其他希望有建设性的代码批评:

  • 您的问题显然是为了使其难以回答而设计的。将来,请隔离有问题的代码,不要只是粘贴整个作业(或此屏幕抓取工具的用途)。

  • 如果您将其制作成我们可以在计算机上逐字执行的单个可运行 Ruby 文件,那就太好了,例如:

.

require "nokogiri"
doc = Nokogiri.parse <<-HTML
<tr>
  <td><img src="http://ycombinator.com/images/s.gif" height="1" width="0"></td>
  <td valign="top"><center>
    <a id="up_3004849" href="vote?for=3004849&dir=up&whence=%2f%78%3f%66%6e%69%64%3d%34%6b%56%68%71%6f%52%4d%38%44"><img src="http://ycombinator.com/images/grayarrow.gif" border="0" vspace="3" hspace="2"></a><span id="down_3004849"></span>
  </center></td>
  <td class="default">
    <div style="margin-top:2px; margin-bottom:-10px; ">
      <span class="comhead">
        <a href="user?id=patio11">patio11</a> 12 days ago  | <a href="item?id=3004849">link</a> | <a href="item?id=3004793">parent</a> | on: <a href="item?id=3004471">Ask HN: What % of your job interviewees pass FizzB...</a>
      </span>
    </div>
    <br><span class="comment"><font color="#000000">Every time FizzBuzz problems come up among engineers, people race to solve them and post their answers, then compete to see who can write increasingly more nifty answers for a question which does not seek niftiness at all.<p>I'm all for intellectual gamesmanship, but these are our professional equivalent of a doctor being asked to identify the difference between blood and water.  You can do it.  <i>We know</i>.  Demonstrating that you can do it is not the point of the exercise.  We do it to have a cheap-to-administer test to exclude people-who-cannot-actually-program-despite-previous-job-titles from the expensive portions of the hiring process.</p></font></span><p><font size="1"><u><a href="reply?id=3004849&whence=%2f%78%3f%66%6e%69%64%3d%34%6b%56%68%71%6f%52%4d%38%44">reply</a></u></font></p>
  </td>
</tr>
HTML

width = doc.at_xpath("*/img")["width"].to_i

这样我们就可以用计算机来调试,而不仅仅是用我们的头脑。

  • 您现在正在编写 Ruby,而不是 Java,因此请遵循 Ruby 的 空格和命名约定:文件名是snake_case,缩进是2个空格,没有制表符等等。确实很难阅读格式错误的代码 - 其中“错误”意味着“非标准”。

  • 只要有这些描述性注释(### Date and Time ###),就有机会提取方法(def date_and_time(array))并使您的代码更清晰、更易于调试。

Your basic problem is that you don't understand XPath. (You are in good company there; XPath is quite confusing.) Your selectors simply don't match what you think they match. In particular, the one that blows up

*/img

should be

//img

or something like that.

Now, because the xpath selector doesn't match anything, the value of this Ruby statement

block.at_xpath("*/img")

is nil. And nil doesn't support [], so when you try to call ["width"] on it, Ruby complains with a undefined method [] for nil:NilClass error.

And as for why it only blows up when you assign it to a variable... yeah, that's not actually what's happening. You probably changed something else too.


And now, please allow me to make some other hopefully constructive code criticisms:

  • Your question was apparently designed to make it difficult to answer. In the future, please isolate the code in question, don't just paste in your whole homework assignment (or whatever this screen scraper is for).

  • It would be extra great if you made it into a single runnable Ruby file that we can execute verbatim on our computers, e.g.:

.

require "nokogiri"
doc = Nokogiri.parse <<-HTML
<tr>
  <td><img src="http://ycombinator.com/images/s.gif" height="1" width="0"></td>
  <td valign="top"><center>
    <a id="up_3004849" href="vote?for=3004849&dir=up&whence=%2f%78%3f%66%6e%69%64%3d%34%6b%56%68%71%6f%52%4d%38%44"><img src="http://ycombinator.com/images/grayarrow.gif" border="0" vspace="3" hspace="2"></a><span id="down_3004849"></span>
  </center></td>
  <td class="default">
    <div style="margin-top:2px; margin-bottom:-10px; ">
      <span class="comhead">
        <a href="user?id=patio11">patio11</a> 12 days ago  | <a href="item?id=3004849">link</a> | <a href="item?id=3004793">parent</a> | on: <a href="item?id=3004471">Ask HN: What % of your job interviewees pass FizzB...</a>
      </span>
    </div>
    <br><span class="comment"><font color="#000000">Every time FizzBuzz problems come up among engineers, people race to solve them and post their answers, then compete to see who can write increasingly more nifty answers for a question which does not seek niftiness at all.<p>I'm all for intellectual gamesmanship, but these are our professional equivalent of a doctor being asked to identify the difference between blood and water.  You can do it.  <i>We know</i>.  Demonstrating that you can do it is not the point of the exercise.  We do it to have a cheap-to-administer test to exclude people-who-cannot-actually-program-despite-previous-job-titles from the expensive portions of the hiring process.</p></font></span><p><font size="1"><u><a href="reply?id=3004849&whence=%2f%78%3f%66%6e%69%64%3d%34%6b%56%68%71%6f%52%4d%38%44">reply</a></u></font></p>
  </td>
</tr>
HTML

width = doc.at_xpath("*/img")["width"].to_i

That way we can debug with our computers, not just with our minds.

  • You're writing Ruby now, not Java, so conform to Ruby's spacing and naming conventions: file names are snake_case, indentation is 2 spaces, no tabs, etc. It really is difficult to read code that's formatted wrong -- where "wrong" means "non-standard."

  • Everywhere you have one of those descriptive comments (### Date and Time ###) is an opportunity to extract a method (def date_and_time(array)) and make your code cleaner and easier to debug.

无法为变量赋值:未定义方法“[]”;对于 nil:NilClass (NoMethodError)

半城柳色半声笛 2024-12-13 20:50:24

是的,您可以做到,有一个 PhoneGap 插件可以完全满足您的需求:

PhoneGap + Background.js
https://github.com/jocull/phonegap-backgroundjs

小心配置你的 config.xml

Yes you can do it, there's a PhoneGap plugin that does exactly what you need:

PhoneGap + Background.js
https://github.com/jocull/phonegap-backgroundjs

Be careful configuring your config.xml

使用 Phonegap 在后台执行 Javascript

半城柳色半声笛 2024-12-13 19:03:39

您不需要

command.add("cmd");
command.add("/c");

仅批处理文件所需的行。我宁愿指定可执行文件的完整路径。

也许输出在 stderr 上?尝试将 p.getInputStream() 替换为 p.getErrorStream()

You don't need the lines

command.add("cmd");
command.add("/c");

That would only be required for a batch file. I would rather specify the full path to the executable.

Maybe the output is on stderr? Try replacing p.getInputStream() with p.getErrorStream().

ProcessBuilder 执行自定义可执行文件

半城柳色半声笛 2024-12-13 17:03:42

这不是经过测试的答案,但它更接近推送部分:

# set wants to master
def wantmaster(haves, wants):
  global repo
  return { "refs/heads/master": repo.refs["HEAD"] }

client, src = dulwich.client.get_transport_and_path(origin_uri) 

client.send_pack(src, wantmaster, repo.object_store.generate_pack_contents)

此问题的变体正在我的代码中工作。

This is not a tested answer but it is closer on the push part:

# set wants to master
def wantmaster(haves, wants):
  global repo
  return { "refs/heads/master": repo.refs["HEAD"] }

client, src = dulwich.client.get_transport_and_path(origin_uri) 

client.send_pack(src, wantmaster, repo.object_store.generate_pack_contents)

A variation on this is working in my code.

如何向索引添加某些内容,提交它,然后使用 dulwich 将 master 分支推送到指定的远程?

半城柳色半声笛 2024-12-13 15:57:27

您的 bnd 描述符中需要两条指令。首先使用 Include-Resource 将目标 JAR 包含到您的捆绑包中:

Include-Resource: foo.jar

然后您需要指定 foo.jar 需要位于捆绑包类路径上。我假设包内容本身也需要成为包类路径的一部分,因此我们还需要将其包含在一个点中:

Bundle-ClassPath: ., foo.jar

请注意,@seh 的关于使用 Private-Package< 将 JAR 包放入包中的答案/code> 也是正确的(在这种情况下,JAR 需要在构建时类路径上可见)。不过,我永远不会为此使用 Export-Package ,因为我认为捆绑包应该严格控制它们导出的数量。

You need two instructions in your bnd descriptor. First use Include-Resource to include the target JAR into your bundle:

Include-Resource: foo.jar

Then you need to specify that foo.jar needs to be on the bundle classpath. I assume that the bundle contents itself also needs to be part of the bundle classpath, so we need to include it as well with a dot:

Bundle-ClassPath: ., foo.jar

Note that @seh's answer about slurping the JAR's packages into your bundle with Private-Package is also correct (in that case the JAR would need to be visible on the build-time classpath). I would never use Export-Package for this though, because I think bundles should keep tight control over how much they export.

使用 BND 嵌入第三方 JAR

半城柳色半声笛 2024-12-13 15:45:55

检查C:\Windows\System32\WindowsCodecs.dll是否存在

Check the existence of C:\Windows\System32\WindowsCodecs.dll

检查是否安装了 Windows 映像组件(wic 注册表)

半城柳色半声笛 2024-12-13 15:36:46

一旦将值添加到集合中,您就无法对其进行编辑。所以这是不可能的:

aColl.Item(aKey) = aColl.Item(aKey) + someValue

相反,您可以从集合中取出对象,编辑其值,然后将其添加回来。

temp = aColl.Item(aKey)
aColl.Remove aKey
aColl.Add temp + someValue, aKey

这有点乏味,但是将这三行放在 Sub 中就可以了。

当集合用作对象的容器时(与整数、双精度等“原始”变量的容器相反),它们会更加友好。您无法更改集合中包含的对象引用,但可以操作附加到该引用的对象。

顺便说一句,我认为您误解了与 Item 相关的语法。你不能说:aColl(aKey).Item。正确的语法是 aColl.Item(aKey),或者简称为 aColl(aKey),因为 Item 是 Collection 的默认方法目的。然而,我更喜欢使用完整、明确的形式......

You can't edit values once they've been added to a collection. So this is not possible:

aColl.Item(aKey) = aColl.Item(aKey) + someValue

Instead, you can take the object out of the collection, edit its value, and add it back.

temp = aColl.Item(aKey)
aColl.Remove aKey
aColl.Add temp + someValue, aKey

This is a bit tedious, but place these three lines in a Sub and you're all set.

Collections are more friendly when they are used as containers for objects (as opposed to containers for "primitive" variables like integer, double, etc.). You can't change the object reference contained in the collection, but you can manipulate the object attached to that reference.

On a side note, I think you've misunderstood the syntax related to Item. You can't say: aColl(aKey).Item. The right syntax is aColl.Item(aKey), or, for short, aColl(aKey) since Item is the default method of the Collection object. However, I prefer to use the full, explicit form...

在 VBA 中设置集合的 Item 属性

半城柳色半声笛 2024-12-13 14:59:54

您可以使用 ORDER BY IF 语句:

SELECT *
FROM table
ORDER BY IF(SORT = 0, 999999999, SORT)

或者可以使用 UNION ALL 语句来实现此目的:

(SELECT * FROM table WHERE sort > 0 ORDER BY sort)
UNION ALL
(SELECT * FROM table WHERE sort = 0)

You can use the ORDER BY IF statement:

SELECT *
FROM table
ORDER BY IF(SORT = 0, 999999999, SORT)

or you can use the UNION ALL statement to achieve this:

(SELECT * FROM table WHERE sort > 0 ORDER BY sort)
UNION ALL
(SELECT * FROM table WHERE sort = 0)

MySQL排序时如何排除某些值?

更多

推荐作者

愿与i

文章 0 评论 0

♡⃝ 酴醾

文章 0 评论 0

晚安先生.

文章 0 评论 0

123

文章 0 评论 0

时光清浅

文章 0 评论 0

避讳

文章 0 评论 0

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文