Web Development

New Information Architecture book is awesome

Tags: 

I picked up a review copy (review forthcoming) of O'Reilly's new Information Architecture for the World Wide Web, 3rd edition, and so far it is a simply inspiring book. I'm only fifty-ish into its almost 500 pages but I've already started to brainstorm ideas for a huge improvement to the website at work, which I intend starting shortly after the holidays. Of all of the tech books I've read this is so far one of the best from a general knowledge point of view - the lessons to be learned in this book aren't just for web development, they're for anyone creating any sort of software. While I'm far from finishing it I already would have to count it as a must-read for anyone developing websites, both internal and public-facing, you won't be disappointed!

Why PHP is still an immature language

Tags: 

A thread came up on Slashdot today about the security problems of PHP and software written using it. Given that this is as much of a major problem today as it was five years ago when version 4 was released (that was supposed to start fixing the security problems), and given how bad most PHP code still is today, I added in my own $0.02:

From my experience the main cause of insecure PHP software is developers not turning the error validation to the highest during development, so when an unsuspecting user downloads the software little do they know that their system can and often is wide open to stupid bugs and security problems. When you leave error_reporting to the default setting you miss lots of important details, like array keys being passed as constants, variables being referenced before they're created (especially with arrays), incorrect return types, etc, etc, yet people wonder why their code is so buggy? I was installing vtiger, which is a pretty comprehensive CRM that has lots of potential to hit it big, the other night for a client and was slamming my had against the wall at the sheer number of stupid syntax bugs that were in the system.

How many programs out there tell you to turn on the old register_globals that everyone knew was a huge security problem?

How many programs tell you to turn down the error_reporting level to hide their development incompetence?

I was actually considering starting a movement to have the PHP community clean up their act, we'll see if its still needed after the dust settles from this.

Personally I think that with PHP 5 they should have stopped supporting deprecated coding practices, like accepting invalid variables and invalid array keys, so that this stupidity could finally stop.

That's why I don't do much with PHP anymore, a large portion of the open source projects that clients want you to "make work" are riddled with utterly stupid mistakes that you spend days if not weeks cleaning it up before you can actually start doing any work.

WP-Cache + password-protected pages = problems

Tags: 

I have discovered that, despite recommendations, it is not advised to use the Wordpress plugin WP-Cache if you use password-protected pages as it stops them working correctly. If you turn on WP-Cache and view a password protected page that you have not previously viewed it will cache a copy of the login page and never let any visitors access the content; if you view a page that you have previously viewed before enabling the cache it will cache the full page, letting everyone who views your site see the page. This is not a good way to work, so I recommend simply not enabling this plugin.

Image block rotation using Script.aculo.us

Tags: 

Here's a handle little Javascript function that'll let you rotate a set of DIVs as needed, e.g. to rotate a series of images for a slideshow. It uses Script.aculo.us to do a very simple looking yet quite appealing slide in/out. You'll need to load the prototype.js file and Script.aculo.us' effects.js file before running the code. One thing to note is that you can use any object to do this - DIVs, IMGs, etc, just assign the IDs accordingly, which is useful if you need to rotate entire code blocks and not just individual images. Enjoy!

// Shuffle a series of divs using Script.aculo.us
// Set it up like this:
// var shuffle_list = ['div1', 'div2', 'div3']; // an array of DIV IDs to rotate
// var shuffle_time = 8000; // 8 seconds
// var shuffle_effect = 'blind'; // the effect to us: 'appear', 'blind' or 'slide'
// setTimeout('imageShuffle();', shuffle_time);

function imageShuffle() {
if(arguments.length == 1)
var i = arguments[0];
else
var i = 0;
var next = i + 1;
if(next >= shuffle_list.length)
next = 0;
new Effect.toggle(shuffle_list[i], shuffle_effect, {queue: 'end'});
new Effect.toggle(shuffle_list[next], shuffle_effect, {queue: 'end'});
i++;
if(i >= shuffle_list.length)
i = 0;
setTimeout('imageShuffle('+i+');', shuffle_time);
}

ColdFusion MX 6.1 with Apache 2.2 on Windows

Tags: 

Apache 2.2 was released to a mixed fanfare. While everyone was pleased at the improvements most had to rest on their laurels while their web programming technology of choice was updated accordingly. At the time of writing, PHP 5.1 and 4.4 have an unofficial connector available (unless you want to run the unreleased 5.2 code), Ruby on Rails has several ways of working with it, and many others have received updates. Adobe's ColdFusion MX 7 was given an update which provides compatibility, but the company decided against including (the older though still officially supported) 6.1, so officially users of 6.1, my current employer included, are up the proverbial creek without an equally proverbial paddle. Or so we thought.

