Blog, Blog Help, BlogML, Wordpress, XML

BlogML importer for WordPress 2.5

I had a blog server which I felt compelled to migrate to WordPress 2.5. The existing blog server can only emit the data in the BlogML format. So I set out to find an BlogML importer for WordPress 2.5. I stumbled upon Aaron’s post on importing to wordpress. So here is what needs to be done:

  • Downloaded WordPress BlogML import module from Aarons site (blogml_wp_2.3.zip)
  • Upload a copy of the BlogML.php file to your wp-admin/import folder
  • Edit the file and change the PATH_TO_CURRENT_DIRECTORY to point to the folder where import.php exists.
  • Download the PHP XPath library 3.5 from Sourceforge
  • Upload a copy of the XPath.class.php file to your wp-admin/import folder

We are all set now. Just go to your wordpress admin page and navigate to Manage -> Import. If all is well, then you should see an entry for BlogML. Just click on the link and follow directions to import the BlogML file into your WordPress blog.

PS:  Once you click on the BlogML link on the import page if you are unable to view the “Upload file and import” button then don’t worry, just open up the BlogML.php file and modify the following lines:

// Instantiate and register the importer
include_once(‘import.php’);
if(function_exists(‘register_importer’)) {
    $blogml_import = new BlogML_Import();
    register_importer(‘blogml’, ‘BlogML’, (‘Import posts, comments, users, and categories from a BlogML file’), array ($blogml_import, ‘dispatch’));
}

to

// Instantiate and register the importer
//include_once(‘import.php’);
//if(function_exists(‘register_importer’)) {
    $blogml_import = new BlogML_Import();
    register_importer(‘blogml’, ‘BlogML’, (‘Import posts, comments, users, and categories from a BlogML file’), array ($blogml_import, ‘dispatch’));
//}

 

Many thanks to Aaron for the plugin.

Microsoft, Technical, Tools

Sysinternals Live

If you are a Sysinternals fan then this one is for you. Microsoft has announced the launch of Sysinternals Live. Ever since Microsoft took over Sysinterals the one thing that i have detested is the need to search for a particular utility and scrolling to the bottom of the page just to download it. But Sysinternals live changes all of that. If you frequent Regmon, Filemon, Process Explorer, Whois, autoruns, Bginfo amongst the myriad of tools offered by Mark and his team then check this out. Just go to Start -> Run and type in

\\live.sysinternals.com\tools

This should give you the list of all the tools at on place. This should save us some time as well as avoid the need to go to Google every time we need the link to a specific Sysinternal utility.

.net, C#, Microsoft, Technical

.Net CLR Windows Service and the ConfigurationManager class

I created a new windows service and attached a App.Config file to it. Then I went back to the code and tried this:

System.Configuration.ConfigurationManager.GetSection(“Extras”);

For some reason the compiler was not able to figure out the class and kept throwing an error. This does not happen with your standard EXE projects as well as ASP.NET projects. I also did not want to use the
ConfigurationSettings.GetConfig() method as it was obsolete. I fiddled around for a while and eventually ended up manually adding a reference to the
System.Configuration DLL. For those who don’t know, just right click on the References folder in your project, click on Add Reference. Select System.Configuration in the .NET tab and click OK. This should allow you to access the ConfigurationManager class. Back to work now..

I will some day write a post on how to implement custom configuration sections in the App.Config file.

Code, Microsoft, Performance, SQL, SQL Server, T-SQL, Technical

Computed Columns in SQL Server 2005

“Computed Columns” as the name suggests allows you to set the value of a column based on other columns data. Here’s how you could specify the formula in T-SQL:

--Create Table
CREATE TABLE T1 (
    a INT, 
    b INT, 
    operator CHAR,
    c AS CASE operator
        WHEN '+' THEN a+b
        WHEN '-' THEN a-b
        ELSE a*b
    END
    PERSISTED
) ;

--Insert dummy data into it
INSERT INTO T1 VALUES(1,2,'+')
INSERT INTO T1 VALUES(5,3,'-')
INSERT INTO T1 VALUES(4,4,'')

--View the results
SELECT * FROM T1

Notice the keyword PERSISTED. This will enable the computed column value to be stored physically on to the disk so that it need not be created every time you ask for it. Creating an index on this computed column will improve performance by doing a seek rather than a table scan.

If you want to specify the above computed column in SQL Server management studio directly you can do this:

Modify the table. Go to the computed column specification for the specific column. Expand it and type the following in the “Formula” field:

(CASE [operator] WHEN '+' THEN [a]+[b] WHEN '-' THEN [a]-[b]

ELSE [a]*[b] END)

Enter without line breaks. If you want the column values to be persisted in the storage medium, just change the value of “Is Persisted” to “Yes”