问题列表 - 第29855页

取消UILocalNotification

我的UILocalNotification有问题.

我正在使用我的方法安排通知.

- (void) sendNewNoteLocalReminder:(NSDate *)date  alrt:(NSString *)title
{
    // some code ...
    UILocalNotification *localNotif = [[UILocalNotification alloc] init]; 

    if (localNotif == nil)  
        return;

    localNotif.fireDate = itemDate; 
    localNotif.timeZone = [NSTimeZone defaultTimeZone];
    localNotif.alertAction = NSLocalizedString(@"View Details", nil); 
    localNotif.alertBody = title;
    localNotif.soundName = UILocalNotificationDefaultSoundName; 
    localNotif.applicationIconBadgeNumber = 0;

    NSDictionary *infoDict = [NSDictionary dictionaryWithObject:stringID forKey:@"id"]; 
    localNotif.userInfo = infoDict; 

    [[UIApplication sharedApplication] scheduleLocalNotification:localNotif]; 
    [localNotif release];
}
Run Code Online (Sandbox Code Playgroud)

它工作正常,我正确收到通知.问题是我应该取消通知.我正在使用这种方法.

- (void) deleteNewNoteLocalReminder:(NSString*) reminderID noteIDe:(NSInteger)noteIDE
{
    [[UIApplication sharedApplication] cancelLocalNotification:(UILocalNotification *)notification ????  
}
Run Code Online (Sandbox Code Playgroud)

我不知道该怎么做,但我的问题是:

我如何知道应删除哪个UILocalNotification对象?
有没有办法列出所有通知?

我唯一拥有的是我应删除的提醒ID.
我正在考虑将UILocalNotification对象保存在我的"Note"对象中并以此方式获取,当我保存到我的SQLite数据库时序列化对象等等......是否有更聪明的方法?

iphone notifications cocoa-touch ios4

48
推荐指数
5
解决办法
4万
查看次数

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

为什么在全局或外部声明结构时会出现段错误?

我在头文件中定义了一个结构,如下所示:

#define LC_ERR_LEN 300
typedef struct dLC_ERRMSG {
   short nr;
   short strategy;
   char tx[LC_ERR_LEN];
} LC_ERRMSG;
Run Code Online (Sandbox Code Playgroud)

我在我的代码中使用的是:

LC_ERRMSG err;
char *szError;
szError = strerror(sStatus);
snprintf(err.tx,LC_ERR_LEN," %s - %s",szFilename,szError);
/* do something with our error string */
Run Code Online (Sandbox Code Playgroud)

这样可行.但是,如果我LC_ERRMSG err;全局声明- 即在使用它的函数之外,或者甚至extern LC_ERRMSG err;(这是我的初衷,因为我希望能够在中心位置读出错误状态),snprintf调用的代码段错误.

你能告诉我任何线索吗?

ddd告诉我,当全局声明时,内存被初始化为全零,或者在声明为extern时至少初始化和可读.值szFilename,szError和LC_ERR_LEN都是正确且有意义的.

c++ printf struct extern segmentation-fault

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

终端中的Python

这个问题涉及在终端中运行未存储在主目录中的python文件.我想通过修改我的路径来解决这个难题的第一部分,以便它包含我的python程序存储的目录.

那么最初 echo $PATH会产生以下结果:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin

它现在产生: /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/Users/paulpatterson/Documents/Python

但是,尽管现在我的路径中存在正确的文件夹,但此文件夹中没有任何python文件运行.例如,当我打开终端并键入时,其中有一个名为recap.py的文件: python recap.py 我得到:

python: can't open file 'recap.py': [Errno 2] No such file or directory
Run Code Online (Sandbox Code Playgroud)

如果我只是输入recap.py(即省略'python'位),我得到: -bash: /Users/paulpatterson/Documents/Python/recap.py: Permission denied

任何人都可以开导我吗?理想情况下,我想设置它,所以一旦终端打开,我需要做的就是输入文件名,甚至不输入python.

我花了好几个小时试图解决这个问题,任何帮助都表示赞赏.

保罗.

python macos terminal

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

用户右键单击时打开所有文件并选择"打开方式"

我有一个用WPF/C#编写的应用程序,它可以将多个文件作为命令行参数.当我从命令行运行多个文件时,它会打开所有文件.当我在资源管理器窗口中选择多个文件并将它们拖到应用程序图标时,它会打开所有文件.但是如果我在资源管理器中选择多个文件并右键单击,请选择打开方式,然后选择我的应用程序,它只打开最后一个.有没有办法告诉Windows我的应用程序可以处理多个文件?我注意到有些程序似乎以这种方式工作,而其他程序则没有.

c# wpf

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

nhibernate或在sql语句中

我如何在nhibernate中获得相当于sql"或"的东西

我有以下方法.基本上我希望看​​看关键字是否在product.Name或Product.Description中找到.

   public ICollection<ProductCategory> FindByCompanyIdAndSearchAndPop(int companyId, string keyword)
    {
        var products = _session
            .CreateCriteria(typeof(ProductCategory))
            .CreateAlias("Product", "product", JoinType.InnerJoin)
            .Add(Restrictions.Eq("CompanyId", companyId))
            .Add(Restrictions.Eq("product.IsPopItem", true))
            .Add(Restrictions.Like("product.Name", keyword, MatchMode.Anywhere))
            .Add(Restrictions.Like("product.Description", keyword, MatchMode.Anywhere))
            .List<ProductCategory>();
        return products;
    }
Run Code Online (Sandbox Code Playgroud)

nhibernate

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

HTA文件中的Javascript

每次当我尝试使用vbscript在hta文件中添加javascript时,当我单击提交按钮时会出现错误消息:

object doesn't support this property or method
Run Code Online (Sandbox Code Playgroud)

我试试这个

<script type="text/javascript" src=""></script>
Run Code Online (Sandbox Code Playgroud)

还有这个

    <script type="text/javascript">
       ...code
    </script>
Run Code Online (Sandbox Code Playgroud)

有谁知道这个问题?

//编辑:我有问题,我忘记了一个VBScript:调用vbscript sub感谢!!

<input type="submit" value=" Submit " onclick="Submit" style="margin-left:100px;">
Run Code Online (Sandbox Code Playgroud)

这是正确的:

<input type="submit" value=" Submit " onclick="VBScript:Submit" style="margin-left:100px;">
Run Code Online (Sandbox Code Playgroud)

javascript vbscript hta

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

sha-1是否会为小于160位的输入消息产生冲突?

我有一个128位ID,我想要执行单向散列,但我不想为输入消息获得相同的摘要.有没有人知道sha-1或替代方案是否保证不会产生小于其输出摘要大小的消息集的冲突?这至少在理论上是可能的......

我还考虑过使用RSA,丢弃私钥给我一个单向加密,但是我需要将结果存储在一个32 char数据库字段中,而我可用的加密方案不会产生足够小的东西.

任何关于产生原始值的确定性,不可逆和无碰撞变换的方法的建议都是受欢迎的.

java hash sha1 rsa cryptographic-hash-function

14
推荐指数
2
解决办法
1321
查看次数

将网站部署包构建为postbuild事件

我正在使用visual studio 2010.我有一个网站项目,我想在每次构建项目时构建一个网站部署包.基本上我正在寻找一个post build MSBuild命令的例子,该命令基本上与网站右键菜单中的"Build Deployment Package"选项做同样的事情.

msbuild visual-studio-2010 msdeploy

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

实体框架:如何在修改模型时更新数据库

在Entity Framework 4中,有"从数据库更新模型"和"从模型生成数据库"选项.但我缺少的是一个选项

从模型更新数据库

它通过修改数据库模式(例如添加新列)反映模型中所做的更改(例如,添加新的Property或Navigation-Property).不失其内容.

有人知道实现这一目标的方法,还是有一个t4模板可以在不删除现有表的情况下执行模式更新?(我使用的是Visual Studio 2010,.Net 4.0和SQL Server 2008)

谢谢

c# sql-server ado.net entity-framework entity-framework-4

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