Tuesday, November 20, 2012

Install Gitosis on CentOS for multiple developers

Install Gitosis

   [@Server]
   1. Download Gitosis from https://github.com/tv42/gitosis (or git clone git://eagain.net/gitosis )
   2. Install it by
       cd gitosis
       python setup.py install
       If you get errors, try yum install python-setuptools

Generate SSH public/private key (If you don't have one)

   [@Local]
   1. To generate a public/private key, run
       ssh-keygen -t rsa
   2. The newly generated public key will be at $Home/.ssh/ directory and named id_rsa.pub. Private key will be named id_rsa.
   3. Upload your public key to server's /tmp directory
       scp ~/.ssh/id_rsa.pub username@SERVER_IP_ADDRESS:/tmp/YourPublicKey.pub

Configure Gitosis

   [@Server]
   1. Create a user to own the repositories, usually called git
       adduser git
   2. Create the repository and add YourPublicKey into authorized keys
       sudo -H -u git gitosis-init < /tmp/YourPublicKey.pub

Configure the permissions

   [@Local]
   1. To configure who can access to your repositories, clone gitosis-admin first and then edit gitosis.conf in gitosis-admin directory
       git clone git@SERVER_IP_ADDRESS:gitosis-admin.git
       cd gitosis-admin
       vi gitosis.conf
   2. Add a repository, TestProject, and make user Howard has full access to it.
       [New group]
       members = Howard
       writable = TestProject
   3. Get Howard's public key, Howard.pub, from Howard and put it into keydir of gitosis-admin
       cp Howard.pub keydir
   4. Once done, commit it and push to remote server.
       git commit -m "Give Howard full access to TestProject"
       git push

Create the repository TestProject

   [@Local]
   1. User Howard creates the TestProject, initialize it and push it to remote server
       mkdir TestProject
       cd TestProject
       git init
       git remote add originServer git@SERVER_IP_ADDRESS:TestProject.git
       // create files, git add . and commit
       git add .
       git commit -m "Initial commit"
       git push originServer master:refs/heads/master
   2. Now TestProject is created and available on server
   3. To allow user Sibo accessing TestProject, edit gitosis.conf of gitosis-admin and add Sibo to members of [New group] and put Sibo's public key into keydir of gitosis-admin
   4. Commit it and push it remote server and now Sibo will be able to clone TestProject from remote server
       [@Sibo Local]
       git clone git@SERVER_IP_ADDRESS:TestProject.git


Wednesday, November 14, 2012

Git commands

git add . : stages new and modified, without deleted
git add -u : stages modified and deleted, without new
git add -A : stages All

Wednesday, October 31, 2012

application executable is missing a required architecture


The minimum Target supported for XCode 4.5 is iOS 4.3 which means iPhone 3G is no longer supported since the highest iOS version for iPhone 3G is iOS 3.1.3)
So to fix this problem:
. Change iOS Development Target to "iOS 4.3"
. Remove armv6 from the "Architectures" and "Valid Architectures"

Tuesday, September 18, 2012

Compile x264 for Mac OS X (32bits)


./configure --enable-pic --enable-shared --disable-asm --host=i686-apple-darwin11.1.0 --extra-cflags="-arch i386" --extra-ldflags="-arch i386"

Friday, August 17, 2012

Map Box.net storage as a local folder through WebDAV

Steps to map Box.net storage as a local folder
1. Go to Computer
2. Click Map network drive
3. Click "Connect to a web site that you can use to store your documents and pictures"
4. Check "Reconnect at logon"
5. Enter "https://www.box.net/dav" when specifying the location of your website
6. Enter the credentials of your Box.net account
7. That's it.

To unmap the network drive, simply delete it.

Thursday, May 10, 2012

Change the location of iPhone/iPad backup in Windows 7

Source : http://aaltonen.us/2011/01/03/change-the-location-of-your-iphone-backup/


Steps:

  • Close iTunes
  • Move the existing C:\Users\(username)\AppData\Roaming\Apple Computer\MobileSync\Backup\ folder to the destination drive (for example, D:\)
  • Open a command prompt and create an NTFS junction point using a command similar to the one below, replacing D:\Backup with the path to your destination:
  • mklink /J "C:\Users\(username)\AppData\Roaming\Apple Computer\MobileSync\Backup" "D:\Backup"

Friday, March 16, 2012

How to check target architecture of a static library

For Mac OS:
   Use lipo.
   Ex. lipo -info staticLibrary.a

For Linux OS:
   Use file
   Ex. file staticLibrary.c

Friday, March 2, 2012

command for listing all the shared libraries used by an ARM-base executable

. For ARM-base executable, use
arm-none-linux-gnueabi-objdump -x executable_name | grep NEEDED

. For Intel-base executable, use
ldd executable_name

