我正在尝试使用facet_wrap和ggplot2为绘图添加多个标题.假设你有两年的季度数据,并想要将季度数据与两个主要标题进行图形比较; 2014年和2015年,以及各季度的标题.
我走到这一步:
data <- rnorm(10)
A1 <- data.frame("Y"=data, "X"=1:10, "Q"=1, "year"=2014)
A2 <- data.frame("Y"=data, "X"=1:10, "Q"=2, "year"=2014)
A3 <- data.frame("Y"=data, "X"=1:10, "Q"=3, "year"=2014)
A4 <- data.frame("Y"=data, "X"=1:10, "Q"=4, "year"=2014)
N1 <- data.frame("Y"=data, "X"=1:10, "Q"=1, "year"=2015)
N2 <- data.frame("Y"=data, "X"=1:10, "Q"=2, "year"=2015)
N3 <- data.frame("Y"=data, "X"=1:10, "Q"=3, "year"=2015)
N4 <- data.frame("Y"=data, "X"=1:10, "Q"=4, "year"=2015)
A <- rbind(A1, A2, A3, A4)
N <- rbind(N1, N2, N3, N4)
tmp <- data.frame(rbind(A, N))
ggplot(data=tmp, aes(x=X, y=Y)) + geom_line() + facet_wrap(~year + …
Run Code Online (Sandbox Code Playgroud) 我不断
An exception of type 'System.Runtime.Serialization.SerializationException'
occurred in IRCBot.exe but was not handled in user code
从 AppDomain.DoCallBack获取信息
我的代码是
object result = null;
try {
Console.WriteLine("Attempting to run in sandbox");
sandbox.DoCallBack(() =>
{
Console.WriteLine("Creating thread");
try
{
var scriptThread = new Thread(() =>
{
try
{
Console.WriteLine("Trying");
result = CSharpScript.RunAsync(code).ReturnValue.Result;
}
catch (Exception ex)
{
result = ex.Message;
}
});
scriptThread.Start();
if (!scriptThread.Join(6000))
{
scriptThread.Abort();
AppDomain.Unload(sandbox);
}
}
catch (Exception ex)
{
result = ex.ToString();
}
});
}
catch (Exception …
Run Code Online (Sandbox Code Playgroud) 我发现了这个问题,但接受的答案提供了两个没有工作的链接.如果你点击它们,你会看到类似的东西:
此项目尚未发布.如果您是此项目的所有者,请使用相应的帐户登录.
所以我的问题是.哪里可以找到VS 2015 Roslyn项目模板的安装程序?
我的代码,适用于2.1版本的驱动程序,在2.2-rc2上失败.
这是堆栈跟踪:
Exception occurred in target VM: Value accountExpiryDate is of type timestamp
com.datastax.driver.core.exceptions.InvalidTypeException: Value accountExpiryDate is of type timestamp
at com.datastax.driver.core.AbstractGettableByIndexData.checkType(AbstractGettableByIndexData.java:75)
at com.datastax.driver.core.AbstractGettableByIndexData.getDate(AbstractGettableByIndexData.java:192)
at com.datastax.driver.core.AbstractGettableData.getDate(AbstractGettableData.java:26)
at com.datastax.driver.core.AbstractGettableData.getDate(AbstractGettableData.java:113)
Run Code Online (Sandbox Code Playgroud) 这种assertEquals(double,double)
方法是合理的弃用.是否有替代和/或不同的方法烘焙到junit - 或者我滚动我自己的小扩展
static boolean assertEquals(double d1, double d2) {
return Math.abs(d1 - d2) < 1e-8;
}
Run Code Online (Sandbox Code Playgroud) 我使用以下链接创建了导航抽屉,这非常好:
http://blog.teamtreehouse.com/add-navigation-drawer-android
你可以从这个URl下载导航抽屉 - https://github.com/sanjaisy/Android-Navigation-Drawer.git
现在我想在这个导航抽屉中添加子菜单.请帮我解决一下.
这是我的完整java代码
public class SmoothBanlanceHome extends ActionBarActivity {
private ListView mDrawerList;
private DrawerLayout mDrawerLayout;
private ArrayAdapter<String> mAdapter;
private ActionBarDrawerToggle mDrawerToggle;
private String mActivityTitle;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_smooth_banlance_home);
mDrawerList = (ListView)findViewById(R.id.navList);mDrawerLayout = (DrawerLayout)findViewById(R.id.drawer_layout);
mActivityTitle = getTitle().toString();
addDrawerItems();
setupDrawer();
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);
}
private void addDrawerItems() {
String[] MenuArray = getResources().getStringArray(R.array.Naviagation_Menu_List);
mAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, MenuArray);
mDrawerList.setAdapter(mAdapter);
mDrawerList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Toast.makeText(SmoothBanlanceHome.this, …
Run Code Online (Sandbox Code Playgroud) 有人知道delphi xe7是否与windows 10兼容?Embarcadero说XE8是兼容的.但对XE7一无所知.
我使用mongo cli创建了以下mongo副本集:
> config = { _id:"repset", members:[{_id:0,host:"192.168.0.1:27017"},{_id:1,host:"192.168.0.2:27017"},{_id:2,host:"192.168.0.3:27017"}]}
> rs.initiate(config);
Run Code Online (Sandbox Code Playgroud)
所有mongo服务器都正常运行.
>>> import pymongo
>>> from pymongo import MongoClient
>>> servers = ["192.168.0.1:27017", "192.168.0.2:27017", "192.168.0.3:27017"]
>>> MongoClient(servers)
>>> xc = MongoClient()
>>> print xc
MongoClient('localhost', 27017)
>>> print xc.database_names()
[u'test_repsets', u'local', u'admin', u'test']
Run Code Online (Sandbox Code Playgroud)
在我杀死本地mongodb服务器后,它显示我的连接超时错误:
pymongo.errors.ServerSelectionTimeoutError: localhost:27017: [Errno 111] Connection refused
Run Code Online (Sandbox Code Playgroud)
虽然我定义了mongodb服务器,但似乎没有自动故障转移.我想知道pymongo是否自动进行故障转移,或者如何正确处理这种情况?
先感谢您.
我有这个javascript代码,在按钮点击时执行ajax请求.
$('#allinea').click(function(e){
e.preventDefault();
var password = $('#password').val();
$.ajax({
type: "POST",
url: "db_align.php",
data: {password:password},
complete: function(data){
data1=data.split("|");
if(data1[0]=="Successo"){
$("#per_all").fadeTo(200,0.1,
function(){
$(this).find('img').attr("src",'../images/ok.png');
$(this).find('.right').html(data1[1]).promise().done(function(){
$(this).fadeTo(900,1);
});
});
}else if(data1[0]=="Errore"){
$("#per_all").fadeTo(200,0.1,
function(){
$(this).find('img').attr("src",'../images/alert.png');
$(this).find('.right').html(data1[1]).promise().done(function(){
$(this).fadeTo(900,1);
});
});
}
}
}); //chiudo $.ajax
});
Run Code Online (Sandbox Code Playgroud)
php页面返回"Successo | Allineamento riuscito",我在firebug中看到它正确但js返回错误:
输入错误:data.split不是函数
DATA1 = data.split( "|");
我在我的应用程序中随处使用此代码,没有任何不便.这次我做错了什么?
对于我所看到的,这不是一个数组,所以这应该没有任何不便!
这是两个简单的类:
class Abc { public int x; }
class Bcd { public int y; }
Run Code Online (Sandbox Code Playgroud)
鉴于它obj
是类型object
,这里有几个测试Abc
或Bcd
具有某些特征的例子:
if (obj is Abc && (obj as Abc).x > 0 && Math.Pow((obj as Abc).x, 2) > 100)
Console.WriteLine(123);
if (obj is Bcd && (obj as Bcd).y > 0 && Math.Pow((obj as Bcd).y, 2) > 100)
Console.WriteLine(234);
Run Code Online (Sandbox Code Playgroud)
处理这种模式的好方法是什么:
if (obj is Abc && (obj as Abc).SomePropertyOrMethod && ...
Run Code Online (Sandbox Code Playgroud)
一种方法是Is
扩展方法:
public static bool Is<T>(this object obj, …
Run Code Online (Sandbox Code Playgroud)