RSS ? Recent Blog Posts

Blogs ยป Archive for February, 2004

Python Server Pages

by Harry Fuecks

Via Simon’s blogmarksPython Server Pages.

Finally!

Personally think this is great news. Up until now (ignoring third party Python projects which have tried this), mod_python has had an awkward deployment mechanism (much like mod_perl, if you know it) requiring definition of handlers, within Apache. Python Server Pages make it pretty much the same as creating PHP pages – just tell Apache to watch out for .psp files and away you go.

If you’re wondering why I’m talking about Python on a PHP blog, I don’t have a clear answer for you. Python is a very well designed language. For my tastes, perhaps most pleasant to work with, out of the dynamically typed family (e.g. Perl, PHP, JavaScript and Ruby).

As a solution for web applications, PHP has a significant head start over Python, with massive support amongst hosting providers and almost all the functionality you need “ready to go”. Also there’s a huge weight in supporting projects for PHP, as John Lim suggests here.

That said, Python comes with all those things that itch PHP developers, such as support for namespaces and an in-built (i.e. free) mechansim that stores a “compiled” form of your scripts. And things like the distutils

 

Setting Global Objects in Global.asax

by miseldine

From a forum request :)

ASP.NET includes a Global.asax file which exposes many application-wide events which you can use to control your application execution.

It also allows you to define globally-scoped objects. However, a word of caution…as each page in an ASP.NET page runs in its own thread, you need to make sure your objects are thread safe for multiple users requesting your site.

Why is this important? Imagine 2 requests, from user A and user B. Each request runs in a separate thread, and user A manipulates a global object in one thread, and user B manipulates the same object in a different thread. Depending on Windows, these might be executed in any order…meaning your global object won’t be synchronized for both users.

So to avoid this complication, use thread-safe objects, or, of particular interest, use a hashtable as a thread-safe container for your variables:

using System;
using System.Collections;

