Archive for October, 2009

Virtual Box – Access host [Mac OS X] physical ethernet port from guest OS [Windows 7].

If you are in a hurry here is the quick summary :

To access the host machine’s ethernet adapter/port from your guest os, you need to create a bridged adapter on the virtual machine. The bridged adapter maps a virtual interface on the guest os to the physical ethernet adapter/port on the host machine.

Got some time ? Then read on…

I got  a new TRENDnet  Gaming Adapter TEW-647GA (Wireless Bridge) to connect my 20 GB PS3 to the Internet and also to explore the Internet@TV features of my Samsung LED TV.

TRENDnet TEW-647GA

TRENDnet TEW-647GA

The wireless bridge comes with a setup utility on a CD. If you are on a Windows machine then setup is a breeze. But if you are on a Macbook/Macbook Pro/Mac you may not be so lucky. Fortunately, for me I had  Virtual Box with Windows 7 set up as a guest instance.

How to Access the host ethernet port from the guest OS ?

Connect the wireless bridge to the built-in ethernet port on the host and power up it up.

From your guest OS, mount the host CD drive  and run the setup.exe utility.

By default virtual box sets up the guest os to use NAT networking, running the setup utility with the default (NAT) virtual machine networking configuration will fail. The wireless bridge will not be recognized by the setup utility.

Reconfigure the guest virtual machine with a bridged adapter and map this new adapter to the physical built-in ethernet network adapter.

Run setup utility again from the guest os.

Setup.exe should now discover the wireless bridge connected to the ethernet port on the host machine.

Follow the instructions on the TRENDnet  installation guide. On my Window 7 guest OS I had to ignore the error messages that said configuration had failed. The configuration had in fact completed successfully and I was able to connect to my Netgear WGR614 router and the internet.

Disconnect the wireless bridge from the ethernet port and connect it to the gaming console. The gaming console should automatically pick up an IP via DHCP and your gaming console should be connected to the net.

Have fun!

Additional Notes :

You can configure an extra adapter (adapter 2) on your virtual machine if adapter 1 is configured with NAT networking already. TRENDnet Setup utility will still recognize the wireless bridge connected to the ethernet port.

How to Post to a Facebook Fan Page on Behalf of the Page.

Quick Summary

Use the Facebook.showPermissionDialog FBJS api call to authorize the Page for which you are an admin. Set the enableProfileSelector to true and include the page id in the profileSelectorIds. Once  the app user has authorized and given the extended permissions, You can use the Stream.publish api call with the page id as the target id and publish on behalf of the page.

The Details – Posting to the Facebook Fan Page on behalf of the page.

Facebook allows you to create pages aka fan pages for your website, business, product, or almost just about anything. Page admins can customize their pages by adding facebook applications from the app directory to their pages. Using Facebook applications for fan pages allows you to integrate into the social connections of your fans better.

Applications with extended permissions can publish to a user’s wall, news feed stream or profile. In addition, applications can now publish to a Page wall.

Publishing to a Page as a user is fairly simple with Stream.publish facebook api, the Facebook developer api covers this well. You can prompt the user for  ’publish_stream’ extended permissions using the  fb:prompt-permission FBML tag, preferably during an initial set up workflow.

Once the user has authorized your app and given the extended permission, You just have to set the target id to the page id in your Stream.publish api call.  See the sample php api call below,

$facebook->api_client->stream_publish($message, $attachment,$action_links, $target_id);

Publishing on behalf of  a page is trickier.  Page admins have to authorize the app to publish on behalf of a page. You can do this by using

the Facebook.showPermissionDialog FBJS api call.

Facebook.showPermissionDialog('publish_stream, read_stream', ondone, showProfileSelector, [1234,2345]);

Just replace the profileSelectorIds ( [1234, 2345]) and include the page id in the FBJS call above. This should bring up a permission dialog and show

a “profile  selector” including the page for which you are an admin.

You should now be able to use the Stream.publish api call with the page id as the target id and publish on behalf of the page.