Sunday, December 25, 2011
NSNotification
Monday, December 5, 2011
How to import Xcode project into bitbucket
BitBucket supports private repository for free users, so it is very suitable for hosting our Xcode projects :)
When you signup your free account, and create a new project for yourself, the problem is coming, how to import your xcode project into the bitbucket?
1. Create your SSH key
First, you need to update your SSH key(s) into bitbucket, as we're OS X users, so it is very :)
1.1 Check your SSH key
In console, type:
$ls ~/.ssh<enter>
If there are id_rsa and id_rsa.pub exist, you've already got your SSH keys, so skip the next step.
1.2 Create your SSH key
In console, type:
$ssh_keygen<enter>
The program will ask you for a passphrase, you can just take it as a "password". And when the program finishes, there will be two files in your ~/.ssh
- id_rsa - which is your private key, you need to protect this file, don't be touched by others.
- id_ras.pub - which is the pub key, you can upload / send this file to others, such as bitbucket.
So we have our SSH key, then we upload it to bitbucket
2. Update your SSH key to bitbucket
Go to Bitbucket settings, click the "choose key", and browser to your id_rsa.pub (you may need to copy it to some directory that the finder can locate it, for example, in console, use: cp ~/.ssh/id_rsa.pub ~/ ), then click the same button, it should be "update key", after that, you public is uploaded successfully.
3. Upload your repository
I refer to this link, you need to:
- Create a repository in bitbucket
- Note the URL you should use is: git@bitbucket.org:youruser/yourepo.git
- in console, go to your locale repository: $cd /path/to/my/repo
- git push --mirror git@bitbucket.org:youruser/progbuenos.git
Then the local code will be uploaded to bitbucket, you can use git clone to fetch it back
Tuesday, November 22, 2011
How to update xcode via app store?
I searched the internet, and finally found that I must run /Applications/install xcode.app.... it means App Store only download the install package, and place it into /Applications, but doesn't run it for you.
You can click "install xcode" from launchpad, and follow the instructions.
Wednesday, November 16, 2011
I searched the internet, and find out that this file is on: /private/etc/ so the file is:
/private/etc/hosts
And the format is the same as other systems.
Saturday, October 29, 2011
Error in .vimrc
So the vimrc can't be loaded into MacVim. I googled but their solution doesn't work for me. There is a very simple solution is....
1. In terminal:
2. Then in vim:
That means, copy the whole content from "vimrc" to ".gvimrc" in MacVim. So the ".gvimrc" will work well.
Friday, October 28, 2011
Vim for Mac
After download / install MacVim, there are two method to open it in console:
- $open -a MacVim
- $mvim
1. open -a MacVim
Because MacVim is installed on /Application, so the system allow us to open the app by the name, the path is not needed. It is very handy, but it seems that if you want to edit a file with administrator privilege, "sudo open -a MacVim" can't work. So we need the second method.
2. mvim
mvim is included in the install package of MacVim, you can copy it to a dir, for example, I have a directory: ~/scripts, and I copy mvim into ~/scripts. Then I need to add ~/scripts into the PATH.
Because OSX read the follow configurations when terminal opens (via this):
- /etc/profile
- ~/.bash_profile
- ~/.bash_login
- ~/.profile
into it. So ~/scripts is added into PATH whenever you open a terminal.
Then in terminal, you can just type:
$mvim <path to file>
or
$sudo mvim <path to system file>
to edit.