Wednesday, September 21, 2011

Shared Folder settings between Windows7 and uBuntu guest OS in VMWare

PS: Please make sure that your VMTools is installed correctly on the uBuntu Guest.
http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1022525

Virtual Machine Settings
  • Folder sharing = Always Enabled.
  • Make sure you have at least one Folder shared between the host and guest.
    • For example: my-D-drive
On the uBuntu Guest
  • check /mnt/hgfs that you can access your shared folder
    •  If you cannot see the folder, then skip it. Next step will create the folder automatically.
  • update your fstab using the details below:
    • Open terminal and type:
      • gksu gedit /etc/fstab
    • Add below to the end of the file:
      • .host:/{shared-folder} /{path-to-mount-on} vmhgfs defaults,ttl=5,uid=1000,gid=1000 0 0
      • Change {shared-folder} to the shared folder of Virtual Machine Settings (my-D-drive).
      • Change {path-to-mount-on} to the folder inside uBuntu (/mnt/hgfs/my-D-drive).
  • Restart your vm.
    • You may need to restart few times or get error message saying unable to mount just skip the error and restart.
Reference: http://askubuntu.com/questions/29284/how-do-i-mount-shared-folders-win7-host-in-ubuntu-guest-using-vmwaretools-v6

    Tuesday, September 20, 2011

    Connect localhost from VMWare Fusion using MAMP

    I’m in the process of setting up a development environment on my mac. I’ve set up IE8 testing by converting Microsoft’s VPC images to a VMware compatible image. So the next thing I need to do is view my local webserver from VMware. Typing http://localhost doesn’t work because the virtual machine is an entity in itself so localhost is local to the virtual machine.
    Having done a little of this in the past I knew the hosts file in folder c:\windows\system32\drivers\etc would need an entry, mapping my Mac’s IP address to a domain name. Sean Sperte reveals a secret VMware IP address that is particularly handy when you use a laptop because a laptop’s IP address is not likely to remain static. I’ll quote Sean here:
    Type ifconfig vmnet1 into a Terminal window. You should get a return like this:

    vmnet1: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500 inet 192.168.115.1 netmask 0xffffff00 broadcast 192.168.115.255 ether 00:50:56:c0:00:01

    The “inet” number is your “secret” IP (in my case, 192.168.115.1).
    Now that we have that number, we can edit the hosts file on the VM. We find it in: C:/WINDOWS/system32/drivers/etc. Just open the host file with Notepad, and add each virtual host (domain) on it’s own line at the end of the document, like so:

    192.168.115.1 macserver

    … and save. Afterwards refresh the VM’s DNS cache by typing ipconfig /flushdns in a command line window.
    This worked perfectly for me.
    Reference: http://www.rowlando.com/blog/2009/01/11/reaching-localhost-from-vmware-virtual-machines-on-a-mac/

    Using AssetManager on native language JNI, C++

    #include <sstream>
    #include <assert.h>
    // include in android platform-9 or newer
    #include <android/asset_manager.h>
    #include <android/asset_manager_jni.h>
    ...

    JNIEXPORT void JNICALL Java_com_yourpackage_yourfunctionname(JNIEnv *env, jclass clazz, jobject assetManager)
    {
        // get assetmanager native
        AAssetManager* mgr = AAssetManager_fromJava(env, assetManager);
        assert(mgr != NULL);

        // load file inside assets, "assets/a/b.txt"
        AAsset* asset = AAssetManager_open(mgr, "a/b.txt", AASSET_MODE_UNKNOWN);
        assert(asset != NULL);

        // get buffer of file
        char* buff = (char*) AAsset_getBuffer(asset);
        assert(buff != NULL);

        // print out buffer per line
        const int MAX_BUF = 512;
        char strbuf [MAX_BUF];

        std::istringstream iss(buff);
        while ( iss.getline(strbuf, MAX_BUF) )
            LOGE("%s", strbuf);

        AAsset_close(asset);
    }

    [ROM] Samsung S7 Stock Firmware BRI (Taiwan台灣)

    Latest ROM: G930FXXU1DQEU Download: https://kfhost.net/tpl/firmwares.php?record=B7E6DE774E3811E7963AFA163EE8F90B Reference: http://...