changing passwd

Make sure the password is in /var/lib/pgsql/.pgpass

The format is as follows…

*:*:*:postgres:PASSWORD

Modify /var/lib/pgsql/data/pg_hba.conf

It should contain the following…

local all all md5
host all all 127.0.0.1 255.255.255.255 md5

Change ‘md5’ to ‘trust’ to disable authentication then restart postgres.

`/etc/init.d/postgresql restart`

Now you should be able to connect to postgresql as user ‘postgres’ without a password to modify the password.

`psql -u template1`

Run the following sql command.

“alter user postgres with password ‘NEW PASSWORD HERE’;”

Finally change /var/lib/pgsql/data/pg_hba.conf back to its original format and restart postgresql one more time. Now you should be able to authenticate using user postgres and the password you specified.

Advertisements

June 4, 2007 at 8:33 am 1 comment

for vim user

If you use Vim, you can enable tabs to be automatically converted to four spaces so that you do not have to enter four spaces each time yourself. You can also enable smart indentation to allow automatic indentation for subsequent statements of the same block.

To enable these features, you can put the following lines in the .vimrc in your home directory:

" Indentation
set smartindent

" Tabs to 4-spaces
set shiftwidth=4
set tabstop=4
set expandtab
set smarttab

May 26, 2007 at 9:54 am Leave a comment

Gentoo Experience

i wanna share some of my experience installing gentoo linux, coz failed to install successfully my LFS heheeh.. fustrating eh. Anyway, i just downloaded the live install cd at gentoo.org (600mb), typical installation.. boot from the CD, then the live CD will automatically load. What amazed me is the speed of the liveCD, as if your running the system on your HDD, anyway.. there’s two method of installation(other than the minimal CD which is LFS style installation). i choose the console based installation, follow the wizard, and puff.. after a couple of minutes, its done (chatting, surfing while installing is what im really amazed of.. u can do that on some other distro e.g. ubuntu, but u’ll experience some lagging).

after installation, i sync it, issuing the command #emerge –sync and took also a couple of minutes to sync, after syncing… i install a new kernel, download the source code, compile it, put it on my grub.. and reboot the computer, use the newly compiled kernel.

its really a worth trying.. 🙂 though a little bit techie..

one thing, Gentoo uses Gnome as a default desktop(which i really loved)

here’s some screeny…

April 8, 2007 at 1:08 am Leave a comment

Java JTable

been a long time not updating my blog.. tsk tsk tsk.. heheeh but anyway.. after reading books, making some experiments, googling, i finally learn how to use Java JTable. here’s how i did it.

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Vector;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import oracle.jdbc.pool.OracleDataSource;

public class myTable {

/** Creates a new instance of myTable */
public myTable() {

}

public void createTable() throws SQLException {

OracleDataSource ods = new OracleDataSource(); // create a new database connection instance
ods.setURL(url);
ods.setUser(user);
ods.setPassword(pass);
System.out.println(“Connected”); //print if the connection is susccessful
Connection conn = ods.getConnection();
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(“SELECT PRODUCTCODE, GENERIC, BRAND, DESCRIPTION from PRODUCT ORDER by GENERIC”);

Vector rowData = new Vector(); // this will be used as a parameter of your table

while (rs.next()) {
Vector row = new Vector();
row.addElement(rs.getString(“GENERIC”));
row.addElement(rs.getString(“BRAND”));
row.addElement(rs.getString(“DESCRIPTION”));
row.addElement(rs.getString(“PRODUCTCODE”));
rowData.addElement(row);

}

Vector columnName = new Vector();
columnName.addElement(“GENERIC”); //this is the header of the table
columnName.addElement(“BRAND”);
columnName.addElement(“DESCRIPTION”);
columnName.addElement(“PRODUCTCODE”);
JTable table = new JTable(rowData, columnName); // create the table
JScrollPane jsp = new JScrollPane(table); //create a scrollpane and add the table inside the scrollpane

JFrame myFrame = new JFrame(); //create a Frame
myFrame.add(jsp); // add the scrollpane to the frame
myFrame.setSize(800,600); //set the size of the frame
myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
myFrame.setVisible(true); //display the table

}

public static void main(String args[]) throws SQLException {
myTable m = new myTable(); //create an instance of our myTable class
m.createTable();
}

private String url = “jdbc:oracle:thin:@//localhost:1521/database”;
private String user = “user”;
private String pass = “password”;

}

March 12, 2007 at 1:22 am Leave a comment

ISPConfig

finally.. i already finished my ISPConfig installation, and configurations, thank to the HOwTo’s and to the developer who gave it away…

follow this link first:

http://www.howtoforge.com/perfect_setup_ubuntu_6.06

then.. after that.. do the installations… very easy..

http://www.ispconfig.org

November 9, 2006 at 7:56 am Leave a comment

Open Sourcing Java

im very happy about this.. i just read an article from java.sun.com.. they are planning to use GPL as the license of Java 🙂 this is cool.. Duke and Tux are going to be busy.. coding.. and having a cup of.. Java Coffee 🙂 hehehe

Cheers

November 9, 2006 at 5:41 am Leave a comment

changing mysql root password

mysqladmin -u root password yournew password

#changing root password

login as root to mysql
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('MyNewPassword');

November 7, 2006 at 7:30 am 3 comments

Older Posts


September 2017
M T W T F S S
« Jun    
 123
45678910
11121314151617
18192021222324
252627282930