走过海棠暮

文章 评论 浏览 25

走过海棠暮 2024-09-03 11:52:28

事实上,解决方案确实与保留有关,正如用户不变所指出的那样。类方法:

output = [NSMutableString stringWithCapacity:0];

返回一个autorelease NSMutableString。当分配给我的输出属性时——看起来,即使有保留标志——它也没有保留它。解决方案是自己分配它而不是自动释放:

output = [[NSMutableString alloc] initWithCapacity:0];

然后保留就起作用了。任何关于原因的解释都将非常受欢迎。

编辑

找出原因。我直接访问实例变量,而不是通过我合成的 getter/setter。有关更多信息,请访问我的博客

The solution did in fact have to do with retention, as indicated by user invariant. The class method:

output = [NSMutableString stringWithCapacity:0];

returns an autorelease NSMutableString. When assigned to my output property -- seemingly, even with the retain flag -- it did not retain it. The solution was to alloc it myself and not autorelease:

output = [[NSMutableString alloc] initWithCapacity:0];

Then the retain worked. Any explanation as to why would be very welcome.

Edit

Figured out why. I was accessing the instance vars directly instead of through the getter/setter that I synthesized. More info on my blog.

将字符串附加到 NSMutableString

走过海棠暮 2024-09-03 06:04:12

坐下来思考如何在给定数组的起始位置的情况下找到 a[i][j] 的内存位置。

请注意,c 数组的布局如下 a[0][0] a[0][1] a[0][2] > ... a[0][M] a[1][0]...

旁注: FORTRAN 数组的布局不同的是: a[1][1] a[2][1] a[3][1] ... a[N][1] a[1][2] ...

注意这将如何改变查找内存位置所需的维度。

Sit down and figure out how to find the memory position of a[i][j] given the starting position of the array.

Note that c arrays are laid out like this a[0][0] a[0][1] a[0][2] ... a[0][M] a[1][0]...

Side note: FORTRAN arrays are laid out differently: a[1][1] a[2][1] a[3][1] ... a[N][1] a[1][2] ...

Notice how this would change which dimension is needed for finding memory positions.

为什么只有第二个数组维度很重要?

走过海棠暮 2024-09-02 23:10:36

框架是理想的,但正如你所说,iPhone 上不允许使用框架。我认为最终您需要提供至少 3 个文件:头文件、静态库和资源包。

头文件只包含您想要公开的所有 API。如果您有多个类,您可能需要提供多个标头。

对于静态库,我建议像平常一样为每个架构(设备和模拟器)编译它,然后使用 lipo 将它们组合起来,如下所示(根据需要替换路径):

lipo -create -output output/file/path device/file/path simulator/file/path

使用捆绑包,您可以在 Xcode 中创建一个新目标来创建捆绑包,但实际上它只是一个文件夹。您还需要让您的 SDK 知道如何加载捆绑包并获取资源。但是,您无法从捆绑包中加载可执行代码;这就是框架无法在 iPhone 上运行的原因。

Frameworks would be ideal, but as you said, aren't allowed on the iPhone. I think in the end you'll need to provide at least 3 files: a header file, a static library, and a resource bundle.

The header file would simply have all the API's you do want to expose. If you have multiple classes you may want to provide multiple headers.

For the static library I recommend compiling it like normal for each architecture (Device and Simulator), and then use lipo to combine them like so (replacing paths as necessary):

lipo -create -output output/file/path device/file/path simulator/file/path

With the bundle you can make a new target in Xcode to create a bundle, but really it's just a folder. You would also need to make you're SDK know how to load the bundle, and get to the resources. You can't load executable code from the bundle however; that is the reason frameworks don't work on the iPhone.

如何为 iPhone 打包 SDK(静态库 + xibs)?

走过海棠暮 2024-09-02 17:54:48

您可以在 jQuery 中将其缩短为:

$(function() {
  $('.pagination a').live('click', function(e) {
    $(this).parent('.pagination')
           .append("<img src='/images/spinner.gif' class='spinner' />");
    $.get($(this).attr("href"));
    return false;
  });
});

我不完全确定 new Ajax.Request(el.href, { method: 'get' }) 不过,这是一个正在请求的脚本吗?返回后似乎没有对内容进行任何处理。

You can shorten this down a bit in jQuery to:

