Firefox 4 was recently released and here are the instructions on how to install it
http://askubuntu.com/questions/6339/how-do-i-install-firefox-4
Wednesday, March 23, 2011
Installing Firefox 4 in Ubuntu 10.04 & Ubuntu 10.10
Monday, March 14, 2011
Installing Internet Explorer on Linux
IE6, IE7 IE8 on Linux
Assumptions
This instructions are created assuming you are running a fairly reacent distribution of linux. At the time of this post I'm using Ubuntu 10.10.
You will need to have all the required software installed and functioning. Instructions about installing the required software is outside of the scope of this post.
This post assumes we are working on the IE7-on-XPSP3.exe compreced VHC image.
Requirements (What we need)
I recommend the Windows XP images since they are several Gigs smaller than the Vista images. This post is based on the IE7-on-XPSP3.exe file.
Virtual PC Configuration File (VMC)
This is an XML configuration files used by Virtual PC and required by VMware Converter. This file can be generated by installing Microsoft Virtual PC on a windows machine or by downloading the pre-generated filed from this post
IE6.vmc
IE7.vmc (the one used here)
IE8.vmc
Wine is used to extract the VHD image from IE7-on-XPSP3.exe.
Converts the Virtual PC (VPC) Images to VMDK which is the format understood by VMware Player.
Required to run our end product.
Step 1. Extract the Virtual PC (VPC) file.
Open your terminal and locate your compressed Windows image and extract the VPC file using Wine.
$ wine IE7-on-XPSP3.exe
Accept the agreement.
Change "Destination Folder" to a location where you want to extract the Virtual PC (VPC) file. I have chosen "/home/rramirez/Download"
Click on install.
Files extracted in "/home/rramirez/Downloads":
ReadMe.txt
VPC_EULA.txt
WinXPIE7.vhd 1.5G
Step 2. Convert VPC file to VMDK.
For this step we need a VMC file generated by Microsoft Virtual PC. If you have machine with Windows on it, you can install Microsoft Virtual PC and generate this file. Fortunately I have generated this file before hand (Download EI7.vmc) .
Place IE7.vmc in the same directory where your extracted WinXPIE7.vhd. This is "/home/rramirez/Downloads" from step 1.
Open VMware Converter
Click on "Convert Machine".
for "Select source type", select "Backup image or third-party virtual machine"
for "Virtual machine" file, click on "Browse" and locate your Virtual Machine Configuration file VMC). in my case the path is /home/rramirez/Downloads/IE7.vmc
Click on "Next"
for "Select destination type", select "VMware Workstation or other VMware virtual machine"
for "Select VMware product", select the latest VMware Player version. in my case this is "VMware Player 2.5.x".
for "Choose a location for the virtual machine", select the destination where you want to store your windows instance. I chose "/home/rramirez/virtual_machines/".
Hit Next
Next Again
Click on Finish, and wait for VMware Converter to finish its job.
Step 3. Run VMware Player and install the drivers.
Open VMware Player
Click on "Open a Vritual Machine". Find the location where you have your VMDK file (Converted Instance). I have chosen "/home/rramirez/virtual_machines/" in step 2.
Click on "Play virtual machine". Wait for your windows instance to load up and your keyboard and mouse to become active. This make take a few minutes.
At the logon screen, type the password provided by Microsoft (in ReadMe.txt extracted from IE7-on-XPSP3.exe). At the time of this post, the password provided is "Password1" without the quotes.
Cancel the Activation screen and any other installation wizard that comes up.
Install the VMware drivers by clicking on "Virtual Machine"-> "Update VMware Tools...". Once the VMware wizard comes up, finish all the steps.
Cancel any other Windows pop-up boxes asking for missing files.
Reboot the virtual machine.
When rebooted, go through the windows Activation wizard.
Done.
Comments about this procedure
To install other instances, just repeat the procedure above. I have successfully loaded IE6-on-XP and IE8-on-XP with no issues. When finished I notice there was a conflict with the battery in all the instances. This should not be an issue for anybody since these instances are running just for Internet Explorer testing.
Tuesday, December 7, 2010
Dynamic Apache configuration for Development Servers
When configuring a development environment for PHP, the usual configuration is a LAMP server with mod_userdir enabled to assign each user their own URL (/~username). I always though this URL format was not elegant.
%-4.0 = username in [username].dev.example.com
The important directive to pay attention to is "VirtualDocumentRoot /home/%-4.0/public_html". I tells apache to dynamically assign the document root based on the domain.
%-5+ = app in [app].username.dev.example.com
This configuration maps http://myapp.username.dev.example.com to /home/username/public_html/myapp
This is not necessarily a bad side effect. We can actually create pages inside underscore directories to display customized messages.
Enjoy!
http://dev.example.com/~username/my_appI think the better way is to have the username in the domain part of the URL:
http://username.dev.example.com/my_appConfiguring the server to handle this type of URL requires having per-user configuration files/sections. It also requires restarting Apache every time this files are changed. The solution was to use mod_vhost_alias which allows mapping domains to directories (More information found at Dynamically Configured Mass Virtual Hosting).
http://[username].dev.example.com
1. Solution (mod_vhost_alias)
The mod_vhost_alias module allows us to map parts of the domain name to directories. The syntax used is similar to printf(). The following tables from the Apache website describes how the mapping is done:
%%insert a %%pinsert the port number of the virtual host %N.Minsert (part of) the name
* For more information about this table visit http://httpd.apache.org/docs/2.0/mod/mod_vhost_alias.html#interpol
0the whole name 1the first part 2the second part -1the last part -2the penultimate part 2+the second and all subsequent parts -2+the penultimate and all preceding parts 1+and-1+the same as 0
1.1. DNS
To make this work we need a wildcard A record pointing to the development server:*.dev.example.com => 127.0.0.1 #sample IP address (use your server's IP address in place or 127.0.0.1)
1.2. Apache
In the default virtual host (or vhost of your choice) the following configuration is necessary:ServerName dev.example.com
ServerAlias *.dev.example.com
VirtualDocumentRoot /home/%-4.0/public_html
%-4.0 = username in [username].dev.example.com
The important directive to pay attention to is "VirtualDocumentRoot /home/%-4.0/public_html". I tells apache to dynamically assign the document root based on the domain.
2. Going Even Further (sub domain per application)
With a wildcard a record and mod_vhost_alias we can assign a domain to each user app. The format I use is the following:http://[app].[username].dev.example.comto achieve this we add %-5+ to the VirtualDocumentRoot directive:
VirtualDocumentRoot /home/%-4.0/public_html/%-5+%-4.0 = username in my-app.[username].dev.example.com
%-5+ = app in [app].username.dev.example.com
This configuration maps http://myapp.username.dev.example.com to /home/username/public_html/myapp
2.1. Omitting parts of the sub-domain
A side effect of using this technique is that if any of the sub-domain parts is missing, apache will replace it with an underscore ( _ ):http://username.dev.example.com maps to /home/username/public_html/_/
http://dev.example.com maps to /home/_/public_html/_/
This is not necessarily a bad side effect. We can actually create pages inside underscore directories to display customized messages.
Enjoy!
Monday, August 30, 2010
Local Git over SSH (Fixing GIT permission issues)
Solving Git local issues over SSH (Fixing GIT permission issues)
When I setup git in my company I ran into many issues. I was moving all my projects from a Subversion environment to a GIT environment. I already knew that GIT was a lot more flexible than Subversion and there were many possible ways of setting up the work flow. Being the first time I ran into some issues and I have to change the way we worked a couple of times.
My first setup
The project I was working on at the time had two developers, including my self. I opted for setting up a our work flow as a decentralized environment. The problem with this approach was that we were used to a centralized environment. It wasn't so much of an issue, but actually an annoyance. After some reading we decided to place a centralized bare repository some where in the /var/lib/project_name directory. It was a work flow that we were more used.
After a couple of days working with it, we started having some permission issues in my local copy. I looked inside my .git directory and found files owned by the other developer. I quickly ran a "sudo chown -R myusername:myusername .git" to claim ownership of my files and fixed the issue. I thought it was strange at the moment, but I didn't put to much thought into it.
Later that same day, the other developer was having the same issues. She was not able to perform certain tasks because the files where owned by me. This time I looked a little closer. I compared the files that had the issue with "ls -hli". I used the "-i" switch to show the file inode numbers. I quickly found that her files and my files where the same. I discover that Git was actually not coping its internal files, but it was creating hard links of the files create by the other developer.
The solution
I did some reading on-line about the issue and I found that Git creates hard links for performance purposes. I was not a git expert and I wasn't sure how to turn off this feature, I thought about a workaround. I already know that git worked over SSH and there was no way to create hard links over SSH. I moved the git repository to it's own *nix account and had everybody clone the repository from this account.
The solution was elegant!, and it also had the added feature of being able to clone the project outside our development environment.
This is what I did. All commands that start with # I ran as root, and commands that start with $ are ran as a regular user.
Create a *nix account for the git user as root:
# useradd git -m
Create a password, this step is optional since I use SSH Keys, it's only temporary.
# passwd git
// create an empty bare repository in git's home directory
I ran these commands as a regular user:
// create project
// push to central repository
Now it's was up to the other developer to clone the central repository.
If you don't want to type the password for the git account every time you push a commit or you don't want to distribute the password. You can install your SSH keys on the git account.
I you have not already don't so, generate your ssh keys. You can leave the default key file and type your security pass phrase. If you don't want to ever type the pass phrase, just leave it empty.
That's it, now you can continue your live with your regular pulls and pushes to the central repository.
Good luck!
When I setup git in my company I ran into many issues. I was moving all my projects from a Subversion environment to a GIT environment. I already knew that GIT was a lot more flexible than Subversion and there were many possible ways of setting up the work flow. Being the first time I ran into some issues and I have to change the way we worked a couple of times.
My first setup
The project I was working on at the time had two developers, including my self. I opted for setting up a our work flow as a decentralized environment. The problem with this approach was that we were used to a centralized environment. It wasn't so much of an issue, but actually an annoyance. After some reading we decided to place a centralized bare repository some where in the /var/lib/project_name directory. It was a work flow that we were more used.
After a couple of days working with it, we started having some permission issues in my local copy. I looked inside my .git directory and found files owned by the other developer. I quickly ran a "sudo chown -R myusername:myusername .git" to claim ownership of my files and fixed the issue. I thought it was strange at the moment, but I didn't put to much thought into it.
Later that same day, the other developer was having the same issues. She was not able to perform certain tasks because the files where owned by me. This time I looked a little closer. I compared the files that had the issue with "ls -hli". I used the "-i" switch to show the file inode numbers. I quickly found that her files and my files where the same. I discover that Git was actually not coping its internal files, but it was creating hard links of the files create by the other developer.
The solution
I did some reading on-line about the issue and I found that Git creates hard links for performance purposes. I was not a git expert and I wasn't sure how to turn off this feature, I thought about a workaround. I already know that git worked over SSH and there was no way to create hard links over SSH. I moved the git repository to it's own *nix account and had everybody clone the repository from this account.
The solution was elegant!, and it also had the added feature of being able to clone the project outside our development environment.
This is what I did. All commands that start with # I ran as root, and commands that start with $ are ran as a regular user.
Create a *nix account for the git user as root:
# useradd git -m
Create a password, this step is optional since I use SSH Keys, it's only temporary.
# passwd git
// create an empty bare repository in git's home directory
# su - git
# mkdir project_name.git
# cd project_name.git
# git init --bare
I ran these commands as a regular user:
// create project
$ mkdir project_name
$ cd project_name
$ vi some_file.txt
$ git init
$ git add .
$ git commit -m "STARTING PROJECT"
// push to central repository
$ git remote add origin git@localhost:project_name
$ git push origin masterNow it's was up to the other developer to clone the central repository.
$ git clone git@localhost:project_name
If you don't want to type the password for the git account every time you push a commit or you don't want to distribute the password. You can install your SSH keys on the git account.
I you have not already don't so, generate your ssh keys. You can leave the default key file and type your security pass phrase. If you don't want to ever type the pass phrase, just leave it empty.
$ ssh-keygen
$ ssh-copy-id -i ~/.ssh/id_rsa.pub git@localhostThat's it, now you can continue your live with your regular pulls and pushes to the central repository.
Good luck!
Wednesday, April 14, 2010
Conditional Comments HTML
Conditional comments are grate when targeting internet explorer, but when it comes to NOT targeting internet explorer they are a pain. The code provided by Microsoft does not play well with HTML validators:
Fortunately, there is a work around.
By adding the tags in red, our code passes HTML validation and targets all browsers that are not Internet explorer.
Enjoy!
Rick Ramirez
<![if !IE]>
<p>This will not show in any version of IE</p>
<!endif]-->
<!--[if IE]>
<p>This will only show in IE</p>
<!endif]-->
Fortunately, there is a work around.
<!--[if !IE]><!-->
<p>This will not show in any version of IE</p>
<!--<!endif]-->
<!--[if IE]>
<p>This will only show in IE</p>
<!endif]-->
By adding the tags in red, our code passes HTML validation and targets all browsers that are not Internet explorer.
Enjoy!
Rick Ramirez
Thursday, February 25, 2010
Eclipse PHP and Remote Editing
Original Post: September 4th, 2008
Eclipse PDT (former PHP IDE) is a free alternative to expensive PHP IDEs. It comes loaded with a lot of features and a large plugin database. One of the most usefull plugins is the Remote System Explorer (RSE). The Remote System Explorer (RSE) allows you to work remotely over the internet. For this article, I explain how to mount a remote PHP project over SSH.
Eclipse PDT Installation
The easies way to install Eclipse PDT is to download the latest all-in-one version from http://www.eclipse.org/pdt/. Once on the page:
Once your eclipse platform is open
Note: If your PDT Eclipse doesn’t recognize the project as a PHP Project, then you must manually edit the .project file on the remote server and add the following code:
Between the <buildSpec> tags add:
and between the <nature> Tags add:
Then Restart Eclipse.
Enjoy.
Eclipse PDT Installation
The easies way to install Eclipse PDT is to download the latest all-in-one version from http://www.eclipse.org/pdt/. Once on the page:
- Click on the Download link.
- Find the latest release (stable release is recommended).
- Look for All-in-one option and click on the link corresponding to your platform (Linux, Max, Windows).
- Once downloaded, Uncompress the file and open the eclipse executable
Once your eclipse platform is open
- Click on the Help menu.
- Navigate your way to Software Updates and click on “Find and Install…”.
- The “Feature Updates” window will open, then Select “Search for new features to install” and click on Next.
- Check the the “Europa Discovery Site” and click on Finish.
- On the “Update Site Mirrors” window, select a mirror or just click OK.
- On the “Search Results” window, expand the “Europa Discovery Site”.
- Check the “Remote Access and Device Development” box, then click on the “Select Required” button.
- Click Next.
- Accept the terms and click on Next.
- Click on Finish. (wait for the software to download)
- When the “Verification” window pops up, click on “Install All”.
- After installation is complete, say “Yes” to restart the eclipse.
- Click on the Window menu.
- Navigate to “Open Perspective” and click on “Other…”.
- Select “Remote System Explorer” and and click OK.
- Click on the “Define a connection to remote system” icon.

