小编Isa*_*ina的帖子

获取错误:bash:parse_git_branch:找不到命令

我正在运行命令:

sudo bash
Run Code Online (Sandbox Code Playgroud)

但是我的终端上一直有错误说,

bash: parse_git_branch: command not found
Run Code Online (Sandbox Code Playgroud)

这是我的.bash_profile档案

parse_git_branch() {
    git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}

export PS1="\u@\h \[\033[32m\]\w - \$(parse_git_branch)\[\033[00m\] $ "

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM$

if [ -f ~/.git-completion.bash ]; then
  . ~/.git-completion.bash
fi

export PATH=/usr/local/bin:/Applications/XAMPP/xamppfiles/bin:$PATH
export PATH=/bin:/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:$PATH
export EDITOR='subl -w'



export JAVA_HOME=$(/usr/libexec/java_home)
export JAVA_HOME=$(/usr/libexec/java_home)
export JAVA_HOME=$(/usr/libexec/java_home)
Run Code Online (Sandbox Code Playgroud)

提前致谢.

macos bash sudo git-bash

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

如何在底部使Button重叠CardView

我正在创建一个显示公告的应用程序,我想添加一个登录信息.我正在尝试制作这个XML设计,图片.我想按钮OVERLAP在底部,它的中心CardView.如果有必要,我将更改文件的根目录.

这是我的XML代码:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    android:background="#fff"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:card_view="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.crescendo.lldm.crescendo.A_Login">

    <RelativeLayout
        android:id="@+id/rl_one_login"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <View
            android:id="@+id/v_one_login"
            android:background="@drawable/gradient_background_one"
            android:layout_width="match_parent"
            android:layout_height="300dp" />

        <RelativeLayout
            android:layout_marginTop="90dp"
            android:id="@+id/rl_two_login"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <TextView
                android:textStyle="bold"
                android:id="@+id/tv_one_login"
                android:textSize="32sp"
                android:textAlignment="center"
                android:textColor="@color/colorWhite"
                android:text="C R E S C E N D O"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />

            <TextView
                android:layout_below="@+id/tv_one_login"
                android:textSize="15sp"
                android:textAlignment="center"
                android:textColor="@color/colorWhite"
                android:text="FOR THE USA MONUMENTAL CHOIR"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />

        </RelativeLayout>

    </RelativeLayout>

    <android.support.v7.widget.CardView
        app:cardUseCompatPadding="false"
        app:cardPreventCornerOverlap="false"
        android:id="@+id/cv_one_login"
        app:cardBackgroundColor="#fcfcfc"
        android:layout_marginTop="240dp"
        card_view:cardElevation="10dp"
        app:cardCornerRadius="10dp"
        android:elevation="10dp"
        android:layout_centerHorizontal="true"
        android:layout_width="360dp"
        android:layout_height="280dp">

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"> …
Run Code Online (Sandbox Code Playgroud)

android android-layout android-xml android-cardview

2
推荐指数
3
解决办法
5793
查看次数

当我有正确数量的字符时,为什么我的 Rails 应用程序返回“密码太短(最少 6 个字符)”?

我正在构建一个简单的注册页面。

这是我的用户模型及其验证和关联:

class User < ApplicationRecord
    has_secure_password

    has_many :posts
    has_many :comments
    has_many :likes

    validates :username, presence: true, uniqueness: true
    validates :password, presence: true, length: { minimum: 6 }
end
Run Code Online (Sandbox Code Playgroud)

这是我的用户迁移:

class CreateUsers < ActiveRecord::Migration[6.0]
  def change
    create_table :users do |t|
      t.string :name
      t.string :username
      t.string :password_digest
      t.integer :age
      t.integer :years_in_the_labor
      t.string :title
      t.string :location
      t.string :ministry

      t.timestamps
    end
  end
end
Run Code Online (Sandbox Code Playgroud)

这也是我的用户控制器创建方法:

def create
    @user = User.new(name: params[:name], title: params[:title], username: params[:username], password: [:password])

    if @user.valid?
        @user.save
        render json: { status: …
Run Code Online (Sandbox Code Playgroud)

ruby-on-rails fetch bcrypt-ruby reactjs

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