Friday, October 22, 2010

React .Vs. Respond


Suddenly, a cockroach flew from somewhere and sat on a lady. I
wondered if this was the cockroach’s response to all the glory that
was spoken about it! She started screaming out of fear. With panic
stricken face and trembling voice, she started jumping, with both her
hands desperately trying to get rid of the cockroach. Her reaction was
contagious, as everyone in her group got cranky to what was happening.
The lady finally managed to push the cockroach to another lady in the
group. Now, it was the turn of the other lady in the group to continue
the drama. The waiter rushed forward to their rescue. In the relay of
throwing, the cockroach next fell upon the waiter. The waiter stood
firm, composed himself and observed the behaviour of the cockroach on
his shirt. When he was confident enough, he grabbed and threw it out
with his fingers.

Sipping my coffee and watching the amusement, the antenna of my mind
picked up a few thoughts and started wondering, was the cockroach
responsible for their histrionic behaviour? If so, then why was the
waiter not disturbed? He handled it near to perfection, without any
chaos. It is not the cockroach, but the inability of the ladies to
handle the disturbance caused by the cockroach that disturbed the
ladies.

I realized even in my case then , it is not the shouting of my father
or my boss that disturbs me, but it’s my inability to handle the
disturbances caused by their shouting that disturbs me. It’s not the
traffic jams on the road that disturbs me, but my inability to handle
the disturbance caused by the traffic jam that disturbs me. More than
the problem, it’s my reaction to the problem that hurts me.

The Take-Away
The women reacted, whereas the waiter responded. We should not react
in life, we should always respond.

Reactions are always instinctive whereas responses are always intellectual.

Postgis 1.4.* with postgresql 8.4 Ubuntu 9.10 /9.04

apt-get update
apt-get install vim
#The sources are still not available on the regular package servers... edit the sources
vim /etc/apt/sources.list

deb http://ppa.launchpad.net/pitti/postgresql/ubuntu jaunty main
deb-src http://ppa.launchpad.net/pitti/postgresql/ubuntu jaunty main

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 8683D8A2
sudo apt-get update
sudo apt-get install postgresql-8.4
#This changes the port from 5433 to 5432
sudo sed -i.bak -e 's/port = 5433/port = 5432/' /etc/postgresql/8.4/main/postgresql.conf

sudo /etc/init.d/postgresql-8.4 stop
sudo /etc/init.d/postgresql-8.4 start
apt-get install postgresql-server-dev-8.4 libpq-dev
apt-get install libgeos-dev
wget http://postgis.refractions.net/download/postgis-1.4.0.tar.gz
apt-get install proj
tar xvfz postgis-1.4.0.tar.gz
cd postgis-1.4.0
./configure
make
make install
sudo su postgres
#change the postgres password to "atlas" so that you can later login
psql -c"ALTER user postgres WITH PASSWORD 'atlas'"

createdb geodb (with password atlas)
createlang -dgeodb plpgsql
psql -dgeodb -f /usr/share/postgresql/8.4/contrib/postgis.sql
psql -dgeodb -f /usr/share/postgresql/8.4/contrib/spatial_ref_sys.sql
psql -dgeodb -c"select postgis_lib_version();"
#This should return 1.4.0
exit

Thursday, October 21, 2010

Configure Oracle from PHP on Centos 5

1) install apache, php …

yum install httpd php php-mysql php-pear php-devel zlib zlib-devel
yum groupinstall « Development Tools »

2) Download and install oracle instant client (basic and devel) from there:

http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/linuxsoft.html

rpm -Uvh oracle-instantclient-basic-.i386.rpm
rpm -Uvh oracle-instantclient-devel-
.i386.rpm

3) Add the Oracle instant client to dynamic linker

echo /usr/include/oracle//client/lib/ > /etc/ld.so.conf.d/oracle_client.conf
ldconfig -v

4) Untar the PECL package and prepare it for compiling. You may download it from http://pecl.php.net/package/oci8

tar -xzvf oci-.tgz
cd oci-

phpize

5) Configure the PECL package as a shared object using the instant client and specifying where the Oracle client libraries are. Then build and install it.

./configure –with-oci8=shared,instantclient,/usr/lib/oracle//client/lib
make
make install

6) Add the library shared object for PHP

echo extension=oci8.so > /etc/php.d/oci8.ini

7) Start Apache

‘service httpd start’ _or_ ‘/etc/init.d/httpd restart’

Create a PHP info page and checked to see if the Oracle (oci8) driver is listed:

echo > /var/www/html/phpinfo.php


I hope this helps.

PS: These contents are borrows from url http://bigjim-network.be/2009/06/02/oracle-from-php-on-centos-5/

Saturday, September 4, 2010

Install fussystrmatch package on postgresql

Step 1: Install package postgresql-contrib-8.*

You may use command sudo apt-get or may use GUI tool like Synaptic package manager.

Note * points to version like 8.3,8.4 etc

Step 2: go to directory where you will find sql files

cd usr/share/postgresql/8.*/contrib

Note * points to version like 8.3,8.4 etc

and execute following command

psql -d indiainfo -U postgres -W -f fuzzystrmatch.sql

this will create all functions like metaphone, soundex etc for you.

Hope this helps you

Regards
Rahul Teni
Cynosure Software Solution

Tuesday, June 8, 2010

Postgresql Single quotes!

Dear All,

Just wanted to share how we can incorporate single quote in postgresql plpgsql.

Say i want dynamic query like select id from emp where empname ilike 'Rahul Teni' and age > 25

name:='Rahul Teni'

query:= 'select id from emp where empname ilike' ||''''||name||''''||'and age >25'

I hope this helps and saves your lot's of time.

Friday, June 4, 2010

org.codehaus.groovy.grails.orm.hibernate.exceptions.CouldNotDetermineHibernateDialectException: Could not determine Hibernate dialect - oracle

Hi,

If you are getting following exception,

