Changing Timezone in Postgresql, Ubuntu

Timezone and locale are integral concepts that one should be aware of when implementing a System. For example. if you create a database in PostgreSql, it will use the default System settings for the database. Lets say you have a server in UK and your client is US. If the client tries to retrieve the current date or time, it is going to show the UK time and not the US one.

Today I encountered a different issue in our client place where the Ubuntu timezone and PostgreSql timezone were showing a incorrect values. Instead of Indian Standard Time (IST) it was showing Pacific Daylight Time(PDT). These are the steps that I followed to change the timezone to IST in PostgreSql and Ubuntu.

Changing timezone in Ubuntu:


sudo dpkg-reconfigure tzdata

You will be prompted to choose the continent and then the area. Provided screen shots where we configure the location.

Use TAB key to navigate to the OK button and then press Enter.

The changes will get reflected immediately. To check it you can open a new terminal and type ‘date’. The output is provided below.

Changing timezone in PostgreSql Database:

1. Select the name of the timzone you want to set.


SELECT * FROM pg_timezone_nam<wbr>es;</wbr>


2. Update the corresponding timezone, in my case ‘Asia/Kolkata’.


ALTER DATABASE postgres SET timezone TO 'Asia/Kolkata';

3. Use Select now() to check the current timezone setting.

For more such articles on Ubuntu, Postgres and Openbravo Subscribe here or here.

Advertisements

PeopleSoft PIA pages have a pink background

Whenever any page is opened in PIA, the pages are displayed with a  pink background shown below.

This started happening right after a tools upgrade and I found that the issue is related to the webprofile configuration.
Steps to solve this issue:

1)Check with the webprofile domain in which we have configured our current setting.

2)Go to Peopletools »» Web-profile »» Web Profile Configuration
open the domain in the webprofile configuration and select debugging tab
clear out the following options
a)Trace Monitoring Server
b)Trace PPM Agent
c)Show Trace Link at Signon
d)Show Layout
e)Create File from PIA HTML Page

3)Check with the default style sheet in PeopleTools option :

PeopleTools »» utilities »» Administration »» People Tools Option
DEFAULT style sheet name —(PSSTYLEDEF_SWAN/PSSTYLEDEF)
4)Check with the default style sheet in System Option.

PeopleTools »»Portal»» Portal Utilities »»System Option
DEFAULT style sheet name —(EOPP_SCSTYLEDEF)

5) shutdown the Appserver and Webserver.

6)After finishing these step clear the cache area in application server as well as in the Web server in order for the  new settings to take effect

Webserver cache area in PeopleTools is present in

<PS_HOME> »» WEBSERV»» PEOPLESOFT»» APPLICATION »» PEOPLESOFT »» PORTAL.WAR »» PS »» CACHE
7)Reboot the Appserver and Webserver

Now check with the pages in PIA.

Working with PostgreSql (postgres) and Apache Tomcat in ubuntu

For users who have been through Ubuntu, executing applications in ubuntu via terminal might sound easy but its not the same case for the windows users. Assuming PostgreSql and Tomcat is already installed in your system, (if not refer here) lets see how to execute them.
1. PostgreSql (Postgres):

PostgreSql by default resides in the port 5432 and unless and until you have modified that, the command remains the same everywhere. So open the terminal and use the following command for Staring Postgres

sudo /etc/init.d/postgresql-8.4 start

To shutdown postgres,

sudo /etc/init.d/postgresql-8.4 stop

Note : The version 8.4 might not be the version that you installed. so use the version number, and first try without giving sudo. If an error “permission denied” comes up, then use sudo. Sudo command is to upgrade yourself to the root user or admin for that operation alone. To check your postgres version, open the terminal and give the following command.

psql -U postgres

It will prompt for the password (which should be either syspass or postgres depending upon how we configure it) and once its provided, it will show the version ( shown as psql(8.4.8) )  and psql prompt as shown in the screenshot.

2. Apache Tomcat :

Tomcat server, usually the  folder reside in the usr/local folder if u install through the synoptic package manager, but I download the source from tomcat and then put it in my convenient folder. this is because I ve to either write a shell script or go to the source folder to execute commands. So lets execute it by the folder way. I assume its in /home in a folder called tomcat6. Use the following commands for startup and shutdown.

For Staring Tomcat:
sudo /home/tomcat6/bin/startup.sh

To Shutdown Tomcat:

sudo /home/tomcat6/bin/shutdown.sh<br />

In case you have installed Tomcat from the Ubuntu Repositories or through the binary execution file, the startup and shutdown commands are as follows:

<br /><br />For Starting Tomcat:<br /><br />sudo /etc/init.d/tomcat6 start<br /><br />For Stopping Tomcat:<br /><br />sudo /etc/init.d/tomcat6 stop<br /><br />

Note :

For Windows Users:

You have to basically go into the bin folder of tomcat and run the Catalina batch file. It will open a command prompt terminal, if you want to Close the same, just close the terminal.

Psql Commands for PostgreSql

PostgreSql is an open source  Enterprise Relational Database Management System (RDBMS). To access postgres database, you can either use the graphical user interface pgAdmin or the command line interface psql. Though pgAdmin is lot easier with the GUI, for command prompt freaks, psql is THE tool for accessing database. Though it is little tough to get used to, once you are in, I am sure nothing tastes better. I have provided the basic steps here for basic operations with the database. Refer here for configuring PostgreSql for access from psql.

