David Luhman's blog

Can't ssh out : Fixing "Permission denied (publickey,password,keyboard-interactive)."

Posted on March 10th, 2010 by David Luhman and tagged .

Suppose you're on a relatively secure Linux box and receive the following message when trying to ssh out interactively (no keys) :

  • Permission denied (publickey,password,keyboard-interactive).

Here's one possible solution :

Check the /etc/ssh/ssh_config (client ssh) file and see if it contains this :

  • PasswordAuthentication no

If so, change it to the following :

  • PasswordAuthentication yes

Now try your interactive ssh session -- you shouldn't need to restart a service or anything else.

Facebook releases 'HipHop' - a PHP 'compiler'

Posted on March 5th, 2010 by David Luhman and tagged .

I stumbled across something called 'HipHop' from Facebook :

Here is how Sebastian Bergmann describes it :

"HipHop for PHP" is a source code transformer that turns PHP 5.2 code (minus some features) into C++ code that can then be compiled with g++, for instance, to a regular binary.

Since much of the Facebook front-end is written in PHP, they found HipHop necessary to reduce their need for servers.

Here are a couple articles on this :

Installing PHP's Testing_Selenium on Windows

Posted on February 25th, 2010 by David Luhman and tagged , .

Earlier I blogged about setting up Selenium, PHPUnit et al on an Ubuntu machine.

Although I prefer to do web development on an Ubuntu machine, for 'legacy' reasons I still do some stuff on a Windows machine. For lighter web interface testing, a full CI tool like Hudson is overkill. Here's how to run Pear's Selenium_Testing alone (without PHPUnit) on Windows.

I assume you have PHP and the Pear installer on your Windows machine. Grab the Pear Selenium_Testing package with :

Writing a simple OO template system in PHP to separate logic and presentation

Posted on February 21st, 2010 by David Luhman and tagged .

If you're maintaining a legacy PHP application which suffers from mixing of application logic and presentation, you may want to implement a simple template system to help separate these two.

Of course there are plenty of existing PHP templating systems, with Smarty being one of the most 'notorious' ;-). But if you have simple needs and don't want to introduce external dependencies to your code, rolling your own simple system can make sense. Let's face it -- you can often roll your own in the time it takes to figure out someone else's system.

Simple Progress (Load) Bar with jQuery

Posted on February 13th, 2010 by David Luhman and tagged , .

Let's say you need to load some info into a page, but the info requires some time to process. You don't want to have the user staring at a blank screen during the processing, so first load the page with a busy (progress) bar image and then replace the image with the actual data when ready.

Assume you have this HTML page :


<html>
<head>
  <script type="text/javascript" src="/js/jquery.js"></script>
  <script type=""  type="text/javascript">
    $(document).ready(function() {

Cheap PHP lint checking with Git

Posted on February 12th, 2010 by David Luhman and tagged , .

Running PHP's "built-in" lint checker (php -l) is a quick way to remove syntax errors which should never creep into your code.

However, you'll no doubt soon tire of typing "php -l" before every Git commit message, so why not let Git do the checking for you with a "pre-commit hook".

Travis Swicegood has a great article on how to set this up with Git :
http://phpadvent.org/2008/dont-commit-that-error-by-travis-swicegood

I found you could pretty much copy his pre-commit PHP script and paste it into your .git/hooks directory with a couple caveats :

Useful Hudson Plugins

Posted on January 21st, 2010 by David Luhman and tagged .

Reporting and Tracking

Running Selenium PHPUnit tests against Firefox in an Ubuntu virtual machine

Posted on January 4th, 2010 by David Luhman and tagged , , .

As part of my Hudson CI server, I'm trying to run Selenium-based PHPUnit tests with each build. The build machine is an virtual machine (VirtualBox) running Ubuntu desktop.

Initially, my tests weren't running thru Hudson and the associated build.xml file. This wasn't surprising since I had forgotten to start the Selenium RC server.

Using the Hudson Continuous Integration (CI) tool

Posted on December 18th, 2009 by David Luhman and tagged , , .

I recently started writing some automated Selenium (Se) tests . I wrote a few tests, and Se seems to work well. But after writing a few tests, I found I needed an easy way to run, report, and track test results.

This lead me to Hudson, a Continuous Integration (CI) tool.

Hudson builds a given project and then does a number of useful things :

  • Automatically run unit tests and provide coverage reports
  • Show style, syntax, and complexity results