dracoblue.net

Cache-Control revalidate

If you want to revalidate the contents of some kind of image, without delivering the entire image, on each call: no-cache-Header won't be the right choice.

You may workaround this issue, by setting:

Cache-Control: max-age=3600, must-revalidate

In by DracoBlue @ 30 Sep 2009 | 41 Words

Simple php task to run commandline in phing

In phing there is a task called

exec. Even though it provides a "passthru"-property it's not really possible to directly get the response from the output.

Since I wanted to have direct output of all data, I created an adhock-task called "run". You can add it to your phing build file, by adding this tag right before the usage.

<adhoc-task name="run">
class RunTest extends Task {
        private $dir;
        private $command;

        function setCommand($command) {
                $this->command = $command;
        }

        function setDir($dir) {
                $this->dir = $dir;
        }

        function main() {
                $this->log("Changing to: " . $this->dir);
                chdir($this->dir);
                $this->log("Executing: " . $this->command);
                system($this->command);
        }
}
</adhoc-task>

Remember, that this task does not check wether the directory exists and always requires it to be set. If you want to extend the task for your needs and mind to share it, feel free to post a reply!

In phing, php by DracoBlue @ 22 Sep 2009 | 147 Words

unknown filesystem type 'mdraid'

Today I tried to mount a raid volume by using the following command:

# mount /dev/sda1 /mnt/disk
mount: unknown filesystem type 'mdraid'

I tried to figure out how to mount this then, but was not successful by searching for a filesystem type called mdraid to install. The reason is, that the software raid system (if detected) is an extra device (next to the physical harddisks) so using the following command:

#cat /proc/mdstat
Personalities : [raid1] 
md2 : active raid1 sda3[0] sdb3[1]
      726266432 blocks [2/2] [UU]

gave me the information I needed to know.

Mounting was now very easy:

mount /dev/md2 /mnt/disk

In by DracoBlue @ 08 Sep 2009 | 116 Words

HttpBindingInfoFactoryBean for CXF Apache

Today I was checking the

JSON-Support page for the Webservice Framework CXF.

While the webservice engine works great, I was not able to enable json-support, because the class HttpBindingInfoFactoryBean gave me a NoDefFoundError.

sf.setBindingFactory(new HttpBindingInfoFactoryBean());

It seems like the

documentation is just out of date.

The proper code (like taken from the mailinglist mail)

sf.setBindingId(HttpBindingFactory.HTTP_BINDING_ID);

No everything works fine. Also the ?wsdl is still available, useful for fetching information about all available functions/methods.

In cxf, java by DracoBlue @ 15 Aug 2009 | 89 Words

Referer with document.location is broken in Internet Explorer

When you have (this should be discussed anyways) code in your javascript application changing to a different website, you'll see something similar to that:

location.href = 'test.php';

If you want to retrieve the referer on the next page, this will not work anymore. This is a

known IE Bug and not fixed in IE 8.

For instance this in javascript:

location.href = 'test.php';

And this as test.php

echo $_SERVER['REFERER']; 

In this case, the output in IE will always be empty. In the other big browsers, it works like a charm.

But there is always, also this time, a workaround. Found at

web bugtrack.

If you use for all browsers such wrapper function:

function goto(url){
  location.href = url;
}

You just have to make it like that for the one browser:

function goto(url){
    var referLink = document.createElement('a');
    referLink.href = url;
    document.body.appendChild(referLink);
    referLink.click();
}

As you can see, it will create a link with exactly the refer link. And will properly work then.

In internet explorer, javascript by DracoBlue @ 08 Jul 2009 | 190 Words

Page 23 - Page 24 - Page 25