Well, Well, Well – WordPress 2.7

Posted by on November 24, 2008

WordPress 2.7-beta3-9863, as its name suggests…is a landmark update for WordPress.

Dashboard at a glance

wp-admin dashboard

Besides the new layout, there are other changes obvious in the first 5 minutes:

  • A new “Quick Press” section – I-’m writing- started writing this post using it.
  • Ajaxy accordion widgets replace the top-nav sections in the new sidebar menu.
  • Sidebar can be minimized a la photoshop toolbar – child items pop-out on hover.
  • Totally new(rockin’) icon set – apparently they had a contest – grats “BD”
  • Did I mention the Ajax?? I don’t mean to be a web2.0 fanboy here – but honestly – UI design can make or break the experience…and unfortunately it’s more often breaking it.

No sooner than I say I’m not a web2.0 fanboy as I mentally say “Ooooeee!” upon noticing that the boxes can be repositioned via drag-and-drop. That’s, like, web2.0 meme numero uno.

using the drag-and-drop widgets

Editing content

Viewing the list of my posts I noticed two things: An alternate view of posts that shows excerpts(just in case you don’t use the most descriptive titles), and the ability to “quick edit” the titles, categories, and a few other things about the post. Unfortunately you can’t edit the body of the post without clicking ‘edit’.

excerpt-with-quick-edit

Revisions

This might have already been there – but revisions are great. At the bottom of the “Edit Post” page you get this:

post-revisions

Clicking one of the links takes you to a page showing the text of your post along with an array of radio buttons for all previous revisions and their restore links. Talk about handy.

Overall

I’m very very happy with the upgrade. I know WP updates don’t come with much fanfare – but this one was touted as having “major improvements”. I certainly think they came through.

There are some minor issues – browser related positioning errors and what-not – but I’d expect an official launch in the very near future.

Want what I have?

If you’d like to upgrade, you can just visit Tools>Update and get the “Nightly build”…Or, if you’re like me, and prefer to handle your upgrades with Subversion(it’s easier to go downgrade, faster to do multiple blogs, and simpler to merge your customizations with upstream code) – then you’d just ssh into your blog directory and…

If you are already tracking trunk(then you probably already know this):

svn update

OR

If you are tracking the latest stable version, but want to try the new stuff:

svn sw http://svn.automattic.com/wordpress/trunk/ .

If you hate it and want to switch back:

svn sw http://svn.automattic.com/wordpress/tags/2.6.3/ .

OR

If you don’t have a WP blog yet and want to get started with the latest stuff or don’t have anything in your media gallery worth keeping(you could always back that up) – and haven’t made any customizations to WP themes(again, you could always back those up). Basically if you don’t yet have your WP blog under revisioning, and need to get started with svn:

svn co http://svn.automattic.com/wordpress/trunk/ .

Enjoy!

Somewhat Serendipity

Posted by on November 23, 2008

Usually the word serendipity(as I hear it most often) is used to suggest that there was meaning in coincidence. Something unlikely that, simply because it occurred to the person in question, is somehow filled with meaning beyond chance.

Upon consulting the Wikipedia – I was relieved to find that the definition of serendipity didn’t exactly fit.

Serendipity is the effect by which one accidentally discovers something fortunate, especially while looking for something else entirely.

Last night, after we devoured a Chinese food feast – we each opened our fortune cookies. Everyone who has ever opened a fortune cookie knows it is very much like reading a horoscope, having your palm read, or consulting a crystal ball. Sometimes, most of the time, you can interpret your fortune to be “OMG that’s totally me!”.

Since we were, in fact, expecting fortunes – it really can’t be called serendipitous… but they did make us all feel sweet, so I thought I’d share.

Freya’s fortune

Life to you is a dashing and bold adventure.

Now that’s a well written fortune. Freya does live life as an adventure – “adventure” is what we call just about anything that involves leaving the house…

Laura’s fortune

You have a strong desire for a home and your family comes first.

Laura is all about making a home for our family. She sacrifices endlessly for us.

My fortune

Your present plans are going to succeed.

Perhaps the most like your usual fortune – but still being that I’m uber stressed about a project that I don’t want to fail…needed reassurance. I guess I’ll take what I can get at this point.

I guess it goes to show – things don’t have to have meaning to be nice.

