ANSI Highlighting With less

My less command of my FreeBSD installation doesn't show the ansi colors embedded in the Rails log file. Well it does shows the codes, but I don't want to see those.

I found a simple solution for this:

export LESS='--RAW-CONTROL-CHARS'

Put the code above in the ~/.bashrc/ file and less will finally show the colors...!

Default Date Format Horrors in Rails

How nice of rails to make it easy to change the default date format that is used when
showing a date from the database.

ActiveSupport::CoreExtensions::Date::Conversions::DATE_FORMATS.merge!(
:default => "%d-%m-%Y"
)

Very easy. Simple writing:

model.date.to_s

outputs the date in my format.

All seems to work well, but a few days later. TODAY!! I found out my application wasn't saving dates anymore.

The cause:

Rails uses the ":default" date definition to format the date when it builds an SQL statement. Well my MySQL version doesn't seem to understand this date format.

For now I stay away from the :default date formatter.
I've changed my custom date_picker field so now it first formats the date with the date format before showing..

Btw. I found a possible solution and a remark that this has been solved for future rails version. You can find this info at, the rails date kit.

Ruby Constants – Note to Self ::

Well after trying to access a ruby class constant for the zillionth time with Class.CONSTNAME.
( Which btw. very nicely gives the error "Undefined Method Class.CONSTNAME"...)
I've decided to write this note on my blog...

Remember:

print Class::InnerClass::CONSTANT
print Class::InnerClass.method_name

* kick * to my own butt..

Microsoft Automatic Update Reboots

After loosing some data thanks to the nice Microsoft autmatic update reboot. I've decided to disable these stupid reboots. Who ever invented this "great" feature should be kicked very hard!!

Disable Reboots for This Run

Execute this at the commandline:

net stop wuauserv

Or a bit more user friendly

net stop "automatic updates"

Much Better is to disable the updates

Start, Run "gpedit.msc" to bring up the group policy editor. Then navigate to the folder

Local Computer Policy   ( Dutch versions: Beleid voor lokale computer)
Computer Configuration ( Dutch versions: Computerconfiguratie )
Administrative Templates ( Dutch versions: Beheersjablonen )
Windows Components ( Dutch versions: Windows-onderdelen )
Windows Update

There are two settings and both will work, so it's your choice. Either enable No auto-restart for schedule Automatic Updates installations or set Re-prompt for restart with scheduled installations to a long time interval, like 1440 minutes.

I found the information above on the following URL:

http://www.codinghorror.com/blog/archives/000294.html

Frustrating PHP 4 Objects

Today I tried the following:

function getObject()
{
$object = new Object();
return $object;
}
getObject()->executeMethod();

Well the code above works perfectly ...
All great, the app worked, so I've committed the project to Subversion.
Upload it to our production server..

Crash!
Well the production server runs PHP4.
Our development server runs PHP5.

In PHP4, You first must put the result of the method call in a variable...

$obj = getObject();
$obj->executeMethod();

*sigh* Sometimes I hate PHP!