Friday, October 21, 2016

SEO notes

My home page bounces all over the place with respect to search engine rankings, especially from Google. First, I found a good post about optimization.
 My own tips, in no particular order, are:
(0) Content, content, content.
(1) Remove HTML errors, include a good title and meta tags, target some keywords and use them appropriately, but all serious sites do this.
(2) Optimize for Google. If Google ranks your site well, so will the other engines, and most users use Google.
(3) Get links to your site listed on other reputable sites, to generate hits and improve automated reputation calculations. Don’t bother with disreputable link farms.
(4) Drop your URL everywhere, such as in web forums. You’ll get spam; deal with it.
(5) Individuals who meet Wikipedia notability standards will get an unbiased biography. Don’t create a bio for yourself because it hurt your reputation. Carefully edit Wikipedia articles.
(6) The DMOZ.org policies baffle me. Many categories are populated but never updated and they’re picky about editors. Still, DMOZ is well respected.
(7) I am an editor on syndic8.com. I reject most of the waiting feeds that I review, but there is some good stuff there.
(8) Make sure your target page loads quickly (within a few seconds).
(9) Reduce your link-to-content ratio and ad-to-content ratio. Links and ads are fine, but the search robots can pick out link farms and ad farms.
(10) Renew your domain registration for multiple years so that you don’t look like a temporary ad farm.

Local news on the web

Print editions of newspapers across the country are shutting down these days. I still subscribe to the print editions of two newspapers in the Rochester, NY area, but I’m looking for news sources to carry me when the inevitable finally happens. The print editions support an investigative activity that bloggers and web editions just can’t match (oh well...). In particular, I’m looking for a deep sources of local news. Lots of web sites regurgitate the top stories from the print editions, but that won’t help when there are no print editions. I'm looking for sites that can tell me about businesses that are opening, school sports results, youth group and charity activities, etc., as well as the bigger stories and weather. Comment here on how you find your local news on the web.

Historical tech post: Installing Windows fresh on a new laptop (05 Jan 2013)

I bought a new Samsung notebook PC. Overall, it works well. It came with Windows 8 64-bit, not Windows 8 Pro, but it was one of those Christmas day deals and I have the Windows media anyway. I found out that computers arrive these days without OS media, and with a restoration partition so that Windows can be re-installed if necessary. However, with separate installation media, I had the option of reformatting the whole drive and wiping out the space taken by the restoration data, which includes a bunch of manufacturer applications which I'll probably never use. Note that before I did this, I downloaded the manufacturer drivers from their support site.
 The installation of Windows 8 is slightly different than previous versions, so my process was to boot from the DVD, which required a BIOS change to allow this, so check your manufacturer documentation. I did indeed choose the advanced options to delete and recreate a single installation partition. No license key was requested because on a PC that originally has Windows pre-installed, a key is built into the BIOS. After installing the manufacturer drivers, Control Panel can be used to Add Features to Windows, where the Pro key is requested for certain features. Including a few environment tweaks, this all took a few hours, but I encountered no errors and the hardware works as expected.

Bibles and translations

The Christian Symbols page displays random Bible verses and most of the web page text is available in English, French and Spanish. To see French or Spanish, change your browser’s language preferences. In most cases, translations come from the old babelfish.altavista.com or basic web searches. Numbers and dates are not localized. If you’d like to volunteer to provide more translations, let me know.
The random Bible verses are retrieved in the preferred language by custom software using text from BibleDatabase.org. That site offers many translations. For now, the English version is King James, but I will use a more modern version if one becomes available for free. Each translations stored on my site uses about 5 megabytes.

Historical tech post: Flash updates (Mon, 17 Nov 2008)

I wondered how Flash knew to install updates after a login. After all, it is a browser plugin. The plugin checks for updates if allowed, and that is a user settable option. When visiting a Flash-enabled site, and when the update check finds that Flash is out of date, the plugin installs a RunOnce registry key. This is done silently, and most of us do not check for such a key every few minutes. The next time the user logs in, possibly days later, and even though the browser plugin is not yet running, the registry key starts the update process. The user might then wonder what started the update, but by that time, the RunOnce key has already deleted itself. Sneaky, but safe.

Historical tech post: Bugs I have seen - MSIE6 and replacing innerHtml with images (01 Feb 2007)


A table cell with an ID can have its innerHtml replaced by Javascript, without a page refresh. But if the content is img HTML markup, IE6 does not automatically download the image. If the image is already cached, it works sometimes. The general solution was to switch to an AJAX technique, which really does download the image.

