KBD

Keith Devens .com

Friday, August 29, 2008 Flag waving
Your best? Losers always whine about their best. Winners go home and fuck the prom queen. – John Mason (The Rock)

Archive: July 13, 2003

← July 12, 2003July 14, 2003 →

Daily link icon Sunday, July 13, 2003

Bug in PHP 4.3.2

Without notice, some subtle behavior changed in PHP 4.3.2. It got borked somewhere along the way with this bug though I haven't checked the actual CVS commits to see what happened. Here's the page in the PHP manual that covers this. And here's some sample code:

<?php
#example from the manual:
$fruits = array('strawberry' => 'red''banana' => 'yellow');
echo 
"A banana is $fruits[banana].";
# $fruits[banana] interpolates into the string
?>

I used to have code like this:

<?php
header
("Content-type: $h[content-type]");
?>

But as of 4.3.2 that no longer works and causes a parse error. In fact...

<?php
$header
['contenttype'] = 'roar';
$header['content-type'] = 'roar';

echo 
"Content-type: $header[contenttype]\n"#works
echo "Content-type: $header[content-type]\n"#causes a parse error
?>

So, non-identifier characters cause the problem. You'll have to change your code to look like one of these:

<?php
echo "Content-type: {$header['content-type']}\n"#works
echo 'Content-type: '.$header['content-type']."\n"#works
?>

And what do we learn from this? The importance of automated test suites.

Understanding XML

Dare Obasanjo has an article at MSDN entitled Understanding XML. It seems to be a great intro to all things XML from someone who's deep in the pile of squishiness that is XML -- his "current day job involves designing a lot of what will be the core XML APIs for the next version of the .NET Framework."

The only thing that bugs me is that as much as I generally dislike XML, I keep talking about it. "XML brings us one step closer to universal data access." -- what does that even mean? That if everything is XML, XML will be universal? God help us.

Also see Lessons from the Component Wars: An XML Manifesto

Pop 'N Music

Uhhhhhhhhhhh......

I've never seen a game like that.

XML vs. Programming Languages

Read Sjoerd Visscher's Programming vs. XML.

The API discussions during the last week showed clearly that a lot of programmers are not ready for XML. They prefer XML-RPC because they want to send and receive data structures that are in native form for their programming language. Yet everybody seems to agree that when you are creating a new data format, it should use XML.

For this friction to disappear one of two things has to happen: Either the programming languages change to match XML better, or the other way around.

In the end I think XML will win. The data structures in programming languages are designed to match the computer's memory model. XML's data structures are a result from it's syntax.

I'm sick of all the attempts to integrate XML natively in programming languages. (to be fair, some of those links point to different links referring to the same technology (like XML in ECMAScript and CDuce), but I still feel like I've missed some of the things I've heard about).

Maybe XML will win. But for XML to win and infect all of our programming languages, it would seem to imply that all of our programming languages have been missing a native XML construct for all these years. Quite the contrary, I think. With XML they went and defined a markup language that seems to try to do everything possible, including mixed content and strange XML structures that wind up creating an "ordered multi-map", all of this giving you a monstrosity that I can't imagine any language needing (except of course, just to deal with XML). It just seems a shame that ALL this work is being done on XML to support a data model no one's really ever used much before just because some people wound up creating a syntax that implies this structure. And it doesn't seem like anyone's yet come up with a really good way to process this mess.

I don't know whether this "mixed-content-capable ordered multi-map" data structure will really be useful in the long term. I think it's overkill. Brett Morgan seems to agree:

I think XML will turn out to be yet another silver bullet that was basically useless.

I think programmers do want to have data wind up in their native data structures (this doesn't mean I'm advocating RPC). Consider Mark's example of generating XML. That's about the nicest way I've seen to programmatically generate XML. But I'd much rather just give a dumper a native data structure and have it work, and have a loader take some markup and wind you up with a native data structure.

For document oriented markup, XML's fine. Documents are complex, and documents were SGML's main target area. But most XML data I see besides XHTML is data-oriented markup, and the data programmers deal with is made up of lists and associative arrays. I've never wanted an "ordered multi-map" before, yet this is what XML is giving us. On the one hand, I'm reluctant to say "Obviously what we have now is fine because that's what's evolved after all this time" because computer science is relatively young, and maybe this "ordered multi-map with mixed content" that XML defines will be useful. But I don't think so.

See an example of Why Markup Languages Matter, which I agree with. I just think we have to keep in mind that XML isn't the ultimate markup language. It can be used for many applications only because it's a jack of all trades (I hate to use the cliche) and a master of none. I think for many applications it's better to use a more targeted markup language.

Conservative Left Turn

Via Josh Claybourn, NRO: Left Turn: Is the GOP conservative?:

The news this summer has been rather bleak for conservatives. The Supreme Court first decided to write "diversity" into the Constitution. A few days later, it issued a ruling on sodomy laws that called into question its willingness to tolerate any state laws based on traditional understandings of sexual morality. In neither case was there much pretense that the Court was merely following the law. At this point it takes real blindness to deny that the Court rules us and, on emotionally charged policy issues, rules us in accord with liberal sensibilities. And while the Court issued its edicts and the rest of the world adjusted, a huge prescription-drug bill made its way through Congress. That bill will add at least $400 billion to federal spending over the next ten years, and it comes on top of already gargantuan spending increases over the last five years. The fact that a pro-growth tax cut is going into effect this summer hardly compensates for these developments - especially since expanding entitlements threaten to exert upward pressure on tax rates in the future.

Free command line development tools from Microsoft

Bruce Eckel has some neat bits about developing in Windows using Microsoft's freely available command line tools. In particular, see Free Visual C++ Command Line Tools from winprog.org:

Microsoft has quietly released it's command line compiler and linker tools as part of the .NET Framework SDK. The Framework SDK comes with everything you need to for .NET development (C# compiler etc...) including the command line compiler cl.exe which, while it's intended for use with the .NET framework, is the same compiler that comes with Visual C++ Standard.

Since this is the .NET SDK, it doesn't come with the headers and libraries required for Win32 API development, as these are part of the Platform SDK. Lo and behold, the Platform SDK is free as well. You only need the Core SDK, but feel free to download the other components as you desire.

As a bonus, if you download the Platform SDK documentation (which I highly recommend) you will have a complete local and up to date Win32 reference which is MUCH easier to use than MSDN online.

Cool.

← July 12, 2003July 14, 2003 →
August 2008
SunMonTueWedThuFriSat
 12
3456789
10111213141516
17181920212223
24252627282930
31 



RSS feed RSS feed for Keith's Weblog
Atom feed Atom feed for Keith's Weblog
Weblog archive
Recent comments
  on 2 posts

Recent comments XML

new⇒Johnny Walker Blue Label

Do let me dive in.. :) 

As an​accomplished imbiber with a full​set of op...

mitch shrader: Aug 29, 3:07pm

Girls, please don't get breast implants

Wow, After all this time, the​comments on this page continue to​grow. It wa...

Ajeet: Aug 25, 2:36am

Generated in about 0.065s.

(Used 7 db queries)

mobile phone