- Select the “SSH Only” as the System Type, and click on Next.

- Type the Host Name of the SSH Server and click on Finish.

- Navigate your way to the folder that has your PHP code. While doing this, Eclipse will ask you for your login credentials. Type your SSH Login and Password and click OK.


- Once you find the folder you are looking for, Right-Click on it, and click on “Create Remote Project”. Depending on the size of the project this could take a while.
- Now you should be able to open your PHP prospective by clicking on the Window -> Open Prospective -> “Other …” menu. Then slect PHP from the list and click OK.
Note: If your PDT Eclipse doesn’t recognize the project as a PHP Project, then you must manually edit the .project file on the remote server and add the following code:
Between the <buildSpec> tags add:
<buildCommand>
<name>org.eclipse.php.core.PhpIncrementalProjectBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.php.core.ValidationManagerWrapper</name>
<arguments>
</arguments>
</buildCommand>
<name>org.eclipse.php.core.PhpIncrementalProjectBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.php.core.ValidationManagerWrapper</name>
<arguments>
</arguments>
</buildCommand>
<nature>org.eclipse.php.core.PHPNature</nature>
Enjoy.
Protocol Wrapper to parse PHP
Original Post: August 21st, 2008
1. create a class handler for the new protocol wrapper. Click on the link to see the code.
PhpFileStream.php
Note that I have added functionality to accept a query string.
2. Create your dynamic file
hello.php
3. Register your Protocol/Wrapper some where in your code and use it!
This code will print:
Note that You can pass a URL encoded query string to the file. The values can be accessed from within the file using $this->[key_name] in the target file.
Now all you would have to do If you ever needed to create a dynamic WSDL file was to use the class I provide here and pass the wrapper path this way:
Now you should be able to include PHP code in you WSDL for you dynamic needs.
Enjoy!
Why do I need a protocol wrapper to parse a PHP file?
There are some cases in which one wants to pass a dynamic string to a function that only takes a file path. One of those cases is the SoapServer class in PHP. The SoapServer class takes the $WSDL argument as a local file path. If you ever needed to have a dynamic WSDL file for different customers you would probably know what I’m talking about.Creating the Protocol/Wrapper to parse a file using PHP
The trick here is to use the PHP function stream_wrapper_register to define a protocol that parses PHP.1. create a class handler for the new protocol wrapper. Click on the link to see the code.
PhpFileStream.php
Note that I have added functionality to accept a query string.
2. Create your dynamic file
hello.php
Hello <?=$this->first_name?>!
3. Register your Protocol/Wrapper some where in your code and use it!
<?php
//include the class
include('PhpFileStream.php');
//
//register the wrapper
stream_wrapper_register('phpfile', 'PhpFileStream');
//
//you can now pass the file path with the new protocol wrapper and it will be parsed
echo file_get_contents('phpfile:///./hello.php?first_name=John');
This code will print:
Hello John!
Note that You can pass a URL encoded query string to the file. The values can be accessed from within the file using $this->[key_name] in the target file.
Now all you would have to do If you ever needed to create a dynamic WSDL file was to use the class I provide here and pass the wrapper path this way:
<?php
//...
SoapServer('phpfile:///path/to/dynamic.wsdl?key1=val1&key2=val2');
//...
Now you should be able to include PHP code in you WSDL for you dynamic needs.
Enjoy!
Subscribe to:
Posts (Atom)





