Thursday 10 February 2011

Inserting Google visualizations in Wordpress blogs

I tried to insert a Google visualization into my (other) blog. I run into problems that Google itself solved.

The solution? Use the Custom fields shortcode plugin for Wordpress: first, install and activate it. Then, wherever your visualization goes, insert

[cf]this_is_my_tag_name[/cf]

If your plugin is properly inserted, at the bottom of the page you will see a form with title "Custom fields". Add a new custom field with name this_is_my_tag_name and paste the code for your visualization into the adjacent field.

The plugin will replace your tag with the code you inserted and your visualization will be properly shown in your entry.

Padding text with leading zeros in Teradata

In order to pad a number with leading zero Teradata you can do as follows:

create set table my_table ,no fallback ,
no before journal,
no after journal,
checksum = default
( a integer )
primary index ( a );

insert into my_table select 25;
insert into my_table select 12345;
insert into my_table select 0;

select substr(
'00000' || cast( a as varchar(5) ),
characters( cast( a as varchar(5) ) ),
5 )
from my_table;

The relevant part lies in the use of the functions substr and characters.