Monday, March 14, 2011

Fieldset Legend Compatibility issue in IE8

I ran accross a problem with IE8's use of legends and fieldsets. The content of the fieldset would appear in the legend when align was used in the legend tag. The solution is to remove align in the legend and replace it with text-align in CSS.

Thursday, April 29, 2010

Convert Metadot articles to TikiWiki pages

My company long used Metadot as our internal intranet for years, but have since moved to TikiWiki since support for Metadot is nearly dead.

This script will help you move articles from Metadot to TikiWiki.

Requirements: TikiWiki "HTML" Plugin must be enabled
Warning: Backup your TikiWiki database before trying this script. It worked for my setup, but may cause yours to blowup.

/**************************************
This script will transfer articles in metadot to tikiwiki wiki pages
***************************************/

//Metadot DB Info
$metadotdburl = "localhost";
$metadotdbuser = "username";
$metadotdbpass = "password";
$metadotdbname = "metadotdb";

//TikiWiki DB Info
$tikidburl = "localhost";
$tikidbuser = "username";
$tikidbpass = "password";
$tikidbname = "tikiwiki";

/**************************************
Only edit the variable above this line
***************************************/

echo "Starting...\n";

$db = mysql_connect($metadotdburl, $metadotdbuser, $metadotdbpass);
if (!$db) { die('Could not connect: ' . mysql_error()); }
echo "Connected successfully to Metadot database.\n";

$db_selected = mysql_select_db($metadotdbname, $db);
if (!$db_selected) {
die ('Can\'t use '.$metadotdbname.' : ' . mysql_error());
}

$sSql = "SELECT DISTINCT name,description,longdescription,UNIX_TIMESTAMP(UpdateDate),UNIX_TIMESTAMP(CreationDate) FROM instance where name<>'' AND description<>'' AND isA='Category' GROUP BY name;";
$nResult = mysql_query($sSql);
$num = mysql_numrows($nResult);
echo "Converting " . $num . " articles.\n";
$i=0;
mysql_close();

$db = mysql_connect($tikidburl, $tikidbuser, $tikidbpass);
if (!$db) { die('Could not connect to '.$tikidburl.': ' . mysql_error()); }
echo "Connected successfully to TikiWiki database.\n";

$db_selected = mysql_select_db($tikidbname, $db);
if (!$db_selected) {
die ('Can\'t use '.$tikidbname.' : ' . mysql_error());
}

while ($i < $num) {
$pageName = mysql_result($nResult, $i, "name");;
$data = mysql_result($nResult, $i, "description");;
$description = mysql_result($nResult, $i, "longdescription");;
$lastModif = mysql_result($nResult, $i, "UNIX_TIMESTAMP(UpdateDate)");;
// $page_size = mysql_result($nResult, $i, "PacketNum");; //size of $data in bits.
$created = mysql_result($nResult, $i, "UNIX_TIMESTAMP(CreationDate)");;
$data = "{HTML()}" . $data . "{HTML}";
$data = ($data);

$sSql = "INSERT INTO tiki_pages(pageName,hits,data,description,lastModif,version,user,IP,cache_timestamp,is_html,created,wysiwyg,version_minor) VALUES('".addslashes($pageName)."','0','".mysql_real_escape_string(htmlspecialchars($data))."','".addslashes($description)."','".$lastModif."','1','admin','1.1.1.1','0','0','".$created."','n','0')";
$result = mysql_query($sSql);
if (!$result) {
echo "Invalid query: " . mysql_error() ."\n";
} else {
echo "TikiWiki Page " .$pageName. " has been created.\n";
}
$i++;
}
echo "Complete";
mysql_close();

?>

Tuesday, March 25, 2008

Fix Broken Element Electronics mp3 player

I purchased one of those small cheap USB 1GB Element Electronic mp3 players from Circuit City. 1 weeks afer purchase the thing would freeze after powering up. Here's how you can fix it under Linux (Windows users might be out of luck).

Plug player into USB. It should auto-mount. Check 'mount -l' and umount the device (it will look something like /dev/sdb1)

Run:
fsck.vfat -a -v /dev/sdb1

Tuesday, February 19, 2008

Remotely execute programs via SSH on local display

Lets pretend you are laying in bed with your laptop and want to run a South Park episode on your desktop across the room without getting up. Lets do it:

ssh user@192.168.1.5
export DISPLAY=":0.0"

Saturday, May 5, 2007

APlus.net/Names4ever is WORST EVER

Here is my horrible Aplus.net story. I took over IT for a upstart manufacturing company about 7 months ago. The company website was hosted with aplus.net using Aplus's registrar names4ever for our two domains.


My first headache with Aplus occurred with my first task of adding a simple sendmail form on our website. The local serverinfo showed sendmail at /usr/sbin/sendmail. My script errors at “sendmail cannot be found”. A phone call to Aplus support and I'm told that the problem is my own script (my script is fine). Aplus support was condescending and could care less about my problem. Their outsourced support had no clue what sendmail was or even how the Unix permission system worked. After multiple phone calls and hours of time wasted I bagged the script and set the form up to use a sendmail script on another server.