Before I explain how I did this, I just wanted to mention that Adobe does not officially support running CFMX 6.x with Apache 2.2, and neither they nor I am responsible if this turns your web server to mush. Proceed at your own risk.

As it turns out, presumably thanks to the wonders of Java binary compatibility, the official ColdFusion MX 7 connector works with ColdFusion MX 6.1, though I had to tweak the instructions a little. Here's what you need to do to get it running on Windows:

  • You'll need both ColdFusion MX 6.1 and Apache 2.2 installed and running correctly.
  • Stop both the Apache and ColdFusion services.
  • Make a backup of both the Apache and ColdFusion directories.
  • Start up the ColdFusion services again.
  • Download the updated connector file from Adobe's site (read the full release instructions if you want).
  • Extract the wsconfig.jar file from the wsconfig.zip file you just downloaded and put it under your ColdFusionMX directory under runtime\lib, e.g. C:\CFusionMX\runtime\lib. It will ask if you want to overwrite the existing file, so click Yes.
  • Open up the command prompt and move to the runtime\lib directory, e.g. CD \cfusionmx\runtime\lib.
  • Enter the following command all on one line:

    java -Dtrace.ci=1 -jar wsconfig.jar -ws apache -dir /apache2.2/conf -bin /apache2.2/bin/httpd.exe -coldfusion -v

    where "/apache2.2/" is the directory you have Apache 2.2 installed. Note that I have both ColdFusion and Apache installed on the same drive so didn't have to give any drive letters, and I used the UNIX-style directory separator (forwards-slash) instead of the Windows-style (backslash).

  • If you got an error message that said
    'java' is not recognized as an internal or external command, operable program or batch file.

    then you need to close your command prompt window, download and install the Java Runtime Environment (JRE) v1.4, and try again.

  • Presuming everything worked correctly you should see the following in your command prompt window:

    Macromedia JRun 4.0 (Build 107948)
    os.name: Windows 2000
    os.version: 5.0
    os.arch: x86
    platform: intel-win
    Extracting resource connectors/installers/intel-win/prebuilt/jrunwin32.dll
    file defaulted
    last modification date: Thu Apr 06 13:07:04 EDT 2006
    size/compressed size: 73728/26315
    to D:\CFusionMX\runtime\lib\wsconfig\jrunwin32.dll
    Created file D:\CFusionMX\runtime\lib\wsconfig\jrunwin32.dll
    findServers(): found server default at 127.0.0.1:2901
    Found JRun server default at 127.0.0.1:2901
    this host is tlcweb:205.241.27.208
    web server: Apache
    web server directory: D:/Apache2.2/conf
    verbose connector logging: false
    apialloc: false
    force resource extract from jar: true
    CFMX: true
    mappings: .jsp,.jws,.cfm,.cfml,.cfc,.cfr,.cfswf
    filter mapping prefix: false
    Using Apache binary D:\Apache2.2\bin\httpd.exe
    Server version: Apache/2.2.3
    Apache 2.2.3 is recognized
    isValidVersion(): Apache is 2.2.3
    Compiled in modules:
    core.c
    mod_win32.c
    mpm_winnt.c
    http_core.c
    mod_so.c
    Parsing Apache configuration file D:\Apache2.2\conf\httpd.conf
    Extracting resource connectors/apache/intel-win/prebuilt/mod_jrun22.so
    file defaulted
    last modification date: Thu Apr 06 13:07:04 EDT 2006
    size/compressed size: 65536/25836
    to D:\CFusionMX\runtime\lib\wsconfig\3\mod_jrun22.so
    Created file D:\CFusionMX\runtime\lib\wsconfig\3\mod_jrun22.so
    getProxyServerUrl(): 127.0.0.1:51010
    Wrote file D:\Apache2.2\conf\httpd.conf
    Added JRun configuration to Apache configuration file D:\Apache2.2\conf\httpd.conf
    Created file D:\CFusionMX\runtime\lib\wsconfig\3\README.txt
    Wrote file D:\CFusionMX\runtime\lib\wsconfig\wsconfig.properties
    Error stopping service. The web server must be restarted to complete this operation.

  • At this point start up the Apache server and try loading a CFM file. :-)

Pages

Subscribe to Web Development