Skip navigation

Hi,

Long time I don’t make any progress with my blog. Today had to connect to the Wifi while having my Guest OS (Windows) connected to the USB Dongle / Wireless data card. No big deal in fact. The trick was to unmount the drivers on Mac OS X, hence make it available to the VirtualBox for mounting it.

If you don’t know how to do it… here are the steps.

1. On your Mac OS X type the following using the Terminal
# kextstat
This command shows you the loaded kernel drivers

2. Connect the USB Dongle (my case Huawei’s dongle). kextstat again will show you the new drivers loaded by Mac OS X.
3. Now all you need to do is to unload the drivers.
# sudo kextunload -b com.huawei.driver.HuaweiDataCardDriver
# sudo kextunload -b com.huawei.driver.HuaweiDataCardECMControl
[…]

4. Once you’re done with it. Go to your virtualbox, guest OS running, click on the USB icon at the bottom of the window. Select the Huawei’s device on the list.
5. Now you can use the dongle on your Windows Guest OS

Have fun.

Today had a problem to solve, get my Ubuntu PC working with remote Desktop and my Mac connected to it. It is always funny to see how Apple tries to make money with the open source software available out there. Apple is offering a Remote Desktop client as part of their product from their site but few know that you can get similar if not the same for free. At the end of the day what they are offering is simple a presentation layer for a open source software (the same code working underneath but with a beautiful GUI).

Anyway, Mac OS comes with a VNC client available … open your Terminal and type:

/System/Library/CoreServices/Screen\ Sharing.app/Contents/MacOS/Screen\ Sharing

Point the host to your VNC server IP address (Ubuntu IP address). Password if any.

PS: Make sure you have the Screen Sharing enabled before you use the client.

By the way, don’t forget to configure your VNC server on the Ubuntu computer.

Have fun

It has been annoying to figure out that suddenly my iWork 09 is no longer working. I had to print a document today, surprisingly found out that iWork was crashing during its initialization.

I have been reading about the problem on few forum threads from Apple’s website. As you may expect from Apple, no engineer / expert detailed the problem and explained why the application was crashing with SIGBUS (invalid access to an unauthorized memory segment). Well after to do my research, figure out that many were describing custom Font related problems on their apple computers. Just to start with… I had no custom font installed (all fonts installed by default)… I also read about the Disk Utility > Repair Disk Permissions feature. I decided to give it a try and bingo it’s now working again.

So here is the steps that I did, so helpfully can work for you too:

1. Open Disk Utility and run the Repair Disk Permissions (First Aid tab).
2. Delete files from /Library/Preferences/com.apple.iWork.*
3. Reboot your system using Safe Boot (after the reboot, hit SHIFT until you see the Apple icon). Alternatively you can type on your Terminal: sudo nvram boot-args=”-x”; reboot
4. After logging… I opened the iPages. You will notice that no text will appear when you’re typing. My guess is that this happens because of Safe Boot that disables Quartz Extreme (3d accelerator).
5. Reboot again the Mac OS X
6. Log in.
7. Voilá . It is working again!

Today had to work with URL escape function on my application (C written application)…
I tried to look for something simple on the internet, as usual nothing was simple enough so could re-use / easily adapt.

So decided to write something myself… Below is the result for what I could get.

/*
 * compilando: gcc -Wall -o urlescape urlescape.c
 */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>

#define ISXDIGIT(c) ( \
	(c >= 48 && c <= 57) || \
	((c & ~0x20) >= 65 && (c & ~0x20) <= 70) \
)

typedef struct {
	char *data;
	unsigned int len;
	unsigned int size;
} str_t;

void
url_escape(str_t *str) {
	char *p, *ptr;
	char hexstr[3];
	unsigned int i=0;
	unsigned long l = 0;

	p = str->data;
	for(i=0; i < str->len; i++) {
		if((p - str->data) >= str->len)
			break;
		if(*p == '%' &&
			((p - str->data)+2) < str->len &&
			ISXDIGIT(*(p+1)) &&
			ISXDIGIT(*(p+2))
		) {
			p++;
			hexstr[0] = *p++;
			hexstr[1] = *p++;
			hexstr[2] = 0;
			l = strtoul(hexstr, &ptr, 16);
			str->data[i] = (char)(l & 0x7f);
			continue;
		}
		if(*p == '+') {
			*p = ' ';
		}
		str->data[i] = *p++;
	}
	str->data[i] = 0;
	str->len = i;
}

void
usage()
{
	fprintf(stderr, "usage: urlescape <string>\n");
	exit(1);
}

int 
main(int argc, char **argv)
{
	str_t str = { NULL, 0 };
	str_t *s = &str;

	if(argc < 2)
		usage();

	s->data = strdup(argv[1]);
	s->len = strlen(argv[1]);
	s->size = s->len;
	url_escape(s);
	printf("escaped url: %s\n", s->data);
	return 0;
}

This will be a quick post… Working with Ubuntu Linux in a desktop was almost impossible these days. I got stuck with my screen freezing after login. What a mess situation!

After doing my internet research, found the following URL:

https://wiki.ubuntu.com/X/Troubleshooting/Freeze

Quick solution: Disable the Compiz…
# chmod a-x /usr/bin/compiz

Today I decided to customize the Eclipse’s configuration so having the auto complete feature to correct fill in the @author Java annotation.  After looking into few articles and email forums on the internet, figure out that none refers to the Mac OS X Eclipse configuration. The configuration is simple although requires you to make the configuration using VI and Console.

1. Open the console
2. cd /Application/eclipse-<release>/Eclipse.app/Contents/MacOS
3. vi eclipse.ini
4. include the following line at the end of the file: -Duser.name=<Your Name>