org.codehaus.groovy.grails.orm.hibernate.exceptions.CouldNotDetermineHibernateDialectException: Could not determine Hibernate dialect for database name [Oracle]!
at org.grails.tomcat.TomcatServer.start(TomcatServer.groovy:135)
at grails.web.container.EmbeddableServer$start.call(Unknown Source)
at _GrailsRun_groovy$_run_closure5_closure12.doCall(_GrailsRun_groovy:158)
at _GrailsRun_groovy$_run_closure5_closure12.doCall(_GrailsRun_groovy)
at _GrailsSettings_groovy$_run_closure10.doCall(_GrailsSettings_groovy:287)
at _GrailsSettings_groovy$_run_closure10.call(_GrailsSettings_groovy)
at _GrailsRun_groovy$_run_closure5.doCall(_GrailsRun_groovy:149)
at _GrailsRun_groovy$_run_closure5.call(_GrailsRun_groovy)
at _GrailsRun_groovy.runInline(_GrailsRun_groovy:115)
at _GrailsRun_groovy.this$4$runInline(_GrailsRun_groovy)
at _GrailsRun_groovy$_run_closure1.doCall(_GrailsRun_groovy:59)
at RunApp$_run_closure1.doCall(RunApp.groovy:33)
at gant.Gant$_dispatch_closure4.doCall(Gant.groovy:324)
at gant.Gant$_dispatch_closure6.doCall(Gant.groovy:334)
at gant.Gant$_dispatch_closure6.doCall(Gant.groovy)
at gant.Gant.withBuildListeners(Gant.groovy:344)
at gant.Gant.this$2$withBuildListeners(Gant.groovy)
at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source)
at gant.Gant.dispatch(Gant.groovy:334)
at gant.Gant.this$2$dispatch(Gant.groovy)
at gant.Gant.invokeMethod(Gant.groovy)
at gant.Gant.processTargets(Gant.groovy:495)
at gant.Gant.processTargets(Gant.groovy:480)

It might be becuase your hibernate dialect for database oracle is not set properly.

You need to add this line dialect='org.hibernate.dialect.Oracle10gDialect' in your database configuration file for your grail application in datasource part.

Please take a note it must be added to datasource part not hibernate part.

I hope this helps.

Regards
Rahul Teni

Tuesday, May 25, 2010

Lighttpd Installation

