我做以下导入:
import matplotlib.pyplot as plt
import matplotlib.axes as ax
import matplotlib
import pylab
Run Code Online (Sandbox Code Playgroud)
它正确执行
plt.plot(y1, 'b')
plt.plot(y2, 'r')
plt.grid()
plt.axhline(1, color='black', lw=2)
plt.show()
Run Code Online (Sandbox Code Playgroud)
并显示图表.
但如果我插入
print("ylim=", ax.get_ylim())
Run Code Online (Sandbox Code Playgroud)
我收到错误消息:
AttributeError:'module'对象没有属性'get_ylim'
我试过更换斧头.与plt.,matplotlib等,我得到相同的错误.
打电话的正确方法是get_ylim什么?
在春天,如果我有:
ServiceA.serviceA() -> ServiceB.serviceB() -> ServiceC.serviceC() ->ServiceD.serviceD()
哪里ServiceD.serviceD()可以抛出运行时异常:MyRuntimeException,它被传播回ServiceA.serviceAcatch块.我穿上哪种服务是否重要@Transactional(noRollbackFor=[MyRuntimeException.class])?
将它放在任何服务上有什么区别吗?
注意:我的所有服务都标记为@Transactional
MongoDB没有启动.我已经安装了mongo和mongo正在运行,但重启后它没有运行.
错误:无法将pid文件写入/var/run/mongodb/mongod.pid:没有这样的文件或目录
我的系统是Fedora 20
它的日志存档.
2014-09-18T00:28:58.515-0300 ***** SERVER RESTARTED *****
2014-09-18T00:28:58.522-0300 [initandlisten] MongoDB starting : pid=3048 port=27017 dbpath=/var/lib/mongo 64-bit host=localhost.localdomain
2014-09-18T00:28:58.522-0300 [initandlisten] db version v2.6.4
2014-09-18T00:28:58.522-0300 [initandlisten] git version: 3a830be0eb92d772aa855ebb711ac91d658ee910
2014-09-18T00:28:58.522-0300 [initandlisten] build info: Linux build7.nj1.10gen.cc 2.6.32-431.3.1.el6.x86_64 #1 SMP Fri Jan 3 21:39:27 UTC 2014 x86_64 BOOST_LIB_VERSION=1_49
2014-09-18T00:28:58.522-0300 [initandlisten] allocator: tcmalloc
2014-09-18T00:28:58.522-0300 [initandlisten] options: { config: "/etc/mongod.conf", net: { bindIp: "127.0.0.1" }, processManagement: { fork: true, pidFilePath: "/var/run/mongodb/mongod.pid" }, storage: { dbPath: "/var/lib/mongo" }, systemLog: { destination: "file", logAppend: true, …Run Code Online (Sandbox Code Playgroud) 我刚为eclipse安装了一个mercurial插件.安装过程进展顺利.但是当我重新启动eclipse安装后,显示错误.
错误说:
发生了多个Mercurial错误.请查看错误日志视图以获取详细信息..命令行:hg -y debuginstall
我找不到任何可能的解决方案.
这个概念是在特定时间获得通知.显然,我做到了,直到我将支持版本低于HoneyComb及高于它.
我已经设置了最低版本的SDK 8和目标SDK 17.由于类编码要大得多,我只显示存在问题的核心区域:
int currentapiVersion = android.os.Build.VERSION.SDK_INT;
Notification notification;
PendingIntent contentIntent = PendingIntent.getActivity(this, 0,
new Intent(this, TaskDetails.class), 0);
if (currentapiVersion < android.os.Build.VERSION_CODES.HONEYCOMB) {
notification = new Notification(icon, text, time);
notification.setLatestEventInfo(this, title, text, contentIntent);
notification.flags |= Notification.FLAG_AUTO_CANCEL;
mNM.notify(NOTIFICATION, notification);
} else {
NotificationCompat.Builder builder = new NotificationCompat.Builder(
this);
notification = builder.setContentIntent(contentIntent)
.setSmallIcon(icon).setTicker(text).setWhen(time)
.setAutoCancel(true).setContentTitle(title)
.setContentText(text).build();
mNM.notify(NOTIFICATION, notification);
}
Run Code Online (Sandbox Code Playgroud)
问题是,
Notification.Builder.Notification.Builder具有包含在API级别11中的方法(因此在行中显示错误"Call requires API level 11 or more").NotificationCompat.Builder.最后,到达没有发现错误的阶段,我在Sony …
在WPF中,这曾经很好用:
<Page.Resources>
<ResourceDictionary Source="resources/Styles.xaml" />
</Page.Resources>
Run Code Online (Sandbox Code Playgroud)
但添加转换器(见下文)会导致第二个资源(Style.xaml)的错误:Each dictionary entry must have an associated key.
<Page.Resources>
<local:MySizeConverter x:Key="sizeConverter"/>
<ResourceDictionary Source="resources/Styles.xaml" />
</Page.Resources>
Run Code Online (Sandbox Code Playgroud)
但是,将键添加到第二行(例如<ResourceDictionary x:Key="myStyleDict" Source="resources/Styles.xaml" />,在后面的代码中导致以下错误
The name 'aTextBlockUsedToWork' does not exist in the current context
Run Code Online (Sandbox Code Playgroud)
在那里aTextBlockUsedToWork可以在后面的代码添加键之前成功访问.请注意,如果我注释掉样式资源,转换器工作正常.我怎样才能让这两种资源都有效?
在我的发票表格中textEdit1,它"INV001"最初是在第一次显示.然后我们将Invoice表单详细信息存储到MS Access数据库.下次on-wards会textEdit1自动想要显示下一个发票号码"INV002".怎么做?
如果它只是数字我尝试这个代码工作成功,但现在我也有3个字母,所以如何执行此操作?
OleDbConnection con =
new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:/Srihari/Srihari/Invoice.accdb");
con.Open();
OleDbCommand cmd =
new OleDbCommand(
"SELECT * FROM NewInvoice_1 WHERE InvoiceNumber = (select max(InvoiceNumber) from NewInvoice_1)",
con);
OleDbDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
int a = reader.GetInt32(1);
TXE_Invoice_Number.Text = (1 + a).ToString();
}
Run Code Online (Sandbox Code Playgroud) 我有一个SAS数据集,让我们说:
No d1 d2 d3 ... dn
1 2 3 4 ... n1
2 3 4 5 ... n2
3 4 5 6 ... n3
Run Code Online (Sandbox Code Playgroud)
我现在需要找到SAS中所有列的平均值.有办法吗?
列数不是特定的.如果我需要d1- dn列的平均值,那么我期望的输出是:
3 4 5 .. (n1+n2+n3)/3
Run Code Online (Sandbox Code Playgroud)
有没有办法在数据步骤或使用proc sql或proc iml?
此代码产生错误:
void GetLog()
{
List<CAR_STATUS_LOGS> logs = null;
using (TESTEntities ctx = new TESTEntities())
{
logs =
ctx.CAR_STATUS_LOGS
.Where(a => SqlFunctions.DatePart("DAY", a.TIMEMARK) == 1)
.ToList();
}
}
Run Code Online (Sandbox Code Playgroud)
错误是这样的:
LINQ to Entities无法识别方法'System.Nullable`1 [System.Int32] DatePart(System.String,System.Nullable`1 [System.DateTime])'方法,并且此方法无法转换为商店表达式.
我看不出我做错了什么SqlFunctions.DatePart.TIMEMARK列是Sqlserver DateTime类型.
有任何想法吗?
使用 System.Media 时,有一种叫做 SystemSounds 的东西,您可以在其中轻松播放几种操作系统声音:
System.Media.SystemSounds.Asterisk.Play();
System.Media.SystemSounds.Beep.Play();
System.Media.SystemSounds.Exclamation.Play();
System.Media.SystemSounds.Hand.Play();
System.Media.SystemSounds.Question.Play();
Run Code Online (Sandbox Code Playgroud)
不幸的是,只有这五个选项,而在 Windows 10 中,其中三个是相同的,而其中一个甚至不播放任何内容。
我真正想做的是播放“声音”面板中定义的“通知”声音(见此处):

有谁知道如何做到这一点?