顯示具有 disable 標籤的文章。 顯示所有文章
顯示具有 disable 標籤的文章。 顯示所有文章

2025年4月17日 星期四

[macOS] 關閉 Android File Transfer Agent 自動啟動 @ MacBook Air M2 / macOS 15.4.1

雖然 Android File Transfer 差不多被官方捨棄掉了,但我有舊版 Android 開發機還是很依賴它。目前官方不能下載,想下載可參考這篇:macOS - android fileTransfer 下載位置 AndroidFileTransfer.dmg

這篇主要是要記錄關閉 Android File Transfer Agent 的方式,以往都是自己跑去系統位置去稍微破壞一下檔案名稱路徑等等的架構,這次就多了解一下系統架構:
  1. 系統 -> 一般 -> 登入項目與延伸功能 -> 在登入時打開,在此處進行關閉


  2. 把 Android File Transfer Agent 所在處移除
    • ~/Library/Application Support/Google/Android File Transfer/Android File Transfer Agent.app
    • /Applications/Android File Transfer.app/Contents/Helpers/Android File Transfer Agent.app


  3. 如此在應用程式開啟時,就不會重新再次註冊到 "在登入時打開"


這樣可以避免 android phone 插上連接線時,不斷觸發煩人的彈跳視窗(手機或筆電都有),直到需要時,自己再去應用程式開啟 Android File Transfer 就夠了

2016年2月29日 星期一

關閉 Android Transfer 自動開啟服務 @ Mac OS X 10.11.3

好一陣子,每次手機插上 Mac OS X Usb 後,就會自動彈跳 Android Transfer ,有些不方便 :P 解法就是關閉相關程式,例如重新命名:

$ kill `pgrep "Android File Transfer Agent"`
$ cd $HOME/Library/Application\ Support/Google/Android\ File\ Transfer && mv Android\ File\ Transfer\ Agent.app/ Android\ File\ Transfer\ Agent-DISABLE.app/
$ cd /Applications/Android\ File\ Transfer.app/Contents/Resources/ && mv Android\ File\ Transfer\ Agent.app/ Android\ File\ Transfer\ Agent-DISABLE.app/


之後,有需要 Android Transfer 時,就自行去點擊開啟他吧!

2015年4月8日 星期三

PHP CodeIgniter - 透過 Apache RewriteRule 限制 CGI 功能

基於一些開發需求,想要侷限網站的功能。剛好這個網站服務是用 PHP CodeIgniter 開發的,整套都是走 RewriteRule 來進行,例如一個 URL 位置,都一律導向到 PHP CodeIgniter Project 的 index.php?/path 來分析。

假設原本網站有 3 個主要網址,分別是 /api, /shopping, / 等,假設想要讓此網站只開啟 /api 時,這時就可以透過 Apache RewriteRule 來限制:

<VirtualHost *:80>
DocumentRoot /ci-project/
DirectoryIndex index.html index.php index.htm

# empty page
Alias /empty     /var/www/html/

<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>

<Directory /var/www/html/>
Options FollowSymLinks
AllowOverride None
DirectoryIndex index.html index.php index.htm
Require all granted
Satisfy Any
</Directory>

<Directory /ci-project>
Options FollowSymLinks
DirectoryIndex index.php
AllowOverride None
#AllowOverride All
Require all granted
Satisfy Any

<IfModule mod_rewrite.c>
RewriteEngine On
#LogLevel alert rewrite:trace6
RewriteBase /

# disable index.php with empty QUERY_STRING
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^index\.php$ /empty/ [L]

RewriteCond $1 !^(index\.php|images|css|js|favicon\.ico)
# enable /api only
RewriteCond $1 ^api.*$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php?/$1 [L,QSA]
</IfModule>
</Directory>
</VirtualHost>


如此一來,只要使用者逛 / 位置,則會顯示 /var/www/html 的資料,而逛 /api 系列時,則是可以正常引導到 PHP CodeIgniter 相關程式碼來處理。

2014年6月11日 星期三

[OSX] 關閉 Android Transfer AutoRun / Android File Transfer Agent @ Mac OSX 10.9.3

安裝 Android Transfer 後,可以讓 OSX 跟 Android 手機傳資料,但是,每次手機想透過 USB 線充電時,反而會使 OSX 彈跳出視窗,並且觀察充電情況,容易出現中斷等現象。

解法:
  1. 透過 Activity Monitor 把 Android File Transfer Agent 結束
  2. 把 Android File Transfer Agent 重新命名或刪掉

    $ mv /Applications/Android\ File\ Transfer.app/Contents/Resources/Android\ File\ Transfer\ Agent.app/ /Applications/Android\ File\ Transfer.app/Contents/Resources/Android\ File\ Transfer\ Agent.app.disable/

    $ mv ~/Library/Application\ Support/Google/Android\ File\ Transfer/Android\ File\ Transfer\ Agent.app/ ~/Library/Application\ Support/Google/Android\ File\ Transfer/Android\ File\ Transfer\ Agent.app.dislabe/
未來要傳輸檔案時,在手動去開啟 Android File Transfer 即可。