web development war stories from the frontlines to the backend

The code snippet below shows an interesting technique to daisy chain calls to a particular method without having to implicitly call the parent::method() in the child method. It takes advantage of php’s __call and self

<?php

class b extends a
{
public function _init()
{
echo ‘hello from b::_init<br>’;
}
}

class a
{
public function _init()
{
echo ‘hello from a::_init<br’;
}

public function __call($n, $a)
{
echo ‘hello [...]

It’s quite the pain in the ass to manually propset for each new file added.
Edit the file .subversion/config and scroll down towards the bottom… find the [miscellany] block and uncomment the line enable-auto-props = true
In the group of options below titled [auto-props] and add a line like:
* = svn:keywords=Id Date LastChangedBy Revision

Recently I worked on a project where the Rails logs were filling up way too quickly. Even though we had log rotation implemented, disk space was filling up fast. As a short term solution, we wanted to suppress all SQL logging Rails. Here’s what I did.

#place this in environment.rb
class ActiveRecord::ConnectionAdapters::OracleAdapter
def [...]

  

Recent Posts

Categories

Archives