namespace MyApp.Collections {

public class globalVariableStore{
private Hashtable myCollection;
private Hashtable threadSafeCollection;

public globalVariableStore()
{
myCollection = new Hashtable();
threadSafeCollection = Hashtable.Synchronized(myCollection);
}

public void …

 

ColdFusion Developers Unite!

by davidjmedlock

…posted by davidjmedlock:

Many thanks to Sitepoint Forums member creole for letting me know about the Nashville CFUG (ColdFusion User Group) meeting tonight. I knew that Nashville had a CFUG, but I have yet to attend one due to an extremely hectic schedule. While I won’t be going tonight, I do plan to attend the next one and report back here on what it’s like.

ColdFusion User Groups have always interested me, despite my lack of support for them up until now, because I’ve always wondered what kinds of ColdFusion jobs are available in my area. I noticed that some of the topics that will be covered in tonight’s meeting specifically include employment opportunities, as well as how to interview someone for a development position.

As ColdFusion developers, interviewing others is something we should all learn at least something about. I’ve now worked for two companies where more than just the management was involved in hiring decisions. It’s important for all members of the development team to be acquainted with the serious applicants for a position. These are people that you could find yourself working with on a daily basis, so I feel that management …

 

How do you learn how to use a library?

by Harry Fuecks

Following an interesting discussion on Sitepointforums, a rough poll.

If you’re getting started with some class library, like one of the many in PEAR, which of the following (if any) steps do you take to work out how to use it (and in what order)?

a: Examples package with the code

b: API docs (such as that generated by phpDocumentor or the PHP manual)

c: Reading the source code

d: Any packaged documentation (such as tests and READMEs)

e: Guessing method names (with IDE help) and parameters.

f: Online tutorial (e.g. those on Sitepoint or a developers WIKI)

g: Pair programming

h: Print magazine articles

i: Book chapters

 

Open Source Agenda

by Blane Warrene

With the brilliant minds we have writing on topics such as Cold Fusion, DHTML/CSS, .Net and PHP in the SitePoint blogs, all of which run in some form or fashion on open source platforms, I am hoping to set a slightly different tone for this blog and would look forward to any feedback.

To date you can see my focus has been on some of the cornerstones of open source and web development (Apache, content management, MySQL and staying current on security vulnerabilities).

I am looking to forge deeper into Apache, the database arena, and stay on the lookout for new tools and techniques across the open source universe that help web designers and developers. From time to time I may even touch on administrative issues (mail servers, server management, security issues or notifications, etc.) as many developers double as sysadmin and webmasters.

Your comments are welcome and I look forward to your feedback.

 

Stateful Web Services

by miseldine

I’ve just been on a two day course at the National e-Science Institute in Edinburgh learning about OGSI and Microsoft.NET. Expect a fuller post soon, however, one of the nice features of OGSI is it enables you to deploy persistent state web services automatically (after some basic inheritance!).

Why do you need state? In a traditional web service, and object instance is created, invoked, and then destroyed once the request has been fulfilled. The next time your service is called, a new instance is created, and so on. In this way, web services are stateless: they do not hold on to any information about its variables and properties once they are destroyed.

You can hack together state management. You could serialize the web service and recall this when future requests are dished up. Not only is this hassle, but the process of producing transient services, which have lifetime management (i.e. can live for a set period), and assigning identifiers to manage different instances, so that each user can have their own stated service instance is difficult to achieve in a standardised, modular fashion.

MS.NET OGSI gives you this power, as well as providing an OGSI container implementation for .NET, compatible with the

 

PHP5 Beta4 and XML

by Harry Fuecks

John Lim has been documenting his experiences with PHP5 beta 4 and has some encouraging things to say about performance and simplexml.

With PHP5 now using libxml2 for all XML support, “things” are looking very interesting. Christian Stocker, who works on the DOM extension (and happens to work down the road from me, so get’s harassed…) gave this presentation recently on the new features.

One to watch is what’s happening in this slide. The example doesn’t really make it clear how much potential being able to use streams with XML has but what it means is something like this could be possible;

Where the “Page://title refers” to;

class Page {
var $title;
function title() {
return $this->title;
}
}

…via stream_wrapper_register(). More on that another time.

On the downside, Christian also found a problem with namespaces which he doesn’t have time to fix, meaning PHP5 will probably ship without xml_parser_create_ns(). If that matters to your business, you know who to hire to fix it…

 

HTTP_Digest headed for PEAR

by Harry Fuecks

Looks like that HTTP_Digest implementation I mentioned here is headed for PEAR: Proposal for Auth_HTTP_Digest.

Rui Hirokawa seems to have picked up the ball from Thomas Pike (the original author) and is organising the PEAR version of the package.

Good to see this become part of PEAR.

 

Hacking CMS output with Javascript

by Simon Willison

In Fixing CMS usability issues with Javascript, Nathan Ashby-Kuhlman shares some of the tricks he has been using to get around the restrictions introduced by the content management system used to power his employer’s site.

This is an interesting use of Javascript. Each of the enhancements Nathan has made (such as dynamically allocating a better title to a page containing a news story) would be far better handled by server-side code, but without total control over the HTML produced by the system Javascript provides a useful workaround. Nathan himself has this to say on the subject:

For the record, I hate it when sites depend on JavaScript to display content. But since I can’t control some of the CMS’s HTML directly, JavaScript is really the only tool I have to make these usability improvements. I’d rather some of my site’s visitors have a more usable site, even if I can’t improve it for everyone.

By the way, thanks for all the feedback concerning topics you’d like to see covered here. I’ll be posting more about CSS and layout techniques this week.

 

Scheduling Tasks Without Access to CF Administrator

by davidjmedlock

…posted by davidjmedlock:

Here’s one that was requested when I polled our audience to see what articles our readers would like to see.

If you are on a Unix-based server, you can usually access your server via telnet and set up cron jobs that will automate processes for you. For example, you may want to create a mail queue that retrieves a list of emails to send from the database or a directory and then send the emails. This is essential if you’re sending out a lot of emails, as in a mailing list or newsletter application.

In this situation you may want the email sent out every night, every 30 minutes, or on some other interval. You don’t want to have to log in to your system and push a button. So, you need a scheduled task to perform this work for you.

The problem with doing this is that most of us run our websites from shared hosts where we don’t have easy access to the ColdFusion Administrator, where we would normally schedule tasks for automatic execution.

Have no fear! You can do this …

 

Sponsored Links

SitePoint Marketplace

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

Follow SitePoint on...