Tuesday, March 27, 2012

XCode - Remove Local Git Repository

If you create a XCode project with "create local Git repository" check, your project will be locally versioned.



But, it does not seem to have an easy way to remove it afterward. Why you want to do it? It may because

1. You want your project to recognize remote SVN/Git repository setting.
2. Double click on xcodeproject so that XCode organizer automatically recognize your current SVN/Git setting

Below may help you in removing local Git repository completely in your project.

1. Go to the root of your project folder. Usually, it is the folder that contains the .xcodeproject file
2. Remove the .git folder. It is hidden. You can use

rm -rf .git

3. Open your project. It should open XCode IDE.
4. Look at the top right corner of the XCode IDE. Open Organizer



5. At Organizer, navigate to Repository



6. Remove all existing/related repository for your project by clicking on the project and click on the - sign on bottom left of Organizer



7. Now, navigate to Projects
8. Remove all exiting/related project EXCEPT the project that is stated open
9. Then, Click on the delete for derived data and snapshot



10. Quit XCode completely.
11. Double click on your .xcodeproject to launch XCode. Now, XCode should recognize your remote SVN/Git setting at Organizer -> Repository

Thursday, March 22, 2012

Linux - cannot restore segment prot after reloc: Permission denied

I encounter this during my installation of Postgres to CentOS 5.8 - cannot restore segment prot after reloc: Permission denied

This error could happen on any package installation.

SELinux (Security Enchance Linux) provide access control security feature in Linux. See http://en.wikipedia.org/wiki/Security-Enhanced_Linux

Disabling it actually is bad. However, it provides a quick fix to my issues.

You can temporarily or permanent disable SELinux

Temporarily Disable

To disable

/usr/sbin/setenforce 0

To enable

/usr/sbin/setenforce 1

This is temporary SELinux turn off, thus, you do not need to reboot the system.


Permanent Disable

Edit /etc/selinux/config

vi /etc/selinux/config

You will see the following

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#       enforcing - SELinux security policy is enforced.
#       permissive - SELinux prints warnings instead of enforcing.
#       disabled - SELinux is fully disabled.
SELINUX=enforcing


Change enforcing to disable

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#       enforcing - SELinux security policy is enforced.
#       permissive - SELinux prints warnings instead of enforcing.
#       disabled - SELinux is fully disabled.
SELINUX=disabled


Then, reboot the system.

shutdown -r now



Sunday, March 11, 2012

Mac OS - Outlook search return no result

Outlook for Mac uses Spotlight for searching. However, my Outlook refuse to search when I try my keyword in the search box.

Here is the official response from MS http://support.microsoft.com/kb/2473212

But the problem is, I don't have any mail category in System Preference -> Spotlight -> Search Result

So, my solution is as follow

1. Go to System Preference -> Spotlight -> Privacy
2. Click on + to add a Privacy
3. At the open dialog, select Macintosh HD and click choose
4. Click ok if the system ask for confirmation on selection Macintosh HD for privacy
5. You should see Macintosh HD appear on the Privacy box
6. Close Spotlight
7. Reopen Spotlight
8. Go to Privacy, select Macintosh HD and click on -
9. Now, Spotlight should be re-indexing the machine and Outlook should be searchable after the re-indexing.

Saturday, March 3, 2012

MEncoder - Encoding with subtitle for PS3 playback

I have to admit that PS3 is very fussy on the playback format. Even encoding with H.264 and AAC in a MP4 container does not always work due to problem such as profile, encoding parameters, etc...

So, the best playback format for PS3 is xvid with mp3 in avi container.

Below is a sample command to encode a file to a xvid with mp3 in avi container with MEncoder


mencoder.exe "input.mp4" -o "output.avi" -oac mp3lame -ovc xvid -xvidencopts fixed_quant=4 -sub "input.srt"

-o --> define a output file

-oac --> output audio codec. mp3lame is the encoder name for mp3

-ovc --> output video codec. xvid is the encoder name for xvid

-xvidencopts --> xvid encoder options. You must define it. The simplest setting is to define fixed_quant level.

fixed_quant define the quality level for the output codec. It ranges from 1 to 31 with 1 is the best. Under my testing 4 is a good setting that provide high quality video with smaller file size. 1, 2 and 3 does not provide much quality improvement to 4 and they will provide you with a much bigger file.

-srt --> subtitle for your file

Thursday, March 1, 2012

VirtualBox - Reusing VDI Harddisk

There are a few techniques to reuse old VirtualBox setting in a new Windows/Mac/Linux machine.

1. Some posts says just copy the VirtualBox setting to a new machine. Adjust the UUID in the xml file so that the new VirtualBox. I never try it because it looks tedious and setting of UUID may not be trival. Also, what if there is a change of hardware such as change of machine?

2. In VirtualBox, they provide an option to Export an Appliance. Well, it does work for single standalone appliance. But, I have a shared vdi and 3 different OS VM using it. That causes an issue during my import because of my shared vdi.

3. My current way of doing. Copy the vdi and manually setup the VM environment. This way, although manual, but at least, the change in hardware and VM setting such as UUID is handled by VirtualBox

The following steps work for me when I reuse a Windows VirtualBox VDI harddisk file in Mac OS X VirtualBox

1. Download and install VirtualBox
2. Create a new VM by clicking the New button. I named it as CentOS 5.6 x86



3. Following the wizard until it asks for Virtual Harddisk Setup. At this point of time, by default, VirtualBox has created a VM folder for your settings. Check "/Users/your_username/VirtualBox VMs" for Mac OS and "C:\Users\your_username\VirtualBox VMs" for Windows 7. So, in this example, I will have a folder created as "/Users/your_username/VirtualBox VMs/CentOS 5.6 x86"



4. For cleanliness/admin purpose, I like to put the vdi file together with the VM folder. So, I copy my old vdi files into the newly created VM folder  "/Users/your_username/VirtualBox VMs/CentOS 5.6 x86". This is just my habit. Your vdi can be at any location.

5. After copying, go back to the wizard. Now, click on "Use existing hard disk" and use the browse folder button to locate your old vdi file. If the vdi is added successfully, it will appear at the drop down menu as normal. Click continue and finish the wizard setup



6. Although each OS has the ability to detect a change in hardware, it is better for you to maintain the same harddisk setup (IDE/SATA) as per your old VM setting. Select your new VM, go to Setting -> Storage and set up as per your old VM Storage setting.



7. Also, remember to setup your Network if necessary.

8. Now, select your new VM and click start to run it. Depend on your hardware changes, your OS will detect and ask your for hardware information if needed

That all. Although it requires manual setup of the VM, this way will create the VM xml, UUID and detect hardware changes safely.

Hadoop - How to setup a Hadoop Cluster

Below is a step-by-step guide which I had used to setup a Hadoop Cluster Scenario 3 VMs involved: 1) NameNode, ResourceManager - Host...