Connecting to database:

psql -U username -d databasename

Eg:

psql -U postgres -d shankar

Connecting to Remote Database:

psql -U username -h hostname -d databasename

Eg:

psql -U postgres -h 192.168.1.65 -d shankar

Writing the query output to a file:

\o filename

<<Query>>

Eg:

shankar=# \o /home/shankar/person.txt

shankar=#SELECT * FROM ad_client;

This command will write the output of the query to the file person.txt

This will keep recording all the outputs till we exit recording using ‘\o’ command.

\o without any argument will stop recording the outputs.

Writing the function to a file:

\ef functionname

This command will display the function in the default command line editor.

The use,

^o

This will prompt for a filename to write.

The function will be written to the specified file in the specified location.

Executing queries

To execute the query or function that is stored in file,

\i filename

Eg:

\i samplefunction.txt

This command will execute all the queries that exists in the file samplefunction.txt

List the existing database:

\l

List the tables,view in a database:

\d

View details of a table structure:

\d tablename

View help comment:

\h command

This command will show the syntax for the command specified.

Reset Query Buffer:

\r

Display History:

\s

Write Query buffer to file:

\w filename

This command will write the last query string to a file.

General help for all commands

\?

Disconnect from psql:

\q

Would like to hear feedback or help on any more commands.

Happy Working…

Performance Enhancement in Ubuntu

I am using Ubuntu for an while now and over the last few months and I find that the performance of my system has been drastically reduced. I know its more because of improper system management than hardware ineffectiveness (mine is a 2gb ram with 160gb hard disk). If it were windows it would have been simple..:) Run disk defragment, %prefetch%, %temp%, temp in cmd and delete all temporary files. But ubuntu is more fun, because you don’t employ some tool to do the job that you should bend yourself and do..:) So here is the list of things that I did in order to increase the performance of my Ubuntu System.

1.Prelink:

Go to Synaptic Package Manager and search for ‘prelink’ and you will find a single app. Install that and then come over to terminal and edit the following file, /etc/default/prelink  i.e give gksu gedit /etc/default/prelink and in the file that opens up, change the PRELINKING=unknown to PRELINKING=yes. This will help in prelinking applications, enabling it to start quickly.

2.Swiftfox:

Swiftfox is an optimized build of Mozilla Firefox. Swiftfox has builds for both AMD and Intel processors and is based on the most cutting edge Firefox source code available. Add the repository to /etc/apt/sources.list Deb http://getswiftfox.com/builds/debian unstable non-free.

Install from a terminal window as root using the correct package name:

apt-get update

apt-get install swiftfox-prescott

Most firefox plugins are compatible here and even your existing firefox bookmarks and plugins are imported automatically..:)

3. Openoffice tweaks:

We all know OpenOffice takes little time in loading. And in most likelihood we will be looking for better word processors. But we can optimize it. Open the word processor and go to tools->options and then change the following options based upon the screenshot attached below. (change the setting little according to your system specs). I found the word processor opening instantly now..:) But with 11.04, LibreOffice looks too cool. More info on that, here

4. Autoclean

There is an inbuilt package autoclean that should remove most irrelevant packages.


sudo apt-get autoclean

5. Residual Config

Go to Synaptic Package Manager and click on the ‘Status’ button in the left bottom end of the screen. Then in the window on the left hand side, you will find menus like installed, manually installed, not installed, etc… If there is a menu not installed (residual config), then select all applications under that (you can choose only one by one..:( and i had a long list) and give ‘Mark for Complete Removal’ and Apply the changes.

I think after performing all this also, there is a high risk that your system is slow. Then it boils down to the application, say for example for me Netbeans is a dream in all ways, it makes app development too easy but literally eats my system, so in such cases you need to tweak your application rather than the system.

ERP Education Series – The Beginning

When wealth is shared it is divided, when knowledge is shared it is multiplied

Enterprise Resource Planning (ERP) is a much bandied phrase with different connotations for different people. Some think it to be this collosal titan which needs to be tamed as an imperative for doing business, while others think it is an IT initiative where they are mere participants while still some others confuse it be nothing more than glorified accounting. As in most things in life the truth lies somewhere in between.

With so much confusion and cloudiness (I refer to the English word here rather than the other over-hyped and over-marketed monster) prevelant, we at Fugo thought it was best if we help people new to ERP recognize its true power and potential. Towards this desire to spread the knowledge we have started this “ERP Education Series“ on our blog where we will be covering a variety of topics on ERP in general and some on our product(s).

The topics we hope to cover in this series are:

  • ERP Education Series – The Beginning (this post)
  • ERP Education Series – ERP Basics
  • ERP Education Series – How will an ERP help me
  • ERP Education Series – How to select the right ERP
  • ERP Education Series – Steps to consider during implementation

Please note that the list of topics is quite dynamic and will change based on your feedback.

Obviously we are touching just the tip of the iceberg. But we do hope this series will help you in your quest. Do pipe in with your thoughts and comments on this series and in general.

(Need to move forward on your ERP needs? Let us help you. Reach us at sales@fugoconsulting.com or call us on +91-80565-75540)