Tuesday, October 2, 2012

HowTo: Windows XP Mode and Windows Virtual PC in Windows 7

Windows 7 has feature for Windows XP Mode and Windows Virtual PC. More info on this feature is available at Microsoft website.

Installation of Virtual PC
The user need to download and install by following the instruction given.
Figure 1: Microsoft Website
Once installed, you can access the virtual PC from Start menu.
Figure 2: Start Menu of host PC

Features of Windows Virtual PC as mentioned below.
Figure 3: Microsoft's website

Create New Virtual PC
1. Start > All Programs > Windows Virtual PC.
Figure 4: Start Menu
Figure 5: Virtual Machines folder
2. Depending on the user's setting, virtual PC files (.vhd, .vmc, .vmcx) may be placed in one folder or split to different folders. As in this tutorial, the files were splitted to 2 main folders.
Figure 6: Virtual PC Location
3. Click on [Create virtual machine] wizard and follow the instruction given.
Figure 7: Create virtual machine
Figure 8: Specify Name and Location of the new virtual PC
Figure 9: Specify memory and network




Note: The memory is preferable to have 512 RAM or the multiple of 512 RAM.
Figure 10: Create virtual hard disk
Figure 11: New created virtual PC
4. Highlight the .vmc file (Virtual Machine Settings file) then click on [Settings] menu.
Figure 12: Setting
Figure 13: Setting - ISO file
 Figure 13 above is necessary since the newly created virtual PC is do not have any OS. In my example, I'm using ISO for Fedora. You may install your chosen OS either from ISO file or the physical drive. Click [OK] once done.

5. Double-click on .vmcx files to start virtual PC.

Note: Microsoft Help files for Virtual PC is very complete and resourceful. You can access the help file from the Windows Virtual PC settings for more info.




Tuesday, March 20, 2012

How to setup Yii (PHP Framework) on Wamp in Windows 7

1. Install Wamp Server.
2. Download the latest Yii framework.
3. Unzipped Yii framework. 
4. Copy the contents to C:\Wamp\www
5. Update Environment Variables by right-click My Computer > Properties > Advanced system settings > Advanced > [Environment Variables...]
- At the “System Variables”, select Path > [Edit].
- Add in new values by separating each path by using semicolon ';'. (DO NOT DELETE the existing path)        - Then click [OK].
Examples:
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\WIDCOMM\Bluetooth Software\;C:\Program Files\WIDCOMM\Bluetooth Software\syswow64;C:\Program Files\TortoiseSVN\bin;C:\WAMP\bin\php\php5.3.10;C:\wamp\www\framework

6. Restart your PC to register the added variables.
7. Go to Command Prompt, by typing 'cmd' at Search field (Start > Search)
8. At command prompt, create Yii skeleton for your new website, called “MyWebsite” at webroot.


Below is the examples of the Command Prompts
____________________________________
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.


C:\Users\yumar>cd..


C:\Users>cd..


C:\>cd wamp


C:\wamp>cd www


C:\wamp\www>cd framework


Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.


C:\Users\yumar>CD..


C:\Users>CD..


C:\>CD WAMP


C:\wamp>CD WWW


C:\wamp\www>YIIC WEBAPP MYWebsiteTest
Create a Web application under 'C:\wamp\www\MYWebsiteTest'? [yes|no] yes
mkdir C:/wamp/www/MYWebsiteTest
mkdir C:/wamp/www/MYWebsiteTest/assets
mkdir C:/wamp/www/MYWebsiteTest/css
generate css/bg.gif
generate css/form.css
generate css/ie.css
generate css/main.css
generate css/print.css
generate css/screen.css
mkdir C:/wamp/www/MYWebsiteTest/images
generate index-test.php
generate index.php
mkdir C:/wamp/www/MYWebsiteTest/protected
generate protected/.htaccess
mkdir C:/wamp/www/MYWebsiteTest/protected/commands
mkdir C:/wamp/www/MYWebsiteTest/protected/commands/shell
mkdir C:/wamp/www/MYWebsiteTest/protected/components
generate protected/components/Controller.php
generate protected/components/UserIdentity.php
mkdir C:/wamp/www/MYWebsiteTest/protected/config
generate protected/config/console.php
generate protected/config/main.php
generate protected/config/test.php
mkdir C:/wamp/www/MYWebsiteTest/protected/controllers
generate protected/controllers/SiteController.php
mkdir C:/wamp/www/MYWebsiteTest/protected/data
generate protected/data/schema.mysql.sql
generate protected/data/schema.sqlite.sql
generate protected/data/testdrive.db
mkdir C:/wamp/www/MYWebsiteTest/protected/extensions
mkdir C:/wamp/www/MYWebsiteTest/protected/messages
mkdir C:/wamp/www/MYWebsiteTest/protected/migrations
mkdir C:/wamp/www/MYWebsiteTest/protected/models
generate protected/models/ContactForm.php
generate protected/models/LoginForm.php
mkdir C:/wamp/www/MYWebsiteTest/protected/runtime
mkdir C:/wamp/www/MYWebsiteTest/protected/tests
generate protected/tests/bootstrap.php
mkdir C:/wamp/www/MYWebsiteTest/protected/tests/fixtures
mkdir C:/wamp/www/MYWebsiteTest/protected/tests/functional
generate protected/tests/functional/SiteTest.php
generate protected/tests/phpunit.xml
mkdir C:/wamp/www/MYWebsiteTest/protected/tests/report
mkdir C:/wamp/www/MYWebsiteTest/protected/tests/unit
generate protected/tests/WebTestCase.php
mkdir C:/wamp/www/MYWebsiteTest/protected/views
mkdir C:/wamp/www/MYWebsiteTest/protected/views/layouts
generate protected/views/layouts/column1.php
generate protected/views/layouts/column2.php
generate protected/views/layouts/main.php
mkdir C:/wamp/www/MYWebsiteTest/protected/views/site
generate protected/views/site/contact.php
generate protected/views/site/error.php
generate protected/views/site/index.php
generate protected/views/site/login.php
mkdir C:/wamp/www/MYWebsiteTest/protected/views/site/pages
generate protected/views/site/pages/about.php
generate protected/yiic
generate protected/yiic.bat
generate protected/yiic.php
mkdir C:/wamp/www/MYWebsiteTest/themes
mkdir C:/wamp/www/MYWebsiteTest/themes/classic
mkdir C:/wamp/www/MYWebsiteTest/themes/classic/views
generate themes/classic/views/.htaccess
mkdir C:/wamp/www/MYWebsiteTest/themes/classic/views/layouts
mkdir C:/wamp/www/MYWebsiteTest/themes/classic/views/site
mkdir C:/wamp/www/MYWebsiteTest/themes/classic/views/system


