Develop for Windows Explorer Browsers from Ubuntu (with VirtualBox)

Lately I wanted to setup my ubuntu box with virtualbox so I can also run windows and mainly to be able to test on windows the look of some of the sites I develop. In order to do that I could choose to put up a site online to a live server somewhere. Although this is feasible for me since I have a special setting with my hosting, dropbox fix, and unlimited space and subdomains, I think it would be too much to be updating files on a far server just for a rapid change. Therefore I decided to have the virtual windows to be able to load pages from my host ubuntu apache2 server which was all along configured.

I found THIS post but it did the inverse. The guys from windows trying to develop sites on ubuntu. That is not what we want! Rather we want to just check our sites we develop on native ubuntu into the nightmare of Internet Explorer’s versions. Yes if you are reading this encourage your users not to use any of those browsers. And that is not changing in the latest beta or whatever version. It will just not change.

Going to the meat you want to have handy these details:

# ifconfig (to look for your IP in your ubuntu host)

cat /etc/resolv.conf (your ubuntu host DNS)

On the windows guest set a fixed IP (e.g. as in the image) and a DNS (same as ubuntu host)

Under Devices on your windows guest virtuabox window on Network Adapters have it this way:

Finally, on your windows guest you should set the domains your developer sites are being served by your ubuntu host apache2 setup.

For instance if I am serving a site as http://ward.local on ubuntu then I have to go into my windows guest and go under C:/Windows/System32/Drivers/etc/hosts and add the entry like this:

Using the IP I got from my ubuntu host with:
# ifconfig (to look for your IP in your ubuntu host)

I enter:
[code] localhost (this line is already there)
XXX.XX.XX.XX ward.local (this is the new line)

Of course don’t enter the lines with parenthesis.

Now you should be able to enjoy seeing your sites on windows iexplorer browsers.

Helping you? Please encourage me with a donation:
I am a freelancer and don’t work for any company. By donating you will be helping me to help others as yourself.
Need help with your site? Conact me at

Google’s “Go” Programming Language

Google has a new compiled programming language called Go. There is a video available on the website from the Google I/O 2010 conference some core features. In the second half of the video I noticed that Go borrows two key ideas from languages like Javascript:
* Closures
* and what the Go programmers call “Channels” (a way to have event handling- Javascript guys call it “Callbacks”)

With the above in mind, it seems that Go can compete with NodeJS. Perhaps this is why Go was created.

establishing an sqlite3 db connection via ActiveRecord

ActiveRecord can be used as a stand-alone gem without going through a Rails app. When establishing a connection we must provide a name for the database. Here is an example where I use sqlite3 as a db engine. I want to provide a full path to the database also.

my_db_dir = ‘~/projects/myapp/db’
filename = File.join(my_db_dir,’development.sqlite3′)
ActiveRecord::Base.establish_connection(:adapter => ‘sqlite3’, :database => filename)

On Ubuntu systems it is very likely that we will get an error

No such file or directory

I know the file is there. I know the path is correct. So what is wrong? The problem is the “~” character. ActiveRecord uses Ruby’s File.binread() method to read the file. The binread() method is a wrapper for a function in the c code (io.c) of the Ruby interpreter. When you dig deep into the source code of the Ruby project you will find the file.c file which contains a function for checking file paths for security related issues. This function is called rb_get_path_check().

Basically we should not pass a tilde character to File.binread(). It is something that will confuse you for many hours if you it!!

Here is a demonstration of the problem using interactive Ruby (irb).

$ irb
ruby-1.9.2-rc2 > File.binread("~/myfile.txt")
errno::ENOENT: No such file or directory – ~/myfile.txt
from (irb):1:in `binread’
from (irb):1
from /home/philip/.rvm/rubies/ruby-1.9.2-rc2/bin/irb:17:in `<main>’
ruby-1.9.2-rc2 > File.binread("/home/myuser/myfile.txt")
=> "This is the content of myfile… "

You can see that the “~” character did not work. 🙁

Day 10 with Jobeet + Git

One of the things I have noticed after finishing day 10 of the Jobeet “tutorial” using git is that it could be possible after all to go back in time and develop some of the teasing questions of the tutorial at each step of the process.

So after finishing up day 10 I have all the code committed and I can see my logs:

commit 4d273d62eee6f1e87edb2d03ee3669d55dc7137f
Author: Luis Cordova <>
Date: Fri Nov 5 21:13:40 2010 -0500

added the requirement for displaying active jobs namely
$q->andWhere(‘j.is_activated = ?’, 1);

commit d2b6761c531f5f914c853eca4c1c85ed0b1a9e05
Author: Luis Cordova <>
Date: Fri Nov 5 21:08:22 2010 -0500

added the function publish used by the action publish from the actions class

commit f738e074c5859bd38284c57aa056bd6877a020e6
Author: Luis Cordova <>
Date: Fri Nov 5 21:04:11 2010 -0500

added the action publish in actions.class.php

commit 32cdd5c99b2f64ed61a656019b4124f1863c14a8
Author: Luis Cordova <>
Date: Fri Nov 5 21:01:49 2010 -0500

change the publish link from job_edit to job_publish

commit f1c5568624b769d15a4f02397fa0ba4266bdaa58
Author: Luis Cordova <>
Date: Fri Nov 5 20:58:00 2010 -0500

added functions for the partial + routing put for publish action

commit a4be28655cb667eef93edf6ef505a65705e08255
Author: Luis Cordova <>
Date: Fri Nov 5 20:42:58 2010 -0500

added partial _admin.php on job templates

create mode 100644 apps/frontend/modules/job/templates/_admin.php

commit b5319463d864f7c3c726052c68f2275275c00eee
Author: Luis Cordova <>
Date: Fri Nov 5 20:40:48 2010 -0500

so if at any point I need to go back in time I will issue the command:

git revert 32cdd5c99b2f64ed61a656019b4124f1863c14a8

And I will “return” to the state where I was at that point.

I just:

” change the publish link from job_edit to job_publish”

so I perhaps can explore some things with the code in that state and learn some more things about symfony. This is of course an example.

This will create a new commit with that version so I have to merge later with the last version of the local repo.

A better way to see the changes that I then did is issuing:

git show 32cdd5c99b2f64ed61a656019b4124f1863c14a8

which will return:
commit 32cdd5c99b2f64ed61a656019b4124f1863c14a8
Author: Luis Cordova <>
Date: Fri Nov 5 21:01:49 2010 -0500

change the publish link from job_edit to job_publish

diff –git a/apps/frontend/modules/job/templates/_admin.php b/apps/frontend/module
index 3e8eda6..37f169b 100644
— a/apps/frontend/modules/job/templates/_admin.php
+++ b/apps/frontend/modules/job/templates/_admin.php
@@ -3,7 +3,7 @@
<?php if (!$job->getIsActivated()): ?>
<li><?php echo link_to(‘Edit’, ‘job_edit’, $job) ?></li>
– <li><?php echo link_to(‘Publish’, ‘job_edit’, $job) ?></li>
+ <li><?php echo link_to(‘Publish’, ‘job_publish’, $job, array(‘method’ => ‘p
<?php endif ?>
<li><?php echo link_to(‘Delete’, ‘job_delete’, $job, array(‘method’ => ‘delet
<?php if ($job->getIsActivated()): ?>

Then I can meditate on the code and learn how to do things for my other projects provided I can locate the descriptions easily. This means that I was good in describing what the feature commit was about so I can pull it out easily.