$(function() {
  $('.pagination a').live('click', function(e) {
    $(this).parent('.pagination')
           .append("<img src='/images/spinner.gif' class='spinner' />");
    $.get($(this).attr("href"));
    return false;
  });
});

I'm not entirely sure about new Ajax.Request(el.href, { method: 'get' }) though, is this a script being requested? It looks like nothing's being done with the content after return.

帮助将一些 Prototype JavaScript 移植到 jQuery

走过海棠暮 2024-09-02 17:36:46

FK 名称对于维护很重要。一般来说我只引用FK和两个表名,而不引用名称中的字段。如果您正确命名了字段,那么这些字段是什么将是显而易见的。

FK names are important for maintenance. Generally I only refernce the FK and the two table names, not the fields in the names. If you have named your fields correctly, it will be obvious what the fields are.

如何处理描述性数据库表名称及其对外键名称的影响?

走过海棠暮 2024-09-02 16:48:12

您可以像这样插入评论

Dim Customers As XDocument = <?xml version="1.0" encoding="UTF-8" standalone="no"?>
                     <customers>
                         <customer>
                             <LastName>Jones</LastName>
                         </customer>
                         <customer>
                             <LastName>Baggins</LastName>
                             <FirstName>Billbo</FirstName>
                         </customer>
                         <customer>
                             <LastName>Baggins</LastName>
                             <FirstName>Frodo</FirstName>
                         </customer>
                         <customer>
                             <LastName>Kurata</LastName>
                             <FirstName>Deborah</FirstName>
                         </customer>
                     </customers>

Customers.Root.AddBeforeSelf(New XComment("Application Version: " & My.Application.Info.Version.ToString()))

You can insert the comment like this

Dim Customers As XDocument = <?xml version="1.0" encoding="UTF-8" standalone="no"?>
                     <customers>
                         <customer>
                             <LastName>Jones</LastName>
                         </customer>
                         <customer>
                             <LastName>Baggins</LastName>
                             <FirstName>Billbo</FirstName>
                         </customer>
                         <customer>
                             <LastName>Baggins</LastName>
                             <FirstName>Frodo</FirstName>
                         </customer>
                         <customer>
                             <LastName>Kurata</LastName>
                             <FirstName>Deborah</FirstName>
                         </customer>
                     </customers>

Customers.Root.AddBeforeSelf(New XComment("Application Version: " & My.Application.Info.Version.ToString()))

如何将变量插入 XML Literals 注释部分并对其进行求值?

走过海棠暮 2024-09-02 09:58:06

怎么样?

 http://www.37signals.com/[PRODUCTNAME]/projects/431678/posts/2964581/comments#5854236

嗯,真的不太确定你在问什么,

Um, how about something like

 http://www.37signals.com/[PRODUCTNAME]/projects/431678/posts/2964581/comments#5854236

Not quite sure what you're asking, really.

重新设计 37signals 路径以托管在单个域下

走过海棠暮 2024-09-02 07:34:50

尝试将其更改为 SelectedItem 并设置 Mode=TwoWay...

<ComboBox ItemsSource="{Binding OrderInfoVm.AllCountries}"
          SelectedValuePath="country_code" DisplayMemberPath="country_name" 
          SelectedItem="{Binding OrderInfoVm.BillingCountry, Mode=TwoWay}" />

编辑:您可能不需要将其更改为 SelectedItem,也许只需设置 TwoWay 就可以了,但这就是我在自己的代码中完成的方式。

Try changing it to SelectedItem and set Mode=TwoWay...

<ComboBox ItemsSource="{Binding OrderInfoVm.AllCountries}"
          SelectedValuePath="country_code" DisplayMemberPath="country_name" 
          SelectedItem="{Binding OrderInfoVm.BillingCountry, Mode=TwoWay}" />

Edit: You may not need to change it to SelectedItem, perhaps just setting TwoWay will work, but that is how I've done it in my own code.

ComboBox wpf 未选择项目

走过海棠暮 2024-09-02 07:10:29
  public class PhpStyleArrayBinder : DefaultModelBinder,IModelBinder
    {
        public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
        {
            var val = bindingContext.ValueProvider.GetValue(bindingContext.ModelName+"[]");
            if (val != null)
                return val;
            return base.BindModel(controllerContext, bindingContext);
        }
    }

用法:

public JsonResult Get([ModelBinder(typeof (PhpStyleArrayBinder))] IEnumerable<string> data)
        {
            //
        }

