Creating images for HTML emails with GIMP

If you’re designing HTML emails (for instance, newsletters or other mails that are not created with a Mail User Agent), you will know that you have to use HTML 3.2 because of Outlook 2007 and its strange Word 2007 rendering. (By the way, I’d even extend Microsoft’s argument that Word is better for security reasons because it doesn’t understand scripts and suggest using Word 2007 as the default browser for every computer.)

In Word/Outlook 2007 Background images are only accepted in this format:… Continue Reading

Typo3: show login page for protected pages when user not is logged in

The problem: If you have pages which are only accessible for certain FE user groups, some of your users may bookmark these protected pages and return when they are not logged in (or you may send the URLs in a newsletter, etc.). Typo3 handles this case as a “404 Page not found” situation (I don’t know why they think 401/403 and 404 are the same, but I can’t change it).

So if you want to show a login form in this case, but a 404 error page if the page is “really” not there, you have to write a user-defined page-not-found-handling … Continue Reading

Typo3: htmlRTE “Zebra” tables (classes for odd/even rows) using TSConfig

It took me some hours and the documentation is not very good, but finally I have found out how to mark up table rows from RTE tables (not elements with content type “table”) with alternating CSS classes. Put this into your page TSConfig:
RTE.classes.zebra-rows {
  name = Zebra table
  alternating.rows {
    startAt = 1
    oddClass = odd
    evenClass = even
  }
}

RTE.default {
  ignoreMainStyleOverride = 0
  inlineStyle.zebra-tables (
    table.zebra-rows { }
    table.zebra-rows tr { background: lime; } /* or whatever color */
    table.zebra-rows tr.odd { background: red; } /* or whatever color */
  )
  classesTable = zebra-rows
  classesTR = odd, even
  proc.allowedClasses … Continue Reading

IE6: AlphaImageLoader rendering problem when 3D acceleration available

If you ever had the pain to code Web designs with the goal to support IE6, you will know the AlphaImageLoader workaround to “emulate” transparent PNGs. Of course, this workaround brings new problems, for instance the problem that links are not clickable when positioned over a AlphaImageLoader PNG. This can be fixed with position: relative.

You won’t believe it …

However, I discovered a fairly new problem that surprised even me: there’s a bug with ImageAlphaLoader that hides part of Web pages when and only when 3D hardware acceleration is available. You can test this with 2 environments:

Typo3 acceleration experience

How to accelerate Typo3 for a page with relative high load?

No statistically significant data but just a few benchmarks (made with ab) for the feeling:

Typo3 (no_cache = 1): ~ 1 rq/s
Typo3 (with cache): ~ 3 rq/s
Typo3 (with cache and eAccelerator): ~ 50 rq/s
Typo3 (with cache, eAccelerator and Squid reverse proxy): ~ 2000 rq/s

Creating an empty Typo3/4.2 installation that supports UTF-8

I always use UTF-8 with my Typo3 installations even if it’s not needed in the first version of the Web site because translation is a requirement often arises at a later time.

The way I create my new, empty Typo3 4.2 installation that fully supports UTF-8:

  • Create the database with
    CREATE DATABASE tt_new_site DEFAULT CHARSET ‘UTF-8’;
    GRANT ALL ON tt_new_site.* TO ‘new_site’@’localhost’ IDENTIFIED BY ‘password’;
  • Unzip the dummy.zip from typo3.org into the new installation’s directory
  • Create correct typo3_src symlink
  • Set permissions correctly (I made a script for this)
  • Create typo3conf/ENABLE_INSTALL_TOOL
  • Do necessary Web server setup
  • Go to http://new_site/
  • Do not use the 1-2-3 setup, but go to the Install Tool directly
  • In … Continue Reading

Comparing myisam_suggest with a book’s index

Recently I had an idea how to illustrate how myisam_suggest works by a comparison with a normal printed book’s index:

“AutoSuggest” for a printed book

Image you have a thick book with hundreds of thousands of words in it. Now you want to know all words beginning with “fu” for some reason (= AutoSuggest).

Without the (full-text) index on the book’s last pages, you’d have to read the whole book, remember all words, sort them alphabetically, erase duplicates and then look at the words beginning with “fu”. A very time-intensive process.

However, if an index is available, you can just scroll to the … Continue Reading

Rails: Digitally sign outgoing emails (S/MIME)

In this article, I will introduce one method to digitally sign outgoing emails with S/MIME using Ruby on Rails.

require ‘openssl’ vs. Kernel.system openssl

At first, I tried to sign mails using the Ruby OpenSSL library which is basically a lightweight wrapper for libopenssl. However, I was not successful; I found out how to create PKCS7 signatures in general, but not especially for S/MIME mails.

So I decided to use the openssl command line tool that can be invoked like this:
openssl smime -sign -signer $CERT_FILE -passin pass:$CERT_PASS
-in $UNSIGNED_MAIL -out $SIGNED_MAIL -certfile $CERT_CA_FILE
-from ‘your ’ -to ‘recipients <email@address>’
Continue Reading

Rails: Using HTML typography automatically

There’s a way you can use special characters for HTML typography in Rails without much work: Just let your views about raw text and then overwrite the html_escape (h) method:

module ApplicationHelper

def h(s)
super(s). \
gsub(‘(c)’ , ‘&copy’). \
gsub(‘(r)’ , ‘®’). \
gsub(‘(tm)’ , ‘™’). \
gsub(’ 1/2 ‘, ’ ½ ‘). \
gsub(’ 1/4 ‘, ’ ¼ ‘). \
gsub(’ … Continue Reading

Rails 2.3: Using ActiveRecord from within console application

If you use Ruby on Rails and want to have access to ActiveRecord and all the other nifty features from within a standalone Ruby script (for instance, a cronjob script that checks integrity of your data), all you need to do is including the “environment” script that fully sets up the Rails environment. In this case I use the “../config” path because my script is located in the app’s “scripts” directory.

#!/usr/bin/ruby
require ‘../config/environment’

# now all Rails features are available, all plugins loaded etc.

# demo
records = Model.find :all
for r in records
puts ‘Checking ’ + r.name + ’ …’
end

blog.dev001.net is Digg proof thanks to caching by WP Super Cache