RSS ? Recent Blog Posts

Blogs ยป Archive for March, 2004

Conditional Class Declaration – bad practice?

by Harry Fuecks

Was perturbed to read one on the comments on Zend’s PHP5 – Ask the Experts;

Q: In PHP 5 (rc1-dev)… is there any reason why you can’t do this?

if (!defined(’SOMETHING’)) {
class HelloWorld {
….
}
}

A: This is a problem we know about. In general, we don’t recommend doing conditional declarations of classes because it isn’t a very good programming practice. However it is yet unclear, if it will be supported, and it might be.

OK – in general to declare classes conditionally, for no other good reason than because you can, is probably a bad idea.

But as I was advocating here, there are very good reasons, IMO, why conditional declaration (i.e. conditional includes) are a good idea, the #1 being so that you can reduce the code “footprint” being included on every page request, when running your app on a typical shared PHP host (where PHP accelerators generally aren’t available).

 

New article online

by miseldine

Just in case you read the .NET blog through your aggregator (and if not, why not?!) you might have missed that a new article is available at Sitepoint.

One of the top requests I receive as the ASP.NET columnist is a back to basics look at XML and how it can be used with the .NET framework. To some, this is 2nd nature, to others it is a daunting technology surrounded in a cloud of buzzwords and weird looking symbols.

Remember, if there’s some technology you’re having difficulty with, just add a comment to this blog or send me an email and I’ll see what I can do to help!

 

Drag and drop with Javascript

by Simon Willison

Walter Zorn’s Drag & Drop is a DHTML API which makes it easy to add extensive drag and drop functionality to any element on a page. The API supports dragging and resizing and also provides Javascript methods for programmatically moving and resizing elements. It works on an impressive range of browsers right the way back to Netscape 4 and has options that include limiting the area within which an item can be manipulated and restricting resizing to maintain the initial ratio of width to height of an element.

I’ve previously used DOM-Drag, a similar library by Aaron Boodman, to create user interfaces that allow users to set the order of items by dragging them relative to each other. Aaron recently updated DOM-Drag’s documentation to include even more examples.

I prefer DOM-Drag’s API over Drag & Drop’s as it uses smart object orientation to provide hooks for performing additional actions when drag related events occur. Drag & Drop’s API is less flexible but the library provides resizing support out of the box and has compatibility with older browsers. I recommend trying out both before picking one as a starting point for your own scripts.

Walter’s site has …

 

Windows Mobile 2003 Second Edition

by miseldine

Any of you out there developing applications using the .NET compact framework might be interested to see what’s coming in the 2nd edition of the latest mobile operating system, Windows Mobile.

As well as introducing VGA screen support, new sound and notification events, one of the neatest productivity enhancements is that you can use your PDA in landscape mode. Sometimes, applications just fit easier in this orientation (esp. large grids etc.).

Brighthand have a thorough run through of what to expect:

http://www.brighthand.com/article/Overview_of_Windows_Mobile_2003_SE

 

Simpletest Docs Online

by Harry Fuecks

