addendum for AWstats, Plesk 8 and suexec

in the article "AWstats, Plesk 8 and suexec" i showed how to set up AWstats on a Plesk 8 system without all the suexec-trouble. recently one of my servers made another trouble, because the FollowSymLinks was missing. so i wrote this addendum.

in your vhosts.conf and vhost_ssl.conf the changes should be:

vhost.conf:

<Directory /srv/www/vhosts/foo.com/httpdocs>
        Options +FollowSymLinks
</Directory>
ScriptAlias /awstats/ "/srv/www/vhosts/foo.com/httpdocs/awstats/"
<Directory "/srv/www/vhosts/foo.com/httpdocs/awstats/">
        Options none
        AllowOverride None
        Order allow,deny
        Allow from all
</Directory>

vhost_ssl.conf:

<Directory /srv/www/vhosts/foo.com/httpsdocs>
        Options +FollowSymLinks
</Directory>
ScriptAlias /awstats/ "/srv/www/vhosts/foo.com/httpdocs/awstats/"
<Directory "/srv/www/vhosts/foo.com/httpdocs/awstats/">
        Options none
        AllowOverride None
        Order allow,deny
        Allow from all
</Directory>

read more/write a comment

Friday, 30. November 2007 • general0 comments/trackbacks

button-tag in MSIE

handgestrickt had to construct a very complex form. it was necessary to transfer several named actions when the user clicks a button. additionally these buttons were embedded in one form-tag.

according to the HTML-specs you can use the following construct:

<form action="foo.php" method="post">
    <input type="checkbox" name="batch[]" value="1" /> value 1<br />
    <input type="checkbox" name="batch[]" value="2" /> value 2<br />
    <input type="checkbox" name="batch[]" value="3" /> value 3<br />
    <input type="checkbox" name="batch[]" value="4" /> value 4<br />
    ...
    <button type="submit" name="action" value="edit">Edit</button>
    <button type="submit" name="action" value="copy">Copy</button>
    <button type="submit" name="action" value="delete">Delete</button>
</form>

in all standard compliant browsers, the name-value-pair gets transfered as expected. all Internet Explorers do the following: they pass all buttons at once, with the name as key and the inner HTML of the button-tags...

read more/write a comment

Friday, 07. September 2007 • general0 comments/trackbacks

image nosave with mooTools 1.11

a lot of photographers use FLASH for another good reason: it is impossible to save the images contained in the FLASH.

as an alternative, handgestrickt had the idea to place a completely transparent layer over every image with the rel-attribute of "nosave" or a nosave-attribute set to "nosave". this works in every modern browser, with one limitation in Opera: the images have to have a width and height. otherwise Opera (or mooTools) cannot measure the width and height of the image.

requires: mooTools 1.11 (Window.DomReady, Element.Dimensions)

here is the code:

