小编Hol*_*ust的帖子

了解git init

究竟是git init什么?我必须每台计算机执行一次,或者每个使用git的项目执行一次吗?我下载了我的项目,git clone并让它工作,但现在它也存储我的项目C:/Users/myUser/git,是某个文件夹或我可以更改它?

我真的不太了解那个文件夹,它看起来像是一个本地git仓库或其他东西,但是"管理"它,或者它为什么使用这条路径,你能解释一下吗?

这就是我的理解,如果我不正确,请修理我,需要直截了当地说明事实:

  1. git init 是为每个项目
  2. "用户"下的git文件夹是本地仓库,每次我git commit都会更新该文件夹.
  3. 当我这样做时git push,它需要来自该本地存储库,并放入远程存储库.
  4. 当我想更新为"HEAD"时,我就是这么做的 git pull

git

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

使用ruby 2.4安装json 1.8.3时出错

[版本信息]

ruby 2.4.0p0(2016-12-24修订版57164)[x86_64-linux]/gem 2.0.3/Windows 10

我跑了bundle install,它告诉我跑gem install json -v '1.8.3'

我这样做了,并且无法构建gem原生扩展错误.

Building native extensions.  This could take a while...

ERROR:  Error installing json:
        ERROR: Failed to build gem native extension.
    /home/ec2-user/.rvm/rubies/ruby-2.4.0/bin/ruby extconf.rb
creating Makefile