Is this "Less Fail"? Why I’m Replacing Typo

Posted by on October 21, 2008

Typo is blog software written in Ruby, and available as a gem for Rails. It’s what is currently running this website. It’ has it’s pluses but over time it’s grown aggravating to me. I’ve decided to move on to another platform, but I’m not sure which at this point.

If by the time you are done reading this post you feel like Typo would be a good fit for you, you can download Typo and try it yourself. I’m by no means the expert in these matters, and what might not work for me might be right up your alley.

Why I picked Typo in the first place

When I was originally looking for a blog software to use I had these basic requirements:

  • Not what everyone else was using(Wordpress, Blogger)
  • Not written in PHP

I didn’t want to use what everyone else was using because in most things – I like to be different. The fact is that I am different from most people, and I tend to make that known.

I wanted to use a product that was not written in PHP because as an aspiring programmer, I’d rather be using a more cutting edge language like Ruby or Python. Not only is the code of Ruby/Python easier to write and the languages more interesting, but the jobs you get when you know them pay very much more than with PHP, whose programmers are a dime a dozen. I’m not saying that it’s not worth knowing – indeed PHP may be the most useful language to know due to it’s ubiquity. Also, I don’t want to offend any of the PHP programmers who may be reading – I’m envious of your skills(read: skillz).

Ok, so why Typo? Well looking back I didn’t look into things all that well. I ended up turning all the negatives into positives which isn’t a very smart thing to do. At some point, mostly for very shallow reasons I decided that Ruby was a little cooler than Python, so having eliminated all of the Python blog software(there aren’t many) I had a very very short list to choose from. When I tried the demo of Typo I was fairly impressed by the admin interface. Also even though there were very few themes available, I really liked the one I have applied here(scribbish).

What I don’t like about Typo

Lack of community

One thing about open-source software is that it really needs a large and active community. This is extremely evident when you start using projects like Drupal, Ubuntu, Eclipse, and so on. Typo is not like that at all. It’s basically just one person developing with a few other making commits. This really leads to nowhere fast.

If you read the first blog post I wrote on this website you’ll see the difficulty I encountered just getting up and running. This was due almost entirely because of Typo development that wasn’t keeping pace with the development of it’s fundaments – Ruby/Rails. Even after working around the issues I was having, an entire section of my admin area is broken. Looking in the svn repo for Typo I’ve found that there is an experimental branch for Ruby 1.8.7, but it’s pretty clear that it’s not going to be finished before Ruby increments again.

Lack of features

Obviously since this is an open-source project, this is intimately tied to the lack of community – but there are things that should have been available at the outset. For example: users(myself included) cannot log into the public side of the website. This makes it very annoying for commenters – having to retype their info each time, and not being able to edit their comments – but also for me If I want to edit anything I have to do it from the admin side.

Another feature missing that is somewhat related to front-side logging in is a feature that I first saw in WP – private posts. The ability to make a post that only permitted users can see is essential for the entire concept of weblog. The idea that everything I publish should be public is ludicrous.

Plug-ins. Again, because plug-ins are almost by definition community contributed I wouldn’t expect to see too many of them – but the number available is really pathetic. Less than 20 are available, and almost all are totally useless to 99.9% of people on the internet.

This brings me to my next point:

Why I’m dumb

I managed to turn every one of the things I’ve identified as negative about Typo into a positive.

Q: Don’t you want to use a product with a huge community? A: No, I want to be different!

Q: Don’t you want to have thousands of plug-ins available? A: I’ll just write whatever I need!

Q: Don’t you want blogging to be easy? A:

So yeah, now I realize that if you want to actually, say, write blogs then you have to have the time to do that. I want to learn Ruby – of course – but I want to write quick blogs about my accomplishments too. Starting a blog as a learning project means you have neither a blog or a project – just a bunch of stagnation. In my case I opted to write blog after blog and never have the features I wanted, feeling pissed off all the while. not good.

So, what to use now?

Honestly I’m leaning towards WordPress. It’s the obvious choice for obvious reasons, but until I have a couple hours to look again at all of the(free, open-source) options – I can’t make a final decision.

I’d still like to look at Ruby/Python blog softwares, and this time not because I want a pet project. I’ll look at performance issues – I know that Ruby, but especially Python will outperform PHP, but after caching is taken into account the difference may be negligible.

