Prevent Git from pickung up changes in the mode of files

10/2011 // Category: git

Prevent GIT from pickung up changes in the mode of files (chmod)

git config core.filemode false

Make Git ignore files that already exist in the repository

09/2011 // Category: Git Version Control

Adding files to .gitignore that are already tracked does not work. In stead, this command can be used:

git update-index --assume-unchanged [filename(s)]

MySQL dump and compress directly

01/2011 // Category: MySQL

Do a mysql dump and compress directly with gzip

mysqldump mysqldump_options | gzip > outputfile.sql.gz

Gunzip and import using gzip

gunzip < outputfile.sql.gz | mysql mysqldump_options 

Dumping MySQL Stored Procedures, Triggers and Functions

10/2010 // Category: MySQL

mysqldump will backup by default all the triggers but NOT the stored procedures/functions. There are 2 mysqldump parameters that control this behavior:

    * –routines – FALSE by default
    * –triggers – TRUE by default

To include in an existing backup script also triggers and stored procedures, add the –routines command line parameter:

mysqldump  --routines > dumpfile.sql 

To dump only the stored procedures and triggers and not the mysql tables and data:

mysqldump --routines --no-create-info --no-data --no-create-db --skip-opt  > dumpfile.sql

To import them to another database server run:

mysql  < dumpfile.sql

Or with character encoding settings

mysql --default_character_set utf8 database  < dumpfile.sql

install postgresql 8.4 under ubuntu with adminpack

10/2010 // Category: PostgreSQL, Ubuntu

1. basic installation of postgresql server (contrib is needed for adminpack)

sudo apt-get install postgresql

2. Install pdadmin GUI

apt-get install pgadmin3

3. Reset the password for the ‘postgres’ admin account for the server:

$ sudo su postgres -c psql template1 template1=# ALTER USER postgres WITH PASSWORD 'password'; template1=# \q

4. Change the password for the unix user ‘postgres’:

$ sudo passwd -d postgres $ sudo su postgres -c passwd

5. install adminpack

$ sudo apt-get install postgresql-contrib
$ sudo su postgres -c psql < /usr/share/postgresql/8.4/contrib/adminpack.sql 

Oracle APEX / FOP / Cocoon: Invalid characters in XML data

The setup is Oracle APEX with Tomcat / Cocoon as XSL-FO processor to generate PDF reports.

PDF reports in some cases do not open, instead in Acrobat (Reader) you are presented with an error message that Acrobat could not open the file because it is either damaged or not a supported file type.

Acrobat error message after creating new PDF report in APEX

If file size of the XML data sent from APEX to the print server is not an issue, another reason might be that you have an invalid character in your XML file.

Turn on debug in APEX to see the error message sent back from Cocoon.

continue reading…

Oracle APEX: XSL-FO with Tomcat/Cocoon

05/2010 // Category: APEX, FOP, Oracle, Tomcat/Cocoon, Ubuntu, XSL-FO

If BI Publisher is not a choice and you also prefer not to use the Apache FOP solution shipped with Oracle APEX (OC4J), you can use another XSL-FO Processing engine which is Apache Cocoon and Apache Tomcat.

Carl Backstrom describes the setup process on his blog:
http://carlback.blogspot.com/2007/03/apex-cocoon-pdf-and-more.html

For Ubuntu this post on the Ubuntu forums is helpful:
http://ubuntuforums.org/showthread.php?t=1004742

Printing large reports

Printing large reports requires some extra settings

Tomcat has by default a limit on POST size. That prevent you from downloading large PDF files.
On Ubuntu: open /etc/tomcat5.5/server.xml
sudo nano /etc/tomcat5.5/server.xml
Find line maxSpareThreads=”75″ and add after that add the following to a new line
maxPostSize="0"

Also you need to increase JAVA memory

continue reading…

Duplicate Oracle schemas using exp / imp (export / import)

05/2010 // Category: Custom Applications

In Oracle 10g or later you use Datapump to copy a schema and all its content, for example, to move it to a different database server. A different method would be to use exp / imp using parameters owner on export, and fromuser/touser during import.

exp userid=system/oracle owner=andre file=c:\temp\andre.dmp

Before the import it is required to set up the new schema user and assign necessary roles and privileges.

sqlplus system/oracle
CREATE USER andre_new IDENTIFIED BY password;
GRANT connect, resource TO andre_new;
EXIT;

Now you can import the data by remapping the previous user andre to the new user andre_new:

imp userid=system/oracle fromuser=andre touser=andre_new file=c:\temp\andre.dmp

VirtualBox: access Windows-host shared folders from Ubuntu-guest

05/2010 // Category: Ubuntu, Virtualbox

Access files on your Windows operating system (host) from Ubuntu (Virtualbox).

Guest Additions installed?
First make sure the Guest Additions are installed. If not, from the VirtualBox’s menu go to Devices > Install Guest Additions. A virtual CD will be mounted. As root run the program VBoxLinuxAdditions.run. When the program completes reboot your VirtualBox.

Define a shared folder
With Guest Additions installed you go ahead and define the shared folder(s). From the VirtualBox’s menu go to Devices > Shared Folders. In the dialog that shows up you can specify which folder from your Windows system you want to share with your Ubuntu OS. You will have to specify a Folder Name for each folder you add. Make sure to memorize that name since it will be required later on.

Create a mountpoint
To mount the shared folder, first you have to create a mounpoint. This is a directory in your Ubuntu OS which will reflect the shared folder from Windows – for example:

# sudo mkdir /media/windows-share

With your mountpoint created you can now mount the shared folder, like this:

Mount shared folder
# sudo mount -t vboxsf shared-folder-name /media/windows-share

Where shared-folder-name will be the name you assigned for this folder when you were adding it in the shared folders list.

You could use the /etc/init.d/rc.local script to execute the last command on startup to have the shared folders automatically mounted every time you start your Ubuntu VirtualBox.

Install Oracle Apex on Ubuntu 8.0.4

05/2010 // Category: Custom Applications

If you run into some problems after installing Oracle Apex on Ubuntu the following lines might help you fix issues related to starting SQLPLUS in the terminal.

sqlplus sys as sysdba
sqlplus: command not found

SQLPLUS is already on your system but you need to run the oracle_env.sh script:

/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/./oracle_env.sh

/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/nls_lang.sh: 114: [[: not found
/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/nls_lang.sh: 114: [[: not found

Again an error message. I took out the if statements around line 114 (:set number in vi to view line numbers) and just left the line ‘locale=$LANG’ by doing:

sudo vi /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/nls_lang.sh

That fixed my language error, then I reran

continue reading…

pagetop