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

Steve Gray

Random Thoughts from the 4Penny VP of Development
  • 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.

     

  • So, you want to sell things on-line...

    Let me start out by saying that you're not going to like this post. But read all the way to the end, read every word. This is hard advice and it comes from years of experience.

    In my business, I meet a lot of folks that have an idea that they can make some money by starting a web storefront and then - after maybe a month - retire and sell the business. I see these folks cry, scratch their head, and fail. I see it over and over and over. It breaks my heart to take their money only to see their new venture go down the drain.

    What's missing? The same thing that missing if they were to open up a brick and mortar storefront. 

    • Willingness to work
    • Knowledge of the area in which they have chosen to compete.  

     What is involved in selling on-line?

    You need a web site. That's my job.

    You need an account with a credit card processor. No, you can't use the processor that you have now. Just ask them, they'll say no, and threaten to close your account. Accepting credit card transactions online is a very risky business, and you have to pay for that risk. Yes, you. Who else?

    No, I will not just collect the credit card number and email them to you, or save them in a database. If it's not against the law it should be. Servers get hacked all the time, just read the papers. Emailing the numbers to you would be a violation of your credit card processing contract, I will not be a party to that.

    So, call an on-line credit card processor and open an account. http://www.authorize.net/ comes to mind, they're big, but there are lots. Expect to pay $50/month even if you don't sell a single thing (and in your first few months you won't). Expect to pay about 7% of your gross.

    You need traffic.

    asdThis is a killer. People think that they can just open up a site and they'll sell things. You won't. I know lots of successful merchants, and they all have one thing in common - they work. All day, every day. Getting traffic to a web site is not easy, it requires the same amount of sweat that any other store would. If you are not willing to do that, then don't bother.

    Don't blame the web developer. This sounds like self serving advice, but I am aware of really ugly sites that get lots of traffic (Like this one, actually). Frequently people call me and ask if I'll redo their site so that they will get traffic. I ask how much traffic they're getting now (They don't know, but they haven't sold anything in months). It's not the site design. You need traffic in the first place. If people are not going to your site, making it prettier will not help. I give these people my half-hour speech on web marketing and send them on their way. If you'd like to hear it, I'd love to share <smiles>

    I'm not able to tell you in the space of this article what you need to do, but I am able to tell you that it is a full time job. If you come to me an complain that you're not selling anything or that you're not getting traffic, I'm going to ask how long you work at it every day. Or, how much you pay someone else to do it. If you say none and none, there's your answer.

    Sorry for the attitute. Christ commands us to love our neighbors and to do that I'd sooner that you had a full understanding of what it means to operate an eCommerce business than to take your money and see you fail.

    May God bless you and your endevors.

     

More Posts Next page »