灯角

文章 0 评论 0 浏览 23

灯角 2024-12-02 13:44:26

将应用程序的名称更改为根
步骤:

  1. 单击您的应用程序根目录。

  2. 单击 f2 按钮。

  3. 并更改您想要的 apk 名称

Change the name of your application to the root
steps:

  1. click on your application root.

  2. click f2 button.

  3. and change the name which you want of ur apk

如何通过编辑清单文件来更改apk名称?

灯角 2024-12-02 13:02:38

Javadoc 由 Doclet 生成,它只能看到代码的解析版本。它与原始来源类似地对齐 throws 子句是巧合。您看到的签名实际上是从 MethodDoc 由框架传递给 Doclet。如果不更改 Doclet 代码,则无法更改输出格式。没有什么可以阻止你对其进行后处理,但我怀疑这是否值得付出努力。

顺便说一句,替代 doclet 可以在互联网上获取,这可能更适合定制。

The Javadoc is generated by a Doclet, which only gets to see a parsed version of your code. That it aligns the throws clause similarly to your original source is coincidence. The signature you see is actually generated from a MethodDoc handed by the framework to the Doclet. Short of changing the Doclet code, you can not change the output format. Nothing prevents you from post-processing it, but I doubt it will be worth the effort.

BTW, alternative doclets are available on the internet, which may be more suitable to customization.

JavaDoc方法签名缩进

灯角 2024-12-02 12:28:48

** 可能会引入一些更棘手的错误,因为它会接受任何内容。通常您希望代码在调用错误时会中断。下面是一个示例:

def dostuff(**kwargs):
 force = 3
 if kwargs.get('reallyhard', False):
     force += 5 
 # and so on

# Now you need luck to find this bug  ...
dostuff(fancy=True, funky=False, realyhard=True)

您不应该仅仅因为懒得键入参数名称而使用 **。但这并不总是可能的,因此也有合法的用途。

** can introduce some more tricky bug because it will accept anything. Usually you want code that breaks when called wrong. Here is a example:

def dostuff(**kwargs):
 force = 3
 if kwargs.get('reallyhard', False):
     force += 5 
 # and so on

# Now you need luck to find this bug  ...
dostuff(fancy=True, funky=False, realyhard=True)

You shouldn't use ** just because you are too lazy to type out the argument names. That is not always possible though, so there are legitimate uses too.

python 样式 ** 问题

灯角 2024-12-02 10:07:41
<!--[if gt IE 6]><!-->
This code displays on non-IE browsers and on IE 7 or higher.
Include your "vendor script" here.
<!--<![endif]-->

取自此处: http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment

<!--[if gt IE 6]><!-->
This code displays on non-IE browsers and on IE 7 or higher.
Include your "vendor script" here.
<!--<![endif]-->

Taken from here: http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment

如果浏览器是IE6则隐藏特定的DIV

灯角 2024-12-02 07:45:04

您可以使用 boost 或 tr1 shared_ptr 来代替它:

std::map<std::string, shared_ptr< MyClass > > myMap;
myValue = shared_ptr< MyClass >( new MyClass() );
myMap["myKey"] = myValue;

没有所有权问题,没有内存泄漏。

you could use this instead, using boost or tr1 shared_ptr:

std::map<std::string, shared_ptr< MyClass > > myMap;
myValue = shared_ptr< MyClass >( new MyClass() );
myMap["myKey"] = myValue;

no ownership issues, no memory leaks.

将堆对象分配给 std::map

灯角 2024-12-02 04:32:47

.NET 1.1 程序集包含与 .NET 2 或 .NET 4 程序集相同类型的 IL。仅元数据的格式发生了变化。抖动不介意将其转换为 64 位机器代码,并且 CLR 可以读取旧的元数据格式。仅当 .NET 1.1 程序集包含本机代码时才会出现问题。 Corflags.exe 实用程序,ILONLY 位。没有令人信服的理由来重建该程序集。

A .NET 1.1 assembly contains the same kind of IL as a .NET 2 or .NET 4 assembly. Only the format of the metadata has changed. The jitter doesn't mind translating it to 64-bit machine code and the CLR can read the old metadata format. Only if the .NET 1.1 assembly contains native code will you have a problem. Corflags.exe utility, ILONLY bit. There's no compelling reason to rebuild that assembly.

从 64 位应用程序引用 .net 1.1 程序集

灯角 2024-12-02 03:39:13

