RSS ? Recent Blog Posts

Blogs ยป Archive for April, 2004

Brunch in Zurich next Sunday?

by Harry Fuecks

On the off chance you happen to be in Zurich, Switzerland, next Sunday (25th April) and want to meet up, will be at the station21 gallery for brunch. It’s for the final day of Natalie’s (my partner) photography exhibition.

The gallery is open from 11am to 4pm. Food served from 11 - 2 - enough for about 20 people so if you’re hungry, get there early. Along with photography and general “hanging out”, should be some live jazz. Hopefully the ideal lazy Sunday.

Map is here. From Zurich main station take tram number 14 towards Triemli and get off at Schmiede Wiedikon.

Look forward to seeing you (unless of course you happen to live to the other side of the planet).

 

XULPlanet Overhaul

by Harry Fuecks

XUL Planet got some major updates last week, including a new Scriptable Object Reference (the APIs Mozilla exposes to unpriveliged JavaScript), friendlier navigation, PHP manual-like comments everywhere and lots more. More details here.

 

European Commission Funds Open Source

by Blane Warrene

The Register is reporting today that the Consortium for Open Source in Public Administration (Cospa) has received 2.6 million in funds toward its total cost of 4 million to disseminate, promote and study open source solutions for European govermental bodies who seek more economical means for their technology programs.

The belief is that overall cost will be less and benefit greater than using proprietary solutions in some cases.

This has been a hotly debated topic in the US with advisory firms and think tanks arguing on both sides of the fence over if closed or open source software is more efficient, more economical and sustainable over the long term.

Regardless if you fall on either side of the argument, activities and organizations like this will certainly bring the proof and truth of open source viability to the surface. This author believes that both closed and open source solutions can co-exist and in some cases can be complimentary for difficult requirements.

I am convinced that one advantage open source has in evolving as a more robust and secure platform is certainly the wide open exposure of source code to the community at large to test and improve.

The story can be found …

 

Parameterised SQL Queries

by miseldine

Reading on the forums, this question often arises. How and why should we use parameters in our SQL queries?

First things first. Here’s a parameterised query:

sqlConnection1.Open();
SqlCommand comm = new SqlCommand(”select * from foo where id=@fooId”,sqlConnection1);

// Create a new parameter with the name of the parameter and in this case the value
SqlParameter idParam = new SqlParameter(”@fooId”,1004);

comm.Parameters.Add(idParam);

SqlDataReader dr = comm.ExecuteReader();

Notice, in our SQL statement we place parameters prefixed with “@” where we’d normally enter the raw data. A parameter is then created with the name of this subsitution and the value to be entered.

Advantages

Parametered queries offer several advantages over non-parametered queries. Firstly, they help protect against injection attacks as the way in which SQL parameters are passed prevents the use of apostrophes and hyphens that can be used in such attacks. If coupled with stored procedures too, you can also secure the execution of the procedure with permissions, and any input would need to be in the context of the permission holder.

SQL server will also cache the execution plan of a parameterised query. This means the next time you run the same query, the database will already know how to execute your query in cache, speeding up access.

mySQL and Parameters

But not …

 

PHP and Wireless Access

by Harry Fuecks

Couple of recent articles looking at how to build content for wireless devices (with examples using PHP): Developing Wireless Content using XHTML Mobile and Introduction to WAP using WML, ASP and PHP.

Some random notes;

Opera does a pretty good job of displaying WML (enough so you’ve got a good idea of what it will look like on a mobile). Also there’s a Mozilla WML Browser plugin (currently 0.6 but getting there).

HAWHAW is a very mature library for building WAP/WML apps with PHP. Gives you a DOM like interface for building pages and handles browser detection.

A starting point for Moblogging

Wireless and Mobile @ phpclasses

 

MySQL Evolves into Big Iron

by Blane Warrene

Often the premium database providers used by web developers (among many others) are called “big iron” for their sheer capacity and scale. These would be IBM DB2, Oracle and Microsoft SQL Server (and possibly Sybase).

MySQL is now joining their ranks, announcing today at their users conference in Florida the first fully open source clustering solution, aptly called MySQL Cluster. The firm states this new solution will provide 99.9999% availability for those needing redundancy for critical applications such as e-commerce solutions and more.