I don’t think WordPress is inherently insecure – as some assert it is due to it’s open-source nature(unlike windoze, which is SO secure!), but it might be vulnerable due to it’s high usage and therefore high rate of attack(just like windoze!). But that’s all anecdotal – I don’t know security in general much less the minute details of the WP code.

Mephisto is another Ruby blog, but it looks like it suffers from the same problems as does Typo. I’d love to do either one of these if I could get paid to work on them.

Anyway…I’ll just keep looking around for now. Post a comment if you want to make a suggestion! (Sorry it won’t remember your user info and I won’t be notified of new comments)

Henry’s Widgets: A Practice in XML/XSLT

Posted by on October 19, 2008

Since attending HighEdWeb 2008 and going to Jason Woodward’s Workshop on XML/XSLT, I’ve been really interested in the possibilities of using XSL to tranform a well-formed XML file into almost anything – especially another type of file, such as XHTML.

This topic is totally new to me, and I’ve never had the chance to use it in a real life scenario. I have played around a little bit with a hypothetical exercise though, and wanted to post my solution for others to use, and hopefully, offer some criticism on. Please do comment if you can think of a better or more elegant solution.

The business need

Develop a single web page that shows Henry’s current inventory. Develop a single page using XHTML standards that shows the inventory using XSL. CSS will be in the head of the XSL page and will be used to style the page. The page will show the widgets grouped by the type of metal in alphabetical order, and then the widgets in order of price with the lowest price item shown first (the list of widgets is only shown once in the page). Lastly, the out of stock widgets should be formatted differently than the ones that are in stock. Tables will be used to layout the web page.

The XML

I developed this XML a few weeks ago, and even wrote another post patting myself on the back for having authored a schema defining my widgets, but here is a snippet:


< ?xml-stylesheet type="text/xsl" href="inventory.xsl"?>
<inventory xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
  xsi:noNamespaceSchemaLocation="inventory.xsd">
  <widget>
    <material>Aluminium</material>
    <length units="ft">1</length>
    <width units="in">2</width>
    <thickness units="in">.25</thickness>
    <price units="USD">15.00</price>
    <stockqty>25</stockqty>
  </widget>
...
</inventory>

The good stuff – XSLT

I think learning XSLT was equal parts learning to understand XSL and then learning the intricacies of Xpath – especially as it relates to <xsl:apply-templates /> and matching/selecting the elements. Anyway here’s what I came up with:


<xsl :stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  </xsl><xsl :template match="/">
    <html>
      <head>
        <title>Henry's Widget Shoppe</title>
        
      </head>
      <body>
        <h2>Here's my available widgets!</h2>
        <table id="Inventory">
          <tr class="tableHead">
            <td>Material Type</td>
            <td>Length</td>
            <td>Width</td>
            <td>Thickness</td>
            <td>Price</td>
            <td>Stock Qty</td>
          </tr>
          <xsl :apply-templates />
        </table>
      </body>
    </html>
    </xsl>

    <xsl :template match="inventory">
      </xsl><xsl :for-each select="widget">
        <xsl :sort select="material" order="ascending"/>
        <xsl :sort select="price" data-type="number" order="ascending"/>
        </xsl><xsl :choose>
          </xsl><xsl :when test="stockQty>0">
            <tr class="widget">
              <xsl :apply-templates select="." />
            </tr>
          </xsl>
          <xsl :otherwise>
            <tr class="widget outOfStock">
              <xsl :apply-templates select="." />
            </tr>
          </xsl>
          
                    
    

    <xsl :template match="widget">
            <td class="material">
              <xsl :value-of select="material"/>
            </td>
            <td class="length">
              <xsl :value-of select="length"/>
              <xsl :value-of select="length/@units"/>
            </td>
            <td class="width">
              <xsl :value-of select="width"/>
              <xsl :value-of select="width/@units"/>
            </td>
            <td class="thickness">
              <xsl :value-of select="thickness"/>
              <xsl :value-of select="thickness/@units"/>
            </td>
            <td class="price">
              <xsl :if test="price[@units] != 'USD'">$</xsl>
              <xsl :value-of select="price"/>
            </td>
            <td class="stockQty">
              <xsl :value-of select="stockQty"/>
            </td>
    </xsl>


Conclusion