Please notice that <Your Name> should be replaced by your name (Name and Surname space separated is acceptable; no quotes are required)

This will be a quick post. Working with a stress test tool, I realized that most of the tests were failing due to the “too many files open” error from the Mac OS X. Immediately figure out that Mac OS X comes with the 256 as the default limit for the number of the files open by a single process. This would be ok for most of the users but what about developers which usually works with a test environment on their own machine?

Launchd is the daemon responsible for managing process. It also controls some of the processes limit information (soft and hard limits for open files, max number of child processes, so on…). The solution is to make use of the launchctl tool from the command line and create the launchd.conf file for the persistent change. Open your Terminal and type the following commands:

sudo echo “limit maxfiles 1000000 1000000” > /etc/launchd.conf

launchctl limit maxfiles 1000000 1000000

Note for Programmers:

Programs utilizing I/O multiplex or non-blocking I/O on Mac OS X are by default restricted to 1024 file descriptors per process. In order to overcome this limitation you can either re-define FD_SETSIZE macro (before you include <sys/types.h> or to limit the maxfiles to 1024. This will make the warning messages disappear during the compilation time.

Recently working under daylight savings I realized that my Windows XP Guest OS was incorrectly displaying the date and time. Windows XP was working with one hour less than the hour set on my Host OS. Although this seems to be a small problem, it was giving me headaches. I am using Windows XP to perform some of my work. MS Outlook to read my emails (don’t ask, company’s policies; exchange server + corporate VPN). So you may imagine how many conference calls I lost or joined later due to this problem.

Anyway let’s go to what matters most, the fix. After trying all the possible configurations over the Windows XP, realized that such configuration is taken directly from the Virtual BIOS; set by the VirtualBox itself. So despite all the configuration efforts, Virtualbox Guest Additions (probably) was updating the time according to the one defined on my Host OS. But instead of setting to the same value, the value set by the VirtualBox was one hour less the actual hour. Side note: I don’t know if this problem came with the update to the last Virtualbox release or this was due to the daylight savings. In either case the problem was happening and I had to fix.

So looking for the answer, how to change the Virtual BIOS to the correct value, I found the command / tool:

VBoxManage modifyvm Windows –biossystemtimeoffset <msec offset>

This command allows you to modify the Virtual Box BIOS system time using the millisecond offset. In other words, you can add or subtract the actual time and date value by an hour, second or millisecond.

So considering my situation, I issued the following command:

VBoxManage modifyvm Windows –biossystemtimeoffset 3600000

Problem solved! Now both Guest and Host OS are displaying the same time.

Please notice that once the daylight savings is finished, you may need to reset this configuration to the default. In order to do so, you may use the following command:

VBoxManage modifyvm Windows –biossystemtimeoffset 0

Couple of weeks ago brought to my attention the fact that could not visualize correctly the Latin1 characters like ç, é, ã, etc… from the web pages created with the Eclipse. At the time I was wondering if I had missing something from the Java application nd so tried to fix over the programming side. Turns out that the problem is related to the Eclipse support for what they call “Text file encoding”, which by default comes with the OS default charset encoding option.

If you’re facing problems with your application like what I have described, I think that it’s worth to double check your Eclipse configuration once again. Here is the path so you can go straight to the point:

1. Open Eclipse’s Preferences (in the Mac OS just hit CMD + ,)
2. Go to General > Workspace and look for the “Text file encoding” dialog box.
3. Select “Other” and then pick the ISO-8859-1 option.

Are you looking for Virtualization solution? From many years I am hearing friends talking about virtualization with Virtualbox, VMware, Xen and others. Couple of friends although recommended me Parallels for Mac OS X. Which supposedly had a nice interface and a smoothly intergration with the Mac OS X.

If you’re thinking to work with Parallels, here is my advice: don’t waste your time and money!

I tell you why… try to install Solaris 10 as Guest OS. Parallels claims that Solaris is supported. Bullshit! Install it and will see that none of the pre-defined network adapters (virtual network interface) are recognized by Solaris. I tried to wast time and get things working properly with Parallels, opening a support ticket and ask for help. As you may imagine after 2-3 days they escalated the problem to the higher support level and in the 6th day, they replied with the standard answer: please install the latest software release and apply the Linux Tools procedures described here (link to the page). What?!? I am asking Solaris support for god sake not Linux! After that I completely gave up!

I can build a list of bugs from Parallels. In either case if you’re still planning to install it, you have to be prepared. Get your soul prepared to deal with this DEVIL!

Here are some of the major problems that I faced and the main reason for writing this post:

If you apply the Parallels software update, the Parallels Tools from your Windows XP (Guest OS) will be invalidated. The worst part is the fact that Parallels tries to update the Tools to the latest release (great isn’t?). However once the installation is about to be completed then the installation process hangs and never finishes! For completeness, when you click on cancel (the only action that you can take btw), the installation performed is entirely rolledback.

Another annoying problem is the Parallels needless machine resource consumption. Sometimes the Parallels process is consuming almost 80% of my computer resources. I can tell you, this is not related to some heavy application that I am running in the Guest OS (which by the way is the Mac OS Snow Leopard). Actually both my Guest OS and my Host OS are doing nothing! So another bug to the list! This one is really annoying… when this happens I have to shutdown the Guest OS and start it again.

What a shit application, don’t you agree?

There are more but I think that you got the point…

Here are some great options and certainly much better then Parallels:

SUN Virtualbox
VMware (VMware Fusion)
XEN

I am currently testing the SUN Virtualbox. So far so great! I will reserve sometime to mention about it on my next posts… stay tuned!

Cheers!