Spot the web RSS 2.0
# Thursday, December 20, 2007

Let’s say you want to change the color of your links on just your contact page to red. They are blue on every other page, but it just makes sense for them to be red on your contact page (for some reason). There are a couple ways you could go about this.

  • You could declare a separate stylesheet for your contact page.
    This isn’t ideal, because it’s redundant. If you make any other changes, you’ll always have to make them both on the main stylesheet and the contact page stylesheet.
      
  • You could give all those links a unique class on that page.
    This isn’t ideal, because it isn’t very semantic and it’s also redundant. Why apply a class to every single link on the page when they really aren’t any different from links elsewhere on the site, contextually speaking?
      
  • The best solution is to give your the body a unique ID.
    This solves the problem perfectly. You can use the same stylesheet and target just the links you want to with a single CSS selector.
      

Simple, literally just apply the ID to the body tag:

   ...
</head>

<body id="contact-page">
   ...

Now for our example of making all links on the contact page red instead of blue, just use some CSS like this:

a {
color: blue;
}

#contact-page a {
   color: red;
}
Thursday, December 20, 2007 6:45:41 PM (Jerusalem Standard Time, UTC+02:00)  #    Comments [0] - Trackback
CSS | Design | Programming

If you want to store configuration information in a XML file, you can easily use serialization to assist you. Instead of using XPath or DOM, and have some code to maintain, simply use the XmlSerializer to retrieve information.

Here's an example of a XML file:

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <DatabaseConfig>
  3.   <Data>
  4.     <DatabaseConfigData
  5.       File="Data/Principal.xml"
  6.       EntityName="Principal"
  7.       Format="Xml" />
  8.     <DatabaseConfigData
  9.       File="Data/Role.xml"
  10.       EntityName="Role"
  11.       Format="Xml" />
  12.   </Data>
  13. </DatabaseConfig>

 

And if you have the following classes (C#):

  1. public class DatabaseConfig
  2. {
  3.     public DatabaseConfigData[] Data { get; set; }
  4. };
  5.  
  6. public class DatabaseConfigData
  7. {
  8.     [System.Xml.Serialization.XmlAttribute()]
  9.     public string File { get; set; }
  10.  
  11.     [System.Xml.Serialization.XmlAttribute()]
  12.     public string EntityName { get; set; }
  13.  
  14.     [System.Xml.Serialization.XmlAttribute()]
  15.     public string Format { get; set; }
  16. };

 

All you have to do to load the XML information into the DatabaseConfig class is (C#):

  1. DatabaseConfig GetDatabaseConfig(string file)
  2. {
  3.     XmlSerializer serializer =
  4.         new XmlSerializer(typeof(DatabaseConfig));
  5.     using (StreamReader reader = new StreamReader(file))
  6.     {
  7.         object obj = serializer.Deserialize(reader);
  8.         return (DatabaseConfig)obj;
  9.     }
  10. }

There are a few issues you have to handle when using XML Serialization, wich you can see at my earlier posts about XMLXSD and Serialization.

Thursday, December 20, 2007 6:35:13 PM (Jerusalem Standard Time, UTC+02:00)  #    Comments [0] - Trackback
.Net | Programming | Serialization | XML
# Wednesday, December 19, 2007

The good folks at Ajaxian.com and I just completed our third annual survey of Ajax tools usage.  The raw data is free for everyone here - you should be able to slice it and dice it anyway you see fit.  The top 10 Ajax toolkits in 2007 are:

Dec2007top10_2

You can check out the top 10 Ajax toolkits from 2006 and 2005 at the end of this blog.

What is interesting about the Ajax market is that it's more diversified in 2007 than it was in 2005 - the number  of toolkits keep growing and jostling position in terms of usage.  Right now there are 241 Ajax toolkits and related libraries listed in the survey. There were about three dozen in 2005 and 170 in 2006.  The number of options is growing.

That's brings up another point: The survey is not limited to Ajax frameworks and toolkits, it also includes some JavaScript libraries commonly used in Ajax development. All of the entries were derived from Ajaxpatterns.org as well as past surveys. There are probably quite a few of these frameworks that have been abandoned and others that were missed, so its not a perfect record of available Ajax toolkits and libraries today.

Prototype and Script.aculo.us are the only toolkits to maintain a lead over the past three years.  However, over all there are no clear winners or losers as even the strongest incumbents (i.e., Prototype and Script.aculo.us) are starting too loose ground. Some frameworks initially popular have faded nearly completely out of the market (i.e., xajax and Rico ) while others have have sprung out of nowhere to become leading tookits (i.e., jQuery and Ext JS).    The changes over the past three years are easy to see in the stack chart at the end of this blog, which shows the market share of the most popular toolkits - notice how they grow and shrink in market share. That means that the market remains immature.

What is astonishing is the nearly complete lack of commercial Ajax frameworks. Backbase has had a lot of success making a comeback after loosing some market share in 2006, but other commercial Ajax frameworks have not been so lucky. 

Spry is growing quickly and may be in the top 10 next year. Spry was left out of the survey for the first day or so and then added in as it was the most popular write in toolkit.  It may have faired better if it was an option from the start. I added up all the write-ins for Spry with picks after the survey was adjusted. The numbers are not great - Spry has about 4% of the market right now

The number of responses were much higher this year (2,619) compared to 2006 (865) and 2005 (763).   The increase is enough to say that Ajaxian.com has become more popular and so has Ajax but you can't go much beyond that. In addition, the entire survey has to be taken with a large licking-block of salt. It's not scientific and probably breaks about 100 rules for best practices when doing a survey.  However, given the limitations of the survey and the surveyor (that's me), it still provides valuable insight to the Ajax toolkit market in general.

Wednesday, December 19, 2007 10:52:22 AM (Jerusalem Standard Time, UTC+02:00)  #    Comments [0] - Trackback
Programming
Navigation
Archive
<December 2007>
SunMonTueWedThuFriSat
2526272829301
2345678
9101112131415
16171819202122
23242526272829
303112345
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2010
Guy Levin
Sign In
Statistics
Total Posts: 63
This Year: 0
This Month: 0
This Week: 0
Comments: 14
Themes
All Content © 2010, Guy Levin