Use hexadecimal in ‘bc’

‘bc’ is really cool application in Linux/Unix. it provides lots of convenient functions without launching GUI calculator.

One thing sometimes necessary is a conversion for the calculation. Mostly converting hexadecimal and decimal.

If you want to use hexadecimal for the input, you can use ‘ibase=16′ and below value will be all treated as 16base.

1
2
3
4
5
6
$ bc
ibase=16
EA8-E98
16
ea8-e98
0





One thing careful is don’t use lowercase for the hexadecimal characters. All needs to be upper case. If you want to put the results in hexadecimal as well, you can use ‘obase=16′.

1
2
3
4
5
6
7
$ bc
obase=16
ibase=16
EA8-E98
10
ea8-e98
0

You shouldn’t use obase=16 after ibase=16 which will treat 16 as hexadecimal value 16 (22 in decimal).

Xcode 4.3.2 organizer crash

After upgrading to Xcode 4.3.2, it becomes very hard to keep developing without crash. Most biggest challenge was configuring iPhone devices in Organizer window. It crashed all the time when I tried to open ‘Device’ tab. Sometimes, it just crashed when I plug my iPhone to the system.

It looks like it has a problem with “SecCertificateCopyValues()” function which is used to check certificate. I could find a link that solved this problem by removing untrusted certificate (http://stackoverflow.com/questions/9325804/xcode-4-3-organizer-crash).

In my case, even I removed all the certificate (even Apple’s certificates), it still failed to show the window.





As a final challenge, I just removed the file ~/Library/Keychains/login.keychain as it still has some certificate which doesn’t show up in ‘keychain’ application. You can check whether it still has some certificate by run the following command.

1
$ sudo security find-certificate

If you don’t mind losing some certificates (I think that is fine as System certificates are still there), you just need to remove login.keychain. If you are not sure about it, you just need to rename it to something else. ;)

Use static DHCP IP address in VMWare Fusion guests

MacBook Pro is really nice laptop for developing. With great power in this gadget, you also can create lots of virtual guests.

With this virtual guests, you can try various kinds of test. Sometimes, there’s a case you want to use fixed IP address (even though it’s a private IP) to communicate with other virtual guests on your system. In that case, you can put the fixed data by open the file with the following command.

1
sudo vi /Library/Preferences/VMware Fusion/vmnet8/dhcpd.conf

And put at the bottom of the file with something similar below:




1
2
3
4
5
####### VMNET DHCP Configuration. End of "DO NOT MODIFY SECTION" #######
host myhost {
	hardware ethernet 00:0C:29:F1:56:6A;
	fixed-address 172.16.95.160;
}

You can find ‘hardware ethernet’ (MAC address) with ifconfig command or equivalent commands in the OS.