June 1, 2011

VMWare, Samba, Eclipse, and XDebug: Mixing a virtual Linux environment with a Microsoft Windows development environment

June 1, 2011 - Categories: development, drupal, geek

I’m starting the second phase of a Drupal development project, which means I get to write about all sorts of geeky things again. Hooray! So I’m investing some time into improving my environment set-up, and taking notes along the way.

This time, I’m going to try developing code in Eclipse instead of Emacs, although I’ll dip into Emacs occasionally if I need to do anything involving keyboard macros or custom automation. Setting up a good Eclipse environment will help me use XDebug for line-by-line debugging. var_dump> can only take me so far, and I still haven’t figured out how to properly use XDebug under Emacs. Configuring Eclipse will also help me help my coworkers, who tend to not be big Emacs fans. (Sigh.)

So here’s my current setup:

I like this because it allows me to edit files in Microsoft Windows or in Linux, and I can use step-by-step debugging instead of relying on var_dump.

Setting up Samba

Samba allows you to share folders on the network. Edit your smb.conf (mine’s in /etc/samba/) and uncomment/edit the following lines:

security = user

[homes]
   comment = Home Directories
   browseable = no
   read only = no
   valid users = %S

You may also need to use smbpasswd to set the user’s password.

Xdebug

Install php5-xdebug or whatever the Xdebug package is for PHP on your system. Edit xdebug.ini (mine’s in /etc/php5/conf.d) and add the following lines to the end:

[Xdebug]
xdebug.remote_enable=on
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.remote_autostart=1
xdebug.remote_connect_back=1

Warning: this allows debugging access from any computer that connects to it. Use this only on your development image. If you want to limit debugging access to a specific computer, remove the line that refers to remote_connect_back and replace it with this:

xdebug.remote_host=YOUR.IP.ADDRESS.HERE

Eclipse and PDT

I downloaded the all-in-one PHP Development Toolkit (PDT) from http://www.eclipse.org/pdt/, unpacked it, and imported my project. After struggling with Javascript and HTML validation, I ended up disabling most of those warnings. Then I set up a debug configuration that used Xdebug and the server in the VM image, and voila! Line by line debugging with the ability to look in variables. Hooray!

2011-05-31 Tue 17:37

Hungry hungry compost and other garden updates

June 1, 2011 - Categories: gardening

The compost bin chomps through imageall the organic material we give it. It’s nowhere near the smooth dark brown of finished compost yet, but when I turn it every week, my two full bins have mysteriously become two half-bins of compost. The Internet says it takes a ton of organic material (a literal ton, mind you) to make half a cubic yard of compost. To make two cubic yards of compost, then, you need about one Asian elephant’s weight in organic material. (Yes, I estimate tons in elephants, thanks to hanging out with my dad at the zoo.) So I’ll probably buy lots more cow manure (moo poo, as we call it) to amend the soil next year, instead of hoping that the compost bins will pull through quickly.

Other garden updates:

Casualties: a Thai basil plant, and the curry plant in front

I planted bok choi last weekend, and I planted some edamame today. We’re more likely to take the time and effort to cook the edamame than the string beans I grew the other year. =) I also sprinkled a lot of lettuce and spinach near the borders, where I pulled up the lilies of the valley. All those sprouts are coming up now that I’m home enough to keep the soil moist. (Note: Don’t plant lilies of the valley in your garden unless you mean it. They’re invasive and will take over. Ditto mint, which I keep in a pot.)

Pity it’s no longer dandelion season. We pulled up almost all of ours and ate them as salads. If we have more next year, I may host a party. We do have a berry tree out back that will be fun to harvest. We missed harvesting it last year, but we caught a lot of berries on a tarp the year before that. I think it would be a good combination with pastry cream, tart shells, maybe some powdered sugar on top. By that time, the tea garden should be growing quite well, too. Garden party! J- said her friends are excited about our tomatoes and peas, so we should have them over to harvest too. Mmm…