我不知道这段代码有什么问题,但每当我运行应用程序时,在显示菜单后,应用程序崩溃.
NSString * path = [[NSBundle mainBundle] pathForResource:@"tung" ofType:@"doc"];
UIDocumentInteractionController *docController = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:path]];
docController.delegate = self;
//[docController presentPreviewAnimated:YES];
CGRect rect = CGRectMake(0, 0, 300, 300);
[docController presentOptionsMenuFromRect:rect inView:self.view animated:YES];
Run Code Online (Sandbox Code Playgroud)
我得到的错误:
***由于未捕获的异常'NSGenericException'终止应用程序,原因:' - [UIPopoverController dealloc]到达,而popover仍然可见.
我现在应该怎么做 ?
每次请求页面时,我都会获得它所来自的页面的引荐来源.我需要跟踪来自其他网站的推荐人,我不想跟踪我的网站中从一个页面到另一个页面.我怎样才能做到这一点?
是否有可能发现哪个项目生成了DocumentEvent?像我可以用ActionListener做的事情:
JTextField field = new JTextField("");
field.addActionListener(actionListener);
//inside ActionListener
public void actionPerformed(ActionEvent arg0) {
if (arg0.getSource() instanceof JTextField) //true
}
Run Code Online (Sandbox Code Playgroud)
我想对DocumentEvent做同样的事情,但似乎不会以同样的方式工作:
JTextField field = new JTextField("");
field.getDocument.addDocumentListener(documentListener);
//inside documentListener
public void insertUpdate(DocumentEvent){
if (arg0.getSource() instanceof JTextField) //false: class is javax.swing.text.PlainDocument
if (arg0.getSource() instanceof MyComponent){
MyComponent comp = (MyComponent)arg0.getSource();
comp.callSpecificMethodUponMyComp();
}
}
Run Code Online (Sandbox Code Playgroud)
答案者应该考虑以下几点:
我有一个模特
class Employee
include Mongoid::Document
field :first_name
field :last_name
field :address1
field :address2
field :salary
end
Run Code Online (Sandbox Code Playgroud)
现在我需要将所有员工的工资更新为10000,其地址1是"卡尔加里"
现在我尝试了这个查询
Employee.update_all "salary = 10000", "address1 = 'Calgary'"
Run Code Online (Sandbox Code Playgroud)
但是这个查询给了我错误:
NoMethodError: undefined method `update_all' for Employee:Class
Run Code Online (Sandbox Code Playgroud)
谢谢
如何将整个MongoDB BsonDocument转换为字符串?
(我正在使用官方的C#驱动程序)
如果我在文档的head标记中添加以下Google字体
<link href="http://fonts.googleapis.com/css?family=Muli|Dosis:500,400|Open+Sans" rel="stylesheet">
Run Code Online (Sandbox Code Playgroud)
Bootstrap图标(Glyphicons)略微向上,您可以在此链接中看到:http://www.acarrilho.com/wp-content/uploads/2012/07/icon_off.png

我该如何解决这个问题?
如何从sql server导入数据到mongodb?
我在sql数据库中有以下列的这些表
州,城市,CityAreas
States Id Name Cities Id Name StatesId CitiArea Id Name CityId
我想要mongoDb中的数据.
{
State:"Orissa",
Cities:{
CitiName:"Phulbani",
CitYArea:{
"Phulbani","Phulbani2","Pokali","Madira"
}
}
}
是否有任何工具或我需要为这种数据转换编写代码?
我观察到的每个浏览器都会创建一个<head>可在DOM中访问的元素,即使<head></head>文档的标记中没有显式标记也是如此.
但是,Google Analytics使用以下代码进行动态脚本插入:
(function() {
var ga = document.createElement('script');
ga.type = 'text/javascript';
ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga);
})();
Run Code Online (Sandbox Code Playgroud)
以下行:
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga);
Run Code Online (Sandbox Code Playgroud)
对于<head>没有元素的情况,似乎做出了特别的让步.
这只是一个极端向后兼容的情况(例如,对于Netscape 4等),或者有没有假设现代浏览器(即Internet Explorer 6和更新版本)始终可以访问的情况到<head>DOM中的元素?
有没有办法在mongo查询中对子文档进行排序?示例(博客集合):
{
"_id" : ObjectId("4c69d19532f73ad544000001"),
"content" : "blah blah blah",
"comments" : {
{"author": "jim", "content":"comment content 1", "date" : "07-24-1995"},
{"author": "joe", "content":"comment content 2", "date" : "07-24-1996"}
{"author": "amy", "content":"comment content 3", "date" : "09-10-1999"}
}
}
{
"_id" : ObjectId("4c69d19532f73ad544000002"),
"content" : "blah blah blah",
"comments" : {
{"author": "jim", "content":"comment content 1", "date" : "07-24-1995"},
{"author": "joe", "content":"comment content 2", "date" : "07-24-1996"}
{"author": "amy", "content":"comment content 3", "date" : "07-24-1997"}
}
}
Run Code Online (Sandbox Code Playgroud)
我希望按照我决定的方式订购我的博客文章,然后在我的博客帖子中通过按日期反向排序或我想要的任何其他排序来订购评论.这可能与mongoDB有关吗?
如何使用python发送电子邮件时添加文档附件?我收到要发送的电子邮件(请忽略:我正在循环发送电子邮件每5秒发送一次,仅用于测试目的,我希望它每隔30分钟发送一次,只需要更改5到1800)
到目前为止,这是我的代码.如何从我的电脑附加文件?
#!/usr/bin/python
import time
import smtplib
while True:
TO = 'xxxx@gmail.com'
SUBJECT = 'Python Email'
TEXT = 'Here is the message'
gmail_sender = 'xxxx@gmail.com'
gmail_passwd = 'xxxx'
server = smtplib.SMTP('smtp.gmail.com',587)
server.ehlo()
server.starttls()
server.ehlo()
server.login(gmail_sender, gmail_passwd)
BODY = '\n'.join([
'To: %s' % TO,
'From: %s' % gmail_sender,
'Subject:%s' % SUBJECT,
'',
TEXT
])
try:
server.sendmail(gmail_sender,[TO], BODY)
print 'email sent'
except:
print 'error sending mail'
time.sleep(5)
server.quit()
Run Code Online (Sandbox Code Playgroud) document ×10
mongodb ×3
javascript ×2
attachment ×1
css3 ×1
dom ×1
domdocument ×1
email ×1
glyphicons ×1
html ×1
import ×1
ipad ×1
iphone ×1
java ×1
jtextfield ×1
mongoid ×1
properties ×1
python ×1
referrer ×1
ruby ×1
sorting ×1
sql ×1
sql-server ×1
swing ×1