Computer

Magento: Configure Magento with ISPConfig

0

Some configuration settings between ISPConfig and Magento overlap, so it was necessary to fine-tune these settings.

Also make sure that you use suPHP and try to prevent mod_php, which is faster but has some problems.

You can simply copy them and add them to your „Apache Directives“ in the ISPConfig, but do not forget to replace the directory „/var/www/clients/client1/web1/web/„ with yours:

DirectoryIndex index.php

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

## adjust memory limit

php_value memory_limit 64M

# lets stick with 30s for now        

# php_value max_execution_time 1800

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

## disable magic quotes for php request vars

php_flag magic_quotes_gpc off

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

## enable resulting html compression

php_flag zlib.output_compression on

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

## enable apache served files compression

## http://developer.yahoo.com/performance/rules.html#gzip

# Insert filter

SetOutputFilter DEFLATE

# Netscape 4.x has some problems…

#BrowserMatch ^Mozilla/4 gzip-only-text/html

# Netscape 4.06-4.08 have some more problems

#BrowserMatch ^Mozilla/4\.0[678] no-gzip

# MSIE masquerades as Netscape, but it is fine

#BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

# Don’t compress images

SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary

# Make sure proxies don’t deliver the wrong content

#Header append Vary User-Agent env=!dont-vary

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

## make HTTPS env vars available for CGI mode

SSLOptions StdEnvVars

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

## enable rewrites

Options +FollowSymLinks

RewriteEngine on

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

## you can put here your magenta root folder

## path relative to web root

RewriteBase /

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

## workaround for HTTP authorization

## in CGI environment

# RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

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

## always send 404 on missing files in these folders

RewriteCond %{REQUEST_URI} !^/(media|skin|js)/

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

## never rewrite for existing files, directories and links

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_FILENAME} !-l

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

## rewrite everything else to index.php

RewriteRule .* index.php [L]

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

## Prevent character encoding issues from server overrides

## If you still have problems, use the second line instead

AddDefaultCharset Off

#AddDefaultCharset UTF-8

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

## Add default Expires header

## http://developer.yahoo.com/performance/rules.html#expires

ExpiresDefault „access plus 1 year“

Postgres: Remote copy a database between two machines using ssh

0

Sometimes it might be useful to copy a postgres database between two systems. This is not a big hazel and can be done with a simple one-liner (Port 22):

pg_dump -C dbname | bzip2 | ssh  remoteuser@remotehost.de "bunzip2 | psql dbname"

and even if your ssh connection uses a different port (1234) you are good to go:

pg_dump -C dbname | bzip2 | ssh remoteuser@remotehost.de -p 1234 "bunzip2 | psql dbname user"

GIT: Updating the current branch in a non-bare repository is denied…

0

Sometimes there are days when you just forget to configure your git repository on the server and that are the days when you run in awkward errors like that:

By default, updating the current branch in a non-bare repository is denied, because it will make the index and work tree inconsistent…

The fix for this is simple, just configure your git repository on the server as a bare repository:

git config --bool core.bare true

Then remove all files and directories, except for the “.git“ directory.
Mission accomplished.

VirtualBox: VMDK and VDI conversion and resize

0

Since VirtualBox 4.0 it is possible to resize vdi disk images, that is quit simple using the following command:

VBoxManage modifyhd YOUR_HARD_DISK.vdi --resize SIZE_IN_MB

SIZE_IN_MB reflects the new disk size so if you want to increase your image to 25GB, just use:

VBoxManage modifyhd darwin.vdi --resize 25000

Sometimes it happens that you do not use a vdi with VirutalBox, but a VMWare Image (VMDK). That is also no problem, to convert from VMDK to VDI you can use:

VBoxManage clonehd –format vdi /path/to/original.vmdk /path/to/converted.vdi

7 months ago

Steve Jobs 1955-2011

I was completely shocked when I read this morning on my iPhone that Steve passed away. All my thoughts and sympathy goes out to his family and friends. Please be strong and accept the condolences of me and my family.

This day in my life is dedicated to Steve Jobs, I will think of him as of the great man he was and the one person who changed and influenced my life the most. Every single piece of software I write, every graphical user interface I create has a touch of his visions and so he will live on in me, till my time comes to meet him in another place.

I will miss you – Take care where ever you are,
Sascha Müllner

Database: Migration from SQLite to MySQL

0

After working with some sqlite databases for one of my iOS projects lately, I have now decided to also add an online service for the project. But how can I migrate from sqlite to MySQL?

Here are the basic three steps, I figured out that are needed to extract and modify the DDL to be ready for an import to MySQL:

  1. 1. Export the SQLite database with sqlite and command parameter “.dump” – as an example :
