我正在寻找一个优化库.我的两个要求是它不使用JNI,并且它没有许可证限制,因此无法在商业上在多台计算机上使用它.我发现的唯一符合这些要求的是Choco,但是它有点无人驾驶.
在开发中,Play会自动在我的数据库中创建缺少的表和索引,但它似乎不想在生产中执行此操作 - 这使得设置生产数据库变得很困难.
我该怎么做呢?
我想在股票图表上绘制Excel所谓的"指数趋势/回归".当我在IPython笔记本中运行下面的代码时,它只是说"内核已经死了,你想重新启动吗?".关于如何修复它的任何想法?此外,这只是尝试进行线性回归,我不太确定如何对指数数据进行回归.
import datetime
import matplotlib.pyplot as plt
import statsmodels.api as sm
from pandas.io.data import DataReader
sp500 = DataReader("AGG", "yahoo", start=datetime.datetime(2000, 1, 1)) # returns a DataFrame
sp500["regression"] = sm.OLS(sp500["Adj Close"], sp500.index).fit().fittedvalues()
top = plt.subplot2grid((3,1), (0, 0), rowspan=2)
top.plot(sp500.index, sp500["Adj Close"], 'b-', sp500.index, sp500["regression"], 'r-')
bottom = plt.subplot2grid((3,1), (2,0))
bottom.bar(sp500.index, sp500.Volume)
plt.gcf().set_size_inches(18,8)
Run Code Online (Sandbox Code Playgroud) 我有一个项目,我想分成多个模块.我是否仍然可以将Eclipse中的项目作为单个项目使用,还是需要将它们作为单独的项目?
当我将父pom.xml中的依赖项移动到子项时,它们停止放在Eclipse构建路径上,所以现在没有任何文件可以在Eclipse中编译(尽管它确实显示Maven正在从命令行运行.)和想法我可能做错了什么或在Eclipse中创建多模块项目的技巧?
我正在尝试使用MongoDB来重新分配ID.但是,它不是将ID设置为等于我分配的值,而是创建一个新的ObjectId.我如何分配自己的ID?
> db.pGitHub.find();
{ "_id" : ObjectId("516f202da1faf201daa15635"),
"url" : { "raw" : "https://github.com/Quatlus",
"domain" : "github.com", "canonical" : "https://github.com/quatlus" } }
{ "_id" : ObjectId("516f202da1faf201daa15636"),
"url" : { "raw" : "https://github.com/Quasii",
"domain" : "github.com", "canonical" : "https://github.com/quasii" } }
> db.pGitHub.find().forEach(function(myProfile) {
var oldId = myProfile._id;
myProfile._id = 'exampleid';
db.pGitHub.save(myProfile);
db.pGitHub.remove({_id: oldId});
});
> db.pGitHub.find();
{ "_id" : ObjectId("516f204da1faf201daa15637"),
"url" : { "raw" : "https://github.com/Quatlus",
"domain" : "github.com", "canonical" : "https://github.com/quatlus" } }
{ "_id" : ObjectId("516f204da1faf201daa15638"),
"url" : { …
Run Code Online (Sandbox Code Playgroud) 最近,我经常发现自己想要在另一个命令的输出上运行一些命令,该命令在几行上有输出.
例如,假设我有一个命令,它返回一个新行的每个文件路径,我想删除所有这些文件.
有没有可以帮我这么做的命令?
有没有一种好方法来测试我是否登录到文本shell或在我的.bashrc中启动GUI会话?例如,如果在gnome和emacs中使用命令行将我的编辑器设置为gedit.
我对Android很新.我想在用户接到电话时弹出透明屏幕.我有这个代码打开MyActivity屏幕,但它是白色而不是透明.
public class CallReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
String state = intent.getStringExtra(TelephonyManager.EXTRA_STATE);
if (TelephonyManager.EXTRA_STATE_RINGING.equals(state)) {
SystemClock.sleep(1);
Intent intent = new Intent(context, MyActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_NO_USER_ACTION);
context.startActivity(intent);
}
}
}
Run Code Online (Sandbox Code Playgroud)
这是MyActivity的代码:
public class MyActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_my);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
}
}
Run Code Online (Sandbox Code Playgroud)
这是布局:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:windowBackground="@android:color/transparent"
android:windowIsTranslucent="true"
android:windowAnimationStyle="@android:style/Animation.Translucent" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="@string/incoming_call"
tools:context=".MyActivity" />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
这会成功弹出一个屏幕,上面显示我的消息,但它使用白色背景而不是透明背景.知道我可能做错了什么吗?我正在使用Android 2.2 SDK的模拟器.
java ×2
android ×1
bash ×1
command-line ×1
eclipse ×1
gnome ×1
jpa ×1
linux ×1
m2eclipse ×1
matplotlib ×1
maven-2 ×1
mongodb ×1
pandas ×1
python ×1
sbt ×1
statsmodels ×1
transparency ×1