Test Symfony2 GUI Apps in Windows7 with IE8 and IE9 The Right Way!

Ever wanted to browse your symfony2 apps from the point of view of those old stiff corporates that don’t know how to install better programs?
Fasten your seat belts!

Update: The right way ended up being https://github.com/xdissent/ievms (thanks @helios_ag)

Go first and download the legal images from this link: http://www.microsoft.com/en-us/download/details.aspx?id=11575
To aid you in your selection just download all 3 by 3 because i am sure you will have corruption problems. If the exe fails when you run it on your ubuntu just remove the files and download the again and again until you get them to work. Don’t be discouraged just try it and defeat it.

Once you grab your images and run the exe for each of the IE7, IE8, IE9 that you want to install (shame on you if IE6), you should get two files for each set, namely a Win7_IE8.vmc and a Win7_IE8.vhd for the IE8 version for instance. I will assume you have installed the latest virtualbox software from the ubuntu software center in your ubuntu. Run that and create a box and init the box with your already existent disk image, yes the vhd file.

After your box is all set and running you would ask yourself how to see my symfony2 app from the virtual box guest browser (yes this is the windows 7 with IE8 or IE9, etc). First follow and make sure the pinging works between the guest browsing the app and the host serving the app through apache or other.
Troubleshot tips, pinging from guest box to the host and from host to guest box:

// from guest windows box
ping 192.168.1.34 // IP address of the ubuntu host
// from ubuntu box
ping 192.168.1.36 // IP address of the virtual box

Step1: Edit your hosts on your windows box to include an entry pointing to your Ubuntu’s IP address (mine is 192.168.1.34) the one running apache and serving the symfony2 app:

// 127.0.0.1   localhost
129.168.1.34   myapp.local

Step2: Set your virtualbox network settings of the windows guest to Bridge and set it to allow on the select box to ALL VMS and what not.
Step3: Drop your defense iptables to allow for the guest to access pages served by the host:

// this works:
~ sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT
// thanks to @helios_ag who recommended these:
~ ufw allow http
~ ufw allow 80

Then open your browser on your windows guest virtual box and type:

http://myapp.local/app_dev.php

And of course you will get the one line warning. But from here on you know what to do if you are a symfony2 guy.
If you get errors make sure you troubleshoot and drop your firewalls allowing for the access with iptable settings as above.

I hope this has helped you. I thank God for having such good friends in the community.
Also I make sure to mention that all of this is undeserved because I cannot repay God’s grace.
Lastly, if you would like to see me at SymfonyLive in San Francisco and would like to contribute towards my air ticket 1800$ ($100 already raised) please follow this link: http://bit.ly/9xbyzM. The flight is very expensive but I am so eager to go and thanks for all that are already supporting me, we will have so much learning there. Looking forward to meet the community you!

Getting your Symfony2 Team On Board With Git Line Endings!

Lately I ran into this help page from github here.
The main problem that this solves and the one I ran into was that I made some modifications to a file in a git repository and to my surprise I was met by an ugly scenario when doing `git diff` showing strange characters `^M` which were showing red and ugly:

I tried in vain to get rid of these windows format line endings. Then was redirected to the link above but just initially set my .gitconfig to no effect.
In order to solve this there were two options: (1) waiting until project manager would make a transition from an unclean repo to a reformatted one, or (2) just cope with it and either run a nice utility called `dos2unix` (you can install it by `sudo apt-get install dos2unix on ubuntu) to filter those characters, stash my changes, then commit the whole file changes after the dos2unix command, yes this command changes all the file, then apply my stashed changes, then commit again. The latter solution is not very nice as there is an ugly bump in history as to who change what in the file. So I just went ahead and made my changes and accept for one only time to see those weird characters on my `git diff`. The reason why those characters were there was that for that particular repository on some version at some point the file got edited in Microsoft products by someone using Windows OS.

The morale of the story is that in order to avoid these problems with strange end of line characters we could just make our project totally independent of what the OS of the team’s developers use. The `.gitattributes` file accomplishes this by telling git what to do or how to behave when checking out these files. Following is a `.gitattributes` I wrote in order to accomplish this for a symfony2 generic project. It is my hope that people would contribute to it and would improve it. Here is the https://github.com/cordoval/symfony2-gitattributes to fork and PR and following is a excerpt:

# Set default behaviour, in case users don't have core.autocrlf set.
* text=auto
 
# Explicitly declare text files we want to always be normalized and converted 
# to native line endings on checkout.
*.php text
*.txt text
*.ini text
//...
*.js text
*.css text
*.cache text
*.meta text
*.phar text
app/console text
console text
vendors text
.gitignore text
// ...
 
# Denote all files that are truly binary and should not be modified.
*.png binary
*.gif binary
*.jpg binary
*.db binary
*.jar binary
*.ico binary
.gitkeep binary

It has inline comments that explain what each section does. Please from now on make sure you include this file in your symfony2 project.
If you liked this and want to support me going to symfonyLive in San Francisco please donate.