Thursday, November 27, 2008
Friday, September 12, 2008
However, if you wanted the default to be relative from today, for example, 3 days ago, you will need to do go outside of the standard java date libraries (Date, Calendar) because JR parameter does not allow you to have multiple statements. You can write your own utility package or you can use Joda, a replacement library for the JDK date and time library.
To use Joda in iReports, you need to extract the jar file and add it to Options -> Classpath. You may also drop the jar file in iReports' lib directory. You will also need to add this library to your application or report server.
For setting a default date 5 days prior from today, use this:
or this if you want the time part set to the beginning of the day:
or if you want the parameter to be relative to another parameter:
Joda has other methods to get a relative date: minusWeeks, minusMonths, minusYears, plusDays, plusWeeks, plusMonths, plusYears. I think you can also use Groovy to write an expression to get a relative date but that's for another time. It would probably be as simple as new Date() - 5. Post a comment if you came up with a better way.
Saturday, August 30, 2008
STEP 1: Restore table structure
If the table structure is corrupted, you need to retrieve the CREATE TABLE statements from the backup. To do this you can use grep:
zcat backup.sql.gz | grep -A 20 'CREATE TABLE `tablename1`' > tablestructure.sql
This command will create tablestructure.sql containing the CREATE TABLE statement and 20 lines after that. You may have to change the parameter from 20 to whatever to get the entire statement.
Once tablestructure.sql had been edited to only contain the proper CREATE TABLE statement, you may now restore the table structure.
mysql -u user -p dbname < tablestructure.sql
STEP 2: Extract and restore the table data
This command will create a sql file for the table.
zcat backup.sql.gz | grep 'INSERT INTO `tablename1`' > tabledata.sql
If the resulting sql file is small enough, you may load the table straight back into the database.
mysql -u user -p dbname < tabledata.sql
OPTIONAL: If you have a huge table and want to partially restore or batch things, you may want to split the table data into multiple lines.
split -l 100 tabledata.sql
This will create multiple files of 100 lines each named xaa, xab, xac, etc. You may then load each file separately.
If some rows are already on the table and you just don't want the INSERT to fail on a duplicate primary key, you can use sed to add the IGNORE option to the INSERT statement. The command below simply does a search and replace on the source file and writes it to a new file.
sed 's/INSERT/INSERT IGNORE/' < tabledata.sql > newtabledata.sql
That should do the trick.
Wednesday, August 13, 2008
This guide has been updated for Ubuntu Hardy 8.04.1. The following is the official installation guide:
The preseed method will enable a more automated install. You will want to enter the proxy a local apt-cacher server if you have one to speed up the updates and installs of new packages.
Post Installation Tasks
Updating and Installing Packages
In Synaptic, configure proxy as needed. If you have an apt-cacher service running on the proxy server, it will make your updates much faster if the packages have already been downloaded by a prior machine.
Click on Reload
Click on Upgrade
Configure Desktop to Remove Annoying Stuff
In System -> Administration -> Login Window -> Accessibility, uncheck the sounds
In System -> Preferences -> Sounds -> Sounds, uncheck Play System Sound to remove annoying sounds
If you want to change the desktop wallpaper for everyone:
In the desktop, type Alt-F2
Enter your password if prompted
Choose /desktop/gnome/background from the tree on the left
Change the picture_filename key to (e.g.) usr/share/backgrounds/ubuntu-calendar.png
Right click and Set As Mandatory or Set As Default. Mandatory means users cannot change the wallpaper.
You will also want to change the default fonts to the liberation fonts. It makes the menus and fonts in your applications more compact.
The scripts below will set the default fonts and settings without going through the GUI. Just change the mandatory to defaults if you want to allow users to change it.
sudo gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory --set /apps/nautilus/preferences/desktop_font --type string "Liberation Sans 9"
sudo gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory--set /desktop/gnome/interface/document_font_name --type string "Liberation Sans 9"
sudo gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory--set /desktop/gnome/interface/font_name --type string "Liberation Sans 9"
sudo gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory--set /desktop/gnome/interface/monospace_font_name --type string "Monospace 9"
sudo gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --set /desktop/gnome/sound/event_sounds --type bool "false"
Adding a New User
System -> Administration -> Users and Groups, Unlock (You will asked for your password.)
Add User as Desktop User Profile. This user will not be able to install new packages.
Adding a Printer
System -> Administration -> Printing
New Printer -> HP JetDirect
Enter the IP of the network printer
Change Printer Options to a default media size of Letter instead of A4 if you are in the Philippines.
Monday, February 04, 2008
1. Allow access from other machines on the LAN.
You need to edit web.xml file located at
where %PCI% is the folder where you uncompressed the Pentaho preconfigured install.
Look for the string base-url.
2. Change the default port 8080.
Sometimes port 8080 is already being used by another application, possibly Tomcat. Pentaho has a web container using port 8080 that may conflict with the existing application.
You need to edit server.xml located at:
Look for the string 8080.
Change the port number to your desired number. You may now restart the Pentaho BI platform.