make
compiling generator.c
generator.c: In function ‘generate_json’:
generator.c:861:25: error: ‘rb_cFixnum’ undeclared (first use in this function)
     } else if (klass == rb_cFixnum) {
                         ^
generator.c:861:25: note: each undeclared identifier is reported only once for each function it appears in
generator.c:863:25: …
Run Code Online (Sandbox Code Playgroud)

ruby

20
推荐指数
2
解决办法
9215
查看次数

npm 错误!404 未找到 - 获取 https://registry.npmjs.org/error-ex

我正在尝试将 npm 包依赖项安装到我的 angular 应用程序中,但出现此错误。任何帮助解决这个问题?

npm ERR! code E404
npm ERR! 404 Not Found: error-ex@^1.2.0
npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Dilushi\AppData\Roaming\npm-cache\_logs\2020-02-12T13_07_17_602Z-debug.log
Run Code Online (Sandbox Code Playgroud)

我将package.json在这里附上我的文件。

{
  "name": "app-pfe",
  "version": "0.0.1",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^6.0.2",
    "@angular/common": "^6.0.2",
    "@angular/compiler": "^6.0.2",
    "@angular/core": "^6.0.2",
    "@angular/forms": "^6.0.2",
    "@angular/http": "^6.0.2",
    "@angular/platform-browser": "^6.0.2",
    "@angular/platform-browser-dynamic": "^6.0.2",
    "@angular/router": "^6.0.2", …
Run Code Online (Sandbox Code Playgroud)

node.js npm node-modules angular

19
推荐指数
2
解决办法
6万
查看次数

Capistrano + Git:生产服务器的本地存储库

我正在尝试为我的应用程序"部署:冷".git仓库是我的部署服务器本地的(即我只有一台服务器用于所有东西,我不在github上托管我的代码).

这是成绩单(将我的应用名称替换为"myapp"以获取隐私)

  * executing `deploy:cold'
  * executing `deploy:update'
 ** transaction: start
  * executing `deploy:update_code'
    executing locally: "git ls-remote /home/mrichman/git/myapp.git master"
fatal: '/home/mrichman/git/myapp.git' does not appear to be a git repository
fatal: The remote end hung up unexpectedly
*** [deploy:update_code] rolling back
  * executing "rm -rf /var/www/myapp.com/releases/20100218203108; true"
    servers: ["myapp.com"]
Password:
    [myapp.com] executing command
    command finished
Command git ls-remote /home/mrichman/git/myapp.git master returned status code 32768
Run Code Online (Sandbox Code Playgroud)

这是我的deploy.rb:http://pastie.org/831424

我也试过了

set :repository, "deploy@localhost:/home/mrichman/git/myapp.git"
Run Code Online (Sandbox Code Playgroud)

但这给了我

ssh: connect to host localhost port 22: Connection …
Run Code Online (Sandbox Code Playgroud)

git deployment capistrano ruby-on-rails

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

为什么Jenkins Android Emulator Plugin会在每次构建中重新创建我的仿真器快照?

我使用Jenkins构建我的一个项目.Android Emulator插件使用以下配置自动启动模拟器:

模拟器配置

配置仿真器插件:

模拟器插件配置.

每次作业运行时,我都会得到以下输出:

Erasing existing emulator data... $
/ci/home/tools/android-sdk//tools/emulator -no-boot-anim -ports
64470,64471 -prop persist.sys.language=de -prop persist.sys.country=DE
-avd hudson_de-DE_240_480x720_Google_Inc._Google_APIs_8 -no-snapshot-load -no-snapshot-save -wipe-data

.
.

shell input keyevent 4 [android] Giving the system some time to settle
before creating initial snapshot... $

.
.

localhost:64471 shell log -p v -t Jenkins "Creating snapshot..."
[android] Creating snapshot... $
Run Code Online (Sandbox Code Playgroud)

完整日志如下.

似乎插件每次都在创建一个新的模拟器,并且不使用快照.这需要2到4分钟,具体取决于仿真器配置.

该插件在作业文件夹内的.android/avd目录中创建.avd和.ini文件.运行过程后不会删除avds.

如果我禁用使用快照配置,则模拟器需要不到一分钟才能启动.

这是模拟器插件的问题,还是由于我的配置而无法拍摄快照?

我希望使用快照可以加快我的构建过程.


完整日志:

$ /ci/home/tools/android-sdk//tools/android list target [android]
Using Android SDK: /ci/home/tools/android-sdk/ [android] Adding 200M
SD card to AVD …
Run Code Online (Sandbox Code Playgroud)

android hudson android-emulator jenkins android-emulator-plugin

17
推荐指数
1
解决办法
4394
查看次数

*(星号)符号在函数参数附近做什么以及如何在其他场景中使用它?

我正在使用Ruby on Rails 3,我想知道*在函数参数附近是否存在运算符,并了解其在其他场景中的用法.

示例场景(此方法来自Ruby on Rails 3框架):

def find(*args)
  return to_a.find { |*block_args| yield(*block_args) } if block_given?

  options = args.extract_options!

  if options.present?
    apply_finder_options(options).find(*args)
  else
    case args.first
    when :first, :last, :all
      send(args.first)
    else
      find_with_ids(*args)
    end
  end
end
Run Code Online (Sandbox Code Playgroud)

ruby arguments ruby-on-rails splat ruby-on-rails-3

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

Gem::Ext::BuildError: 错误: 无法构建 gem 本机扩展。在 VScode 中运行捆绑程序安装时不断收到此消息

我正在尝试在 Windows 版 vscode 上运行捆绑程序安装,但每次这样做时,我都会收到相同的消息:

Fetching gem metadata from https://rubygems.org/.......
Resolving dependencies...
Using bundler 2.1.4
Fetching byebug 11.1.3
Installing byebug 11.1.3 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /home/chadcunn/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/byebug-11.1.3/ext/byebug
/home/chadcunn/.rbenv/versions/2.7.1/bin/ruby -I /home/chadcunn/.rbenv/versions/2.7.1/lib/ruby/2.7.0 -r ./siteconf20200718-7409-qq2a6i.rb extconf.rb
creating Makefile

current directory: /home/chadcunn/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/byebug-11.1.3/ext/byebug
make "DESTDIR=" clean

current directory: /home/chadcunn/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/byebug-11.1.3/ext/byebug
make "DESTDIR="
compiling breakpoint.c
compiling byebug.c
compiling context.c
compiling locker.c
compiling threads.c
linking shared-object byebug/byebug.so

current directory: /home/chadcunn/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/byebug-11.1.3/ext/byebug
make "DESTDIR=" install
/usr/bin/install -c -m 0755 byebug.so ./.gem.20200718-7409-z7mdim/byebug

Permission …
Run Code Online (Sandbox Code Playgroud)

ruby rubygems ruby-on-rails bundler visual-studio-code

15
推荐指数
2
解决办法
7万
查看次数

将SVGSVGElement转换为String

我到处搜索了一个答案,但我找不到将SVGSVGElement转换为字符串的方法.我正在使用Chrome(22).如果之前已经回答过但我无法找到它(此处或Google上),我道歉.

我有一个嵌入在HTML页面中的SVG(XML)图像,并使用Javascript(添加/删除形状等)操纵SVG.我的目标是将修改后的SVG XML映像保存在内存中并将其保存到文件中(通过发布到php表单).post和php表单正在运行,但我目前遇到的问题是我无法获得修改后的SVG图像的字符串表示.

我在下面发布了一个简化的页面,我只是想从加载的SVG中获取原始XML并将其粘贴到textarea中.如果你测试下面的html,你会发现textarea只包含字符串:" [object SVGSVGElement] ".

我可以使用Javascript访问SVG中的每个元素并操纵元素和属性,但我似乎无法将整个事物变成字符串.我已经尝试过JQuery和JQuery SVG但是无法让它运行起来.console.log()能够显示svg/xml,但它不是字符串,所以我似乎无法存储/发送它.非常感谢任何帮助!

我甚至会想办法将任何SVG*Element对象转换为字符串,因为我可以使用.childNodes [x]属性遍历所有这些对象,但这些仍然是对象,我似乎无法获得原始XML.

的test.html:

<html>
<head>
<script type='text/javascript' src='js/jquery.js'></script>
<script>
function startup() {
    svgOutput = document.getElementById("svgCanvas").getSVGDocument().documentElement;    
    console.log(svgOutput);
    document.getElementById("output").value = svgOutput;
}
</script>
</head>
<body style="margin: 0px;" onload="startup()">
<textarea id="output"></textarea><br/>
<embed src="svg1.svg"
    id="svgCanvas"
    width="75%" height="75%"
    type="image/svg+xml"
    codebase="http://www.adobe.com/svg/viewer/install"
></embed>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

svg1.svg:

<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ev="http://www.w3.org/2001/xml-events">
<image id="svgBackground" x="0px" y="0px" width="100%" height="100%" preserveAspectRatio="none" xlink:href="bg1.jpg"/>
<g id="1">
    <text id="shape" x="30" y="30" font-size="16pt" fill="black" visibility="hidden">circle</text>
    <text …
Run Code Online (Sandbox Code Playgroud)

javascript xml svg

14
推荐指数
2
解决办法
2万
查看次数

Ruby 2.4上的MySQL Gem安装错误

我有一个安装mysql gem的问题.这是我的错误:

gem install mysql -v '2.9.1'
Building native extensions.  This could take a while...
ERROR:  Error installing mysql:
    ERROR: Failed to build gem native extension.

    current directory: /usr/local/rvm/gems/ruby-2.4.0/gems/mysql-2.9.1/ext/mysql_api
/usr/local/rvm/rubies/ruby-2.4.0/bin/ruby -r ./siteconf20170107-4120-x2dv85.rb extconf.rb
checking for mysql_ssl_set()... yes
checking for rb_str_set_len()... yes
checking for rb_thread_start_timer()... no
checking for mysql.h... yes
creating Makefile

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /usr/local/rvm/gems/ruby-2.4.0/extensions/x86_64-linux/2.4.0/mysql-2.9.1/mkmf.log

current directory: /usr/local/rvm/gems/ruby-2.4.0/gems/mysql-2.9.1/ext/mysql_api
make "DESTDIR=" clean

current directory: /usr/local/rvm/gems/ruby-2.4.0/gems/mysql-2.9.1/ext/mysql_api
make "DESTDIR=" …
Run Code Online (Sandbox Code Playgroud)

ruby mysql rubygems

14
推荐指数
1
解决办法
6755
查看次数

带有IFrames Chrome 63的Android Cordova应用程序无请求标题Cookie

自从Android 63上的Chrome 63发布以来,2017年12月6日,我遇到了我公司基于Cordova的Android应用程序的问题.此应用程序包含IFrame,允许用户从应用程序中导航我公司的部分电子商务网站.

IFrame中加载的页面之间的导航不再在请求标头中发送任何cookie信息.

存储在cookie中的诸如Session Ids之类的信息不会传递到下一页,这反过来会导致下一页开始一个全新的用户会话!

然而奇怪的是,在IFrame上的页面中执行的任何AJAX调用(例如,检索篮子中的项目数)和资产请求(css js,图像文件等)确实在请求头中发送cookie信息.这些标头中的会话ID在页面之间是相同的,表示会话持久性.

正在创建Cookie,我可以在公司域下的"应用程序"面板中使用Chrome开发人员工具时看到它们.他们只是没有被传递到下一页.

我在Android 7.1.1设备上遇到过这个问题.当我在此设备上停用Chrome应用时,应用中IFrame中的Cookie请求标头会再次正常工作,可能是Cordova Webview在禁用时不再使用Chrome?

有谁知道可能导致这个问题的原因?是否与Chrome 63中的SameSite cookie或严格的站点隔离更改或其他与安全相关的更改有关?

该问题与2016年10月修复的Chromium bug类似:https: //bugs.chromium.org/p/chromium/issues/detail?id = 634311

但是,Webview确实在Cordova库的SystemCookieManager类中启用了ThirdParty cookie(Cordova Android 6.4.0):

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    cookieManager.setAcceptThirdPartyCookies(webView, true);            
}
Run Code Online (Sandbox Code Playgroud)

如果我没有明确说明任何内容,请道歉.如果有人可以帮助解决这个问题,我很乐意提供更多信息.

cookies iframe android google-chrome cordova

14
推荐指数
1
解决办法
1636
查看次数