Unique to this cluster solution is the dual licensing. Web developers of all sizes will be able to leverage MySQL Cluster under the GPL open source license without cost, while those needing commercial support can opt for the purchased license. This opens up development environments that can now test clustering without the cost of acquiring big iron database licensing (even development licenses from some providers can run between $400 and $1000).

Key to keeping the costs low are hardware requirements. MySQL leveraged the ability to run Linux on standard hardware. This should further seal the appeal to web developers of all sizes. Hence, use of typical Linux servers with decent RPM hard drives …

 

PHP Comes of Age

by Harry Fuecks

Oracle (yes Oracle) have an interesting article up titled PHP Comes of Age which reflects on PHP’s past and makes some insightful observations on “Culture Clash”, PHP being, in many ways, a meeting point for programmers of many backgrounds.

The signs of PHP’s growing maturity and acceptance are definately in the wind. If you believe in straw polls, TIOBE’s Programming Community Index places PHP as the forth most popular programming language, after Java, C and C++ (that index is based on Google searches so take a big pinch of salt). From Oracle’s Hitchhiker’s Guide to PHP to JSR 223 and Zend’s planned US expansion, it seems like PHP has hit critical mass.

The points Philippe Lachaise makes on PHP’s culture are valid. How will long time PHP hackers cope with the switch from “outsiders” to “mainstream”? Will the meeting of different programming mindsets clash or harmonize? Time will tell…

Also: From C++ to PHP - another article by Philippe Lachaise

 

XPath 101

by miseldine

As an addition to my latest article, this entry will show you how to harness the power of XPath by example.

XPath is a query language for XML, akin to SQL for relational databases (ok, loosely akin!) which is used to extract nodes from an XML file.

Let’s take a look at some examples:

Here’s our XML file to parse:

Be Here Now
Oasis
$9.99

Heathen Chemistry
Oasis
$13.99

Let It Be
The Beatles
$12.99

We can use XPath queries through the XmlDocument.SelectNodes method to return a set of nodes matching our query. Let’s set this up:

string fileName = Server.MapPath(”catalog.xml”);
XmlDocument doc = new XmlDocument();
doc.Load(fileName);

Our XmlDocument is now ready to query. Rather than explain the specifics of the query language, I think its better to show by example. The full details of XPath can be found here.

OK, let’s select all the CDs in our catalog:

XmlNodeList cdNodes = doc.SelectNodes(”catalog/cd”);

Easy eh? Notice, we just write out the “path” …

 

Upper case / Lower case functions

by davidjmedlock

…posted by davidjmedlock:

This originated out of some project I was thinking about doing and I though it’d be useful for others. These functions check to see if a character is upper case or lower case:

function isUpperCase(character) {
if (Asc(character) gte 65 and Asc(character) lte 90) {
return true;
}
else {
return false;
}
}

function isLowerCase(character) {
if (Asc(character) gte 97 and Asc(character) lte 122) {
return true;
}
else {
return false;
}
}

#isUpperCase(”A”)#
#isLowerCase(”A”)#
#isUpperCase(”a”)#
#isLowerCase(”a”)#

Have fun with it.

 

More Debate on PEAR

by Harry Fuecks

Via Tobias Schlitt, Alexey Borzov kicked off a huge debate on PEAR quality and standards, part inspired by another discussion that raises a number of very valid issues related to PEAR (Sitepoint Forums regulars will spot a familiar name or two).

On one level I get a little weary of this topic, it seeming to repeat itself without clear resolution. It’s much like talking about template engines in PHP. At the same time, comments following Alexey’s original remark manage to stay fairly focused on specific issues rather than an all out rant, which is encouraging. Question is, what happens when it drops off everyones mental radar? Will specific points be followed up? Will we see additional volunteers willing to submit time to “right the wrongs”?

Just to fragment the debate yet further, some random thoughts on PEAR

- Should use a PHP forum application such as phpBB. Whatever the technical issues (mirroring etc. etc.), one aspect of PEAR is that it’s a community of developers. Mailing lists work for small teams to stay in touch but not much else, IMO. Forums like Sitepoint’s Advanced PHP forums result in a higher level of debate and greater participation. …

 

Sponsored Links

SitePoint Marketplace

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