小编Was*_*uel的帖子

使用bitbucket上的git部署到Heroku

我想使用git在bitbucket上托管我的源码,因为我显然得到了一个免费的私人仓库,我想使用bitbucket的源代码在heroku上托管我的应用程序.

我可以使用github客户端和heroku工具带来完成它.它会起作用吗?Github很棒,但我不希望每个人都看到我的代码,我不想支付私人回购,因为它是一个小项目.

git github heroku bitbucket heroku-toolbelt

78
推荐指数
4
解决办法
5万
查看次数

撤消git中几个没有推送到远程的提交

我已经运行了git status

# On branch master
# Your branch is ahead of 'origin/master' by 4 commits.
#   (use "git push" to publish your local commits)
#
# 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/views/layouts/_header.html.erb
#
no changes added to commit (use "git add" and/or "git commit -a")
Run Code Online (Sandbox Code Playgroud)

我希望在提交到我的远程存储库之前撤消所有4次提交和更改未提交的提交.我怎样才能做到这一点?

git github

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

brew链接错误libpng和libtiff

我尝试使用自制软件安装elixir,我得到以下错误

==> Pouring libtiff-4.0.3.yosemite.bottle.tar.gz
Error: An unexpected error occurred during the `brew link` step
The formula built, but is not symlinked into /usr/local
Run Code Online (Sandbox Code Playgroud)

文件存在 - /usr/local/lib错误:文件存在 - /usr/local/lib

我跑了brew doctor,我看到了这个

Warning: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that  depend on
those kegs to fail to run properly once built. Run `brew link` on these:

libpng
libtiff
Run Code Online (Sandbox Code Playgroud)

所以我跑了brew link libpng,我得到了这个

Linking /usr/local/Cellar/libpng/1.6.17... Error: File exists - …
Run Code Online (Sandbox Code Playgroud)

macos homebrew elixir

5
推荐指数
1
解决办法
1187
查看次数

Sequelize错误:未处理的拒绝TypeError:无法读取未定义的属性'_pseudo

我克隆了此应用程序https://github.com/sequelize/express-example,它似乎是官方的sequelize express示例,但是当我尝试运行它时出现此错误

Unhandled rejection TypeError: Cannot read property '_pseudo' of undefined at conformInclude (/Users/wasswasam/express-example-master/node_modules/sequelize/lib/model.js:277:14)

我不确定发生了什么。

node.js express sequelize.js

5
推荐指数
2
解决办法
2812
查看次数

Pandas - 在分类数据中处理NaN

我在数据框中有一列有分类数据,但缺少一些数据,即NaN.我想对这些数据进行线性插值以填补缺失值,但我不确定如何去做.我不能删除NaN来将数据转换为分类类型,因为我需要填充它们.一个简单的例子来演示我想要做什么.

col1  col2
5     cloudy
3     windy
6     NaN
7     rainy
10    NaN
Run Code Online (Sandbox Code Playgroud)

假设我想转换 col2为分类数据但保留NaN并使用线性插值填充它们我该如何处理它.让我们说在将列转换为分类数据后,它看起来像这样

col2
1
2
NaN
3
NaN
Run Code Online (Sandbox Code Playgroud)

然后我可以做线性插值并得到这样的东西

col2
1
2
3
3
2
Run Code Online (Sandbox Code Playgroud)

我怎样才能做到这一点?

python dataframe python-3.x pandas categorical-data

5
推荐指数
1
解决办法
3023
查看次数

ember-cli -TypeError:运行ember服务器后,undefined不是一个函数

我使用ember-cli创建了一个新的ember应用程序

ember new myapp
cd myapp
ember server.
Run Code Online (Sandbox Code Playgroud)

我得到以下神秘错误.

 ember server
 version: 0.2.0-beta.1
 Livereload server on port 35729
 Serving on http://0.0.0.0:4200/
 undefined is not a function
 TypeError: undefined is not a function
at rimraf (/vagrant/fadis-web/node_modules/ember-cli/node_modules/broccoli-caching-writer/node_modules/rimraf/rimraf.js:57:13)
at lib$rsvp$node$$tryApply (/vagrant/fadis-web/node_modules/ember-cli/node_modules/broccoli-caching-writer/node_modules/rsvp/dist/rsvp.js:1467:11)
at lib$rsvp$node$$handleValueInput (/vagrant/fadis-web/node_modules/ember-cli/node_modules/broccoli-caching-writer/node_modules/rsvp/dist/rsvp.js:1567:20)
at fn (/vagrant/fadis-web/node_modules/ember-cli/node_modules/broccoli-caching-writer/node_modules/rsvp/dist/rsvp.js:1555:18)
at /vagrant/fadis-web/node_modules/ember-cli/node_modules/broccoli-caching-writer/index.js:100:14
at lib$rsvp$$internal$$tryCatch (/vagrant/fadis-web/node_modules/ember-cli/node_modules/promise-map-series/node_modules/rsvp/dist/rsvp.js:489:16)
at lib$rsvp$$internal$$invokeCallback (/vagrant/fadis-web/node_modules/ember-cli/node_modules/promise-map-series/node_modules/rsvp/dist/rsvp.js:501:17)
at lib$rsvp$$internal$$publish (/vagrant/fadis-web/node_modules/ember-cli/node_modules/promise-map-series/node_modules/rsvp/dist/rsvp.js:472:11)
at lib$rsvp$asap$$flush (/vagrant/fadis-web/node_modules/ember-cli/node_modules/promise-map-series/node_modules/rsvp/dist/rsvp.js:1290:9)
at process._tickCallback (node.js:355:11)
Run Code Online (Sandbox Code Playgroud)

