brite, a MVC Framework for jQuery

Apache: Redirect pages to another domain

October 23rd, 2013 by jeremychone | Comments Off

Redirect: http://www.socengine.com/seo/somefile.php To: /somefile.php

RedirectMatch 301 /seo/(.*) /$1

Source

MySQL: Change root password

August 7th, 2013 by jeremychone | Comments Off

1) Kill mysqld
2) Start like that.

sudo mysqld --skip-grant-tables --skip-networking &

3) Type “mysql”

UPDATE mysql.user SET Password=PASSWORD('pwd') WHERE User='root';
FLUSH PRIVILEGES;

4) Kill mysqld and restart it with “sudo service mysqld start”

Source: MYSQL doc

Java: Encoding UTF8 Java_tools

July 11th, 2013 by jeremychone | Comments Off

on unix systems (linux, Mac) set the following in your .profile or equivalent.

export JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8

On windows, setting the (Windows) environment variable JAVA_TOOL_OPTIONS to -Dfile.encoding=UTF-8, the (Java) System property will be set automatically every time a JVM is started.

source

MySQL: Installing and starting MySQL On Mac

June 30th, 2013 by jeremychone | Comments Off
  1. Download latest native Package (i.e. .dmg) here: MySQL Download
  2. See installation doc (install MySQL and the startup items

Startup Items Info from doc

The Startup Item for MySQL is installed into /Library/StartupItems/MySQLCOM. The Startup Item installation adds a variable MYSQLCOM=-YES- to the system configuration file /etc/hostconfig. If you want to disable the automatic startup of MySQL, change this variable to MYSQLCOM=-NO-.

Start:

shell> sudo /Library/StartupItems/MySQLCOM/MySQLCOM start

Stop:

shell> sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop

See source

maven: Custom Maven Repository Web Applications

June 10th, 2013 by jeremychone | Comments Off

Archiva vs artifactory vs nexus

postgresql: jdbc url to connect to a schema

June 8th, 2013 by jeremychone | Comments Off

There does not seem to have a way to have a connect string that specify a schema, but a user can be set a default schema.

ALTER USER user_name SET search_path to 'schema'

source

Postgresql: problem running post install step (on Mac / OSX)

May 22nd, 2013 by jeremychone | Comments Off

This often comes when a postgres user was already created and not removed.

The best way I found, is to uninstall Postgresql DB, remove the postgres user, and reinstall the new version.

sudo dscl . delete /users/postgres  

Note, when installing Postgresql in the Advanced Option, nice to have everybody in the team choose the same local, e.g. “en_US.UTF-8″

Linux: Top RPM command examples (install, uninstall, query)

April 7th, 2013 by jeremychone | Comments Off

Probably the best page on the subject: rpm command examples

Amazon EC2: Installing Postgresql 9

April 2nd, 2013 by jeremychone | Comments Off

Amazon default yum

[root@ip ~]# sudo su -
[root@ip ~]# adduser postgres
[root@ip ~]# yum install postgresql9-libs.x86_64  postgresql9.x86_64 postgresql9-server.x86_64 postgresql9-contrib.x86_64
[root@ip ~]# su - postgres
[postgress@ip ~]# initdb  --pgdata=/var/lib/pgsql9/data -E 'UTF-8' --lc-collate='en_US.UTF-8' --lc-ctype='en_US.UTF-8'
[postgress@ip ~]# exit
[root@ip ~]# service postgresql start

To change the pgdata edit the /etc/init.d/postgresql

Then, test your postgres:

[root@ip ~]# su - postgres
[postgres@ip ~]# psql
postgres=# l

And you should see something like:

                                  List of databases
   Name    |  Owner   | Encoding |   Collate   |    Ctype    |   Access privileges
-----------+----------+----------+-------------+-------------+-----------------------
 postgres  | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 |
 template0 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
           |          |          |             |             | postgres=CTc/postgres
 template1 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
           |          |          |             |             | postgres=CTc/postgres
(3 rows)

Sources: basic install instructions
and
UTF8 Default

Linux way

Yum installation postgres

postgresql: create user, db, schema (command line)

March 16th, 2013 by jeremychone | Comments Off
# create the user
CREATE USER some_user WITH password 'pwd'

# create the new db with the new user as owner
CREATE DATABASE some_db WITH OWNER some_user;

# connect to db
connect some_db

# create schema
CREATE SCHEMA some_schema AUTHORIZATION some_user;

# rename database
ALTER DATABASE dbname RENAME TO new_dbname;