1830 articles

XCode 10的UI组件库在哪?

我好久不用Xcode,发现以前在右侧边栏的UI组件库不见了,找了半天也没找到,google一搜,还真有不少人我和一样https://stackoverflow.com/questions/51051532/xcode-10-where-are-the-ui-elements

View -> Libraries -> Show Library

Screen Shot 2019-07-24 at 23.35.54.png

或者快捷键 Command + Shift + L

More ~

shell tree in macos

Use find to list the current folder:

find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'

Add to ~/.bash_profile or ~/.zshrc
alias tree="find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'"
  

Or install the tree with brew
brew install tree

More ~

First start ansible on macos

I installed the ansible via pip install, and there are several issues here:

where is the config

Here you should create a file ~/.ansible.cfg

[defaults]
inventory =~/.ansible/hosts
sudo_user=root
remote_port=22
host_key_checking=False
remote_user=root
log_path=~/.ansible/log/ansible.log
module_name=command
private_key_file=~/.ssh/id_rsa
More ~

Git: remove untracked files

To remove directories, run
git clean -f -d or git clean -fd

To remove ignored files, run
git clean -f -X or git clean -fX

To remove ignored and non-ignored files, run
git clean -f -x or git clean -fx

More ~

mysql delete foreign key

Check what's the CONSTRAINT name and the FOREIGN KEY name:

SHOW CREATE TABLE table_name;

Remove both the CONSTRAINT name and the FOREIGN KEY name:

ALTER TABLE table_name
  DROP FOREIGN KEY the_name_after_CONSTRAINT,
  DROP KEY the_name_after_FOREIGN_KEY;

Or simply run this if you know the foreign key name:

alter table footable drop foreign key fooconstraint

原文:https://stackoverflow.com/questions/838354/mysql-removing-some-foreign-keys

More ~

No changes detected while running python manage.py makemigrations

Issues:

I want to recreate the migrations, so I deleted files under migrations folder, and drop the database. And try this python manage.py makemigrations, it reponse No changes detected.

Fix:

Create the database again, and clear files and folders under migrations, then try the following:

  1. python manage.py makemigrations --empty appname
  2. python manage.py makemigrations
  3. python manage.py migrate

It works!

More ~

ld: library not found for -lssl - Install mysqlclient for Django 2, macos

Background

mysql server was installed by brew install mysql

Issues like this:

ERROR: Failed building wheel for mysqlclient

ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'clang' failed with exit status 1

Exception: Wrong MySQL configuration: maybe https://bugs.mysql.com/bug.php?id=86971 ?

More ~