Historical tech post: Bugs I have seen - National Weather Service web service (Tue, 27 Sep 2011)

 The National Weather Service web service returns XML data that does not conform to the latest security standards (first reported in 2005), so clients using .NET Framework 1.1 and later report an error ("The server committed an HTTP protocol violation..."). The solution is to edit the proxy class generated by Visual Studio to process the returned data according to an older version of the protocol.
http://weblogs.asp.net/jan/archive/2004/01/28/63771.aspx
The web service intermittently throws, "Unable to read data from the transport connection." This appears to be a timeout error which I work around by requesting less data at a time, multiple times.
 I noticed errors on 2011-09-26; the web service URL changed from http://www.weather.gov/xml/DWMLgen/wsdl/ndfdXML.wsdl to http://graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.php?wsdl, and there were breaking changes to NDFDgen(). I struggled with Visual Studio, so I deleted the old web reference, closed and reopened VS, added the new web reference, modified NDFDgen(), and then it worked (without editing the proxy class to adjust the protocol version, at least there’s that).

Historical tech post: Bugs I have seen - Firefox and synchronous AJAX (01 Dec 2006)


 There is a problem with the way FireFox (in 2006) handles the Javascript XMLHttpRequest object. This object is used to implement AJAX techniques that allow access to remote information via HTTP without refreshing the whole web page. If the open method is called synchronously, the readyState property never gets set to 4 (completed). Some blogs suggest declaring the onreadystatechange function after the call to open, but this didn’t work for me (I had to use an asynchronous call). My page behaves better with the asynchronous call, but from what I’ve seen in the blogs, FireFox is either the only browser that does it right, or the only browser that does it wrong.
Also: I had a few issue when loading an XML document with Javascript. My XML document was being cached by the browser, and this caching apparently cannot be avoided with an HTML no-cache header. A simple but hack-ish solution is to do,
 xmlDok.load("file.xml?rnd=" + Math.random(1000).toString());
 so that the browser thinks a different URL is loaded each time.
 Also, one would expect to be able to select nodes with XPath, via selectSingleNode and selectNodes. This works as expected in MSIE, but Firefox implements a different DOM which throws exceptions ("selectNodes is not a function" or "selectSingleNode is not a function"). Try these:
 function XSelectNodes(xmldok, elementPath)
 {
 if (window.ActiveXObject)
 {
 return xmldok.selectNodes(elementPath);
 }
 else
 {
 var xpe = new XPathEvaluator();
 var nsResolver = xpe.createNSResolver((xmldok.ownerDocument == null) ? xmldok.documentElement : xmldok.ownerDocument.documentElement);
 var results = xpe.evaluate(elementPath, xmldok, nsResolver, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
 var i, nodes = [];
 for (i=0; i < results.snapshotLength; i++)
 {
 nodes[i] = results.snapshotItem(i);
 nodes[i].text = nodes[i].firstChild ? nodes[i].firstChild.nodeValue : "";
 }
 return nodes;
 }
 }
 function XSelectSingleNode(xmldok, elementPath)
 {
 if (window.ActiveXObject)
 {
 return xmldok.selectSingleNode(elementPath);
 }
 else
 {
 var xpe = new XPathEvaluator();
 var nsResolver = xpe.createNSResolver((xmldok.ownerDocument == null) ? xmldok.documentElement : xmldok.ownerDocument.documentElement);
 var results = xpe.evaluate(elementPath, xmldok, nsResolver, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
 return results.singleNodeValue;
 }
 }

Historical tech post: Bugs I have seen - ASP.NET checkbox controls (01 Nov 2006)

I have run into a couple of issues with ASP.NET CheckBox server controls. When a CheckBox is nested inside an ItemTemplate inside a Repeater control, the CheckedChanged event doesn’t fire for me. But let's say the Text of each CheckBox is set like this:


    Text='<%# DataBinder.Eval(Container, "DataItem.columnX")%>’ CssClass="hideme"


 where the hideme CSS class looks like:


 <style>.hideme LABEL { DISPLAY: none }</style>


The result is that each checkbox can have a unique Text property, and the CSS class makes it invisible, so it's essentially a custom control property. Then do:


 foreach (RepeaterItem dataItem in RepeaterDataTable.Items)
 {
    CheckBox itemCb = (CheckBox) dataItem.FindControl("CheckBox1");
       ...


The loop gets at each CheckBox and you can then see the Text property.
Also, an onclick property can be specified for a CheckBox, but the CheckBox server control has no such documented property. Microsoft documents that arbitrary attributes can be applied to the rendered HTML control. For example, a CheckBox is rendered as an HTML input control of type checkbox. A CheckBox can be created to call a JavaScript function, client-side, by adding the following line to a code-behind method:
    cb1.Attributes.Add("onclick", "jsFunc();");
The CheckBox will also invoke server-side methods as usual.