RSS ? Recent Blog Posts

Blogs ยป Archive for May, 2004

Maintaining state within anonymous functions

by Simon Willison

I had a bit of fun with JavaScript on my personal blog over the weekend, pulling together a number of topics which I’ve covered here and in articles on SitePoint. The challenge was to provide a way of linking to any paragraph within a blog entry. The solution I came up with ended up using an unobtrusive JavaScript script, a bookmarklet and some CSS as well. You can read all of the gory details in the entry, but I’d like to dissect the bookmarklet further here.

The aim of this bookmarklet (entitled “add plink IDs”) is to find all textareas on the current page that appear to contain HTML and to then add ID attributes to any paragraph tags in the textareas that do not yet have them. For example, the following HTML:

<p>This is a paragraph.</p>

<p>This is another paragraph.</p>

Would become:

<p id=”p-0″>This is a paragraph.</p>

<p id=”p-1″>This is another paragraph.</p>

Here’s the full bookmarklet I used, indented for readability:

javascript:(function() {
var tas = document.getElementsByTagName(’textarea’);
for (var i = 0; i < tas.length; i++) {
var ta = tas[ i ];
var text = ta.value.replace(’<p>’, function() {

 

Cool ColdFusion things…

by Eric Jones

One of the coolest things about any coding language is watching people take it from one area (the web) to another. For example php’ers have hooks into the GTK tool kit which gives them the ability to build GUI applications for the desktop etc.

Well recently two cool ColdFusion items have floated up from the net and onto my browser.

The first is a guy on the CF-TALK mailing list who’s made a CF app run from a CD using various software packages. You can see the initial thread here, and see his online documentation here. That second URL might not work all the time, as i think the developer is hosting it at home. Im sure you can see the marketing advantages this will have. Think mini-CD’s and promotions.

The second item is a software program which will allow you to create and run desktop ColdFusion applications. CORAL is a nice little application that frees you from the web. It allows you to develop and deploy your ColdFusion applications in a variety of ways including the desktop. This is nice because it free you from having to pay for a CF license every time you want to …

 

XP SP2 and Your Web Site

by miseldine

This doesn’t affect just ASP.NET developers, however the article concentrates on Microsoft technologies.

How to Make Your Web Site Work with Windows XP Service Pack 2 shows what you need to do to be prepared for the changes to Internet Explorer, principally how to design safe pop-ups.

XP SP2 will be pushed to all current XP users, so every web developer should at least give these new guidelines an overview.

 

Using JavaScript for Presentation

by Simon Willison

My latest article, Rounded Corners with CSS and JavaScript, has just been published. It goes over various methods for achieving rounded corners, including an old-school table hack, two CSS methods and a new technique that uses JavaScript to modify the DOM and provide extra CSS hooks.

This kind of presentational JavaScript is something that hasn’t seen much discussion yet. Since JavaScript can make arbitrary modifications to a document’s structure after the fact, all manner of presentational tweaks can be achieved. The obvious question is whether or not this is a good idea; after all, JavaScript is traditionally used to add behaviour to web documents with CSS used for the presentational aspects. The problem is that while CSS is a powerful technology it comes with its own limitations – such as the inability to apply multiple backgrounds to an element as discussed in my article. JavaScript lets us avoid those limitations without having to add extra cruft to the underlying markup.

In my opinion, this kind of presentational JavaScript is fine so long as it doesn’t result in inaccessible content for user agents without JavaScript support. The rounded corners technique is an ideal example: browsers without JavaScript only miss out on a …

 

A Quick Way to Improve Client Relationships and Your Own Capabilities

by Andrew Neitlich

Here’s a challenge for you. If you take it, you will improve your client relationships and your own capabilities. However, it takes guts to do this and I understand that most of you won’t.

1. Find an impartial colleague who you trust and who is professional.

2. Have that individual contact each of your current and past clients (or most of them). Send a letter/email letting your clients know they will be contacted.

3. Have your colleague ask these questions about you (after a professional introduction stating that you have engaged him or her to learn how to improve your service, and asking if they would prefer responses to be confidential or shared):
- What 1-3 things did they like most about your work?
- What advice would they have for you to improve — in terms of quality, process, communication, attitude, professionalism, etc.
- How do you compare to other Web professionals they might have engaged before? What are relative strengths and weaknesses?
- What do they say about you to colleagues? Why?
- Would they recommend you to colleagues?
- Would they engage you again?
- If they were going to write a marketing slogan describing your company, what might the slogan say? (Or, how do they perceive …

 

The garbage you can’t dispose of…

by Harry Fuecks

Looks like Jeff’s made an unpleasant discovery while exploring Rephlux and PHP memory usage in WACT.

Adding the following to WACT’s unit test suit (which basically executes everything WACT has);

foreach (array_keys($GLOBALS) as $key) {
echo “$key=” . strlen(serialize($GLOBALS[$key]));
}

This shows up: ‘_PEAR_destructor_object_list=146270′

To support this gem, PEAR puts a reference to every object instance ever instantiated that inherits from PEAR into the global variable _PEAR_destructor_object_list. There the object stays until the deconstruction shutdown function is called. This reference prevents garbage collection of any of objects inheriting from PEAR or the memory they reference during the lifetime of the script. And it does this for no good reason at all.

The file in question is PEAR.php. And in fact I’m the guilty party for having extended from it in XML_HTMLSax (now gone with latest 3.0.0 release).

My guess is there are other projects like PhpDocumentor and anyone doing “build-like” tasks via cron, using PEAR code that could also do without donating memory to no good purpose. For PHP web applications it’s likely less of an issue but it’s still wasted overhead.

Perhaps while PEAR package developers …

 

SSL Comparison Chart

by Blane Warrene

There are numerous threads in the SitePoint forums on the use of ssl and e-commerce. In researching a future column for SitePoint – I cam across this great comparison matrix at SSL Review showing the price, product, stability and several other factors for choosing an ssl certificate.

Please us this url below to see Google cached page:

In Google search box – type “cache:http://sslreview.com/ssl-certificate-content/ssl-compare-table/index.html”

When it comes to securing a server or multiple servers – the key is to know your requirements. In some cases, a sophisticated commerce site handling transaction either of great value or in high volume would require an enterprise ready ssl certificate with extensive fraud control. However, a site handling light volumes of low cost transactions could save money by using a certificate from FreeSSL, which offers very economical options.

Finally, for those needing multiple certificates on sub-domains all under one primary domain – the best bet is a wildcard certificate. These enable administrators to setup numerous domains, such as sub1.domain.com, sub2.domain.com, sub3.domain.com and so on, with one ssl certificate.

These range anywhere from $200 and on up. They can be useful if you host many clients, but provide ssl services under one standard domain, giving each client a …

 

PEAR:: HTML_Template_Report Draft

by Harry Fuecks

An interesting draft proposal for PEAR up amongst the package proposals right now – HTML_Template_Report. Draft status means the author is interested in getting feedback on the proposal as potential PEAR package – nothing is fixed at this time.

Think it’s an interesting idea – to me what’s being suggested is something like a spreadsheet – you begin with some raw data (such as a database result set) then transform / aggregate it into a document humans can use.

Think it relates to a discussion we had in Sitepoint’s Advanced PHP forums asking Are PHP apps fundamentally data driven?. One particularily striking comment there, from Jeff;

{in PHP … the typical “flow” of a request is DB > Query > Transform Data > Render to Browser. Data has to get to the final stage as quickly as possible, given no mechanism to store it in memory.}

think of this as document driven and perhaps it will make more sense. The “document” can be the data. document doesn’t have to mean XML/SGML derivative.

For example in WACT, the dataspace interface represents a document in “PHP variables” Format. PHP’s associative arrays make a pretty flexible “document.” In WACT, the database classes generate …

 

Messing with the PrintJob Class

by sgrosvenor

Its the same with anything, until you need to use the functionality of a given class or object in a project, you never delve into it unless you’re an ardent explorer type person!. I found the need to quickly explore the printing capabilities of Flash MX 2004 and was pleasantly surprised.

In Flash MX 2004, the new PrintJob class is much more powerful than the print() and printAsBitmap() functions in previous versions, allowing you to print individual MovieClips, sections of MovieClips (using print area parameters) or entire levels with simplistic ease.

In the example outlined here (source code found here), I needed to quickly print out a given number of MovieClips from the stage (example shown below).

ScreenShot of Stage

I created the following function to pass in a simple array of MovieClips allowing me to add multiple pages to the print queue.

function PrintWhat(WhatToPrint:Array) {
var PrintQueue = new PrintJob();
var PrintStart:Boolean = PrintQueue.start();
if (PrintStart) {
for (i=0; i

 

Another Database Joins Open Source

by Blane Warrene

As many of you probably already saw today, CA (Computer Associates) joined the open source fray by announcing plans to release the core of their Ingres database code under an open source license.

Interestingly, CA is not using the dual license structure that MySQL uses – which is of you distribute MySQL in your application and it is free – then MySQL is free. If you build a proprietary application and distribute MySQL – you have to pay.

CA only will require developers to share changes they make directly to Ingres, with no concern over any apps built on top of the db platform.

According to an interview with Maurice Donegan, director of product marketing for databases at Computer Associates International, with eWeek, the company is reviewing the entire codebase to insure no borrowed or non-CA code is in the release. This will limit any risk to users whod ownload and use Ingres from potential future lawsuits.

I find it interesting that companies of substantial size are moving toward the open source arena, even if with ancillary applications. This reinforces the notion that Linux and open source are gaining traction in traditional corporate markets. Companies that are heavily leveraged in …

 

Sponsored Links

SitePoint Marketplace

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

Follow SitePoint on...