我正在研究Visual Studio 2008中的一个大型C++项目,并且有很多文件带有不必要的#include
指令.有时#include
s只是工件,一切都会被删除,但是在其他情况下,类可以向前声明,#include可以移动到.cpp
文件中.是否有任何好的工具可以检测这两种情况?
我正在闲暇时间写一个django应用程序,用于我们在工作中进行的一场小费比赛.我认为我会明智地利用这段时间,并加快virtualenv,pip,packaging,django 1.3的速度,以及如何编写一个易于重新分发的应用程序.到现在为止还挺好.
我喜欢包装部分.例如,GitHub上的许多django应用程序大多以相同的方式捆绑(大致).我将以django-uni-forms为例.
我正在做的一个假设是,MANIFEST.in
并且setup.py
是pip需要完成其工作的唯一必需件.那是对的吗?如果我的假设错了,还需要哪些其他组件?
是否通常生成所需的包装文件,还是手工制作?是否可以描述依赖关系并进行安装?我的应用程序依赖于django-uni-forms
,我将它列在requirements.txt
我的应用程序中的一个文件中,我用它来安装依赖项; 但这是包装系统可以照顾的东西吗?
我需要遵循哪些步骤来打包我的应用程序,以便pip能够安装它和任何依赖项?
我的问题有点普遍,但它也与Gradle有关.
为什么我们需要编译和运行时配置?
当我编译一些东西时,我需要工件来转换我的字节码中的java类,所以我需要编译配置,但为什么需要运行时配置我还需要别的东西在JVM中运行我的应用程序?
对不起,如果它听起来很愚蠢,但我不明白.
我试图用scipy读取图像.但是它不接受这scipy.misc.imread
部分.可能是什么原因造成的?
>>> import scipy
>>> scipy.misc
<module 'scipy.misc' from 'C:\Python27\lib\site-packages\scipy\misc\__init__.pyc'>
>>> scipy.misc.imread('test.tif')
Traceback (most recent call last):
File "<pyshell#11>", line 1, in <module>
scipy.misc.imread('test.tif')
AttributeError: 'module' object has no attribute 'imread'
Run Code Online (Sandbox Code Playgroud) python installation dependencies scipy python-imaging-library
假设我有一个带有规则的makefile
%.o: %.c
gcc -Wall -Iinclude ...
Run Code Online (Sandbox Code Playgroud)
我想要在头文件更改时重建*.o.无论何时/include
更改任何头文件,都必须重建dir中的所有对象,而不是计算出依赖项列表.
我想不出一个改变规则以适应这个的好方法,我愿意接受建议.如果标题列表不必硬编码,则奖励积分
我正在启动一个新的桌面应用程序,我想使用MVVM和WPF构建它.
我也打算使用TDD.
问题是我不知道如何使用IoC容器将依赖项注入我的生产代码.
假设我有以下类和接口:
public interface IStorage
{
bool SaveFile(string content);
}
public class Storage : IStorage
{
public bool SaveFile(string content){
// Saves the file using StreamWriter
}
}
Run Code Online (Sandbox Code Playgroud)
然后我有另一个IStorage
作为依赖项的类,假设这个类是一个ViewModel或一个业务类......
public class SomeViewModel
{
private IStorage _storage;
public SomeViewModel(IStorage storage){
_storage = storage;
}
}
Run Code Online (Sandbox Code Playgroud)
有了这个,我可以轻松编写单元测试,以确保它们正常工作,使用模拟等.
问题是在实际应用中使用它.我知道我必须有一个链接IStorage
接口默认实现的IoC容器,但我该怎么做呢?
例如,如果我有以下xaml会怎么样:
<Window
... xmlns definitions ...
>
<Window.DataContext>
<local:SomeViewModel />
</Window.DataContext>
</Window>
Run Code Online (Sandbox Code Playgroud)
在这种情况下,如何正确地"告诉"WPF注入依赖项?
另外,假设我需要一个SomeViewModel
来自我的cs
代码的实例,我应该怎么做?
我觉得我完全迷失了,我会感谢任何有关如何处理它的最好方法的例子或指导.
我熟悉StructureMap,但我不是专家.此外,如果有更好/更容易/开箱即用的框架,请告诉我.
提前致谢.
我已将我的 Android Studio 和targetSdkVersion
(build.gradle) 更新为 29。我迁移到了 AndroidX。现在 Gradle 构建给了我这两个错误。
此项目使用 AndroidX 依赖项,但未启用 'android.useAndroidX' 属性。在 gradle.properties 文件中将此属性设置为 true 并重试。
检测到以下 AndroidX 依赖项:androidx.versionedparcelable:versionedparcelable:1.0.0、androidx.fragment:fragment:1.0.0、androidx.slidingpanelayout:slidingpanelayout:1.0.0、androidx.core:core:1.0.0、androidx.customview :customview:1.0.0, androidx.swiperrefreshlayout:swiperrefreshlayout:1.0.0, androidx.interpolator:interpolator:1.0.0, androidx.loader:loader:1.0.0, androidx.drawerlayout:drawerlayout:1.0.0, androidx.viewpage :viewpager:1.0.0, androidx.collection:collection:1.0.0, androidx.localbroadcastmanager:localbroadcastmanager:1.0.0, androidx.lifecycle:lifecycle-common:2.0.0, androidx.arch.core:core-common:2.0 .0, androidx.annotation:annotation:1.1.0, androidx.lifecycle:lifecycle-livedata:2.0.0, androidx.legacy:legacy-support-core-ui:1.0.0, androidx.lifecycle:lifecycle-viewmodel:2.0 .0,androidx.lifecycle:lifecycle-livedata-core:2。0.0, androidx.arch.core:core-runtime:2.0.0, androidx.legacy:legacy-support-core-utils:1.0.0, androidx.documentfile:documentfile:1.0.0, androidx.cursoradapter:cursoradapter:1.0。 0, androidx.lifecycle:lifecycle-runtime:2.0.0, androidx.coordinatorlayout:coordinatorlayout:1.0.0, androidx.asynclayoutinflater:asynclayoutinflater:1.0.0, androidx.print:print:1.0.0
我的代码是:MainActivity.java
package it.manuel.myapp;
import android.Manifest;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.DownloadManager;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.content.DialogInterface;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Build;
import android.support.v4.app.ActivityCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle; …
Run Code Online (Sandbox Code Playgroud) 我在.NET中有一个安装项目.当我保存的项目和其他项目,以颠覆,安装项目不再编译.我收到错误"无法更新项目的依赖项".
我喜欢Bundler,它非常善于依赖管理.我爱npm,安装节点包很容易!我有一个nodejs应用程序,并希望能够指定我的应用程序依赖项,并在我部署我的应用程序的任何地方轻松安装/更新它们.这不是我发布的图书馆,它是一个完整的网络应用程序.
我知道这个npm bundle
命令,但这似乎只是覆盖了安装包的目录.
我习惯以这种方式使用bundler:
# Gemfile
gem "rails", "3.0.3"
Run Code Online (Sandbox Code Playgroud)
仅在主机上存在rails v3.0.3和任何其他必需的gem时才会存在
> bundle install
Run Code Online (Sandbox Code Playgroud)
如何用npm实现类似的功能?
告诉Gradle
以下内容最简单的方法是什么:
检索'junit'依赖关系并采用其最新的'release'版本.
管理Maven和Ivy存储库对我来说有点新鲜.我尝试了以下步骤,导致Could not resolve dependency ...
错误:
compile "junit:junit:latest.release"
用存储库设置为只写mavenCentral()
(但是,如果我说"junit:junit:4.10",它就可以工作).
compile "junit:junit:latest.release"
使用存储库写入以下方式:
ivy {
// I also tried 'http://maven.org' and other possible variants.
url "http://repo1.maven.org"
layout "maven"
}
Run Code Online (Sandbox Code Playgroud)尝试使用Spring Source Ivy存储库:
ivy {
artifactPattern "http://repository.springsource.com/ivy/libraries/release/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]"
ivyPattern "http://repository.springsource.com/ivy/libraries/release/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]"
}
Run Code Online (Sandbox Code Playgroud)也许我误解了一些事情.为什么获得最新版本的依赖是如此艰巨的任务?
dependencies ×10
gradle ×2
python ×2
android ×1
bundler ×1
c# ×1
c++ ×1
deployment ×1
django ×1
header ×1
header-files ×1
include ×1
installation ×1
ivy ×1
java ×1
javascript ×1
makefile ×1
maven ×1
mvvm ×1
node.js ×1
npm ×1
pip ×1
scipy ×1
winforms ×1
wpf ×1