小编Dra*_*aco的帖子

如何以更快的方式添加要提交的文件?

例如,这是我本地存储库中分支的状态:

14:56:15 /srv/www/gamersmafia/current[max-decisiones]$ git status
# On branch max-decisiones
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#       modified:   app/controllers/respuestas_controller.rb
#       modified:   app/helpers/application_helper.rb
#       modified:   app/models/decision.rb
#       modified:   app/models/gm_portal.rb
#       modified:   app/models/term.rb
#       modified:   app/views/respuestas/index.html.erb
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       app/assets/stylesheets/old/sprites/games_sprites.css
#
Run Code Online (Sandbox Code Playgroud)

如果我想添加文件来提交它们,我必须写入文件的路径,或者在写入后 …

git

10
推荐指数
1
解决办法
3183
查看次数

基于webkit的浏览器的CSS规则

我有下一个CSS代码:

#mgheader .letters {
  display: inline-block;
  margin-left: 55px;
  margin-top: -45px;
  position: absolute;
}

#mgheader .letters {
  display: inline-block;
  margin-left: 10px;
  position: absolute;
}
Run Code Online (Sandbox Code Playgroud)

现在我想在Google Chrome和Safari中执行第一个,在其他浏览器中执行第二个.

我试过这个,但第二个代码似乎总是在执行:

@media screen and (-webkit-min-device-pixel-ratio:0) {
  #mgheader .letters {
    display: inline-block;
    margin-left: 55px;
    margin-top: -45px;
    position: absolute;
  }
}   

#mgheader .letters {
  display: inline-block;
  margin-left: 10px;
  position: absolute;
}
Run Code Online (Sandbox Code Playgroud)

我该如何解决这个问题?

css webkit media-queries

9
推荐指数
1
解决办法
1万
查看次数

UTF-8转换不使用String#encode但是Iconv

我和Iconv有这个:

git_log = Iconv.conv 'UTF-8', 'iso8859-1', git_log
Run Code Online (Sandbox Code Playgroud)

现在我想将其更改为使用String #catit,因为弃用警告,但我不能,不起作用:

git_log = git_log.encode(Encoding::UTF_8, :invalid => :replace, :undef => :replace, :replace => '')
Run Code Online (Sandbox Code Playgroud)

我以前在这里使用Iconv,它仍在工作:

https://github.com/gamersmafia/gamersmafia/blob/master/lib/formatting.rb#L244

但是当我用String #coding方法替换这些行时,首先gsub引发"UTF-8中的无效字节序列"错误.

你知道为什么吗?

ruby ruby-on-rails

3
推荐指数
1
解决办法
1287
查看次数

如何用递归的方式解决这个求和问题

今天,我的老师要求我们在 Java 中使用递归实现下一个表达式(其中n是向用户询问的值):

待实施汇总

有可能的?我找不到这个问题的正确解决方案,但我想我需要两种递归方法。

更新

到目前为止我已经这样做了:

public static double sumatorio(int n){
    if(n==1)
        return 1;
    else{
        return (1 + ((n-1) * segundoSumatorio(n))) + sumatorio(n-1);            
    }
}

public static double segundoSumatorio(int n){
    if(n==1)
        return 1;
    else
        return 1/(double)n + segundoSumatorio(n-1);
}
Run Code Online (Sandbox Code Playgroud)

看起来是正确的,但是当n=3或更大时,结果不准确。有人知道为什么吗?

也许存在与失去精度相关的错误。

痕迹

我非常感谢您提供的任何帮助。

java recursion

0
推荐指数
1
解决办法
1371
查看次数

标签 统计

css ×1

git ×1

java ×1

media-queries ×1

recursion ×1

ruby ×1

ruby-on-rails ×1

webkit ×1