After this trouble I hurried to transfer the domains to a decent registrar and move our websites to our own colocated servers which were up in place by then. I called Aplus support once again. Most of their reps don't speak clear English forcing you to hang up and keep calling until you get somebody understandable. I finally get to explain that I need the privacy setting removed from my domain records making it possible to transfer the domains. The short story here is that it took 40 DAYS, 2 dozen phone calls and 3 payments for the same domain transfer to get the registrar information updated and 1 domain transferred.


I'm in my last couple days with Aplus.net with only one transfer to go (though its been in “waiting for approval from current registrar” status for 6 days). My sincere hope is that somebody reads this and is able to avoid Aplus.net. When you look for a web hosting company avoid outsourced technical/customer support. Support service should always be in-house for hosting companies. And if your website means anything to you its worth a few extra bucks to host with somebody reliable.

Thursday, December 14, 2006

Metadot Installation Notes

Note: The Metadot installation is a little difficult. Most of the installation instructions assume use of Apache 1.x and a self compiled mod_perl. It took me about 7 hours to get this thing running on FC5 but was well worth it.
Also use metadot instructions:
http://www.metadot.com/metadot/index.pl?id=2558&isa=Category&op=show#min_reqs

Requirements:

Linux - Fedora Core 5
Apache 1.3.6
Perl 5.005_03
mod_perl 1.21
MySQL 3.23.xx


1. Start by installing the following rpm's from the FC5 repos:
httpd
mod_perl
mysql-devel installed
mysql-client
mysql-server

2. Start Mysql: /etc/init.d/mysqld start
3. Install Perl Modules:
The Expat module has to be compiled from the below source:
http://superb-east.dl.sourceforge.net/sourceforge/expat/expat-2.0.0.tar.gz
$bash > tar -xf expat-2.0.0.tar.gz
$bash >./configure
$bash >make
#bash >make install

Now install the following modules using CPAN:

$bash > perl -MCPAN -e shell
cpan> install LWP
cpan> install DBI
cpan> install Bundle::Mysql (make sure you have a 'test' database in mysql)
cpan> install Apache::DBI
cpan> install XML::RSS (this one gave me test errors, see below)
cpan> install Storable (Only needed for Metadot version 6.3.x and below. No longer needed on >= 6.4.x)
cpan> install Net::LDAP (also gave errors, see below)
cpan> install Log::Agent
cpan> install Mail::POP3Client
cpan> install IO::Stringy
cpan> install Mail::Internet
cpan> install MIME::Tools
cpan> install Unicode::String
cpan> install Spreadsheet::WriteExcel
cpan> install Date::Calc
cpan> install AppConfig
cpan> install Image::Size
cpan> install Template
cpan> install Time::HiRes
cpan> install Lingua::EN::NameParse
cpan> install Number::Format
cpan> install XML::Simple
cpan> install Text::CSV_XS
cpan> install Archive::Zip
cpan> install Date::Manip
cpan> install XML::Dumper
cpan> install HTML::TreeBuilder
cpan> install HTML::FormatText

I had errors installing XML::RSS and Net::LDAP so i just installed their RPM packages from FC5:
perl-XML-RSS
perl-LDAP

4. Download http://download.metadot.com/Metadot6.4.5.4.tar.gz
extract (tar -xf Metadot6.4.5.4.tar.gz) and move to /var/www/html/
$bash> chmod ugo+rx /var/www/html/metadot
$bash> chown -R apache.apache /var/www/html/metadot

5. Setup Mysql database and user.
Note: The script to create the metadot database and user is /var/www/html/metadot/default_data/createdbanduser.sql, but this isn't formatted correcly. So I just created the database 'metadotdb' and the user 'metadot' using mysql-administrator and gave the metadot user all access to metadotdb.

Now add the sample data:
$bash > mysql -u root -p metadotdb < /var/www/html/metadot/default_data/sampledata.sql 6. Configure Metadot conf files: edit /var/www/html/metadot/etc/metadot.conf
name = dbi:mysql:metadotdb
user = metadot
pass = (metadot user password)
dbtype = MySQL
featureset = open

7. Configure Apache. (this part will get you caught as well) Edit /etc/httpd/conf/httpd.conf
Make sure you have these lines:
LoadModule perl_module modules/libperl.so
AddModule mod_perl.c
DirectoryIndex index.html index.pl index.html.var

Add these lines:
Alias /images/ /var/www/html/metadot/html/images/
Alias /js/ /var/www/html/metadot/html/js/
Alias /metadot/ /var/www/html/metadot/metadot/
Alias /public/ /var/www/html/metadot/sitedata/public/
Alias /skins/ /var/www/html/metadot/sitedata/skins/
Alias /intranet/ /var/www/html/metadot/metadot/
PerlOptions +Parent
PerlRequire "/var/www/html/metadot



SetHandler perl-script
PerlHandler ModPerl::Registry
Options +ExecCGI
DirectoryIndex index.pl




AllowOverride None
Order allow,deny
Allow from all


Now create this file (/var/www/html/metadot/setcwd.pl) with the below information:
#!/usr/bin/perl

use lib "/var/www/html/metadot/metadot";

use Cwd;
chdir "/var/www/html/metadot/metadot";
1;
#--------------------------------------

You should be able to see http://servername/metadot/