Steps to Lighttpd Installation

  • Edit file /etc/lighttpd/lighttpd.conf file for any configuration related changes.
  • Go to system -> Administration -> Synaptic Package Manager and select lighttpd
  • Click apply changes
  • FAST CGI Support

    Steps to FAST CGI Support

    Go to system -> Administration -> Synaptic Package Manager and select php-cgi

    sh /etc/init.d/lighttpd start

    sh /etc/init.d/lighttpd stop

    Click apply changes

    Edit file /etc/lighttpd/lighttpd.conf file to add following things.

    First add the module mod_fastcgi (lighttpd provides an interface to a external programs that support the FastCGI interface via this module). Make sure your server.modules loades mod_fastcgi:

    server.modules = (
    “mod_access”,
    “mod_accesslog”,
    “mod_fastcgi”,
    “mod_rewrite”,
    “mod_auth”
    )

    Add following lines to configuration

    fastcgi.server = ( “.php” =>

    (( “socket” => “/tmp/php-fastcgi.socket”,
    “bin-path” => “/usr/local/bin/php”,
    “bin-environment” => (
    “PHP_FCGI_CHILDREN” => “16″,
    “PHP_FCGI_MAX_REQUESTS” => “10000″
    )
    ))
    )

    Restart lighttpd server with following command

    TileCache Installation

    Steps to Tile Cache Installation

    • Sample Cache entry is as follows

    Tile cache can be accessed by link http://localhost:port/tilecache/

    Map Server version 5.4.2 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP OUTPUT=SWF OUTPUT=SVG SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=ICONV SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER SUPPORTS=GEOS SUPPORTS=RGBA_PNG INPUT=EPPL7 INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE

    [cache]

    type=Disk

    base=/home/mapserver/fgs/tmp/tilecache/cache

    Sample WMS layer entry is as follows

    [states]

    type=WMS

    url=http://localhost:8000/cgi-bin/mapserv?map=/home/mapserver/fgs/apps/OMMS3.0/htdocs/map/india_states.map

    layers=states

    extension=png

    For above entry it is important that your map server supports WMS server to test that just go to your FGS installation directory and type command ./www/cgi-bin/mapserv -v and it should not throw any error

    Mounting Linux partitions

    Step 1.

    sudo fdisk -l

    This command will list down all devices (drives) connected to your machine

    Sample output can be as follows

    Disk /dev/sda: 20.0 GB, 20020396544 bytes

    255 heads, 63 sectors/track, 2434 cylinders

    Units = cylinders of 16065 * 512 = 8225280 bytes

    Device Boot Start End Blocks Id System

    /dev/sda1 * 1 1275 10241406 83 Linux

    /dev/sda2 1276 2434 9309667+ 5 Extended

    /dev/sda5 1276 2388 8940141 83 Linux

    /dev/sda6 2389 2434 369463+ 82 Linux swap / Solaris

    Step 2.

    Install partion creator program in ubuntu

    sudo apt-get update

    sudo apt-get install gparted gksu

    gksudo gparted

    Step 3.

    sudo mkdir /storage

    This will create a directory where partition will be mounted

    Step 4.

    ls -l /dev/disk/by-uuid

    List down uuids for all drive’s partitions.

    Sample output can be as follows

    lrwxrwxrwx 1 root root 10 2009-11-04 17:05 069427AD94279E65 -> ../../sda1

    lrwxrwxrwx 1 root root 10 2009-11-04 17:05 82b11ae0-e4c9-4e95-9518-06a337659dfb -> ../../sda5

    lrwxrwxrwx 1 root root 10 2009-11-04 17:05 EA902C94902C6971 -> ../../sda7

    Step 5.

    sudo cp /etc/fstab /etc/fstab_backup

    Take back up of original file

    sudo gedit /etc/fstab

    Edit original file and add following line to that.

    Step 6

    sudo mount -a

    Mount all partitions

    Step 7

    sudo chown -R username:usergroup /storage

    sudo chmod -R 755 /storage

    UUID=82b11ae0-e4c9-4e95-9518-06a337659dfb /storage ext3 defaults 0 0

    Postgres Update Memory

    Steps to Postgres Update Memory

    Open Terminal Window

    cat/proc/sys/kernel/shmmax.

    To view By default shared memory segment

    • To change memory segment permanantly
    • etc/sysctl.conf
    • 1) Login as root
    • 2) Go to system->Administration->Login Window->security->Check Local
    • 3) To edit shared memory segment.
    • edit/proc/sys/kernel/shmmax

    PostgreSQL on Ubuntu

    Installation

    • To install PostgreSQL, run the following command in the command prompt:
    • sudo apt-get install postgresql
    • Once the installation is complete, you should configure the PostgreSQL server

    based on your needs, although the default configuration is viable.

    • Configuration
    • By default, connection via TCP/IP is disabled. PostgreSQL supports multiple

    client authentication methods. By default, IDENT authentication method is

    used for postgres and local users.

    Please refer the PostgreSQL Administrator’s Guide.

    • The following discussion assumes that you wish to enable TCP/IP connections

    and use the MD5 method for client authentication. PostgreSQL configuration

    files are stored in the /etc/postgresql//main directory.

    For example, if you install PostgreSQL 8.3, the configuration files are stored

    in the /etc/postgresql/8.3/main directory.

    • To configure ident authentication,

    add entries to the /etc/postgresql/8.3/main/pg_ident.conf file.

    • To enable TCP/IP connections,

    edit the file /etc/postgresql/8.3/main/postgresql.conf

    • Locate the line #listen_addresses = ‘localhost’ and change it to:
    • listen_addresses = ‘localhost’
    • To allow other computers to connect to your PostgreSQL server replace

    ‘localhost’ with the IP Address of your server.

    • You may also edit all other parameters, if you know what you are doing!

    For details, refer to the configuration file or to the PostgreSQL documentation.

    • Now that we can connect to our PostgreSQL server, the next step is to set a

    password for the postgres user. Run the following command at a terminal

    prompt to connect to the default PostgreSQL template database:

    • sudo -u postgres psql template1
    • The above command connects to PostgreSQL database template1

    as user postgres. Once you connect to the PostgreSQL server, you

    will be at a SQL prompt. You can run the following SQL command

    at the psql prompt to configure the password for the user postgres.

    • ALTER USER postgres with encrypted password ‘your_password’;
    • After configuring the password, edit the

    file /etc/postgresql/8.3/main/pg_hba.conf to use MD5 authentication

    with the postgres user:

    • local all postgres md5 sameuser
      sudo /etc/init.d/postgresql-8.3 restart
    • The above configuration is not complete by any means.

    Please refer the PostgreSQL Administrator’s Guide to configure

    more parameters.

    Resources

    • As mentioned above the Administrator’s Guide is an excellent
    • resource. The guide is also available in the postgresql-doc-8.3
    • package. Execute the following in a terminal to install the package:

    sudo apt-get install postgresql-doc-8.3

    To view the guide enter

    file:///usr/share/doc/postgresql-doc-8.3/html/index.html

    into the address bar of your browser. For general SQL information see

    Using SQL Special Edition by Rafe Colburn.

    PostGIS on Ubuntu

    With this post I will show how to install PostGIS 1.2.1 on Postgres

    8.2.5 in Ubuntu 7.10 (but this procedure should work also for previous

    PostGIS/Postgres/Ubuntu versions) from repositories.I will also show

    you how to load and secure GIS data and how to access them with

    some cool OS GIS Client (QGIS, UDig and gvSIG).

    -1- Install Postgres

    If you haven’t Postgres, you need to install it (PostGIS runs on top of it).

    Open an Ubuntu terminal, and type:

    sudo apt-get install postgresql postgresql-client
    postgresql-contrib pgadmin3
    sudo apt-get install postgresql pgadmin3
    Postgres (8.2.5) will be now on your Ubuntu box.
    -2- Install PostGIS

    Still from the terminal, type:
    sudo apt-get install postgresql-8.2-postgis
    PostGIS (1.2.1) will now be installed, to be precise this
    2 packages are installed:
    postgresql
    -8.2-postgis
    postgis
    under file:///usr/share/doc/postgis/postgis.html you will
    find the PostGIS Manual, for more help about installation
    and configuration.
    -3- Create a PostGIS database template

    Creating a PostGIS database template is the way to go if
    you want to make it easy the creations of many GIS database
    on the same server. Without creating this template, you
    would need to repeat this steps every time you need to
    create a PostGIS database.
    sudo su postgres
    createdb postgistemplate
    createlang plpgsql postgistemplate
    psql -d postgistemplate -f /usr/share/postgresql-8.2
    -postgis/lwpostgis.sql
    psql -d postgistemplate -f /usr/share/postgresql-8.2
    -postgis/spatial_ref_sys.sql
    The template is now ready (a lot of functions and two
    tables – geometry_columns and spatial_ref_sys – were
    created in it).
    Now we can test of postgistemplate we just created:
    $ psql -d postgistemplate -c “SELECT postgis_full_version();”

    postgis_full_version
    ————————————————————
    POSTGIS=”1.2.1″ GEOS=”2.2.3-CAPI-1.1.1″ PROJ=”Rel.
    4.5.0, 22 Oct 2006″ USE_STATS
    (1 row)
    -4- Create group role and user

    • Generally the best way is to create the GIS data in
    • the PostGIS database by using a different role and
      user than using the postgres one, that should be used
      only for administrative tasks.
      Typically I use to create a GIS role and user for
      managing data in the PostGIS database. You can even
      create more GIS users with different rights (SELECT,
      INSERT, UPDATE, DELETE on the different GIS feature
      classes), to generate a more safe environment. This
      depends on the configuration of your GIS scenario.
    • Connect to postgres (with postgres user): psql and
    • enter in the command prompt:
    • type this to create the group role, that here i
      name gisgroup (choose less permissions if needed
      for security reasons):
    • CREATE ROLE gisgroup NOSUPERUSER NOINHERIT CREATEDB
      NOCREATEROLE;
    • type this to create the login role, here named gis
      (feel free to change it):
    • CREATE ROLE gis LOGIN PASSWORD ‘mypassword’ NOINHERIT;
    • assign the gis login role to the gisgroup group role:
    • GRANT gisgroup TO gis;
      -5- Assign permissions
    • We need to assign permissions for the postgistemplate
      tables
    • (geometry_columns and spatial_ref_sys will be owned from
      the gis user):
    • exit from the previous connection (type \q), and connect
      to the postgistemplate database as the postgres user:
    • psql -d postgistemplate
    • assign the permissions:
      ALTER
      TABLE geometry_columns OWNER TO gis;
    • ALTER TABLE spatial_ref_sys OWNER TO gis;
    • Create a schema for your gis data (we shouldn’t create the
      gis data in the public schema):
    • CREATE SCHEMA gis_schema AUTHORIZATION gis;
    • exit from the connection (\q)
      -6- Database creation
    • Now we are ready to create the database (or more databases)
      where to load the data (named gisdb), using the createdb
      command, from the postgistemplate we just have created:
    • $ createdb -T postgistemplate -O gis gisdb
      -7- Data loading
    • Download this test data: there are 4 shapefiles that we
    • will load in the new PostGIS database we have created.
      We can import shapefiles in PostGis with the shp2pgsql
      command. First we will create the sql files with this
    • command, and then we will run this files with Postgres
      to import the data in PostGIS.
    • To create the sql files (if you want to avoid this step,
      the zip file already contains this *.sql files we are
      generating):
    • $ shp2pgsql -I -s 32633 POI.shp gis_schema.poi > poi.sql
    • Shapefile type: Point
    • Postgis type: POINT[2]
    • $ shp2pgsql -I -s 32633 vestizioni.shp gis_schema.vestizioni
    • > vestizioni.sql
    • Shapefile type: Arc
    • Postgis type: MULTILINESTRING[2]
    • $ shp2pgsql -I -s 32633 compfun.shp gis_schema.compfun >
      compfun.sql
    • Shapefile type: Polygon
    • Postgis type: MULTIPOLYGON[2]
    • $ shp2pgsql -I -s 32633 zone.shp gis_schema.zone > zone.sql
    • Shapefile type: Polygon
    • Postgis type: MULTIPOLYGON[2]
    • Note that we used 2 options of the shp2pgsql:
      -I will also create a GiST index on the geometry column
      -s will give to PostGIS the information of the srid of the
      data (srid=32633 is for gis data with a spatial reference
      WGS84, UTM 33 N)
    • Now it is time to execute the *.sql scripts with the gis user:
    • $ psql -d gisdb -h localhost -U gis -f poi.sql
    • BEGIN
      psql:poi.sql:4: NOTICE: CREATE TABLE will create implicit sequence
    • “poi_gid_seq” for serial column “poi.gid”
      psql:poi.sql:4: NOTICE: CREATE TABLE / PRIMARY KEY will create
      implicit index “poi_pkey” for table “poi”
      CREATE TABLE
      addgeometrycolumn
      ——————————————————
      gis_schema.poi.the_geom SRID:32633 TYPE:POINT DIMS:2
    • (1 row)
    • CREATE INDEX
      COMMIT
    • Do the same with the other 3 sqls generated from the
      previous step:
    • $ psql -d gisdb -h localhost -U gis -f compfun.sql
    • $ psql -d gisdb -h localhost -U gis -f vestizioni.sql
      $ psql -d gisdb -h localhost -U gis -f zone.sql

    Rownum in 8.3 PostgreSQL

    select rownum,columnname from(
    SELECT ROWNUM, (a[ROWNUM]).columnname as columnAlias
    FROM (
    SELECT a, generate_series(1, array_upper(a, 1)) AS ROWNUM
    FROM (
    SELECT ARRAY
    (
    /*You complex query goes here*/
    ) AS a
    ) q2
    ) q3 ) q4 where /*Some where condition*/

    General keyboard shortcuts

    General keyboard shortcuts for ubuntu.

    Ctrl + A = Select all

    Ctrl + C = Copy the highlighted content to clipboard

    Ctrl + V = Paste the clipboard content

    Ctrl + N = New (Create a new document, not in terminal)

    Ctrl + O = Open a document

    Ctrl + S = Save the current document

    Ctrl + P = Print the current document

    Ctrl + W = Close the close document

    Ctrl + Q = Quit the current application

    Keyboard shortcuts for GNOME desktop

    Ctrl + Alt + F1 = Switch to the first virtual terminal

    Ctrl + Alt + F2(F3)(F4)(F5)(F6) = Select the different virtual terminals

    Ctrl + Alt + F7 = Restore back to the current terminal session with X

    Ctrl + Alt + Backspace = Restart GNOME

    Alt + Tab = Switch between open programs

    Ctrl + Alt + L = Lock the screen.

    Alt + F1 = opens the Applications menu

    Alt + F2 = opens the Run Application dialog box.

    Alt + F3 = opens the Deskbar Applet

    Alt + F4 = closes the current window.

    Alt + F5 = unmaximizes the current window.

    Alt + F7 = move the current window

    Alt + F8 = resizes the current window.

    Alt + F9 = minimizes the current window.

    Alt + F10 = maximizes the current window.

    Alt + Space = opens the window menu.

    Ctrl + Alt + + = Switch to next X resolution

    Ctrl + Alt + – = Switch to previous X resolution

    Ctrl + Alt + Left/Right = move to the next/previous workspace

    Keyboard shortcuts for Terminal

    Ctrl + A = Move cursor to beginning of line

    Ctrl + E = Move cursor to end of line

    Ctrl + C = kills the current process.

    Ctrl + Z = sends the current process to the background.

    Ctrl + D = logs you out.

    Ctrl + R = finds the last command matching the entered letters.

    Enter a letter, followed by Tab + Tab = lists the available commands beginning with those letters.

    Ctrl + U = deletes the current line.

    Ctrl + K = deletes the command from the cursor right.

    Ctrl + W = deletes the word before the cursor.

    Ctrl + L = clears the terminal output

    Shift + Ctrl + C = copy the highlighted command to the clipboard.

    Shift + Ctrl + V (or Shift + Insert) = pastes the contents of the clipboard.

    Alt + F = moves forward one word.

    Alt + B = moves backward one word.

    Arrow Up/Down = browse command history

    Shift + PageUp / PageDown = Scroll terminal output

    Keyboard shortcuts for Ubuntu

    Alt + Tab = switch between open windows

    Win + Tab = switch between open windows with Shift Switcher or Ring Switcher effect

    Win + E = Expo, show all workspace

    Ctrl + Alt + Down = Film Effect

    Ctrl + Alt + Left mouse button = Rotate Desktop Cube

    Alt + Shift + Up = Scale Windows

    Ctrl + Alt + D = Show Desktop

    Win + Left mouse button = take screenshot on selected area

    Win + Mousewheel = Zoom In/Out

    Alt + Mousewheel = Transparent Window

    Alt + F8 = Resize Window

    Alt + F7 = Move Window

    Win + P = Add Helper

    F9 = show widget layer

    Shift + F9 = show water effects

    Win + Shift + Left mouse button = Fire Effects

    Win + Shift + C = Clear Fire Effects

    Win + Left mouse button = Annotate: Draw

    Win + 1 = Start annotation

    Win + 3 = End annotation

    Win + S = selects windows for grouping

    Win + T = Group Windows together

    Win + U = Ungroup Windows

    Win + Left/Right = Flip Windows

    Keyboard shortcut for Nautilus

    Shift + Ctrl + N = Create New Folder

    Ctrl + T = Delete selected file(s) to trash

    Alt + ENTER = Show File/Folder Properties

    Ctrl + 1 = Toggle View As Icons

    Ctrl + 2 = Toggle View As List

    Shift + Right = Open Directory (Only in List View)

    Shift + Left = Close Directory (Only in List View)

    Ctrl + S = Select Pattern

    F2 = Rename File

    Ctrl + A = Select all files and folders

    Ctrl + W = Close Window

    Ctrl + Shift + W = Close All Nautilus Windows

    Ctrl + R = Reload Nautilus Window

    Alt + Up = Open parent directory

    Alt + Left = Back

    Alt + Right = Forward

    Alt + Home = go to Home folder

    Ctrl + L = go to location bar

    F9 = Show sidepane

    Ctrl + H = Show Hidden Files

    Ctrl + + = Zoom In

    Ctrl + – = Zoom Out

    Ctrl + 0 = Normal Size

    If you want to configure your own keyboard shortcuts, you can do it at System->Preferences->Keyboard Shortcuts.

    PostGIS Functions

    Constructors

    ST_MakePoint(Float Longitude, Float Latitude) returns Point

    Create a new point. Note the order of the coordinates (longitude then latitude).

    ST_GeomFromText(String WellKnownText, Integer SRID) returns Geometry

    Create a new geometry from a standard formatted string and SRID. For example: POINT(0 0), LINESTRING(0 0, 1 1), POLYGON((0 0, 0 1, 1 1, 1 0, 0 0)).

    ST_SetSRID(Geometry, Integer SRID) returns Geometry

    Update the SRID on a geometry. This does not alter the coordinates of the geometry, it just updates the SRID number. For example: ST_SetSRID(‘POINT(0 0)’::geometry, 4326). The direct cast of text to geometry creates a geometry without an SRID, so we set it post-facto. This function is useful for conditioning geometries created without SRIDs.

    ST_Expand(Geometry, Float Radius) returns Geometry

    Create a new geometry that is the expanded bounding box of the input geometry. For example: ST_Expand(‘POINT(0 0)’, 1) returns POLYGON((-1 -1, -1 1, 1 1, 1 -1, -1 -1)). This function is useful for creating envelopes for use in indexed searches.

    Outputs

    ST_AsText(Geometry)

    Convert geometry from internal format to human-readable text format.

    ST_AsGML(Geometry)

    Convert geometry from internal format to standard OGC GML format.

    ST_AsGeoJSON(Geometry)

    Convert geometry from internal format to standard GeoJSON format.

    Measurements

    ST_Area(Geometry) returns Float

    Return the area of the geometry in the units of the spatial reference system.

    ST_Length(Geometry) returns Float

    Return the length of the geometry in the units of the spatial reference system.

    ST_Perimeter(Geometry) returns Float

    Return the perimeter of the geometry in the units of the spatial reference system.

    ST_NumPoints(Linestring) returns Integer

    Return the number of vertices in a linestring.

    ST_NumRings(Polygon) returns Integer

    Returns the number of rings in a polygon.

    ST_NumGeometries(Geometry) returns Integer

    Returns the number of geometries in a geometry collection.

    Relationships

    ST_Distance(Geometry, Geometry) returns Float

    Return the distance between two geometries in the units of the spatial reference system.

    ST_DWithin(Geometry, Geometry, Float Radius) returns Boolean

    Return true if the geometries are within radius distance of one another.

    ST_Intersects(Geometry, Geometry) returns Boolean

    Return true if the geometries are not disjoint.

    ST_Contains(GeometryA, GeometryB) returns Boolean

    Return true if geometry “A” fully contains geometry “B”.

    ST_Crosses(Geometry, Geometry) returns Boolean

    For line/polygon case, return true if line crosses polygon boundary. For line/line case, return true if lines cross.

    PostGres 'select clause' parameter list parameter.

    http://www.postgresql.org/docs/7/static/sql-select.htm#SQL-EXCEPT

    Suppress php warnings

    To suppress php errors we need to add ‘@’ sign before statement.

    It will continue processing to next statment.

    Example:

    @ $result1 = pg_query($connection,$query1) or die(‘Error, query1 failed’);
    if(!$result1)
    continue;

    Adding 900913 projection to “spatial_ref_sys” table of PostGIS

    You need to execute following query

    INSERT into spatial_ref_sys (srid, auth_name, auth_srid, proj4text, srtext) values ( 900913, ’spatialreference.org’, 6, ‘+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs’, ‘PROJCS["unnamed",GEOGCS["unnamed ellipse",DATUM["unknown",SPHEROID["unnamed",6378137,0]],PRIMEM["Greenwich",0]
    ,UNIT["degree",0.0174532925199433]],PROJECTION["Mercator_2SP"],PARAMETER["standard
    _parallel_1",0],PARAMETER["central_meridian",0],PARAMETER["false_easting",0],PARAMETER
    ["false_northing",0],UNIT["Meter",1],EXTENSION["PROJ4","+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs"]]’);

    Network Set up

    Network Set up of Ubuntu

    Open terminal window

    Type sudo gedit /etc/network/interfaces and press enter

    Type password for your root

    Copy following lines to that file

    auto eth0

    iface eth0 inet static

    address 192.168.1.100

    gateway 192.168.1.1

    netmask 255.255.255.0

    network 192.168.1.0

    broadcast 192.168.1.255

    Save file and close the editor

    restart network with following command

    sudo /etc/init.d/networking restart

    Install fgs5.4.2 on ubuntu 64 bit

    Installation error “eval 1 :can not

    found $FGS_HOME/www/bin/httpd” where as ‘httpd’ is there.
    When i debugged that in apachectl it throws error code 2
    which means httpd usage error. I am not able to proceed
    further. After searching lot and using mailing lists i found
    solution which is described as below.

    Solution

    Follow following steps : -

    1. You need to install the ia32-libs package:

    apt-get install ia32-libs

    2. You need to install the fgs package:

    download latest fgs from

    www.maptools.org/fgs/

    3. Install fgs

    sh fgs-mapserver_extended_5.4.2-fgs_9.5-linux-i386.bin

    4. star fgs

    5. You have done enjoy…

    PostGIS Aggregate Functions

    The functions given below are spatial aggregate functions provided with PostGIS that can be used just like any other sql aggregate function such as sum, average.

    • ST_Accum – Aggregate. Constructs an array of geometries.
    • ST_Collect – Return a specified ST_Geometry value from a collection of other geometries.
    • ST_Extent – an aggregate function that returns the bounding box that bounds rows of geometries.
    • ST_Extent3D – an aggregate function that returns the box3D bounding box that bounds rows of geometries.
    • ST_MakeLine – Creates a Linestring from point geometries.
    • ST_MemUnion – Same as ST_Union, only memory-friendly (uses less memory and more processor time).
    • ST_Polygonize – Aggregate. Creates a GeometryCollection containing possible polygons formed from the constituent linework of a set of geometries.
    • ST_Union – Returns a geometry that represents the point set union of the Geometries.

    PostGIS SQL-MM Compliant Functions

    The functions given below are PostGIS functions that conform to the SQL/MM 3 standard

    • ST_Area – Returns the area of the geometry if it is a polygon or multi-polygon. This method implements the SQL/MM specification: SQL-MM 3: 8.1.2, 9.5.3
    • ST_AsBinary – Return the Well-Known Binary (WKB) representation of the geometry without SRID meta data. This method implements the SQL/MM specification: SQL-MM 3: 5.1.37
    • ST_AsText – Return the Well-Known Text (WKT) representation of the geometry without SRID metadata. This method implements the SQL/MM specification: SQL-MM 3: 5.1.25
    • ST_Boundary – Returns the closure of the combinatorial boundary of this Geometry. This method implements the SQL/MM specification: SQL-MM 3: 5.1.14
    • ST_Buffer – Returns a geometry that represents all points whose distance from this Geometry is less than or equal to distance. Calculations are in the Spatial Reference System of this Geometry. The optional third parameter sets the number of segments used to approximate a quarter circle (defaults to 8). This method implements the SQL/MM specification: SQL-MM 3: 5.1.17
    • ST_Centroid – Returns the geometric center of a geometry. This method implements the SQL/MM specification: SQL-MM 3: 8.1.4, 9.5.5
    • ST_Contains – Returns true if and only if no points of B lie in the exterior of A, and at least one point of the interior of B lies in the interior of A. This method implements the SQL/MM specification: SQL-MM 3: 5.1.31
    • ST_ConvexHull – The convex hull of a geometry represents the minimum convex geometry that encloses all geometries within the set. This method implements the SQL/MM specification: SQL-MM 3: 5.1.16
    • ST_CoordDim – Return the coordinate dimension of the ST_Geometry value. This method implements the SQL/MM specification: SQL-MM 3: 5.1.3
    • ST_Crosses – Returns TRUE if the supplied geometries have some, but not all, interior points in common. This method implements the SQL/MM specification: SQL-MM 3: 5.1.29
    • ST_CurveToLine – Converts a CIRCULARSTRING/CURVEDPOLYGON to a LINESTRING/POLYGON This method implements the SQL/MM specification: SQL-MM 3: 7.1.7
    • ST_Difference – Returns a geometry that represents that part of geometry A that does not intersect with geometry B. This method implements the SQL/MM specification: SQL-MM 3: 5.1.20
    • ST_Dimension – The inherent dimension of this Geometry object, which must be less than or equal to the coordinate dimension. This method implements the SQL/MM specification: SQL-MM 3: 5.1.2
    • ST_Disjoint – Returns TRUE if the Geometries do not “spatially intersect” – if they do not share any space together. This method implements the SQL/MM specification: SQL-MM 3: 5.1.26
    • ST_Distance – Returns the 2-dimensional cartesian minimum distance between two geometries in projected units. This method implements the SQL/MM specification: SQL-MM 3: 5.1.23
    • ST_EndPoint – Returns the last point of a LINESTRING geometry as a POINT. This method implements the SQL/MM specification: SQL-MM 3: 7.1.4
    • ST_Envelope – Returns a geometry representing the bounding box of the supplied geometry. This method implements the SQL/MM specification: SQL-MM 3: 5.1.15
    • ST_Equals – Returns true if the given geometries represent the same geometry. Directionality is ignored. This method implements the SQL/MM specification: SQL-MM 3: 5.1.24
    • ST_ExteriorRing – Returns a line string representing the exterior ring of the POLYGON geometry. Return NULL if the geometry is not a polygon. Will not work with MULTIPOLYGON This method implements the SQL/MM specification: SQL-MM 3: 8.2.3, 8.3.3
    • ST_GeomCollFromText – Makes a collection Geometry from collection WKT with the given SRID. If SRID is not give, it defaults to -1. This method implements the SQL/MM specification: ?
    • ST_GeomFromText – Return a specified ST_Geometry value from Well-Known Text representation (WKT). This method implements the SQL/MM specification: SQL-MM 3: 5.1.40
    • ST_GeomFromWKB – Creates a geometry instance from a Well-Known Binary geometry representation (WKB) and optional SRID. This method implements the SQL/MM specification: SQL-MM 3: 5.1.41
    • ST_GeometryFromText – Return a specified ST_Geometry value from Well-Known Text representation (WKT). This is an alias name for ST_GeomFromText This method implements the SQL/MM specification: SQL-MM 3: 5.1.40
    • ST_GeometryN – Return the 1-based Nth geometry if the geometry is a GEOMETRYCOLLECTION, MULTIPOINT, MULTILINESTRING, MULTICURVE or MULTIPOLYGON. Otherwise, return NULL. This method implements the SQL/MM specification: SQL-MM 3: 9.1.5
    • ST_GeometryType – Return the geometry type of the ST_Geometry value. This method implements the SQL/MM specification: SQL-MM 3: 5.1.4
    • ST_InteriorRingN – Return the Nth interior linestring ring of the polygon geometry. Return NULL if the geometry is not a polygon or the given N is out of range. This method implements the SQL/MM specification: SQL-MM 3: 8.2.6, 8.3.5
    • ST_Intersection – Returns a geometry that represents the shared portion of geomA and geomB This method implements the SQL/MM specification: SQL-MM 3: 5.1.18
    • ST_Intersects – Returns TRUE if the Geometries “spatially intersect” – (share any portion of space) and FALSE if they don’t (they are Disjoint). This method implements the SQL/MM specification: SQL-MM 3: 5.1.27
    • ST_IsClosed – Returns TRUE if the LINESTRING’s start and end points are coincident. This method implements the SQL/MM specification: SQL-MM 3: 7.1.5, 9.3.3
    • ST_IsEmpty – Returns true if this Geometry is an empty geometry . If true, then this Geometry represents the empty point set – i.e. GEOMETRYCOLLECTION(EMPTY). This method implements the SQL/MM specification: SQL-MM 3: 5.1.7
    • ST_IsRing – Returns TRUE if this LINESTRING is both closed and simple. This method implements the SQL/MM specification: SQL-MM 3: 7.1.6
    • ST_IsSimple – Returns (TRUE) if this Geometry has no anomalous geometric points, such as self intersection or self tangency. This method implements the SQL/MM specification: SQL-MM 3: 5.1.8
    • ST_IsValid – Returns true if the ST_Geometry is well formed. This method implements the SQL/MM specification: SQL-MM 3: 5.1.9
    • ST_Length – Returns the 2d length of the geometry if it is a linestring or multilinestring. This method implements the SQL/MM specification: SQL-MM 3: 7.1.2, 9.3.4
    • ST_LineFromText – Makes a Geometry from WKT representation with the given SRID. If SRID is not given, it defaults to -1. This method implements the SQL/MM specification: SQL-MM 3: 7.2.8
    • ST_LineFromWKB – Makes a LINESTRING from WKB with the given SRID This method implements the SQL/MM specification: SQL-MM 3: 7.2.9
    • ST_LinestringFromWKB – Makes a geometry from WKB with the given SRID. This method implements the SQL/MM specification: SQL-MM 3: 7.2.9
    • ST_M – Return the M coordinate of the point, or NULL if not available. Input must be a point. This method implements the SQL/MM specification: SQL-MM 3 New standard: ?
    • ST_MLineFromText – Return a specified ST_MultiLineString value from WKT representation. This method implements the SQL/MM specification: SQL-MM 3: 9.4.4
    • ST_MPointFromText – Makes a Geometry from WKT with the given SRID. If SRID is not give, it defaults to -1. This method implements the SQL/MM specification: SQL-MM 3: 9.2.4
    • ST_MPolyFromText – Makes a MultiPolygon Geometry from WKT with the given SRID. If SRID is not give, it defaults to -1. This method implements the SQL/MM specification: SQL-MM 3: 9.6.4
    • ST_NumGeometries – If geometry is a GEOMETRYCOLLECTION (or MULTI*) return the number of geometries, otherwise return NULL. This method implements the SQL/MM specification: SQL-MM 3: 9.1.4
    • ST_NumInteriorRing – Return the number of interior rings of the first polygon in the geometry. Synonym to ST_NumInteriorRings. This method implements the SQL/MM specification: SQL-MM 3: 8.2.5
    • ST_NumInteriorRings – Return the number of interior rings of the first polygon in the geometry. This will work with both POLYGON and MULTIPOLYGON types but only looks at the first polygon. Return NULL if there is no polygon in the geometry. This method implements the SQL/MM specification: SQL-MM 3: 8.2.5
    • ST_NumPoints – Return the number of points in an ST_LineString or ST_CircularString value. This method implements the SQL/MM specification: SQL-MM 3: 7.2.4
    • ST_OrderingEquals – Returns true if the given geometries represent the same geometry and points are in the same directional order. This method implements the SQL/MM specification: SQL-MM 3: 5.1.43
    • ST_Overlaps – Returns TRUE if the Geometries share space, are of the same dimension, but are not completely contained by each other. This method implements the SQL/MM specification: SQL-MM 3: 5.1.32
    • ST_Perimeter – Return the length measurement of the boundary of an ST_Surface or ST_MultiSurface value. (Polygon, Multipolygon) This method implements the SQL/MM specification: SQL-MM 3: 8.1.3, 9.5.4
    • ST_Point – Returns an ST_Point with the given coordinate values. OGC alias for ST_MakePoint. This method implements the SQL/MM specification: SQL-MM 3: 6.1.2
    • ST_PointFromText – Makes a point Geometry from WKT with the given SRID. If SRID is not given, it defaults to unknown. This method implements the SQL/MM specification:SQL-MM 3: 6.1.8
    • ST_PointFromWKB – Makes a geometry from WKB with the given SRID This method implements the SQL/MM specification: SQL-MM 3: 6.1.9
    • ST_PointN – Return the Nth point in the first linestring or circular linestring in the geometry. Return NULL if there is no linestring in the geometry. This method implements the SQL/MM specification: SQL-MM 3: 7.2.5, 7.3.5
    • ST_PointOnSurface – Returns a POINT guaranteed to lie on the surface. This method implements the SQL/MM specification: SQL-MM 3: 8.1.5, 9.5.6. According to the specs, ST_PointOnSurface works for surface geometries (POLYGONs, MULTIPOLYGONS, CURVED POLYGONS). So PostGIS seems to be extending what the spec allows here. Most databases Oracle,DB II, ESRI SDE seem to only support this function for surfaces. SQL Server 2008 like PostGIS supports for all common geometries.
    • ST_Polygon – Returns a polygon built from the specified linestring and SRID. This method implements the SQL/MM specification: SQL-MM 3: 8.3.2
    • ST_PolygonFromText – Makes a Geometry from WKT with the given SRID. If SRID is not give, it defaults to -1. This method implements the SQL/MM specification: SQL-MM 3: 8.3.6
    • ST_Relate – Returns true if this Geometry is spatially related to anotherGeometry, by testing for intersections between the Interior, Boundary and Exterior of the two geometries as specified by the values in the intersectionMatrixPattern. If no intersectionMatrixPattern is passed in, then returns the maximum intersectionMatrixPattern that relates the 2 geometries. This method implements the SQL/MM specification: SQL-MM 3: 5.1.25
    • ST_SRID – Returns the spatial reference identifier for the ST_Geometry as defined in spatial_ref_sys table. This method implements the SQL/MM specification: SQL-MM 3: 5.1.5
    • ST_StartPoint – Returns the first point of a LINESTRING geometry as a POINT. This method implements the SQL/MM specification: SQL-MM 3: 7.1.3
    • ST_SymDifference – Returns a geometry that represents the portions of A and B that do not intersect. It is called a symmetric difference because ST_SymDifference(A,B) = ST_SymDifference(B,A). This method implements the SQL/MM specification: SQL-MM 3: 5.1.21
    • ST_Touches – Returns TRUE if the geometries have at least one point in common, but their interiors do not intersect. This method implements the SQL/MM specification: SQL-MM 3: 5.1.28
    • ST_Transform – Returns a new geometry with its coordinates transformed to the SRID referenced by the integer parameter. This method implements the SQL/MM specification: SQL-MM 3: 5.1.6
    • ST_Union – Returns a geometry that represents the point set union of the Geometries. This method implements the SQL/MM specification: SQL-MM 3: 5.1.19
    • ST_WKBToSQL – Return a specified ST_Geometry value from Well-Known Binary representation (WKB). This is an alias name for ST_GeomFromWKB that takes no srid This method implements the SQL/MM specification: SQL-MM 3: 5.1.36
    • ST_WKTToSQL – Return a specified ST_Geometry value from Well-Known Text representation (WKT). This is an alias name for ST_GeomFromText This method implements the SQL/MM specification: SQL-MM 3: 5.1.34
    • ST_Within – Returns true if the geometry A is completely inside geometry B This method implements the SQL/MM specification: SQL-MM 3: 5.1.30
    • ST_X – Return the X coordinate of the point, or NULL if not available. Input must be a point. This method implements the SQL/MM specification: SQL-MM 3 standard: SQL-MM 3: 6.1.3
    • ST_Y – Return the Y coordinate of the point, or NULL if not available. Input must be a point. This method implements the SQL/MM specification: SQL-MM 3 standard: SQL-MM 3: 6.1.4
    • ST_Z – Return the Z coordinate of the point, or NULL if not available. Input must be a point. This method implements the SQL/MM specification: SQL-MM 3 standard New Spec: ?

    Pages

    About Me

    My photo
    - A competent M.S. Software Engineer and B.E. (Comp) with 6 years of rich experience in Java/ C / C++ / Oracle/PHP/Postgresql/Mysql in IT industry.
    - Resourceful in developing Applications with various platforms and different domains.
    A strategic planner with expertise in designing internal control systems towards the accomplishment of corporate business goals.
    - A keen analyst with exceptional relationship management skills and abilities in liaising with different clients.
    - Team player with excellent analytical and communications skills.
    Worked with development projects with software brands like Cognizant and Infosys
    Specialties
    - Master in struts
    - Good hands on in core Java
    - Understanding of other building blocks of Enterprise applications like middle ware technologies.
    - Knowledge of database like Oracle,postgresql,mysql