Development
Technology related articles.
A Worthwhile Definition of Web 2.0
0The thing I’ve most disliked about the term “Web 2.0″ is that most people use it to define something old as if it were something new. For example, some people have used the term to define myspace.com as a Web 2.0 application. However, they should remember that Geocities offered many of the same capabilities as myspace.com, but has been around since long before the term Web 2.0 was coined (since late 1995, to be exact).
Finally Tom Scott has done a great job underlining the essence of Web 2.0 applications. He describes exactly that part of Web 2.0 applications that is actually new. He also underlines the importance of good URL design and points out that it is even more important than graphic design (and I fully agree), but even good URL design isn’t exactly new. In fact, it’s been the mantra of many since the very beginning of the web, and for exactly the same reasons.
In the end, perhaps the only thing that differentiates these new web applications from pre-Web 2.0 web applications is the effort they put into making their data accessible to other systems. And if this is the case, is it really worth coining a new term to describe it? If so, why aren’t we just calling them what they are: web applications based on open standards? And finally, I don’t think the fact that most emerging web applications are embracing open standards should come as a surprise to anyone since it is a great way to grow your user base.
PHP BBEdit Clipping Set
0I’ve finally updated my PHP BBEdit Clipping Set (formerly known as a glossary). The new clipping set:
- Continues to contain around 6,000 function definitions (whatever is in the official PHP documentation)
- Is based on a recent version of the official documentation
- Allows tabbing between function parameters (very handy…)
- Provides additional information when inserting a function (the return type, for example)
- Optionally includes predefined constants for each function
As always, there are links to instructions for creating your own set (be sure to download the Extras to get the source XSLT stylesheets) and donations are greatly appreciated.
My Google Reader Starred Items List
1Periodically, Russ over at maxdesign.com.au publishes his list of “links for light reading” (an ironic name considering the actual content is usually quite dense). I frequently find several very interesting articles on that list. Not having the time to compile a similar list myself, I looked for a quick and dirty alternative.
Since I use Google Reader I’m in luck. Reader offers the ability to make items “public”. It also allows you to “star” items that then end up on your starred item list. And it offers the ability to merge the two, so, with this blog entry, I formally announce the publication of my starred items list available for your consumption.
Regex for finding quoted strings
0(originally posted to the BBEdit-Talk list, but posting here too since the answer might help others)
I’m looking for a regex pattern that will find quoted strings (double quotes) but skip (double-)quoted strings containing any of the following characters: $, ‘, “, \ (dollar sign, single quote, double quote, backslash)
At first I tried “[^\$'"\]+?” but it was matching the end of one quoted string and the beginning of the next, so I’m clearly missing something.
Regexes in Depth: Advanced Quoted String Matching was helpful, but didn’t explain how to negate strings containing the characters above.
Strings that should fail to match:
// contains quotes
$str = "`zcol ACOL` NUMBER(32,2) DEFAULT 'The \"cow\"
(and Jim''s dog) jumps over the moon' PRIMARY,
INTI INT AUTO DEFAULT 0, zcol2\"afs ds";
// contains dollar signs, backslashes and single quotes
ADOConnection::outp( "
-- $_SESSION['AVAR']={$_SESSION['AVAR']}",false);
// contain single quotes
if (strncmp($val,"'",1) != 0 && substr($val,strlen($val)-1,1) != "'") {
Strings that should successfully match:
$myvar = "this is my quoeted ".$and_another_var." and another string";
Also, quoted strings should not be preceded with a backslash.
I’ve read and reread the BBEdit docs (which are great) but I’ve been unable to come up with a method that passes all of these tests.
I never had any idea this could be such a complicated problem. Does anyone see what I’m missing?
Update
Matching negative character classes is prone to difficulties because it’s hard to manage what comes before and after the class. That’s why I ended up using the following, which worked more or less well for me and avoided matching properly quoted strings inside HTML.
(?s)(?<!name=|action=|align=|valign=|width=|height= |nowrap=|scope=|class=|id=|style=|type=|value=|method=|border= |cellspacing=|cellpadding=|colspan=|size=|maxlength=|for=|label= |rows=|cols=|wrap=|language=|href=|version=|fuse=|charset=|src= |alt=|title=|xmlns=|http-equiv=|rel=|content=|rowspan=|checked= |accept=|face=)(?<!\')(?<!\\)(?<!\?\>) "((?!\.|,|, | ,| , |\. | \. |:| :|: | : )[[:alnum:] \-\_\.\,\:\%\@\<\>\?\(\)\*/]*?(?<!\\))"
Update 2
Give me a break! Here’s the solution to this problem: matching quoted strings.