我有一个大的git repo(从SVN repo创建),我想将它推送到github.鉴于它很大,我不能只是尝试直接推送它,因为它失败了"包太大"的错误.
到目前为止一切都很好,我可以一次推回一个回购.但是当我尝试这样做时会发生什么:
git push origin 86c310d8a680d6d0e052fa7db89adb25348f3e54:master
error: unable to push to unqualified destination: master
The destination refspec neither matches an existing ref on the remote nor
begins with refs/, and we are unable to guess a prefix based on the source ref.
Run Code Online (Sandbox Code Playgroud)
所以,远程仓库中还没有主分支,但我正试图推动它并且它失败了.
我该如何解决?或者我如何在遥控器上创建一个空的主分支,以便我可以推送它?
仍然是Scala中的新手,我现在正在寻找一种方法来实现以下代码:
@Override
public void store(InputStream source, String destination, long size) {
ObjectMetadata metadata = new ObjectMetadata();
metadata.setContentLength(size);
final PutObjectRequest request = new PutObjectRequest(
this.configuration.getBucket(), destination, source, metadata);
new RetryableService(3) {
@Override
public void call() throws Exception {
getClient().putObject(request);
}
};
}
Run Code Online (Sandbox Code Playgroud)
在Scala中实现RetryableService实现的相同功能的最佳方法是什么?
它基本上调用了N次调用方法,如果所有这些都失败,则会引发异常,如果它们成功则继续运行.这个没有返回任何东西但是我有另一个版本允许返回一个值(所以,我有两个Java类)我相信我可以用Scala中的单个类/函数.
有任何想法吗?
编辑
java中的当前实现如下:
public abstract class RetryableService {
private static final JobsLogger log = JobsLogger
.getLogger(RetryableService.class);
private int times;
public RetryableService() {
this(3);
}
public RetryableService(int times) {
this.times = times;
this.run();
}
private void …Run Code Online (Sandbox Code Playgroud) 我正在测试Web应用程序的前端,并想测试一些转换如何在AJAX请求之间出现各种延迟.有什么办法可以添加sleep(1500)到我的控制器来延迟响应吗?
我有这个多模块构建配置,我正在努力工作,但每当我尝试编译项目时它失败并出现以下错误:
? postgresql-netty git:(multi-module) sbt clean compile
[info] Loading global plugins from /Users/mauricio/.sbt/plugins
[info] Loading project definition from /Users/mauricio/projects/scala/postgresql-netty/project
[info] Set current project to db-async-base (in build file:/Users/mauricio/projects/scala/postgresql-netty/)
[success] Total time: 0 s, completed May 1, 2013 11:18:29 PM
[info] Updating {file:/Users/mauricio/projects/scala/postgresql-netty/}db-async-common...
[info] Updating {file:/Users/mauricio/projects/scala/postgresql-netty/}db-async-base...
[info] Resolving org.specs2#scalaz-core_2.10;7.0.0 ...
[info] Done updating.
[info] Resolving org.scala-lang#scala-library;2.10.1 ...
[info] Done updating.
[info] Updating {file:/Users/mauricio/projects/scala/postgresql-netty/}postgresql-async...
[info] Resolving ch.qos.logback#logback-classic;1.0.9 ...
[info] Compiling 16 Scala sources to /Users/mauricio/projects/scala/postgresql-netty/db-async-common/target/scala-2.10/classes...
[info] Resolving org.specs2#scalaz-core_2.10;7.0.0 ...
[info] …Run Code Online (Sandbox Code Playgroud) 我设置Devise使用用户名而不是电子邮件地址登录,因为我们的大量用户与他们的配偶共享同一个电子邮件地址.这是我们服务的独特市场.但每个配偶需要单独的账户来记录个性工具的结果.
数据库不再需要唯一的电子邮件地址,因此它将接受两个帐户的相同电子邮件地址.但是,Devise仍然需要为每个帐户提供唯一的电子邮件地址.是否有可以用来改变它的设置或解决方法?
我正在尝试使用Scala中的基本Java代码从文件中读取并写入OutputStream,但是当我在Scala中使用通常的while(!= -1)时,会给出一个警告"比较Unit和Int的类型! =总是会产生真实的".
代码如下:
val file = this.cache.get(imageFileEntry).getValue().asInstanceOf[File]
response.setContentType( "image/%s".format( imageDescription.getFormat() ) )
val input = new BufferedInputStream( new FileInputStream( file ) )
val output = response.getOutputStream()
var read : Int = -1
while ( ( read = input.read ) != -1 ) {
output.write( read )
}
input.close()
output.flush()
Run Code Online (Sandbox Code Playgroud)
我应该如何从输入流写入Scala中的输出流?
我最感兴趣的是类似Scala的解决方案.
我正在尝试在R中读取以下UTF-8编码文件,但每当我读取它时,unicode字符都没有正确编码:

我用来处理文件的脚本如下:
defaultEncoding <- "UTF8"
detalheVotacaoMunicipioZonaTypes <- c("character", "character", "factor", "factor", "factor", "factor", "factor",
"factor", "factor", "factor", "factor", "factor", "numeric",
"numeric", "numeric", "numeric", "numeric", "numeric",
"numeric", "numeric", "numeric", "numeric", "numeric",
"numeric", "character", "character")
readDetalheVotacaoMunicipioZona <- function( fileName ) {
fileConnection = file(fileName,encoding=defaultEncoding)
contents <- readChar(fileConnection, file.info(fileName)$size)
close(fileConnection)
contents <- gsub('"', "", contents)
columnNames <- c("data_geracao", "hora_geracao", "ano_eleicao", "num_turno", "descricao_eleicao", "sigla_uf", "sigla_ue",
"codigo_municipio", "nome_municipio", "numero_zona", "codigo_cargo", "descricao_cargo", "qtd_aptos",
"qtd_secoes", "qtd_secoes_agregadas", "qtd_aptos_tot", "qtd_secoes_tot", "qtd_comparecimento",
"qtd_abstencoes", "qtd_votos_nominais", "qtd_votos_brancos", "qtd_votos_nulos", "qtd_votos_legenda",
"qtd_votos_anulados", …Run Code Online (Sandbox Code Playgroud) 我正在尝试将我的项目编译为Scala 2.10和2.11,以便我可以为两个scala版本发布版本,但每次尝试执行此操作时都会失败,并显示以下消息:
#( 04/26/14@ 7:40 )( mauricio@Mauricios-MacBook-Pro ):~/projects/scala/postgresql-netty@scala-2.11?
sbt compile
[info] Loading project definition from /Users/mauricio/projects/scala/postgresql-netty/project
[info] Set current project to db-async-base (in build file:/Users/mauricio/projects/scala/postgresql-netty/)
[info] Compiling 61 Scala sources and 1 Java source to /Users/mauricio/projects/scala/postgresql-netty/db-async-common/target/scala-2.11/classes...
[error] error while loading Object, Missing dependency 'object scala in compiler mirror', required by /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/jre/lib/rt.jar(java/lang/Object.class)
scala.reflect.internal.MissingRequirementError: object scala in compiler mirror not found.
at scala.reflect.internal.MissingRequirementError$.signal(MissingRequirementError.scala:17)
at scala.reflect.internal.MissingRequirementError$.notFound(MissingRequirementError.scala:18)
at scala.reflect.internal.Mirrors$RootsBase.getModuleOrClass(Mirrors.scala:53)
at scala.reflect.internal.Mirrors$RootsBase.getModuleOrClass(Mirrors.scala:66)
at scala.reflect.internal.Mirrors$RootsBase.getPackage(Mirrors.scala:173)
at scala.reflect.internal.Definitions$DefinitionsClass.ScalaPackage$lzycompute(Definitions.scala:161)
at scala.reflect.internal.Definitions$DefinitionsClass.ScalaPackage(Definitions.scala:161)
at scala.reflect.internal.Definitions$DefinitionsClass.ScalaPackageClass$lzycompute(Definitions.scala:162)
at scala.reflect.internal.Definitions$DefinitionsClass.ScalaPackageClass(Definitions.scala:162)
at scala.reflect.internal.Definitions$DefinitionsClass.init(Definitions.scala:1375)
at …Run Code Online (Sandbox Code Playgroud) 我试图调用runTask我的任务内部,并认为这将工作:
name := "hello"
version := "1.0"
scalaVersion := "2.10.2"
lazy val hello = taskKey[Unit]("executes hey")
lazy val helloTask = hello <<= runTask(fullClasspath, "sample.Hey" in run, runner in run)
Run Code Online (Sandbox Code Playgroud)
但是,它没有.有关如何做到这一点的任何想法?
给出以下示例:
val handler : Connection = new DatabaseConnectionHandler()
val result : Future[Future[Future[Option[ResultSet]]]] = handler.connect
.map( (parameters) => handler )
.map( connection => connection.sendQuery("BEGIN TRANSACTION SERIALIZABLE") )
.map( future => future.map( query => query.rows ) )
.map( future => handler.sendQuery("COMMIT").map( query => future ) )
Run Code Online (Sandbox Code Playgroud)
Future[Option[ResultSet]]在Scala的未来结构中,是否有可能将其展平以接收最终而不是未来的未来?
我目前正在使用Scala的2.10 Future和Promise,但我无法找到解决方法.我知道我可以使用嵌套回调但我宁愿避免这种情况,因为代码看起来很糟糕.
该Connection特性被定义在这里.
scala ×6
sbt ×3
java ×2
ruby ×2
ajax ×1
asynchronous ×1
csv ×1
devise ×1
encoding ×1
future ×1
git ×1
github ×1
inputstream ×1
integration ×1
multi-module ×1
outputstream ×1
r ×1
rstudio ×1
scala-2.11 ×1
task ×1
testing ×1
utf-8 ×1