sqlite3 mySQLiteDataBase .dump .quit >> myDumpSQLite
  2. 2. Adapt the dump to get it compatible for MySQL
  – Replace “ (double-quotes) with ` (grave accent)
  – Remove “BEGIN TRANSACTION;” “COMMIT;”, and lines related to “sqlite_sequence”
  – Replace “auto increment” with “auto_increment
  3. 3. The dump is ready to get imported in a MySQL server

Luckily the modifications can be done with a simple python script Axel Steiner wrote. You can find it on his website:

http://www.treibsand.com/2008/02/15/sqlite_mysql/

Oracle: How to get a formatted string from a date?

0

If you work with SQL on Oracle you sometimes want to extract additional informations from a date field and also limit this result to a distinct set.
So for example to get all distinct years of a date field from a data set, you can use the following statement, which uses a subquery:

SELECT year FROM
(SELECT distinct TO_CHAR(wtp.delivery_date, 'YYYY') AS year FROM world_transport wtp)
ORDER BY year ASC;

We can further optimize the query, removing the subquery:

SELECT distinct TO_CHAR(wtp.delivery_date, 'YYYY') year
FROM world_transport wtp
ORDER BY year ASC;

If you now only want to order the result set, but also group it, remember that the alias year is not known when “GROUP BY” is invoked. To work around this simply use the same “TO_CHAR” function, instead of the alias:

SELECT TO_CHAR(wtp.delivery_date, 'YYYY') year
FROM world_transport wtp
GROUP  BY TO_CHAR(wtp.delivery_date, 'YYYY')
ORDER BY year ASC;

If you want to know the year, but want to preserve the data type date, you can do this by using the function”TRUNC” instead of “TO_CHAR” function:

SELECT TRUNC(wtp.delivery_date, 'YEAR') year
FROM world_transport wtp
GROUP  BY TRUNC(wtp.delivery_date, 'YEAR')
ORDER BY year ASC;

Any comments or additions are welcome!

Oracle: Escape ampersand (&) characters in SQL*Plus

0

When importing a backup you might have run into the problem that the ampersands (&) or colon () characters are used as bind variables in PL/SQL. This is actually no real problem, as you can simply change the substitution character using the DEFINE setting in SQL*Plus:

SET DEFINE ~

The usual substitution mechanism an ampersands would trigger, is now suppressed.

Other methods:
Define an escape character:

SET ESCAPE '\'
SELECT '\&abc' FROM dual;

Don’t scan for substitution variables:

SET SCAN OFF
SELECT '&ABC' x FROM dual;

Another way to escape the & would be to use concatenation, which would not require any SET commands -

SELECT 'Laurel ' || '&' || ' Hardy' FROM dual;

Use the 10g Quoting mechanism:

Syntax
 q'[QUOTE_CHAR]Text[QUOTE_CHAR]'
 Make sure that the QUOTE_CHAR followed by an ' doesn't exist in the text.
SELECT q'{This is Orafaq's 'quoted' text field}' FROM DUAL;

You can also turn off substitutions by setting define to off:

SET DEFINE OFF

When you need it, just turn it on again:

SET DEFINE ON

Reference:

http://kwatog.com/blog/oracle/enable-disable-bind-variable-in-sqlplus/

Oracle: Drop All Trigger and Drop All Database

0

To drop all triggers in a schema, simply execute:

begin
for i in (select trigger_name,owner from dba_triggers where trigger_name like '%') LOOP
execute immediate 'DROP TRIGGER '||i.owner||'."'||i.trigger_name||'"';
END LOOP;
END;

To get drop queries for all tables in a schema, simply execute:

select 'drop table '||table_name||' cascade constraints;' from user_tables;

or you can get drop queries for all user objects in a schema by executing:

select 'drop ' || object_type || ' ' || object_name || ';' from user_objects where object_type != 'INDEX'

Oracle: Disable ArchiveLog Mode

0

Sometimes it is unnecessary to use ArchiveLog mode with the Oracle database. If you do not know what ArchiveLog Mode is – here is a short statement:

“Any Oracle database that contains important data should be running in ARCHIVELOG mode. Running in Archive log mode enables you to take hot backups and perform point-in-time recovery.”
So if you do not want this feature you can disable it following these steps:

        - Login to your server as oracle user
        - start sqlplus as sysdba
                sqlplus “/ as sysdba”
        - run the following commands
                shutdown abort
                startup mount
                alter database noarchivelog;
                alter database open;
        - to test if you where successful just run the query:
                select name, log_mode from v$database;

Remember that once you disable archive log mode you need to take a fresh backup once archive log mode is turned back on.
Be aware that if a disk failure occurs while in NOARCHIVELOG mode, you can only restore the database to the point of the most recent full database backup.
To switch back from archivelog to noarchivelog mode, just repeat the relevant steps above specifying: ALTER DATABASE NOARCHIVELOG;

For RAC environments, read the following link:

http://www.dba-oracle.com/bk_disable_archive_log_mode.htm

Go to Top