我是新手,所以我不知道发生了什么.有什么建议.

ember.js ember-cli

4
推荐指数
1
解决办法
1387
查看次数

自制软件安装:错误:RPC 失败;卷曲 56 LibreSSL SSL_read:错误:06FFF064:数字信封例程:CRYPTO_internal:解密错误,errno 0

我尝试homebrew在 Macbook pro Apple M1 上安装 MacOS Monterey,但在这一步总是失败,如下所示。

HEAD is now at 472edc06e Merge pull request #12943 from Homebrew/update-man- 
completions
==> Tapping homebrew/core
remote: Enumerating objects: 1150006, done.
remote: Counting objects: 100% (29/29), done.
remote: Compressing objects: 100% (19/19), done.
error: RPC failed; curl 56 LibreSSL SSL_read: error:06FFF064:digital envelope 
routines:CRYPTO_internal:bad decrypt, errno 0
error: 1835 bytes of body are still expected
fetch-pack: unexpected disconnect while reading sideband packet
fatal: early EOF
fatal: fetch-pack: invalid index-pack output
Failed during: …
Run Code Online (Sandbox Code Playgroud)

git homebrew macos-monterey

4
推荐指数
1
解决办法
6832
查看次数

生成10阶多项式的值及其在C中的导数

我试图生成具有11个系数的10阶多项式的值.我也试图产生它的衍生物.我写了三个函数如下所示.此代码生成多项式的值.a1到a10是系数.

float polynm( float a0,float a1,float a2,float a3,float a4,float a5,float a6,float a7,float a8,float a9,float a10,float x)
     {
          float poly = a0 + a1*x + a2*pow(x,2)+a3*pow(x,3)+a4*pow(x,4)+a5*pow(x,5)+a6*pow(x,6)+a7*pow(x,7)+a8*pow(x,8)+a9*pow(x,9)+a10*pow(x,10);
             return poly;
             }
Run Code Online (Sandbox Code Playgroud)

此代码生成它调用函数deri的多项式的导数值

 float polynm_der(float a0,float a1,float a2,float a3,float a4,float a5,float a6,float a7,float a8,float a9,float a10,float x)
    {  float der = a1 + a2*deri(x,2)+a3*deri(x,3)+a4*deri(x,4)+a5*deri(x,5)+a6*deri(x,6)+a7*deri(x,7)+a8*deri(x,8)+a9*deri(x,9)+a10*deri(x,10);
       return der;
       }
deri is below
float deri(float x,int n)
   {   
         float term_der = n*pow(x,n-1);
           return term_der;
           }
Run Code Online (Sandbox Code Playgroud)

多项式的代码是低效的.如果我想生成一个100阶多项式,它将变得不可能.有没有办法可以递归生成多项式及其导数,以避免笨重的代码.

c polynomial-math

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

创建一个迭代程序来估计多项式的根

我在c中创建了一个程序,该程序假设要使用牛顿拉夫森方法估算10阶多项式的根。用户输入10个系数,并假设估计方程的根。绝对相对误差为0.00000001,允许的最大迭代次数为70。示例代码如下。

   n=0;
    while(abserr<=0.00000001){
    yold=y;
    y = y-(poly(y,coefficients,11)/poly_der(y,coefficients,11));
    ynew = y;
    error=ynew-yold;
    abserr=sqrt(error*error);

    printf("iteration x%d = %.2f error =%.2f\n",n+1,y,abserr);
    n++;
    iteration++;

    if(iteration==70){
    printf("you have reached the maximum number of iterations\n");
    break;}
    }
Run Code Online (Sandbox Code Playgroud)

函数poly和poly_der分别计算多项式的值及其导数。下面有定义。

float poly(float x, float coefficients[], int order)
    {
     int idx;
     float total;

     for (idx = 0; idx < order; idx++)
        total += coefficients[idx] * pow(x, idx);
        return total;
     }

   float poly_der(float x, float coefficients[], int order)
{
    int idx;
    float total;

    for (idx = 0; idx < order; …
Run Code Online (Sandbox Code Playgroud)

c polynomial-math numerical-methods

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

尝试将其配置为使用php运行后,Apache服务器无法启动

我在vista机器上安装了apache server 2.2.19.它运行正常但我尝试通过修改httpd.conf文件来配置它以使用php.这些是我添加的行

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
PHPIniDir “C:\PHP”
Run Code Online (Sandbox Code Playgroud)

我在这一行下面加了这个

AddType application/x-gzip .gz .tgz
Run Code Online (Sandbox Code Playgroud)

我也添加了这一行

LoadModule php5_module “C:\PHP\php5apache2_2.dll”
Run Code Online (Sandbox Code Playgroud)

我在这一行下面加了这个

#LoadModule vhost_alias_module modules/mod_vhost_alias.so
Run Code Online (Sandbox Code Playgroud)

我试图重新启动apache服务器,但每次我这样做都会返回一条错误消息,指出请求的操作失败了.可能是什么问题呢?

php apache

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