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

2016年3月17日 星期四

Set up shortcut for python compiler -- .bashrc

It's sometimes annoying when you use python compiler.  Especially you went to some spicily complier.

I used to use python3.4 for my code. but it's not quite fast to type the whole name.

My default python version is Python 2.7.10

[check]

                                                                       
$ python --version                                     
                                                                         







ps: python2.7 是官方認可的最後版本,也是version 2中最終版本。基本上mac系統中都已經內建python系統。

Although use aliases for changing is helpful, once you close terminal or environment , the aliases before you set up will be gone.

More information about 'alias" please check 指令別名設定 -- BASH

So add alias in file-- .bashrc is a key to change environment that you don't need to set up every time at first time opening terminal.

[1. First ]

Find the location and See what python binary executables you have.

                                                                 
$ ls /usr/local/bin/python*                
                                                                  








choose and copy the the complier which you want

[2. Second]

open (or create) the .bashrc file

here i already have this file, so just need to open it.

                                                                                           
$ vi ~/.bashrc                                                                  
                                                                                            

Add new alias to change your default python executable:

                                                                                            
alias = py3='python3.4'                                                
                                                                                            








leave the file and source the file:

                                                                                            
$ . ~/.bashrc                                                                    
                                                                                            

check the version:













Reference: How to change from default to alternative Python version on Debian Linux












2016年2月15日 星期一

指令別名設定 -- BASH

參考文獻:鳥哥 10.3.1  alias, unalias

I learn Python programming recently. There are many complier i can use for.






I used to use python3.4 but i found this way is too annoying. So, to be speed up coding, i need to typing less words.

Usually, i compile my code like this way:

>> python3.4 xxx.py
--------------------------------------------------------------------

now simplified complier "python3.4" as "Py3":

>>$ alias Py3='python3.4'

--------------------------------------------------------------------

if change back:

>> $ unalias Py3

---------------------------------------------------------------------

check all the simplification

>> alias






===========[學習紀錄]================

ps: 若要改變路徑,參考path 相關文章



2010年5月31日 星期一

Install converter

step 1. install MacPorts

step 2. open terminal and type : sudo port install ImageMagick

step 3 . sudo port install ghostscript

done !

[Set up the environment]

cd $HOME

vi .bashrc

================================================

export MAGICK_HOME="$HOME/ImageMagick-6.9.1"

export PATH="MAGICK_HOME/bin:$PATH"

export DYLS_LIBRARY_PATH="MAGICK_HOME/bin/"

:q

================================================

[check]

convert logo: logo.gif

identify logo.gif

display logo.gif




===============================================
create a .gif file :

convert -density 500 -alpha off -delay 50 *.eps _____.gif

-density 500: the gif size

-alpha off : transparency

-delay 50 : output 2 pictures per second. 100 = output 1 picture per second.




source:http://www.imagemagick.org/script/binary-releases.php

2010年3月25日 星期四

How to create a icon for your own self -----如何建立一個屬於自己的icon

如何建立一個屬於自己的icon 圖示?通常大家給的答案幾乎都是去 iconfactory 抓免費的。
如果要漂亮一點的圖就要付費。但是,卻不能保證那些圖都是你要的。
其實建立一個新的icon並不難!只是要讓圖的付檔名變成.icns
actually, it is easy to create a new icon you like! (just change format from .png to .icns)
follow next steps, you will be a creater!

step 1. prepare your picture you like. you can download any picture on the websit or creat your own picture.

step 2. save as .png or .psd

step 3. go to "/Developer/Applications/Utilities" and open "Icon Composer.app"

step 4. "file >> New icns" you will see like this:



step 5. drag your picture in to the box and filled it.


like this :

step 6. save it. "file >> save"

step 7. now you need IcnsRsrc to convert .icns to .rsrc .

step. 8 download and open it. "file >> open >> .icns" than you will get a new icon.

now you can easily change any icon you like !!

drag .ratc to new file which you want to change.

enjoy it !!

參考來源:http://macapper.com/2007/04/21/how-to-create-custom-icons-for-your-mac/

set printer to server for MAC (or Linux)

this way is to link the server printer from MAC to Windows

step 1. open website type "http://localhost:631/"

step 2. enter "Administration --> add printer", choose "Windows Printer via SAMBA" and click continue.

step 3. type "smb://username:password@140.11x.xxx.xx/HP_Color_LaserJet_xxxx" and continue.
ps: username is server name.
password is server password.
140.1xx.xxx.xxx is server IP
HP_Color_xxxxx is the printer's type

step 4. type "Name","Description","Location" whish you prefer to and continue.

step 5. choose the printer type. (for me i choose "HP" ) and continue.

step 6. done! you can go back "Administration --> Manage" print test page to check is it work.

good luck !
if i have time i will put figuer in this in the future.

install gnuplot on MAC

前提:每次安裝都會花很久的時間才會安裝成功,不是失敗就是哪些沒安裝,為了以防萬一還是來記一下好了。

在 MAC上安裝 gnuplot 之外必須還要在安裝一項 AquaTerm 來輸出結果。

stap 1. download AquaTerm v1.0.1
click on "AquaTerm.dmg"
step 2. open Terminal type :
"cd /usr/local/lib/"
"sudo ln -s libaquaterm.1.0.1.dylib libaquaterm.1.0.0.dylib"
ernter your password

-------------------------------------以上aquaterm才算是安裝成功---------------------------------
再來就是gnuplot 的部份:
there are two way to install gnuplot :

step 3. download gnuplot 4.0.0.dmg
install this , and follow the installation step to the end.

the other way to install is :
step 3. download gnuplot-4.4.0.tar.gz
unzip this file
step 4. open Terminal to where you download the gnuplot file.
4-1 . type "./configure" enter it
4-2. "make"
4-3. "sudo make install" and type your password.

--------------------------------------------end-----------------------------------------------
check gnuplot :

step 5. type "gnuplot"

step 6. "set term aqua"

step 7. "plot sin(x)"

個人比較喜歡第一種方法,簡單。雖然比較低階(只有到4.0.0),但是個人用起來似乎沒什麼差別。

參考網站:http://www.oikos.com.tw/v4/viewtopic.php?id=32198
http://www.it.uom.gr/teaching/gnuplot/gnuplot.html