我目前正在寻找JAVA的职业生涯,并决定从构建应用程序开始.我在这里有这个代码,我用它来触发语音识别.
public class MainActivity extends Activity implements OnClickListener{
private static final int VR_REQUEST = 999;
private ListView wordList;
private final String LOG_TAG = "SpeechRepeatActivity";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button speechBtn = (Button) findViewById(R.id.speech_btn);
wordList = (ListView) findViewById (R.id.word_list);
PackageManager packManager= getPackageManager();
List<ResolveInfo> intActivities = packManager.queryIntentActivities
(new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH), 0);
if (intActivities.size() !=0){
speechBtn.setOnClickListener(this);
} else {
speechBtn.setEnabled(false);
Toast.makeText(this,"Oops - Speech Recognition Not Supported!",
Toast.LENGTH_LONG).show();
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this …Run Code Online (Sandbox Code Playgroud) 我正在使用SourceTree作为我的GIT存储库.
今天我需要忽略一些文件; 当我从SourceTree的"忽略文件"菜单中添加这些文件以忽略列表并检查本地.gitignore文件时,忽略的文件不在那里列出.相反,它们列在全球.gitignore中.
如何让SourceTree将文件添加到特定于存储库的.gitignore?
在SourceTree中有没有办法看到藏匿的全部内容?
我已经隐藏了很多尚未准备好在Develop分支上提交的更改,以便检查Master分支以获取修补程序.现在我意识到存储中的一个更改将很好地包含在修补程序中,因为我无论如何都必须进行新的部署.但是由于存储很大,当我在SourceTree中选择存储时,我看不到我想要的特定更改.对我来说,SourceTree只显示了藏匿的一部分作为某种总结......
我知道我可以通过几种不同的方式解决这个问题,但如果有一个我不知道哪个选项可以让SourceTree显示藏匿的全部内容,我会很高兴有人能告诉我在哪里找到它.
如果存储GIT库有所不同,则存储库是一个存储库...
有人可以解释之间的差异SatisfyImportsOnce和ComposeParts为什么人会在哪里工作,其他没有?
具体来说,我有一个MVC Web应用程序,我正在使用MEF.下面是一些代码(来自该应用程序),当我使用时工作,SatisfyImportsOnce但在我使用时不工作ComposeParts.我的理解是ComposeParts从一组属性对象创建可组合部分,并在指定的组合容器中组合它们,并SatisfyImportsOnce 使用指定的组合服务组成指定的部分.对于我简单的猴子脑,即使英语不同,它们在语义上是相同的.两者都使用CompositionContainer在导入目标上吐出导出的类型.
public class FormPartCustomatorFactory
{
[ImportMany(typeof(ICustomRenderer), AllowRecomposition = true)]
private readonly List<Lazy<ICustomRenderer, ICustomRendererMetaData>> _rendererImports = new List<Lazy<ICustomRenderer, ICustomRendererMetaData>>();
private readonly Dictionary<string, Lazy<ICustomRenderer, ICustomRendererMetaData>> _renderers;
public static readonly FormPartCustomatorFactory Instance = new FormPartCustomatorFactory();
static CompositionContainer _container;
private FormPartCustomatorFactory()
{
using (var catalog = new DirectoryCatalog(HttpRuntime.BinDirectory, "*.dll"))
{
_container = new CompositionContainer(catalog);
_container.SatisfyImportsOnce(this); // <- Works
// _container.ComposeParts(this); // DOESN'T Work
_renderers = _rendererImports.ToDictionary(q => q.Metadata.Name, …Run Code Online (Sandbox Code Playgroud) 我目前在Windows 7上使用SourceTree.如果我遇到我的git存储库的任何问题,在线解决方案总是依赖于命令行.无论如何在SourceTree中输入这些命令?
我有一个项目存储在我的Mac上,并创建了一个从该位置到我的项目的存储库.我能够使用源代码树提交,但现在我想恢复到之前的提交,以便我的文件夹中的所有文件都更新?我不知道我是怎么做到的?
想发布这个,即使我在写这个问题的过程中弄清楚了.将在下面发布答案.
使用VS代码分析获得以下警告:
警告CA2213'DBConn'包含IDisposable类型的字段'DBConn.k__BackingField':'SqlConnection'.更改"DBConn"上的Dispose方法以在此字段上调用Dispose或Close.
但我的代码确实在DBConn属性上调用Dispose().它不在支持领域吗?我有这样的其他实例 - 我处理编译器不会抛出此警告的位置.这是下面的代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.SqlClient;
namespace TheProgramSpace
{
public sealed class DBConn : IDisposable
{
// class containing the database and its connection
public SqlConnection TheConn { get; }
public string DbPath { get; }
public string DbName { get; }
public DBConn(ProgInstance FPI)
{
// constructs new SQLConnection
DbPath = FPI.dbPath;
DbName = FPI.dbName;
string connString = "Data Source = " + DbPath + …Run Code Online (Sandbox Code Playgroud) 点击"tree"后,gitk显示给定提交的目录树.sourcetree中有类似的东西吗?
目录树(第一次修订)(见右下窗框)

目录树作为第二次修订

POM是
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.geotools</groupId>
<artifactId>tutorial</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>tutorial</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<geotools.version>10-SNAPSHOT</geotools.version>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-shapefile</artifactId>
<version>${geotools.version}</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-swing</artifactId>
<version>${geotools.version}</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>maven2-repository.dev.java.net</id>
<name>Java.net repository</name>
<url>http://download.java.net/maven/2</url>
</repository>
<repository>
<id>osgeo</id>
<name>Open Source Geospatial Foundation Repository</name>
<url>http://download.osgeo.org/webdav/geotools/</url>
</repository>
</repositories>
</project>
Run Code Online (Sandbox Code Playgroud)
我收到错误:
[ERROR] Failed to execute goal on project tutorial: Could not resolve dependencies for project org.geotools:tutorial:jar:1.0-SNAPSHOT: The following artifacts could not be resolved: org.geotools:gt-shapefile:jar:10-SNAPSHOT, org.geotools:gt-swing:jar:10-SNAPSHOT: Could not …
给定对象obj是有保证的
uintptr(unsafe.Pointer(&obj))
Run Code Online (Sandbox Code Playgroud)
无论何时调用,它总是会评估为相同的值?
当然,Go保证如果你把两个指针指向同一个对象,它们总是比较相等.虽然实现可以移动对象在内存中并透明地更新指向它的所有指针.
如果您考虑像Mark-and-Compact这样的垃圾收集策略,这很有趣.是否允许实现者使用这种垃圾收集策略?