Archive for the ‘Development’ Category

“Only websites with over 100,000 daily page views across user pages are eligible to participate in the Google AdSense API program…”

Sunday, November 9th, 2008

What the.. This is annoying.  And all I wanted to do was write a hack to see my AdSense pittance from within WordPress.

Running the BlackBerry Simulator on Vista

Saturday, October 4th, 2008

BlackBerry Simulator mysteriously dying every time you try to fire it up on Vista?  Same here. It’s a good thing I’ve become a compulsive reader of release notes. From the the latest JDE 4.6.0 docs:

If you install the BlackBerry® Java® Development Environment on a computer with Windows Vista™, if Use Account Control is turned on, launching the BlackBerry® Smartphone simulator might produce error messages and the simulator might not start.

Read:  Simulator will definitely not start.  And of course they mean User Access Control. How-To Geek has an easy way to kill UAC here.

Elegant PHP error logging in Firefox

Thursday, September 25th, 2008

Mika Tuupola has come up with an elegant logging mechanism that has already found its way into the official PEAR::Log package.

It’s a snap to use.  Simply instantiate a “Firebug” log as such:

$log = &Log::singleton('firebug', '', 'PHP', array('buffering' => true), PEAR_LOG_DEBUG);

Output will then go to your Firebug console window:

firebug-output-300x113 Elegant PHP error logging in Firefox

$log->log('Debug lorem ipsum.', PEAR_LOG_DEBUG);
$log->log('Info wisi enim ad minim veniam', PEAR_LOG_INFO);
$log->log('Warning est usus legentis in', PEAR_LOG_WARNING);
$log->log('Error est notare quam', PEAR_LOG_ERR);

To split output to both the default error log as well as the Firebug console, build a “composite” log:

$log = &Log::singleton('composite');
$logFile =& parent::singleton('error_log', PEAR_LOG_TYPE_SYSTEM, 'to error log', array(), PEAR_LOG_DEBUG);
$logFire =& parent::singleton(’firebug’, ”, ‘to firebug’, array(’buffering’=>true), PEAR_LOG_DEBUG);
$log->addChild($logFile);
$log->addChild($logFire);

Mantis State Plugin Updated

Thursday, September 11th, 2008

gmap-state-004-150x150 Mantis State Plugin UpdatedI was surprised to receive a support request last week for the Mantis State Plugin.  Given that the thing wouldn’t allow itself to be uninstalled, I figured it was time to release an update.

Version 0.0.4 includes clearer severity output, issue details on mouseover, and an attempt to better visualize date ranges within the state matrix.

Oh, and it can now be uninstalled.

Mantis State Plugin (6.21 KB)

Remote PHP Debugging with Emacs

Saturday, June 21st, 2008

It’s an Emacs weekend here at blog.arithm.

I was recently asked if it was possible to do remote PHP debugging with Emacs. We’re talking about Emacs, so the answer is:  Of course!  How to do it:

  1. Grab Tohru Fujinaka’s GEBEN library.  It’s an aging alpha release, but works fairly well.
  2. Make sure you also have CEDET installed.  I’m using the 1.0 pre4 release.
  3. Drop debugclient somewhere in your path.  (Here Emacs is running on Windows, so I just threw it into the C:\WINDOWS\ directory.)  Make sure the executable is named “debugclient” and not “debugclient-0.9.0″ or whatever.
  4. If you’re using the standard xdebug port 9,000 (recommended), make sure that port is open on your firewall.  For most folks these days that means opening up the default OS firewall as well as forwarding a port from the router.  See the exceptional portforward.com for more information on router port forwarding specifics.

Now, assuming you already have xdebug plugged into PHP, modify php.ini or an .htaccess file with the following settings:

  • xdebug.remote_enable = true
  • xdebug.remote_handler = dbgp
  • xdebug.remote_host = your_client_ip

For security reasons it’s wiser to do this via .htaccess on directories that permit only authenticated access.

To debug, ask Emacs to listen for connections by going into GEBEN Mode with Meta-x geben. You should see “xdebug started.” in the status row at the bottom of the Emacs window.

Run your PHP script with the xdebug switch on, eg.

http://www.example.com/script.php?XDEBUG_SESSION_START

If everything is setup correctly, Emacs will load the source of script.php (be wary of security!) and allow you to step through the code.

Available commands are:

spc step into/step over
i   step into
o   step over
r   step out
b   set a breakpoint at a line
u   unset a breakpoint at a line
g   run
q   stop

Some gotchas: I’ve noticed the GEBEN expects the first keystroke to be “space”; often it will freeze otherwise.  GEBEN may also run into problems on certain session-related PHP commands.

Happy debugging!

TOAD versus DBVisualizer Revisited

Tuesday, June 17th, 2008

Despite all the nice things I said about TOAD last year, I thought I should mention that I find myself still using DBVisualizer almost exclusively.

Although TOAD has some really powerful features, DBVisualizer is just so easy to use.. that it’s a difficult habit to break.

readonly versus disabled

Thursday, April 10th, 2008

I couldn’t seem to find a good breakdown on this anywhere and had to see what would happen trial and error.

  • readonly="1" will show a standard form element, however it will not be editable. Data will, however, be submitted.
  • disabled="1" will gray-out the form element. Data will not be submitted with the rest of the form.

At least, this is what Firefox does.

Run svnserve, run!

Saturday, January 5th, 2008

More notes to self.

Fancy shmancy init scripts aside, this is the fastest way to get a Subversion server up and running:

/usr/bin/svnserve --daemon --root /var/svn

root is the directory housing one’s repositories; looks something like this:

/var/svn/
conf/
project1/
project2/
repos/

Make sure the svn port 3690 is open.

Subversion Project Startup Cheat Sheet

Saturday, November 10th, 2007

This is one of those things I have to do once every so often and that I can never freaking remember how to do.

  1. Create a repository on the server. AFAIK can’t be done over the network; must be done on the machine hosting the repository.

    # svnadmin create /path/to/repositoryname

  2. Import your files (often from a remote machine).

    $ svn import /tmp/project svn://url.com/repositoryname -m "initial freaking import"

  3. Check them out again to your desired directory.

    $ svn checkout svn://url.com/repositoryname

That’s it! See the Quick Start in the online book if you need to mess around with branches and tags and the like.

Mantis State Plugin

Monday, October 8th, 2007

For the longest time now I’ve wanted a view in Mantis that could show me, at a glance, what’s receiving attention and what’s falling through the cracks.

Vincent Debout has recently released an excellent plugin manager for Mantis; so I’ve attempted to whip something up. The Mantis State plugin contains a matrix view listing out issues in left-to-right, top-to-bottom in order of last update. Font size indicates priority. Blinking issues are severe.

Right now this probably works well for smaller projects, but could get difficult to view with a large number of issues. Would be nice if Mantis’ current filtering system could plug into this.

mantis-state-sample.pngYou can see from this sample view that one of our projects has a number of items reported sometime back that are not getting looked at. Oops.

If you’d like to test it out, feel free to download an early alpha version here: Mantis State Plugin (6.21 KB)

Includes some simple Japanese localization.

Update: Recieved a request last week to update the broken uninstaller.  Link above updated as of September 2008.