I did make several improvements and tried alternate strategies over the weekend, so this isn’t exactly what I first puked out. All in all, I’m very pleased with it. This was probably one of the most valuable self learning exercises I’ve yet had.

Download the source here and/or View the transformed XML here

Starter problems :(

Posted by on October 15, 2008

Well, bad news. After a successful trip to the gas station the day before yesterday, I encountered my first real scooter problem the following morning when I was leaving for work.

Lightning strikes

After putting my helmet and gloves on I inserted the key, turned it to ‘on’, squeezed the brake with my left hand, and pressed the starter switch. I was unpleasantly surprised to hear, after a brief “chug”, a useless and insulting whirring noise. I’ve only had the scooter for 2 months!

Clearly the starter motor was not doing it’s job….I’m not well versed in the names of motor parts, mechanical terminology, etc – so if I come off sounding totally ignorant here it’s only because I am totally ignorant. The initial sound was the normal “I’m about to start” sound. You might call it “turning over”. But after perhaps 1-2 seconds, or 1-2 “chugs”, whatever it is that the starter motor is supposed to turn inside that mysterious black box wasn’t turning and instead you could hear the electric starter motor spinning with no apparent resistance.

What now?

Since I don’t know enough about the mysterious black box that does all the work, I’m at a loss about what do with the scooter. I suppose I’m lucky that the problem can be circumvented by kick-starting. Those mornings(or whenever) when it’s difficult to start are much more annoying now.

I attended a business meeting yesterday morning and after letting it sit for a couple hours it was almost impossible to get started at all. It may have had something to do with it being low on fuel, but I actually had to sulk around a corner with it out of embarrassment after 5 minutes of kick-kick-kicking away at it to no avail. It did finally get it started though.

I’m not really in a position to have it fixed(even if I could find parts), so unless it turns out to be a trivial cost – or someone offers to fix it for free – I’m probably stuck with kick-starting.

The only helpful thing I’ve done – and I’m not totally sure this is even helping – is to crank up the idle a little bit. Kick-starting is difficult in part because the “kick-start-thing” is far to the rear of the scooter and brake and throttle are both needed to get it going. This is a hard reach to make for me. Also – and I can’t confirm this as fact, but – it’s been my impression that full throttle is not better than just a little when it comes to starting, and I’ve had good luck with the increased idle setting during kick-starts.

Thunderbird + FireTray FTW!

Posted by on October 12, 2008

Who doesn’t love Firefox? Probably only this guy. But what about it’s cousin, Thunderbird?

Thunderbird

Thunderbird has always been a program I wanted to embrace, with only 1 real problem: NO MINIMIZE TO TRAY! For what it’s worth, if you’re using Windoze, you can download Minimize to Tray. The lack of a Linux version of Minimize to Tray has long kept me from using it. It sounds really stupid I know, and it IS stupid. Thank goodness that doesn’t matter anymore!

FireTray

That’s right folks. As the name might imply, FireTray is a Firefox extension. I saw no mention of it’s compatitbility with Thunderbird – but out of desperation I decided to try to install it. Lo and behold, it worked.

It’s the usual install process. Find the extension, but instead of clicking the Install button, right click and choose “Save link as” then save the .xpi to your desktop. In Thunderbird, go to Tools > Add-ons, then click Install and browse to your .xpi file. Thunderbird will not give you the option to restart(I don’t think) but you will have to restart Thunderbird to get the tray icon. You can adjust the preferences for the extension – I recommend checking all three boxes for super tray goodness.

FireTray should keep Thunderbird running in the tray(duh), notify you of new mails, and still provide you with a mail client that is 1 million times better than Evolution. HA!

Mileage Chart

Posted by on October 12, 2008

Ok, I’ve been procrastinating for a long time about doing this – but it’s finally finished. Thanks Laura and Freya for waiting for me to get this done on a Sunday morning. this chart should update as I add data to the Google Spreadsheet.

My first XML Schema

Posted by on October 11, 2008

Having only been really introduced to XML a week ago, I’m proud to announce my first go at authoring an XML Schema. I can’t say it was really fun, but it was very interesting to be sure. I think XML in general is neat, but creating a schema really gave new insights into how XML files can and should be designed.

Please, if you can propose improvements – leave me a comment!

The sample XML file


&lt;?xml version="1.0" encoding="UTF-8"?&gt; 
&lt;inventory
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:noNamespaceSchemaLocation="inventory.xsd"&gt;
    &lt;widget&gt;
        &lt;material&gt;Aluminium&lt;/material&gt;
        &lt;length units="ft"&gt;1&lt;/length&gt;
        &lt;width units="in"&gt;2&lt;/width&gt;
        &lt;thickness units="in"&gt;.25&lt;/thickness&gt;
        &lt;price units="USD"&gt;5.00&lt;/price&gt;
        &lt;stockQty&gt;25&lt;/stockQty&gt;
    &lt;/widget&gt;
    &lt;widget&gt;
        &lt;material&gt;Aluminium&lt;/material&gt;
        &lt;length units="ft"&gt;1&lt;/length&gt;
        &lt;width units="in"&gt;2&lt;/width&gt;
        &lt;thickness units="in"&gt;.5&lt;/thickness&gt;
        &lt;price units="USD"&gt;10.00&lt;/price&gt;
        &lt;stockQty&gt;15&lt;/stockQty&gt;
    &lt;/widget&gt;
    &lt;widget&gt;
        &lt;material&gt;Aluminium&lt;/material&gt;
        &lt;length units="ft"&gt;1&lt;/length&gt;
        &lt;width units="in"&gt;4&lt;/width&gt;
        &lt;thickness units="in"&gt;.25&lt;/thickness&gt;
        &lt;price units="USD"&gt;12.50&lt;/price&gt;
        &lt;stockQty&gt;16&lt;/stockQty&gt;
    &lt;/widget&gt;
    &lt;widget&gt;
        &lt;material&gt;Aluminium&lt;/material&gt;
        &lt;length units="ft"&gt;1&lt;/length&gt;
        &lt;width units="in"&gt;4&lt;/width&gt;
        &lt;thickness units="in"&gt;.5&lt;/thickness&gt;
        &lt;price units="USD"&gt;15.00&lt;/price&gt;
        &lt;stockQty&gt;8&lt;/stockQty&gt;
    &lt;/widget&gt;
    &lt;widget&gt;
        &lt;material&gt;Aluminium&lt;/material&gt;
        &lt;length units="ft"&gt;10&lt;/length&gt;
        &lt;width units="in"&gt;2&lt;/width&gt;
        &lt;thickness units="in"&gt;.25&lt;/thickness&gt;
        &lt;price units="USD"&gt;15.00&lt;/price&gt;
        &lt;stockQty&gt;25&lt;/stockQty&gt;
    &lt;/widget&gt;
    &lt;widget&gt;
        &lt;material&gt;Aluminium&lt;/material&gt;
        &lt;length units="ft"&gt;10&lt;/length&gt;
        &lt;width units="in"&gt;2&lt;/width&gt;
        &lt;thickness units="in"&gt;.5&lt;/thickness&gt;
        &lt;price units="USD"&gt;30.00&lt;/price&gt;
        &lt;stockQty&gt;13&lt;/stockQty&gt;
    &lt;/widget&gt;
    &lt;widget&gt;
        &lt;material&gt;Aluminium&lt;/material&gt;
        &lt;length units="ft"&gt;10&lt;/length&gt;
        &lt;width units="in"&gt;4&lt;/width&gt;
        &lt;thickness units="in"&gt;.25&lt;/thickness&gt;
        &lt;price units="USD"&gt;35.00&lt;/price&gt;
        &lt;stockQty&gt;11&lt;/stockQty&gt;
    &lt;/widget&gt;
    &lt;widget&gt;
        &lt;material&gt;Aluminium&lt;/material&gt;
        &lt;length units="ft"&gt;10&lt;/length&gt;
        &lt;width units="in"&gt;4&lt;/width&gt;
        &lt;thickness units="in"&gt;.5&lt;/thickness&gt;
        &lt;price units="USD"&gt;40.00&lt;/price&gt;
        &lt;stockQty&gt;4&lt;/stockQty&gt;
    &lt;/widget&gt;
    &lt;widget&gt;
        &lt;material&gt;Copper&lt;/material&gt;
        &lt;length units="ft"&gt;1&lt;/length&gt;
        &lt;width units="in"&gt;2&lt;/width&gt;
        &lt;thickness units="in"&gt;.25&lt;/thickness&gt;
        &lt;price units="USD"&gt;5.50&lt;/price&gt;
        &lt;stockQty&gt;19&lt;/stockQty&gt;
    &lt;/widget&gt;
    &lt;widget&gt;
        &lt;material&gt;Copper&lt;/material&gt;
        &lt;length units="ft"&gt;1&lt;/length&gt;
        &lt;width units="in"&gt;2&lt;/width&gt;
        &lt;thickness units="in"&gt;.5&lt;/thickness&gt;
        &lt;price units="USD"&gt;11.00&lt;/price&gt;
        &lt;stockQty&gt;17&lt;/stockQty&gt;
    &lt;/widget&gt;
    &lt;widget&gt;
        &lt;material&gt;Copper&lt;/material&gt;
        &lt;length units="ft"&gt;1&lt;/length&gt;
        &lt;width units="in"&gt;4&lt;/width&gt;
        &lt;thickness units="in"&gt;.25&lt;/thickness&gt;
        &lt;price units="USD"&gt;15.00&lt;/price&gt;
        &lt;stockQty&gt;3&lt;/stockQty&gt;
    &lt;/widget&gt;
    &lt;widget&gt;
        &lt;material&gt;Copper&lt;/material&gt;
        &lt;length units="ft"&gt;1&lt;/length&gt;
        &lt;width units="in"&gt;4&lt;/width&gt;
        &lt;thickness units="in"&gt;.5&lt;/thickness&gt;
        &lt;price units="USD"&gt;16.50&lt;/price&gt;
        &lt;stockQty&gt;8&lt;/stockQty&gt;
    &lt;/widget&gt;
    &lt;widget&gt;
        &lt;material&gt;Copper&lt;/material&gt;
        &lt;length units="ft"&gt;10&lt;/length&gt;
        &lt;width units="in"&gt;2&lt;/width&gt;
        &lt;thickness units="in"&gt;.25&lt;/thickness&gt;
        &lt;price units="USD"&gt;16.00&lt;/price&gt;
        &lt;stockQty&gt;21&lt;/stockQty&gt;
    &lt;/widget&gt;
    &lt;widget&gt;
        &lt;material&gt;Copper&lt;/material&gt;
        &lt;length units="ft"&gt;10&lt;/length&gt;
        &lt;width units="in"&gt;2&lt;/width&gt;
        &lt;thickness units="in"&gt;.5&lt;/thickness&gt;
        &lt;price units="USD"&gt;30.00&lt;/price&gt;
        &lt;stockQty&gt;13&lt;/stockQty&gt;
    &lt;/widget&gt;
    &lt;widget&gt;
        &lt;material&gt;Copper&lt;/material&gt;
        &lt;length units="ft"&gt;10&lt;/length&gt;
        &lt;width units="in"&gt;4&lt;/width&gt;
        &lt;thickness units="in"&gt;.25&lt;/thickness&gt;
        &lt;price units="USD"&gt;35.00&lt;/price&gt;
        &lt;stockQty&gt;18&lt;/stockQty&gt;
    &lt;/widget&gt;
    &lt;widget&gt;
        &lt;material&gt;Copper&lt;/material&gt;
        &lt;length units="ft"&gt;10&lt;/length&gt;
        &lt;width units="in"&gt;4&lt;/width&gt;
        &lt;thickness units="in"&gt;.5&lt;/thickness&gt;
        &lt;price units="USD"&gt;44.00&lt;/price&gt;
        &lt;stockQty&gt;2&lt;/stockQty&gt;
    &lt;/widget&gt;
&lt;/inventory&gt;

The Schema


&lt;xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
    &lt;xsd:annotation&gt;
        &lt;xsd:documentation xml:lang="en"&gt;
            Widget Schema for Henry's Widgets.
            Copyright 2008 Henry's Widgets Inc.
        &lt;/xsd:documentation&gt;
    &lt;/xsd:annotation&gt;

    &lt;xsd:element name="inventory" type="inventoryType"/&gt; 

    &lt;xsd:complexType name="inventoryType"&gt;
      &lt;xsd:annotation&gt;
        &lt;xsd:documentation&gt;
          The inventory contains a number of widget elements of 
          which are defined by the complexType 'widgetType'
        &lt;/xsd:documentation&gt;
      &lt;/xsd:annotation&gt;
        &lt;xsd:sequence&gt;
            &lt;xsd:element name="widget" type="widgetType"  minOccurs="0" maxOccurs="unbounded" /&gt;
        &lt;/xsd:sequence&gt;
    &lt;/xsd:complexType&gt;

  &lt;xsd:simpleType name="materialType"&gt;
    &lt;xsd:annotation&gt;
      &lt;xsd:documentation&gt;
        This type defines the possible valid materials for widgets.
        This could be easily extended, but currently only includes 
        Aluminium and Copper.
      &lt;/xsd:documentation&gt;
    &lt;/xsd:annotation&gt;
    &lt;xsd:restriction base="xsd:string"&gt;
      &lt;xsd:enumeration value="Aluminium"/&gt;
      &lt;xsd:enumeration value="Copper"/&gt;
    &lt;/xsd:restriction&gt;
  &lt;/xsd:simpleType&gt;

    &lt;xsd:complexType name="widgetType"&gt;
      &lt;xsd:annotation&gt;
        &lt;xsd:documentation&gt;
          This type defines widgets. Some of the elements have 'unit' attributes that have fixed values. These could be extended.
        &lt;/xsd:documentation&gt;
      &lt;/xsd:annotation&gt;
        &lt;xsd:sequence&gt;
            &lt;xsd:element name="material"  type="materialType"/&gt;
            &lt;xsd:element name="length"&gt;
                &lt;xsd:complexType&gt;
                    &lt;xsd:simpleContent&gt;
                        &lt;xsd:extension base="xsd:decimal"&gt;
                            &lt;xsd:attribute name="units" type="xsd:string" fixed="ft" use="required"/&gt;
                        &lt;/xsd:extension&gt;
                    &lt;/xsd:simpleContent&gt;
                &lt;/xsd:complexType&gt;
            &lt;/xsd:element&gt;
            &lt;xsd:element name="width"&gt;
                &lt;xsd:complexType&gt;
                    &lt;xsd:simpleContent&gt;
                        &lt;xsd:extension base="xsd:decimal"&gt;
                            &lt;xsd:attribute name="units" type="xsd:string" fixed="in" use="required"/&gt;
                        &lt;/xsd:extension&gt;
                    &lt;/xsd:simpleContent&gt;
                &lt;/xsd:complexType&gt;
            &lt;/xsd:element&gt;
            &lt;xsd:element name="thickness"&gt;
                &lt;xsd:complexType&gt;
                    &lt;xsd:simpleContent&gt;
                        &lt;xsd:extension base="xsd:decimal"&gt;
                            &lt;xsd:attribute name="units" type="xsd:string" fixed="in" use="required"/&gt;
                        &lt;/xsd:extension&gt;
                    &lt;/xsd:simpleContent&gt;
                &lt;/xsd:complexType&gt;
            &lt;/xsd:element&gt;
            &lt;xsd:element name="price"&gt;
                &lt;xsd:complexType&gt;
                    &lt;xsd:simpleContent&gt;
                        &lt;xsd:extension base="xsd:decimal"&gt;
                            &lt;xsd:attribute name="units" type="xsd:string" fixed="USD" use="required"/&gt;
                        &lt;/xsd:extension&gt;
                    &lt;/xsd:simpleContent&gt;
                &lt;/xsd:complexType&gt;
            &lt;/xsd:element&gt;
            &lt;xsd:element name="stockQty"     type="xsd:nonNegativeInteger"/&gt;
        &lt;/xsd:sequence&gt;
    &lt;/xsd:complexType&gt;
&lt;/xsd:schema&gt;

Again, this is just my first try at this. I hope to improve my skills. Next, XSLT!

Zipped source: inventory.zip

Octopus is Calling

Posted by on October 10, 2008

Freya made this up today at story time. Mom said she went to her room and grabbed an older book and said she wanted to “read” it to her. This was her story:

Octopus was having real feeling about wanting her daddy. Daddy came home and took her to the farmer’s market and they got lots of good food! They came home and Octopus ate an avocado and it was really good. Octopus and Daddy love each other very much. The end!

I have the best daughter ever!

Do you know Paul Gilzow?

Posted by on October 10, 2008

Paul Gilzow, XSS master. This is sort of an inside joke…

Reminds me of this XKCD.