• ASP.NET Date Validation

    A simple requirement at first sight not one with a simple solution. You have an ASP.NET page which allows the user to specify a date which is then used as an input parameter for an SQL Stored Procedure. What is stopping the user from entering ‘Hello World’ and submitting it? Answer, nothing unless you configure some sort of validation.

    Read more
  • Reading an RSS Feed with C# and Python

    When I started this site I had a project in mind that would download Podcasts as they were posted and maintain the content of my MP3 player so that I didn’t have to do it myself. Well since then I have lost my iTunes virginity and while it doesn’t do everything that I wanted (like telling me that a new episode has been downloaded) it does automatically download and delete them once I’ve watched/listened to them. But just because I don’t need to develop a complete application there is still an itch to scratch here – a few of them in fact.

    • How do I download an RSS stream – it’s not just podcasts that uses them
    • How do I parse the resulting XML
    • How do I download a file and store it locally and
    • How do I do this in C# and Python

    Well this post will answer the first two questions using C# and LINQ and Python and it’s XML library.

    Read more
  • Upgrading Ubuntu Intrepid to Jaunty

    When it comes to upgrading Operating Systems I’m not known as an early adopter, I normally wait a while for others to have the headache of encountering and resolving problems. However, in a moment of madness I decided to upgrade my fully functional Ubuntu 8.10 (Intrepid Ibex) installation to 9.04 (Jaunty Jackalope). I’ve read a few blog posts where users have upgraded and then found that thier sound no longer works or that thier display crashes or won’t hit the previous resolution so I made sure that I had a backup of my /home directory and exported a list of my installed applications.

    Read more
  • Request format is unrecognized for URL unexpectedly ending in …

    Another thing that you think would be straight forward but turned out to be quite frustrating. I have written Web Services in the past without any problems but recently when I was writing one specifically for Excel (2007) I could not get it to link properly.

    Running the web service in VS2005 resulted in the test page we all know and love and the Invoke button worked fine! Taking the URL and pasting it into Excel resulted in a “Request format is unrecognized for URL unexpectedly ending in…” error!

    It turns out that this is by design – sort of. Basically the HTTP Get and HTTP Post protocols are disabled by default (not the case in .NET 1.0). Enabling them in is simple matter of adding the following to the system.web section of the web.config:

    <configuration>
      <system.web>
        <webServices>
          <protocols>
           <add name="HttpGet"/>
           <add name="HttpPost"/>
          </protocols>
        </webServices>
      </system.web>
    </configuration>
    

    TaDa! it worked.

    If you want some more information then click here to go to the Knowledge Base article [KB819267]

  • Calling Code-Behind Method from JavaScript

    While this page is still popular I have blogged about an alternate method for sending data from client to server using Javascript. You may want to check that out while you are here.

    It shouldn’t be too hard should it? You want to use some Javascript on the client-side to call a method on in the Code-Behind of your aspx page – how hard can that be? Surely it must be possible. I was developing a DotNetNuke module (so the code below is VB.NET and not C#) which would allow the user to search for locations using Virtual Earth and store the latitude and longitude (as well as the zoom level) in a database.

    The problem is that the Virtual Earth API is a Javascript (and hence Client-Side) technology and in the normal scheme of things cannot access .NET code on the server. So how do you do it? How do you get a Javascript function to call a Server-Side method – Is it even possible?

    Read more