Your application has been created successfully under C:\wamp\www\MYWebsiteTest.


C:\wamp\www>
-----------------------------------------------------------------------------

9. Check your Wamp webroot folder.

Saturday, March 17, 2012

How to access Diskpart.exe in Windows 7?

To locate Diskpart.exe in Windows 7:
1. Start > Search
2. Type diskpart.exe

To download Diskpart.exe if your PC don't have yet:
1. Go visit Microsoft website.

To learn more on Diskpart.exe:
1. Microsoft Support centre
2. Techarena forum

How to reduce VHD size by using Diskpart.exe and VHDResizer

 I've used Diskpart.exe to reduce my virtual pc size from 234GB to 108GB.
Virtual PC Name = QAServer
-------------------------------------------------------------------------------------------------------------
Microsoft DiskPart version 6.1.7600
Copyright (C) 1999-2008 Microsoft Corporation.
On computer: Yumar-NB


DISKPART> select vdisk file=f:\virtualpc\qaserver\qaserver.vhd

DiskPart successfully selected the virtual disk file.

DISKPART> attach vdisk

DISKPART> list volume

  Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
  ----------  ---  -----------  -----  ----------  -------  ---------  --------
  Volume 0     E                       DVD-ROM         0 B  No Media
  Volume 1         System Rese  NTFS   Partition    100 MB  Healthy    System
  Volume 2     C   System       NTFS   Partition    137 GB  Healthy    Boot
  Volume 3     D   Data1        NTFS   Partition    102 GB  Healthy
  Volume 4     G   Data2        NTFS   Partition     36 GB  Healthy
  Volume 5     F   CathY        NTFS   Partition    465 GB  Healthy
  Volume 6     H   QAServer     NTFS   Partition    234 GB  Healthy

DISKPART> select volume 6
Volume 6 is the selected volume.

DISKPART> list volume

  Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
  ----------  ---  -----------  -----  ----------  -------  ---------  --------
  Volume 0     E                       DVD-ROM         0 B  No Media
  Volume 1         System Rese  NTFS   Partition    100 MB  Healthy    System
  Volume 2     C   System       NTFS   Partition    137 GB  Healthy    Boot
  Volume 3     D   Data1        NTFS   Partition    102 GB  Healthy
  Volume 4     G   Data2        NTFS   Partition     36 GB  Healthy
  Volume 5     F   CathY        NTFS   Partition    465 GB  Healthy
* Volume 6     H   QAServer     NTFS   Partition    234 GB  Healthy

DISKPART> shrink querymax
The maximum number of reclaimable bytes is:  195 GB (200196 MB)

DISKPART> shrink desired=130000
DiskPart successfully shrunk the volume by:  126 GB

DISKPART> list volume

  Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
  ----------  ---  -----------  -----  ----------  -------  ---------  --------
  Volume 0     E                       DVD-ROM         0 B  No Media
  Volume 1         System Rese  NTFS   Partition    100 MB  Healthy    System
  Volume 2     C   System       NTFS   Partition    137 GB  Healthy    Boot
  Volume 3     D   Data1        NTFS   Partition    102 GB  Healthy
  Volume 4     G   Data2        NTFS   Partition     36 GB  Healthy
  Volume 5     F   CathY        NTFS   Partition    465 GB  Healthy
* Volume 6     H   QAServer     NTFS   Partition    108 GB  Healthy

DISKPART> detach vdisk
DiskPart successfully detached the virtual disk file.

DISKPART> exit
---------------------------------------------------------------------------------------------------------
Once, the volume is reduced, I used VHDResizer to reduce VHD to below 127GB.
Viola! The vhd file is ready for use.
 

Friday, March 16, 2012

Physical disk to VHD

I was planning to capture my QAServer to virtual PC so that I can perform my testing during the weekend at my house. Somehow, I've faced many difficulties and it not that simple.
Below the process I've went through:
1. Create virtual PC for QAServer by using Disk2vhd
2. Resize vhd by using diskpart.exe
(Reference: Microsoft)
3. Resize vhd by using VhdResizer
4. Merge partitions by using Partition Master

To know in detail all the partition available in each vhd file, I've used Disk Management available in Computer Management.
Computer Management is accessed from Control Panel > Administrative Tools > Computer Management. There are many actions can be performed by using Disk Management, such as Attach VHD, Create VHD, Rename Partition and so on.