Showing posts with label software. Show all posts
Showing posts with label software. Show all posts

Tuesday, January 09, 2007

Wonders of Typo3

This blog moved to a new location, please visit us at http://ramble.m2m.at

A lot of people complain about Typo3. They say it is too heavy for a CMS. Perhaps they are right - it is not for script kiddies. It takes some time to get used to it. But it pays!

Today a customer complained, that one of his pages in Typo3 was missing completely. He was right, it was not there any more. What happened, was that one of his employees accidentally deleted the wrong page. No problem for Typo3.

Unfortunately there was no content versioning enabled, which made it a little bit more work:
- open the database
- find the page (write down the pid)
- change deleted from 1 to 0
- do the same for all content entries for that pid
- open the administrator of Typo3
- move the page to its correct location
- reposition the content inside the page
... done in 5 minutes

Monday, January 08, 2007

Howto shutdown Linux box automatically?

This blog moved to a new location, please visit us at http://ramble.m2m.at.

Do it once:
e.g. shutdown your linux box at 7:30 January 10th:
at 7:30 jan 10
> shutdown -h now
> CTRL-D
... make sure the at daemon is running:
/etc/init.d/atd start or rcatd start for SuSE
... and check your at queue:
atq
Do it regularly:
e.g. kill your computer every day at midnight (to make sure you get enough sleep):
crontab -e -u root
> 0 0 * * * /sbin/shutdown -h now
... save and exit ...

Typo3 Sitemap Hacks

This blog moved to a new location, please visit us at http://ramble.m2m.at.

The creation of site maps in typo3 is pretty straight forward. You can either use the built-in site-map function or the extension fl_seo_sitemap. The later has the advantage to be adjustable using CSS.

Have a look at en example for a human readable site map.

For the automatic creation of a site map for google in XML format, there exists another nice extension mc_googlesitemap. It provides functions not only to create site maps for the pages inside the typo3 CMS but also for database content such as news items. At our system, the site maps for content items did not work at first. A look at the source code showed the problem. We did not have the news items assigned to a news category. After doing so the site map worked.

Here are examples for a google site map for pages, a google site map for content items, and finally a google site map which links the other two together.

Saturday, January 06, 2007

MediaWiki Hacks III

This blog moved to a new location, please visit us at http://ramble.m2m.at.

To integrate RSS feeds there are a couple extensions for MediaWiki. The most up to date extension seems to be GISWiki/RSS which uses Magpie RSS as back end to fetch the RSS feeds.

To enable blogger atom feeds some tweaks are necessary to match the different formats:

Find the comment "# Bild items" and enter the following lines into the following foreach loop:
if (isset($item['atom_content'])) {
 $item['description'] =& $item['atom_content'];
 $item['date_timestamp'] = parse_w3cdtf($item['published']);
}
Above the "# Bild items" comment there is another foreach loop. Place the following lines inside that loop right after the if statement.
if (isset($item['atom_content']) && $item['atom_content']) {
 $description = true; break;
}
Because we did not want to show the complete description we added the following function to truncate the text:
function mTruncate($string, $length = 200, $etc = ' ...') {
 if ($length == 0) return '';
 $string = strip_tags($string);
 if (strlen($string) <= $length) return $string;       
 $length -= strlen($etc);       
 return substr(preg_replace('/\s+?(\S+)?$/', '',     
   substr($string, 0, $length+1)), 0, $length).$etc; 
}
To activate the truncate function we changed the following line
if ($text) $output.="\n$text";
to
if ($text) $output .= "\n" . mTruncate($text);
multilang breaks NOSECTIONEDIT magic word
To fix this we had to add the following line:
  $parser->mOptions->mEditSection = false; 

Thursday, January 04, 2007

vi - goto line n

This blog moved to a new location, please visit us at http://ramble.m2m.at.

To go to a certain line in vi enter the line number and then G ...

Wednesday, January 03, 2007

MediaWiki Hacks

This blog moved to a new location, please visit us at http://ramble.m2m.at.

