Follow me as I struggle with rogue technology, insane programmers, and impossible math questions in a battle to the death.

Sunday, October 18, 2009

Install MySQL-python 1.2.3b on mac OS X when you get the

I tried to install MySQL-python on Mac OS X 10.5 and I got the error:

EnvironmentError: mysql_config not found

To fix this error, you need to specify the location of your mysql_config in the site.cfg file.

I found mine in /usr/local/mysql/bin/

In the MySQL-python installation directory, open the site.cfg.

Add a line that says:

mysql_config = /usr/local/mysq/bin/mysql_config

Then run sudo python setup.py install again and it should install correctly.

Labels: ,

Friday, May 22, 2009

Using the Java Classpath at the command line

One of the most irritating things about Java is the classpath.

Here's the command on UNIX:

java -cp /Users/jacob/foo.jar:. foo/bar

Here's how to do it on Windows:

java -cp C:\jacob\foo.jar;. foo/bar

The annoying part is that you can't use relative path names. You must put the absolute path for each directory and jar file. Also, on UNIX you separate each path with a semicolon, while on Windows you separate using a semicolon.

Use the -cp flag, then reference you class. Don't append the .class file extension to the name of class, just provide the path relative to where you are executing the Java command.

Labels:

Wednesday, May 20, 2009

Create a postgresql database

How to add postgresql user account

# adduser tom
# passwd tom

# sudo su -
(or might be # su - postgres)

$ psql -d template1 -U postgres

template1=# CREATE USER tom WITH PASSWORD 'myPassword';
template1=# CREATE DATABASE jerry;
template1=# GRANT ALL PRIVILEGES ON DATABASE jerry to tom;

template1=# \q

$ su - tom
$ psql -d jerry -U tom

Labels:

Tuesday, May 05, 2009

MySql Installation Problem and resolution

A lot of times I've encountered this problem installing MySQL.

When it goes to turn on the service at the end of the installation process, the software firewall stops it from starting the service. When this happens, the security is not applied. Then, I try to run the installation again, and when I get to the point where I'm setting the password, there are 3 password fields instead of 2. Since the the security settings were never applied, there is no password for the first field! But usually I end up trying to put a password in that field, and as a result MySQL fails when it tries to apply security settings.

So, leave that field blank.

Labels:

Tuesday, April 07, 2009

Convert all wav files in directory to mp3 in bash

for file in *.wav;
do
lame -h -m s -b 320 "${file}" "${file%.wav}.mp3";
done

Labels: ,

Tuesday, March 24, 2009

Where is my Apache installed on Ubuntu?

Go to the terminal and type:

locate apache

Labels: ,

Wednesday, March 11, 2009

Add User to SQL Server 2008

Open Microsoft SQL Server Management Studio.
Right Click the server of choice in the tree and click Properties.
Click Security.
Make sure the SQL Server and Windows Authentication radio button is selected.
Click OK.
In the tree, expand the Security folder under your chosen server.
Right click Logins and choose New Login.
Enter login name.
Click SQL Server Authentication radio button.
Enter password.
It may be necessary to unclick User must change password at next login if not using Windows Server 2003.
Click Server Roles in left menu.
Click all entries.
Click OK.

In the tree inside your instance, expand the database folder, then Security.
Right click on Users and click New User.
Enter the User name and login name.
Enter the default schema.
Under Owned Schemas click all checkboxes except "guest".
Under Role Members click all checkboxes.
Push OK.

To test:
Click the Connect button at the top of the tree.
Choose Database Engine.
Enter login name and password and click Connect.

Labels: