我的主线程创建了一个新线程.当新线程调用时System.exit(-1),我的主线程被关闭.如何处理退出代码并保持主线程活动?
PS.新线程会在其他.jar文件中调用一些方法,所以我无法修改它.
请求content-type是application/json,但我想获取请求正文字节。Flask 将自动将数据转换为json. 我如何获取请求正文?
我知道如何返回一个PageReference来编辑和查看一个sObject:
PageReference ref = new ApexPages.StandardController(bnk).edit();
Run Code Online (Sandbox Code Playgroud)
但是StandardController类没有像create这样的方法.
如何返回页面以创建sObject.
我也知道这样的方法:
PageReference ref = new PageReference('/a00/e');
Run Code Online (Sandbox Code Playgroud)
但是sObject有很多查找字段.这个方法不能取出引用查找字段.它只能创建一个独立的sObject.
那么如何返回创建页面并取出参考查找字段呢?
我通过visual studio开设了一个项目,该项目由TFS控制.当我通过记事本等其他编辑器编辑任何文件时,不会自动结帐.
我在其他编辑器中编辑时如何自动签出文件?
我想在使用mvn test或时自动编译并运行测试mvn install
我以前习惯使用gmaven-plugin它会起作用.
但是当我使用groovy-maven-plugin新版本的gmaven时,它不起作用!
那怎么配置?
这是我的pom.xml:
<!-- gmaven-plugin -->
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>gmaven-plugin</artifactId>
<version>1.5</version>
<configuration>
<providerSelection>2.0</providerSelection>
<source/>
</configuration>
<executions>
<execution>
<goals>
<goal>generateStubs</goal>
<goal>compile</goal>
<goal>generateTestStubs</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.codehaus.gmaven.runtime</groupId>
<artifactId>gmaven-runtime-2.0</artifactId>
<version>1.5</version>
<exclusions>
<exclusion>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>${groovy.version}</version>
</dependency>
</dependencies>
</plugin>
<!-- groovy-maven-plugin -->
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>groovy-maven-plugin</artifactId>
<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>${groovy.version}</version>
</dependency>
</dependencies>
</plugin>
Run Code Online (Sandbox Code Playgroud) 我有三个实体.
public class Book
{
public string Name {get;set;}
}
public class Author
{
public string AuthorName {get;set;}
}
public class BookDTO
{
public string Name {get;set;}
public string AuthorName {get;set;}
}
Run Code Online (Sandbox Code Playgroud)
如何映射Book和Author到BookDTO?以及如何映射BookDTO到Book和Author?我在我的解决方案中使用了automapper.
可能重复:
事件处理程序是否阻止垃圾收集发生?
我有一个像这样的wp7应用程序:
private void button1_Click(object sender, RoutedEventArgs e)
{
GeoCoordinateWatcher watcher = new GeoCoordinateWatcher();
watcher.PositionChanged += new EventHandler<GeoPositionChangedEventArgs<GeoCoordinate>>(watcher_PositionChanged);
watcher.Start();
}
void watcher_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e)
{
Debug.WriteLine(e.Position.Timestamp.ToString());
}
Run Code Online (Sandbox Code Playgroud)
单击两次按钮后,控制台将输出两次Timestamp.但观察者是一个局部变量!它出什么问题了?我怎么能打扰它呢?
db.UploadFileSet.Where(f => f.Article.ID == id).ToList();
Run Code Online (Sandbox Code Playgroud)
ef会自动加载文章.但我不需要它!我怎么能阻止它?
我知道我可以这样写:
Select new XXX{Id = xxx ,Name = xxx};
Run Code Online (Sandbox Code Playgroud)
但这很麻烦.