Cool URIs don’t change
August 30, 2006 | In WebTechnology | No Comments From the W3C: Cool URIs don’t changeAnyone have any advice on how to reconcile this with transitioning to a CMS?
Here is my answer: Use Joomla for your CMS. ( www.joomla.org ) Install the ARTIO SEF component. (1-click install in Joomla admin interface.). Wow! Those URL’s are awesome!
This ugly url: http://www.antioch.edu/admincomputing/index.php?option=com_frontpage&Itemid=1
becomes this: http://www.antioch.edu/admincomputing/home/index.php
I thought crappy URL’s were endemic to all CMS systems… Oh I love Joomla!![]()
Working with Fixed Length Outfiles using MySQL and PHP
August 21, 2006 | In MySQL, Other Tech, WebTechnology | No CommentsCreating ASCII Fixed Length Outfiles using MySQL
- Step 1. Create a FileSpecification Mysql table.
- Step 2. Export your MySQL data using the FileSpecification Table as a map
Details:
Step 1. Create a FileSpecification Mysql table.
Create a File Specification Table:
CREATE TABLE `filespecification` (
`id` int(11) NOT NULL auto_increment,
`speccode` varchar(50) NOT NULL default '',
`fieldname` varchar(100) NOT NULL default '',
`startpos` varchar(10) NOT NULL default '',
`endpos` varchar(10) NOT NULL default '',
`length` varchar(10) NOT NULL default '',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=85 ;
Manually populate it using PHPMYAdmin or your favorite gui MySQL client.
Step 2. Export your MySQL data using the FileSpecification Table as a map
** Details forthcoming ***
Load a FLat File Into an Array
** Details forthcoming ***
check out unpack() function in php
Other Notes
Though CHAR() (as opposed to VARCHAR()) data is stored fixed-length, it is retrieved from the database without the padding. So data type definitions themselves do not seem to help.
And metadata definitions of tables are not easily retrievable until MySQL 5.x, which have information schema’s.
From the forum below, the winning answer seems to be the RPAD() function. Use it when retrieving data from database in the SQL query thus:
SELECT rpad( test, 10, ‘ ‘ )
FROM `test`
WHERE 1
Full solution forthcoming…
mysql_query(”SELECT RPAD( FName, 11 ,’ ‘ ) , RPAD( LName, 18 ,’ ‘ ) “) ; //etc
Continue reading Working with Fixed Length Outfiles using MySQL and PHP…
Powered by WordPress
RSS Feed - Syndicate this Site
and comments feed