您应该尝试下面的代码:

 if (objWeb.IsRootWeb)
 {   
    SPContentType contentType = objWeb.ContentTypes["Wiki Page"];
    if (!contentType.Fields.ContainsField("Keywords"))
    {
      SPField field = objWeb.Fields["Keywords"];
      SPFieldLink fieldLink = new SPFieldLink(field);
      contentType.FieldLinks.Add(fieldLink);
      contentType.Update(true);
    }
 }
 else
 {
   SPContentType contentTyperoot = site.RootWeb.ContentTypes["Wiki Page"];
   if (!contentTyperoot.Fields.ContainsField("Keywords"))
   {
     SPContentType contentType = site.RootWeb.ContentTypes["Wiki Page"];
     if (!contentType.Fields.ContainsField("Keywords"))
     {
       SPField field = site.RootWeb.Fields["Keywords"];
       SPFieldLink fieldLink = new SPFieldLink(field);
       contentType.FieldLinks.Add(fieldLink);
       contentType.Update(true);
     }
   }
 }

我希望有人能从我的代码中得到帮助:)

You should try the code below:

 if (objWeb.IsRootWeb)
 {   
    SPContentType contentType = objWeb.ContentTypes["Wiki Page"];
    if (!contentType.Fields.ContainsField("Keywords"))
    {
      SPField field = objWeb.Fields["Keywords"];
      SPFieldLink fieldLink = new SPFieldLink(field);
      contentType.FieldLinks.Add(fieldLink);
      contentType.Update(true);
    }
 }
 else
 {
   SPContentType contentTyperoot = site.RootWeb.ContentTypes["Wiki Page"];
   if (!contentTyperoot.Fields.ContainsField("Keywords"))
   {
     SPContentType contentType = site.RootWeb.ContentTypes["Wiki Page"];
     if (!contentType.Fields.ContainsField("Keywords"))
     {
       SPField field = site.RootWeb.Fields["Keywords"];
       SPFieldLink fieldLink = new SPFieldLink(field);
       contentType.FieldLinks.Add(fieldLink);
       contentType.Update(true);
     }
   }
 }

I hope someone is being helped from my code :)

sharepoint:以编程方式将现有网站栏添加到现有内容类型

灯角 2024-12-02 02:08:07

是的,它会锁定。

DDL 语句发出架构锁(请参阅此链接),这将阻止访问直到操作完成。

确实没有办法解决这个问题,如果你仔细想想,这是有道理的。 SQL 需要知道表中有多少个字段,并且在此操作期间,某些行将比其他行拥有更多字段。

另一种方法是创建一个包含正确字段的新表,插入表,然后重命名表以将其交换出来。

Yes, it will lock.

DDL statements issue a Schema Lock (see this link) which will prevent access to the table until the operation completes.

There's not really a way around this, and it makes sense if you think about it. SQL needs to know how many fields are in a table, and during this operation some rows will have more fields than others.

The alternative is to make a new table with the correct fields, insert into, then rename the tables to swap them out.

在 SQL Server 2008 中添加列会锁定表吗?

灯角 2024-12-01 21:10:32

好吧,您可能应该首先使用 json 库序列化 error_dict

import json
out = json.dumps(error_dict)

鉴于您没有提供有关如何设置视图的任何上下文,我只能向您展示我将如何做到这一点:

@view_config(route_name='some_route', renderer='json')
def myview(request):
    if #stuff fails to validate:
        error_dict = # the dict
        request.response.status = 400
        return {'errors': error_dict}

    return {
        # valid data
    }

如果您想自己创建响应,那么:

response = HTTPBadRequest()
response.body = json.dumps(error_dict)
response.content_type = 'application/json'
return response

要调试问题,请停止基于 jQuery 是否工作并亲自查看请求以确定 Pyramid 是否正常运行,或者是否存在其他问题。

curl -i <url>

或者甚至只是在浏览器中打开调试器来查看响应中返回的内容。

Well you should probably start off by serializing the error_dict using a json library.

import json
out = json.dumps(error_dict)

Given that you don't give any context on how your view is setup, I can only show you how I would do it:

@view_config(route_name='some_route', renderer='json')
def myview(request):
    if #stuff fails to validate:
        error_dict = # the dict
        request.response.status = 400
        return {'errors': error_dict}

    return {
        # valid data
    }

If you want to create the response yourself, then:

response = HTTPBadRequest()
response.body = json.dumps(error_dict)
response.content_type = 'application/json'
return response

To debug the issue, stop going based off of whether jQuery works and look at the requests yourself to determine if Pyramid is operating correctly, or if it is something else that's going on.

curl -i <url>

Or even just open up the debugger in the browser to look at what is being returned in the response.

在金字塔中如何用json数据返回400响应?

灯角 2024-12-01 20:46:41

要在每个 ajax 请求上执行 js,请使用 Omnifaces onloadScript 组件:

