Archive of: Web Design

  1. Grouping Radio Buttons in ASP .NET MVC 2 posted August 27, 2010

    Here’s a simple issue I ran into today when dealing with radio buttons in an ASP .NET MVC 2 application.

    Radio buttons should only allow the user to select a single option out of multiple choices. This should be enforced by only allowing one radio button to be selected for each option set. But, what if your application has multiple options that all need radio buttons? How do you distinguish the radio buttons from one option from the other.

    This is where groups comes in. By setting the GroupName property for each of your radio buttons, you can specify which buttons to associate to an option.

    <div>
      <asp:RadioButton ID="ActionMatch" GroupName="RegexActions" Checked="true" Text="Match" runat="server" />
      <asp:RadioButton ID="ActionReplace" GroupName="RegexActions" Text="Replace" runat="server" />
    </div>
    

    Also, note that in ASP .NET MVC 2 there is no default group, so you must define a GroupName in order for the radio buttons to work properly.

  2. How to Properly Style HTML Tables posted August 23, 2010

    Some folks would argue that you should never use tables. And, for the most part, I agree.

    I believe that HTML markup should be meaningful, and therefore, you shouldn’t use tags for something they weren’t intended for (such as laying out a web page.) However, tables were put into the HTML standard for a reason, displaying tabular data.

    For instance, if we have a database of employees and we want to print a report that contains our top performers, their salary, and contact information a table would be the perfect candidate.

    Here’s a fictitious example of what a web page might return from a database of employees.

    <table id="employees">
      <tr>
        <th>First Name</th>
        <th>Last Name</th>
        <th>Salary</th>
        <th>Extension</th>
      </tr>
      <tr>
        <td>Albert</td>
        <td>Einstien</td>
        <td>$500,000</td>
        <td>3141</td>
      </tr>
      <tr>
        <td>Alan</td>
        <td>Turing</td>
        <td>$300,000</td>
        <td>1243</td>
      </tr>
      <tr>
        <td>Nikola</td>
        <td>Tesla</td>
        <td>$300,500</td>
        <td>0987</td>
      </tr>
      <tr>
        <td>Bill</td>
        <td>Gates</td>
        <td>$100,000,000</td>
        <td>2222</td>
      </tr>
    </table>
    

    This, in my humble opionion is perfectly acceptable. We have tabular data that belongs in an HTML table. But, what do we do from here? The table returned is drab and needs some styling to look as sharp as the rest of the site. Let’s add some style.

    #employees {

    Read the rest

  3. How to Add an RSS Feed to Any Website posted May 16, 2010

    I wanted a quick and easy way for my portfolio page to show a dynamic list of what I’ve been blogging about on CreatingCode. Google makes this extremely easy by offering an API that does all of the behind the scenes work for you. They even have a feed control wizard that will generate the code for you.

    Here is a snippet of what the feed control wizard generated for this site.

    <!-- ++Begin Dynamic Feed Wizard Generated Code++ -->
      <!--
      // Created with a Google AJAX Search and Feed Wizard
      // http://code.google.com/apis/ajaxsearch/wizards.html
      -->
    
      <!--
      // The Following div element will end up holding the actual feed control.
      // You can place this anywhere on your page.
      -->
      <div id="feed-control-creatingcode">
        <span style="color:#676767;font-size:11px;margin:10px;padding:4px;">Loading...</span>
      </div>
    
      <!-- Google Ajax Api
      -->
      <script src="http://www.google.com/jsapi?key=notsupplied-wizard"
        type="text/javascript"></script>
    
      <!-- Dynamic Feed Control and Stylesheet -->
      <script src="http://www.google.com/uds/solutions/dynamicfeed/gfdynamicfeedcontrol.js"
        type="text/javascript"></script>
      <style type="text/css">
        @import url("http://www.google.com/uds/solutions/dynamicfeed/gfdynamicfeedcontrol.css");
      </style>
    
      <script type="text/javascript">
        function LoadDynamicFeedControlCreatingCode() {
          var feeds = [
    	{title: 'CreatingCode',
    	 url: 'http://www.creatingcode.com/?feed=rss2'
    	}];
          var options = {
            stacked : true,
            horizontal : false,
            title : "CreatingCode"
          }
    
          new GFdynamicFeedControl(feeds, 'feed-control-creatingcode', options);
        }
        // Load the feeds API and set the onload callback.
        google.load('feeds', '1');
        google.setOnLoadCallback(LoadDynamicFeedControlCreatingCode);
      </script>
    <!-- ++End Dynamic

    Read the rest

  4. Thwarting Spammers With reCAPTCHA posted May 6, 2010

    One day, while going out to lunch, I checked my phone and noticed 20 new email messages from WordPress asking me to review new comments to my blog. I instantly knew something was wrong because I don’t generally get that many comments in such a short amount of time. After reviewing all of my email messages, I confirmed that every last one of them was asking me to approve a spam comment. By the time I got back to my desk to deal with my new spam issue, I found over 100 messages awaiting my rejection.

    Strangely enough, I had some mixed feelings towards this lame (and ultimately futile) spam attack. On one hand, I was super annoyed to have to deal with this problem. But, on the other hand, I was at least a little bit encouraged to see that my blog was getting web-crawled by something out there (at the time of this writing I am completely over the encouraged part and now just plain annoyed.)

    My first plan to stop the barrage of spam comments I was receiving was to simply blacklist the IP address making all of the bad comment requests. After all, every single spam… Read the rest

  5. How to Make Sure Your Website is Classified Properly With McAfee TrustedSource posted April 24, 2010

    If you run a website, you might want to check out how McAfee categorizes it. In order for your site to come up unimpeded on company internet connections that use McAfee WebWasher it has to be classified properly.

    This website used to be classified as “Medium Risk” because it was un-categorized by the WebWasher service. This means that everytime someone wants to view one of the pages on this site, they have to bypass a warning message. Luckily, one of my readers informed me of this (Thanks Phil), otherwise I would have never known about it.

    Having your website classified improperly can significantly reduce your traffic during business hours.

    In order to check what your website is classified as, go to http://www.trustedsource.org and check. If you don’t agree with your classification, you can submit a re-classification request and someone will take a look at it for you.

    Making sure your website is classified properly is your responsibility, don’t assume anyone is going to do it for you.

.NET Algorithmic Art ASP ASP .NET ASP .NET MVC audio Bill Gates C# code review Computational Art CouchDB CSS Database DateTime debug DevDays eclipse ethics FileSystem Git Improvement iPhone Java JQuery Knopflerfish Layouts mail Microsoft Oracle OSGi Processing Python Ruby SMTP SOA Software Piracy Source Control SQL StackOverflow tools TortoiseGit training Web Standards Windows XHTML