Wednesday, August 15, 2012

Ubuntu 10.04 "Android Ant-based build system requires Ant 1.8.0 or later"

I got this crap when I was trying to compile the sample android app:

gideon@desktop-i7:~/workspace/MyFirstApp$ ant debug
Buildfile: build.xml
-set-mode-check:
-set-debug-files:
-check-env:
BUILD FAILED
/home/gideon/android-sdk-linux/tools/ant/build.xml:377: The Android Ant-based build system requires Ant 1.8.0 or later. Current version is 1.7.1
Total time: 0 seconds
The fix is easy, just install the ant1.8 package:

apt-get install ant1.8 
That'll do.

Friday, August 10, 2012

What is the device name for mount

When you insert your SD card or USB drive to a system, there will be some kernel message, but you may or may not see the message depends on what UI or tty you're at. You know you need to mount it, if not auto mounted, but you don't know what is the device name, you can try the following:

Before you insert your SD card or USB drive
# cat /proc/partitions
This will show you the existing partitions. Now insert your SD Card or USB drive, wait until the kernel message is done, or wait 5-10 secs to make sure your kernel complete recognizing your drive.
# cat /proc/partitions
You should see something new like sdb or mmcblk0p1. Check your /dev to see the device node is already exist. If not, uses the device major and minor name showed in /proc/partitions, create it using mknod command:
# mknod /dev/<device name> b <major> <minor>
Then you can create your mount point e.g. mkdir /mnt/sdcard or /mnt/usb_driver and mount your partiton
# mount /dev/<device name> /mnt/<mount point>
Then you should be able to read your drive.  If /proc/partitions fails to show up, I would suspect something is wrong with your SD card or USB drive, or something to do with the driver.

Friday, August 03, 2012

Wordpress export to Blogger bX-8bpovo error

Wordpress sucks.  I like them open source but their ads and archives list modules just pissed me off.  And I can't do nothing about it when I just use their services.  I expected that the transition from wordpress to blogger wouldn't smooth, and that's right.  When you export your blog from wordpress and try to import the xml in blogger, you'll find the following error:
Finished: Sorry, the import failed due to a server error. The error code is bX-8bpovo
The xml is obviously not compatible.  Luckily there is someone (probably from Blogger?) put up a tool to fix the xml file:

http://wordpress2blogger.appspot.com/

After the conversion, the xml file imported successfully, and this blog is alive again.

C pointers and array examples

Some pointers and array examples
int ia[6] = {0, 1, 2, 3, 4, 5}; /* 1 */
int *ip; /* 2 */

ip = ia; /* equivalent to ip = &ia[0]; */ /* 3 */
ip[3] = 32; /* equivalent to ia[3] = 32; */ /* 4 */
ip++; /* ip now points to ia[1] */ /* 5 */
printf("%d ", *ip); /* prints 1 to the screen */ /* 6 */
ip[3] = 52; /* equivalent to ia[4] = 52 */ /* 7 */

argv
+---+
| 0 | ---> "./junk"
+---+
| 1 | ---> "-b"
+---+
| 2 | ---> "gradient"
+---+
| 3 | ---> "yeehaw"
+---+
**argv or *argv[] are equal. Array is just a pointer, and a double pointer is just an array of pointers.

Ubuntu make xconfig qt error

When you do make xconfig (graphical kernel config), you may receive following error

gideon@gideon-desktop:~/linux$ make xconfig
CHECK qt
* Unable to find the QT4 tool qmake. Trying to use QT3
*
* Unable to find any QT installation. Please make sure that
* the QT4 or QT3 development package is correctly installed and
* either qmake can be found or install pkg-config or set
* the QTDIR environment variable to the correct location.

In Ubuntu, you just need to install the qt4-dev-tools package to fix it.

# aptitude install qt4-dev-tools