發表文章

python3 的lambda

bank.py class Account:     def __init__(self, name, number, balance):         self.__name = name         self.__number = number         self.__balance = balance     @property     def name(self):         return self.__name     @property     def number(self):         return self.__number     @property     def balance(self):         return self.__balance     def deposit(self, amount):         if amount <= 0:             print('存款金額不得為負')         else:             self.__balance += amount     def withdraw(self, amount):         if amount > self.__balance:             print('餘額不足')       ...

Homebrew安裝和啟動rabbitmq-server

圖片
安裝 brew update brew install rabbitmq 啟動 PATH=$PATH:/usr/local/sbin rabbitmq-server 參考

用shell script 執行python

圖片
我想用shell script 執行python,並執行時要選y,並讓sh檔每10秒執行一次,,. 因為當我用 python manage.py rebuild_index 時要選y 參考

在背景執行shell script

現在我有bash 檔run_rebuild.sh 因為我logout  server 後還要server繼續執行它 在背景執行run_rebuild.sh nohup ./run_rebuild.sh & 然後我就可以logout 了 或者 ./run_rebuild.sh & exit 直接 logout了 參考

找出存在的 Shell script 的Process ID 並 kill

ps - ef | grep your_process_name | grep - v grep | awk '{print $2}' | xargs kill 參考

solr

在server 端運行 solr時要登出server並讓solr繼續運行 sudo nohup java -jar start.jar & 或者 sudo java -jar start.jar & exit 直接logout server 參考

如果某個 input 沒有輸入就不能submit

圖片
html 代碼 以下引用了jquery <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">   <script src="//code.jquery.com/jquery-1.10.2.js"></script>   <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script> 再加上這段 這樣一來id_model_number和id_name必須有輸入數據才能submit 參考