Thursday, March 1, 2012

Install Gitosis on CentOS how-to

Source1: http://scie.nti.st/2007/11/14/hosting-git-repositories-the-easy-and-secure-way
Source2: http://wiki.centos.org/HowTos/Network/SecuringSSH

[On server side, login as root]
1. Install gitosis
   cd ~/src
   git clone git://eagain.net/gitosis.git
   cd gitosis
   yum install python-setuptools
   python setup.py install
2. Create a user who will own the repositories you want to manage. Usually called "git".
   useradd git
3. Copy your public key to the server (howard's $HOME/.ssh/ on server)
   [On local machine]
   scp ~/.ssh/id_rsa.pub howard@10.0.0.10:~/.ssh/
      [Create one if you don't have it, on local machine]
      ssh-keygen -t rsa
      . Both public and private key will be stored in ~/.ssh/, name id_rsa.pub and id_rsa
      . Change the permission as following:
         . chmod 700 ~/.ssh
         . chmod 600 ~/.ssh/id_rsa
4. Install public key to the authorized_keys list in order to log on with public/private key instead of password prompt
   [On local machine]
   ssh howard@10.0.0.10 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
   ssh howard@10.0.0.10 chmod 700 ~/.ssh
   ssh howard@10.0.0.10 chmod 600 ~/.ssh/authorized_keys
   . Now you will be log on to 10.0.0.10 without entering password
5. Init gitosis-admin repository
   . Copy howard's public key to tmp folder in case user "git"cannot access it in howard's $HOME/.ssh
   cp /home/howard/.ssh/id_rsa.pub /tmp
   . Now to init gitosis-admin repository
   sudo -H -u git gitosis-init < /tmp/id_rsa.pub
   chmod 755 /home/git/repositories/gitosis-admin.git/hooks/post-update
6. Change user "git"'s home directory to /home/git/repositories
7. Clone the gitosis-admin repository into your local machine
   [On local machine]
   . Find a place where you would like to create gitosis-admin repository
   git clone ssh://git@10.0.0.10:~/gitosis-admin.git
8. Now you have gitosis.conf file and keydir directory under gitosis-admin repository
   . With these 2 files, you can define access right for every user and all is done locally and push the changes to the server.

Creating new repositories [On local machine]
1. To allow howard creates/writes "ViewerRepo" repository, edit gitosis.conf and add following
   [group team1]
   members = howard
   writable = ViewerRepo
2. Save it and push to remote server
   git commit -a -m "Allow howard write access to ViewerRepo"
   git push
3. Now howard has access to create/write the ViewerRepo. But it's not created yet. let's create it now.
   mkdir ViewerRepo
   cd ViewerRepo
   git init
   git remote add origin git@10.0.0.10:~/ViewerRepo
   // git add and commit files
   git push origin master:refs/heads/master
4. Adding user aaron
   . Simply copy aaron' public keys to gitosis-admin/keydir/, when done, add to git
   git add keydir/aaron.pub
   . Edit gitosis.conf accordingly
   Change "members = howard" to "members = howard aaron"
   . Update the settings to remote server
   git commit -a -m "Granted aaron commit rights to ViewerRepo"
   git push
5. Now aaron can clone the ViewerRepo and working on it
   git clone git@10.0.0.10:~/ViewerRepo

Wednesday, February 29, 2012

Install Git on CentOS

Source1: http://www.davegardner.me.uk/blog/2010/01/29/setting-up-git-on-centos-5-server/
Source2: http://stackoverflow.com/questions/8059743/trying-to-install-git-on-centos-5-and-a-little-lost

Installing Git on CentOS 5 is easy if you make use of the EPEL (Extra Packages for Enterprise Linux) repository.
1. To setup EPEL all you need to do is create a file /etc/yum.repos.d/epel.repo and then paste in the following:
[epel]
name=Extra Packages for Enterprise Linux 5 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/5/$basearch
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL

[epel-debuginfo]
name=Extra Packages for Enterprise Linux 5 - $basearch - Debug
#baseurl=http://download.fedoraproject.org/pub/epel/5/$basearch/debug
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-debug-5&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
gpgcheck=1

[epel-source]
name=Extra Packages for Enterprise Linux 5 - $basearch - Source
#baseurl=http://download.fedoraproject.org/pub/epel/5/SRPMS
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-source-5&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
gpgcheck=1
2. Install GPG Keys


Go into rpm-gpg directory
cd /etc/pki/rpm-gpg/
Download GPG KEYS from https://fedoraproject.org/keys
wget https://fedoraproject.org/static/217521F6.txt
Rename to "217521F6.txt" to "RPM-GPG-KEY-EPEL"
cp 217521F6.txt RPM-GPG-KEY-EPEL
Remove "217521F6.txt" because we don't need in that file anymore
rm 217521F6.txt
If you want you can remove prefix lines from the file by vim and :wq (:Write and Quit)
vim RPM-GPG-KEY-EPEL
3. Installing git git-daemon
yum install git git-daemon

Friday, February 24, 2012

[iOS Developer] How to use TestFlight to distribute your beta app

1. Create an account on TestFlight (http://testflightapp.com) and with "Developer" option checked.
2. Log in to the TestFlight web site and "Add a team" for your app.
3. Add teammates, either testers or developers. (PS. Recruiting testers from public is also available)
4. Ask your teammates to register their iOS devices following the instructions in the Email. (Do it on their iOS devices)
5. Once they accepted to being the teammates and registered their devices, you will be able to see their devices information such as device model, iOS version, and UDID.
6. Add their devices/UDIDs to your Provisioning Portal -> Devices.
7. Modify the Ad-Hoc provisioning profile to include the newly added devices and install the updated provisioning profile to your XCode.
8. Build your app in Ad-Hoc mode and locate the YourAppName.ipa.
   . For XCode 4: http://support.testflightapp.com/kb/tutorials/how-to-create-an-ipa-xcode-4
   . For XCode 3: http://support.testflightapp.com/kb/tutorials/how-to-create-an-ipa-xcode-3
9. Log in to TestFlight web site, click "Upload Build" and follow the instructions to finish uploading the app.
10. Your teammates will be able to install the app you just uploaded to their devices with TestFlight app on their iOS devices.

Wednesday, February 22, 2012

XCode breakpoint not working

Sometimes the XCode breakpoint becomes not working somehow. To solve this problem, simply restart the iOS device.

Tuesday, February 21, 2012

Update NVIDIA Graphic card driver for SONY laptop

Steps:
1. Get the latest driver from NVIDIA and unpack it.
2. Look up the hardware id of the Graphic card in Device Manager -> Display adapters -> NVIDIA GeForce 8400M GS -> Properties -> Details tab. Select "Hardware Ids" from the Property dropdown checkbox and then it will be listed. There should be something like PCI\VEN_10DE&DEV_0427&SUBSYS_9008104D. Here 0427 after DEV_ is the hardware id.
3. Go the driver folder unpacked earlier and locate nvam.inf (in driver folder) and open it with any text editor. Find the entries start with %NVIDIA_DEV.0427, and replace the value after SUBSYS_
Ex.
From %NVIDIA_DEV.0427.01% = Section001, PCI\VEN_10DE&DEV_0427&SUBSYS_17C21043
To %NVIDIA_DEV.0427.01% = Section001, PCI\VEN_10DE&DEV_0427&SUBSYS_9008104D
5. Save the nvam.inf
6. Run the setup.exe to install the latest driver

Friday, February 17, 2012

Mac-to-Mac: Remote Desktop (Remote Control)

1. Enable the remote management or screen sharing function on the target Mac which is to be controlled.
. System Preference -> Sharing -> Remote Management
. System Preference -> Sharing -> Screen Sharing

2-A. Apple remote desktop (remote management, not free)
. Start "Remote Desktop"(Install the apple remote desktop admin if it's not installed yet)
. Locate the target Mac and connect to it

2-B. Screen Sharing (free)
. Finder -> Go -> Connect to server
   type in vnc://ip_address_of_the_target_mac

Monday, February 13, 2012

Excel Date to Epoch time conversion formula

Date to Epoch time: (A1: Date cell)
=(A1-25569)*86400

Epoch time to Date: (A1: Epoch time cell)
=(A1/86400)+25569
PS. Need to format the cell to date

Wednesday, January 4, 2012

How to convert a DLL to LIB for Windows

Source: http://support.microsoft.com/?scid=kb%3Ben-us%3B131313&x=1&y=15

1. Start Visual Studio Tools command promopt from Start -> Program Files -> Microsoft Visual Studio 2005 -> Visual Studio Tools -> Visual Studio 2005 Command Prompt
2. Create the .def file for the target DLL if you don't have it on hand by entering following command
  DUMPBIN /EXPORTS PATH_TO_DLL_IN_QUESTION
  (Ex. dumpbin /exports D:\Ts2Sqlite\sqlite3.dll)
3. To create the import library (.LIB), run following command
  LIB /def:PATH_TO_DEF_OF_DLL /out:OUTPUT_PATH /machine:x86
  (Ex. lib /def:D:\Ts2Sqlite\sqlite3.def /out:D:\Ts2Sqlite\sqlite3.lib /machine:x86)
4. Now you can use this LIB file along with the DLL like using a real LIB file


   

Check clients which connect to Mac OS X Wi-Fi Internet Sharing

arp -i bridge100 -a bridge100 may be different on your Mac OSX