mhinze.com

links etc.




    Archive for February, 2007

    links for 2007-02-28

    Wednesday, February 28th, 2007

    pinging technorati technique, code

    Tuesday, February 27th, 2007

    the technique: trick to increase technorati rank

    the output:

    C:\\>type c:\\urls.txt
    http://www.testerson.com|Testerson
    http://www.testertown.com|Testertown
    C:\\>XmlrpcPing.exe c:\\urls.txt
    Success: http://www.testerson.com
    Success: http://www.testertown.com
    
    C:\\>XmlrpcPing.exe c:\\urls.txt
    Failed: http://www.testerson.com You just sent a ping, please only ping when you update
    Failed: http://www.testertown.com You just sent a ping, please only ping when you update
    



    the quick & dirty c# code to repeatedly xmlrpc ping technorati (some heavy lifting here)

    [csharp]
    class Program
    {
    static void Main(string[] args)
    {
    if (args[0] != null)
    {
    string url, name, output;
    string[] urlnames = File.ReadAllLines(args[0]);
    foreach (string urlname in urlnames)
    {
    url = urlname.Split('|')[0];
    name = urlname.Split('|')[1];
    if (Send("http://rpc.technorati.com/rpc/ping", name, url, out output))
    Console.WriteLine("Success: {0}", url);
    else Console.WriteLine("Failed: {0} {1}", url, output);
    }
    }
    }

    public static bool Send(string pingUrl, string name, string url, out string output)
    {
    try
    {
    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(pingUrl);
    request.Method = "POST";
    request.ContentType = "text/xml";
    Stream pingstream = (Stream)request.GetRequestStream();
    XmlTextWriter xtw = new XmlTextWriter(pingstream, Encoding.UTF8);
    xtw.WriteStartDocument();
    xtw.WriteStartElement("methodCall");
    xtw.WriteElementString("methodName", "weblogUpdates.ping");
    xtw.WriteStartElement("params");
    xtw.WriteStartElement("param");
    xtw.WriteElementString("value", name);
    xtw.WriteEndElement();
    xtw.WriteStartElement("param");
    xtw.WriteElementString("value", url);
    xtw.WriteEndElement();
    xtw.WriteEndElement();
    xtw.WriteEndElement();
    xtw.Close();
    HttpWebResponse response = (HttpWebResponse)request.GetResponse();
    StreamReader respSr = new StreamReader(response.GetResponseStream());
    XmlDocument xml = new XmlDocument();
    string pingResponseXml = respSr.ReadToEnd();
    xml.LoadXml(pingResponseXml);
    respSr.Close();
    response.Close();
    output = xml.SelectSingleNode("methodResponse/params/param/value/struct/member[2]/value").InnerText;
    return "0" == xml.SelectSingleNode("methodResponse/params/param/value/struct/member[1]/value/boolean").InnerText;
    }
    catch (Exception ex)
    {
    output = ex.Message;
    return false;
    }
    }
    }

    [/csharp]

    questions? leave a comment

    links for 2007-02-27

    Tuesday, February 27th, 2007

    4 most important seo considerations

    Monday, February 26th, 2007

    a very short list:

    1. inbound links

    2. keywords (and related phrases) in places where keywords should go

    3. proper navigation

    4. avoid negative factors
      • participation in sketchy communities (ie, linking to "gray area" sites)
      • spam or the appearance of spam
      • etc, etc

    5. runners up:

      • site age
      • freshness
      • uniqueness
      • outbound links
      • any factor by which software can evaluate content quality: vocabulary & grammar level, length of content, similarity to other authoritative text



    links for 2007-02-26

    Monday, February 26th, 2007

    links for 2007-02-24

    Saturday, February 24th, 2007

    OPML to HTML

    Friday, February 23rd, 2007

    i was asked yesterday what blogs i read and i wanted to use data from my reader's opml document. but the converters I found weren't good enough, either they were javascript (ie: it didn't render source i could copy/paste into an email or blogpost) or they didn't include support for nested outlines, which is how google reader exports opml and also how i wanted to present it. so i took an hour this morning to write a asp.net page in c# that converts opml into html with support for nested outlines (folders, tags) and which renders nicely formatted unordered lists. i chose not to do xslt. ymmv.

    <%@ Page Language="C#" EnableViewState="false" ValidateRequest="false" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <script runat="server">
        StringBuilder sb;
        protected void submit_Click(object sender, EventArgs e)
        {
            opml.Rows = 5;
            System.Xml.XmlDocument xml = new System.Xml.XmlDocument();
            sb = new StringBuilder();
            try
            {
                xml.LoadXml(opml.Text);
            }
            catch
            {
                output.Text = "<h1>Invalid input</h1>";
                return;
            }
            System.Xml.XmlNode titleNode = xml.SelectSingleNode("opml/head/title");
            if (titleNode != null)
            {
                string title = titleNode.InnerText;
                sb.AppendFormat("<h1>{0}</h1>\n", title);
            }
            //process top level "folders"
            convertNodes(xml.SelectNodes("opml/body/outline"));
            output.Text = sb.ToString();
        }
        protected void convertNodes(System.Xml.XmlNodeList nodes)
        {
            sb.Append("<ul>\n");
            foreach (System.Xml.XmlElement element in nodes)
            {
                sb.Append("<li>");
                sb.Append(genLinkFromElement(element));
                if (element.HasChildNodes) convertNodes(element.ChildNodes);
                sb.Append("</li>\n");
            }
            sb.Append("</ul>\n");
        }
        protected string genLinkFromElement(System.Xml.XmlElement element)
        {
            string text = element.HasAttribute("text") ? element.GetAttribute("text") : "unknown description";
            string htmlLink = element.HasAttribute("htmlUrl") ?
                "<a href=\"" + element.GetAttribute("htmlUrl") + "\">" + text + "</a>" : text;
            string rssLink = element.HasAttribute("xmlUrl") ?
                "- [<a href=\"" + element.GetAttribute("xmlUrl") + "\">rss</a>]" : string.Empty;
            return string.Format("{0} {1}", htmlLink, rssLink);
        }
    </script>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title>convert OPML to HTML.. paste your opml, get a blogroll</title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <asp:TextBox ID="opml" TextMode="multiline" Columns="100" Rows="40" runat="server"></asp:TextBox>
            <br />
            <asp:Button ID="submit" runat="server" Text="Process OPML" OnClick="submit_Click" />
            <asp:Literal ID="output" runat="server"></asp:Literal>
        </div>
        </form>
    </body>
    </html>

    Blogs I Read

    Friday, February 23rd, 2007

    Yesterday I was asked what asp.net and seo blogs I currently read. So I wrote a little tool to export my OPML to HTML and here are the relevant excerpts.

    links for 2007-02-23

    Friday, February 23rd, 2007

    links for 2007-02-22

    Thursday, February 22nd, 2007
    © 2007 mhinze.com