Just FYI, Simple Test (PHP’s #1 unit test framework, IMO) now has some finely crafted API docs online at http://simpletest.sourceforge.net/, including all the tutorials. Wanna know what Mock Objects are? Look no further.

Apparently the docs takes advantage of some features only available in the latest release of phpDocumentor and they’re looking very slick.

 

Security Enhanced Linux

by Blane Warrene

Operating system security is (or at least should be) of critical importance to us all. However, the varying levels of security required differ for each systems administrator.

For those who seek enhanced, tightened security control over their Linux systems, SELinux may be the answer. Standing for Security-Enhanced Linux, it is a result of research projects from the NSA (National Security Agency) in the US and focuses on mandatory access controls which offers powerful controls over users and devices as well as applications and services.

SELinux is released as a set of kernel patches which wraps into an existing Linux installation. The NSA states they have tested it successfully only on Red Hat.

In thet same vein, the Red Hat community has just announced integration with SELinux into its latest test release of Fedora (core 2), the replacement for Red Hat’s Professional series of distributions which ended with version 9. Red Hat facilitates the Fedora project but does not officially support it. However, it is obvious the goal is to test out and find the best improvements that can then make there way into Red Hat’s official Enterprise Linux products.

The NSA defines the difference between …

 

Open Source ColdFusion Projects

by davidjmedlock

…posted by davidjmedlock:

This is pretty cool. SourceForge is a huge (the largest, I’m sure) open source software web site. There are thousands of projects hosted there at SF and a surprising number are ColdFusion Projects. I expected to find only a couple of projects, maybe 10 or so, but when I do a simple search under Software/People, I come up with about 3 pages worth of projects, from business application toolkits (calendar, address book, contacts, etc.) to content management systems to IP country look ups.

So, my resolve is to get involved to some extent with the open source community. I’m in the process of getting a couple of commercial products out, but I feel like I should contribute to the open source community as well. Shouldn’t you? Get started at SourceForge!

 

Version Control and Web Development

by Blane Warrene

CVS, or the Concurrent Versions System, allows for a robust version control system to be in place to insure control over changes to a web site as it is being designed and developed, during testing and qa and post-production during content management and improvements.

While there are many web developers using cvs, it is mostly known for its use in software development projects. However, conisdering the dynamics of the 21st century web site, and the proliferation of web applications, cvs should be a consideration even for the independent developer who occasionally uses sub-contractors for projects.

CVS, found here, is generally already installed on your *Nix servers, including OS X. Clients are available for numerous platforms (Windows, Macintosh and *Nix), and are built in to some web development IDEs (such as Macromedia Dreamweaver). The CVS home also includes extensive documentation on how to use cvs on your server.

There are three pieces to getting started on a cvs project:

1) If starting a new cvs repository with existing files, you should do a master backup of the code, import it into a new cvs tree, and then delete the old directory. This insures you will not accidentally edit cvs and …

 

Flexible Floats

by Simon Willison

Dunstan Orchard has an interesting twist on the floated image gallery technique, originally introduced by Mark Newhouse back in August 2001 (was it really that long ago?). Floated image galleries use floated thumbnails to create a layout that appears to use table style columns, but dynamically reorganises itself as you resize the page. Dunstan’s variation uses Javascript to cause the individual floated element widths to increase to take up the additional space made available when only one column of elements are displayed at a time. It’s difficult to describe, but makes perfect sense if you play with his reading section for a short while.

This is an excellent example of Javascript being used to complement CSS in an inobtrusive manner, as browsers without Javascript support will still get a functional and attractive site, minus a small visual improvement if they are surfing with a smaller browser window.

It’s also interesting to see how Dunstan’s technique has evolved after feedback from readers of his blog. Read all about it in Flexible floats, Flexible floats 2 and Flexible floats 3.

 

Handling content from strangers

by Harry Fuecks

One thing that makes web development both fascinating and exhausting is how the same subjects keep popping up, over and over, without resulting in any clear answers. One the one hand it’s remarkably easy to put up your own website. But building a site capable of handling a lot of traffic, and is easy to change and modify is not so easy.

What’s got me started is this recent blog by Sam Ruby, owner of the job to die for, at IBM, to whom PHP can thank for the Java extension, who’s been a member of the Apache group and has had a part countless other web innovations and groups.

The issue? How to publish content submitted to your site by it’s visitors. Solving this is one is as old as that most dated of web apps – the Guestbook and if you trawl through the comments on Sam’s site, you’ll quickly get the idea that still, no ones too sure of the answer.

The basic problem, as you no doubt know, is to allow visitors to your blog or forum to submit more that just plain, unformatted text, you need to allow them some kind of mechanism to add …

 

Sponsored Links

SitePoint Marketplace

Buy and sell Websites, templates, domain names, hosting, graphics and more.

Follow SitePoint on...