Omnifaces onloadScript Showcase

To execute js on every ajax request use Omnifaces onloadScript component:

Omnifaces onloadScript showcase

JSF:Ajax 中的 Javascript JSF 响应

灯角 2024-12-01 12:27:44

varcustomers = allCustomers.Where(c => c.Orders.Any(o => o.ProductID == 6));

var customers = allCustomers.Where(c => c.Orders.Any(o => o.ProductID == 6));

LINQ:查询集合中的集合

灯角 2024-11-30 19:54:51

要平滑直方图,您需要使用一维滤波器。使用 filter 函数可以轻松完成此操作。这是一个示例:

I = imread('pout.tif');
h = imhist(I);
smooth_h = filter(normpdf(-4:4, 0,1),1,h);

当然,您可以使用您选择的任何平滑函数。平均值就是ones(1,8)

由于您的目标只是找到二值化图像的阈值,因此您可以使用 graythresh 函数使用了大津的方法。

To smooth the histogram you need to use a 1-D filter. This is easily done using the filter function. Here is an example:

I = imread('pout.tif');
h = imhist(I);
smooth_h = filter(normpdf(-4:4, 0,1),1,h);

Of course you can use any smoothing function you choose. The mean would simply be ones(1,8).

Since your goal here is just to find the threshold to binarize an image you could just use the graythresh function which uses Otsu's method.

在 MATLAB 中使用低通滤波器平滑直方图

灯角 2024-11-26 23:36:15

当用户按下“确定”时,旧组件(一些单选按钮)将被删除,并添加一个新的 JPanel,其中包含一堆文本字段。

使用CardLayout,如图此处。它非常适合这种情况。

游戏视图

When the user presses "OK", the old components (some radio buttons) are removed, and a new JPanel is added, with a bunch of textfields.

Use a CardLayout, as shown here. It is perfect for situations like this.

Game view High Scores view

在小程序中添加组件

灯角 2024-11-26 23:34:03

您不能将 NSUserDefaults 用于自定义类。从文档中:

NSUserDefaults 类提供了方便的访问方法
常见类型,例如浮点数、双精度数、整数、布尔值和 URL。一个
默认对象必须是属性列表,即(或
对于集合实例的组合):NSDataNSString
NSNumberNSDateNSArrayNSDictionary。如果你想存储任何
其他类型的对象,您通常应该将其存档以创建
NSData 的实例。

尝试使用 NSData。例如,要将自定义对象加载到数组中,您可以执行以下操作:

NSUserDefaults *currentDefaults = [NSUserDefaults standardUserDefaults];
NSData *dataRepresentingSavedArray = [currentDefaults objectForKey:@"savedArray"];
if (dataRepresentingSavedArray != nil)
{
        NSArray *oldSavedArray = [NSKeyedUnarchiver unarchiveObjectWithData:dataRepresentingSavedArray];
        if (oldSavedArray != nil)
                objectArray = [[NSMutableArray alloc] initWithArray:oldSavedArray];
        else
                objectArray = [[NSMutableArray alloc] init];
}

要归档数据,请使用:

[[NSUserDefaults standardUserDefaults] setObject:[NSKeyedArchiver archivedDataWithRootObject:objectArray] forKey:@"savedArray"];

只要您的自定义对象符合 NSCoding 协议,这一切都可以工作:

- (void)encodeWithCoder:(NSCoder *)coder;
{
    [coder encodeObject:label forKey:@"label"];
    [coder encodeInteger:numberID forKey:@"numberID"];
}

- (id)initWithCoder:(NSCoder *)coder;
{
    self = [[CustomObject alloc] init];
    if (self != nil)
    {
        label = [coder decodeObjectForKey:@"label"];
        numberID = [coder decodeIntegerForKey:@"numberID"];
    }   
    return self;
}

ABRecord 是一种不透明的 C 类型,因此它不是 Objective-C 意义上的对象。这意味着您无法扩展它,无法在其上添加类别,也无法向其发送消息。您唯一能做的就是使用 ABRecord 作为参数来调用 ABRecord 参考中描述的函数。

您可以做两件事来保留 ABRecord 引用的信息:

  1. 通过 获取 ABRecordid >ABRecordGetRecordID()ABRecordID 定义为 int32_t,因此您可以将其转换为 NSInteger 并将其存储在您喜欢的任何位置。您稍后可以从 ABAddressBookGetPersonWithRecordID()ABAddressBookGetGroupWithRecordID() 取回记录。但是,该记录可能会被用户或其他应用程序更改甚至删除。

  2. 将记录内的所有值复制到标准 NSObject 子类,并使用上面讨论的 NSCoding 来存储它。当然,您将无法从用户对记录所做的更改或添加中受益。

