Site Search:
Sign in | Join | Help
4Penny.net

Steve Gray

Random Thoughts from the 4Penny VP of Development
  • Adding .FLV MIME Type in IIS

    .FLV files are already the best method for publishing video on the web, and are sure to become even better with the new enhancements in Flash 8. When serving .flv files off of a Windows Server 2003 (or any other Windows server I would imagine) requires setting up the MIME type on the server first (it isn't one of the native MIME types on MS servers).

    You can figure out easily if your server is configured to support .flv files by posting a .flv file on a server and navigating to the URL of that .flv in a browser. If you see a LONG string of garbage on the screen, your server isn't set up for .FLVs and needs to have the MIME type set up.

    Adding .flv MIME type in IIS

    1) Select the site to configure in IIS, right click and select "Properties"
    2) Under HTTP Headers Tab, select "File Types" under the MIME Map section and select "New Type"
    3) Type ".flv" as the associated extension and "video/x-flv" as the content type.
    4) Select "OK" and you're ready to fly!

     

  • linq to XML

    Here's my first foray into linq to XML. The task here is to take an XMLDocument and see if a particular node exists. If not, we need to add the node.

     Sub handleSopDocs(ByRef xDoc As XmlDocument)
        Dim eConnect As XElement
    
    
        'load the document using the 'string' method
        eConnect = XElement.Parse(xDoc.OuterXml)
    
    
        'loop through all the 'SOPTransactionType' nodes in the document
        For Each SOPTransactionType In eConnect.Elements("SOPTransactionType")
            'get a reference to that documnet's 'taSopHdrIvcInsert' node
            Dim taSopHdrIvcInsert As XElement = SOPTransactionType.Element("taSopHdrIvcInsert")
    
    
            'get the sopnumbe node. this will always exist. 
            Dim SOPNUMBE As XElement = taSopHdrIvcInsert.Element("SOPNUMBE")
    
    
            'get the string value of the sopnumbe
            Dim strSOPNUMBE As string = taSopHdrIvcInsert.Element("SOPNUMBE")
    
    
            'get the BACHNUMB node. this may or may not exist
            Dim bachnumb As XElement = taSopHdrIvcInsert.Element("BACHNUMB")
    
    
            'if it did not exist...
            If bachnumb Is Nothing Then
                'create a new node
                bachnumb = New XElement("BACHNUMB", "ORDERS")
                'add in after the SOPNUMBE
                SOPNUMBE.AddAfterSelf(bachnumb)
            End If
        Next
    
    
        'this procedure is 'BY REF', so we reload the xDoc parameter and we're good to go
        xDoc.LoadXml(eConnect.ToString)
    
    
    End Sub

  • What is a '404 error'?

    As a web host, I am frequently asked what a '404' error is. Customers see this in their web statistics, sometimes the web site is configured to send daily reports and 404 errors show up there.

    Simply put, a 404 error is a 'page not found' error. Actually, it probably says that right in the error report.

    What they're really asking is 'why am I getting it?'. There are several reasons; usually they are not reason for alarm. A 404 is caused by somebody (or some robot) requesting a page from the site that doesn't exist.

    • If there is an error in the menu structure or a bad link on the site this may happen. Say you have a link on the home page to 'Contact Us', but the developer fat-fingers the link and it goes to 'kontackus.htm'. Clicking that link will generate a 404, because 'kontactus.htm' probably doesn't exist.
    • If a search engine sends a robot to your site to index it, they frequently request 'robots.txt'. This is a non-required page that tells them what pages you don't want indexed. The default is to index all pages. Since it causes an annoying 404 in the reports, we usually will just drop a blank file into the site.
    • Sometimes we'll see repeated calls to non-existent pages (pages that used to be in the site but are not currently) all in the span of a second or two. That's an indicator that a search engine is making a scan of the pages that it thinks you have. Strangely, they'll keep on doing that for some time. I don't know why.
    • If someone manually types in an address and misspells it... 'www.mySite.com/hom.htm' (missing the 'e' in 'home')
    • If the site changes over time, and a link to a non-existent page exists on another web site, or in the search engine. We see this a lot when we get requests to upgrade the functionality in a web site, because it means changing the page names from '.htm' to '.aspx' so that we can get 'server side' functionality' like database calls or sending email. The answer here is frequently to put the old 'home.htm' back into the site, but have it immediately redirect to the new 'home.aspx'

    Repeated calls to nonexistent pages, especially if they end in '.dll', '.exe', or '.cmd' should be cause for worry. Immediately call about that. That might be a hack attempt.

    Other than that, 404 errors are just an alert, and can usually be ignored. Repeated calls for the same page can usually be fixed by placing that page on the site and redirecting.

     

More Posts Next page »