All posts by a.philippi

download from a stubborn ftp using wget

We had the following issue:
Status:	Resolving address of ftp.example.com
Status:	Connecting to 192.0.43.10:21...
Status:	Connection established, waiting for welcome message...
Response:	220 Welcome to this FTP Server
Command:	USER our-username
Response:	331 Please specify the password.
Command:	PASS *******
Response:	230 Login successful.
Status:	Connected
Status:	Retrieving directory listing...
Command:	PWD
Response:	257 "/"
Command:	TYPE I
Response:	200 Switching to Binary mode.
Command:	PASV
Response:	227 Entering Passive Mode 
Command:	LIST
Error:	Connection timed out
Error:	Failed to retrieve directory listing
the FTP server just would work in passive mode, and about every FTP-Client
we had was defaulting to Passive mode because we are behind a rooter and
obviously most ports aren't forwarded for security reasons.
What worked in the end was WGET
wget -m ftp://username:password@ftp.servername.com/foldername --no-passive-ftp
the -m option for wget means "mirror", so it mirror the folder structure on the server
(this is similar to -r but you don't have to specify which files using *
--no-passive-ftp sets wget to use only active connection




typo3: different max width for images in different columns

The problem:

We usually have several content regions populated in the TS-Template like this:


subparts.main_content < styles.content.get subparts.main_content.select.where = colPos = 1 subparts.second_content < styles.content.get subparts.second_content.select.where = colPos = 2

etc...

You can define a global maxW for images, but often this needs to be specific for every content region.

And this is how it should be done:

instead of:


subparts.right_content < styles.content.get subparts.right_content.select.where = colPos = 2 subparts.right_content.slide = -1

you must use:


subparts.right_content = COA
subparts.right_content{
5 = LOAD_REGISTER
5.maxImageWidth = 320
10= COA
10 < styles.content.get 10.select.where = colPos = 2 10.slide =-1 15 = RESTORE_REGISTER }

post request freeze with firefox, nginx, ssl

We had the following issue:

We have a webapplication available over a secure connection (ssl/https). We use nginx on a freeBSD-host as webserver.

When submitting large forms via “ajax post request” the request freeze/ we do not get any answer.
This happens only in Firefox 3.5, 4 and 5, only when accessing the webapplication over https – when submitting forms that generate o POST request larger than aprox. 16k.

Finding absolutely no documentation about this kind of behavior, be tried several options.

Our solution was to increase the following 2 variables in nginx.conf:


client_header_buffer_size 8k; (default 1k)
client_body_buffer_size 256k; (default 8/16k)

Now it works – we tested with a maximum POST size limit of 300k.

ruby Date, DateTime to Time conversion

Sometimes I needed to convert a Date or a DateTime object to it’s Time-class equivalent.

Note that Date can be converted to Time without loosing “a lot of information”.

However, in a lot of cases we do not care about these details – we just need a method that conversion.

You can paste the following snippet in your ruby-code – tested with ruby 1.8.7 (2010-08-16 patchlevel 302)

class Date
  def to_time    
    usec = self.respond_to?("sec_fraction")? (self.sec_fraction * 60 * 60 * 24 * (10**6)).to_i : nil    
    h = self.respond_to?("hour")? self.hour : nil
    m = self.respond_to?("min")? self.min : nil
    s = self.respond_to?("sec")? self.sec : nil
    Time.local(self.year, self.month, self.day, h, m, s, usec)
  end
end

This enables you to write:
Date.today.to_time
DateTime.now.to_time

freebsd cron envidonment variable COLUMNS

Today another strange issue – involving a cronjob on freebsd 8.1 which delivers different results when run from the console:

I’m running
ps aux
from the console and I get the expected results.

I’m running the same thing from the crontab – the lines are cut/truncated.

The solution was to specify the COLUMNS-environment variable…

This can be done by writing
COLUMNS=250 at the top of the crontab, or by prepending the command to be executed like this

*/10 * * * * COLUMNS=250 /path/to/my/script.sh

getting bundler, unicorn to play nice with a rails 2.3.x-app

We have a situation here:
– a rails 2.3.5 app
– unicorn must be used as deploy solution
– rack gems 1.1.0 AND 1.0.1 installed

unicorn_rails requires rack 1.1.0
after that somewhere in the rails app rack 1.0.1 is required

So we get an error like this: “can’t activate rack (~> 1.0.1, runtime) for [], already activated rack-1.1.0”

Our solution:
– use bundler: http://gembundler.com/
– small modifications in the rails 2.3.x-files: http://gembundler.com/rails23.html
– configure and create the gem bundle
– start unicorn in the “bundler context” like this:
/usr/local/bin/bundle exec “/usr/local/bin/unicorn_rails -c config/unicorn.rb -E production”

powermail long forms optimisations

We are often using the great powermail extension for typo3.

At the current project we have some very long forms – the user needs to scroll several “monitors” to finish.

And now we have the following problem: if one of the upper mandatory form fields isn’t completed or has an invalid form – the user does not see it and the form will not submit.
That’s why we extended the form validator with a callback function that scrolls up to the first error.

Here is the typoscript setp code we used in the template:


    page.jsFooterInline.10.100.100 = TEXT
    page.jsFooterInline.10.100.100.value (

        powermail_validator = $('.tx_powermail_pi1_form').validator($.extend({
           inputEvent: 'blur',
           grouped: true,
           singleError: false,
           onBeforeValidate: function(e, els) {               
               clearPlaceholderValue(e, els);
           },
           onBeforeFail: function(e, els, matcher) {
               setPlaceholderValue(e, els, matcher);
           }
        }, powermail_customValidatorConfiguration)).bind("onFail", function(e, els)  {   
              $('html,body').animate({ "scrollTop": $(els[0].input).offset().top-50}, 1000);             
           });

        )

Ubuntu Bios update for Dell Vostro 430

I have a Dell Vostro 430 with an old BIOS (2.0.1). This BIOS has a annoying bug with detecting incorrect temperatures…. Details here

I tried updating the every way suggested by Dell or the community for Linux users:

My system ID is 0x02EC, and there simply was no “system_bios_ven_0x1028_dev_0x02EC…” here http://linux.dell.com/repo/firmware/bios-hdrs/

In the end the solution was simple.