var nosave = new Class({
    initialize: function() {
        window.addEvent('domready',this.prepare.bindAsEventListener(this));
        return true;
    },

    prepare: function() {
        var imgs = $$('img');
        for(var a=0;a<imgs.length;a++) {
            if(
                imgs[a].getProperty('nosave') ||
                (imgs[a].getProperty('rel') && imgs[a].getProperty('rel').match(/(?:^|;)nosave(?:$|;)/i))
        ...

read more/write a comment

Tuesday, 28. August 2007 • general0 comments/trackbacks

smarty modifier for FLASH Videos

a handgestrickt customer uses the "Free Video to Flash Converter" for converting his videos to FLV-format. this program also provides a FLASH-file with a very basic player, called player.swf.

this modifier is designed to take a link to an FLV-file and convert it to an HTML-snippet including a FLASH-plugin, with the player.swf, the link as the file-argument and the link-text as the player-title. this modifier is highly configurable.

basically this modifier can also be used for other FLASH-Video-players. only tiny modifications have to be made.

the code:

<?php
function identify_modifier_flvlink2flash () {
        return array (
                'name' => 'flvlink2flash',
                'type' => 'smarty_modifier',
                'nicename' => 'FLV-Link to FLASH',
                'description' => 'Converts a Link to an FLV-Video to a fully FLASH.',
                'authors' => 'Stefan Jelner <info@handgestrickt.biz>',
                'licence' => 'GPL',
                'help' => ''
     ...

read more/write a comment

Friday, 24. August 2007 • general0 comments/trackbacks

unobtrusive scrolltext with mooTools

recently handgestrickt is really crazy for mooTools. we developed a whole bunch of unobtrusive scripts, we will publish in the future.

yesterday we had a quite simple task: we needed a scrolltext. unlike the 5 million DHTML solutions out there, where you have to fiddle your scrolltext into the JavaScript code, we wanted a scrolltext that changes any normal element with the classname "scroller" and a CSS-overflow to a scrolltext.

in mooTools this is very easy. we did the same trick as in old C64-days. first we measured the whole width of the scroller plus the width of the element. then we copied the same text at the end of the scrolltext, to make it look infinite. when the scrolltext reached the point, where it starts over, we just reseted it to zero.

following mooTools dependencies: mooTools 1.11 (Fx.Scroll, Fx.Transitions, Window.DomReady, Element.Selectors)

tested in: Internet Explorer 6.1 and 7, Firefox 1.5 and 2.0.0.6, Opera 9.01, Safari 3.0.3, Konqueror 3.4, Galeon 1.3, Mozilla...

read more/write a comment

Friday, 24. August 2007 • general2 comments/trackbacks

PHP 4 and 5 and UTF-8 BOM issues

handgestrickts favourite source-code-editor is Ultraedit 32. this editor, like many other modern editors, has a good feature to mark files as UTF-8 encoded. this mark is called BOM (byte order mark) and is a 2-4 bytes mark in the beginning of a file, that indicates which Unicode-type is used. what a brilliant idea.

unfortunately PHP 4 and 5 send these marks as output to the browser. so if later you use a session_start()- or header()-function somewhere, you end up with the error message "headers already sent in ...".

after searching the web, we found the solution: PHP 5.2.0 introduces the configure-switch --enable-zend-multibyte. this switch enables PHP to recognize the BOM as what it is. unfortunately you have to recompile PHP.

for people using PHP on windows or others hosting on a shared public webserver, there are other workarounds: the first line in your PHP code should be a comment with a Unicode-character inside, like german "Umlaute", for example. then you save this file as UTF-8...

read more/write a comment

Thursday, 26. July 2007 • general2 comments/trackbacks

newbie-Ruby

just for fun and to provide a very new service to our customers, handgestrickt learned Ruby recently. the syntax is simple, highly structured, clearly readable, yet powerful. for people who are used to read cryptic Perl-scripts, Ruby is a real delight.

in the next weeks we will have a look at Ruby On Rails.

inspite of using the Apache mod_ruby to make our Ruby-scripts running on the webserver, we just run them as CGI-scripts by adding the following to the Apache-configuration:

<IfModule mod_mime.c>
    AddHandler cgi-script .cgi .rb
</IfModule>

we do not want to hide our first efforts. the following script reads out the current folder and outputs it to the browser. you can click on a file or folder to open it.

#!/usr/bin/ruby

class Folderview
        #requiring and including necessary modules
        require "erb"
        include ERB::Util
        require "cgi"

        #constructor
        def initialize(folder = nil)
                #default values
                @folders = []...

read more/write a comment

Saturday, 21. July 2007 • general0 comments/trackbacks

new service: eyeOS-applications!

after an intense study of the apps_introduction-pages in the eyeOS Wiki, handgestrickt netzwerk now provides a new service: applications for eyeOS. after being really into PHP/AJAX-developing, this service is the current zenith of our work. we are very proud to provide the ability to make window-based, desktop-mimic applications in the web-browser possible.

read more/write a comment

Tuesday, 12. June 2007 • general0 comments/trackbacks

jsL10n and shorthand $L

yesterday handgestrickt netzwerk launched the new basic documentation and website for jsL10N, an internationalization and localization project for AJAX. the aim is to provide ISO 639, ISO 3166, UN M.49, ISO 3166-2, ISO 15924, ISO 4217 and POSIX informations in 264 different locales to AJAX-developers.

for further informations visit the official homepage of jsL10N and shorthand $L.

read more/write a comment

Tuesday, 12. June 2007 • general0 comments/trackbacks

addendum for perl and ls

today handgestrickt wrote about PHP, Perl and systemcalls. later we found a slightly faster Perl script:

here we mix perl with a systemcall to ls, telling it to list all subdirectories recursively and sort by modification time descending. in Perl we just chop the output into pieces.

test.pl

#/usr/bin/perl
$dir = '';
foreach(`ls -Rat1`) {
        if(/:$/) { $dir = substr($_,2,-2); }
        elsif(/\.(?:jpeg|jpg|jpe|gif|png)$/i) { print $dir.'/'.$_; }
}

this does the same task as todays Perl script. the result is now:

perl and ls took: 0.0277252197266 seconds

which is a little bit faster than yesterdays solution in Perl. additionally the code is shorter. unfortunately even this example is slower than the PHP solution.

read more/write a comment

Sunday, 03. June 2007 • general0 comments/trackbacks

page navigation