You cannot use NSUserDefaults for a custom class. From the documentation:

The NSUserDefaults class provides convenience methods for accessing
common types such as floats, doubles, integers, Booleans, and URLs. A
default object must be a property list, that is, an instance of (or
for collections a combination of instances of): NSData, NSString,
NSNumber, NSDate, NSArray, or NSDictionary. If you want to store any
other type of object, you should typically archive it to create an
instance of NSData.

Try using NSData. For example, to load custom objects into an array, you can do

NSUserDefaults *currentDefaults = [NSUserDefaults standardUserDefaults];
NSData *dataRepresentingSavedArray = [currentDefaults objectForKey:@"savedArray"];
if (dataRepresentingSavedArray != nil)
{
        NSArray *oldSavedArray = [NSKeyedUnarchiver unarchiveObjectWithData:dataRepresentingSavedArray];
        if (oldSavedArray != nil)
                objectArray = [[NSMutableArray alloc] initWithArray:oldSavedArray];
        else
                objectArray = [[NSMutableArray alloc] init];
}

To archive the data, use:

[[NSUserDefaults standardUserDefaults] setObject:[NSKeyedArchiver archivedDataWithRootObject:objectArray] forKey:@"savedArray"];

This will all work so long as your custom object complies with the NSCoding protocol:

- (void)encodeWithCoder:(NSCoder *)coder;
{
    [coder encodeObject:label forKey:@"label"];
    [coder encodeInteger:numberID forKey:@"numberID"];
}

- (id)initWithCoder:(NSCoder *)coder;
{
    self = [[CustomObject alloc] init];
    if (self != nil)
    {
        label = [coder decodeObjectForKey:@"label"];
        numberID = [coder decodeIntegerForKey:@"numberID"];
    }   
    return self;
}

ABRecord is an opaque C type, so it's not an object in the sense of Objective-C. That means you can not extend it, you can not add a category on it, you can not message it. The only thing you can do is call functions described in ABRecord Reference with the ABRecord as a parameter.

You could do two things to be able to keep the information referenced by the ABRecord around:

  1. Get the ABRecords id by ABRecordGetRecordID(). The ABRecordID is defined as int32_t so you can cast it to an NSInteger and store it wherever you like. You can later get the record back from ABAddressBookGetPersonWithRecordID() or ABAddressBookGetGroupWithRecordID(). However, the record could be changed or even deleted by the user or another app meanwhile.

  2. Copy all values inside the record to a standard NSObject subclass and use NSCoding as discussed above to store it. You will then, of course, not benefit from changes or additions to the record the user could have made.

将数据存储到 NSUserDefaults

灯角 2024-11-26 22:54:45

无论哪种方式,你的函数都必须“存在”在某个地方,因此你无法避免声明某种名称空间。我也同意你的观点,即在 XUL 中定义事件比附加它们更好。因此,我建议采用 3+4 的混合:

  • 找到一个对于你的插件来说是唯一的但又尽可能吸引人的命名空间,例如“catchyseo”。
  • 将插件的所有代码和所有变量放入此命名空间中。使用匿名函数包装器模式,例如(查看一些 jQuery 插件作为代码示例):

    window.catchyseo = (function(){var private = x; [...] })();
    
  • 在您的命名空间中,公开一些您可以在 XUL 中引用的事件处理程序。

这种方法为您提供了两个世界中最好的:您可以在 XUL 中定义事件,并且您拥有一个封闭的名称空间,没有任何全局名称空间污染 - 除了您的一个名称空间变量。

Your functions have to "live" somewhere either way, so you cannot avoid to claim some kind of namespace. I also agree to your point that defining the event in the XUL is better than attaching them. So, I propose a hybrid between 3+4:

  • Find a namespace that is unique for your plugin yet as catchy as possible, for example "catchyseo".
  • Place all the code of your plugin and all variables inside this namespace. Use the anonymous function wrapper pattern like (have a look at some jQuery plugins as code examples):

    window.catchyseo = (function(){var private = x; [...] })();
    
  • In your namespace, expose some event handlers which you can reference in your XUL.

This approach gives you the best of two worlds: you can define your events in XUL and you have a closed namespace without any global namespace pollution - except your one namespace variable.

Firefox 扩展如何最好地避免污染全局命名空间?

更多

推荐作者

束缚m

文章 0 评论 0

alipaysp_VP2a8Q4rgx

文章 0 评论 0

α

文章 0 评论 0

一口甜

文章 0 评论 0

厌味

文章 0 评论 0

转身泪倾城

文章 0 评论 0

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