http://pavelsvetlov.blogspot.com/2016/04 /mvcnet-modelbinder-phpstyle-array.html

  public class PhpStyleArrayBinder : DefaultModelBinder,IModelBinder
    {
        public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
        {
            var val = bindingContext.ValueProvider.GetValue(bindingContext.ModelName+"[]");
            if (val != null)
                return val;
            return base.BindModel(controllerContext, bindingContext);
        }
    }

usage:

public JsonResult Get([ModelBinder(typeof (PhpStyleArrayBinder))] IEnumerable<string> data)
        {
            //
        }

http://pavelsvetlov.blogspot.com/2016/04/mvcnet-modelbinder-phpstyle-array.html

PHP 数组可以通过 POST 方法在 ASP.NET MVC 中捕获吗?

走过海棠暮 2024-09-02 05:01:39

这是一个可以帮助您开始正确方向的链接。

http://www.chrisumbel.com/article/basic_authentication_iphone_cocoa_touch

Here is a link that may get you started in the right direction.

http://www.chrisumbel.com/article/basic_authentication_iphone_cocoa_touch

使用 Obj C 和 Xcode 进行基本 HTTP 身份验证

走过海棠暮 2024-09-02 04:53:15

由于一些原因,我会使用 jQuery 验证插件

你已经验证了,好吧,现在怎么办?您需要显示错误,在错误有效时处理删除它,显示总共有多少错误?它可以为您处理很多事情,无需重新发明轮子。

此外,另一个巨大的好处是它托管在 CDN 上,可以在此处找到发表此答案时的当前版本http://www.asp.net/ajaxLibrary/CDNjQueryValidate16.ashx 这意味着客户端的加载时间更快。

I would use the jQuery validation plugin for a few reasons.

You validated, ok great, now what? You need to display the error, handle erasing it when it is valid, displaying how many errors total perhaps? There are lots of things it can handle for you, no need to re-invent the wheel.

Also, another huge benefit is it's hosted on a CDN, the current version at the time of this answer can be found here: http://www.asp.net/ajaxLibrary/CDNjQueryValidate16.ashx This means faster load times for the client.

如何使用 JQuery 验证电子邮件地址?

走过海棠暮 2024-09-02 02:27:30

如果您想截断表,可能必须删除外键并将它们添加回来。来自此处

“您不能在 FOREIGN KEY 约束引用的表上使用 TRUNCATE TABLE;而是使用不带 WHERE 子句的 DELETE 语句。因为 TRUNCATE TABLE 未记录,所以无法激活触发器。”

类似的问题此处 在这样的情况下。

If you want to truncate the table, probably you have to drop the foreign keys and add them back. From here.

"You cannot use TRUNCATE TABLE on a table referenced by a FOREIGN KEY constraint; instead, use DELETE statement without a WHERE clause. Because TRUNCATE TABLE is not logged, it cannot activate a trigger."

Similar question here in SO.

禁用所有表上的外键约束不起作用

走过海棠暮 2024-09-02 02:11:10

由于您使用 eclipse,设置断点并逐步执行该方法,这可能会花费一些时间,但它有助于查找错误。 (例如,检查对象 ID 以查看引用是否已更改)。

Since you use eclipse, set a breakpoint and step through the method, it may take time but it helps with finding bugs. (check the object ids for example to see if the reference has changed).

Java ArrayList 中的对象不会更新

走过海棠暮 2024-09-01 22:18:15

导出表仅包含导出函数的条目。如果调试信息可用,通常也会有大多数其他功能的条目。如果没有这个,可执行文件很可能根本不包含有关尚未导出的函数的任何信息。

The export table only contains entries for exported functions. If you debugging information available, there will usually be entries for most other functions as well. Without that, chances are pretty good that the executable simply doesn't contain any information about functions that haven't been exported.

导出表是否包含 Win32 Exe 函数的所有条目?

走过海棠暮 2024-09-01 18:57:28

让我提前道歉,我没有给你答案,但我确实有一个插件建议,可能比小部件上下文或小部件逻辑更好(这个可以让您从“帖子编辑”添加小部件内容)屏幕):

http://wordpress.org/extend/plugins/my-snippets/

Let me apologize in advance, I don't have an answer for you but I do have a plugin suggestion that may be a better fall back than Widget Context or Widget Logic (this one lets you add the widget content from the "post edit" screen):

http://wordpress.org/extend/plugins/my-snippets/

从页面编辑屏幕管理小部件

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