Monday, November 25, 2013

Maze algorithm in Python.

I was so bored during the weekend and I thought, may be I should play around python a little. So I wrote the following code to make a Maze. It uses a backtracking algorithm to make a Maze of any given size. I personally enjoyed writing it.


And the output:

##############################
#       ##                   #
# ## ## ##### ############## #
# ## ## ##### ############## #
# ## ##       ##             #
# ## ########### #############
# ## ########### #############
# ##    ##    ## ##          #
####### ## ##### ##### ##### #
####### ## ##### ##### ##### #
#       ##    ##    ##    ## #
# ######## ## ##### ## ## ####
# ######## ## ##### ## ## ####
#    ## ## ##    ## ## ##    #
#### ## ## ## ##### ##### ## #
#### ## ## ## ##### ##### ## #
#    ## ## ##    ##    ## ## #
# ##### ## ##### ##### ##### #
# ##### ## ##### ##### ##### #
#    ##    ##       ##       #
# ## ##### ## ############## #
# ## ##### ## ############## #
# ##    ## ##          ##    #
# ##### ## ######## ##### ####
# ##### ## ######## ##### ####
#    ## ## ##    ##       ## #
####### ## ##### ########### #
####### ## ##### ########### #
#       ##                   #
##############################

Friday, November 08, 2013

Auto-compile Jasper subreports in OpenNMS

I was trying to make a database report in OpenNMS to collect CPU utilization information from JRobin files.  To use a subreport and make it compile the subreport every time you run the report, I ended up with the following way of presentation of jrxml file. May it be useful to someone. 



The parent report file:
The subreport file:
/opt/opennms/etc/report-templates/subreports/PeakCPU_subreport.jrxml