New Start Page with $wgUseDatabaseMessages = true
Go to MediaWiki:Mainpage and enter your new star page.

New Start Page with $wgUseDatabaseMessages = false
Add the follwing code to your LocalSettings.php file:

if (empty($_GET['title'])) $_REQUEST['title'] = 'NewStartPage';

Multi-Language Extension for MediaWiki
http://www.mediawiki.org/wiki/Extension:Multilang

Change Sidebar with $wgUseDatabaseMessages = true
Go to MediaWiki:Sidebar and enter your changes.

Change Sidebar with $wgUseDatabaseMessages = false
Add your changes in Messages.php and all MessagesXX.php you use.

Friday, November 10, 2006

chm to pdf

CHM - Microsoft Compressed HTML Help - is a proprietary format for online help files, developed by Microsoft. Viewing CHM files using other operating systems is sometimes a little bit difficult.
Recently a CHM plug-in appeared for firefox which should be some help.
Sometimes it is still necessary to convert CHM files into other formats. While there are quite a lot of applications which could do that easily on Windows, it is still tricky for non-Windows systems.

e.g. for Mac OS X or other UNIX based OS

First you have to unpack the html files.
  1. Download the chmtools package.
  2. Unzip it: tar -zxf chmtools.tar.gz
  3. Go to the chmtools folder: cd chmtools
  4. Compile it: make
  5. Move the new command somewhere you can easily access it (you might have to become root to be able to do that), eg: su; cp chmdump /usr/bin
Step 1. to 5. you have to do only once.
  1. Now it is time to unpack the CHM file, eg: chmdump file.chm newFolder
Now we have to install two software packages which will do the actual html to pdf conversion.
  1. Download the fltk source (should be version 1.1 or above)
  2. Unzip it, eg: tar -yxf fltk-1.1.7-source.tar.bz2
  3. Go to the fltk folder, eg: cd fltk-1.1.7
  4. Compile it: make
  5. It could be you need to configure the compile process for your system - have a look at their manual.
  6. Install the new commands (you have to become root to be able to do that), eg: su; make install
  7. Download the htmldoc source
  8. Unzip it, eg: tar -yxf htmldoc-1.8.27-source.tar.bz2
  9. Go to the fltk folder, eg: cd htmldoc-1.8.27
  10. Compile it: make
  11. It could be you need to configure the compile process for your system - have a look at their manual.
  12. Install the new commands (you have to become root to be able to do that), eg: su; make install
Step 7. to 18. you have to do only once.
  1. Now look for the html files in the folder chmdump created.
  2. Go there, eg: cd newFolder
  3. Now you have to create a batch file containing all the html files you want to have in your pdf. Eg: ls *.thml > test.book
  4. Sometimes the files are not in the order you like. Use your favorite text editor to adjust that.
  5. Add the following two lines at the top of test.book to adjust the layout the pdf. The given format is best if you want to use the pdf file on your iLiad reader.
#HTMLDOC
-t pdf --webpage --size 12x15cm --pscommands --gray --jpeg -f test.pdf
  1. Run the batch file: htmldoc --batch test.book
  2. The result should be a pdf file called test.pdf.
Have fun

Tuesday, October 10, 2006

SpamAssassin

If you have not known SpamAssassin yet:
As it name might already say, it deals with spam (unwanted emails).

It can (and actually does quite often without your knowledge) run directly on your mail server. This has the big advantage that the spam mails can be eliminated already on your server and you do not have to download it to your computer.

However, it is very flexible. E.g. you might also want to receive spam, which SpamAssassin has marked as such and move it manually to your trash can.

More about SpamAssassin at its homepage.

Monday, October 09, 2006

train SpamAssassin

If you want to teach SpamAssassin and you are using pine, create two new folders e.g.
train-spam
train-ham
save the spam to train-spam and the non-spam mails to train-ham.

And tell SpamAssassin:
sa-learn --mbox --spam ~/mail/spam-train
sa-learn --mbox --ham /var/mail/{username}