Tuesday, October 19, 2010

Novell RBPM Logging

So the default logging for RBPM only shows the time and not the date. This I find very irritating as it makes debugging a pain.

So to get it to log the date as well do this:

Edit this file:

{RBPM Base}/jboss/server/IDMProv/conf/jboss-log4j.xml

and change the line:

<param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>


<param name="ConversionPattern" value="%d{dd/MM/yyyy HH:mm:ss} %-5p [%c{1}] %m%n"/>

No mess no fuss Jboss picks up the change on the fly :-)

Saturday, October 9, 2010

MySQL Query GROUP BY day / month / year

Wow I just found the most awesome thing with MySQL. I've always needed to group date data by month and year and never knew you could do it via SQL so easy.

Here's someones question:

Is it possible I make a simple query to count how many records I have in a determined period of time like a Year, month or day, having a TIMESTAMP field, like:
FROM stats
WHERE record_date.YEAR = 2009
GROUP BY record_date.YEAR
Or even:
FROM stats
GROUP BY record_date.YEAR, record_date.MONTH
To have a monthly statistic.

And the response:

GROUP BY YEAR(record_date), MONTH(record_date)
Check out the date and time functions in MySQL.

Ref: http://stackoverflow.com/questions/508791/mysql-query-group-by-day-month-year

Monday, October 4, 2010

PHP Variable Function Names

I always thought I'd never use this functionality of PHP due to getting lost in someone elses code trying to understand what they where doing with variable function names, but now it seems like I found a use for this:


Basically I'm calling a function to generate a report and have an array of about 15 function names so I know which function to call for which report:

$this->report_list[2] = array(
        "report_name"     => "Agent Comm per Product Group",
        "report_function" => "agent_comm_per_product_group",
        "report_export_csv" => true,
        "report_select_dates" => false,
        "report_select_agent" => false

Ref: http://php.net/manual/en/functions.variable-functions.php