Monday, February 26, 2007

phpMyAdmin and the "Client does not support authentication" Error

When you see the following error...
#1251 - Client does not support authentication protocol requested by server; consider upgrading MySQL client
...there is a problem with the password you created for a user. You'll need to run...
mysql> SET PASSWORD FOR 'username'@'host' = OLD_PASSWORD('password');
See http://dev.mysql.com/doc/refman/5.0/en/old-client.html for more information.

Friday, February 23, 2007

Firefox and Internet Explorer Development Tools

I always lose this, so here's the list of Firefox extensions I'm using
  • DOM Inspector
  • Firebug
  • Flashblock
  • Header Monitor
  • Live HTTP Headers
  • Web Developer
  • XML Developer Toolbar

On Internet Explorer, I have the IE Developer Toolbar

Tuesday, February 20, 2007

View Results from the Textml QueryAnalyzer Object

I wasn't sure if I had an error in my code or if I uncovered a bug in Textml's QueryAnalyzer, so I wrote a little ASP.NET page where I could pass in a search string and see what QueryAnalyzer would do with it. This is how I found the bug with their .NET implementation of the choice operator.

Here are the ASPX and C# files
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="QueryAnalyzer.aspx.cs"
Inherits="QueryAnalyzer" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>QueryAnalyzer Test Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:TextBox ID="txtQuery" runat="server"></asp:TextBox>
<asp:Button ID="btnRun" runat="server" Text="Run" /><br />
<div id="divQuery" runat="server"></div>
<div id="divError" runat="server"></div>
</form>
</body>
</html>

--

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Ixiasoft.TextmlServer;
using Ixiasoft.TextmlServer.Tools;

public partial class QueryAnalyzer : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Page.IsPostBack)
{
divError.InnerHtml = "";
divQuery.InnerHtml = "";
IxiaQueryAnalyzer TextmlQueryAnalyzer = new IxiaQueryAnalyzer();
try
{
string queryEdited =
TextmlQueryAnalyzer.GetXMLQueryString(txtQuery.Text, "words");
divQuery.InnerHtml = HttpUtility.HtmlEncode(queryEdited);
}
catch (Exception ex)
{
divError.InnerHtml += "<br />" + ex.ToString() +
"<br />" + ex.StackTrace.ToString() +
"<br />Passed to QueryAnalyzer: " +
HttpUtility.HtmlEncode(txtQuery.Text);
}
}
}
}

Wednesday, February 14, 2007

Searching Textml for Words with Tildes

Document searches in Textml are insensitive to case and ... in most cases ... special characters. For example, searches for "José Martí" and "jose marti" should return the same results set in the same order. But there is at least one exception to this, ñ. A search for "quinceañera" will return a different set of results when compared to "quinceanera." Ixiasoft has reported this is a feature based on requests from their Spanish-speaking partners and customers, which make sense because the two are different characters in the Spanish alphabet.

One solution is to add a hidden element to the document that contains the alternate spelling.

Another solution is to use the <oneof> element. To do this you would intercept each word at the application level and modify words with "ñ" or "n." That part of the query might look something like this:
<elem>quincea<oneof><choice>ñ</choice><choice>n</choice></oneof>era</elem>
If you have to support this particular feature, neither solution is very palatable.

UPDATE 1: If you try and pass the choice operator to the Textml QueryAnalyzer object in .NET, it will throw an exception. quincea[n,ñ]era as a search string will fail. I've submitted this bug to Ixiasoft and I'm waiting for a response.

UPDATE 2: Ixiasoft has responded that this is a bug and is due to be released in their newest package, 3.6.1.1542.

Sunday, February 11, 2007

Determine the Encoding of an XML File: Method 1

In Visual Studio 2003, I needed a way to determine the encoding of an XML file. I found some information about reading the byte order mark (BOM) on a file, but I couldn't get it to work properly. The alternative approach below seems to be working. In this example, I needed the file to be UTF-8.
String encoding = DetectEncodingXml(); 
if(encoding.IndexOf("UTF-8") > -1)
{
/* This is what we want. Run the code. */
}
else
{
/* Display error message. */
}
private string DetectEncodingXml()
{
try
{
XmlTextReader xreader = new XmlTextReader(openFileDialog.FileName);
xreader.Read();
Encoding xreaderEnc = xreader.Encoding;
string xreaderEncString = xreaderEnc.EncodingName;
return xreaderEncString;
}
catch(Exception ex)
{
return " Encoding could not be detected. ";
}
}